]> jspc29.x-matter.uni-frankfurt.de Git - radhard.git/commitdiff
Added some bugfixes: Plotting now works also for veto trigger and summed
authorStefan Strohauer <sstrohauer@jspc31.x-matter.uni-frankfurt.de>
Wed, 21 Aug 2013 15:34:48 +0000 (17:34 +0200)
committerStefan Strohauer <sstrohauer@jspc31.x-matter.uni-frankfurt.de>
Wed, 21 Aug 2013 15:34:48 +0000 (17:34 +0200)
cluster only.

PlotGraph/PlotGraph.C
ProcessMeasurements/MAPS.C

index 3cc39d17fe6f79317e051a2404a822080a96d088..39bcc283216f48c5ada3bac2d7199c3561398656 100644 (file)
@@ -41,7 +41,8 @@
 #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)
@@ -70,6 +71,8 @@ void PlotGraph(Float_t selTemp, Int_t selChip, std::string selSource, Int_t selM
   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;
@@ -144,6 +147,9 @@ void PlotGraph(Float_t selTemp, Int_t selChip, std::string selSource, Int_t selM
          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;
@@ -153,6 +159,8 @@ void PlotGraph(Float_t selTemp, Int_t selChip, std::string selSource, Int_t selM
          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();
@@ -178,6 +186,16 @@ void PlotGraph(Float_t selTemp, Int_t selChip, std::string selSource, Int_t selM
            }
            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;
@@ -203,6 +221,8 @@ void PlotGraph(Float_t selTemp, Int_t selChip, std::string selSource, Int_t selM
          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):"");
@@ -228,25 +248,31 @@ void PlotGraph(Float_t selTemp, Int_t selChip, std::string selSource, Int_t selM
 
   // 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);
+      }
     }
   }
   
@@ -262,16 +288,17 @@ void PlotGraph(Float_t selTemp, Int_t selChip, std::string selSource, Int_t selM
       (*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
@@ -284,16 +311,17 @@ void PlotGraph(Float_t selTemp, Int_t selChip, std::string selSource, Int_t selM
       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
@@ -306,34 +334,46 @@ void PlotGraph(Float_t selTemp, Int_t selChip, std::string selSource, Int_t selM
       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;
   }
   
   
index 5fc55d2549c1a5c3a418725383817d4e73475028..f485ce540573a870b252859d7b51c76bfbe719d1 100644 (file)
@@ -706,7 +706,8 @@ void MAPS::hitana() {
                
        
        // Consider boundaries => Remove hits where the seed pixel is within 2 pixels beside the edge
-       if (Hitlist[hit]/fColumnsSub < 2 || Hitlist[hit]/fColumnsSub > fRowsSub-3 || Hitlist[hit]%fColumnsSub < 2 || Hitlist[hit]%fColumnsSub > fRowsSub-3)
+       //  Hitlist[hit]%fColumnsSub = x-coordinate of the seed pixel, Hitlist[hit]/fColumnsSub = y-coordinate of the seed pixel
+       if (Hitlist[hit]%fColumnsSub < 2 || Hitlist[hit]%fColumnsSub > fColumnsSub-3 || Hitlist[hit]/fColumnsSub < 2 || Hitlist[hit]/fColumnsSub > fRowsSub-3)
          continue;