CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 GtCondition *, const GtBoard *)
 from base template condition (from event setup usually) More...
 
 EnergySumCondition (const EnergySumCondition &)
 
const bool evaluateCondition (const int bxEval) const
 the core function to check if the condition matches More...
 
const GtBoardgetuGtB () const
 get / set the pointer to uGt GtBoard More...
 
const EnergySumTemplategtEnergySumTemplate () const
 get / set the pointer to a L1GtCondition More...
 
EnergySumConditionoperator= (const EnergySumCondition &)
 
void print (std::ostream &myCout) const
 print condition More...
 
void setGtEnergySumTemplate (const EnergySumTemplate *)
 
void setuGtB (const GtBoard *)
 set the pointer to uGT GtBoard More...
 
virtual ~EnergySumCondition ()
 
- 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 GtBoardm_uGtB
 pointer to uGt GtBoard, 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 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 &beginR, const Type1 &endR, const Type1 &beginVetoR, const Type1 &endVetoR, 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 &beginR, const Type1 &endR, const Type1 &beginVetoR, const Type1 &endVetoR) 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 &threshold, 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 49 of file EnergySumCondition.cc.

49  :
51 
52  //empty
53 
54 }
EnergySumCondition::EnergySumCondition ( const GtCondition eSumTemplate,
const GtBoard ptrGTB 
)

from base template condition (from event setup usually)

Definition at line 57 of file EnergySumCondition.cc.

References l1t::ConditionEvaluation::m_condMaxNumberObjects.

57  :
59  m_gtEnergySumTemplate(static_cast<const EnergySumTemplate*>(eSumTemplate)),
60  m_uGtB(ptrGTB)
61 
62 {
63 
64  // maximum number of objects received for the evaluation of the condition
65  // energy sums are global quantities - one object per event
66 
68 
69 }
const EnergySumTemplate * m_gtEnergySumTemplate
pointer to a EnergySumTemplate
const GtBoard * m_uGtB
pointer to uGt GtBoard, to be able to get the trigger objects
EnergySumCondition::EnergySumCondition ( const EnergySumCondition cp)

Definition at line 85 of file EnergySumCondition.cc.

References copy().

85  :
87 
88  copy(cp);
89 
90 }
void copy(const EnergySumCondition &cp)
copy function for copy constructor and operator=
EnergySumCondition::~EnergySumCondition ( )
virtual

Definition at line 93 of file EnergySumCondition.cc.

93  {
94 
95  // empty
96 
97 }

Member Function Documentation

void EnergySumCondition::copy ( const EnergySumCondition cp)
private

copy function for copy constructor and operator=

Definition at line 72 of file EnergySumCondition.cc.

References l1t::ConditionEvaluation::condLastResult(), l1t::ConditionEvaluation::condMaxNumberObjects(), l1t::ConditionEvaluation::getCombinationsInCond(), getuGtB(), gtEnergySumTemplate(), and l1t::ConditionEvaluation::m_verbosity.

Referenced by EnergySumCondition().

72  {
73 
74  m_gtEnergySumTemplate = cp.gtEnergySumTemplate();
75  m_uGtB = cp.getuGtB();
76 
77  m_condMaxNumberObjects = cp.condMaxNumberObjects();
78  m_condLastResult = cp.condLastResult();
79  m_combinationsInCond = cp.getCombinationsInCond();
80 
81  m_verbosity = cp.m_verbosity;
82 
83 }
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 GtBoard * m_uGtB
pointer to uGt GtBoard, to be able to get the trigger objects
const bool EnergySumCondition::evaluateCondition ( const int  bxEval) const
virtual

the core function to check if the condition matches

Implements l1t::ConditionEvaluation.

Definition at line 121 of file EnergySumCondition.cc.

References BXVector< T >::at(), hitfit::clear(), ETM, ETT, EnergySumTemplate::ObjectParameter::etThreshold, BXVector< T >::getLastBX(), l1t::EtSum::getType(), HTM, HTT, l1t::L1Candidate::hwPhi(), l1t::L1Candidate::hwPt(), LogDebug, EnergySumTemplate::ObjectParameter::phiWindowLower, EnergySumTemplate::ObjectParameter::phiWindowUpper, EnergySumTemplate::ObjectParameter::phiWindowVetoLower, and BXVector< T >::size().

