Changeset 2169 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
06/11/03 08:20:37 (21 years ago)
Author:
wittek
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r2167 r2169  
    153153    //  - write root file for ON (or OFF or MC) data (ON1.root, ...);
    154154
    155     Bool_t JobA    = kTRUE; 
     155    Bool_t JobA    = kFALSE; 
    156156    Bool_t WPad    = kFALSE;   // write out padding histograms ?
    157     Bool_t RPad    = kTRUE;   // read in padding histograms ?
    158     Bool_t Wout    = kTRUE;   // write out root file ON1.root
     157    Bool_t RPad    = kFALSE;   // read in padding histograms ?
     158    Bool_t Wout    = kFALSE;   // write out root file ON1.root
    159159                               // (or OFF1.root or MC1.root)?
    160160
    161 
    162     // Job A_MC : read MC gamma data,
    163     //  - read sigmabar vs. Theta plot from ON data 
    164     //  - do padding;
    165     //  - write root file for MC gammas (MC1.root);
    166 
    167     Bool_t JobA_MC  = kFALSE; 
    168     Bool_t WMC1     = kFALSE;  // write out root file MC1.root ?
    169 
    170 
    171     // Job B_NN_UP : read ON1.root (or MC1.root) file
     161    // Job B_NN_UP : read ON1.root (OFF1.root or MC1.root) file
    172162    //  - depending on RlookNN : create (or read in) hadron and gamma matrix
    173163    //  - calculate hadroness for method of NEAREST NEIGHBORS
    174     //    and for the SUPERCUTS
    175     //  - update the input files with the hadronesses (ON1.root or MC1.root)
     164    //  - update the input files with the hadroness (ON1.root, OFF1.root
     165    //    or MC1.root)
    176166
    177167    Bool_t JobB_NN_UP  = kFALSE; 
     
    180170
    181171
    182     // Job B_RF_UP : read ON1.root (or MC1.root) file
     172    // Job B_RF_UP : read ON1.root (OFF1.root or MC1.root) file
    183173    //  - depending on RLook : create (or read in) hadron and gamma matrix
    184174    //  - depending on RTree : create (or read in) trees
    185175    //  - calculate hadroness for method of RANDOM FOREST
    186     //  - update the input files with the hadroness (ON1.root or MC1.root)
     176    //    and for the SUPERCUTS
     177    //  - update the input files with the hadronesses (ON1.root, OFF1.root
     178    //     or MC1.root)
    187179
    188180    Bool_t JobB_RF_UP  = kFALSE; 
     
    211203    //  - make plots
    212204
    213     Bool_t JobD  = kFALSE; 
     205    Bool_t JobD  = kTRUE; 
    214206
    215207
     
    220212    //  - optimize energy estimation for events passing the final cuts
    221213    //  - write parameters of energy estimator onto file
    222     //  - update ON1.root and MC1.root files with estimated energy
    223     //    (ON_XX1.root and MC_XX1.root)
     214    //  - update ON1.root, OFF1.root and MC1.root files with estimated energy
     215    //    (ON_XX1.root, OFF_XX1.root and MC_XX1.root)
    224216
    225217    Bool_t JobE_EST_UP  = kFALSE; 
     
    693685
    694686
    695   //---------------------------------------------------------------------
    696    // Job A_MC
    697    //=========
    698 
    699     // read MC gamma data 
    700 
    701     //    - to pad them
    702     //      (using the 2D-histogram "sigmabar versus Theta"
    703     //       (SigmaTheta_ON.root)  of the ON data)
    704 
    705     //    - to write a file of padded MC gamma events (MC1.root)
    706     //      (after the standard cuts, before the g/h separation)
    707     //      (to be used together with the corresponding hadron file
    708     //       for the optimization of the g/h separation)
    709 
    710 
    711  if (JobA_MC)
    712  {
    713     gLog << "=====================================================" << endl;
    714     gLog << "Macro CT1Analysis : Start of Job A_MC" << endl;
    715 
    716     gLog << "" << endl;
    717     gLog << "Macro CT1Analysis : JobA_MC, WMC1 = "
    718          << JobA_MC  << ",  " << WMC1 << endl;
    719 
    720 
    721     // name of input root file
    722     TString filenamein(mcfile);
    723 
    724     // name of output root file
    725     TString outNameImage = outPath;
    726     outNameImage += "MC";
    727     outNameImage += "1.root";
    728 
    729     //------------------------------------------------
    730     // use for padding sigmabar vs. Theta from ON data
    731     TString typeHist = "ON";
    732     gLog << "typeHist = " << typeHist << endl;
    733 
    734     // name of file containing the histograms for the padding
    735     TString outNameSigTh = outPath;
    736     outNameSigTh += "SigmaTheta_";
    737     outNameSigTh += typeHist;
    738     outNameSigTh += ".root";
    739 
    740 
    741     //------------------------------------
    742     // Get the histograms "2D-ThetaSigmabar"
    743     // and                "3D-ThetaPixSigma"
    744     // and                "3D-ThetaPixDiff"
    745     // and                "2D-IdBlindPixels"
    746     // and                "2D-NBlindPixels"
    747 
    748 
    749       gLog << "Reading in file " << outNameSigTh << endl;
    750 
    751       TFile *infile = new TFile(outNameSigTh);
    752       infile->ls();
    753 
    754       TH2D *fHSigmaTheta =
    755       (TH2D*) gROOT->FindObject("2D-ThetaSigmabar");
    756       if (!fHSigmaTheta)
    757         {
    758           gLog << "Object '2D-ThetaSigmabar' not found on root file" << endl;
    759           return;
    760         }
    761       gLog << "Object '2D-ThetaSigmabar' was read in" << endl;
    762 
    763       TH3D *fHSigmaPixTheta =
    764       (TH3D*) gROOT->FindObject("3D-ThetaPixSigma");
    765       if (!fHSigmaPixTheta)
    766         {
    767           gLog << "Object '3D-ThetaPixSigma' not found on root file" << endl;
    768           return;
    769         }
    770       gLog << "Object '3D-ThetaPixSigma' was read in" << endl;
    771 
    772       TH3D *fHDiffPixTheta =
    773       (TH3D*) gROOT->FindObject("3D-ThetaPixDiff");
    774       if (!fHDiffPixTheta)
    775         {
    776           gLog << "Object '3D-ThetaPixDiff' not found on root file" << endl;
    777           return;
    778         }
    779       gLog << "Object '3D-ThetaPixDiff' was read in" << endl;
    780 
    781 
    782       TH2D *fHIdBlindPixels =
    783       (TH2D*) gROOT->FindObject("2D-IdBlindPixels");
    784       if (!fHIdBlindPixels)
    785         {
    786           gLog << "Object '2D-IdBlindPixels' not found on root file" << endl;
    787           return;
    788         }
    789       gLog << "Object '2D-IdBlindPixels' was read in" << endl;
    790 
    791       TH2D *fHNBlindPixels =
    792       (TH2D*) gROOT->FindObject("2D-NBlindPixels");
    793       if (!fHNBlindPixels)
    794         {
    795           gLog << "Object '2D-NBlindPixels' not found on root file" << endl;
    796           return;
    797         }
    798       gLog << "Object '2D-NBlindPixels' was read in" << endl;
    799 
    800     //------------------------------------
    801 
    802     MTaskList tlist;
    803     MParList plist;
    804 
    805     char *sourceName = "MSrcPosCam";
    806     MSrcPosCam source(sourceName);
    807 
    808 
    809     // geometry is needed in  MHHillas... classes
    810     MGeomCam *fGeom =
    811              (MGeomCam*)plist->FindCreateObj("MGeomCamCT1", "MGeomCam");
    812 
    813     //-------------------------------------------
    814     // create the tasks which should be executed
    815     //
    816 
    817     MCT1ReadPreProc read(filenamein);
    818 
    819     MBlindPixelCalc blind;
    820     blind.SetUseBlindPixels();
    821 
    822     MFCT1SelBasic selbasic;
    823     MContinue contbasic(&selbasic);
    824     contbasic.SetName("SelBasic");
    825 
    826 
    827     // There are 2 options for Thomas Schweizer's padding
    828     //     fPadFlag = 1   get Sigmabar from fHSigmaTheta
    829     //                    and Sigma    from fHDiffPixTheta
    830     //     fPadFlag = 2   get Sigma    from fHSigmaPixTheta
    831    
    832     MPadSchweizer padthomas("MPadSchweizer","Task for the padding (Schweizer)");
    833     padthomas.SetHistograms(fHSigmaTheta, fHSigmaPixTheta, fHDiffPixTheta,
    834                             fHIdBlindPixels, fHNBlindPixels);
    835     padthomas.SetPadFlag(1);
    836 
    837     MFillH fillblind("MCBlindPixels[MHBlindPixels]", "MBlindPixels");
    838     fillblind.SetName("HBlind");
    839 
    840 
    841     //...........................................
    842 
    843     MSigmabarCalc sigbarcalc;
    844 
    845     MFillH fillsigtheta ("MCSigmaTheta[MHSigmaTheta]", "MMcEvt");
    846     fillsigtheta.SetName("HSigmaTheta");
    847 
    848     MImgCleanStd    clean;
    849 
    850     // calculation of  image parameters ---------------------
    851     TString fHilName    = "MHillas";
    852     TString fHilNameExt = "MHillasExt";
    853     TString fHilNameSrc = "MHillasSrc";
    854     TString fImgParName = "MNewImagePar";
    855 
    856     MHillasCalc    hcalc;
    857     hcalc.SetNameHillas(fHilName);
    858     hcalc.SetNameHillasExt(fHilNameExt);
    859     hcalc.SetNameNewImgPar(fImgParName);
    860 
    861     MHillasSrcCalc hsrccalc(sourceName, fHilNameSrc);
    862     hsrccalc.SetInput(fHilName);
    863 
    864 
    865     MFillH hfill1("MHHillas",    fHilName);
    866     hfill1.SetName("HHillas");
    867 
    868     MFillH hfill2("MHStarMap",   fHilName);
    869     hfill2.SetName("HStarMap");
    870 
    871     MFillH hfill3("MHHillasExt",   fHilNameSrc);
    872     hfill3.SetName("HHillasExt");
    873 
    874     MFillH hfill4("MHHillasSrc",   fHilNameSrc);
    875     hfill4.SetName("HHillasSrc");
    876 
    877     MFillH hfill5("MHNewImagePar", fImgParName);
    878     hfill5.SetName("HNewImagePar");
    879     // --------------------------------------------------
    880 
    881     MFCT1SelStandard selstandard(fHilNameSrc);
    882     selstandard.SetHillasName(fHilName);
    883     selstandard.SetImgParName(fImgParName);
    884     selstandard.SetCuts(92, 4, 60, 0.4, 1.05, 0.0, 0.0);
    885     MContinue contstandard(&selstandard);
    886     contstandard.SetName("SelStandard");
    887 
    888 
    889 
    890       MWriteRootFile write(outNameImage);
    891 
    892       write.AddContainer("MRawRunHeader", "RunHeaders");
    893       write.AddContainer("MTime",         "Events");
    894       write.AddContainer("MMcEvt",        "Events");
    895       write.AddContainer("ThetaOrig",     "Events");
    896       write.AddContainer("MSrcPosCam",    "Events");
    897       write.AddContainer("MSigmabar",     "Events");
    898       write.AddContainer("MHillas",       "Events");
    899       write.AddContainer("MHillasExt",    "Events");
    900       write.AddContainer("MHillasSrc",    "Events");
    901       write.AddContainer("MNewImagePar",  "Events");
    902 
    903 
    904 
    905     //*****************************
    906     // entries in MParList
    907 
    908     plist.AddToList(&tlist);
    909     InitBinnings(&plist);
    910 
    911     plist.AddToList(&source);
    912 
    913 
    914     //*****************************
    915     // entries in MTaskList
    916 
    917     tlist.AddToList(&read);
    918     tlist.AddToList(&padthomas);
    919     tlist.AddToList(&blind);
    920 
    921     tlist.AddToList(&contbasic);
    922     tlist.AddToList(&fillblind);
    923     tlist.AddToList(&sigbarcalc);
    924     tlist.AddToList(&fillsigtheta);
    925     tlist.AddToList(&clean);
    926 
    927     tlist.AddToList(&hcalc);
    928     tlist.AddToList(&hsrccalc);
    929 
    930     tlist.AddToList(&hfill1);
    931     tlist.AddToList(&hfill2);
    932     tlist.AddToList(&hfill3);
    933     tlist.AddToList(&hfill4);
    934     tlist.AddToList(&hfill5);
    935 
    936     tlist.AddToList(&contstandard);
    937     if (WMC1)
    938       tlist.AddToList(&write);
    939 
    940     //*****************************
    941 
    942 
    943     //-------------------------------------------
    944     // Execute event loop
    945     //
    946     MProgressBar bar;
    947     MEvtLoop evtloop;
    948     evtloop.SetParList(&plist);
    949     evtloop.ReadEnv(env, "", printEnv);
    950     evtloop.SetProgressBar(&bar);
    951     //if (WMC1)   
    952     //  evtloop.Write();
    953 
    954     Int_t maxevents = -1;
    955     //Int_t maxevents = 1000;
    956     if ( !evtloop.Eventloop(maxevents) )
    957         return;
    958 
    959     tlist.PrintStatistics(0, kTRUE);
    960 
    961 
    962     //-------------------------------------------
    963     // Display the histograms
    964     //
    965 
    966     plist.FindObject("MCSigmaTheta",  "MHSigmaTheta")->DrawClone();
    967     plist.FindObject("MCBlindPixels", "MHBlindPixels")->DrawClone();
    968 
    969     plist.FindObject("MHHillas")->DrawClone();
    970     plist.FindObject("MHHillasExt")->DrawClone();
    971     plist.FindObject("MHHillasSrc")->DrawClone();
    972     plist.FindObject("MHNewImagePar")->DrawClone();
    973     plist.FindObject("MHStarMap")->DrawClone();
    974 
    975 
    976 
    977     DeleteBinnings(&plist);
    978 
    979     gLog << "Macro CT1Analysis : End of Job A_MC"
    980          << endl;
    981     gLog << "========================================================="
    982          << endl;
    983  }
    984 
    985 
    986687
    987688  //---------------------------------------------------------------------
     
    1010711
    1011712    //--------------------------------------------
    1012     // file to be updated (either ON or MC)
    1013 
    1014     TString typeInput = "ON";
    1015     //TString typeInput = "MC";
     713    // file to be updated (ON, OFF or MC)
     714
     715    //TString typeInput = "ON";
     716    //TString typeInput = "OFF";
     717    TString typeInput = "MC";
    1016718    gLog << "typeInput = " << typeInput << endl;
    1017719
     
    1034736    // files to be read for generating the look-alike events
    1035737    // "hadrons" :
    1036     TString filenameON = outPath;
    1037     filenameON += "ON";
    1038     filenameON += "1.root";
     738    TString filenameHad = outPath;
     739    filenameHad += "OFF";
     740    filenameHad += "1.root";
    1039741    Int_t howManyHadrons = 500000;
    1040     gLog << "filenameON = " << filenameON << ",   howManyHadrons = "
     742    gLog << "filenameHad = " << filenameHad << ",   howManyHadrons = "
    1041743         << howManyHadrons  << endl;
    1042744   
     
    1058760    outNameGammas += ".root";
    1059761
    1060     TString typeMatrixHadrons = "ON";
     762    TString typeMatrixHadrons = "OFF";
    1061763    gLog << "typeMatrixHadrons = " << typeMatrixHadrons << endl;
    1062764
     
    1134836    readg.DisableAutoScheme();
    1135837
    1136     MReadMarsFile  readh("Events", filenameON);
     838    MReadMarsFile  readh("Events", filenameHad);
    1137839    readh.DisableAutoScheme();
    1138840
     
    13831085
    13841086    //.......................................................................
    1385     // calculation of hadroness for the supercuts
    1386     // (=0.25 if fullfilled, =0.75 otherwise)
    1387 
    1388     TString hadSCName = "HadSC";
    1389     MCT1SupercutsCalc sccalc(fHilName, fHilNameSrc);
    1390     sccalc.SetHadronnessName(hadSCName);
    1391 
    1392     //.......................................................................
    13931087
    13941088      //MWriteRootFile write(outNameImage, "UPDATE");
     
    14061100      write.AddContainer("MNewImagePar",  "Events");
    14071101
     1102      write.AddContainer("HadRF",         "Events");
     1103      write.AddContainer("HadSC",         "Events");
    14081104      write.AddContainer("HadNN",         "Events");
    1409       write.AddContainer("HadSC",         "Events");
    14101105
    14111106
     
    14281123    MFillH fillhadnn("hadNN[MHHadronness]", hadNNName);
    14291124    fillhadnn.SetName("HhadNN");
    1430     MFillH fillhadsc("hadSC[MHHadronness]", hadSCName);
    1431     fillhadsc.SetName("HhadSC");
    14321125
    14331126    MFCT1SelFinal selfinal(fHilNameSrc);
     
    14701163
    14711164    tliston.AddToList(&nncalc);
    1472     tliston.AddToList(&sccalc);
    14731165    tliston.AddToList(&fillhadnn);
    1474     tliston.AddToList(&fillhadsc);
    14751166
    14761167    tliston.AddToList(&hfill1);
     
    15051196    //
    15061197    pliston.FindObject("hadNN", "MHHadronness")->DrawClone();
    1507     pliston.FindObject("hadSC", "MHHadronness")->DrawClone();
    15081198
    15091199    pliston.FindObject("MHHillas")->DrawClone();
     
    15571247
    15581248    //--------------------------------------------
    1559     // file to be updated (either ON or MC)
     1249    // file to be updated (ON, OFF or MC)
    15601250
    15611251    TString typeInput = "ON";
     1252    //TString typeInput = "OFF";
    15621253    //TString typeInput = "MC";
    15631254    gLog << "typeInput = " << typeInput << endl;
     
    15661257    TString filenameData = outPath;
    15671258    filenameData += typeInput;
    1568     filenameData += "2.root";
     1259    filenameData += "1.root";
    15691260    gLog << "filenameData = " << filenameData << endl;
    15701261
     
    15721263    TString outNameImage = outPath;
    15731264    outNameImage += typeInput;
    1574     outNameImage += "3.root";
     1265    outNameImage += "2.root";
    15751266    //TString outNameImage = filenameData;
    15761267
     
    15801271    // files to be read for generating the look-alike events
    15811272    // "hadrons" :
    1582     TString filenameON = outPath;
    1583     filenameON += "ON";
    1584     filenameON += "1.root";
     1273    TString filenameHad = outPath;
     1274    filenameHad += "OFF";
     1275    filenameHad += "1.root";
    15851276    Int_t howManyHadrons = 1000000;
    1586     gLog << "filenameON = " << filenameON << ",   howManyHadrons = "
     1277    gLog << "filenameHad = " << filenameHad << ",   howManyHadrons = "
    15871278         << howManyHadrons  << endl;
    15881279   
     
    16041295    outNameGammas += ".root";
    16051296
    1606     TString typeMatrixHadrons = "ON";
     1297    TString typeMatrixHadrons = "OFF";
    16071298    gLog << "typeMatrixHadrons = " << typeMatrixHadrons << endl;
    16081299
     
    16871378    readg.DisableAutoScheme();
    16881379
    1689     MReadMarsFile  readh("Events", filenameON);
     1380    MReadMarsFile  readh("Events", filenameHad);
    16901381    readh.DisableAutoScheme();
    16911382
     
    20461737
    20471738    //.......................................................................
     1739    // calculation of hadroness for the supercuts
     1740    // (=0.25 if fullfilled, =0.75 otherwise)
     1741
     1742    TString hadSCName = "HadSC";
     1743    MCT1SupercutsCalc sccalc(fHilName, fHilNameSrc);
     1744    sccalc.SetHadronnessName(hadSCName);
     1745
     1746
     1747    //.......................................................................
    20481748
    20491749      //MWriteRootFile write(outNameImage, "UPDATE");
     
    20611761      write.AddContainer("MNewImagePar",  "Events");
    20621762
    2063       write.AddContainer("HadNN",         "Events");
     1763      write.AddContainer("HadRF",         "Events");
    20641764      write.AddContainer("HadSC",         "Events");
    2065 
    2066       write.AddContainer(hadRFName,       "Events");
    2067 
    20681765
    20691766    //-----------------------------------------------------------------
     
    20891786    MFillH fillhadrf("hadRF[MHHadronness]", hadRFName);
    20901787    fillhadrf.SetName("HhadRF");
     1788    MFillH fillhadsc("hadSC[MHHadronness]", hadSCName);
     1789    fillhadsc.SetName("HhadSC");
     1790
    20911791
    20921792    MFCT1SelFinal selfinal(fHilNameSrc);
     
    21281828
    21291829    tliston.AddToList(&rfcalc);
     1830    tliston.AddToList(&sccalc);
    21301831    tliston.AddToList(&fillranfor);
    21311832    tliston.AddToList(&fillhadrf);
     1833    tliston.AddToList(&fillhadsc);
    21321834
    21331835    tliston.AddToList(&hfill1);
     
    21641866    pliston.FindObject("MHRanForest")->DrawClone();
    21651867    pliston.FindObject("hadRF", "MHHadronness")->DrawClone();
     1868    pliston.FindObject("hadSC", "MHHadronness")->DrawClone();
    21661869
    21671870    pliston.FindObject("MHHillas")->DrawClone();
     
    22011904    // name of input data file
    22021905    TString filenameData = outPath;
    2203     filenameData += "ON";
    2204     filenameData += "3.root";
     1906    filenameData += "OFF";
     1907    filenameData += "2.root";
    22051908    gLog << "filenameData = " << filenameData << endl;
    22061909
     
    22081911    TString filenameMC = outPath;
    22091912    filenameMC += "MC";
    2210     filenameMC += "3.root";
     1913    filenameMC += "2.root";
    22111914    gLog << "filenameMC   = " << filenameMC   << endl;
    22121915
     
    22521955    MFCT1SelFinal selfinalgh(fHilNameSrc);
    22531956    selfinalgh.SetCuts(maxhadronness, 100.0, maxdist);
    2254     selfinalgh.SetHadronnessName(hadNNName);
     1957    selfinalgh.SetHadronnessName(hadRFName);
    22551958    selfinalgh.SetName("SelFinalgh");
    22561959    MContinue contfinalgh(&selfinalgh);
    22571960    contfinalgh.SetName("ContSelFinalgh");
    22581961
    2259     MFillH fillhadnn("hadNN[MHHadronness]", hadNNName);
    2260     fillhadnn.SetName("HhadNN");
     1962    //MFillH fillhadnn("hadNN[MHHadronness]", hadNNName);
     1963    //fillhadnn.SetName("HhadNN");
    22611964    MFillH fillhadsc("hadSC[MHHadronness]", hadSCName);
    22621965    fillhadsc.SetName("HhadSC");
     
    22661969    MFCT1SelFinal selfinal(fHilNameSrc);
    22671970    selfinal.SetCuts(maxhadronness, maxalpha, maxdist);
    2268     selfinal.SetHadronnessName(hadNNName);
     1971    selfinal.SetHadronnessName(hadRFName);
    22691972    selfinal.SetName("SelFinal");
    22701973    MContinue contfinal(&selfinal);
     
    23002003    tliston.AddToList(&read);
    23012004
    2302     tliston.AddToList(&fillhadnn);
     2005    //tliston.AddToList(&fillhadnn);
    23032006    tliston.AddToList(&fillhadsc);
    23042007    tliston.AddToList(&fillhadrf);
     
    23352038    //
    23362039
    2337     pliston.FindObject("hadNN", "MHHadronness")->DrawClone();
     2040    //pliston.FindObject("hadNN", "MHHadronness")->DrawClone();
    23382041    pliston.FindObject("hadSC", "MHHadronness")->DrawClone();
    23392042    pliston.FindObject("hadRF", "MHHadronness")->DrawClone();
     
    23722075
    23732076    // type of data to be analysed
    2374     //TString typeData = "ON";
     2077    TString typeData = "ON";
    23752078    //TString typeData = "OFF";
    2376     TString typeData = "MC";
     2079    //TString typeData = "MC";
    23772080    gLog << "typeData = " << typeData << endl;
    23782081
    2379     TString ext      = "3.root";
     2082    TString ext      = "2.root";
    23802083
    23812084
     
    23922095
    23932096    // maximum values of the hadronness, |ALPHA| and DIST
    2394     Float_t maxhadronness   = 0.20;
     2097    Float_t maxhadronness   = 0.30;
    23952098    Float_t maxalpha        = 20.0;
    23962099    Float_t maxdist         = 10.0;
     
    24472150    contfinalgh.SetName("ContSelFinalgh");
    24482151
    2449     MFillH fillhadnn("hadNN[MHHadronness]", "HadNN");
    2450     fillhadnn.SetName("HhadNN");
     2152    //MFillH fillhadnn("hadNN[MHHadronness]", "HadNN");
     2153    //fillhadnn.SetName("HhadNN");
    24512154    MFillH fillhadsc("hadSC[MHHadronness]", "HadSC");
    24522155    fillhadsc.SetName("HhadSC");
     
    24922195    tliston.AddToList(&contfinalgh);
    24932196
    2494     tliston.AddToList(&contfinal);
    2495 
    2496     tliston.AddToList(&fillhadnn);
     2197    //tliston.AddToList(&fillhadnn);
    24972198    tliston.AddToList(&fillhadsc);
    24982199    tliston.AddToList(&fillhadrf);
     
    25042205    tliston.AddToList(&hfill5);
    25052206
    2506 
     2207    tliston.AddToList(&contfinal);
    25072208
    25082209    //*****************************
     
    25242225
    25252226
     2227
    25262228    //-------------------------------------------
    25272229    // Display the histograms
    25282230    //
    25292231
    2530     pliston.FindObject("hadNN", "MHHadronness")->DrawClone();
     2232    //pliston.FindObject("hadNN", "MHHadronness")->DrawClone();
    25312233    pliston.FindObject("hadRF", "MHHadronness")->DrawClone();
    25322234    pliston.FindObject("hadSC", "MHHadronness")->DrawClone();
     
    25382240    pliston.FindObject("MHStarMap")->DrawClone();
    25392241
     2242    //-------------------------------------------
     2243    // fit alpha distribution to get the number of excess events
     2244    //
     2245
     2246    MHHillasSrc* hillasSrc =
     2247      (MHHillasSrc*)(pliston->FindObject("MHHillasSrc"));
     2248    TH1F* alphaHist = (TH1F*)(hillasSrc->GetHistAlpha());
     2249 
     2250    MHOnSubtraction onsub;
     2251    onsub.Calc(alphaHist, &pliston, kTRUE, 25);
     2252    //-------------------------------------------
     2253
    25402254    DeleteBinnings(&pliston);
    25412255
     
    25702284
    25712285
    2572     TString typeON = "ON";
    2573     TString typeMC = "MC";
    2574     TString ext    = "3.root";
    2575     TString extout = "4.root";
     2286    TString typeON  = "ON";
     2287    TString typeOFF = "OFF";
     2288    TString typeMC  = "MC";
     2289    TString ext    = "2.root";
     2290    TString extout = "3.root";
    25762291
    25772292    //------------------------------
     
    25862301    // and definition of final selections
    25872302
    2588     TString XX("NN");
     2303    //TString XX("NN");
    25892304    //TString XX("SC");
    2590     //TString XX("RF");
     2305    TString XX("RF");
    25912306    TString fhadronnessName("Had");
    25922307    fhadronnessName += XX;
     
    26152330    filenameON += ext;
    26162331    gLog << "filenameON = " << filenameON << endl;
     2332
     2333    // name of OFF file to be updated
     2334    TString filenameOFF(outPath);
     2335    filenameOFF += typeOFF;
     2336    filenameOFF += ext;
     2337    gLog << "filenameOFF = " << filenameOFF << endl;
    26172338
    26182339    // name of MC file to be updated
     
    26312352    gLog << "filenameONup = " << filenameONup << endl;
    26322353
     2354    // name of updated OFF file
     2355    TString filenameOFFup(outPath);
     2356    filenameOFFup += typeOFF;
     2357    filenameOFFup += "_";
     2358    filenameOFFup += XX;
     2359    filenameOFFup += extout;
     2360    gLog << "filenameOFFup = " << filenameOFFup << endl;
     2361
    26332362    // name of updated MC file
    26342363    TString filenameMCup(outPath);
     
    26832412    //==========   start update   ============================================
    26842413    //
    2685     // Update ON and MC root files with the estimated energy
     2414    // Update ON, OFF and MC root files with the estimated energy
    26862415
    26872416    //---------------------------------------------------
    2688     // Update ON data
     2417    // Update OFF data
    26892418    //
    26902419    gLog << "============================================================"
    26912420         << endl;
    2692     gLog << "Macro CT1Analysis.C : update file '" << filenameON
     2421    gLog << "Macro CT1Analysis.C : update file '" << filenameOFF
    26932422         << "'" << endl;
    26942423
    2695     MTaskList tliston;
    2696     MParList pliston;
     2424    MTaskList tlistoff;
     2425    MParList plistoff;
    26972426
    26982427
    26992428    // geometry is needed in  MHHillas... classes
    27002429    MGeomCam *fGeom =
    2701              (MGeomCam*)pliston->FindCreateObj("MGeomCamCT1", "MGeomCam");
     2430             (MGeomCam*)plistoff->FindCreateObj("MGeomCamCT1", "MGeomCam");
    27022431
    27032432    //-------------------------------------------
     
    27052434    //
    27062435
    2707     MReadMarsFile read("Events", filenameON);
     2436    MReadMarsFile read("Events", filenameOFF);
    27082437    read.DisableAutoScheme();
    27092438
     
    27192448    //.......................................................................
    27202449
    2721       MWriteRootFile write(filenameONup);
     2450      MWriteRootFile write(filenameOFFup);
    27222451
    27232452      write.AddContainer("MRawRunHeader", "RunHeaders");
     
    27322461      write.AddContainer("MNewImagePar",  "Events");
    27332462
    2734       write.AddContainer("HadNN",         "Events");
     2463      //write.AddContainer("HadNN",         "Events");
    27352464      write.AddContainer("HadSC",         "Events");
    27362465      write.AddContainer("HadRF",         "Events");
     
    27492478    // entries in MParList
    27502479
    2751     pliston.AddToList(&tliston);
    2752     InitBinnings(&pliston);
     2480    plistoff.AddToList(&tlistoff);
     2481    InitBinnings(&plistoff);
    27532482
    27542483
     
    27562485    // entries in MTaskList
    27572486   
    2758     tliston.AddToList(&read);
    2759     tliston.AddToList(&eest2);
    2760     tliston.AddToList(&write);
    2761     tliston.AddToList(&contfinal);
     2487    tlistoff.AddToList(&read);
     2488    tlistoff.AddToList(&eest2);
     2489    tlistoff.AddToList(&write);
     2490    tlistoff.AddToList(&contfinal);
    27622491
    27632492    //*****************************
     
    27682497    MProgressBar bar;
    27692498    MEvtLoop evtloop;
    2770     evtloop.SetParList(&pliston);
     2499    evtloop.SetParList(&plistoff);
    27712500    evtloop.SetProgressBar(&bar);
    27722501
     
    27762505        return;
    27772506
    2778     tliston.PrintStatistics(0, kTRUE);
    2779     DeleteBinnings(&pliston);
     2507    tlistoff.PrintStatistics(0, kTRUE);
     2508    DeleteBinnings(&plistoff);
    27802509
    27812510    //---------------------------------------------------
     2511
    27822512    //---------------------------------------------------
    2783     // Update MC data
     2513    // Update ON data
    27842514    //
    27852515    gLog << "============================================================"
    27862516         << endl;
    2787     gLog << "Macro CT1Analysis.C : update file '" << filenameMC
     2517    gLog << "Macro CT1Analysis.C : update file '" << filenameON
    27882518         << "'" << endl;
    27892519
    2790     MTaskList tlistmc;
    2791     MParList plistmc;
     2520    MTaskList tliston;
     2521    MParList pliston;
     2522
     2523
     2524    // geometry is needed in  MHHillas... classes
     2525    MGeomCam *fGeom =
     2526             (MGeomCam*)pliston->FindCreateObj("MGeomCamCT1", "MGeomCam");
    27922527
    27932528    //-------------------------------------------
     
    27952530    //
    27962531
    2797     MReadMarsFile read("Events", filenameMC);
     2532    MReadMarsFile read("Events", filenameON);
    27982533    read.DisableAutoScheme();
    27992534
     
    28092544    //.......................................................................
    28102545
    2811       MWriteRootFile write(filenameMCup);
     2546      MWriteRootFile write(filenameONup);
    28122547
    28132548      write.AddContainer("MRawRunHeader", "RunHeaders");
     
    28222557      write.AddContainer("MNewImagePar",  "Events");
    28232558
    2824       write.AddContainer("HadNN",         "Events");
     2559      //write.AddContainer("HadNN",         "Events");
    28252560      write.AddContainer("HadSC",         "Events");
    28262561      write.AddContainer("HadRF",         "Events");
     
    28392574    // entries in MParList
    28402575
    2841     plistmc.AddToList(&tlistmc);
    2842     InitBinnings(&plistmc);
     2576    pliston.AddToList(&tliston);
     2577    InitBinnings(&pliston);
    28432578
    28442579
     
    28462581    // entries in MTaskList
    28472582   
    2848     tlistmc.AddToList(&read);
    2849     tlistmc.AddToList(&eest2);
    2850     tlistmc.AddToList(&write);
    2851     tlistmc.AddToList(&contfinal);
     2583    tliston.AddToList(&read);
     2584    tliston.AddToList(&eest2);
     2585    tliston.AddToList(&write);
     2586    tliston.AddToList(&contfinal);
    28522587
    28532588    //*****************************
     
    28582593    MProgressBar bar;
    28592594    MEvtLoop evtloop;
    2860     evtloop.SetParList(&plistmc);
     2595    evtloop.SetParList(&pliston);
    28612596    evtloop.SetProgressBar(&bar);
    28622597
     
    28662601        return;
    28672602
    2868     tlistmc.PrintStatistics(0, kTRUE);
    2869     DeleteBinnings(&plistmc);
    2870 
    2871 
    2872     //==========   end update   ============================================
    2873    }
    2874    
    2875     enparam.Close();
    2876 
    2877     gLog << "Macro CT1Analysis : End of Job E_EST_UP" << endl;
    2878     gLog << "=======================================================" << endl;
    2879  }
    2880   //---------------------------------------------------------------------
    2881 
    2882 
    2883   //---------------------------------------------------------------------
    2884   // Job F_XX
    2885   //=========
    2886 
    2887     //  - select g/h separation method XX
    2888     //  - read MC_XX2.root file
    2889     //  - calculate eff. collection area
    2890     //  - read ON_XX2.root file
    2891     //  - apply final cuts
    2892     //  - calculate flux
    2893     //  - write root file for ON data after final cuts (ON_XX3.root))
    2894 
    2895 
    2896  if (JobF_XX)
    2897  {
    2898     gLog << "=====================================================" << endl;
    2899     gLog << "Macro CT1Analysis : Start of Job F_XX" << endl;
    2900 
    2901     gLog << "" << endl;
    2902     gLog << "Macro CT1Analysis : JobF_XX, WXX = "
    2903          << JobF_XX  << ",  " << WXX << endl;
    2904 
    2905     // type of data to be analysed
    2906     TString typeData = "ON";
    2907     //TString typeData = "OFF";
    2908     //TString typeData = "MC";
    2909     gLog << "typeData = " << typeData << endl;
    2910 
    2911     TString typeMC   = "MC";
    2912     TString ext      = "2.root";
    2913     TString extout   = "3.root";
    2914 
    2915     //------------------------------
    2916     // selection of g/h separation method
    2917     // and definition of final selections
    2918 
    2919     //TString XX("NN");
    2920     TString XX("SC");
    2921     //TString XX("RF");
    2922     TString fhadronnessName("Had");
    2923     fhadronnessName += XX;
    2924     gLog << "fhadronnessName = " << fhadronnessName << endl;
    2925 
    2926     // maximum values of the hadronness, |ALPHA| and DIST
    2927     Float_t maxhadronness   = 0.40;
    2928     Float_t maxalpha        = 20.0;
    2929     Float_t maxdist         = 10.0;
    2930     gLog << "Maximum values of hadronness, |ALPHA| and DIST = "
    2931          << maxhadronness << ",  " << maxalpha << ",  "
    2932          << maxdist << endl;
    2933 
    2934 
    2935     //------------------------------
    2936     // name of MC file to be used for calculating the eff. collection areas
    2937     TString filenameArea(outPath);
    2938     filenameArea += typeMC;
    2939     filenameArea += "_";
    2940     filenameArea += XX;
    2941     filenameArea += ext;
    2942     gLog << "filenameArea = " << filenameArea << endl;
    2943 
    2944     //------------------------------
    2945     // name of file containing the eff. collection areas
    2946     TString collareaName(outPath);
    2947     collareaName += "area_";
    2948     collareaName += XX;
    2949     collareaName += ".root";
    2950     gLog << "collareaName = " << collareaName << endl;
    2951 
    2952     //------------------------------
    2953     // name of data file to be analysed
    2954     TString filenameData(outPath);
    2955     filenameData += typeData;
    2956     filenameData += "_";
    2957     filenameData += XX;
    2958     filenameData += ext;
    2959     gLog << "filenameData = " << filenameData << endl;
    2960 
    2961     //------------------------------
    2962     // name of output data file (after the final cuts)
    2963     TString filenameDataout(outPath);
    2964     filenameDataout += typeData;
    2965     filenameDataout += "_";
    2966     filenameDataout += XX;
    2967     filenameDataout += extout;
    2968     gLog << "filenameDataout = " << filenameDataout << endl;
    2969 
    2970 
    2971     //====================================================================
    2972     gLog << "-----------------------------------------------" << endl;
    2973     gLog << "Start calculation of effective collection areas" << endl;
    2974     MParList  parlist;
    2975     MTaskList tasklist;
    2976 
    2977     //---------------------------------------
    2978     // Setup the tasks to be executed
    2979     //
    2980     MReadMarsFile reader("Events", filenameArea);
    2981     reader.DisableAutoScheme();
    2982 
    2983     MFCT1SelFinal cuthadrons;
    2984     cuthadrons.SetHadronnessName(fhadronnessName);
    2985     cuthadrons.SetCuts(maxhadronness, maxalpha, maxdist);
    2986 
    2987     MContinue conthadrons(&cuthadrons);
    2988 
    2989     MHMcCT1CollectionArea* collarea = new MHMcCT1CollectionArea();
    2990 
    2991     MFillH filler("MHMcCT1CollectionArea", "MMcEvt");
    2992     filler.SetName("CollectionArea");
    2993 
    2994     //********************************
    2995     // entries in MParList
    2996 
    2997     parlist.AddToList(&tasklist);
    2998     InitBinnings(&parlist);
    2999     parlist.AddToList(collarea);
    3000 
    3001     //********************************
    3002     // entries in MTaskList
    3003 
    3004     tasklist.AddToList(&reader);   
    3005     tasklist.AddToList(&conthadrons);
    3006     tasklist.AddToList(&filler);
    3007 
    3008     //********************************
    3009 
    3010     //-----------------------------------------
    3011     // Execute event loop
    3012     //
    3013     MEvtLoop magic;
    3014     magic.SetParList(&parlist);
    3015 
    3016     MProgressBar bar;
    3017     magic.SetProgressBar(&bar);
    3018     if (!magic.Eventloop())
    3019         return;
    3020 
    3021     tasklist.PrintStatistics(0, kTRUE);
    3022 
    3023     // Calculate effective collection areas
    3024     // and display the histograms
    3025     //
    3026     //MHMcCT1CollectionArea *collarea = parlist.FindObject("MHMcCT1CollectionArea");
    3027     collarea->CalcEfficiency();
    3028     collarea->DrawClone("lego");
    3029 
    3030     //---------------------------------------------
    3031     // Write histograms to a file
    3032     //
    3033 
    3034     TFile f(collareaName, "RECREATE");
    3035     collarea->GetHist()->Write();
    3036     collarea->GetHAll()->Write();
    3037     collarea->GetHSel()->Write();
    3038     f.Close();
    3039 
    3040 
    3041     gLog << "Calculation of effective collection areas done" << endl;
    3042     gLog << "-----------------------------------------------" << endl;   
    3043     //------------------------------------------------------------------
    3044 
    3045 
    3046     //*************************************************************************
    3047     //
    3048     // Analyse the data
    3049     //
    3050 
    3051     MTaskList tliston;
    3052     MParList pliston;
    3053 
    3054     // geometry is needed in  MHHillas... classes
    3055     MGeomCam *fGeom =
    3056              (MGeomCam*)pliston->FindCreateObj("MGeomCamCT1", "MGeomCam");
    3057 
    3058 
    3059     TString fHilName    = "MHillas";
    3060     TString fHilNameExt = "MHillasExt";
    3061     TString fHilNameSrc = "MHillasSrc";
    3062     TString fImgParName = "MNewImagePar";
     2603    tliston.PrintStatistics(0, kTRUE);
     2604    DeleteBinnings(&pliston);
     2605
     2606    //---------------------------------------------------
     2607
     2608    //---------------------------------------------------
     2609    // Update MC data
     2610    //
     2611    gLog << "============================================================"
     2612         << endl;
     2613    gLog << "Macro CT1Analysis.C : update file '" << filenameMC
     2614         << "'" << endl;
     2615
     2616    MTaskList tlistmc;
     2617    MParList plistmc;
    30632618
    30642619    //-------------------------------------------
     
    30662621    //
    30672622
    3068     MReadMarsFile read("Events", filenameData);
     2623    MReadMarsFile read("Events", filenameMC);
    30692624    read.DisableAutoScheme();
    30702625
     2626    //---------------------------
     2627    // calculate estimated energy
     2628
     2629    MEnergyEstParam eest2(fHilName);
     2630    eest2.Add(fHilNameSrc);
     2631
     2632    eest2.SetCoeffA(parA);
     2633    eest2.SetCoeffB(parB);
     2634
    30712635    //.......................................................................
    30722636
    3073 
    3074       MWriteRootFile write(filenameDataout);
     2637      MWriteRootFile write(filenameMCup);
    30752638
    30762639      write.AddContainer("MRawRunHeader", "RunHeaders");
     
    30852648      write.AddContainer("MNewImagePar",  "Events");
    30862649
    3087       write.AddContainer("HadNN",         "Events");
     2650      //write.AddContainer("HadNN",         "Events");
     2651      write.AddContainer("HadSC",         "Events");
     2652      write.AddContainer("HadRF",         "Events");
     2653
     2654      write.AddContainer("MEnergyEst",    "Events");
     2655
     2656    //-----------------------------------------------------------------
     2657
     2658    MFCT1SelFinal selfinal(fHilNameSrc);
     2659    selfinal.SetCuts(maxhadronness, maxalpha, maxdist);
     2660    selfinal.SetHadronnessName(fhadronnessName);
     2661    MContinue contfinal(&selfinal);
     2662
     2663
     2664    //*****************************
     2665    // entries in MParList
     2666
     2667    plistmc.AddToList(&tlistmc);
     2668    InitBinnings(&plistmc);
     2669
     2670
     2671    //*****************************
     2672    // entries in MTaskList
     2673   
     2674    tlistmc.AddToList(&read);
     2675    tlistmc.AddToList(&eest2);
     2676    tlistmc.AddToList(&write);
     2677    tlistmc.AddToList(&contfinal);
     2678
     2679    //*****************************
     2680
     2681    //-------------------------------------------
     2682    // Execute event loop
     2683    //
     2684    MProgressBar bar;
     2685    MEvtLoop evtloop;
     2686    evtloop.SetParList(&plistmc);
     2687    evtloop.SetProgressBar(&bar);
     2688
     2689    Int_t maxevents = -1;
     2690    //Int_t maxevents = 1000;
     2691    if ( !evtloop.Eventloop(maxevents) )
     2692        return;
     2693
     2694    tlistmc.PrintStatistics(0, kTRUE);
     2695    DeleteBinnings(&plistmc);
     2696
     2697
     2698    //==========   end update   ============================================
     2699   }
     2700   
     2701    enparam.Close();
     2702
     2703    gLog << "Macro CT1Analysis : End of Job E_EST_UP" << endl;
     2704    gLog << "=======================================================" << endl;
     2705 }
     2706  //---------------------------------------------------------------------
     2707
     2708
     2709  //---------------------------------------------------------------------
     2710  // Job F_XX
     2711  //=========
     2712
     2713    //  - select g/h separation method XX
     2714    //  - read MC_XX2.root file
     2715    //  - calculate eff. collection area
     2716    //  - read ON_XX2.root file
     2717    //  - apply final cuts
     2718    //  - calculate flux
     2719    //  - write root file for ON data after final cuts (ON_XX3.root))
     2720
     2721
     2722 if (JobF_XX)
     2723 {
     2724    gLog << "=====================================================" << endl;
     2725    gLog << "Macro CT1Analysis : Start of Job F_XX" << endl;
     2726
     2727    gLog << "" << endl;
     2728    gLog << "Macro CT1Analysis : JobF_XX, WXX = "
     2729         << JobF_XX  << ",  " << WXX << endl;
     2730
     2731    // type of data to be analysed
     2732    //TString typeData = "ON";
     2733    //TString typeData = "OFF";
     2734    TString typeData = "MC";
     2735    gLog << "typeData = " << typeData << endl;
     2736
     2737    TString typeMC   = "MC";
     2738    TString ext      = "3.root";
     2739    TString extout   = "4.root";
     2740
     2741    //------------------------------
     2742    // selection of g/h separation method
     2743    // and definition of final selections
     2744
     2745    //TString XX("NN");
     2746    //TString XX("SC");
     2747    TString XX("RF");
     2748    TString fhadronnessName("Had");
     2749    fhadronnessName += XX;
     2750    gLog << "fhadronnessName = " << fhadronnessName << endl;
     2751
     2752    // maximum values of the hadronness, |ALPHA| and DIST
     2753    Float_t maxhadronness   = 0.40;
     2754    Float_t maxalpha        = 20.0;
     2755    Float_t maxdist         = 10.0;
     2756    gLog << "Maximum values of hadronness, |ALPHA| and DIST = "
     2757         << maxhadronness << ",  " << maxalpha << ",  "
     2758         << maxdist << endl;
     2759
     2760
     2761    //------------------------------
     2762    // name of MC file to be used for calculating the eff. collection areas
     2763    TString filenameArea(outPath);
     2764    filenameArea += typeMC;
     2765    filenameArea += "_";
     2766    filenameArea += XX;
     2767    filenameArea += ext;
     2768    gLog << "filenameArea = " << filenameArea << endl;
     2769
     2770    //------------------------------
     2771    // name of file containing the eff. collection areas
     2772    TString collareaName(outPath);
     2773    collareaName += "area_";
     2774    collareaName += XX;
     2775    collareaName += ".root";
     2776    gLog << "collareaName = " << collareaName << endl;
     2777
     2778    //------------------------------
     2779    // name of data file to be analysed
     2780    TString filenameData(outPath);
     2781    filenameData += typeData;
     2782    filenameData += "_";
     2783    filenameData += XX;
     2784    filenameData += ext;
     2785    gLog << "filenameData = " << filenameData << endl;
     2786
     2787    //------------------------------
     2788    // name of output data file (after the final cuts)
     2789    TString filenameDataout(outPath);
     2790    filenameDataout += typeData;
     2791    filenameDataout += "_";
     2792    filenameDataout += XX;
     2793    filenameDataout += extout;
     2794    gLog << "filenameDataout = " << filenameDataout << endl;
     2795
     2796
     2797    //====================================================================
     2798    gLog << "-----------------------------------------------" << endl;
     2799    gLog << "Start calculation of effective collection areas" << endl;
     2800    MParList  parlist;
     2801    MTaskList tasklist;
     2802
     2803    //---------------------------------------
     2804    // Setup the tasks to be executed
     2805    //
     2806    MReadMarsFile reader("Events", filenameArea);
     2807    reader.DisableAutoScheme();
     2808
     2809    MFCT1SelFinal cuthadrons;
     2810    cuthadrons.SetHadronnessName(fhadronnessName);
     2811    cuthadrons.SetCuts(maxhadronness, maxalpha, maxdist);
     2812
     2813    MContinue conthadrons(&cuthadrons);
     2814
     2815    //MHMcCT1CollectionArea* collarea = new MHMcCT1CollectionArea();
     2816    //MHMcCT1CollectionArea* collarea;
     2817
     2818    MFillH filler("MHMcCT1CollectionArea", "MMcEvt");
     2819    filler.SetName("CollectionArea");
     2820
     2821    //********************************
     2822    // entries in MParList
     2823
     2824    parlist.AddToList(&tasklist);
     2825    InitBinnings(&parlist);
     2826    //parlist.AddToList(collarea);
     2827
     2828    //********************************
     2829    // entries in MTaskList
     2830
     2831    tasklist.AddToList(&reader);   
     2832    tasklist.AddToList(&conthadrons);
     2833    tasklist.AddToList(&filler);
     2834
     2835    //********************************
     2836
     2837    //-----------------------------------------
     2838    // Execute event loop
     2839    //
     2840    MEvtLoop magic;
     2841    magic.SetParList(&parlist);
     2842
     2843    MProgressBar bar;
     2844    magic.SetProgressBar(&bar);
     2845    if (!magic.Eventloop())
     2846        return;
     2847
     2848    tasklist.PrintStatistics(0, kTRUE);
     2849
     2850    // Calculate effective collection areas
     2851    // and display the histograms
     2852    //
     2853
     2854    MHMcCT1CollectionArea *collarea =
     2855        (MHMcCT1CollectionArea*)parlist.FindObject("MHMcCT1CollectionArea");
     2856
     2857    collarea->CalcEfficiency();
     2858    collarea->DrawClone("lego");
     2859
     2860    //---------------------------------------------
     2861    // Write histograms to a file
     2862    //
     2863
     2864    TFile f(collareaName, "RECREATE");
     2865    collarea->GetHist()->Write();
     2866    collarea->GetHAll()->Write();
     2867    collarea->GetHSel()->Write();
     2868    f.Close();
     2869
     2870    //delete collarea;
     2871
     2872    gLog << "Calculation of effective collection areas done" << endl;
     2873    gLog << "-----------------------------------------------" << endl;   
     2874    //------------------------------------------------------------------
     2875
     2876
     2877    //*************************************************************************
     2878    //
     2879    // Analyse the data
     2880    //
     2881
     2882    MTaskList tliston;
     2883    MParList pliston;
     2884
     2885    // geometry is needed in  MHHillas... classes
     2886    MGeomCam *fGeom =
     2887             (MGeomCam*)pliston->FindCreateObj("MGeomCamCT1", "MGeomCam");
     2888
     2889    TString fHilName    = "MHillas";
     2890    TString fHilNameExt = "MHillasExt";
     2891    TString fHilNameSrc = "MHillasSrc";
     2892    TString fImgParName = "MNewImagePar";
     2893
     2894    //-------------------------------------------
     2895    // create the tasks which should be executed
     2896    //
     2897
     2898    MReadMarsFile read("Events", filenameData);
     2899    read.DisableAutoScheme();
     2900
     2901    //.......................................................................
     2902
     2903
     2904      MWriteRootFile write(filenameDataout);
     2905
     2906      write.AddContainer("MRawRunHeader", "RunHeaders");
     2907      write.AddContainer("MTime",         "Events");
     2908      write.AddContainer("MMcEvt",        "Events");
     2909      write.AddContainer("ThetaOrig",     "Events");
     2910      write.AddContainer("MSrcPosCam",    "Events");
     2911      write.AddContainer("MSigmabar",     "Events");
     2912      write.AddContainer("MHillas",       "Events");
     2913      write.AddContainer("MHillasExt",    "Events");
     2914      write.AddContainer("MHillasSrc",    "Events");
     2915      write.AddContainer("MNewImagePar",  "Events");
     2916
     2917      //write.AddContainer("HadNN",         "Events");
    30882918      write.AddContainer("HadSC",         "Events");
    30892919      write.AddContainer("HadRF",         "Events");
     
    31042934    contfinalgh.SetName("ContSelFinalgh");
    31052935
    3106     MFillH fillhadnn("hadNN[MHHadronness]", "HadNN");
    3107     fillhadnn.SetName("HhadNN");
     2936    //MFillH fillhadnn("hadNN[MHHadronness]", "HadNN");
     2937    //fillhadnn.SetName("HhadNN");
    31082938    MFillH fillhadsc("hadSC[MHHadronness]", "HadSC");
    31092939    fillhadsc.SetName("HhadSC");
     
    31522982      tliston.AddToList(&write);
    31532983
    3154     tliston.AddToList(&fillhadnn);
     2984    //tliston.AddToList(&fillhadnn);
    31552985    tliston.AddToList(&fillhadsc);
    31562986    tliston.AddToList(&fillhadrf);
     
    31863016    //
    31873017
    3188     pliston.FindObject("hadNN", "MHHadronness")->DrawClone();
     3018    //pliston.FindObject("hadNN", "MHHadronness")->DrawClone();
    31893019    pliston.FindObject("hadRF", "MHHadronness")->DrawClone();
    31903020    pliston.FindObject("hadSC", "MHHadronness")->DrawClone();
Note: See TracChangeset for help on using the changeset viewer.