Ignore:
Timestamp:
05/25/08 11:28:15 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mtrigger
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mtrigger/MFTriggerPattern.cc

    r8787 r8898  
    1919!   Author(s): Thomas Bretz  12/2004 <mailto:tbretz@astro.uni-wuerzburg.de>
    2020!
    21 !   Copyright: MAGIC Software Development, 2004-2007
     21!   Copyright: MAGIC Software Development, 2004-2008
    2222!
    2323\* ======================================================================== */
     
    3232//
    3333// For more details see: MTriggerPattern
     34//
     35//
     36// Input Containers:
     37//   MTriggerPattern
     38//
    3439//
    3540/////////////////////////////////////////////////////////////////////////////
     
    6772    fMaskRequiredPrescaled   = trigpatt.fMaskRequiredPrescaled;
    6873    fMaskRequiredUnprescaled = trigpatt.fMaskRequiredUnprescaled;
     74
     75    fMaskDeniedPrescaled     = trigpatt.fMaskDeniedPrescaled;
     76    fMaskDeniedUnprescaled   = trigpatt.fMaskDeniedUnprescaled;
     77
     78    fDefault                 = trigpatt.fDefault;
    6979}
    7080
    7181
    7282// --------------------------------------------------------------------------
     83//
     84// Search for MTriggerPattern in the paremeter list.
    7385//
    7486Int_t MFTriggerPattern::PreProcess(MParList *pList)
     
    8597
    8698// --------------------------------------------------------------------------
     99//
     100// If Prescaled and Unprescaled pattern is 0 return default.
     101// If all bits of the fMaskRequired* mask are found in the pattern set
     102// fResult to true.
     103// If any bit matches the fMasDenied* mask fResult is forced to be false.
    87104//
    88105Int_t MFTriggerPattern::Process()
     
    110127}
    111128
    112 void MFTriggerPattern::RequireTriggerLvl1(Prescale_t prescaled)
    113 {
    114     prescaled==kPrescaled ? (fMaskRequiredPrescaled |= MTriggerPattern::kTriggerLvl1) : (fMaskRequiredUnprescaled |= MTriggerPattern::kTriggerLvl1);
    115 }
    116 
    117 void MFTriggerPattern::RequireTriggerLvl2(Prescale_t prescaled)
    118 {
    119     prescaled==kPrescaled ? (fMaskRequiredPrescaled |= MTriggerPattern::kTriggerLvl2) : (fMaskRequiredUnprescaled |= MTriggerPattern::kTriggerLvl2);
    120 }
    121 
    122 void MFTriggerPattern::RequireCalibration(Prescale_t prescaled)
    123 {
    124     prescaled==kPrescaled ? (fMaskRequiredPrescaled |= MTriggerPattern::kCalibration) : (fMaskRequiredUnprescaled |= MTriggerPattern::kCalibration);
    125 }
    126 
    127 void MFTriggerPattern::RequirePedestal(Prescale_t prescaled)
    128 {
    129     prescaled==kPrescaled ? (fMaskRequiredPrescaled |= MTriggerPattern::kPedestal)    : (fMaskRequiredUnprescaled |= MTriggerPattern::kPedestal);
    130 }
    131 
    132 void MFTriggerPattern::RequirePinDiode(Prescale_t prescaled)
    133 {
    134     prescaled==kPrescaled ? (fMaskRequiredPrescaled |= MTriggerPattern::kPinDiode)    : (fMaskRequiredUnprescaled |= MTriggerPattern::kPinDiode);
    135 }
    136 
    137 void MFTriggerPattern::RequireSumTrigger(Prescale_t prescaled)
    138 {
    139     prescaled==kPrescaled ? (fMaskRequiredPrescaled |= MTriggerPattern::kSumTrigger)  : (fMaskRequiredUnprescaled |= MTriggerPattern::kSumTrigger);
    140 }
    141 
    142 
    143 void MFTriggerPattern::DenyTriggerLvl1(Prescale_t prescaled)
    144 {
    145     prescaled==kPrescaled ? (fMaskDeniedPrescaled |= MTriggerPattern::kTriggerLvl1) : (fMaskDeniedUnprescaled |= MTriggerPattern::kTriggerLvl1);
    146 }
    147 
    148 void MFTriggerPattern::DenyTriggerLvl2(Prescale_t prescaled)
    149 {
    150     prescaled==kPrescaled ? (fMaskDeniedPrescaled |= MTriggerPattern::kTriggerLvl2) : (fMaskDeniedUnprescaled |= MTriggerPattern::kTriggerLvl2);
    151 }
    152 
    153 void MFTriggerPattern::DenyCalibration(Prescale_t prescaled)
    154 {
    155     prescaled==kPrescaled ? (fMaskDeniedPrescaled |= MTriggerPattern::kCalibration) : (fMaskDeniedUnprescaled |= MTriggerPattern::kCalibration);
    156 }
    157 
    158 void MFTriggerPattern::DenyPedestal(Prescale_t prescaled)
    159 {
    160     prescaled==kPrescaled ? (fMaskDeniedPrescaled |= MTriggerPattern::kPedestal)    : (fMaskDeniedUnprescaled |= MTriggerPattern::kPedestal);
    161 }
    162 
    163 void MFTriggerPattern::DenyPinDiode(Prescale_t prescaled)
    164 {
    165     prescaled==kPrescaled ? (fMaskDeniedPrescaled |= MTriggerPattern::kPinDiode)    : (fMaskDeniedUnprescaled |= MTriggerPattern::kPinDiode);
    166 }
    167 
    168 void MFTriggerPattern::DenySumTrigger(Prescale_t prescaled)
    169 {
    170     prescaled==kPrescaled ? (fMaskDeniedPrescaled |= MTriggerPattern::kSumTrigger)  : (fMaskDeniedUnprescaled |= MTriggerPattern::kSumTrigger);
     129// -------------------------------------------------------------------------
     130//
     131// Require that a prescaled or unprescaled bit in the trigger pattern is
     132// passed. The bit is defined by mask, the prescaling by prescaled. The
     133// default is unprescaled.
     134//
     135// Because it doesn't make sense to require a denied bit we reset
     136// the deny bit at the same time.
     137//
     138void MFTriggerPattern::Require(const Byte_t mask, Prescale_t prescaled=kUnPrescaled)
     139{
     140    prescaled==kPrescaled ? (fMaskRequiredPrescaled |=  mask) : (fMaskRequiredUnprescaled |=  mask);
     141    prescaled==kPrescaled ? (fMaskDeniedPrescaled   &= ^mask) : (fMaskDeniedUnprescaled   &= ^mask);
     142}
     143
     144// -------------------------------------------------------------------------
     145//
     146// Deny that a prescaled or unprescaled bit in the trigger pattern is
     147// passed. The bit is defined by mask, the prescaling by prescaled. The
     148// default is unprescaled.
     149//
     150// Because it doesn't make sense to deny a required bit we reset
     151// the require bit at the same time.
     152//
     153void MFTriggerPatter::Deny(const Byte_t mask, Prescale_t prescaled=kUnPrescaled)
     154{
     155    prescaled==kPrescaled ? (fMaskDeniedPrescaled   |=  mask) : (fMaskDeniedUnprescaled   |=  mask);
     156    prescaled==kPrescaled ? (fMaskRequiredPrescaled &= ^mask) : (fMaskRequiredUnprescaled &= ^mask);
     157}
     158
     159// -------------------------------------------------------------------------
     160//
     161// Remove the given bits from the deny-mask. Thus you can first deny
     162// all bits to pass and then define which bit you want to allow
     163// to pass. The bit is defined by mask, the prescaling by prescaled. The
     164// default is unprescaled.
     165//
     166void MFTriggerPatter::Allow(const Byte_t mask, Prescale_t prescaled=kUnPrescaled)
     167{
     168    prescaled==kPrescaled ? (fMaskDeniedPrescaled &= ^mask) : (fMaskDeniedUnprescaled &= ^mask);
     169}
     170
     171
     172// -------------------------------------------------------------------------
     173//
     174// Deny all bits (i.e. also require non bits) for the given prescaling
     175// option. The prescaling is defined by prescaled. The default is
     176// unprescaled.
     177//
     178void MFTriggerPattern::DenyAll(Prescale_t prescaled)
     179{
     180    Deny(0xff, prescaled);
     181}
     182
     183// -------------------------------------------------------------------------
     184//
     185// Allow all bits. resets the deny mask for the given prescaling option,
     186// but keeps the require mask unchanged. The prescaling is defined
     187// by prescaled. The default is unprescaled.
     188//
     189void MFTriggerPattern::AllowAll(Prescale_t prescaled)
     190{
     191    prescaled==kPrescaled ? (fMaskDeniedPrescaled = 0) : (fMaskDeniedUnprescaled = 0);
    171192}
    172193
     
    268289// This method is there because is not possible to deny trigger patterns
    269290// using only the Require pattern. Possible arguments are (upper/lower
    270 // case is ignored):
    271 //
    272 //           "LT1"  : Trigger Level 1 flag
    273 //           "CAL"  : Calibration flag
    274 //           "LT2"  : Trigger Level 2 flag
    275 //           "PED"  : Pedestal flag
    276 //           "PIND" : Pin Diode flag
    277 //           "SUMT" : Sum Trigger flag
     291// case is ignored) the flags for:
     292//
     293//           "LT1"  : Trigger Level 1
     294//           "CAL"  : Calibration
     295//           "LT2"  : Trigger Level 2
     296//           "PED"  : Pedestal
     297//           "PIND" : Pin Diode
     298//           "SUMT" : Sum Trigger
    278299//
    279300// concatenations of these strings are allowed and considered as
     
    304325        DenySumTrigger(prescaled);
    305326}
    306 
    307 // --------------------------------------------------------------------------
    308 //
    309 Bool_t MFTriggerPattern::IsExpressionTrue() const
    310 {
    311     return fResult;
    312 }
  • trunk/MagicSoft/Mars/mtrigger/MFTriggerPattern.h

    r8787 r8898  
    2525
    2626  Bool_t fDefault;                  // Default which is used if trigger pattern has default value (p==0&&u==0)
    27   Bool_t fResult;                   //!
     27  Bool_t fResult;                   //! Calculated result to be returned by IsExpressionTrue
    2828
     29  // MFTriggerPattern
     30  void Require(const Byte_t mask, Prescale_t prescaled=kUnPrescaled);
     31  void Deny(const Byte_t mask, Prescale_t prescaled=kUnPrescaled);
     32  void Allow(const Byte_t mask, Prescale_t prescaled=kUnPrescaled);
     33
     34  // MTask
    2935  Int_t PreProcess(MParList *pList);
    3036  Int_t Process();
    3137
    32   Bool_t IsExpressionTrue() const;
     38  // MFilter
     39  Bool_t IsExpressionTrue() const { return fResult; }
    3340
    3441public:
     
    3643  MFTriggerPattern(MFTriggerPattern &trigpatt);
    3744
    38   void RequireTriggerLvl1(Prescale_t prescaled=kUnPrescaled);
    39   void RequireTriggerLvl2(Prescale_t prescaled=kUnPrescaled);
    40   void RequireCalibration(Prescale_t prescaled=kUnPrescaled);
    41   void RequirePedestal(Prescale_t prescaled=kUnPrescaled);
    42   void RequirePinDiode(Prescale_t prescaled=kUnPrescaled);
    43   void RequireSumTrigger(Prescale_t prescaled=kUnPrescaled);
     45  // Setter
     46  void RequireTriggerLvl1(Prescale_t prescaled=kUnPrescaled) { Require(MTriggerPattern::kTriggerLvl1, prescaled); }
     47  void RequireTriggerLvl2(Prescale_t prescaled=kUnPrescaled) { Require(MTriggerPattern::kTriggerLvl2, prescaled); }
     48  void RequireCalibration(Prescale_t prescaled=kUnPrescaled) { Require(MTriggerPattern::kCalibration, prescaled); }
     49  void RequirePedestal(Prescale_t prescaled=kUnPrescaled)    { Require(MTriggerPattern::kPedestal, prescaled);    }
     50  void RequirePinDiode(Prescale_t prescaled=kUnPrescaled)    { Require(MTriggerPattern::kPinDiode, prescaled);    }
     51  void RequireSumTrigger(Prescale_t prescaled=kUnPrescaled)  { Require(MTriggerPattern::kSumTrigger, prescaled);  }
    4452
    45   void DenyTriggerLvl1(Prescale_t prescaled=kUnPrescaled);
    46   void DenyTriggerLvl2(Prescale_t prescaled=kUnPrescaled);
    47   void DenyCalibration(Prescale_t prescaled=kUnPrescaled);
    48   void DenyPedestal(Prescale_t prescaled=kUnPrescaled);
    49   void DenyPinDiode(Prescale_t prescaled=kUnPrescaled);
    50   void DenySumTrigger(Prescale_t prescaled=kUnPrescaled);
     53  void DenyTriggerLvl1(Prescale_t prescaled=kUnPrescaled)    { Deny(MTriggerPattern::kTriggerLvl1, prescaled); }
     54  void DenyTriggerLvl2(Prescale_t prescaled=kUnPrescaled)    { Deny(MTriggerPattern::kTriggerLvl2, prescaled); }
     55  void DenyCalibration(Prescale_t prescaled=kUnPrescaled)    { Deny(MTriggerPattern::kCalibration, prescaled); }
     56  void DenyPedestal(Prescale_t prescaled=kUnPrescaled)       { Deny(MTriggerPattern::kPedestal, prescaled);    }
     57  void DenyPinDiode(Prescale_t prescaled=kUnPrescaled)       { Deny(MTriggerPattern::kPinDiode, prescaled);    }
     58  void DenySumTrigger(Prescale_t prescaled=kUnPrescaled)     { Deny(MTriggerPattern::kSumTrigger, prescaled);  }
     59
     60  void AllowTriggerLvl1(Prescale_t prescaled=kUnPrescaled)   { Allow(MTriggerPattern::kTriggerLvl1, prescaled); }
     61  void AllowTriggerLvl2(Prescale_t prescaled=kUnPrescaled)   { Allow(MTriggerPattern::kTriggerLvl2, prescaled); }
     62  void AllowCalibration(Prescale_t prescaled=kUnPrescaled)   { Allow(MTriggerPattern::kCalibration, prescaled); }
     63  void AllowPedestal(Prescale_t prescaled=kUnPrescaled)      { Allow(MTriggerPattern::kPedestal, prescaled);    }
     64  void AllowPinDiode(Prescale_t prescaled=kUnPrescaled)      { Allow(MTriggerPattern::kPinDiode, prescaled);    }
     65  void AllowSumTrigger(Prescale_t prescaled=kUnPrescaled)    { Allow(MTriggerPattern::kSumTrigger, prescaled);  }
     66
     67  void DenyAll(Prescale_t prescaled=kUnPrescaled);
     68  void AllowAll(Prescale_t prescaled=kUnPrescaled);
    5169
    5270  void Require(TString patt, Prescale_t prescaled=kUnPrescaled);
  • trunk/MagicSoft/Mars/mtrigger/MTriggerPattern.cc

    r8892 r8898  
    5252// 2) The second concerns prescaled triggers.
    5353//
    54 // The prescaler is a devise installed AFTER the LT2. It collects
     54// The prescaler is a devicee installed AFTER the LT2. It collects
    5555// all kind of triggers and can prescale each trigger by a different
    5656// prescaling factor. This means that we can set the prescaler to
Note: See TracChangeset for help on using the changeset viewer.