*
*/
-#include "Run.h"
-#include "MAPS.h"
-
-
-/**
- * @file
- * @brief Use brief, otherwise the index won't have a brief explanation.
- *
- * Detailed explanation.
- *
- *
- */
-
// bad c- style fix me
-#include "Run.c"
#include "MAPS.c"
+#include "Run.c"
#include "CSVRow.h"
#include "CSVRow.C"
#include <TTimeStamp.h>
+#include <fstream>
Int_t* ReadRunList();
+Int_t ReadRunList(std::vector<int>*);
void plotAllRuns();
void plotAllRuns(TString);
Int_t numberRuns;
Bool_t isBatch = kFALSE;
-void ChargeSpektrum(Int_t runnumber = -1)
+const TString colorwhite = "\033[1;29m";
+const TString colorred = "\033[1;31m";
+const TString coloryellow = "\033[1;33m";
+const TString colorreset = "\033[0m";
+const TString endlr = "\033[0m\n";
+
+void ChargeSpektrum(Int_t runnumber)
+{
+ cout << endl << colorred << "Given parameters have wrong format, please enter integer run numbers devided by '" << colorreset << colorwhite << "," << colorreset << colorred << "' and surrounded by '" << colorreset << colorwhite << "\"" << colorreset << colorred << "'." << endlr;
+ cout << "For example run: root -l 'ChargeSpektrum.c+(\"342815,342816\")'" << endl;
+ exit(1);
+}
+
+void ChargeSpektrum(Int_t runnumber, Int_t runnumber2)
+{
+ cout << endl << colorred << "Given parameters have wrong format, please enter integer run numbers devided by '" << colorreset << colorwhite << "," << colorreset << colorred << "' and surrounded by '" << colorreset << colorwhite << "\"" << colorreset << colorred << "'." << endlr;
+ cout << "For example run: " << colorwhite << "root -l 'ChargeSpektrum.c+(\"342815,342816\")'" << endl;
+ exit(1);
+}
+
+void ChargeSpektrum(TString runnumber = "")
{
cout << endl << endl;
if (gROOT->IsBatch())
isBatch = kTRUE;
numberRuns=0;
- Int_t* runList;
- if (runnumber > 0)
+ std::vector<int> runList;
+ if (runnumber.Length() > 0)
{
- numberRuns=1;
- runList=new Int_t[numberRuns];
- runList[0]=runnumber;
+ if (runnumber.Contains("-"))
+ {
+ TObjArray* runarray = runnumber.Tokenize("-");
+ if (runarray->GetEntries()==2)
+ {
+ TObjString* tempstrobj;
+ tempstrobj=static_cast<TObjString*>(runarray->At(0));
+ if (tempstrobj->GetString().Length()>0)
+ {
+ Int_t tempintstart = tempstrobj->GetString().Atoi();
+ tempstrobj=static_cast<TObjString*>(runarray->At(1));
+ if (tempstrobj->GetString().Length()>0)
+ {
+ Int_t tempintend = tempstrobj->GetString().Atoi();
+ if (tempintend-tempintstart > 0)
+ {
+ for (Int_t i=tempintstart; i <= tempintend; i++)
+ {
+ runList.push_back(i);
+ numberRuns++;
+ }
+ }
+ else
+ cout << coloryellow << "Invalid run number range "<< colorreset << colorwhite << tempintstart << " till " << tempintend << endlr;
+ }
+ else
+ cout << coloryellow << "Invalid run number "<< colorreset << colorwhite << tempstrobj->GetString() << endlr;
+
+ }
+ else
+ cout << coloryellow << "Invalid run number "<< colorreset << colorwhite << tempstrobj->GetString() << endlr;
+ }
+ else
+ {
+ cout << endl << colorred << "Given parameters have wrong format, please enter integer run numbers devided by '" << colorreset << colorwhite << "," << colorreset << colorred << " or 2 runnumbers devided by " << colorreset << colorwhite << "-" << colorreset << colorred << "' and surrounded by '" << colorreset << colorwhite << "\"" << colorreset << colorred << "'." << endlr;
+ cout << "For example run: " << colorwhite << "root -l 'ChargeSpektrum.c+(\"342815,342816\")'" << endl;
+ exit(1);
+ }
+
+ }
+ else
+ {
+ TObjArray* runarray = runnumber.Tokenize(",");
+ if (runarray->GetEntries()>0)
+ {
+ TObjString* tempstrobj;
+ for (Int_t i=0; i < runarray->GetEntries(); i++)
+ {
+ tempstrobj=static_cast<TObjString*>(runarray->At(i));
+ if (tempstrobj->GetString().Length()>0)
+ {
+ Int_t tempint = tempstrobj->GetString().Atoi();
+ if (tempint > 0)
+ {
+ runList.push_back(tempint);
+ numberRuns++;
+ }
+ else
+ cout << coloryellow << "Invalid run number "<< colorreset << colorwhite << tempint << endlr;
+ }
+ else
+ cout << coloryellow << "Invalid run number "<< colorreset << colorwhite << tempstrobj->GetString() << endlr;
+ }
+ }
+ else
+ {
+ cout << endl << colorred << "Given parameters have wrong format, please enter integer run numbers devided by '" << colorreset << colorwhite << "," << colorreset << colorred << "' and surrounded by '" << colorreset << colorwhite << "\"" << colorreset << colorred << "'." << endlr;
+ cout << "For example run: " << colorwhite << "root -l 'ChargeSpektrum.c+(\"342815,342816\")'" << endl;
+ exit(1);
+ }
+ }
}
else
{
/// number of runs to be analyzed, number of lines read by @c ReadRunList()
- numberRuns=0;
- ReadRunList();
- /// array with run numbers
- runList=new Int_t[numberRuns];
- runList=ReadRunList();
+ ReadRunList(&runList);
}
runs = new Run*[numberRuns];
- cout << "Found " << numberRuns << " run(s) in 'runlist.txt'." << endl;
+ cout << "Found " << numberRuns << " run(s) in 'runlist.txt' or given as parameters." << endl;
for(Int_t runi=0;runi<numberRuns;runi++) // loop over runs read from file
{
- runs[runi] = new Run(runList[runi], runi);
- if (runi%2)
+ if (runList[runi]>0)
{
- // check if devided matrix is investigated
- if (runList[runi-1] == runList[runi])
+ runs[runi] = new Run(runList[runi], runi);
+ if (!runs[runi]->error)
{
- cout << "Using devided matrix upper" << endl;
- runs[runi]->dividedmatrix = 1;
- runs[runi]->upperpart = 1;
+ if (runi%2)
+ {
+ // check if devided matrix is investigated
+ if (runList[runi-1] == runList[runi])
+ {
+ cout << "Using devided matrix upper" << endl;
+ runs[runi]->dividedmatrix = 1;
+ runs[runi]->upperpart = 1;
+ }
+ }
+ if (runi+1 < numberRuns)
+ {
+ if (runList[runi] == runList[runi+1] )
+ {
+ cout << "Using devided matrix lower" << endl;
+ runs[runi]->dividedmatrix = 1;
+ runs[runi]->upperpart = 0;
+ }
+ }
+ runs[runi]->setResultsPath("./results/");
+ runs[runi]->useDynamicalNoise(true);
+ // runs[runi]->analyzeFrame(542875); // creates or opens .root file, can analyze the RAW data
+ runs[runi]->error=runs[runi]->analyzeRun(false); // creates or opens .root file, can analyze the RAW data
+ if (!runs[runi]->error)
+ {
+ // gROOT->SetBatch(kTRUE);
+ // runs[runi]->plotSeed();
+ runs[runi]->plotSeedThreshold();
+ // runs[runi]->plotSeed();
+ // runs[runi]->plotSum();
+ // runs[runi]->plotVeto();
+ // runs[runi]->plotNoise();
+ if (!isBatch)
+ gROOT->SetBatch(kFALSE);
+ // runs[runi]->plotAllHistograms();
+ runs[runi]->plotAllHistogramsThresholdCluster();
+ // runs[runi]->plotAllHistogramsCalibrated();
+ runs[runi]->writeAllHistogramsToFile();
+ }
}
}
- if (runi+1 < numberRuns)
- {
- if (runList[runi] == runList[runi+1] )
- {
- cout << "Using devided matrix lower" << endl;
- runs[runi]->dividedmatrix = 1;
- runs[runi]->upperpart = 0;
- }
- }
- runs[runi]->setResultsPath("./results/");
- runs[runi]->useDynamicalNoise(true);
- runs[runi]->analyzeRun(false); // creates or opens .root file, can analyze the RAW data
-// gROOT->SetBatch(kTRUE);
- // runs[runi]->plotSeed();
-// runs[runi]->plotSeedThreshold();
-// runs[runi]->plotSum();
-// runs[runi]->plotVeto();
- // runs[runi]->plotNoise();
- if (!isBatch)
- gROOT->SetBatch(kFALSE);
-// runs[runi]->plotAllHistograms();
- runs[runi]->plotAllHistogramsThresholdCluster();
-// runs[runi]->plotAllHistogramsCalibrated();
- runs[runi]->writeAllHistogramsToFile();
}
plotAllRuns("");
- plotAllRuns("threshold");
+// plotAllRuns("threshold");
}
Int_t* ReadRunList()
{
Int_t* runList=new Int_t[1000];
-
std::ifstream file("runlist.txt");
- CSVRow row;
+ Int_t row;
Int_t runLauf=0;
while (file >> row)
- {
+ {
try
{
- runList[runLauf]=atoi(row[0].c_str());
- runLauf++;
+ if (row > 0)
+ {
+ runList[runLauf]=row;
+ runLauf++;
+ }
}
catch(...)
{
}
+Int_t ReadRunList(std::vector<int>* runlist)
+{
+ std::ifstream file("runlist.txt");
+ Int_t row;
+ while (file >> row)
+ {
+ try
+ {
+ if (row > 0)
+ {
+ runlist->push_back(row);
+ numberRuns++;
+ }
+ }
+ catch(...)
+ {
+ cout << "File ended";
+ }
+ }
+ return numberRuns;
+}
+
+
// void plotNoiseComparison()
// {
//
void plotAllRuns(TString histogramtype)
{
- if (histogramtype.Contains("threshold"))
+ if (histogramtype.Contains("threshold")){
for(Int_t runi=0;runi<numberRuns;runi++) { /* loop over runs read from file */
- runs[runi]->histogrampointer = &runs[runi]->histogramthreshold; }
- else if (histogramtype.Contains("calibrated") || histogramtype.Contains("electron"))
+ runs[runi]->plothistogrampointer = &runs[runi]->histogramthreshold; } }
+ else if (histogramtype.Contains("calibrated") || histogramtype.Contains("electron")) {
for(Int_t runi=0;runi<numberRuns;runi++) /* loop over runs read from file */ {
- runs[runi]->histogrampointer = &runs[runi]->histogramCalibrated; }
- else
+ runs[runi]->plothistogrampointer = &runs[runi]->histogramCalibrated; } }
+ else {
for(Int_t runi=0;runi<numberRuns;runi++) /* loop over runs read from file */ {
- runs[runi]->histogrampointer = &runs[runi]->histogram; }
+ runs[runi]->plothistogrampointer = &runs[runi]->histogram; } }
plotAllRuns();
}
for(Int_t runi=0;runi<numberRuns;runi++) // loop over runs read from file
{
- canvas->cd(1);
- runs[runi]->histogrampointer->Seed->Draw("SAME");
- lastbin = runs[runi]->histogrampointer->Seed->GetBinCenter(runs[runi]->histogrampointer->Seed->FindLastBinAbove(2,1));
- runs[runi]->histogrampointer->Seed->SetAxisRange(0,lastbin*1.1,"X");
- gPad->SetLogy(1);
- legendEntry = Form("%s", runs[runi]->histogrampointer->Seed->GetTitle());
- leg1->AddEntry(runs[runi]->histogrampointer->Veto, legendEntry, "l");
- leg1->Draw("SAME");
- canvas->cd(2);
- runs[runi]->histogrampointer->Sum->Draw("SAME");
- lastbin = runs[runi]->histogrampointer->Sum->GetBinCenter(runs[runi]->histogrampointer->Sum->FindLastBinAbove(2,1));
- runs[runi]->histogrampointer->Sum->SetAxisRange(0,lastbin*1.1,"X");
- canvas->cd(3);
- runs[runi]->histogrampointer->Veto->Draw("SAME");
- runs[runi]->histogrampointer->Veto->SetAxisRange(runs[runi]->histogrampointer->posVeto*0.7,runs[runi]->histogrampointer->posVeto*1.4,"X");
- canvas->cd(4);
- runs[runi]->histogrampointer->Noise->Draw("SAME");
- legendEntry = Form("%s, Noise: %.2f", runs[runi]->labbook.matrix.Data(), runs[runi]->histogrampointer->avgNoise);
- leg2->AddEntry(runs[runi]->histogrampointer->Veto, legendEntry, "l");
- leg2->Draw("SAME");
+ if (runs[runi] != nullptr)
+ {
+ if (!runs[runi]->error)
+ {
+ canvas->cd(1);
+ runs[runi]->plothistogrampointer->Seed->Draw("SAME");
+ lastbin = runs[runi]->plothistogrampointer->Seed->GetBinCenter(runs[runi]->plothistogrampointer->Seed->FindLastBinAbove(2,1));
+ runs[runi]->plothistogrampointer->Seed->SetAxisRange(0,lastbin*1.1,"X");
+ gPad->SetLogy(1);
+ legendEntry = Form("%s", runs[runi]->plothistogrampointer->Seed->GetTitle());
+ leg1->AddEntry(runs[runi]->plothistogrampointer->Veto, legendEntry, "l");
+ leg1->Draw("SAME");
+ canvas->cd(2);
+ runs[runi]->plothistogrampointer->Sum->Draw("SAME");
+ lastbin = runs[runi]->plothistogrampointer->Sum->GetBinCenter(runs[runi]->plothistogrampointer->Sum->FindLastBinAbove(2,1));
+ runs[runi]->plothistogrampointer->Sum->SetAxisRange(0,lastbin*1.1,"X");
+ canvas->cd(3);
+ runs[runi]->plothistogrampointer->Veto->Draw("SAME");
+ runs[runi]->plothistogrampointer->Veto->SetAxisRange(runs[runi]->plothistogrampointer->posVeto*0.7,runs[runi]->plothistogrampointer->posVeto*1.4,"X");
+ canvas->cd(4);
+ runs[runi]->plothistogrampointer->Noise->Draw("SAME");
+ legendEntry = Form("%s, Noise: %.2f", runs[runi]->labbook.matrix.Data(), runs[runi]->plothistogrampointer->avgNoise);
+ leg2->AddEntry(runs[runi]->plothistogrampointer->Veto, legendEntry, "l");
+ leg2->Draw("SAME");
+ }
+ }
}
// canvas -> Print( runs[0]->savepathresults + "/" + canvastitle + ".eps");
*
*
*/
-
+#ifndef __MAPS__C
+#define __MAPS__C
#include"MAPS.h"
#include "Run.h"
MAPS::MAPS(Run* runp) {
run = runp;
- initMapsRun();
-
- // check if sepcified system is correct, if not, switch and reinitialize
- if ( switchsystem() )
+ error = initMapsRun();
+ if (!error)
{
- if (run->labbook.system.EqualTo("USB"))
+ // check if sepcified system is correct, if not, switch and reinitialize
+ if ( switchsystem() )
{
- run->labbook.system = Form("PXI");
- }
- else
- {
- run->labbook.system = Form("USB");
+ if (run->labbook.system.EqualTo("USB"))
+ {
+ run->labbook.system = Form("PXI");
+ }
+ else
+ {
+ run->labbook.system = Form("USB");
+ }
+ run->setSystemSpecificParameters();
+ error = initMapsRun( );
}
- run->setSystemSpecificParameters();
- initMapsRun( );
- } sleep(1); // TODO test if removable
+ }
}
//Check and open Data Files
int MaxFiles = TMath::Ceil((Float_t) FileTotalEvNbInConfig/FileEvNbInConfig);
if( checkDataFiles(MaxFiles) )
- {
fOutputFile = new TFile(fRootFile,"RECREATE");
+ {
// Hit TTree
fHitTree = new TTree("hit", "hit");
fHitTree->Branch("frame" , &fFrameInfo.frame , "frame/i" , 32000);
fInn[i].close();
}
- cout << "Bevor delete MAPS Arrays! " << endl;
delete[] fEvents;
delete[] fF0matrix;
delete[] fF1matrix;
delete[] fCdsmatrix;
delete[] fNoise;
delete[] fPedestals;
- cout << "Nach delete MAPS Arrays! " << endl;
- cout<<"================================================================="<<endl;
+ cout<< colorwhite <<"================================================================="<<endlr;
};
void MAPS::save() {
if(fSave && fOk)
{
+ cout<<"----------------------------------------------------------------"<<endl;
+ cout << " Frames with suspicious pedestial value: " << fPedestalhighFrames << " out of " << fEventsSum << " (" << (1.0*fPedestalhighFrames/fEventsSum*100) << " %%)" << endl;
+ cout << " Pixel with suspicious pedestial value: " << fPedestalhighPixel << " out of " << fEventsSum*fPixels<< " (" << (1.0*fPedestalhighPixel/(fEventsSum*fPixels)*100) << " %%)" << endl;
+ cout << " Frames with suspicious noise value: " << fNoiseHighFrames << " out of " << fEventsSum << " (" << (1.0*fNoiseHighFrames/fEventsSum*100) << " %%)" << endl;
+ cout << " Pixel with suspicious pedestial value: " << fNoiseHighPixel << " out of " << fEventsSum*fPixels<< " (" << (1.0*fNoiseHighPixel/(fEventsSum*fPixels)*100) << " %%)" << endl;
+ cout<<"----------------------------------------------------------------"<<endl;
+
fOutputFile->cd();
fHitTree->Write("",TObject::kOverwrite);
//####################################################################
-void MAPS::initMapsRun( ) {
+Bool_t MAPS::initMapsRun( ) {
//
fInDir=run->storepathRAWLinux;
fOutDir = run->storepathRAWLinux; // default ouput directory is input directory
value1[vi][vj] = (vj*16 + (vi & 0xF0) / 16);
}
}
+
+ ifstream inn(fConfigFile, ios::binary);
+ if( !inn.good() )
+ {
+ cout<<"-----------------------"<<endl;
+ cout << colorred << "Configuration file not found: " ;
+ cout << fConfigFile;
+ cout << endlr;
+ cout << " -- STOP -- " << endl;
+ return true;
+ }
+
+ return false;
//-----------------------------------------------
}
inn.close();
NrAdcBoards = littleEndian32( RAWDATA, 4*9); // Number of Adc boards installed in the system
-
+
if( fSystem == "" )
{
if( NrAdcBoards == 1) {
cout << endl;
cout << " -- STOP -- " << endl;
- exit(-1);
+ return false;
}
return false;
}
+
+
bool MAPS::checkConf( Int_t &PixelData ) {
UInt_t DataSz;
NrAdcBoards = littleEndian32( RAWDATA, 4*9); ///< Number of Adc boards installed in the system
PixelData = DataSz/4;
-
+
TString System[5] = {"","","USB","","PXI"};
if( fSystem == "" )
{
// Frames = countframes;
Frames = End/(4*(fPixelsData+29));
//-----------------------------------------------
- cout<<setw(25)<<right<<Form("RUN_%i_%i.rz --> ",fRunNumber,FileNr)<<left;
-
- if (End/(TMath::Power(2,40)) >= 1) {
- printf("%6.2f TB ", (Float_t)(End/(TMath::Power(2,40))) );
- }
- else if (End/(TMath::Power(2,30)) >= 1) {
- printf("%6.2f GB ", (Float_t)(End/(TMath::Power(2,30))) );
- }
- else if (End/(TMath::Power(2,20)) >= 1) {
- printf("%6.2f MB ", (Float_t)(End/(TMath::Power(2,20))) );
- }
- else if (End/(TMath::Power(2,10)) >= 1) {
- printf("%6.2f kB ", (Float_t)(End/(TMath::Power(2,10))) );
- }
- else {
- printf("%6.2f B ", (Float_t)(End));
- }
-
- cout<<setw(15)<<left<<Form("%7i Frames",Frames);
+// cout<<setw(25)<<right<<Form("RUN_%i_%i.rz --> ",fRunNumber,FileNr)<<left;
+//
+// if (End/(TMath::Power(2,40)) >= 1) {
+// printf("%6.2f TB ", (Float_t)(End/(TMath::Power(2,40))) );
+// }
+// else if (End/(TMath::Power(2,30)) >= 1) {
+// printf("%6.2f GB ", (Float_t)(End/(TMath::Power(2,30))) );
+// }
+// else if (End/(TMath::Power(2,20)) >= 1) {
+// printf("%6.2f MB ", (Float_t)(End/(TMath::Power(2,20))) );
+// }
+// else if (End/(TMath::Power(2,10)) >= 1) {
+// printf("%6.2f kB ", (Float_t)(End/(TMath::Power(2,10))) );
+// }
+// else {
+// printf("%6.2f B ", (Float_t)(End));
+// }
+//
+// cout<<setw(15)<<left<<Form("%7i Frames",Frames);
if (Frames != FileEvNbInConfig && Frames >= 20000)
- cout << "\033[1;31mRun could be corrupted, number of events in file doesn't match configuration! ("<< Frames << " != " << FileEvNbInConfig << ") \033[0m\n";
+ cout << colorred << "Run could be corrupted, number of events in file doesn't match configuration! ("<< Frames << " != " << FileEvNbInConfig << ")" << endlr;
// cout<<setw(15)<<left<<Form("%7i Pixels",Pixels);
cout<<endl;
//-----------------------------------------------
Int_t* nframescutawaythirdnoiseestimate = new Int_t[fPixels]();
Int_t npixelscutawaythirdnoiseestimate=0;
+
+
+
// fDynNoiseTree->Branch("frame" , &fFrameNumber , "frame/i" , 32000);
// fDynNoiseTree->Branch("noise" , &fNoiseMean , "noise/F" , 32000);
// fDynNoiseTree->Branch("pedestal" , &fPedestalsMean , "pedestal/F" , 32000);
cout << endl;
}
+
bool MAPS::regetDynNoise(Int_t Frames) {
+ Bool_t pedestalhighinthisframe = false;
+ Bool_t noisehighinthisframe = false;
for(Int_t pixeli=0; pixeli<fPixels; pixeli++)
{
// if (fHittedPixel[fColumns]==0)
CDSlastframes[pixeli].push(fCdsmatrix[pixeli]);
if (abs(fPedestals[pixeli])>20)
{
- cout<<"\rFrame: "<<fFrameNumber<< " row: " << (Int_t)pixeli/fColumns << " Pedestial of pixel: " << fPedestals[pixeli] << " --> Pdestial suspiciously high!"<<endl;
+ fPedestalhighPixel++;
+ if (!pedestalhighinthisframe) {
+ fPedestalhighFrames++;
+ pedestalhighinthisframe=true;
+ }
+// cout<<"\rFrame: "<<fFrameNumber<< " row: " << (Int_t)pixeli/fColumns << " Pedestial of pixel: " << fPedestals[pixeli] << " --> Pedestal suspiciously high!"<<endl;
// cout<<" CDS signal of sensor: ";
// debugStream<>(fCdsmatrix , fPixels, fColumns, 1, 20);
// cout<<" Pedestial of sensor: ";
}
if (abs(fNoise[pixeli])>20)
{
- cout <<"\rFrame: "<<fFrameNumber<< " row: " << (Int_t)pixeli/fColumns << " Noise of pixel: " << fNoise[pixeli] << " --> Noise suspiciously high! "<<endl;
+ fNoiseHighPixel++;
+ if (!noisehighinthisframe) {
+ fNoiseHighFrames++;
+ noisehighinthisframe=true;
+ }
+// cout <<"\rFrame: "<<fFrameNumber<< " row: " << (Int_t)pixeli/fColumns << " Noise of pixel: " << fNoise[pixeli] << " --> Noise suspiciously high! "<<endl;
// cout<<" CDS signal of sensor: ";
// debugStream<>(fCdsmatrix , fPixels, fColumns, 1, 20);
// cout<<" Noise of sensor: ";
// cout << "Skipped pixel " << pixeli << " for noise calc" << endl;
}
}
+ if (pedestalhighinthisframe)
+ cout<<"\rFrame: "<<fFrameNumber<< " --> Pedestal suspiciously high!"<<endl;
+ if (noisehighinthisframe)
+ cout<<"\rFrame: "<<fFrameNumber<< " --> Noise suspiciously high!"<<endl;
if (fFrameNumber%Frames == 0 && RefillNoiseBranch)
{
if(fSave)
}
//####################################################################
+#endif
/// Array mit der Größe Pixel * Frames, enthält CDS Werte
Float_t* fDynFrameArr;
/// Irgendein Array mit Grüße fPixels
- Int_t* fDynCounter;
+ Int_t* fDynCounter;
+
+ /// how many pixel exceeded a suspecious pedestal limit
+ unsigned long fPedestalhighPixel = 0;
+ /// how many pixel exceeded a suspecious noise limit
+ unsigned long fNoiseHighPixel = 0;
+ /// in how many frames minimum one pixel exceeded a suspecious pedestal limit
+ unsigned long fPedestalhighFrames = 0;
+ /// in how many frames minimum one pixel exceeded a suspecious noise limit
+ unsigned long fNoiseHighFrames = 0;
/// Array of file handlers for each RAW files, filled in @c checkDataFiles()
ifstream* fInn;
const static int numberofframesfornoise =100;
+
+
/// full path in LINUX style to the .root file, all hit information is stored there
TString fRootFile;
/// full path in LINUX style to the .rz file, all run configuration is stored there
* If the RAW files indicate, that the runs are done with another system then stated in the config files, the system in the config file is ignored and
* a warning is printed, for this @c switchsystem() is called.
*/
- void initMapsRun( TString, TString, Int_t, Int_t, Int_t, TString, TString, Int_t, bool);
+ Bool_t initMapsRun( TString, TString, Int_t, Int_t, Int_t, TString, TString, Int_t, bool);
/**
* If the RAW files indicate, that the runs are done with another system then stated in the config files, the system in the config file is ignored and
* a warning is printed, for this @c switchsystem() is called.
*/
- void initMapsRun();
+ Bool_t initMapsRun();
/**
* @brief initializes ROOT file structure, if fSave is set to true
~MAPS (void);
+ /// is set to true if somewhere a critical error occurs
+ Bool_t error = false;
+
+
/**
* @brief Checks RAW data files and creates a new ROOT file
*
/// Pointer to the ROOT TTree of the run containing the noise, only used if external noise used
TTree* fNoiseTree;
+
/**
* @brief Calculates a first estimate of the noise and pedestial of each pixel in #frames
*
* @return true if no errors occured
*/
bool regetDynNoise (Int_t Frames = numberofframesfornoise);
- /**
- * @brief Old routine, shoould be deletable without side effects */
- bool regetDynNoise2 ();
+
/**
* @brief Old routine, should load noise information from given runnumber root file
*
*
*
*/
+#ifndef __RUN__C
+#define __RUN__C
#include "Run.h"
using namespace std;
Run::Run(Int_t runnumber, Int_t loopi)
{
plotStyle = loopi%13;
+ gethostname(hostname, 1024);
labbook.runnumber = runnumber;
random1 = new TRandom;
random1->SetSeed(0);
// replace windows drive notation with linux style
if (labbook.storepath.Length() > 0)
{
+
storepathRAWLinux = labbook.storepath;
// storepathRAWLinux = storepathRAWLinux.ReplaceAll("H:","/jspc53_H");
// storepathRAWLinux = storepathRAWLinux.ReplaceAll("h:","/jspc53_H");
- storepathRAWLinux = storepathRAWLinux.ReplaceAll("H:","/d/garlic");
- storepathRAWLinux = storepathRAWLinux.ReplaceAll("h:","/d/garlic");
- storepathRAWLinux = storepathRAWLinux.ReplaceAll("U:","/jspc53_U");
- storepathRAWLinux = storepathRAWLinux.ReplaceAll("u:","/jspc53_U");
+ storepathRAWLinux = storepathRAWLinux.ReplaceAll("H:","/d/jspc53_H");
+ storepathRAWLinux = storepathRAWLinux.ReplaceAll("h:","/d/jspc53_H");
+ if (TString(hostname).EqualTo("jspc48"))
+ {
+ storepathRAWLinux = storepathRAWLinux.ReplaceAll("U:","/d/jspc28/jspc53_U");
+ storepathRAWLinux = storepathRAWLinux.ReplaceAll("u:","/d/jspc28/jspc53_U");
+ }
+ else
+ {
+ storepathRAWLinux = storepathRAWLinux.ReplaceAll("U:","/jspc53_U");
+ storepathRAWLinux = storepathRAWLinux.ReplaceAll("u:","/jspc53_U");
+ }
storepathRAWLinux = storepathRAWLinux.ReplaceAll("F:","/jspc12_F");
storepathRAWLinux = storepathRAWLinux.ReplaceAll("f:","/jspc12_F");
storepathRAWLinux = storepathRAWLinux.ReplaceAll("O:","/d/garlic");
initRootParameters();
cout << colorwhite << "initHistograms():" << endlr;
initHistograms(&histogram);
- histogrampointer = &histogram;
+ plothistogrampointer = &histogram;
initHistograms(&histogramthreshold, " threshold");
runexistsinDB = 1;
debugDBreadout();
else
{
cout << "\033[1;31mNo database data for run " << numberToString<>(labbook.runnumber) << " found!\033[0m" << endl;
+ error = 1;
}
}
catch(...)
{
cout << "\033[1;31mError while reading laboratory book (run number " << numberToString<>(labbook.runnumber) << ")!\033[0m\n";
+ error = 1;
}
}
{
cout << colorwhite << "instatiate MAPS(this)" << endlr;
processed = new MAPS(this);
- if (!runAllreadyAnalyzed() || force)
+ error = processed->error;
+ if (!error)
{
- processed->initNewRootFile();
- /// progress meter, temporal variable
- ULong_t progress_tmp=-1;
- /// progress meter
- Float_t progress;
- processed->InitialDynNoise();
- int start = 0;
- int nframes = processed->GetNumberFrames();
- for(int i=0; i<nframes;i++) // TODO remove 100000
+ if (!runAllreadyAnalyzed() || force)
{
- processed->getFrame(i);
-// processed->filterCommonMode();
- processed->hitana();
- if (dynamicalNoise)
- processed->regetDynNoise();
- progress = (Int_t)(((i-start)*100)/(nframes-1)*10);
- if (progress!=progress_tmp) { print_progress( (((i-start)*100.)/(nframes-1)) ); progress_tmp=progress;}
- }
-// cout << processed->plus << " vs. " << processed->minus << " : " << (processed->plus*1.0)/processed->minus<< endl;
+ if (processed->initNewRootFile()) return 1;
+ /// progress meter, temporal variable
+ ULong_t progress_tmp=-1;
+ /// progress meter
+ Float_t progress;
+ processed->InitialDynNoise();
+ int start = 0;
+ int nframes = processed->GetNumberFrames();
+ for(int i=0; i<nframes;i++) // TODO remove 100000
+ {
+ // cout << "getframe " << i << endl;
+ processed->getFrame(i);
+ // processed->filterCommonMode();
+ // cout << "hitana " << endl;
+ processed->hitana();
+ // cout << "regetDynNoise " << endl;
+ if (dynamicalNoise)
+ processed->regetDynNoise();
+ progress = (Int_t)(((i-start)*100)/(nframes-1)*10);
+ if (progress!=progress_tmp) { print_progress( (((i-start)*100.)/(nframes-1)) ); progress_tmp=progress;}
+ }
+ // cout << processed->plus << " vs. " << processed->minus << " : " << (processed->plus*1.0)/processed->minus<< endl;
- // print a dummy file to indicate, that a root file was created once
- fstream* fout = new fstream(storepathRAWLinux + "/rootfilecreated",std::ios::out);
- *fout << "" << endl;
- fout->close();
- processed->save();
- }
- else
- {
- cout << "Skipped analysis of run " << labbook.runnumber << ", I think the root file for this run allready exists." << endl;
- cout << colorwhite << "initOldRootFile():" << endlr;
+ // print a dummy file to indicate, that a root file was created once
+ fstream* fout = new fstream(storepathRAWLinux + "/rootfilecreated",std::ios::out);
+ *fout << "" << endl;
+ fout->close();
+ processed->save();
+ }
+ else
+ {
+ cout << "Skipped analysis of run " << labbook.runnumber << ", I think the root file for this run allready exists." << endl;
+ cout << colorwhite << "initOldRootFile():" << endlr;
+ }
}
-
if (!error)
{
- error = processed->initOldRootFile();
+ if (processed->initOldRootFile()) return 1;
cout << colorwhite << "binNoise():" << endlr;
binNoise();
cout << colorwhite << "binSeedSumVeto():" << endlr;
calculteCCE();
cout << colorwhite << "updateDatabase():" << endlr;
updateDatabase();
- cout << colorwhite << "delete processed:" << endlr;
+ cout << colorwhite << "delete MAPS class:" << endlr;
delete processed;
- return true;
+ return 0;
}
delete processed;
}
- return false;
+ return 1;
}
Bool_t Run::calculteCCE()
Float_t posMax = 0;
Float_t posMax2 = 0;
Float_t posMaxValHist = histogrampointer->GetXaxis()->GetXmax();
- Float_t noiseborder = posMaxValHist/15;
+ Float_t noiseborder = posMaxValHist/10; // for USB system, the value is 90
if (doFits)
{
TString humanreadablestr = Form("%s, %s spectrum, Mi%s, chip %s, %s, T=%.1f",prefix.Data(), labbook.source.Data(), labbook.chipGen.Data(), labbook.chip.Data(), labbook.matrix.Data(), labbook.temp);
histogrampointer=new TH1F(prefix.Data(), humanreadablestr.Data(), systemparamcur.nbins, 0, systemparamcur.maxbin);
histogrampointer->SetLineStyle(rootlinestyle[plotStyle]);
- cout << "prefix: " << prefix << " rootcolor: " << rootcolors[plotStyle] << endl;
histogrampointer->SetLineColor(rootcolors[plotStyle]);
histogrampointer->SetStats(kTRUE);
histogrampointer->SetStats(111111111);
rootlinestyle = new Int_t[13]{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
}
+#endif
#define SERVERUSER "radhard"
#define SERVERPWD "mimosa88"
-#include "MAPS.h"
+#include "MAPS.c"
class MAPS;
/**
/// is set to true if the RAW Data is consistent
Bool_t runRAWok = 0;
-
- /// is set to true if an error occured
- Bool_t error = 0;
-
+
TRandom* random1;
+ /// host name of the machine, used to find correct mount points
+ char hostname[1024];
+
/**
* @brief fills noise #histogram */
Bool_t binNoise();
};
systemparam systemparamUSB {
900, // maxbin;
- 900/15,// nbins;
+ 900/5,// nbins;
25, //vetothreshold
10,
100
/** @brief Makes a gnuplot file to plot the histogram data created in @c writeAllHistogramsToFile() */
void MakeGnuplotFile();
+ /// is set to true if an error occured
+ Bool_t error = 0;
+
/**
* @brief analysis the RAW data
*
histogramstruct histogram;
histogramstruct histogramCalibrated;
histogramstruct histogramthreshold;
- histogramstruct* histogrampointer;
+ histogramstruct* plothistogrampointer;
/** @brief Plots all histograms from #histogram into one canvas */
Bool_t plotAllHistograms(histogramstruct*);