Ignore:
Timestamp:
02/02/05 12:00:43 (20 years ago)
Author:
blanch
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mtemp/mifae/macros/makeHillasMC.C

    r6045 r6196  
    5050  TString* OutFilename2;
    5151
     52  TString  rffilename;
     53  TString  dispfilename;
     54
    5255  // ------------- USER CHANGE -----------------
    5356  // Comment line starting "CalibrationFileName" to disable calibration.
     
    5760
    5861  // File to be used in the calibration (must be a camera file without added noise)
    59   CalibrationFilename = new TString("/discpepe/root_0.73mirror/wuerzburg/gammas_nonoise/Gamma_zbin0_0_7_1000to1009_w0.root");
     62  CalibrationFilename = new TString("/mnt/local_wdjrico/jrico/mc/Gammas/Gamma_zbin3_90_7_1290to1299_w0_nonoise.root");
    6063  // File to be analyzed
    61   AnalysisFilename = new TString("/discpepe/root_0.73mirror/wuerzburg/gammas/Gamma_zbin*.root");
     64  AnalysisFilename = new TString("/mnt/users/blanch/magic/TestSample/file*.root");
    6265
    6366  // Change output file names as desired.
    6467  // If you want only one output (not dividing the events in Train and Test samples),
    6568  // comment the initialization of OutFilename2.
    66   OutFilename1 = new TString("/mnt/users/domingo/MAGIC/Disp05/All_gammas_0.73mirror_zbin0to12_cleaned_4035_Spline.root");
    67   //  OutFilename1 = new TString("star_train.root");   // Output file name 1 (test)
     69  OutFilename1 = new TString("/mnt/users/blanch/Temp/Prova.root");
    6870  //  OutFilename2 = new TString("star_test.root");    // Output file name 2 (train)
     71
     72  // File to read RandomForest
     73  rffilename="/mnt/users/blanch/magic/Mars-All/Mars_Standard06/mtemp/mifae/programs/RFstd.root";
     74  // File to read Disp
     75  dispfilename="/mnt/users/blanch/magic/Mars-All/Mars_Standard06/mtemp/mifae/programs/DISPstd.root";
    6976
    7077  // Fraction of events (taken at random) which one wants to process from the
     
    115122  plist.AddToList(&badpix);
    116123
     124  MCerPhotEvt     nphot;
     125  // Stores number of phe
     126  plist.AddToList(&nphot);
    117127 
    118128  // Now setup the tasks and tasklist:
     
    150160  MMcCalibrationCalc mccalibcalc;
    151161  // Calculates calibration constants to convert from ADC counts to photons.
     162
     163  MAddGainFluctuation gainfluc;
     164  //gainfluc.FillHist(1,0.5);
     165  gainfluc.FillHist(0,0.1); // defaul line to not add fluctuations
     166  // Adds Gain fluctuations
    152167
    153168  MImgCleanStd  clean(CleanLev[0], CleanLev[1]);
     
    189204  write1.AddContainer("MMcFadcHeader",       "RunHeaders");
    190205  write1.AddContainer("MMcTrigHeader",       "RunHeaders");
     206  write1.AddContainer("MGainFluctuationCam", "RunHeaders");
    191207
    192208  write1.AddContainer("MRawEvtHeader",   "Events");
     
    201217  write1.AddContainer("MTopology",       "Events");
    202218  write1.AddContainer("MPointingPos",    "Events");
     219  write1.AddContainer("MHadronness",     "Events");
     220  write1.AddContainer("MImageParDisp"  , "Events");
    203221  //write1.AddContainer("MArrivalTimeCam", "Events");
    204222  //write1.AddContainer("MCerPhotEvt",     "Events");
     
    215233      write2.AddContainer("MMcFadcHeader",       "RunHeaders");
    216234      write2.AddContainer("MMcTrigHeader",       "RunHeaders");
     235      write2.AddContainer("MGainFluctuationCam", "RunHeaders");
    217236
    218237      write2.AddContainer("MRawEvtHeader",   "Events");
     
    227246      write2.AddContainer("MTopology",       "Events");
    228247      write2.AddContainer("MPointingPos",    "Events");
     248      write2.AddContainer("MHadronness",     "Events");
     249      write2.AddContainer("MImageParDisp"  , "Events");
    229250      //write2.AddContainer("MArrivalTimeCam", "Events");
    230251      //write2.AddContainer("MCerPhotEvt",     "Events");
     
    260281    }
    261282
    262 
    263   //
    264   // SECOND LOOP: Analysis loop (process file with noise)
     283  //
     284  // SECOND LOOP: TO READ THE RANDOM FOREST FILE(S)
     285  //
     286
     287  MParList   plistrf;
     288  MTaskList  tlistrf;
     289  MRanForest ranforest;
     290  MRanTree   rantree;
     291
     292  if(rffilename.Length())
     293    {
     294      plistrf.AddToList(&tlistrf);
     295      plistrf.AddToList(&ranforest);
     296      plistrf.AddToList(&rantree);
     297
     298      MReadTree readrf("Tree",rffilename);
     299      readrf.DisableAutoScheme();
     300     
     301      MRanForestFill rffill;
     302      rffill.SetNumTrees(100);
     303     
     304      tlistrf.AddToList(&readrf);
     305      tlistrf.AddToList(&rffill);
     306     
     307      MEvtLoop evtlooprf;
     308      evtlooprf.SetParList(&plistrf);
     309      if (!evtlooprf.Eventloop())
     310        return;
     311     
     312      tlistrf.PrintStatistics();
     313    }
     314 
     315
     316  //
     317  // THIRD LOOP: Analysis loop (process file with noise)
    265318  //
    266319  bar.SetWindowName("Analyzing...");
     
    272325  plist.AddToList(&timecam);
    273326  plist.AddToList(&topology);
    274 
     327  plist.AddToList(&rantree);
     328  plist.AddToList(&ranforest);
     329 
    275330  MArrivalTimeCalc2  timecalc;
    276331  // Calculates the arrival time as the mean time of the fWindowSize
     
    290345
    291346  // Change the read task by another one which reads the file we want to analyze:
    292   MReadMarsFile read2("Events");
    293   read2.AddFile(AnalysisFilename->Data());
     347  MReadMarsFile read2("Events","/mnt/users/blanch/magic/TestSample/file*.root");
     348  //  MReadMarsFile read2("Events","/mnt/users/blanch/magic/TestSample/file53.root");
     349  //  read2.AddFile(AnalysisFilename->Data());
    294350  read2.DisableAutoScheme();
    295351  tlist.AddToListBefore(&read2, &read);
    296352  tlist.RemoveFromList(&read);
     353
    297354
    298355  // Add new tasks (Islands and Topology calculations)
     
    301358  //  tlist.AddToListBefore(&islclean,&hcalc);
    302359  tlist.AddToListBefore(&topcalc,&hcalc);
     360
     361  // Add Task to Add Gain Fluctuations
     362  tlist.AddToListBefore(&gainfluc, &hcalc);
     363
     364  MGeomCamMagic geomcam;// = new MGeomCam();
     365  plist.AddToList(&geomcam);
     366
     367
     368  MHillasDisplay*  disphillas=NULL;
     369  disphillas = new MHillasDisplay(&nphot,&geomcam);
    303370
    304371  // Analyze only the desired fraction of events, skip the rest:
     
    312379  tlist.RemoveFromList(&mccalibcalc);
    313380
     381  // disp
     382  // (read in optimum Disp parameter values) 
     383  MDispParameters dispin;
     384  TArrayD dispPar;
     385  if(dispfilename.Length())
     386    {
     387      TFile inparam(dispfilename);
     388      dispin.Read("MDispParameters");
     389      cout << "Optimum parameter values taken for calculating Disp : " << endl;
     390
     391      dispPar =  dispin.GetParameters();
     392      for (Int_t i=0; i<dispPar.GetSize(); i++)
     393        cout << dispPar[i] << ",  ";
     394      cout << endl;
     395     
     396      inparam.Close();
     397    }
     398  // Disp results container
     399  MImageParDisp imagepardisp;
     400  // Disp histograms
     401  MHDisp hdisp;
     402  hdisp.SetName("MHDispAsym");
     403  hdisp.SetSelectedPos(4);
     404  MFillH filldisp("MHDispAsym[MHDisp]", "");
     405 
     406  // Add RandomForest and Disp task computation
     407  MRanForestCalc hadrcalc;
     408  MDispCalc         dispcalc; 
     409
     410  tlist.AddToList(&dispcalc);
     411  tlist.AddToList(&filldisp);
     412  if(rffilename.Length())
     413    tlist.AddToList(&hadrcalc);
     414 
    314415  // Add tasks to write output:
    315416  if (OutFilename2)
     
    321422  tlist.AddToList(&write1);
    322423
     424  // Add display image with hillas
     425  disphillas->SetPSFile();
     426  disphillas->SetPSFileName("provaGF.ps");
     427  disphillas->SetPause(kFALSE);
     428  //tlist.AddToList(disphillas);
     429 
    323430
    324431  if (!evtloop.Eventloop())
Note: See TracChangeset for help on using the changeset viewer.