| 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): Thomas Bretz, 1/2004 <mailto:tbretz@astro.uni-wuerzburg.de>
|
|---|
| 19 | ! Markus Gaug, 02/2004 <mailto:markus@ifae.es>
|
|---|
| 20 | !
|
|---|
| 21 | ! Copyright: MAGIC Software Development, 2000-2004
|
|---|
| 22 | !
|
|---|
| 23 | !
|
|---|
| 24 | \* ======================================================================== */
|
|---|
| 25 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 26 | //
|
|---|
| 27 | // MJCalibration
|
|---|
| 28 | //
|
|---|
| 29 | // Do one calibration loop over serious of runs with the same pulser
|
|---|
| 30 | // colour and the same intensity. The following containers (rectangular) and
|
|---|
| 31 | // tasks (ellipses) are called to produce an MCalibrationChargeCam and to
|
|---|
| 32 | // update the MCalibrationQECam: (MCalibrate is not called from this class)
|
|---|
| 33 | //
|
|---|
| 34 | //Begin_Html
|
|---|
| 35 | /*
|
|---|
| 36 | <img src="images/CalibClasses.gif">
|
|---|
| 37 | */
|
|---|
| 38 | //End_Html
|
|---|
| 39 | //
|
|---|
| 40 | // Different signal extractors can be set with the command SetExtractor()
|
|---|
| 41 | // Only extractors deriving from MExtractor can be set, default is MExtractSlidingWindow
|
|---|
| 42 | //
|
|---|
| 43 | // Different arrival time extractors can be set with the command SetTimeExtractor()
|
|---|
| 44 | // Only extractors deriving from MExtractTime can be set, default is MExtractTimeSpline
|
|---|
| 45 | //
|
|---|
| 46 | // At the end of the eventloop, plots and results are displayed, depending on
|
|---|
| 47 | // the flags set (see DisplayResult())
|
|---|
| 48 | //
|
|---|
| 49 | // If the flag SetFullDisplay() is set, all MHCameras will be displayed.
|
|---|
| 50 | // if the flag SetDataCheckDisplay() is set, only the most important ones are displayed
|
|---|
| 51 | // Otherwise, (default: SetNormalDisplay()), a good selection of plots is given
|
|---|
| 52 | //
|
|---|
| 53 | // If the flag SetDataCheck() is set, the calibration is used as in the data check at
|
|---|
| 54 | // La Palma, which mean especially running on raw data files.
|
|---|
| 55 | //
|
|---|
| 56 | // The absolute light calibration devices Blind Pixel and PIN Diode can be switched on
|
|---|
| 57 | // and off with the commands:
|
|---|
| 58 | //
|
|---|
| 59 | // - SetUseBlindPixel(Bool_t )
|
|---|
| 60 | // - SetUsePINDiode(Bool_t )
|
|---|
| 61 | //
|
|---|
| 62 | // See also: MHCalibrationChargePix, MHCalibrationChargeCam, MHGausEvents
|
|---|
| 63 | // MHCalibrationChargeBlindPix, MHCalibrationChargePINDiode
|
|---|
| 64 | // MCalibrationChargePix, MCalibrationChargeCam, MCalibrationChargeCalc
|
|---|
| 65 | // MCalibrationBlindPix, MCalibrationChargePINDiode,
|
|---|
| 66 | // MCalibrationQECam, MBadPixelsPix, MBadPixelsCam
|
|---|
| 67 | //
|
|---|
| 68 | // If the flag RelTimeCalibration() is set, a calibration of the relative arrival
|
|---|
| 69 | // times is also performed. The following containers (rectangular) and
|
|---|
| 70 | // tasks (ellipses) are called to produce an MCalibrationRelTimeCam used by
|
|---|
| 71 | // MCalibrateTime to correct timing offset between pixels: (MCalibrateTime is not
|
|---|
| 72 | // called from this class)
|
|---|
| 73 | //
|
|---|
| 74 | //Begin_Html
|
|---|
| 75 | /*
|
|---|
| 76 | <img src="images/RelTimeClasses.gif">
|
|---|
| 77 | */
|
|---|
| 78 | //End_Html
|
|---|
| 79 | //
|
|---|
| 80 | // Different arrival time extractors can be set directly with the command SetTimeExtractor(MExtractor *)
|
|---|
| 81 | //
|
|---|
| 82 | // See also: MHCalibrationRelTimePix, MHCalibrationRelTimeCam, MHGausEvents
|
|---|
| 83 | // MCalibrationRelTimePix, MCalibrationRelTimeCam
|
|---|
| 84 | // MBadPixelsPix, MBadPixelsCam
|
|---|
| 85 | //
|
|---|
| 86 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 87 | #include "MJCalibration.h"
|
|---|
| 88 |
|
|---|
| 89 | #include <TFile.h>
|
|---|
| 90 | #include <TF1.h>
|
|---|
| 91 | #include <TStyle.h>
|
|---|
| 92 | #include <TCanvas.h>
|
|---|
| 93 | #include <TSystem.h>
|
|---|
| 94 | #include <TLine.h>
|
|---|
| 95 | #include <TLatex.h>
|
|---|
| 96 | #include <TLegend.h>
|
|---|
| 97 | #include <TRegexp.h>
|
|---|
| 98 | #include <TPaveText.h>
|
|---|
| 99 | #include <TPaveStats.h>
|
|---|
| 100 |
|
|---|
| 101 | #include "MLog.h"
|
|---|
| 102 | #include "MLogManip.h"
|
|---|
| 103 |
|
|---|
| 104 | #include "MRunIter.h"
|
|---|
| 105 | #include "MSequence.h"
|
|---|
| 106 | #include "MParList.h"
|
|---|
| 107 | #include "MTaskList.h"
|
|---|
| 108 | #include "MEvtLoop.h"
|
|---|
| 109 |
|
|---|
| 110 | #include "MHCamera.h"
|
|---|
| 111 | #include "MGeomCam.h"
|
|---|
| 112 |
|
|---|
| 113 | #include "MPedestalCam.h"
|
|---|
| 114 | #include "MCalibColorSteer.h"
|
|---|
| 115 |
|
|---|
| 116 | #include "MCalibrationIntensityChargeCam.h"
|
|---|
| 117 | #include "MCalibrationIntensityBlindCam.h"
|
|---|
| 118 | #include "MCalibrationIntensityRelTimeCam.h"
|
|---|
| 119 | #include "MCalibrationIntensityQECam.h"
|
|---|
| 120 |
|
|---|
| 121 | #include "MCalibrationCam.h"
|
|---|
| 122 | #include "MCalibrationQECam.h"
|
|---|
| 123 | #include "MCalibrationQEPix.h"
|
|---|
| 124 | #include "MCalibrationChargeCam.h"
|
|---|
| 125 | #include "MCalibrationChargePix.h"
|
|---|
| 126 | #include "MCalibrationChargePINDiode.h"
|
|---|
| 127 | #include "MCalibrationBlindPix.h"
|
|---|
| 128 | #include "MCalibrationBlindCam.h"
|
|---|
| 129 | #include "MCalibrationBlindCamOneOldStyle.h"
|
|---|
| 130 | #include "MCalibrationBlindCamTwoNewStyle.h"
|
|---|
| 131 | #include "MCalibrationChargeCalc.h"
|
|---|
| 132 | #include "MCalibColorSet.h"
|
|---|
| 133 |
|
|---|
| 134 | #include "MHGausEvents.h"
|
|---|
| 135 | #include "MHCalibrationCam.h"
|
|---|
| 136 | #include "MHCalibrationChargeCam.h"
|
|---|
| 137 | #include "MHCalibrationChargeBlindCam.h"
|
|---|
| 138 | #include "MHCalibrationChargePINDiode.h"
|
|---|
| 139 | #include "MHCalibrationRelTimeCam.h"
|
|---|
| 140 | #include "MCalibrationRelTimeCam.h"
|
|---|
| 141 | #include "MCalibrationRelTimeCalc.h"
|
|---|
| 142 |
|
|---|
| 143 | #include "MReadMarsFile.h"
|
|---|
| 144 | #include "MRawFileRead.h"
|
|---|
| 145 | #include "MGeomApply.h"
|
|---|
| 146 | #include "MTaskEnv.h"
|
|---|
| 147 | #include "MBadPixelsMerge.h"
|
|---|
| 148 | #include "MBadPixelsCam.h"
|
|---|
| 149 | #include "MExtractTime.h"
|
|---|
| 150 | #include "MExtractor.h"
|
|---|
| 151 | #include "MExtractPINDiode.h"
|
|---|
| 152 | #include "MExtractBlindPixel.h"
|
|---|
| 153 | #include "MExtractSlidingWindow.h"
|
|---|
| 154 | #include "MExtractTimeFastSpline.h"
|
|---|
| 155 | #include "MFCosmics.h"
|
|---|
| 156 | #include "MContinue.h"
|
|---|
| 157 | #include "MFillH.h"
|
|---|
| 158 |
|
|---|
| 159 | #include "MArrivalTimeCam.h"
|
|---|
| 160 |
|
|---|
| 161 | #include "MStatusDisplay.h"
|
|---|
| 162 |
|
|---|
| 163 | ClassImp(MJCalibration);
|
|---|
| 164 |
|
|---|
| 165 | using namespace std;
|
|---|
| 166 |
|
|---|
| 167 | const Int_t MJCalibration::gkIFAEBoxInaugurationRun = 20113;
|
|---|
| 168 | const Int_t MJCalibration::gkSecondBlindPixelInstallation = 31693;
|
|---|
| 169 | const Int_t MJCalibration::gkSpecialPixelsContInstallation = 34057;
|
|---|
| 170 | const Int_t MJCalibration::gkThirdBlindPixelInstallation = 99999;
|
|---|
| 171 |
|
|---|
| 172 | const Double_t MJCalibration::fgConvFADC2PheMin = 0.;
|
|---|
| 173 | const Double_t MJCalibration::fgConvFADC2PheMax = 1.5;
|
|---|
| 174 | const Double_t MJCalibration::fgConvFADC2PhotMin = 0.;
|
|---|
| 175 | const Double_t MJCalibration::fgConvFADC2PhotMax = 10.;
|
|---|
| 176 | const Double_t MJCalibration::fgQEMin = 0.;
|
|---|
| 177 | const Double_t MJCalibration::fgQEMax = 0.3;
|
|---|
| 178 | const Double_t MJCalibration::fgArrivalTimeMin = 1.;
|
|---|
| 179 | const Double_t MJCalibration::fgArrivalTimeMax = 10.;
|
|---|
| 180 |
|
|---|
| 181 | const Float_t MJCalibration::fgRefConvFADC2PheInner = 0.14;
|
|---|
| 182 | const Float_t MJCalibration::fgRefConvFADC2PheOuter = 0.4;
|
|---|
| 183 | const Float_t MJCalibration::fgRefConvFADC2PhotInner = 0.8;
|
|---|
| 184 | const Float_t MJCalibration::fgRefConvFADC2PhotOuter = 3.8;
|
|---|
| 185 | const Float_t MJCalibration::fgRefQEInner = 0.18;
|
|---|
| 186 | const Float_t MJCalibration::fgRefQEOuter = 0.12;
|
|---|
| 187 | const Float_t MJCalibration::fgRefArrivalTimeInner = 4.5;
|
|---|
| 188 | const Float_t MJCalibration::fgRefArrivalTimeOuter = 5.0;
|
|---|
| 189 | const Float_t MJCalibration::fgRefArrivalTimeRmsInner = 0.5;
|
|---|
| 190 | const Float_t MJCalibration::fgRefArrivalTimeRmsOuter = 0.5;
|
|---|
| 191 | // --------------------------------------------------------------------------
|
|---|
| 192 | //
|
|---|
| 193 | // Default constructor.
|
|---|
| 194 | //
|
|---|
| 195 | // - Sets fRuns to 0, fExtractor to NULL, fTimeExtractor to NULL, fColor to kNONE,
|
|---|
| 196 | // fDisplay to kNormalDisplay, kRelTimes to kFALSE, kataCheck to kFALSE, kDebug to kFALSE,
|
|---|
| 197 | // kIntensity to kFALSE
|
|---|
| 198 | // - SetUseBlindPixel()
|
|---|
| 199 | // - SetUsePINDiode()
|
|---|
| 200 | //
|
|---|
| 201 | MJCalibration::MJCalibration(const char *name, const char *title)
|
|---|
| 202 | : fRuns(0), fExtractor(NULL), fTimeExtractor(NULL),
|
|---|
| 203 | fColor(MCalibrationCam::kNONE), fDisplayType(kDataCheckDisplay),
|
|---|
| 204 | fGeometry("MGeomCamMagic")
|
|---|
| 205 | {
|
|---|
| 206 |
|
|---|
| 207 | fName = name ? name : "MJCalibration";
|
|---|
| 208 | fTitle = title ? title : "Tool to create the calibration constants for one calibration run";
|
|---|
| 209 |
|
|---|
| 210 | SetUseBlindPixel();
|
|---|
| 211 | SetUsePINDiode();
|
|---|
| 212 |
|
|---|
| 213 | SetRelTimeCalibration( kFALSE );
|
|---|
| 214 | SetDataCheck ( kFALSE );
|
|---|
| 215 | SetDebug ( kFALSE );
|
|---|
| 216 | SetIntensity ( kFALSE );
|
|---|
| 217 |
|
|---|
| 218 | SetNoStorage ( kFALSE );
|
|---|
| 219 | SetHistsStorage ( kFALSE );
|
|---|
| 220 |
|
|---|
| 221 | }
|
|---|
| 222 |
|
|---|
| 223 | // --------------------------------------------------------------------------
|
|---|
| 224 | //
|
|---|
| 225 | // Display the results in MStatusDisplay:
|
|---|
| 226 | //
|
|---|
| 227 | // - Add "Calibration" to the MStatusDisplay title
|
|---|
| 228 | // - Retrieve the MGeomCam from MParList
|
|---|
| 229 | // - Initialize the following MHCamera's:
|
|---|
| 230 | // 1) MCalibrationPix::GetMean()
|
|---|
| 231 | // 2) MCalibrationPix::Sigma()
|
|---|
| 232 | // 3) MCalibrationChargePix::GetRSigma()
|
|---|
| 233 | // 4) MCalibrationChargePix::GetRSigmaPerCharge()
|
|---|
| 234 | // 5) MCalibrationChargePix::GetPheFFactorMethod()
|
|---|
| 235 | // 6) MCalibrationChargePix::GetMeanConvFADC2Phe()
|
|---|
| 236 | // 7) MCalibrationChargePix::GetMeanFFactorFADC2Phot()
|
|---|
| 237 | // 8) MCalibrationQEPix::GetQECascadesFFactor()
|
|---|
| 238 | // 9) MCalibrationQEPix::GetQECascadesBlindPixel()
|
|---|
| 239 | // 10) MCalibrationQEPix::GetQECascadesPINDiode()
|
|---|
| 240 | // 11) MCalibrationQEPix::GetQECascadesCombined()
|
|---|
| 241 | // 12) MCalibrationQEPix::IsAverageQEFFactorAvailable()
|
|---|
| 242 | // 13) MCalibrationQEPix::IsAverageQEBlindPixelAvailable()
|
|---|
| 243 | // 14) MCalibrationQEPix::IsAverageQEPINDiodeAvailable()
|
|---|
| 244 | // 15) MCalibrationQEPix::IsAverageQECombinedAvailable()
|
|---|
| 245 | // 16) MCalibrationChargePix::IsHiGainSaturation()
|
|---|
| 246 | // 17) MCalibrationPix::GetHiLoMeansDivided()
|
|---|
| 247 | // 18) MCalibrationPix::GetHiLoSigmasDivided()
|
|---|
| 248 | // 19) MCalibrationChargePix::GetHiGainPickup()
|
|---|
| 249 | // 20) MCalibrationChargePix::GetLoGainPickup()
|
|---|
| 250 | // 21) MCalibrationChargePix::GetHiGainBlackout()
|
|---|
| 251 | // 22) MCalibrationChargePix::GetLoGainBlackout()
|
|---|
| 252 | // 23) MCalibrationPix::IsExcluded()
|
|---|
| 253 | // 24) MBadPixelsPix::IsUnsuitable(MBadPixelsPix::kUnsuitableRun)
|
|---|
| 254 | // 25) MBadPixelsPix::IsUnsuitable(MBadPixelsPix::kUnreliableRun)
|
|---|
| 255 | // 26) MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kHiGainOscillating)
|
|---|
| 256 | // 27) MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kLoGainOscillating)
|
|---|
| 257 | // 28) MCalibrationChargePix::GetAbsTimeMean()
|
|---|
| 258 | // 29) MCalibrationChargePix::GetAbsTimeRms()
|
|---|
| 259 | //
|
|---|
| 260 | // If the flag SetFullDisplay() is set, all MHCameras will be displayed.
|
|---|
| 261 | // if the flag SetDataCheckDisplay() is set, only the most important ones are displayed
|
|---|
| 262 | // and otherwise, (default: SetNormalDisplay()), a good selection of plots is given
|
|---|
| 263 | //
|
|---|
| 264 | void MJCalibration::DisplayResult(MParList &plist)
|
|---|
| 265 | {
|
|---|
| 266 |
|
|---|
| 267 | if (!fDisplay)
|
|---|
| 268 | return;
|
|---|
| 269 |
|
|---|
| 270 | //
|
|---|
| 271 | // Update display
|
|---|
| 272 | //
|
|---|
| 273 | TString title = fDisplay->GetTitle();
|
|---|
| 274 | title += "-- Calibration ";
|
|---|
| 275 | title += fSequence.IsValid() ? Form("calib%06d", fSequence.GetSequence()) : (const char*)fRuns->GetRunsAsString();
|
|---|
| 276 | title += " --";
|
|---|
| 277 | fDisplay->SetTitle(title);
|
|---|
| 278 |
|
|---|
| 279 | //
|
|---|
| 280 | // Get container from list
|
|---|
| 281 | //
|
|---|
| 282 | MGeomCam &geomcam = *(MGeomCam*)plist.FindObject("MGeomCam");
|
|---|
| 283 |
|
|---|
| 284 | // Create histograms to display
|
|---|
| 285 | MHCamera disp1 (geomcam, "Charge", "Fitted Mean Signal (Charges)");
|
|---|
| 286 | MHCamera disp2 (geomcam, "SigmaCharge", "Sigma of Fitted Signal");
|
|---|
| 287 | MHCamera disp3 (geomcam, "RSigma", "Reduced Sigmas");
|
|---|
| 288 | MHCamera disp4 (geomcam, "RSigmaPerCharge", "Reduced Sigma per Charge");
|
|---|
| 289 | MHCamera disp5 (geomcam, "NumPhes", "Number Photo-electrons");
|
|---|
| 290 | MHCamera disp6 (geomcam, "ConvFADC2Phes", "Conversion Factor to Phes");
|
|---|
| 291 | MHCamera disp7 (geomcam, "TotalFFactor", "Total F-Factor(F-Factor Method)");
|
|---|
| 292 | MHCamera disp8 (geomcam, "CascadesQEFFactor", "Cascades QE (F-Factor Method)");
|
|---|
| 293 | MHCamera disp9 (geomcam, "CascadesQEBlindPix","Cascades QE (Blind Pixel Method)");
|
|---|
| 294 | MHCamera disp10(geomcam, "CascadesQEPINDiode","Cascades QE (PIN Diode Method)");
|
|---|
| 295 | MHCamera disp11(geomcam, "CascadesQECombined","Cascades QE (Combined Method)");
|
|---|
| 296 | MHCamera disp12(geomcam, "FFactorValid", "Pixels with valid F-Factor calibration");
|
|---|
| 297 | MHCamera disp13(geomcam, "BlindPixelValid", "Pixels with valid BlindPixel calibration");
|
|---|
| 298 | MHCamera disp14(geomcam, "PINdiodeValid", "Pixels with valid PINDiode calibration");
|
|---|
| 299 | MHCamera disp15(geomcam, "CombinedValid", "Pixels with valid Combined calibration");
|
|---|
| 300 | MHCamera disp16(geomcam, "Saturation", "Pixels with saturated Hi Gain");
|
|---|
| 301 | MHCamera disp17(geomcam, "ConversionMeans", "Conversion HiGain.vs.LoGain Means");
|
|---|
| 302 | MHCamera disp18(geomcam, "ConversionSigmas", "Conversion HiGain.vs.LoGain Sigmas");
|
|---|
| 303 | MHCamera disp19(geomcam, "HiGainPickup", "Number Pickup events Hi Gain");
|
|---|
| 304 | MHCamera disp20(geomcam, "LoGainPickup", "Number Pickup events Lo Gain");
|
|---|
| 305 | MHCamera disp21(geomcam, "HiGainBlackout", "Number Blackout events Hi Gain");
|
|---|
| 306 | MHCamera disp22(geomcam, "LoGainBlackout", "Number Blackout events Lo Gain");
|
|---|
| 307 | MHCamera disp23(geomcam, "Excluded", "Pixels previously excluded");
|
|---|
| 308 | MHCamera disp24(geomcam, "UnSuitable", "Pixels not suited for further analysis");
|
|---|
| 309 | MHCamera disp25(geomcam, "UnReliable", "Pixels suitable, but not reliable for further analysis");
|
|---|
| 310 | MHCamera disp26(geomcam, "HiGainOscillating", "Oscillating Pixels High Gain");
|
|---|
| 311 | MHCamera disp27(geomcam, "LoGainOscillating", "Oscillating Pixels Low Gain");
|
|---|
| 312 | MHCamera disp28(geomcam, "AbsTimeMean", "Abs. Arrival Times");
|
|---|
| 313 | MHCamera disp29(geomcam, "AbsTimeRms", "RMS of Arrival Times");
|
|---|
| 314 | MHCamera disp30(geomcam, "MeanTime", "Mean Rel. Arrival Times");
|
|---|
| 315 | MHCamera disp31(geomcam, "SigmaTime", "Sigma Rel. Arrival Times");
|
|---|
| 316 | MHCamera disp32(geomcam, "TimeProb", "Probability of Time Fit");
|
|---|
| 317 | MHCamera disp33(geomcam, "TimeNotFitValid", "Pixels with not valid fit results");
|
|---|
| 318 | MHCamera disp34(geomcam, "TimeOscillating", "Oscillating Pixels");
|
|---|
| 319 | MHCamera disp35(geomcam, "TotalConv", "Conversion Factor to photons");
|
|---|
| 320 |
|
|---|
| 321 | MCalibrationChargeCam *cam = NULL;
|
|---|
| 322 | MCalibrationQECam *qecam = NULL;
|
|---|
| 323 | MCalibrationRelTimeCam *relcam = NULL;
|
|---|
| 324 | MBadPixelsCam *badcam = NULL;
|
|---|
| 325 |
|
|---|
| 326 | if (IsIntensity())
|
|---|
| 327 | {
|
|---|
| 328 | cam = (MCalibrationChargeCam*) fIntensCalibCam.GetCam();
|
|---|
| 329 | qecam = (MCalibrationQECam*) fIntensQECam.GetCam();
|
|---|
| 330 | relcam = (MCalibrationRelTimeCam*)fIntensRelTimeCam.GetCam();
|
|---|
| 331 | badcam = (MBadPixelsCam*) fIntensBadCam.GetCam();
|
|---|
| 332 | }
|
|---|
| 333 | else
|
|---|
| 334 | {
|
|---|
| 335 | cam = &fCalibrationCam;
|
|---|
| 336 | qecam = &fQECam;
|
|---|
| 337 | relcam = &fRelTimeCam;
|
|---|
| 338 | badcam = &fBadPixels;
|
|---|
| 339 | }
|
|---|
| 340 |
|
|---|
| 341 | // Fitted charge means and sigmas
|
|---|
| 342 | disp1.SetCamContent(*cam, 0);
|
|---|
| 343 | disp1.SetCamError( *cam, 1);
|
|---|
| 344 | disp2.SetCamContent(*cam, 2);
|
|---|
| 345 | disp2.SetCamError( *cam, 3);
|
|---|
| 346 |
|
|---|
| 347 | // Reduced Sigmas and reduced sigmas per charge
|
|---|
| 348 | disp3.SetCamContent(*cam, 5);
|
|---|
| 349 | disp3.SetCamError( *cam, 6);
|
|---|
| 350 | disp4.SetCamContent(*cam, 7);
|
|---|
| 351 | disp4.SetCamError( *cam, 8);
|
|---|
| 352 |
|
|---|
| 353 | // F-Factor Method
|
|---|
| 354 | disp5.SetCamContent(*cam, 9);
|
|---|
| 355 | disp5.SetCamError( *cam, 10);
|
|---|
| 356 | disp6.SetCamContent(*cam, 11);
|
|---|
| 357 | disp6.SetCamError( *cam, 12);
|
|---|
| 358 | disp7.SetCamContent(*cam, 13);
|
|---|
| 359 | disp7.SetCamError( *cam, 14);
|
|---|
| 360 |
|
|---|
| 361 | // Quantum Efficiencies
|
|---|
| 362 | disp8.SetCamContent (*qecam, 0 );
|
|---|
| 363 | disp8.SetCamError (*qecam, 1 );
|
|---|
| 364 | disp9.SetCamContent (*qecam, 2 );
|
|---|
| 365 | disp9.SetCamError (*qecam, 3 );
|
|---|
| 366 | disp10.SetCamContent(*qecam, 4 );
|
|---|
| 367 | disp10.SetCamError (*qecam, 5 );
|
|---|
| 368 | disp11.SetCamContent(*qecam, 6 );
|
|---|
| 369 | disp11.SetCamError (*qecam, 7 );
|
|---|
| 370 |
|
|---|
| 371 | // Valid flags
|
|---|
| 372 | disp12.SetCamContent(*qecam, 8 );
|
|---|
| 373 | disp13.SetCamContent(*qecam, 9 );
|
|---|
| 374 | disp14.SetCamContent(*qecam, 10);
|
|---|
| 375 | disp15.SetCamContent(*qecam, 11);
|
|---|
| 376 |
|
|---|
| 377 | // Conversion Hi-Lo
|
|---|
| 378 | disp16.SetCamContent(*cam, 25);
|
|---|
| 379 | disp17.SetCamContent(*cam, 16);
|
|---|
| 380 | disp17.SetCamError (*cam, 17);
|
|---|
| 381 | disp18.SetCamContent(*cam, 18);
|
|---|
| 382 | disp18.SetCamError (*cam, 19);
|
|---|
| 383 |
|
|---|
| 384 | // Pickup and Blackout
|
|---|
| 385 | disp19.SetCamContent(*cam, 21);
|
|---|
| 386 | disp20.SetCamContent(*cam, 22);
|
|---|
| 387 | disp21.SetCamContent(*cam, 23);
|
|---|
| 388 | disp22.SetCamContent(*cam, 24);
|
|---|
| 389 |
|
|---|
| 390 | // Pixels with defects
|
|---|
| 391 | disp23.SetCamContent(*cam, 20);
|
|---|
| 392 | disp24.SetCamContent(*badcam, 6);
|
|---|
| 393 | disp25.SetCamContent(*badcam, 7);
|
|---|
| 394 |
|
|---|
| 395 | // Oscillations
|
|---|
| 396 | disp26.SetCamContent(*badcam, 10);
|
|---|
| 397 | disp27.SetCamContent(*badcam, 11);
|
|---|
| 398 |
|
|---|
| 399 | // Arrival Times
|
|---|
| 400 | disp28.SetCamContent(*cam, 26);
|
|---|
| 401 | disp28.SetCamError( *cam, 27);
|
|---|
| 402 | disp29.SetCamContent(*cam, 27);
|
|---|
| 403 |
|
|---|
| 404 | disp1.SetYTitle("Q [FADC counts]");
|
|---|
| 405 | disp2.SetYTitle("\\sigma_{Q} [FADC counts]");
|
|---|
| 406 |
|
|---|
| 407 | disp3.SetYTitle("\\sqrt{\\sigma^{2}_{Q} - RMS^{2}_{Ped}} [FADC Counts]");
|
|---|
| 408 | disp4.SetYTitle("Red.Sigma/<Q> [1]");
|
|---|
| 409 |
|
|---|
| 410 | disp5.SetYTitle("Photo-electons [1]");
|
|---|
| 411 | disp6.SetYTitle("Conv.Factor [PhE/FADC counts]");
|
|---|
| 412 | disp7.SetYTitle("Total F-Factor [1]");
|
|---|
| 413 |
|
|---|
| 414 | disp8.SetYTitle("QE [1]");
|
|---|
| 415 | disp9.SetYTitle("QE [1]");
|
|---|
| 416 | disp10.SetYTitle("QE [1]");
|
|---|
| 417 | disp11.SetYTitle("QE [1]");
|
|---|
| 418 |
|
|---|
| 419 | disp12.SetYTitle("[1]");
|
|---|
| 420 | disp13.SetYTitle("[1]");
|
|---|
| 421 | disp14.SetYTitle("[1]");
|
|---|
| 422 | disp15.SetYTitle("[1]");
|
|---|
| 423 | disp16.SetYTitle("[1]");
|
|---|
| 424 |
|
|---|
| 425 | disp17.SetYTitle("<Q>(High)/<Q>(Low) [1]");
|
|---|
| 426 | disp18.SetYTitle("\\sigma_{Q}(High)/\\sigma_{Q}(Low) [1]");
|
|---|
| 427 |
|
|---|
| 428 | disp19.SetYTitle("[1]");
|
|---|
| 429 | disp20.SetYTitle("[1]");
|
|---|
| 430 | disp21.SetYTitle("[1]");
|
|---|
| 431 | disp22.SetYTitle("[1]");
|
|---|
| 432 | // disp23.SetYTitle("[1]");
|
|---|
| 433 | // disp24.SetYTitle("[1]");
|
|---|
| 434 | // disp25.SetYTitle("[1]");
|
|---|
| 435 | disp26.SetYTitle("[1]");
|
|---|
| 436 | disp27.SetYTitle("[1]");
|
|---|
| 437 |
|
|---|
| 438 | disp28.SetYTitle("Mean Abs. Time [FADC slice]");
|
|---|
| 439 | disp29.SetYTitle("RMS Abs. Time [FADC slices]");
|
|---|
| 440 |
|
|---|
| 441 | disp35.SetYTitle("Conv.Factor [Ph/FADC counts]");
|
|---|
| 442 |
|
|---|
| 443 | for (UInt_t i=0;i<geomcam.GetNumPixels();i++)
|
|---|
| 444 | {
|
|---|
| 445 |
|
|---|
| 446 | MCalibrationChargePix &pix = (MCalibrationChargePix&)(*cam) [i];
|
|---|
| 447 | MCalibrationQEPix &qe = (MCalibrationQEPix&) (*qecam)[i];
|
|---|
| 448 |
|
|---|
| 449 | if (!pix.IsFFactorMethodValid())
|
|---|
| 450 | continue;
|
|---|
| 451 |
|
|---|
| 452 | const Float_t convphe = pix.GetMeanConvFADC2Phe();
|
|---|
| 453 | const Float_t quaeff = qe.GetQECascadesFFactor(0.);
|
|---|
| 454 |
|
|---|
| 455 | disp35.Fill(i,convphe/quaeff);
|
|---|
| 456 | disp35.SetUsed(i);
|
|---|
| 457 | }
|
|---|
| 458 |
|
|---|
| 459 |
|
|---|
| 460 | if (IsRelTimes())
|
|---|
| 461 | {
|
|---|
| 462 | disp30.SetCamContent(*relcam,0);
|
|---|
| 463 | disp30.SetCamError( *relcam,1);
|
|---|
| 464 | disp31.SetCamContent(*relcam,2);
|
|---|
| 465 | disp31.SetCamError( *relcam,3);
|
|---|
| 466 | disp32.SetCamContent(*relcam,4);
|
|---|
| 467 | disp33.SetCamContent(fBadPixels,20);
|
|---|
| 468 | disp34.SetCamContent(fBadPixels,21);
|
|---|
| 469 |
|
|---|
| 470 | disp30.SetYTitle("Time Offset [FADC units]");
|
|---|
| 471 | disp31.SetYTitle("Timing resolution [FADC units]");
|
|---|
| 472 | disp32.SetYTitle("P_{Time} [1]");
|
|---|
| 473 | disp33.SetYTitle("[1]");
|
|---|
| 474 | disp34.SetYTitle("[1]");
|
|---|
| 475 | }
|
|---|
| 476 |
|
|---|
| 477 | if (fDisplayType == kDataCheckDisplay)
|
|---|
| 478 | {
|
|---|
| 479 |
|
|---|
| 480 | TCanvas &c1 = fDisplay->AddTab("Fit.Charge");
|
|---|
| 481 | c1.Divide(3, 3);
|
|---|
| 482 |
|
|---|
| 483 | //
|
|---|
| 484 | // MEAN CHARGES
|
|---|
| 485 | //
|
|---|
| 486 |
|
|---|
| 487 | c1.cd(1);
|
|---|
| 488 | gPad->SetBorderMode(0);
|
|---|
| 489 | gPad->SetTicks();
|
|---|
| 490 | MHCamera *obj1=(MHCamera*)disp1.DrawCopy("hist");
|
|---|
| 491 | //
|
|---|
| 492 | // for the datacheck, fix the ranges!!
|
|---|
| 493 | //
|
|---|
| 494 | // obj1->SetMinimum(fgChargeMin);
|
|---|
| 495 | // obj1->SetMaximum(fgChargeMax);
|
|---|
| 496 | //
|
|---|
| 497 | // Set the datacheck sizes:
|
|---|
| 498 | //
|
|---|
| 499 | FixDataCheckHist((TH1D*)obj1);
|
|---|
| 500 | obj1->SetStats(kFALSE);
|
|---|
| 501 | //
|
|---|
| 502 | // set reference lines
|
|---|
| 503 | //
|
|---|
| 504 | // DisplayReferenceLines(obj1,0);
|
|---|
| 505 |
|
|---|
| 506 | c1.cd(4);
|
|---|
| 507 | gPad->SetBorderMode(0);
|
|---|
| 508 | obj1->SetPrettyPalette();
|
|---|
| 509 | obj1->Draw();
|
|---|
| 510 |
|
|---|
| 511 | c1.cd(7);
|
|---|
| 512 | gPad->SetBorderMode(0);
|
|---|
| 513 | gPad->SetTicks();
|
|---|
| 514 | TH1D *obj2 = (TH1D*)obj1->Projection(obj1->GetName());
|
|---|
| 515 | obj2->Draw();
|
|---|
| 516 | obj2->SetBit(kCanDelete);
|
|---|
| 517 | obj2->Fit("gaus","Q");
|
|---|
| 518 | TF1 *fun2 = obj2->GetFunction("gaus");
|
|---|
| 519 | fun2->SetLineColor(kYellow);
|
|---|
| 520 | gPad->Modified();
|
|---|
| 521 | gPad->Update();
|
|---|
| 522 | TPaveStats *st = (TPaveStats*)obj2->GetListOfFunctions()->FindObject("stats");
|
|---|
| 523 | st->SetY1NDC(0.55);
|
|---|
| 524 | st->SetY2NDC(0.89);
|
|---|
| 525 | st->SetX1NDC(0.65);
|
|---|
| 526 | st->SetX2NDC(0.99);
|
|---|
| 527 | gPad->Modified();
|
|---|
| 528 | gPad->Update();
|
|---|
| 529 | //
|
|---|
| 530 | // Set the datacheck sizes:
|
|---|
| 531 | //
|
|---|
| 532 | FixDataCheckHist(obj2);
|
|---|
| 533 | obj2->SetStats(1);
|
|---|
| 534 |
|
|---|
| 535 | //
|
|---|
| 536 | // Display the outliers as dead and noisy pixels
|
|---|
| 537 | //
|
|---|
| 538 | DisplayOutliers(obj2,"low-ampl.","high-ampl.");
|
|---|
| 539 | TLatex flattex;
|
|---|
| 540 | flattex.SetTextSize(0.07);
|
|---|
| 541 | const Double_t minl = obj2->GetBinCenter(obj2->GetXaxis()->GetFirst());
|
|---|
| 542 | const Double_t maxl = obj2->GetBinCenter(obj2->GetXaxis()->GetLast());
|
|---|
| 543 | flattex.DrawLatex(minl+0.015*(maxl-minl),obj2->GetBinContent(obj2->GetMaximumBin())/1.35,
|
|---|
| 544 | Form("Flatfield precision: %4.2f%%",
|
|---|
| 545 | fun2->GetParameter(2)/fun2->GetParameter(1)*100.));
|
|---|
| 546 |
|
|---|
| 547 | //
|
|---|
| 548 | // REDUCED SIGMAS
|
|---|
| 549 | //
|
|---|
| 550 |
|
|---|
| 551 | c1.cd(2);
|
|---|
| 552 | gPad->SetBorderMode(0);
|
|---|
| 553 | gPad->SetTicks();
|
|---|
| 554 | MHCamera *obj3=(MHCamera*)disp4.DrawCopy("hist");
|
|---|
| 555 | //
|
|---|
| 556 | // for the datacheck, fix the ranges!!
|
|---|
| 557 | //
|
|---|
| 558 | obj3->SetMinimum(0.);
|
|---|
| 559 | // obj3->SetMaximum(fgChargeMax);
|
|---|
| 560 | //
|
|---|
| 561 | // Set the datacheck sizes:
|
|---|
| 562 | //
|
|---|
| 563 | FixDataCheckHist((TH1D*)obj3);
|
|---|
| 564 | obj3->SetStats(kFALSE);
|
|---|
| 565 | //
|
|---|
| 566 | // set reference lines
|
|---|
| 567 | //
|
|---|
| 568 | // DisplayReferenceLines(obj3,0);
|
|---|
| 569 |
|
|---|
| 570 | c1.cd(5);
|
|---|
| 571 | gPad->SetBorderMode(0);
|
|---|
| 572 | obj3->SetPrettyPalette();
|
|---|
| 573 | obj3->Draw();
|
|---|
| 574 |
|
|---|
| 575 | c1.cd(8);
|
|---|
| 576 | gPad->SetBorderMode(0);
|
|---|
| 577 | if (geomcam.InheritsFrom("MGeomCamMagic"))
|
|---|
| 578 | DisplayDoubleProject(&disp4, "dead", "noisy");
|
|---|
| 579 |
|
|---|
| 580 | //
|
|---|
| 581 | // PHOTO ELECTRONS
|
|---|
| 582 | //
|
|---|
| 583 |
|
|---|
| 584 | c1.cd(3);
|
|---|
| 585 | gPad->SetBorderMode(0);
|
|---|
| 586 | gPad->SetTicks();
|
|---|
| 587 | MHCamera *obj4=(MHCamera*)disp5.DrawCopy("hist");
|
|---|
| 588 | //
|
|---|
| 589 | // for the datacheck, fix the ranges!!
|
|---|
| 590 | //
|
|---|
| 591 | // obj3->SetMinimum(fgChargeMin);
|
|---|
| 592 | // obj3->SetMaximum(fgChargeMax);
|
|---|
| 593 | //
|
|---|
| 594 | // Set the datacheck sizes:
|
|---|
| 595 | //
|
|---|
| 596 | FixDataCheckHist((TH1D*)obj4);
|
|---|
| 597 | obj4->SetStats(kFALSE);
|
|---|
| 598 | //
|
|---|
| 599 | // set reference lines
|
|---|
| 600 | //
|
|---|
| 601 | // DisplayReferenceLines(obj3,0);
|
|---|
| 602 |
|
|---|
| 603 | c1.cd(6);
|
|---|
| 604 | gPad->SetBorderMode(0);
|
|---|
| 605 | obj4->SetPrettyPalette();
|
|---|
| 606 | obj4->Draw();
|
|---|
| 607 |
|
|---|
| 608 | c1.cd(9);
|
|---|
| 609 | gPad->SetBorderMode(0);
|
|---|
| 610 | if (geomcam.InheritsFrom("MGeomCamMagic"))
|
|---|
| 611 | DisplayDoubleProject(&disp5, "dead", "noisy");
|
|---|
| 612 |
|
|---|
| 613 | //
|
|---|
| 614 | // CONVERSION FACTORS
|
|---|
| 615 | //
|
|---|
| 616 | TCanvas &c2 = fDisplay->AddTab("Conversion");
|
|---|
| 617 | c2.Divide(3,3);
|
|---|
| 618 |
|
|---|
| 619 | c2.cd(1);
|
|---|
| 620 | gPad->SetBorderMode(0);
|
|---|
| 621 | gPad->SetTicks();
|
|---|
| 622 | MHCamera *obj5=(MHCamera*)disp6.DrawCopy("hist");
|
|---|
| 623 | //
|
|---|
| 624 | // for the datacheck, fix the ranges!!
|
|---|
| 625 | //
|
|---|
| 626 | obj5->SetMinimum(fgConvFADC2PheMin);
|
|---|
| 627 | obj5->SetMaximum(fgConvFADC2PheMax);
|
|---|
| 628 | //
|
|---|
| 629 | // Set the datacheck sizes:
|
|---|
| 630 | //
|
|---|
| 631 | FixDataCheckHist((TH1D*)obj5);
|
|---|
| 632 | obj5->SetStats(kFALSE);
|
|---|
| 633 | //
|
|---|
| 634 | // set reference lines
|
|---|
| 635 | //
|
|---|
| 636 | DisplayReferenceLines(obj5,2);
|
|---|
| 637 |
|
|---|
| 638 | c2.cd(4);
|
|---|
| 639 | gPad->SetBorderMode(0);
|
|---|
| 640 | obj5->SetPrettyPalette();
|
|---|
| 641 | obj5->Draw();
|
|---|
| 642 |
|
|---|
| 643 | c2.cd(7);
|
|---|
| 644 | gPad->SetBorderMode(0);
|
|---|
| 645 | if (geomcam.InheritsFrom("MGeomCamMagic"))
|
|---|
| 646 | DisplayDoubleProject(&disp6, "noisy", "dead");
|
|---|
| 647 |
|
|---|
| 648 | //
|
|---|
| 649 | // QUANTUM EFFICIENCY
|
|---|
| 650 | //
|
|---|
| 651 | c2.cd(2);
|
|---|
| 652 | gPad->SetBorderMode(0);
|
|---|
| 653 | gPad->SetTicks();
|
|---|
| 654 | MHCamera *obj6=(MHCamera*)disp8.DrawCopy("hist");
|
|---|
| 655 | //
|
|---|
| 656 | // for the datacheck, fix the ranges!!
|
|---|
| 657 | //
|
|---|
| 658 | obj6->SetMinimum(fgQEMin);
|
|---|
| 659 | obj6->SetMaximum(fgQEMax);
|
|---|
| 660 | //
|
|---|
| 661 | // Set the datacheck sizes:
|
|---|
| 662 | //
|
|---|
| 663 | FixDataCheckHist((TH1D*)obj6);
|
|---|
| 664 | obj6->SetStats(kFALSE);
|
|---|
| 665 | //
|
|---|
| 666 | // set reference lines
|
|---|
| 667 | //
|
|---|
| 668 | DisplayReferenceLines(obj6,0);
|
|---|
| 669 |
|
|---|
| 670 | c2.cd(5);
|
|---|
| 671 | gPad->SetBorderMode(0);
|
|---|
| 672 | obj6->SetPrettyPalette();
|
|---|
| 673 | obj6->Draw();
|
|---|
| 674 |
|
|---|
| 675 | c2.cd(8);
|
|---|
| 676 | gPad->SetBorderMode(0);
|
|---|
| 677 | if (geomcam.InheritsFrom("MGeomCamMagic"))
|
|---|
| 678 | DisplayDoubleProject(&disp8, "noisy", "dead");
|
|---|
| 679 |
|
|---|
| 680 | //
|
|---|
| 681 | // CONVERSION FADC TO PHOTONS
|
|---|
| 682 | //
|
|---|
| 683 |
|
|---|
| 684 | c2.cd(3);
|
|---|
| 685 | gPad->SetBorderMode(0);
|
|---|
| 686 | gPad->SetTicks();
|
|---|
| 687 | MHCamera *obj7=(MHCamera*)disp35.DrawCopy("hist");
|
|---|
| 688 | //
|
|---|
| 689 | // for the datacheck, fix the ranges!!
|
|---|
| 690 | //
|
|---|
| 691 | obj7->SetMinimum(fgConvFADC2PhotMin);
|
|---|
| 692 | obj7->SetMaximum(fgConvFADC2PhotMax);
|
|---|
| 693 | //
|
|---|
| 694 | // Set the datacheck sizes:
|
|---|
| 695 | //
|
|---|
| 696 | FixDataCheckHist((TH1D*)obj7);
|
|---|
| 697 | obj7->SetStats(kFALSE);
|
|---|
| 698 | //
|
|---|
| 699 | // set reference lines
|
|---|
| 700 | //
|
|---|
| 701 | DisplayReferenceLines(obj7,1);
|
|---|
| 702 |
|
|---|
| 703 | c2.cd(6);
|
|---|
| 704 | gPad->SetBorderMode(0);
|
|---|
| 705 | obj7->SetPrettyPalette();
|
|---|
| 706 | obj7->Draw();
|
|---|
| 707 | c2.cd(9);
|
|---|
| 708 | gPad->SetBorderMode(0);
|
|---|
| 709 | if (geomcam.InheritsFrom("MGeomCamMagic"))
|
|---|
| 710 | DisplayDoubleProject(&disp35, "noisy", "dead");
|
|---|
| 711 |
|
|---|
| 712 | //
|
|---|
| 713 | // ARRIVAL TIMES
|
|---|
| 714 | //
|
|---|
| 715 | TCanvas &c3 = fDisplay->AddTab("ArrivalTimes");
|
|---|
| 716 | c3.Divide(2,3);
|
|---|
| 717 |
|
|---|
| 718 | c3.cd(1);
|
|---|
| 719 | gPad->SetBorderMode(0);
|
|---|
| 720 | gPad->SetTicks();
|
|---|
| 721 | MHCamera *obj10=(MHCamera*)disp28.DrawCopy("hist");
|
|---|
| 722 | //
|
|---|
| 723 | // for the datacheck, fix the ranges!!
|
|---|
| 724 | //
|
|---|
| 725 | obj10->SetMinimum(fgArrivalTimeMin);
|
|---|
| 726 | obj10->SetMaximum(fgArrivalTimeMax);
|
|---|
| 727 | //
|
|---|
| 728 | // Set the datacheck sizes:
|
|---|
| 729 | //
|
|---|
| 730 | FixDataCheckHist((TH1D*)obj10);
|
|---|
| 731 | obj10->SetStats(kFALSE);
|
|---|
| 732 | //
|
|---|
| 733 | // set reference lines
|
|---|
| 734 | //
|
|---|
| 735 | DisplayReferenceLines(obj10,3);
|
|---|
| 736 |
|
|---|
| 737 | c3.cd(3);
|
|---|
| 738 | gPad->SetBorderMode(0);
|
|---|
| 739 | obj10->SetPrettyPalette();
|
|---|
| 740 | obj10->Draw();
|
|---|
| 741 |
|
|---|
| 742 | c3.cd(5);
|
|---|
| 743 | gPad->SetBorderMode(0);
|
|---|
| 744 | if (geomcam.InheritsFrom("MGeomCamMagic"))
|
|---|
| 745 | DisplayDoubleProject(&disp28, "early", "late");
|
|---|
| 746 |
|
|---|
| 747 | //
|
|---|
| 748 | // ARRIVAL TIMES JITTER
|
|---|
| 749 | //
|
|---|
| 750 | c3.cd(2);
|
|---|
| 751 | gPad->SetBorderMode(0);
|
|---|
| 752 | gPad->SetTicks();
|
|---|
| 753 | MHCamera *obj11=(MHCamera*)disp29.DrawCopy("hist");
|
|---|
| 754 | //
|
|---|
| 755 | // for the datacheck, fix the ranges!!
|
|---|
| 756 | //
|
|---|
| 757 | // obj11->SetMinimum(fgArrivalTimeMin);
|
|---|
| 758 | // obj11->SetMaximum(fgArrivalTimeMax);
|
|---|
| 759 | //
|
|---|
| 760 | // Set the datacheck sizes:
|
|---|
| 761 | //
|
|---|
| 762 | FixDataCheckHist((TH1D*)obj11);
|
|---|
| 763 | obj11->SetStats(kFALSE);
|
|---|
| 764 | //
|
|---|
| 765 | // set reference lines
|
|---|
| 766 | //
|
|---|
| 767 | DisplayReferenceLines(obj11,4);
|
|---|
| 768 |
|
|---|
| 769 | c3.cd(4);
|
|---|
| 770 | gPad->SetBorderMode(0);
|
|---|
| 771 | obj11->SetPrettyPalette();
|
|---|
| 772 | obj11->Draw();
|
|---|
| 773 |
|
|---|
| 774 | c3.cd(6);
|
|---|
| 775 | gPad->SetBorderMode(0);
|
|---|
| 776 | if (geomcam.InheritsFrom("MGeomCamMagic"))
|
|---|
| 777 | DisplayDoubleProject(&disp29, "", "jittering");
|
|---|
| 778 |
|
|---|
| 779 | //
|
|---|
| 780 | // UNSUITABLE PIXELS
|
|---|
| 781 | //
|
|---|
| 782 | TCanvas &c4 = fDisplay->AddTab("Defect");
|
|---|
| 783 | c4.Divide(2,2);
|
|---|
| 784 |
|
|---|
| 785 | c4.cd(1);
|
|---|
| 786 | gPad->SetBorderMode(0);
|
|---|
| 787 | gPad->SetTicks();
|
|---|
| 788 | MHCamera *obj8=(MHCamera*)disp24.DrawCopy("hist");
|
|---|
| 789 | //
|
|---|
| 790 | // for the datacheck, fix the ranges!!
|
|---|
| 791 | //
|
|---|
| 792 | const Double_t max = 11.;
|
|---|
| 793 | obj8->SetMinimum(0.);
|
|---|
| 794 | obj8->SetMaximum(11.);
|
|---|
| 795 | //
|
|---|
| 796 | // Set the datacheck sizes:
|
|---|
| 797 | //
|
|---|
| 798 | FixDataCheckHist((TH1D*)obj8);
|
|---|
| 799 | obj8->SetStats(kFALSE);
|
|---|
| 800 |
|
|---|
| 801 | gStyle->SetPalette(1);
|
|---|
| 802 | const Int_t numcol = gStyle->GetNumberOfColors()-3;
|
|---|
| 803 |
|
|---|
| 804 | TPaveText *pave = new TPaveText(0.0,0.0,0.99,0.99);
|
|---|
| 805 | pave->SetBit(kCanDelete);
|
|---|
| 806 | pave->ConvertNDCtoPad();
|
|---|
| 807 | pave->SetTextSize(0.05);
|
|---|
| 808 | pave->AddText(" ");
|
|---|
| 809 | TText *t1 = pave->AddText(Form("Signal smaller 3 Pedestal RMS: %3i pixels",
|
|---|
| 810 | CountBadPixels(&disp24,1)));
|
|---|
| 811 | t1->SetTextColor(gStyle->GetColorPalette(Int_t(1./max*numcol + 1.)));
|
|---|
| 812 | t1->SetTextAlign(12);
|
|---|
| 813 | TText *t2 = pave->AddText(Form("%s%3i%s","Signal Rel. error too large: ",
|
|---|
| 814 | CountBadPixels(&disp24,2)," pixels"));
|
|---|
| 815 | t2->SetTextColor(gStyle->GetColorPalette(Int_t(2./max*numcol + 1.)));
|
|---|
| 816 | t2->SetTextAlign(12);
|
|---|
| 817 | TText *t4 = pave->AddText(Form("Low Gain Saturation: %3i pixels",
|
|---|
| 818 | CountBadPixels(&disp24,3)));
|
|---|
| 819 | t4->SetTextColor(gStyle->GetColorPalette(Int_t(3./max*numcol + 1.)));
|
|---|
| 820 | t4->SetTextAlign(12);
|
|---|
| 821 | TText *t5 = pave->AddText(Form("Mean Arr. Time In First Extraction Bin: %3i pixels",
|
|---|
| 822 | CountBadPixels(&disp24,4)));
|
|---|
| 823 | t5->SetTextColor(gStyle->GetColorPalette(Int_t(4./max*numcol + 1.)));
|
|---|
| 824 | t5->SetTextAlign(12);
|
|---|
| 825 | TText *t6 = pave->AddText(Form("Mean Arr. Time In Last 2 Extraction Bins: %3i pixels",
|
|---|
| 826 | CountBadPixels(&disp24,5)));
|
|---|
| 827 | t6->SetTextColor(gStyle->GetColorPalette(Int_t(5./max*numcol + 1.)));
|
|---|
| 828 | t6->SetTextAlign(12);
|
|---|
| 829 | TText *t7 = pave->AddText(Form("Deviating Number of Photo-electrons: %3i pixels",
|
|---|
| 830 | CountBadPixels(&disp24,6)));
|
|---|
| 831 | t7->SetTextColor(gStyle->GetColorPalette(Int_t(6./max*numcol + 1.)));
|
|---|
| 832 | t7->SetTextAlign(12);
|
|---|
| 833 | TText *t8 = pave->AddText(Form("Deviating global F-Factor: %3i pixels",
|
|---|
| 834 | CountBadPixels(&disp24,7)));
|
|---|
| 835 | t8->SetTextColor(gStyle->GetColorPalette(Int_t(7./max*numcol + 1.)));
|
|---|
| 836 | t8->SetTextAlign(12);
|
|---|
| 837 | TText *t9 = pave->AddText(Form("Deviating Number of Photons: %3i pixels",
|
|---|
| 838 | CountBadPixels(&disp24,8)));
|
|---|
| 839 | t9->SetTextColor(gStyle->GetColorPalette(Int_t(8./max*numcol + 1.)));
|
|---|
| 840 | t9->SetTextAlign(12);
|
|---|
| 841 | TText *t10= pave->AddText(Form("High-Gain Histogram Overflow: %3i pixels",
|
|---|
| 842 | CountBadPixels(&disp24,9 )));
|
|---|
| 843 | t10->SetTextColor(gStyle->GetColorPalette(Int_t(9./max*numcol + 1.)));
|
|---|
| 844 | t10->SetTextAlign(12);
|
|---|
| 845 | TText *t11= pave->AddText(Form("Low-Gain Histogram Overflow: %3i pixels",
|
|---|
| 846 | CountBadPixels(&disp24,10)));
|
|---|
| 847 | t11->SetTextColor(gStyle->GetColorPalette(Int_t(10./max*numcol + 1.)));
|
|---|
| 848 | t11->SetTextAlign(12);
|
|---|
| 849 | TText *t12= pave->AddText(Form("Previously Excluded: %3i pixels",
|
|---|
| 850 | CountBadPixels(&disp24,11)));
|
|---|
| 851 | t12->SetTextColor(gStyle->GetColorPalette(Int_t(11./max*numcol + 1.)));
|
|---|
| 852 | t12->SetTextAlign(12);
|
|---|
| 853 | pave->Draw();
|
|---|
| 854 |
|
|---|
| 855 | c4.cd(3);
|
|---|
| 856 | gPad->SetBorderMode(0);
|
|---|
| 857 | obj8->Draw();
|
|---|
| 858 | obj8->SetPrettyPalette();
|
|---|
| 859 |
|
|---|
| 860 | //
|
|---|
| 861 | // UNRELIABLE PIXELS
|
|---|
| 862 | //
|
|---|
| 863 |
|
|---|
| 864 | c4.cd(2);
|
|---|
| 865 | gPad->SetBorderMode(0);
|
|---|
| 866 | gPad->SetTicks();
|
|---|
| 867 | MHCamera *obj9=(MHCamera*)disp25.DrawCopy("hist");
|
|---|
| 868 | //
|
|---|
| 869 | // for the datacheck, fix the ranges!!
|
|---|
| 870 | //
|
|---|
| 871 | const Double_t max2 = 8.;
|
|---|
| 872 | obj9->SetMinimum(0.);
|
|---|
| 873 | obj9->SetMaximum(max2);
|
|---|
| 874 | //
|
|---|
| 875 | // Set the datacheck sizes:
|
|---|
| 876 | //
|
|---|
| 877 | FixDataCheckHist((TH1D*)obj9);
|
|---|
| 878 | obj9->SetStats(kFALSE);
|
|---|
| 879 |
|
|---|
| 880 | gStyle->SetPalette(1);
|
|---|
| 881 |
|
|---|
| 882 | TPaveText *pave2 = new TPaveText(0.0,0.0,0.99,0.99);
|
|---|
| 883 | pave2->SetBit(kCanDelete);
|
|---|
| 884 | pave2->ConvertNDCtoPad();
|
|---|
| 885 | pave2->SetTextSize(0.05);
|
|---|
| 886 | pave2->AddText(" ");
|
|---|
| 887 | TText *t3 = pave2->AddText(Form("Signal Sigma smaller Pedestal RMS: %3i pixels",
|
|---|
| 888 | CountBadPixels(&disp25,1)));
|
|---|
| 889 | t3->SetTextColor(gStyle->GetColorPalette(Int_t(1./max*numcol + 1.)));
|
|---|
| 890 | t3->SetTextAlign(12);
|
|---|
| 891 | TText *tt1 = pave2->AddText(Form("High Gain Signals could not be fitted: %3i pixels",
|
|---|
| 892 | CountBadPixels(&disp25,2)));
|
|---|
| 893 | tt1->SetTextColor(gStyle->GetColorPalette(Int_t(2./max2*numcol + 1.)));
|
|---|
| 894 | tt1->SetTextAlign(12);
|
|---|
| 895 | TText *tt2 = pave2->AddText(Form("Low Gain Signals could not be fitted: %3i pixels",
|
|---|
| 896 | CountBadPixels(&disp25,3)));
|
|---|
| 897 | tt2->SetTextColor(gStyle->GetColorPalette(Int_t(3./max2*numcol + 1.)));
|
|---|
| 898 | tt2->SetTextAlign(12);
|
|---|
| 899 | TText *tt3 = pave2->AddText(Form("Relative Arr. Times could not be fitted: %3i pixels",
|
|---|
| 900 | CountBadPixels(&disp25,4)));
|
|---|
| 901 | tt3->SetTextColor(gStyle->GetColorPalette(Int_t(4./max2*numcol + 1.)));
|
|---|
| 902 | tt3->SetTextAlign(12);
|
|---|
| 903 | TText *tt4 = pave2->AddText(Form("High Gain Signals Oscillation: %3i pixels",
|
|---|
| 904 | CountBadPixels(&disp25,5)));
|
|---|
| 905 | tt4->SetTextColor(gStyle->GetColorPalette(Int_t(5./max2*numcol + 1.)));
|
|---|
| 906 | tt4->SetTextAlign(12);
|
|---|
| 907 | TText *tt5 = pave2->AddText(Form("Low Gain Signals Oscillation: %3i pixels",
|
|---|
| 908 | CountBadPixels(&disp25,6)));
|
|---|
| 909 | tt5->SetTextColor(gStyle->GetColorPalette(Int_t(6./max2*numcol + 1.)));
|
|---|
| 910 | tt5->SetTextAlign(12);
|
|---|
| 911 | TText *tt6 = pave2->AddText(Form("Relative Arr. Times Oscillation: %3i pixels",
|
|---|
| 912 | CountBadPixels(&disp25,7)));
|
|---|
| 913 | tt6->SetTextColor(gStyle->GetColorPalette(Int_t(7./max2*numcol + 1.)));
|
|---|
| 914 | tt6->SetTextAlign(12);
|
|---|
| 915 | pave2->Draw();
|
|---|
| 916 |
|
|---|
| 917 | c4.cd(4);
|
|---|
| 918 | gPad->SetBorderMode(0);
|
|---|
| 919 | obj9->SetPrettyPalette();
|
|---|
| 920 | obj9->Draw();
|
|---|
| 921 |
|
|---|
| 922 | if (IsRelTimes())
|
|---|
| 923 | {
|
|---|
| 924 | TCanvas &c5 = fDisplay->AddTab("Rel. Times");
|
|---|
| 925 | c5.Divide(2,3);
|
|---|
| 926 |
|
|---|
| 927 | //
|
|---|
| 928 | // MEAN REL. ARR. TIMES
|
|---|
| 929 | //
|
|---|
| 930 | c5.cd(1);
|
|---|
| 931 | gPad->SetBorderMode(0);
|
|---|
| 932 | gPad->SetTicks();
|
|---|
| 933 | MHCamera *obj10=(MHCamera*)disp30.DrawCopy("hist");
|
|---|
| 934 | //
|
|---|
| 935 | // for the datacheck, fix the ranges!!
|
|---|
| 936 | //
|
|---|
| 937 | // obj10->SetMinimum(fgConvFADC2PheMin);
|
|---|
| 938 | // obj10->SetMaximum(fgConvFADC2PheMax);
|
|---|
| 939 | //
|
|---|
| 940 | // Set the datacheck sizes:
|
|---|
| 941 | //
|
|---|
| 942 | FixDataCheckHist((TH1D*)obj10);
|
|---|
| 943 | obj10->SetStats(kFALSE);
|
|---|
| 944 | //
|
|---|
| 945 | // set reference lines
|
|---|
| 946 | //
|
|---|
| 947 | // DisplayReferenceLines(obj10,2);
|
|---|
| 948 |
|
|---|
| 949 | c5.cd(3);
|
|---|
| 950 | gPad->SetBorderMode(0);
|
|---|
| 951 | obj10->SetPrettyPalette();
|
|---|
| 952 | obj10->Draw();
|
|---|
| 953 |
|
|---|
| 954 | c5.cd(5);
|
|---|
| 955 | gPad->SetBorderMode(0);
|
|---|
| 956 | if (geomcam.InheritsFrom("MGeomCamMagic"))
|
|---|
| 957 | DisplayDoubleProject(&disp30, "early", "late");
|
|---|
| 958 |
|
|---|
| 959 | //
|
|---|
| 960 | // JITTER Rel. Arr. Times
|
|---|
| 961 | //
|
|---|
| 962 | c5.cd(2);
|
|---|
| 963 | gPad->SetBorderMode(0);
|
|---|
| 964 | gPad->SetTicks();
|
|---|
| 965 | MHCamera *obj11=(MHCamera*)disp31.DrawCopy("hist");
|
|---|
| 966 | //
|
|---|
| 967 | // for the datacheck, fix the ranges!!
|
|---|
| 968 | //
|
|---|
| 969 | // obj11->SetMinimum(fgQEMin);
|
|---|
| 970 | // obj11->SetMaximum(fgQEMax);
|
|---|
| 971 | //
|
|---|
| 972 | // Set the datacheck sizes:
|
|---|
| 973 | //
|
|---|
| 974 | FixDataCheckHist((TH1D*)obj11);
|
|---|
| 975 | obj11->SetStats(kFALSE);
|
|---|
| 976 | //
|
|---|
| 977 | // set reference lines
|
|---|
| 978 | //
|
|---|
| 979 | // DisplayReferenceLines(obj11,0);
|
|---|
| 980 |
|
|---|
| 981 | c5.cd(4);
|
|---|
| 982 | gPad->SetBorderMode(0);
|
|---|
| 983 | obj11->SetPrettyPalette();
|
|---|
| 984 | obj11->Draw();
|
|---|
| 985 |
|
|---|
| 986 | c5.cd(6);
|
|---|
| 987 | gPad->SetBorderMode(0);
|
|---|
| 988 | if (geomcam.InheritsFrom("MGeomCamMagic"))
|
|---|
| 989 | DisplayDoubleProject(&disp31, "too stable", "jittering");
|
|---|
| 990 |
|
|---|
| 991 | }
|
|---|
| 992 | return;
|
|---|
| 993 | }
|
|---|
| 994 |
|
|---|
| 995 | if (fDisplayType == kNormalDisplay)
|
|---|
| 996 | {
|
|---|
| 997 |
|
|---|
| 998 | // Charges
|
|---|
| 999 | TCanvas &c11 = fDisplay->AddTab("Fit.Charge");
|
|---|
| 1000 | c11.Divide(2, 4);
|
|---|
| 1001 |
|
|---|
| 1002 | disp1.CamDraw(c11, 1, 2, 5, 1);
|
|---|
| 1003 | disp2.CamDraw(c11, 2, 2, 5, 1);
|
|---|
| 1004 |
|
|---|
| 1005 | // Reduced Sigmas
|
|---|
| 1006 | TCanvas &c12 = fDisplay->AddTab("Red.Sigma");
|
|---|
| 1007 | c12.Divide(2,4);
|
|---|
| 1008 |
|
|---|
| 1009 | disp3.CamDraw(c12, 1, 2, 5, 1);
|
|---|
| 1010 | disp4.CamDraw(c12, 2, 2, 5, 1);
|
|---|
| 1011 |
|
|---|
| 1012 | // F-Factor
|
|---|
| 1013 | TCanvas &c13 = fDisplay->AddTab("Phe's");
|
|---|
| 1014 | c13.Divide(3,4);
|
|---|
| 1015 |
|
|---|
| 1016 | disp5.CamDraw(c13, 1, 3, 5, 1);
|
|---|
| 1017 | disp6.CamDraw(c13, 2, 3, 5, 1);
|
|---|
| 1018 | disp7.CamDraw(c13, 3, 3, 5, 1);
|
|---|
| 1019 |
|
|---|
| 1020 | // QE's
|
|---|
| 1021 | TCanvas &c14 = fDisplay->AddTab("QE's");
|
|---|
| 1022 | c14.Divide(4,4);
|
|---|
| 1023 |
|
|---|
| 1024 | disp8.CamDraw(c14, 1, 4, 5, 1);
|
|---|
| 1025 | disp9.CamDraw(c14, 2, 4, 5, 1);
|
|---|
| 1026 | disp10.CamDraw(c14, 3, 4, 5, 1);
|
|---|
| 1027 | disp11.CamDraw(c14, 4, 4, 5, 1);
|
|---|
| 1028 |
|
|---|
| 1029 | // Defects
|
|---|
| 1030 | TCanvas &c15 = fDisplay->AddTab("Defect");
|
|---|
| 1031 | // c15.Divide(5,2);
|
|---|
| 1032 | c15.Divide(4,2);
|
|---|
| 1033 |
|
|---|
| 1034 | /*
|
|---|
| 1035 | disp23.CamDraw(c15, 1, 5, 0);
|
|---|
| 1036 | disp24.CamDraw(c15, 2, 5, 0);
|
|---|
| 1037 | disp25.CamDraw(c15, 3, 5, 0);
|
|---|
| 1038 | disp26.CamDraw(c15, 4, 5, 0);
|
|---|
| 1039 | disp27.CamDraw(c15, 5, 5, 0);
|
|---|
| 1040 | */
|
|---|
| 1041 | disp24.CamDraw(c15, 1, 4, 0);
|
|---|
| 1042 | disp25.CamDraw(c15, 2, 4, 0);
|
|---|
| 1043 | disp26.CamDraw(c15, 3, 4, 0);
|
|---|
| 1044 | disp27.CamDraw(c15, 4, 4, 0);
|
|---|
| 1045 |
|
|---|
| 1046 | // Abs. Times
|
|---|
| 1047 | TCanvas &c16 = fDisplay->AddTab("Abs. Times");
|
|---|
| 1048 | c16.Divide(2,3);
|
|---|
| 1049 |
|
|---|
| 1050 | disp28.CamDraw(c16, 1, 2, 5);
|
|---|
| 1051 | disp29.CamDraw(c16, 2, 2, 5);
|
|---|
| 1052 |
|
|---|
| 1053 | if (IsRelTimes())
|
|---|
| 1054 | {
|
|---|
| 1055 | // Rel. Times
|
|---|
| 1056 | TCanvas &c17 = fDisplay->AddTab("Rel. Times");
|
|---|
| 1057 | c17.Divide(2,4);
|
|---|
| 1058 |
|
|---|
| 1059 | disp30.CamDraw(c17, 1, 2, 5, 1);
|
|---|
| 1060 | disp31.CamDraw(c17, 2, 2, 5, 1);
|
|---|
| 1061 | }
|
|---|
| 1062 |
|
|---|
| 1063 | return;
|
|---|
| 1064 | }
|
|---|
| 1065 |
|
|---|
| 1066 | if (fDisplayType == kFullDisplay)
|
|---|
| 1067 | {
|
|---|
| 1068 | MHCalibrationCam *cam = (MHCalibrationCam*)plist.FindObject("MHCalibrationChargeCam");
|
|---|
| 1069 |
|
|---|
| 1070 | for (Int_t sector=1;sector<cam->GetAverageSectors();sector++)
|
|---|
| 1071 | {
|
|---|
| 1072 | cam->GetAverageHiGainSector(sector).DrawClone("all");
|
|---|
| 1073 | cam->GetAverageLoGainSector(sector).DrawClone("all");
|
|---|
| 1074 | }
|
|---|
| 1075 |
|
|---|
| 1076 | // Charges
|
|---|
| 1077 | TCanvas &c21 = fDisplay->AddTab("Fit.Charge");
|
|---|
| 1078 | c21.Divide(2, 4);
|
|---|
| 1079 |
|
|---|
| 1080 | disp1.CamDraw(c21, 1, 2, 2, 1);
|
|---|
| 1081 | disp2.CamDraw(c21, 2, 2, 2, 1);
|
|---|
| 1082 |
|
|---|
| 1083 | // Reduced Sigmas
|
|---|
| 1084 | TCanvas &c23 = fDisplay->AddTab("Red.Sigma");
|
|---|
| 1085 | c23.Divide(2,4);
|
|---|
| 1086 |
|
|---|
| 1087 | disp3.CamDraw(c23, 1, 2, 2, 1);
|
|---|
| 1088 | disp4.CamDraw(c23, 2, 2, 2, 1);
|
|---|
| 1089 |
|
|---|
| 1090 | // F-Factor
|
|---|
| 1091 | TCanvas &c24 = fDisplay->AddTab("Phe's");
|
|---|
| 1092 | c24.Divide(3,5);
|
|---|
| 1093 |
|
|---|
| 1094 | disp5.CamDraw(c24, 1, 3, 2, 1, 1);
|
|---|
| 1095 | disp6.CamDraw(c24, 2, 3, 2, 1, 1);
|
|---|
| 1096 | disp7.CamDraw(c24, 3, 3, 2, 1, 1);
|
|---|
| 1097 |
|
|---|
| 1098 | // QE's
|
|---|
| 1099 | TCanvas &c25 = fDisplay->AddTab("QE's");
|
|---|
| 1100 | c25.Divide(4,5);
|
|---|
| 1101 |
|
|---|
| 1102 | disp8.CamDraw(c25, 1, 4, 2, 1, 1);
|
|---|
| 1103 | disp9.CamDraw(c25, 2, 4, 2, 1, 1);
|
|---|
| 1104 | disp10.CamDraw(c25, 3, 4, 2, 1, 1);
|
|---|
| 1105 | disp11.CamDraw(c25, 4, 4, 2, 1, 1);
|
|---|
| 1106 |
|
|---|
| 1107 | // Validity
|
|---|
| 1108 | TCanvas &c26 = fDisplay->AddTab("Valid");
|
|---|
| 1109 | c26.Divide(4,2);
|
|---|
| 1110 |
|
|---|
| 1111 | disp12.CamDraw(c26, 1, 4, 0);
|
|---|
| 1112 | disp13.CamDraw(c26, 2, 4, 0);
|
|---|
| 1113 | disp14.CamDraw(c26, 3, 4, 0);
|
|---|
| 1114 | disp15.CamDraw(c26, 4, 4, 0);
|
|---|
| 1115 |
|
|---|
| 1116 | // Other info
|
|---|
| 1117 | TCanvas &c27 = fDisplay->AddTab("HiLoGain");
|
|---|
| 1118 | c27.Divide(3,3);
|
|---|
| 1119 |
|
|---|
| 1120 | disp16.CamDraw(c27, 1, 3, 0);
|
|---|
| 1121 | disp17.CamDraw(c27, 2, 3, 1);
|
|---|
| 1122 | disp18.CamDraw(c27, 3, 3, 1);
|
|---|
| 1123 |
|
|---|
| 1124 | // Pickup
|
|---|
| 1125 | TCanvas &c28 = fDisplay->AddTab("Pickup");
|
|---|
| 1126 | c28.Divide(4,2);
|
|---|
| 1127 |
|
|---|
| 1128 | disp19.CamDraw(c28, 1, 4, 0);
|
|---|
| 1129 | disp20.CamDraw(c28, 2, 4, 0);
|
|---|
| 1130 | disp21.CamDraw(c28, 3, 4, 0);
|
|---|
| 1131 | disp22.CamDraw(c28, 4, 4, 0);
|
|---|
| 1132 |
|
|---|
| 1133 | // Defects
|
|---|
| 1134 | TCanvas &c29 = fDisplay->AddTab("Defect");
|
|---|
| 1135 | // c29.Divide(5,2);
|
|---|
| 1136 | c29.Divide(4,2);
|
|---|
| 1137 |
|
|---|
| 1138 | disp24.CamDraw(c29, 1, 4, 0);
|
|---|
| 1139 | disp25.CamDraw(c29, 2, 4, 0);
|
|---|
| 1140 | disp26.CamDraw(c29, 3, 4, 0);
|
|---|
| 1141 | disp27.CamDraw(c29, 4, 4, 0);
|
|---|
| 1142 |
|
|---|
| 1143 | // Abs. Times
|
|---|
| 1144 | TCanvas &c30 = fDisplay->AddTab("Abs. Times");
|
|---|
| 1145 | c30.Divide(2,3);
|
|---|
| 1146 |
|
|---|
| 1147 | disp28.CamDraw(c30, 1, 2, 2);
|
|---|
| 1148 | disp29.CamDraw(c30, 2, 2, 1);
|
|---|
| 1149 |
|
|---|
| 1150 | if (IsRelTimes())
|
|---|
| 1151 | {
|
|---|
| 1152 | // Rel. Times
|
|---|
| 1153 | TCanvas &c31 = fDisplay->AddTab("Rel. Times");
|
|---|
| 1154 | c31.Divide(3,5);
|
|---|
| 1155 |
|
|---|
| 1156 | disp30.CamDraw(c31, 1, 3, 2, 1, 1);
|
|---|
| 1157 | disp31.CamDraw(c31, 2, 3, 2, 1, 1);
|
|---|
| 1158 | disp32.CamDraw(c31, 3, 3, 4, 1, 1);
|
|---|
| 1159 |
|
|---|
| 1160 | // Time Defects
|
|---|
| 1161 | TCanvas &c32 = fDisplay->AddTab("Time Def.");
|
|---|
| 1162 | c32.Divide(2,2);
|
|---|
| 1163 |
|
|---|
| 1164 | disp33.CamDraw(c32, 1, 2, 0);
|
|---|
| 1165 | disp34.CamDraw(c32, 2, 2, 0);
|
|---|
| 1166 |
|
|---|
| 1167 | MHCalibrationCam *cam = (MHCalibrationCam*)plist.FindObject("MHCalibrationRelTimeCam");
|
|---|
| 1168 |
|
|---|
| 1169 | for (Int_t sector=1;sector<cam->GetAverageSectors();sector++)
|
|---|
| 1170 | {
|
|---|
| 1171 | cam->GetAverageHiGainSector(sector).DrawClone("fourierevents");
|
|---|
| 1172 | cam->GetAverageLoGainSector(sector).DrawClone("fourierevents");
|
|---|
| 1173 | }
|
|---|
| 1174 |
|
|---|
| 1175 | }
|
|---|
| 1176 |
|
|---|
| 1177 | return;
|
|---|
| 1178 | }
|
|---|
| 1179 | }
|
|---|
| 1180 |
|
|---|
| 1181 |
|
|---|
| 1182 | void MJCalibration::DisplayReferenceLines(MHCamera *cam, const Int_t what) const
|
|---|
| 1183 | {
|
|---|
| 1184 |
|
|---|
| 1185 | const MGeomCam *geom = cam->GetGeometry();
|
|---|
| 1186 |
|
|---|
| 1187 | Double_t x = geom->InheritsFrom("MGeomCamMagic") ? 397 : cam->GetNbinsX() ;
|
|---|
| 1188 |
|
|---|
| 1189 | TLine line;
|
|---|
| 1190 | line.SetLineStyle(kDashed);
|
|---|
| 1191 | line.SetLineWidth(3);
|
|---|
| 1192 | line.SetLineColor(kBlue);
|
|---|
| 1193 |
|
|---|
| 1194 | TLine *l1 = NULL;
|
|---|
| 1195 |
|
|---|
| 1196 | if (what == 0)
|
|---|
| 1197 | l1 = line.DrawLine(0, fgRefQEInner, x, fgRefQEInner);
|
|---|
| 1198 | else if (what == 1)
|
|---|
| 1199 | l1 = line.DrawLine(0, fgRefConvFADC2PhotInner, x, fgRefConvFADC2PhotInner);
|
|---|
| 1200 | else if (what == 2)
|
|---|
| 1201 | l1 = line.DrawLine(0, fgRefConvFADC2PheInner, x, fgRefConvFADC2PheInner );
|
|---|
| 1202 | else if (what == 3)
|
|---|
| 1203 | l1 = line.DrawLine(0, fgRefArrivalTimeInner, x, fgRefArrivalTimeInner );
|
|---|
| 1204 | else if (what == 4)
|
|---|
| 1205 | l1 = line.DrawLine(0, fgRefArrivalTimeRmsInner, x, fgRefArrivalTimeRmsInner );
|
|---|
| 1206 |
|
|---|
| 1207 | if (geom->InheritsFrom("MGeomCamMagic"))
|
|---|
| 1208 | {
|
|---|
| 1209 | const Double_t x2 = cam->GetNbinsX();
|
|---|
| 1210 |
|
|---|
| 1211 | switch (what)
|
|---|
| 1212 | {
|
|---|
| 1213 | case 0:
|
|---|
| 1214 | line.DrawLine(x2, fgRefQEOuter, 398, fgRefQEOuter);
|
|---|
| 1215 | break;
|
|---|
| 1216 | case 1:
|
|---|
| 1217 | line.DrawLine(x2, fgRefConvFADC2PhotOuter, 398, fgRefConvFADC2PhotOuter );
|
|---|
| 1218 | break;
|
|---|
| 1219 | case 2:
|
|---|
| 1220 | line.DrawLine(x2, fgRefConvFADC2PheOuter, 398, fgRefConvFADC2PheOuter);
|
|---|
| 1221 | break;
|
|---|
| 1222 | case 3:
|
|---|
| 1223 | line.DrawLine(x2, fgRefArrivalTimeOuter, 398, fgRefArrivalTimeOuter);
|
|---|
| 1224 | break;
|
|---|
| 1225 | case 4:
|
|---|
| 1226 | line.DrawLine(x2, fgRefArrivalTimeRmsOuter, 398, fgRefArrivalTimeRmsOuter);
|
|---|
| 1227 | break;
|
|---|
| 1228 | }
|
|---|
| 1229 | }
|
|---|
| 1230 |
|
|---|
| 1231 | TLegend *leg = new TLegend(what ? 0.2 : 0.6,0.75,what ? 0.5 : 0.9 ,0.85);
|
|---|
| 1232 | leg->SetBit(kCanDelete);
|
|---|
| 1233 | leg->AddEntry(l1, "Reference","l");
|
|---|
| 1234 | leg->Draw();
|
|---|
| 1235 | }
|
|---|
| 1236 |
|
|---|
| 1237 | void MJCalibration::DisplayOutliers(TH1D *hist, const char* whatsmall, const char* whatbig) const
|
|---|
| 1238 | {
|
|---|
| 1239 |
|
|---|
| 1240 | const Int_t kNotDraw = 1<<9;
|
|---|
| 1241 | TF1 *f = hist->GetFunction("gaus");
|
|---|
| 1242 | f->ResetBit(kNotDraw);
|
|---|
| 1243 |
|
|---|
| 1244 | const Float_t mean = f->GetParameter(1);
|
|---|
| 1245 | const Float_t lolim = mean - 4.0*f->GetParameter(2);
|
|---|
| 1246 | const Float_t uplim = mean + 4.0*f->GetParameter(2);
|
|---|
| 1247 | const Stat_t dead = hist->Integral(0,hist->FindBin(lolim)-1);
|
|---|
| 1248 | const Stat_t noisy = hist->Integral(hist->FindBin(uplim)+1,hist->GetNbinsX()+1);
|
|---|
| 1249 |
|
|---|
| 1250 | const Double_t max = hist->GetBinContent(hist->GetMaximumBin());
|
|---|
| 1251 |
|
|---|
| 1252 | const Double_t minl = hist->GetBinCenter(hist->GetXaxis()->GetFirst());
|
|---|
| 1253 | const Double_t maxl = hist->GetBinCenter(hist->GetXaxis()->GetLast());
|
|---|
| 1254 |
|
|---|
| 1255 | TLatex deadtex;
|
|---|
| 1256 | deadtex.SetTextSize(0.07);
|
|---|
| 1257 | deadtex.DrawLatex(minl+0.015*(maxl-minl),max/1.1,
|
|---|
| 1258 | Form("%3i %s pixels",(Int_t)dead,whatsmall));
|
|---|
| 1259 |
|
|---|
| 1260 | TLatex noisytex;
|
|---|
| 1261 | noisytex.SetTextSize(0.07);
|
|---|
| 1262 | noisytex.DrawLatex(minl+0.015*(maxl-minl),max/1.2,
|
|---|
| 1263 | Form("%3i %s pixels",(Int_t)noisy,whatbig));
|
|---|
| 1264 |
|
|---|
| 1265 | }
|
|---|
| 1266 |
|
|---|
| 1267 | void MJCalibration::FixDataCheckHist(TH1D *hist) const
|
|---|
| 1268 | {
|
|---|
| 1269 |
|
|---|
| 1270 | hist->SetDirectory(NULL);
|
|---|
| 1271 |
|
|---|
| 1272 | //
|
|---|
| 1273 | // set the labels bigger
|
|---|
| 1274 | //
|
|---|
| 1275 | TAxis *xaxe = hist->GetXaxis();
|
|---|
| 1276 | TAxis *yaxe = hist->GetYaxis();
|
|---|
| 1277 |
|
|---|
| 1278 | xaxe->CenterTitle();
|
|---|
| 1279 | yaxe->CenterTitle();
|
|---|
| 1280 | xaxe->SetTitleSize(0.06);
|
|---|
| 1281 | yaxe->SetTitleSize(0.06);
|
|---|
| 1282 | xaxe->SetTitleOffset(0.8);
|
|---|
| 1283 | yaxe->SetTitleOffset(0.85);
|
|---|
| 1284 | xaxe->SetLabelSize(0.05);
|
|---|
| 1285 | yaxe->SetLabelSize(0.05);
|
|---|
| 1286 |
|
|---|
| 1287 | }
|
|---|
| 1288 |
|
|---|
| 1289 | const Int_t MJCalibration::CountBadPixels ( MHCamera *cam , const Int_t what ) const
|
|---|
| 1290 | {
|
|---|
| 1291 |
|
|---|
| 1292 | Int_t cnt = 0;
|
|---|
| 1293 |
|
|---|
| 1294 | for (UInt_t pix=0; pix<cam->GetNumPixels();pix++)
|
|---|
| 1295 | if ((Int_t)cam->GetPixContent(pix) == what)
|
|---|
| 1296 | cnt++;
|
|---|
| 1297 |
|
|---|
| 1298 | return cnt;
|
|---|
| 1299 | }
|
|---|
| 1300 |
|
|---|
| 1301 | // --------------------------------------------------------------------------
|
|---|
| 1302 | //
|
|---|
| 1303 | // Retrieve the output file written by WriteResult()
|
|---|
| 1304 | //
|
|---|
| 1305 | const char* MJCalibration::GetOutputFile() const
|
|---|
| 1306 | {
|
|---|
| 1307 | if (fSequence.IsValid())
|
|---|
| 1308 | return Form("%s/calib%06d.root", (const char*)fPathOut, fSequence.GetSequence());
|
|---|
| 1309 | if (!fRuns)
|
|---|
| 1310 | return "";
|
|---|
| 1311 |
|
|---|
| 1312 | return Form("%s/%s-F1.root", (const char*)fPathOut, (const char*)fRuns->GetRunsAsFileName());
|
|---|
| 1313 | }
|
|---|
| 1314 |
|
|---|
| 1315 | // --------------------------------------------------------------------------
|
|---|
| 1316 | //
|
|---|
| 1317 | // MJCalibration allows to setup several option by a resource file:
|
|---|
| 1318 | // MJCalibration.Display: full, datacheck, normal
|
|---|
| 1319 | // MJCalibration.RelTimeCalibration: yes,no
|
|---|
| 1320 | // MJCalibration.Datacheck: yes,no
|
|---|
| 1321 | // MJCalibration.Debug: yes,no
|
|---|
| 1322 | // MJCalibration.Intensity: yes,no
|
|---|
| 1323 | // MJCalibration.UseBlindPixel: yes,no
|
|---|
| 1324 | // MJCalibration.UsePINDiode: yes,no
|
|---|
| 1325 | // MJCalibration.Geometry: MGeomCamMagic, MGeomCamECO1000
|
|---|
| 1326 | //
|
|---|
| 1327 | // For more details see the class description and the corresponding Getters
|
|---|
| 1328 | //
|
|---|
| 1329 | Bool_t MJCalibration::CheckEnvLocal()
|
|---|
| 1330 | {
|
|---|
| 1331 | TString dis = GetEnv("Display", "");
|
|---|
| 1332 | if (dis.BeginsWith("Full", TString::kIgnoreCase))
|
|---|
| 1333 | SetFullDisplay();
|
|---|
| 1334 | if (dis.BeginsWith("DataCheck", TString::kIgnoreCase))
|
|---|
| 1335 | SetDataCheckDisplay();
|
|---|
| 1336 | if (dis.BeginsWith("Normal", TString::kIgnoreCase))
|
|---|
| 1337 | SetNormalDisplay();
|
|---|
| 1338 |
|
|---|
| 1339 | SetRelTimeCalibration(GetEnv("RelTimeCalibration", IsRelTimes()));
|
|---|
| 1340 | SetIntensity(GetEnv("IntensityCalibration", IsIntensity()));
|
|---|
| 1341 | SetDataCheck(GetEnv("Datacheck", IsDataCheck()));
|
|---|
| 1342 | SetDebug(GetEnv("Debug", IsDebug()));
|
|---|
| 1343 |
|
|---|
| 1344 | SetUseBlindPixel(GetEnv("UseBlindPixel", IsUseBlindPixel()));
|
|---|
| 1345 | SetUsePINDiode(GetEnv("UsePINDiode", IsUsePINDiode()));
|
|---|
| 1346 | SetGeometry(GetEnv("Geometry", fGeometry));
|
|---|
| 1347 |
|
|---|
| 1348 | return kTRUE;
|
|---|
| 1349 | }
|
|---|
| 1350 |
|
|---|
| 1351 | // --------------------------------------------------------------------------
|
|---|
| 1352 | //
|
|---|
| 1353 | // Call the ProcessFile(MPedestalCam)
|
|---|
| 1354 | //
|
|---|
| 1355 | Bool_t MJCalibration::Process(MPedestalCam &pedcam)
|
|---|
| 1356 | {
|
|---|
| 1357 | if (!ReadCalibrationCam())
|
|---|
| 1358 | return ProcessFile(pedcam);
|
|---|
| 1359 |
|
|---|
| 1360 | return kTRUE;
|
|---|
| 1361 | }
|
|---|
| 1362 |
|
|---|
| 1363 | void MJCalibration::InitBlindPixel(MExtractBlindPixel &blindext,
|
|---|
| 1364 | MHCalibrationChargeBlindCam &blindcam)
|
|---|
| 1365 | {
|
|---|
| 1366 |
|
|---|
| 1367 | Int_t run = fSequence.IsValid() ? fSequence.GetLastRun() : fRuns->GetRuns()[fRuns->GetNumRuns()-1];
|
|---|
| 1368 |
|
|---|
| 1369 | //
|
|---|
| 1370 | // Initialize the blind pixel. Unfortunately, there is a hardware difference
|
|---|
| 1371 | // in the first blind pixel until run "gkSecondBlindPixelInstallation" and the
|
|---|
| 1372 | // later setup. The first needs to use a filter because of the length of
|
|---|
| 1373 | // spurious NSB photon signals. The latter get better along extracting the amplitude
|
|---|
| 1374 | // from a small window.
|
|---|
| 1375 | //
|
|---|
| 1376 | if (run < gkSecondBlindPixelInstallation)
|
|---|
| 1377 | {
|
|---|
| 1378 | MCalibrationBlindCamOneOldStyle blindresults;
|
|---|
| 1379 | if (IsIntensity())
|
|---|
| 1380 | blindresults.Copy(*fIntensBlindCam.GetCam());
|
|---|
| 1381 | else
|
|---|
| 1382 | blindresults.Copy(fCalibrationBlindCam);
|
|---|
| 1383 |
|
|---|
| 1384 | blindext.SetExtractionType(MExtractBlindPixel::kIntegral);
|
|---|
| 1385 | blindext.SetExtractionType(MExtractBlindPixel::kFilter);
|
|---|
| 1386 | blindext.SetRange(10,19,0,6);
|
|---|
| 1387 | blindext.SetNSBFilterLimit(70);
|
|---|
| 1388 | }
|
|---|
| 1389 | else if (run < gkThirdBlindPixelInstallation)
|
|---|
| 1390 | {
|
|---|
| 1391 |
|
|---|
| 1392 | MCalibrationBlindCamTwoNewStyle blindresults;
|
|---|
| 1393 |
|
|---|
| 1394 | if (IsIntensity())
|
|---|
| 1395 | blindresults.Copy(*fIntensBlindCam.GetCam());
|
|---|
| 1396 | else
|
|---|
| 1397 | blindresults.Copy(fCalibrationBlindCam);
|
|---|
| 1398 |
|
|---|
| 1399 | blindext.SetNumBlindPixels(blindresults.GetSize());
|
|---|
| 1400 | for (Int_t i=0;i<blindresults.GetSize();i++)
|
|---|
| 1401 | blindext.SetBlindPixelIdx(blindresults[i].GetPixId(),i);
|
|---|
| 1402 |
|
|---|
| 1403 | blindext.SetExtractionType(MExtractBlindPixel::kAmplitude);
|
|---|
| 1404 | blindext.SetExtractionType(MExtractBlindPixel::kFilter);
|
|---|
| 1405 | blindext.SetRange(5,8,0,2);
|
|---|
| 1406 | blindext.SetNSBFilterLimit(38);
|
|---|
| 1407 |
|
|---|
| 1408 | }
|
|---|
| 1409 | else
|
|---|
| 1410 | {
|
|---|
| 1411 | *fLog << err << "Third blind pixel installation not yet completed, check your run number!!! " << endl;
|
|---|
| 1412 | }
|
|---|
| 1413 |
|
|---|
| 1414 | }
|
|---|
| 1415 |
|
|---|
| 1416 | // --------------------------------------------------------------------------
|
|---|
| 1417 | //
|
|---|
| 1418 | // Execute the task list and the eventloop:
|
|---|
| 1419 | //
|
|---|
| 1420 | // - Check if there are fRuns, otherwise return
|
|---|
| 1421 | // - Check the colour of the files in fRuns (FindColor()), otherwise return
|
|---|
| 1422 | // - Check for consistency between run numbers and number of files
|
|---|
| 1423 | // - Add fRuns to MReadMarsFile
|
|---|
| 1424 | // - Put into MParList:
|
|---|
| 1425 | // 1) MPedestalCam (pedcam)
|
|---|
| 1426 | // 2) MCalibrationQECam (fQECam)
|
|---|
| 1427 | // 3) MCalibrationChargeCam (fCalibrationCam)
|
|---|
| 1428 | // 4) MCalibrationRelTimeCam (fRelTimeCam) (only if flag IsRelTimes() is chosen)
|
|---|
| 1429 | // 5) MBadPixelsCam (fBadPixels)
|
|---|
| 1430 | // 6) MCalibrationChargePINDiode
|
|---|
| 1431 | // 7) MCalibrationBlindPix
|
|---|
| 1432 | // - Put into the MTaskList:
|
|---|
| 1433 | // 1) MReadMarsFile
|
|---|
| 1434 | // 2) MBadPixelsMerge
|
|---|
| 1435 | // 3) MGeomApply
|
|---|
| 1436 | // 4) MExtractor
|
|---|
| 1437 | // 5) MExtractPINDiode
|
|---|
| 1438 | // 6) MExtractBlindPixel
|
|---|
| 1439 | // 7) MExtractTime (only if flag IsRelTimes() is chosen)
|
|---|
| 1440 | // 8) MContinue(MFCosmics)
|
|---|
| 1441 | // 9) MFillH("MHCalibrationChargePINDiode", "MExtractedSignalPINDiode", "FillPINDiode")
|
|---|
| 1442 | // 10) MFillH("MHCalibrationChargeBlindCam", "MExtractedSignalBlindPixel", "FillBlindCam")
|
|---|
| 1443 | // 11) MFillH("MHCalibrationChargeCam", "MExtractedSignalCam", "FillChargeCam")
|
|---|
| 1444 | // 12) MFillH("MHCalibrationChargeCam", "MExtractedSignalCam", "FillRelTime")
|
|---|
| 1445 | // 13) MCalibrationChargeCalc
|
|---|
| 1446 | // 14) MFillH("MHCalibrationRelTimeCam", "MArrivalTimeCam") (only if flag IsRelTimes() is chosen)
|
|---|
| 1447 | // 15) MCalibrationRelTimeCalc
|
|---|
| 1448 | // - Execute MEvtLoop
|
|---|
| 1449 | // - DisplayResult()
|
|---|
| 1450 | // - WriteResult()
|
|---|
| 1451 | //
|
|---|
| 1452 | Bool_t MJCalibration::ProcessFile(MPedestalCam &pedcam)
|
|---|
| 1453 | {
|
|---|
| 1454 | if (!fSequence.IsValid())
|
|---|
| 1455 | {
|
|---|
| 1456 | if (!fRuns)
|
|---|
| 1457 | {
|
|---|
| 1458 | *fLog << err << "No Runs choosen... abort." << endl;
|
|---|
| 1459 | return kFALSE;
|
|---|
| 1460 | }
|
|---|
| 1461 |
|
|---|
| 1462 | if (fRuns->GetNumRuns() != fRuns->GetNumEntries())
|
|---|
| 1463 | {
|
|---|
| 1464 | *fLog << err << "Number of files found doesn't match number of runs... abort."
|
|---|
| 1465 | << fRuns->GetNumRuns() << " vs. " << fRuns->GetNumEntries() << endl;
|
|---|
| 1466 | return kFALSE;
|
|---|
| 1467 | }
|
|---|
| 1468 | }
|
|---|
| 1469 |
|
|---|
| 1470 | //if (!CheckEnv())
|
|---|
| 1471 | // return kFALSE;
|
|---|
| 1472 |
|
|---|
| 1473 | CheckEnv();
|
|---|
| 1474 |
|
|---|
| 1475 | // --------------------------------------------------------------------------------
|
|---|
| 1476 |
|
|---|
| 1477 | *fLog << inf;
|
|---|
| 1478 | fLog->Separator(GetDescriptor());
|
|---|
| 1479 |
|
|---|
| 1480 | *fLog << "Calculate MCalibrationCam from ";
|
|---|
| 1481 | if (fSequence.IsValid())
|
|---|
| 1482 | *fLog << "Sequence #" << fSequence.GetSequence() << endl;
|
|---|
| 1483 | else
|
|---|
| 1484 | *fLog << "Runs " << fRuns->GetRunsAsString() << endl;
|
|---|
| 1485 | *fLog << endl;
|
|---|
| 1486 |
|
|---|
| 1487 | // --------------------------------------------------------------------------------
|
|---|
| 1488 |
|
|---|
| 1489 | // Setup Tasklist
|
|---|
| 1490 | MParList plist;
|
|---|
| 1491 | MTaskList tlist;
|
|---|
| 1492 | plist.AddToList(&tlist);
|
|---|
| 1493 | plist.AddToList(this); // take care of fDisplay!
|
|---|
| 1494 |
|
|---|
| 1495 | MDirIter iter;
|
|---|
| 1496 | if (fSequence.IsValid())
|
|---|
| 1497 | {
|
|---|
| 1498 | const Int_t n0 = fSequence.SetupCalRuns(iter, fPathData);
|
|---|
| 1499 | const Int_t n1 = fSequence.GetNumCalRuns();
|
|---|
| 1500 | if (n0==0)
|
|---|
| 1501 | {
|
|---|
| 1502 | *fLog << err << "ERROR - No input files of sequence found!" << endl;
|
|---|
| 1503 | return kFALSE;
|
|---|
| 1504 | }
|
|---|
| 1505 | if (n0!=n1)
|
|---|
| 1506 | {
|
|---|
| 1507 | *fLog << err << "ERROR - Number of files found ("
|
|---|
| 1508 | << n0 << ") doesn't match number of files in sequence ("
|
|---|
| 1509 | << n1 << ")" << endl;
|
|---|
| 1510 | return kFALSE;
|
|---|
| 1511 | }
|
|---|
| 1512 | }
|
|---|
| 1513 |
|
|---|
| 1514 | //
|
|---|
| 1515 | // Input containers
|
|---|
| 1516 | //
|
|---|
| 1517 | plist.AddToList(&pedcam);
|
|---|
| 1518 | plist.AddToList(&fBadPixels);
|
|---|
| 1519 |
|
|---|
| 1520 | //
|
|---|
| 1521 | // Calibration Results containers
|
|---|
| 1522 | //
|
|---|
| 1523 | if (IsIntensity())
|
|---|
| 1524 | {
|
|---|
| 1525 | plist.AddToList(&fIntensQECam);
|
|---|
| 1526 | plist.AddToList(&fIntensCalibCam);
|
|---|
| 1527 | plist.AddToList(&fIntensBlindCam);
|
|---|
| 1528 | // plist.AddToList(&fIntensCalibrationPINDiode);
|
|---|
| 1529 | plist.AddToList(&fIntensRelTimeCam);
|
|---|
| 1530 | plist.AddToList(&fIntensBadCam);
|
|---|
| 1531 | }
|
|---|
| 1532 | else
|
|---|
| 1533 | {
|
|---|
| 1534 | plist.AddToList(&fQECam);
|
|---|
| 1535 | plist.AddToList(&fCalibrationCam);
|
|---|
| 1536 | plist.AddToList(&fCalibrationBlindCam);
|
|---|
| 1537 | plist.AddToList(&fCalibrationPINDiode);
|
|---|
| 1538 | plist.AddToList(&fRelTimeCam);
|
|---|
| 1539 | }
|
|---|
| 1540 |
|
|---|
| 1541 | //
|
|---|
| 1542 | // Initialize two histogram containers which could be modified in this class
|
|---|
| 1543 | //
|
|---|
| 1544 | MHCalibrationRelTimeCam reltimecam;
|
|---|
| 1545 | MHCalibrationChargeCam chargecam;
|
|---|
| 1546 | MHCalibrationChargeBlindCam blindcam;
|
|---|
| 1547 | plist.AddToList(&chargecam);
|
|---|
| 1548 | plist.AddToList(&blindcam);
|
|---|
| 1549 | if (IsRelTimes())
|
|---|
| 1550 | plist.AddToList(&reltimecam);
|
|---|
| 1551 | //
|
|---|
| 1552 | // Data Reading tasks
|
|---|
| 1553 | //
|
|---|
| 1554 | MReadMarsFile read("Events");
|
|---|
| 1555 | MRawFileRead rawread(NULL);
|
|---|
| 1556 |
|
|---|
| 1557 | if (IsDataCheck())
|
|---|
| 1558 | {
|
|---|
| 1559 | rawread.AddFiles(fSequence.IsValid() ? iter : *fRuns);
|
|---|
| 1560 | tlist.AddToList(&rawread);
|
|---|
| 1561 | }
|
|---|
| 1562 | else
|
|---|
| 1563 | {
|
|---|
| 1564 | read.DisableAutoScheme();
|
|---|
| 1565 | read.AddFiles(fSequence.IsValid() ? iter : *fRuns);
|
|---|
| 1566 | tlist.AddToList(&read);
|
|---|
| 1567 | }
|
|---|
| 1568 |
|
|---|
| 1569 | //
|
|---|
| 1570 | // Other Tasks
|
|---|
| 1571 | //
|
|---|
| 1572 | MGeomApply apply;
|
|---|
| 1573 | apply.SetGeometry(fGeometry);
|
|---|
| 1574 | MBadPixelsMerge merge(&fBadPixels);
|
|---|
| 1575 | MExtractPINDiode pinext;
|
|---|
| 1576 | MExtractBlindPixel blindext;
|
|---|
| 1577 |
|
|---|
| 1578 | InitBlindPixel(blindext, blindcam);
|
|---|
| 1579 |
|
|---|
| 1580 | MExtractSlidingWindow extract2;
|
|---|
| 1581 | MExtractTimeFastSpline timespline;
|
|---|
| 1582 | MCalibrationChargeCalc calcalc;
|
|---|
| 1583 | MCalibrationRelTimeCalc timecalc;
|
|---|
| 1584 |
|
|---|
| 1585 | if (!fSequence.IsValid())
|
|---|
| 1586 | {
|
|---|
| 1587 | calcalc.SetOutputPath(fPathOut);
|
|---|
| 1588 | calcalc.SetOutputFile(Form("%s-ChargeCalibStat.txt",(const char*)fRuns->GetRunsAsFileName()));
|
|---|
| 1589 | }
|
|---|
| 1590 |
|
|---|
| 1591 | if (IsDebug())
|
|---|
| 1592 | {
|
|---|
| 1593 | chargecam.SetDebug();
|
|---|
| 1594 | calcalc.SetDebug();
|
|---|
| 1595 | }
|
|---|
| 1596 |
|
|---|
| 1597 | //
|
|---|
| 1598 | // Calibration histogramming
|
|---|
| 1599 | //
|
|---|
| 1600 | MFillH fillpin("MHCalibrationChargePINDiode", "MExtractedSignalPINDiode", "FillPINDiode");
|
|---|
| 1601 | MFillH fillbnd("MHCalibrationChargeBlindCam", "MExtractedSignalBlindPixel", "FillBlindCam");
|
|---|
| 1602 | MFillH fillcam("MHCalibrationChargeCam", "MExtractedSignalCam", "FillChargeCam");
|
|---|
| 1603 | MFillH filltme("MHCalibrationRelTimeCam", "MArrivalTimeCam", "FillRelTime");
|
|---|
| 1604 | fillpin.SetNameTab("PINDiode");
|
|---|
| 1605 | fillbnd.SetNameTab("BlindPix");
|
|---|
| 1606 | fillcam.SetNameTab("Charge");
|
|---|
| 1607 | filltme.SetNameTab("RelTimes");
|
|---|
| 1608 |
|
|---|
| 1609 | TString drawoption;
|
|---|
| 1610 |
|
|---|
| 1611 | if (fDisplayType == kDataCheckDisplay)
|
|---|
| 1612 | drawoption += "datacheck";
|
|---|
| 1613 | if (fDisplayType == kFullDisplay)
|
|---|
| 1614 | drawoption += "all";
|
|---|
| 1615 |
|
|---|
| 1616 | fillcam.SetDrawOption(drawoption.Data());
|
|---|
| 1617 | fillbnd.SetDrawOption(drawoption.Data());
|
|---|
| 1618 | fillpin.SetDrawOption(drawoption.Data());
|
|---|
| 1619 | filltme.SetDrawOption(drawoption.Data());
|
|---|
| 1620 |
|
|---|
| 1621 | //
|
|---|
| 1622 | // Apply a filter against cosmics
|
|---|
| 1623 | // (will have to be needed in the future
|
|---|
| 1624 | // when the calibration hardware-trigger is working)
|
|---|
| 1625 | //
|
|---|
| 1626 | MFCosmics cosmics;
|
|---|
| 1627 | MContinue cont(&cosmics);
|
|---|
| 1628 |
|
|---|
| 1629 | MTaskEnv taskenv("ExtractSignal");
|
|---|
| 1630 | taskenv.SetDefault(fExtractor ? fExtractor : &extract2);
|
|---|
| 1631 |
|
|---|
| 1632 | tlist.AddToList(&merge);
|
|---|
| 1633 | tlist.AddToList(&apply);
|
|---|
| 1634 | tlist.AddToList(&taskenv);
|
|---|
| 1635 | tlist.AddToList(&pinext);
|
|---|
| 1636 | tlist.AddToList(&blindext);
|
|---|
| 1637 |
|
|---|
| 1638 | MTaskEnv taskenv2("ExtractTime");
|
|---|
| 1639 | taskenv2.SetDefault(fTimeExtractor ? fTimeExtractor : ×pline);
|
|---|
| 1640 |
|
|---|
| 1641 | if (IsRelTimes())
|
|---|
| 1642 | tlist.AddToList(&taskenv2);
|
|---|
| 1643 |
|
|---|
| 1644 | //
|
|---|
| 1645 | // FIXME: This is not yet implemented in the classes!!!
|
|---|
| 1646 | //
|
|---|
| 1647 | if (fColor == MCalibrationCam::kCT1)
|
|---|
| 1648 | tlist.AddToList(&cont);
|
|---|
| 1649 |
|
|---|
| 1650 | MCalibColorSet colorset;
|
|---|
| 1651 | tlist.AddToList(&colorset);
|
|---|
| 1652 |
|
|---|
| 1653 | MCalibColorSteer steer;
|
|---|
| 1654 | if (IsIntensity())
|
|---|
| 1655 | tlist.AddToList(&steer);
|
|---|
| 1656 |
|
|---|
| 1657 | tlist.AddToList(&fillcam);
|
|---|
| 1658 |
|
|---|
| 1659 | if (IsRelTimes())
|
|---|
| 1660 | {
|
|---|
| 1661 | tlist.AddToList(&filltme);
|
|---|
| 1662 | tlist.AddToList(&timecalc);
|
|---|
| 1663 | }
|
|---|
| 1664 |
|
|---|
| 1665 | if (IsUseBlindPixel())
|
|---|
| 1666 | tlist.AddToList(&fillbnd);
|
|---|
| 1667 | if (IsUsePINDiode())
|
|---|
| 1668 | tlist.AddToList(&fillpin);
|
|---|
| 1669 |
|
|---|
| 1670 | tlist.AddToList(&calcalc);
|
|---|
| 1671 |
|
|---|
| 1672 | // Create and setup the eventloop
|
|---|
| 1673 | MEvtLoop evtloop(fName);
|
|---|
| 1674 | evtloop.SetParList(&plist);
|
|---|
| 1675 | evtloop.SetDisplay(fDisplay);
|
|---|
| 1676 | evtloop.SetLogStream(fLog);
|
|---|
| 1677 | if (!SetupEnv(evtloop))
|
|---|
| 1678 | return kFALSE;
|
|---|
| 1679 |
|
|---|
| 1680 | if (!taskenv.GetTask() && !taskenv2.GetTask())
|
|---|
| 1681 | {
|
|---|
| 1682 | *fLog << err << "ERROR - Neither ExtractSignal nor ExtractTime initialized or both '<dummy>'." << endl;
|
|---|
| 1683 | return kFALSE;
|
|---|
| 1684 | }
|
|---|
| 1685 |
|
|---|
| 1686 | if (!WriteTasks(taskenv.GetTask(), taskenv2.GetTask()))
|
|---|
| 1687 | return kFALSE;
|
|---|
| 1688 |
|
|---|
| 1689 | // Execute first analysis
|
|---|
| 1690 | if (!evtloop.Eventloop())
|
|---|
| 1691 | {
|
|---|
| 1692 | *fLog << err << GetDescriptor() << ": Failed." << endl;
|
|---|
| 1693 | return kFALSE;
|
|---|
| 1694 | }
|
|---|
| 1695 |
|
|---|
| 1696 | tlist.PrintStatistics();
|
|---|
| 1697 |
|
|---|
| 1698 | //
|
|---|
| 1699 | // The next lines are necessary in order to avoid that
|
|---|
| 1700 | // the last entry drawn by MFillH gets deleted again from
|
|---|
| 1701 | // the display. No idea where this comes from...
|
|---|
| 1702 | //
|
|---|
| 1703 | // FIND THE REASON! THE NEXT CHANGE SOMEBODY DOES MIGHT RESULT
|
|---|
| 1704 | // IN __YOUR__ WORKAROUN NOT WORKING IF IT IS NOT CLEANLY DONE!
|
|---|
| 1705 | //
|
|---|
| 1706 | // THE AUTHOR OF MFILLH SHOULD FIND THE REASON INSTEAD OF DELETING
|
|---|
| 1707 | // CODE WITHOUT INFORMING THE DATACHECK PEOPLE - SORRY, I SPENT
|
|---|
| 1708 | // TOO MANY DAYS TRYING TO FIND THIS REASON!
|
|---|
| 1709 | //
|
|---|
| 1710 | // There is NO BUG-REPORT! And no code has been deleted! And
|
|---|
| 1711 | // there is NO hint who wrote this work around and should
|
|---|
| 1712 | // be informed! Maybe the author of a WORKAROUND should contact
|
|---|
| 1713 | // the author of a class which he/she identified not working
|
|---|
| 1714 | // correctly instead of vice versa!
|
|---|
| 1715 | //
|
|---|
| 1716 | if (fDisplay)
|
|---|
| 1717 | {
|
|---|
| 1718 | if (IsUsePINDiode())
|
|---|
| 1719 | {
|
|---|
| 1720 | MHCalibrationChargePINDiode *pin =
|
|---|
| 1721 | (MHCalibrationChargePINDiode*)plist.FindObject("MHCalibrationChargePINDiode");
|
|---|
| 1722 | pin->DrawClone(Form("nonew %s",drawoption.Data()));
|
|---|
| 1723 | }
|
|---|
| 1724 | else if (IsUseBlindPixel())
|
|---|
| 1725 | {
|
|---|
| 1726 | MHCalibrationChargeBlindCam *cam =
|
|---|
| 1727 | (MHCalibrationChargeBlindCam*)plist.FindObject("MHCalibrationChargeBlindCam");
|
|---|
| 1728 | cam->DrawClone(Form("nonew %s",drawoption.Data()));
|
|---|
| 1729 | }
|
|---|
| 1730 | else if (IsRelTimes())
|
|---|
| 1731 | {
|
|---|
| 1732 | MHCalibrationRelTimeCam *cam =
|
|---|
| 1733 | (MHCalibrationRelTimeCam*)plist.FindObject("MHCalibrationRelTimeCam");
|
|---|
| 1734 | cam->DrawClone(Form("nonew %s",drawoption.Data()));
|
|---|
| 1735 | }
|
|---|
| 1736 | else
|
|---|
| 1737 | chargecam.DrawClone(Form("nonew %s",drawoption.Data()));
|
|---|
| 1738 | }
|
|---|
| 1739 |
|
|---|
| 1740 | DisplayResult(plist);
|
|---|
| 1741 |
|
|---|
| 1742 | if (!IsNoStorage())
|
|---|
| 1743 | {
|
|---|
| 1744 | if (!WriteResult(plist.FindObject("MGeomCam")))
|
|---|
| 1745 | return kFALSE;
|
|---|
| 1746 | }
|
|---|
| 1747 |
|
|---|
| 1748 | if (IsHistsStorage())
|
|---|
| 1749 | {
|
|---|
| 1750 | if (!WriteHists(plist))
|
|---|
| 1751 | return kFALSE;
|
|---|
| 1752 | }
|
|---|
| 1753 |
|
|---|
| 1754 | *fLog << all << GetDescriptor() << ": Done." << endl;
|
|---|
| 1755 |
|
|---|
| 1756 | return kTRUE;
|
|---|
| 1757 | }
|
|---|
| 1758 |
|
|---|
| 1759 | // --------------------------------------------------------------------------
|
|---|
| 1760 | //
|
|---|
| 1761 | // Read the following containers from GetOutputFile()
|
|---|
| 1762 | // - MCalibrationChargeCam
|
|---|
| 1763 | // - MCalibrationQECam
|
|---|
| 1764 | // - MBadPixelsCam
|
|---|
| 1765 | //
|
|---|
| 1766 | Bool_t MJCalibration::ReadCalibrationCam()
|
|---|
| 1767 | {
|
|---|
| 1768 |
|
|---|
| 1769 | if (IsNoStorage())
|
|---|
| 1770 | return kFALSE;
|
|---|
| 1771 |
|
|---|
| 1772 | const TString fname = GetOutputFile();
|
|---|
| 1773 |
|
|---|
| 1774 | if (gSystem->AccessPathName(fname, kFileExists))
|
|---|
| 1775 | {
|
|---|
| 1776 | *fLog << err << "Input file " << fname << " doesn't exist." << endl;
|
|---|
| 1777 | return kFALSE;
|
|---|
| 1778 | }
|
|---|
| 1779 |
|
|---|
| 1780 | *fLog << inf << "Reading from file: " << fname << endl;
|
|---|
| 1781 |
|
|---|
| 1782 | TFile file(fname, "READ");
|
|---|
| 1783 | if (fCalibrationCam.Read()<=0)
|
|---|
| 1784 | {
|
|---|
| 1785 | *fLog << err << "Unable to read MCalibrationChargeCam from " << fname << endl;
|
|---|
| 1786 | return kFALSE;
|
|---|
| 1787 | }
|
|---|
| 1788 |
|
|---|
| 1789 | if (fQECam.Read()<=0)
|
|---|
| 1790 | {
|
|---|
| 1791 | *fLog << err << "Unable to read MCalibrationQECam from " << fname << endl;
|
|---|
| 1792 | return kFALSE;
|
|---|
| 1793 | }
|
|---|
| 1794 |
|
|---|
| 1795 |
|
|---|
| 1796 | if (file.FindKey("MCalibrationRelTimeCam"))
|
|---|
| 1797 | if (fRelTimeCam.Read()<=0)
|
|---|
| 1798 | {
|
|---|
| 1799 | *fLog << err << "Unable to read MCalibrationRelTimeCam from " << fname << endl;
|
|---|
| 1800 | return kFALSE;
|
|---|
| 1801 | }
|
|---|
| 1802 |
|
|---|
| 1803 | if (file.FindKey("MBadPixelsCam"))
|
|---|
| 1804 | {
|
|---|
| 1805 | MBadPixelsCam bad;
|
|---|
| 1806 | if (bad.Read()<=0)
|
|---|
| 1807 | {
|
|---|
| 1808 | *fLog << err << "Unable to read MBadPixelsCam from " << fname << endl;
|
|---|
| 1809 | return kFALSE;
|
|---|
| 1810 | }
|
|---|
| 1811 | fBadPixels.Merge(bad);
|
|---|
| 1812 | }
|
|---|
| 1813 |
|
|---|
| 1814 | if (fDisplay /*&& !fDisplay->GetCanvas("Pedestals")*/) // FIXME!
|
|---|
| 1815 | fDisplay->Read();
|
|---|
| 1816 |
|
|---|
| 1817 | return kTRUE;
|
|---|
| 1818 | }
|
|---|
| 1819 |
|
|---|
| 1820 |
|
|---|
| 1821 | // --------------------------------------------------------------------------
|
|---|
| 1822 | //
|
|---|
| 1823 | // Set the useage of the Blind Pixel device
|
|---|
| 1824 | //
|
|---|
| 1825 | void MJCalibration::SetUseBlindPixel(const Bool_t b)
|
|---|
| 1826 | {
|
|---|
| 1827 | b ? SETBIT(fDevices,kUseBlindPixel) : CLRBIT(fDevices,kUseBlindPixel);
|
|---|
| 1828 | }
|
|---|
| 1829 |
|
|---|
| 1830 | // --------------------------------------------------------------------------
|
|---|
| 1831 | //
|
|---|
| 1832 | // Set the useage of the PIN Diode device
|
|---|
| 1833 | //
|
|---|
| 1834 | void MJCalibration::SetUsePINDiode(const Bool_t b)
|
|---|
| 1835 | {
|
|---|
| 1836 | b ? SETBIT(fDevices,kUsePINDiode) : CLRBIT(fDevices,kUsePINDiode);
|
|---|
| 1837 | }
|
|---|
| 1838 |
|
|---|
| 1839 | Bool_t MJCalibration::WriteEventloop(MEvtLoop &evtloop) const
|
|---|
| 1840 | {
|
|---|
| 1841 | if (fPathOut.IsNull())
|
|---|
| 1842 | return kTRUE;
|
|---|
| 1843 |
|
|---|
| 1844 | const TString oname(GetOutputFile());
|
|---|
| 1845 |
|
|---|
| 1846 | *fLog << inf << "Writing to file: " << oname << endl;
|
|---|
| 1847 |
|
|---|
| 1848 | TFile file(oname, fOverwrite?"RECREATE":"NEW", "File created by MJCalibration", 9);
|
|---|
| 1849 | if (!file.IsOpen())
|
|---|
| 1850 | {
|
|---|
| 1851 | *fLog << err << "ERROR - Couldn't open file " << oname << " for writing..." << endl;
|
|---|
| 1852 | return kFALSE;
|
|---|
| 1853 | }
|
|---|
| 1854 |
|
|---|
| 1855 | if (evtloop.Write(fName)<=0)
|
|---|
| 1856 | {
|
|---|
| 1857 | *fLog << err << "Unable to write MEvtloop to " << oname << endl;
|
|---|
| 1858 | return kFALSE;
|
|---|
| 1859 | }
|
|---|
| 1860 |
|
|---|
| 1861 | return kTRUE;
|
|---|
| 1862 | }
|
|---|
| 1863 |
|
|---|
| 1864 | Bool_t MJCalibration::WriteTasks(MTask *t1, MTask *t2) const
|
|---|
| 1865 | {
|
|---|
| 1866 | if (fPathOut.IsNull())
|
|---|
| 1867 | return kTRUE;
|
|---|
| 1868 |
|
|---|
| 1869 | const TString oname(GetOutputFile());
|
|---|
| 1870 |
|
|---|
| 1871 | *fLog << inf << "Writing to file: " << oname << endl;
|
|---|
| 1872 |
|
|---|
| 1873 | TFile file(oname, fOverwrite?"RECREATE":"NEW", "File created by MJCalibration", 9);
|
|---|
| 1874 | if (!file.IsOpen())
|
|---|
| 1875 | {
|
|---|
| 1876 | *fLog << err << "ERROR - Couldn't open file " << oname << " for writing..." << endl;
|
|---|
| 1877 | return kFALSE;
|
|---|
| 1878 | }
|
|---|
| 1879 |
|
|---|
| 1880 | if (t1 && t1->Write()<=0)
|
|---|
| 1881 | {
|
|---|
| 1882 | *fLog << err << "Unable to write " << t1->GetName() << " to " << oname << endl;
|
|---|
| 1883 | return kFALSE;
|
|---|
| 1884 | }
|
|---|
| 1885 | if (t2 && t2->Write()<=0)
|
|---|
| 1886 | {
|
|---|
| 1887 | *fLog << err << "Unable to write " << t2->GetName() << " to " << oname << endl;
|
|---|
| 1888 | return kFALSE;
|
|---|
| 1889 | }
|
|---|
| 1890 |
|
|---|
| 1891 | return kTRUE;
|
|---|
| 1892 | }
|
|---|
| 1893 |
|
|---|
| 1894 | // --------------------------------------------------------------------------
|
|---|
| 1895 | //
|
|---|
| 1896 | // Write the result into the output file GetOutputFile(), if fOutputPath exists.
|
|---|
| 1897 | //
|
|---|
| 1898 | // The following containers are written:
|
|---|
| 1899 | // - MStatusDisplay
|
|---|
| 1900 | // - MCalibrationChargeCam or MCalibrationIntensityChargeCam
|
|---|
| 1901 | // - MCalibrationBlindCam or MCalibrationIntensityBlindCam
|
|---|
| 1902 | // - MCalibrationQECam or MCalibrationIntensityQECam
|
|---|
| 1903 | // - MCalibrationChargePINDiode
|
|---|
| 1904 | // - MBadPixelsCam
|
|---|
| 1905 | // If the flag kRelTimes is set, then also:
|
|---|
| 1906 | // - MCalibrationRelTimeCam or MCalibrationIntensityRelTimeCam
|
|---|
| 1907 | //
|
|---|
| 1908 | Bool_t MJCalibration::WriteResult(TObject *geom)
|
|---|
| 1909 | {
|
|---|
| 1910 | if (fPathOut.IsNull())
|
|---|
| 1911 | return kTRUE;
|
|---|
| 1912 |
|
|---|
| 1913 | const TString oname(GetOutputFile());
|
|---|
| 1914 |
|
|---|
| 1915 | *fLog << inf << "Writing to file: " << oname << endl;
|
|---|
| 1916 |
|
|---|
| 1917 | TFile file(oname, "UPDATE", "File created by MJCalibration", 9);
|
|---|
| 1918 | if (!file.IsOpen())
|
|---|
| 1919 | {
|
|---|
| 1920 | *fLog << err << "ERROR - Couldn't open file " << oname << " for writing..." << endl;
|
|---|
| 1921 | return kFALSE;
|
|---|
| 1922 | }
|
|---|
| 1923 |
|
|---|
| 1924 | *fLog << inf << " - MStatusDisplay..." << flush;
|
|---|
| 1925 | if (fDisplay && fDisplay->Write()<=0)
|
|---|
| 1926 | {
|
|---|
| 1927 | *fLog << err << "Unable to write MStatusDisplay to " << oname << endl;
|
|---|
| 1928 | return kFALSE;
|
|---|
| 1929 | }
|
|---|
| 1930 | *fLog << inf << "ok." << endl;
|
|---|
| 1931 |
|
|---|
| 1932 | TObjArray cont;
|
|---|
| 1933 | if (IsIntensity())
|
|---|
| 1934 | {
|
|---|
| 1935 | cont.Add(&fIntensBadCam);
|
|---|
| 1936 | cont.Add(&fIntensCalibCam);
|
|---|
| 1937 | cont.Add(&fIntensQECam);
|
|---|
| 1938 | cont.Add(&fIntensBlindCam);
|
|---|
| 1939 | }
|
|---|
| 1940 | else
|
|---|
| 1941 | {
|
|---|
| 1942 | cont.Add(&fBadPixels);
|
|---|
| 1943 | cont.Add(&fCalibrationCam);
|
|---|
| 1944 | cont.Add(&fQECam);
|
|---|
| 1945 | cont.Add(&fCalibrationBlindCam);
|
|---|
| 1946 | }
|
|---|
| 1947 | cont.Add(&fCalibrationPINDiode);
|
|---|
| 1948 | if (IsRelTimes())
|
|---|
| 1949 | cont.Add(IsIntensity() ? (TObject*)&fIntensRelTimeCam : (TObject*)&fRelTimeCam);
|
|---|
| 1950 |
|
|---|
| 1951 | if (!geom)
|
|---|
| 1952 | *fLog << warn << " - WARNING - MGeomCam... not found!" << endl;
|
|---|
| 1953 | else
|
|---|
| 1954 | cont.Add(geom);
|
|---|
| 1955 |
|
|---|
| 1956 | return WriteContainer(cont);
|
|---|
| 1957 | }
|
|---|
| 1958 |
|
|---|
| 1959 | // --------------------------------------------------------------------------
|
|---|
| 1960 | //
|
|---|
| 1961 | // Write the calibration histograms into the output file GetOutputFile(),
|
|---|
| 1962 | // if fOutputPath exists.
|
|---|
| 1963 | //
|
|---|
| 1964 | // The following containers are written:
|
|---|
| 1965 | // - MHCalibrationChargeCam
|
|---|
| 1966 | // - MHCalibrationChargeBlindCam
|
|---|
| 1967 | // - MHCalibrationChargePINDiode
|
|---|
| 1968 | // If the flag kRelTimes is set, then also:
|
|---|
| 1969 | // - MHCalibrationRelTimeBlindCam
|
|---|
| 1970 | //
|
|---|
| 1971 | Bool_t MJCalibration::WriteHists(MParList &plist)
|
|---|
| 1972 | {
|
|---|
| 1973 | if (fPathOut.IsNull())
|
|---|
| 1974 | return kTRUE;
|
|---|
| 1975 |
|
|---|
| 1976 | const TString oname(GetOutputFile());
|
|---|
| 1977 |
|
|---|
| 1978 | *fLog << inf << "Writing to file: " << oname << endl;
|
|---|
| 1979 |
|
|---|
| 1980 | TFile file(oname, "UPDATE", "File created by MJCalibration", 9);
|
|---|
| 1981 | if (!file.IsOpen())
|
|---|
| 1982 | {
|
|---|
| 1983 | *fLog << err << "ERROR - Couldn't open file " << oname << " for writing..." << endl;
|
|---|
| 1984 | return kFALSE;
|
|---|
| 1985 | }
|
|---|
| 1986 |
|
|---|
| 1987 | TObjArray cont;
|
|---|
| 1988 | cont.Add(plist.FindObject("MHCalibrationChargeCam"));
|
|---|
| 1989 | cont.Add(plist.FindObject("MHCalibrationChargeBlindCam"));
|
|---|
| 1990 | cont.Add(plist.FindObject("MHCalibrationChargePINDiode"));
|
|---|
| 1991 | if (IsRelTimes())
|
|---|
| 1992 | cont.Add(plist.FindObject("MHCalibrationRelTimeCam"));
|
|---|
| 1993 |
|
|---|
| 1994 | return WriteContainer(cont);
|
|---|
| 1995 | }
|
|---|
| 1996 |
|
|---|
| 1997 | void MJCalibration::DisplayDoubleProject(MHCamera *cam, const char* whatsmall, const char* whatbig) const
|
|---|
| 1998 | {
|
|---|
| 1999 |
|
|---|
| 2000 | TArrayI inner(1);
|
|---|
| 2001 | inner[0] = 0;
|
|---|
| 2002 |
|
|---|
| 2003 | TArrayI outer(1);
|
|---|
| 2004 | outer[0] = 1;
|
|---|
| 2005 |
|
|---|
| 2006 | TArrayI s1(3);
|
|---|
| 2007 | s1[0] = 6;
|
|---|
| 2008 | s1[1] = 1;
|
|---|
| 2009 | s1[2] = 2;
|
|---|
| 2010 |
|
|---|
| 2011 | TArrayI s2(3);
|
|---|
| 2012 | s2[0] = 3;
|
|---|
| 2013 | s2[1] = 4;
|
|---|
| 2014 | s2[2] = 5;
|
|---|
| 2015 |
|
|---|
| 2016 | TVirtualPad *pad = gPad;
|
|---|
| 2017 | pad->Divide(2,1);
|
|---|
| 2018 |
|
|---|
| 2019 | TH1D *inout[2];
|
|---|
| 2020 |
|
|---|
| 2021 | for (int i=0; i<2; i++)
|
|---|
| 2022 | {
|
|---|
| 2023 | pad->cd(i+1);
|
|---|
| 2024 | gPad->SetBorderMode(0);
|
|---|
| 2025 | gPad->SetTicks();
|
|---|
| 2026 |
|
|---|
| 2027 | inout[i] = cam->ProjectionS(TArrayI(), TArrayI(1,&i), i==0 ? "Inner" : "Outer");
|
|---|
| 2028 | FixDataCheckHist(inout[i]);
|
|---|
| 2029 | inout[i]->SetTitle(Form("%s %s",cam->GetTitle(),i==0 ? "Inner" : "Outer"));
|
|---|
| 2030 | inout[i]->SetDirectory(NULL);
|
|---|
| 2031 | inout[i]->SetLineColor(kRed+i);
|
|---|
| 2032 | inout[i]->SetBit(kCanDelete);
|
|---|
| 2033 | inout[i]->Draw();
|
|---|
| 2034 | //
|
|---|
| 2035 | // Display the outliers as dead and noisy pixels
|
|---|
| 2036 | //
|
|---|
| 2037 | if (!inout[i]->Fit("gaus","0Q"))
|
|---|
| 2038 | DisplayOutliers(inout[i],whatsmall,whatbig);
|
|---|
| 2039 |
|
|---|
| 2040 | gPad->Modified();
|
|---|
| 2041 | gPad->Update();
|
|---|
| 2042 | TPaveStats *st = (TPaveStats*)inout[i]->GetListOfFunctions()->FindObject("stats");
|
|---|
| 2043 | st->SetY1NDC(0.6);
|
|---|
| 2044 | st->SetY2NDC(0.9);
|
|---|
| 2045 | st->SetX1NDC(0.55);
|
|---|
| 2046 | st->SetX2NDC(0.99);
|
|---|
| 2047 | gPad->Modified();
|
|---|
| 2048 | gPad->Update();
|
|---|
| 2049 |
|
|---|
| 2050 | TLegend *leg2 = new TLegend(0.55,0.4,0.99,0.6);
|
|---|
| 2051 |
|
|---|
| 2052 | //
|
|---|
| 2053 | // Display the two half of the camera separately
|
|---|
| 2054 | //
|
|---|
| 2055 | TH1D *half[2];
|
|---|
| 2056 | half[0] = cam->ProjectionS(s1, TArrayI(1,&i), "Sector 6-1-2");
|
|---|
| 2057 | half[1] = cam->ProjectionS(s2, TArrayI(1,&i), "Sector 3-4-5");
|
|---|
| 2058 |
|
|---|
| 2059 | for (int j=0; j<2; j++)
|
|---|
| 2060 | {
|
|---|
| 2061 | half[j]->SetLineColor(kRed+i+2*j+1);
|
|---|
| 2062 | half[j]->SetDirectory(NULL);
|
|---|
| 2063 | half[j]->SetBit(kCanDelete);
|
|---|
| 2064 | half[j]->Draw("same");
|
|---|
| 2065 | leg2->AddEntry(half[j], half[j]->GetName(), "l");
|
|---|
| 2066 | }
|
|---|
| 2067 | leg2->Draw();
|
|---|
| 2068 | }
|
|---|
| 2069 | }
|
|---|