CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
l1t::EnergySumCondition Class Reference

#include <EnergySumCondition.h>

Inheritance diagram for l1t::EnergySumCondition:
l1t::ConditionEvaluation

Public Member Functions

 EnergySumCondition ()
 
 EnergySumCondition (const GlobalCondition *, const GlobalBoard *)
 from base template condition (from event setup usually) More...
 
 EnergySumCondition (const EnergySumCondition &)
 
const bool evaluateCondition (const int bxEval) const override
 the core function to check if the condition matches More...
 
const GlobalBoardgetuGtB () const
 get / set the pointer to uGt GlobalBoard More...
 
const EnergySumTemplategtEnergySumTemplate () const
 get / set the pointer to a L1GtCondition More...
 
EnergySumConditionoperator= (const EnergySumCondition &)
 
void print (std::ostream &myCout) const override
 print condition More...
 
void setGtEnergySumTemplate (const EnergySumTemplate *)
 
void setuGtB (const GlobalBoard *)
 set the pointer to uGT GlobalBoard More...
 
 ~EnergySumCondition () override
 
- Public Member Functions inherited from l1t::ConditionEvaluation
 ConditionEvaluation ()
 constructor More...
 
bool condLastResult () const
 get the latest result for the condition More...
 
int condMaxNumberObjects () const
 
void evaluateConditionStoreResult (const int bxEval)
 call evaluateCondition and save last result More...
 
CombinationsInCond const & getCombinationsInCond () const
 get all the object combinations evaluated to true in the condition More...
 
virtual std::string getNumericExpression () const
 get numeric expression More...
 
void setCondMaxNumberObjects (int condMaxNumberObjectsValue)
 
void setVerbosity (const int verbosity)
 
virtual ~ConditionEvaluation ()
 destructor More...
 

Private Member Functions

void copy (const EnergySumCondition &cp)
 copy function for copy constructor and operator= More...
 

Private Attributes

const EnergySumTemplatem_gtEnergySumTemplate
 pointer to a EnergySumTemplate More...
 
const GlobalBoardm_uGtB
 pointer to uGt GlobalBoard, to be able to get the trigger objects More...
 

Additional Inherited Members

- Protected Member Functions inherited from l1t::ConditionEvaluation
template<class Type1 >
const bool checkBit (const Type1 &mask, const unsigned int bitNumber) const
 check if a bit with a given number is set in a mask More...
 
template<class Type1 >
const bool checkIndex (const Type1 &indexLo, const Type1 &indexHi, const unsigned int index) const
 check if a index is in a given range More...
 
template<class Type1 >
const bool checkRangeDeltaEta (const unsigned int obj1Eta, const unsigned int obj2Eta, const Type1 &lowerR, const Type1 &upperR, const unsigned int nEtaBits) const
 check if a value is in a given range More...
 
template<class Type1 >
const bool checkRangeDeltaPhi (const unsigned int obj1Phi, const unsigned int obj2Phi, const Type1 &lowerR, const Type1 &upperR) const
 check if a value is in a given range More...
 
template<class Type1 >
const bool checkRangeEta (const unsigned int bitNumber, const Type1 &W1beginR, const Type1 &W1endR, const Type1 &W2beginR, const Type1 &W2endR, const unsigned int nEtaBits) const
 check if a value is in a given range and outside of a veto range More...
 
template<class Type1 >
const bool checkRangePhi (const unsigned int bitNumber, const Type1 &W1beginR, const Type1 &W1endR, const Type1 &W2beginR, const Type1 &W2endR) const
 check if a value is in a given range and outside of a veto range More...
 
template<class Type1 , class Type2 >
const bool checkThreshold (const Type1 &thresholdL, const Type1 &thresholdH, const Type2 &value, bool condGEqValue) const
 
CombinationsInCondcombinationsInCond () const
 get all the object combinations (to fill it...) More...
 
- Protected Attributes inherited from l1t::ConditionEvaluation
CombinationsInCond m_combinationsInCond
 store all the object combinations evaluated to true in the condition More...
 
bool m_condLastResult
 the last result of evaluateCondition() More...
 
int m_condMaxNumberObjects
 
int m_verbosity
 verbosity level More...
 

Detailed Description

Definition at line 37 of file EnergySumCondition.h.

