Ignore:
Timestamp:
01/16/05 17:11:31 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mcalib
Files:
2 edited

Legend:

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

    r5799 r5856  
    2929//
    3030//  Input Containers:
    31 //   MRawEvtHeader
    3231//   MParList
    3332//   MCalibrationIntensityChargeCam
     
    6160#include "MCalibrationChargeCalc.h"
    6261#include "MCalibrationRelTimeCalc.h"
     62#include "MCalibrateData.h"
    6363
    6464#include "MRawRunHeader.h"
    65 #include "MRawEvtHeader.h"
    6665
    6766#include "MGeomCam.h"
     
    7170using namespace std;
    7271
     72const UInt_t MCalibCalcFromPast::fgNumEventsDump = 1000;
    7373// --------------------------------------------------------------------------
    7474//
    7575//  Default constructor.
    7676//
     77// Sets:
     78// - fNumEventsDump to fgNumEventsDump
     79//
    7780MCalibCalcFromPast::MCalibCalcFromPast(const char *name, const char *title)
    78     : fHeader(NULL), fGeom(NULL), fParList(NULL),
     81    : fRunHeader(NULL), fGeom(NULL), fParList(NULL),
    7982      fIntensCharge(NULL), fIntensRelTime(NULL), fIntensBad(NULL),
    80       fChargeCalc(NULL), fRelTimeCalc(NULL),
    81       fPattern(0)
     83      fChargeCalc(NULL), fRelTimeCalc(NULL), fCalibrate(NULL),
     84      fNumEvents(0), fNumCam(0)
    8285{
    8386
     
    8588  fTitle = title ? title : "Task to steer the processing of interlaced calibration events";
    8689
     90  SetNumEventsDump();
    8791}
    8892
     
    9094//
    9195// The following container are searched for and execution aborted if not in MParList:
    92 //  - MRawEvtHeader
    9396//  - MTaskList
    9497//
     
    9699{
    97100
    98   fHeader = (MRawEvtHeader*)pList->FindObject("MRawEvtHeader");
    99   if (!fHeader)
    100     {
    101       *fLog << err << "MRawEvtHeader not found... abort." << endl;
    102       return kFALSE;
    103     }
     101  /*
     102  fTrigPattern = (MTriggerPattern*)pList->FindObject("MTriggerPattern");
     103  if (!fTrigPattern)
     104    {
     105      *fLog << err << "MTriggerPattern not found... abort." << endl;
     106      return kFALSE;
     107    }
     108  */
    104109
    105110  fRunHeader = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
    106   if (!fHeader)
     111  if (!fRunHeader)
    107112    {
    108113      *fLog << err << "MRawRunHeader not found... abort." << endl;
     
    159164    fIntensQE     = (MCalibrationIntensityQECam*)    pList->FindCreateObj("MCalibrationIntensityQECam");
    160165
    161     fChargeCalc   = (MCalibrationChargeCalc*)tlist->FindObject("MCalibrationChargeCalc");
    162 
     166    if (!fChargeCalc)
     167      fChargeCalc   = (MCalibrationChargeCalc*)tlist->FindObject("MCalibrationChargeCalc");
     168
     169    if (!fCalibrate)
     170      fCalibrate   = (MCalibrateData*)tlist->FindObject("MCalibrateData");
     171   
    163172    *fLog << inf << "Found MHCalibrationChargeCam ... " << flush;
     173    *fLog << err << fCalibrate << flush;
    164174
    165175    if (!fIntensCharge)
     
    180190        return kFALSE;
    181191      }
     192
     193    if (!fCalibrate)
     194      {
     195        *fLog << err << "Could not find MCalibrateData abort... " << endl;
     196        return kFALSE;
     197      }
    182198  }
    183199     
     
    190206
    191207    fIntensRelTime = (MCalibrationIntensityRelTimeCam*)pList->FindCreateObj("MCalibrationIntensityRelTimeCam");
    192     fRelTimeCalc   = (MCalibrationRelTimeCalc*)tlist->FindObject(AddSerialNumber("MCalibrationRelTimeCalc"));
     208    if (!fRelTimeCalc)
     209      fRelTimeCalc   = (MCalibrationRelTimeCalc*)tlist->FindObject(AddSerialNumber("MCalibrationRelTimeCalc"));
    193210
    194211    *fLog << inf << "Found MHCalibrationRelTimeCam ... " << flush;
     
    225242  }
    226243     
     244
     245  fNumCam    = 0;
     246  fNumEvents = 0;
     247
    227248  return kTRUE;
    228249}
     
    230251// --------------------------------------------------------------------------
    231252//
    232 // Reads the pattern from MRawEvtHeader and initializes new containers in the
    233 // Intensity Cams, if the pattern has changed. Executes CallPostProcess of the
    234 // MCalibration*Calc classes in that case.
     253// Initializes new containers in the
     254// Intensity Cams, if the number of calibration events has reach fNumEventsDump.
     255// Executes CallPostProcess of the MCalibration*Calc classes in that case.
    235256//
    236257Int_t MCalibCalcFromPast::Process()
    237258{
    238259
    239   const UInt_t pattern = fHeader->GetCalibrationPattern();
    240 
    241   if (pattern == fPattern)
     260  /*
     261  if (!(fTrigPattern->GetPrescaled() & MTriggerPattern::kCalibration))
    242262    return kTRUE;
    243 
    244   if (fPattern == 0)
    245     {
    246       fPattern = pattern;
    247       return kTRUE;
    248     }
    249 
    250   fPattern = pattern;
    251  
     263  */
     264
     265  if (fNumEvents++ < fNumEventsDump)
     266    return kTRUE;
     267 
     268  fNumEvents = 0;
    252269  //
    253270  // Finalize Possible calibration histogram classes...
     
    265282  *fLog << inf << GetDescriptor() << " : Finalize calibration calculations..." << flush;
    266283  if (fChargeCalc)
    267     fChargeCalc->CallPostProcess();
     284    fChargeCalc->Finalize();
    268285  if (fRelTimeCalc)
    269     fRelTimeCalc->CallPostProcess();
     286    fRelTimeCalc->Finalize();
     287  if (fCalibrate)
     288    {
     289      fCalibrate->SetCalibUpdate((MCalibrationChargeCam*)fIntensCharge->GetCam());
     290      fCalibrate->UpdateConversionFactors();
     291    }
    270292
    271293  ReInitialize();
     
    307329  *fLog << endl;
    308330 
     331  fNumCam++;
     332
    309333  if (fIntensBad)
    310334    {
    311       fIntensBad->AddToList(Form("MBadPixelsCam%s",GetNamePattern()),*fGeom);
    312       *fLog << inf << "New MBadPixelsCam with " << GetNamePattern() << endl;
    313     }
     335      fIntensBad->AddToList(Form("MBadPixelsCam%04d",fNumCam),*fGeom);
     336      *fLog << inf << "New MBadPixelsCam Nr. " << fNumCam << endl;
     337    }
     338
    314339  if (fIntensCharge)
    315340    {
    316       fIntensCharge->AddToList(Form("MCalibrationChargeCam%s",GetNamePattern()),*fGeom);
    317       *fLog << inf << "New MCalibrationChargeCam with " << GetNamePattern() << endl;
     341      fIntensCharge->AddToList(Form("MCalibrationChargeCam%04d",fNumCam),*fGeom);
     342      *fLog << inf << "New MCalibrationChargeCam Nr.  " << fNumCam << endl;
    318343    }
    319344  if (fIntensQE)
    320345    {
    321       fIntensQE->AddToList(Form("MCalibrationQECam%s",GetNamePattern()),*fGeom);
    322       *fLog << inf << "New MCalibrationQECam with " << GetNamePattern() << endl;
     346      fIntensQE->AddToList(Form("MCalibrationQECam%04d",fNumCam),*fGeom);
     347      *fLog << inf << "New MCalibrationQECam Nr.  " << fNumCam << endl;
    323348    }
    324349  if (fIntensBlind)
    325350    {
    326       fIntensBlind->AddToList(Form("MCalibrationBlindCam%s",GetNamePattern()),*fGeom);
    327       *fLog << inf << "New MCalibrationBlindCam with " << GetNamePattern() << endl;
     351      fIntensBlind->AddToList(Form("MCalibrationBlindCam%04d",fNumCam),*fGeom);
     352      *fLog << inf << "New MCalibrationBlindCam Nr. " << fNumCam << endl;
    328353    }
    329354
     
    332357}
    333358
    334 const char* MCalibCalcFromPast::GetNamePattern()
    335 {
    336 
    337   Float_t number[MCalibrationCam::gkNumPulserColors];
    338   memset(number,0,MCalibrationCam::gkNumPulserColors*sizeof(Float_t));
    339 
    340   enum ColorCode_t
    341     {
    342       k5LedGreen   = BIT(0 ),
    343       k2LedGreen   = BIT(1 ),
    344       k5LedBlue2   = BIT(2 ),     
    345       k1LedUV      = BIT(3 ),
    346       k2LedUV      = BIT(4 ),
    347       k5LedBlue3   = BIT(5 ),
    348       k5LedBlue4   = BIT(6 ),
    349       k2LedBlue    = BIT(7 ),
    350       k01LedBlue   = BIT(8 ),
    351       k1LedBlue    = BIT(10),
    352       k5LedUV1     = BIT(11),
    353       k5LedUV2     = BIT(12),
    354       k5LedBlue1   = BIT(13),
    355       k1LedGreen   = BIT(14),
    356       k01LedGreen  = BIT(15),
    357       kCT1Pulser   = BIT(16)
    358     };
    359 
    360   if (fPattern & k5LedGreen)
    361     number[MCalibrationCam::kGREEN] += 5;
    362   if (fPattern & k2LedGreen)
    363     number[MCalibrationCam::kGREEN] += 2;
    364   if (fPattern & k5LedBlue2)
    365     number[MCalibrationCam::kBLUE]  += 2;
    366   if (fPattern & k1LedUV)           
    367     number[MCalibrationCam::kUV]    += 1;
    368   if (fPattern & k2LedUV)           
    369     number[MCalibrationCam::kUV]    += 2;
    370   if (fPattern & k5LedBlue3)       
    371     number[MCalibrationCam::kBLUE]  += 5;
    372   if (fPattern & k5LedBlue4)       
    373     number[MCalibrationCam::kBLUE]  += 5;
    374   if (fPattern & k2LedBlue)         
    375     number[MCalibrationCam::kBLUE]  += 2;
    376   if (fPattern & k01LedBlue)       
    377     number[MCalibrationCam::kBLUE]  += 0.5;
    378   if (fPattern & k1LedBlue)         
    379     number[MCalibrationCam::kBLUE]  += 1;
    380   if (fPattern & k5LedUV1)         
    381     number[MCalibrationCam::kUV]    += 5;
    382   if (fPattern & k5LedUV2)       
    383     number[MCalibrationCam::kUV]    += 5;
    384   if (fPattern & k5LedBlue1)       
    385     number[MCalibrationCam::kBLUE]  += 5;
    386   if (fPattern & k1LedGreen)
    387     number[MCalibrationCam::kGREEN] += 1;
    388   if (fPattern & k01LedGreen)
    389     number[MCalibrationCam::kGREEN] += 0.5;
    390   if (fPattern & kCT1Pulser)
    391     number[MCalibrationCam::kCT1]   += 1;
    392 
    393   TString result;
    394  
    395   for (Int_t i=0; i<MCalibrationCam::gkNumPulserColors; i++)
    396     {
    397       switch (i)
    398         {
    399         case MCalibrationCam::kGREEN:
    400           if (number[i] > 0.1)
    401             result = Form("%2.1f%s",number[i],"GREEN");
    402           break;
    403         case MCalibrationCam::kBLUE:
    404           if (number[i] > 0.1)
    405             result = Form("%2.1f%s",number[i],"BLUE");
    406           break;
    407         case MCalibrationCam::kUV:
    408           if (number[i] > 0.1)
    409             result = Form("%2.1f%s",number[i],"UV");
    410           break;
    411         case MCalibrationCam::kCT1:
    412           if (number[i] > 0.1)
    413             result = Form("%2.1f%s",number[i],"CT1");
    414           break;
    415         }
    416     }
    417   return result.Data();
    418 }
     359Int_t MCalibCalcFromPast::PostProcess()
     360{
     361  *fLog << inf << GetDescriptor()
     362        << ": Number of Calibration Cams: " << fNumCam << endl;
     363  return kTRUE;
     364 
     365}
  • trunk/MagicSoft/Mars/mcalib/MCalibCalcFromPast.h

    r5799 r5856  
    88class MParList;
    99class MGeomCam;
    10 class MRawEvtHeader;
    1110class MRawRunHeader;
    1211class MPedCalcFromLoGain;
    1312class MCalibrationChargeCalc;
    1413class MCalibrationRelTimeCalc;
     14class MCalibrateData;
    1515class MCalibrationIntensityChargeCam;
    1616class MCalibrationIntensityBlindCam;
     
    2323private:
    2424
    25   static const UInt_t fgNumEventsDump;                //! Default for fNumEventsDump
     25  static const UInt_t fgNumEventsDump;               //! Default for fNumEventsDump
    2626 
    27   MRawEvtHeader                   *fHeader;          //!
    28   MRawRunHeader                   *fRunHeader;       //!
    29   MGeomCam                        *fGeom;            //!
    30   MParList                        *fParList;         //!
    31   MCalibrationIntensityChargeCam  *fIntensCharge;    //!
    32   MCalibrationIntensityBlindCam   *fIntensBlind;     //! 
    33   MCalibrationIntensityQECam      *fIntensQE;        //!
    34   MCalibrationIntensityRelTimeCam *fIntensRelTime;   //!
    35   MCalibrationIntensityHiLoCam    *fIntensHiLo;      //!
    36   MBadPixelsIntensityCam          *fIntensBad;       //!
     27  MRawRunHeader                   *fRunHeader;       //! Run Header
     28  MGeomCam                        *fGeom;            //! Camera Geometry
     29  MParList                        *fParList;         //! Parameter List
     30  MCalibrationIntensityChargeCam  *fIntensCharge;    //! Intensity Charge Cam (to be created)
     31  MCalibrationIntensityBlindCam   *fIntensBlind;     //! Intensity Blind  Cam (to be created)
     32  MCalibrationIntensityQECam      *fIntensQE;        //! Intensity QE     Cam (to be created)
     33  MCalibrationIntensityRelTimeCam *fIntensRelTime;   //! Intensity Rel. Time Cam (to be created)
     34  MCalibrationIntensityHiLoCam    *fIntensHiLo;      //! Intensity High-Vs.Low Cam (to be created)
     35  MBadPixelsIntensityCam          *fIntensBad;       //! Intensity Bad Pixels Cam (to be created)
    3736 
    38   MCalibrationChargeCalc          *fChargeCalc;      //!
    39   MCalibrationRelTimeCalc         *fRelTimeCalc;     //!
     37  MCalibrationChargeCalc          *fChargeCalc;      //! Charge Calibration Task
     38  MCalibrationRelTimeCalc         *fRelTimeCalc;     //! Rel. Times Calibratio Task
     39  MCalibrateData                  *fCalibrate;       //! Data Calibration Task
    4040                                                     
    4141  UInt_t fNumEventsDump;       // Number of event after which the MCalibrationCams gets updated
    42   UInt_t fPattern;             // Calibration bit pattern from digital modules
     42  UInt_t fNumEvents;           //! Event counter only for calibration events
     43  UInt_t fNumCam;              //! Number of currently used Calibration Cam
    4344 
    4445  Int_t  PreProcess(MParList *pList);
    4546  Int_t  Process();
    46  
     47  Int_t  PostProcess(); 
     48
    4749  Bool_t ReInitialize();
    4850  Bool_t Finalize(const char* name);
    49   const char* GetNamePattern();
    50  
     51
    5152public:
    5253
    53     MCalibCalcFromPast(const char *name=NULL, const char *title=NULL);
    54     ~MCalibCalcFromPast() {}
     54  MCalibCalcFromPast(const char *name=NULL, const char *title=NULL);
     55  ~MCalibCalcFromPast() {}
     56 
     57  UInt_t GetNumEventsDump() const   {  return fNumEventsDump;   }
     58 
     59  void SetNumEventsDump( const UInt_t i=fgNumEventsDump )   { fNumEventsDump = i; }
     60 
     61  void SetCalibrate    ( MCalibrateData          *c )  { fCalibrate   = c; }
     62  void SetChargeCalc   ( MCalibrationChargeCalc  *c )  { fChargeCalc  = c; }
     63  void SetRelTimeCalc  ( MCalibrationRelTimeCalc *c )  { fRelTimeCalc = c; }
     64 
     65  ClassDef(MCalibCalcFromPast, 1) // Task to steer the processing of interlace calibration events
     66};
    5567
    56     UInt_t GetNumEventsDump() const   {  return fNumEventsDump;   }
    57 
    58     void SetNumEventsDump( const UInt_t i=fgNumEventsDump )   { fNumEventsDump = i; }
    59 
    60     ClassDef(MCalibCalcFromPast, 1) // Task to steer the processing of interlace calibration events
    61 };
    62    
    6368#endif
    6469
Note: See TracChangeset for help on using the changeset viewer.