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

38  :
40 
41  //empty
42 
43 }
EnergySumCondition::EnergySumCondition ( const GtCondition eSumTemplate,
const GtBoard ptrGTB 
)

from base template condition (from event setup usually)

Definition at line 46 of file EnergySumCondition.cc.

References l1t::ConditionEvaluation::m_condMaxNumberObjects.

46  :
48  m_gtEnergySumTemplate(static_cast<const EnergySumTemplate*>(eSumTemplate)),
49  m_uGtB(ptrGTB)
50 
51 {
52 
53  // maximum number of objects received for the evaluation of the condition
54  // energy sums are global quantities - one object per event
55 
57 
58 }
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 74 of file EnergySumCondition.cc.

References copy().

74  :
76 
77  copy(cp);
78 
79 }
void copy(const EnergySumCondition &cp)
copy function for copy constructor and operator=
EnergySumCondition::~EnergySumCondition ( )
virtual

Definition at line 82 of file EnergySumCondition.cc.

82  {
83 
84  // empty
85 
86 }

Member Function Documentation

void EnergySumCondition::copy ( const EnergySumCondition cp)
private

copy function for copy constructor and operator=

Definition at line 61 of file EnergySumCondition.cc.

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

Referenced by EnergySumCondition().

61  {
62 
63  m_gtEnergySumTemplate = cp.gtEnergySumTemplate();
64  m_uGtB = cp.getuGtB();
65 
66  m_condMaxNumberObjects = cp.condMaxNumberObjects();
67  m_condLastResult = cp.condLastResult();
68  m_combinationsInCond = cp.getCombinationsInCond();
69 
70  m_verbosity = cp.m_verbosity;
71 
72 }
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 110 of file EnergySumCondition.cc.

References BXVector< T >::at(), hitfit::clear(), EnergySumTemplate::ObjectParameter::etHighThreshold, EnergySumTemplate::ObjectParameter::etLowThreshold, ETM, ETT, BXVector< T >::getLastBX(), l1t::EtSum::getType(), HTM, HTT, l1t::L1Candidate::hwPhi(), l1t::L1Candidate::hwPt(), L1Analysis::kMissingEt, L1Analysis::kMissingHt, L1Analysis::kTotalEt, L1Analysis::kTotalHt, LogDebug, EnergySumTemplate::ObjectParameter::phiWindow1Lower, EnergySumTemplate::ObjectParameter::phiWindow1Upper, EnergySumTemplate::ObjectParameter::phiWindow2Lower, EnergySumTemplate::ObjectParameter::phiWindow2Upper, and BXVector< T >::size().

