Changeset 5432


Ignore:
Timestamp:
11/18/04 15:59:51 (20 years ago)
Author:
wittek
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r5429 r5432  
    2020
    2121                                                 -*-*- END OF LINE -*-*-
     22
     23 2004/11/18: Wolfgang Wittek
     24
     25   * mbadpixels/MHBadPixels.[h,cc]
     26     - include 'fCam' to set the size of MPedPhotCam;
     27       why is the size of MPedPhotCam equal to 0 ???
     28     - use "UseCurrentStyle()" when drawing a histogram
     29     - in SetupFill() the binnings of the histograms may be changed
     30
     31   * mbadpixels/MBadPixelsCalc.[h,cc]
     32     - print name of MPedPhotCam container in PreProcess
     33
     34   * mhist/MHSigmaTheta.[h,cc]
     35     - use iterator for looping over MCerPhotPix
     36     - use "UseCurrentStyle()" when drawing a histogram
     37     - in SetupFill() the binnings of the histograms may be changed
     38     - plot also Theta versus phi
     39
     40   * macros/ONOFFAnalysis.C
     41     - replaced part of the code by calls to
     42                - MMakePadHistograms
     43                - and to new member functions of MPad
     44
     45   * manalysis/MMakePadHistograms.[h,cc]
     46     - new class; it generates histograms which are needed for the
     47       padding
     48
     49   * manalysis/Makefile
     50               AnalysisLinkDef.h
     51     - add MMakePadHistograms
     52
     53   * manalysis/MPad.[h,cc]
     54     - add member function ReadPadHistograms() 
     55
     56   * mfilter/MFSelBasic.[h,cc]
     57             MFSelStandard.[h,cc]
     58             MFSelFinal.[h,cc]
     59     - move printout of cut values from SetCuts() to PreProcess()
     60
     61   * mimage/MImgCleanStd.[h,cc]
     62     - print name of MPedPhotCam container in PreProcess()
     63
    2264
    2365 2004/11/18: Thomas Bretz
  • trunk/MagicSoft/Mars/macros/ONOFFAnalysis.C

    r4868 r5432  
    5555        plist->AddToList(binsb);
    5656
     57        MBinning *binssig = new MBinning("BinningSigma");
     58        binssig->SetEdges( 100,  0.0, 120.0);
     59        plist->AddToList(binssig);
     60
    5761        MBinning *binth = new MBinning("BinningTheta");
    5862        // this is Daniel's binning in theta
     
    6064        //  {9.41, 16.22, 22.68, 28.64, 34.03, 38.84, 43.08, 44.99};
    6165        // this is our binning
    62         Double_t yedge[9] =
    63                        {0.0, 17.5, 23.5, 29.5, 35.5, 42., 50., 60., 70.};
    64         TArrayD yed;
    65         yed.Set(9,yedge);
    66         binth->SetEdges(yed);
     66        //Double_t yedge[9] =
     67        //               {0.0, 17.5, 23.5, 29.5, 35.5, 42., 50., 60., 70.};
     68        //TArrayD yed;
     69        //yed.Set(9,yedge);
     70        //binth->SetEdges(yed);
     71       
     72        binth->SetEdges(     1, 0.0, 90.0);
     73        //binth->SetEdgesCos( 10, 0.0, 90.0);
    6774        plist->AddToList(binth);
    6875
    69         MBinning *bincosth = new MBinning("BinningCosTheta");
    70         Double_t zedge[9];
    71         for (Int_t i=0; i<9; i++)
    72         {
    73           zedge[8-i] = cos(yedge[i]/kRad2Deg);
    74         }
    75         TArrayD zed;
    76         zed.Set(9,zedge);
    77         bincosth->SetEdges(zed);
    78         plist->AddToList(bincosth);
     76        //MBinning *bincosth = new MBinning("BinningCosTheta");
     77        //Double_t yedge[9] =
     78        //               {0.0, 17.5, 23.5, 29.5, 35.5, 42., 50., 60., 70.};
     79        //Double_t zedge[9];
     80        //for (Int_t i=0; i<9; i++)
     81        //{
     82        //zedge[8-i] = cos(yedge[i]/kRad2Deg);
     83        //}
     84        //TArrayD zed;
     85        //zed.Set(9,zedge);
     86        //bincosth->SetEdges(zed);
     87        //plist->AddToList(bincosth);
    7988
    8089        MBinning *binsdiff = new MBinning("BinningDiffsigma2");
    81         binsdiff->SetEdges(100, -300.0, 500.0);
     90        binsdiff->SetEdges(100, -500.0, 1500.0);
    8291        plist->AddToList(binsdiff);
    8392
     
    137146        if (bin) delete bin;
    138147
     148        bin = plist->FindObject("BinningSigma");
     149        if (bin) delete bin;
     150
    139151        bin = plist->FindObject("BinningTheta");
    140152        if (bin) delete bin;
     
    170182
    171183      //-----------------------------------------------
    172       //TString tag = "040126";
    173       //TString tag = "040127";
    174       //TString tag = "040215";
    175       TString tag = "040422";
    176 
    177       //const char *offfile = "~magican/ct1test/wittek/offdata.preproc";
    178       //const char *offfile = "20040126_OffCrab_";
    179       //const char *offfile  = "*.OFF";
    180       //const char *offfile  = "12776.OFF";
    181       // 27 Jan 04
    182       //const char *offfile  = "12*.OFF";
    183       // 26 Jan 04
    184       //const char *offfile  = "*.OFF";
    185       // 15 Feb 04
    186       //const char *offfile  = "*.OFF";
    187       //const char *offfile  = "174*.OFF";
    188       const char *offfile  = "*.OffMrk421*";
    189 
    190       //const char *onfile  = "~magican/ct1test/wittek/mkn421_on.preproc";
    191       //      const char *onfile  = "~magican/ct1test/wittek/mkn421_00-01";
    192       //const char *onfile  = "20040126_Crab_";
    193       //const char *onfile  = "MCerPhot_output";
    194       //const char *onfile  = "*.ON";
    195       //const char *onfile  = "1216*.ON";
    196       // 27 Jan 04
    197       //const char *onfile  = "12*.ON";
    198       // 26 Jan 04
    199       //const char *onfile  = "*.ON";
    200       // 15 Feb 04
    201       //const char *onfile  = "*.ON";
    202       //const char *onfile  = "174*.ON";
    203       const char *onfile  = "*.Mrk421*";
    204 
    205 
    206       //const char *mcfile  = "/data/MAGIC/mc_eth/magLQE_3/gh/0/0/G_M0_00_0_550*.root";
    207       //const char *mcfile  = "/data/MAGIC/mc_eth/magLQE_4/gh/0/0/G_M0_00_0_550*.root";
    208       //const char *mcfile  = "/data/MAGIC/mc_eth/magLQE_5/gh/0/0/G_M0_00_0_550*.root";
    209       //const char *mcfile = "calibrated_gammas";
    210       const char *mcfile = "calibrated_data_david*";
     184      TString tag = "080000";
     185
     186      const char *offfile  = "*";
     187
     188      const char *onfile  = "*";
     189
     190      // Pratik
     191      //const char *mcfile = "MCGamma_calibrate";
     192      // Keiichi
     193      const char *mcfile = "calibrated_MCdata2";
    211194
    212195      //-----------------------------------------------
    213196
    214197      // path for input for Mars
    215       //TString inPath = "/.magic/magicserv01/scratch/";
    216       //TString inPath = "/mnt/data17a/hbartko/";
    217       //TString inPath = "~wittek/datacrab_feb04/";
    218       //TString inPath = "~wittek/datacrab_26feb04/";
    219      //TString inPath = "/.magic/magicserv01/scratch/David/CalibratedRuns/";
    220      // 26 Jan 04, Hendrik
    221      if (tag == "040126")
    222        TString inPath = "/.magic/magicserv01/scratch/calibrated26/";
    223 
    224      // 27 Jan 04, Hendrik
    225      if (tag == "040127")
    226         TString inPath = "/.magic/magicserv01/scratch/calibrated/";
    227 
    228      // 27 Jan 04, David
    229      //if (tag == "040127")
    230      //TString inPath = "/mnt/magicserv01/scratch/David/CalibratedData/Crab/2004_01_27/";
    231 
    232      // 15 Feb 04, David
    233      //if (tag == "040215")
    234      //  TString inPath = "/mnt/magicserv01/scratch/David/CalibratedData/Crab/2004_02_15/";
    235      if (tag == "040215") 
     198
     199     if (tag == "080000") 
    236200     {
    237        TString inPathON = "/.magic/magicserv01/scratch/Daniel/CalibratedData/MispointingTest/2004_02_15ForgottenData/finesam20/";
    238        TString inPathOFF = "/.magic/magicserv01/scratch/David/CalibratedData/Mkn421/2004_02_15/";
    239        TString inPathMC = "/.magic/magicserv01/scratch/David/MCData/MCApril2004/Data/gammas_highnoise/";
     201       TString inPathON  = "/home/pcmagic14/wittek/CalibData/CrabSept2004/2004_09_21/";
     202       TString inPathOFF = "/home/pcmagic14/wittek/CalibData/OffSept2004/2004_09_18/";
     203       // Pratik
     204       //TString inPathMC  = "/home/pcmagic21/pratik/mcdata/gamma/MCcalibrate/";
     205       // Keiichi
     206       TString inPathMC  = "/.magic/data21a/mase/Mars/Mars041103/DataCalibUV/";
     207
    240208     }
    241209
    242      if (tag == "040422") 
    243      {
    244        TString inPathON  = "/.magic/data03a/mazin/calibrdata/2004_04_22/";
    245        TString inPathOFF = "/.magic/data03a/mazin/calibrdata/2004_04_22/";
    246        TString inPathMC  = "/.magic/magicserv01/scratch/David/MCData/MCApril2004/Data/gammas_highnoise/";
    247      }
    248 
    249210      // path for output from Mars
    250       //TString outPath = "~wittek/datacrab_feb04/";
    251      //TString outPath = "~wittek/datacrab_01march04/";
    252      // TString outPath = "~wittek/datacrab_27april04/";
    253      TString outPath = "/mnt/data03a/wittek/";
     211     TString outPath = "/.magic/data21a/wittek/";
    254212     outPath += tag;
    255213     outPath += "/";
     
    270228
    271229    Bool_t JobA    = kTRUE; 
    272     Bool_t GPadON  = kTRUE;    // \  generate padding histograms
     230    Bool_t GPadON  = kFALSE;    // \  generate Pad histograms
    273231    Bool_t GPadOFF = kFALSE;    //  | and write them onto disk
    274232    Bool_t GPadMC  = kFALSE;    // /
    275     Bool_t Merge   = kFALSE;   // merge padding histograms
     233    Bool_t Merge   = kFALSE;   // read the Pad histograms, merge them
    276234                               // and write them onto disk
    277     Bool_t Wout    = kFALSE;   // read in merged padding histograms and
    278                               // write out root file of padded data
    279                               // (ON1.root, OFF1.root or MC1.root)
     235    Bool_t Wout    = kTRUE;   // \  read in merged padding histograms and
     236                               //  | write out root file of padded data
     237                               // /  (ON1.root, OFF1.root or MC1.root)
     238    //TString typeInput("ON");
     239    TString typeInput("OFF");
     240    //TString typeInput("MC");
    280241
    281242
     
    379340         << (Wout    ? "kTRUE" : "kFALSE")  << endl;
    380341   
     342    //--------------------------------------------------
     343
     344    TString fNamePedPhotCam("MPedPhotCamFromData");
     345    // for Keiichi's file
     346    //TString fNamePedPhotCam("MPedPhotCam");
     347
     348
     349    //************************************************************
     350    // generate histograms to be used in the padding
     351    //
     352    // read ON, OFF and MC data files
     353    // generate (or read in) the padding histograms for ON, OFF and MC data
     354    //
     355
     356    MPad pad;
     357    pad.SetName("MPad");
    381358
    382359    //--------------------------------------------------
    383360    // names of ON and OFF files to be read
    384361    // for generating the histograms to be used in the padding
    385 
    386 
    387362    TString fileON  = inPathON;
    388363    fileON += onfile;
     
    396371    fileMC += mcfile;
    397372    fileMC += ".root";
    398 
    399     gLog << "fileON, fileOFF, fileMC = " << fileON << ",  "
    400          << fileOFF << ",  " << fileMC   << endl;
    401 
    402     // name of file to conatin the merged histograms for the padding
    403     TString outNameSigTh = outPath;
    404     outNameSigTh += "SigmaTheta";
    405     outNameSigTh += ".root";
    406373
    407374    //--------------------------------------------------
     
    419386      NamePadMC += ".root";
    420387
     388    // name of file to conatin the merged histograms for the padding
     389    TString outNameSigTh = outPath;
     390    outNameSigTh += "SigmaTheta";
     391    outNameSigTh += ".root";
     392
     393    //--------------------------------------------------
     394
     395    if (GPadON || GPadOFF || GPadMC)
     396    {
     397      // generate the padding histograms
     398      gLog << "=====================================================" << endl;
     399      gLog << "Start generating the padding histograms" << endl;
     400
     401
     402    gLog << "fileON, fileOFF, fileMC = " << fileON << ",  "
     403         << fileOFF << ",  " << fileMC   << endl;
     404
     405
     406
     407    //--------------------------------------------------
     408      MMakePadHistograms makepad;
     409      makepad.SetMaxEvents(10000);
     410      makepad.SetNamePedPhotCam(fNamePedPhotCam);
     411      makepad.SetPedestalLevel(2.0);
     412      makepad.SetUseInterpolation(kTRUE);
     413      makepad.SetProcessPedestal(kTRUE);
     414      makepad.SetProcessTime(kFALSE);
     415
     416      //-----------------------------------------
     417      // ON events
     418
     419      if (GPadON)
     420      {
     421        makepad.SetDataType("ON");
     422        makepad.SetNameInputFile(fileON);
     423        makepad.SetNameOutputFile(NamePadON);
     424        makepad.MakeHistograms();
     425      }
     426
     427      //-----------------------------------------
     428      // OFF events
     429
     430      if (GPadOFF)
     431      {
     432        makepad.SetDataType("OFF");
     433        makepad.SetNameInputFile(fileOFF);
     434        makepad.SetNameOutputFile(NamePadOFF);
     435        makepad.MakeHistograms();
     436      }
     437
     438      //-----------------------------------------
     439      // MC events
     440
     441      if (GPadMC)
     442      {
     443        makepad.SetDataType("MC");
     444        makepad.SetNameInputFile(fileMC);
     445        makepad.SetNameOutputFile(NamePadMC);
     446        makepad.MakeHistograms();
     447      }
     448
     449      //-----------------------------------------
     450
     451
     452      gLog << "" << endl;
     453      gLog << "End of generating the padding histograms" << endl;
     454      gLog << "=====================================================" << endl;
     455    }
     456
     457    //************************************************************
     458
     459    if (Merge)
     460    {
     461      gLog << "=====================================================" << endl;
     462      gLog << "Start of merging the padding histograms" << endl;
     463      gLog << "" << endl;
     464
     465      pad.MergeONOFFMC(NamePadON, NamePadOFF, NamePadMC, outNameSigTh);
     466      //pad.MergeONOFFMC(NamePadON, "", NamePadMC, outNameSigTh);
     467      //pad.MergeONOFFMC(NamePadON, NamePadOFF, "", outNameSigTh);
     468      //pad.MergeONOFFMC("", NamePadOFF, NamePadMC, outNameSigTh);
     469
     470      gLog << "" << endl;
     471      gLog << "End of merging the padding histograms" << endl;
     472      gLog << "=====================================================" << endl;
     473    }
     474    // end of Merge
     475
     476
     477
     478    //************************************************************
     479
     480  if (Wout)
     481  {
     482    // read the target padding histograms ---------------------------
     483    pad.ReadPaddingDist(outNameSigTh);
     484
     485
     486    gLog << "=====================================================" << endl;
     487    gLog << "Start the padding" << endl;
     488
    421489    //--------------------------------------------------
    422490    // type of data to be padded
    423       //TString typeInput = "ON";
    424       //TString typeInput = "OFF";
    425       TString typeInput = "MC";
    426491    gLog << "typeInput = " << typeInput << endl;
    427492
    428 
     493    //-------------------------------------------
    429494    // name of input root file
    430495    if (typeInput == "ON")
     
    437502
    438503    // name of output root file
    439     //if (typeInput == "ON")
    440     //  TString file(onfile);
    441     //else if (typeInput == "OFF")
    442     //  TString file(offfile);
    443     //else if (typeInput == "MC")
    444     //  TString file(mcfile);
    445 
    446504    TString outNameImage = outPath;
    447     outNameImage += tag;
    448505    outNameImage += "Hillas";
    449506    outNameImage += typeInput;
     
    451508    gLog << "padded data to be written onto : " << outNameImage << endl;
    452509
    453     //--------------------------------------------------
    454 
    455     //************************************************************
    456     // generate histograms to be used in the padding
    457     //
    458     // read ON, OFF and MC data files
    459     // generate (or read in) the padding histograms for ON, OFF and MC data
    460     //
    461 
    462     MPad pad;
    463     pad.SetName("MPad");
     510    //-----------------------------------------------------------
    464511    pad.SetDataType(typeInput);
    465 
    466     if (GPadON || GPadOFF || GPadMC)
    467     {
    468     // generate the padding histograms
    469       gLog << "=====================================================" << endl;
    470       gLog << "Start generating the padding histograms" << endl;
    471     }
    472 
    473       //-----------------------------------------
    474       // ON events
    475 
    476       if (GPadON)
    477       {
    478 
    479       gLog << "-----------" << endl;
    480       gLog << "ON events :" << endl;
    481       gLog << "-----------" << endl;
    482 
    483       MTaskList tliston;
    484       MParList pliston;
    485 
    486     MObservatory observon;
    487 
    488     MReadMarsFile  readON("Events", fileON);
    489     readON.DisableAutoScheme();
    490 
    491     MGeomApply        apply;
    492 
    493     TString pedphotcamname("MPedPhotCamFromData");
    494 
    495     MBadPixelsCalc badcalcon;
    496     badcalcon.SetNamePedPhotContainer(pedphotcamname);
    497     badcalcon.SetPedestalLevel(2.0);
    498 
    499     MBadPixelsTreat badtreaton;
    500     badtreaton.SetNamePedPhotCam(pedphotcamname);
    501     badtreaton.SetUseInterpolation();
    502     badtreaton.SetProcessPedestalEvt();
    503     badtreaton.SetProcessTimes();
    504 
    505       MFSelBasic selbasicon;
    506       MContinue contbasicon(&selbasicon);
    507 
    508       MHBadPixels badON("BadPixelsON");
    509       MFillH fillbadON("BadPixelsON[MHBadPixels]", "MBadPixelsCam");
    510       fillbadON.SetName("FillBad");
    511 
    512       MSigmabarCalc sigbarcalcon;
    513 
    514       MHSigmaTheta sigthON("SigmaThetaON");
    515       sigthON.SetNamePedPhotCam(pedphotcamname);
    516       MFillH fillsigthetaON ("SigmaThetaON[MHSigmaTheta]", "");
    517       fillsigthetaON.SetName("FillSigTheta");   
    518  
    519       //*****************************
    520       // entries in MParList
    521    
    522       pliston.AddToList(&tliston);
    523       InitBinnings(&pliston);
    524       pliston.AddToList(&observon);
    525       pliston.AddToList(&badON);
    526       pliston.AddToList(&sigthON);
    527 
    528 
    529       //*****************************
    530       // entries in MTaskList
    531    
    532       tliston.AddToList(&readON);
    533       tliston.AddToList(&apply);
    534 
    535       tliston.AddToList(&badcalcon);
    536       tliston.AddToList(&badtreaton);
    537 
    538       tliston.AddToList(&contbasicon);
    539       tliston.AddToList(&fillbadON);
    540       tliston.AddToList(&sigbarcalcon);
    541       tliston.AddToList(&fillsigthetaON);
    542 
    543       MProgressBar baron;
    544       MEvtLoop evtloopon;
    545       evtloopon.SetParList(&pliston);
    546       evtloopon.SetProgressBar(&baron);
    547 
    548       //Int_t maxeventson = -1;
    549       Int_t maxeventson = 10000;
    550       if ( !evtloopon.Eventloop(maxeventson) )
    551           return;
    552 
    553       tliston.PrintStatistics(0, kTRUE);
    554 
    555       badON.DrawClone();
    556       sigthON.DrawClone();
    557 
    558       // save the histograms for the padding
    559       TH2D *sigthon     = sigthON.GetSigmaTheta();
    560       TH3D *sigpixthon  = sigthON.GetSigmaPixTheta();
    561       TH3D *diffpixthon = sigthON.GetDiffPixTheta();
    562 
    563       TH2D *badidthon = badON.GetBadId();
    564       TH2D *badnthon  = baddON.GetBadN();
    565 
    566       gLog << "" << endl;
    567       gLog << "Macro ONOFFAnalysis : write padding plots for ON data from file "
    568            << NamePadON << endl;
    569 
    570       TFile filewriteon(NamePadON, "RECREATE", "");
    571       sigthon->Write();
    572       sigpixthon->Write();
    573       diffpixthon->Write();
    574       badidthon->Write();
    575       badnthon->Write();
    576       filewriteon.Close();
    577 
    578       gLog << "" << endl;
    579       gLog << "Macro ONOFFAnalysis : padding plots for ON data written onto file "
    580            << NamePadON << endl;
    581       }
    582       // end of GPadON
    583 
    584 
    585       //-----------------------------------------
    586       // OFF events
    587 
    588       if (GPadOFF)
    589       {
    590 
    591       gLog << "------------" << endl;
    592       gLog << "OFF events :" << endl;
    593       gLog << "------------" << endl;
    594 
    595       MTaskList tlistoff;
    596       MParList plistoff;
    597 
    598     MObservatory observoff;
    599 
    600     MReadMarsFile  readOFF("Events", fileOFF);
    601     readOFF.DisableAutoScheme();
    602 
    603     MSourcePosfromStarPos sourcefromstaroff;
    604     sourcefromstaroff.AddFile("~wittek/datacrab_26feb04/positions040215.txt", 0);
    605 
    606       MBlindPixelsCalc2 blindoff;
    607       //blindoff.SetUseBlindPixels();
    608       blindoff.SetCheckPedestalRms();
    609 
    610       MFSelBasic selbasicoff;
    611       MContinue contbasicoff(&selbasicoff);
    612 
    613       MHBlindPixels blindOFF("BlindPixelsOFF");
    614       MFillH fillblindOFF("BlindPixelsOFF[MHBlindPixels]", "MBlindPixels");
    615       fillblindOFF.SetName("FillBlindOFF");
    616 
    617       MSigmabarCalc sigbarcalcoff;
    618 
    619       MHSigmaTheta sigthOFF("SigmaThetaOFF");
    620       MFillH fillsigthetaOFF ("SigmaThetaOFF[MHSigmaTheta]", "MPointingPos");
    621       fillsigthetaOFF.SetName("FillSigThetaOFF");     
    622 
    623       //*****************************
    624       // entries in MParList
    625    
    626       plistoff.AddToList(&tlistoff);
    627       InitBinnings(&plistoff);
    628       plistoff.AddToList(&observoff);
    629       plistoff.AddToList(&blindOFF);
    630       plistoff.AddToList(&sigthOFF);
    631 
    632 
    633       //*****************************
    634       // entries in MTaskList
    635    
    636       tlistoff.AddToList(&readOFF);
    637       tlistoff.AddToList(&sourcefromstaroff);
    638 
    639       tlistoff.AddToList(&blindoff);
    640 
    641       tlistoff.AddToList(&contbasicoff);
    642       tlistoff.AddToList(&fillblindOFF);
    643       tlistoff.AddToList(&sigbarcalcoff);
    644       tlistoff.AddToList(&fillsigthetaOFF);
    645 
    646       MProgressBar baroff;
    647       MEvtLoop evtloopoff;
    648       evtloopoff.SetParList(&plistoff);
    649       evtloopoff.SetProgressBar(&baroff);
    650 
    651       //Int_t maxeventsoff = -1;
    652       Int_t maxeventsoff = 10000;
    653       if ( !evtloopoff.Eventloop(maxeventsoff) )
    654           return;
    655 
    656       tlistoff.PrintStatistics(0, kTRUE);
    657 
    658       blindOFF.DrawClone();
    659       sigthOFF.DrawClone();
    660 
    661       // save the histograms for the padding
    662       TH2D *sigthoff     = sigthOFF.GetSigmaTheta();
    663       TH3D *sigpixthoff  = sigthOFF.GetSigmaPixTheta();
    664       TH3D *diffpixthoff = sigthOFF.GetDiffPixTheta();
    665 
    666       TH2D *blindidthoff = blindOFF.GetBlindId();
    667       TH2D *blindnthoff  = blindOFF.GetBlindN();
    668 
    669       gLog << "" << endl;
    670       gLog << "Macro ONOFFAnalysis : write padding plots for OFF data from file "
    671            << NamePadOFF << endl;
    672 
    673       TFile filewriteoff(NamePadOFF, "RECREATE", "");
    674       sigthoff->Write();
    675       sigpixthoff->Write();
    676       diffpixthoff->Write();
    677       blindidthoff->Write();
    678       blindnthoff->Write();
    679       filewriteoff.Close();
    680 
    681       gLog << "" << endl;
    682       gLog << "Macro ONOFFAnalysis : padding plots for OFF data written onto file "
    683            << NamePadOFF << endl;
    684       }
    685       // end of GPadOFF
    686 
    687 
    688 
    689       //-----------------------------------------
    690       // MC events
    691 
    692       if (GPadMC)
    693       {
    694 
    695       gLog << "------------" << endl;
    696       gLog << "MC events :" << endl;
    697       gLog << "------------" << endl;
    698 
    699       MTaskList tlistmc;
    700       MParList plistmc;
    701 
    702     MObservatory observmc;
    703 
    704     MReadMarsFile  readMC("Events", fileMC);
    705     readMC.DisableAutoScheme();
    706 
    707     MSourcePosfromStarPos sourcefromstarmc;
    708 
    709       MBlindPixelsCalc2 blindmc;
    710       //blindmc.SetUseBlindPixels();
    711       blindmc.SetCheckPedestalRms();
    712 
    713       MFSelBasic selbasicmc;
    714       MContinue contbasicmc(&selbasicmc);
    715 
    716       MHBlindPixels blindMC("BlindPixelsMC");
    717       MFillH fillblindMC("BlindPixelsMC[MHBlindPixels]", "MBlindPixels");
    718       fillblindMC.SetName("FillBlindMC");
    719 
    720       MSigmabarCalc sigbarcalcmc;
    721 
    722       MHSigmaTheta sigthMC("SigmaThetaMC");
    723       MFillH fillsigthetaMC ("SigmaThetaMC[MHSigmaTheta]", "MPointingPos");
    724       fillsigthetaMC.SetName("FillSigThetaMC");     
    725 
    726       //*****************************
    727       // entries in MParList
    728    
    729       plistmc.AddToList(&tlistmc);
    730       InitBinnings(&plistmc);
    731       plistmc.AddToList(&observmc);
    732       plistmc.AddToList(&blindMC);
    733       plistmc.AddToList(&sigthMC);
    734 
    735 
    736       //*****************************
    737       // entries in MTaskList
    738    
    739       tlistmc.AddToList(&readMC);
    740       tlistmc.AddToList(&sourcefromstarmc);
    741 
    742       tlistmc.AddToList(&blindmc);
    743 
    744       tlistmc.AddToList(&contbasicmc);
    745       tlistmc.AddToList(&fillblindMC);
    746       tlistmc.AddToList(&sigbarcalcmc);
    747       tlistmc.AddToList(&fillsigthetaMC);
    748 
    749       MProgressBar barmc;
    750       MEvtLoop evtloopmc;
    751       evtloopmc.SetParList(&plistmc);
    752       evtloopmc.SetProgressBar(&barmc);
    753 
    754       //Int_t maxeventsmc = -1;
    755       Int_t maxeventsmc = 10000;
    756       if ( !evtloopmc.Eventloop(maxeventsmc) )
    757           return;
    758 
    759       tlistmc.PrintStatistics(0, kTRUE);
    760 
    761       blindMC.DrawClone();
    762       sigthMC.DrawClone();
    763 
    764       // save the histograms for the padding
    765       TH2D *sigthmc     = sigthMC.GetSigmaTheta();
    766       TH3D *sigpixthmc  = sigthMC.GetSigmaPixTheta();
    767       TH3D *diffpixthmc = sigthMC.GetDiffPixTheta();
    768 
    769       TH2D *blindidthmc = blindMC.GetBlindId();
    770       TH2D *blindnthmc  = blindMC.GetBlindN();
    771 
    772       gLog << "" << endl;
    773       gLog << "Macro ONOFFAnalysis : write padding plots for MC data from file "
    774            << NamePadMC << endl;
    775 
    776       TFile filewritemc(NamePadMC, "RECREATE", "");
    777       sigthmc->Write();
    778       sigpixthmc->Write();
    779       diffpixthmc->Write();
    780       blindidthmc->Write();
    781       blindnthmc->Write();
    782       filewritemc.Close();
    783 
    784       gLog << "" << endl;
    785       gLog << "Macro ONOFFAnalysis : padding plots for MC data written onto file "
    786            << NamePadMC << endl;
    787       }
    788       // end of GPadMC
    789 
    790       //-----------------------------------------
    791 
    792     if (GPadON || GPadOFF || GPadMC)
    793     {
    794       gLog << "" << endl;
    795       gLog << "End of generating the padding histograms" << endl;
    796       gLog << "=====================================================" << endl;
    797     }
    798 
    799     if (Merge)
    800     {
    801 
    802       //-----------------------------------
    803       TH2D sigon;
    804       TH3D sigpixon;
    805       TH3D diffpixon;
    806       TH2D blindidon;
    807       TH2D blindnon;
    808 
    809       TFile filereadon(NamePadON);
    810       filereadon.ls();
    811       sigon.Read("2D-ThetaSigmabar(Inner)");
    812       sigpixon.Read("3D-ThetaPixSigma");
    813       diffpixon.Read("3D-ThetaPixDiff");
    814       blindidon.Read("2D-IdBlindPixels");
    815       blindnon.Read("2D-NBlindPixels");
    816 
    817       TH2D *sigthon     = new TH2D( (const TH2D&)sigon     );
    818       TH3D *sigpixthon  = new TH3D( (const TH3D&)sigpixon  );
    819       TH3D *diffpixthon = new TH3D( (const TH3D&)diffpixon );
    820       TH2D *blindidthon = new TH2D( (const TH2D&)blindidon );
    821       TH2D *blindnthon  = new TH2D( (const TH2D&)blindnon  );
    822 
    823       /*
    824       TH2D *sigthon     = (TH2D*)sigon.Clone();
    825       TH3D *sigpixthon  = (TH3D*)sigpixon.Clone();
    826       TH3D *diffpixthon = (TH3D*)diffpixon.Clone();
    827       TH2D *blindidthon = (TH2D*)blindidon.Clone();
    828       TH2D *blindnthon  = (TH2D*)blindnon.Clone();
    829       */
    830 
    831       //filereadon.Close();
    832       gLog << "" << endl;
    833       gLog << "Macro ONOFFAnalysis : padding plots for ON data read from file "
    834            << NamePadON << endl;
    835 
    836 
    837       //-----------------------------------
    838       TH2D sigoff;
    839       TH3D sigpixoff;
    840       TH3D diffpixoff;
    841       TH2D blindidoff;
    842       TH2D blindnoff;
    843 
    844       TFile filereadoff(NamePadOFF);
    845       filereadoff.ls();
    846       sigoff.Read("2D-ThetaSigmabar(Inner)");
    847       sigpixoff.Read("3D-ThetaPixSigma");
    848       diffpixoff.Read("3D-ThetaPixDiff");
    849       blindidoff.Read("2D-IdBlindPixels");
    850       blindnoff.Read("2D-NBlindPixels");
    851  
    852       TH2D *sigthoff     = new TH2D( (const TH2D&)sigoff     );
    853       TH3D *sigpixthoff  = new TH3D( (const TH3D&)sigpixoff  );
    854       TH3D *diffpixthoff = new TH3D( (const TH3D&)diffpixoff );
    855       TH2D *blindidthoff = new TH2D( (const TH2D&)blindidoff );
    856       TH2D *blindnthoff  = new TH2D( (const TH2D&)blindnoff  );
    857 
    858       /*
    859       TH2D *sigthoff     = (TH2D*)sigoff.Clone();
    860       TH3D *sigpixthoff  = (TH3D*)sigpixoff.Clone();
    861       TH3D *diffpixthoff = (TH3D*)diffpixoff.Clone();
    862       TH2D *blindidthoff = (TH2D*)blindidoff.Clone();
    863       TH2D *blindnthoff  = (TH2D*)blindnoff.Clone();
    864       */
    865 
    866       //filereadoff.Close();
    867       gLog << "" << endl;
    868       gLog << "Macro ONOFFAnalysis : padding plots for OFF data read from file "
    869            << NamePadOFF << endl;
    870 
    871 
    872       //-----------------------------------
    873       TH2D sigmc;
    874       TH3D sigpixmc;
    875       TH3D diffpixmc;
    876       TH2D blindidmc;
    877       TH2D blindnmc;
    878 
    879       TFile filereadmc(NamePadMC);
    880       filereadmc.ls();
    881       sigmc.Read("2D-ThetaSigmabar(Inner)");
    882       sigpixmc.Read("3D-ThetaPixSigma");
    883       diffpixmc.Read("3D-ThetaPixDiff");
    884       blindidmc.Read("2D-IdBlindPixels");
    885       blindnmc.Read("2D-NBlindPixels");
    886  
    887       TH2D *sigthmc     = new TH2D( (const TH2D&)sigmc     );
    888       TH3D *sigpixthmc  = new TH3D( (const TH3D&)sigpixmc  );
    889       TH3D *diffpixthmc = new TH3D( (const TH3D&)diffpixmc );
    890       TH2D *blindidthmc = new TH2D( (const TH2D&)blindidmc );
    891       TH2D *blindnthmc  = new TH2D( (const TH2D&)blindnmc  );
    892 
    893       /*
    894       TH2D *sigthmc     = (TH2D*)sigmc.Clone();
    895       TH3D *sigpixthmc  = (TH3D*)sigpixmc.Clone();
    896       TH3D *diffpixthmc = (TH3D*)diffpixmc.Clone();
    897       TH2D *blindidthmc = (TH2D*)blindidmc.Clone();
    898       TH2D *blindnthmc  = (TH2D*)blindnmc.Clone();
    899       */
    900 
    901       //filereadmc.Close();
    902       gLog << "" << endl;
    903       gLog << "Macro ONOFFAnalysis : padding plots for MC data read from file "
    904            << NamePadMC << endl;
    905 
    906       pad.MergeONOFFMC(*sigthmc,     *diffpixthmc, *sigpixthmc,
    907                        *blindidthmc, *blindnthmc,
    908                        *sigthon,     *diffpixthon, *sigpixthon,
    909                        *blindidthon, *blindnthon,
    910                        *sigthoff,    *diffpixthoff,*sigpixthoff,
    911                        *blindidthoff,*blindnthoff);
    912 
    913       // write the target padding histograms onto a file  ---------
    914       pad.WritePaddingDist(outNameSigTh);     
    915     }
    916     // end of Merge
    917 
    918 
    919 
    920     //************************************************************
    921 
    922   if (Wout)
    923   {
    924     // read the target padding histograms ---------------------------
    925     pad.ReadPaddingDist(outNameSigTh);
    926 
    927 
    928     gLog << "=====================================================" << endl;
    929     gLog << "Start the padding" << endl;
    930 
    931     //-----------------------------------------------------------
     512    pad.SetNamePedPhotCam(fNamePedPhotCam);
     513
    932514    MTaskList tliston;
    933515    MParList pliston;
    934 
    935     MObservatory observ;
    936 
    937     char *sourceName = "MSrcPosCam";
    938     MSrcPosCam source(sourceName);
    939516
    940517    // geometry is needed in  MHHillas... classes
     
    957534    //f2.SetName("Select Data");
    958535
    959     MSourcePosfromStarPos sourcefromstar;
    960     if (typeInput == "ON")
    961     {
    962       //sourcefromstar.SetSourceAndStarPosition(
    963       //                         "Crab", 22,  0, 52, 5, 34, 32.0,
    964       //                           "Zeta-Tau", 21,  8, 33, 5, 37, 38.7);
    965       //sourcefromstar.AddStar("Tau114", 21, 56, 13, 5, 27, 38.1);
    966       ////sourcefromstar.AddFile("~wittek/datacrab_26feb04/positionsOn.4.txt",0);
    967 
    968       //if(inPath == "/.magic/magicserv01/scratch/calibrated/")
    969       //{
    970         //sourcefromstar.AddFile("~wittek/datacrab_26feb04/positions2stars.txt", 0);
    971         ////sourcefromstar.AddFile("~wittek/datacrab_26feb04/positionsNoStar.txt", 0);
    972       //}
    973       //else if(inPath == "/.magic/magicserv01/scratch/calibrated26/")
    974       //  sourcefromstar.AddFile("~wittek/datacrab_26feb04/stars_2004_01_26", 0);
    975 
    976       //else if(inPath == "/mnt/magicserv01/scratch/David/CalibratedData/Crab/2004_02_15/")
    977       sourcefromstar.AddFile("~wittek/datacrab_26feb04/positions040215.txt", 0);
    978     }
    979     else if (typeInput == "OFF")
    980     {
    981       //if(inPath == "/.magic/magicserv01/scratch/calibrated/")
    982       //  sourcefromstar.AddFile("~wittek/datacrab_26feb04/positionsOff.txt", 0);
    983       //else if(inPath == "/.magic/magicserv01/scratch/calibrated26/")
    984       //  sourcefromstar.AddFile("~wittek/datacrab_26feb04/positions_2004_01_26", 0);
    985       //else if(inPath == "/mnt/magicserv01/scratch/David/CalibratedData/Crab/2004_02_15")
    986       sourcefromstar.AddFile("~wittek/datacrab_26feb04/positions040215.txt", 0);
    987     }
    988     else if (typeInput == "MC")
    989     {
    990     }
    991 
    992     MBlindPixelsCalc2 blindbeforepad;
    993     //blindbeforepad.SetUseBlindPixels();
    994     blindbeforepad.SetCheckPedestalRms();
    995     blindbeforepad.SetName("BlindBeforePadding");
    996 
    997     //MBadPixelCalcRms blind;
    998     MBlindPixelsCalc2 blind;
    999     //blind.SetUseBlindPixels();
    1000     blind.SetUseInterpolation();
    1001     blind.SetCheckPedestalRms();
    1002     blind.SetName("BlindAfterPadding");
    1003 
    1004     MFSelBasic selbasic;
    1005     MContinue contbasic(&selbasic);
    1006     contbasic.SetName("SelBasic");
    1007 
    1008     MFillH fillblind("BlindPixels[MHBlindPixels]", "MBlindPixels");
    1009     fillblind.SetName("HBlind");
    1010 
    1011     MSigmabarCalc sigbarcalc;
    1012 
    1013     MFillH fillsigtheta ("SigmaTheta[MHSigmaTheta]", "MPointingPos");
    1014     fillsigtheta.SetName("HSigmaTheta");
     536
     537
     538      MBadPixelsCalc badcalc;
     539      badcalc.SetNamePedPhotContainer(fNamePedPhotCam);
     540      badcalc.SetPedestalLevel(2.0);
     541      badcalc.SetName("BadCalc");
     542
     543      MBadPixelsTreat badtreat;
     544      badtreat.SetNamePedPhotCam(fNamePedPhotCam);
     545      badtreat.SetUseInterpolation(kTRUE);
     546      badtreat.SetProcessPedestal(kTRUE);
     547      badtreat.SetProcessTimes(kFALSE);
     548      badtreat.SetName("BadTreat");
     549
     550      MFSelBasic selbasic;
     551      MContinue contbasic(&selbasic);
     552      contbasic.SetName("SelBasic");
     553
     554      MHBadPixels bad("BadPixels");
     555      bad.SetNamePedPhotCam(fNamePedPhotCam);
     556      MFillH fillbad("BadPixels[MHBadPixels]", "MBadPixelsCam");
     557      fillbad.SetName("FillBad");
     558
     559      MHSigmaTheta sigth("SigmaTheta");
     560      sigth.SetNamePedPhotCam(fNamePedPhotCam);
     561      MFillH fillsigtheta ("SigmaTheta[MHSigmaTheta]", "");
     562      fillsigtheta.SetName("FillSigTheta");   
     563
    1015564
    1016565    MImgCleanStd    clean(3.0, 2.5);
    1017566    //clean.SetMethod(MImgCleanStd::kDemocratic);
    1018567    clean.SetCleanRings(3);
    1019 
     568    clean.SetName("Clean");
     569    clean.SetNamePedPhotCam(fNamePedPhotCam);
    1020570
    1021571    // calculation of  image parameters ---------------------
     
    1028578    hcalc.SetNameHillas(fHilName);
    1029579    hcalc.SetNameHillasExt(fHilNameExt);
    1030     hcalc.SetNameNewImgPar(fImgParName);
    1031 
    1032     MHillasSrcCalc hsrccalc(sourceName, fHilNameSrc);
     580    hcalc.SetNameNewImagePar(fImgParName);
     581
     582    MHillasSrcCalc hsrccalc("MSrcPosCam", fHilNameSrc);
    1033583    hsrccalc.SetInput(fHilName);
    1034584
     
    1056606    contstandard.SetName("SelStandard");
    1057607
    1058    
     608    /* 
    1059609      MWriteRootFile write(outNameImage);
    1060610
     
    1064614      write.AddContainer("MPointingPos", "Events");
    1065615      write.AddContainer("MSrcPosCam",    "Events");
    1066       write.AddContainer("MSigmabar",     "Events");
    1067616      write.AddContainer("MHillas",       "Events");
    1068617      write.AddContainer("MHillasExt",    "Events");
    1069618      write.AddContainer("MHillasSrc",    "Events");
    1070619      write.AddContainer("MNewImagePar",  "Events");
    1071    
     620    */     
    1072621
    1073622    //*****************************
     
    1075624   
    1076625    pliston.AddToList(&tliston);
    1077     pliston.AddToList(&observ);
    1078626    InitBinnings(&pliston);
    1079 
    1080     pliston.AddToList(&source);
     627    pliston.AddToList(&bad);
     628    pliston.AddToList(&sigth);
    1081629
    1082630    //*****************************
     
    1087635    //tliston.AddToList(&f2);
    1088636    tliston.AddToList(&apply);
    1089     tliston.AddToList(&sourcefromstar);
    1090 
    1091     tliston.AddToList(&blindbeforepad);
     637
     638    tliston.AddToList(&badcalc);
     639    tliston.AddToList(&badtreat);
    1092640
    1093641    tliston.AddToList(&contbasic);
    1094642    tliston.AddToList(&pad);
    1095643
    1096     tliston.AddToList(&blind);
    1097     tliston.AddToList(&fillblind);
    1098     tliston.AddToList(&sigbarcalc);
     644   
     645    tliston.AddToList(&fillbad);
    1099646    tliston.AddToList(&fillsigtheta);
    1100647    tliston.AddToList(&clean);
     
    1110657
    1111658    tliston.AddToList(&contstandard);
    1112     tliston.AddToList(&write);
     659    //tliston.AddToList(&write);
     660   
    1113661
    1114662    //*****************************
     
    1136684
    1137685    pliston.FindObject("SigmaTheta", "MHSigmaTheta")->DrawClone();
    1138     pliston.FindObject("BlindPixels", "MHBlindPixels")->DrawClone();
     686    pliston.FindObject("BadPixels",  "MHBadPixels")->DrawClone();
    1139687
    1140688    pliston.FindObject("MHHillas")->DrawClone();
Note: See TracChangeset for help on using the changeset viewer.