Changeset 4348


Ignore:
Timestamp:
06/23/04 14:23:48 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r4347 r4348  
    2525    - added calibration of pedestal files and creation of F2-files.
    2626
     27  * macros/bootcampstandardanalysis.C
     28    - updated to use MJExtractSignal
    2729
    2830 2004/06/18: Markus Gaug
  • trunk/MagicSoft/Mars/macros/bootcampstandardanalysis.C

    r4292 r4348  
    4646//////////////////////////////////////////////////////////////////////////////////
    4747const TString inpath = "/mnt/Data/rootdata/CrabNebula/2004_02_10/";
     48const TString outpath = "./";
    4849const Int_t dpedrun  = 14607;
    4950const Int_t dcalrun1 = 14608;
     
    5253const Int_t ddatrun2 = 14614;
    5354const Bool_t usedisplay = kTRUE;
    54 
     55//
     56// A switch to use the Blind Pixel
     57//
     58const Bool_t blindpix = kTRUE;
     59//
     60// A switch to use the PIN Diode
     61//
     62const Bool_t pindiode = kFALSE;
     63//
    5564void bootcampstandardanalysis(const Int_t prun=dpedrun, // pedestal file
    5665                              const Int_t crun1=dcalrun1, const Int_t crun2=dcalrun2, // calibration file(s)
     
    120129  MJPedestal pedloop;
    121130  pedloop.SetInput(&pruns);
     131  pedloop.SetOutputPath(outpath.Data());
    122132  if (usedisplay)
    123133    {
     
    144154  MJCalibration     calloop;
    145155  calloop.SetInput(&cruns);
     156  calloop.SetOutputPath(outpath.Data());
    146157  calloop.SetExtractor(&extractor);
    147158  //
     
    155166  calloop.SetQECam(qecam);
    156167  calloop.SetBadPixels(pedloop.GetBadPixels());
     168  //
     169  // Choose if you want to use the blind pixel and/or the pin diode
     170  //
     171  calloop.SetUseBlindPixel(blindpix);
     172  calloop.SetUsePINDiode(pindiode);
    157173  //
    158174  // The next two commands are for the display:
     
    172188  /*************************************/
    173189
    174   //
    175   // Create a empty Parameter List and an empty Task List
    176   //
    177   MParList  plist3;
    178   MTaskList tlist3;
    179   plist3.AddToList(&tlist3);
    180  
    181   //
    182   // Now setup the tasks and tasklist to calculate the pedestal rms in number of photons
    183   // -----------------------------------------------------------------------------------
    184   //
    185  
    186   MCerPhotEvt    nphot;
    187   MPedPhotCam    nphotrms;
    188  
    189   plist3.AddToList(&geomcam);
    190 
    191   //
    192   // Retrieve the cameras from the previous runs:
    193   //
    194   plist3.AddToList(&pedloop.GetPedestalCam());
    195   plist3.AddToList(&calloop.GetCalibrationCam());
    196   plist3.AddToList(&calloop.GetQECam());
    197   plist3.AddToList(&calloop.GetRelTimeCam());
    198   plist3.AddToList(&calloop.GetBadPixels());
    199   plist3.AddToList(&nphot);
    200   plist3.AddToList(&nphotrms);
    201  
    202   //tasks
    203   MReadMarsFile read3("Events");
    204   read3.DisableAutoScheme();
    205   static_cast<MRead&>(read3).AddFiles(pruns); 
    206 
    207   MCalibrate       photcalc;
    208   photcalc.SetCalibrationMode(MCalibrate::kFfactor);
    209   //    MPedPhotCalc  photrmscalc;  //It doesn't exist yet
    210  
    211   tlist3.AddToList(&read3);
    212   tlist3.AddToList(&geomapl);
    213   tlist3.AddToList(&extractor);
    214   tlist3.AddToList(&photcalc);
    215   //    tlist3.AddToList(&photrmscalc);
    216  
    217   //
    218   // Create and setup the eventloop
    219   //
    220   MEvtLoop evtloop3;
    221   evtloop3.SetParList(&plist3);
    222  
    223   //
    224   // Execute first analysis
    225   //
    226   if (!evtloop3.Eventloop())
     190  MJExtractSignal pedphotloop;
     191
     192  pedphotloop.SetExtractor(&extractor);
     193  pedphotloop.SetTimeExtractor(&timeext);
     194  pedphotloop.SetInput(&pruns);
     195  pedphotloop.SetOutputPath(outpath);
     196  if (useDisplay)
     197    pedphotloop.SetDisplay(display);
     198  pedphotloop.SetBadPixels(calloop.GetBadPixels());
     199 
     200  if (!pedphotloop.ProcessP(pedloop.GetPedestalCam(),calloop.GetCalibrationCam(),calloop.GetQECam()))
    227201    return;
    228  
    229   tlist3.PrintStatistics();
    230  
     202
    231203  /*************************************/
    232204  /* FOURTH LOOP: DATA CALIBRATION     */
     
    244216  // -----------------------------------------------------
    245217  //
    246  
    247218  plist4.AddToList(&geomcam);
    248219  //
     
    254225  plist4.AddToList(&calloop.GetRelTimeCam());
    255226  plist4.AddToList(&calloop.GetBadPixels());
     227  plist4.AddToList(&pedphotloop.GetPedPhotCam());
     228
     229  MCerPhotEvt nphot;
    256230  plist4.AddToList(&nphot);
    257   plist4.AddToList(&nphotrms);
    258231
    259232  MArrivalTime times;
     
    265238  static_cast<MRead&>(read4).AddFiles(druns); 
    266239 
     240  MCalibrate       photcalc;
     241  photcalc.SetCalibrationMode(MCalibrate::kFfactor);
    267242  MCalibrateRelTimes  timecal;
    268243
  • trunk/MagicSoft/Mars/macros/calibration.C

    r4236 r4348  
    5757#include "MJPedestal.h"
    5858#include "MJCalibration.h"
     59#include "MJExtractSignal.h"
    5960#include "MJExtractCalibTest.h"
    60 #include "TObject.h"
    61 #include "TObjectTable.h"
    6261#include "MExtractFixedWindowPeakSearch.h"
    6362#include "MExtractSlidingWindow.h"
    6463#include "MExtractFixedWindow.h"
     64#include "MExtractFixedWindowSpline.h"
     65#include "MExtractAmplitudeSpline.h"
    6566#include "MExtractTimeHighestIntegral.h"
    6667#include "MExtractTimeFastSpline.h"
    6768#include "MRunIter.h"
    6869#include "MStatusDisplay.h"
    69 #include "TStyle.h"
    7070#include "MCalibrationQECam.h"
    7171#include "MHCalibrationTestCam.h"
     
    7777#include "MParContainer.h"
    7878
     79#include "TStyle.h"
     80#include "TObject.h"
     81#include "TObjectTable.h"
     82#include "TSystem.h"
     83
     84#include <fstream>
     85
    7986using namespace std;
    8087
    8188static TString outpath = "./";
    82 static TString inpath = "./";
     89static TString inpath  = "/home/rootdata/Calib/2004_05_24/";
     90static TString badfile = "";
    8391//
    8492// the default pedestal run for the calibration
    8593//
    86 static const Int_t   pedrun  = 26851;
     94static const Int_t   pedrun  = 26569;
    8795//
    8896// the default start calibration run
    8997//
    90 static const Int_t   calrun1 = 26849;
     98static const Int_t   calrun1 = 26568;
    9199//
    92100// the default last calibration run (if 0, only one run is taken, otherwise consecutive runs
     
    109117// Tell if you want to calibrate times:
    110118//
    111 static Bool_t useTimes = kFALSE;
     119static Bool_t useTimes = kTRUE;
    112120//
    113121// Tell if you want to use the display:
    114122//
    115123static Bool_t useDisplay = kTRUE;
     124//
     125// Tell if you want to test the result afterwards
     126//
     127static Bool_t useTest = kTRUE;
    116128//
    117129Int_t calibration(const Int_t prun=pedrun,
     
    127139  //  MExtractFixedWindowPeakSearch extractor;
    128140  //  MExtractSlidingWindow  extractor;   
    129   MExtractFixedWindow extractor;   
    130 
     141  MExtractFixedWindowSpline extractor;
     142  //  MExtractAmplitudeSpline extractor;
     143  //  MExtractTimeAndChargeSpline extractor;
    131144  //
    132145  // Set Ranges or Windows
    133146  //
    134   extractor.SetRange(0,15,3,14);
    135    // extractor.SetRange(5,9 ,5,9 );
     147  extractor.SetRange(1,14,2,13);
    136148  //  extractor.SetWindows(8,8);
    137149
     
    144156  // Set Ranges or Windows
    145157  //
    146   timeext.SetRange(1,14,3,14);
     158  timeext.SetRange(0,7,3,8);
    147159
    148160  MRunIter pruns;
     
    156168    cruns.AddRuns(crun1,crun2,inpath);
    157169
    158   gStyle->SetOptStat(111111);
     170  gStyle->SetOptStat(1111);
    159171  gStyle->SetOptFit();
     172  gStyle->SetTitleSize(0.1,"u");
     173  gStyle->SetLineWidth(1);
    160174
    161175  MStatusDisplay *display = NULL;
     
    178192  // an ascii-file with the corr. pixel numbers (see MBadPixelsCam)
    179193  //
    180   //  badcam.AsciiRead("badpixels.dat");
     194  if (!badfile.IsNull())
     195    {
     196      ifstream f(badfile.Data());
     197      badcam.AsciiRead(f); 
     198      f.close();
     199    }
    181200
    182201  MJPedestal pedloop;
     
    197216  MJCalibration calloop;
    198217
     218  if (debug)
     219    calloop.SetDebug();
    199220  //
    200221  // If you want to run the data-check on RAW DATA!!!, choose:
    201   // calloop.SetDataCheck();
     222  //  calloop.SetDataCheck();
    202223  //
    203224  // If you want to see the data-check plots only, choose:
    204   // calloop.SetDataCheckDisplay();
     225  calloop.SetDataCheckDisplay();
    205226  //
    206227  // For everything, you have ever dreamed of, choose:
     
    249270  /********************************************************************/
    250271
    251   MJExtractCalibTest testloop;
    252 
    253   testloop.SetExtractor(&extractor);
    254   testloop.SetTimeExtractor(&timeext);
    255   testloop.SetInput(&cruns);
    256   testloop.SetOutputPath(outpath);
     272  if (useTest)
     273    {
     274     
     275      MJExtractCalibTest testloop;
     276     
     277      testloop.SetExtractor(&extractor);
     278      testloop.SetTimeExtractor(&timeext);
     279      testloop.SetInput(&cruns);
     280      testloop.SetOutputPath(outpath);
     281      if (useDisplay)
     282        testloop.SetDisplay(display);
     283      testloop.SetBadPixels(calloop.GetBadPixels());
     284     
     285      if (!testloop.ProcessD(pedloop.GetPedestalCam(),calloop.GetCalibrationCam(),calloop.GetQECam()))
     286        return 3;
     287     
     288      if (useTimes)
     289        if (!testloop.ProcessT(pedloop.GetPedestalCam(),calloop.GetRelTimeCam()))
     290      return 4;
     291     
     292      gLog << endl;
     293      gLog << "Mean equiv. number of photons from cascades per mm^2 Inner pixels: "
     294       << testloop.GetTestCam().GetMeanMeanPhotPerArea(0)
     295           << " +- " << testloop.GetTestCam().GetRmsMeanPhotPerArea(0) << endl;
     296      gLog << "Sigma equiv. number of photons from cascades per mm^2 Inner pixels: "
     297           << testloop.GetTestCam().GetMeanSigmaPhotPerArea(0)
     298           << " +- " << testloop.GetTestCam().GetRmsSigmaPhotPerArea(0) << endl;
     299     
     300      gLog << endl;
     301      gLog << "Mean equiv. number of photons from cascades per mm^2 Outer pixels: "
     302           << testloop.GetTestCam().GetMeanMeanPhotPerArea(1)
     303           << " +- " << testloop.GetTestCam().GetRmsMeanPhotPerArea(1) << endl;
     304      gLog << "Sigma equiv. number of photons from cascades per mm^2 Outer pixels: "
     305           << testloop.GetTestCam().GetMeanSigmaPhotPerArea(1)
     306           << " +- " << testloop.GetTestCam().GetRmsSigmaPhotPerArea(1) << endl;
     307      gLog << endl; 
     308     
     309    }
     310 
     311  /********************************************************************/
     312  /* FOURTH LOOP: APPLY CALIBRATION TO THE PEDESTAL FILES             */
     313  /********************************************************************/
     314
     315  MJExtractSignal pedphotloop;
     316
     317  pedphotloop.SetExtractor(&extractor);
     318  pedphotloop.SetTimeExtractor(&timeext);
     319  pedphotloop.SetInput(&pruns);
     320  pedphotloop.SetOutputPath(outpath);
    257321  if (useDisplay)
    258     testloop.SetDisplay(display);
    259   testloop.SetBadPixels(calloop.GetBadPixels());
    260  
    261   if (!testloop.ProcessD(pedloop.GetPedestalCam(),calloop.GetCalibrationCam(),calloop.GetQECam()))
    262     return 3;
    263 
    264   if (useTimes)
    265     if (!testloop.ProcessT(pedloop.GetPedestalCam(),calloop.GetRelTimeCam()))
    266       return 4;
    267 
    268   gLog << endl;
    269   gLog << "Mean equiv. number of photons from cascades per mm^2 Inner pixels: "
    270        << testloop.GetTestCam().GetMeanMeanPhotPerArea(0)
    271        << " +- " << testloop.GetTestCam().GetRmsMeanPhotPerArea(0) << endl;
    272   gLog << "Sigma equiv. number of photons from cascades per mm^2 Inner pixels: "
    273        << testloop.GetTestCam().GetMeanSigmaPhotPerArea(0)
    274        << " +- " << testloop.GetTestCam().GetRmsSigmaPhotPerArea(0) << endl;
    275 
    276   gLog << endl;
    277   gLog << "Mean equiv. number of photons from cascades per mm^2 Outer pixels: "
    278        << testloop.GetTestCam().GetMeanMeanPhotPerArea(1)
    279        << " +- " << testloop.GetTestCam().GetRmsMeanPhotPerArea(1) << endl;
    280   gLog << "Sigma equiv. number of photons from cascades per mm^2 Outer pixels: "
    281        << testloop.GetTestCam().GetMeanSigmaPhotPerArea(1)
    282        << " +- " << testloop.GetTestCam().GetRmsSigmaPhotPerArea(1) << endl;
    283   gLog << endl; 
     322    pedphotloop.SetDisplay(display);
     323  pedphotloop.SetBadPixels(calloop.GetBadPixels());
     324 
     325  if (!pedphotloop.ProcessP(pedloop.GetPedestalCam(),calloop.GetCalibrationCam(),calloop.GetQECam()))
     326    return 5;
    284327
    285328
     
    296339  // List of useful containers:
    297340  //
    298   MHCalibrationTestCam  &testcam     = testloop.GetTestCam();
    299   testcam[100].DrawClone("events");
    300 
    301341/*
    302342  MPedestalCam          &pedcam      = pedloop.GetPedestalCam();
     
    312352  //
    313353/*
     354  testcam[200].DrawClone("fourierevents");
    314355  testcam.GetAverageHiGainArea(0).DrawClone();
    315356  testcam.GetAverageLoGainArea(0).DrawClone();
     
    330371  testcam.GetAverageLoGainSector(6).DrawClone();
    331372*/
     373
    332374  return 0;
    333375
     
    351393    gLog << "     --inpath=#          Find the data in inpath"                      << endl;
    352394    gLog << "     --outpath=#         Write the output containers to outpath"       << endl;
     395    gLog << "     --badfile=#         Use the file # to exclude pixels from the beginning" << endl;
    353396    gLog << "     --debug             Use the TObjectTable for debugging    "       << endl;
    354397    gLog << "                             and write out the pixels as ascii tables" << endl;
    355398    gLog << "     --useTimes          Calibrate the relative arrival times"         << endl;
     399    gLog << "     --useTest           Use the class MJExtractCalibTest to test the calibration on itself" << endl;
    356400    gLog << "     --skipBlindPix      Skip the blind pixel calibration"             << endl;
    357401    gLog << "     --skipPINDiode      Skip the PIN Diode   calibration"             << endl;
     
    374418  debug    = arg.HasOnlyAndRemove("--debug")    || arg.HasOnlyAndRemove("-d");
    375419  useTimes = arg.HasOnlyAndRemove("--useTimes") || arg.HasOnlyAndRemove("-t");
     420  useTest  = arg.HasOnlyAndRemove("--useTest")  || arg.HasOnlyAndRemove("-e");
    376421  blindpix = !(arg.HasOnlyAndRemove("--skipBlindPix"));
    377422  pindiode = !(arg.HasOnlyAndRemove("--skipPINDiode"));
     
    383428    outpath = arg.GetStringAndRemove("--outpath=");
    384429
    385   //
     430  if (arg.HasOption("--badfile="))
     431    badfile = arg.GetStringAndRemove("--badfile=");
     432
     433  if (gSystem->AccessPathName(badfile,kFileExists))
     434  {
     435    gLog << "WARNING: the bad pixels file '" << badfile.Data() << "' doesn't exist." << endl;
     436    badfile = "";
     437  }
     438
    386439  // check for the right usage of the program
    387440  //
  • trunk/MagicSoft/Mars/mjobs/MJExtractCalibTest.cc

    r4189 r4348  
    179179
    180180  TCanvas &c = fDisplay->AddTab("TestTimes");
    181   c.Divide(4,2);
     181  c.Divide(2,4);
    182182
    183183  disp1.CamDraw(c, 1, 2,  5, 1);
Note: See TracChangeset for help on using the changeset viewer.