| 1 | /*********************************/
 | 
|---|
| 2 | /* Compute the hillas parameters */
 | 
|---|
| 3 | /*********************************/
 | 
|---|
| 4 | 
 | 
|---|
| 5 | #include "TString.h"
 | 
|---|
| 6 | #include "TArrayS.h"
 | 
|---|
| 7 | 
 | 
|---|
| 8 | #include "MParList.h"
 | 
|---|
| 9 | #include "MTaskList.h"
 | 
|---|
| 10 | #include "MPedestalCam.h"
 | 
|---|
| 11 | #include "MBadPixelsCam.h"
 | 
|---|
| 12 | #include "MBadPixelsTreat.h"
 | 
|---|
| 13 | #include "MReadMarsFile.h"
 | 
|---|
| 14 | #include "MGeomApply.h"
 | 
|---|
| 15 | #include "MPedCalcPedRun.h"
 | 
|---|
| 16 | #include "MEvtLoop.h"
 | 
|---|
| 17 | #include "MGeomCamMagic.h"
 | 
|---|
| 18 | #include "MExtractedSignalCam.h"
 | 
|---|
| 19 | #include "MCalibrationChargeCam.h"
 | 
|---|
| 20 | #include "MHCalibrationChargeCam.h"
 | 
|---|
| 21 | #include "MHCalibrationRelTimeCam.h"
 | 
|---|
| 22 | #include "MExtractor.h"
 | 
|---|
| 23 | #include "MExtractFixedWindow.h"
 | 
|---|
| 24 | #include "MExtractFixedWindowPeakSearch.h"
 | 
|---|
| 25 | #include "MExtractSlidingWindow.h"
 | 
|---|
| 26 | #include "MPedCalcFromLoGain.h"
 | 
|---|
| 27 | #include "MExtractSignal.h"
 | 
|---|
| 28 | #include "MCalibrationChargeCalc.h"
 | 
|---|
| 29 | #include "MFCosmics.h"
 | 
|---|
| 30 | #include "MContinue.h"
 | 
|---|
| 31 | #include "MLog.h"
 | 
|---|
| 32 | #include "MCerPhotEvt.h"
 | 
|---|
| 33 | #include "MPedPhotCam.h"
 | 
|---|
| 34 | #include "MCalibrateData.h"
 | 
|---|
| 35 | #include "MPedPhotCalc.h"
 | 
|---|
| 36 | #include "MHillas.h"
 | 
|---|
| 37 | #include "MNewImagePar.h"
 | 
|---|
| 38 | #include "MRawRunHeader.h"
 | 
|---|
| 39 | #include "MSrcPosCam.h"
 | 
|---|
| 40 | #include "MImgCleanStd.h"
 | 
|---|
| 41 | #include "MHillasSrcCalc.h"
 | 
|---|
| 42 | #include "MHillasCalc.h"
 | 
|---|
| 43 | #include "MArrivalTimeCam.h"
 | 
|---|
| 44 | #include "MArrivalTimeCalc2.h"
 | 
|---|
| 45 | #include "MIslands.h"
 | 
|---|
| 46 | #include "MImgIsland.h"
 | 
|---|
| 47 | #include "MIslandsCalc.h"
 | 
|---|
| 48 | #include "MIslandsClean.h"
 | 
|---|
| 49 | #include "MWriteRootFile.h"
 | 
|---|
| 50 | #include "MArgs.h"
 | 
|---|
| 51 | #include "MRunIter.h"
 | 
|---|
| 52 | #include "MJPedestal.h"
 | 
|---|
| 53 | #include "MJCalibration.h"
 | 
|---|
| 54 | #include "MHillasDisplay.h"
 | 
|---|
| 55 | #include "MF.h"
 | 
|---|
| 56 | #include "MContinue.h"
 | 
|---|
| 57 | #include "MReportDrive.h"
 | 
|---|
| 58 | 
 | 
|---|
| 59 | #include "TApplication.h"
 | 
|---|
| 60 | 
 | 
|---|
| 61 | #include <iostream>
 | 
|---|
| 62 | #include <fstream>
 | 
|---|
| 63 | #include <stdlib.h>
 | 
|---|
| 64 | 
 | 
|---|
| 65 | using namespace std;
 | 
|---|
| 66 | 
 | 
|---|
| 67 | Bool_t readDatacards(TString& filename);
 | 
|---|
| 68 | void makeHillas();
 | 
|---|
| 69 | 
 | 
|---|
| 70 | 
 | 
|---|
| 71 | // declaration of variables read from datacards
 | 
|---|
| 72 | TString  outname;
 | 
|---|
| 73 | const TString outpath = "./";
 | 
|---|
| 74 | TString  idirname;
 | 
|---|
| 75 | TString  filter;
 | 
|---|
| 76 | TString  psfilename("makehillas.ps");
 | 
|---|
| 77 | MRunIter pedcaliter;
 | 
|---|
| 78 | MRunIter caliter;
 | 
|---|
| 79 | MRunIter pediter;
 | 
|---|
| 80 | MRunIter datiter;
 | 
|---|
| 81 | UInt_t   display   = 0;
 | 
|---|
| 82 | ULong_t  nmaxevents= 999999999;
 | 
|---|
| 83 | Short_t  calflag   = 1;
 | 
|---|
| 84 | Bool_t   caltimeflag   = kFALSE;
 | 
|---|
| 85 | Short_t  cleanflag   = 1;
 | 
|---|
| 86 | UShort_t lrings     = 1;
 | 
|---|
| 87 | Float_t  lcore     = 3.0;
 | 
|---|
| 88 | Float_t  ltail     = 1.5;
 | 
|---|
| 89 | Int_t    islflag   = 0;
 | 
|---|
| 90 | Float_t  lnew      = 40;
 | 
|---|
| 91 | Int_t    kmethod   = 1;
 | 
|---|
| 92 | Int_t    kalgorithm = 1;
 | 
|---|
| 93 | Int_t    nfiles    = 0;
 | 
|---|
| 94 | Int_t    hifirst = 0;
 | 
|---|
| 95 | Int_t    hilast  = 14;
 | 
|---|
| 96 | Int_t    lofirst = 2;
 | 
|---|
| 97 | Int_t    lolast  = 14;
 | 
|---|
| 98 | Int_t    wsize   = 6;
 | 
|---|
| 99 | Int_t    sext    = 0;
 | 
|---|
| 100 | 
 | 
|---|
| 101 | const TString defaultcard="makehillas.datacard";
 | 
|---|
| 102 | char* chext[3]={"Fixed window","Sliding window","Peak Search"};
 | 
|---|
| 103 | /*************************************************************/
 | 
|---|
| 104 | static void Usage()
 | 
|---|
| 105 | {
 | 
|---|
| 106 |   gLog <<endl;
 | 
|---|
| 107 |   gLog << "Usage is:" << endl;
 | 
|---|
| 108 |   gLog << "   makeHillas [-h] [-?] <datacards>" << endl << endl;
 | 
|---|
| 109 |   gLog << "     <datacards>: datacards file name (dafault makehillas.datacards)" << endl;
 | 
|---|
| 110 |   gLog << "     -?/-h: This help" << endl << endl;
 | 
|---|
| 111 | }
 | 
