CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Attributes | Static Private Attributes
L1RCTProducer Class Reference

#include <L1RCTProducer.h>

Inheritance diagram for L1RCTProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginLuminosityBlock (edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context)
 
virtual void beginRun (edm::Run &r, const edm::EventSetup &c)
 
 L1RCTProducer (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &e, const edm::EventSetup &c)
 
void updateConfiguration (const edm::EventSetup &)
 
virtual ~L1RCTProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Types

enum  crateSection {
  c_min, ebOddFed = c_min, ebEvenFed, eeFed,
  hbheFed, hfFed, c_max = hfFed
}
 

Private Attributes

std::vector< int > bunchCrossings
 
std::vector< edm::InputTagecalDigis
 
L1RCTChannelMaskfedUpdatedMask
 
std::vector< edm::InputTaghcalDigis
 
L1RCTrct
 
L1RCTLookupTablesrctLookupTables
 
bool useEcal
 
bool useHcal
 

Static Private Attributes

static const int crateFED [18][5]
 
static const int maxBarrel = 17
 
static const int maxEndcap = 28
 
static const int maxHF =32
 
static const int minBarrel = 1
 
static const int minEndcap = 17
 
static const int minHF = 29
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 48 of file L1RCTProducer.h.

Member Enumeration Documentation

Enumerator
c_min 
ebOddFed 
ebEvenFed 
eeFed 
hbheFed 
hfFed 
c_max 

Definition at line 76 of file L1RCTProducer.h.

Constructor & Destructor Documentation

L1RCTProducer::L1RCTProducer ( const edm::ParameterSet ps)
explicit

Definition at line 34 of file L1RCTProducer.cc.

34  :
37  useEcal(conf.getParameter<bool>("useEcal")),
38  useHcal(conf.getParameter<bool>("useHcal")),
39  ecalDigis(conf.getParameter<std::vector<edm::InputTag> >("ecalDigis")),
40  hcalDigis(conf.getParameter<std::vector<edm::InputTag> >("hcalDigis")),
41  bunchCrossings(conf.getParameter<std::vector<int> >("BunchCrossings")),
43 {
44  produces<L1CaloEmCollection>();
45  produces<L1CaloRegionCollection>();
46 
47 
48 
49 }
L1RCTLookupTables * rctLookupTables
Definition: L1RCTProducer.h:63
std::vector< edm::InputTag > hcalDigis
Definition: L1RCTProducer.h:68
std::vector< edm::InputTag > ecalDigis
Definition: L1RCTProducer.h:67
std::vector< int > bunchCrossings
Definition: L1RCTProducer.h:69
tuple conf
Definition: dbtoconf.py:185
L1RCTChannelMask * fedUpdatedMask
Definition: L1RCTProducer.h:73
Definition: L1RCT.h:20
L1RCTProducer::~L1RCTProducer ( )
virtual

Definition at line 51 of file L1RCTProducer.cc.

References fedUpdatedMask, rct, and rctLookupTables.

52 {
53  if(rct != 0) delete rct;
54  if(rctLookupTables != 0) delete rctLookupTables;
55  if(fedUpdatedMask != 0) delete fedUpdatedMask;
56 }
L1RCTLookupTables * rctLookupTables
Definition: L1RCTProducer.h:63
L1RCTChannelMask * fedUpdatedMask
Definition: L1RCTProducer.h:73

Member Function Documentation

void L1RCTProducer::beginLuminosityBlock ( edm::LuminosityBlock lumiSeg,
const edm::EventSetup context 
)
virtual

Reimplemented from edm::EDProducer.

Definition at line 64 of file L1RCTProducer.cc.

References updateConfiguration().

65 {
66  updateConfiguration(context);
67 }
void updateConfiguration(const edm::EventSetup &)
void L1RCTProducer::beginRun ( edm::Run r,
const edm::EventSetup c 
)
virtual

