tempstrobj=static_cast<TObjString*>(runarray->At(1));
if (tempstrobj->GetString().Length()>0)
{
- TString tempstrend = tempstrobj->GetString().ReplaceAll("!","");
+ TString tempstrend = tempstrobj->GetString();
+ tempstrend = tempstrend.ReplaceAll("!", "");
Int_t tempintend = tempstrend.Atoi();
if (tempintend-tempintstart > 0)
{
//TString canvasname = Form("%d",time->GetNanoSec());
for (UInt_t histogrami=0; histogrami < ptCompareHistogramVector->size(); histogrami++)
{
- TH1F* curhistogramclone = (TH1F*) ptCompareHistogramVector->at(histogrami)->Clone();
+ TH1FO* curhistogramclone = (TH1FO*) ptCompareHistogramVector->at(histogrami)->Clone();
heighestval1 = (curhistogramclone->GetMaximum()>heighestval1?curhistogramclone->GetMaximum():heighestval1);
canvastitle+= Form("_%s",getRunnumberAtBegin(curhistogramclone->GetName()).Data());
}
for (UInt_t histogrami=0; histogrami < ptCompareHistogramVector->size(); histogrami++)
{
- TH1F* curhistogramclone = (TH1F*) ptCompareHistogramVector->at(histogrami)->Clone();
+ TH1FO* curhistogramclone = (TH1FO*) ptCompareHistogramVector->at(histogrami)->Clone();
lastbin1 = (curhistogramclone->GetBinCenter(curhistogramclone->FindLastBinAbove(heighestval1/20,1))>lastbin1)?curhistogramclone->GetBinCenter(curhistogramclone->FindLastBinAbove(heighestval1/20,1)):lastbin1;
}
TCanvas* canvas = new TCanvas(canvasname, canvastitle, 1200, 700);
for (UInt_t histogrami=0; histogrami < ptCompareHistogramVector->size(); histogrami++)
{
- TH1F* curhistogramclone = (TH1F*) ptCompareHistogramVector->at(histogrami)->Clone();
+ TH1FO* curhistogramclone = (TH1FO*) ptCompareHistogramVector->at(histogrami)->Clone();
if (titlestr.Length() > 0) curhistogramclone->SetName(titlestr);
if (YAxisTitle.Length() > 0) curhistogramclone->SetYTitle(YAxisTitle);
curhistogramclone->SetLineColor(rootcolors[histogrami%13]);
}
canvas->Update();
// gPad->Modified(); gPad->Update();
+ gStyle->SetPaperSize(29,21);
MSaveBigPNG(canvas, savepathresults + folderadd + "/" + canvastitle + ".png");
TImageDump *img = new TImageDump(savepathresults + folderadd + "/" + canvastitle + ".png");
for (UInt_t histogrami=0; histogrami < ptCompareHistogramClassVector->size(); histogrami++)
{
HistogramType* curhistogramclassp = ptCompareHistogramClassVector->at(histogrami);
- TH1F* curhistogramclone = (TH1F*) curhistogramclassp->Seed->Clone();
+ TH1FO* curhistogramclone = (TH1FO*) curhistogramclassp->Seed->Clone();
Float_t posMaxValHist = curhistogramclone->GetXaxis()->GetXmax();
curhistogramclone->GetXaxis()->UnZoom();
if (!unZoom)
heighestval1 = (curhistogramclone->GetMaximum()>heighestval1?curhistogramclone->GetMaximum():heighestval1);
- curhistogramclone = (TH1F*) (*curhistogramclassp->Sum)->Clone();
+ curhistogramclone = (TH1FO*) (*curhistogramclassp->Sum)->Clone();
posMaxValHist = curhistogramclone->GetXaxis()->GetXmax();
curhistogramclone->GetXaxis()->UnZoom();
if (!unZoom)
heighestval2 = (curhistogramclone->GetMaximum()>heighestval2?curhistogramclone->GetMaximum():heighestval2);
- curhistogramclone = (TH1F*) curhistogramclassp->Veto->Clone();
+ curhistogramclone = (TH1FO*) curhistogramclassp->Veto->Clone();
posMaxValHist = curhistogramclone->GetXaxis()->GetXmax();
curhistogramclone->GetXaxis()->UnZoom();
if (!unZoom)
curhistogramclone->GetXaxis()->SetRange(curhistogramclone->GetXaxis()->FindBin(curhistogramclassp->noisethresholdborder),curhistogramclone->GetXaxis()->FindBin(posMaxValHist)); // look only for maxima with x greater than noiseborder, cut away noise
heighestval3 = (curhistogramclone->GetMaximum()>heighestval3?curhistogramclone->GetMaximum():heighestval3);
- curhistogramclone = (TH1F*) curhistogramclassp->Noise->Clone();
+ curhistogramclone = (TH1FO*) curhistogramclassp->Noise->Clone();
curhistogramclone->GetXaxis()->UnZoom();
heighestval4 = (curhistogramclone->GetMaximum()>heighestval4?curhistogramclone->GetMaximum():heighestval4);
}
for (UInt_t histogrami=0; histogrami < ptCompareHistogramClassVector->size(); histogrami++)
{
HistogramType* curhistogramclassp = ptCompareHistogramClassVector->at(histogrami);
- TH1F* curhistogramclone = (TH1F*) curhistogramclassp->Seed->Clone();
+ TH1FO* curhistogramclone = (TH1FO*) curhistogramclassp->Seed->Clone();
lastbin1 = (curhistogramclone->GetBinCenter(curhistogramclone->FindLastBinAbove(heighestval1/20,1))>lastbin1)?curhistogramclone->GetBinCenter(curhistogramclone->FindLastBinAbove(heighestval1/20,1)):lastbin1;
- curhistogramclone = (TH1F*) (*curhistogramclassp->Sum)->Clone();
+ curhistogramclone = (TH1FO*) (*curhistogramclassp->Sum)->Clone();
lastbin2 = (curhistogramclone->GetBinCenter(curhistogramclone->FindLastBinAbove(heighestval2/20,1))>lastbin2)?curhistogramclone->GetBinCenter(curhistogramclone->FindLastBinAbove(heighestval2/20,1)):lastbin2;
- curhistogramclone = (TH1F*) curhistogramclassp->Veto->Clone();
+ curhistogramclone = (TH1FO*) curhistogramclassp->Veto->Clone();
lastbin3 = (curhistogramclone->GetBinCenter(curhistogramclone->FindLastBinAbove(heighestval3/20,1))>lastbin3)?curhistogramclone->GetBinCenter(curhistogramclone->FindLastBinAbove(heighestval3/20,1)):lastbin3;
}
for (UInt_t histogrami=0; histogrami < ptCompareHistogramClassVector->size(); histogrami++)
{
HistogramType* curhistogramclassp = ptCompareHistogramClassVector->at(histogrami);
- TH1F* curhistogramclone;
+ TH1FO* curhistogramclone;
canvas->cd(1);
- curhistogramclone = (TH1F*) curhistogramclassp->Seed->Clone();
+ curhistogramclone = (TH1FO*) curhistogramclassp->Seed->Clone();
// TLatex Tl;
// Tl.SetNDC();
// Tl.DrawText(0.3, 0.2, "Titel titel");
owntitle->Draw("SAME");
canvas->cd(2);
- curhistogramclone = (TH1F*) (*curhistogramclassp->Sum)->Clone();
+ curhistogramclone = (TH1FO*) (*curhistogramclassp->Sum)->Clone();
curhistogramclone->SetLineColor(rootcolors[histogrami%13]);
curhistogramclone->Draw("SAME");
hs->Add(curhistogramclone);
owntitle2->Draw("SAME");
canvas->cd(3);
- curhistogramclone = (TH1F*) curhistogramclassp->Veto->Clone();
+ curhistogramclone = (TH1FO*) curhistogramclassp->Veto->Clone();
curhistogramclone->SetLineColor(rootcolors[histogrami%13]);
curhistogramclone->Draw("SAME");
legendEntry = Form("%s", curhistogramclone->GetTitle());
owntitle3->Draw("SAME");
canvas->cd(4);
- curhistogramclone = (TH1F*) curhistogramclassp->Noise->Clone();
+ curhistogramclone = (TH1FO*) curhistogramclassp->Noise->Clone();
curhistogramclone->SetLineColor(rootcolors[histogrami%13]);
curhistogramclone->Draw("SAME");
legendEntry = Form("%d Noise: %.2f + %.2f - %.2f",curhistogramclassp->labbook->runnumber, curhistogramclassp->avgNoise, curhistogramclassp->avgNoisePlus, curhistogramclassp->avgNoiseMinus);
initHistogramCustom(LeakageCurrentDistrib, "Average Leakage current per pixel" + histogramdescription, color, style, -100, 400, 1000, "Average CDS [ADU]", "Entries");
// initHistogram(LeakageCurrentInPixelSorted, "Leakage current" + histogramdescription, color, style);
initHistogramCustom(pixelHadGoodVeto, "Number of times pixel had good veto" + histogramdescription, color, style, 0, cursensorinfo->columns*cursensorinfo->rows, cursensorinfo->columns*cursensorinfo->rows, "Pixel index", "Counter good veto");
-
SeedPerc->GetXaxis()->SetRangeUser(0,50);
Noise->SetBins(cursystempar->nbinsnoise, 0, cursystempar->maxbinnoise);
NoiseEnd->SetBins(cursystempar->nbinsnoise, 0, cursystempar->maxbinnoise);
void HistogramType::initHistogram(TH1FO* &histogrampointer, TString prefix, Int_t color, Int_t style) {
// histogrampointer=(TH1FO*)new TH1F(Form("%d %s",labbook->runnumber, prefix.Data()), Form("%s, %s",prefix.Data(), humanreadablestr.Data()), cursystempar->nbins, 0, cursystempar->maxbin);
- histogrampointer=(TH1FO*)new TH1F(Form("%d %s",labbook->runnumber, prefix.Data()), Form("%s",prefix.Data()), cursystempar->nbins, 0, cursystempar->maxbin);
+ histogrampointer=new TH1FO(Form("%d %s",labbook->runnumber, prefix.Data()), Form("%s",prefix.Data()), cursystempar->nbins, 0, cursystempar->maxbin);
histogrampointer->SetLineStyle(style);
histogrampointer->SetLineColor(color);
histogrampointer->SetStats(kTRUE);
void HistogramType::initHistogramCustom(TH1FO* &histogrampointer, TString prefix, Int_t color, Int_t style, Double_t xLow, Double_t xUp, Int_t nBins, TString xaxistitle, TString yaxistitle) {
// histogrampointer=(TH1FO*)new TH1F(Form("%d %s",labbook->runnumber, prefix.Data()), Form("%s, %s",prefix.Data(), humanreadablestr.Data()), nBins, xLow, xUp);
- histogrampointer=(TH1FO*)new TH1F(Form("%d %s",labbook->runnumber, prefix.Data()), Form("%s",prefix.Data()), nBins, xLow, xUp);
+ histogrampointer=new TH1FO(Form("%d %s",labbook->runnumber, prefix.Data()), Form("%s",prefix.Data()), nBins, xLow, xUp);
histogrampointer->SetLineStyle(style);
histogrampointer->SetLineColor(color);
histogrampointer->SetStats(kTRUE);
void HistogramType::initHistogramArray(vector<TH1FO*>* histogramarraypointer, int numberofhisto, TString prefix, Int_t color, Int_t style) {
for (int i=0; i < numberofhisto; ++i) {
// TH1FO* histogrampointer = (TH1FO*)new TH1F(Form("%d %s %d",labbook->runnumber, prefix.Data(), i+1), Form("%s %d, %s",prefix.Data(), i+1, humanreadablestr.Data()), cursystempar->nbins, 0, cursystempar->maxbin);
- TH1FO* histogrampointer = (TH1FO*)new TH1F(Form("%d %s %d",labbook->runnumber, prefix.Data(), i+1), Form("%s %d",prefix.Data(), i+1), cursystempar->nbins, 0, cursystempar->maxbin);
+ TH1FO* histogrampointer = new TH1FO(Form("%d %s %d",labbook->runnumber, prefix.Data(), i+1), Form("%s %d",prefix.Data(), i+1), cursystempar->nbins, 0, cursystempar->maxbin);
histogrampointer->SetLineStyle(style);
histogrampointer->SetLineColor(color);
histogrampointer->SetStats(kTRUE);
if (Veto != 0) calibrateHistogram(calibrated->Veto, Veto, gain, "Collected charge [e]", Form("Entries [1/%.1f e]",calibrated->Veto->GetBinWidth(1)));
if (Noise != 0) calibrateHistogram(calibrated->Noise, Noise, gain, "Collected charge [e]", Form("Entries [1/%.1f e]",calibrated->Noise->GetBinWidth(1)));
if (pixeltimefired != 0) calibrated->pixeltimefired = pixeltimefired;
- if (pixeltimefiredDistrib != 0) calibrated->pixeltimefiredDistrib = pixeltimefiredDistrib;
+ if (pixeltimefiredDistrib != 0) calibrated->pixeltimefiredDistrib = pixeltimefiredDistrib;
if (SeedPerc != 0) calibrated->SeedPerc = SeedPerc;
if (clustermultiplicity != 0) calibrated->clustermultiplicity = clustermultiplicity;
if (histAvgCluster != 0) calibrate2DHistogramCounts(calibrated->histAvgCluster, histAvgCluster);
calibrated->medianLeakageCurrentPlus = medianLeakageCurrentPlus * gain / 3.7 / pow10(-3) * (1.6*pow10(-19)) * pow10(15);
calibrated->iscalibrated = true;
+ cout << "Before =" << endlr;
return 1;
}
void HistogramType::calibrateHistogramYAxis(TH1FO* &histogrampointernew, TH1FO* &histogrampointerold, Double_t scalefactor) {
+ cout << "calibrateHistogramYAxis start " << endl;
histogrampointernew = (TH1FO*)histogrampointerold->Clone();
histogrampointernew->SetName(Form("%s Calibr.", histogrampointerold->GetName()));
histogrampointernew->SetTitle(Form("%s Calibr.", histogrampointerold->GetTitle()));
}
histogrampointernew->GetYaxis()->SetTitle(Form("Entries [1/%.1f e]",histogrampointernew->GetBinWidth(1)));
histogrampointernew->itsHistogramType = histogrampointerold->itsHistogramType;
+ cout << "calibrateHistogramYAxis end " << endl;
}
void HistogramType::calibrate2DHistogramCounts(TH2F* &histogrampointernew, TH2F* &histogrampointerold ) {
cout << "---------- 1. loop over all classes --------" << endl;
for (vector<HistogramType*>::iterator curHistogramClass = HistogramClassVector.begin(); curHistogramClass != HistogramClassVector.end(); curHistogramClass++) {
cout << "Processing histograms in class: <" << colorwhite << (*curHistogramClass)->histogramdescription << colorreset << " >" << endlr;
- cout << colorwhite << " BinFiringRates():" << endlr;
+// cout << colorwhite << " BinFiringRates():" << endlr;
BinFiringRates(*curHistogramClass);
if ((*curHistogramClass)->maskRTSpixel) {
// if (labbook.chipGen=="Mi19") {
}
}
if (labbook.source.Contains("Fe")||labbook.source.Contains("Cd")) {
- // cout << colorwhite << " calculateCCE():" << endlr;
+// cout << colorwhite << " calculateCCE():" << endlr;
curHistogramClassPt->calculteCCE(false);
}
if (labbook.source.Contains("Sr90")) {
// cout << colorwhite << " calculteStoN():" << endlr;
curHistogramClassPt->calculteStoN(true);
}
- // cout << colorwhite << "normalizeHistogramClasses():" << endlr;
+// cout << colorwhite << "normalizeHistogramClasses():" << endlr;
normalizeHistogramClasses(curHistogramClassPt);
- // cout << colorwhite << "rescaleHistogramClasses():" << endlr;
+// cout << colorwhite << "rescaleHistogramClasses():" << endlr;
rescaleHistogramClasses(curHistogramClassPt);
+ cout << colorcyan << "after rescaleHistogramClasses():" << endlr;
}
cout << "--------------------------------------------" << endl;
if (labbook.source.Contains("Sr90")) {
Bool_t Run::rescaleHistogramClasses(HistogramType* curHistogramClassPt)
{
+
float_t vetopeakposition = -1;
Float_t gain;
if (gain > 0) {
cout << " Gain for the calibrated class: " << gain << endlr;
}
+ cout << colorcyan << "calibrateHistograms():" << endlr;
curHistogramClassPt->calibrateHistograms(gain);
+ cout << colorcyan << "normalized->calibrateHistograms():" << endlr;
curHistogramClassPt->normalized->calibrateHistograms(gain);
return 1;
// afterwards sum them up for an 'average' F0 distribution over the run
- averageF0Hist = (TH1FO*) new TH1F(Form("%d AvgF0 for whole chip",labbook.runnumber), Form("%d AvgF0 for whole chip",labbook.runnumber), processed->fHitTree->GetEntries(), 0, processed->fHitTree->GetEntries());
+ averageF0Hist = new TH1FO(Form("%d AvgF0 for whole chip",labbook.runnumber), Form("%d AvgF0 for whole chip",labbook.runnumber), processed->fHitTree->GetEntries(), 0, processed->fHitTree->GetEntries());
averageF0Hist->SetLineStyle(rootlinestyle[plotStyle]);
averageF0Hist->SetLineColor(rootcolors[plotStyle]);
averageF0Hist->SetStats(kTRUE);
labbook.sigmaF0 /= processed->fHitTree->GetEntries();
labbook.sigmaF0 = sqrt(labbook.sigmaF0);
- averageF0PixelwiseStart = (TH1FO*) new TH1F(Form("%d AvgF0 per Pixel, first 1000 frames",labbook.runnumber), Form("%d Average F0 per Pixel, first 1000 frames",labbook.runnumber), cursensorinfo.columns * cursensorinfo.rows, 0, cursensorinfo.columns * cursensorinfo.rows);
+ averageF0PixelwiseStart = new TH1FO(Form("%d AvgF0 per Pixel, first 1000 frames",labbook.runnumber), Form("%d Average F0 per Pixel, first 1000 frames",labbook.runnumber), cursensorinfo.columns * cursensorinfo.rows, 0, cursensorinfo.columns * cursensorinfo.rows);
averageF0PixelwiseStart->SetLineStyle(1);
averageF0PixelwiseStart->SetLineColor(1);
averageF0PixelwiseStart->SetStats(kTRUE);
averageF0PixelwiseStart->GetXaxis()->CenterTitle();
averageF0PixelwiseStart->GetYaxis()->CenterTitle();
averageF0PixelwiseStart->itsHistogramType = histogram;
- averageF0DistrStart = (TH1FO*) new TH1F(Form("%d AvgF0, first 1000 frames",labbook.runnumber), Form("%d Average F0, first 1000 frames",labbook.runnumber), 10000, 0, 10000);
+ averageF0DistrStart = new TH1FO(Form("%d AvgF0, first 1000 frames",labbook.runnumber), Form("%d Average F0, first 1000 frames",labbook.runnumber), 10000, 0, 10000);
averageF0DistrStart->SetLineStyle(1);
averageF0DistrStart->SetLineColor(1);
averageF0DistrStart->SetStats(kTRUE);
averageF0DistrStart->GetXaxis()->CenterTitle();
averageF0DistrStart->GetYaxis()->CenterTitle();
averageF0DistrStart->itsHistogramType = histogram;
- averageF0PixelwiseEnd = (TH1FO*) averageF0PixelwiseStart->Clone();
+ cout << colorcyan << averageF0DistrStart->itsHistogramType << endlr;
+// cout << colorcyan << "Before clone" << endlr;
+ averageF0PixelwiseEnd = (TH1FO*)averageF0PixelwiseStart->Clone();
+// cout << colorcyan << "After clone" << endlr;
averageF0PixelwiseEnd->SetNameTitle(Form("%d AvgF0 per Pixel, last 1000 frames",labbook.runnumber),Form("%d AvgF0 per Pixel, last 1000 frames",labbook.runnumber));
averageF0PixelwiseEnd->SetLineColor(1+100);
+ cout << colorcyan << averageF0PixelwiseEnd->itsHistogramType << endlr;
averageF0PixelwiseEnd->itsHistogramType = histogram;
- averageF0DistrEnd = (TH1FO*) averageF0DistrStart->Clone();
+ cout << colorcyan << averageF0PixelwiseEnd->itsHistogramType << endlr;
+ averageF0DistrEnd = (TH1FO*)averageF0DistrStart->Clone();
averageF0DistrEnd->SetNameTitle(Form("%d AvgF0, last 1000 frames",labbook.runnumber),Form("%d Average F0, last 1000 frames",labbook.runnumber));
averageF0DistrEnd->SetLineColor(1+100);
averageF0DistrEnd->itsHistogramType = histogram;
- averageF0Distr = (TH1FO*) averageF0DistrStart->Clone();
+ averageF0Distr = (TH1FO*)averageF0DistrStart->Clone();
averageF0Distr->SetNameTitle(Form("%d AvgF0",labbook.runnumber),Form("%d Average F0",labbook.runnumber));
averageF0Distr->SetLineColor(2);
averageF0Distr->itsHistogramType = histogram;
- averageF1DistrStart = (TH1FO*) averageF0DistrStart->Clone();
+ averageF1DistrStart = (TH1FO*)averageF0DistrStart->Clone();
averageF1DistrStart->SetNameTitle(Form("%d AvgF1, first 1000 frames",labbook.runnumber),Form("%d Average F1, first 1000 frames",labbook.runnumber));
averageF1DistrStart->SetLineColor(3);
averageF1DistrStart->itsHistogramType = histogram;
- averageF1DistrEnd = (TH1FO*) averageF0DistrStart->Clone();
+ averageF1DistrEnd =(TH1FO*) averageF0DistrStart->Clone();
averageF1DistrEnd->SetNameTitle(Form("%d AvgF1, last 1000 frames",labbook.runnumber),Form("%d Average F1, last 1000 frames",labbook.runnumber));
averageF1DistrEnd->SetLineColor(3+100);
averageF1DistrEnd->itsHistogramType = histogram;
- averageF1Distr = (TH1FO*) averageF0DistrStart->Clone();
+ averageF1Distr = (TH1FO*)averageF0DistrStart->Clone();
averageF1Distr->SetNameTitle(Form("%d AvgF1",labbook.runnumber),Form("%d Average F1",labbook.runnumber));
averageF1Distr->SetLineColor(4);
averageF1Distr->itsHistogramType = histogram;
+
for (Int_t filli=0; filli<3; filli++) { // first and second fill loop
for (Int_t framei=0; framei<processed->fHitTree->GetEntries(); framei++) // loop over all frames
{
for (UInt_t histogrami=0; histogrami < compareHistogramClassVector.size(); histogrami++)
{
HistogramType* curhistogramclassp = compareHistogramClassVector.at(histogrami);
- TH1F* curhistogramclone;
+ TH1FO* curhistogramclone;
canvas->cd(1);
- curhistogramclone = (TH1F*) curhistogramclassp->Seed->Clone();
+ curhistogramclone = (TH1FO*) curhistogramclassp->Seed->Clone();
curhistogramclone->SetLineColor(rootcolors[histogrami]);
curhistogramclone->Draw("SAME");
legendEntry = Form("%s", curhistogramclone->GetTitle());
curhistogramclone->SetAxisRange(0,lastbin1*1.1,"X");
gPad->SetLogy(1);
canvas->cd(2);
- curhistogramclone = (TH1F*) (*curhistogramclassp->Sum)->Clone();
+ curhistogramclone = (TH1FO*) (*curhistogramclassp->Sum)->Clone();
curhistogramclone->SetLineColor(rootcolors[histogrami]);
curhistogramclone->Draw("SAME");
leg1->Draw("SAME");
curhistogramclone->SetAxisRange(0,lastbin2*1.1,"X");
gPad->SetLogy(1);
canvas->cd(3);
- curhistogramclone = (TH1F*) curhistogramclassp->Veto->Clone();
+ curhistogramclone = (TH1FO*) curhistogramclassp->Veto->Clone();
curhistogramclone->SetLineColor(rootcolors[histogrami]);
curhistogramclone->Draw("SAME");
leg1->Draw("SAME");
lastbin3 = (curhistogramclone->GetBinCenter(curhistogramclone->FindLastBinAbove(2,1))>lastbin3)?curhistogramclone->GetBinCenter(curhistogramclone->FindLastBinAbove(2,1)):lastbin3;
curhistogramclone->SetAxisRange(0,lastbin3*1.1,"X");
canvas->cd(4);
- curhistogramclone = (TH1F*) curhistogramclassp->Noise->Clone();
+ curhistogramclone = (TH1FO*) curhistogramclassp->Noise->Clone();
curhistogramclone->SetLineColor(rootcolors[histogrami]);
curhistogramclone->Draw();
legendEntry = Form("Noise: %.2f + %.2f - %.2f",curhistogramclassp->avgNoise, curhistogramclassp->avgNoisePlus, curhistogramclassp->avgNoiseMinus);
// canvas->Print(savepathresults + "/" + canvastitle + ".tex");
// create lorentz fit of a slice
- TH1FO* xslicetroughcluster = (TH1FO*) new TH1F(Form("%s_xslice", HistogramTypepointer->histAvgCluster->GetTitle()),"X slice",HistogramTypepointer->histAvgCluster->GetXaxis()->GetNbins(),HistogramTypepointer->histAvgCluster->GetXaxis()->GetBinLowEdge(1),HistogramTypepointer->histAvgCluster->GetXaxis()->GetBinUpEdge(HistogramTypepointer->histAvgCluster->GetXaxis()->GetNbins()));
+ TH1FO* xslicetroughcluster = new TH1FO(Form("%s_xslice", HistogramTypepointer->histAvgCluster->GetTitle()),"X slice",HistogramTypepointer->histAvgCluster->GetXaxis()->GetNbins(),HistogramTypepointer->histAvgCluster->GetXaxis()->GetBinLowEdge(1),HistogramTypepointer->histAvgCluster->GetXaxis()->GetBinUpEdge(HistogramTypepointer->histAvgCluster->GetXaxis()->GetNbins()));
Double_t* xslicetroughclusterpar = (Double_t *)calloc(11, sizeof(Double_t)); // allocate 11 parameters for safety, maximum 10 used at the moment
Int_t middlebin = (int)(HistogramTypepointer->histAvgCluster->GetXaxis()->GetNbins()/2.0 + 0.5);
for (Int_t bini=1; bini <= HistogramTypepointer->histAvgCluster->GetXaxis()->GetNbins(); bini++)
xslicetroughcluster->SetBinContent(bini,HistogramTypepointer->histAvgCluster->GetBinContent(bini,middlebin));
- TH1FO* yslicetroughcluster = (TH1FO*) new TH1F(Form("%s_yslice", HistogramTypepointer->histAvgCluster->GetTitle()),"Y slice",HistogramTypepointer->histAvgCluster->GetYaxis()->GetNbins(),HistogramTypepointer->histAvgCluster->GetYaxis()->GetBinLowEdge(1),HistogramTypepointer->histAvgCluster->GetYaxis()->GetBinUpEdge(HistogramTypepointer->histAvgCluster->GetYaxis()->GetNbins()));
+ TH1FO* yslicetroughcluster = new TH1FO(Form("%s_yslice", HistogramTypepointer->histAvgCluster->GetTitle()),"Y slice",HistogramTypepointer->histAvgCluster->GetYaxis()->GetNbins(),HistogramTypepointer->histAvgCluster->GetYaxis()->GetBinLowEdge(1),HistogramTypepointer->histAvgCluster->GetYaxis()->GetBinUpEdge(HistogramTypepointer->histAvgCluster->GetYaxis()->GetNbins()));
Double_t* yslicetroughclusterpar = (Double_t *)calloc(11, sizeof(Double_t)); // allocate 11 parameters for safety, maximum 10 used at the moment
middlebin = (int)(HistogramTypepointer->histAvgCluster->GetYaxis()->GetNbins()/2.0 + 0.5);
for (Int_t bini=1; bini <= HistogramTypepointer->histAvgCluster->GetYaxis()->GetNbins(); bini++)
gPad->SetLogy(1);
}
if (withOverflow)
- onehistogram=(TH1FO*)ShowOverflow((TH1F*)onehistogram);
+ onehistogram=ShowOverflow(onehistogram);
onehistogram->Draw();
Double_t* parameters = (Double_t *)calloc(11, sizeof(Double_t)); // allocate 10 parameters for safety, maximum 9 used at the moment
return nullptr;
}
-Bool_t Run::writeHistogramToFile(TH1F* onehistogram)
+Bool_t Run::writeHistogramToFile(TH1FO* onehistogram)
{
system("mkdir \""+ savepathresults + "\" -p");
TString filename= savepathresults + "/" + runcode + " " + onehistogram->GetName() + " hist.dat";
Bool_t plotCompareHistograms( );
/** @brief Writes a given 2D-histogram into a file */
- Bool_t writeHistogramToFile(TH1F* onehistogram);
+ Bool_t writeHistogramToFile(TH1FO* onehistogram);
/** @brief Writes a given histogram into a file */
Bool_t write2DHistogramToFile(TH2F* onehistogram);
*
*/
class TH1FO: public TH1F {
+
+// protected:
+// HistogramType* itsHistogramType2 = 0;
+
public:
HistogramType* itsHistogramType = 0;
+ //______________________________________________________________________________
+ // TH1FO methods
+ // TH1FO : histograms with one float per channel. Maximum precision 7 digits
+ //______________________________________________________________________________
+
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// Constructor.
+
+ TH1FO(): TH1F() {};
+
+ TH1FO(const char *name,const char *title,Int_t nbins,Double_t xlow,Double_t xup):
+ TH1F(name,title,nbins,xlow,xup), itsHistogramType(0){};
+
+ TH1FO(const char *name,const char *title,Int_t nbins,const Float_t *xbins):
+ TH1F(name,title,nbins,xbins), itsHistogramType(0){ };
+
+ TH1FO(const char *name,const char *title,Int_t nbins,const Double_t *xbins):
+ TH1F(name,title,nbins,xbins), itsHistogramType(0) { };
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// Destructor.
+ virtual ~TH1FO()
+ {
+ itsHistogramType = 0;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// Copy constructor.
+ TH1FO(const TH1FO &th1fo) : TH1F()
+ {
+ ((TH1FO&)th1fo).Copy(*this);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// Copy a TH1FO histogram to a new profile histogram.
+ void Copy(TObject &obj) const
+ {
+ try {
+ TH1F & pobj = static_cast<TH1F&>(obj);
+ TH1F::Copy(pobj);
+ } catch(...) {
+ Fatal("Copy","Cannot copy a TH1F0 in a %s",obj.IsA()->GetName());
+ }
+
+ }
- // TH1FO* Clone(const char *newname="") {
- // TObject *newTObject = this->Clone(newname);
- // TH1FO *newTH1FO = (TH1FO *)newTObject;
- // newTH1FO->itsHistogramType = this->itsHistogramType;
- // return newTH1FO;
- // }
- //
- // Overload = operator
- TH1FO operator=(const TH1FO &h1) {
- TH1FO h2;
- h2 = h1;
- h2.itsHistogramType = h1.itsHistogramType;
- return h2;
- };
- TH1FO& operator=(const TH1F &h1);
+ TH1FO& operator=(const TH1FO &cT){
+ if (this != &cT) ((TH1FO&)cT).Copy(*this);
+ return *this;
+ }
};
+
+
/**
* @brief A structure to hold information about a given sensor, like number of #columns and #rows
*/
* @param xVal position of the vertical line at x-axis
*
*/
-void plotVerticalLine(TH1F* histogrampointer, Float_t xVal) {
+void plotVerticalLine(TH1FO* histogrampointer, Float_t xVal) {
if (xVal > 0)
{
Float_t posMaxValue = 0;
* @param histogrampointer histogram pointer to calculate vertical line end
* @param xVal position of the vertical line at x-axis
*/
-void plotVerticalLineHeigher(TH1F* histogrampointer, Float_t xVal, TString texttoprint = "") {
+void plotVerticalLineHeigher(TH1FO* histogrampointer, Float_t xVal, TString texttoprint = "") {
if (xVal > 0)
{
if (texttoprint.Length() < 1)
* @param xVal position of the vertical line at x-axis
*
*/
-void plotTextAtVal(TH1F* histogrampointer, Float_t xVal, TString legendEntry) {
+void plotTextAtVal(TH1FO* histogrampointer, Float_t xVal, TString legendEntry) {
if (xVal > 0)
{
Double_t gPadX2 = histogrampointer->GetBinCenter(histogrampointer->GetXaxis()->GetLast());
* @return pointer to the new histogram
*
*/
-TH1F * ShowOverflow(TH1F *h)
+TH1FO * ShowOverflow(TH1FO *h)
{
// This function paint the histogram h with an extra bin for overflows
UInt_t nx = h->GetNbinsX()+1;
char *tempName= new char[strlen(h->GetName())+10];
sprintf(tempName,"%swtOverFlow",h->GetName());
// Book a temporary histogram having an extra bin for overflows
- TH1F *htmp = (TH1F*)h->Clone(tempName);
+ TH1FO *htmp = (TH1FO*)h->Clone(tempName);
htmp->SetBins (nx, xbins);
// Fill the new hitogram including the extra bin for overflows
for (UInt_t i=1; i<=nx; i++)