110  {
111 
112  // number of trigger objects in the condition
113  // in fact, there is only one object
114  int iCondition = 0;
115 
116  // condition result condResult set to true if the energy sum
117  // passes all requirements
118  bool condResult = false;
119 
120  // store the indices of the calorimeter objects
121  // from the combination evaluated in the condition
122  SingleCombInCond objectsInComb;
123 
124  // clear the m_combinationsInCond vector
126 
127  // clear the indices in the combination
128  objectsInComb.clear();
129 
131 
132  // Look at objects in bx = bx + relativeBx
133  int useBx = bxEval + m_gtEnergySumTemplate->condRelativeBx();
134 
135  int numberObjects = candVec->size(useBx);
136  if (numberObjects < 1) {
137  return false;
138  }
139 
140  // Fail condition if attempting to get Bx outside of range
141  if( ( useBx < candVec->getFirstBX() ) ||
142  ( useBx > candVec->getLastBX() ) ) {
143  return false;
144  }
145 
146 
148  bool MissingEnergy = false;
149  switch( (m_gtEnergySumTemplate->objectType())[0] ){
150  case ETM:
152  MissingEnergy = true;
153  break;
154  case ETT:
156  MissingEnergy = false;
157  break;
158  case HTM:
160  MissingEnergy = true;
161  break;
162  case HTT:
164  MissingEnergy = false;
165  break;
166  default:
167  edm::LogError("l1t|Global")
168  << "\n Error: "
169  << "Unmatched object type from template to EtSumType, (m_gtEnergySumTemplate->objectType())[0] = "
171  << std::endl;
173  break;
174  }
175 
176 
177  // get energy, phi (ETM and HTM) and overflow for the trigger object
178  unsigned int candEt = 0;
179  unsigned int candPhi = 0;
180  bool candOverflow = false;
181  for( int iEtSum = 0; iEtSum < numberObjects; ++iEtSum ){
182  l1t::EtSum cand = *(candVec->at(useBx,iEtSum));
183  if( cand.getType() != type ) continue;
184  candEt = cand.hwPt();
185  candPhi = cand.hwPhi();
186  }
187 
188 
190  ( *(m_gtEnergySumTemplate->objectParameter()) )[iCondition];
191 
192  // check energy threshold and overflow
193  // overflow evaluation:
194  // for condGEq >=
195  // candidate overflow true -> condition true
196  // candidate overflow false -> evaluate threshold
197  // for condGEq =
198  // candidate overflow true -> condition false
199  // candidate overflow false -> evaluate threshold
200  //
201 
202  bool condGEqVal = m_gtEnergySumTemplate->condGEq();
203 
204  // check energy threshold
205  if ( !checkThreshold(objPar.etLowThreshold, objPar.etHighThreshold, candEt, condGEqVal) ) {
206  LogDebug("l1t|Global") << "\t\t l1t::EtSum failed checkThreshold" << std::endl;
207  return false;
208  }
209 
210  if( !condGEqVal && candOverflow ) return false;
211 
212  // for ETM and HTM check phi also
213  // for overflow, the phi requirements are ignored
214  if( MissingEnergy ){
215  // check phi
216  if( !checkRangePhi(candPhi, objPar.phiWindow1Lower, objPar.phiWindow1Upper, objPar.phiWindow2Lower, objPar.phiWindow2Upper) ){
217  LogDebug("l1t|Global") << "\t\t l1t::EtSum failed checkRange(phi)" << std::endl;
218  return false;
219  }
220  }
221 
222 
223  // index is always zero, as they are global quantities (there is only one object)
224  int indexObj = 0;
225 
226  objectsInComb.push_back(indexObj);
227  (combinationsInCond()).push_back(objectsInComb);
228 
229  // if we get here all checks were successfull for this combination
230  // set the general result for evaluateCondition to "true"
231 
232  condResult = true;
233  return condResult;
234 
235 }
#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
const bool checkThreshold(const Type1 &thresholdL, const Type1 &thresholdH, const Type2 &value, bool condGEqValue) const
Definition: L1GtObject.h:38
const std::vector< ObjectParameter > * objectParameter() const
const EnergySumTemplate * m_gtEnergySumTemplate
pointer to a EnergySumTemplate
const int & condRelativeBx() const
get / set the condition relative bx
Definition: GtCondition.h:123
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:90
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:101
const BXVector< const l1t::EtSum * > * getCandL1EtSum() const
pointer to Tau data list
Definition: GtBoard.h:175
EtSumType getType() const
Definition: EtSum.cc:37
EtSumType
Definition: EtSum.h:20
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 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 89 of file EnergySumCondition.cc.

References filterCSVwithJSON::copy.

90 {
91  copy(cp);
92  return *this;
93 }
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 237 of file EnergySumCondition.cc.

References l1t::ConditionEvaluation::print().

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

237  {
238 
239  m_gtEnergySumTemplate->print(myCout);
241 
242 }
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 96 of file EnergySumCondition.cc.

96  {
97 
98  m_gtEnergySumTemplate = eSumTempl;
99 
100 }
const EnergySumTemplate * m_gtEnergySumTemplate
pointer to a EnergySumTemplate
void EnergySumCondition::setuGtB ( const GtBoard ptrGTB)

set the pointer to uGT GtBoard

Definition at line 103 of file EnergySumCondition.cc.

103  {
104 
105  m_uGtB = ptrGTB;
106 
107 }
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().