|---|
| 112 | /*************************************************************/
 | 
|---|
| 113 | int main(int argc, char **argv)
 | 
|---|
| 114 | {
 | 
|---|
| 115 |   // create a TApplication to be able to 
 | 
|---|
| 116 |   TApplication app("Application",0,0);
 | 
|---|
| 117 | 
 | 
|---|
| 118 |   // evaluate arguments
 | 
|---|
| 119 |   MArgs arg(argc, argv);
 | 
|---|
| 120 |   if (arg.HasOnly("-?") || arg.HasOnly("-h") || arg.HasOnly("--help"))
 | 
|---|
| 121 |     {
 | 
|---|
| 122 |       Usage();
 | 
|---|
| 123 |       return -1;
 | 
|---|
| 124 |     }
 | 
|---|
| 125 | 
 | 
|---|
| 126 |   TString datacard  = arg.GetArgumentStr(0);
 | 
|---|
| 127 |   if(!datacard.Length())
 | 
|---|
| 128 |     datacard = defaultcard;
 | 
|---|
| 129 | 
 | 
|---|
| 130 |   if(!readDatacards(datacard))
 | 
|---|
| 131 |     {
 | 
|---|
| 132 |       cout << "Error reading datacards. Stoping" << endl;
 | 
|---|
| 133 |       return -1;
 | 
|---|
| 134 |     }
 | 
|---|
| 135 | 
 | 
|---|
| 136 |   makeHillas();
 | 
|---|
| 137 | }
 | 
|---|
| 138 | 
 | 
|---|
| 139 | /*************************************************************/
 | 
|---|
| 140 | void makeHillas()
 | 
