Changeset 4861 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
09/05/04 17:55:32 (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/MCalibColorSet.cc

    r4855 r4861  
    5252
    5353const Int_t MCalibColorSet::gkIFAEBoxInaugurationRun = 20113;
    54 
    5554// --------------------------------------------------------------------------
    5655//
     
    5857//
    5958MCalibColorSet::MCalibColorSet(const char *name, const char *title)
    60     : fHeader(0), fIsValid(kFALSE)
    61 {
    62     fName  = name  ? name  : "MCalibColorSet";
    63     fTitle = title ? title : "Task to set workaround missing colors calibration events";
    64 }
    65 
     59    : fHeader(0)
     60{
     61  fName  = name  ? name  : "MCalibColorSet";
     62  fTitle = title ? title : "Task to set workaround missing colors calibration events";
     63
     64  Clear();
     65}
     66
     67void MCalibColorSet::Clear(const Option_t *o)
     68{
     69 
     70  fPattern = 0;
     71  fIsValid = kFALSE;
     72 
     73}
     74
     75
     76// -----------------------------------------------------------------------------------
     77//
     78// The following container are searched for and execution aborted if not in MParList:
     79//  - MRawEvtHeader
     80//
    6681Int_t MCalibColorSet::PreProcess(MParList *pList)
    6782{
    68     fHeader = (MRawEvtHeader*)pList->FindObject("MRawEvtHeader");
    69     if (!fHeader)
    70     {
    71        *fLog << err << "MRawEvtHeader not found... abort." << endl;
    72         return kFALSE;
    73     }
    74     return kTRUE;
     83
     84  fHeader = (MRawEvtHeader*)pList->FindObject("MRawEvtHeader");
     85  if (!fHeader)
     86    {
     87      *fLog << err << "MRawEvtHeader not found... abort." << endl;
     88      return kFALSE;
     89    }
     90
     91  return kTRUE;
    7592}
    7693
    7794// --------------------------------------------------------------------------
    7895//
    79 //  Try to find 'MGeomCam' in the Parameter List. If it is not found,
    80 //  processing is stopped.
     96// Search for the following input containers and abort if not existing:
     97// - MRawRunHeader
     98//
     99// If Runnumber < gkIFAEBoxInaugurationRun, set colour pattern: 0
     100//
     101// If Runnumber > gkIFAEBoxInaugurationRun, search for colour in
     102// the project name: Set colour pattern according to the following
     103// convention:
     104//    Green: assume slot 1  ( 5 Leds Green)
     105//    Blue:  assume slot 14 ( 5 Leds Blue )
     106//    UV:    assume slot 12 ( 5 Leds UV   )
     107//    CT1:   take  'slot 17'
    81108//
    82109Bool_t MCalibColorSet::ReInit(MParList *pList)
    83110{
    84     fIsValid = kFALSE;
    85 
    86     MRawRunHeader *header = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
    87     if (!header)
    88     {
    89        *fLog << err << "MRawRunHeader not found... abort." << endl;
    90         return kFALSE;
    91     }
    92 
    93     enum { kNONE, kGREEN, kBLUE, kUV, kCT1 };
    94 
    95     Int_t color = kNONE;
    96 
    97     const Int_t num = header->GetRunNumber();
    98     if (num<gkIFAEBoxInaugurationRun)
    99     {
    100         *fLog << inf << "Run taken before inauguration of IFAE-box... using CT1 pulser." << endl;
    101         color = kCT1;
    102         return kTRUE;
    103     }
    104 
    105     switch (num)
     111
     112  Clear();
     113
     114  MRawRunHeader *header = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
     115  if (!header)
     116    {
     117      *fLog << err << "MRawRunHeader not found... abort." << endl;
     118      return kFALSE;
     119    }
     120 
     121  enum { kNONE, kGREEN, kBLUE, kUV, kCT1 };
     122 
     123  enum ColorCode_t
     124    {
     125      k5LedGreen   = BIT(1),
     126      k5LedUV      = BIT(12),
     127      k5LedBlue    = BIT(14),
     128      kCT1Pulser   = BIT(17)
     129    };
     130
     131  const Int_t num = header->GetRunNumber();
     132
     133  if (num<gkIFAEBoxInaugurationRun)
     134    {
     135      *fLog << inf << "Run taken before inauguration of IFAE-box... using CT1 pulser." << endl;
     136      fPattern |= kCT1Pulser;
     137      fIsValid  = kTRUE;
     138      return kTRUE;
     139    }
     140 
     141  Int_t color = kNONE;
     142
     143  switch (num)
    106144    {
    107145    case 26402:
    108146    case 22246:
    109147    case 22253:
    110         color = kBLUE;
    111         break;
    112 
     148      color = kBLUE;
     149      break;
     150     
    113151    case 30090:
    114152    case 20660:
     
    119157    case 26568:
    120158    case 26924:
     159      color = kGREEN;
     160      break;
     161     
     162    case 27474:
     163      *fLog << err << "Sorry, run 27474 was taken with CLOSED LIDS. It should not be used! " << endl;
     164      return kFALSE;
     165    }
     166 
     167  if (color!=kNONE)
     168    *fLog << inf << "Color determined from the run-number... ";
     169  else
     170    {
     171      const TString proj = header->GetProjectName();
     172     
     173      if (proj.Contains("gree",TString::kIgnoreCase))
    121174        color = kGREEN;
    122         break;
    123 
    124     case 27474:
    125         *fLog << err << "Sorry, run 27474 was taken with CLOSED LIDS. It should not be used! " << endl;
    126         return kFALSE;
    127     }
    128 
    129     if (color!=kNONE)
    130         *fLog << inf << "Color determined from the run-number... ";
    131     else
    132     {
    133         const TString proj = header->GetProjectName();
    134 
    135         if (proj.Contains("green",TString::kIgnoreCase))
    136             color = kGREEN;
    137         if (proj.Contains("blue",TString::kIgnoreCase))
    138             color = kBLUE;
    139         if (proj.Contains("uv",TString::kIgnoreCase))
    140             color = kUV;
    141         if (proj.Contains("ct1",TString::kIgnoreCase))
    142             color = kCT1;
    143 
    144         *fLog << inf << "Color determined from project-name (" << proj << ")... ";
    145     }
    146 
    147     if (color==kNONE)
    148     {
    149         *fLog << err << "Sorry, calibration run was taken before the events could be" << endl;
    150         *fLog << "flagged with a color by the digital modul and no color" << endl;
    151         *fLog << "could be determined... abort." << endl;
    152         return kFALSE;
    153     }
    154 
    155     switch (color)
    156     {
    157     case kGREEN: *fLog << "Green."; fPattern = 0; break;
    158     case kBLUE:  *fLog << "Blue.";  fPattern = 0; break;
    159     case kUV:    *fLog << "UV.";    fPattern = 0; break;
    160     case kCT1:   *fLog << "CT1.";   fPattern = 0; break;
    161     }
    162     *fLog << endl;
    163 
    164     fIsValid = kTRUE;
    165 
     175      if (proj.Contains("blue",TString::kIgnoreCase))
     176        color = kBLUE;
     177      if (proj.Contains("uv",TString::kIgnoreCase))
     178        color = kUV;
     179      if (proj.Contains("ct1",TString::kIgnoreCase))
     180        color = kCT1;
     181     
     182      *fLog << inf << "Color determined from project-name (" << proj << ")... ";
     183    }
     184 
     185  if (color==kNONE)
     186    {
     187      *fLog << err << "Sorry, calibration run was taken before the events could be" << endl;
     188      *fLog << "flagged with a color by the digital modul and no color" << endl;
     189      *fLog << "could be determined... abort." << endl;
     190      return kFALSE;
     191    }
     192 
     193  switch (color)
     194    {
     195    case kGREEN: *fLog << "Green."; fPattern |= k5LedGreen; break;
     196    case kBLUE:  *fLog << "Blue.";  fPattern |= k5LedBlue ; break;
     197    case kUV:    *fLog << "UV.";    fPattern |= k5LedUV   ; break;
     198    case kCT1:   *fLog << "CT1.";   fPattern |= kCT1Pulser; break;
     199    }
     200  *fLog << endl;
     201 
     202  fIsValid = kTRUE;
     203 
     204  return kTRUE;
     205}
     206
     207Int_t MCalibColorSet::Process()
     208{
     209    if (fIsValid)
     210      fHeader->SetCalibrationPattern(fPattern);
    166211    return kTRUE;
    167212}
    168 
    169 Int_t MCalibColorSet::Process()
    170 {
    171     if (fIsValid)
    172         fHeader->SetCalibrationPattern(fPattern);
    173     return kTRUE;
    174 }
  • trunk/MagicSoft/Mars/mcalib/MCalibColorSet.h

    r4845 r4861  
    2626    MCalibColorSet(const char *name=NULL, const char *title=NULL);
    2727
     28    void Clear(const Option_t *o="");
     29
    2830    ClassDef(MCalibColorSet, 0) // Task to workaround missing colors
    2931};
Note: See TracChangeset for help on using the changeset viewer.