Constructor & Destructor Documentation

EnergySumCondition::EnergySumCondition ( )

constructors default

Definition at line 36 of file EnergySumCondition.cc.

36  :
38 
39  //empty
40 
41 }
EnergySumCondition::EnergySumCondition ( const GlobalCondition eSumTemplate,
const GlobalBoard ptrGTB 
)

from base template condition (from event setup usually)

Definition at line 44 of file EnergySumCondition.cc.

References l1t::ConditionEvaluation::m_condMaxNumberObjects.

44  :
46  m_gtEnergySumTemplate(static_cast<const EnergySumTemplate*>(eSumTemplate)),
47  m_uGtB(ptrGTB)
48 
49 {
50 
51  // maximum number of objects received for the evaluation of the condition
52  // energy sums are global quantities - one object per event
53 
55 
56 }
const GlobalBoard * m_uGtB
pointer to uGt GlobalBoard, to be able to get the trigger objects
const EnergySumTemplate * m_gtEnergySumTemplate
pointer to a EnergySumTemplate
EnergySumCondition::EnergySumCondition ( const EnergySumCondition cp)

Definition at line 72 of file EnergySumCondition.cc.

References copy().

72  :
74 
75  copy(cp);
76 
77 }
void copy(const EnergySumCondition &cp)
copy function for copy constructor and operator=
EnergySumCondition::~EnergySumCondition ( )
override

Definition at line 80 of file EnergySumCondition.cc.

80  {
81 
82  // empty
83 
84 }

Member Function Documentation

void EnergySumCondition::copy ( const EnergySumCondition cp)
private

copy function for copy constructor and operator=

Definition at line 59 of file EnergySumCondition.cc.

References l1t::ConditionEvaluation::condLastResult(), l1t::ConditionEvaluation::condMaxNumberObjects(), l1t::ConditionEvaluation::getCombinationsInCond(), getuGtB(), gtEnergySumTemplate(), l1t::ConditionEvaluation::m_combinationsInCond, l1t::ConditionEvaluation::m_condLastResult, l1t::ConditionEvaluation::m_condMaxNumberObjects, m_gtEnergySumTemplate, m_uGtB, and l1t::ConditionEvaluation::m_verbosity.

Referenced by EnergySumCondition(), getuGtB(), and operator=().

59  {
60 
61  m_gtEnergySumTemplate = cp.gtEnergySumTemplate();
62  m_uGtB = cp.getuGtB();
63 
64  m_condMaxNumberObjects = cp.condMaxNumberObjects();
65  m_condLastResult = cp.condLastResult();
66  m_combinationsInCond = cp.getCombinationsInCond();
67 
68  m_verbosity = cp.m_verbosity;
69 
70 }
const GlobalBoard * m_uGtB
pointer to uGt GlobalBoard, to be able to get the trigger objects
const EnergySumTemplate * m_gtEnergySumTemplate
pointer to a EnergySumTemplate
CombinationsInCond m_combinationsInCond
store all the object combinations evaluated to true in the condition
int m_verbosity
verbosity level
bool m_condLastResult
the last result of evaluateCondition()
const bool EnergySumCondition::evaluateCondition ( const int  bxEval) const
overridevirtual

the core function to check if the condition matches

Implements l1t::ConditionEvaluation.

Definition at line 108 of file EnergySumCondition.cc.

