CMS 3D CMS Logo

ExternalCondition.cc
Go to the documentation of this file.
1 
13 // this class header
15 
16 // system include files
17 #include <iostream>
18 #include <iomanip>
19 
20 #include <string>
21 #include <vector>
22 #include <algorithm>
23 
24 // user include files
25 // base classes
30 
32 
35 
36 // constructors
37 // default
40 
41  //empty
42 
43 }
44 
45 // from base template condition (from event setup usually)
48  m_gtExternalTemplate(static_cast<const ExternalTemplate*>(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 
56  m_condMaxNumberObjects = 1; //blw ???
57 
58 }
59 
60 // copy constructor
62 
64  m_uGtB = cp.getuGtB();
65 
69 
71 
72 }
73 
76 
77  copy(cp);
78 
79 }
80 
81 // destructor
83 
84  // empty
85 
86 }
87 
88 // equal operator
90 {
91  copy(cp);
92  return *this;
93 }
94 
95 // methods
97 
98  m_gtExternalTemplate = eSumTempl;
99 
100 }
101 
104 
105  m_uGtB = ptrGTB;
106 
107 }
108 
109 // try all object permutations and check spatial correlations, if required
110 const bool l1t::ExternalCondition::evaluateCondition(const int bxEval) const {
111 
112 
113 
114  LogDebug("L1TGlobal") << "Evaluating External Condition "
116  << " on Channel " << m_gtExternalTemplate->extChannel()
117  << " relative Bx " << m_gtExternalTemplate->condRelativeBx() << std::endl;
118  // number of trigger objects in the condition
119  // in fact, there is only one object
120 // int iCondition = 0;
121 
122  // condition result condResult set to true if the energy sum
123  // passes all requirements
124  bool condResult = false;
125 
126  // store the indices of the calorimeter objects
127  // from the combination evaluated in the condition
128  SingleCombInCond objectsInComb;
129 
130  // clear the m_combinationsInCond vector
132 
133  // clear the indices in the combination
134  objectsInComb.clear();
135 
137 
138  // Look at objects in bx = bx + relativeBx
139  int useBx = bxEval + m_gtExternalTemplate->condRelativeBx();
140  unsigned int exCondCh = m_gtExternalTemplate->extChannel();
141 
142  // Fail condition if attempting to get Bx outside of range
143  if( ( useBx < candVec->getFirstBX() ) ||
144  ( useBx > candVec->getLastBX() ) ) {
145  return false;
146  }
147 
148  int numberObjects = candVec->size(useBx);
149  if (numberObjects < 1) {
150  return false;
151  }
152 
153  //get external block (should only be one for the bx)
154  GlobalExtBlk ext = *(candVec->at(useBx,0));
155  //ext.print(std::cout);
156 
157  // check external bit
158  if ( !ext.getExternalDecision(exCondCh) ) {
159  LogDebug("L1TGlobal") << "\t\t External Condition was not set" << std::endl;
160  return false;
161  }
162 
163  // index is always zero, as they are global quantities (there is only one object)
164  int indexObj = 0;
165 
166  //Do we need this?
167  objectsInComb.push_back(indexObj);
168  (combinationsInCond()).push_back(objectsInComb);
169 
170  // if we get here all checks were successfull for this combination
171  // set the general result for evaluateCondition to "true"
172  condResult = true;
173  LogDebug("L1TGlobal") << "\t\t Congrats, External Condition was set!" << std::endl;
174 
175  return condResult;
176 
177 }
178 
179 void l1t::ExternalCondition::print(std::ostream& myCout) const {
180 
181  m_gtExternalTemplate->print(myCout);
183 
184 }
185 
#define LogDebug(id)
const BXVector< const GlobalExtBlk * > * getCandL1External() const
pointer to Tau data list
Definition: GlobalBoard.h:174
unsigned size(int bx) const
CombinationsInCond const & getCombinationsInCond() const
get all the object combinations evaluated to true in the condition
void print(std::ostream &myCout) const
print condition
virtual void print(std::ostream &myCout) const
print condition
std::vector< int > SingleCombInCond
typedefs
ExternalCondition & operator=(const ExternalCondition &)
bool condLastResult() const
get the latest result for the condition
const int & condRelativeBx() const
get / set the condition relative bx
void clear(CLHEP::HepGenMatrix &m)
Helper function: Reset all elements of a matrix to 0.
Definition: matutil.cc:167
virtual void print(std::ostream &myCout) const
print the condition
CombinationsInCond m_combinationsInCond
store all the object combinations evaluated to true in the condition
const ExternalTemplate * m_gtExternalTemplate
pointer to a ExternalTemplate
const std::string & condName() const
get / set condition name
int m_verbosity
verbosity level
const ExternalTemplate * gtExternalTemplate() const
get / set the pointer to a L1GtCondition
const GlobalBoard * m_uGtB
pointer to uGt GlobalBoard, to be able to get the trigger objects
bool m_condLastResult
the last result of evaluateCondition()
void copy(const ExternalCondition &cp)
copy function for copy constructor and operator=
bool getExternalDecision(unsigned int bit) const
Get decision bits.
Definition: GlobalExtBlk.cc:67
const bool evaluateCondition(const int bxEval) const
the core function to check if the condition matches
int getLastBX() const
const unsigned int & extChannel() const
get external channel number
void setGtExternalTemplate(const ExternalTemplate *)
Definition: memstream.h:15
CombinationsInCond & combinationsInCond() const
get all the object combinations (to fill it...)
const GlobalBoard * getuGtB() const
get / set the pointer to uGt GlobalBoard
void setuGtB(const GlobalBoard *)
set the pointer to uGT GlobalBoard
const T & at(int bx, unsigned i) const