CMS 3D CMS Logo

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::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, const edm::EventSetup &context) final
 
void beginRun (edm::Run const &r, const edm::EventSetup &c) final
 
const std::vector< int > getFedVectorFromOmds (const edm::EventSetup &)
 
const std::vector< int > getFedVectorFromRunInfo (const edm::EventSetup &)
 
 L1RCTProducer (const edm::ParameterSet &ps)
 
void printFedVector (const std::vector< int > &)
 
void printUpdatedFedMask ()
 
void printUpdatedFedMaskVerbose ()
 
void produce (edm::Event &e, const edm::EventSetup &c) final
 
void updateConfiguration (const edm::EventSetup &)
 
void updateFedVector (const edm::EventSetup &, bool getFromOmds, int)
 
 ~L1RCTProducer () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Types

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

Private Attributes

std::vector< int > bunchCrossings
 
std::string conditionsLabel
 
std::vector< edm::InputTagecalDigis
 
L1RCTChannelMaskfedUpdatedMask
 
bool getFedsFromOmds
 
std::vector< edm::InputTaghcalDigis
 
unsigned int queryDelayInLS
 
unsigned int queryIntervalInLS
 
L1RCTrct
 
L1RCTLookupTablesrctLookupTables
 
bool useEcal
 
bool useHcal
 

Static Private Attributes

