| 1 | /* ======================================================================== *\
|
|---|
| 2 | !
|
|---|
| 3 | ! *
|
|---|
| 4 | ! * This file is part of MARS, the MAGIC Analysis and Reconstruction
|
|---|
| 5 | ! * Software. It is distributed to you in the hope that it can be a useful
|
|---|
| 6 | ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
|
|---|
| 7 | ! * It is distributed WITHOUT ANY WARRANTY.
|
|---|
| 8 | ! *
|
|---|
| 9 | ! * Permission to use, copy, modify and distribute this software and its
|
|---|
| 10 | ! * documentation for any purpose is hereby granted without fee,
|
|---|
| 11 | ! * provided that the above copyright notice appear in all copies and
|
|---|
| 12 | ! * that both that copyright notice and this permission notice appear
|
|---|
| 13 | ! * in supporting documentation. It is provided "as is" without express
|
|---|
| 14 | ! * or implied warranty.
|
|---|
| 15 | ! *
|
|---|
| 16 | !
|
|---|
| 17 | !
|
|---|
| 18 | ! Author(s): Markus Gaug, 11/2003 <mailto:markus@ifae.es>
|
|---|
| 19 | !
|
|---|
| 20 | ! Copyright: MAGIC Software Development, 2000-2004
|
|---|
| 21 | !
|
|---|
| 22 | !
|
|---|
| 23 | \* ======================================================================== */
|
|---|
| 24 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 25 | //
|
|---|
| 26 | // calibration.C
|
|---|
| 27 | //
|
|---|
| 28 | // Needs as arguments the run number of a calibration file ("*_C_*.root") and
|
|---|
| 29 | // the run number of the corresponding pedestal file ("*_P_*.root").
|
|---|
| 30 | //
|
|---|
| 31 | // The TString inpath has to be set correctly.
|
|---|
| 32 | //
|
|---|
| 33 | // The macro searches for the pulser colour which corresponds to the calibration
|
|---|
| 34 | // run number. If the run number is smaller than 20000, pulser colour "CT1"
|
|---|
| 35 | // is assumed, otherwise, it searches for the strings "green", "blue", "uv" or
|
|---|
| 36 | // "ct1" in the filenames. If no colour or multiple colours are found, the
|
|---|
| 37 | // execution is aborted.
|
|---|
| 38 | //
|
|---|
| 39 | // The container MBadPixelsCam is created and followed during the execution of the
|
|---|
| 40 | // rest of the macro.
|
|---|
| 41 | //
|
|---|
| 42 | // A first loop over the pedestal file is performed using the class MJPedestal
|
|---|
| 43 | //
|
|---|
| 44 | // The container MCalibrationQECam is created and followed during the execution of the
|
|---|
| 45 | // rest of the macro.
|
|---|
| 46 | //
|
|---|
| 47 | // A loop over the calibration files is performed using the class MJCalibration.
|
|---|
| 48 | // The results are displayed using the MJCalibration::SetNormalDisplay() facility,
|
|---|
| 49 | // but other displays can easily be uncommented.
|
|---|
| 50 | // The call to MJCalibration skips the relative time calibration, which can be
|
|---|
| 51 | // uncommented as well.
|
|---|
| 52 | //
|
|---|
| 53 | // Last, a third loop is performed over the calibration file again in order to
|
|---|
| 54 | // "calibrate" it and test the resulting outcome.
|
|---|
| 55 | //
|
|---|
| 56 | //////////////////////////////////////////////////////////////////////////////////////////
|
|---|
| 57 | #include "getExtractor.C"
|
|---|
| 58 |
|
|---|
| 59 | #include "MJPedestal.h"
|
|---|
| 60 | #include "MJCalibration.h"
|
|---|
| 61 | #include "MJExtractSignal.h"
|
|---|
| 62 | #include "MJExtractCalibTest.h"
|
|---|
| 63 | #include "MRunIter.h"
|
|---|
| 64 | #include "MStatusDisplay.h"
|
|---|
| 65 | #include "MCalibrationQECamMagic.h"
|
|---|
| 66 | #include "MCalibrationQECam.h"
|
|---|
| 67 | #include "MBadPixelsCam.h"
|
|---|
| 68 | #include "MArgs.h"
|
|---|
| 69 | #include "MArray.h"
|
|---|
| 70 | #include "MParContainer.h"
|
|---|
| 71 |
|
|---|
| 72 | #include "TStyle.h"
|
|---|
| 73 | #include "TObject.h"
|
|---|
| 74 | #include "TObjectTable.h"
|
|---|
| 75 | #include "TCanvas.h"
|
|---|
| 76 | #include "TPad.h"
|
|---|
| 77 | #include "TH1.h"
|
|---|
| 78 | #include "TPaveStats.h"
|
|---|
| 79 |
|
|---|
| 80 | using namespace std;
|
|---|
| 81 |
|
|---|
| 82 | static TString outpath = "./";
|
|---|
| 83 | static TString inpath = "/home/rootdata/Calib/2004_09_22";
|
|---|
| 84 | //static TString badfile = "";
|
|---|
| 85 | static TString badfile = "badpixels_only0_388_559.dat";
|
|---|
| 86 | //
|
|---|
| 87 | // the default pedestal run for the calibration
|
|---|
| 88 | //
|
|---|
| 89 | static const Int_t pedrun = 38995;
|
|---|
| 90 | //
|
|---|
| 91 | // the default start calibration run
|
|---|
| 92 | //
|
|---|
| 93 | static const Int_t calrun1 = 38997;
|
|---|
| 94 | //
|
|---|
| 95 | // the default last calibration run (if 0, only one run is taken, otherwise consecutive runs
|
|---|
| 96 | // between calrun1 and calrun2)
|
|---|
| 97 | //
|
|---|
| 98 | static const Int_t calrun2 = 0;
|
|---|
| 99 | //
|
|---|
| 100 | // A switch to output debugging information about Objects use
|
|---|
| 101 | //
|
|---|
| 102 | static Bool_t debug = kFALSE;
|
|---|
| 103 | //
|
|---|
| 104 | // A switch to use the Blind Pixel
|
|---|
| 105 | //
|
|---|
| 106 | static Bool_t blindpix = kTRUE;
|
|---|
| 107 | //
|
|---|
| 108 | // A switch to use the PIN Diode
|
|---|
| 109 | //
|
|---|
| 110 | static Bool_t pindiode = kTRUE;
|
|---|
| 111 | //
|
|---|
| 112 | // Tell if you want to use the display:
|
|---|
| 113 | //
|
|---|
| 114 | static Bool_t useDisplay = kTRUE;
|
|---|
| 115 | //
|
|---|
| 116 | // Tell if you want to test the result afterwards
|
|---|
| 117 | //
|
|---|
| 118 | static Bool_t useTest = kFALSE;
|
|---|
| 119 | //
|
|---|
| 120 | // Tell if you want to test the intensity calibration
|
|---|
| 121 | //
|
|---|
| 122 | static Bool_t useIntensity = kFALSE;
|
|---|
| 123 | //
|
|---|
| 124 | // Tell if you want to store and read the F0 and F1- files
|
|---|
| 125 | //
|
|---|
| 126 | static Bool_t usestorage = kFALSE;
|
|---|
| 127 | //
|
|---|
| 128 | // Tell which extractor you want to use. The flags are counted according
|
|---|
| 129 | // to the extractor-TDAS
|
|---|
| 130 | //
|
|---|
| 131 | static Int_t extractorflag = 1;
|
|---|
| 132 | //
|
|---|
| 133 | Int_t calibration(const UInt_t extflag=extractorflag, const Int_t prun=pedrun,
|
|---|
| 134 | const Int_t crun1=calrun1, const Int_t crun2=calrun2)
|
|---|
| 135 | {
|
|---|
| 136 |
|
|---|
| 137 | MExtractor *extractor = getExtractor(extflag);
|
|---|
| 138 |
|
|---|
| 139 | if (!extractor)
|
|---|
| 140 | return 99;
|
|---|
| 141 |
|
|---|
| 142 | extractor->SetName(Form("%s_Run_%05d",extractor->GetName(),prun));
|
|---|
| 143 | const Bool_t timeandcharge = extractor->InheritsFrom("MExtractTimeAndCharge");
|
|---|
| 144 |
|
|---|
| 145 | gStyle->SetOptStat(1111);
|
|---|
| 146 | gStyle->SetOptFit();
|
|---|
| 147 | gStyle->SetTitleSize(0.35,"u");
|
|---|
| 148 | gStyle->SetTitleFontSize(0.9);
|
|---|
| 149 | gStyle->SetTitleH(0.12);
|
|---|
| 150 | gStyle->SetTitleW(0.95);
|
|---|
| 151 | gStyle->SetLineWidth(1);
|
|---|
| 152 |
|
|---|
| 153 | if (debug)
|
|---|
| 154 | TObject::SetObjectStat(kTRUE);
|
|---|
| 155 |
|
|---|
| 156 | MRunIter pruns;
|
|---|
| 157 | MRunIter cruns;
|
|---|
| 158 |
|
|---|
| 159 | pruns.AddRun(prun,inpath);
|
|---|
| 160 |
|
|---|
| 161 | if (crun2==0)
|
|---|
| 162 | cruns.AddRun(crun1,inpath);
|
|---|
| 163 | else
|
|---|
| 164 | cruns.AddRuns(crun1,crun2,inpath);
|
|---|
| 165 |
|
|---|
| 166 | MStatusDisplay *display = NULL;
|
|---|
| 167 |
|
|---|
| 168 | if (useDisplay)
|
|---|
| 169 | {
|
|---|
| 170 | display = new MStatusDisplay;
|
|---|
| 171 | display->SetUpdateTime(3000);
|
|---|
| 172 | display->Resize(850,700);
|
|---|
| 173 | }
|
|---|
| 174 |
|
|---|
| 175 | /*****************************************/
|
|---|
| 176 | /* FIRST LOOP: PURE PEDESTAL COMPUTATION */
|
|---|
| 177 | /*****************************************/
|
|---|
| 178 | //
|
|---|
| 179 | // Hand over to the jobs a QE Cam with Cornings initialized
|
|---|
| 180 | //
|
|---|
| 181 | MCalibrationQECamMagic qecam;
|
|---|
| 182 | MBadPixelsCam badcam;
|
|---|
| 183 | //
|
|---|
| 184 | // If you want to exclude pixels from the beginning, read
|
|---|
| 185 | // an ascii-file with the corr. pixel numbers (see MBadPixelsCam)
|
|---|
| 186 | //
|
|---|
| 187 | if (!badfile.IsNull())
|
|---|
| 188 | {
|
|---|
| 189 | ifstream f(badfile.Data());
|
|---|
| 190 | badcam.AsciiRead((istream&)f);
|
|---|
| 191 | f.close();
|
|---|
| 192 | }
|
|---|
| 193 |
|
|---|
| 194 | MJPedestal pedloop1;
|
|---|
| 195 | pedloop1.SetNoStorage(!usestorage);
|
|---|
| 196 | pedloop1.SetEnvDebug(debug);
|
|---|
| 197 | pedloop1.SetExtractor(extractor);
|
|---|
| 198 | pedloop1.SetInput(&pruns);
|
|---|
| 199 | pedloop1.SetPathOut(outpath.Data());
|
|---|
| 200 | if (useDisplay)
|
|---|
| 201 | {
|
|---|
| 202 | pedloop1.SetDisplay(display);
|
|---|
| 203 | pedloop1.SetDataCheckDisplay();
|
|---|
| 204 | }
|
|---|
| 205 | pedloop1.SetBadPixels(badcam);
|
|---|
| 206 |
|
|---|
| 207 | if (!pedloop1.Process())
|
|---|
| 208 | return 1;
|
|---|
| 209 |
|
|---|
| 210 | /****************************************/
|
|---|
| 211 | /* SECOND LOOP: CALIBRATION COMPUTATION */
|
|---|
| 212 | /****************************************/
|
|---|
| 213 |
|
|---|
| 214 | MJPedestal pedloop2;
|
|---|
| 215 | MJCalibration calloop;
|
|---|
| 216 |
|
|---|
| 217 | if (timeandcharge)
|
|---|
| 218 | {
|
|---|
| 219 | /***********************************************************/
|
|---|
| 220 | /* NEEDE FOR SECOND LOOP: EXTRACTOR RESOLUTION COMPUTATION */
|
|---|
| 221 | /***********************************************************/
|
|---|
| 222 |
|
|---|
| 223 | pedloop2.SetUseData();
|
|---|
| 224 | pedloop2.SetNoStorage(!usestorage);
|
|---|
| 225 | pedloop2.SetEnvDebug(debug);
|
|---|
| 226 | pedloop2.SetExtractor(extractor);
|
|---|
| 227 | pedloop2.SetExtractorResolution();
|
|---|
| 228 | pedloop2.SetPedestals(pedloop1.GetPedestalCam());
|
|---|
| 229 | pedloop2.SetInput(&pruns);
|
|---|
| 230 | pedloop2.SetPathOut(outpath.Data());
|
|---|
| 231 | if (useDisplay)
|
|---|
| 232 | {
|
|---|
| 233 | pedloop2.SetDisplay(display);
|
|---|
| 234 | pedloop2.SetDataCheckDisplay();
|
|---|
| 235 | }
|
|---|
| 236 | pedloop2.SetBadPixels(badcam);
|
|---|
| 237 |
|
|---|
| 238 | if (!pedloop2.Process())
|
|---|
| 239 | return 1;
|
|---|
| 240 |
|
|---|
| 241 | extractor->SetNoiseCalculation(kFALSE);
|
|---|
| 242 | calloop.SetExtractorCam(pedloop2.GetPedestalCam());
|
|---|
| 243 | }
|
|---|
| 244 |
|
|---|
| 245 | MPedestalCam &pedcam = pedloop1.GetPedestalCam();
|
|---|
| 246 |
|
|---|
| 247 | if (debug)
|
|---|
| 248 | calloop.SetDebug();
|
|---|
| 249 | calloop.SetEnvDebug(debug);
|
|---|
| 250 | if (useIntensity)
|
|---|
| 251 | calloop.SetIntensity();
|
|---|
| 252 | // calloop.SetHistsStorage();
|
|---|
| 253 | calloop.SetNoStorage(!usestorage);
|
|---|
| 254 | //
|
|---|
| 255 | // If you want to set a colour explicitely from outside (not recommanded!)
|
|---|
| 256 | // calloop.SetColor(MCalibrationCam::kUV);
|
|---|
| 257 | //
|
|---|
| 258 | // If you want to run the data-check on RAW DATA!!!, choose:
|
|---|
| 259 | // calloop.SetDataCheck();
|
|---|
| 260 | //
|
|---|
| 261 | // If you want to see the data-check plots only, choose:
|
|---|
| 262 | calloop.SetDataCheckDisplay();
|
|---|
| 263 | //calloop.SetNormalDisplay();
|
|---|
| 264 | //
|
|---|
| 265 | // For everything, you have ever dreamed of, choose:
|
|---|
| 266 | // calloop.SetFullDisplay();
|
|---|
| 267 |
|
|---|
| 268 | //
|
|---|
| 269 | // If you want to calibrate the times as well, choose:
|
|---|
| 270 | //
|
|---|
| 271 | calloop.SetExtractor(extractor);
|
|---|
| 272 | calloop.SetInput(&cruns);
|
|---|
| 273 | calloop.SetPathOut(outpath.Data());
|
|---|
| 274 | if (useDisplay)
|
|---|
| 275 | calloop.SetDisplay(display);
|
|---|
| 276 | calloop.SetUseBlindPixel(blindpix);
|
|---|
| 277 | calloop.SetUsePINDiode(pindiode);
|
|---|
| 278 | calloop.SetQECam(qecam);
|
|---|
| 279 | calloop.SetBadPixels(pedloop1.GetBadPixels());
|
|---|
| 280 |
|
|---|
| 281 | if (!calloop.Process(pedcam))
|
|---|
| 282 | return 2;
|
|---|
| 283 |
|
|---|
| 284 | //
|
|---|
| 285 | // The next lines are the use the Print() function and have
|
|---|
| 286 | // all the results as ascii-tables:
|
|---|
| 287 | //
|
|---|
| 288 | if (debug)
|
|---|
| 289 | {
|
|---|
| 290 | MCalibrationChargeCam &chargecam = calloop.GetCalibrationCam();
|
|---|
| 291 | MCalibrationQECam &nqecam = calloop.GetQECam();
|
|---|
| 292 | MBadPixelsCam &badbad = calloop.GetBadPixels();
|
|---|
| 293 | chargecam.Print();
|
|---|
| 294 | nqecam.Print();
|
|---|
| 295 | badbad.Print();
|
|---|
| 296 | }
|
|---|
| 297 |
|
|---|
| 298 | /********************************************************************/
|
|---|
| 299 | /* THIRD LOOP: APPLY CALIBRATION TO THE CALIBRATION FILES FOR TESTS */
|
|---|
| 300 | /********************************************************************/
|
|---|
| 301 |
|
|---|
| 302 | if (useTest)
|
|---|
| 303 | {
|
|---|
| 304 |
|
|---|
| 305 | MJExtractCalibTest testloop;
|
|---|
| 306 |
|
|---|
| 307 | // If you want to see the data-check plots only, choose:
|
|---|
| 308 | testloop.SetDataCheckDisplay();
|
|---|
| 309 |
|
|---|
| 310 | testloop.SetExtractor(extractor);
|
|---|
| 311 | testloop.SetInput(&cruns);
|
|---|
| 312 | testloop.SetPathOut(outpath);
|
|---|
| 313 | if (useDisplay)
|
|---|
| 314 | testloop.SetDisplay(display);
|
|---|
| 315 | testloop.SetBadPixels(calloop.GetBadPixels());
|
|---|
| 316 |
|
|---|
| 317 | if (!testloop.ProcessD(pedloop1.GetPedestalCam(),calloop.GetCalibrationCam(),calloop.GetQECam()))
|
|---|
| 318 | return 3;
|
|---|
| 319 |
|
|---|
| 320 | return 4;
|
|---|
| 321 |
|
|---|
| 322 | }
|
|---|
| 323 |
|
|---|
| 324 | /********************************************************************/
|
|---|
| 325 | /* FOURTH LOOP: APPLY CALIBRATION TO THE PEDESTAL FILES */
|
|---|
| 326 | /********************************************************************/
|
|---|
| 327 |
|
|---|
| 328 | MJExtractSignal pedphotloop;
|
|---|
| 329 |
|
|---|
| 330 | pedphotloop.SetExtractor(extractor);
|
|---|
| 331 | pedphotloop.SetInput(&pruns);
|
|---|
| 332 | pedphotloop.SetOutputPath(outpath);
|
|---|
| 333 | if (useDisplay)
|
|---|
| 334 | pedphotloop.SetDisplay(display);
|
|---|
| 335 | pedphotloop.SetBadPixels(calloop.GetBadPixels());
|
|---|
| 336 |
|
|---|
| 337 | if (!pedphotloop.ProcessP(pedloop1.GetPedestalCam(),calloop.GetCalibrationCam(),calloop.GetQECam()))
|
|---|
| 338 | return 5;
|
|---|
| 339 |
|
|---|
| 340 | if (debug)
|
|---|
| 341 | TObject::SetObjectStat(kFALSE);
|
|---|
| 342 |
|
|---|
| 343 | //
|
|---|
| 344 | // Debugging at the end:
|
|---|
| 345 | //
|
|---|
| 346 | if (debug)
|
|---|
| 347 | gObjectTable->Print();
|
|---|
| 348 |
|
|---|
| 349 | return 0;
|
|---|
| 350 | }
|
|---|
| 351 |
|
|---|
| 352 | static void Usage()
|
|---|
| 353 | {
|
|---|
| 354 | gLog << endl;
|
|---|
| 355 | gLog << "Usage:" << endl;
|
|---|
| 356 | gLog << endl;
|
|---|
| 357 | gLog << " calibration [ped.run nr.] [first cal.run nr.] [last cal.run nr.]" << endl ;
|
|---|
| 358 | gLog << endl;
|
|---|
| 359 | gLog << " ped.run.nr: Run number of the pedestal file." << endl;
|
|---|
| 360 | gLog << " first cal.run nr.: Run number of the first calibration file." << endl;
|
|---|
| 361 | gLog << " last cal.run nr.: Run number of the last calibration file." << endl;
|
|---|
| 362 | gLog << endl;
|
|---|
| 363 | gLog << "All calibration runs between (first cal.run nr.) and (last cal.run nr.) will be used" << endl;
|
|---|
| 364 | gLog << "If last.cal.run.nr is 0 (default), only one calibration run is taken" << endl;
|
|---|
| 365 | gLog << endl;
|
|---|
| 366 | gLog << "Additional Options: " << endl;
|
|---|
| 367 | gLog << " --extractor=# Choose one of the following possible extractors (integer)" << endl;
|
|---|
| 368 | gLog << endl;
|
|---|
| 369 | gLog << " Nr. Extractor Parameters " << endl;
|
|---|
| 370 | gLog << endl;
|
|---|
| 371 | gLog << " MExtractFixedWindow: " << endl;
|
|---|
| 372 | gLog << " with the following parameters, if 'maxbin' defines the mean position" << endl;
|
|---|
| 373 | gLog << " of the High-Gain FADC slice carrying the pulse maximum: " << endl;
|
|---|
| 374 | gLog << " 1: SetRange('maxbin}}-1,'maxbin}}+2,'maxbin}}+0.5,'maxbin}}+3.5) " << endl;
|
|---|
| 375 | gLog << " 2: SetRange('maxbin'-1,'maxbin'+2,'maxbin'-0.5,'maxbin'+4.5)" << endl;
|
|---|
| 376 | gLog << " 3: SetRange('maxbin'-2,'maxbin'+3,'maxbin'-0.5,'maxbin'+4.5)" << endl;
|
|---|
| 377 | gLog << " 4: SetRange('maxbin'-3,'maxbin'+4,'maxbin'-1.5,'maxbin'+5.5)" << endl;
|
|---|
| 378 | gLog << " 5: SetRange('maxbin'-5,'maxbin'+8,'maxbin'-1.5,'maxbin'+7.5)" << endl;
|
|---|
| 379 | gLog << " MExtractFixedWindowSpline: " << endl;
|
|---|
| 380 | gLog << " 6: SetRange('maxbin'-1,'maxbin'+2,'maxbin'+0.5,'maxbin'+3.5)" << endl;
|
|---|
| 381 | gLog << " 7: SetRange('maxbin'-1,'maxbin'+2,'maxbin'-0.5,'maxbin'+4.5)" << endl;
|
|---|
| 382 | gLog << " 8: SetRange('maxbin'-2,'maxbin'+3,'maxbin'-0.5,'maxbin'+4.5)" << endl;
|
|---|
| 383 | gLog << " 9: SetRange('maxbin'-3,'maxbin'+4,'maxbin'-1.5,'maxbin'+5.5)" << endl;
|
|---|
| 384 | gLog << " 10: SetRange('maxbin'-5,'maxbin'+8,'maxbin'-1.5,'maxbin'+7.5)" << endl;
|
|---|
| 385 | gLog << " MExtractFixedWindowPeakSearch: " << endl;
|
|---|
| 386 | gLog << " SetRange(0,18,2,14) and the following parameters:" << endl;
|
|---|
| 387 | gLog << " 11: SetWindows(2,2,2)" << endl;
|
|---|
| 388 | gLog << " 12: SetWindows(4,4,2)" << endl;
|
|---|
| 389 | gLog << " 13: SetWindows(6,6,4)" << endl;
|
|---|
| 390 | gLog << " 14: SetWindows(4,6,4)" << endl;
|
|---|
| 391 | gLog << " 15: SetWindows(8,8,4)" << endl;
|
|---|
| 392 | gLog << " 16: SetWindows(14,10,4)" << endl;
|
|---|
| 393 | gLog << " MExtractTimeAndChargeSlidingWindow:" << endl;
|
|---|
| 394 | gLog << " SetRange(0,18,2,14) and the following parameters:" << endl;
|
|---|
| 395 | gLog << " 17: SetWindowSize(2,2)" << endl;
|
|---|
| 396 | gLog << " 18: SetWindowSize(4,4)" << endl;
|
|---|
| 397 | gLog << " 19: SetWindowSize(6,6)" << endl;
|
|---|
| 398 | gLog << " 20: SetWindowSize(4,6)" << endl;
|
|---|
| 399 | gLog << " 21: SetWindowSize(8,8)" << endl;
|
|---|
| 400 | gLog << " 22: SetWindowSize(14,10)" << endl;
|
|---|
| 401 | gLog << " MExtractTimeAndChargeSpline: " << endl;
|
|---|
| 402 | gLog << " SetChargeType(MExtractTimeAndChargeSpline::kIntegral) and:" << endl;
|
|---|
| 403 | gLog << " SetRange(0,18,2,14) and the following parameters:" << endl;
|
|---|
| 404 | gLog << " 23: SetRiseTime(1.5); SetFallTime(4.5)" << endl;
|
|---|
| 405 | gLog << " 24: SetRiseTime(0.5); SetFallTime(2.5)" << endl;
|
|---|
| 406 | gLog << " 25: SetRiseTime(0.5); SetFallTime(1.5)" << endl;
|
|---|
| 407 | gLog << " 26: SetRiseTime(0.5); SetFallTime(0.5)" << endl;
|
|---|
| 408 | gLog << " 27: SetChargeType(MExtractTimeAndChargeSpline::kAmplitude" << endl;
|
|---|
| 409 | gLog << " SetRange(0,10,4,11)" << endl;
|
|---|
| 410 | gLog << " MExtractTimeAndChargeDigitalFilter" << endl;
|
|---|
| 411 | gLog << " SetRange(0,18,2,14) and the following parameters:" << endl;
|
|---|
| 412 | gLog << " 28: SetNameWeightsFile('msignal/cosmics_weights.dat')" << endl;
|
|---|
| 413 | gLog << " 29: SetNameWeightsFile('msignal/cosmics_weights4.dat')" << endl;
|
|---|
| 414 | gLog << " 30: SetNameWeightsFile('msignal/cosmics_weights_logain6.dat')" << endl;
|
|---|
| 415 | gLog << " 31: SetNameWeightsFile('msignal/cosmics_weights_logain4.dat')" << endl;
|
|---|
| 416 | gLog << " 32: SetNameWeightsFile('msignal/calibration_weights_UV.dat')" << endl;
|
|---|
| 417 | gLog << " 33: SetNameWeightsFile('msignal/calibration_weights_UV4.dat')" << endl;
|
|---|
| 418 | gLog << " 34: SetNameWeightsFile('msignal/calibration_weights_UV_logain6.dat')" << endl;
|
|---|
| 419 | gLog << " 35: SetNameWeightsFile('msignal/calibration_weights_UV_logain4.dat')" << endl;
|
|---|
| 420 | gLog << " 36: Real Fit: (not yet implemented)" << endl;
|
|---|
| 421 | gLog << endl;
|
|---|
| 422 | gLog << " --inpath=# Find the data in inpath" << endl;
|
|---|
| 423 | gLog << " --outpath=# Write the output containers to outpath" << endl;
|
|---|
| 424 | gLog << " --badfile=# Use the file # to exclude pixels from the beginning" << endl;
|
|---|
| 425 | gLog << " --debug Use the TObjectTable for debugging " << endl;
|
|---|
| 426 | gLog << " and write out the pixels as ascii tables" << endl;
|
|---|
| 427 | gLog << " --useTest Use the class MJExtractCalibTest to test the calibration on itself" << endl;
|
|---|
| 428 | gLog << " --skipBlindPix Skip the blind pixel calibration" << endl;
|
|---|
| 429 | gLog << " --skipPINDiode Skip the PIN Diode calibration" << endl;
|
|---|
| 430 | }
|
|---|
| 431 |
|
|---|
| 432 |
|
|---|
| 433 | int main(int argc, char **argv)
|
|---|
| 434 | {
|
|---|
| 435 | //
|
|---|
| 436 | // Evaluate arguments
|
|---|
| 437 | //
|
|---|
| 438 | MArgs arg(argc, argv);
|
|---|
| 439 |
|
|---|
| 440 | if (arg.HasOnly("-?") || arg.HasOnly("-h") || arg.HasOnly("--help"))
|
|---|
| 441 | {
|
|---|
| 442 | Usage();
|
|---|
| 443 | return -1;
|
|---|
| 444 | }
|
|---|
| 445 |
|
|---|
| 446 | debug = arg.HasOnlyAndRemove("--debug") || arg.HasOnlyAndRemove("-d");
|
|---|
| 447 | useTest = arg.HasOnlyAndRemove("--useTest") || arg.HasOnlyAndRemove("-e");
|
|---|
| 448 | blindpix = !(arg.HasOnlyAndRemove("--skipBlindPix"));
|
|---|
| 449 | pindiode = !(arg.HasOnlyAndRemove("--skipPINDiode"));
|
|---|
| 450 |
|
|---|
| 451 | if (arg.HasOption("--extractor="))
|
|---|
| 452 | extractorflag = arg.GetIntAndRemove("--extractor=");
|
|---|
| 453 |
|
|---|
| 454 | if (arg.HasOption("--inpath="))
|
|---|
| 455 | inpath = arg.GetStringAndRemove("--inpath=");
|
|---|
| 456 |
|
|---|
| 457 | if (arg.HasOption("--outpath="))
|
|---|
| 458 | outpath = arg.GetStringAndRemove("--outpath=");
|
|---|
| 459 |
|
|---|
| 460 | if (arg.HasOption("--badfile="))
|
|---|
| 461 | badfile = arg.GetStringAndRemove("--badfile=");
|
|---|
| 462 |
|
|---|
| 463 | if (gSystem->AccessPathName(badfile,kFileExists))
|
|---|
| 464 | {
|
|---|
| 465 | gLog << "WARNING: the bad pixels file '" << badfile.Data() << "' doesn't exist." << endl;
|
|---|
| 466 | badfile = "";
|
|---|
| 467 | }
|
|---|
| 468 |
|
|---|
| 469 | // check for the right usage of the program
|
|---|
| 470 | //
|
|---|
| 471 | if (arg.GetNumArguments()>4)
|
|---|
| 472 | {
|
|---|
| 473 | Usage();
|
|---|
| 474 | return -1;
|
|---|
| 475 | }
|
|---|
| 476 |
|
|---|
| 477 | //
|
|---|
| 478 | // Initialize Non-GUI (batch) mode
|
|---|
| 479 | //
|
|---|
| 480 | gROOT->SetBatch();
|
|---|
| 481 |
|
|---|
| 482 | //
|
|---|
| 483 | // Switch off the display
|
|---|
| 484 | //
|
|---|
| 485 | useDisplay = kTRUE;
|
|---|
| 486 | //
|
|---|
| 487 | // check for the arguments
|
|---|
| 488 | //
|
|---|
| 489 | Int_t pedr = 0;
|
|---|
| 490 | Int_t calr1 = 0;
|
|---|
| 491 | Int_t calr2 = 0;
|
|---|
| 492 |
|
|---|
| 493 | const Int_t nargs = arg.GetNumArguments();
|
|---|
| 494 |
|
|---|
| 495 | if (nargs>=3)
|
|---|
| 496 | {
|
|---|
| 497 | pedr = arg.GetArgumentInt(0);
|
|---|
| 498 | calr1 = arg.GetArgumentInt(1);
|
|---|
| 499 | calr2 = arg.GetArgumentInt(2);
|
|---|
| 500 | return calibration(pedr,calr1,calr2);
|
|---|
| 501 | }
|
|---|
| 502 |
|
|---|
| 503 | if (nargs>=2)
|
|---|
| 504 | {
|
|---|
| 505 | pedr = arg.GetArgumentInt(0);
|
|---|
| 506 | calr1 = arg.GetArgumentInt(1);
|
|---|
| 507 | gLog << "PEDR: " << pedr << " CALR1: " << calr1 << " CALR2 " << calr2 << endl;
|
|---|
| 508 | gLog << "inpath: " << inpath << endl;
|
|---|
| 509 | gLog << "extractor: " << extractorflag << endl;
|
|---|
| 510 | return calibration();
|
|---|
| 511 | }
|
|---|
| 512 |
|
|---|
| 513 | if (nargs>=1)
|
|---|
| 514 | {
|
|---|
| 515 | pedr = arg.GetArgumentInt(0);
|
|---|
| 516 | return calibration(pedr,calr1,calr2);
|
|---|
| 517 | }
|
|---|
| 518 |
|
|---|
| 519 | return calibration(pedr,calr1,calr2);
|
|---|
| 520 | }
|
|---|
| 521 |
|
|---|