runs[runi]->plot1DHistogram(runs[runi]->histogram->calibrated, runs[runi]->histogram->Seed, "landau");
runs[runi]->plot1DHistogram(runs[runi]->histogram->calibrated, runs[runi]->histogram->calibrated->Seed, "landau");
compareHistogramClassVector.push_back(runs[runi]->histogram->calibrated);
+ compareHistogramVector.push_back(runs[runi]->histogram->Seed);
// runs[runi]->integrateSr90Spectra(&runs[runi]->histogramfixedthresholdCalibrated, runs[runi]->histogramfixedthresholdCalibrated.Seed, 0);
// runs[runi]->plot1DHistogram(&runs[runi]->histogramfixedthresholdCalibrated, runs[runi]->histogramfixedthresholdCalibrated.Seed, "landau");
// runs[runi]->plot1DHistogram(&runs[runi]->histogramthresholdCalibrated, runs[runi]->histogramthresholdCalibrated.Seed, "landau");
}
}
plotAllRuns();
+ writeObservableToFile();
// plotAllRuns("seed threshold calibrated");
// setCustomPath("Excel/");
// writeObservableToFile("seed threshold calibrated");
Int_t* ReadRunList();
Int_t ReadRunList(std::vector<int>*);
Bool_t plotAllRuns();
-Bool_t plotAllRuns(TString);
-Bool_t writeObservableToFile(TString);
+/** @brief A function to plot TH1F histograms of different runs into one file
+ *
+ * You push in #ChargeSpectrum.c a pointer of the type TH1F into the vector #compareHistogramVector and then
+ * you can compare different histograms of the different runs.
+ *
+ * Call #writeObservableToFile() in #ChargeSpectrum.c to create a file with all the TH1F histogram data
+ *
+ */
Bool_t writeObservableToFile();
-void writeObservableToFileHistSelect(TString);
/** @brief A vector able to hold pointer of type #Run::histogramstruct
*
* You push in pointer of the type Run::histogramstruct in ChargeSpectrum.C and then
*
*/
vector<HistogramType*> compareHistogramClassVector;
+vector<TH1F*> compareHistogramVector;
TString ownpath = "";
}
-// void plotNoiseComparison()
-// {
-//
-// }
-
-Bool_t writeObservableToFile(TString histogramtype)
-{
- if (histogramtype.Contains("threshold"))
- {
- if (histogramtype.Contains("calibrated"))
- {
- for(Int_t runi=0;runi<numberRuns;runi++)/* loop over runs read from file */
- {
- if (runs[runi]->histogramthreshold->iscalibrated)
- runs[runi]->plothistogramclasspointer = runs[runi]->histogramthreshold->calibrated;
- else
- return 1;
- }
- }
- else
- {
- for(Int_t runi=0;runi<numberRuns;runi++)/* loop over runs read from file */
- runs[runi]->plothistogramclasspointer = 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 */ {
- if (runs[runi]->histogram->iscalibrated)
- runs[runi]->plothistogramclasspointer = runs[runi]->histogram->calibrated;
- else return 1; } }
- else {
- for(Int_t runi=0;runi<numberRuns;runi++) /* loop over runs read from file */ {
- runs[runi]->plothistogramclasspointer = runs[runi]->histogram; } }
- writeObservableToFileHistSelect(histogramtype);
- return 0;
-}
-void writeObservableToFileHistSelect(TString histogramtype)
-{
- if (histogramtype.Contains("Seed") || histogramtype.Contains("seed")) {
- for(Int_t runi=0;runi<numberRuns;runi++)/* loop over runs read from file */ {
- runs[runi]->plothistogrampointer = runs[runi]->plothistogramclasspointer->Seed; } }
- else if (histogramtype.Contains("Sum") || histogramtype.Contains("sum")) {
- for(Int_t runi=0;runi<numberRuns;runi++)/* loop over runs read from file */ {
- runs[runi]->plothistogrampointer = runs[runi]->plothistogramclasspointer->Sum; } }
- else if (histogramtype.Contains("Veto") || histogramtype.Contains("veto")) {
- for(Int_t runi=0;runi<numberRuns;runi++) /* loop over runs read from file */ {
- runs[runi]->plothistogrampointer = runs[runi]->plothistogramclasspointer->Veto; } }
- else {
- for(Int_t runi=0;runi<numberRuns;runi++) /* loop over runs read from file */ {
- runs[runi]->plothistogrampointer = runs[runi]->plothistogramclasspointer->Seed; } }
- writeObservableToFile();
-}
-
Bool_t writeObservableToFile()
{
- system("mkdir "+ runs[0]->savepathresults + " -p");
- TString headerInfo = "";
- for(Int_t runi=0;runi<numberRuns;runi++) // loop over runs read from file
- {
- headerInfo+=runs[runi]->runcode+"\t\t\t";
- }
- TH1F* plothistogrampointer = runs[0]->plothistogrampointer;
- TString runnumberListe="";
- TString header="";
- for(Int_t runi=0;runi<numberRuns;runi++) // loop over runs read from file
- {
- if (runs[runi] != nullptr)
- {
- if (!runs[runi]->error)
- {
- plothistogrampointer = runs[runi]->plothistogrampointer;
- runnumberListe+=Form("%d_",runs[runi]->labbook.runnumber);
- header+=Form("%d\t%s\t\t\t", runs[runi]->labbook.runnumber, plothistogrampointer->GetName());
- }
- }
- }
- TString filename= runs[0]->savepathresults + "/" + ownpath + runnumberListe + Form("%s",plothistogrampointer->GetName())+"histograms.dat";
- fstream* fout = new fstream(filename,ios::out);
- *fout << headerInfo << endl;
- *fout << header << endl;
- for(Int_t bini=0;bini<plothistogrampointer->GetNbinsX();bini++)
+ if (numberRuns>0)
{
+ system("mkdir "+ runs[0]->savepathresults + " -p");
+
+ TString filename = runs[0]->savepathresults + "/Spectra";
+ TString header = "";
for(Int_t runi=0;runi<numberRuns;runi++) // loop over runs read from file
{
if (runs[runi] != nullptr)
{
if (!runs[runi]->error)
{
- plothistogrampointer = runs[runi]->plothistogrampointer;
- TString outline;
- Double_t binContentNorm=plothistogrampointer->GetBinContent(bini)/runs[runi]->labbook.frames_foundDB*10000000;
- Double_t binSumme=0.0;
- for(Int_t binSummei=bini;binSummei<plothistogrampointer->GetNbinsX();binSummei++)//Sum up from bini beginning (cut condition for detection eff.)
- {
- Double_t binContentNormInSumme=plothistogrampointer->GetBinContent(binSummei)/runs[runi]->labbook.frames_foundDB*10000000;
- binSumme=binSumme+binContentNormInSumme;
- }
- outline=Form("%.1f\t%.1f\t%.1f\t%.1f\t",plothistogrampointer->GetBinCenter(bini),plothistogrampointer->GetBinContent(bini),binContentNorm,binSumme);
- *fout<<outline;
+ filename+= Form("_%d",runs[runi]->labbook.runnumber);
+ header += Form("#%s %lu frames\n", runs[runi]->runcode.Data(), runs[runi]->frames_found);
}
}
}
- *fout<<endl;
- }
- fout->close();
-
+ filename+=".dat";
+ fstream* fout = new fstream(filename,ios::out);
+ header += Form("#");
+ for (vector<TH1F*>::iterator curHistogram = compareHistogramVector.begin(); curHistogram != compareHistogramVector.end(); curHistogram++) {
+ header += Form("bin\t%s\t",(*curHistogram)->GetName());
+ }
+ *fout << header << endl;
+ TString outline;
+ for(Int_t bin=1;bin<=runs[0]->cursystemparam.nbins;bin++)
+ {
+ outline ="";
+ for (vector<TH1F*>::iterator curHistogram = compareHistogramVector.begin(); curHistogram != compareHistogramVector.end(); curHistogram++) {
+ outline+=Form("%.1f\t%.1f\t", (*curHistogram)->GetBinCenter(bin), (*curHistogram)->GetBinContent(bin));
+ }
+ *fout<<outline<<endl;
+ }
+ fout->close();
+ return 0;
+
+ }
return 0;
}
}
-HistogramType::HistogramType(TString suffix, systemparam* gotsystempar, sensorinfostruct* gotsensorinfo, TString gothumanreadablestr, Int_t gotcolor, Int_t gotstyle ) {
+HistogramType::HistogramType(TString suffix, systemparam* gotsystempar, sensorinfostruct* gotsensorinfo, TString gothumanreadablestr, Int_t gotrunnumber, Int_t gotcolor, Int_t gotstyle ) {
histogramdescription = suffix;
humanreadablestr = gothumanreadablestr;
cursystempar = gotsystempar;
+ runnumber = gotrunnumber;
cursensorinfo = gotsensorinfo;
initHistograms(gotcolor, gotstyle);
};
}
void HistogramType::initHistogram(TH1F* &histogrampointer, TString prefix, Int_t color, Int_t style) {
- histogrampointer=new TH1F(prefix.Data(), Form("%s, %s",prefix.Data(), humanreadablestr.Data()), cursystempar->nbins, 0, cursystempar->maxbin);
+ histogrampointer=new TH1F(Form("%d %s",runnumber, prefix.Data()), Form("%s, %s",prefix.Data(), humanreadablestr.Data()), cursystempar->nbins, 0, cursystempar->maxbin);
histogrampointer->SetLineStyle(style);
histogrampointer->SetLineColor(color);
histogrampointer->SetStats(kTRUE);
~HistogramType(void);
/** @brief constructor */
- HistogramType(TString suffix, systemparam* gotsystempar, sensorinfostruct* gotsensorinfo, TString gothumanreadablestr, Int_t gotcolor=0, Int_t gotstyle=0);
+ HistogramType(TString suffix, systemparam* gotsystempar, sensorinfostruct* gotsensorinfo, TString gothumanreadablestr="", Int_t gotrunnumber=0, Int_t gotcolor=0, Int_t gotstyle=0);
//*****************
// TH HISTOGRAMS
//*****************
/// A string representing the current run database information in a human readable format
TString humanreadablestr="";
+ /// Runnumber provided by Run.c from the database, used for names of histograms
+ Int_t runnumber = 0;
/// type in here what the histogram is intended for or how it is calculated, will be added to filenames
TString histogramdescription = "";
/// The gain used to rescale the histograms
cout << colorwhite << "init Histogram classes:" << endlr;
// default histogram class, no special cuts applied
- histogram = new HistogramType("", &cursystemparam, &cursensorinfo, humanreadablestr, rootcolors[plotStyle], rootlinestyle[plotStyle] );
+ histogram = new HistogramType("", &cursystemparam, &cursensorinfo, humanreadablestr, labbook.runnumber, rootcolors[plotStyle], rootlinestyle[plotStyle] );
HistogramClassVector.push_back(histogram);
// dynamical cluster threshold cut
- histogramthreshold = new HistogramType(" Threshold", &cursystemparam, &cursensorinfo, humanreadablestr, rootcolors[plotStyle], rootlinestyle[plotStyle] );
+ histogramthreshold = new HistogramType(" Threshold", &cursystemparam, &cursensorinfo, humanreadablestr, labbook.runnumber, rootcolors[plotStyle], rootlinestyle[plotStyle] );
HistogramClassVector.push_back(histogramthreshold);
// fixed threshold cut
- histogramfixedthreshold = new HistogramType(" fixed Threshold", &cursystemparam, &cursensorinfo, humanreadablestr, rootcolors[plotStyle], rootlinestyle[plotStyle] );
+ histogramfixedthreshold = new HistogramType(" fixed Threshold", &cursystemparam, &cursensorinfo, humanreadablestr, labbook.runnumber, rootcolors[plotStyle], rootlinestyle[plotStyle] );
HistogramClassVector.push_back(histogramfixedthreshold);
// dennis megacut
- dennismegacut = new HistogramType(" Dennis Mega Cut", &cursystemparam, &cursensorinfo, humanreadablestr, rootcolors[plotStyle], rootlinestyle[plotStyle] );
+ dennismegacut = new HistogramType(" Dennis Mega Cut", &cursystemparam, &cursensorinfo, humanreadablestr, labbook.runnumber, rootcolors[plotStyle], rootlinestyle[plotStyle] );
HistogramClassVector.push_back(dennismegacut);
debugDBreadout();
u_int submatrix_y_start;
/// If you set this variable to a value, #Run::binSeedSumVeto() and #Run::binCluster() will only account for hits in given range
u_int submatrix_y_end;
-
- /// number of frames found in given folder
- ULong_t frames_found = 0;
-
+
/**
* @brief Generates a human readable string with information about the run
*
TString storepathOutLinux = "/d/garlic/Mi34/rootFiles";
/// path to the RAW files on LINUX systems
TString savepathresults = ".";
+ /// number of frames found in given folder
+ ULong_t frames_found = 0;
TFile* rootfile;
HistogramType* histogram;
HistogramType* histogramthreshold;
HistogramType* histogramfixedthreshold;
- HistogramType* plothistogramclasspointer;
HistogramType* dennismegacut;
- TH1F* plothistogrampointer;
///
/** @brief A vector able to hold pointer of type #Run::histogramstruct
*