Changeset 3341


Ignore:
Timestamp:
02/27/04 15:19:57 (21 years ago)
Author:
moralejo
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r3338 r3341  
    55                                                 -*-*- END OF LINE -*-*-
    66 
     7
     8 2004/02/27: Abelardo Moralejo
     9   * macros/starmc.C
     10     - added (optional) division of output into two, for use as train
     11       and test samples in g/h separation studies.
     12
     13
    714 2004/02/26: Hendrik Bartko
    815
    916   * macros/dohtml.C
    1017     - included the path msignals/
    11 
    1218
    1319
  • trunk/MagicSoft/Mars/macros/starmc.C

    r2981 r3341  
    4141  // parameters from Magic Monte Carlo files (output of camera).
    4242
     43  TString* CalibrationFilename;
     44  TString* OutFilename1;
     45  TString* OutFilename2;
    4346
    4447  // ------------- user change -----------------
    45 
    46   TString* CalibrationFilename;
    47 
    48   //
    49   // Comment out next line to disable calibration. In that case the units of the
    50   // MHillas.fSize parameter will be ADC counts (rather, equivalent ADC counts in
    51   // inner pixels, since we correct for the possible differences in gain of outer
    52   // pixels)
    53   //
    54   CalibrationFilename = new TString("nonoise/Gamma_zbin0_0*.root");
     48  //
     49  // Comment line starting "CalibrationFileName" to disable calibration. In that
     50  // case the units of the MHillas.fSize parameter will be ADC counts (rather,
     51  // equivalent ADC counts in inner pixels, since we correct for the possible
     52  // differences in gain of outer pixels)
     53  //
     54  CalibrationFilename = new TString("nonoise/Gamma_zbin0_90_7_507*.root");
    5555  // File to be used in the calibration (must be a camera file without added noise)
    5656
    5757  Char_t* AnalysisFilename = "Gamma_zbin0*.root";  // File to be analyzed
    58   Char_t* OutFilename      = "star_mc.root";       // Output file name
     58
     59  // ------------- user change -----------------
     60  //
     61  // Change output file names as desired. If you want only one output, comment
     62  // the initialization of OutFilename2.
     63
     64  OutFilename1 = new TString("star_train.root");   // Output file name 1 (test)
     65  //  OutFilename2 = new TString("star_test.root");    // Output file name 2 (train)
     66
    5967
    6068  Float_t CleanLev[2] = {4., 3.}; // Tail cuts for image analysis
     
    129137
    130138  //
    131   // Open output file:
    132   //
    133   MWriteRootFile write(OutFilename); // Writes output
    134   write.AddContainer("MRawRunHeader", "RunHeaders");
    135   write.AddContainer("MMcRunHeader",  "RunHeaders");
    136   write.AddContainer("MSrcPosCam",    "RunHeaders");
    137   write.AddContainer("MMcEvt",        "Events");
    138   write.AddContainer("MHillas",       "Events");
    139   write.AddContainer("MHillasExt",    "Events");
    140   write.AddContainer("MHillasSrc",    "Events");
    141   write.AddContainer("MNewImagePar",  "Events");
     139  // Open output files:
     140  //
     141
     142  MWriteRootFile write1(OutFilename1.Data()); // Writes output1
     143  write1.AddContainer("MRawRunHeader", "RunHeaders");
     144  write1.AddContainer("MMcRunHeader",  "RunHeaders");
     145  write1.AddContainer("MSrcPosCam",    "RunHeaders");
     146  write1.AddContainer("MMcEvt",        "Events");
     147  write1.AddContainer("MHillas",       "Events");
     148  write1.AddContainer("MHillasExt",    "Events");
     149  write1.AddContainer("MHillasSrc",    "Events");
     150  write1.AddContainer("MNewImagePar",  "Events");
     151
     152  if (OutFilename2)
     153    {
     154      MWriteRootFile write2(OutFilename2.Data()); // Writes output2
     155      write2.AddContainer("MRawRunHeader", "RunHeaders");
     156      write2.AddContainer("MMcRunHeader",  "RunHeaders");
     157      write2.AddContainer("MSrcPosCam",    "RunHeaders");
     158      write2.AddContainer("MMcEvt",        "Events");
     159      write2.AddContainer("MHillas",       "Events");
     160      write2.AddContainer("MHillasExt",    "Events");
     161      write2.AddContainer("MHillasSrc",    "Events");
     162      write2.AddContainer("MNewImagePar",  "Events");
     163
     164      //
     165      // Divide output in train and test samples, using the event number
     166      // (odd/even) to achieve otherwise unbiased event samples:
     167      //
     168     
     169      MF filter1("{MMcEvt.fEvtNumber%2}>0.5");
     170      MF filter2("{MMcEvt.fEvtNumber%2}<0.5");
     171
     172      write1.SetFilter(&filter1);
     173      write2.SetFilter(&filter2);
     174    }
    142175
    143176  //
     
    179212  tlist.AddToList(&scalc);            // Calculates Source-dependent Hillas parameters
    180213
    181   tlist.AddToList(&write);            // Add task to write output.
     214
     215  // Add tasks to write output:
     216
     217  if (OutFilename2)
     218    {
     219      tlist.AddToList(&filter1);
     220      tlist.AddToList(&filter2);
     221      tlist.AddToList(&write2);
     222    }
     223
     224  tlist.AddToList(&write1);
    182225
    183226  if (!evtloop.Eventloop())
Note: See TracChangeset for help on using the changeset viewer.