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
57  m_gtExternalTemplate = cp.gtExternalTemplate();
58  m_uGtB = cp.getuGtB();
59 
60  m_condMaxNumberObjects = cp.condMaxNumberObjects();
61  m_condLastResult = cp.condLastResult();
62  m_combinationsInCond = cp.getCombinationsInCond();
63 
64  m_verbosity = cp.m_verbosity;
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
106  (combinationsInCond()).clear();
107 
108  // clear the indices in the combination
109  objectsInComb.clear();
110 
111  const BXVector<const GlobalExtBlk*>* candVec = m_uGtB->getCandL1External();
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 }
l1t::GlobalBoard
Definition: GlobalBoard.h:52
ext
Definition: memstream.h:15
GlobalBoard.h
MessageLogger.h
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
l1t::ExternalCondition::setGtExternalTemplate
void setGtExternalTemplate(const ExternalTemplate *)
Definition: ExternalCondition.cc:81
l1t::ExternalCondition::setuGtB
void setuGtB(const GlobalBoard *)
set the pointer to uGT GlobalBoard
Definition: ExternalCondition.cc:86
GlobalExtBlk.h
l1t::ConditionEvaluation::print
virtual void print(std::ostream &myCout) const
print condition
Definition: ConditionEvaluation.cc:32
hgcal_conditions::parameters
Definition: HGCConditions.h:86
watchdog.const
const
Definition: watchdog.py:83
BXVector< const GlobalExtBlk * >
ExternalTemplate
Definition: ExternalTemplate.h:32
l1t::ExternalCondition::print
void print(std::ostream &myCout) const override
print condition
Definition: ExternalCondition.cc:152
SingleCombInCond
std::vector< int > SingleCombInCond
typedefs
Definition: L1GlobalTriggerObjectMapFwd.h:29
ExternalTemplate.h
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
MessageDrop.h
clear
void clear(HadCaloObj &c)
Definition: data.h:124
BXVector::at
const T & at(int bx, unsigned i) const
ConditionEvaluation.h
GlobalExtBlk
Definition: GlobalExtBlk.h:34
L1Candidate.h
l1t::ExternalCondition::copy
void copy(const ExternalCondition &cp)
copy function for copy constructor and operator=
Definition: ExternalCondition.cc:56
l1t::ExternalCondition::operator=
ExternalCondition & operator=(const ExternalCondition &)
Definition: ExternalCondition.cc:75
l1t::ExternalCondition::ExternalCondition
ExternalCondition()
Definition: ExternalCondition.cc:38
l1t::ConditionEvaluation
Definition: ConditionEvaluation.h:39
l1t::ExternalCondition::~ExternalCondition
~ExternalCondition() override
Definition: ExternalCondition.cc:70
l1t::ExternalCondition::evaluateCondition
const bool evaluateCondition(const int bxEval) const override
the core function to check if the condition matches
Definition: ExternalCondition.cc:89
ExternalCondition.h
l1t::ExternalCondition
Definition: ExternalCondition.h:37
BXVector::size
unsigned size(int bx) const
GlobalCondition
Definition: GlobalCondition.h:33
l1t::ConditionEvaluation::m_condMaxNumberObjects
int m_condMaxNumberObjects
Definition: ConditionEvaluation.h:148
BXVector::getLastBX
int getLastBX() const