References BXVector< T >::at(), l1t::ConditionEvaluation::checkBit(), l1t::ConditionEvaluation::checkRangePhi(), l1t::ConditionEvaluation::checkThreshold(), hitfit::clear(), l1t::ConditionEvaluation::combinationsInCond(), GlobalCondition::condGEq(), GlobalCondition::condRelativeBx(), EnergySumTemplate::ObjectParameter::etHighThreshold, EnergySumTemplate::ObjectParameter::etLowThreshold, l1t::GlobalBoard::getCandL1EtSum(), BXVector< T >::getLastBX(), l1t::EtSum::getType(), l1t::gtAsymmetryEt, l1t::gtAsymmetryEtHF, l1t::gtAsymmetryHt, l1t::gtAsymmetryHtHF, l1t::gtCentrality0, l1t::gtCentrality1, l1t::gtCentrality2, l1t::gtCentrality3, l1t::gtCentrality4, l1t::gtCentrality5, l1t::gtCentrality6, l1t::gtCentrality7, l1t::gtETM, l1t::gtETMHF, l1t::gtETT, l1t::gtETTem, l1t::gtHTM, l1t::gtHTT, l1t::gtMinBiasHFM0, l1t::gtMinBiasHFM1, l1t::gtMinBiasHFP0, l1t::gtMinBiasHFP1, l1t::gtTowerCount, l1t::L1Candidate::hwPhi(), l1t::L1Candidate::hwPt(), L1Analysis::kAsymEt, L1Analysis::kAsymEtHF, L1Analysis::kAsymHt, L1Analysis::kAsymHtHF, L1Analysis::kCentrality, L1Analysis::kMinBiasHFM0, L1Analysis::kMinBiasHFM1, L1Analysis::kMinBiasHFP0, L1Analysis::kMinBiasHFP1, L1Analysis::kMissingEt, L1Analysis::kMissingEtHF, L1Analysis::kMissingHt, L1Analysis::kTotalEt, L1Analysis::kTotalEtEm, L1Analysis::kTotalHt, L1Analysis::kTowerCount, LogDebug, m_gtEnergySumTemplate, m_uGtB, EnergySumTemplate::objectParameter(), GlobalCondition::objectType(), EnergySumTemplate::ObjectParameter::phiWindow1Lower, EnergySumTemplate::ObjectParameter::phiWindow1Upper, EnergySumTemplate::ObjectParameter::phiWindow2Lower, EnergySumTemplate::ObjectParameter::phiWindow2Upper, and BXVector< T >::size().

