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