|---|
| 141 | {
 | 
|---|
| 142 |   // Set the signal extractor
 | 
|---|
| 143 |   MExtractor* extractor;
 | 
|---|
| 144 |   switch(sext)
 | 
|---|
| 145 |     {
 | 
|---|
| 146 |     case 0:
 | 
|---|
| 147 |       extractor = new MExtractFixedWindow();
 | 
|---|
| 148 |       break;
 | 
|---|
| 149 |     case 1:
 | 
|---|
| 150 |       extractor = new MExtractSlidingWindow();
 | 
|---|
| 151 |       ((MExtractSlidingWindow*)extractor)->SetWindowSize(wsize,wsize);
 | 
|---|
| 152 |       break;
 | 
|---|
| 153 |     case 2:
 | 
|---|
| 154 |       extractor = new MExtractFixedWindowPeakSearch();
 | 
|---|
| 155 |       ((MExtractFixedWindowPeakSearch*)extractor)->SetWindows(wsize,wsize,4);
 | 
|---|
| 156 |       break;
 | 
|---|
| 157 |     default:
 | 
|---|
| 158 |       extractor = new MExtractFixedWindow();
 | 
|---|
| 159 |       break;
 | 
|---|
| 160 |     }
 | 
|---|
| 161 | 
 | 
|---|
| 162 |   extractor->SetRange(hifirst,hilast,lofirst,lolast);
 | 
|---|
| 163 |  
 | 
|---|
| 164 | 
 | 
|---|
| 165 |   /****************************************************/
 | 
|---|
| 166 |   /* FIRST LOOP: PEDESTAL COMPUTATION FOR CALIBRATION */
 | 
|---|
| 167 |   /****************************************************/
 | 
|---|
| 168 | 
 | 
|---|
| 169 |   // If you want to exclude pixels from the beginning, read 
 | 
|---|
| 170 |   // an ascii-file with the corr. pixel numbers (see MBadPixelsCam)  
 | 
|---|
| 171 |   //badcam.AsciiRead("badpixels.dat");
 | 
|---|
| 172 | 
 | 
|---|
| 173 |   MJPedestal pedcalloop;
 | 
|---|
| 174 |   pedcalloop.SetInput(&pedcaliter);
 | 
|---|
| 175 |   pedcalloop.SetExtractor(extractor);
 | 
|---|
| 176 |   //  pedloop.SetBadPixels(badcam);
 | 
|---|
| 177 |   //pedcalloop.SetOutputPath(outpath.Data());
 | 
|---|
| 178 | 
 | 
|---|
| 179 | 
 | 
|---|
| 180 |   if (!pedcalloop.Process())
 | 
|---|
| 181 |     return;
 | 
|---|
| 182 | 
 | 
|---|
| 183 |   /*****************************/
 | 
|---|
| 184 |   /* SECOND LOOP: CALIBRATION  */
 | 
|---|
| 185 |   /*****************************/        
 | 
|---|
| 186 | 
 | 
|---|
| 187 |   MJCalibration calloop;
 | 
|---|
| 188 | 
 | 
|---|
| 189 |   calloop.SetRelTimeCalibration(caltimeflag);
 | 
|---|
| 190 |   calloop.SetExtractor(extractor);
 | 
|---|
| 191 |   calloop.SetInput(&caliter);
 | 
|---|
| 192 |   calloop.SetBadPixels(pedcalloop.GetBadPixels());
 | 
|---|
| 193 |   if(calflag==2)
 | 
|---|
| 194 |     calloop.SetUseBlindPixel();
 | 
|---|
| 195 |   if(calflag>0)
 | 
|---|
| 196 |     if (!calloop.Process(pedcalloop.GetPedestalCam()))
 | 
|---|
| 197 |       return;
 | 
|---|
| 198 | 
 | 
|---|
| 199 |   // Next loops are different if we take pedestals from data or from pedestal files
 | 
|---|
| 200 |   if(pediter.GetNumRuns()==0)
 | 
|---|
| 201 |     {
 | 
|---|
| 202 |       /************************************************************************/
 | 
|---|
| 203 |       /*                 THIRD (SMALL) LOOP TO GET INITIAl PEDESTALS          */
 | 
|---|
| 204 |       /************************************************************************/      
 | 
|---|
| 205 |       MParList  plist3;
 | 
|---|
| 206 |       MTaskList tlist3;
 | 
|---|
| 207 |       
 | 
|---|
| 208 |       // containers
 | 
|---|
| 209 |       MPedestalCam  pedcamdata;      
 | 
|---|
| 210 |       MGeomCamMagic geomcam;
 | 
|---|
| 211 |       
 | 
|---|
| 212 |       plist3.AddToList(&tlist3);
 | 
|---|
| 213 |       plist3.AddToList(&geomcam);
 | 
|---|
| 214 |       plist3.AddToList(&pedcamdata);
 | 
|---|
| 215 |             
 | 
|---|
| 216 |       //tasks
 | 
|---|
| 217 |       MReadMarsFile read3("Events");
 | 
|---|
| 218 |       static_cast<MRead&>(read3).AddFiles(datiter); 
 | 
|---|
| 219 |       read3.DisableAutoScheme();
 | 
|---|
| 220 | 
 | 
|---|
| 221 |       MGeomApply      geomapl;
 | 
|---|
| 222 | 
 | 
|---|
| 223 |       MPedCalcFromLoGain peddatacalc;
 | 
|---|
| 224 |       peddatacalc.SetPedestalUpdate(kFALSE);
 | 
|---|
| 225 |       peddatacalc.SetRange(hifirst,hilast,lofirst,lolast);
 | 
|---|
| 226 |       peddatacalc.SetWindowSize(wsize,wsize);
 | 
|---|
| 227 |       peddatacalc.SetNumEventsDump(500);
 | 
|---|
| 228 |       peddatacalc.SetMaxHiGainVar(40);
 | 
|---|
| 229 |       
 | 
|---|
| 230 |       tlist3.AddToList(&read3);
 | 
|---|
| 231 |       tlist3.AddToList(&geomapl);
 | 
|---|
| 232 |       tlist3.AddToList(&peddatacalc);
 | 
|---|
| 233 |       
 | 
|---|
| 234 |       // Create and setup the eventloop
 | 
|---|
| 235 |       MEvtLoop evtloop3;
 | 
|---|
| 236 |       evtloop3.SetParList(&plist3);
 | 
|---|
| 237 |       if (!evtloop3.Eventloop(500))
 | 
|---|
| 238 |         return;
 | 
|---|
| 239 |       
 | 
|---|
| 240 |       tlist3.PrintStatistics();
 | 
|---|
| 241 |       
 | 
|---|
| 242 |       /************************************************************************/
 | 
|---|
| 243 |       /*       FOURTH LOOP: PEDESTAL+DATA CALIBRATION INTO PHOTONS            */
 | 
|---|
| 244 |       /************************************************************************/
 | 
|---|
| 245 |       
 | 
|---|
| 246 |       MParList  plist4;
 | 
|---|
| 247 |       MTaskList tlist4;
 | 
|---|
| 248 |       plist4.AddToList(&tlist4);
 | 
|---|
| 249 |       
 | 
|---|
| 250 |       // containers 
 | 
|---|
| 251 |       MCerPhotEvt     nphot;
 | 
|---|
| 252 |       MPedPhotCam     nphotrms;
 | 
|---|
| 253 |       MHillas         hillas;
 | 
|---|
| 254 |       MNewImagePar    newimagepar;
 | 
|---|
| 255 |       MSrcPosCam      source;
 | 
|---|
| 256 |       MRawRunHeader   runhead;      
 | 
|---|
| 257 |       MArrivalTimeCam timecam;      
 | 
|---|
| 258 |       MReportDrive    reportdrive;
 | 
|---|
| 259 |       // islands
 | 
|---|
| 260 |       MIslands      isl;
 | 
|---|
| 261 |       MIslands      isl2;
 | 
|---|
| 262 |       MIslands      isl3;
 | 
|---|
| 263 |       
 | 
|---|
| 264 |       isl.SetName("MIslands");  
 | 
|---|
| 265 |       isl2.SetName("MIslands2");
 | 
|---|
| 266 |       isl3.SetName("MIslands3");
 | 
|---|
| 267 |       
 | 
|---|
| 268 |       plist4.AddToList(&timecam);
 | 
|---|
| 269 |       plist4.AddToList(&isl);
 | 
|---|
| 270 |       
 | 
|---|
| 271 |       if (islflag == 2)
 | 
|---|
| 272 |         plist4.AddToList(&isl2);
 | 
|---|
| 273 |       if (islflag == 3)
 | 
|---|
| 274 |         plist4.AddToList(&isl3);
 | 
|---|
| 275 |       
 | 
|---|
| 276 |       plist4.AddToList(&geomcam);
 | 
|---|
| 277 |       plist4.AddToList(&pedcamdata);
 | 
|---|
| 278 |       plist4.AddToList(&calloop.GetCalibrationCam());
 | 
|---|
| 279 |       plist4.AddToList(&calloop.GetQECam());
 | 
|---|
| 280 |       plist4.AddToList(&calloop.GetRelTimeCam());
 | 
|---|
| 281 |       plist4.AddToList(&calloop.GetBadPixels());
 | 
|---|
| 282 |       plist4.AddToList(&nphot);
 | 
|---|
| 283 |       plist4.AddToList(&nphotrms);
 | 
|---|
| 284 |       plist4.AddToList(&source);
 | 
|---|
| 285 |       plist4.AddToList(&hillas);
 | 
|---|
| 286 |       plist4.AddToList(&newimagepar);
 | 
|---|
| 287 |       plist4.AddToList(&runhead);
 | 
|---|
| 288 |       plist4.AddToList(&reportdrive);
 | 
|---|
| 289 |       
 | 
|---|
| 290 |       // cuts
 | 
|---|
| 291 |       MF cut(filter);
 | 
|---|
| 292 |       
 | 
|---|
| 293 |       //tasks
 | 
|---|
| 294 |       MReadMarsFile read4("Events");
 | 
|---|
| 295 |       static_cast<MRead&>(read4).AddFiles(datiter); 
 | 
|---|
| 296 |       read4.DisableAutoScheme();
 | 
|---|
| 297 |             
 | 
|---|
| 298 |       peddatacalc.SetPedestalUpdate(kTRUE);
 | 
|---|
| 299 | 
 | 
|---|
| 300 |       MCalibrateData::CalibrationMode_t calMode=MCalibrateData::kDefault;  
 | 
|---|
| 301 |       if(calflag==0)
 | 
|---|
| 302 |         calMode=MCalibrateData::kNone;
 | 
|---|
| 303 |       if(calflag==-1)
 | 
|---|
| 304 |         calMode=MCalibrateData::kDummy;
 | 
|---|
| 305 |       MCalibrateData  photcalc;
 | 
|---|
| 306 |       photcalc.SetCalibrationMode(calMode);
 | 
|---|
| 307 |       photcalc.EnablePedestalType(MCalibrateData::kRun);
 | 
|---|
| 308 |       photcalc.EnablePedestalType(MCalibrateData::kEvent);
 | 
|---|
| 309 | 
 | 
|---|
| 310 |       MImgCleanStd      clean(lcore,ltail);
 | 
|---|
| 311 |       clean.SetCleanRings(lrings);
 | 
|---|
| 312 |       MImgCleanStd::CleaningMethod_t cleanMeth= MImgCleanStd::kStandard;  
 | 
|---|
| 313 |       if(cleanflag==2)
 | 
|---|
| 314 |         cleanMeth=MImgCleanStd::kDemocratic;
 | 
|---|
| 315 |       clean.SetMethod(cleanMeth);
 | 
|---|
| 316 |       
 | 
|---|
| 317 |       MArrivalTimeCalc2 timecalc;
 | 
|---|
| 318 |       MIslandsCalc       island;
 | 
|---|
| 319 |       island.SetOutputName("MIslands");
 | 
|---|
| 320 |       island.SetAlgorithm(kalgorithm);
 | 
|---|
| 321 |       
 | 
|---|
| 322 |       MBadPixelsTreat   interpolatebadpixels;
 | 
|---|
| 323 |       interpolatebadpixels.SetUseInterpolation();
 | 
|---|
| 324 |       interpolatebadpixels.SetProcessPedestal();
 | 
|---|
| 325 |       
 | 
|---|
| 326 |       MIslandsClean      islclean(lnew);
 | 
|---|
| 327 |       islclean.SetInputName("MIslands");
 | 
|---|
| 328 |       islclean.SetMethod(kmethod);
 | 
|---|
| 329 |       
 | 
|---|
| 330 |       MIslandsCalc       island2;
 | 
|---|
| 331 |       island2.SetOutputName("MIslands2");  
 | 
|---|
| 332 |       island2.SetAlgorithm(kalgorithm);
 | 
|---|
| 333 |       
 | 
|---|
| 334 |       MIslandsCalc       island3;
 | 
|---|
| 335 |       island3.SetOutputName("MIslands3");  
 | 
|---|
| 336 |       
 | 
|---|
| 337 |       
 | 
|---|
| 338 |       MHillasCalc       hcalc;
 | 
|---|
| 339 |       MHillasSrcCalc    csrc1;
 | 
|---|
| 340 |       
 | 
|---|
| 341 |       MContinue applycut(&cut);
 | 
|---|
| 342 |       applycut.SetInverted(kTRUE);
 | 
|---|
| 343 |       MWriteRootFile write(outname,"RECREATE");
 | 
|---|
| 344 |       
 | 
|---|
| 345 |       MHillasDisplay*  disphillas=NULL;
 | 
|---|
| 346 |       
 | 
|---|
| 347 |       write.AddContainer("MHillas"        , "Parameters");
 | 
|---|
| 348 |       write.AddContainer("MHillasSrc"     , "Parameters");
 | 
|---|
| 349 |       write.AddContainer("MHillasExt"     , "Parameters");
 | 
|---|
| 350 |       write.AddContainer("MNewImagePar"   , "Parameters");
 | 
|---|
| 351 |       write.AddContainer("MRawEvtHeader"  , "Parameters");
 | 
|---|
| 352 |       write.AddContainer("MRawRunHeader"  , "Parameters");
 | 
|---|
| 353 |       write.AddContainer("MTime"          , "Parameters");
 | 
|---|
| 354 |       write.AddContainer("MConcentration" , "Parameters");
 | 
|---|
| 355 |       write.AddContainer("MSrcPosCam"     , "Parameters");
 | 
|---|
| 356 |       write.AddContainer("MIslands"       , "Parameters");
 | 
|---|
| 357 |       write.AddContainer("MReportDrive"   , "Parameters");
 | 
|---|
| 358 | 
 | 
|---|
| 359 |       if (islflag == 2) 
 | 
|---|
| 360 |         write.AddContainer("MIslands2" , "Parameters");
 | 
|---|
| 361 |       if (islflag == 3) 
 | 
|---|
| 362 |         write.AddContainer("MIslands3" , "Parameters");
 | 
|---|
| 363 |       
 | 
|---|
| 364 |       
 | 
|---|
| 365 |       if(display)
 | 
|---|
| 366 |         {
 | 
|---|
| 367 |           disphillas = new MHillasDisplay(&nphot,&geomcam);
 | 
|---|
| 368 |           disphillas->SetIslandsName("MIslands");
 | 
|---|
| 369 |           if (islflag == 2)
 | 
|---|
| 370 |             disphillas->SetIslandsName("MIslands2");
 | 
|---|
| 371 |           if (islflag == 3)
 | 
|---|
| 372 |             disphillas->SetIslandsName("MIslands3");
 | 
|---|
| 373 |         }      
 | 
|---|
| 374 |       
 | 
|---|
| 375 |       tlist4.AddToList(&read4);
 | 
|---|
| 376 |       tlist4.AddToList(&geomapl);
 | 
|---|
| 377 |       tlist4.AddToList(&peddatacalc);
 | 
|---|
| 378 |       tlist4.AddToList(extractor);
 | 
|---|
| 379 |       tlist4.AddToList(&timecalc);
 | 
|---|
| 380 |       tlist4.AddToList(&photcalc);
 | 
|---|
| 381 |       if(calflag==11 || calflag==21)
 | 
|---|
| 382 |         tlist4.AddToList(&interpolatebadpixels);
 | 
|---|
| 383 |       tlist4.AddToList(&clean);
 | 
|---|
| 384 |       tlist4.AddToList(&island);
 | 
|---|
| 385 |       
 | 
|---|
| 386 |       if (islflag == 2)
 | 
|---|
| 387 |         {
 | 
|---|
| 388 |           tlist4.AddToList(&islclean);
 | 
|---|
| 389 |           tlist4.AddToList(&island2);
 | 
|---|
| 390 |         }
 | 
|---|
| 391 |       
 | 
|---|
| 392 |       if (islflag == 3)
 | 
|---|
| 393 |         {
 | 
|---|
| 394 |           tlist4.AddToList(&islclean);
 | 
|---|
| 395 |           tlist4.AddToList(&island3);
 | 
|---|
| 396 |         }
 | 
|---|
| 397 |       
 | 
|---|
| 398 |       tlist4.AddToList(&hcalc);
 | 
|---|
| 399 |       tlist4.AddToList(&csrc1);
 | 
|---|
| 400 |       if(filter.Length())
 | 
|---|
| 401 |         tlist4.AddToList(&applycut);
 | 
|---|
| 402 |       tlist4.AddToList(&write);
 | 
|---|
| 403 |       if(display)
 | 
|---|
| 404 |         {
 | 
|---|
| 405 |           disphillas->SetPSFile();
 | 
|---|
| 406 |           disphillas->SetPSFileName(psfilename);
 | 
|---|
| 407 |           if(display==2) 
 | 
|---|
| 408 |             disphillas->SetPause(kFALSE);       
 | 
|---|
| 409 |           tlist4.AddToList(disphillas);
 | 
|---|
| 410 |         }
 | 
|---|
| 411 |       
 | 
|---|
| 412 |       // Create and setup the eventloop
 | 
|---|
| 413 |       MEvtLoop datloop;
 | 
|---|
| 414 |       datloop.SetParList(&plist4);
 | 
|---|
| 415 |       
 | 
|---|
| 416 |       cout << "*************************************************************" << endl;
 | 
|---|
| 417 |       cout << "***   COMPUTING DATA USING EXTRACTED SIGNAL (IN PHOTONS)  ***" << endl;
 | 
|---|
| 418 |       cout << "*************************************************************" << endl;
 | 
|---|
| 419 |       
 | 
|---|
| 420 |       if (!datloop.Eventloop(nmaxevents))
 | 
|---|
| 421 |         return;
 | 
|---|
| 422 |       
 | 
|---|
| 423 |       tlist4.PrintStatistics();    
 | 
|---|
| 424 |       delete extractor;
 | 
|---|
| 425 |     }
 | 
|---|
| 426 |   else
 | 
|---|
| 427 |     {      
 | 
|---|
| 428 |       /************************************************************************/
 | 
|---|
| 429 |       /*                THIRD LOOP: PEDESTAL CALIBRATION INTO PHOTONS         */
 | 
|---|
| 430 |       /************************************************************************/
 | 
|---|
| 431 |       
 | 
|---|
| 432 |       // First Compute the pedestals
 | 
|---|
| 433 |       MJPedestal pedloop;
 | 
|---|
| 434 |       pedloop.SetInput(&pediter);
 | 
|---|
| 435 |       
 | 
|---|
| 436 |       if (!pedloop.Process())
 | 
|---|
| 437 |         return;
 | 
|---|
| 438 |       
 | 
|---|
| 439 |       MParList  plist3;
 | 
|---|
| 440 |       MTaskList tlist3;
 | 
|---|
| 441 |       plist3.AddToList(&tlist3);
 | 
|---|
| 442 |       
 | 
|---|
| 443 |       // containers
 | 
|---|
| 444 |       MGeomCamMagic       geomcam;
 | 
|---|
| 445 |       MCerPhotEvt         nphot;
 | 
|---|
| 446 |       MPedPhotCam         nphotrms;
 | 
|---|
| 447 |       MExtractedSignalCam sigcam;
 | 
|---|
| 448 |       
 | 
|---|
| 449 |       plist3.AddToList(&geomcam);
 | 
|---|
| 450 |       plist3.AddToList(&pedloop.GetPedestalCam());
 | 
|---|
| 451 |       plist3.AddToList(&calloop.GetCalibrationCam());
 | 
|---|
| 452 |       plist3.AddToList(&calloop.GetQECam());
 | 
|---|
| 453 |       plist3.AddToList(&calloop.GetRelTimeCam());
 | 
|---|
| 454 |       plist3.AddToList(&calloop.GetBadPixels());
 | 
|---|
| 455 |       plist3.AddToList(&sigcam);
 | 
|---|
| 456 |       plist3.AddToList(&nphot);
 | 
|---|
| 457 |       plist3.AddToList(&nphotrms);
 | 
|---|
| 458 |       
 | 
|---|
| 459 |       
 | 
|---|
| 460 |       MCalibrateData::CalibrationMode_t calMode=MCalibrateData::kDefault;  
 | 
|---|
| 461 |       if(calflag==0)
 | 
|---|
| 462 |         calMode=MCalibrateData::kNone;
 | 
|---|
| 463 |       if(calflag==-1)
 | 
|---|
| 464 |         calMode=MCalibrateData::kDummy;
 | 
|---|
| 465 |       
 | 
|---|
| 466 |       //tasks
 | 
|---|
| 467 |       MReadMarsFile read3("Events");
 | 
|---|
| 468 |       static_cast<MRead&>(read3).AddFiles(pediter); 
 | 
|---|
| 469 |       read3.DisableAutoScheme();
 | 
|---|
| 470 |       
 | 
|---|
| 471 |       MGeomApply      geomapl;
 | 
|---|
| 472 |       MPedPhotCalc    photrmscalc; 
 | 
|---|
| 473 |       MCalibrateData  photcalc;
 | 
|---|
| 474 |       photcalc.SetCalibrationMode(calMode);
 | 
|---|
| 475 |       
 | 
|---|
| 476 |       tlist3.AddToList(&read3);
 | 
|---|
| 477 |       tlist3.AddToList(&geomapl);
 | 
|---|
| 478 |       tlist3.AddToList(extractor);
 | 
|---|
| 479 |       tlist3.AddToList(&photcalc);
 | 
|---|
| 480 |       tlist3.AddToList(&photrmscalc);
 | 
|---|
| 481 |       
 | 
|---|
| 482 |       // Create and setup the eventloop
 | 
|---|
| 483 |       MEvtLoop evtloop3;
 | 
|---|
| 484 |       evtloop3.SetParList(&plist3);
 | 
|---|
| 485 |       if (!evtloop3.Eventloop())
 | 
|---|
| 486 |         return;
 | 
|---|
| 487 |       
 | 
|---|
| 488 |       tlist3.PrintStatistics();
 | 
|---|
| 489 |       
 | 
|---|
| 490 |       /************************************************************************/
 | 
|---|
| 491 |       /*                FOURTH LOOP: DATA CALIBRATION INTO PHOTONS            */
 | 
|---|
| 492 |       /************************************************************************/
 | 
|---|
| 493 |       
 | 
|---|
| 494 |       MParList  plist4;
 | 
|---|
| 495 |       MTaskList tlist4;
 | 
|---|
| 496 |       plist4.AddToList(&tlist4);
 | 
|---|
| 497 |       
 | 
|---|
| 498 |       // containers 
 | 
|---|
| 499 |       MHillas       hillas;
 | 
|---|
| 500 |       MNewImagePar  newimagepar;
 | 
|---|
| 501 |       MSrcPosCam    source;
 | 
|---|
| 502 |       MRawRunHeader runhead;
 | 
|---|
| 503 |       
 | 
|---|
| 504 |       MArrivalTimeCam   timecam;
 | 
|---|
| 505 |       
 | 
|---|
| 506 |       
 | 
|---|
| 507 |       // islands
 | 
|---|
| 508 |       MIslands      isl;
 | 
|---|
| 509 |       MIslands      isl2;
 | 
|---|
| 510 |       MIslands      isl3;
 | 
|---|
| 511 |       
 | 
|---|
| 512 |       isl.SetName("MIslands");  
 | 
|---|
| 513 |       isl2.SetName("MIslands2");
 | 
|---|
| 514 |       isl3.SetName("MIslands3");
 | 
|---|
| 515 |       
 | 
|---|
| 516 |       plist4.AddToList(&timecam);
 | 
|---|
| 517 |       plist4.AddToList(&isl);
 | 
|---|
| 518 |       
 | 
|---|
| 519 |       if (islflag == 2)
 | 
|---|
| 520 |         plist4.AddToList(&isl2);
 | 
|---|
| 521 |       if (islflag == 3)
 | 
|---|
| 522 |         plist4.AddToList(&isl3);
 | 
|---|
| 523 |       
 | 
|---|
| 524 |       plist4.AddToList(&geomcam);
 | 
|---|
| 525 |       plist4.AddToList(&pedloop.GetPedestalCam());
 | 
|---|
| 526 |       plist4.AddToList(&calloop.GetCalibrationCam());
 | 
|---|
| 527 |       plist4.AddToList(&calloop.GetQECam());
 | 
|---|
| 528 |       plist4.AddToList(&calloop.GetRelTimeCam());
 | 
|---|
| 529 |       plist4.AddToList(&calloop.GetBadPixels());
 | 
|---|
| 530 |       plist4.AddToList(&nphot);
 | 
|---|
| 531 |       plist4.AddToList(&nphotrms);
 | 
|---|
| 532 |       plist4.AddToList(&source);
 | 
|---|
| 533 |       plist4.AddToList(&hillas);
 | 
|---|
| 534 |       plist4.AddToList(&newimagepar);
 | 
|---|
| 535 |       plist4.AddToList(&runhead);
 | 
|---|
| 536 |       
 | 
|---|
| 537 |       // cuts
 | 
|---|
| 538 |       MF cut(filter);
 | 
|---|
| 539 |       
 | 
|---|
| 540 |       //tasks
 | 
|---|
| 541 |       MReadMarsFile read4("Events");
 | 
|---|
| 542 |       static_cast<MRead&>(read4).AddFiles(datiter); 
 | 
|---|
| 543 |       read4.DisableAutoScheme();
 | 
|---|
| 544 |       
 | 
|---|
| 545 |       MImgCleanStd      clean(lcore,ltail);
 | 
|---|
| 546 |       clean.SetCleanRings(lrings);
 | 
|---|
| 547 |       MImgCleanStd::CleaningMethod_t cleanMeth= MImgCleanStd::kStandard;  
 | 
|---|
| 548 |       if(cleanflag==2)
 | 
|---|
| 549 |         cleanMeth=MImgCleanStd::kDemocratic;
 | 
|---|
| 550 |       clean.SetMethod(cleanMeth);
 | 
|---|
| 551 |       
 | 
|---|
| 552 |       MArrivalTimeCalc2 timecalc;
 | 
|---|
| 553 |       MIslandsCalc       island;
 | 
|---|
| 554 |       island.SetOutputName("MIslands");
 | 
|---|
| 555 |       island.SetAlgorithm(kalgorithm);
 | 
|---|
| 556 |       
 | 
|---|
| 557 |       MBadPixelsTreat   interpolatebadpixels;
 | 
|---|
| 558 |       interpolatebadpixels.SetUseInterpolation();
 | 
|---|
| 559 |       interpolatebadpixels.SetProcessPedestal();
 | 
|---|
| 560 |       //  interpolatebadpixels.SetSloppyTreatment();
 | 
|---|
| 561 |       
 | 
|---|
| 562 |       MIslandsClean      islclean(lnew);
 | 
|---|
| 563 |       islclean.SetInputName("MIslands");
 | 
|---|
| 564 |       islclean.SetMethod(kmethod);
 | 
|---|
| 565 |       
 | 
|---|
| 566 |       MIslandsCalc       island2;
 | 
|---|
| 567 |       island2.SetOutputName("MIslands2");  
 | 
|---|
| 568 |       island2.SetAlgorithm(kalgorithm);
 | 
|---|
| 569 |       
 | 
|---|
| 570 |       MIslandsCalc       island3;
 | 
|---|
| 571 |       island3.SetOutputName("MIslands3");  
 | 
|---|
| 572 |       
 | 
|---|
| 573 |       
 | 
|---|
| 574 |       MHillasCalc       hcalc;
 | 
|---|
| 575 |       MHillasSrcCalc    csrc1;
 | 
|---|
| 576 |       
 | 
|---|
| 577 |       MContinue applycut(&cut);
 | 
|---|
| 578 |       applycut.SetInverted(kTRUE);
 | 
|---|
| 579 |       MWriteRootFile write(outname,"RECREATE");
 | 
|---|
| 580 |       
 | 
|---|
| 581 |       MHillasDisplay*  disphillas=NULL;
 | 
|---|
| 582 |       
 | 
|---|
| 583 |       write.AddContainer("MHillas"        , "Parameters");
 | 
|---|
| 584 |       write.AddContainer("MHillasSrc"     , "Parameters");
 | 
|---|
| 585 |       write.AddContainer("MHillasExt"     , "Parameters");
 | 
|---|
| 586 |       write.AddContainer("MNewImagePar"   , "Parameters");
 | 
|---|
| 587 |       write.AddContainer("MRawEvtHeader"  , "Parameters");
 | 
|---|
| 588 |       write.AddContainer("MRawRunHeader"  , "Parameters");
 | 
|---|
| 589 |       write.AddContainer("MTime"          , "Parameters");
 | 
|---|
| 590 |       write.AddContainer("MConcentration" , "Parameters");
 | 
|---|
| 591 |       write.AddContainer("MSrcPosCam"     , "Parameters");
 | 
|---|
| 592 |       write.AddContainer("MIslands"       , "Parameters");
 | 
|---|
| 593 |       
 | 
|---|
| 594 |       if (islflag == 2) 
 | 
|---|
| 595 |         write.AddContainer("MIslands2" , "Parameters");
 | 
|---|
| 596 |       if (islflag == 3) 
 | 
|---|
| 597 |         write.AddContainer("MIslands3" , "Parameters");
 | 
|---|
| 598 |       
 | 
|---|
| 599 |       
 | 
|---|
| 600 |       if(display)
 | 
|---|
| 601 |         {
 | 
|---|
| 602 |           disphillas = new MHillasDisplay(&nphot,&geomcam);
 | 
|---|
| 603 |           disphillas->SetIslandsName("MIslands");
 | 
|---|
| 604 |           if (islflag == 2)
 | 
|---|
| 605 |             disphillas->SetIslandsName("MIslands2");
 | 
|---|
| 606 |           if (islflag == 3)
 | 
|---|
| 607 |             disphillas->SetIslandsName("MIslands3");
 | 
|---|
| 608 |         }      
 | 
|---|
| 609 |       
 | 
|---|
| 610 |       tlist4.AddToList(&read4);
 | 
|---|
| 611 |       tlist4.AddToList(&geomapl);
 | 
|---|
| 612 |       tlist4.AddToList(extractor);
 | 
|---|
| 613 |       tlist4.AddToList(&photcalc);
 | 
|---|
| 614 |       if(calflag==11 || calflag==21)
 | 
|---|
| 615 |         tlist4.AddToList(&interpolatebadpixels);
 | 
|---|
| 616 |       tlist4.AddToList(&clean);
 | 
|---|
| 617 |       tlist4.AddToList(&timecalc);
 | 
|---|
| 618 |       tlist4.AddToList(&island);
 | 
|---|
| 619 |       
 | 
|---|
| 620 |       if (islflag == 2)
 | 
|---|
| 621 |         {
 | 
|---|
| 622 |           tlist4.AddToList(&islclean);
 | 
|---|
| 623 |           tlist4.AddToList(&island2);
 | 
|---|
| 624 |         }
 | 
|---|
| 625 |       
 | 
|---|
| 626 |       if (islflag == 3)
 | 
|---|
| 627 |         {
 | 
|---|
| 628 |           tlist4.AddToList(&islclean);
 | 
|---|
| 629 |           tlist4.AddToList(&island3);
 | 
|---|
| 630 |         }
 | 
|---|
| 631 |       
 | 
|---|
| 632 |       tlist4.AddToList(&hcalc);
 | 
|---|
| 633 |       tlist4.AddToList(&csrc1);
 | 
|---|
| 634 |       if(filter.Length())
 | 
|---|
| 635 |         tlist4.AddToList(&applycut);
 | 
|---|
| 636 |       tlist4.AddToList(&write);
 | 
|---|
| 637 |       if(display)
 | 
|---|
| 638 |         {
 | 
|---|
| 639 |           disphillas->SetPSFile();
 | 
|---|
| 640 |           disphillas->SetPSFileName(psfilename);
 | 
|---|
| 641 |           if(display==2) 
 | 
|---|
| 642 |             disphillas->SetPause(kFALSE);       
 | 
|---|
| 643 |           tlist4.AddToList(disphillas);
 | 
|---|
| 644 |         }
 | 
|---|
| 645 |       
 | 
|---|
| 646 |       // Create and setup the eventloop
 | 
|---|
| 647 |       MEvtLoop datloop;
 | 
|---|
| 648 |       datloop.SetParList(&plist4);
 | 
|---|
| 649 |       
 | 
|---|
| 650 |       cout << "*************************************************************" << endl;
 | 
|---|
| 651 |       cout << "***   COMPUTING DATA USING EXTRACTED SIGNAL (IN PHOTONS)  ***" << endl;
 | 
|---|
| 652 |       cout << "*************************************************************" << endl;
 | 
|---|
| 653 |       
 | 
|---|
| 654 |       if (!datloop.Eventloop(nmaxevents))
 | 
|---|
| 655 |         return;
 | 
|---|
| 656 |       
 | 
|---|
| 657 |       tlist4.PrintStatistics();    
 | 
|---|
| 658 |       delete extractor;
 | 
|---|
| 659 |     }
 | 
|---|
| 660 | }
 | 