108  {
109 
110  // number of trigger objects in the condition
111  // in fact, there is only one object
112  int iCondition = 0;
113 
114  // condition result condResult set to true if the energy sum
115  // passes all requirements
116  bool condResult = false;
117 
118  // store the indices of the calorimeter objects
119  // from the combination evaluated in the condition
120  SingleCombInCond objectsInComb;
121 
122  // clear the m_combinationsInCond vector
124 
125  // clear the indices in the combination
126  objectsInComb.clear();
127 
129 
130  // Look at objects in bx = bx + relativeBx
131  int useBx = bxEval + m_gtEnergySumTemplate->condRelativeBx();
132 
133  // Fail condition if attempting to get Bx outside of range
134  if( ( useBx < candVec->getFirstBX() ) ||
135  ( useBx > candVec->getLastBX() ) ) {
136  return false;
137  }
138 
139  // If no candidates, no use looking any further.
140  int numberObjects = candVec->size(useBx);
141  if (numberObjects < 1) {
142  return false;
143  }
144 
145 
147  bool MissingEnergy = false;
148  int centbit=0;
149  switch( (m_gtEnergySumTemplate->objectType())[0] ){
150  case gtETM:
152  MissingEnergy = true;
153  break;
154  case gtETT:
156  MissingEnergy = false;
157  break;
158  case gtETTem:
160  MissingEnergy = false;
161  break;
162  case gtHTM:
164  MissingEnergy = true;
165  break;
166  case gtHTT:
168  MissingEnergy = false;
169  break;
170  case gtETMHF:
172  MissingEnergy = true;
173  break;
174  case gtTowerCount:
176  MissingEnergy = false;
177  break;
178  case gtMinBiasHFP0:
180  MissingEnergy = false;
181  break;
182  case gtMinBiasHFM0:
184  MissingEnergy = false;
185  break;
186  case gtMinBiasHFP1:
188  MissingEnergy = false;
189  break;
190  case gtMinBiasHFM1:
192  MissingEnergy = false;
193  break;
194  case gtAsymmetryEt:
196  MissingEnergy = false;
197  break;
198  case gtAsymmetryHt:
200  MissingEnergy = false;
201  break;
202  case gtAsymmetryEtHF:
204  MissingEnergy = false;
205  break;
206  case gtAsymmetryHtHF:
208  MissingEnergy = false;
209  break;
210  case gtCentrality0:
211  centbit=0;
213  MissingEnergy = false;
214  break;
215  case gtCentrality1:
216  centbit=1;
218  MissingEnergy = false;
219  break;
220  case gtCentrality2:
221  centbit=2;
223  MissingEnergy = false;
224  break;
225  case gtCentrality3:
226  centbit=3;
228  MissingEnergy = false;
229  break;
230  case gtCentrality4:
231  centbit=4;
233  MissingEnergy = false;
234  break;
235  case gtCentrality5:
236  centbit=5;
238  MissingEnergy = false;
239  break;
240  case gtCentrality6:
241  centbit=6;
243  MissingEnergy = false;
244  break;
245  case gtCentrality7:
246  centbit=7;
248  MissingEnergy = false;
249  break;
250  default:
251  edm::LogError("L1TGlobal")
252  << "\n Error: "
253  << "Unmatched object type from template to EtSumType, (m_gtEnergySumTemplate->objectType())[0] = "
255  << std::endl;
257  break;
258  }
259 
260 
261  // get energy, phi (ETM and HTM) and overflow for the trigger object
262  unsigned int candEt = 0;
263  unsigned int candPhi = 0;
264  bool candOverflow = false;
265  for( int iEtSum = 0; iEtSum < numberObjects; ++iEtSum ){
266  l1t::EtSum cand = *(candVec->at(useBx,iEtSum));
267  if( cand.getType() != type ) continue;
268  candEt = cand.hwPt();
269  candPhi = cand.hwPhi();
270  }
271 
272 
274  ( *(m_gtEnergySumTemplate->objectParameter()) )[iCondition];
275 
276  // check energy threshold and overflow
277  // overflow evaluation:
278  // for condGEq >=
279  // candidate overflow true -> condition true
280  // candidate overflow false -> evaluate threshold
281  // for condGEq =
282  // candidate overflow true -> condition false
283  // candidate overflow false -> evaluate threshold
284  //
285 
286  bool condGEqVal = m_gtEnergySumTemplate->condGEq();
287 
289  bool myres=checkBit(candEt,centbit);
290  //std::cout << "CCLC: Checking bit " << centbit << "\tResult is: " << myres << std::endl;
291  if (!myres){
292  LogDebug("L1TGlobal") << "\t\t l1t::EtSum failed Centrality bit" << std::endl;
293  return false;
294  }
295  }else{
296  // check energy threshold
297  if ( !checkThreshold(objPar.etLowThreshold, objPar.etHighThreshold, candEt, condGEqVal) ) {
298  LogDebug("L1TGlobal") << "\t\t l1t::EtSum failed checkThreshold" << std::endl;
299  return false;
300  }
301 
302  if( !condGEqVal && candOverflow ) return false;
303 
304  // for ETM and HTM check phi also
305  // for overflow, the phi requirements are ignored
306  if( MissingEnergy ){
307  // check phi
308  if( !checkRangePhi(candPhi, objPar.phiWindow1Lower, objPar.phiWindow1Upper, objPar.phiWindow2Lower, objPar.phiWindow2Upper) ){
309  LogDebug("L1TGlobal") << "\t\t l1t::EtSum failed checkRange(phi)" << std::endl;
310  return false;
311  }
312  }
313  }
314 
315  // index is always zero, as they are global quantities (there is only one object)
316  int indexObj = 0;
317 
318  objectsInComb.push_back(indexObj);
319  (combinationsInCond()).push_back(objectsInComb);
320 
321  // if we get here all checks were successfull for this combination
322  // set the general result for evaluateCondition to "true"
323 
324  condResult = true;
325  return condResult;
326 
327 }
#define LogDebug(id)
type
Definition: HCALResponse.h:21
unsigned size(int bx) const
const GlobalBoard * m_uGtB
pointer to uGt GlobalBoard, to be able to get the trigger objects
std::vector< int > SingleCombInCond
typedefs
const bool condGEq() const
get / set condition GEq flag
int hwPhi() const
Definition: L1Candidate.h:50
const bool checkThreshold(const Type1 &thresholdL, const Type1 &thresholdH, const Type2 &value, bool condGEqValue) const
const std::vector< ObjectParameter > * objectParameter() const
const int & condRelativeBx() const
get / set the condition relative bx
const EnergySumTemplate * m_gtEnergySumTemplate
pointer to a EnergySumTemplate
const std::vector< l1t::GlobalObject > & objectType() const
get / set the trigger object type(s) in the condition
void clear(CLHEP::HepGenMatrix &m)
Helper function: Reset all elements of a matrix to 0.
Definition: matutil.cc:167
const BXVector< const l1t::EtSum * > * getCandL1EtSum() const
pointer to Tau data list
Definition: GlobalBoard.h:168
const bool checkBit(const Type1 &mask, const unsigned int bitNumber) const
check if a bit with a given number is set in a mask
typedef for a single object template
int hwPt() const
Definition: L1Candidate.h:48
int getLastBX() const
EtSumType getType() const
Definition: EtSum.cc:37
EtSumType
Definition: EtSum.h:25
CombinationsInCond & combinationsInCond() const
get all the object combinations (to fill it...)
const bool checkRangePhi(const unsigned int bitNumber, const Type1 &W1beginR, const Type1 &W1endR, const Type1 &W2beginR, const Type1 &W2endR) const
check if a value is in a given range and outside of a veto range
const T & at(int bx, unsigned i) const
const GlobalBoard* l1t::EnergySumCondition::getuGtB ( ) const
inline

