CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 {
39  //now do what ever initialization is needed
40 
41 }
42 
43 
45 {
46 
47  // do anything here that needs to be done at desctruction time
48  // (e.g. close files, deallocate resources etc.)
49 
50 }
51 
52 
53 //
54 // member functions
55 //
56 
57 // ------------ method called on each new Event ------------
58 bool
60 {
61  // get the GMTReadoutCollection
63  iEvent.getByLabel(l1GTReadoutRecTag_,gmtrc_handle);
64  L1MuGMTReadoutCollection const* gmtrc = gmtrc_handle.product();
65  if (!(gmtrc_handle.isValid()))
66  {
67  LogWarning("EcalExclusiveTrigFilter") << "l1MuGMTReadoutCollection" << " not available";
68  //return;
69  }
70 
71  // get hold of L1GlobalReadoutRecord
73  iEvent.getByLabel(l1GTReadoutRecTag_,L1GTRR);
74  bool isEcalL1 = false;
75  const unsigned int sizeOfDecisionWord(L1GTRR->decisionWord().size());
76  if (!(L1GTRR.isValid()))
77  {
78  LogWarning("EcalExclusiveTrigFilter") << l1GTReadoutRecTag_ << " not available";
79  //return;
80  }
81  else if(sizeOfDecisionWord<128)
82  {
83  LogWarning("EcalExclusiveTrigFilter") << "size of L1 decisionword is " << sizeOfDecisionWord
84  << "; L1 Ecal triggering bits not available";
85  }
86  else
87  {
88  l1Names_.resize(sizeOfDecisionWord);
89  l1Accepts_.resize(sizeOfDecisionWord);
90  for (unsigned int i=0; i!=sizeOfDecisionWord; ++i) {
91  l1Accepts_[i]=0;
92  l1Names_[i]="NameNotAvailable";
93  }
94  for (unsigned int i=0; i!=sizeOfDecisionWord; ++i) {
95  if (L1GTRR->decisionWord()[i])
96  {
97  l1Accepts_[i]++;
98  //cout << "L1A bit: " << i << endl;
99  }
100  }
101 
102  if(l1Accepts_[14] || l1Accepts_[15] || l1Accepts_[16] || l1Accepts_[17]
103  || l1Accepts_[18] || l1Accepts_[19] || l1Accepts_[20])
104  isEcalL1 = true;
105  if(l1Accepts_[73] || l1Accepts_[74] || l1Accepts_[75] || l1Accepts_[76]
106  || l1Accepts_[77] || l1Accepts_[78])
107  isEcalL1 = true;
108  }
109 
110  bool isRPCL1 = false;
111  bool isDTL1 = false;
112  bool isCSCL1 = false;
113  bool isHCALL1 = false;
114 
115  std::vector<L1MuGMTReadoutRecord> gmt_records = gmtrc->getRecords();
116  std::vector<L1MuGMTReadoutRecord>::const_iterator igmtrr;
117 
118  for(igmtrr=gmt_records.begin(); igmtrr!=gmt_records.end(); igmtrr++) {
119 
120  std::vector<L1MuRegionalCand>::const_iterator iter1;
121  std::vector<L1MuRegionalCand> rmc;
122 
123  //DT triggers
124  int idt = 0;
125  rmc = igmtrr->getDTBXCands();
126  for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
127  if ( !(*iter1).empty() ) {
128  idt++;
129  }
130  }
131 
132  //if(idt>0) std::cout << "Found " << idt << " valid DT candidates in bx wrt. L1A = "
133  // << igmtrr->getBxInEvent() << std::endl;
134  if(igmtrr->getBxInEvent()==0 && idt>0) isDTL1 = true;
135 
136  //RPC triggers
137  int irpcb = 0;
138  rmc = igmtrr->getBrlRPCCands();
139  for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
140  if ( !(*iter1).empty() ) {
141  irpcb++;
142  }
143  }
144 
145  //if(irpcb>0) std::cout << "Found " << irpcb << " valid RPC candidates in bx wrt. L1A = "
146  // << igmtrr->getBxInEvent() << std::endl;
147  if(igmtrr->getBxInEvent()==0 && irpcb>0) isRPCL1 = true;
148 
149  //CSC Triggers
150  int icsc = 0;
151  rmc = igmtrr->getCSCCands();
152  for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
153  if ( !(*iter1).empty() ) {
154  icsc++;
155  }
156  }
157  //if(icsc>0) std::cout << "Found " << icsc << " valid CSC candidates in bx wrt. L1A = "
158  // // << igmtrr->getBxInEvent() << std::endl;
159  if(igmtrr->getBxInEvent()==0 && icsc>0) isCSCL1 = true;
160  }
161 
162  L1GlobalTriggerReadoutRecord const* gtrr = L1GTRR.product();
163 
164  for(int ibx=-1; ibx<=1; ibx++) {
165  bool hcal_top = false;
166  bool hcal_bot = false;
167  const L1GtPsbWord psb = gtrr->gtPsbWord(0xbb0d,ibx);
168  std::vector<int> valid_phi;
169  if((psb.aData(4)&0x3f) >= 1) {valid_phi.push_back( (psb.aData(4)>>10)&0x1f ); }
170  if((psb.bData(4)&0x3f) >= 1) {valid_phi.push_back( (psb.bData(4)>>10)&0x1f ); }
171  if((psb.aData(5)&0x3f) >= 1) {valid_phi.push_back( (psb.aData(5)>>10)&0x1f ); }
172  if((psb.bData(5)&0x3f) >= 1) {valid_phi.push_back( (psb.bData(5)>>10)&0x1f ); }
173  std::vector<int>::const_iterator iphi;
174  for(iphi=valid_phi.begin(); iphi!=valid_phi.end(); iphi++) {
175  //std::cout << "Found HCAL mip with phi=" << *iphi << " in bx wrt. L1A = " << ibx << std::endl;
176  if(*iphi<9) hcal_top=true;
177  if(*iphi>8) hcal_bot=true;
178  }
179  if(ibx==0 && hcal_top && hcal_bot) isHCALL1=true;
180  }
181 
182  std::cout << "**** Trigger Source ****" << std::endl;
183  if(isDTL1) std::cout << "DT" << std::endl;
184  if(isRPCL1) std::cout << "RPC" << std::endl;
185  if(isCSCL1) cout << "CSC" << endl;
186  if(isHCALL1) std::cout << "HCAL" << std::endl;
187  if(isEcalL1) std::cout << "ECAL" << std::endl;
188  std::cout << "************************" << std::endl;
189 
190  return(isEcalL1 && !isDTL1 && !isRPCL1 && !isCSCL1 && !isHCALL1);
191 
192 }
const cms_uint16_t bData(int iB) const
get/set B_DATA_CH_IB
Definition: L1GtPsbWord.cc:323
int i
Definition: DBlmapReader.cc:9
int iEvent
Definition: GenABIO.cc:230
virtual bool filter(edm::Event &, const edm::EventSetup &)
const cms_uint16_t aData(int iA) const
get/set A_DATA_CH_IA
Definition: L1GtPsbWord.cc:228
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:75
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:420
T const * product() const
Definition: Handle.h:81
std::vector< std::string > l1Names_
std::vector< L1MuGMTReadoutRecord > const & getRecords() const
tuple cout
Definition: gather_cfg.py:121