CMS 3D CMS Logo

EcalExclusiveTrigFilter.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: EcalExclusiveTrigFilter
4 // Class: EcalExclusiveTrigFilter
5 //
13 //
14 // Original Author: Seth COOPER
15 // Created: Thu May 22 11:40:12 CEST 2008
16 //
17 //
18 
20 
21 using namespace cms;
22 using namespace edm;
23 using namespace std;
24 
25 //
26 // constants, enums and typedefs
27 //
28 
29 //
30 // static data member definitions
31 //
32 
33 //
34 // constructors and destructor
35 //
37  : l1GTReadoutRecTag_(iConfig.getUntrackedParameter<std::string>("L1GlobalReadoutRecord", "gtDigis")) {
38  //now do what ever initialization is needed
39 }
40 
42  // do anything here that needs to be done at desctruction time
43  // (e.g. close files, deallocate resources etc.)
44 }
45 
46 //
47 // member functions
48 //
49 
50 // ------------ method called on each new Event ------------
52  // get the GMTReadoutCollection
54  iEvent.getByLabel(l1GTReadoutRecTag_, gmtrc_handle);
55  L1MuGMTReadoutCollection const* gmtrc = gmtrc_handle.product();
56  if (!(gmtrc_handle.isValid())) {
57  LogWarning("EcalExclusiveTrigFilter") << "l1MuGMTReadoutCollection"
58  << " not available";
59  //return;
60  }
61 
62  // get hold of L1GlobalReadoutRecord
64  iEvent.getByLabel(l1GTReadoutRecTag_, L1GTRR);
65  bool isEcalL1 = false;
66  const unsigned int sizeOfDecisionWord(L1GTRR->decisionWord().size());
67  if (!(L1GTRR.isValid())) {
68  LogWarning("EcalExclusiveTrigFilter") << l1GTReadoutRecTag_ << " not available";
69  //return;
70  } else if (sizeOfDecisionWord < 128) {
71  LogWarning("EcalExclusiveTrigFilter")
72  << "size of L1 decisionword is " << sizeOfDecisionWord << "; L1 Ecal triggering bits not available";
73  } else {
74  l1Names_.resize(sizeOfDecisionWord);
75  l1Accepts_.resize(sizeOfDecisionWord);
76  for (unsigned int i = 0; i != sizeOfDecisionWord; ++i) {
77  l1Accepts_[i] = 0;
78  l1Names_[i] = "NameNotAvailable";
79  }
80  for (unsigned int i = 0; i != sizeOfDecisionWord; ++i) {
81  if (L1GTRR->decisionWord()[i]) {
82  l1Accepts_[i]++;
83  //cout << "L1A bit: " << i << endl;
84  }
85  }
86 
87  if (l1Accepts_[14] || l1Accepts_[15] || l1Accepts_[16] || l1Accepts_[17] || l1Accepts_[18] || l1Accepts_[19] ||
88  l1Accepts_[20])
89  isEcalL1 = true;
90  if (l1Accepts_[73] || l1Accepts_[74] || l1Accepts_[75] || l1Accepts_[76] || l1Accepts_[77] || l1Accepts_[78])
91  isEcalL1 = true;
92  }
93 
94  bool isRPCL1 = false;
95  bool isDTL1 = false;
96  bool isCSCL1 = false;
97  bool isHCALL1 = false;
98 
99  std::vector<L1MuGMTReadoutRecord> gmt_records = gmtrc->getRecords();
100  std::vector<L1MuGMTReadoutRecord>::const_iterator igmtrr;
101 
102  for (igmtrr = gmt_records.begin(); igmtrr != gmt_records.end(); igmtrr++) {
103  std::vector<L1MuRegionalCand>::const_iterator iter1;
104  std::vector<L1MuRegionalCand> rmc;
105 
106  //DT triggers
107  int idt = 0;
108  rmc = igmtrr->getDTBXCands();
109  for (iter1 = rmc.begin(); iter1 != rmc.end(); iter1++) {
110  if (!(*iter1).empty()) {
111  idt++;
112  }
113  }
114 
115  //if(idt>0) std::cout << "Found " << idt << " valid DT candidates in bx wrt. L1A = "
116  // << igmtrr->getBxInEvent() << std::endl;
117  if (igmtrr->getBxInEvent() == 0 && idt > 0)
118  isDTL1 = true;
119 
120  //RPC triggers
121  int irpcb = 0;
122  rmc = igmtrr->getBrlRPCCands();
123  for (iter1 = rmc.begin(); iter1 != rmc.end(); iter1++) {
124  if (!(*iter1).empty()) {
125  irpcb++;
126  }
127  }
128 
129  //if(irpcb>0) std::cout << "Found " << irpcb << " valid RPC candidates in bx wrt. L1A = "
130  // << igmtrr->getBxInEvent() << std::endl;
131  if (igmtrr->getBxInEvent() == 0 && irpcb > 0)
132  isRPCL1 = true;
133 
134  //CSC Triggers
135  int icsc = 0;
136  rmc = igmtrr->getCSCCands();
137  for (iter1 = rmc.begin(); iter1 != rmc.end(); iter1++) {
138  if (!(*iter1).empty()) {
139  icsc++;
140  }
141  }
142  //if(icsc>0) std::cout << "Found " << icsc << " valid CSC candidates in bx wrt. L1A = "
143  // // << igmtrr->getBxInEvent() << std::endl;
144  if (igmtrr->getBxInEvent() == 0 && icsc > 0)
145  isCSCL1 = true;
146  }
147 
148  L1GlobalTriggerReadoutRecord const* gtrr = L1GTRR.product();
149 
150  for (int ibx = -1; ibx <= 1; ibx++) {
151  bool hcal_top = false;
152  bool hcal_bot = false;
153  const L1GtPsbWord psb = gtrr->gtPsbWord(0xbb0d, ibx);
154  std::vector<int> valid_phi;
155  if ((psb.aData(4) & 0x3f) >= 1) {
156  valid_phi.push_back((psb.aData(4) >> 10) & 0x1f);
157  }
158  if ((psb.bData(4) & 0x3f) >= 1) {
159  valid_phi.push_back((psb.bData(4) >> 10) & 0x1f);
160  }
161  if ((psb.aData(5) & 0x3f) >= 1) {
162  valid_phi.push_back((psb.aData(5) >> 10) & 0x1f);
163  }
164  if ((psb.bData(5) & 0x3f) >= 1) {
165  valid_phi.push_back((psb.bData(5) >> 10) & 0x1f);
166  }
167  std::vector<int>::const_iterator iphi;
168  for (iphi = valid_phi.begin(); iphi != valid_phi.end(); iphi++) {
169  //std::cout << "Found HCAL mip with phi=" << *iphi << " in bx wrt. L1A = " << ibx << std::endl;
170  if (*iphi < 9)
171  hcal_top = true;
172  if (*iphi > 8)
173  hcal_bot = true;
174  }
175  if (ibx == 0 && hcal_top && hcal_bot)
176  isHCALL1 = true;
177  }
178 
179  std::cout << "**** Trigger Source ****" << std::endl;
180  if (isDTL1)
181  std::cout << "DT" << std::endl;
182  if (isRPCL1)
183  std::cout << "RPC" << std::endl;
184  if (isCSCL1)
185  cout << "CSC" << endl;
186  if (isHCALL1)
187  std::cout << "HCAL" << std::endl;
188  if (isEcalL1)
189  std::cout << "ECAL" << std::endl;
190  std::cout << "************************" << std::endl;
191 
192  return (isEcalL1 && !isDTL1 && !isRPCL1 && !isCSCL1 && !isHCALL1);
193 }
const cms_uint16_t bData(int iB) const
get/set B_DATA_CH_IB
Definition: L1GtPsbWord.cc:323
int iEvent
Definition: GenABIO.cc:224
const cms_uint16_t aData(int iA) const
get/set A_DATA_CH_IA
Definition: L1GtPsbWord.cc:228
bool filter(edm::Event &, const edm::EventSetup &) override
const L1GtPsbWord gtPsbWord(cms_uint16_t boardIdValue, int bxInEventValue) const
get / set PSB word (record) in the GT readout record
EcalExclusiveTrigFilter(const edm::ParameterSet &)
bool isValid() const
Definition: HandleBase.h:74
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:480
const DecisionWord & decisionWord(int bxInEventValue) const
Namespace of DDCMS conversion namespace.
T const * product() const
Definition: Handle.h:74
std::vector< std::string > l1Names_
HLT enums.
std::vector< L1MuGMTReadoutRecord > const & getRecords() const