#define DRAW_SINGLE_HISTOGRAMS true
#define DRAW_SUMMED_HISTOGRAMS true
#define DRAW_VETO_HISTOGRAMS true
-#define DRAW_FITS true
+#define DRAW_PIXEL_DISTRIBUTION_HISTOGRAMS false
+#define DRAW_FITS false
#define PRINT_HEADER false
void PlotGraph(Float_t selTemp, Int_t selChip, std::string selSource, Int_t selMatrix6480, Int_t selSubmatrix, Float_t selRadDose)
std::vector<TH1F*> histNtuple;
std::vector<TH1F*> histNtupleSum;
std::vector<TH1F*> histNtupleVeto;
+ std::vector<TH1F*> histPixelDistribution1;
+ std::vector<TH1F*> histPixelDistribution2;
Int_t nHistNtuple = 0;
std::vector<std::string> runDetails;
std::vector<Float_t> fitMaxPosX;
Float_t frame;
TBranch* frameBranch;
hitNtuple->SetBranchAddress("frame", &frame, &frameBranch);
+ Float_t seedPixel;
+ TBranch* seedPixelBranch;
+ hitNtuple->SetBranchAddress("pixel", &seedPixel, &seedPixelBranch);
Float_t frameCounts;
TBranch* frameCountsBranch;
histNtuple.push_back(new TH1F(Form("hist%i",nHistNtuple), "Histogram title", 200, 0, RIGHT_BOUNDARY));
histNtupleSum.push_back(new TH1F(Form("histSum%i",nHistNtuple), "Histogram title", 200, 0, RIGHT_BOUNDARY));
histNtupleVeto.push_back(new TH1F(Form("histVeto%i",nHistNtuple), "Histogram title", 200, 0, RIGHT_BOUNDARY));
+ histPixelDistribution1.push_back(new TH1F(Form("histPixelDistribution1_%i",nHistNtuple), "Histogram title", 50000, 0, 50000));
+ histPixelDistribution2.push_back(new TH1F(Form("histPixelDistribution2_%i",nHistNtuple), "Histogram title", 50000, 0, 50000));
// loop over all hits to fill histogram
Int_t nentries = hitNtuple->GetEntries();
}
histNtupleSum[nHistNtuple]->Fill(pixelSum);
+ // search for systematics in pixel distribution
+ if (pixelSum > 100 && pixelSum < 150) {
+ histPixelDistribution1[nHistNtuple]->Fill(frame);
+ }
+ else if (pixelSum > 180 && pixelSum < 300) {
+ histPixelDistribution2[nHistNtuple]->Fill(frame);
+ }
+
+
+
// histogram with the single pixel and with "veto trigger"
// for the "histNtupleVeto" take only hits where only the seed pixel contains charge
Double_t notSeedSum = 0;
histNtupleVeto[nHistNtuple]->SetLineColor(nHistNtuple+1);
histNtupleVeto[nHistNtuple]->SetStats(kFALSE);
histNtupleVeto[nHistNtuple]->SetLineStyle(3); // make summed graphs dotted
+ histPixelDistribution1[nHistNtuple]->SetLineColor(1); // black line
+ histPixelDistribution2[nHistNtuple]->SetLineColor(2); // red line
// TString legendEntry = Form("#splitline{Run %i: T_{set}=%.1f, T_{sens}=%.1f, Chip=%i, }{Source=%s, Matrix=%i, Submatrix=%i, RadDose=%.2E}", runNo, temperature, tempSens, chip, TString(source).Data(), matrix6480, submatrix, radDose);
TString legendEntry = TString(Form("Run %i: ",runNo)) + (selTemp==-1 ? Form(" T_{set}=%.1f",temperature):"") + Form(" T_{sens}=%.1f",tempSens) + (selChip==-1 ? Form(" Chip=%i",chip):"") + (selSource=="-1" ? Form(" Source=%s",source.c_str()):"") + (selMatrix6480==-1 ? Form(" Matrix=%i",matrix6480):"") + (selSubmatrix==-1 ? Form(" Submatrix=%i",submatrix):"") + (selRadDose==-1 ? Form(" RadDose=%.2E",radDose):"");
// TString legendEntry = TString(Form("test") + (selTemp==-1 ? Form(", T_{set}=%.1f",temperature):"");// + Form(", T_{sens}=%.1f",tempSens) + (selChip==-1 ? Form(", Chip=%i",chip):"") + (selSource=="-1" ? Form(", Source=%s",source):"") + (selMatrix6480==-1 ? Form(", Matrix=%i",matrix6480):"") + (selSubmatrix==-1 ? Form(", Submatrix=%i",submatrix):"") + (selRadDose==-1 ? Form(", RadDose=%.2E",radDose):"");
// determine maximum y-value
Float_t maxY = 0;
- for (std::vector<TH1F*>::iterator it = histNtuple.begin(); it != histNtuple.end(); ++it){
- Int_t thismax = (*it)->GetMaximum();
- if (thismax > maxY){
- maxY = thismax;
-// maxHistNum = std::distance(histNtuple.begin(), it);
+ if (DRAW_SINGLE_HISTOGRAMS){
+ for (std::vector<TH1F*>::iterator it = histNtuple.begin(); it != histNtuple.end(); ++it){
+ Int_t thismax = (*it)->GetMaximum();
+ if (thismax > maxY){
+ maxY = thismax;
+ // maxHistNum = std::distance(histNtuple.begin(), it);
+ }
}
}
- for (std::vector<TH1F*>::iterator it = histNtupleSum.begin(); it != histNtupleSum.end(); ++it){
- Int_t thismax = (*it)->GetMaximum();
- if (thismax > maxY){
- maxY = thismax;
-// maxHistNum = std::distance(histNtuple.begin(), it);
+ if (DRAW_SUMMED_HISTOGRAMS){
+ for (std::vector<TH1F*>::iterator it = histNtupleSum.begin(); it != histNtupleSum.end(); ++it){
+ Int_t thismax = (*it)->GetMaximum();
+ if (thismax > maxY){
+ maxY = thismax;
+ // maxHistNum = std::distance(histNtuple.begin(), it);
+ }
}
}
- for (std::vector<TH1F*>::iterator it = histNtupleVeto.begin(); it != histNtupleVeto.end(); ++it){
- Int_t thismax = (*it)->GetMaximum();
- if (thismax > maxY){
- maxY = thismax;
-// maxHistNum = std::distance(histNtuple.begin(), it);
+ if (DRAW_VETO_HISTOGRAMS){
+ for (std::vector<TH1F*>::iterator it = histNtupleVeto.begin(); it != histNtupleVeto.end(); ++it){
+ Int_t thismax = (*it)->GetMaximum();
+ if (thismax > maxY){
+ maxY = thismax;
+ // maxHistNum = std::distance(histNtuple.begin(), it);
+ }
}
}
(*it)->SetMaximum(1.05*maxY);
(*it)->Draw((cnt==0)?"":"same");
- (*it)->GetXaxis()->SetRange((*it)->GetXaxis()->FindBin(20),(*it)->GetXaxis()->FindBin(RIGHT_BOUNDARY)); // look only for maxima with x greater than 20
- Int_t xValMax = (*it)->GetBinCenter((*it)->GetMaximumBin());
- (*it)->Fit(fitFunc, "N,Q,W", "", xValMax-10, xValMax+10);
- (*it)->GetXaxis()->UnZoom();
- if (DRAW_FITS)
+ if (DRAW_FITS) {
+ (*it)->GetXaxis()->SetRange((*it)->GetXaxis()->FindBin(20),(*it)->GetXaxis()->FindBin(RIGHT_BOUNDARY)); // look only for maxima with x greater than 20
+ Int_t xValMax = (*it)->GetBinCenter((*it)->GetMaximumBin());
+ (*it)->Fit(fitFunc, "N,Q,W", "", xValMax-10, xValMax+10);
+ (*it)->GetXaxis()->UnZoom();
fitFunc->DrawCopy("same");
-// cout << "Maximum bin: " << (*it)->GetBinCenter((*it)->GetMaximumBin()) << endl;
-// cout << "Maximum of gaussian fit: " << fitFunc->GetParameter(1) << "\n\n";
- fitMaxPosX.push_back(fitFunc->GetParameter(1));
-// runDetails[cnt] = runDetails[cnt] + Form("%.2f", fitMaxPosX);
+ // cout << "Maximum bin: " << (*it)->GetBinCenter((*it)->GetMaximumBin()) << endl;
+ // cout << "Maximum of gaussian fit: " << fitFunc->GetParameter(1) << "\n\n";
+ fitMaxPosX.push_back(fitFunc->GetParameter(1));
+ // runDetails[cnt] = runDetails[cnt] + Form("%.2f", fitMaxPosX);
+ }
}
}
// plot all summed histograms into the same histogram
else
(*it)->Draw("same");
-// (*it)->GetXaxis()->SetRange((*it)->GetXaxis()->FindBin(fitMaxPosX[cnt] + 25),(*it)->GetXaxis()->FindBin(RIGHT_BOUNDARY)); // look only for maxima with x greater than 25 more right than the peak of the seed pixel
- (*it)->GetXaxis()->SetRange((*it)->GetXaxis()->FindBin(fitMaxPosX[cnt]),(*it)->GetXaxis()->FindBin(RIGHT_BOUNDARY)); // look only for maxima with x greater than 20
- Int_t xValMax = (*it)->GetBinCenter((*it)->GetMaximumBin());
- (*it)->Fit(fitFunc, "N,Q,W", "", xValMax-15, xValMax+15);
- (*it)->GetXaxis()->UnZoom();
- if (DRAW_FITS)
+ if (DRAW_FITS) {
+ // (*it)->GetXaxis()->SetRange((*it)->GetXaxis()->FindBin(fitMaxPosX[cnt] + 25),(*it)->GetXaxis()->FindBin(RIGHT_BOUNDARY)); // look only for maxima with x greater than 25 more right than the peak of the seed pixel
+ (*it)->GetXaxis()->SetRange((*it)->GetXaxis()->FindBin(fitMaxPosX[cnt]),(*it)->GetXaxis()->FindBin(RIGHT_BOUNDARY)); // look only for maxima with x greater than 20
+ Int_t xValMax = (*it)->GetBinCenter((*it)->GetMaximumBin());
+ (*it)->Fit(fitFunc, "N,Q,W", "", xValMax-15, xValMax+15);
+ (*it)->GetXaxis()->UnZoom();
fitFunc->DrawCopy("same");
-// cout << "Maximum bin: " << (*it)->GetBinCenter((*it)->GetMaximumBin()) << endl;
-// cout << "Maximum of gaussian fit: " << fitFunc->GetParameter(1) << "\n\n";
- fitMaxPosXSum.push_back(fitFunc->GetParameter(1));
+ // cout << "Maximum bin: " << (*it)->GetBinCenter((*it)->GetMaximumBin()) << endl;
+ // cout << "Maximum of gaussian fit: " << fitFunc->GetParameter(1) << "\n\n";
+ fitMaxPosXSum.push_back(fitFunc->GetParameter(1));
+ }
}
}
// plot single pixel histograms with veto trigger in the same histogram
else
(*it)->Draw("same");
-// (*it)->GetXaxis()->SetRange((*it)->GetXaxis()->FindBin(fitMaxPosX[cnt] + 25),(*it)->GetXaxis()->FindBin(RIGHT_BOUNDARY)); // look only for maxima with x greater than 25 more right than the peak of the seed pixel
- (*it)->GetXaxis()->SetRange((*it)->GetXaxis()->FindBin(fitMaxPosX[cnt]),(*it)->GetXaxis()->FindBin(RIGHT_BOUNDARY)); // look only for maxima with x greater than 20
- Int_t xValMax = (*it)->GetBinCenter((*it)->GetMaximumBin());
- (*it)->Fit(fitFunc, "N,Q,W", "", xValMax-15, xValMax+15);
- (*it)->GetXaxis()->UnZoom();
- if (DRAW_FITS)
+ if (DRAW_FITS) {
+ // (*it)->GetXaxis()->SetRange((*it)->GetXaxis()->FindBin(fitMaxPosX[cnt] + 25),(*it)->GetXaxis()->FindBin(RIGHT_BOUNDARY)); // look only for maxima with x greater than 25 more right than the peak of the seed pixel
+ (*it)->GetXaxis()->SetRange((*it)->GetXaxis()->FindBin(fitMaxPosX[cnt]),(*it)->GetXaxis()->FindBin(RIGHT_BOUNDARY)); // look only for maxima with x greater than 20
+ Int_t xValMax = (*it)->GetBinCenter((*it)->GetMaximumBin());
+ (*it)->Fit(fitFunc, "N,Q,W", "", xValMax-15, xValMax+15);
+ (*it)->GetXaxis()->UnZoom();
fitFunc->DrawCopy("same");
-// cout << "Maximum bin: " << (*it)->GetBinCenter((*it)->GetMaximumBin()) << endl;
-// cout << "Maximum of gaussian fit: " << fitFunc->GetParameter(1) << "\n\n";
- fitMaxPosXVeto.push_back(fitFunc->GetParameter(1));
+ // cout << "Maximum bin: " << (*it)->GetBinCenter((*it)->GetMaximumBin()) << endl;
+ // cout << "Maximum of gaussian fit: " << fitFunc->GetParameter(1) << "\n\n";
+ fitMaxPosXVeto.push_back(fitFunc->GetParameter(1));
+ }
}
}
-
-
-
// add legend
TString legendEntry = TString("Same Parameters: ") + (selTemp!=-1 ? Form(" T_{set}=%.1f",selTemp):"") + (selChip!=-1 ? Form(" Chip=%i",selChip):"") + (selSource!="-1" ? Form(" Source=%s",selSource.c_str()):"") + (selMatrix6480!=-1 ? Form(" Matrix=%i",selMatrix6480):"") + (selSubmatrix!=-1 ? Form(" Submatrix=%i",selSubmatrix):"") + (selRadDose!=-1 ? Form(" RadDose=%.2E",selRadDose):"");
leg->AddEntry((TObject*) 0, legendEntry, "");
leg->SetTextSize(0.02);
leg->Draw();
+
+ // plot histogram for analysis of pixel distribution in another histogram
+ if (DRAW_PIXEL_DISTRIBUTION_HISTOGRAMS){
+ TCanvas* c2 = new TCanvas();
+ for (std::vector<TH1F*>::iterator it = histPixelDistribution1.begin(); it != histPixelDistribution1.end(); ++it){
+ Int_t cnt = std::distance(histPixelDistribution1.begin(), it) ;
+ (*it)->Draw((cnt==0)?"":"same");
+ }
+ for (std::vector<TH1F*>::iterator it = histPixelDistribution2.begin(); it != histPixelDistribution2.end(); ++it){
+ (*it)->Draw("same");
+ }
+ }
+
+
// print all information
- TString runDetailsHeader = TString("runNo\tT\tTSens\tChip\tSource\tMatrix\tRadDose\tSubmtrx") + (DRAW_SINGLE_HISTOGRAMS ? "\tColPeak":"") + (DRAW_SUMMED_HISTOGRAMS ? "\tSumColPeak":"") + (DRAW_VETO_HISTOGRAMS ? "\tCalibPeak":"") + "\n";
+ TString runDetailsHeader = TString("runNo\tT\tTSens\tChip\tSource\tMatrix\tRadDose\tSubmtrx") + (DRAW_SINGLE_HISTOGRAMS && DRAW_FITS ? "\tColPeak":"") + (DRAW_SUMMED_HISTOGRAMS && DRAW_FITS ? "\tSumColPeak":"") + (DRAW_VETO_HISTOGRAMS && DRAW_FITS ? "\tCalibPeak":"") + "\n";
if (PRINT_HEADER)
cout << endl << runDetailsHeader;
for (UInt_t i=0; i<runDetails.size(); ++i){
// cout << runDetails[i] << Form("\t%.2f", fitMaxPosX[i]) << Form("\t%.2f", fitMaxPosXSum[i]) << endl;
- cout << runDetails[i] << (DRAW_SINGLE_HISTOGRAMS ? Form("\t%.2f", fitMaxPosX[i]):"") << (DRAW_SUMMED_HISTOGRAMS ? Form("\t%.2f", fitMaxPosXSum[i]):"") << (DRAW_VETO_HISTOGRAMS ? Form("\t%.2f", fitMaxPosXVeto[i]):"") << endl;
+ cout << runDetails[i] << (DRAW_SINGLE_HISTOGRAMS && DRAW_FITS ? Form("\t%.2f", fitMaxPosX[i]):"") << (DRAW_SUMMED_HISTOGRAMS && DRAW_FITS ? Form("\t%.2f", fitMaxPosXSum[i]):"") << (DRAW_VETO_HISTOGRAMS && DRAW_FITS ? Form("\t%.2f", fitMaxPosXVeto[i]):"") << endl;
}