Changeset 13473 for fact/tools
- Timestamp:
- 04/30/12 19:22:44 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/rootmacros/PulseTemplates/pixel.C
r13465 r13473 19 19 20 20 Pixel::Pixel( 21 int pixelID = 0,22 int maxPulsorder = 1,23 int verbosityLevel = 0,21 int pixelID, 22 int maxPulsorder, 23 int verbosityLevel, 24 24 int pixelOverlayXaxisLeft, 25 25 int pixelOverlayXaxisRight, 26 26 int bSLMean, 27 27 int gainMean, 28 const char* options = "",28 TString options 29 29 ) 30 30 { … … 38 38 mGainMean = gainMean; 39 39 40 hMaxOverlay = (TH2F*) calloc(mMaxPulseOrder, sizeof(TH2F)); 41 hEdgeOverlay = (TH2F*) calloc(mMaxPulseOrder, sizeof(TH2F)); 42 hMaxProfile = (TProfile*) calloc(mMaxPulseOrder, sizeof(TProfile)); 43 hEdgeProfile = (TProfile*) calloc(mMaxPulseOrder, sizeof(TProfile)); 44 40 // hMaxOverlay = (TH2F*) calloc(mMaxPulseOrder, sizeof(TH2F*)); 41 hMaxOverlay = new TH2F*[mMaxPulseOrder]; 42 // hEdgeOverlay = (TH2F*) calloc(mMaxPulseOrder, sizeof(TH2F*)); 43 hEdgeOverlay = new TH2F*[mMaxPulseOrder]; 44 // hMaxProfile = (TProfile*) calloc(mMaxPulseOrder, sizeof(TProfile)); 45 hMaxProfile = new TProfile*[mMaxPulseOrder]; 46 // hEdgeProfile = (TProfile*) calloc(mMaxPulseOrder, sizeof(TProfile)); 47 hEdgeProfile = new TProfile*[mMaxPulseOrder]; 45 48 if (mOptions == "S") 46 hSlopeRisingEdge= (TH1F*) calloc(mMaxPulseOrder, sizeof(TH1F)); 49 { 50 // hSlopeRisingEdge= (TH1F*) calloc(mMaxPulseOrder, sizeof(TH1F)); 51 hSlopeRisingEdge = new TH1F*[mMaxPulseOrder]; 52 } 47 53 if (mOptions == "R") 48 hRisingToMaxEdge= (TH1F*) calloc(mMaxPulseOrder, sizeof(TH1F)); 54 { 55 // hRisingEdgeToMax= (TH1F*) calloc(mMaxPulseOrder, sizeof(TH1F)); 56 hRisingEdgeToMax = new TH1F*[mMaxPulseOrder]; 57 } 49 58 if (mOptions == "P") 50 hPosOfMax = (TH1F*) calloc(mMaxPulseOrder, sizeof(TH1F)); 59 { 60 // hPosOfMax = (TH1F*) calloc(mMaxPulseOrder, sizeof(TH1F)); 61 hPosOfMax = new TH1F*[mMaxPulseOrder]; 62 } 51 63 52 64 hList = new TObjArray; 53 65 54 66 BookPixelHistos(); 55 BookDistributionHistos() 67 BookDistributionHistos(); 56 68 } 57 69 … … 59 71 { 60 72 if (mVerbosityLevel > 2) cout << endl << "...delete current pixel histograms" ; 61 for (int order = 0;62 order < mMaxPulseOrder;63 order ++)64 {65 if (mVerbosityLevel > 3) cout << endl << "...deleting hMaxOverlay" << mHistogramId;66 delete hMaxOverlay[order];73 // for (int order = 0; 74 // order < mMaxPulseOrder; 75 // order ++) 76 // { 77 if (mVerbosityLevel > 3) cout << endl << "...deleting hMaxOverlay"; 78 delete[] hMaxOverlay; 67 79 hMaxOverlay = NULL; 68 if (mVerbosityLevel > 3) cout << endl << "...deleting hEdgeOverlay" << mHistogramId;69 delete hEdgeOverlay[order];80 if (mVerbosityLevel > 3) cout << endl << "...deleting hEdgeOverlay"; 81 delete[] hEdgeOverlay; 70 82 hEdgeOverlay = NULL; 71 if (mVerbosityLevel > 3) cout << endl << "...deleting hMaxProfile" << mHistogramId;72 delete hMaxProfile[order];83 if (mVerbosityLevel > 3) cout << endl << "...deleting hMaxProfile"; 84 delete[] hMaxProfile; 73 85 hMaxProfile = NULL; 74 if (mVerbosityLevel > 3) cout << endl << "...deleting hMaxProfile2" << mHistogramId;75 delete hEdgeProfile[order];86 if (mVerbosityLevel > 3) cout << endl << "...deleting hMaxProfile2"; 87 delete[] hEdgeProfile; 76 88 hEdgeProfile = NULL; 77 }89 // } 78 90 if (mVerbosityLevel > 3) cout << endl << "...deleting hList"; 79 91 delete hList; … … 97 109 if (mVerbosityLevel > 2) cout << endl << "...book pixel histograms" << endl; 98 110 TString histo_name; 99 for (int order = 0; order < mMaxPulseOrder; order ++) 100 { 111 112 for (int order =0; order > mMaxPulseOrder; order++) 113 { 114 histo_name = "hMaxOverlay"; 115 histo_name += order; 116 hMaxOverlay[order]=new TH2F( 117 histo_name, 118 "Overlay of detected pulses of one pulse order for one Pixel", 119 mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight , 120 (-1*mPixelOverlayXaxisLeft)-0.5, 121 mPixelOverlayXaxisRight-0.5 , 122 512, 123 -55.5, 124 200.5 125 ); 101 126 /* 102 127 SetHistogramAttributes( … … 107 132 ); 108 133 */ 109 histo_name = "hMaxOverlay";110 histo_name += order;111 134 if (mVerbosityLevel > 3) cout << "...booking " << histo_name << endl; 112 hMaxOverlay[order] = TH2F(113 histo_name,114 "Overlay of detected pulses of one pulse order for one Pixel",115 mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight ,116 (-1*mPixelOverlayXaxisLeft)-0.5,117 mPixelOverlayXaxisRight-0.5 ,118 512,119 -55.5,120 200.5121 );122 135 hMaxOverlay[order]->SetAxisRange( 123 136 mBSLMean - 5, … … 128 141 //hMaxProfile->SetBit(TH2F::kCanRebin); 129 142 hList->Add( hMaxOverlay[order] ); 143 } 144 145 for (int order = 0; order < mMaxPulseOrder; order ++) 146 { 130 147 131 148 //------------------------------------------------------------------------ … … 141 158 histo_name += order; 142 159 if (mVerbosityLevel > 3) cout << "...booking " << histo_name << endl; 143 hEdgeOverlay[order] = TH2F(160 hEdgeOverlay[order] = new TH2F( 144 161 histo_name, 145 162 "Overlay at rising edge of detected pulses of one pulse order for one Pixel ", … … 172 189 histo_name += order; 173 190 if (mVerbosityLevel > 3) cout << "...booking " << histo_name << endl; 174 hMaxProfile[order] = TProfile(191 hMaxProfile[order] = new TProfile( 175 192 histo_name, 176 193 "Mean value of each slice in overlay plot (Tprofile)", … … 201 218 ); 202 219 */ 203 histo_name = "hEdgeProfile"; 204 histo_name += order; 205 if (mVerbosityLevel > 3) cout << "...booking " << histo_name << endl; 206 hEdgeProfile[order] = TProfile( 207 histo_name, 208 "Mean value of each slice in overlay plot (Tprofile)", 209 mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight ,//nbinsx 210 (-1*mPixelOverlayXaxisLeft)-0.5, //xlow 211 mPixelOverlayXaxisRight-0.5 , //xup 212 // 512, //nbinsy 213 -55.5, //ylow 214 300.5, //yup 215 "s"); //option 216 hEdgeProfile[order]->SetLineColor(kRed); 217 hEdgeProfile[order]->SetAxisRange( 218 mBSLMean - 5, 219 (mGainMean*(order+1)) + 10, 220 "Y"); 221 hEdgeProfile[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" ); 222 hEdgeProfile[order]->GetYaxis()->SetTitle( "Amplitude [mV]" ); 223 //hMaxProfile->SetBit(TH2F::kCanRebin); 220 histo_name = "hEdgeProfile"; 221 histo_name += order; 222 if (mVerbosityLevel > 3) cout << "...booking " << histo_name << endl; 223 hEdgeProfile[order] = new TProfile( 224 histo_name, 225 "Mean value of each slice in overlay plot (Tprofile)", 226 mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight ,//nbinsx 227 (-1*mPixelOverlayXaxisLeft)-0.5, //xlow 228 mPixelOverlayXaxisRight-0.5 , //xup 229 // 512, //nbinsy 230 -55.5, //ylow 231 300.5, //yup 232 "s"); //option 233 hEdgeProfile[order]->SetLineColor(kRed); 234 hEdgeProfile[order]->SetAxisRange( 235 mBSLMean - 5, 236 (mGainMean*(order+1)) + 10, 237 "Y"); 238 hEdgeProfile[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" ); 239 hEdgeProfile[order]->GetYaxis()->SetTitle( "Amplitude [mV]" ); 240 //hMaxProfile->SetBit(TH2F::kCanRebin); 241 hList->Add( hEdgeProfile[order] ); 242 224 243 } 225 244 if (mVerbosityLevel > 2) cout << "...done" << endl; … … 231 250 void 232 251 Pixel::DrawHistograms( 233 TCanvas* pixelCanvas = NULL,234 int* histoFrameNr = NULL252 TCanvas* pixelCanvas, 253 int* histoFrameNr 235 254 ) 236 255 { … … 238 257 for (int pulse_order = 0; pulse_order < mMaxPulseOrder; pulse_order++) 239 258 { 240 pixelCanvas[pulse_order] ->cd( histoFrameNr[0] );259 pixelCanvas[pulse_order].cd( histoFrameNr[0] ); 241 260 hMaxOverlay[pulse_order]->Draw("COLZ"); 242 pixelCanvas[pulse_order] ->cd( histoFrameNr[2] );261 pixelCanvas[pulse_order].cd( histoFrameNr[2] ); 243 262 hMaxProfile[pulse_order]->Draw("COLZ"); 244 h MaxProfile2[pulse_order]->Draw("SAME");245 246 pixelCanvas[pulse_order] ->cd( histoFrameNr[1] );263 hEdgeProfile[pulse_order]->Draw("SAME"); 264 265 pixelCanvas[pulse_order].cd( histoFrameNr[1] ); 247 266 hEdgeOverlay[pulse_order]->Draw("COLZ"); 248 267 } … … 257 276 if (mOptions != "") 258 277 { 259 if (mVerbosityLevel > 2) cout << endl 260 << "...book distribution histograms" 261 << endl; 262 263 if (mOptions != "S") 278 TString histo_name; 279 for (int order =0; order > mMaxPulseOrder; order++) 280 { 281 if (mVerbosityLevel > 2) cout << endl 282 << "...book distribution histograms" 283 << endl; 284 285 if (mOptions.Contains("S")) 264 286 { 265 hSlopeRisingEdge = TH1F ( 266 "hSlopeRisingEdge", 287 histo_name = "hSlopeRisingEdge"; 288 histo_name += order; 289 hSlopeRisingEdge[order] = new TH1F ( 290 histo_name, 267 291 "Distribution of rising edge", 268 292 600, … … 270 294 10.1 271 295 ); 272 hSlopeRisingEdge->GetXaxis()->SetTitle( "Timeslices [a.u.]" ); 273 hSlopeRisingEdge->GetYaxis()->SetTitle( "counts" ); 296 hSlopeRisingEdge[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" ); 297 hSlopeRisingEdge[order]->GetYaxis()->SetTitle( "counts" ); 298 hList->Add( hSlopeRisingEdge[order] ); 274 299 } 275 300 276 if (mOptions != "R")301 if (mOptions.Contains("R")) 277 302 { 278 hRisingToMaxEdge = TH1F ( 279 "hRisingToMaxEdge", 303 histo_name = "hRisingEdgeToMax"; 304 histo_name += order; 305 hRisingEdgeToMax[order] = new TH1F ( 306 histo_name, 280 307 "Deviation of rising edge and maximum", 281 308 600, … … 283 310 10.1 284 311 ); 285 hRisingToMaxEdge->GetXaxis()->SetTitle( "Timeslices [a.u.]" ); 286 hRisingToMaxEdge->GetYaxis()->SetTitle( "counts" ); 312 hRisingEdgeToMax[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" ); 313 hRisingEdgeToMax[order]->GetYaxis()->SetTitle( "counts" ); 314 hList->Add( hRisingEdgeToMax[order] ); 287 315 } 288 316 289 if (mOptions != "P")317 if (mOptions.Contains("P")) 290 318 { 291 hPosOfMax = TH1F ( 292 "hPosOfMax", 319 histo_name = "hPosOfMax"; 320 histo_name += order; 321 hPosOfMax[order] = new TH1F ( 322 histo_name, 293 323 "Deviation of rising edge and maximum", 294 324 600, … … 296 326 10.1 297 327 ); 298 hPosOfMax->GetXaxis()->SetTitle( "Timeslices [a.u.]" ); 299 hPosOfMax->GetYaxis()->SetTitle( "counts" ); 328 hPosOfMax[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" ); 329 hPosOfMax[order]->GetYaxis()->SetTitle( "counts" ); 330 hList->Add( hPosOfMax[order] ); 300 331 } 301 332 302 if (mVerbosityLevel > 2) cout << "...done" << endl; 303 } 304 } 305 306 333 if (mVerbosityLevel > 2) cout << "...done" << endl; 334 } 335 } 336 } 337 338 void 339 Pixel::DrawDistributionHistograms( 340 TCanvas* pixelCanvas, 341 int* histoFrameNr 342 ) 343 { 344 if (mVerbosityLevel > 2) cout << endl << "...drawing distribution histograms" ; 345 for (int pulse_order = 0; pulse_order < mMaxPulseOrder; pulse_order++) 346 { 347 pixelCanvas[pulse_order].cd( histoFrameNr[0] ); 348 hSlopeRisingEdge[pulse_order]->Draw(); 349 pixelCanvas[pulse_order].cd( histoFrameNr[1] ); 350 hRisingEdgeToMax[pulse_order]->Draw(); 351 352 pixelCanvas[pulse_order].cd( histoFrameNr[2] ); 353 hPosOfMax[pulse_order]->Draw(); 354 } 355 } 356 // end of DrawDistributionHistograms 357 //---------------------------------------------------------------------------- 358 359 void 360 Pixel::SavePixelHistograms( 361 const char* outRootFileName 362 ) 363 { 364 SaveHistograms( 365 outRootFileName, 366 CreateSubDirName( mChid ), 367 hList, 368 mVerbosityLevel 369 ); 370 } 307 371 308 372
Note:
See TracChangeset
for help on using the changeset viewer.