| 1 | /* ======================================================================== *\
|
|---|
| 2 | !
|
|---|
| 3 | ! *
|
|---|
| 4 | ! * This file is part of MARS, the MAGIC Analysis and Reconstruction
|
|---|
| 5 | ! * Software. It is distributed to you in the hope that it can be a useful
|
|---|
| 6 | ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
|
|---|
| 7 | ! * It is distributed WITHOUT ANY WARRANTY.
|
|---|
| 8 | ! *
|
|---|
| 9 | ! * Permission to use, copy, modify and distribute this software and its
|
|---|
| 10 | ! * documentation for any purpose is hereby granted without fee,
|
|---|
| 11 | ! * provided that the above copyright notice appear in all copies and
|
|---|
| 12 | ! * that both that copyright notice and this permission notice appear
|
|---|
| 13 | ! * in supporting documentation. It is provided "as is" without express
|
|---|
| 14 | ! * or implied warranty.
|
|---|
| 15 | ! *
|
|---|
| 16 | !
|
|---|
| 17 | !
|
|---|
| 18 | ! Author(s): Markus Gaug 02/2004 <mailto:markus@ifae.es>
|
|---|
| 19 | !
|
|---|
| 20 | ! Copyright: MAGIC Software Development, 2000-2004
|
|---|
| 21 | !
|
|---|
| 22 | !
|
|---|
| 23 | \* ======================================================================== */
|
|---|
| 24 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 25 | //
|
|---|
| 26 | // MHCalibrationChargeCam
|
|---|
| 27 | //
|
|---|
| 28 | // Fills the extracted signals of MExtractedSignalCam into the MHCalibrationPix-classes
|
|---|
| 29 | // MHCalibrationChargeHiGainPix and MHCalibrationChargeLoGainPix for every:
|
|---|
| 30 | //
|
|---|
| 31 | // - Pixel, stored in the TObjArray's MHCalibrationCam::fHiGainArray and
|
|---|
| 32 | // MHCalibrationCam::fLoGainArray
|
|---|
| 33 | //
|
|---|
| 34 | // - Average pixel per AREA index (e.g. inner and outer for the MAGIC camera),
|
|---|
| 35 | // stored in the TObjArray's MHCalibrationCam::fAverageHiGainAreas and
|
|---|
| 36 | // MHCalibrationCam::fAverageLoGainAreas
|
|---|
| 37 | //
|
|---|
| 38 | // - Average pixel per camera SECTOR (e.g. sectors 1-6 for the MAGIC camera),
|
|---|
| 39 | // stored in the TObjArray's MHCalibrationCam::fAverageHiGainSectors and
|
|---|
| 40 | // MHCalibrationCam::fAverageLoGainSectors
|
|---|
| 41 | //
|
|---|
| 42 | // Every signal is taken from MExtractedSignalCam and filled into a histogram and
|
|---|
| 43 | // an array, in order to perform a Fourier analysis (see MHGausEvents).
|
|---|
| 44 | // The signals are moreover averaged on an event-by-event basis and written into
|
|---|
| 45 | // the corresponding average pixels.
|
|---|
| 46 | //
|
|---|
| 47 | // Additionally, the (FADC slice) position of the maximum is stored in an Absolute
|
|---|
| 48 | // Arrival Time histogram. This histogram serves for a rough cross-check if the
|
|---|
| 49 | // signal does not lie at or outside the edges of the extraction window.
|
|---|
| 50 | //
|
|---|
| 51 | // The Charge histograms are fitted to a Gaussian, mean and sigma with its errors
|
|---|
| 52 | // and the fit probability are extracted. If none of these values are NaN's and
|
|---|
| 53 | // if the probability is bigger than MHGausEvents::fProbLimit (default: 0.5%),
|
|---|
| 54 | // the fit is declared valid.
|
|---|
| 55 | // Otherwise, the fit is repeated within ranges of the previous mean
|
|---|
| 56 | // +- MHCalibrationPix::fPickupLimit (default: 5) sigma (see MHCalibrationPix::RepeatFit())
|
|---|
| 57 | // In case this does not make the fit valid, the histogram means and RMS's are
|
|---|
| 58 | // taken directly (see MHCalibrationPix::BypassFit()) and the following flags are set:
|
|---|
| 59 | // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kHiGainNotFitted ) or
|
|---|
| 60 | // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainNotFitted ) and
|
|---|
| 61 | // - MBadPixelsPix::SetUnsuitable( MBadPixelsPix::kUnreliableRun )
|
|---|
| 62 | //
|
|---|
| 63 | // Outliers of more than MHCalibrationPix::fPickupLimit (default: 5) sigmas
|
|---|
| 64 | // from the mean are counted as Pickup events (stored in MHCalibrationPix::fPickup)
|
|---|
| 65 | //
|
|---|
| 66 | // Unless more than fNumHiGainSaturationLimit (default: 1%) of the overall FADC
|
|---|
| 67 | // slices show saturation, the following flag is set:
|
|---|
| 68 | // - MCalibrationChargePix::SetHiGainSaturation();
|
|---|
| 69 | // In that case, the calibration constants are derived from the low-gain results.
|
|---|
| 70 | //
|
|---|
| 71 | // If more than fNumLoGainSaturationLimit (default: 1%) of the overall
|
|---|
| 72 | // low-gain FADC slices saturate, the following flags are set:
|
|---|
| 73 | // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainSaturation ) and
|
|---|
| 74 | // - MBadPixelsPix::SetUnsuitable( MBadPixelsPix::kUnsuitableRun )
|
|---|
| 75 | //
|
|---|
| 76 | // The class also fills arrays with the signal vs. event number, creates a fourier
|
|---|
| 77 | // spectrum and investigates if the projected fourier components follow an exponential
|
|---|
| 78 | // distribution. In case that the probability of the exponential fit is less than
|
|---|
| 79 | // MHGausEvents::fProbLimit (default: 0.5%), the following flags are set:
|
|---|
| 80 | // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kHiGainOscillating ) or
|
|---|
| 81 | // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainOscillating ) and
|
|---|
| 82 | // - MBadPixelsPix::SetUnsuitable( MBadPixelsPix::kUnreliableRun )
|
|---|
| 83 | //
|
|---|
| 84 | // This same procedure is performed for the average pixels.
|
|---|
| 85 | //
|
|---|
| 86 | // The following results are written into MCalibrationChargeCam:
|
|---|
| 87 | //
|
|---|
| 88 | // - MCalibrationPix::SetHiGainSaturation()
|
|---|
| 89 | // - MCalibrationPix::SetHiGainMean()
|
|---|
| 90 | // - MCalibrationPix::SetHiGainMeanErr()
|
|---|
| 91 | // - MCalibrationPix::SetHiGainSigma()
|
|---|
| 92 | // - MCalibrationPix::SetHiGainSigmaErr()
|
|---|
| 93 | // - MCalibrationPix::SetHiGainProb()
|
|---|
| 94 | // - MCalibrationPix::SetHiGainNumPickup()
|
|---|
| 95 | //
|
|---|
| 96 | // - MCalibrationPix::SetLoGainMean()
|
|---|
| 97 | // - MCalibrationPix::SetLoGainMeanErr()
|
|---|
| 98 | // - MCalibrationPix::SetLoGainSigma()
|
|---|
| 99 | // - MCalibrationPix::SetLoGainSigmaErr()
|
|---|
| 100 | // - MCalibrationPix::SetLoGainProb()
|
|---|
| 101 | // - MCalibrationPix::SetLoGainNumPickup()
|
|---|
| 102 | //
|
|---|
| 103 | // - MCalibrationChargePix::SetAbsTimeMean()
|
|---|
| 104 | // - MCalibrationChargePix::SetAbsTimeRms()
|
|---|
| 105 | //
|
|---|
| 106 | // For all averaged areas, the fitted sigma is multiplied with the square root of
|
|---|
| 107 | // the number involved pixels in order to be able to compare it to the average of
|
|---|
| 108 | // sigmas in the camera.
|
|---|
| 109 | //
|
|---|
| 110 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 111 | #include "MHCalibrationChargeCam.h"
|
|---|
| 112 | #include "MHCalibrationCam.h"
|
|---|
| 113 |
|
|---|
| 114 | #include "MLog.h"
|
|---|
| 115 | #include "MLogManip.h"
|
|---|
| 116 |
|
|---|
| 117 | #include "MParList.h"
|
|---|
| 118 |
|
|---|
| 119 | #include "MHCalibrationChargePix.h"
|
|---|
| 120 | #include "MHCalibrationPix.h"
|
|---|
| 121 |
|
|---|
| 122 | #include "MCalibrationIntensityCam.h"
|
|---|
| 123 | #include "MCalibrationChargeCam.h"
|
|---|
| 124 | #include "MCalibrationChargePix.h"
|
|---|
| 125 |
|
|---|
| 126 | #include "MGeomCam.h"
|
|---|
| 127 | #include "MGeomPix.h"
|
|---|
| 128 |
|
|---|
| 129 | #include "MBadPixelsCam.h"
|
|---|
| 130 | #include "MBadPixelsPix.h"
|
|---|
| 131 |
|
|---|
| 132 | #include "MRawEvtData.h"
|
|---|
| 133 | #include "MRawRunHeader.h"
|
|---|
| 134 | #include "MRawEvtPixelIter.h"
|
|---|
| 135 |
|
|---|
| 136 | #include "MExtractedSignalCam.h"
|
|---|
| 137 | #include "MExtractedSignalPix.h"
|
|---|
| 138 |
|
|---|
| 139 | #include "MArrayI.h"
|
|---|
| 140 | #include "MArrayD.h"
|
|---|
| 141 |
|
|---|
| 142 | #include <TPad.h>
|
|---|
| 143 | #include <TVirtualPad.h>
|
|---|
| 144 | #include <TCanvas.h>
|
|---|
| 145 | #include <TStyle.h>
|
|---|
| 146 | #include <TF1.h>
|
|---|
| 147 | #include <TH2D.h>
|
|---|
| 148 | #include <TLine.h>
|
|---|
| 149 | #include <TLatex.h>
|
|---|
| 150 | #include <TLegend.h>
|
|---|
| 151 |
|
|---|
| 152 | ClassImp(MHCalibrationChargeCam);
|
|---|
| 153 |
|
|---|
| 154 | using namespace std;
|
|---|
| 155 |
|
|---|
| 156 | const Axis_t MHCalibrationChargeCam::fgChargeHiGainFirst = -100.5;
|
|---|
| 157 | const Axis_t MHCalibrationChargeCam::fgChargeHiGainLast = 999.5;
|
|---|
| 158 | const Axis_t MHCalibrationChargeCam::fgChargeLoGainFirst = -150.5;
|
|---|
| 159 | const Axis_t MHCalibrationChargeCam::fgChargeLoGainLast = 499.5;
|
|---|
| 160 |
|
|---|
| 161 | const Float_t MHCalibrationChargeCam::fgNumHiGainSaturationLimit = 0.01;
|
|---|
| 162 | const Float_t MHCalibrationChargeCam::fgNumLoGainSaturationLimit = 0.005;
|
|---|
| 163 | const Float_t MHCalibrationChargeCam::fgTimeLowerLimit = 1.;
|
|---|
| 164 | const Float_t MHCalibrationChargeCam::fgTimeUpperLimit = 2.;
|
|---|
| 165 | // 1Led Green, 1 LED blue, 5 LEDs blue, 10 LEDs blue, 10 LEDs UV, CT1, 5Leds Green
|
|---|
| 166 | const Float_t MHCalibrationChargeCam::gkHiGainInnerRefLines[7] = { 245., 323. , 1065., 1467., 180., 211. , 533.5};
|
|---|
| 167 | const Float_t MHCalibrationChargeCam::gkHiGainOuterRefLines[7] = { 217., 307.5, 932. , 1405., 167., 183.5, 405.5};
|
|---|
| 168 | const Float_t MHCalibrationChargeCam::gkLoGainInnerRefLines[7] = { 20.8, 28.0 , 121. , 200.2, 16.5, 13.5 , 41.7 };
|
|---|
| 169 | const Float_t MHCalibrationChargeCam::gkLoGainOuterRefLines[7] = { 18.9, 26.0 , 108.3, 198. , 14.0, 11. , 42. };
|
|---|
| 170 | // --------------------------------------------------------------------------
|
|---|
| 171 | //
|
|---|
| 172 | // Default Constructor.
|
|---|
| 173 | //
|
|---|
| 174 | // Sets:
|
|---|
| 175 | // - all pointers to NULL
|
|---|
| 176 | //
|
|---|
| 177 | // Initializes:
|
|---|
| 178 | // - fNumHiGainSaturationLimit to fgNumHiGainSaturationLimit
|
|---|
| 179 | // - fNumLoGainSaturationLimit to fgNumLoGainSaturationLimit
|
|---|
| 180 | // - fTimeLowerLimit to fgTimeLowerLimit
|
|---|
| 181 | // - fTimeUpperLimit to fgTimeUpperLimit
|
|---|
| 182 | //
|
|---|
| 183 | MHCalibrationChargeCam::MHCalibrationChargeCam(const char *name, const char *title)
|
|---|
| 184 | : fRawEvt(NULL)
|
|---|
| 185 | {
|
|---|
| 186 |
|
|---|
| 187 | fName = name ? name : "MHCalibrationChargeCam";
|
|---|
| 188 | fTitle = title ? title : "Class to fill the calibration histograms ";
|
|---|
| 189 |
|
|---|
| 190 | SetNumHiGainSaturationLimit(fgNumHiGainSaturationLimit);
|
|---|
| 191 | SetNumLoGainSaturationLimit(fgNumLoGainSaturationLimit);
|
|---|
| 192 | SetTimeLowerLimit();
|
|---|
| 193 | SetTimeUpperLimit();
|
|---|
| 194 |
|
|---|
| 195 | }
|
|---|
| 196 |
|
|---|
| 197 | // --------------------------------------------------------------------------
|
|---|
| 198 | //
|
|---|
| 199 | // Gets the pointers to:
|
|---|
| 200 | // - MRawEvtData
|
|---|
| 201 | //
|
|---|
| 202 | Bool_t MHCalibrationChargeCam::SetupHists(const MParList *pList)
|
|---|
| 203 | {
|
|---|
| 204 |
|
|---|
| 205 | fRawEvt = (MRawEvtData*)pList->FindObject("MRawEvtData");
|
|---|
| 206 | if (!fRawEvt)
|
|---|
| 207 | {
|
|---|
| 208 | *fLog << err << dbginf << "MRawEvtData not found... aborting." << endl;
|
|---|
| 209 | return kFALSE;
|
|---|
| 210 | }
|
|---|
| 211 |
|
|---|
| 212 | return kTRUE;
|
|---|
| 213 | }
|
|---|
| 214 |
|
|---|
| 215 | // --------------------------------------------------------------------------
|
|---|
| 216 | //
|
|---|
| 217 | // Gets or creates the pointers to:
|
|---|
| 218 | // - MExtractedSignalCam
|
|---|
| 219 | // - MCalibrationChargeCam
|
|---|
| 220 | // - MBadPixelsCam
|
|---|
| 221 | //
|
|---|
| 222 | // Initializes the number of used FADC slices from MExtractedSignalCam
|
|---|
| 223 | // into MCalibrationChargeCam and test for changes in that variable
|
|---|
| 224 | //
|
|---|
| 225 | // Initializes, if empty to MGeomCam::GetNumPixels():
|
|---|
| 226 | // - MHCalibrationCam::fHiGainArray, MHCalibrationCam::fLoGainArray
|
|---|
| 227 | // - MHCalibrationCam::fHiGainOverflow, MHCalibrationCam::fLoGainOverflow
|
|---|
| 228 | //
|
|---|
| 229 | // Initializes, if empty to MGeomCam::GetNumAreas() for:
|
|---|
| 230 | // - MHCalibrationCam::fAverageHiGainAreas, MHCalibrationCam::fAverageLoGainAreas
|
|---|
| 231 | //
|
|---|
| 232 | // Initializes, if empty to MGeomCam::GetNumSectors() for:
|
|---|
| 233 | // - MHCalibrationCam::fAverageHiGainSectors, MHCalibrationCam::fAverageLoGainSectors
|
|---|
| 234 | //
|
|---|
| 235 | // Calls MHCalibrationCam::InitHists() for every entry in:
|
|---|
| 236 | // - MHCalibrationCam::fHiGainArray, MHCalibrationCam::fLoGainArray
|
|---|
| 237 | // - MHCalibrationCam::fAverageHiGainAreas, MHCalibrationCam::fAverageLoGainAreas
|
|---|
| 238 | // - MHCalibrationCam::fAverageHiGainSectors, MHCalibrationCam::fAverageLoGainSectors
|
|---|
| 239 | //
|
|---|
| 240 | // Sets Titles and Names for the Charge Histograms:
|
|---|
| 241 | // - MHCalibrationCam::fAverageHiGainAreas
|
|---|
| 242 | // - MHCalibrationCam::fAverageHiGainSectors
|
|---|
| 243 | //
|
|---|
| 244 | Bool_t MHCalibrationChargeCam::ReInitHists(MParList *pList)
|
|---|
| 245 | {
|
|---|
| 246 |
|
|---|
| 247 | MExtractedSignalCam *signal =
|
|---|
| 248 | (MExtractedSignalCam*)pList->FindObject(AddSerialNumber("MExtractedSignalCam"));
|
|---|
| 249 | if (!signal)
|
|---|
| 250 | {
|
|---|
| 251 | *fLog << err << "MExtractedSignalCam not found... abort." << endl;
|
|---|
| 252 | return kFALSE;
|
|---|
| 253 | }
|
|---|
| 254 |
|
|---|
| 255 | fIntensCam = (MCalibrationIntensityCam*)pList->FindObject(AddSerialNumber("MCalibrationIntensityChargeCam"));
|
|---|
| 256 | if (fIntensCam)
|
|---|
| 257 | *fLog << inf << "Found MCalibrationIntensityChargeCam ... " << endl;
|
|---|
| 258 | else
|
|---|
| 259 | {
|
|---|
| 260 | fCam = (MCalibrationCam*)pList->FindObject(AddSerialNumber("MCalibrationChargeCam"));
|
|---|
| 261 | if (!fCam)
|
|---|
| 262 | {
|
|---|
| 263 | fCam = (MCalibrationCam*)pList->FindCreateObj(AddSerialNumber("MCalibrationChargeCam"));
|
|---|
| 264 | if (!fCam)
|
|---|
| 265 | {
|
|---|
| 266 | *fLog << err << "Cannot find nor create MCalibrationChargeCam ... abort." << endl;
|
|---|
| 267 | return kFALSE;
|
|---|
| 268 | }
|
|---|
| 269 | fCam->Init(*fGeom);
|
|---|
| 270 | }
|
|---|
| 271 | }
|
|---|
| 272 |
|
|---|
| 273 | fFirstHiGain = signal->GetFirstUsedSliceHiGain();
|
|---|
| 274 | fLastHiGain = signal->GetLastUsedSliceHiGain();
|
|---|
| 275 | fFirstLoGain = signal->GetFirstUsedSliceLoGain();
|
|---|
| 276 | fLastLoGain = signal->GetLastUsedSliceLoGain();
|
|---|
| 277 |
|
|---|
| 278 | /*
|
|---|
| 279 | const Float_t numhigain = signal->GetNumUsedHiGainFADCSlices();
|
|---|
| 280 | const Float_t numlogain = signal->GetNumUsedLoGainFADCSlices();
|
|---|
| 281 |
|
|---|
| 282 |
|
|---|
| 283 | if (fCam)
|
|---|
| 284 | {
|
|---|
| 285 | if (fCam->GetNumHiGainFADCSlices() == 0.)
|
|---|
| 286 | fCam->SetNumHiGainFADCSlices ( numhigain );
|
|---|
| 287 | else if (fCam->GetNumHiGainFADCSlices() != numhigain)
|
|---|
| 288 | {
|
|---|
| 289 | *fLog << err << GetDescriptor()
|
|---|
| 290 | << ": Number of High Gain FADC extraction slices has changed, abort..." << endl;
|
|---|
| 291 | return kFALSE;
|
|---|
| 292 | }
|
|---|
| 293 |
|
|---|
| 294 | if (fCam->GetNumLoGainFADCSlices() == 0.)
|
|---|
| 295 | fCam->SetNumLoGainFADCSlices ( numlogain );
|
|---|
| 296 | else if (fCam->GetNumLoGainFADCSlices() != numlogain)
|
|---|
| 297 | {
|
|---|
| 298 | *fLog << err << GetDescriptor()
|
|---|
| 299 | << ": Number of Low Gain FADC extraction slices has changes, abort..." << endl;
|
|---|
| 300 | return kFALSE;
|
|---|
| 301 | }
|
|---|
| 302 | }
|
|---|
| 303 | */
|
|---|
| 304 |
|
|---|
| 305 |
|
|---|
| 306 | const Int_t npixels = fGeom->GetNumPixels();
|
|---|
| 307 | const Int_t nsectors = fGeom->GetNumSectors();
|
|---|
| 308 | const Int_t nareas = fGeom->GetNumAreas();
|
|---|
| 309 |
|
|---|
| 310 | const Int_t higainsamples = fRunHeader->GetNumSamplesHiGain();
|
|---|
| 311 | const Int_t logainsamples = fRunHeader->GetNumSamplesLoGain();
|
|---|
| 312 |
|
|---|
| 313 | if (fHiGainArray->GetEntries()==0)
|
|---|
| 314 | {
|
|---|
| 315 | fHiGainArray->Expand(npixels);
|
|---|
| 316 | for (Int_t i=0; i<npixels; i++)
|
|---|
| 317 | {
|
|---|
| 318 | (*fHiGainArray)[i] = new MHCalibrationChargePix("ChargeHiGainPix","Signals of the HiGain");
|
|---|
| 319 | MHCalibrationChargePix &pix = (MHCalibrationChargePix&)(*this)[i];
|
|---|
| 320 |
|
|---|
| 321 | pix.SetAbsTimeNbins(higainsamples);
|
|---|
| 322 | pix.SetAbsTimeFirst(-0.5);
|
|---|
| 323 | pix.SetAbsTimeLast(higainsamples-0.5);
|
|---|
| 324 |
|
|---|
| 325 | pix.SetNbins((Int_t)(fgChargeHiGainLast-fgChargeHiGainFirst));
|
|---|
| 326 | pix.SetFirst(fgChargeHiGainFirst);
|
|---|
| 327 | pix.SetLast(fgChargeHiGainLast);
|
|---|
| 328 |
|
|---|
| 329 | pix.GetHGausHist()->SetName ("HCalibrationChargeHiGainPix");
|
|---|
| 330 | pix.GetHGausHist()->SetTitle("Summed Hi Gain FADC slices Pixel ");
|
|---|
| 331 |
|
|---|
| 332 | pix.GetHAbsTime()->SetName ("HAbsTimeHiGainPix");
|
|---|
| 333 | pix.GetHAbsTime()->SetTitle("Absolute Arrival Times Hi Gain Pixel ");
|
|---|
| 334 |
|
|---|
| 335 | InitHists((*this)[i],(*fBadPixels)[i],i);
|
|---|
| 336 | }
|
|---|
| 337 | }
|
|---|
| 338 |
|
|---|
| 339 | if (fLoGainArray->GetEntries()==0 && fLoGain)
|
|---|
| 340 | {
|
|---|
| 341 | fLoGainArray->Expand(npixels);
|
|---|
| 342 |
|
|---|
| 343 | for (Int_t i=0; i<npixels; i++)
|
|---|
| 344 | {
|
|---|
| 345 | (*fLoGainArray)[i] = new MHCalibrationChargePix("ChargeLoGainPix","Signals of the LoGain");
|
|---|
| 346 | MHCalibrationChargePix &pix = (MHCalibrationChargePix&)(*this)(i);
|
|---|
| 347 |
|
|---|
| 348 | pix.SetAbsTimeNbins(logainsamples);
|
|---|
| 349 | pix.SetAbsTimeFirst(-0.5);
|
|---|
| 350 | pix.SetAbsTimeLast(logainsamples-0.5);
|
|---|
| 351 |
|
|---|
| 352 | pix.SetNbins((Int_t)(fgChargeLoGainLast-fgChargeLoGainFirst));
|
|---|
| 353 | pix.SetFirst(fgChargeLoGainFirst);
|
|---|
| 354 | pix.SetLast(fgChargeLoGainLast);
|
|---|
| 355 |
|
|---|
| 356 | pix.GetHGausHist()->SetName ("HCalibrationChargeLoGainPix");
|
|---|
| 357 | pix.GetHGausHist()->SetTitle("Summed Lo Gain FADC slices Pixel ");
|
|---|
| 358 |
|
|---|
| 359 | pix.GetHAbsTime()->SetName ("HAbsTimeLoGainPix");
|
|---|
| 360 | pix.GetHAbsTime()->SetTitle("Absolute Arrival Times Lo Gain Pixel ");
|
|---|
| 361 |
|
|---|
| 362 | //
|
|---|
| 363 | // Adapt the range for the case, the intense blue is used:
|
|---|
| 364 | // FIXME: this is a nasty workaround, but for the moment necessary
|
|---|
| 365 | // in order to avoid default memory space.
|
|---|
| 366 | //
|
|---|
| 367 | if (fGeom->InheritsFrom("MGeomCamMagic"))
|
|---|
| 368 | {
|
|---|
| 369 | if ( fColor == MCalibrationCam::kBLUE)
|
|---|
| 370 | {
|
|---|
| 371 | pix.SetLast(999.5);
|
|---|
| 372 | pix.SetNbins((Int_t)(999.5-fgChargeLoGainFirst));
|
|---|
| 373 | }
|
|---|
| 374 | }
|
|---|
| 375 | InitHists(pix,(*fBadPixels)[i],i);
|
|---|
| 376 | }
|
|---|
| 377 | }
|
|---|
| 378 |
|
|---|
| 379 | if (fAverageHiGainAreas->GetEntries()==0)
|
|---|
| 380 | {
|
|---|
| 381 | fAverageHiGainAreas->Expand(nareas);
|
|---|
| 382 |
|
|---|
| 383 | for (Int_t j=0; j<nareas; j++)
|
|---|
| 384 | {
|
|---|
| 385 | (*fAverageHiGainAreas)[j] = new MHCalibrationChargePix("ChargeAverageHiGainArea",
|
|---|
| 386 | "Average HiGain FADC sums area idx ");
|
|---|
| 387 |
|
|---|
| 388 | MHCalibrationChargePix &pix = (MHCalibrationChargePix&)GetAverageHiGainArea(j);
|
|---|
| 389 |
|
|---|
| 390 | pix.SetAbsTimeNbins(higainsamples);
|
|---|
| 391 | pix.SetAbsTimeFirst(-0.5);
|
|---|
| 392 | pix.SetAbsTimeLast(higainsamples-0.5);
|
|---|
| 393 |
|
|---|
| 394 | pix.SetNbins((Int_t)(fgChargeHiGainLast-fgChargeHiGainFirst)*3);
|
|---|
| 395 | pix.SetFirst(fgChargeHiGainFirst);
|
|---|
| 396 | pix.SetLast(fgChargeHiGainLast);
|
|---|
| 397 |
|
|---|
| 398 | pix.GetHGausHist()->SetName ("HCalibrationChargeHiGainAreaIdx");
|
|---|
| 399 | pix.GetHGausHist()->SetTitle("Signal averaged on event-by-event basis High Gain Area Idx ");
|
|---|
| 400 |
|
|---|
| 401 | pix.GetHAbsTime()->SetName ("HAbsTimeHiGainAreaIdx");
|
|---|
| 402 | pix.GetHAbsTime()->SetTitle("Absolute Arrival Times average Hi Gain Area Idx ");
|
|---|
| 403 |
|
|---|
| 404 | if (fGeom->InheritsFrom("MGeomCamMagic"))
|
|---|
| 405 | {
|
|---|
| 406 | pix.GetHGausHist()->SetTitle(Form("%s%s%s","Signal averaged on event-by-event basis ",
|
|---|
| 407 | j==0 ? "Inner Pixels " : "Outer Pixels ","High Gain Runs: "));
|
|---|
| 408 | pix.InitBins();
|
|---|
| 409 | pix.SetEventFrequency(fPulserFrequency);
|
|---|
| 410 | }
|
|---|
| 411 | else
|
|---|
| 412 | {
|
|---|
| 413 | InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j);
|
|---|
| 414 | }
|
|---|
| 415 | }
|
|---|
| 416 | }
|
|---|
| 417 |
|
|---|
| 418 |
|
|---|
| 419 | if (fAverageLoGainAreas->GetEntries()==0 && fLoGain)
|
|---|
| 420 | {
|
|---|
| 421 | fAverageLoGainAreas->Expand(nareas);
|
|---|
| 422 |
|
|---|
| 423 | for (Int_t j=0; j<nareas; j++)
|
|---|
| 424 | {
|
|---|
| 425 | (*fAverageLoGainAreas)[j] = new MHCalibrationChargePix("ChargeAverageLoGainArea",
|
|---|
| 426 | "Average LoGain FADC sums area idx ");
|
|---|
| 427 |
|
|---|
| 428 | MHCalibrationChargePix &pix = (MHCalibrationChargePix&)GetAverageLoGainArea(j);
|
|---|
| 429 |
|
|---|
| 430 | pix.SetAbsTimeNbins(logainsamples);
|
|---|
| 431 | pix.SetAbsTimeFirst(-0.5);
|
|---|
| 432 | pix.SetAbsTimeLast(logainsamples-0.5);
|
|---|
| 433 |
|
|---|
| 434 | pix.SetNbins((Int_t)(fgChargeLoGainLast-fgChargeLoGainFirst)*3);
|
|---|
| 435 | pix.SetFirst(fgChargeLoGainFirst);
|
|---|
| 436 | pix.SetLast(fgChargeLoGainLast);
|
|---|
| 437 |
|
|---|
| 438 | pix.GetHGausHist()->SetName ("HChargeLoGainAreaIdx");
|
|---|
| 439 | pix.GetHGausHist()->SetTitle("Signal averaged on event-by-event basis Low Gain Area Idx ");
|
|---|
| 440 |
|
|---|
| 441 | pix.GetHAbsTime()->SetName ("HAbsTimeLoGainAreaIdx");
|
|---|
| 442 | pix.GetHAbsTime()->SetTitle("Absolute Arrival Times average Lo Gain Area Idx ");
|
|---|
| 443 |
|
|---|
| 444 | //
|
|---|
| 445 | // Adapt the range for the case, the intense blue is used:
|
|---|
| 446 | // FIXME: this is a nasty workaround, but for the moment necessary
|
|---|
| 447 | // in order to avoid default memory space.
|
|---|
| 448 | //
|
|---|
| 449 | if (fGeom->InheritsFrom("MGeomCamMagic"))
|
|---|
| 450 | {
|
|---|
| 451 | if ( fColor == MCalibrationCam::kBLUE)
|
|---|
| 452 | {
|
|---|
| 453 | pix.SetFirst(-10.5);
|
|---|
| 454 | pix.SetLast(999.5);
|
|---|
| 455 | pix.SetNbins(3030);
|
|---|
| 456 | }
|
|---|
| 457 | }
|
|---|
| 458 |
|
|---|
| 459 | if (fGeom->InheritsFrom("MGeomCamMagic"))
|
|---|
| 460 | {
|
|---|
| 461 | pix.GetHGausHist()->SetTitle(Form("%s%s%s","Signal averaged on event-by-event basis ",
|
|---|
| 462 | j==0 ? "Inner Pixels " : "Outer Pixels ","Low Gain Runs: "));
|
|---|
| 463 | pix.InitBins();
|
|---|
| 464 | pix.SetEventFrequency(fPulserFrequency);
|
|---|
| 465 | }
|
|---|
| 466 | else
|
|---|
| 467 | {
|
|---|
| 468 | InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j);
|
|---|
| 469 | }
|
|---|
| 470 | }
|
|---|
| 471 | }
|
|---|
| 472 |
|
|---|
| 473 | if (fAverageHiGainSectors->GetEntries()==0)
|
|---|
| 474 | {
|
|---|
| 475 | fAverageHiGainSectors->Expand(nsectors);
|
|---|
| 476 |
|
|---|
| 477 | for (Int_t j=0; j<nsectors; j++)
|
|---|
| 478 | {
|
|---|
| 479 | (*fAverageHiGainSectors)[j] = new MHCalibrationChargePix("ChargeAverageHiGainSector",
|
|---|
| 480 | "Averaged HiGain Signals Sector ");
|
|---|
| 481 |
|
|---|
| 482 | MHCalibrationChargePix &pix = (MHCalibrationChargePix&)GetAverageHiGainSector(j);
|
|---|
| 483 |
|
|---|
| 484 | pix.SetAbsTimeNbins(higainsamples);
|
|---|
| 485 | pix.SetAbsTimeFirst(-0.5);
|
|---|
| 486 | pix.SetAbsTimeLast(higainsamples-0.5);
|
|---|
| 487 |
|
|---|
| 488 | pix.SetNbins((Int_t)(fgChargeHiGainLast-fgChargeHiGainFirst)*3);
|
|---|
| 489 | pix.SetFirst(fgChargeHiGainFirst);
|
|---|
| 490 | pix.SetLast(fgChargeHiGainLast);
|
|---|
| 491 |
|
|---|
| 492 | pix.GetHGausHist()->SetName ("HCalibrationChargeHiGainPix");
|
|---|
| 493 | pix.GetHGausHist()->SetTitle("Signals averaged on event-by-event basis HiGain Sector ");
|
|---|
| 494 |
|
|---|
| 495 | pix.GetHAbsTime()->SetName ("HAbsTimeHiGainPix");
|
|---|
| 496 | pix.GetHAbsTime()->SetTitle("Absolute Arrival Time average HiGain Sector ");
|
|---|
| 497 |
|
|---|
| 498 | InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadSector(j) : fCam->GetAverageBadSector(j),j);
|
|---|
| 499 | }
|
|---|
| 500 | }
|
|---|
| 501 |
|
|---|
| 502 | if (fAverageLoGainSectors->GetEntries()==0 && fLoGain)
|
|---|
| 503 | {
|
|---|
| 504 | fAverageLoGainSectors->Expand(nsectors);
|
|---|
| 505 |
|
|---|
| 506 | for (Int_t j=0; j<nsectors; j++)
|
|---|
| 507 | {
|
|---|
| 508 | (*fAverageLoGainSectors)[j] = new MHCalibrationChargePix("ChargeAverageLoGainSector",
|
|---|
| 509 | "Average LoGain Signals Sector ");
|
|---|
| 510 |
|
|---|
| 511 | MHCalibrationChargePix &pix = (MHCalibrationChargePix&)GetAverageLoGainSector(j);
|
|---|
| 512 |
|
|---|
| 513 | pix.SetAbsTimeNbins(logainsamples);
|
|---|
| 514 | pix.SetAbsTimeFirst(-0.5);
|
|---|
| 515 | pix.SetAbsTimeLast(logainsamples-0.5);
|
|---|
| 516 |
|
|---|
| 517 | pix.SetNbins((Int_t)(fgChargeLoGainLast-fgChargeLoGainFirst)*3);
|
|---|
| 518 | pix.SetFirst(fgChargeLoGainFirst);
|
|---|
| 519 | pix.SetLast(fgChargeLoGainLast);
|
|---|
| 520 |
|
|---|
| 521 | pix.GetHGausHist()->SetName ("HCalibrationChargeLoGainPix");
|
|---|
| 522 | pix.GetHGausHist()->SetTitle("Signals averaged on event-by-event basis LoGain Sector ");
|
|---|
| 523 |
|
|---|
| 524 | pix.GetHAbsTime()->SetName ("HAbsTimeLoGainPix");
|
|---|
| 525 | pix.GetHAbsTime()->SetTitle("Absolute Arrival Time average LoGain Sector ");
|
|---|
| 526 |
|
|---|
| 527 | //
|
|---|
| 528 | // Adapt the range for the case, the intense blue is used:
|
|---|
| 529 | // FIXME: this is a nasty workaround, but for the moment necessary
|
|---|
| 530 | // in order to avoid default memory space.
|
|---|
| 531 | //
|
|---|
| 532 | if (fGeom->InheritsFrom("MGeomCamMagic"))
|
|---|
| 533 | {
|
|---|
| 534 | if ( fColor == MCalibrationCam::kBLUE)
|
|---|
| 535 | {
|
|---|
| 536 | pix.SetFirst(-10.5);
|
|---|
| 537 | pix.SetLast(999.5);
|
|---|
| 538 | pix.SetNbins(3030);
|
|---|
| 539 | }
|
|---|
| 540 | }
|
|---|
| 541 |
|
|---|
| 542 | InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadSector(j) : fCam->GetAverageBadSector(j),j);
|
|---|
| 543 | }
|
|---|
| 544 | }
|
|---|
| 545 |
|
|---|
| 546 | fSumhiarea .Set(nareas);
|
|---|
| 547 | fSumloarea .Set(nareas);
|
|---|
| 548 | fTimehiarea .Set(nareas);
|
|---|
| 549 | fTimeloarea .Set(nareas);
|
|---|
| 550 | fSumhisector.Set(nsectors);
|
|---|
| 551 | fSumlosector.Set(nsectors);
|
|---|
| 552 | fTimehisector.Set(nsectors);
|
|---|
| 553 | fTimelosector.Set(nsectors);
|
|---|
| 554 |
|
|---|
| 555 | fSathiarea .Set(nareas);
|
|---|
| 556 | fSatloarea .Set(nareas);
|
|---|
| 557 | fSathisector.Set(nsectors);
|
|---|
| 558 | fSatlosector.Set(nsectors);
|
|---|
| 559 |
|
|---|
| 560 | return kTRUE;
|
|---|
| 561 | }
|
|---|
| 562 |
|
|---|
| 563 |
|
|---|
| 564 | // --------------------------------------------------------------------------
|
|---|
| 565 | //
|
|---|
| 566 | // Retrieves from MExtractedSignalCam:
|
|---|
| 567 | // - first used LoGain FADC slice
|
|---|
| 568 | //
|
|---|
| 569 | // Retrieves from MGeomCam:
|
|---|
| 570 | // - number of pixels
|
|---|
| 571 | // - number of pixel areas
|
|---|
| 572 | // - number of sectors
|
|---|
| 573 | //
|
|---|
| 574 | // For all TObjArray's (including the averaged ones), the following steps are performed:
|
|---|
| 575 | //
|
|---|
| 576 | // 1) Fill Charges histograms (MHGausEvents::FillHistAndArray()) with:
|
|---|
| 577 | // - MExtractedSignalPix::GetExtractedSignalHiGain();
|
|---|
| 578 | // - MExtractedSignalPix::GetExtractedSignalLoGain();
|
|---|
| 579 | //
|
|---|
| 580 | // 2) Set number of saturated slices (MHCalibrationChargePix::SetSaturated()) with:
|
|---|
| 581 | // - MExtractedSignalPix::GetNumHiGainSaturated();
|
|---|
| 582 | // - MExtractedSignalPix::GetNumLoGainSaturated();
|
|---|
| 583 | //
|
|---|
| 584 | // 3) Fill AbsTime histograms (MHCalibrationChargePix::FillAbsTime()) with:
|
|---|
| 585 | // - MRawEvtPixelIter::GetIdxMaxHiGainSample();
|
|---|
| 586 | // - MRawEvtPixelIter::GetIdxMaxLoGainSample(first slice);
|
|---|
| 587 | //
|
|---|
| 588 | Bool_t MHCalibrationChargeCam::FillHists(const MParContainer *par, const Stat_t w)
|
|---|
| 589 | {
|
|---|
| 590 |
|
|---|
| 591 | MExtractedSignalCam *signal = (MExtractedSignalCam*)par;
|
|---|
| 592 | if (!signal)
|
|---|
| 593 | {
|
|---|
| 594 | *fLog << err << "No argument in MExtractedSignalCam::Fill... abort." << endl;
|
|---|
| 595 | return kFALSE;
|
|---|
| 596 | }
|
|---|
| 597 |
|
|---|
| 598 | const UInt_t npixels = fGeom->GetNumPixels();
|
|---|
| 599 | const UInt_t nareas = fGeom->GetNumAreas();
|
|---|
| 600 | const UInt_t nsectors = fGeom->GetNumSectors();
|
|---|
| 601 | const UInt_t lofirst = signal->GetFirstUsedSliceLoGain();
|
|---|
| 602 |
|
|---|
| 603 | fSumhiarea .Reset();
|
|---|
| 604 | fSumloarea .Reset();
|
|---|
| 605 | fTimehiarea .Reset();
|
|---|
| 606 | fTimeloarea .Reset();
|
|---|
| 607 | fSumhisector.Reset();
|
|---|
| 608 | fSumlosector.Reset();
|
|---|
| 609 | fTimehisector.Reset();
|
|---|
| 610 | fTimelosector.Reset();
|
|---|
| 611 |
|
|---|
| 612 | fSathiarea .Reset();
|
|---|
| 613 | fSatloarea .Reset();
|
|---|
| 614 | fSathisector.Reset();
|
|---|
| 615 | fSatlosector.Reset();
|
|---|
| 616 |
|
|---|
| 617 | for (UInt_t i=0; i<npixels; i++)
|
|---|
| 618 | {
|
|---|
| 619 |
|
|---|
| 620 | MHCalibrationChargePix &histhi = (MHCalibrationChargePix&)(*this)[i];
|
|---|
| 621 |
|
|---|
| 622 | if (histhi.IsExcluded())
|
|---|
| 623 | continue;
|
|---|
| 624 |
|
|---|
| 625 | const MExtractedSignalPix &pix = (*signal)[i];
|
|---|
| 626 |
|
|---|
| 627 | const Float_t sumhi = pix.GetExtractedSignalHiGain();
|
|---|
| 628 | const Int_t sathi = (Int_t)pix.GetNumHiGainSaturated();
|
|---|
| 629 |
|
|---|
| 630 | histhi.FillHistAndArray(sumhi);
|
|---|
| 631 | histhi.SetSaturated(sathi);
|
|---|
| 632 |
|
|---|
| 633 | const Int_t aidx = (*fGeom)[i].GetAidx();
|
|---|
| 634 | const Int_t sector = (*fGeom)[i].GetSector();
|
|---|
| 635 |
|
|---|
| 636 | fSumhiarea[aidx] += sumhi;
|
|---|
| 637 | fSathiarea[aidx] += sathi;
|
|---|
| 638 |
|
|---|
| 639 | fSumhisector[sector] += sumhi;
|
|---|
| 640 | fSathisector[sector] += sathi;
|
|---|
| 641 |
|
|---|
| 642 | if (fLoGain)
|
|---|
| 643 | {
|
|---|
| 644 | MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)(*this)(i);
|
|---|
| 645 | const Float_t sumlo = pix.GetExtractedSignalLoGain();
|
|---|
| 646 | const Int_t satlo = (Int_t)pix.GetNumLoGainSaturated();
|
|---|
| 647 |
|
|---|
| 648 | histlo.FillHistAndArray(sumlo);
|
|---|
| 649 | histlo.SetSaturated(satlo);
|
|---|
| 650 |
|
|---|
| 651 | fSumloarea[aidx] += sumlo;
|
|---|
| 652 | fSatloarea[aidx] += satlo;
|
|---|
| 653 | fSumlosector[sector] += sumlo;
|
|---|
| 654 | fSatlosector[sector] += satlo;
|
|---|
| 655 | }
|
|---|
| 656 |
|
|---|
| 657 | }
|
|---|
| 658 |
|
|---|
| 659 | MRawEvtPixelIter pixel(fRawEvt);
|
|---|
| 660 | while (pixel.Next())
|
|---|
| 661 | {
|
|---|
| 662 |
|
|---|
| 663 | const UInt_t pixid = pixel.GetPixelId();
|
|---|
| 664 |
|
|---|
| 665 | MHCalibrationChargePix &histhi = (MHCalibrationChargePix&)(*this)[pixid];
|
|---|
| 666 |
|
|---|
| 667 | if (histhi.IsExcluded())
|
|---|
| 668 | continue;
|
|---|
| 669 |
|
|---|
| 670 | const Float_t timehi = (Float_t)pixel.GetIdxMaxHiGainSample();
|
|---|
| 671 |
|
|---|
| 672 | histhi.FillAbsTime(timehi);
|
|---|
| 673 |
|
|---|
| 674 | const Int_t aidx = (*fGeom)[pixid].GetAidx();
|
|---|
| 675 | const Int_t sector = (*fGeom)[pixid].GetSector();
|
|---|
| 676 |
|
|---|
| 677 | fTimehiarea [aidx] += timehi;
|
|---|
| 678 | fTimehisector[sector] += timehi;
|
|---|
| 679 |
|
|---|
| 680 | if (fLoGain)
|
|---|
| 681 | {
|
|---|
| 682 | MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)(*this)(pixid);
|
|---|
| 683 |
|
|---|
| 684 | const Float_t timelo = (Float_t)pixel.GetIdxMaxLoGainSample(lofirst);
|
|---|
| 685 | histlo.FillAbsTime(timelo);
|
|---|
| 686 |
|
|---|
| 687 | fTimeloarea[aidx] += timelo;
|
|---|
| 688 | fTimelosector[sector] += timelo;
|
|---|
| 689 | }
|
|---|
| 690 | }
|
|---|
| 691 |
|
|---|
| 692 | for (UInt_t j=0; j<nareas; j++)
|
|---|
| 693 | {
|
|---|
| 694 |
|
|---|
| 695 | const Int_t npix = fAverageAreaNum[j];
|
|---|
| 696 |
|
|---|
| 697 | if (npix == 0)
|
|---|
| 698 | continue;
|
|---|
| 699 |
|
|---|
| 700 | MHCalibrationChargePix &hipix = (MHCalibrationChargePix&)GetAverageHiGainArea(j);
|
|---|
| 701 |
|
|---|
| 702 | hipix.FillHistAndArray(fSumhiarea [j]/npix);
|
|---|
| 703 | hipix.SetSaturated (fSathiarea [j]/npix);
|
|---|
| 704 | hipix.FillAbsTime (fTimehiarea[j]/npix);
|
|---|
| 705 |
|
|---|
| 706 | if (fLoGain)
|
|---|
| 707 | {
|
|---|
| 708 | MHCalibrationChargePix &lopix = (MHCalibrationChargePix&)GetAverageLoGainArea(j);
|
|---|
| 709 | lopix.FillHistAndArray(fSumloarea [j]/npix);
|
|---|
| 710 | lopix.SetSaturated (fSatloarea [j]/npix);
|
|---|
| 711 | lopix.FillAbsTime (fTimeloarea[j]/npix);
|
|---|
| 712 | }
|
|---|
| 713 | }
|
|---|
| 714 |
|
|---|
| 715 | for (UInt_t j=0; j<nsectors; j++)
|
|---|
| 716 | {
|
|---|
| 717 |
|
|---|
| 718 | const Int_t npix = fAverageSectorNum[j];
|
|---|
| 719 |
|
|---|
| 720 | if (npix == 0)
|
|---|
| 721 | continue;
|
|---|
| 722 |
|
|---|
| 723 | MHCalibrationChargePix &hipix = (MHCalibrationChargePix&)GetAverageHiGainSector(j);
|
|---|
| 724 |
|
|---|
| 725 | hipix.FillHistAndArray(fSumhisector [j]/npix);
|
|---|
| 726 | hipix.SetSaturated (fSathisector [j]/npix);
|
|---|
| 727 | hipix.FillAbsTime (fTimehisector[j]/npix);
|
|---|
| 728 |
|
|---|
| 729 | if (fLoGain)
|
|---|
| 730 | {
|
|---|
| 731 | MHCalibrationChargePix &lopix = (MHCalibrationChargePix&)GetAverageLoGainSector(j);
|
|---|
| 732 | lopix.FillHistAndArray(fSumlosector [j]/npix);
|
|---|
| 733 | lopix.SetSaturated (fSatlosector [j]/npix);
|
|---|
| 734 | lopix.FillAbsTime (fTimelosector[j]/npix);
|
|---|
| 735 | }
|
|---|
| 736 | }
|
|---|
| 737 |
|
|---|
| 738 | return kTRUE;
|
|---|
| 739 | }
|
|---|
| 740 |
|
|---|
| 741 | // --------------------------------------------------------------------------
|
|---|
| 742 | //
|
|---|
| 743 | // For all TObjArray's (including the averaged ones), the following steps are performed:
|
|---|
| 744 | //
|
|---|
| 745 | // 1) Returns if the pixel is excluded.
|
|---|
| 746 | // 2) Tests saturation. In case yes, set the flag: MCalibrationPix::SetHiGainSaturation()
|
|---|
| 747 | // or the flag: MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainSaturated )
|
|---|
| 748 | // 3) Store the absolute arrival times in the MCalibrationChargePix's. If flag
|
|---|
| 749 | // MCalibrationPix::IsHiGainSaturation() is set, the Low-Gain arrival times are stored,
|
|---|
| 750 | // otherwise the Hi-Gain ones.
|
|---|
| 751 | // 4) Calls to MHCalibrationCam::FitHiGainArrays() and MCalibrationCam::FitLoGainArrays()
|
|---|
| 752 | // with the flags:
|
|---|
| 753 | // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kHiGainNotFitted )
|
|---|
| 754 | // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainNotFitted )
|
|---|
| 755 | // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kHiGainOscillating )
|
|---|
| 756 | // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainOscillating )
|
|---|
| 757 | //
|
|---|
| 758 | Bool_t MHCalibrationChargeCam::FinalizeHists()
|
|---|
| 759 | {
|
|---|
| 760 |
|
|---|
| 761 | *fLog << endl;
|
|---|
| 762 |
|
|---|
| 763 | for (Int_t i=0; i<fHiGainArray->GetSize(); i++)
|
|---|
| 764 | {
|
|---|
| 765 |
|
|---|
| 766 | MHCalibrationChargePix &histhi = (MHCalibrationChargePix&)(*this)[i];
|
|---|
| 767 |
|
|---|
| 768 | if (histhi.IsExcluded())
|
|---|
| 769 | continue;
|
|---|
| 770 |
|
|---|
| 771 | MCalibrationChargePix &pix = fIntensCam
|
|---|
| 772 | ? (MCalibrationChargePix&)(*fIntensCam)[i]
|
|---|
| 773 | : (MCalibrationChargePix&)(*fCam)[i];
|
|---|
| 774 |
|
|---|
| 775 | if (histhi.GetSaturated() > fNumHiGainSaturationLimit*histhi.GetHGausHist()->GetEntries())
|
|---|
| 776 | {
|
|---|
| 777 | pix.SetHiGainSaturation();
|
|---|
| 778 | histhi.CreateFourierSpectrum();
|
|---|
| 779 | continue;
|
|---|
| 780 | }
|
|---|
| 781 |
|
|---|
| 782 | MBadPixelsPix &bad = (*fBadPixels)[i];
|
|---|
| 783 |
|
|---|
| 784 | Stat_t overflow = histhi.GetHGausHist()->GetBinContent(histhi.GetHGausHist()->GetNbinsX()+1);
|
|---|
| 785 | if (overflow > 0.1)
|
|---|
| 786 | {
|
|---|
| 787 | *fLog << warn << GetDescriptor()
|
|---|
| 788 | << ": HiGain Histogram Overflow occurred " << overflow
|
|---|
| 789 | << " times in pixel: " << i << " (without saturation!) " << endl;
|
|---|
| 790 | bad.SetUncalibrated( MBadPixelsPix::kHiGainOverFlow );
|
|---|
| 791 | }
|
|---|
| 792 |
|
|---|
| 793 | overflow = histhi.GetHGausHist()->GetBinContent(0);
|
|---|
| 794 | if (overflow > 0.1)
|
|---|
| 795 | {
|
|---|
| 796 | *fLog << warn << GetDescriptor()
|
|---|
| 797 | << ": HiGain Histogram Underflow occurred " << overflow
|
|---|
| 798 | << " times in pixel: " << i << " (without saturation!) " << endl;
|
|---|
| 799 | bad.SetUncalibrated( MBadPixelsPix::kHiGainOverFlow );
|
|---|
| 800 | }
|
|---|
| 801 |
|
|---|
| 802 | FinalizeAbsTimes(histhi, pix, bad, fFirstHiGain, fLastHiGain);
|
|---|
| 803 | }
|
|---|
| 804 |
|
|---|
| 805 | if (fLoGain)
|
|---|
| 806 | for (Int_t i=0; i<fLoGainArray->GetSize(); i++)
|
|---|
| 807 | {
|
|---|
| 808 |
|
|---|
| 809 | MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)(*this)(i);
|
|---|
| 810 | MBadPixelsPix &bad = (*fBadPixels)[i];
|
|---|
| 811 |
|
|---|
| 812 | if (histlo.IsExcluded())
|
|---|
| 813 | continue;
|
|---|
| 814 |
|
|---|
| 815 | if (histlo.GetSaturated() > fNumLoGainSaturationLimit*histlo.GetHGausHist()->GetEntries())
|
|---|
| 816 | {
|
|---|
| 817 | *fLog << warn << "Saturated Lo Gain histogram in pixel: " << i << endl;
|
|---|
| 818 | bad.SetUncalibrated( MBadPixelsPix::kLoGainSaturation );
|
|---|
| 819 | histlo.CreateFourierSpectrum();
|
|---|
| 820 | continue;
|
|---|
| 821 | }
|
|---|
| 822 |
|
|---|
| 823 | Stat_t overflow = histlo.GetHGausHist()->GetBinContent(histlo.GetHGausHist()->GetNbinsX()+1);
|
|---|
| 824 | if (overflow > 0.1)
|
|---|
| 825 | {
|
|---|
| 826 | *fLog << warn << GetDescriptor()
|
|---|
| 827 | << ": Lo-Gain Histogram Overflow occurred " << overflow
|
|---|
| 828 | << " times in pixel: " << i << " (without saturation!) " << endl;
|
|---|
| 829 | bad.SetUncalibrated( MBadPixelsPix::kLoGainOverFlow );
|
|---|
| 830 | }
|
|---|
| 831 |
|
|---|
| 832 | overflow = histlo.GetHGausHist()->GetBinContent(0);
|
|---|
| 833 | if (overflow > 0.1)
|
|---|
| 834 | {
|
|---|
| 835 | *fLog << warn << GetDescriptor()
|
|---|
| 836 | << ": Lo-Gain Histogram Underflow occurred " << overflow
|
|---|
| 837 | << " times in pixel: " << i << " (without saturation!) " << endl;
|
|---|
| 838 | bad.SetUncalibrated( MBadPixelsPix::kLoGainOverFlow );
|
|---|
| 839 | }
|
|---|
| 840 |
|
|---|
| 841 | MCalibrationChargePix &pix = fIntensCam
|
|---|
| 842 | ? (MCalibrationChargePix&)(*fIntensCam)[i]
|
|---|
| 843 | : (MCalibrationChargePix&)(*fCam)[i];
|
|---|
| 844 |
|
|---|
| 845 | if (pix.IsHiGainSaturation())
|
|---|
| 846 | FinalizeAbsTimes(histlo, pix, bad, fFirstLoGain, fLastLoGain);
|
|---|
| 847 | }
|
|---|
| 848 |
|
|---|
| 849 | for (Int_t j=0; j<fAverageHiGainAreas->GetSize(); j++)
|
|---|
| 850 | {
|
|---|
| 851 |
|
|---|
| 852 | MHCalibrationChargePix &histhi = (MHCalibrationChargePix&)GetAverageHiGainArea(j);
|
|---|
| 853 | MCalibrationChargePix &pix = fIntensCam
|
|---|
| 854 | ? (MCalibrationChargePix&)fIntensCam->GetAverageArea(j)
|
|---|
| 855 | : (MCalibrationChargePix&)fCam->GetAverageArea(j);
|
|---|
| 856 |
|
|---|
| 857 | if (histhi.GetSaturated() > fNumHiGainSaturationLimit*histhi.GetHGausHist()->GetEntries())
|
|---|
| 858 | {
|
|---|
| 859 | pix.SetHiGainSaturation();
|
|---|
| 860 | histhi.CreateFourierSpectrum();
|
|---|
| 861 | continue;
|
|---|
| 862 | }
|
|---|
| 863 |
|
|---|
| 864 | MBadPixelsPix &bad = fIntensCam
|
|---|
| 865 | ? fIntensCam->GetAverageBadArea(j)
|
|---|
| 866 | : fCam->GetAverageBadArea(j);
|
|---|
| 867 |
|
|---|
| 868 | FinalizeAbsTimes(histhi, pix, bad, fFirstHiGain, fLastHiGain);
|
|---|
| 869 | }
|
|---|
| 870 |
|
|---|
| 871 | if (fLoGain)
|
|---|
| 872 | for (Int_t j=0; j<fAverageLoGainAreas->GetSize(); j++)
|
|---|
| 873 | {
|
|---|
| 874 |
|
|---|
| 875 | MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)GetAverageLoGainArea(j);
|
|---|
| 876 |
|
|---|
| 877 | if (histlo.GetSaturated() > fNumLoGainSaturationLimit*histlo.GetHGausHist()->GetEntries())
|
|---|
| 878 | {
|
|---|
| 879 | *fLog << warn << "Saturated Lo Gain histogram in area idx: " << j << endl;
|
|---|
| 880 | histlo.CreateFourierSpectrum();
|
|---|
| 881 | continue;
|
|---|
| 882 | }
|
|---|
| 883 |
|
|---|
| 884 | MCalibrationChargePix &pix = fIntensCam
|
|---|
| 885 | ? (MCalibrationChargePix&)fIntensCam->GetAverageArea(j)
|
|---|
| 886 | : (MCalibrationChargePix&)fCam->GetAverageArea(j) ;
|
|---|
| 887 |
|
|---|
| 888 | if (pix.IsHiGainSaturation())
|
|---|
| 889 | {
|
|---|
| 890 | MBadPixelsPix &bad = fIntensCam
|
|---|
| 891 | ? fIntensCam->GetAverageBadArea(j)
|
|---|
| 892 | : fCam->GetAverageBadArea(j);
|
|---|
| 893 | FinalizeAbsTimes(histlo, pix, bad, fFirstLoGain, fLastLoGain);
|
|---|
| 894 | }
|
|---|
| 895 |
|
|---|
| 896 | }
|
|---|
| 897 |
|
|---|
| 898 | for (Int_t j=0; j<fAverageHiGainSectors->GetSize(); j++)
|
|---|
| 899 | {
|
|---|
| 900 |
|
|---|
| 901 | MHCalibrationChargePix &histhi = (MHCalibrationChargePix&)GetAverageHiGainSector(j);
|
|---|
| 902 | MCalibrationChargePix &pix = fIntensCam
|
|---|
| 903 | ? (MCalibrationChargePix&)fIntensCam->GetAverageSector(j)
|
|---|
| 904 | : (MCalibrationChargePix&)fCam->GetAverageSector(j);
|
|---|
| 905 |
|
|---|
| 906 | if (histhi.GetSaturated() > fNumHiGainSaturationLimit*histhi.GetHGausHist()->GetEntries())
|
|---|
| 907 | {
|
|---|
| 908 | pix.SetHiGainSaturation();
|
|---|
| 909 | histhi.CreateFourierSpectrum();
|
|---|
| 910 | continue;
|
|---|
| 911 | }
|
|---|
| 912 |
|
|---|
| 913 | MBadPixelsPix &bad = fIntensCam
|
|---|
| 914 | ? fIntensCam->GetAverageBadSector(j)
|
|---|
| 915 | : fCam->GetAverageBadSector(j);
|
|---|
| 916 |
|
|---|
| 917 | FinalizeAbsTimes(histhi, pix, bad, fFirstHiGain, fLastHiGain);
|
|---|
| 918 | }
|
|---|
| 919 |
|
|---|
| 920 | if (fLoGain)
|
|---|
| 921 | for (Int_t j=0; j<fAverageLoGainSectors->GetSize(); j++)
|
|---|
| 922 | {
|
|---|
| 923 |
|
|---|
| 924 | MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)GetAverageLoGainSector(j);
|
|---|
| 925 | MBadPixelsPix &bad = fIntensCam
|
|---|
| 926 | ? fIntensCam->GetAverageBadSector(j)
|
|---|
| 927 | : fCam->GetAverageBadSector(j);
|
|---|
| 928 |
|
|---|
| 929 | if (histlo.GetSaturated() > fNumLoGainSaturationLimit*histlo.GetHGausHist()->GetEntries())
|
|---|
| 930 | {
|
|---|
| 931 | *fLog << warn << "Saturated Lo Gain histogram in sector: " << j << endl;
|
|---|
| 932 | bad.SetUncalibrated( MBadPixelsPix::kLoGainSaturation );
|
|---|
| 933 | histlo.CreateFourierSpectrum();
|
|---|
| 934 | continue;
|
|---|
| 935 | }
|
|---|
| 936 |
|
|---|
| 937 | MCalibrationChargePix &pix = fIntensCam
|
|---|
| 938 | ? (MCalibrationChargePix&)fIntensCam->GetAverageSector(j)
|
|---|
| 939 | : (MCalibrationChargePix&)fCam->GetAverageSector(j);
|
|---|
| 940 |
|
|---|
| 941 | if (pix.IsHiGainSaturation())
|
|---|
| 942 | FinalizeAbsTimes(histlo, pix, bad, fFirstLoGain, fLastLoGain);
|
|---|
| 943 | }
|
|---|
| 944 |
|
|---|
| 945 | //
|
|---|
| 946 | // Perform the fitting for the High Gain (done in MHCalibrationCam)
|
|---|
| 947 | //
|
|---|
| 948 | FitHiGainArrays(fIntensCam ? (MCalibrationCam&)(*fIntensCam->GetCam()) : (MCalibrationCam&)(*fCam),
|
|---|
| 949 | *fBadPixels,
|
|---|
| 950 | MBadPixelsPix::kHiGainNotFitted,
|
|---|
| 951 | MBadPixelsPix::kHiGainOscillating);
|
|---|
| 952 |
|
|---|
| 953 | //
|
|---|
| 954 | // Perform the fitting for the Low Gain (done in MHCalibrationCam)
|
|---|
| 955 | //
|
|---|
| 956 | if (fLoGain)
|
|---|
| 957 | FitLoGainArrays(fIntensCam ? (MCalibrationCam&)(*fIntensCam->GetCam()) : (MCalibrationCam&)(*fCam),
|
|---|
| 958 | *fBadPixels,
|
|---|
| 959 | MBadPixelsPix::kLoGainNotFitted,
|
|---|
| 960 | MBadPixelsPix::kLoGainOscillating);
|
|---|
| 961 |
|
|---|
| 962 | return kTRUE;
|
|---|
| 963 | }
|
|---|
| 964 |
|
|---|
| 965 | // --------------------------------------------------------------------------------
|
|---|
| 966 | //
|
|---|
| 967 | // Fill the absolute time results into MCalibrationChargePix
|
|---|
| 968 | //
|
|---|
| 969 | // Check absolute time validity:
|
|---|
| 970 | // - Mean arrival time is at least fTimeLowerLimit slices from the lower edge
|
|---|
| 971 | // - Mean arrival time is at least fUpperLimit slices from the upper edge
|
|---|
| 972 | //
|
|---|
| 973 | void MHCalibrationChargeCam::FinalizeAbsTimes(MHCalibrationChargePix &hist, MCalibrationChargePix &pix, MBadPixelsPix &bad,
|
|---|
| 974 | Byte_t first, Byte_t last)
|
|---|
| 975 | {
|
|---|
| 976 |
|
|---|
| 977 | const Float_t mean = hist.GetAbsTimeMean();
|
|---|
| 978 | const Float_t rms = hist.GetAbsTimeRms();
|
|---|
| 979 |
|
|---|
| 980 | pix.SetAbsTimeMean ( mean );
|
|---|
| 981 | pix.SetAbsTimeRms ( rms );
|
|---|
| 982 |
|
|---|
| 983 | const Float_t lowerlimit = (Float_t)first + fTimeLowerLimit;
|
|---|
| 984 | const Float_t upperlimit = (Float_t)last + fTimeUpperLimit;
|
|---|
| 985 |
|
|---|
| 986 | if ( mean < lowerlimit)
|
|---|
| 987 | {
|
|---|
| 988 | *fLog << warn << GetDescriptor()
|
|---|
| 989 | << Form("%s%3.1f%s%2.1f%s%4i",": Mean ArrivalTime: ",mean," smaller than ",fTimeLowerLimit,
|
|---|
| 990 | " FADC slices from lower edge in pixel ",hist.GetPixId()) << endl;
|
|---|
| 991 | bad.SetUncalibrated( MBadPixelsPix::kMeanTimeInFirstBin );
|
|---|
| 992 | }
|
|---|
| 993 |
|
|---|
| 994 | if ( mean > upperlimit )
|
|---|
| 995 | {
|
|---|
| 996 | *fLog << warn << GetDescriptor()
|
|---|
| 997 | << Form("%s%3.1f%s%2.1f%s%4i",": Mean ArrivalTime: ",mean," greater than ",fTimeUpperLimit,
|
|---|
| 998 | " FADC slices from upper edge in pixel ",hist.GetPixId()) << endl;
|
|---|
| 999 | bad.SetUncalibrated( MBadPixelsPix::kMeanTimeInLast2Bins );
|
|---|
| 1000 | }
|
|---|
| 1001 | }
|
|---|
| 1002 |
|
|---|
| 1003 | // --------------------------------------------------------------------------
|
|---|
| 1004 | //
|
|---|
| 1005 | // Sets all pixels to MBadPixelsPix::kUnsuitableRun, if following flags are set:
|
|---|
| 1006 | // - MBadPixelsPix::kLoGainSaturation
|
|---|
| 1007 | //
|
|---|
| 1008 | // Sets all pixels to MBadPixelsPix::kUnreliableRun, if following flags are set:
|
|---|
| 1009 | // - if MBadPixelsPix::kHiGainNotFitted and !MCalibrationPix::IsHiGainSaturation()
|
|---|
| 1010 | // - if MBadPixelsPix::kHiGainOscillating and !MCalibrationPix::IsHiGainSaturation()
|
|---|
| 1011 | // - if MBadPixelsPix::kLoGainNotFitted and MCalibrationPix::IsLoGainSaturation()
|
|---|
| 1012 | // - if MBadPixelsPix::kLoGainOscillating and MCalibrationPix::IsLoGainSaturation()
|
|---|
| 1013 | //
|
|---|
| 1014 | void MHCalibrationChargeCam::FinalizeBadPixels()
|
|---|
| 1015 | {
|
|---|
| 1016 |
|
|---|
| 1017 | for (Int_t i=0; i<fBadPixels->GetSize(); i++)
|
|---|
| 1018 | {
|
|---|
| 1019 |
|
|---|
| 1020 | MBadPixelsPix &bad = (*fBadPixels)[i];
|
|---|
| 1021 | MCalibrationPix &pix = fIntensCam ? (*fIntensCam)[i] : (*fCam)[i];
|
|---|
| 1022 |
|
|---|
| 1023 | if (bad.IsUncalibrated( MBadPixelsPix::kHiGainNotFitted ))
|
|---|
| 1024 | if (!pix.IsHiGainSaturation())
|
|---|
| 1025 | bad.SetUnsuitable( MBadPixelsPix::kUnreliableRun );
|
|---|
| 1026 |
|
|---|
| 1027 | if (bad.IsUncalibrated( MBadPixelsPix::kHiGainOscillating ))
|
|---|
| 1028 | bad.SetUnsuitable( MBadPixelsPix::kUnreliableRun );
|
|---|
| 1029 |
|
|---|
| 1030 | if (bad.IsUncalibrated( MBadPixelsPix::kLoGainNotFitted ))
|
|---|
| 1031 | if (pix.IsHiGainSaturation())
|
|---|
| 1032 | bad.SetUnsuitable( MBadPixelsPix::kUnreliableRun );
|
|---|
| 1033 |
|
|---|
| 1034 | if (bad.IsUncalibrated( MBadPixelsPix::kLoGainOscillating ))
|
|---|
| 1035 | if (pix.IsHiGainSaturation())
|
|---|
| 1036 | bad.SetUnsuitable( MBadPixelsPix::kUnreliableRun );
|
|---|
| 1037 |
|
|---|
| 1038 | if (bad.IsUncalibrated( MBadPixelsPix::kLoGainSaturation ))
|
|---|
| 1039 | bad.SetUnsuitable( MBadPixelsPix::kUnsuitableRun );
|
|---|
| 1040 | }
|
|---|
| 1041 | }
|
|---|
| 1042 |
|
|---|
| 1043 | // --------------------------------------------------------------------------
|
|---|
| 1044 | //
|
|---|
| 1045 | // Dummy, needed by MCamEvent
|
|---|
| 1046 | //
|
|---|
| 1047 | Bool_t MHCalibrationChargeCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
|
|---|
| 1048 | {
|
|---|
| 1049 | return kTRUE;
|
|---|
| 1050 | }
|
|---|
| 1051 |
|
|---|
| 1052 | // --------------------------------------------------------------------------
|
|---|
| 1053 | //
|
|---|
| 1054 | // Calls MHCalibrationPix::DrawClone() for pixel idx
|
|---|
| 1055 | //
|
|---|
| 1056 | void MHCalibrationChargeCam::DrawPixelContent(Int_t idx) const
|
|---|
| 1057 | {
|
|---|
| 1058 | (*this)[idx].DrawClone();
|
|---|
| 1059 | }
|
|---|
| 1060 |
|
|---|
| 1061 |
|
|---|
| 1062 | // -----------------------------------------------------------------------------
|
|---|
| 1063 | //
|
|---|
| 1064 | // Default draw:
|
|---|
| 1065 | //
|
|---|
| 1066 | // Displays the averaged areas, both High Gain and Low Gain
|
|---|
| 1067 | //
|
|---|
| 1068 | // Calls the Draw of the fAverageHiGainAreas and fAverageLoGainAreas objects with options
|
|---|
| 1069 | //
|
|---|
| 1070 | void MHCalibrationChargeCam::Draw(const Option_t *opt)
|
|---|
| 1071 | {
|
|---|
| 1072 |
|
|---|
| 1073 | const Int_t nareas = fAverageHiGainAreas->GetEntries();
|
|---|
| 1074 | if (nareas == 0)
|
|---|
| 1075 | return;
|
|---|
| 1076 |
|
|---|
| 1077 | TString option(opt);
|
|---|
| 1078 | option.ToLower();
|
|---|
| 1079 |
|
|---|
| 1080 | if (!option.Contains("datacheck"))
|
|---|
| 1081 | {
|
|---|
| 1082 | MHCalibrationCam::Draw(opt);
|
|---|
| 1083 | return;
|
|---|
| 1084 | }
|
|---|
| 1085 |
|
|---|
| 1086 | //
|
|---|
| 1087 | // From here on , the datacheck - Draw
|
|---|
| 1088 | //
|
|---|
| 1089 | TVirtualPad *pad = gPad ? gPad : MH::MakeDefCanvas(this);
|
|---|
| 1090 | pad->SetBorderMode(0);
|
|---|
| 1091 | pad->Divide(1,nareas);
|
|---|
| 1092 |
|
|---|
| 1093 | //
|
|---|
| 1094 | // Loop over inner and outer pixels
|
|---|
| 1095 | //
|
|---|
| 1096 | for (Int_t i=0; i<nareas;i++)
|
|---|
| 1097 | {
|
|---|
| 1098 |
|
|---|
| 1099 | pad->cd(i+1);
|
|---|
| 1100 |
|
|---|
| 1101 | MHCalibrationChargePix &hipix = (MHCalibrationChargePix&)GetAverageHiGainArea(i);
|
|---|
| 1102 | //
|
|---|
| 1103 | // Ask for Hi-Gain saturation
|
|---|
| 1104 | //
|
|---|
| 1105 | if (hipix.GetSaturated() > fNumHiGainSaturationLimit*hipix.GetHGausHist()->GetEntries() && fLoGain)
|
|---|
| 1106 | {
|
|---|
| 1107 | MHCalibrationChargePix &lopix = (MHCalibrationChargePix&)GetAverageLoGainArea(i);
|
|---|
| 1108 | DrawDataCheckPixel(lopix,i ? gkLoGainOuterRefLines : gkLoGainInnerRefLines);
|
|---|
| 1109 | }
|
|---|
| 1110 | else
|
|---|
| 1111 | DrawDataCheckPixel(hipix,i ? gkHiGainOuterRefLines : gkHiGainInnerRefLines);
|
|---|
| 1112 | }
|
|---|
| 1113 | }
|
|---|
| 1114 |
|
|---|
| 1115 |
|
|---|
| 1116 | // --------------------------------------------------------------------------
|
|---|
| 1117 | //
|
|---|
| 1118 | // Our own clone function is necessary since root 3.01/06 or Mars 0.4
|
|---|
| 1119 | // I don't know the reason.
|
|---|
| 1120 | //
|
|---|
| 1121 | // Creates new MHCalibrationCam
|
|---|
| 1122 | //
|
|---|
| 1123 | TObject *MHCalibrationChargeCam::Clone(const char *name) const
|
|---|
| 1124 | {
|
|---|
| 1125 |
|
|---|
| 1126 | const Int_t navhi = fAverageHiGainAreas->GetEntries();
|
|---|
| 1127 | const Int_t navlo = fAverageLoGainAreas->GetEntries();
|
|---|
| 1128 | const Int_t nsehi = fAverageHiGainSectors->GetEntries();
|
|---|
| 1129 | const Int_t nselo = fAverageLoGainSectors->GetEntries();
|
|---|
| 1130 |
|
|---|
| 1131 | //
|
|---|
| 1132 | // FIXME, this might be done faster and more elegant, by direct copy.
|
|---|
| 1133 | //
|
|---|
| 1134 | MHCalibrationChargeCam *cam = new MHCalibrationChargeCam();
|
|---|
| 1135 |
|
|---|
| 1136 | cam->fAverageHiGainAreas->Expand(navhi);
|
|---|
| 1137 | cam->fAverageLoGainAreas->Expand(navlo);
|
|---|
| 1138 | cam->fAverageHiGainSectors->Expand(nsehi);
|
|---|
| 1139 | cam->fAverageLoGainSectors->Expand(nselo);
|
|---|
| 1140 |
|
|---|
| 1141 | cam->fAverageHiGainAreas->Expand(navhi);
|
|---|
| 1142 | cam->fAverageLoGainAreas->Expand(navlo);
|
|---|
| 1143 | cam->fAverageHiGainSectors->Expand(nsehi);
|
|---|
| 1144 | cam->fAverageLoGainSectors->Expand(nselo);
|
|---|
| 1145 |
|
|---|
| 1146 | for (int i=0; i<navhi; i++)
|
|---|
| 1147 | (*cam->fAverageHiGainAreas) [i] = (*fAverageHiGainAreas) [i]->Clone();
|
|---|
| 1148 | for (int i=0; i<navlo; i++)
|
|---|
| 1149 | (*cam->fAverageLoGainAreas) [i] = (*fAverageLoGainAreas) [i]->Clone();
|
|---|
| 1150 | for (int i=0; i<nsehi; i++)
|
|---|
| 1151 | (*cam->fAverageHiGainSectors)[i] = (*fAverageHiGainSectors)[i]->Clone();
|
|---|
| 1152 | for (int i=0; i<nselo; i++)
|
|---|
| 1153 | (*cam->fAverageLoGainSectors)[i] = (*fAverageLoGainSectors)[i]->Clone();
|
|---|
| 1154 |
|
|---|
| 1155 | cam->fAverageAreaNum = fAverageAreaNum;
|
|---|
| 1156 | cam->fAverageAreaSat = fAverageAreaSat;
|
|---|
| 1157 | cam->fAverageAreaSigma = fAverageAreaSigma;
|
|---|
| 1158 | cam->fAverageAreaSigmaVar = fAverageAreaSigmaVar;
|
|---|
| 1159 | cam->fAverageAreaRelSigma = fAverageAreaRelSigma;
|
|---|
| 1160 | cam->fAverageAreaRelSigmaVar = fAverageAreaRelSigmaVar;
|
|---|
| 1161 | cam->fAverageSectorNum = fAverageSectorNum;
|
|---|
| 1162 | cam->fRunNumbers = fRunNumbers;
|
|---|
| 1163 |
|
|---|
| 1164 | cam->fColor = fColor;
|
|---|
| 1165 | cam->fPulserFrequency = fPulserFrequency;
|
|---|
| 1166 |
|
|---|
| 1167 | return cam;
|
|---|
| 1168 |
|
|---|
| 1169 | }
|
|---|
| 1170 |
|
|---|
| 1171 | void MHCalibrationChargeCam::DrawDataCheckPixel(MHCalibrationChargePix &pix, const Float_t refline[])
|
|---|
| 1172 | {
|
|---|
| 1173 |
|
|---|
| 1174 | TVirtualPad *newpad = gPad;
|
|---|
| 1175 | newpad->Divide(1,2);
|
|---|
| 1176 | newpad->cd(1);
|
|---|
| 1177 |
|
|---|
| 1178 | gPad->SetTicks();
|
|---|
| 1179 | if (!pix.IsEmpty() && !pix.IsOnlyOverflow() && !pix.IsOnlyUnderflow())
|
|---|
| 1180 | gPad->SetLogy();
|
|---|
| 1181 |
|
|---|
| 1182 | TH1F *hist = pix.GetHGausHist();
|
|---|
| 1183 |
|
|---|
| 1184 | TH2D *null = new TH2D("Null",hist->GetTitle(),100,pix.GetFirst() > -1. ? 0. : 100.,pix.GetLast()/2.,
|
|---|
| 1185 | 100,0.,hist->GetEntries()/10.);
|
|---|
| 1186 |
|
|---|
| 1187 | null->SetDirectory(NULL);
|
|---|
| 1188 | null->SetBit(kCanDelete);
|
|---|
| 1189 | null->SetStats(kFALSE);
|
|---|
| 1190 | //
|
|---|
| 1191 | // set the labels bigger
|
|---|
| 1192 | //
|
|---|
| 1193 | TAxis *xaxe = null->GetXaxis();
|
|---|
| 1194 | TAxis *yaxe = null->GetYaxis();
|
|---|
| 1195 | xaxe->CenterTitle();
|
|---|
| 1196 | yaxe->CenterTitle();
|
|---|
| 1197 | xaxe->SetTitleSize(0.07);
|
|---|
| 1198 | yaxe->SetTitleSize(0.07);
|
|---|
| 1199 | xaxe->SetTitleOffset(0.7);
|
|---|
| 1200 | yaxe->SetTitleOffset(0.55);
|
|---|
| 1201 | xaxe->SetLabelSize(0.06);
|
|---|
| 1202 | yaxe->SetLabelSize(0.06);
|
|---|
| 1203 |
|
|---|
| 1204 | xaxe->SetTitle(hist->GetXaxis()->GetTitle());
|
|---|
| 1205 | yaxe->SetTitle(hist->GetYaxis()->GetTitle());
|
|---|
| 1206 | null->Draw();
|
|---|
| 1207 | hist->Draw("same");
|
|---|
| 1208 |
|
|---|
| 1209 | gStyle->SetOptFit();
|
|---|
| 1210 |
|
|---|
| 1211 | if (pix.GetFGausFit())
|
|---|
| 1212 | {
|
|---|
| 1213 | switch ( fColor )
|
|---|
| 1214 | {
|
|---|
| 1215 | case MCalibrationCam::kGREEN:
|
|---|
| 1216 | pix.GetFGausFit()->SetLineColor(kGreen);
|
|---|
| 1217 | break;
|
|---|
| 1218 | case MCalibrationCam::kBLUE:
|
|---|
| 1219 | pix.GetFGausFit()->SetLineColor(kBlue);
|
|---|
| 1220 | break;
|
|---|
| 1221 | case MCalibrationCam::kUV:
|
|---|
| 1222 | pix.GetFGausFit()->SetLineColor(106);
|
|---|
| 1223 | break;
|
|---|
| 1224 | case MCalibrationCam::kCT1:
|
|---|
| 1225 | pix.GetFGausFit()->SetLineColor(006);
|
|---|
| 1226 | break;
|
|---|
| 1227 | default:
|
|---|
| 1228 | pix.GetFGausFit()->SetLineColor(kRed);
|
|---|
| 1229 | }
|
|---|
| 1230 | pix.GetFGausFit()->Draw("same");
|
|---|
| 1231 | }
|
|---|
| 1232 |
|
|---|
| 1233 | DisplayRefLines(null,refline);
|
|---|
| 1234 |
|
|---|
| 1235 | newpad->cd(2);
|
|---|
| 1236 | gPad->SetTicks();
|
|---|
| 1237 |
|
|---|
| 1238 | pix.DrawEvents();
|
|---|
| 1239 | return;
|
|---|
| 1240 |
|
|---|
| 1241 | }
|
|---|
| 1242 |
|
|---|
| 1243 |
|
|---|
| 1244 | void MHCalibrationChargeCam::DisplayRefLines(const TH2D *hist, const Float_t refline[]) const
|
|---|
| 1245 | {
|
|---|
| 1246 |
|
|---|
| 1247 | TLine *green1 = new TLine(refline[0],0.,refline[0],hist->GetYaxis()->GetXmax());
|
|---|
| 1248 | green1->SetBit(kCanDelete);
|
|---|
| 1249 | green1->SetLineColor(kGreen);
|
|---|
| 1250 | green1->SetLineStyle(2);
|
|---|
| 1251 | green1->SetLineWidth(3);
|
|---|
| 1252 | green1->Draw();
|
|---|
| 1253 |
|
|---|
| 1254 | TLine *green5 = new TLine(refline[6],0.,refline[6],hist->GetYaxis()->GetXmax());
|
|---|
| 1255 | green5->SetBit(kCanDelete);
|
|---|
| 1256 | green5->SetLineColor(8);
|
|---|
| 1257 | green5->SetLineStyle(2);
|
|---|
| 1258 | green5->SetLineWidth(3);
|
|---|
| 1259 | green5->Draw();
|
|---|
| 1260 |
|
|---|
| 1261 | TLine *blue1 = new TLine(refline[1],0.,refline[1],hist->GetYaxis()->GetXmax());
|
|---|
| 1262 | blue1->SetBit(kCanDelete);
|
|---|
| 1263 | blue1->SetLineColor(227);
|
|---|
| 1264 | blue1->SetLineStyle(2);
|
|---|
| 1265 | blue1->SetLineWidth(3);
|
|---|
| 1266 | blue1->Draw();
|
|---|
| 1267 |
|
|---|
| 1268 | TLine *blue5 = new TLine(refline[2],0.,refline[2],hist->GetYaxis()->GetXmax());
|
|---|
| 1269 | blue5->SetBit(kCanDelete);
|
|---|
| 1270 | blue5->SetLineColor(68);
|
|---|
| 1271 | blue5->SetLineStyle(2);
|
|---|
| 1272 | blue5->SetLineWidth(3);
|
|---|
| 1273 | blue5->Draw();
|
|---|
| 1274 |
|
|---|
| 1275 | TLine *blue10 = new TLine(refline[3],0.,refline[3],hist->GetYaxis()->GetXmax());
|
|---|
| 1276 | blue10->SetBit(kCanDelete);
|
|---|
| 1277 | blue10->SetLineColor(4);
|
|---|
| 1278 | blue10->SetLineStyle(2);
|
|---|
| 1279 | blue10->SetLineWidth(3);
|
|---|
| 1280 | blue10->Draw();
|
|---|
| 1281 |
|
|---|
| 1282 | TLine *uv10 = new TLine(refline[4],0.,refline[4],hist->GetYaxis()->GetXmax());
|
|---|
| 1283 | uv10->SetBit(kCanDelete);
|
|---|
| 1284 | uv10->SetLineColor(106);
|
|---|
| 1285 | uv10->SetLineStyle(2);
|
|---|
| 1286 | uv10->SetLineWidth(3);
|
|---|
| 1287 | uv10->Draw();
|
|---|
| 1288 |
|
|---|
| 1289 | TLine *ct1 = new TLine(refline[5],0.,refline[5],hist->GetYaxis()->GetXmax());
|
|---|
| 1290 | ct1->SetBit(kCanDelete);
|
|---|
| 1291 | ct1->SetLineColor(6);
|
|---|
| 1292 | ct1->SetLineStyle(2);
|
|---|
| 1293 | ct1->SetLineWidth(3);
|
|---|
| 1294 | ct1->Draw();
|
|---|
| 1295 |
|
|---|
| 1296 | TLegend *leg = new TLegend(0.7,0.35,0.9,0.99);
|
|---|
| 1297 | leg->SetBit(kCanDelete);
|
|---|
| 1298 | leg->AddEntry(green1,"1 Led GREEN","l");
|
|---|
| 1299 | leg->AddEntry(green5,"5 Leds GREEN","l");
|
|---|
| 1300 | leg->AddEntry(blue1,"1 Led BLUE","l");
|
|---|
| 1301 | leg->AddEntry(blue5,"5 Leds BLUE","l");
|
|---|
| 1302 | leg->AddEntry(blue10,"10 Leds BLUE","l");
|
|---|
| 1303 | leg->AddEntry(uv10,"10 Leds UV","l");
|
|---|
| 1304 | leg->AddEntry(ct1,"CT1-Pulser","l");
|
|---|
| 1305 |
|
|---|
| 1306 | leg->Draw();
|
|---|
| 1307 | }
|
|---|