Reimplemented from edm::EDProducer.

Definition at line 59 of file L1RCTProducer.cc.

60 {
61 
62 }
void L1RCTProducer::produce ( edm::Event e,
const edm::EventSetup c 
)
virtual

Implements edm::EDProducer.

Definition at line 247 of file L1RCTProducer.cc.

References bunchCrossings, L1RCT::digiInput(), patCandidatesForDimuonsSequences_cff::ecal, ecalDigis, edm::hlt::Exception, edm::Event::getByLabel(), L1RCT::getIsolatedEGObjects(), L1RCT::getNonisolatedEGObjects(), L1RCT::getRegions(), patCandidatesForDimuonsSequences_cff::hcal, hcalDigis, i, j, L1RCT::processEvent(), rct, useEcal, and useHcal.

248 {
249 
250 
251  std::auto_ptr<L1CaloEmCollection> rctEmCands (new L1CaloEmCollection);
252  std::auto_ptr<L1CaloRegionCollection> rctRegions (new L1CaloRegionCollection);
253 
254 
255  if(!(ecalDigis.size()==hcalDigis.size()&&hcalDigis.size()==bunchCrossings.size()))
256  throw cms::Exception("BadInput")
257  << "From what I see the number of your your ECAL input digi collections.\n"
258  <<"is different from the size of your HCAL digi input collections\n"
259  <<"or the size of your BX factor collection"
260  <<"They must be the same to correspond to the same Bxs\n"
261  << "It does not matter if one of them is empty\n";
262 
263 
264 
265 
266  // loop through and process each bx
267  for (unsigned short sample = 0; sample < bunchCrossings.size(); sample++)
268  {
271 
274 
275 
276  if(useHcal&&event.getByLabel(hcalDigis[sample], hcal))
277  hcalIn = *hcal;
278 
279  if(useEcal&&event.getByLabel(ecalDigis[sample],ecal))
280  ecalIn = *ecal;
281 
282  rct->digiInput(ecalIn,hcalIn);
283  rct->processEvent();
284 
285  // Stuff to create
286  for (int j = 0; j<18; j++)
287  {
288  L1CaloEmCollection isolatedEGObjects = rct->getIsolatedEGObjects(j);
289  L1CaloEmCollection nonisolatedEGObjects = rct->getNonisolatedEGObjects(j);
290  for (int i = 0; i<4; i++)
291  {
292  isolatedEGObjects.at(i).setBx(bunchCrossings[sample]);
293  nonisolatedEGObjects.at(i).setBx(bunchCrossings[sample]);
294  rctEmCands->push_back(isolatedEGObjects.at(i));
295  rctEmCands->push_back(nonisolatedEGObjects.at(i));
296  }
297  }
298 
299 
300  for (int i = 0; i < 18; i++)
301  {
302  std::vector<L1CaloRegion> regions = rct->getRegions(i);
303  for (int j = 0; j < 22; j++)
304  {
305  regions.at(j).setBx(bunchCrossings[sample]);
306  rctRegions->push_back(regions.at(j));
307  }
308  }
309 
310  }
311 
312 
313  //putting stuff back into event
314  event.put(rctEmCands);
315  event.put(rctRegions);
316 
317 }
int i
Definition: DBlmapReader.cc:9
std::vector< L1CaloEmCand > L1CaloEmCollection
std::vector< L1CaloRegion > getRegions(unsigned crate)
Definition: L1RCT.cc:363
L1CaloEmCollection getNonisolatedEGObjects(unsigned crate)
Definition: L1RCT.cc:349
std::vector< edm::InputTag > hcalDigis
Definition: L1RCTProducer.h:68
std::vector< edm::InputTag > ecalDigis
Definition: L1RCTProducer.h:67
std::vector< int > bunchCrossings
Definition: L1RCTProducer.h:69
L1CaloEmCollection getIsolatedEGObjects(unsigned crate)
Definition: L1RCT.cc:332
int j
Definition: DBlmapReader.cc:9
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
void processEvent()
Definition: L1RCT.cc:36
void digiInput(const EcalTrigPrimDigiCollection &ecalCollection, const HcalTrigPrimDigiCollection &hcalCollection)
Definition: L1RCT.cc:116
std::vector< L1CaloRegion > L1CaloRegionCollection
void L1RCTProducer::updateConfiguration ( const edm::EventSetup eventSetup)

