Ignore:
Timestamp:
12/08/04 18:02:12 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mcalib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mcalib/MCalibrateData.cc

    r5196 r5570  
    6666//     SetPedestalFlag(MCalibrateData::kEvent)  (calibration is done for each event)
    6767//
    68 //   By calling SetNamePedADCContainer() and/or SetNamePedPhotContainer() you
     68//   By calling SetNamePedestalCam() and/or SetNamePedPhotCam() you
    6969//   can control the name of the MPedestalCam and/or MPedPhotCam container which is used.
    7070//
     
    7676//     MCalibrateData cal2;
    7777//     cal2.SetCalibrationMode(MCalibrateData::kSkip);
    78 //     cal2.SetNamePedADCContainer("MPedestalFromLoGain");
    79 //     cal2.SetNamePedPhotContainer("MPedPhotFromLoGain")
     78//     cal2.SetNamePedestalCam("MPedestalFromLoGain");
     79//     cal2.SetNamePedPhotCam("MPedPhotFromLoGain")
    8080//     cal2.SetPedestalFlag(MCalibrateData::kEvent);
    8181//
     
    133133using namespace std;
    134134
    135 const TString MCalibrateData::fgNamePedADCContainer  = "MPedestalCam";
    136 const TString MCalibrateData::fgNamePedPhotContainer = "MPedPhotCam";
     135const TString MCalibrateData::fgNamePedestalCam  = "MPedestalCam";
     136const TString MCalibrateData::fgNamePedPhotCam = "MPedPhotCam";
     137
    137138// --------------------------------------------------------------------------
    138139//
     
    143144// Initializes:
    144145// - fCalibrationMode to kDefault
    145 // - fPedestalFlag to kRun
     146// - fPedestalFlag to kNo
    146147// - fNamePedADCRunContainer    to "MPedestalCam" 
    147148// - fNamePedPhotRunContainer   to "MPedPhotCam"   
    148149//
    149150MCalibrateData::MCalibrateData(CalibrationMode_t calmode,const char *name, const char *title)
    150     : fGeomCam(NULL),   fPedestal(NULL),
     151    : fGeomCam(NULL),   fPedestalMean(NULL), fPedestalRms(NULL),
    151152      fBadPixels(NULL), fCalibrations(NULL), fQEs(NULL), fSignals(NULL),
    152153      fPedPhot(NULL),   fCerPhotEvt(NULL), fPedestalFlag(kNo)
     
    158159  SetCalibrationMode(calmode);
    159160
    160   SetNamePedADCContainer();
    161   SetNamePedPhotContainer();
     161  SetNamePedestalCam();
     162  SetNamePedPhotCam();
    162163}
    163164
     
    225226    }
    226227
    227     fPedestal = 0;
     228    //fPedestalMean = 0;
     229    //fPedestalRms  = 0;
    228230    fPedPhot  = 0;
    229231    if (fPedestalFlag)
    230232    {
    231         fPedestal = (MPedestalCam*)pList->FindObject(AddSerialNumber(fNamePedADCContainer), "MPedestalCam");
    232         if (!fPedestal)
    233         {
    234             *fLog << err << AddSerialNumber(fNamePedADCContainer) << " [MPedestalCam] not found ... aborting" << endl;
    235             return kFALSE;
    236         }
    237 
    238         fPedPhot = (MPedPhotCam*)pList->FindCreateObj("MPedPhotCam", AddSerialNumber(fNamePedPhotContainer));
     233        if (!fPedestalMean)
     234        {
     235            fPedestalMean = (MPedestalCam*)pList->FindObject(AddSerialNumber(fNamePedestalCam), "MPedestalCam");
     236            if (!fPedestalMean)
     237            {
     238                *fLog << err << AddSerialNumber(fNamePedestalCam) << " [MPedestalCam] not found ... aborting" << endl;
     239                return kFALSE;
     240            }
     241        }
     242
     243        if (!fPedestalRms)
     244        {
     245            fPedestalRms = (MPedestalCam*)pList->FindObject(AddSerialNumber(fNamePedestalCam), "MPedestalCam");
     246            if (!fPedestalRms)
     247            {
     248                *fLog << err << AddSerialNumber(fNamePedestalCam) << " [MPedestalCam] not found ... aborting" << endl;
     249                return kFALSE;
     250            }
     251        }
     252
     253        fPedPhot = (MPedPhotCam*)pList->FindCreateObj("MPedPhotCam", AddSerialNumber(fNamePedPhotCam));
    239254        if (!fPedPhot)
    240255            return kFALSE;
     
    266281
    267282    // Sizes might have changed
    268     if (fPedestalFlag && (Int_t)fPedestal->GetSize() != fSignals->GetSize())
    269     {
    270         *fLog << err << "Size mismatch of MPedestalCam and MCalibrationCam... abort." << endl;
     283    if (fPedestalFlag && (Int_t)fPedestalMean->GetSize() != fSignals->GetSize())
     284    {
     285        *fLog << err << "Size mismatch of MPedestalCam for Mean and MCalibrationCam... abort." << endl;
     286        return kFALSE;
     287    }
     288
     289    if (fPedestalFlag && (Int_t)fPedestalRms->GetSize() != fSignals->GetSize())
     290    {
     291        *fLog << err << "Size mismatch of MPedestalCam for RMS and MCalibrationCam... abort." << endl;
    271292        return kFALSE;
    272293    }
     
    499520                cpix->SetPixelSaturated();
    500521        }
     522
    501523        if (pedestal)
    502524        {
    503             const MPedestalPix &ped = (*fPedestal)[pixidx];
    504 
    505525            // pedestals/(used FADC slices)   in [ADC] counts
    506             const Float_t pedes  = ped.GetPedestal()    * slices;
    507             const Float_t pedrms = ped.GetPedestalRms() * sqrtslices;
     526            const Float_t pedes  = (*fPedestalMean)[pixidx].GetPedestal()   * slices;
     527            const Float_t pedrms = (*fPedestalRms)[pixidx].GetPedestalRms() * sqrtslices;
    508528
    509529            //
     
    590610    }
    591611
    592     if (fNamePedADCContainer != fgNamePedADCContainer)
    593     {
    594         out << "   " << GetUniqueName() << ".SetNamePedADCContainer(";
    595         out << fNamePedADCContainer.Data() << ");" << endl;
    596     }
    597 
    598     if (fNamePedPhotContainer  != fgNamePedPhotContainer)
    599     {
    600         out << "   " << GetUniqueName() << ".SetNamePedPhotContainer(";
    601         out << fNamePedPhotContainer.Data() << ");" << endl;
     612    if (fNamePedestalCam != fgNamePedestalCam)
     613    {
     614        out << "   " << GetUniqueName() << ".SetNamePedestalCam(";
     615        out << fNamePedestalCam << ");" << endl;
     616    }
     617
     618    if (fNamePedPhotCam  != fgNamePedPhotCam)
     619    {
     620        out << "   " << GetUniqueName() << ".SetNamePedPhotCam(";
     621        out << fNamePedPhotCam << ");" << endl;
    602622    }
    603623}
  • trunk/MagicSoft/Mars/mcalib/MCalibrateData.h

    r5030 r5570  
    3434{
    3535private:
    36   static const TString fgNamePedADCContainer;    //! "MPedestalCam"
    37   static const TString fgNamePedPhotContainer;   //! "MPedPhotCam"
     36  static const TString fgNamePedestalCam;    //! "MPedestalCam"
     37  static const TString fgNamePedPhotCam;     //! "MPedPhotCam"
    3838 
    3939  MGeomCam              *fGeomCam;          //! Camera geometry container
    40   MPedestalCam          *fPedestal;         //! Pedestals/slice [ADC counts]
     40  MPedestalCam          *fPedestalMean;     //! Pedestals/slice [ADC counts]
     41  MPedestalCam          *fPedestalRms;      //! Pedestals/slice [ADC counts]
    4142  MBadPixelsCam         *fBadPixels;        //! Bad Pixels information
    4243  MCalibrationChargeCam *fCalibrations;     //! Calibration constants
     
    5051  Byte_t   fPedestalFlag;                   // Flags defining to calibrate the pedestal each event or each run
    5152 
    52   TString  fNamePedADCContainer;            // name of fPedestal
    53   TString  fNamePedPhotContainer;           // name of fPedPhot
     53  TString  fNamePedestalCam;            // name of fPedestal
     54  TString  fNamePedPhotCam;           // name of fPedPhot
    5455
    5556  Int_t Calibrate(Bool_t data, Bool_t pedestal) const;
     
    9596  void   SetCalibrationMode ( CalibrationMode_t calmode=kDefault ) { fCalibrationMode=calmode; }
    9697 
    97   void   SetNamePedADCContainer(const char *name=fgNamePedADCContainer.Data())
     98  void   SetNamePedestalCam(const char *name=fgNamePedestalCam.Data())
    9899  {
    99       fNamePedADCContainer  = name;
     100      fNamePedestalCam  = name;
    100101  }
    101   void   SetNamePedPhotContainer(const char *name=fgNamePedPhotContainer.Data())
     102  void SetPedestalCamMean(MPedestalCam *cam) { fPedestalMean = cam; }
     103  void SetPedestalCamRms(MPedestalCam *cam)  { fPedestalRms  = cam; }
     104
     105  void   SetNamePedPhotCam(const char *name=fgNamePedPhotCam.Data())
    102106  {
    103       fNamePedPhotContainer   = name;
     107      fNamePedPhotCam   = name;
    104108  }
    105109 
Note: See TracChangeset for help on using the changeset viewer.