get / set the pointer to uGt GlobalBoard

Definition at line 76 of file EnergySumCondition.h.

References copy(), SimDataFormats::CaloAnalysis::cp, m_uGtB, and setuGtB().

Referenced by copy().

76  {
77  return m_uGtB;
78  }
const GlobalBoard * m_uGtB
pointer to uGt GlobalBoard, to be able to get the trigger objects
const EnergySumTemplate* l1t::EnergySumCondition::gtEnergySumTemplate ( ) const
inline

get / set the pointer to a L1GtCondition

Definition at line 69 of file EnergySumCondition.h.

References m_gtEnergySumTemplate, and setGtEnergySumTemplate().

Referenced by copy().

69  {
70  return m_gtEnergySumTemplate;
71  }
const EnergySumTemplate * m_gtEnergySumTemplate
pointer to a EnergySumTemplate
l1t::EnergySumCondition & EnergySumCondition::operator= ( const EnergySumCondition cp)

Definition at line 87 of file EnergySumCondition.cc.

References copy().

88 {
89  copy(cp);
90  return *this;
91 }
void copy(const EnergySumCondition &cp)
copy function for copy constructor and operator=
void EnergySumCondition::print ( std::ostream &  myCout) const
overridevirtual

print condition

Reimplemented from l1t::ConditionEvaluation.

Definition at line 329 of file EnergySumCondition.cc.

References m_gtEnergySumTemplate, EnergySumTemplate::print(), and l1t::ConditionEvaluation::print().

Referenced by l1t::CorrCondition::evaluateCondition(), l1t::CorrWithOverlapRemovalCondition::evaluateCondition(), and l1t::GlobalBoard::runGTL().

329  {
330 
331  m_gtEnergySumTemplate->print(myCout);
333 
334 }
virtual void print(std::ostream &myCout) const
print condition
const EnergySumTemplate * m_gtEnergySumTemplate
pointer to a EnergySumTemplate
void print(std::ostream &myCout) const override
print the condition
void EnergySumCondition::setGtEnergySumTemplate ( const EnergySumTemplate eSumTempl)

Definition at line 94 of file EnergySumCondition.cc.

References m_gtEnergySumTemplate.

Referenced by gtEnergySumTemplate().

94  {
95 
96  m_gtEnergySumTemplate = eSumTempl;
97 
98 }
const EnergySumTemplate * m_gtEnergySumTemplate
pointer to a EnergySumTemplate
void EnergySumCondition::setuGtB ( const GlobalBoard ptrGTB)

set the pointer to uGT GlobalBoard

Definition at line 101 of file EnergySumCondition.cc.

References m_uGtB.

Referenced by getuGtB().

101  {
102 
103  m_uGtB = ptrGTB;
104 
105 }
const GlobalBoard * m_uGtB
pointer to uGt GlobalBoard, to be able to get the trigger objects

Member Data Documentation

const EnergySumTemplate* l1t::EnergySumCondition::m_gtEnergySumTemplate
private
const GlobalBoard* l1t::EnergySumCondition::m_uGtB
private

pointer to uGt GlobalBoard, to be able to get the trigger objects

Definition at line 93 of file EnergySumCondition.h.

Referenced by copy(), evaluateCondition(), getuGtB(), and setuGtB().