121  {
122 
123  // number of trigger objects in the condition
124  // in fact, there is only one object
125  int iCondition = 0;
126 
127  // condition result condResult set to true if the energy sum
128  // passes all requirements
129  bool condResult = false;
130 
131  // store the indices of the calorimeter objects
132  // from the combination evaluated in the condition
133  SingleCombInCond objectsInComb;
134 
135  // clear the m_combinationsInCond vector
137 
138  // clear the indices in the combination
139  objectsInComb.clear();
140 
142 
143  // Look at objects in bx = bx + relativeBx
144  int useBx = bxEval + m_gtEnergySumTemplate->condRelativeBx();
145 
146  int numberObjects = candVec->size(useBx);
147  if (numberObjects < 1) {
148  return false;
149  }
150 
151  // Fail condition if attempting to get Bx outside of range
152  if( ( useBx < candVec->getFirstBX() ) ||
153  ( useBx > candVec->getLastBX() ) ) {
154  return false;
155  }
156 
157 
159  bool MissingEnergy = false;
160  switch( (m_gtEnergySumTemplate->objectType())[0] ){
161  case ETM:
162  type = l1t::EtSum::EtSumType::kMissingEt;
163  MissingEnergy = true;
164  break;
165  case ETT:
166  type = l1t::EtSum::EtSumType::kTotalEt;
167  MissingEnergy = false;
168  break;
169  case HTM:
170  type = l1t::EtSum::EtSumType::kMissingHt;
171  MissingEnergy = true;
172  break;
173  case HTT:
174  type = l1t::EtSum::EtSumType::kTotalHt;
175  MissingEnergy = false;
176  break;
177  default:
178  edm::LogError("l1t|Global")
179  << "\n Error: "
180  << "Unmatched object type from template to EtSumType, (m_gtEnergySumTemplate->objectType())[0] = "
182  << std::endl;
183  type = l1t::EtSum::EtSumType::kTotalEt;
184  break;
185  }
186 
187 
188  // get energy, phi (ETM and HTM) and overflow for the trigger object
189  unsigned int candEt = 0;
190  unsigned int candPhi = 0;
191  bool candOverflow = false;
192  for( int iEtSum = 0; iEtSum < numberObjects; ++iEtSum ){
193  l1t::EtSum cand = *(candVec->at(useBx,iEtSum));
194  if( cand.getType() != type ) continue;
195  candEt = cand.hwPt();
196  candPhi = cand.hwPhi();
197  }
198 
199 
201  ( *(m_gtEnergySumTemplate->objectParameter()) )[iCondition];
202 
203  // check energy threshold and overflow
204  // overflow evaluation:
205  // for condGEq >=
206  // candidate overflow true -> condition true
207  // candidate overflow false -> evaluate threshold
208  // for condGEq =
209  // candidate overflow true -> condition false
210  // candidate overflow false -> evaluate threshold
211  //
212 
213  bool condGEqVal = m_gtEnergySumTemplate->condGEq();
214 
215  // check energy threshold
216  if ( !checkThreshold(objPar.etThreshold, candEt, condGEqVal) ) {
217  LogDebug("l1t|Global") << "\t\t l1t::EtSum failed checkThreshold" << std::endl;
218  return false;
219  }
220 
221  if( !condGEqVal && candOverflow ) return false;
222 
223  // for ETM and HTM check phi also
224  // for overflow, the phi requirements are ignored
225  if( MissingEnergy ){
226  // check phi
227  if( !checkRangePhi(candPhi, objPar.phiWindowLower, objPar.phiWindowUpper, objPar.phiWindowVetoLower, objPar.phiWindowVetoLower) ){
228  LogDebug("l1t|Global") << "\t\t l1t::EtSum failed checkRange(phi)" << std::endl;
229  return false;
230  }
231  }
232 
233 
234  // index is always zero, as they are global quantities (there is only one object)
235  int indexObj = 0;
236 
237  objectsInComb.push_back(indexObj);
238  (combinationsInCond()).push_back(objectsInComb);
239 
240  // if we get here all checks were successfull for this combination
241  // set the general result for evaluateCondition to "true"
242 
243  condResult = true;
244  return condResult;
245 
246 }
#define LogDebug(id)
type
Definition: HCALResponse.h:21
unsigned size(int bx) const
Definition: L1GtObject.h:39
Definition: L1GtObject.h:36
std::vector< int > SingleCombInCond
typedefs
int hwPhi() const
Definition: L1Candidate.cc:79
Definition: L1GtObject.h:38
const std::vector< ObjectParameter > * objectParameter() const
const bool checkRangePhi(const unsigned int bitNumber, const Type1 &beginR, const Type1 &endR, const Type1 &beginVetoR, const Type1 &endVetoR) const
check if a value is in a given range and outside of a veto range
const EnergySumTemplate * m_gtEnergySumTemplate
pointer to a EnergySumTemplate
const int & condRelativeBx() const
get / set the condition relative bx
Definition: GtCondition.h:122
void clear(CLHEP::HepGenMatrix &m)
Helper function: Reset all elements of a matrix to 0.
Definition: matutil.cc:167
typedef for a single object template
const std::vector< L1GtObject > & objectType() const
get / set the trigger object type(s) in the condition
Definition: GtCondition.h:89
const bool checkThreshold(const Type1 &threshold, const Type2 &value, bool condGEqValue) const
int hwPt() const
Definition: L1Candidate.cc:69
Definition: L1GtObject.h:37
const GtBoard * m_uGtB
pointer to uGt GtBoard, to be able to get the trigger objects
int getLastBX() const
const bool condGEq() const
get / set condition GEq flag
Definition: GtCondition.h:100
const BXVector< const l1t::EtSum * > * getCandL1EtSum() const
pointer to Tau data list
Definition: GtBoard.h:162
EtSumType getType() const
Definition: EtSum.cc:37
EtSumType
Definition: EtSum.h:17
CombinationsInCond & combinationsInCond() const
get all the object combinations (to fill it...)
const T & at(int bx, unsigned i) const
const GtBoard* l1t::EnergySumCondition::getuGtB ( ) const
inline