Definition at line 71 of file L1RCTProducer.cc.

References c_max, c_min, crateFED, ebEvenFed, ebOddFed, patCandidatesForDimuonsSequences_cff::ecal, L1RCTChannelMask::ecalMask, eeFed, fedUpdatedMask, spr::find(), edm::EventSetup::get(), h, hbheFed, L1RCTChannelMask::hcalMask, hfFed, L1RCTChannelMask::hfMask, i, j, gen::k, RunInfo::m_fed_in, maxBarrel, maxEndcap, maxHF, minBarrel, minEndcap, minHF, edm::ESHandle< class >::product(), csvReporter::r, rctLookupTables, asciidump::s, L1RCTLookupTables::setChannelMask(), L1RCTLookupTables::setEcalScale(), L1RCTLookupTables::setHcalScale(), L1RCTLookupTables::setL1CaloEtScale(), L1RCTLookupTables::setNoisyChannelMask(), L1RCTLookupTables::setRCTParameters(), and summarizeEdmComparisonLogfiles::summary.

Referenced by beginLuminosityBlock().

72 {
73  // Refresh configuration information every event
74  // Hopefully, this does not take too much time
75  // There should be a call back function in future to
76  // handle changes in configuration
77  // parameters to configure RCT (thresholds, etc)
78  edm::ESHandle<L1RCTParameters> rctParameters;
79  eventSetup.get<L1RCTParametersRcd>().get(rctParameters);
80  const L1RCTParameters* r = rctParameters.product();
81 
82  // list of RCT channels to mask
84  eventSetup.get<L1RCTChannelMaskRcd>().get(channelMask);
85  const L1RCTChannelMask* cEs = channelMask.product();
86 
87 
88  // list of Noisy RCT channels to mask
90  eventSetup.get<L1RCTNoisyChannelMaskRcd>().get(hotChannelMask);
91  const L1RCTNoisyChannelMask* cEsNoise = hotChannelMask.product();
93 
94 
95 
96  //Update the channel mask according to the FED VECTOR
97  //This is the beginning of run. We delete the old
98  //create the new and set it in the LUTs
99 
100  if(fedUpdatedMask!=0) delete fedUpdatedMask;
101 
103  // copy a constant object
104  for (int i = 0; i < 18; i++)
105  {
106  for (int j = 0; j < 2; j++)
107  {
108  for (int k = 0; k < 28; k++)
109  {
110  fedUpdatedMask->ecalMask[i][j][k] = cEs->ecalMask[i][j][k];
111  fedUpdatedMask->hcalMask[i][j][k] =cEs->hcalMask[i][j][k] ;
112  }
113  for (int k = 0; k < 4; k++)
114  {
115  fedUpdatedMask->hfMask[i][j][k] = cEs->hfMask[i][j][k];
116  }
117  }
118  }
119 
120 
121  // adding fed mask into channel mask
123  eventSetup.get<RunInfoRcd>().get(sum);
124  const RunInfo* summary=sum.product();
125 
126 
127  std::vector<int> caloFeds; // pare down the feds to the intresting ones
128  // is this unneccesary?
129  // Mike B : This will decrease the find speed so better do it
130  const std::vector<int> Feds = summary->m_fed_in;
131  for(std::vector<int>::const_iterator cf = Feds.begin(); cf != Feds.end(); ++cf){
132  int fedNum = *cf;
133  if(fedNum > 600 && fedNum <724)
134  caloFeds.push_back(fedNum);
135  }
136 
137  for(int cr = 0; cr < 18; ++cr){
138 
139  for(crateSection cs = c_min; cs <= c_max; cs = crateSection(cs +1)) {
140  bool fedFound = false;
141 
142 
143  //Try to find the FED
144  std::vector<int>::iterator fv = std::find(caloFeds.begin(),caloFeds.end(),crateFED[cr][cs]);
145  if(fv!=caloFeds.end())
146  fedFound = true;
147 
148  if(!fedFound) {
149  int eta_min=0;
150  int eta_max=0;
151  bool phi_even[2] = {false};//, phi_odd = false;
152  bool ecal=false;
153 
154  switch (cs) {
155  case ebEvenFed :
156  eta_min = minBarrel;
157  eta_max = maxBarrel;
158  phi_even[0] = true;
159  ecal = true;
160  break;
161 
162  case ebOddFed:
163  eta_min = minBarrel;
164  eta_max = maxBarrel;
165  phi_even[1] = true;
166  ecal = true;
167  break;
168 
169  case eeFed:
170  eta_min = minEndcap;
171  eta_max = maxEndcap;
172  phi_even[0] = true;
173  phi_even[1] = true;
174  ecal = true;
175  break;
176 
177  case hbheFed:
178  eta_min = minBarrel;
179  eta_max = maxEndcap;
180  phi_even[0] = true;
181  phi_even[1] = true;
182  ecal = false;
183  break;
184 
185  case hfFed:
186  eta_min = minHF;
187  eta_max = maxHF;
188 
189  phi_even[0] = true;
190  phi_even[1] = true;
191  ecal = false;
192  break;
193  default:
194  break;
195 
196  }
197  for(int ieta = eta_min; ieta <= eta_max; ++ieta){
198  if(ieta<=28) // barrel and endcap
199  for(int even = 0; even<=1 ; even++){
200  if(phi_even[even]){
201  if(ecal)
202  fedUpdatedMask->ecalMask[cr][even][ieta-1] = true;
203  else
204  fedUpdatedMask->hcalMask[cr][even][ieta-1] = true;
205  }
206  }
207  else
208  for(int even = 0; even<=1 ; even++)
209  if(phi_even[even])
210  fedUpdatedMask->hfMask[cr][even][ieta-29] = true;
211 
212  }
213  }
214  }
215  }
216 
217 
218  //SCALES
219 
220  // energy scale to convert eGamma output
222  eventSetup.get<L1EmEtScaleRcd>().get(emScale);
223  const L1CaloEtScale* s = emScale.product();
224 
225 
226  // get energy scale to convert input from ECAL
228  eventSetup.get<L1CaloEcalScaleRcd>().get(ecalScale);
229  const L1CaloEcalScale* e = ecalScale.product();
230 
231  // get energy scale to convert input from HCAL
233  eventSetup.get<L1CaloHcalScaleRcd>().get(hcalScale);
234  const L1CaloHcalScale* h = hcalScale.product();
235 
236  // set scales
239 
240 
244 }
int i
Definition: DBlmapReader.cc:9
static const int minHF
Definition: L1RCTProducer.h:93
L1RCTLookupTables * rctLookupTables
Definition: L1RCTProducer.h:63
bool ecalMask[18][2][28]
static const int crateFED[18][5]
Definition: L1RCTProducer.h:88
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
static const int maxHF
Definition: L1RCTProducer.h:94
void setHcalScale(const L1CaloHcalScale *hcalScale)
std::vector< int > m_fed_in
Definition: RunInfo.h:24
int j
Definition: DBlmapReader.cc:9
void setL1CaloEtScale(const L1CaloEtScale *etScale)
static const int minBarrel
Definition: L1RCTProducer.h:89
int k[5][pyjets_maxn]
static const int minEndcap
Definition: L1RCTProducer.h:91
L1RCTChannelMask * fedUpdatedMask
Definition: L1RCTProducer.h:73
const T & get() const
Definition: EventSetup.h:55
static const int maxBarrel
Definition: L1RCTProducer.h:90
T const * product() const
Definition: ESHandle.h:62
void setEcalScale(const L1CaloEcalScale *ecalScale)
void setRCTParameters(const L1RCTParameters *rctParameters)
static const int maxEndcap
Definition: L1RCTProducer.h:92
void setNoisyChannelMask(const L1RCTNoisyChannelMask *channelMask)
bool hcalMask[18][2][28]
string s
Definition: asciidump.py:422
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
bool hfMask[18][2][4]
void setChannelMask(const L1RCTChannelMask *channelMask)

