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