|---|
| 661 |   //-------------------------------------------------------------------------------
 | 
|---|
| 662 | 
 | 
|---|
| 663 | Bool_t readDatacards(TString& filename)
 | 
|---|
| 664 | {
 | 
|---|
| 665 |   ifstream ifun(filename.Data());
 | 
|---|
| 666 |   if(!ifun)
 | 
|---|
| 667 |     {
 | 
|---|
| 668 |       cout << "File " << filename << " not found" << endl;
 | 
|---|
| 669 |       return kFALSE;
 | 
|---|
| 670 |     }
 | 
|---|
| 671 | 
 | 
|---|
| 672 |   TString word;
 | 
|---|
| 673 |   
 | 
|---|
| 674 |   while(ifun >> word)
 | 
|---|
| 675 |     {
 | 
|---|
| 676 |       // skip comments
 | 
|---|
| 677 |       if(word[0]=='/' && word[1]=='/')
 | 
|---|
| 678 |         {
 | 
|---|
| 679 |           while(ifun.get()!='\n'); // skip line
 | 
|---|
| 680 |           continue;
 | 
|---|
| 681 |         }
 | 
|---|
| 682 | 
 | 
|---|
| 683 |       // number of events
 | 
|---|
| 684 |       if(strcmp(word.Data(),"NEVENTS")==0)
 | 
|---|
| 685 |         ifun >> nmaxevents;
 | 
|---|
| 686 | 
 | 
|---|
| 687 | 
 | 
|---|
| 688 |       // input file directory
 | 
|---|
| 689 |       if(strcmp(word.Data(),"IDIR")==0)
 | 
|---|
| 690 |         {
 | 
|---|
| 691 |           if(idirname.Length())
 | 
|---|
| 692 |             cout << "readDataCards Warning: overriding input directory file name" << endl;
 | 
|---|
| 693 |           ifun >> idirname;
 | 
|---|
| 694 |         }
 | 
|---|
| 695 | 
 | 
|---|
| 696 |       // pedestal runs
 | 
|---|
| 697 |       if(strcmp(word.Data(),"PRUNS")==0)
 | 
|---|
| 698 |         {
 | 
|---|
| 699 |           if(pediter.GetNumRuns())
 | 
|---|
| 700 |             cout << "readDataCards Warning: adding pedestal runs to the existing list" << endl;
 | 
|---|
| 701 |           ifun >> word;
 | 
|---|
| 702 |           if(strcmp(word.Data(),"0")!=0)
 | 
|---|
| 703 |             pediter.AddRuns(word.Data(),idirname.Data());
 | 
|---|
| 704 |         }
 | 
|---|
| 705 | 
 | 
|---|
| 706 |       // pedestal runs for calibration
 | 
|---|
| 707 |       if(strcmp(word.Data(),"PCRUNS")==0)
 | 
|---|
| 708 |         {
 | 
|---|
| 709 |           if(pedcaliter.GetNumRuns())
 | 
|---|
| 710 |             cout << "readDataCards Warning: adding pedestal runs for calibration to the existing list" << endl;
 | 
|---|
| 711 |           ifun >> word;
 | 
|---|
| 712 |           pedcaliter.AddRuns(word.Data(),idirname.Data());
 | 
|---|
| 713 |         }
 | 
|---|
| 714 | 
 | 
|---|
| 715 |       // calibration runs
 | 
|---|
| 716 |       if(strcmp(word.Data(),"CRUNS")==0)
 | 
|---|
| 717 |         {
 | 
|---|
| 718 |           if(caliter.GetNumRuns())
 | 
|---|
| 719 |             cout << "readDataCards Warning: adding calibration runs to the existing list" << endl;
 | 
|---|
| 720 |           ifun >> word;
 | 
|---|
| 721 |           caliter.AddRuns(word.Data(),idirname.Data());
 | 
|---|
| 722 |         }
 | 
|---|
| 723 | 
 | 
|---|
| 724 |       // data runs
 | 
|---|
| 725 |       if(strcmp(word.Data(),"DRUNS")==0)
 | 
|---|
| 726 |         {
 | 
|---|
| 727 |           if(datiter.GetNumRuns())
 | 
|---|
| 728 |             cout << "readDataCards Warning: adding data runs to the existing list" << endl;
 | 
|---|
| 729 |           ifun >> word;
 | 
|---|
| 730 |           datiter.AddRuns(word.Data(),idirname.Data());
 | 
|---|
| 731 |         }
 | 
|---|
| 732 |       
 | 
|---|
| 733 |       // output file name
 | 
|---|
| 734 |       if(strcmp(word.Data(),"OUTFILE")==0)
 | 
|---|
| 735 |         {
 | 
|---|
| 736 |           if(outname.Length())
 | 
|---|
| 737 |             cout << "readDataCards Warning: overriding output file name" << endl;
 | 
|---|
| 738 |           ifun >> outname;
 | 
|---|
| 739 |         }
 | 
|---|
| 740 | 
 | 
|---|
| 741 |       // exclusion cut
 | 
|---|
| 742 |       if(strcmp(word.Data(),"FILTER")==0)
 | 
|---|
| 743 |         {
 | 
|---|
| 744 |           if(filter.Length())
 | 
|---|
| 745 |             cout << "readDataCards Warning: overriding existing cut" << endl;
 | 
|---|
| 746 |           
 | 
|---|
| 747 |           char ch;
 | 
|---|
| 748 |           while((ch=ifun.get())!='\n')
 | 
|---|
| 749 |             filter.Append(ch);    
 | 
|---|
| 750 |         }
 | 
|---|
| 751 | 
 | 
|---|
| 752 |       // display flag
 | 
|---|
| 753 |       if(strcmp(word.Data(),"DISPLAY")==0)
 | 
|---|
| 754 |         ifun >> display;
 | 
|---|
| 755 | 
 | 
|---|
| 756 |       // ps file name
 | 
|---|
| 757 |       if(strcmp(word.Data(),"PSFILENAME")==0)
 | 
|---|
| 758 |         ifun >> psfilename;
 | 
|---|
| 759 | 
 | 
|---|
| 760 |       // calibration flag
 | 
|---|
| 761 |       if(strcmp(word.Data(),"CALFLAG")==0)
 | 
|---|
| 762 |         ifun >> calflag;
 | 
|---|
| 763 | 
 | 
|---|
| 764 |       // calibration flag
 | 
|---|
| 765 |       if(strcmp(word.Data(),"CALTIME")==0)
 | 
|---|
| 766 |         ifun >> caltimeflag;
 | 
|---|
| 767 | 
 | 
|---|
| 768 |       // cleaning level
 | 
|---|
| 769 |       if(strcmp(word.Data(),"CLEANLEVEL")==0)
 | 
|---|
| 770 |         {
 | 
|---|
| 771 |           ifun >> lcore;
 | 
|---|
| 772 |           ifun >> ltail;
 | 
|---|
| 773 |           if(ifun.get()!='\n'){
 | 
|---|
| 774 |             ifun.unget();
 | 
|---|
| 775 |             ifun >> lrings;
 | 
|---|
| 776 |             if(ifun.get()!='\n'){
 | 
|---|
| 777 |               ifun.unget();
 | 
|---|
| 778 |               ifun >> cleanflag;
 | 
|---|
| 779 |             }
 | 
|---|
| 780 |           }
 | 
|---|
| 781 |         }
 | 
|---|
| 782 |       
 | 
|---|
| 783 |       // cleaning level
 | 
|---|
| 784 |       if(strcmp(word.Data(),"EXTRACTOR")==0)
 | 
|---|
| 785 |         ifun >> sext >> hifirst >> hilast >> lofirst >> lolast >> wsize;
 | 
|---|
| 786 |       
 | 
|---|
| 787 |       if(strcmp(word.Data(),"ISLFLAG")==0)
 | 
|---|
| 788 |         {
 | 
|---|
| 789 |           ifun >> islflag;
 | 
|---|
| 790 | 
 | 
|---|
| 791 |           // if (islflag == 1 || islflag == 2)
 | 
|---|
| 792 |             ifun >> kalgorithm;
 | 
|---|
| 793 |         }
 | 
|---|
| 794 | 
 | 
|---|
| 795 |       // island cleaning 
 | 
|---|
| 796 |       if (islflag == 2){
 | 
|---|
| 797 |         if(strcmp(word.Data(),"ISLANDCLEAN")==0)
 | 
|---|
| 798 |           {
 | 
|---|
| 799 |             ifun >> kmethod;
 | 
|---|
| 800 |             ifun >> lnew;
 | 
|---|
| 801 |           }
 | 
|---|
| 802 |       }
 | 
|---|
| 803 |     }
 | 
|---|
| 804 | 
 | 
|---|
| 805 |   pediter.Reset();
 | 
|---|
| 806 |   pedcaliter.Reset();
 | 
|---|
| 807 |   caliter.Reset();
 | 
|---|
| 808 |   datiter.Reset();
 | 
|---|
| 809 |   TString pfile;
 | 
|---|
| 810 | 
 | 
|---|
| 811 |   // Dump read values
 | 
|---|
| 812 |   cout << "************************************************" << endl;
 | 
|---|
| 813 |   cout << "* Datacards read from file " << filename << endl;
 | 
|---|
| 814 |   cout << "************************************************" << endl;
 | 
|---|
| 815 |   cout << "Pedestal file (s) for calibration: "  << endl;
 | 
|---|
| 816 |   while(!(pfile=pedcaliter.Next()).IsNull())
 | 
|---|
| 817 |     cout << pfile << endl;
 | 
|---|
| 818 |   cout << "Calibration file (s): "  << endl;
 | 
|---|
| 819 |   while(!(pfile=caliter.Next()).IsNull())
 | 
|---|
| 820 |     cout << pfile << endl;
 | 
|---|
| 821 |   if(pediter.GetNumRuns()>0)
 | 
|---|
| 822 |     {
 | 
|---|
| 823 |       cout << "Pedestal file (s): "  << endl;
 | 
|---|
| 824 |       while(!(pfile=pediter.Next()).IsNull())
 | 
|---|
| 825 |         cout << pfile << endl;
 | 
|---|
| 826 |     }
 | 
|---|
| 827 |   else 
 | 
|---|
| 828 |     cout << "Warning: Pedestals for data will be computed from data themselves" << endl;
 | 
|---|
| 829 |   cout << "Data file (s): "  << endl;
 | 
|---|
| 830 |   while(!(pfile=datiter.Next()).IsNull())
 | 
|---|
| 831 |     cout << pfile << endl;
 | 
|---|
| 832 |   cout << "Maximum number of events: " << nmaxevents << endl;
 | 
|---|
| 833 |   if(filter.Length())
 | 
|---|
| 834 |     cout << "Applying rejection cut: " << filter << endl;
 | 
|---|
| 835 |   cout << "Output file name: " << outname << endl;
 | 
|---|
| 836 |   if(display)
 | 
|---|
| 837 |     cout << "Generating PS file: " << psfilename << endl;
 | 
|---|
| 838 |   cout << "Signal Extractor: " << chext[sext] << " with bounds ("<<hifirst<<","<<hilast<<","<<lofirst<<","<<lolast<<"), window size " << wsize << endl;
 | 
|---|
| 839 |   cout << "Calibration: ";
 | 
|---|
| 840 |   if(calflag==0)    
 | 
|---|
| 841 |     cout << "Pixel area proportional intercalibration (kNone)" << endl;
 | 
|---|
| 842 |   else if(calflag==-1)    
 | 
|---|
| 843 |     cout << "No calibration whatsoever" << endl;
 | 
|---|
| 844 |   else if(calflag==1)
 | 
|---|
| 845 |     cout << "Default calibration" << endl;
 | 
|---|
| 846 |   else if(calflag==11)
 | 
|---|
| 847 |     cout << "Default calibration + bad pixels interpolation" << endl;
 | 
|---|
| 848 |   cout << "Cleaning level: ("<<lcore<<","<<ltail<<") - " << lrings << "ring" << endl;
 | 
|---|
| 849 |   cout << "Cleaning method: "<< cleanflag << endl;
 | 
|---|
| 850 |   if (islflag == 1 || islflag == 2)
 | 
|---|
| 851 |     cout << "Island calcultation..." << "using algorithm #" << kalgorithm <<endl;
 | 
|---|
| 852 |   if (islflag == 2)
 | 
|---|
| 853 |     {
 | 
|---|
| 854 |       cout << "Island Cleaning: "<< kmethod <<" method  "<< lnew << " new threshold" << endl;
 | 
|---|
| 855 |     }
 | 
|---|
| 856 |   cout << "***********" << endl << endl;
 | 
|---|
| 857 |   
 | 
|---|
| 858 |   if(!pedcaliter.GetNumEntries())
 | 
|---|
| 859 |     {
 | 
|---|
| 860 |       cout << "No pedestal file for calibration specified" << endl;
 | 
|---|
| 861 |       return kFALSE;
 | 
|---|
| 862 |     }
 | 
|---|
| 863 |   if(!caliter.GetNumEntries() && calflag>0)
 | 
|---|
| 864 |     {
 | 
|---|
| 865 |       cout << "No calibration file name specified" << endl;
 | 
|---|
| 866 |       return kFALSE;
 | 
|---|
| 867 |     }
 | 
|---|
| 868 |   if(!datiter.GetNumEntries())
 | 
|---|
| 869 |     {
 | 
|---|
| 870 |       cout << "No data file name specified" << endl;
 | 
|---|
| 871 |       return kFALSE;
 | 
|---|
| 872 |     }
 | 
|---|
| 873 |   if(!outname.Length())
 | 
|---|
| 874 |     {
 | 
|---|
| 875 |       cout << "No output file name specified" << endl;
 | 
|---|
| 876 |       return kFALSE;
 | 
|---|
| 877 |     }
 | 
|---|
| 878 | 
 | 
|---|
| 879 | 
 | 
|---|
| 880 |   return kTRUE;
 | 
|---|
| 881 | }
 | 
|---|
| 882 | 
 | 
|---|