static const int crateFED [18][6]
 
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
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ESProduct , Transition Tr = Transition::Event>
auto esConsumes (eventsetup::EventSetupRecordKey const &, ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 47 of file L1RCTProducer.h.

Member Enumeration Documentation

Enumerator
c_min 
ebOddFed 
ebEvenFed 
eeFed 
hbheFed 
hfFed 
hfFedUp 
c_max 

Definition at line 84 of file L1RCTProducer.h.

Constructor & Destructor Documentation

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

Definition at line 36 of file L1RCTProducer.cc.

References ecalDigis, and hcalDigis.

36  :
39  useEcal(conf.getParameter<bool>("useEcal")),
40  useHcal(conf.getParameter<bool>("useHcal")),
41  ecalDigis(conf.getParameter<std::vector<edm::InputTag> >("ecalDigis")),
42  hcalDigis(conf.getParameter<std::vector<edm::InputTag> >("hcalDigis")),
43  bunchCrossings(conf.getParameter<std::vector<int> >("BunchCrossings")),
44  getFedsFromOmds(conf.getParameter<bool>("getFedsFromOmds")),
45  queryDelayInLS(conf.getParameter<unsigned int>("queryDelayInLS")),
46  queryIntervalInLS(conf.getParameter<unsigned int>("queryIntervalInLS")),
47  conditionsLabel(conf.getParameter<std::string>("conditionsLabel")),
48  fedUpdatedMask(nullptr)
49 {
50  produces<L1CaloEmCollection>();
51  produces<L1CaloRegionCollection>();
52 
53  for(unsigned int ihc=0;ihc<hcalDigis.size();ihc++){
54  consumes<edm::SortedCollection<HcalTriggerPrimitiveDigi,edm::StrictWeakOrdering<HcalTriggerPrimitiveDigi> > >(hcalDigis[ihc]);
55  }
56 
57  for(unsigned int iec=0;iec<ecalDigis.size();iec++){
58  consumes<edm::SortedCollection<EcalTriggerPrimitiveDigi,edm::StrictWeakOrdering<EcalTriggerPrimitiveDigi> > >(ecalDigis[iec]);
59  }
60 }
std::string conditionsLabel
Definition: L1RCTProducer.h:78
L1RCTLookupTables * rctLookupTables
Definition: L1RCTProducer.h:68
unsigned int queryDelayInLS
Definition: L1RCTProducer.h:76
bool getFedsFromOmds
Definition: L1RCTProducer.h:75
std::vector< edm::InputTag > hcalDigis
Definition: L1RCTProducer.h:73
std::vector< edm::InputTag > ecalDigis
Definition: L1RCTProducer.h:72
std::vector< int > bunchCrossings
Definition: L1RCTProducer.h:74
L1RCTChannelMask * fedUpdatedMask
Definition: L1RCTProducer.h:81
unsigned int queryIntervalInLS
Definition: L1RCTProducer.h:77
Definition: L1RCT.h:20
L1RCTProducer::~L1RCTProducer ( )
override

Definition at line 62 of file L1RCTProducer.cc.

References fedUpdatedMask, rct, and rctLookupTables.

63 {
64  if(rct != nullptr) delete rct;
65  if(rctLookupTables != nullptr) delete rctLookupTables;
66  if(fedUpdatedMask != nullptr) delete fedUpdatedMask;
67 }
L1RCTLookupTables * rctLookupTables
Definition: L1RCTProducer.h:68
L1RCTChannelMask * fedUpdatedMask
Definition: L1RCTProducer.h:81

Member Function Documentation

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

Definition at line 82 of file L1RCTProducer.cc.

References getFedsFromOmds, edm::LuminosityBlockBase::luminosityBlock(), queryDelayInLS, queryIntervalInLS, edm::LuminosityBlockBase::run(), convertSQLiteXML::runNumber, and updateFedVector().

83 {
84  // check LS number every LS, if the checkOMDS flag is set AND it's the right LS, update the FED vector from OMDS
85  // can pass the flag as the bool?? but only check LS number if flag is true anyhow
86  if (getFedsFromOmds)
87  {
88  unsigned int nLumi = lumiSeg.luminosityBlock(); // doesn't even need the (unsigned int) cast because LuminosityBlockNumber_t is already an unsigned int
89  // LS count starts at 1, want to be able to delay 0 LS's intuitively
90  if ( ( (nLumi - 1) == queryDelayInLS)
91  || (queryIntervalInLS > 0 && nLumi % queryIntervalInLS == 0 ) ) // to guard against problems if online DQM crashes; every 100 LS is ~20-30 minutes, not too big a load, hopefully not too long between
92  {
93  int runNumber = lumiSeg.run();
94  // std::cout << "Lumi section for this FED vector update is " << nLumi << std::endl;
95  updateFedVector(context,true,runNumber); // OMDS
96  }
97  else if (queryIntervalInLS <= 0)
98  {
99  // don't do interval checking... cout message??
100  }
101  }
102 }
unsigned int queryDelayInLS
Definition: L1RCTProducer.h:76
bool getFedsFromOmds
Definition: L1RCTProducer.h:75
void updateFedVector(const edm::EventSetup &, bool getFromOmds, int)
unsigned int queryIntervalInLS
Definition: L1RCTProducer.h:77
void L1RCTProducer::beginRun ( edm::Run const &  r,
const edm::EventSetup c 
)
final

Definition at line 70 of file L1RCTProducer.cc.

References edm::RunBase::run(), convertSQLiteXML::runNumber, updateConfiguration(), and updateFedVector().

71 {
72  // std::cout << "getFedsFromOmds is " << getFedsFromOmds << std::endl;
73 
74  updateConfiguration(eventSetup);
75 
76  int runNumber = run.run();
77  updateFedVector(eventSetup,false,runNumber); // RUNINFO ONLY at beginning of run
78 
79 }
void updateConfiguration(const edm::EventSetup &)
void updateFedVector(const edm::EventSetup &, bool getFromOmds, int)
const std::vector< int > L1RCTProducer::getFedVectorFromOmds ( const edm::EventSetup eventSetup)

Definition at line 328 of file L1RCTProducer.cc.

References edm::EventSetup::get(), getFedVectorFromRunInfo(), edm::ESHandleBase::isValid(), RunInfo::m_fed_in, edm::ESHandle< T >::product(), and heppy_report::summary.

Referenced by updateFedVector().

329 {
330 
331  // std::cout << "Getting FED vector from my specific ES RunInfo object" << std::endl;
332 
333  // get FULL FED vector from RunInfo object specifically created to have OMDS fed vector
335  eventSetup.get<RunInfoRcd>().get("OmdsFedVector",sum); // using label to get my specific instance of RunInfo
336  if (sum.isValid())
337  {
338  const RunInfo* summary=sum.product();
339  const std::vector<int> fedvector = summary->m_fed_in;
340 
341  return fedvector;
342  }
343  else
344  {
345  return getFedVectorFromRunInfo(eventSetup);
346  }
347 
348 }
const std::vector< int > getFedVectorFromRunInfo(const edm::EventSetup &)
std::vector< int > m_fed_in
Definition: RunInfo.h:26
T get() const
Definition: EventSetup.h:68
bool isValid() const
Definition: ESHandle.h:45
T const * product() const
Definition: ESHandle.h:84
const std::vector< int > L1RCTProducer::getFedVectorFromRunInfo ( const edm::EventSetup eventSetup)

Definition at line 315 of file L1RCTProducer.cc.

References edm::EventSetup::get(), RunInfo::m_fed_in, edm::ESHandle< T >::product(), and heppy_report::summary.

Referenced by getFedVectorFromOmds(), and updateFedVector().

316 {
317  // std::cout << "Getting FED vector from standard RunInfo object" << std::endl;
318  // get FULL FED vector from RUNINFO
320  eventSetup.get<RunInfoRcd>().get(sum);
321  const RunInfo* summary=sum.product();
322  const std::vector<int> fedvector = summary->m_fed_in;
323 
324  return fedvector;
325 }
std::vector< int > m_fed_in
Definition: RunInfo.h:26
T get() const
Definition: EventSetup.h:68
T const * product() const
Definition: ESHandle.h:84
void L1RCTProducer::printFedVector ( const std::vector< int > &  fedVector)

Definition at line 425 of file L1RCTProducer.cc.

References popcon2dropbox::copy(), and gather_cfg::cout.

426 {
427  std::cout << "Contents of given fedVector: ";
428  std::copy(fedVector.begin(), fedVector.end(), std::ostream_iterator<int>(std::cout, ", "));
429  std::cout << std::endl;
430 }
def copy(args, dbName)
void L1RCTProducer::printUpdatedFedMask ( )

Definition at line 433 of file L1RCTProducer.cc.

References gather_cfg::cout, fedUpdatedMask, and L1RCTChannelMask::print().

434 {
435  if (fedUpdatedMask != nullptr)
436  {
438  }
439  else
440  {
441  std::cout << "Trying to print contents of fedUpdatedMask, but it doesn't exist!" << std::endl;
442  }
443 }
void print(std::ostream &s) const
L1RCTChannelMask * fedUpdatedMask
Definition: L1RCTProducer.h:81
void L1RCTProducer::printUpdatedFedMaskVerbose ( )

Definition at line 446 of file L1RCTProducer.cc.

References gather_cfg::cout, L1RCTChannelMask::ecalMask, fedUpdatedMask, L1RCTChannelMask::hcalMask, L1RCTChannelMask::hfMask, mps_fire::i, and gen::k.

447 {
448  if (fedUpdatedMask != nullptr)
449  {
450  // print contents of fedvector
451  std::cout << "Contents of fedUpdatedMask: ";
452 // std::copy(fedUpdatedMask.begin(), fedUpdatedMask.end(), std::ostream_iterator<int>(std::cout, ", "));
453  std::cout << "--> ECAL mask: " << std::endl;
454  for (int i = 0; i < 18; i++)
455  {
456  for (int j = 0; j < 2; j++)
457  {
458  for (int k = 0; k < 28; k++)
459  {
460  std::cout << fedUpdatedMask->ecalMask[i][j][k] << ", ";
461  }
462  }
463  }
464  std::cout << "--> HCAL mask: " << std::endl;
465  for (int i = 0; i < 18; i++)
466  {
467  for (int j = 0; j < 2; j++)
468  {
469  for (int k = 0; k < 28; k++)
470  {
471  std::cout << fedUpdatedMask->hcalMask[i][j][k] << ", ";
472  }
473  }
474  }
475  std::cout << "--> HF mask: " << std::endl;
476  for (int i = 0; i < 18; i++)
477  {
478  for (int j = 0; j < 2; j++)
479  {
480  for (int k = 0; k < 4; k++)
481  {
482  std::cout << fedUpdatedMask->hfMask[i][j][k] << ", ";
483  }
484  }
485  }
486 
487  std::cout << std::endl;
488  }
489  else
490  {
491  //print error message
492  std::cout << "Trying to print contents of fedUpdatedMask, but it doesn't exist!" << std::endl;
493  }
494 }
bool ecalMask[18][2][28]
int k[5][pyjets_maxn]
L1RCTChannelMask * fedUpdatedMask
Definition: L1RCTProducer.h:81
bool hcalMask[18][2][28]
bool hfMask[18][2][4]
void L1RCTProducer::produce ( edm::Event e,
const edm::EventSetup c 
)
final

Definition at line 352 of file L1RCTProducer.cc.

References bunchCrossings, L1RCT::digiInput(), digitizers_cfi::ecal, ecalDigis, Exception, edm::Event::getByLabel(), L1RCT::getIsolatedEGObjects(), L1RCT::getNonisolatedEGObjects(), L1RCT::getRegions(), digitizers_cfi::hcal, hcalDigis, mps_fire::i, eostools::move(), L1RCT::processEvent(), rct, simplePhotonAnalyzer_cfi::sample, useEcal, and useHcal.

353 {
354 
355 
356  std::unique_ptr<L1CaloEmCollection> rctEmCands (new L1CaloEmCollection);
357  std::unique_ptr<L1CaloRegionCollection> rctRegions (new L1CaloRegionCollection);
358 
359 
360  if(!(ecalDigis.size()==hcalDigis.size()&&hcalDigis.size()==bunchCrossings.size()))
361  throw cms::Exception("BadInput")
362  << "From what I see the number of your your ECAL input digi collections.\n"
363  <<"is different from the size of your HCAL digi input collections\n"
364  <<"or the size of your BX factor collection"
365  <<"They must be the same to correspond to the same Bxs\n"
366  << "It does not matter if one of them is empty\n";
367 
368 
369 
370 
371  // loop through and process each bx
372  for (unsigned short sample = 0; sample < bunchCrossings.size(); sample++)
373  {
376 
379 
380 
381  if(useHcal&&event.getByLabel(hcalDigis[sample], hcal))
382  hcalIn = *hcal;
383 
384  if(useEcal&&event.getByLabel(ecalDigis[sample],ecal))
385  ecalIn = *ecal;
386 
387  rct->digiInput(ecalIn,hcalIn);
388  rct->processEvent();
389 
390  // Stuff to create
391  for (int j = 0; j<18; j++)
392  {
393  L1CaloEmCollection isolatedEGObjects = rct->getIsolatedEGObjects(j);
394  L1CaloEmCollection nonisolatedEGObjects = rct->getNonisolatedEGObjects(j);
395  for (int i = 0; i<4; i++)
396  {
397  isolatedEGObjects.at(i).setBx(bunchCrossings[sample]);
398  nonisolatedEGObjects.at(i).setBx(bunchCrossings[sample]);
399  rctEmCands->push_back(isolatedEGObjects.at(i));
400  rctEmCands->push_back(nonisolatedEGObjects.at(i));
401  }
402  }
403 
404 
405  for (int i = 0; i < 18; i++)
406  {
407  std::vector<L1CaloRegion> regions = rct->getRegions(i);
408  for (int j = 0; j < 22; j++)
409  {
410  regions.at(j).setBx(bunchCrossings[sample]);
411  rctRegions->push_back(regions.at(j));
412  }
413  }
414 
415  }
416 
417 
418  //putting stuff back into event
419  event.put(std::move(rctEmCands));
420  event.put(std::move(rctRegions));
421 
422 }
std::vector< L1CaloEmCand > L1CaloEmCollection
std::vector< L1CaloRegion > getRegions(unsigned crate)
Definition: L1RCT.cc:366
L1CaloEmCollection getNonisolatedEGObjects(unsigned crate)
Definition: L1RCT.cc:352
std::vector< edm::InputTag > hcalDigis
Definition: L1RCTProducer.h:73
std::vector< edm::InputTag > ecalDigis
Definition: L1RCTProducer.h:72
std::vector< int > bunchCrossings
Definition: L1RCTProducer.h:74
L1CaloEmCollection getIsolatedEGObjects(unsigned crate)
Definition: L1RCT.cc:335
void processEvent()
Definition: L1RCT.cc:36
void digiInput(const EcalTrigPrimDigiCollection &ecalCollection, const HcalTrigPrimDigiCollection &hcalCollection)
Definition: L1RCT.cc:116
std::vector< L1CaloRegion > L1CaloRegionCollection
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1
void L1RCTProducer::updateConfiguration ( const edm::EventSetup eventSetup)

Definition at line 106 of file L1RCTProducer.cc.

References conditionsLabel, MillePedeFileConverter_cfg::e, edm::EventSetup::get(), h, edm::ESHandle< T >::product(), alignCSCRings::r, rctLookupTables, alignCSCRings::s, L1RCTLookupTables::setEcalScale(), L1RCTLookupTables::setHcalScale(), L1RCTLookupTables::setL1CaloEtScale(), and L1RCTLookupTables::setRCTParameters().

Referenced by beginRun().

107 {
108  // Refresh configuration information every event
109  // Hopefully, this does not take too much time
110  // There should be a call back function in future to
111  // handle changes in configuration
112  // parameters to configure RCT (thresholds, etc)
113  edm::ESHandle<L1RCTParameters> rctParameters;
114  eventSetup.get<L1RCTParametersRcd>().get(conditionsLabel, rctParameters);
115  const L1RCTParameters* r = rctParameters.product();
116 
117  //SCALES
118 
119  // energy scale to convert eGamma output
121  eventSetup.get<L1EmEtScaleRcd>().get(conditionsLabel, emScale);
122  const L1CaloEtScale* s = emScale.product();
123 
124  // get energy scale to convert input from ECAL
126  eventSetup.get<L1CaloEcalScaleRcd>().get(conditionsLabel, ecalScale);
127  const L1CaloEcalScale* e = ecalScale.product();
128 
129  // get energy scale to convert input from HCAL
131  eventSetup.get<L1CaloHcalScaleRcd>().get(conditionsLabel, hcalScale);
132  const L1CaloHcalScale* h = hcalScale.product();
133 
134  // set scales
137 
140 }
std::string conditionsLabel
Definition: L1RCTProducer.h:78
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
L1RCTLookupTables * rctLookupTables
Definition: L1RCTProducer.h:68
void setHcalScale(const L1CaloHcalScale *hcalScale)
void setL1CaloEtScale(const L1CaloEtScale *etScale)
void setEcalScale(const L1CaloEcalScale *ecalScale)
void setRCTParameters(const L1RCTParameters *rctParameters)
T get() const
Definition: EventSetup.h:68
T const * product() const
Definition: ESHandle.h:84
void L1RCTProducer::updateFedVector ( const edm::EventSetup eventSetup,
bool  getFromOmds,
int  runNumber 
)

Definition at line 143 of file L1RCTProducer.cc.

References c_max, c_min, crateFED, fwrapper::cs, ebEvenFed, ebOddFed, digitizers_cfi::ecal, L1RCTChannelMask::ecalMask, eeFed, MuonTCMETValueMapProducer_cff::eta_max, MuonME0RecHits_cfi::eta_min, fedUpdatedMask, spr::find(), edm::EventSetup::get(), getFedVectorFromOmds(), getFedVectorFromRunInfo(), hbheFed, L1RCTChannelMask::hcalMask, hfFed, hfFedUp, L1RCTChannelMask::hfMask, mps_fire::i, gen::k, maxBarrel, maxEndcap, maxHF, minBarrel, minEndcap, minHF, edm::ESHandle< T >::product(), rctLookupTables, L1RCTLookupTables::setChannelMask(), and L1RCTLookupTables::setNoisyChannelMask().

Referenced by beginLuminosityBlock(), and beginRun().

144 {
145  // list of RCT channels to mask
147  eventSetup.get<L1RCTChannelMaskRcd>().get(channelMask);
148  const L1RCTChannelMask* cEs = channelMask.product();
149 
150 
151  // list of Noisy RCT channels to mask
153  eventSetup.get<L1RCTNoisyChannelMaskRcd>().get(hotChannelMask);
154  const L1RCTNoisyChannelMask* cEsNoise = hotChannelMask.product();
156 
157 
158 
159  //Update the channel mask according to the FED VECTOR
160  //This is the beginning of run. We delete the old
161  //create the new and set it in the LUTs
162 
163  if(fedUpdatedMask!=nullptr) delete fedUpdatedMask;
164 
166  // copy a constant object
167  for (int i = 0; i < 18; i++)
168  {
169  for (int j = 0; j < 2; j++)
170  {
171  for (int k = 0; k < 28; k++)
172  {
173  fedUpdatedMask->ecalMask[i][j][k] = cEs->ecalMask[i][j][k];
174  fedUpdatedMask->hcalMask[i][j][k] = cEs->hcalMask[i][j][k] ;
175  }
176  for (int k = 0; k < 4; k++)
177  {
178  fedUpdatedMask->hfMask[i][j][k] = cEs->hfMask[i][j][k];
179  }
180  }
181  }
182 
183 
184 // // adding fed mask into channel mask
185 
186  const std::vector<int> Feds = getFromOmds ? getFedVectorFromOmds(eventSetup) : getFedVectorFromRunInfo(eventSetup);
187  // so can create/initialize/assign const quantity in one line accounting for if statement
188  // wikipedia says this is exactly what it's for: http://en.wikipedia.org/wiki/%3F:#C.2B.2B
189 
190 // std::cout << "Contents of ";
191 // std::cout << (getFromOmds ? "OMDS RunInfo" : "standard RunInfo");
192 // std::cout << " FED vector" << std::endl;
193 // printFedVector(Feds);
194 
195  bool useUpgradedHF=false;
196 
197  std::vector<int> caloFeds; // pare down the feds to the interesting ones
198  // is this unneccesary?
199  // Mike B : This will decrease the find speed so better do it
200  for(std::vector<int>::const_iterator cf = Feds.begin(); cf != Feds.end(); ++cf)
201  {
202  int fedNum = *cf;
203  if((fedNum > 600 && fedNum <724) || fedNum==1118 || fedNum == 1120 || fedNum == 1122)
204  caloFeds.push_back(fedNum);
205 
206  if(fedNum==1118 || fedNum == 1120 || fedNum == 1122) useUpgradedHF=true;
207 
208  }
209 
210  for(int cr = 0; cr < 18; ++cr)
211  {
212 
213  for(crateSection cs = c_min; cs <= c_max; cs = crateSection(cs +1))
214  {
215  bool fedFound = false;
216 
217  //Try to find the FED
218  std::vector<int>::iterator fv= std::find(caloFeds.begin(),caloFeds.end(),crateFED[cr][cs]);
219  if(fv!=caloFeds.end())
220  fedFound = true;
221 
222 
223 
224  if(!fedFound) {
225  int eta_min=0;
226  int eta_max=0;
227  bool phi_even[2] = {false};//, phi_odd = false;
228  bool ecal=false;
229 
230  switch (cs) {
231  case ebEvenFed :
232  eta_min = minBarrel;
233  eta_max = maxBarrel;
234  phi_even[0] = true;
235  ecal = true;
236  break;
237 
238  case ebOddFed:
239  eta_min = minBarrel;
240  eta_max = maxBarrel;
241  phi_even[1] = true;
242  ecal = true;
243  break;
244 
245  case eeFed:
246  eta_min = minEndcap;
247  eta_max = maxEndcap;
248  phi_even[0] = true;
249  phi_even[1] = true;
250  ecal = true;
251  break;
252 
253  case hbheFed:
254  eta_min = minBarrel;
255  eta_max = maxEndcap;
256  phi_even[0] = true;
257  phi_even[1] = true;
258  ecal = false;
259  break;
260 
261  case hfFed:
262  if(useUpgradedHF) break;
263 
264  eta_min = minHF;
265  eta_max = maxHF;
266 
267  phi_even[0] = true;
268  phi_even[1] = true;
269  ecal = false;
270  break;
271 
272  case hfFedUp:
273  if(!useUpgradedHF) break;
274 
275  eta_min = minHF;
276  eta_max = maxHF;
277 
278  phi_even[0] = true;
279  phi_even[1] = true;
280  ecal = false;
281  break;
282 
283 
284  default:
285  break;
286 
287  }
288  for(int ieta = eta_min; ieta <= eta_max; ++ieta)
289  {
290  if(ieta<=28) // barrel and endcap
291  for(int even = 0; even<=1 ; even++)
292  {
293  if(phi_even[even])
294  {
295  if(ecal)
296  fedUpdatedMask->ecalMask[cr][even][ieta-1] = true;
297  else
298  fedUpdatedMask->hcalMask[cr][even][ieta-1] = true;
299  }
300  }
301  else
302  for(int even = 0; even<=1 ; even++)
303  if(phi_even[even])
304  fedUpdatedMask->hfMask[cr][even][ieta-29] = true;
305 
306  }
307  }
308  }
309  }
310 
312 
313 }
static const int minHF
const std::vector< int > getFedVectorFromRunInfo(const edm::EventSetup &)
unique_ptr< ClusterSequence > cs
L1RCTLookupTables * rctLookupTables
Definition: L1RCTProducer.h:68
bool ecalMask[18][2][28]
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
static const int maxHF
const std::vector< int > getFedVectorFromOmds(const edm::EventSetup &)
static const int minBarrel
Definition: L1RCTProducer.h:97
int k[5][pyjets_maxn]
static const int minEndcap
Definition: L1RCTProducer.h:99
L1RCTChannelMask * fedUpdatedMask
Definition: L1RCTProducer.h:81
static const int maxBarrel
Definition: L1RCTProducer.h:98
static const int maxEndcap
T get() const
Definition: EventSetup.h:68
void setNoisyChannelMask(const L1RCTNoisyChannelMask *channelMask)
bool hcalMask[18][2][28]
static const int crateFED[18][6]
Definition: L1RCTProducer.h:95
T const * product() const
Definition: ESHandle.h:84
bool hfMask[18][2][4]
void setChannelMask(const L1RCTChannelMask *channelMask)

Member Data Documentation

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

Definition at line 74 of file L1RCTProducer.h.

Referenced by produce().

std::string L1RCTProducer::conditionsLabel
private

Definition at line 78 of file L1RCTProducer.h.

Referenced by updateConfiguration().

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

Definition at line 95 of file L1RCTProducer.h.

Referenced by updateFedVector().

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

Definition at line 72 of file L1RCTProducer.h.

Referenced by L1RCTProducer(), and produce().

L1RCTChannelMask* L1RCTProducer::fedUpdatedMask
private
bool L1RCTProducer::getFedsFromOmds
private

Definition at line 75 of file L1RCTProducer.h.

Referenced by beginLuminosityBlock().

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

Definition at line 73 of file L1RCTProducer.h.

Referenced by L1RCTProducer(), and produce().

const int L1RCTProducer::maxBarrel = 17
staticprivate

Definition at line 98 of file L1RCTProducer.h.

Referenced by updateFedVector().

const int L1RCTProducer::maxEndcap = 28
staticprivate

Definition at line 100 of file L1RCTProducer.h.

Referenced by updateFedVector().

const int L1RCTProducer::maxHF =32
staticprivate

Definition at line 102 of file L1RCTProducer.h.

Referenced by updateFedVector().

const int L1RCTProducer::minBarrel = 1
staticprivate

Definition at line 97 of file L1RCTProducer.h.

Referenced by updateFedVector().

const int L1RCTProducer::minEndcap = 17
staticprivate

Definition at line 99 of file L1RCTProducer.h.

Referenced by updateFedVector().

const int L1RCTProducer::minHF = 29
staticprivate

Definition at line 101 of file L1RCTProducer.h.

Referenced by updateFedVector().

unsigned int L1RCTProducer::queryDelayInLS
private

Definition at line 76 of file L1RCTProducer.h.

Referenced by beginLuminosityBlock().

unsigned int L1RCTProducer::queryIntervalInLS
private

Definition at line 77 of file L1RCTProducer.h.

Referenced by beginLuminosityBlock().

L1RCT* L1RCTProducer::rct
private

Definition at line 69 of file L1RCTProducer.h.

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

L1RCTLookupTables* L1RCTProducer::rctLookupTables
private

Definition at line 68 of file L1RCTProducer.h.

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

bool L1RCTProducer::useEcal
private

Definition at line 70 of file L1RCTProducer.h.

Referenced by produce().

bool L1RCTProducer::useHcal
private

Definition at line 71 of file L1RCTProducer.h.

Referenced by produce().