| 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 | !
|
|---|
| 20 | ! Copyright: MAGIC Software Development, 2000-2004
|
|---|
| 21 | !
|
|---|
| 22 | !
|
|---|
| 23 | \* ======================================================================== */
|
|---|
| 24 |
|
|---|
| 25 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 26 | //
|
|---|
| 27 | // MJCalibrateSignal
|
|---|
| 28 | //
|
|---|
| 29 | // This class is reading the output written by callisto. It calibrates
|
|---|
| 30 | // signal and time.
|
|---|
| 31 | //
|
|---|
| 32 | // The signal and time extractors are read from the callisto-output. In
|
|---|
| 33 | // pricipal you could overwrite these default using the resource file,
|
|---|
| 34 | // but this is NOT recommended!
|
|---|
| 35 | //
|
|---|
| 36 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 37 | #include "MJCalibrateSignal.h"
|
|---|
| 38 |
|
|---|
| 39 | #include <TEnv.h>
|
|---|
| 40 | #include <TFile.h>
|
|---|
| 41 |
|
|---|
| 42 | #include "MLog.h"
|
|---|
| 43 | #include "MLogManip.h"
|
|---|
| 44 |
|
|---|
| 45 | #include "MDirIter.h"
|
|---|
| 46 | #include "MRunIter.h"
|
|---|
| 47 | #include "MParList.h"
|
|---|
| 48 | #include "MTaskList.h"
|
|---|
| 49 | #include "MEvtLoop.h"
|
|---|
| 50 |
|
|---|
| 51 | #include "MStatusDisplay.h"
|
|---|
| 52 |
|
|---|
| 53 | #include "MGeomCam.h"
|
|---|
| 54 | #include "MHCamEvent.h"
|
|---|
| 55 | //#include "MHCamEventTH.h"
|
|---|
| 56 | #include "MPedestalCam.h"
|
|---|
| 57 | #include "MBadPixelsCam.h"
|
|---|
| 58 | #include "MArrivalTimeCam.h"
|
|---|
| 59 |
|
|---|
| 60 | #include "MCalibrationQECam.h"
|
|---|
| 61 | #include "MCalibrationBlindCam.h"
|
|---|
| 62 | #include "MCalibrationChargeCam.h"
|
|---|
| 63 | #include "MCalibrationRelTimeCam.h"
|
|---|
| 64 | #include "MCalibrationChargePINDiode.h"
|
|---|
| 65 | #include "MCalibrationHiLoCam.h"
|
|---|
| 66 | #include "MCalibrationPulseTimeCam.h"
|
|---|
| 67 | #include "MCalibrationPatternDecode.h"
|
|---|
| 68 |
|
|---|
| 69 | #include "MCalibrationChargeCalc.h"
|
|---|
| 70 | #include "MCalibrationRelTimeCalc.h"
|
|---|
| 71 |
|
|---|
| 72 | #include "MCalibrationIntensityChargeCam.h"
|
|---|
| 73 | #include "MCalibrationIntensityBlindCam.h"
|
|---|
| 74 | #include "MCalibrationIntensityRelTimeCam.h"
|
|---|
| 75 | #include "MCalibrationIntensityQECam.h"
|
|---|
| 76 | #include "MCalibrationIntensityConstCam.h"
|
|---|
| 77 | #include "MBadPixelsIntensityCam.h"
|
|---|
| 78 |
|
|---|
| 79 | #include "MHCalibrationChargeCam.h"
|
|---|
| 80 | #include "MHCalibrationChargeBlindCam.h"
|
|---|
| 81 | #include "MHCalibrationChargePINDiode.h"
|
|---|
| 82 | #include "MHCalibrationRelTimeCam.h"
|
|---|
| 83 | #include "MHCalibrationPulseTimeCam.h"
|
|---|
| 84 | #include "MHCalibrationHiLoCam.h"
|
|---|
| 85 | #include "MHCamera.h"
|
|---|
| 86 |
|
|---|
| 87 | #include "MCalibCalcFromPast.h"
|
|---|
| 88 |
|
|---|
| 89 | #include "MReadReports.h"
|
|---|
| 90 | #include "MReadMarsFile.h"
|
|---|
| 91 | #include "MRawFileRead.h"
|
|---|
| 92 | #include "MContinue.h"
|
|---|
| 93 | #include "MTriggerPatternDecode.h"
|
|---|
| 94 | #include "MFTriggerPattern.h"
|
|---|
| 95 | #include "MGeomApply.h"
|
|---|
| 96 | //#include "MMcPedestalCopy.h"
|
|---|
| 97 | #include "MPointingPosCalc.h"
|
|---|
| 98 | #include "MPedCalcFromLoGain.h"
|
|---|
| 99 | #include "MExtractor.h"
|
|---|
| 100 | #include "MExtractTimeAndCharge.h"
|
|---|
| 101 | #include "MExtractPINDiode.h"
|
|---|
| 102 | #include "MExtractBlindPixel.h"
|
|---|
| 103 | #include "MFCosmics.h"
|
|---|
| 104 | #include "MTaskEnv.h"
|
|---|
| 105 | #include "MCalibrateData.h"
|
|---|
| 106 | #include "MCalibrateRelTimes.h"
|
|---|
| 107 | #include "MBadPixelsMerge.h"
|
|---|
| 108 | #include "MBadPixelsCalc.h"
|
|---|
| 109 | #include "MBadPixelsTreat.h"
|
|---|
| 110 | #include "MFillH.h"
|
|---|
| 111 | #include "MWriteRootFile.h"
|
|---|
| 112 |
|
|---|
| 113 | ClassImp(MJCalibrateSignal);
|
|---|
| 114 |
|
|---|
| 115 | using namespace std;
|
|---|
| 116 |
|
|---|
| 117 | // --------------------------------------------------------------------------
|
|---|
| 118 | //
|
|---|
| 119 | // Default constructor.
|
|---|
| 120 | //
|
|---|
| 121 | // Sets:
|
|---|
| 122 | // - fIsInterlaced to kTRUE
|
|---|
| 123 | // - fIsRelTimesUpdate to kFALSE
|
|---|
| 124 | // - fIsHiLoCalibration to kFALSE
|
|---|
| 125 | // - fPulsePosCheck to kTRUE
|
|---|
| 126 | //
|
|---|
| 127 | MJCalibrateSignal::MJCalibrateSignal(const char *name, const char *title)
|
|---|
| 128 | : fExtractor(0), fIsInterlaced(kTRUE), fIsRelTimesUpdate(kFALSE)
|
|---|
| 129 | {
|
|---|
| 130 | fName = name ? name : "MJCalibrateSignal";
|
|---|
| 131 | fTitle = title ? title : "Tool to calibrate data";
|
|---|
| 132 |
|
|---|
| 133 | SetPulsePosCheck();
|
|---|
| 134 | //fCruns = NULL;
|
|---|
| 135 | }
|
|---|
| 136 |
|
|---|
| 137 | MJCalibrateSignal::~MJCalibrateSignal()
|
|---|
| 138 | {
|
|---|
| 139 | if (fExtractor)
|
|---|
| 140 | delete fExtractor;
|
|---|
| 141 | }
|
|---|
| 142 |
|
|---|
| 143 | void MJCalibrateSignal::SetExtractor(const MExtractor *ext)
|
|---|
| 144 | {
|
|---|
| 145 | if (fExtractor)
|
|---|
| 146 | delete fExtractor;
|
|---|
| 147 |
|
|---|
| 148 | fExtractor = ext ? (MExtractor*)ext->Clone() : NULL;
|
|---|
| 149 | }
|
|---|
| 150 |
|
|---|
| 151 | Bool_t MJCalibrateSignal::WriteResult(TObjArray &cont)
|
|---|
| 152 | {
|
|---|
| 153 | if (IsNoStorage())
|
|---|
| 154 | return kTRUE;
|
|---|
| 155 |
|
|---|
| 156 | const TString name(Form("signal%08d.root", fSequence.GetSequence()));
|
|---|
| 157 | return WriteContainer(cont, name);
|
|---|
| 158 | }
|
|---|
| 159 |
|
|---|
| 160 | Bool_t MJCalibrateSignal::ReadCalibration(TObjArray &l, MBadPixelsCam &cam, MExtractor* &ext2, MExtractor* &ext3, TString &geom) const
|
|---|
| 161 | {
|
|---|
| 162 | TString fname = Form("%s/calib%08d.root", fPathIn.Data(), fSequence.GetSequence());
|
|---|
| 163 |
|
|---|
| 164 | *fLog << inf << "Reading from file: " << fname << endl;
|
|---|
| 165 |
|
|---|
| 166 | TFile file(fname, "READ");
|
|---|
| 167 | if (!file.IsOpen())
|
|---|
| 168 | {
|
|---|
| 169 | *fLog << err << dbginf << "ERROR - Could not open file " << fname << endl;
|
|---|
| 170 | return kFALSE;
|
|---|
| 171 | }
|
|---|
| 172 |
|
|---|
| 173 | TObject *o = file.Get("ExtractSignal");
|
|---|
| 174 | if (o && !o->InheritsFrom(MExtractor::Class()))
|
|---|
| 175 | {
|
|---|
| 176 | *fLog << err << dbginf << "ERROR - ExtractSignal read from " << fname << " doesn't inherit from MExtractor!" << endl;
|
|---|
| 177 | return kFALSE;
|
|---|
| 178 | }
|
|---|
| 179 | ext3 = o ? (MExtractor*)o->Clone() : NULL;
|
|---|
| 180 |
|
|---|
| 181 | o = file.Get("ExtractTime");
|
|---|
| 182 | if (o && !o->InheritsFrom(MExtractor::Class()))
|
|---|
| 183 | {
|
|---|
| 184 | *fLog << err << dbginf << "ERROR - ExtractTime read from " << fname << " doesn't inherit from MExtractor!" << endl;
|
|---|
| 185 | return kFALSE;
|
|---|
| 186 | }
|
|---|
| 187 | ext2 = o ? (MExtractor*)o->Clone() : NULL;
|
|---|
| 188 | if (!ext3 && !ext2)
|
|---|
| 189 | {
|
|---|
| 190 | *fLog << err << dbginf << "ERROR - Neither ExtractSignal nor ExrtractTime found in " << fname << "!" << endl;
|
|---|
| 191 | return kFALSE;
|
|---|
| 192 | }
|
|---|
| 193 |
|
|---|
| 194 | o = file.Get("MGeomCam");
|
|---|
| 195 | if (o && !o->InheritsFrom(MGeomCam::Class()))
|
|---|
| 196 | {
|
|---|
| 197 | *fLog << err << dbginf << "ERROR - MGeomCam read from " << fname << " doesn't inherit from MGeomCam!" << endl;
|
|---|
| 198 | return kFALSE;
|
|---|
| 199 | }
|
|---|
| 200 | geom = o ? o->ClassName() : "";
|
|---|
| 201 |
|
|---|
| 202 | TObjArray cont(l);
|
|---|
| 203 | cont.Add(&cam);
|
|---|
| 204 | return ReadContainer(cont);
|
|---|
| 205 | }
|
|---|
| 206 |
|
|---|
| 207 | // --------------------------------------------------------------------------
|
|---|
| 208 | //
|
|---|
| 209 | // MJCalibration allows to setup several option by a resource file:
|
|---|
| 210 | // MJCalibrateSignal.RawData: yes,no
|
|---|
| 211 | //
|
|---|
| 212 | // For more details see the class description and the corresponding Getters
|
|---|
| 213 | //
|
|---|
| 214 | Bool_t MJCalibrateSignal::CheckEnvLocal()
|
|---|
| 215 | {
|
|---|
| 216 | SetInterlaced(GetEnv("Interlaced", fIsInterlaced));
|
|---|
| 217 | SetRelTimesUpdate(GetEnv("RelTimesUpdate", fIsRelTimesUpdate));
|
|---|
| 218 |
|
|---|
| 219 | return MJCalib::CheckEnvLocal();
|
|---|
| 220 | }
|
|---|
| 221 |
|
|---|
| 222 | Bool_t MJCalibrateSignal::Process(MPedestalCam &pedcamab, MPedestalCam &pedcambias,
|
|---|
| 223 | MPedestalCam &pedcamextr)
|
|---|
| 224 | {
|
|---|
| 225 | if (!fSequence.IsValid())
|
|---|
| 226 | {
|
|---|
| 227 | *fLog << err << "ERROR - Sequence invalid..." << endl;
|
|---|
| 228 | return kFALSE;
|
|---|
| 229 | }
|
|---|
| 230 |
|
|---|
| 231 | *fLog << inf;
|
|---|
| 232 | fLog->Separator(GetDescriptor());
|
|---|
| 233 | *fLog << "Calculate calibrated data from Sequence #";
|
|---|
| 234 | *fLog << fSequence.GetSequence() << endl << endl;
|
|---|
| 235 |
|
|---|
| 236 |
|
|---|
| 237 | //if (!CheckEnv())
|
|---|
| 238 | // return kFALSE;
|
|---|
| 239 |
|
|---|
| 240 | CheckEnv();
|
|---|
| 241 |
|
|---|
| 242 | // --------------------------------------------------------------------------------
|
|---|
| 243 |
|
|---|
| 244 | MDirIter iter;
|
|---|
| 245 | if (fSequence.IsValid())
|
|---|
| 246 | {
|
|---|
| 247 | const Int_t n0 = fSequence.SetupDatRuns(iter, fPathData, IsUseRawData());
|
|---|
| 248 | const Int_t n1 = fSequence.GetNumDatRuns();
|
|---|
| 249 | if (n0==0)
|
|---|
| 250 | {
|
|---|
| 251 | *fLog << err << "ERROR - No input files of sequence found!" << endl;
|
|---|
| 252 | return kFALSE;
|
|---|
| 253 | }
|
|---|
| 254 | if (n0!=n1)
|
|---|
| 255 | {
|
|---|
| 256 | *fLog << err << "ERROR - Number of files found (" << n0 << ") doesn't match number of files in sequence (" << n1 << ")" << endl;
|
|---|
| 257 | if (fLog->GetDebugLevel()>4)
|
|---|
| 258 | {
|
|---|
| 259 | *fLog << dbg << "Files which are searched:" << endl;
|
|---|
| 260 | iter.Print();
|
|---|
| 261 | }
|
|---|
| 262 | return kFALSE;
|
|---|
| 263 | }
|
|---|
| 264 | }
|
|---|
| 265 |
|
|---|
| 266 | // Read File
|
|---|
| 267 | MCalibrationIntensityChargeCam ichcam;
|
|---|
| 268 | MCalibrationIntensityQECam iqecam;
|
|---|
| 269 | MCalibrationIntensityBlindCam iblcam;
|
|---|
| 270 | MCalibrationIntensityRelTimeCam itmcam;
|
|---|
| 271 | MCalibrationIntensityConstCam icncam;
|
|---|
| 272 | MBadPixelsIntensityCam ibdcam;
|
|---|
| 273 |
|
|---|
| 274 | MHCalibrationChargeCam hchacam;
|
|---|
| 275 | MHCalibrationChargeBlindCam hbndcam;
|
|---|
| 276 | MHCalibrationChargePINDiode hpndiod;
|
|---|
| 277 | MHCalibrationRelTimeCam hrelcam;
|
|---|
| 278 | MHCalibrationHiLoCam hilocam;
|
|---|
| 279 | MHCalibrationPulseTimeCam hpulcam;
|
|---|
| 280 |
|
|---|
| 281 | hchacam.SetOscillations(kFALSE);
|
|---|
| 282 | hbndcam.SetOscillations(kFALSE);
|
|---|
| 283 | hrelcam.SetOscillations(kFALSE);
|
|---|
| 284 |
|
|---|
| 285 | MCalibrationChargeCam calcam;
|
|---|
| 286 | MCalibrationQECam qecam;
|
|---|
| 287 | MCalibrationBlindCam bndcam;
|
|---|
| 288 | MCalibrationChargePINDiode pind;
|
|---|
| 289 | MCalibrationRelTimeCam tmcam;
|
|---|
| 290 | MCalibrationHiLoCam hilcam;
|
|---|
| 291 | MCalibrationPulseTimeCam pulcam;
|
|---|
| 292 |
|
|---|
| 293 | MBadPixelsCam badpix;
|
|---|
| 294 |
|
|---|
| 295 | TObjArray interlacedcont;
|
|---|
| 296 | if (fIsInterlaced)
|
|---|
| 297 | {
|
|---|
| 298 | interlacedcont.Add(&ichcam);
|
|---|
| 299 | interlacedcont.Add(&iqecam);
|
|---|
| 300 | interlacedcont.Add(&iblcam);
|
|---|
| 301 | interlacedcont.Add(&itmcam);
|
|---|
| 302 | interlacedcont.Add(&ibdcam);
|
|---|
| 303 | interlacedcont.Add(&icncam);
|
|---|
| 304 | interlacedcont.Add(&hchacam);
|
|---|
| 305 | if (IsUseBlindPixel())
|
|---|
| 306 | interlacedcont.Add(&hbndcam);
|
|---|
| 307 | if (IsUsePINDiode())
|
|---|
| 308 | interlacedcont.Add(&hpndiod);
|
|---|
| 309 | if (fIsRelTimesUpdate)
|
|---|
| 310 | interlacedcont.Add(&hrelcam);
|
|---|
| 311 | }
|
|---|
| 312 |
|
|---|
| 313 | MExtractor *extractor1=fExtractor;
|
|---|
| 314 | MExtractor *extractor2=0;
|
|---|
| 315 | MExtractor *extractor3=0;
|
|---|
| 316 | TString geom;
|
|---|
| 317 |
|
|---|
| 318 | TObjArray calibcont;
|
|---|
| 319 | calibcont.Add(&calcam);
|
|---|
| 320 | calibcont.Add(&qecam);
|
|---|
| 321 | calibcont.Add(&bndcam);
|
|---|
| 322 | calibcont.Add(&tmcam);
|
|---|
| 323 | if (IsUseBlindPixel())
|
|---|
| 324 | calibcont.Add(&bndcam);
|
|---|
| 325 |
|
|---|
| 326 | if (!ReadCalibration(calibcont, badpix, extractor2, extractor3, geom))
|
|---|
| 327 | return kFALSE;
|
|---|
| 328 |
|
|---|
| 329 | *fLog << all;
|
|---|
| 330 | if (!geom.IsNull())
|
|---|
| 331 | *fLog << inf << "Camera geometry found in file: " << geom << endl;
|
|---|
| 332 | else
|
|---|
| 333 | *fLog << inf << "No Camera geometry found using default <MGeomCamMagic>" << endl;
|
|---|
| 334 |
|
|---|
| 335 | if (extractor3)
|
|---|
| 336 | {
|
|---|
| 337 | *fLog << underline << "Signal Extractor found in calibration file" << endl;
|
|---|
| 338 | extractor3->Print();
|
|---|
| 339 | *fLog << endl;
|
|---|
| 340 | }
|
|---|
| 341 | else
|
|---|
| 342 | *fLog << inf << "No Signal Extractor: ExtractSignal in file." << endl;
|
|---|
| 343 |
|
|---|
| 344 |
|
|---|
| 345 | if (extractor1)
|
|---|
| 346 | {
|
|---|
| 347 | *fLog << underline << "Modified Signal Extractor set by user." << endl;
|
|---|
| 348 | extractor1->Print();
|
|---|
| 349 | *fLog << endl;
|
|---|
| 350 | }
|
|---|
| 351 | else
|
|---|
| 352 | {
|
|---|
| 353 | *fLog << inf << "No modified Signal Extractor set by user... using ExtractSignal." << endl;
|
|---|
| 354 | extractor1 = extractor3 ? (MExtractor*)extractor3->Clone() : 0;
|
|---|
| 355 | }
|
|---|
| 356 |
|
|---|
| 357 | if (extractor2)
|
|---|
| 358 | {
|
|---|
| 359 | *fLog << underline << "Time Extractor found in calibration file" << endl;
|
|---|
| 360 | extractor2->Print();
|
|---|
| 361 | *fLog << endl;
|
|---|
| 362 | }
|
|---|
| 363 | else
|
|---|
| 364 | *fLog << inf << "No Time Extractor: ExtractTime in file." << endl;
|
|---|
| 365 |
|
|---|
| 366 | // This is necessary for the case in which it is not in the files
|
|---|
| 367 | MBadPixelsCam badcam;
|
|---|
| 368 | icncam.SetBadPixels(&badpix);
|
|---|
| 369 |
|
|---|
| 370 | // Setup Parlist
|
|---|
| 371 | MParList plist;
|
|---|
| 372 | plist.AddToList(this); // take care of fDisplay!
|
|---|
| 373 | plist.AddToList(&badcam);
|
|---|
| 374 | plist.AddToList(&hilcam);
|
|---|
| 375 | plist.AddToList(&calibcont); // Using AddToList(TObjArray *)
|
|---|
| 376 | plist.AddToList(&interlacedcont); // Using AddToList(TObjArray *)
|
|---|
| 377 | plist.AddToList(&pulcam);
|
|---|
| 378 |
|
|---|
| 379 | // Setup Tasklist
|
|---|
| 380 | MTaskList tlist;
|
|---|
| 381 | plist.AddToList(&tlist);
|
|---|
| 382 |
|
|---|
| 383 | MReadReports readreal;
|
|---|
| 384 | readreal.AddTree("Events", "MTime.", MReadReports::kMaster);
|
|---|
| 385 | readreal.AddTree("Trigger");
|
|---|
| 386 | readreal.AddTree("Camera");
|
|---|
| 387 | readreal.AddTree("Drive");
|
|---|
| 388 | readreal.AddTree("CC");
|
|---|
| 389 | readreal.AddTree("Currents");
|
|---|
| 390 |
|
|---|
| 391 | MReadMarsFile readmc("Events");
|
|---|
| 392 | readmc.DisableAutoScheme();
|
|---|
| 393 |
|
|---|
| 394 | MRawFileRead rawread(NULL);
|
|---|
| 395 |
|
|---|
| 396 | MRead *read = 0;
|
|---|
| 397 | switch (GetDataFlag())
|
|---|
| 398 | {
|
|---|
| 399 | case kIsUseRawData: read = &rawread; break;
|
|---|
| 400 | case kIsUseMC: read = &readmc; break;
|
|---|
| 401 | case kIsUseRootData: read = &readreal; break;
|
|---|
| 402 | }
|
|---|
| 403 | read->AddFiles(iter);
|
|---|
| 404 |
|
|---|
| 405 | const TString fname(Form("%s{s/_D_/_Y_}{s/\\.raw$/.root}{s/\\.raw\\.gz$/.root}", fPathOut.Data()));
|
|---|
| 406 |
|
|---|
| 407 |
|
|---|
| 408 | // Skips MC which have no contents. This are precisely the
|
|---|
| 409 | // events which fullfilled the MC Lvl1 trigger and an
|
|---|
| 410 | // arbitrary cut (typically at 50phe) to speed up simulation
|
|---|
| 411 | MContinue contmc("MRawEvtData.GetNumPixels<0.5", "ContEmptyMC");
|
|---|
| 412 |
|
|---|
| 413 | //MPointingPosInterpolate pextr;
|
|---|
| 414 | //pextr.AddFiles(&iter);
|
|---|
| 415 |
|
|---|
| 416 | MGeomApply apply; // Only necessary to create geometry
|
|---|
| 417 | if (!geom.IsNull())
|
|---|
| 418 | apply.SetGeometry(geom);
|
|---|
| 419 | MBadPixelsMerge merge(&badpix);
|
|---|
| 420 |
|
|---|
| 421 | // Make sure that pedcamab has the correct name
|
|---|
| 422 | pedcamab.SetName("MPedestalFundamental");
|
|---|
| 423 | pedcamextr.SetName("MPedestalFromExtractorRndm");
|
|---|
| 424 | pedcambias.SetName("MPedestalFromExtractor");
|
|---|
| 425 | plist.AddToList(&pedcamextr);
|
|---|
| 426 | plist.AddToList(&pedcambias);
|
|---|
| 427 | plist.AddToList(&pedcamab);
|
|---|
| 428 |
|
|---|
| 429 | MArrivalTimeCam timecam;
|
|---|
| 430 | plist.AddToList(&timecam);
|
|---|
| 431 |
|
|---|
| 432 | // Check for interleaved events
|
|---|
| 433 | MCalibrationPatternDecode caldec;
|
|---|
| 434 | MTriggerPatternDecode decode;
|
|---|
| 435 |
|
|---|
| 436 | // This will make that for data with version less than 5, where
|
|---|
| 437 | // trigger patterns were not yet correct, all the events in the real
|
|---|
| 438 | // data file will be processed. In any case there are no interleaved
|
|---|
| 439 | // calibration events in such data, so this is fine.
|
|---|
| 440 | MFTriggerPattern ftp;
|
|---|
| 441 | ftp.SetDefault(kTRUE);
|
|---|
| 442 | // ftp.RequireCalibration();
|
|---|
| 443 | ftp.DenyCalibration();
|
|---|
| 444 | ftp.DenyPedestal();
|
|---|
| 445 | // ftp.DenyPinDiode();
|
|---|
| 446 | ftp.SetInverted();
|
|---|
| 447 |
|
|---|
| 448 | // This will skip interleaved calibration events and pedestal events (if any)
|
|---|
| 449 | // --> tlist2
|
|---|
| 450 | MContinue conttp(&ftp, "ContTrigPattern");
|
|---|
| 451 |
|
|---|
| 452 | // Do signal and pedestal calculation
|
|---|
| 453 | MPedCalcFromLoGain pedlo1("MPedCalcFundamental");
|
|---|
| 454 | pedlo1.SetPedestalUpdate(kTRUE);
|
|---|
| 455 | pedlo1.SetNamePedestalCamOut("MPedestalFundamental");
|
|---|
| 456 |
|
|---|
| 457 | MPedCalcFromLoGain pedlo2("MPedCalcWithExtractorRndm");
|
|---|
| 458 | pedlo2.SetPedestalUpdate(kTRUE);
|
|---|
| 459 | pedlo2.SetRandomCalculation(kTRUE);
|
|---|
| 460 | pedlo2.SetNamePedestalCamIn("MPedestalFundamental");
|
|---|
| 461 | pedlo2.SetNamePedestalCamOut("MPedestalFromExtractorRndm");
|
|---|
| 462 |
|
|---|
| 463 | MPedCalcFromLoGain pedlo3("MPedCalcWithExtractor");
|
|---|
| 464 | pedlo3.SetPedestalUpdate(kTRUE);
|
|---|
| 465 | pedlo3.SetRandomCalculation(kFALSE);
|
|---|
| 466 | pedlo3.SetNamePedestalCamIn("MPedestalFundamental");
|
|---|
| 467 | pedlo3.SetNamePedestalCamOut("MPedestalFromExtractor");
|
|---|
| 468 |
|
|---|
| 469 | if (extractor1)
|
|---|
| 470 | {
|
|---|
| 471 | extractor1->SetPedestals(&pedcamab);
|
|---|
| 472 |
|
|---|
| 473 | if (extractor1->InheritsFrom("MExtractTimeAndCharge"))
|
|---|
| 474 | {
|
|---|
| 475 | pedlo2.SetExtractor((MExtractTimeAndCharge*)extractor1);
|
|---|
| 476 | pedlo3.SetExtractor((MExtractTimeAndCharge*)extractor1);
|
|---|
| 477 | const Int_t win = ((MExtractTimeAndCharge*)extractor1)->GetWindowSizeHiGain();
|
|---|
| 478 | pedlo1.SetExtractWindow(15, win);
|
|---|
| 479 | pedlo2.SetExtractWindow(15, win/*obsolete*/);
|
|---|
| 480 | pedlo3.SetExtractWindow(15, win/*obsolete*/);
|
|---|
| 481 | }
|
|---|
| 482 | else
|
|---|
| 483 | {
|
|---|
| 484 | // FIXME: How to get the fixed value 15 automatically?
|
|---|
| 485 | const Int_t f = (Int_t)(15.5+extractor1->GetHiGainFirst());
|
|---|
| 486 | const Int_t n = (Int_t)(15.5+extractor1->GetNumHiGainSamples());
|
|---|
| 487 | pedlo1.SetExtractWindow(f, n);
|
|---|
| 488 | pedlo2.SetExtractWindow(f, n);
|
|---|
| 489 | pedlo3.SetExtractWindow(f, n);
|
|---|
| 490 | }
|
|---|
| 491 | }
|
|---|
| 492 | if (extractor2)
|
|---|
| 493 | extractor2->SetPedestals(&pedcamab);
|
|---|
| 494 |
|
|---|
| 495 | if (extractor3)
|
|---|
| 496 | extractor3->SetPedestals(&pedcamab);
|
|---|
| 497 |
|
|---|
| 498 | MFCosmics fcosmics;
|
|---|
| 499 | fcosmics.SetNamePedestalCam("MPedestalFundamental");
|
|---|
| 500 | MContinue contcos(&fcosmics, "ContTrigEvts");
|
|---|
| 501 | contcos.SetInverted();
|
|---|
| 502 |
|
|---|
| 503 | //MMcPedestalCopy pcopy;
|
|---|
| 504 | MTaskEnv taskenv1("ExtractSignal");
|
|---|
| 505 | MTaskEnv taskenv2("ExtractTime");
|
|---|
| 506 | MTaskEnv taskenv3("ExtractInterlaced");
|
|---|
| 507 | taskenv1.SetDefault(extractor1);
|
|---|
| 508 | taskenv2.SetDefault(extractor2);
|
|---|
| 509 | taskenv3.SetDefault(extractor3);
|
|---|
| 510 |
|
|---|
| 511 | //
|
|---|
| 512 | // This is new calibration to photo-electrons, hard-coded
|
|---|
| 513 | // as decided at the Wuerzburg software meeting 26.01.05
|
|---|
| 514 | //
|
|---|
| 515 | MCalibrateData calib;
|
|---|
| 516 | calib.SetSignalType(MCalibrateData::kPhe);
|
|---|
| 517 | calib.AddPedestal("Fundamental");
|
|---|
| 518 | calib.AddPedestal("FromExtractor");
|
|---|
| 519 | calib.AddPedestal("FromExtractorRndm");
|
|---|
| 520 | calib.SetPedestalFlag(MCalibrateData::kEvent);
|
|---|
| 521 | //----------------------------------------------------------
|
|---|
| 522 |
|
|---|
| 523 | MExtractPINDiode pinext;
|
|---|
| 524 | MExtractBlindPixel bldext;
|
|---|
| 525 |
|
|---|
| 526 | MFTriggerPattern fcalib("CalibFilter");
|
|---|
| 527 | fcalib.SetDefault(kFALSE);
|
|---|
| 528 | fcalib.RequireCalibration();
|
|---|
| 529 |
|
|---|
| 530 | MCalibrationChargeCalc chcalc;
|
|---|
| 531 | chcalc.SetExtractor(extractor3);
|
|---|
| 532 |
|
|---|
| 533 | MCalibrationRelTimeCalc recalc;
|
|---|
| 534 | MCalibCalcFromPast pacalc;
|
|---|
| 535 |
|
|---|
| 536 | pinext.SetPedestals(&pedcamab);
|
|---|
| 537 | bldext.SetPedestals(&pedcamab);
|
|---|
| 538 | chcalc.SetPedestals(&pedcamextr);
|
|---|
| 539 |
|
|---|
| 540 | pacalc.SetChargeCalc(&chcalc);
|
|---|
| 541 | if (fIsRelTimesUpdate)
|
|---|
| 542 | pacalc.SetRelTimeCalc(&recalc);
|
|---|
| 543 | pacalc.SetCalibrate(&calib);
|
|---|
| 544 |
|
|---|
| 545 | //
|
|---|
| 546 | // Intensity Calibration histogramming
|
|---|
| 547 | //
|
|---|
| 548 | MFillH filpin(&hpndiod, "MExtractedSignalPINDiode", "FillPINDiode");
|
|---|
| 549 | MFillH filbnd(&hbndcam, "MExtractedSignalBlindPixel", "FillBlindCam");
|
|---|
| 550 | MFillH filcam(&hchacam, "MExtractedSignalCam", "FillChargeCam");
|
|---|
| 551 | MFillH filtme(&hrelcam, "MArrivalTimeCam", "FillRelTime");
|
|---|
| 552 | MFillH filhil(&hilocam, "MExtractedSignalCam", "FillHiLoRatio");
|
|---|
| 553 | MFillH filpul(&hpulcam, "MRawEvtData", "FillPulseTime");
|
|---|
| 554 | filpin.SetBit(MFillH::kDoNotDisplay);
|
|---|
| 555 | filbnd.SetBit(MFillH::kDoNotDisplay);
|
|---|
| 556 | filcam.SetBit(MFillH::kDoNotDisplay);
|
|---|
| 557 | filtme.SetBit(MFillH::kDoNotDisplay);
|
|---|
| 558 | filhil.SetBit(MFillH::kDoNotDisplay);
|
|---|
| 559 | filpul.SetBit(MFillH::kDoNotDisplay);
|
|---|
| 560 |
|
|---|
| 561 | MCalibrateRelTimes caltm;
|
|---|
| 562 | MBadPixelsCalc bpcal;
|
|---|
| 563 | MBadPixelsTreat treat;
|
|---|
| 564 |
|
|---|
| 565 | bpcal.SetNamePedPhotCam("MPedPhotFromExtractor");
|
|---|
| 566 | treat.AddNamePedPhotCam("MPedPhotFundamental");
|
|---|
| 567 | treat.AddNamePedPhotCam("MPedPhotFromExtractor");
|
|---|
| 568 | treat.AddNamePedPhotCam("MPedPhotFromExtractorRndm");
|
|---|
| 569 | if (!extractor2 && !extractor1->InheritsFrom("MExtractTimeAndCharge"))
|
|---|
| 570 | treat.SetProcessTimes(kFALSE);
|
|---|
| 571 |
|
|---|
| 572 | MHCamEvent evt0( 0, "PedFLG", "Fundamental Pedestal from Lo Gain;;P [cnts/sl]");
|
|---|
| 573 | MHCamEvent evt1( 2, "PedRmsFLG", "RMS from Extractor applied to ped.;;\\sigma_{p} [cnts/sl]");
|
|---|
| 574 | MHCamEvent evt2( 0, "Extra'd", "Extracted Signal;;S [cnts/sl]");
|
|---|
| 575 | // MHCamEvent evt3(4, "PedPhot", "Calibrated Pedestal;;P [phe]");
|
|---|
| 576 | MHCamEvent evt4( 5, "PedRMS", "Calibrated RMS from Extractor applied to ped.;;\\sigma_{p} [phe]");
|
|---|
| 577 | MHCamEvent evt5( 0, "Interp'd", "Interpolated Signal scaled with A/A_{0};;S [phe]");
|
|---|
| 578 | MHCamEvent evt6(102, "Unsuitable", "Fraction of unsuitable events per Pixel;;[1]");
|
|---|
| 579 | // MHCamEvent evt7( 6, "Times", "Calibrated Arrival Time;;T [fadc sl]");
|
|---|
| 580 | MHCamEvent evt8( 0, "Conv", "Calibration Conv. Factors;;[phe/fadc cnts]");
|
|---|
| 581 | MHCamEvent evt9( 7, "PulsePos", "Pulse Position of cosmics (>50phe);;T");
|
|---|
| 582 | MHCamEvent evtR( 4, "HiLoCal", "Hi-/Lo-Gain ratio;;Ratio");
|
|---|
| 583 | MHCamEvent evtO( 7, "HiLoOff", "Lo-/Hi-Gain Offset;;Offset");
|
|---|
| 584 | evt6.SetThreshold();
|
|---|
| 585 |
|
|---|
| 586 | MFillH fill0(&evt0, "MPedestalFundamental", "FillPedFLG");
|
|---|
| 587 | MFillH fill1(&evt1, "MPedestalFromExtractorRndm", "FillPedRmsFLG");
|
|---|
| 588 | MFillH fill2(&evt2, "MExtractedSignalCam", "FillExtracted");
|
|---|
| 589 | // MFillH fill3(&evt3, "MPedPhotFundamental", "FillPedPhot");
|
|---|
| 590 | MFillH fill4(&evt4, "MPedPhotFromExtractorRndm", "FillPedRMS");
|
|---|
| 591 | MFillH fill5(&evt5, "MSignalCam", "FillInterpolated");
|
|---|
| 592 | MFillH fill6(&evt6, "MBadPixelsCam", "FillUnsuitable");
|
|---|
| 593 | // MFillH fill7(&evt7, "MSignalCam", "FillTimes");
|
|---|
| 594 | MFillH fill8(&evt8, "MCalibrationIntensityConstCam", "FillConv");
|
|---|
| 595 | MFillH fill9(&evt9, "MSignalCam", "FillPulse");
|
|---|
| 596 | MFillH fillR(&evtR, "MExtractedSignalCam", "FillHiLoCal");
|
|---|
| 597 | MFillH fillO(&evtO, "MArrivalTimeCam", "FillHiLoOff");
|
|---|
| 598 |
|
|---|
| 599 | MTaskEnv fillflorian("FinalFantasy");
|
|---|
| 600 | fillflorian.SetDefault();
|
|---|
| 601 |
|
|---|
| 602 | // The second rule is for the case reading raw-files!
|
|---|
| 603 | MWriteRootFile write(2, fname, fOverwrite?"RECREATE":"NEW");
|
|---|
| 604 | // Run Header
|
|---|
| 605 | write.AddContainer("MRawRunHeader", "RunHeaders");
|
|---|
| 606 | write.AddContainer("MBadPixelsCam", "RunHeaders");
|
|---|
| 607 | write.AddContainer("MGeomCam", "RunHeaders");
|
|---|
| 608 | // Monte Carlo Headers
|
|---|
| 609 | write.AddContainer("MMcRunHeader", "RunHeaders", kFALSE);
|
|---|
| 610 | write.AddContainer("MMcFadcHeader", "RunHeaders", kFALSE);
|
|---|
| 611 | write.AddContainer("MMcTrigHeader", "RunHeaders", kFALSE);
|
|---|
| 612 | write.AddContainer("MMcConfigRunHeader", "RunHeaders", kFALSE);
|
|---|
| 613 | write.AddContainer("MMcCorsikaRunHeader", "RunHeaders", kFALSE);
|
|---|
| 614 | // Monte Carlo
|
|---|
| 615 | write.AddContainer("MMcEvt", "Events", kFALSE);
|
|---|
| 616 | write.AddContainer("MMcTrig", "Events", kFALSE);
|
|---|
| 617 | // Data tree
|
|---|
| 618 | write.AddContainer("MSignalCam", "Events");
|
|---|
| 619 | write.AddContainer("MPedPhotFundamental", "Events");
|
|---|
| 620 | write.AddContainer("MPedPhotFromExtractor", "Events");
|
|---|
| 621 | write.AddContainer("MPedPhotFromExtractorRndm", "Events");
|
|---|
| 622 | write.AddContainer("MTime", "Events", kFALSE);
|
|---|
| 623 | write.AddContainer("MRawEvtHeader", "Events");
|
|---|
| 624 | // Slow-Control: Current-tree
|
|---|
| 625 | write.AddContainer("MTimeCurrents", "Currents", kFALSE);
|
|---|
| 626 | write.AddContainer("MCameraDC", "Currents", kFALSE);
|
|---|
| 627 | write.AddContainer("MReportCurrents", "Currents", kFALSE);
|
|---|
| 628 | // Slow-Control: Camera-tree
|
|---|
| 629 | write.AddContainer("MReportCamera", "Camera", kFALSE);
|
|---|
| 630 | write.AddContainer("MTimeCamera", "Camera", kFALSE);
|
|---|
| 631 | write.AddContainer("MCameraAUX", "Camera", kFALSE);
|
|---|
| 632 | write.AddContainer("MCameraCalibration", "Camera", kFALSE);
|
|---|
| 633 | write.AddContainer("MCameraCooling", "Camera", kFALSE);
|
|---|
| 634 | write.AddContainer("MCameraHV", "Camera", kFALSE);
|
|---|
| 635 | write.AddContainer("MCameraLV", "Camera", kFALSE);
|
|---|
| 636 | write.AddContainer("MCameraLids", "Camera", kFALSE);
|
|---|
| 637 | // Slow-Control: Trigger-tree
|
|---|
| 638 | write.AddContainer("MReportTrigger", "Trigger", kFALSE);
|
|---|
| 639 | write.AddContainer("MTimeTrigger", "Trigger", kFALSE);
|
|---|
| 640 | // Slow-Control: Drive-tree
|
|---|
| 641 | write.AddContainer("MReportDrive", "Drive", kFALSE);
|
|---|
| 642 | write.AddContainer("MTimeDrive", "Drive", kFALSE);
|
|---|
| 643 | // Slow-Control: Central Control-tree
|
|---|
| 644 | write.AddContainer("MReportCC", "CC", kFALSE);
|
|---|
| 645 | write.AddContainer("MTimeCC", "CC", kFALSE);
|
|---|
| 646 |
|
|---|
| 647 | // Write the special MC tree
|
|---|
| 648 | MWriteRootFile writemc(2, fname, fOverwrite?"RECREATE":"NEW");
|
|---|
| 649 | writemc.SetName("WriteMC");
|
|---|
| 650 | writemc.AddContainer("MMcEvtBasic", "OriginalMC");
|
|---|
| 651 |
|
|---|
| 652 | // Now setup tasklist for events
|
|---|
| 653 | MTaskList tlist2;
|
|---|
| 654 |
|
|---|
| 655 | tlist2.AddToList(&caldec);
|
|---|
| 656 | tlist2.AddToList(&decode);
|
|---|
| 657 | tlist2.AddToList(&apply);
|
|---|
| 658 | tlist2.AddToList(&merge);
|
|---|
| 659 | tlist2.AddToList(&pedlo1);
|
|---|
| 660 | tlist2.AddToList(&pedlo2);
|
|---|
| 661 | tlist2.AddToList(&pedlo3);
|
|---|
| 662 | //-----------------------------------------------------------
|
|---|
| 663 |
|
|---|
| 664 | MTaskList tlist3;
|
|---|
| 665 | tlist3.SetFilter(&fcalib);
|
|---|
| 666 |
|
|---|
| 667 | if (fIsInterlaced)
|
|---|
| 668 | {
|
|---|
| 669 | tlist2.AddToList(&fcalib);
|
|---|
| 670 | tlist2.AddToList(&tlist3);
|
|---|
| 671 |
|
|---|
| 672 | if (IsUsePINDiode())
|
|---|
| 673 | tlist3.AddToList(&pinext);
|
|---|
| 674 | if (IsUseBlindPixel())
|
|---|
| 675 | tlist3.AddToList(&bldext);
|
|---|
| 676 | tlist3.AddToList(&taskenv3);
|
|---|
| 677 | tlist3.AddToList(&pacalc);
|
|---|
| 678 | tlist3.AddToList(&filcam);
|
|---|
| 679 | if (fIsRelTimesUpdate)
|
|---|
| 680 | tlist3.AddToList(&filtme);
|
|---|
| 681 | if (IsUseBlindPixel())
|
|---|
| 682 | tlist3.AddToList(&filbnd);
|
|---|
| 683 | if (IsUsePINDiode())
|
|---|
| 684 | tlist3.AddToList(&filpin);
|
|---|
| 685 | tlist3.AddToList(&chcalc);
|
|---|
| 686 | if (fIsRelTimesUpdate)
|
|---|
| 687 | tlist3.AddToList(&recalc);
|
|---|
| 688 | }
|
|---|
| 689 |
|
|---|
| 690 | // Continue for all non-cosmic events
|
|---|
| 691 | tlist2.AddToList(&conttp);
|
|---|
| 692 | if (extractor1)
|
|---|
| 693 | tlist2.AddToList(&taskenv1);
|
|---|
| 694 | if (extractor2)
|
|---|
| 695 | tlist2.AddToList(&taskenv2);
|
|---|
| 696 | tlist2.AddToList(&fill0);
|
|---|
| 697 | tlist2.AddToList(&fill1);
|
|---|
| 698 | tlist2.AddToList(&contcos);
|
|---|
| 699 | if (fIsHiLoCalibration)
|
|---|
| 700 | {
|
|---|
| 701 | plist.AddToList(&hilocam);
|
|---|
| 702 | tlist2.AddToList(&filhil);
|
|---|
| 703 | }
|
|---|
| 704 | if (fIsPulsePosCheck)
|
|---|
| 705 | {
|
|---|
| 706 | plist.AddToList(&hpulcam);
|
|---|
| 707 | tlist2.AddToList(&filpul);
|
|---|
| 708 | }
|
|---|
| 709 |
|
|---|
| 710 | tlist2.AddToList(&fill2);
|
|---|
| 711 | tlist2.AddToList(&calib);
|
|---|
| 712 | if (extractor2 || extractor1->InheritsFrom("MExtractTimeAndCharge"))
|
|---|
| 713 | tlist2.AddToList(&caltm);
|
|---|
| 714 | if (fIsInterlaced)
|
|---|
| 715 | tlist2.AddToList(&fill8);
|
|---|
| 716 | tlist2.AddToList(&bpcal);
|
|---|
| 717 | tlist2.AddToList(&treat);
|
|---|
| 718 | tlist2.AddToList(&fill6);
|
|---|
| 719 | // tlist2.AddToList(&fill3);
|
|---|
| 720 | tlist2.AddToList(&fill4);
|
|---|
| 721 | tlist2.AddToList(&fill5);
|
|---|
| 722 | //if (extractor2 || extractor1->InheritsFrom("MExtractTimeAndCharge"))
|
|---|
| 723 | // tlist2.AddToList(&fill7);
|
|---|
| 724 | tlist2.AddToList(&fill9);
|
|---|
| 725 | tlist2.AddToList(&fillR);
|
|---|
| 726 | tlist2.AddToList(&fillO);
|
|---|
| 727 |
|
|---|
| 728 | tlist2.AddToList(&fillflorian);
|
|---|
| 729 |
|
|---|
| 730 | // Setup List for Drive-tree
|
|---|
| 731 | //MPointingPosCalc pcalc;
|
|---|
| 732 |
|
|---|
| 733 | // Now setup main tasklist
|
|---|
| 734 | tlist.AddToList(read);
|
|---|
| 735 |
|
|---|
| 736 | if (IsUseMC())
|
|---|
| 737 | {
|
|---|
| 738 | tlist.AddToList(&writemc);
|
|---|
| 739 | tlist.AddToList(&contmc);
|
|---|
| 740 | }
|
|---|
| 741 |
|
|---|
| 742 | //if (IsUseRootData())
|
|---|
| 743 | // tlist2.AddToList(&pextr);
|
|---|
| 744 | tlist.AddToList(&tlist2, IsUseRootData() ? "Events" : "All");
|
|---|
| 745 |
|
|---|
| 746 | //if (IsUseMC())
|
|---|
| 747 | // tlist.AddToList(&pcalc, "Drive");
|
|---|
| 748 |
|
|---|
| 749 | tlist.AddToList(&write);
|
|---|
| 750 |
|
|---|
| 751 | // Create and setup the eventloop
|
|---|
| 752 | MEvtLoop evtloop(fName);
|
|---|
| 753 | evtloop.SetParList(&plist);
|
|---|
| 754 | evtloop.SetDisplay(fDisplay);
|
|---|
| 755 | evtloop.SetLogStream(fLog);
|
|---|
| 756 | if (!SetupEnv(evtloop))
|
|---|
| 757 | return kFALSE;
|
|---|
| 758 |
|
|---|
| 759 | // Execute first analysis
|
|---|
| 760 | const Bool_t rc = evtloop.Eventloop(fMaxEvents);
|
|---|
| 761 |
|
|---|
| 762 | // make sure owned object are deleted
|
|---|
| 763 | if (extractor1 && extractor1!=fExtractor)
|
|---|
| 764 | delete extractor1;
|
|---|
| 765 | if (extractor2)
|
|---|
| 766 | delete extractor2;
|
|---|
| 767 | if (extractor3)
|
|---|
| 768 | delete extractor3;
|
|---|
| 769 |
|
|---|
| 770 | // return if job failed
|
|---|
| 771 | if (!rc)
|
|---|
| 772 | {
|
|---|
| 773 | *fLog << err << GetDescriptor() << ": Failed." << endl;
|
|---|
| 774 | return kFALSE;
|
|---|
| 775 | }
|
|---|
| 776 |
|
|---|
| 777 | // if everything went ok write and display result
|
|---|
| 778 | DisplayResult(plist);
|
|---|
| 779 |
|
|---|
| 780 | if (fIsPixelCheck)
|
|---|
| 781 | {
|
|---|
| 782 | if (fIsPulsePosCheck)
|
|---|
| 783 | hpulcam[fCheckedPixId].DrawClone("");
|
|---|
| 784 |
|
|---|
| 785 | if (fIsHiLoCalibration)
|
|---|
| 786 | hilocam[fCheckedPixId].DrawClone("");
|
|---|
| 787 | }
|
|---|
| 788 |
|
|---|
| 789 | interlacedcont.Add(&pulcam);
|
|---|
| 790 |
|
|---|
| 791 | if (fIsHiLoCalibration)
|
|---|
| 792 | interlacedcont.Add(&hilcam);
|
|---|
| 793 |
|
|---|
| 794 | if (fIsPulsePosCheck)
|
|---|
| 795 | interlacedcont.Add(plist.FindObject("MHCalibrationPulseTimeCam"));
|
|---|
| 796 |
|
|---|
| 797 | if (fIsHiLoCalibration)
|
|---|
| 798 | interlacedcont.Add(plist.FindObject("MHCalibrationHiLoCam"));
|
|---|
| 799 |
|
|---|
| 800 | if (!WriteResult(interlacedcont))
|
|---|
| 801 | return kFALSE;
|
|---|
| 802 |
|
|---|
| 803 | // return if job went ok
|
|---|
| 804 | *fLog << all << GetDescriptor() << ": Done." << endl;
|
|---|
| 805 | *fLog << endl << endl;
|
|---|
| 806 |
|
|---|
| 807 | return kTRUE;
|
|---|
| 808 | }
|
|---|
| 809 |
|
|---|
| 810 |
|
|---|
| 811 | void MJCalibrateSignal::DisplayResult(MParList &plist)
|
|---|
| 812 | {
|
|---|
| 813 | if (!fDisplay || !fIsHiLoCalibration)
|
|---|
| 814 | return;
|
|---|
| 815 |
|
|---|
| 816 | MCalibrationHiLoCam *hcam = (MCalibrationHiLoCam*)plist.FindObject("MCalibrationHiLoCam");
|
|---|
| 817 | MGeomCam *geom = (MGeomCam*)plist.FindObject("MGeomCam");
|
|---|
| 818 | if (!hcam || !geom)
|
|---|
| 819 | return;
|
|---|
| 820 |
|
|---|
| 821 | // Create histograms to display
|
|---|
| 822 | MHCamera disp1(*geom, "HiLoConv", "Ratio Amplification HiGain vs. LoGain (Charges)");
|
|---|
| 823 | MHCamera disp2(*geom, "HiLoDiff", "Arrival Time Diff. HiGain vs. LoGain (Times)");
|
|---|
| 824 |
|
|---|
| 825 | disp1.SetCamContent(*hcam, 0);
|
|---|
| 826 | disp1.SetCamError( *hcam, 1);
|
|---|
| 827 | disp2.SetCamContent(*hcam, 5);
|
|---|
| 828 | disp2.SetCamError( *hcam, 6);
|
|---|
| 829 |
|
|---|
| 830 | disp1.SetYTitle("R [1]");
|
|---|
| 831 | disp2.SetYTitle("\\Delta T [FADC sl.]");
|
|---|
| 832 |
|
|---|
| 833 | TCanvas &c1 = fDisplay->AddTab("HiLoConv");
|
|---|
| 834 | c1.Divide(2,3);
|
|---|
| 835 |
|
|---|
| 836 | disp1.CamDraw(c1, 1, 2, 1);
|
|---|
| 837 | disp2.CamDraw(c1, 2, 2, 1);
|
|---|
| 838 | }
|
|---|
| 839 |
|
|---|