Changeset 2543 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
11/20/03 09:13:31 (21 years ago)
Author:
wittek
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/macros
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/macros/CT1Analysis.C

    r2475 r2543  
    286286
    287287
     288
    288289    // Job E_XX : extended version of E_XX (including flux plots) 
    289290    //  - select g/h separation method XX
     
    297298
    298299
    299     Bool_t JobE_XX  = kFALSE; 
     300    Bool_t JobE_XX  = kTRUE; 
     301    Bool_t CCollArea= kFALSE;  // calculate eff. collection areas
    300302    Bool_t OEEst    = kFALSE;  // optimize energy estimator
    301     Bool_t WEX      = kFALSE;  // update root file  ?
    302     Bool_t WRobert  = kFALSE;  // write out Robert's file  ?
     303    Bool_t WEX      = kTRUE;  // update root file  ?
     304    Bool_t WRobert  = kTRUE;  // write out Robert's file  ?
     305
    303306
    304307
     
    25272530
    25282531
    2529 
    25302532  //---------------------------------------------------------------------
    25312533  // Job E_XX
     
    25472549
    25482550    gLog << "" << endl;
    2549     gLog << "Macro CT1Analysis : JobE_XX, OEEst, WEX = "
     2551    gLog << "Macro CT1Analysis : JobE_XX, CCollArea, OEEst, WEX = "
    25502552         << (JobE_XX ? "kTRUE" : "kFALSE")  << ",  "
     2553         << (CCollArea?"kTRUE" : "kFALSE")  << ",  "
    25512554         << (OEEst ?   "kTRUE" : "kFALSE")  << ",  "
    25522555         << (WEX     ? "kTRUE" : "kFALSE")  << endl;
     
    25542557
    25552558    // type of data to be analysed
    2556     TString typeData = "ON";
     2559    //TString typeData = "ON";
    25572560    //TString typeData = "OFF";
    2558     //TString typeData = "MC";
     2561    TString typeData = "MC";
    25592562    gLog << "typeData = " << typeData << endl;
    25602563
     
    25672570    // and definition of final selections
    25682571
    2569     TString XX("SC");
    2570     //TString XX("RF");
     2572    //TString XX("SC");
     2573    TString XX("RF");
    25712574    TString fhadronnessName("Had");
    25722575    fhadronnessName += XX;
     
    25742577
    25752578    // maximum values of the hadronness, |ALPHA| and DIST
    2576     Float_t maxhadronness   = 0.4;
     2579    Float_t maxhadronness   = 0.23;
    25772580    Float_t maxalpha        = 20.0;
    25782581    Float_t maxdist         = 10.0;
     
    26382641
    26392642    //====================================================================
     2643
     2644    MHMcCT1CollectionArea collarea;
     2645    collarea.SetEaxis(MHMcCT1CollectionArea::kLinear);
     2646
     2647    MParList  parlist;
     2648    InitBinnings(&parlist);
     2649
     2650  if (CCollArea)
     2651  {
    26402652    gLog << "-----------------------------------------------" << endl;
    26412653    gLog << "Start calculation of effective collection areas" << endl;
    2642     MParList  parlist;
     2654
     2655
    26432656    MTaskList tasklist;
    26442657
     
    26552668    MContinue conthadrons(&cuthadrons);
    26562669
    2657     MHMcCT1CollectionArea collarea;
    2658     collarea.SetEaxis(MHMcCT1CollectionArea::kLinear);
    26592670
    26602671    MFillH filler("MHMcCT1CollectionArea", "MMcEvt");
     
    26652676
    26662677    parlist.AddToList(&tasklist);
    2667     InitBinnings(&parlist);
     2678
    26682679    parlist.AddToList(&collarea);
    26692680
     
    26972708    collarea.CalcEfficiency();
    26982709    collarea.DrawClone();
     2710
     2711
     2712
     2713    //---------------------------------------------
     2714    // Write histograms to a file
     2715    //
     2716
     2717    TFile f(collareaName, "RECREATE");
     2718    //collarea.GetHist()->Write();
     2719    //collarea.GetHAll()->Write();
     2720    //collarea.GetHSel()->Write();
     2721    collarea.Write();
     2722
     2723    f.Close();
     2724
     2725    gLog << "Collection area plots written onto file " << collareaName << endl;
     2726
     2727    gLog << "Calculation of effective collection areas done" << endl;
     2728    gLog << "-----------------------------------------------" << endl;   
     2729    //------------------------------------------------------------------
     2730  }
     2731
     2732  if (!CCollArea)
     2733  {
     2734    gLog << "-----------------------------------------------" << endl;
     2735    gLog << "Read in effective collection areas from file "
     2736         << collareaName << endl;
     2737
     2738    TFile collfile(collareaName);
     2739    collfile.ls();
     2740    collarea.Read("MHMcCT1CollectionArea");
     2741    collarea.DrawClone();
     2742
     2743    gLog << "Effective collection areas were read in from file "
     2744         << collareaName << endl;
     2745    gLog << "-----------------------------------------------" << endl;   
     2746  }
     2747
    26992748
    27002749    // save binnings for call to CT1EEst
     
    27122761        }
    27132762
    2714 
    2715     //---------------------------------------------
    2716     // Write histograms to a file
    2717     //
    2718 
    2719     TFile f(collareaName, "RECREATE");
    2720     collarea.GetHist()->Write();
    2721     collarea.GetHAll()->Write();
    2722     collarea.GetHSel()->Write();
    2723     f.Close();
    2724 
    2725     gLog << "Collection area plots written onto file " << collareaName << endl;
    2726 
    2727     gLog << "Calculation of effective collection areas done" << endl;
    2728     gLog << "-----------------------------------------------" << endl;   
    2729     //------------------------------------------------------------------
    2730 
    2731 
     2763    //-------------------------------------
    27322764    TString fHilName    = "MHillas";
    27332765    TString fHilNameExt = "MHillasExt";
  • trunk/MagicSoft/Mars/macros/ONOFFCT1Analysis.C

    r2475 r2543  
    207207
    208208    // Job B_RF_UP : read ON1.root (OFF1.root or MC1.root) file
     209    //  - if CTrainRF = TRUE : create matrices of training events
     210    //                         and root files of training and test events
    209211    //  - if RTrainRF = TRUE : read in training matrices for hadrons and gammas
    210     //  - if CTrainRF = TRUE : create matrices of training events
    211212    //  - if RTree    = TRUE : read in trees, otherwise create trees
    212213    //  - calculate hadroness for method of RANDOM FOREST
     
    214215    //     or MC2.root)
    215216
    216     Bool_t JobB_RF_UP  = kFALSE; 
    217     Bool_t CTrainRF    = kFALSE;  // create  matrices of training events
     217    Bool_t JobB_RF_UP  = kTRUE; 
     218    Bool_t CTrainRF    = kTRUE;  // create  matrices of training events
     219                                  // and root files of training and test events
    218220    Bool_t RTrainRF    = kFALSE;  // read in matrices of training events
    219221    Bool_t RTree       = kFALSE;  // read in trees (otherwise grow them)
     
    268270
    269271
    270     Bool_t JobE_XX  = kTRUE; 
     272    Bool_t JobE_XX  = kFALSE; 
     273    Bool_t CCollArea= kFALSE;  // calculate eff. collection areas
    271274    Bool_t OEEst    = kFALSE;  // optimize energy estimator
    272     Bool_t WEX      = kTRUE;  // update root file  ?
    273     Bool_t WRobert  = kTRUE;  // write out Robert's file  ?
     275    Bool_t WEX      = kFALSE;  // update root file  ?
     276    Bool_t WRobert  = kFALSE;  // write out Robert's file  ?
    274277
    275278
     
    802805
    803806    //--------------------------------------------
    804     // files to be read for generating the matrices of training events
     807    // files to be read for generating
     808    //    - the matrices of training events
     809    //    - and the root files of training and test events
     810
     811    TString typeMatrixHadrons = "OFF";
     812    gLog << "typeMatrixHadrons = " << typeMatrixHadrons << endl;
     813
    805814    // "hadrons" :
    806815    TString filenameHad = outPath;
    807     filenameHad += "OFF";
     816    filenameHad += typeMatrixHadrons;
    808817    filenameHad += "1.root";
    809     Int_t howManyHadrons = 1000000;
    810     gLog << "filenameHad = " << filenameHad << ",   howManyHadrons = "
    811          << howManyHadrons  << endl;
     818    Int_t howManyHadronsTrain = 8000;
     819    Int_t howManyHadronsTest  = 8000;
     820    gLog << "filenameHad = "    << filenameHad << ",   howManyHadronsTrain = "
     821         << howManyHadronsTrain << ",   howManyHadronsTest = "
     822         << howManyHadronsTest  << endl;
    812823   
    813824
     
    816827    filenameMC += "MC";
    817828    filenameMC += "1.root";
    818     Int_t howManyGammas = 50000;
    819     gLog << "filenameMC = " << filenameMC << ",   howManyGammas = "
    820          << howManyGammas   << endl;
     829    Int_t howManyGammasTrain = 8000;
     830    Int_t howManyGammasTest  = 8000;
     831    gLog << "filenameMC = "    << filenameMC << ",   howManyGammasTrain = "
     832         << howManyGammasTrain << ",   howManyGammasTest = "
     833         << howManyGammasTest  << endl;
    821834   
    822835    //--------------------------------------------
    823     // files of training events
     836    // files for the matrices of training events
    824837
    825838    TString outNameGammas = outPath;
    826     outNameGammas += "RFmatrix_gammas_";
     839    outNameGammas += "RFmatrix_gammas_Train_";
    827840    outNameGammas += "MC";
    828841    outNameGammas += ".root";
    829842
    830     TString typeMatrixHadrons = "OFF";
    831     gLog << "typeMatrixHadrons = " << typeMatrixHadrons << endl;
    832 
    833843    TString outNameHadrons = outPath;
    834     outNameHadrons += "RFmatrix_hadrons_";
     844    outNameHadrons += "RFmatrix_hadrons_Train_";
    835845    outNameHadrons += typeMatrixHadrons;
    836846    outNameHadrons += ".root";
     847
     848
     849    //--------------------------------------------
     850    // root files for the training events
     851
     852    TString outNameGammasTrain = outPath;
     853    outNameGammasTrain += "RF_gammas_Train_";
     854    outNameGammasTrain += "MC";
     855    outNameGammasTrain += ".root";
     856
     857    TString outNameHadronsTrain = outPath;
     858    outNameHadronsTrain += "RF_hadrons_Train_";
     859    outNameHadronsTrain += typeMatrixHadrons;
     860    outNameHadronsTrain += ".root";
     861
     862
     863    //--------------------------------------------
     864    // root files for the test events
     865
     866    TString outNameGammasTest = outPath;
     867    outNameGammasTest += "RF_gammas_Test_";
     868    outNameGammasTest += "MC";
     869    outNameGammasTest += ".root";
     870
     871    TString outNameHadronsTest = outPath;
     872    outNameHadronsTest += "RF_hadrons_Test_";
     873    outNameHadronsTest += typeMatrixHadrons;
     874    outNameHadronsTest += ".root";
     875
     876    //--------------------------------------------------------------------
    837877
    838878
     
    908948   //*************************************************************************
    909949   // create matrices of training events
     950   // and root files of training and test events
     951 
    910952if (CTrainRF)
    911953  {
    912954    gLog << "" << endl;
    913955    gLog << "========================================================" << endl;
    914     gLog << " Create matrices of training events" << endl;
     956    gLog << " Create matrices of training events and root files of training and test events"
     957         << endl;
    915958    gLog << " Gammas :" << endl;
    916 
     959    gLog << "---------" << endl;
    917960
    918961    MParList  plistg;
    919962    MTaskList tlistg;
    920     MFilterList flistg;
    921 
    922     MParList  plisth;
    923     MTaskList tlisth;
    924     MFilterList flisth;
     963
     964    MFilterList flistgtrain;
     965    flistgtrain.SetName("GammaFilterTrain");
     966    MFilterList flistgtest;
     967    flistgtest.SetName("GammaFilterTest");
    925968
    926969    MReadMarsFile  readg("Events", filenameMC);
    927970    readg.DisableAutoScheme();
    928971
    929     MReadMarsFile  readh("Events", filenameHad);
    930     readh.DisableAutoScheme();
    931972
    932973    MFParticleId fgamma("MMcEvt", '=', kGAMMA);
    933974    fgamma.SetName("gammaID");
    934     MFParticleId fhadrons("MMcEvt", '!', kGAMMA);
    935     fhadrons.SetName("hadronID)");
    936975
    937976    TString mgname("costhg");
     
    946985
    947986    MFEventSelector2 selectorg(gref);
    948     selectorg.SetNumMax(howManyGammas);
    949     selectorg.SetName("selectGammas");
     987    selectorg.SetNumMax(howManyGammasTrain+howManyGammasTest);
     988    selectorg.SetName("selectGammasTrainTest");
     989
     990    TString strgtrain = "gRandom->Rndm()*(";
     991    strgtrain += howManyGammasTrain;
     992    strgtrain += "+";
     993    strgtrain += howManyGammasTest;
     994    strgtrain += ")<";
     995    strgtrain += howManyGammasTrain;   
     996    MF selsplitg(strgtrain);
    950997
    951998    MFillH fillmatg("MatrixGammas");
    952     fillmatg.SetFilter(&flistg);
     999    fillmatg.SetFilter(&flistgtrain);
    9531000    fillmatg.SetName("fillGammas");
    9541001
     1002    //-----------------------
     1003    // for writing the root files of training and test events
     1004    // for gammas
     1005   
     1006    MWriteRootFile writetraing(outNameGammasTrain, "RECREATE");
     1007    writetraing.SetName("WriteGammasTrain");
     1008    writetraing.SetFilter(&flistgtrain);
     1009
     1010      writetraing.AddContainer("MRawRunHeader", "RunHeaders");
     1011      writetraing.AddContainer("MTime",         "Events");
     1012      writetraing.AddContainer("MMcEvt",        "Events");
     1013      writetraing.AddContainer("ThetaOrig",     "Events");
     1014      writetraing.AddContainer("MSrcPosCam",    "Events");
     1015      writetraing.AddContainer("MSigmabar",     "Events");
     1016      writetraing.AddContainer("MHillas",       "Events");
     1017      writetraing.AddContainer("MHillasExt",    "Events");
     1018      writetraing.AddContainer("MHillasSrc",    "Events");
     1019      writetraing.AddContainer("MNewImagePar",  "Events");
     1020
     1021    MContinue contg(&flistgtrain);
     1022
     1023    MWriteRootFile writetestg(outNameGammasTest, "RECREATE");
     1024    writetestg.SetName("WriteGammasTest");
     1025    writetestg.SetFilter(&flistgtest);
     1026
     1027      writetestg.AddContainer("MRawRunHeader", "RunHeaders");
     1028      writetestg.AddContainer("MTime",         "Events");
     1029      writetestg.AddContainer("MMcEvt",        "Events");
     1030      writetestg.AddContainer("ThetaOrig",     "Events");
     1031      writetestg.AddContainer("MSrcPosCam",    "Events");
     1032      writetestg.AddContainer("MSigmabar",     "Events");
     1033      writetestg.AddContainer("MHillas",       "Events");
     1034      writetestg.AddContainer("MHillasExt",    "Events");
     1035      writetestg.AddContainer("MHillasSrc",    "Events");
     1036      writetestg.AddContainer("MNewImagePar",  "Events");
     1037
     1038    //-----------------------
    9551039   
    9561040    //*****************************   fill gammas   *** 
    9571041    // entries in MFilterList
    9581042
    959     flistg.AddToList(&fgamma);
    960     flistg.AddToList(&selectorg);
     1043    flistgtrain.AddToList(&fgamma);
     1044    flistgtrain.AddToList(&selectorg);
     1045    flistgtrain.AddToList(&selsplitg);
     1046
     1047    flistgtest.AddToList(&fgamma);
     1048    flistgtest.AddToList(&selectorg);
     1049    flistgtest.AddToList(&selsplitg);
    9611050
    9621051    //***************************** 
     
    9721061   
    9731062    tlistg.AddToList(&readg);
    974     tlistg.AddToList(&flistg);
     1063
     1064    tlistg.AddToList(&flistgtrain);
    9751065    tlistg.AddToList(&fillmatg);
     1066    tlistg.AddToList(&writetraing);
     1067
     1068    tlistg.AddToList(&contg);
     1069
     1070    tlistg.AddToList(&flistgtest);
     1071    tlistg.AddToList(&writetestg);
    9761072
    9771073    //*****************************
     
    9901086    tlistg.PrintStatistics(0, kTRUE);
    9911087
     1088    matrixg.Print("SizeCols");
     1089    Int_t generatedgTrain = matrixg.GetM().GetNrows();
     1090    if ( fabs(generatedgTrain-howManyGammasTrain) >
     1091                                    3.0*sqrt(howManyGammasTrain) )
     1092    {
     1093      gLog << "ONOFFCT1Analysis.C : no.of generated gamma training events ("
     1094           << generatedgTrain << ") is incompatible with the no.of requested events ("
     1095           << howManyGammasTrain << ")" << endl;   
     1096    }
     1097
     1098
     1099    Int_t generatedgTest = writetestg.GetNumExecutions();
     1100    if ( fabs(generatedgTest-howManyGammasTest) >
     1101                                    3.0*sqrt(howManyGammasTest) )
     1102    {
     1103      gLog << "ONOFFCT1Analysis.C : no.of generated gamma test events ("
     1104           << generatedgTest << ") is incompatible with the no.of requested events ("
     1105           << howManyGammasTest << ")" << endl;   
     1106    }
    9921107
    9931108    //*****************************   fill hadrons   *** 
    9941109
    9951110    gLog << " Hadrons :" << endl;
     1111    gLog << "----------" << endl;
     1112
     1113    MParList  plisth;
     1114    MTaskList tlisth;
     1115
     1116    MFilterList flisthtrain;
     1117    flisthtrain.SetName("HadronFilterTrain");
     1118    MFilterList flisthtest;
     1119    flisthtest.SetName("HadronFilterTest");
     1120
     1121    MReadMarsFile  readh("Events", filenameHad);
     1122    readh.DisableAutoScheme();
     1123
     1124    MFParticleId fhadrons("MMcEvt", '!', kGAMMA);
     1125    fhadrons.SetName("hadronID)");
    9961126
    9971127    TString mhname("costhh");
     
    10061136
    10071137    MFEventSelector2 selectorh(href);
    1008     //selectorh.SetNumMax(howManyHadrons);
    1009     // select as many hadrons as gammas
    1010     selectorh.SetNumMax(matrixg.GetM().GetNrows());
    1011     selectorh.SetName("selectHadrons");
     1138    selectorh.SetNumMax(howManyHadronsTrain+howManyHadronsTest);
     1139    selectorh.SetName("selectHadronsTrainTest");
     1140
     1141    TString strhtrain = "gRandom->Rndm()*(";
     1142    strhtrain += howManyHadronsTrain;
     1143    strhtrain += "+";
     1144    strhtrain += howManyHadronsTest;
     1145    strhtrain += ")<";
     1146    strhtrain += howManyHadronsTrain;   
     1147    MF selsplith(strhtrain);
    10121148
    10131149    MFillH fillmath("MatrixHadrons");
    1014     fillmath.SetFilter(&flisth);
     1150    fillmath.SetFilter(&flisthtrain);
    10151151    fillmath.SetName("fillHadrons");
    10161152
     1153    //-----------------------
     1154    // for writing the root files of training and test events
     1155    // for hadrons
     1156   
     1157    MWriteRootFile writetrainh(outNameHadronsTrain, "RECREATE");
     1158    writetrainh.SetName("WriteHadronsTrain");
     1159    writetrainh.SetFilter(&flisthtrain);
     1160
     1161      writetrainh.AddContainer("MRawRunHeader", "RunHeaders");
     1162      writetrainh.AddContainer("MTime",         "Events");
     1163      writetrainh.AddContainer("MMcEvt",        "Events");
     1164      writetrainh.AddContainer("ThetaOrig",     "Events");
     1165      writetrainh.AddContainer("MSrcPosCam",    "Events");
     1166      writetrainh.AddContainer("MSigmabar",     "Events");
     1167      writetrainh.AddContainer("MHillas",       "Events");
     1168      writetrainh.AddContainer("MHillasExt",    "Events");
     1169      writetrainh.AddContainer("MHillasSrc",    "Events");
     1170      writetrainh.AddContainer("MNewImagePar",  "Events");
     1171
     1172    MContinue conth(&flisthtrain);
     1173
     1174    MWriteRootFile writetesth(outNameHadronsTest, "RECREATE");
     1175    writetesth.SetName("WriteHadronsTest");
     1176    writetesth.SetFilter(&flisthtest);
     1177
     1178      writetesth.AddContainer("MRawRunHeader", "RunHeaders");
     1179      writetesth.AddContainer("MTime",         "Events");
     1180      writetesth.AddContainer("MMcEvt",        "Events");
     1181      writetesth.AddContainer("ThetaOrig",     "Events");
     1182      writetesth.AddContainer("MSrcPosCam",    "Events");
     1183      writetesth.AddContainer("MSigmabar",     "Events");
     1184      writetesth.AddContainer("MHillas",       "Events");
     1185      writetesth.AddContainer("MHillasExt",    "Events");
     1186      writetesth.AddContainer("MHillasSrc",    "Events");
     1187      writetesth.AddContainer("MNewImagePar",  "Events");
     1188
     1189    //-----------------------
    10171190
    10181191    // entries in MFilterList
    10191192
    1020     flisth.AddToList(&fhadrons);
    1021     flisth.AddToList(&selectorh);
     1193    flisthtrain.AddToList(&fhadrons);
     1194    flisthtrain.AddToList(&selectorh);
     1195    flisthtrain.AddToList(&selsplith);
     1196
     1197    flisthtest.AddToList(&fhadrons);
     1198    flisthtest.AddToList(&selectorh);
     1199    flisthtest.AddToList(&selsplith);
    10221200
    10231201    //***************************** 
     
    10331211   
    10341212    tlisth.AddToList(&readh);
    1035     tlisth.AddToList(&flisth);
     1213
     1214    tlisth.AddToList(&flisthtrain);
    10361215    tlisth.AddToList(&fillmath);
     1216    tlisth.AddToList(&writetrainh);
     1217
     1218    tlisth.AddToList(&conth);
     1219
     1220    tlisth.AddToList(&flisthtest);
     1221    tlisth.AddToList(&writetesth);
    10371222
    10381223    //*****************************
     
    10501235
    10511236    tlisth.PrintStatistics(0, kTRUE);
     1237
     1238    matrixh.Print("SizeCols");
     1239    Int_t generatedhTrain = matrixh.GetM().GetNrows();
     1240    if ( fabs(generatedhTrain-howManyHadronsTrain) >
     1241                                    3.0*sqrt(howManyHadronsTrain) )
     1242    {
     1243      gLog << "ONOFFCT1Analysis.C : no.of generated hadron training events ("
     1244           << generatedhTrain << ") is incompatible with the no.of requested events ("
     1245           << howManyHadronsTrain << ")" << endl;   
     1246    }
     1247
     1248
     1249    Int_t generatedhTest = writetesth.GetNumExecutions();
     1250    if ( fabs(generatedhTest-howManyHadronsTest) >
     1251                                    3.0*sqrt(howManyHadronsTest) )
     1252    {
     1253      gLog << "ONOFFCT1Analysis.C : no.of generated gamma test events ("
     1254           << generatedhTest << ") is incompatible with the no.of requested events ("
     1255           << howManyHadronsTest << ")" << endl;   
     1256    }
     1257
     1258
    10521259    //***************************************************** 
    10531260
     
    12041411    // end of growing the trees of the random forest
    12051412    //-----------------------------------------------------------------
    1206 
    1207 
    12081413
    12091414
     
    24192624
    24202625    gLog << "" << endl;
    2421     gLog << "Macro CT1Analysis : JobE_XX, OEEst, WEX = "
     2626    gLog << "Macro CT1Analysis : JobE_XX, CCollArea, OEEst, WEX = "
    24222627         << (JobE_XX ? "kTRUE" : "kFALSE")  << ",  "
     2628         << (CCollArea?"kTRUE" : "kFALSE")  << ",  "
    24232629         << (OEEst ?   "kTRUE" : "kFALSE")  << ",  "
    24242630         << (WEX     ? "kTRUE" : "kFALSE")  << endl;
     
    25102716
    25112717    //====================================================================
     2718
     2719    MHMcCT1CollectionArea collarea;
     2720    collarea.SetEaxis(MHMcCT1CollectionArea::kLinear);
     2721
     2722    MParList  parlist;
     2723    InitBinnings(&parlist);
     2724
     2725  if (CCollArea)
     2726  {
    25122727    gLog << "-----------------------------------------------" << endl;
    25132728    gLog << "Start calculation of effective collection areas" << endl;
    2514     MParList  parlist;
     2729
     2730
    25152731    MTaskList tasklist;
    25162732
     
    25272743    MContinue conthadrons(&cuthadrons);
    25282744
    2529     MHMcCT1CollectionArea collarea;
    2530     collarea.SetEaxis(MHMcCT1CollectionArea::kLinear);
    25312745
    25322746    MFillH filler("MHMcCT1CollectionArea", "MMcEvt");
     
    25372751
    25382752    parlist.AddToList(&tasklist);
    2539     InitBinnings(&parlist);
     2753
    25402754    parlist.AddToList(&collarea);
    25412755
     
    25692783    collarea.CalcEfficiency();
    25702784    collarea.DrawClone();
     2785
     2786
     2787
     2788    //---------------------------------------------
     2789    // Write histograms to a file
     2790    //
     2791
     2792    TFile f(collareaName, "RECREATE");
     2793    //collarea.GetHist()->Write();
     2794    //collarea.GetHAll()->Write();
     2795    //collarea.GetHSel()->Write();
     2796    collarea.Write();
     2797
     2798    f.Close();
     2799
     2800    gLog << "Collection area plots written onto file " << collareaName << endl;
     2801
     2802    gLog << "Calculation of effective collection areas done" << endl;
     2803    gLog << "-----------------------------------------------" << endl;   
     2804    //------------------------------------------------------------------
     2805  }
     2806
     2807  if (!CCollArea)
     2808  {
     2809    gLog << "-----------------------------------------------" << endl;
     2810    gLog << "Read in effective collection areas from file "
     2811         << collareaName << endl;
     2812
     2813    TFile collfile(collareaName);
     2814    collfile.ls();
     2815    collarea.Read("MHMcCT1CollectionArea");
     2816    collarea.DrawClone();
     2817
     2818    gLog << "Effective collection areas were read in from file "
     2819         << collareaName << endl;
     2820    gLog << "-----------------------------------------------" << endl;   
     2821  }
     2822
    25712823
    25722824    // save binnings for call to CT1EEst
     
    25842836        }
    25852837
    2586 
    2587     //---------------------------------------------
    2588     // Write histograms to a file
    2589     //
    2590 
    2591     TFile f(collareaName, "RECREATE");
    2592     collarea.GetHist()->Write();
    2593     collarea.GetHAll()->Write();
    2594     collarea.GetHSel()->Write();
    2595     f.Close();
    2596 
    2597     gLog << "Collection area plots written onto file " << collareaName << endl;
    2598 
    2599     gLog << "Calculation of effective collection areas done" << endl;
    2600     gLog << "-----------------------------------------------" << endl;   
    2601     //------------------------------------------------------------------
    2602 
    2603 
     2838    //-------------------------------------
    26042839    TString fHilName    = "MHillas";
    26052840    TString fHilNameExt = "MHillasExt";
Note: See TracChangeset for help on using the changeset viewer.