| 1 | #include <iostream> | 
|---|
| 2 | #include <TMath.h> | 
|---|
| 3 | #include <TF1.h> | 
|---|
| 4 |  | 
|---|
| 5 | #include "rootfilehandler.h" | 
|---|
| 6 | #include "pixel.h" // class implemented | 
|---|
| 7 | using namespace std; | 
|---|
| 8 |  | 
|---|
| 9 | /////////////////////////////// PUBLIC /////////////////////////////////////// | 
|---|
| 10 |  | 
|---|
| 11 | //============================= LIFECYCLE ==================================== | 
|---|
| 12 |  | 
|---|
| 13 |  | 
|---|
| 14 | Pixel::Pixel( | 
|---|
| 15 | int         pixelID, | 
|---|
| 16 | int         maxPulsorder, | 
|---|
| 17 | int         verbosityLevel, | 
|---|
| 18 | bool        stats, | 
|---|
| 19 | TString     options, | 
|---|
| 20 | int         pixelOverlayXaxisLeft, | 
|---|
| 21 | int         pixelOverlayXaxisRight, | 
|---|
| 22 | float       bSLMean, | 
|---|
| 23 | float       gainMean, | 
|---|
| 24 | TFile*      filename, | 
|---|
| 25 | TFile*      outfilename | 
|---|
| 26 | ) | 
|---|
| 27 | { | 
|---|
| 28 | mConstructorType        = 1;        //important for deletion 0 delete distribution 1 delete TemplateHistos | 
|---|
| 29 |  | 
|---|
| 30 | mChid                   = pixelID; | 
|---|
| 31 | mMaxPulseOrder          = maxPulsorder; | 
|---|
| 32 | mVerbosityLevel         = verbosityLevel; | 
|---|
| 33 | mStats                  = stats; | 
|---|
| 34 | mOptions                = options; | 
|---|
| 35 | mPixelOverlayXaxisLeft  = pixelOverlayXaxisLeft; | 
|---|
| 36 | mPixelOverlayXaxisRight = pixelOverlayXaxisRight; | 
|---|
| 37 | mBSLMean                = bSLMean; | 
|---|
| 38 | mGainMean               = gainMean; | 
|---|
| 39 | mRootFile               = filename; | 
|---|
| 40 | mOutRootFile            = outfilename; | 
|---|
| 41 |  | 
|---|
| 42 | hMaxOverlay  = new TH2F*[mMaxPulseOrder]; | 
|---|
| 43 | hEdgeOverlay = new TH2F*[mMaxPulseOrder]; | 
|---|
| 44 | hMaxProfile  = new TProfile*[mMaxPulseOrder]; | 
|---|
| 45 | hEdgeProfile = new TProfile*[mMaxPulseOrder]; | 
|---|
| 46 |  | 
|---|
| 47 | hPixelMax  = new TH1F*[mMaxPulseOrder]; | 
|---|
| 48 | hPixelMedian = new TH1F*[mMaxPulseOrder]; | 
|---|
| 49 | hPixelMean  = new TH1F*[mMaxPulseOrder]; | 
|---|
| 50 |  | 
|---|
| 51 | hPixelEdgeMax  = new TH1F*[mMaxPulseOrder]; | 
|---|
| 52 | hPixelEdgeMedian = new TH1F*[mMaxPulseOrder]; | 
|---|
| 53 | hPixelEdgeMean  = new TH1F*[mMaxPulseOrder]; | 
|---|
| 54 |  | 
|---|
| 55 | hList           = new TList(); | 
|---|
| 56 |  | 
|---|
| 57 | if (mOptions.Contains("C") ) | 
|---|
| 58 | { | 
|---|
| 59 | hChi2EdgetoMax = new TH1F*[mMaxPulseOrder]; | 
|---|
| 60 | } | 
|---|
| 61 |  | 
|---|
| 62 | if (options.Contains("L")) | 
|---|
| 63 | { | 
|---|
| 64 | LoadPulseHistos( ); | 
|---|
| 65 | } | 
|---|
| 66 | else | 
|---|
| 67 | { | 
|---|
| 68 | BookPixelHistos(); | 
|---|
| 69 | } | 
|---|
| 70 |  | 
|---|
| 71 | if (mOptions.Contains("C")) | 
|---|
| 72 | { | 
|---|
| 73 | BookDistributionHistos(); | 
|---|
| 74 | } | 
|---|
| 75 |  | 
|---|
| 76 | BookTemplateHistos(); | 
|---|
| 77 | BookEdgeTemplateHistos(); | 
|---|
| 78 | } | 
|---|
| 79 |  | 
|---|
| 80 | Pixel::Pixel( | 
|---|
| 81 | int         pixelID, | 
|---|
| 82 | int         maxPulsorder, | 
|---|
| 83 | int         verbosityLevel, | 
|---|
| 84 | bool        stats, | 
|---|
| 85 | TString     options, | 
|---|
| 86 | int         pixelOverlayXaxisLeft, | 
|---|
| 87 | int         pixelOverlayXaxisRight, | 
|---|
| 88 | float       bSLMean, | 
|---|
| 89 | float       gainMean | 
|---|
| 90 | ) | 
|---|
| 91 | { | 
|---|
| 92 | mConstructorType        = 0; | 
|---|
| 93 |  | 
|---|
| 94 | mChid                   = pixelID; | 
|---|
| 95 | mMaxPulseOrder          = maxPulsorder; | 
|---|
| 96 | mVerbosityLevel         = verbosityLevel; | 
|---|
| 97 | mStats                  = stats;        ///TODO: HANDOVER THE VALUE | 
|---|
| 98 | mOptions                = options; | 
|---|
| 99 | mPixelOverlayXaxisLeft  = pixelOverlayXaxisLeft; | 
|---|
| 100 | mPixelOverlayXaxisRight = pixelOverlayXaxisRight; | 
|---|
| 101 | mBSLMean                = bSLMean; | 
|---|
| 102 | mGainMean               = gainMean; | 
|---|
| 103 |  | 
|---|
| 104 | hMaxOverlay  = new TH2F*[mMaxPulseOrder]; | 
|---|
| 105 | hEdgeOverlay = new TH2F*[mMaxPulseOrder]; | 
|---|
| 106 | hMaxProfile  = new TProfile*[mMaxPulseOrder]; | 
|---|
| 107 | hEdgeProfile = new TProfile*[mMaxPulseOrder]; | 
|---|
| 108 |  | 
|---|
| 109 | if (mOptions.Contains("S") ) | 
|---|
| 110 | { | 
|---|
| 111 | hSlopeRisingEdge = new TH1F*[mMaxPulseOrder]; | 
|---|
| 112 | } | 
|---|
| 113 |  | 
|---|
| 114 | if (mOptions.Contains("R") ) | 
|---|
| 115 | { | 
|---|
| 116 | hRisingEdgeToMax = new TH1I*[mMaxPulseOrder]; | 
|---|
| 117 | } | 
|---|
| 118 |  | 
|---|
| 119 | if (mOptions.Contains("M") ) | 
|---|
| 120 | { | 
|---|
| 121 | hPosOfMax = new TH1I*[mMaxPulseOrder]; | 
|---|
| 122 | } | 
|---|
| 123 |  | 
|---|
| 124 | hList           = new TList(); | 
|---|
| 125 |  | 
|---|
| 126 | BookPixelHistos(); | 
|---|
| 127 | BookDistributionHistos(); | 
|---|
| 128 | } | 
|---|
| 129 |  | 
|---|
| 130 | Pixel::~Pixel() | 
|---|
| 131 | { | 
|---|
| 132 | if (mVerbosityLevel > 1) | 
|---|
| 133 | { | 
|---|
| 134 | cout << endl << "...delete histograms of pixel " << mChid ; | 
|---|
| 135 | cout << endl << "...mConstructorType = " << mConstructorType ; | 
|---|
| 136 | } | 
|---|
| 137 |  | 
|---|
| 138 | if (mConstructorType == 0) | 
|---|
| 139 | { | 
|---|
| 140 | DeleteDistributionHistos(); | 
|---|
| 141 | } | 
|---|
| 142 |  | 
|---|
| 143 | if (mConstructorType == 1) | 
|---|
| 144 | { | 
|---|
| 145 | DeleteTemplateHistos(); | 
|---|
| 146 | DeleteEdgeTemplateHistos(); | 
|---|
| 147 | } | 
|---|
| 148 |  | 
|---|
| 149 | DeletePixelHistos(); | 
|---|
| 150 | delete hList; | 
|---|
| 151 | hList = NULL; | 
|---|
| 152 | if (mVerbosityLevel > 1) | 
|---|
| 153 | { | 
|---|
| 154 | cout << endl << "...histograms of pixel " << mChid ; | 
|---|
| 155 | cout << "...deleted " << endl ; | 
|---|
| 156 | } | 
|---|
| 157 | }// ~Pixel | 
|---|
| 158 |  | 
|---|
| 159 |  | 
|---|
| 160 | //============================= OPERATORS ==================================== | 
|---|
| 161 |  | 
|---|
| 162 | //XX& | 
|---|
| 163 | //XX::operator=(const XX&); | 
|---|
| 164 | //{ | 
|---|
| 165 | //    return *this; | 
|---|
| 166 |  | 
|---|
| 167 | //}// = | 
|---|
| 168 |  | 
|---|
| 169 | //============================= OPERATIONS =================================== | 
|---|
| 170 | void | 
|---|
| 171 | Pixel::DrawOverlayHistograms( | 
|---|
| 172 | TCanvas**    pixelCanvas, | 
|---|
| 173 | int*        histoFrameNr | 
|---|
| 174 | ) | 
|---|
| 175 | { | 
|---|
| 176 | if (mVerbosityLevel > 2) cout << endl << "...drawing pulse histograms" ; | 
|---|
| 177 | for (int pulse_order = 0; pulse_order < mMaxPulseOrder; pulse_order++) | 
|---|
| 178 | { | 
|---|
| 179 | pixelCanvas[pulse_order]->cd( histoFrameNr[0] ); | 
|---|
| 180 | hMaxOverlay[pulse_order]->Draw("COLZ"); | 
|---|
| 181 | pixelCanvas[pulse_order]->cd( histoFrameNr[2] ); | 
|---|
| 182 | hMaxProfile[pulse_order]->Draw(); | 
|---|
| 183 |  | 
|---|
| 184 | pixelCanvas[pulse_order]->cd( histoFrameNr[1] ); | 
|---|
| 185 | hEdgeOverlay[pulse_order]->Draw("COLZ"); | 
|---|
| 186 | pixelCanvas[pulse_order]->cd( histoFrameNr[3] ); | 
|---|
| 187 | hEdgeProfile[pulse_order]->Draw(); | 
|---|
| 188 | } | 
|---|
| 189 | } | 
|---|
| 190 | // end of DrawOverlayHistograms | 
|---|
| 191 | //---------------------------------------------------------------------------- | 
|---|
| 192 |  | 
|---|
| 193 | void | 
|---|
| 194 | Pixel::DrawDistributionHistograms( | 
|---|
| 195 | TCanvas**    pixelCanvas, | 
|---|
| 196 | int*        histoFrameNr | 
|---|
| 197 | ) | 
|---|
| 198 | { | 
|---|
| 199 | if (mVerbosityLevel > 2) cout << endl << "...drawing distribution histograms" ; | 
|---|
| 200 | bool nothing_to_fill = true; | 
|---|
| 201 | for (int pulse_order = 0; pulse_order < mMaxPulseOrder; pulse_order++) | 
|---|
| 202 | { | 
|---|
| 203 | if (mOptions.Contains("S") ) | 
|---|
| 204 | { | 
|---|
| 205 | pixelCanvas[pulse_order]->cd( histoFrameNr[0] ); | 
|---|
| 206 | hSlopeRisingEdge[pulse_order]->Draw(); | 
|---|
| 207 | nothing_to_fill = false; | 
|---|
| 208 | } | 
|---|
| 209 |  | 
|---|
| 210 | if (mOptions.Contains("R") ) | 
|---|
| 211 | { | 
|---|
| 212 | pixelCanvas[pulse_order]->cd( histoFrameNr[1] ); | 
|---|
| 213 | hRisingEdgeToMax[pulse_order]->Draw(); | 
|---|
| 214 | nothing_to_fill = false; | 
|---|
| 215 | } | 
|---|
| 216 |  | 
|---|
| 217 | if (mOptions.Contains("M") ) | 
|---|
| 218 | { | 
|---|
| 219 | pixelCanvas[pulse_order]->cd( histoFrameNr[2] ); | 
|---|
| 220 | hPosOfMax[pulse_order]->Draw(); | 
|---|
| 221 | nothing_to_fill = false; | 
|---|
| 222 | } | 
|---|
| 223 |  | 
|---|
| 224 | } | 
|---|
| 225 | if (nothing_to_fill) | 
|---|
| 226 | { | 
|---|
| 227 | cout << endl << "there were NO DISTRIBUTION HISTOGRAMS to fill" << endl; | 
|---|
| 228 | } | 
|---|
| 229 | } | 
|---|
| 230 | // end of DrawDistributionHistograms | 
|---|
| 231 | //---------------------------------------------------------------------------- | 
|---|
| 232 |  | 
|---|
| 233 | void | 
|---|
| 234 | Pixel::DrawTemplateHistograms( | 
|---|
| 235 | TCanvas**    pixelCanvas, | 
|---|
| 236 | int*        histoFrameNr | 
|---|
| 237 | ) | 
|---|
| 238 | { | 
|---|
| 239 | int mrkStyle =1; | 
|---|
| 240 | int mrkSize  = 2; | 
|---|
| 241 | if (mVerbosityLevel > 2) cout << "...drawing Template histograms" << endl ; | 
|---|
| 242 | for (int pulse_order = 0; pulse_order < mMaxPulseOrder; pulse_order++) | 
|---|
| 243 | { | 
|---|
| 244 | pixelCanvas[pulse_order]->cd( histoFrameNr[0] ); | 
|---|
| 245 | hMaxOverlay[pulse_order]->Draw("COLZ"); | 
|---|
| 246 |  | 
|---|
| 247 | pixelCanvas[pulse_order]->cd( histoFrameNr[1] ); | 
|---|
| 248 | hPixelMax[pulse_order]->Draw("E1"); | 
|---|
| 249 | hPixelMax[pulse_order]->SetMarkerColor(kBlue); | 
|---|
| 250 | hPixelMax[pulse_order]->SetLineColor(kBlack); | 
|---|
| 251 | hPixelMax[pulse_order]->SetMarkerStyle(mrkStyle); | 
|---|
| 252 | hPixelMax[pulse_order]->SetMarkerSize(mrkSize); | 
|---|
| 253 |  | 
|---|
| 254 | pixelCanvas[pulse_order]->cd( histoFrameNr[2] ); | 
|---|
| 255 | hPixelMedian[pulse_order]->Draw("E1"); | 
|---|
| 256 | hPixelMedian[pulse_order]->SetMarkerColor(kBlue); | 
|---|
| 257 | hPixelMedian[pulse_order]->SetLineColor(kBlack); | 
|---|
| 258 | hPixelMedian[pulse_order]->SetMarkerStyle(mrkStyle); | 
|---|
| 259 | hPixelMedian[pulse_order]->SetMarkerSize(mrkSize); | 
|---|
| 260 |  | 
|---|
| 261 | pixelCanvas[pulse_order]->cd( histoFrameNr[3] ); | 
|---|
| 262 | hPixelMean[pulse_order]->Draw("E1"); | 
|---|
| 263 | hPixelMean[pulse_order]->SetMarkerColor(kBlue); | 
|---|
| 264 | hPixelMean[pulse_order]->SetLineColor(kBlack); | 
|---|
| 265 | hPixelMean[pulse_order]->SetMarkerStyle(mrkStyle); | 
|---|
| 266 | hPixelMean[pulse_order]->SetMarkerSize(mrkSize); | 
|---|
| 267 | //        hPixelMax[pulse_order]->Draw("SAME"); | 
|---|
| 268 | //        hPixelMedian[pulse_order]->Draw("SAME"); | 
|---|
| 269 |  | 
|---|
| 270 | } | 
|---|
| 271 | } | 
|---|
| 272 | // end of DrawTemplateHistograms | 
|---|
| 273 | //---------------------------------------------------------------------------- | 
|---|
| 274 |  | 
|---|
| 275 | void | 
|---|
| 276 | Pixel::DrawEdgeTemplateHistograms( | 
|---|
| 277 | TCanvas**    pixelCanvas, | 
|---|
| 278 | int*        histoFrameNr | 
|---|
| 279 | ) | 
|---|
| 280 | { | 
|---|
| 281 | int mrkStyle = 1; | 
|---|
| 282 | int mrkSize  = 3; | 
|---|
| 283 |  | 
|---|
| 284 | if (mVerbosityLevel > 2) cout << endl << "...drawing Template histograms" ; | 
|---|
| 285 | for (int pulse_order = 0; pulse_order < mMaxPulseOrder; pulse_order++) | 
|---|
| 286 | { | 
|---|
| 287 | pixelCanvas[pulse_order]->cd( histoFrameNr[4] ); | 
|---|
| 288 | hEdgeOverlay[pulse_order]->Draw("COLZ"); | 
|---|
| 289 |  | 
|---|
| 290 | pixelCanvas[pulse_order]->cd( histoFrameNr[5] ); | 
|---|
| 291 | hPixelEdgeMax[pulse_order]->Draw("E1"); | 
|---|
| 292 | hPixelEdgeMax[pulse_order]->SetLineColor(kBlack); | 
|---|
| 293 | hPixelEdgeMax[pulse_order]->SetMarkerColor(kBlue); | 
|---|
| 294 | hPixelEdgeMax[pulse_order]->SetMarkerStyle(mrkStyle); | 
|---|
| 295 | hPixelEdgeMax[pulse_order]->SetMarkerSize(mrkSize); | 
|---|
| 296 |  | 
|---|
| 297 | pixelCanvas[pulse_order]->cd( histoFrameNr[6] ); | 
|---|
| 298 | hPixelEdgeMedian[pulse_order]->Draw("E1"); | 
|---|
| 299 | hPixelEdgeMedian[pulse_order]->SetLineColor(kBlack); | 
|---|
| 300 | hPixelEdgeMedian[pulse_order]->SetMarkerColor(kBlue); | 
|---|
| 301 | hPixelEdgeMedian[pulse_order]->SetMarkerStyle(mrkStyle); | 
|---|
| 302 | hPixelEdgeMedian[pulse_order]->SetMarkerSize(mrkSize); | 
|---|
| 303 |  | 
|---|
| 304 | pixelCanvas[pulse_order]->cd( histoFrameNr[7] ); | 
|---|
| 305 | hPixelEdgeMean[pulse_order]->Draw("E1"); | 
|---|
| 306 | hPixelEdgeMean[pulse_order]->SetLineColor(kBlack); | 
|---|
| 307 | hPixelEdgeMean[pulse_order]->SetMarkerColor(kBlue); | 
|---|
| 308 | hPixelEdgeMean[pulse_order]->SetMarkerStyle(mrkStyle); | 
|---|
| 309 | hPixelEdgeMean[pulse_order]->SetMarkerSize(mrkSize); | 
|---|
| 310 | //        hPixelEdgeMax[pulse_order]->Draw("SAME"); | 
|---|
| 311 | //        hPixelEdgeMedian[pulse_order]->Draw("SAME"); | 
|---|
| 312 |  | 
|---|
| 313 | } | 
|---|
| 314 | } | 
|---|
| 315 | // end of DrawTemplateHistograms | 
|---|
| 316 | //---------------------------------------------------------------------------- | 
|---|
| 317 |  | 
|---|
| 318 |  | 
|---|
| 319 |  | 
|---|
| 320 |  | 
|---|
| 321 | void | 
|---|
| 322 | Pixel::SavePixelHistograms( | 
|---|
| 323 | TString     outRootFileName, | 
|---|
| 324 | bool        saveResults | 
|---|
| 325 | ) | 
|---|
| 326 | { | 
|---|
| 327 | if (mVerbosityLevel > 2) cout << endl << "Saving histograms of Pixel# " << mChid; | 
|---|
| 328 | if (!saveResults) return; | 
|---|
| 329 | SaveHistograms( | 
|---|
| 330 | outRootFileName, | 
|---|
| 331 | CreateSubDirName( mChid ), | 
|---|
| 332 | hList, | 
|---|
| 333 | saveResults, | 
|---|
| 334 | mVerbosityLevel | 
|---|
| 335 | ); | 
|---|
| 336 | } | 
|---|
| 337 | // end of SavePixelHistograms | 
|---|
| 338 | //---------------------------------------------------------------------------- | 
|---|
| 339 |  | 
|---|
| 340 | TString | 
|---|
| 341 | Pixel::HistoName( | 
|---|
| 342 | TString     histoname, | 
|---|
| 343 | int         order | 
|---|
| 344 | ) | 
|---|
| 345 | { | 
|---|
| 346 | histoname +=   mChid; | 
|---|
| 347 | histoname +=   "_"; | 
|---|
| 348 | histoname +=   order; | 
|---|
| 349 | return histoname; | 
|---|
| 350 | } | 
|---|
| 351 |  | 
|---|
| 352 | TString | 
|---|
| 353 | Pixel::ChooseCycleNumber( | 
|---|
| 354 | TString     histoname, | 
|---|
| 355 | int         cycleNumber | 
|---|
| 356 | ) | 
|---|
| 357 | { | 
|---|
| 358 | histoname +=   ";"; | 
|---|
| 359 | histoname +=   cycleNumber; | 
|---|
| 360 | return histoname; | 
|---|
| 361 | } | 
|---|
| 362 |  | 
|---|
| 363 | TString | 
|---|
| 364 | Pixel::HistoTitle( | 
|---|
| 365 | TString     histo_title, | 
|---|
| 366 | int         order | 
|---|
| 367 | ) | 
|---|
| 368 | { | 
|---|
| 369 | histo_title +=   " [Pixel_Order] "; | 
|---|
| 370 | histo_title +=   mChid; | 
|---|
| 371 | histo_title +=   "_"; | 
|---|
| 372 | histo_title +=   order; | 
|---|
| 373 | return histo_title; | 
|---|
| 374 | } | 
|---|
| 375 |  | 
|---|
| 376 | TString | 
|---|
| 377 | Pixel::CsvFileName( | 
|---|
| 378 | TString     path, | 
|---|
| 379 | TString     overlayMethod, | 
|---|
| 380 | int         order | 
|---|
| 381 | ) | 
|---|
| 382 | { | 
|---|
| 383 | path += "CSV/"; | 
|---|
| 384 | path += overlayMethod; | 
|---|
| 385 | path += "OverlayTemplate"; | 
|---|
| 386 | path += "_"; | 
|---|
| 387 | path +=   mChid; | 
|---|
| 388 | path +=   "_"; | 
|---|
| 389 | path +=   order; | 
|---|
| 390 | path +=   ".csv"; | 
|---|
| 391 | return path; | 
|---|
| 392 | } | 
|---|
| 393 |  | 
|---|
| 394 |  | 
|---|
| 395 | //============================= ACESS      =================================== | 
|---|
| 396 | //============================= INQUIRY    =================================== | 
|---|
| 397 | /////////////////////////////// PROTECTED  /////////////////////////////////// | 
|---|
| 398 |  | 
|---|
| 399 | /////////////////////////////// PRIVATE    /////////////////////////////////// | 
|---|
| 400 |  | 
|---|
| 401 | void | 
|---|
| 402 | Pixel::BookPixelHistos() | 
|---|
| 403 | { | 
|---|
| 404 | if (mVerbosityLevel > 2) cout << endl << "...book pixel histograms" << endl; | 
|---|
| 405 | for (int order = 0; order < mMaxPulseOrder; order++) | 
|---|
| 406 | { | 
|---|
| 407 | if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hMaxOverlay", order) << endl; | 
|---|
| 408 | hMaxOverlay[order]=new TH2F( | 
|---|
| 409 | HistoName("hMaxOverlay", order), | 
|---|
| 410 | HistoTitle("Overlay at peak maximum of detected pulses of", order), | 
|---|
| 411 | mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight , | 
|---|
| 412 | (-1*mPixelOverlayXaxisLeft)-0.5, | 
|---|
| 413 | mPixelOverlayXaxisRight-0.5 , | 
|---|
| 414 | 512, | 
|---|
| 415 | -55.25, | 
|---|
| 416 | 200.75 | 
|---|
| 417 | ); | 
|---|
| 418 |  | 
|---|
| 419 | hMaxOverlay[order]->SetAxisRange( | 
|---|
| 420 | mBSLMean - 5, | 
|---|
| 421 | (mGainMean*(order+1)) + 10, | 
|---|
| 422 | "Y"); | 
|---|
| 423 | hMaxOverlay[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" ); | 
|---|
| 424 | hMaxOverlay[order]->GetYaxis()->SetTitle( "Amplitude [mV]" ); | 
|---|
| 425 | //hMaxProfile->SetBit(TH2F::kCanRebin); | 
|---|
| 426 | hMaxOverlay[order]->SetStats(mStats); | 
|---|
| 427 | hList->Add( hMaxOverlay[order] ); | 
|---|
| 428 |  | 
|---|
| 429 | //------------------------------------------------------------------------ | 
|---|
| 430 |  | 
|---|
| 431 | if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hEdgeOverlay", order) << endl; | 
|---|
| 432 | hEdgeOverlay[order] = new TH2F( | 
|---|
| 433 | HistoName("hEdgeOverlay", order), | 
|---|
| 434 | HistoTitle("Overlay at rising edge of detected pulses of", order), | 
|---|
| 435 | mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight , | 
|---|
| 436 | (-1*mPixelOverlayXaxisLeft)-0.5, | 
|---|
| 437 | mPixelOverlayXaxisRight-0.5 , | 
|---|
| 438 | 512, | 
|---|
| 439 | -55.25, | 
|---|
| 440 | 200.75 | 
|---|
| 441 | ); | 
|---|
| 442 |  | 
|---|
| 443 | hEdgeOverlay[order]->SetAxisRange( | 
|---|
| 444 | mBSLMean - 5, | 
|---|
| 445 | (mGainMean*(order+1)) + 10, | 
|---|
| 446 | "Y"); | 
|---|
| 447 | hEdgeOverlay[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" ); | 
|---|
| 448 | hEdgeOverlay[order]->GetYaxis()->SetTitle( "Amplitude [mV]" ); | 
|---|
| 449 | hEdgeOverlay[order]->SetStats(mStats); | 
|---|
| 450 | hList->Add( hEdgeOverlay[order] ); | 
|---|
| 451 |  | 
|---|
| 452 | //------------------------------------------------------------------------ | 
|---|
| 453 |  | 
|---|
| 454 | if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hMaxProfile", order) << endl; | 
|---|
| 455 | hMaxProfile[order] = new TProfile( | 
|---|
| 456 | HistoName("hMaxProfile", order), | 
|---|
| 457 | HistoTitle("Mean value of each slice in overlay plot (Tprofile)", order), | 
|---|
| 458 | mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight ,//nbinsx | 
|---|
| 459 | (-1*mPixelOverlayXaxisLeft)-0.5,                 //xlow | 
|---|
| 460 | mPixelOverlayXaxisRight-0.5 ,                    //xup | 
|---|
| 461 | //                512,                                            //nbinsy | 
|---|
| 462 | -55.25,                                          //ylow | 
|---|
| 463 | 300.75,                                          //yup | 
|---|
| 464 | "s");                                           //option | 
|---|
| 465 | hMaxProfile[order]->SetAxisRange( | 
|---|
| 466 | mBSLMean - 5, | 
|---|
| 467 | (mGainMean*(order+1)) + 10, | 
|---|
| 468 | "Y"); | 
|---|
| 469 | hMaxProfile[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" ); | 
|---|
| 470 | hMaxProfile[order]->GetYaxis()->SetTitle( "Amplitude [mV]" ); | 
|---|
| 471 | //hMaxProfile->SetBit(TH2F::kCanRebin); | 
|---|
| 472 | hMaxProfile[order]->SetStats(mStats); | 
|---|
| 473 | hList->Add( hMaxProfile[order] ); | 
|---|
| 474 |  | 
|---|
| 475 |  | 
|---|
| 476 | //------------------------------------------------------------------------ | 
|---|
| 477 |  | 
|---|
| 478 | if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hEdgeProfile", order) << endl; | 
|---|
| 479 | hEdgeProfile[order] = new TProfile( | 
|---|
| 480 | HistoName("hEdgeProfile", order), | 
|---|
| 481 | HistoTitle("Mean value of each slice in overlay plot (Tprofile)", order), | 
|---|
| 482 | mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight ,//nbinsx | 
|---|
| 483 | (-1*mPixelOverlayXaxisLeft)-0.5,                 //xlow | 
|---|
| 484 | mPixelOverlayXaxisRight-0.5 ,                    //xup | 
|---|
| 485 | //                512,                                            //nbinsy | 
|---|
| 486 | -55.25,                                          //ylow | 
|---|
| 487 | 300.75,                                          //yup | 
|---|
| 488 | "s");                                           //option | 
|---|
| 489 | hEdgeProfile[order]->SetLineColor(kRed); | 
|---|
| 490 | hEdgeProfile[order]->SetAxisRange( | 
|---|
| 491 | mBSLMean - 5, | 
|---|
| 492 | (mGainMean*(order+1)) + 10, | 
|---|
| 493 | "Y"); | 
|---|
| 494 | hEdgeProfile[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" ); | 
|---|
| 495 | hEdgeProfile[order]->GetYaxis()->SetTitle( "Amplitude [mV]" ); | 
|---|
| 496 | //hMaxProfile->SetBit(TH2F::kCanRebin); | 
|---|
| 497 | hEdgeProfile[order]->SetStats(mStats); | 
|---|
| 498 | hList->Add( hEdgeProfile[order] ); | 
|---|
| 499 |  | 
|---|
| 500 | } | 
|---|
| 501 | if (mVerbosityLevel > 2) cout << "...done" << endl; | 
|---|
| 502 | } | 
|---|
| 503 | //end of BookPixelHistos | 
|---|
| 504 | //---------------------------------------------------------------------------- | 
|---|
| 505 |  | 
|---|
| 506 | void | 
|---|
| 507 | Pixel::BookDistributionHistos( ) | 
|---|
| 508 | { | 
|---|
| 509 | if (!mOptions.IsNull() ) | 
|---|
| 510 | { | 
|---|
| 511 | int x_min = 0; | 
|---|
| 512 | int x_max = 0; | 
|---|
| 513 |  | 
|---|
| 514 | for (int order =0; order < mMaxPulseOrder; order++) | 
|---|
| 515 | { | 
|---|
| 516 | if (mVerbosityLevel > 2) cout << endl | 
|---|
| 517 | << "...book distribution histograms" | 
|---|
| 518 | << endl; | 
|---|
| 519 |  | 
|---|
| 520 | if (mOptions.Contains("S")) | 
|---|
| 521 | { | 
|---|
| 522 | if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hSlopeRisingEdge", order) << endl; | 
|---|
| 523 | hSlopeRisingEdge[order] = new TH1F ( | 
|---|
| 524 | HistoName("hSlopeRisingEdge", order), | 
|---|
| 525 | HistoTitle("Distribution of rising edge's slope", order), | 
|---|
| 526 | 600, | 
|---|
| 527 | -10.1, | 
|---|
| 528 | 10.1 | 
|---|
| 529 | ); | 
|---|
| 530 | hSlopeRisingEdge[order]->SetAxisRange( | 
|---|
| 531 | -1, | 
|---|
| 532 | 7, | 
|---|
| 533 | "X"); | 
|---|
| 534 | hSlopeRisingEdge[order]->GetXaxis()->SetTitle( "Slope Amplitude/time [mV/timeslices]" ); | 
|---|
| 535 | hSlopeRisingEdge[order]->GetYaxis()->SetTitle( "counts" ); | 
|---|
| 536 | hSlopeRisingEdge[order]->SetStats(mStats); | 
|---|
| 537 | hList->Add( hSlopeRisingEdge[order] ); | 
|---|
| 538 | } | 
|---|
| 539 |  | 
|---|
| 540 | if (mOptions.Contains("R")) | 
|---|
| 541 | { | 
|---|
| 542 | x_min = -15; | 
|---|
| 543 | x_max = 35; | 
|---|
| 544 |  | 
|---|
| 545 | if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hRisingEdgeToMax", order) << endl; | 
|---|
| 546 | hRisingEdgeToMax[order] = new TH1I ( | 
|---|
| 547 | HistoName("hRisingEdgeToMax", order), | 
|---|
| 548 | HistoTitle("Distribution of distance between rising edge and pulse's maximum", order), | 
|---|
| 549 | x_max -x_min, | 
|---|
| 550 | x_min, | 
|---|
| 551 | x_max | 
|---|
| 552 | ); | 
|---|
| 553 | hSlopeRisingEdge[order]->SetAxisRange( | 
|---|
| 554 | -5, | 
|---|
| 555 | 25, | 
|---|
| 556 | "X"); | 
|---|
| 557 | hRisingEdgeToMax[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" ); | 
|---|
| 558 | hRisingEdgeToMax[order]->GetYaxis()->SetTitle( "counts" ); | 
|---|
| 559 | hRisingEdgeToMax[order]->SetStats(mStats); | 
|---|
| 560 | hList->Add( hRisingEdgeToMax[order] ); | 
|---|
| 561 | } | 
|---|
| 562 |  | 
|---|
| 563 | if (mOptions.Contains("M")) | 
|---|
| 564 | { | 
|---|
| 565 | x_min = 10; | 
|---|
| 566 | x_max = 290; | 
|---|
| 567 | if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hPosOfMax", order) << endl; | 
|---|
| 568 | hPosOfMax[order] = new TH1I ( | 
|---|
| 569 | HistoName("hPosOfMax", order), | 
|---|
| 570 | HistoTitle("Distribution of pulse's maximum's positon", order), | 
|---|
| 571 | x_max - x_min, | 
|---|
| 572 | x_min, | 
|---|
| 573 | x_max | 
|---|
| 574 | ); | 
|---|
| 575 | hPosOfMax[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" ); | 
|---|
| 576 | hPosOfMax[order]->GetYaxis()->SetTitle( "counts" ); | 
|---|
| 577 | hRisingEdgeToMax[order]->SetStats(mStats); | 
|---|
| 578 | hList->Add( hPosOfMax[order] ); | 
|---|
| 579 | } | 
|---|
| 580 |  | 
|---|
| 581 | if (mOptions.Contains("C")) | 
|---|
| 582 | { | 
|---|
| 583 | if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hSlopeRisingEdge", order) << endl; | 
|---|
| 584 | hChi2EdgetoMax[order] = new TH1F ( | 
|---|
| 585 | HistoName("hChi2EdgetoMax", order), | 
|---|
| 586 | HistoTitle("Distribution of CHI2 comparison of Edge and Max", order), | 
|---|
| 587 | 600, | 
|---|
| 588 | -299, | 
|---|
| 589 | 300 | 
|---|
| 590 | ); | 
|---|
| 591 | hChi2EdgetoMax[order]->SetAxisRange( | 
|---|
| 592 | -1, | 
|---|
| 593 | 7, | 
|---|
| 594 | "X"); | 
|---|
| 595 | hChi2EdgetoMax[order]->GetXaxis()->SetTitle( "p-Value" ); | 
|---|
| 596 | hChi2EdgetoMax[order]->GetYaxis()->SetTitle( "counts" ); | 
|---|
| 597 | hChi2EdgetoMax[order]->SetStats(mStats); | 
|---|
| 598 | //                hList->Add( hChi2EdgetoMax[order] ); | 
|---|
| 599 | } | 
|---|
| 600 |  | 
|---|
| 601 | if (mVerbosityLevel > 2) cout << "...done" << endl; | 
|---|
| 602 | } | 
|---|
| 603 | } | 
|---|
| 604 | } | 
|---|
| 605 | //end of BookDistributionHistos | 
|---|
| 606 | //---------------------------------------------------------------------------- | 
|---|
| 607 |  | 
|---|
| 608 | void | 
|---|
| 609 | Pixel::BookTemplateHistos() | 
|---|
| 610 | { | 
|---|
| 611 | if (mVerbosityLevel > 2) cout << endl << "...book pixel histograms" << endl; | 
|---|
| 612 | for (int order = 0; order < mMaxPulseOrder; order++) | 
|---|
| 613 | { | 
|---|
| 614 | if (mVerbosityLevel > 3) | 
|---|
| 615 | { | 
|---|
| 616 | cout << "\t...booking " << HistoName("hPixelMax", order) << endl; | 
|---|
| 617 | } | 
|---|
| 618 |  | 
|---|
| 619 | hPixelMax[order]=new TH1F( | 
|---|
| 620 | HistoName("hPixelMax", order), | 
|---|
| 621 | HistoTitle("Maximum value of each slice in overlay plot of", order), | 
|---|
| 622 | mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight , | 
|---|
| 623 | (-1*mPixelOverlayXaxisLeft)-0.5, | 
|---|
| 624 | mPixelOverlayXaxisRight-0.5 | 
|---|
| 625 | ); | 
|---|
| 626 |  | 
|---|
| 627 | hPixelMax[order]->SetAxisRange( | 
|---|
| 628 | mBSLMean - 5, | 
|---|
| 629 | (mGainMean*(order+1)) + 10, | 
|---|
| 630 | "Y"); | 
|---|
| 631 | hPixelMax[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" ); | 
|---|
| 632 | hPixelMax[order]->GetYaxis()->SetTitle( "Amplitude [mV]" ); | 
|---|
| 633 | //hMaxProfile->SetBit(TH2F::kCanRebin); | 
|---|
| 634 | hPixelMax[order]->SetStats(mStats); | 
|---|
| 635 | hList->Add( hPixelMax[order] ); | 
|---|
| 636 |  | 
|---|
| 637 | //------------------------------------------------------------------------ | 
|---|
| 638 |  | 
|---|
| 639 | if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hPixelMean", order) << endl; | 
|---|
| 640 | hPixelMean[order] = new TH1F( | 
|---|
| 641 | HistoName("hPixelMean", order), | 
|---|
| 642 | HistoTitle("Mean value of each slice in overlay plot of", order), | 
|---|
| 643 | mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight , | 
|---|
| 644 | (-1*mPixelOverlayXaxisLeft)-0.5, | 
|---|
| 645 | mPixelOverlayXaxisRight-0.5 | 
|---|
| 646 | ); | 
|---|
| 647 | hPixelMean[order]->SetLineColor(kBlue); | 
|---|
| 648 | hPixelMean[order]->SetAxisRange( | 
|---|
| 649 | mBSLMean - 5, | 
|---|
| 650 | (mGainMean*(order+1)) + 10, | 
|---|
| 651 | "Y"); | 
|---|
| 652 | hPixelMean[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" ); | 
|---|
| 653 | hPixelMean[order]->GetYaxis()->SetTitle( "Amplitude [mV]" ); | 
|---|
| 654 | hPixelMean[order]->SetStats(mStats); | 
|---|
| 655 | hList->Add( hPixelMean[order] ); | 
|---|
| 656 |  | 
|---|
| 657 | //------------------------------------------------------------------------ | 
|---|
| 658 |  | 
|---|
| 659 | if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hPixelMedian", order) << endl; | 
|---|
| 660 | hPixelMedian[order] = new TH1F( | 
|---|
| 661 | HistoName("hPixelMedian", order), | 
|---|
| 662 | HistoTitle("Median value of each slice in overlay plot of", order), | 
|---|
| 663 | mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight ,//nbinsx | 
|---|
| 664 | (-1*mPixelOverlayXaxisLeft)-0.5,                 //xlow | 
|---|
| 665 | mPixelOverlayXaxisRight-0.5                     //xup | 
|---|
| 666 | ); | 
|---|
| 667 | hPixelMedian[order]->SetLineColor(kRed); | 
|---|
| 668 | hPixelMedian[order]->SetAxisRange( | 
|---|
| 669 | mBSLMean - 5, | 
|---|
| 670 | (mGainMean*(order+1)) + 10, | 
|---|
| 671 | "Y"); | 
|---|
| 672 | hPixelMedian[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" ); | 
|---|
| 673 | hPixelMedian[order]->GetYaxis()->SetTitle( "Amplitude [mV]" ); | 
|---|
| 674 | //hMaxProfile->SetBit(TH2F::kCanRebin); | 
|---|
| 675 | hPixelMedian[order]->SetStats(mStats); | 
|---|
| 676 | hList->Add( hPixelMedian[order] ); | 
|---|
| 677 |  | 
|---|
| 678 | } | 
|---|
| 679 | if (mVerbosityLevel > 2) cout << "...done" << endl; | 
|---|
| 680 | } | 
|---|
| 681 | //end of BookTemplateHistos | 
|---|
| 682 | //---------------------------------------------------------------------------- | 
|---|
| 683 |  | 
|---|
| 684 | void | 
|---|
| 685 | Pixel::BookEdgeTemplateHistos() | 
|---|
| 686 | { | 
|---|
| 687 | if (mVerbosityLevel > 2) cout << endl << "...book pixel histograms" << endl; | 
|---|
| 688 | for (int order = 0; order < mMaxPulseOrder; order++) | 
|---|
| 689 | { | 
|---|
| 690 | if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hPixelEdgeMax", order) << endl; | 
|---|
| 691 | hPixelEdgeMax[order]=new TH1F( | 
|---|
| 692 | HistoName("hPixelEdgeMax", order), | 
|---|
| 693 | HistoTitle("Maximum value of each slice in overlay plot of", order), | 
|---|
| 694 | mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight , | 
|---|
| 695 | (-1*mPixelOverlayXaxisLeft)-0.5, | 
|---|
| 696 | mPixelOverlayXaxisRight-0.5 | 
|---|
| 697 | ); | 
|---|
| 698 |  | 
|---|
| 699 | hPixelEdgeMax[order]->SetAxisRange( | 
|---|
| 700 | mBSLMean - 5, | 
|---|
| 701 | (mGainMean*(order+1)) + 10, | 
|---|
| 702 | "Y"); | 
|---|
| 703 | hPixelEdgeMax[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" ); | 
|---|
| 704 | hPixelEdgeMax[order]->GetYaxis()->SetTitle( "Amplitude [mV]" ); | 
|---|
| 705 | //hMaxProfile->SetBit(TH2F::kCanRebin); | 
|---|
| 706 | hPixelEdgeMax[order]->SetStats(mStats); | 
|---|
| 707 | hList->Add( hPixelEdgeMax[order] ); | 
|---|
| 708 |  | 
|---|
| 709 | //------------------------------------------------------------------------ | 
|---|
| 710 |  | 
|---|
| 711 | if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hPixelEdgeMean", order) << endl; | 
|---|
| 712 | hPixelEdgeMean[order] = new TH1F( | 
|---|
| 713 | HistoName("hPixelEdgeMean", order), | 
|---|
| 714 | HistoTitle("Mean value of each slice in overlay plot of", order), | 
|---|
| 715 | mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight , | 
|---|
| 716 | (-1*mPixelOverlayXaxisLeft)-0.5, | 
|---|
| 717 | mPixelOverlayXaxisRight-0.5 | 
|---|
| 718 | ); | 
|---|
| 719 | hPixelEdgeMean[order]->SetLineColor(kBlue); | 
|---|
| 720 | hPixelEdgeMean[order]->SetAxisRange( | 
|---|
| 721 | mBSLMean - 5, | 
|---|
| 722 | (mGainMean*(order+1)) + 10, | 
|---|
| 723 | "Y"); | 
|---|
| 724 | hPixelEdgeMean[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" ); | 
|---|
| 725 | hPixelEdgeMean[order]->GetYaxis()->SetTitle( "Amplitude [mV]" ); | 
|---|
| 726 | hPixelEdgeMean[order]->SetStats(mStats); | 
|---|
| 727 | hList->Add( hPixelEdgeMean[order] ); | 
|---|
| 728 |  | 
|---|
| 729 | //------------------------------------------------------------------------ | 
|---|
| 730 |  | 
|---|
| 731 | if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hPixelEdgeMedian", order) << endl; | 
|---|
| 732 | hPixelEdgeMedian[order] = new TH1F( | 
|---|
| 733 | HistoName("hPixelEdgeMedian", order), | 
|---|
| 734 | HistoTitle("Median value of each slice in overlay plot of", order), | 
|---|
| 735 | mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight ,//nbinsx | 
|---|
| 736 | (-1*mPixelOverlayXaxisLeft)-0.5,                 //xlow | 
|---|
| 737 | mPixelOverlayXaxisRight-0.5                     //xup | 
|---|
| 738 | ); | 
|---|
| 739 | hPixelEdgeMedian[order]->SetLineColor(kRed); | 
|---|
| 740 | hPixelEdgeMedian[order]->SetAxisRange( | 
|---|
| 741 | mBSLMean - 5, | 
|---|
| 742 | (mGainMean*(order+1)) + 10, | 
|---|
| 743 | "Y"); | 
|---|
| 744 | hPixelEdgeMedian[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" ); | 
|---|
| 745 | hPixelEdgeMedian[order]->GetYaxis()->SetTitle( "Amplitude [mV]" ); | 
|---|
| 746 | //hMaxProfile->SetBit(TH2F::kCanRebin); | 
|---|
| 747 | hPixelEdgeMedian[order]->SetStats(mStats); | 
|---|
| 748 | hList->Add( hPixelEdgeMedian[order] ); | 
|---|
| 749 |  | 
|---|
| 750 | } | 
|---|
| 751 | if (mVerbosityLevel > 2) cout << "...done" << endl; | 
|---|
| 752 | } | 
|---|
| 753 | //end of BookEdgeTemplateHistos | 
|---|
| 754 | //---------------------------------------------------------------------------- | 
|---|
| 755 |  | 
|---|
| 756 | void | 
|---|
| 757 | Pixel::LoadPulseHistos() | 
|---|
| 758 | { | 
|---|
| 759 | mRootFile->cd(); | 
|---|
| 760 |  | 
|---|
| 761 | if (mVerbosityLevel > 2) | 
|---|
| 762 | { | 
|---|
| 763 | if (mVerbosityLevel > 3) | 
|---|
| 764 | { | 
|---|
| 765 | mRootFile->ls(); | 
|---|
| 766 | } | 
|---|
| 767 | cout << "loading current File: " ; | 
|---|
| 768 | gFile->pwd(); | 
|---|
| 769 | } | 
|---|
| 770 |  | 
|---|
| 771 | mRootFile->cd( CreateSubDirName( mChid ) ); //Go to pixel's subdirectory | 
|---|
| 772 | mDirectory = gDirectory; | 
|---|
| 773 |  | 
|---|
| 774 | if (mVerbosityLevel > 2) | 
|---|
| 775 | { | 
|---|
| 776 | if (mVerbosityLevel > 3) | 
|---|
| 777 | { | 
|---|
| 778 | gDirectory->ls(); | 
|---|
| 779 | } | 
|---|
| 780 | cout << "Current Directory: " ; | 
|---|
| 781 | gDirectory->pwd(); | 
|---|
| 782 | } | 
|---|
| 783 |  | 
|---|
| 784 |  | 
|---|
| 785 | if (mVerbosityLevel > 2) cout << endl << "...load pixel histograms" << endl; | 
|---|
| 786 | for (int order = 0; order < mMaxPulseOrder; order++) | 
|---|
| 787 | { | 
|---|
| 788 |  | 
|---|
| 789 | if (mVerbosityLevel > 3) cout << "\t...loading " << ChooseCycleNumber( HistoName("hMaxOverlay", order), 1) << endl; | 
|---|
| 790 | hMaxOverlay[order]  = (TH2F*)mDirectory->Get( ChooseCycleNumber( HistoName("hMaxOverlay", order), 1) ); | 
|---|
| 791 |  | 
|---|
| 792 | if (mVerbosityLevel > 3) cout << "\t...loading " << HistoName("hEdgeOverlay", order) << endl; | 
|---|
| 793 | hEdgeOverlay[order] = (TH2F*)mDirectory->Get( ChooseCycleNumber( HistoName("hEdgeOverlay", order), 1) ); | 
|---|
| 794 |  | 
|---|
| 795 | if (mVerbosityLevel > 3) cout << "\t...loading " << HistoName("hMaxProfile", order) << endl; | 
|---|
| 796 | hMaxProfile[order]  = (TProfile*)mDirectory->Get( ChooseCycleNumber( HistoName("hMaxProfile", order), 1) ); | 
|---|
| 797 |  | 
|---|
| 798 | if (mVerbosityLevel > 3) cout << "\t...loading " << HistoName("hEdgeProfile", order) << endl; | 
|---|
| 799 | hEdgeProfile[order] = (TProfile*)mDirectory->Get( ChooseCycleNumber( HistoName("hEdgeProfile", order), 1) ); | 
|---|
| 800 |  | 
|---|
| 801 |  | 
|---|
| 802 | } | 
|---|
| 803 | //    mPixelOverlayXaxisRight   =70;   ///TODO: get it from the root file | 
|---|
| 804 | //    mPixelOverlayXaxisLeft    =230;  ///TODO: get it from the root file | 
|---|
| 805 | //        mBSLMean                  =-2;   ///TODO: get it from the root file | 
|---|
| 806 | //        mGainMean                 =11;    ///TODO: get it from the root file | 
|---|
| 807 | //    mOptions                  ="SRM"; ///TODO: get it from the root file | 
|---|
| 808 |  | 
|---|
| 809 | mPixelOverlayXaxisRight = hEdgeOverlay[0]->GetBinCenter( | 
|---|
| 810 | hEdgeOverlay[0]->GetXaxis()->GetFirst() | 
|---|
| 811 | ); | 
|---|
| 812 |  | 
|---|
| 813 | mPixelOverlayXaxisLeft = hEdgeOverlay[0]->GetBinCenter( | 
|---|
| 814 | hEdgeOverlay[0]->GetXaxis()->GetLast() | 
|---|
| 815 | ); | 
|---|
| 816 |  | 
|---|
| 817 | } | 
|---|
| 818 | // end of LoadPulseHistos | 
|---|
| 819 | //---------------------------------------------------------------------------- | 
|---|
| 820 |  | 
|---|
| 821 | void | 
|---|
| 822 | Pixel::DeletePixelHistos() | 
|---|
| 823 | { | 
|---|
| 824 | if (mVerbosityLevel > 2) | 
|---|
| 825 | { | 
|---|
| 826 | cout << endl | 
|---|
| 827 | << endl | 
|---|
| 828 | << "\t...delete current overlay histograms of Pixel# " << mChid; | 
|---|
| 829 | } | 
|---|
| 830 | for (int order = 0; | 
|---|
| 831 | order < mMaxPulseOrder; | 
|---|
| 832 | order ++) | 
|---|
| 833 | { | 
|---|
| 834 | if (mVerbosityLevel > 3) | 
|---|
| 835 | cout << endl << "\t\t...deleting hMaxOverlay" | 
|---|
| 836 | << mChid << "_" << order; | 
|---|
| 837 |  | 
|---|
| 838 | delete hMaxOverlay[order]; | 
|---|
| 839 | hMaxOverlay[order] = NULL; | 
|---|
| 840 |  | 
|---|
| 841 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hEdgeOverlay" | 
|---|
| 842 | << mChid << "_" << order ; | 
|---|
| 843 | delete hEdgeOverlay[order]; | 
|---|
| 844 | hEdgeOverlay[order] = NULL; | 
|---|
| 845 |  | 
|---|
| 846 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hMaxProfile" | 
|---|
| 847 | << mChid << "_" << order ; | 
|---|
| 848 | delete hMaxProfile[order]; | 
|---|
| 849 | hMaxProfile[order] = NULL; | 
|---|
| 850 |  | 
|---|
| 851 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hMaxProfile2" | 
|---|
| 852 | << mChid << "_" << order ; | 
|---|
| 853 | delete hEdgeProfile[order]; | 
|---|
| 854 | hEdgeProfile[order] = NULL; | 
|---|
| 855 | } | 
|---|
| 856 | if (mVerbosityLevel > 3) cout << endl << "\t...deleting histogram Arrays"; | 
|---|
| 857 |  | 
|---|
| 858 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hMaxOverlay"; | 
|---|
| 859 | delete[] hMaxOverlay; | 
|---|
| 860 | hMaxOverlay = NULL; | 
|---|
| 861 |  | 
|---|
| 862 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hEdgeOverlay"; | 
|---|
| 863 | delete[] hEdgeOverlay; | 
|---|
| 864 | hEdgeOverlay = NULL; | 
|---|
| 865 |  | 
|---|
| 866 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hMaxProfile"; | 
|---|
| 867 | delete[] hMaxProfile; | 
|---|
| 868 | hMaxProfile = NULL; | 
|---|
| 869 |  | 
|---|
| 870 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hEdgeProfile"; | 
|---|
| 871 | delete[] hEdgeProfile; | 
|---|
| 872 | hEdgeProfile = NULL; | 
|---|
| 873 | } | 
|---|
| 874 | // end of DeletePixelHistos | 
|---|
| 875 | //---------------------------------------------------------------------------- | 
|---|
| 876 |  | 
|---|
| 877 | void | 
|---|
| 878 | Pixel::DeleteDistributionHistos() | 
|---|
| 879 | { | 
|---|
| 880 | if (mVerbosityLevel > 2) | 
|---|
| 881 | { | 
|---|
| 882 | cout << endl | 
|---|
| 883 | << "\t...delete current distribution histograms" ; | 
|---|
| 884 | } | 
|---|
| 885 |  | 
|---|
| 886 | for (int order = 0; | 
|---|
| 887 | order < mMaxPulseOrder; | 
|---|
| 888 | order ++) | 
|---|
| 889 | { | 
|---|
| 890 | if (mOptions.Contains("S")) | 
|---|
| 891 | { | 
|---|
| 892 | if (mVerbosityLevel > 3) cout << endl | 
|---|
| 893 | << "\t\t...deleting hSlopeRisingEdge" | 
|---|
| 894 | << mChid << "_" << order ; | 
|---|
| 895 | delete hSlopeRisingEdge[order]; | 
|---|
| 896 | } | 
|---|
| 897 |  | 
|---|
| 898 | if (mOptions.Contains("R")) | 
|---|
| 899 | { | 
|---|
| 900 | if (mVerbosityLevel > 3) cout << endl | 
|---|
| 901 | << "\t\t...deleting hRisingEdgeToMax" | 
|---|
| 902 | << mChid << "_" << order ; | 
|---|
| 903 | delete hRisingEdgeToMax[order]; | 
|---|
| 904 | } | 
|---|
| 905 |  | 
|---|
| 906 | if (mOptions.Contains("M")) | 
|---|
| 907 | { | 
|---|
| 908 | if (mVerbosityLevel > 3) cout << endl | 
|---|
| 909 | << "\t\t...deleting hPosOfMax" | 
|---|
| 910 | << mChid << "_" << order ; | 
|---|
| 911 |  | 
|---|
| 912 | delete hPosOfMax[order]; | 
|---|
| 913 | } | 
|---|
| 914 |  | 
|---|
| 915 | } | 
|---|
| 916 | if (mVerbosityLevel > 3) cout << endl << "\t...deleting histogram Arrays"; | 
|---|
| 917 |  | 
|---|
| 918 | if (mOptions.Contains("S")) | 
|---|
| 919 | { | 
|---|
| 920 | if (mVerbosityLevel > 3) | 
|---|
| 921 | cout << endl << "\t\t...deleting hSlopeRisingEdge"; | 
|---|
| 922 | delete[] hSlopeRisingEdge; | 
|---|
| 923 | hSlopeRisingEdge = NULL; | 
|---|
| 924 | } | 
|---|
| 925 |  | 
|---|
| 926 | if (mOptions.Contains("R")) | 
|---|
| 927 | { | 
|---|
| 928 | if (mVerbosityLevel > 3) | 
|---|
| 929 | cout << endl << "\t\t...deleting hRisingEdgeToMax"; | 
|---|
| 930 | delete[] hRisingEdgeToMax; | 
|---|
| 931 | hRisingEdgeToMax = NULL; | 
|---|
| 932 | } | 
|---|
| 933 |  | 
|---|
| 934 | if (mOptions.Contains("M")) | 
|---|
| 935 | { | 
|---|
| 936 | if (mVerbosityLevel > 3) | 
|---|
| 937 | cout << endl << "\t\t...deleting hPosOfMax"; | 
|---|
| 938 | delete[] hPosOfMax; | 
|---|
| 939 | hPosOfMax = NULL; | 
|---|
| 940 | } | 
|---|
| 941 | } | 
|---|
| 942 | // end of DeletePixelHistos | 
|---|
| 943 | //---------------------------------------------------------------------------- | 
|---|
| 944 |  | 
|---|
| 945 | void | 
|---|
| 946 | Pixel::DeleteTemplateHistos() | 
|---|
| 947 | { | 
|---|
| 948 | if (mVerbosityLevel > 2) | 
|---|
| 949 | { | 
|---|
| 950 | cout << endl | 
|---|
| 951 | << "\t...delete current template histograms of Pixel# " << mChid; | 
|---|
| 952 | } | 
|---|
| 953 | for (int order = 0; | 
|---|
| 954 | order < mMaxPulseOrder; | 
|---|
| 955 | order ++) | 
|---|
| 956 | { | 
|---|
| 957 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hPixelMean" | 
|---|
| 958 | << mChid << "_" << order ; | 
|---|
| 959 | delete hPixelMean[order]; | 
|---|
| 960 | hPixelMean[order] = NULL; | 
|---|
| 961 |  | 
|---|
| 962 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hPixelMedian" | 
|---|
| 963 | << mChid << "_" << order ; | 
|---|
| 964 | delete hPixelMedian[order]; | 
|---|
| 965 | hPixelMedian[order] = NULL; | 
|---|
| 966 |  | 
|---|
| 967 | if (mVerbosityLevel > 3) | 
|---|
| 968 | cout << endl << "\t\t...deleting hPixelMax" | 
|---|
| 969 | << mChid << "_" << order; | 
|---|
| 970 | delete hPixelMax[order]; | 
|---|
| 971 | hPixelMax[order] = NULL; | 
|---|
| 972 |  | 
|---|
| 973 | } | 
|---|
| 974 | if (mVerbosityLevel > 3) cout << endl << "\t...deleting histogram Arrays"; | 
|---|
| 975 |  | 
|---|
| 976 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hPixelMax"; | 
|---|
| 977 | delete[] hPixelMax; | 
|---|
| 978 | hPixelMax = NULL; | 
|---|
| 979 |  | 
|---|
| 980 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hPixelMedian"; | 
|---|
| 981 | delete[] hPixelMedian; | 
|---|
| 982 | hPixelMedian = NULL; | 
|---|
| 983 |  | 
|---|
| 984 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hPixelMean"; | 
|---|
| 985 | delete[] hPixelMean; | 
|---|
| 986 | hPixelMean = NULL; | 
|---|
| 987 | } | 
|---|
| 988 | // end of DeleteTemplateHistos | 
|---|
| 989 | //---------------------------------------------------------------------------- | 
|---|
| 990 |  | 
|---|
| 991 | void | 
|---|
| 992 | Pixel::DeleteEdgeTemplateHistos() | 
|---|
| 993 | { | 
|---|
| 994 | if (mVerbosityLevel > 2) | 
|---|
| 995 | { | 
|---|
| 996 | cout << endl | 
|---|
| 997 | << "\t...delete current Edge template histograms of Pixel# " << mChid; | 
|---|
| 998 | } | 
|---|
| 999 | for (int order = 0; | 
|---|
| 1000 | order < mMaxPulseOrder; | 
|---|
| 1001 | order ++) | 
|---|
| 1002 | { | 
|---|
| 1003 | if (mVerbosityLevel > 3) | 
|---|
| 1004 | cout << endl << "\t\t...deleting hPixelEdgeMax" | 
|---|
| 1005 | << mChid << "_" << order; | 
|---|
| 1006 |  | 
|---|
| 1007 | delete hPixelEdgeMax[order]; | 
|---|
| 1008 | hPixelEdgeMax[order] = NULL; | 
|---|
| 1009 |  | 
|---|
| 1010 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hPixelEdgeMedian" | 
|---|
| 1011 | << mChid << "_" << order ; | 
|---|
| 1012 | delete hPixelEdgeMedian[order]; | 
|---|
| 1013 | hPixelEdgeMedian[order] = NULL; | 
|---|
| 1014 |  | 
|---|
| 1015 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hPixelEdgeMean" | 
|---|
| 1016 | << mChid << "_" << order ; | 
|---|
| 1017 | delete hPixelEdgeMean[order]; | 
|---|
| 1018 | hPixelEdgeMean[order] = NULL; | 
|---|
| 1019 |  | 
|---|
| 1020 | } | 
|---|
| 1021 | if (mVerbosityLevel > 3) cout << endl << "\t...deleting histogram Arrays"; | 
|---|
| 1022 |  | 
|---|
| 1023 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hPixelEdgeMax"; | 
|---|
| 1024 | delete[] hPixelEdgeMax; | 
|---|
| 1025 | hPixelEdgeMax = NULL; | 
|---|
| 1026 |  | 
|---|
| 1027 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hPixelEdgeMedian"; | 
|---|
| 1028 | delete[] hPixelEdgeMedian; | 
|---|
| 1029 | hPixelEdgeMedian = NULL; | 
|---|
| 1030 |  | 
|---|
| 1031 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hPixelEdgeMean"; | 
|---|
| 1032 | delete[] hPixelEdgeMean; | 
|---|
| 1033 | hPixelEdgeMean = NULL; | 
|---|
| 1034 | } | 
|---|
| 1035 | // end of DeleteTemplateHistos | 
|---|
| 1036 | //---------------------------------------------------------------------------- | 
|---|
| 1037 |  | 
|---|
| 1038 | void | 
|---|
| 1039 | Pixel::MakeTH1Pretty( | 
|---|
| 1040 | TH1*                histo, | 
|---|
| 1041 | TString             histName, | 
|---|
| 1042 | TString             histTitle, | 
|---|
| 1043 | int                 order | 
|---|
| 1044 | ) | 
|---|
| 1045 | { | 
|---|
| 1046 | if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName(histName, order) << endl; | 
|---|
| 1047 |  | 
|---|
| 1048 | histo->SetNameTitle( | 
|---|
| 1049 | HistoName(histName, order), | 
|---|
| 1050 | HistoTitle(histTitle, order) | 
|---|
| 1051 | ); | 
|---|
| 1052 |  | 
|---|
| 1053 | histo->SetBins( | 
|---|
| 1054 | mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight , | 
|---|
| 1055 | (-1*mPixelOverlayXaxisLeft)-0.5, | 
|---|
| 1056 | mPixelOverlayXaxisRight-0.5 | 
|---|
| 1057 | ); | 
|---|
| 1058 |  | 
|---|
| 1059 | histo->SetAxisRange( | 
|---|
| 1060 | mBSLMean - 5, | 
|---|
| 1061 | (mGainMean*(order+1)) + 10, | 
|---|
| 1062 | "Y"); | 
|---|
| 1063 | histo->GetXaxis()->SetTitle( "Timeslices [a.u.]" ); | 
|---|
| 1064 | histo->GetYaxis()->SetTitle( "Amplitude [mV]" ); | 
|---|
| 1065 | //histo->SetBit(TH2F::kCanRebin); | 
|---|
| 1066 | histo->SetStats(mStats); | 
|---|
| 1067 | } | 
|---|
| 1068 | // end of MakeTH2Pretty | 
|---|
| 1069 | //---------------------------------------------------------------------------- | 
|---|
| 1070 |  | 
|---|
| 1071 |  | 
|---|
| 1072 | void | 
|---|
| 1073 | Pixel::MakeTH2Pretty( | 
|---|
| 1074 | TH2*                histo, | 
|---|
| 1075 | TString             histName, | 
|---|
| 1076 | TString             histTitle, | 
|---|
| 1077 | int                 order | 
|---|
| 1078 | ) | 
|---|
| 1079 | { | 
|---|
| 1080 | if (mVerbosityLevel > 3) cout << "\t...designing " << HistoName(histName, order) << endl; | 
|---|
| 1081 |  | 
|---|
| 1082 | histo->SetNameTitle( | 
|---|
| 1083 | HistoName(histName, order), | 
|---|
| 1084 | HistoTitle(histTitle, order) | 
|---|
| 1085 | ); | 
|---|
| 1086 |  | 
|---|
| 1087 | histo->SetBins( | 
|---|
| 1088 | mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight , | 
|---|
| 1089 | (-1*mPixelOverlayXaxisLeft)-0.5, | 
|---|
| 1090 | mPixelOverlayXaxisRight-0.5 , | 
|---|
| 1091 | 512, | 
|---|
| 1092 | -55.5, | 
|---|
| 1093 | 200.5 | 
|---|
| 1094 | ); | 
|---|
| 1095 |  | 
|---|
| 1096 | histo->SetAxisRange( | 
|---|
| 1097 | mBSLMean - 5, | 
|---|
| 1098 | (mGainMean*(order+1)) + 10, | 
|---|
| 1099 | "Y"); | 
|---|
| 1100 |  | 
|---|
| 1101 | histo->GetXaxis()->SetTitle( "Timeslices [a.u.]" ); | 
|---|
| 1102 | histo->GetYaxis()->SetTitle( "Amplitude [mV]" ); | 
|---|
| 1103 | //histo->SetBit(TH2F::kCanRebin); | 
|---|
| 1104 | histo->SetStats(mStats); | 
|---|
| 1105 | } | 
|---|
| 1106 | // end of MakeTH2Pretty | 
|---|
| 1107 | //---------------------------------------------------------------------------- | 
|---|
| 1108 |  | 
|---|
| 1109 | void | 
|---|
| 1110 | Pixel::MakeTProfilePretty( | 
|---|
| 1111 | TProfile*           histo, | 
|---|
| 1112 | TString             histName, | 
|---|
| 1113 | TString             histTitle, | 
|---|
| 1114 | int                 order | 
|---|
| 1115 | ) | 
|---|
| 1116 | { | 
|---|
| 1117 | if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName(histName, order) << endl; | 
|---|
| 1118 |  | 
|---|
| 1119 | histo->SetNameTitle( | 
|---|
| 1120 | HistoName(histName, order), | 
|---|
| 1121 | HistoTitle(histTitle, order) | 
|---|
| 1122 | ); | 
|---|
| 1123 |  | 
|---|
| 1124 | histo->SetBins( | 
|---|
| 1125 | mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight , | 
|---|
| 1126 | (-1*mPixelOverlayXaxisLeft)-0.5, | 
|---|
| 1127 | mPixelOverlayXaxisRight-0.5 | 
|---|
| 1128 | ); | 
|---|
| 1129 | histo->SetOption( "s" ); | 
|---|
| 1130 |  | 
|---|
| 1131 | histo->SetAxisRange( | 
|---|
| 1132 | mBSLMean - 5, | 
|---|
| 1133 | (mGainMean*(order+1)) + 10, | 
|---|
| 1134 | "Y"); | 
|---|
| 1135 |  | 
|---|
| 1136 | histo->GetXaxis()->SetTitle( "Timeslices [a.u.]" ); | 
|---|
| 1137 | histo->GetYaxis()->SetTitle( "Amplitude [mV]" ); | 
|---|
| 1138 | //histo->SetBit(TH2F::kCanRebin); | 
|---|
| 1139 | histo->SetStats(mStats); | 
|---|
| 1140 | } | 
|---|
| 1141 | // end of MakeTProfilePretty | 
|---|
| 1142 | //---------------------------------------------------------------------------- | 
|---|
| 1143 |  | 
|---|
| 1144 |  | 
|---|
| 1145 | void | 
|---|
| 1146 | Pixel::ShiftHistoInY( | 
|---|
| 1147 | TH1*                histo, | 
|---|
| 1148 | float               shift | 
|---|
| 1149 | ) | 
|---|
| 1150 | { | 
|---|
| 1151 | int min_bin = histo->GetXaxis()->GetFirst(); | 
|---|
| 1152 | int max_bin = histo->GetXaxis()->GetLast(); | 
|---|
| 1153 |  | 
|---|
| 1154 | for (int bin = min_bin; bin <= max_bin; bin++) | 
|---|
| 1155 | { | 
|---|
| 1156 | histo->AddBinContent( bin, shift); | 
|---|
| 1157 | } | 
|---|
| 1158 |  | 
|---|
| 1159 | } | 
|---|
| 1160 |  | 
|---|
| 1161 |  | 
|---|