source: trunk/MagicSoft/Mars/mtemp/mifae/programs/makeHillas.cc@ 6049

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