| 1 | #include "pixel.h" // class implemented
|
|---|
| 2 | using namespace std;
|
|---|
| 3 |
|
|---|
| 4 | /////////////////////////////// PUBLIC ///////////////////////////////////////
|
|---|
| 5 |
|
|---|
| 6 | //============================= LIFECYCLE ====================================
|
|---|
| 7 |
|
|---|
| 8 | //Pixel::Pixel(int pixelID)
|
|---|
| 9 | //{
|
|---|
| 10 | // Chid = pixelID;
|
|---|
| 11 | // max_puslse_order = 1;
|
|---|
| 12 | // hMaxOverlay = NULL;
|
|---|
| 13 | // hEdgeOverlay = NULL;
|
|---|
| 14 | // hMaxProfile = NULL;
|
|---|
| 15 | // hEdgeProfile = NULL;
|
|---|
| 16 | // hList = NULL;
|
|---|
| 17 |
|
|---|
| 18 | //}
|
|---|
| 19 |
|
|---|
| 20 | Pixel::Pixel(
|
|---|
| 21 | int pixelID,
|
|---|
| 22 | int maxPulsorder,
|
|---|
| 23 | int verbosityLevel,
|
|---|
| 24 | int pixelOverlayXaxisLeft,
|
|---|
| 25 | int pixelOverlayXaxisRight,
|
|---|
| 26 | int bSLMean,
|
|---|
| 27 | int gainMean,
|
|---|
| 28 | TString options
|
|---|
| 29 | )
|
|---|
| 30 | {
|
|---|
| 31 | mChid = pixelID;
|
|---|
| 32 | mMaxPulseOrder = maxPulsorder;
|
|---|
| 33 | mVerbosityLevel = verbosityLevel;
|
|---|
| 34 | mOptions = options;
|
|---|
| 35 | mPixelOverlayXaxisLeft = pixelOverlayXaxisLeft;
|
|---|
| 36 | mPixelOverlayXaxisRight = pixelOverlayXaxisRight;
|
|---|
| 37 | mBSLMean = bSLMean;
|
|---|
| 38 | mGainMean = gainMean;
|
|---|
| 39 |
|
|---|
| 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];
|
|---|
| 48 | if (mOptions == "S")
|
|---|
| 49 | {
|
|---|
| 50 | // hSlopeRisingEdge= (TH1F*) calloc(mMaxPulseOrder, sizeof(TH1F));
|
|---|
| 51 | hSlopeRisingEdge = new TH1F*[mMaxPulseOrder];
|
|---|
| 52 | }
|
|---|
| 53 | if (mOptions == "R")
|
|---|
| 54 | {
|
|---|
| 55 | // hRisingEdgeToMax= (TH1F*) calloc(mMaxPulseOrder, sizeof(TH1F));
|
|---|
| 56 | hRisingEdgeToMax = new TH1F*[mMaxPulseOrder];
|
|---|
| 57 | }
|
|---|
| 58 | if (mOptions == "P")
|
|---|
| 59 | {
|
|---|
| 60 | // hPosOfMax = (TH1F*) calloc(mMaxPulseOrder, sizeof(TH1F));
|
|---|
| 61 | hPosOfMax = new TH1F*[mMaxPulseOrder];
|
|---|
| 62 | }
|
|---|
| 63 |
|
|---|
| 64 | hList = new TObjArray;
|
|---|
| 65 |
|
|---|
| 66 | BookPixelHistos();
|
|---|
| 67 | BookDistributionHistos();
|
|---|
| 68 | }
|
|---|
| 69 |
|
|---|
| 70 | Pixel::~Pixel()
|
|---|
| 71 | {
|
|---|
| 72 | if (mVerbosityLevel > 2) cout << endl << "...delete current pixel histograms" ;
|
|---|
| 73 | // for (int order = 0;
|
|---|
| 74 | // order < mMaxPulseOrder;
|
|---|
| 75 | // order ++)
|
|---|
| 76 | // {
|
|---|
| 77 | if (mVerbosityLevel > 3) cout << endl << "...deleting hMaxOverlay";
|
|---|
| 78 | delete[] hMaxOverlay;
|
|---|
| 79 | hMaxOverlay = NULL;
|
|---|
| 80 | if (mVerbosityLevel > 3) cout << endl << "...deleting hEdgeOverlay";
|
|---|
| 81 | delete[] hEdgeOverlay;
|
|---|
| 82 | hEdgeOverlay = NULL;
|
|---|
| 83 | if (mVerbosityLevel > 3) cout << endl << "...deleting hMaxProfile";
|
|---|
| 84 | delete[] hMaxProfile;
|
|---|
| 85 | hMaxProfile = NULL;
|
|---|
| 86 | if (mVerbosityLevel > 3) cout << endl << "...deleting hMaxProfile2";
|
|---|
| 87 | delete[] hEdgeProfile;
|
|---|
| 88 | hEdgeProfile = NULL;
|
|---|
| 89 | // }
|
|---|
| 90 | if (mVerbosityLevel > 3) cout << endl << "...deleting hList";
|
|---|
| 91 | delete hList;
|
|---|
| 92 | if (mVerbosityLevel > 2) cout << endl << "...done" << endl;
|
|---|
| 93 | }// ~Pixel
|
|---|
| 94 |
|
|---|
| 95 |
|
|---|
| 96 | //============================= OPERATORS ====================================
|
|---|
| 97 |
|
|---|
| 98 | //XX&
|
|---|
| 99 | //XX::operator=(const XX&);
|
|---|
| 100 | //{
|
|---|
| 101 | // return *this;
|
|---|
| 102 |
|
|---|
| 103 | //}// =
|
|---|
| 104 |
|
|---|
| 105 | //============================= OPERATIONS ===================================
|
|---|
| 106 | void
|
|---|
| 107 | Pixel::BookPixelHistos()
|
|---|
| 108 | {
|
|---|
| 109 | if (mVerbosityLevel > 2) cout << endl << "...book pixel histograms" << endl;
|
|---|
| 110 | TString histo_name;
|
|---|
| 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 | );
|
|---|
| 126 | /*
|
|---|
| 127 | SetHistogramAttributes(
|
|---|
| 128 | "PeakMaxGaus",
|
|---|
| 129 | order,
|
|---|
| 130 | gMaxGausAttrib,
|
|---|
| 131 | MaxAmplOfFirstPulse
|
|---|
| 132 | );
|
|---|
| 133 | */
|
|---|
| 134 | if (mVerbosityLevel > 3) cout << "...booking " << histo_name << endl;
|
|---|
| 135 | hMaxOverlay[order]->SetAxisRange(
|
|---|
| 136 | mBSLMean - 5,
|
|---|
| 137 | (mGainMean*(order+1)) + 10,
|
|---|
| 138 | "Y");
|
|---|
| 139 | hMaxOverlay[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
|
|---|
| 140 | hMaxOverlay[order]->GetYaxis()->SetTitle( "Amplitude [mV]" );
|
|---|
| 141 | //hMaxProfile->SetBit(TH2F::kCanRebin);
|
|---|
| 142 | hList->Add( hMaxOverlay[order] );
|
|---|
| 143 | }
|
|---|
| 144 |
|
|---|
| 145 | for (int order = 0; order < mMaxPulseOrder; order ++)
|
|---|
| 146 | {
|
|---|
| 147 |
|
|---|
| 148 | //------------------------------------------------------------------------
|
|---|
| 149 | /*
|
|---|
| 150 | SetHistogramAttributes(
|
|---|
| 151 | "PeakMaxGaus",
|
|---|
| 152 | order,
|
|---|
| 153 | gMaxGausAttrib,
|
|---|
| 154 | MaxAmplOfFirstPulse
|
|---|
| 155 | );
|
|---|
| 156 | */
|
|---|
| 157 | histo_name = "hEdgeOverlay";
|
|---|
| 158 | histo_name += order;
|
|---|
| 159 | if (mVerbosityLevel > 3) cout << "...booking " << histo_name << endl;
|
|---|
| 160 | hEdgeOverlay[order] = new TH2F(
|
|---|
| 161 | histo_name,
|
|---|
| 162 | "Overlay at rising edge of detected pulses of one pulse order for one Pixel ",
|
|---|
| 163 | mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight ,
|
|---|
| 164 | (-1*mPixelOverlayXaxisLeft)-0.5,
|
|---|
| 165 | mPixelOverlayXaxisRight-0.5 ,
|
|---|
| 166 | 512,
|
|---|
| 167 | -55.5,
|
|---|
| 168 | 200.5
|
|---|
| 169 | );
|
|---|
| 170 |
|
|---|
| 171 | hEdgeOverlay[order]->SetAxisRange(
|
|---|
| 172 | mBSLMean - 5,
|
|---|
| 173 | (mGainMean*(order+1)) + 10,
|
|---|
| 174 | "Y");
|
|---|
| 175 | hEdgeOverlay[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
|
|---|
| 176 | hEdgeOverlay[order]->GetYaxis()->SetTitle( "Amplitude [mV]" );
|
|---|
| 177 | hList->Add( hEdgeOverlay[order] );
|
|---|
| 178 |
|
|---|
| 179 | //------------------------------------------------------------------------
|
|---|
| 180 | /*
|
|---|
| 181 | SetHistogramAttributes(
|
|---|
| 182 | "PeakMaxGaus",
|
|---|
| 183 | order,
|
|---|
| 184 | gMaxGausAttrib,
|
|---|
| 185 | MaxAmplOfFirstPulse
|
|---|
| 186 | );
|
|---|
| 187 | */
|
|---|
| 188 | histo_name = "hMaxProfile";
|
|---|
| 189 | histo_name += order;
|
|---|
| 190 | if (mVerbosityLevel > 3) cout << "...booking " << histo_name << endl;
|
|---|
| 191 | hMaxProfile[order] = new TProfile(
|
|---|
| 192 | histo_name,
|
|---|
| 193 | "Mean value of each slice in overlay plot (Tprofile)",
|
|---|
| 194 | mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight ,//nbinsx
|
|---|
| 195 | (-1*mPixelOverlayXaxisLeft)-0.5, //xlow
|
|---|
| 196 | mPixelOverlayXaxisRight-0.5 , //xup
|
|---|
| 197 | // 512, //nbinsy
|
|---|
| 198 | -55.5, //ylow
|
|---|
| 199 | 300.5, //yup
|
|---|
| 200 | "s"); //option
|
|---|
| 201 | hMaxProfile[order]->SetAxisRange(
|
|---|
| 202 | mBSLMean - 5,
|
|---|
| 203 | (mGainMean*(order+1)) + 10,
|
|---|
| 204 | "Y");
|
|---|
| 205 | hMaxProfile[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
|
|---|
| 206 | hMaxProfile[order]->GetYaxis()->SetTitle( "Amplitude [mV]" );
|
|---|
| 207 | //hMaxProfile->SetBit(TH2F::kCanRebin);
|
|---|
| 208 | hList->Add( hMaxProfile[order] );
|
|---|
| 209 |
|
|---|
| 210 |
|
|---|
| 211 | //------------------------------------------------------------------------
|
|---|
| 212 | /*
|
|---|
| 213 | SetHistogramAttributes(
|
|---|
| 214 | "PeakMaxGaus",
|
|---|
| 215 | order,
|
|---|
| 216 | gMaxGausAttrib,
|
|---|
| 217 | MaxAmplOfFirstPulse
|
|---|
| 218 | );
|
|---|
| 219 | */
|
|---|
| 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 |
|
|---|
| 243 | }
|
|---|
| 244 | if (mVerbosityLevel > 2) cout << "...done" << endl;
|
|---|
| 245 | }
|
|---|
| 246 | //end of BookPixelHistos
|
|---|
| 247 | //----------------------------------------------------------------------------
|
|---|
| 248 |
|
|---|
| 249 |
|
|---|
| 250 | void
|
|---|
| 251 | Pixel::DrawHistograms(
|
|---|
| 252 | TCanvas* pixelCanvas,
|
|---|
| 253 | int* histoFrameNr
|
|---|
| 254 | )
|
|---|
| 255 | {
|
|---|
| 256 | if (mVerbosityLevel > 2) cout << endl << "...drawing pulse histograms" ;
|
|---|
| 257 | for (int pulse_order = 0; pulse_order < mMaxPulseOrder; pulse_order++)
|
|---|
| 258 | {
|
|---|
| 259 | pixelCanvas[pulse_order].cd( histoFrameNr[0] );
|
|---|
| 260 | hMaxOverlay[pulse_order]->Draw("COLZ");
|
|---|
| 261 | pixelCanvas[pulse_order].cd( histoFrameNr[2] );
|
|---|
| 262 | hMaxProfile[pulse_order]->Draw("COLZ");
|
|---|
| 263 | hEdgeProfile[pulse_order]->Draw("SAME");
|
|---|
| 264 |
|
|---|
| 265 | pixelCanvas[pulse_order].cd( histoFrameNr[1] );
|
|---|
| 266 | hEdgeOverlay[pulse_order]->Draw("COLZ");
|
|---|
| 267 | }
|
|---|
| 268 | }
|
|---|
| 269 | // end of DrawPulseHistograms
|
|---|
| 270 | //----------------------------------------------------------------------------
|
|---|
| 271 |
|
|---|
| 272 |
|
|---|
| 273 | void
|
|---|
| 274 | Pixel::BookDistributionHistos( )
|
|---|
| 275 | {
|
|---|
| 276 | if (mOptions != "")
|
|---|
| 277 | {
|
|---|
| 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"))
|
|---|
| 286 | {
|
|---|
| 287 | histo_name = "hSlopeRisingEdge";
|
|---|
| 288 | histo_name += order;
|
|---|
| 289 | hSlopeRisingEdge[order] = new TH1F (
|
|---|
| 290 | histo_name,
|
|---|
| 291 | "Distribution of rising edge",
|
|---|
| 292 | 600,
|
|---|
| 293 | -10.1,
|
|---|
| 294 | 10.1
|
|---|
| 295 | );
|
|---|
| 296 | hSlopeRisingEdge[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
|
|---|
| 297 | hSlopeRisingEdge[order]->GetYaxis()->SetTitle( "counts" );
|
|---|
| 298 | hList->Add( hSlopeRisingEdge[order] );
|
|---|
| 299 | }
|
|---|
| 300 |
|
|---|
| 301 | if (mOptions.Contains("R"))
|
|---|
| 302 | {
|
|---|
| 303 | histo_name = "hRisingEdgeToMax";
|
|---|
| 304 | histo_name += order;
|
|---|
| 305 | hRisingEdgeToMax[order] = new TH1F (
|
|---|
| 306 | histo_name,
|
|---|
| 307 | "Deviation of rising edge and maximum",
|
|---|
| 308 | 600,
|
|---|
| 309 | -10.1,
|
|---|
| 310 | 10.1
|
|---|
| 311 | );
|
|---|
| 312 | hRisingEdgeToMax[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
|
|---|
| 313 | hRisingEdgeToMax[order]->GetYaxis()->SetTitle( "counts" );
|
|---|
| 314 | hList->Add( hRisingEdgeToMax[order] );
|
|---|
| 315 | }
|
|---|
| 316 |
|
|---|
| 317 | if (mOptions.Contains("P"))
|
|---|
| 318 | {
|
|---|
| 319 | histo_name = "hPosOfMax";
|
|---|
| 320 | histo_name += order;
|
|---|
| 321 | hPosOfMax[order] = new TH1F (
|
|---|
| 322 | histo_name,
|
|---|
| 323 | "Deviation of rising edge and maximum",
|
|---|
| 324 | 600,
|
|---|
| 325 | -10.1,
|
|---|
| 326 | 10.1
|
|---|
| 327 | );
|
|---|
| 328 | hPosOfMax[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
|
|---|
| 329 | hPosOfMax[order]->GetYaxis()->SetTitle( "counts" );
|
|---|
| 330 | hList->Add( hPosOfMax[order] );
|
|---|
| 331 | }
|
|---|
| 332 |
|
|---|
| 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 | }
|
|---|
| 371 |
|
|---|
| 372 |
|
|---|
| 373 | //============================= ACESS ===================================
|
|---|
| 374 | //============================= INQUIRY ===================================
|
|---|
| 375 | /////////////////////////////// PROTECTED ///////////////////////////////////
|
|---|
| 376 |
|
|---|
| 377 | /////////////////////////////// PRIVATE ///////////////////////////////////
|
|---|
| 378 |
|
|---|
| 379 |
|
|---|
| 380 |
|
|---|
| 381 |
|
|---|
| 382 |
|
|---|
| 383 |
|
|---|
| 384 |
|
|---|
| 385 |
|
|---|