get / set the pointer to uGt GtBoard

Definition at line 76 of file EnergySumCondition.h.

References m_uGtB.

Referenced by copy().

76  {
77  return m_uGtB;
78  }
const GtBoard * m_uGtB
pointer to uGt GtBoard, 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.

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 100 of file EnergySumCondition.cc.

References filterCSVwithJSON::copy.

101 {
102  copy(cp);
103  return *this;
104 }
void copy(const EnergySumCondition &cp)
copy function for copy constructor and operator=
void EnergySumCondition::print ( std::ostream &  myCout) const
virtual

print condition

Reimplemented from l1t::ConditionEvaluation.

Definition at line 248 of file EnergySumCondition.cc.

References l1t::ConditionEvaluation::print().

Referenced by l1t::GtBoard::runGTL().

248  {
249 
250  m_gtEnergySumTemplate->print(myCout);
252 
253 }
virtual void print(std::ostream &myCout) const
print condition
virtual void print(std::ostream &myCout) const
print the condition
const EnergySumTemplate * m_gtEnergySumTemplate
pointer to a EnergySumTemplate
void EnergySumCondition::setGtEnergySumTemplate ( const EnergySumTemplate eSumTempl)

Definition at line 107 of file EnergySumCondition.cc.

107  {
108 
109  m_gtEnergySumTemplate = eSumTempl;
110 
111 }
const EnergySumTemplate * m_gtEnergySumTemplate
pointer to a EnergySumTemplate
void EnergySumCondition::setuGtB ( const GtBoard ptrGTB)

set the pointer to uGT GtBoard

Definition at line 114 of file EnergySumCondition.cc.

114  {
115 
116  m_uGtB = ptrGTB;
117 
118 }
const GtBoard * m_uGtB
pointer to uGt GtBoard, to be able to get the trigger objects

Member Data Documentation

const EnergySumTemplate* l1t::EnergySumCondition::m_gtEnergySumTemplate
private

pointer to a EnergySumTemplate

Definition at line 90 of file EnergySumCondition.h.

Referenced by gtEnergySumTemplate().

const GtBoard* l1t::EnergySumCondition::m_uGtB
private

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

Definition at line 93 of file EnergySumCondition.h.

Referenced by getuGtB().