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
39  //empty
40 }
41 
42 // from base template condition (from event setup usually)
45  m_gtExternalTemplate(static_cast<const ExternalTemplate*>(eSumTemplate)),
46  m_uGtB(ptrGTB)
47 
48 {
49  // maximum number of objects received for the evaluation of the condition
50  // energy sums are global quantities - one object per event
51 
52  m_condMaxNumberObjects = 1; //blw ???
53 }
54 
55 // copy constructor
58  m_uGtB = cp.getuGtB();
59 
63 
65 }
66 
68 
69 // destructor
71  // empty
72 }
73 
74 // equal operator
76  copy(cp);
77  return *this;
78 }
79 
80 // methods
82  m_gtExternalTemplate = eSumTempl;
83 }
84 
86 void l1t::ExternalCondition::setuGtB(const GlobalBoard* ptrGTB) { m_uGtB = ptrGTB; }
87 
88 // try all object permutations and check spatial correlations, if required
89 const bool l1t::ExternalCondition::evaluateCondition(const int bxEval) const {
90  LogDebug("L1TGlobal") << "Evaluating External Condition " << m_gtExternalTemplate->condName() << " on Channel "
91  << m_gtExternalTemplate->extChannel() << " relative Bx "
92  << m_gtExternalTemplate->condRelativeBx() << std::endl;
93  // number of trigger objects in the condition
94  // in fact, there is only one object
95  // int iCondition = 0;
96 
97  // condition result condResult set to true if the energy sum
98  // passes all requirements
99  bool condResult = false;
100 
101  // store the indices of the calorimeter objects
102  // from the combination evaluated in the condition
103  SingleCombInCond objectsInComb;
104 
105  // clear the m_combinationsInCond vector
107 
108  // clear the indices in the combination
109  objectsInComb.clear();
110 
112 
113  // Look at objects in bx = bx + relativeBx
114  int useBx = bxEval + m_gtExternalTemplate->condRelativeBx();
115  unsigned int exCondCh = m_gtExternalTemplate->extChannel();
116 
117  // Fail condition if attempting to get Bx outside of range
118  if ((useBx < candVec->getFirstBX()) || (useBx > candVec->getLastBX())) {
119  return false;
120  }
121 
122  int numberObjects = candVec->size(useBx);
123  if (numberObjects < 1) {
124  return false;
125  }
126 
127  //get external block (should only be one for the bx)
128  GlobalExtBlk ext = *(candVec->at(useBx, 0));
129  //ext.print(std::cout);
130 
131  // check external bit
132  if (!ext.getExternalDecision(exCondCh)) {
133  LogDebug("L1TGlobal") << "\t\t External Condition was not set" << std::endl;
134  return false;
135  }
136 
137  // index is always zero, as they are global quantities (there is only one object)
138  int indexObj = 0;
139 
140  //Do we need this?
141  objectsInComb.push_back(indexObj);
142  (combinationsInCond()).push_back(objectsInComb);
143 
144  // if we get here all checks were successfull for this combination
145  // set the general result for evaluateCondition to "true"
146  condResult = true;
147  LogDebug("L1TGlobal") << "\t\t Congrats, External Condition was set!" << std::endl;
148 
149  return condResult;
150 }
151 
152 void l1t::ExternalCondition::print(std::ostream& myCout) const {
153  m_gtExternalTemplate->print(myCout);
155 }
#define LogDebug(id)
const BXVector< const GlobalExtBlk * > * getCandL1External() const
pointer to Tau data list
Definition: GlobalBoard.h:153
unsigned size(int bx) const
CombinationsInCond const & getCombinationsInCond() const
get all the object combinations evaluated to true in the 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
const bool evaluateCondition(const int bxEval) const override
the core function to check if the condition matches
void clear(CLHEP::HepGenMatrix &m)
Helper function: Reset all elements of a matrix to 0.
Definition: matutil.cc:151
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=
void print(std::ostream &myCout) const override
print the condition
bool getExternalDecision(unsigned int bit) const
Get decision bits.
Definition: GlobalExtBlk.cc:51
void print(std::ostream &myCout) const override
print condition
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