Member Data Documentation

std::vector<int> L1RCTProducer::bunchCrossings
private

Definition at line 69 of file L1RCTProducer.h.

Referenced by produce().

const int L1RCTProducer::crateFED
staticprivate
Initial value:
=
{{613, 614, 603, 702, 718},
{611, 612, 602, 700, 718},
{627, 610, 601,716, 722},
{625, 626, 609, 714, 722},
{623, 624, 608, 712, 722},
{621, 622, 607, 710, 720},
{619, 620, 606, 708, 720},
{617, 618, 605, 706, 720},
{615, 616, 604, 704, 718},
{631, 632, 648, 703, 719},
{629, 630, 647, 701, 719},
{645, 628, 646, 717, 723},
{643, 644, 654, 715, 723},
{641, 642, 653, 713, 723},
{639, 640, 652, 711, 721},
{637, 638, 651, 709, 721},
{635, 636, 650, 707, 721},
{633, 634, 649, 705, 719}}

Definition at line 88 of file L1RCTProducer.h.

Referenced by updateConfiguration().

std::vector<edm::InputTag> L1RCTProducer::ecalDigis
private

Definition at line 67 of file L1RCTProducer.h.

Referenced by produce().

L1RCTChannelMask* L1RCTProducer::fedUpdatedMask
private

