Changeset 4624 for trunk/MagicSoft


Ignore:
Timestamp:
08/16/04 12:26:47 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r4618 r4624  
    2121
    2222
     23 2004/08/16: Thomas Bretz
     24
     25   * mcalib/MCalibrateData.[h,cc]:
     26     - change to support also 'No calibration of data'
     27     - removed obsolete dependancie on *'FromData' containers
     28
     29
     30
    2331 2004/08/16: Markus Gaug
    2432 
     
    2937
    3038
     39
    3140 2004/08/14: Markus Gaug
    3241
     
    3847     - some small modifications in the data-check display, discussed
    3948       with Florian
     49
     50
     51
     52 2004/08/13: Thomas Bretz
     53 
     54   * macros/readraw.C:
     55     - updated to get it working with MC data
     56
     57   * mbase/MTaskEnv.cc:
     58     - fixed a typo
     59
     60   * mcalib/MCalibrationChargeCalc.[h,cc],
     61     mcalib/MHCalibrationCam.[h,cc]:
     62     - added ReadEnv
     63     - changed some output slightly to match into a typical
     64       80-column console
     65
     66   * mjobs/MJCalibration.[h,cc]:
     67     - changed to support Sequences
     68     - added SetEnv
     69     - added possibility to change extractors from a resource file
     70     - put MBadPixelsMerge into the tasklist - for strange reasons
     71       it was missing
     72
     73   * mjobs/MJPedestal.[h,cc]:
     74     - fixed the output name for sequences
     75     - added possibility to set output from resource file
     76
     77   * mpedestal/MPedCalcFromLoGain.[h,cc]:
     78     - changed handling of sanity check for setup
     79     - removed obsolete variables
     80     - changed output slightly to fit into a typical 80-column
     81       console
     82     - added some sanity checks to PostProcess
     83     - added some info-output to PostProcess
     84     - calculate a mean number of total events
     85     - call ReCalc to calc mean values of sectors and areas
     86
     87   * mpedestal/MPedCalcPedRun.[h,cc]:
     88     - changed to use ReCalc instead of doing the calculation itself
     89       for convinience I left the old code as a comment inside -
     90       will be removed later
     91
     92   * mpedestal/MPedPhotCam.[h,cc]:
     93     - slight changes in ReCalc
     94
     95   * mpedestal/MPedestalCam.[h,cc]:
     96     - added ReCalc function (maily taken from PedPhotCamReCalc)
     97
     98   * mpedestal/MPedestalPix.h:
     99     - added Getter for fNumEvents
     100
     101   * mraw/MRawEvtHeader.[h,cc]:
     102     - started adding support for calibration pattern. Please don't
     103       take the current implementation to serious
     104
    40105
    41106
  • trunk/MagicSoft/Mars/mcalib/MCalibrateData.cc

    r4608 r4624  
    108108using namespace std;
    109109
    110 const TString MCalibrateData::fgNamePedADCRunContainer     = "MPedestalCam"        ;   
    111 const TString MCalibrateData::fgNamePedADCEventContainer   = "MPedestalCamFromData";
    112 const TString MCalibrateData::fgNamePedPhotRunContainer    = "MPedPhotCam"         ; 
    113 const TString MCalibrateData::fgNamePedPhotEventContainer  = "MPedPhotCamFromData" ;
     110const TString MCalibrateData::fgNamePedADCContainer  = "MPedestalCam";
     111const TString MCalibrateData::fgNamePedPhotContainer = "MPedPhotCam";
    114112// --------------------------------------------------------------------------
    115113//
     
    122120// - fPedestalFlag to kRun
    123121// - fNamePedADCRunContainer    to "MPedestalCam" 
    124 // - fNamePedADCEventContainer  to "MPedestalCamFromData"
    125122// - fNamePedPhotRunContainer   to "MPedPhotCam"   
    126 // - fNamePedPhotEventContainer to "MPedPhotCamFromData"
    127123//
    128124MCalibrateData::MCalibrateData(CalibrationMode_t calmode,const char *name, const char *title)
    129     : fGeomCam(NULL), fPedestal(NULL), fPedestalFromData(NULL),
     125    : fGeomCam(NULL), fPedestal(NULL),
    130126      fBadPixels(NULL), fCalibrations(NULL), fQEs(NULL), fSignals(NULL),
    131       fPedPhot(NULL), fPedPhotFromData(NULL), fCerPhotEvt(NULL)
     127      fPedPhot(NULL), fCerPhotEvt(NULL)
    132128{
    133129
     
    136132 
    137133  SetCalibrationMode();
    138   SetPedestalType();
    139 
    140   SetNamePedADCRunContainer   ();
    141   SetNamePedADCEventContainer ();
    142   SetNamePedPhotRunContainer  ();
    143   SetNamePedPhotEventContainer();
     134  SetPedestalFlag();
     135
     136  SetNamePedADCContainer();
     137  SetNamePedPhotContainer();
    144138
    145139}
     
    164158Int_t MCalibrateData::PreProcess(MParList *pList)
    165159{
    166 
    167   // input containers
    168 
    169   if (TestFlag(kRun))
    170   {
    171     fPedestal = (MPedestalCam*)pList->FindObject(AddSerialNumber(fNamePedADCRunContainer), "MPedestalCam");
     160    // input containers
     161
     162    fPedestal = (MPedestalCam*)pList->FindObject(AddSerialNumber(fNamePedADCContainer), "MPedestalCam");
    172163    if (!fPedestal)
    173     { 
    174       *fLog << err << "container 'MPedestalCam'"
    175             << " not found ... aborting" << endl;
    176       return kFALSE;
    177     }
    178   }
    179 
    180 
    181   if (TestFlag(kEvent))
    182   {
    183     fPedestalFromData = (MPedestalCam*)pList->FindObject(AddSerialNumber(fNamePedADCEventContainer), "MPedestalCam");
    184     if (!fPedestalFromData)
    185     {
    186       *fLog << err << "container 'MPedestalCamFromData'"
    187             << " not found ... aborting" << endl;
    188       return kFALSE;
    189     }
    190   }
    191 
    192 
    193   fSignals = (MExtractedSignalCam*)pList->FindObject(AddSerialNumber("MExtractedSignalCam"));
    194   if (!fSignals)
    195     {
    196       *fLog << err << AddSerialNumber("MExtractedSignalCam") << " not found ... aborting" << endl;
    197       return kFALSE;
    198     }
    199 
    200   fBadPixels = (MBadPixelsCam*)pList->FindObject(AddSerialNumber("MBadPixelsCam"));
    201   if (!fBadPixels)
    202     {
    203       *fLog << err << AddSerialNumber("MBadPixelsCam") << " not found ... aborting" << endl;
    204       return kFALSE;
    205     }
    206  
    207   if (fCalibrationMode>kNone)
     164    {
     165        *fLog << err << AddSerialNumber(fNamePedADCContainer) << " [MPedestalCam] not found ... aborting" << endl;
     166        return kFALSE;
     167    }
     168
     169    fSignals = (MExtractedSignalCam*)pList->FindObject(AddSerialNumber("MExtractedSignalCam"));
     170    if (!fSignals)
     171    {
     172        *fLog << err << AddSerialNumber("MExtractedSignalCam") << " not found ... aborting" << endl;
     173        return kFALSE;
     174    }
     175
     176    fBadPixels = (MBadPixelsCam*)pList->FindObject(AddSerialNumber("MBadPixelsCam"));
     177    if (!fBadPixels)
     178    {
     179        *fLog << err << AddSerialNumber("MBadPixelsCam") << " not found ... aborting" << endl;
     180        return kFALSE;
     181    }
     182
     183    if (fCalibrationMode>kNone)
    208184    {
    209185        fCalibrations = (MCalibrationChargeCam*)pList->FindObject(AddSerialNumber("MCalibrationChargeCam"));
    210186        if (!fCalibrations)
    211           {
     187        {
    212188            *fLog << err << AddSerialNumber("MCalibrationChargeCam") << " not found ... aborting." << endl;
    213189            return kFALSE;
    214           }
     190        }
    215191
    216192        fQEs = (MCalibrationQECam*)pList->FindObject(AddSerialNumber("MCalibrationQECam"));
     
    221197        }
    222198    }
    223  
    224   // output containers
    225 
    226   if (TestFlag(kRun))
    227     {
    228       fPedPhot = (MPedPhotCam*)pList->FindCreateObj("MPedPhotCam", AddSerialNumber(fNamePedPhotRunContainer));
    229       if (!fPedPhot)
    230         return kFALSE;
    231        
    232     }
    233 
    234 
    235   if (TestFlag(kEvent))
    236     { 
    237       fPedPhotFromData = (MPedPhotCam*)pList->FindCreateObj("MPedPhotCam", AddSerialNumber(fNamePedPhotEventContainer));
    238       if (!fPedPhotFromData)
    239         return kFALSE;
    240      
    241     }
    242  
    243   fCerPhotEvt = (MCerPhotEvt*)pList->FindCreateObj(AddSerialNumber("MCerPhotEvt"));
    244   if (!fCerPhotEvt)
    245     return kFALSE;
    246  
    247   return kTRUE;
     199
     200    // output containers
     201
     202    fPedPhot = (MPedPhotCam*)pList->FindCreateObj("MPedPhotCam", AddSerialNumber(fNamePedPhotContainer));
     203    if (!fPedPhot)
     204        return kFALSE;
     205
     206    fCerPhotEvt = (MCerPhotEvt*)pList->FindCreateObj(AddSerialNumber("MCerPhotEvt"));
     207    if (!fCerPhotEvt)
     208        return kFALSE;
     209
     210    return kTRUE;
    248211}
    249212
     
    329292    }
    330293
    331   if (TestFlag(kRun))
    332     if (!CalibratePedestal(fPedestal,fPedPhot))
    333       return kFALSE;
    334 
     294  if (TestPedestalFlag(kRun))
     295      if (!CalibratePedestal())
     296          return kFALSE;
    335297
    336298  return kTRUE;
     
    343305// Calibrate the Pedestal values
    344306//
    345 Bool_t MCalibrateData::CalibratePedestal(MPedestalCam *pedADCCam, MPedPhotCam *pedPhotCam)
    346 {
    347 
    348   //
    349   // Fill MPedPhot container using the informations from
    350   // MPedestalCam, MExtractedSignalCam and MCalibrationCam
    351   //
    352   const Float_t slices = fSignals->GetNumUsedHiGainFADCSlices();
    353 
    354   // is pixid equal to pixidx ?
    355   if (    (Int_t)(pedADCCam->GetSize()) != fSignals->GetSize())
    356   {
    357     *fLog << err << "MCalibrateData::ReInit(); sizes of MPedestalCam and MCalibrationCam are different"
    358           << endl;
    359   }
    360 
    361 
    362   for (Int_t pixid=0; pixid<pedADCCam->GetSize(); pixid++)
    363   {
    364 
    365     const MPedestalPix    &ped = (*pedADCCam)[pixid];
    366 
    367     // pedestals/(used FADC slices)   in [ADC] counts
    368     Float_t pedes  = ped.GetPedestal()    * slices;
    369     Float_t pedrms = ped.GetPedestalRms() * TMath::Sqrt(slices);
    370 
     307Bool_t MCalibrateData::CalibratePedestal()
     308{
    371309    //
    372     // get phe/ADC conversion factor
     310    // Fill MPedPhot container using the informations from
     311    // MPedestalCam, MExtractedSignalCam and MCalibrationCam
    373312    //
    374     Float_t hiloconv;
    375     Float_t hiloconverr;
    376     Float_t calibConv;
    377     Float_t calibConvVar;
    378     Float_t calibFFactor;
    379 
    380     if ( !GetConversionFactor(pixid, hiloconv, hiloconverr,
    381                               calibConv, calibConvVar, calibFFactor ))
    382       continue;
    383 
    384     //
    385     // pedestals/(used FADC slices)   in [number of photons]
    386     //
    387     Float_t pedphot    = pedes  * calibConv;
    388     Float_t pedphotrms = pedrms * calibConv;
    389 
    390     (*pedPhotCam)[pixid].Set(pedphot, pedphotrms);
    391 
    392   }
    393 
    394   pedPhotCam->SetReadyToSave();
    395 
    396   return kTRUE;
     313    const Float_t slices = fSignals->GetNumUsedHiGainFADCSlices();
     314
     315    // is pixid equal to pixidx ?
     316    if ((Int_t)fPedestal->GetSize() != fSignals->GetSize())
     317    {
     318        *fLog << err << "MCalibrateData::ReInit(); sizes of MPedestalCam and MCalibrationCam are different"
     319            << endl;
     320    }
     321
     322    const Int_t n = fPedestal->GetSize();
     323    for (Int_t pixid=0; pixid<n; pixid++)
     324    {
     325        const MPedestalPix &ped = (*fPedestal)[pixid];
     326
     327        // pedestals/(used FADC slices)   in [ADC] counts
     328        Float_t pedes  = ped.GetPedestal()    * slices;
     329        Float_t pedrms = ped.GetPedestalRms() * TMath::Sqrt(slices);
     330
     331        //
     332        // get phe/ADC conversion factor
     333        //
     334        Float_t hiloconv;
     335        Float_t hiloconverr;
     336        Float_t calibConv;
     337        Float_t calibConvVar;
     338        Float_t calibFFactor;
     339
     340        if ( !GetConversionFactor(pixid, hiloconv, hiloconverr,
     341                                  calibConv, calibConvVar, calibFFactor ))
     342            continue;
     343
     344        //
     345        // pedestals/(used FADC slices)   in [number of photons]
     346        //
     347        Float_t pedphot    = pedes  * calibConv;
     348        Float_t pedphotrms = pedrms * calibConv;
     349
     350        (*fPedPhot)[pixid].Set(pedphot, pedphotrms);
     351    }
     352
     353    fPedPhot->SetReadyToSave();
     354
     355    return kTRUE;
    397356}
    398357
     
    401360// Get conversion factor and its error from MCalibrationCam
    402361//
    403 Bool_t MCalibrateData::GetConversionFactor(UInt_t pixidx,
    404  Float_t &hiloconv, Float_t &hiloconverr,
    405  Float_t &calibConv, Float_t &calibConvVar, Float_t &calibFFactor)
    406 {
    407 
     362Bool_t MCalibrateData::GetConversionFactor(UInt_t pixidx, Float_t &hiloconv, Float_t &hiloconverr,
     363                                           Float_t &calibConv, Float_t &calibConvVar, Float_t &calibFFactor)
     364{
    408365  //
    409366  // For the moment, we use only a dummy zenith for the calibration:
     
    523480}
    524481
     482void MCalibrateData::CalibrateData()
     483{
     484    UInt_t npix = fSignals->GetSize();
     485
     486    Float_t hiloconv;
     487    Float_t hiloconverr;
     488    Float_t calibrationConversionFactor;
     489    Float_t calibrationConversionFactorErr;
     490    Float_t calibFFactor;
     491
     492    for (UInt_t pixidx=0; pixidx<npix; pixidx++)
     493    {
     494        if ( !GetConversionFactor(pixidx, hiloconv, hiloconverr,
     495                                  calibrationConversionFactor, calibrationConversionFactorErr, calibFFactor) )
     496            continue;
     497
     498        MExtractedSignalPix &sig =  (*fSignals)[pixidx];
     499
     500        Float_t signal;
     501        Float_t signalErr = 0.;
     502        Float_t nphot,nphotErr;
     503
     504        if (sig.IsLoGainUsed())
     505        {
     506            signal    = sig.GetExtractedSignalLoGain()*hiloconv;
     507            signalErr = signal*hiloconverr;
     508        }
     509        else
     510        {
     511            if (sig.GetExtractedSignalHiGain() > 9999.)
     512            {
     513                signal = 0.;
     514                signalErr = 0.;
     515            }
     516            else
     517                signal = sig.GetExtractedSignalHiGain();
     518        }
     519
     520        nphot    = signal*calibrationConversionFactor;
     521        nphotErr = calibFFactor*TMath::Sqrt(TMath::Abs(nphot));
     522        //
     523        // The following part is the commented first version of the error calculation
     524        // Contact Markus Gaug for questions (or wait for the next documentation update...)
     525        //
     526        /*
     527         nphotErr = signal    > 0 ? signalErr*signalErr / (signal * signal)  : 0.
     528         + calibConv > 0 ? calibConvVar  / (calibConv * calibConv ) : 0.;
     529         nphotErr  = TMath::Sqrt(nphotErr) * nphot;
     530         */
     531
     532        MCerPhotPix *cpix = fCerPhotEvt->AddPixel(pixidx, nphot, nphotErr);
     533
     534        if (sig.GetNumHiGainSaturated() > 0)
     535            cpix->SetPixelHGSaturated();
     536
     537        if (sig.GetNumLoGainSaturated() > 0)
     538            cpix->SetPixelSaturated();
     539    }
     540
     541    fCerPhotEvt->FixSize();
     542    fCerPhotEvt->SetReadyToSave();
     543}
    525544
    526545// --------------------------------------------------------------------------
     
    531550Int_t MCalibrateData::Process()
    532551{
    533 
    534   /*
    535     if (fCalibrations->GetNumPixels() != (UInt_t)fSignals->GetSize())
    536     {
    537         // FIXME: MExtractedSignal must be of variable size -
    538         //        like MCerPhotEvt - because we must be able
    539         //        to reduce size by zero supression
    540         //        For the moment this check could be done in ReInit...
    541         *fLog << err << "MExtractedSignal and MCalibrationCam have different sizes... abort." << endl;
    542         return kFALSE;
    543     }
    544   */
    545 
    546   UInt_t npix = fSignals->GetSize();
    547 
    548   Float_t hiloconv;
    549   Float_t hiloconverr;
    550   Float_t calibrationConversionFactor;
    551   Float_t calibrationConversionFactorErr;
    552   Float_t calibFFactor;
    553 
    554   for (UInt_t pixidx=0; pixidx<npix; pixidx++)
    555     {
    556       if ( !GetConversionFactor(pixidx, hiloconv, hiloconverr,
    557             calibrationConversionFactor, calibrationConversionFactorErr, calibFFactor) )
    558         continue;
    559      
    560       MExtractedSignalPix &sig =  (*fSignals)[pixidx];
    561      
    562       Float_t signal;
    563       Float_t signalErr = 0.;
    564       Float_t nphot,nphotErr;
    565            
    566       if (sig.IsLoGainUsed())
    567         {
    568           signal    = sig.GetExtractedSignalLoGain()*hiloconv;
    569           signalErr = signal*hiloconverr;
    570         }
    571       else
    572         {
    573           if (sig.GetExtractedSignalHiGain() > 9999.)
    574             {
    575               signal = 0.;
    576               signalErr = 0.;
    577             }
    578           else
    579             signal = sig.GetExtractedSignalHiGain();
    580         }
    581      
    582       nphot    = signal*calibrationConversionFactor;
    583       nphotErr = calibFFactor*TMath::Sqrt(TMath::Abs(nphot));
    584       //
    585       // The following part is the commented first version of the error calculation
    586       // Contact Markus Gaug for questions (or wait for the next documentation update...)
    587       //
    588       /*
    589         nphotErr = signal    > 0 ? signalErr*signalErr / (signal * signal)  : 0.
    590                  + calibConv > 0 ? calibConvVar  / (calibConv * calibConv ) : 0.;
    591         nphotErr  = TMath::Sqrt(nphotErr) * nphot;
    592       */
    593 
    594       MCerPhotPix *cpix = fCerPhotEvt->AddPixel(pixidx, nphot, nphotErr);
    595 
    596       if (sig.GetNumHiGainSaturated() > 0)
    597         cpix->SetPixelHGSaturated();
    598 
    599       if (sig.GetNumLoGainSaturated() > 0)
    600         cpix->SetPixelSaturated();
    601     }
    602  
    603   fCerPhotEvt->FixSize();
    604   fCerPhotEvt->SetReadyToSave();
    605  
    606   if(TestFlag(kEvent))
    607     if (!CalibratePedestal(fPedestalFromData,fPedPhotFromData))
    608       return kFALSE;
    609 
    610   /*
    611   //
    612   // fill MPedPhot(FromData) container using the informations from
    613   // MPedestalCam, MExtractedSignalCam and MCalibrationCam
    614   //
    615   fNumUsedHiGainFADCSlices = fSignals->GetNumUsedHiGainFADCSlices();
    616 
    617   // is pixid equal to pixidx ?
    618   if (    (Int_t)(fPedestal->GetSize()) != fSignals->GetSize())
    619     {
    620       *fLog << err << "MCalibrateData::ReInit(); sizes of MPedestalCam and MCalibrationCam are different"
    621                    << endl;
    622      }
    623   */
    624 
    625   /*
    626   *fLog << all << "MCalibrateData::ReInit(); fill MPedPhotCam container"
    627         << endl;
    628   *fLog << all << "     fNumUsedHiGainADCSlices = "
    629         <<  fNumUsedHiGainFADCSlices << endl;
    630   *fLog << all << "     pixid, calibrationConversionFactor, ped, pedRMS, pedphot, pedphotRMS :"
    631         << endl;
    632   */ /*
    633   for (Int_t pixid=0; pixid<fPedestalFromData->GetSize(); pixid++)
    634   {
    635     const MPedestalPix    &ped = (*fPedestalFromData)[pixid];
    636 
    637     // pedestals/(used FADC slices)   in [ADC] counts
    638     Float_t pedes  = ped.GetPedestal()    * fNumUsedHiGainFADCSlices;
    639     Float_t pedrms = ped.GetPedestalRms() * sqrt(fNumUsedHiGainFADCSlices);
    640 
    641     //----------------------------------
    642     // get phe/ADC conversion factor
    643 
    644     Float_t hiloconv;
    645     Float_t hiloconverr;
    646     Float_t calibConv;
    647     Float_t calibFFactor;
    648 
    649     if ( !GetConversionFactor(pixid, hiloconv, hiloconverr,
    650                               calibConv, calibFFactor ))
    651       continue;
    652 
    653     //----------------------------------
    654 
    655     // pedestals/(used FADC slices)   in [number of photons]
    656     Float_t pedphot    = pedes  * calibConv;
    657     Float_t pedphotrms = pedrms * calibConv;
    658 
    659     (*fPedPhotFromData)[pixid].Set(pedphot, pedphotrms);
    660 
    661     //    *fLog << all << pixid << ",  " << calibConv << ",  "
    662     //      << ped.GetPedestal() << ",  " << ped.GetPedestalRms() << ",  "
    663     //       << pedphot << ",  " << pedphotrms << endl;
    664   }
    665 
    666   //---------------------------------------------
    667 
    668   fPedPhotFromData->SetReadyToSave();
    669 
    670   }
     552    /*
     553     if (fCalibrations->GetNumPixels() != (UInt_t)fSignals->GetSize())
     554     {
     555     // FIXME: MExtractedSignal must be of variable size -
     556     //        like MCerPhotEvt - because we must be able
     557     //        to reduce size by zero supression
     558     //        For the moment this check could be done in ReInit...
     559     *fLog << err << "MExtractedSignal and MCalibrationCam have different sizes... abort." << endl;
     560     return kFALSE;
     561     }
    671562     */
     563
     564    if (fCalibrationMode!=kSkip)
     565        CalibrateData();
     566
     567    if (TestPedestalFlag(kEvent))
     568        if (!CalibratePedestal())
     569            return kFALSE;
    672570
    673571  return kTRUE;
     
    686584  out << "\"" << fName << "\", \"" << fTitle << "\");" << endl;
    687585
    688   if (TestFlag(kEvent))
     586  if (TestPedestalFlag(kEvent))
    689587    out << "   " << GetUniqueName() << ".EnablePedestalType(kEvent)" << endl;
    690   if (TestFlag(kRun))
     588  if (TestPedestalFlag(kRun))
    691589    out << "   " << GetUniqueName() << ".EnablePedestalType(kRun)" << endl;
    692590
    693591  if (fCalibrationMode != kDefault)
    694     out << "   " << GetUniqueName() << ".SetCalibrationMode(fCalibrationMode)" << endl;
    695 
    696   if (fNamePedADCRunContainer != fgNamePedADCRunContainer)
    697     {
    698       out << "   " << GetUniqueName() << ".SetNamePedADCRunContainer(";
    699       out << fNamePedADCRunContainer.Data() << ");" << endl;
     592    out << "   " << GetUniqueName() << ".SetCalibrationMode(" << fCalibrationMode << ")" << endl;
     593
     594  if (fNamePedADCContainer != fgNamePedADCContainer)
     595    {
     596      out << "   " << GetUniqueName() << ".SetNamePedADCContainer(";
     597      out << fNamePedADCContainer.Data() << ");" << endl;
    700598    }
    701599 
    702   if (fNamePedADCEventContainer != fgNamePedADCEventContainer)
    703     {
    704       out << "   " << GetUniqueName() << ".SetNamePedADCEventContainer(";
    705       out << fNamePedADCEventContainer.Data() << ");" << endl;
    706     }
    707 
    708  
    709   if (fNamePedPhotRunContainer  != fgNamePedPhotRunContainer)
    710     {
    711       out << "   " << GetUniqueName() << ".SetNamePedPhotRunContainer(";
    712       out << fNamePedPhotRunContainer.Data() << ");" << endl;
    713     }
    714 
    715 
    716   if (fNamePedPhotEventContainer != fNamePedPhotEventContainer)
    717     {
    718       out << "   " << GetUniqueName() << ".SetNamePedPhotEventContainer(";
    719       out <<  fNamePedPhotEventContainer.Data() << ");" << endl;
    720     }
    721 
    722 }
    723 
    724  
     600  if (fNamePedPhotContainer  != fgNamePedPhotContainer)
     601    {
     602      out << "   " << GetUniqueName() << ".SetNamePedPhotContainer(";
     603      out << fNamePedPhotContainer.Data() << ");" << endl;
     604    }
     605}
  • trunk/MagicSoft/Mars/mcalib/MCalibrateData.h

    r4614 r4624  
    3535private:
    3636
    37   static const TString fgNamePedADCRunContainer;    //! "MPedestalCam"
    38   static const TString fgNamePedADCEventContainer;  //! "MPedestalCamFromData"
    39   static const TString fgNamePedPhotRunContainer;   //! "MPedPhotCam"
    40   static const TString fgNamePedPhotEventContainer; //! "MPedPhotCamFromData" 
     37  static const TString fgNamePedADCContainer;    //! "MPedestalCam"
     38  static const TString fgNamePedPhotContainer;   //! "MPedPhotCam"
    4139 
    4240  MGeomCam              *fGeomCam;          //! Camera geometry container
    4341  MPedestalCam          *fPedestal;         //! Pedestals/slice [ADC counts]
    44   MPedestalCam          *fPedestalFromData; //! Pedestals/slice [ADC counts]
    4542  MBadPixelsCam         *fBadPixels;        //! Bad Pixels information
    4643  MCalibrationChargeCam *fCalibrations;     //! Calibration constants
     
    4946 
    5047  MPedPhotCam           *fPedPhot;          // Pedestals/(used slices) [photons]
    51   MPedPhotCam           *fPedPhotFromData;  // Pedestals/(used slices) [photons]
    5248  MCerPhotEvt           *fCerPhotEvt;       // Cerenkov Photon Event used for calculation
    5349 
     
    5551  Byte_t   fPedestalFlag;                   // Flags defining to calibrate the pedestal each event or each run
    5652 
    57   TString  fNamePedADCRunContainer;         // name of fPedestal
    58   TString  fNamePedADCEventContainer;       // name of fPedestalFromData
    59   TString  fNamePedPhotRunContainer;        // name of fPedPhot
    60   TString  fNamePedPhotEventContainer;      // name of fPedPhotFromData
     53  TString  fNamePedADCContainer;         // name of fPedestal
     54  TString  fNamePedPhotContainer;        // name of fPedPhot
    6155
    62   Bool_t   CalibratePedestal ( MPedestalCam *, MPedPhotCam * );
     56  Bool_t CalibratePedestal();
     57  void   CalibrateData();
    6358 
    64   Bool_t   GetConversionFactor(UInt_t,
    65                                Float_t &, Float_t &, Float_t &,
    66                                Float_t &, Float_t &);   
     59  Bool_t GetConversionFactor(UInt_t, Float_t &, Float_t &, Float_t &, Float_t &, Float_t &);
    6760 
    68   Int_t    PreProcess( MParList *pList );
    69   Bool_t   ReInit    ( MParList *pList );
    70   Int_t    Process   ( );
     61  Int_t  PreProcess(MParList *pList);
     62  Bool_t ReInit(MParList *pList);
     63  Int_t  Process();
    7164
    72   void      StreamPrimitive( ofstream &out ) const;
     65  void   StreamPrimitive( ofstream &out ) const;
    7366 
    7467public:
    7568
    76   enum CalibrationMode_t { kNone=0,kFlatCharge=1,
    77                            kBlindPixel=2,kFfactor=3,kPinDiode=4,kCombined=5, kDummy=6 };
     69    enum CalibrationMode_t
     70    {
     71        kNone       =  0,
     72        kFlatCharge =  1,
     73        kBlindPixel =  2,
     74        kFfactor    =  3,
     75        kPinDiode   =  4,
     76        kCombined   =  5,
     77        kDummy      =  6,
     78        kSkip       =  7
     79    };
    7880
    7981  static const CalibrationMode_t kDefault = kFfactor;
    8082 
    81   enum PedestalType_t {
    82     kNo    = BIT(0),
    83     kRun   = BIT(1),
    84     kEvent = BIT(2)
     83  enum PedestalType_t
     84  {
     85      kNo    = BIT(0),
     86      kRun   = BIT(1),
     87      kEvent = BIT(2)
    8588  };
    8689 
    87   MCalibrateData( CalibrationMode_t calmode=kDefault,
    88                   const char *name=NULL, const char *title=NULL);
     90  MCalibrateData(CalibrationMode_t calmode=kDefault,
     91                 const char *name=NULL, const char *title=NULL);
    8992 
    90   void   EnablePedestalType ( PedestalType_t i      )              { fPedestalFlag |=  i;      }
    91   void   SetPedestalType    ( PedestalType_t i=kRun )              { fPedestalFlag  =  i;      }
    92   Bool_t TestFlag           ( PedestalType_t i      ) const        { return fPedestalFlag & i; }
     93  void   EnablePedestalType(PedestalType_t i)     { fPedestalFlag |=  i;      }
     94  void   SetPedestalFlag(PedestalType_t i=kRun)   { fPedestalFlag  =  i;      }
     95  Bool_t TestPedestalFlag(PedestalType_t i) const { return fPedestalFlag & i; }
    9396 
    9497  void   SetCalibrationMode ( CalibrationMode_t calmode=kDefault ) { fCalibrationMode=calmode; }
    9598 
    96   void   SetNamePedADCRunContainer   ( const char *name=fgNamePedADCRunContainer.Data() )         {
    97     fNamePedADCRunContainer    = name; }
    98   void   SetNamePedADCEventContainer ( const char *name=fgNamePedADCEventContainer.Data() ) {
    99     fNamePedADCEventContainer  = name; }
    100   void   SetNamePedPhotRunContainer  ( const char *name=fgNamePedPhotRunContainer.Data() )          {
    101     fNamePedPhotRunContainer   = name; }
    102   void   SetNamePedPhotEventContainer( const char *name=fgNamePedPhotEventContainer.Data())   {
    103     fNamePedPhotEventContainer = name; }
     99  void   SetNamePedADCContainer(const char *name=fgNamePedADCContainer.Data())
     100  {
     101      fNamePedADCContainer  = name;
     102  }
     103  void   SetNamePedPhotContainer(const char *name=fgNamePedPhotContainer.Data())
     104  {
     105      fNamePedPhotContainer   = name;
     106  }
    104107 
    105108  ClassDef(MCalibrateData, 0)   // Task to calibrate FADC counts into Cherenkov photons
Note: See TracChangeset for help on using the changeset viewer.