Ignore:
Timestamp:
02/18/05 17:08:10 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r4237 r6607  
    3535static const TString inpath = ".";
    3636//
    37 // Tell if you want to calibrate times:
    38 //
    39 static const  Bool_t useTimes = kTRUE;
    40 //
    41 // the default pedestal run for the calibration
    42 //
    43 static const Int_t   pedrun = 26210;
    44 //
    4537// the default start calibration run
    4638//
    4739static const Int_t   calrun = 26209;
    4840//
    49 // A switch to output debugging information about Objects use
    50 //
    51 static const Bool_t debug = kFALSE;
    52 //
    5341// Tell if you want to use the display:
    5442//
    55 static Bool_t useDisplay = kTRUE;
     43static Bool_t useDisplay = kFALSE;
    5644//
    57 void readCalibration(const Int_t prun=pedrun, const Int_t crun=calrun)
     45void readCalibration(const Int_t crun=calrun)
    5846{
    5947
    60   const TString pedname  = Form("%s/%i-F0.root", (const char*)inpath,prun);
    61   const TString calname  = Form("%s/%i-F1.root", (const char*)inpath,crun);
    62   const TString testname = Form("%s/%i-Test.root", (const char*)inpath,crun);
    63 
    64   if (gSystem->AccessPathName(pedname, kFileExists))
    65     {
    66       cout << "Input file " << pedname << " doesn't exist." << endl;
    67       return;
    68     }
     48  const TString calname  = Form("%s/calib%08d.root", (const char*)inpath,crun);
    6949
    7050  if (gSystem->AccessPathName(calname, kFileExists))
    7151    {
    7252      cout << "Input file " << calname << " doesn't exist." << endl;
    73       return;
    74     }
    75 
    76   if (gSystem->AccessPathName(testname, kFileExists))
    77     {
    78       cout << "Input file " << testname << " doesn't exist." << endl;
    7953      return;
    8054    }
     
    8559    display = new MStatusDisplay;
    8660
     61  MPedestalCam                 pedcam;
     62  MCalibrationChargeCam        chargecam; 
     63  MCalibrationQECam            qecam;
     64  MCalibrationRelTimeCam       relcam;
     65  MBadPixelsCam                badcam;
    8766
    88   MPedestalCam             pedcam;
    89   MCalibrationChargeCam    chargecam; 
    90   MCalibrationQECam        qecam;
    91   MCalibrationRelTimeCam   reltimecam;
    92   MBadPixelsCam            badcam;
    93   MHCalibrationTestCam     testcam;
    94   MHCalibrationTestTimeCam testtime;
    95 
    96   cout << "Reading from file: " << pedname << endl;
    97 
    98   TFile pedfile(pedname, "READ");
    99   if (pedcam.Read()<=0)
    100     {
    101       cout << "Unable to read MPedestalCam from " << pedname << endl;
    102       return;
    103     }
    104  
    105   if (useDisplay)
    106     {
    107       if (display->GetCanvas("Pedestals"))
    108         display->Read();
    109     }
    110  
    11167  cout << "Reading from file: " << calname << endl;
    11268
     
    11773      return;
    11874    }
    119 
    12075  if (qecam.Read()<=0)
    12176    {
     
    12479    }
    12580
    126     if (reltimecam.Read()<=0)
    127     {
    128       cout << "Unable to read MCalibrationRelTimeCam from " << calname << endl;
    129       return;
    130     }
    131    
    132     if (calfile.FindKey("MBadPixelsCam"))
     81  if (calfile.FindKey("MBadPixelsCam"))
    13382      {
    13483        MBadPixelsCam bad;
     
    14089        badcam.Merge(bad);
    14190      }
     91  if (relcam.Read()<=0)
     92    {
     93      cout << "Unable to read MCalibrationRelTimeCam from " << calname << endl;
     94      return;
     95    }
     96
     97  cout << "Size of QECam: "      << qecam.GetSize() << endl;
     98  cout << "Size of BlindCam: "   << blindcam.GetSize() << endl;
     99  cout << "Size of Chargecam: "  << chargecam.GetSize() << endl;
     100  cout << "Size of RelTimeCam: "  << relcam.GetSize() << endl;
     101
     102   MGeomCamMagic geom;
    142103
    143104  if (useDisplay)
    144105    display->Read();
    145    
    146   cout << "Reading from file: " << testname << endl;
     106 
     107  for (Int_t i=0; i<relcam.GetSize(); i++)
     108  {
     109      MCalibrationRelTimePix &rpix = (MCalibrationRelTimePix&)relcam[i];
     110      cout << "Number of outliers in time pixel: " << i << ": " << rpix.GetNumPickup()+rpix.GetNumBlackout() << endl;
     111  }
    147112
    148   TFile testfile(testname, "READ");
    149   if (testcam.Read()<=0)
     113  for (Int_t i=0; i<2; i++)
     114  { 
     115      TArrayF conv = chargecam.GetAveragedConvFADC2PhotPerArea(geom,qecam,i,&badcam);
     116      cout << "Average Conv Factor Area idx: " << i << ":  " << conv[0] << "+-" << conv[1] << endl;
     117  }
     118
     119  for (Int_t i=0; i<qecam.GetSize(); i++)
    150120    {
    151       cout << "Unable to read MHCalibrationTestCam from " << testname << endl;
    152       return;
     121      MCalibrationChargePix &cpix = (MCalibrationChargePix&)chargecam[i];
     122      MCalibrationQEPix     &qpix = (MCalibrationQEPix&)    qecam[i];
     123      cout << "Conversion Factor: " << cpix.GetMeanConvFADC2Phe() / qpix.GetQECascadesFFactor() << endl;
    153124    }
    154   if (testtime.Read()<=0)
    155     {
    156       cout << "Unable to read MHCalibrationTestTimeCam from " << testname << endl;
    157       return;
    158     }
    159  
    160   if (useDisplay)
    161     display->Read();
    162 
    163   //
    164   // List of interesting plots:
    165   //
    166 /*
    167   testcam.GetAverageHiGainArea(0).DrawClone();
    168   testcam.GetAverageLoGainArea(0).DrawClone();
    169   testcam.GetAverageHiGainArea(1).DrawClone();
    170   testcam.GetAverageLoGainArea(1).DrawClone();
    171 
    172   testcam.GetAverageHiGainSector(1).DrawClone();
    173   testcam.GetAverageLoGainSector(1).DrawClone();
    174   testcam.GetAverageHiGainSector(2).DrawClone();
    175   testcam.GetAverageLoGainSector(2).DrawClone();
    176   testcam.GetAverageHiGainSector(3).DrawClone();
    177   testcam.GetAverageLoGainSector(3).DrawClone();
    178   testcam.GetAverageHiGainSector(4).DrawClone();
    179   testcam.GetAverageLoGainSector(4).DrawClone();
    180   testcam.GetAverageHiGainSector(5).DrawClone();
    181   testcam.GetAverageLoGainSector(5).DrawClone();
    182   testcam.GetAverageHiGainSector(6).DrawClone();
    183   testcam.GetAverageLoGainSector(6).DrawClone();
    184 */
    185 
    186 
    187 
    188125
    189126}
Note: See TracChangeset for help on using the changeset viewer.