Definition at line 73 of file L1RCTProducer.h.

Referenced by updateConfiguration(), and ~L1RCTProducer().

std::vector<edm::InputTag> L1RCTProducer::hcalDigis
private

Definition at line 68 of file L1RCTProducer.h.

Referenced by produce().

const int L1RCTProducer::maxBarrel = 17
staticprivate

Definition at line 90 of file L1RCTProducer.h.

Referenced by updateConfiguration().

const int L1RCTProducer::maxEndcap = 28
staticprivate

Definition at line 92 of file L1RCTProducer.h.

Referenced by updateConfiguration().

const int L1RCTProducer::maxHF =32
staticprivate

Definition at line 94 of file L1RCTProducer.h.

Referenced by updateConfiguration().

const int L1RCTProducer::minBarrel = 1
staticprivate

Definition at line 89 of file L1RCTProducer.h.

Referenced by updateConfiguration().

const int L1RCTProducer::minEndcap = 17
staticprivate

Definition at line 91 of file L1RCTProducer.h.

Referenced by updateConfiguration().

const int L1RCTProducer::minHF = 29
staticprivate

Definition at line 93 of file L1RCTProducer.h.

Referenced by updateConfiguration().

L1RCT* L1RCTProducer::rct
private

Definition at line 64 of file L1RCTProducer.h.

Referenced by produce(), and ~L1RCTProducer().

L1RCTLookupTables* L1RCTProducer::rctLookupTables
private

Definition at line 63 of file L1RCTProducer.h.

Referenced by updateConfiguration(), and ~L1RCTProducer().

bool L1RCTProducer::useEcal
private

Definition at line 65 of file L1RCTProducer.h.

Referenced by produce().

bool L1RCTProducer::useHcal
private

Definition at line 66 of file L1RCTProducer.h.

Referenced by produce().