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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
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)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
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::ProducerBase
ProducesCollector producesCollector ()
 
- 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 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 44 of file L1RCTProducer.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

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

Definition at line 33 of file L1RCTProducer.cc.

References ecalDigis, and hcalDigis.

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

Definition at line 60 of file L1RCTProducer.cc.

References fedUpdatedMask, rct, and rctLookupTables.

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

Member Function Documentation

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

Definition at line 79 of file L1RCTProducer.cc.

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

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

Definition at line 69 of file L1RCTProducer.cc.

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

69  {
70  // std::cout << "getFedsFromOmds is " << getFedsFromOmds << std::endl;
71 
72  updateConfiguration(eventSetup);
73 
74  int runNumber = run.run();
75  updateFedVector(eventSetup, false,
76  runNumber); // RUNINFO ONLY at beginning of run
77 }
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 309 of file L1RCTProducer.cc.

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

Referenced by updateFedVector().

309  {
310  // std::cout << "Getting FED vector from my specific ES RunInfo object" <<
311  // std::endl;
312 
313  // get FULL FED vector from RunInfo object specifically created to have OMDS
314  // fed vector
316  eventSetup.get<RunInfoRcd>().get("OmdsFedVector",
317  sum); // using label to get my specific instance of RunInfo
318  if (sum.isValid()) {
319  const RunInfo *summary = sum.product();
320  const std::vector<int> fedvector = summary->m_fed_in;
321 
322  return fedvector;
323  } else {
324  return getFedVectorFromRunInfo(eventSetup);
325  }
326 }
const std::vector< int > getFedVectorFromRunInfo(const edm::EventSetup &)
std::vector< int > m_fed_in
Definition: RunInfo.h:25
T get() const
Definition: EventSetup.h:73
bool isValid() const
Definition: ESHandle.h:44
T const * product() const
Definition: ESHandle.h:86
const std::vector< int > L1RCTProducer::getFedVectorFromRunInfo ( const edm::EventSetup eventSetup)

Definition at line 297 of file L1RCTProducer.cc.

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

Referenced by getFedVectorFromOmds(), and updateFedVector().

297  {
298  // std::cout << "Getting FED vector from standard RunInfo object" <<
299  // std::endl;
300  // get FULL FED vector from RUNINFO
302  eventSetup.get<RunInfoRcd>().get(sum);
303  const RunInfo *summary = sum.product();
304  const std::vector<int> fedvector = summary->m_fed_in;
305 
306  return fedvector;
307 }
std::vector< int > m_fed_in
Definition: RunInfo.h:25
T get() const
Definition: EventSetup.h:73
T const * product() const
Definition: ESHandle.h:86
void L1RCTProducer::printFedVector ( const std::vector< int > &  fedVector)

Definition at line 384 of file L1RCTProducer.cc.

References filterCSVwithJSON::copy, and gather_cfg::cout.

384  {
385  std::cout << "Contents of given fedVector: ";
386  std::copy(fedVector.begin(), fedVector.end(), std::ostream_iterator<int>(std::cout, ", "));
387  std::cout << std::endl;
388 }
void L1RCTProducer::printUpdatedFedMask ( )

Definition at line 391 of file L1RCTProducer.cc.

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

391  {
392  if (fedUpdatedMask != nullptr) {
394  } else {
395  std::cout << "Trying to print contents of fedUpdatedMask, but it doesn't exist!" << std::endl;
396  }
397 }
void print(std::ostream &s) const
L1RCTChannelMask * fedUpdatedMask
Definition: L1RCTProducer.h:76
void L1RCTProducer::printUpdatedFedMaskVerbose ( )

Definition at line 400 of file L1RCTProducer.cc.

References gather_cfg::cout, L1RCTChannelMask::ecalMask, fedUpdatedMask, L1RCTChannelMask::hcalMask, L1RCTChannelMask::hfMask, mps_fire::i, dqmiolumiharvest::j, and dqmdumpme::k.

400  {
401  if (fedUpdatedMask != nullptr) {
402  // print contents of fedvector
403  std::cout << "Contents of fedUpdatedMask: ";
404  // std::copy(fedUpdatedMask.begin(), fedUpdatedMask.end(),
405  // std::ostream_iterator<int>(std::cout, ", "));
406  std::cout << "--> ECAL mask: " << std::endl;
407  for (int i = 0; i < 18; i++) {
408  for (int j = 0; j < 2; j++) {
409  for (int k = 0; k < 28; k++) {
410  std::cout << fedUpdatedMask->ecalMask[i][j][k] << ", ";
411  }
412  }
413  }
414  std::cout << "--> HCAL mask: " << std::endl;
415  for (int i = 0; i < 18; i++) {
416  for (int j = 0; j < 2; j++) {
417  for (int k = 0; k < 28; k++) {
418  std::cout << fedUpdatedMask->hcalMask[i][j][k] << ", ";
419  }
420  }
421  }
422  std::cout << "--> HF mask: " << std::endl;
423  for (int i = 0; i < 18; i++) {
424  for (int j = 0; j < 2; j++) {
425  for (int k = 0; k < 4; k++) {
426  std::cout << fedUpdatedMask->hfMask[i][j][k] << ", ";
427  }
428  }
429  }
430 
431  std::cout << std::endl;
432  } else {
433  // print error message
434  std::cout << "Trying to print contents of fedUpdatedMask, but it doesn't exist!" << std::endl;
435  }
436 }
bool ecalMask[18][2][28]
L1RCTChannelMask * fedUpdatedMask
Definition: L1RCTProducer.h:76
bool hcalMask[18][2][28]
bool hfMask[18][2][4]
void L1RCTProducer::produce ( edm::Event e,
const edm::EventSetup c 
)
final

Definition at line 328 of file L1RCTProducer.cc.

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

328  {
329  std::unique_ptr<L1CaloEmCollection> rctEmCands(new L1CaloEmCollection);
330  std::unique_ptr<L1CaloRegionCollection> rctRegions(new L1CaloRegionCollection);
331 
332  if (!(ecalDigis.size() == hcalDigis.size() && hcalDigis.size() == bunchCrossings.size()))
333  throw cms::Exception("BadInput") << "From what I see the number of your your ECAL input digi "
334  "collections.\n"
335  << "is different from the size of your HCAL digi input collections\n"
336  << "or the size of your BX factor collection"
337  << "They must be the same to correspond to the same Bxs\n"
338  << "It does not matter if one of them is empty\n";
339 
340  // loop through and process each bx
341  for (unsigned short sample = 0; sample < bunchCrossings.size(); sample++) {
344 
347 
348  if (useHcal && event.getByLabel(hcalDigis[sample], hcal))
349  hcalIn = *hcal;
350 
351  if (useEcal && event.getByLabel(ecalDigis[sample], ecal))
352  ecalIn = *ecal;
353 
354  rct->digiInput(ecalIn, hcalIn);
355  rct->processEvent();
356 
357  // Stuff to create
358  for (int j = 0; j < 18; j++) {
359  L1CaloEmCollection isolatedEGObjects = rct->getIsolatedEGObjects(j);
360  L1CaloEmCollection nonisolatedEGObjects = rct->getNonisolatedEGObjects(j);
361  for (int i = 0; i < 4; i++) {
362  isolatedEGObjects.at(i).setBx(bunchCrossings[sample]);
363  nonisolatedEGObjects.at(i).setBx(bunchCrossings[sample]);
364  rctEmCands->push_back(isolatedEGObjects.at(i));
365  rctEmCands->push_back(nonisolatedEGObjects.at(i));
366  }
367  }
368 
369  for (int i = 0; i < 18; i++) {
370  std::vector<L1CaloRegion> regions = rct->getRegions(i);
371  for (int j = 0; j < 22; j++) {
372  regions.at(j).setBx(bunchCrossings[sample]);
373  rctRegions->push_back(regions.at(j));
374  }
375  }
376  }
377 
378  // putting stuff back into event
379  event.put(std::move(rctEmCands));
380  event.put(std::move(rctRegions));
381 }
std::vector< L1CaloEmCand > L1CaloEmCollection
std::vector< L1CaloRegion > getRegions(unsigned crate)
Definition: L1RCT.cc:359
L1CaloEmCollection getNonisolatedEGObjects(unsigned crate)
Definition: L1RCT.cc:344
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:327
void processEvent()
Definition: L1RCT.cc:36
void digiInput(const EcalTrigPrimDigiCollection &ecalCollection, const HcalTrigPrimDigiCollection &hcalCollection)
Definition: L1RCT.cc:109
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 104 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().

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

Definition at line 139 of file L1RCTProducer.cc.

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

Referenced by beginLuminosityBlock(), and beginRun().

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

std::string L1RCTProducer::conditionsLabel
private

Definition at line 73 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 80 of file L1RCTProducer.h.

Referenced by updateFedVector().

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

Definition at line 67 of file L1RCTProducer.h.

Referenced by L1RCTProducer(), and produce().

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

Definition at line 70 of file L1RCTProducer.h.

Referenced by beginLuminosityBlock().

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

Definition at line 68 of file L1RCTProducer.h.

Referenced by L1RCTProducer(), and produce().

const int L1RCTProducer::maxBarrel = 17
staticprivate

Definition at line 83 of file L1RCTProducer.h.

Referenced by updateFedVector().

const int L1RCTProducer::maxEndcap = 28
staticprivate

Definition at line 85 of file L1RCTProducer.h.

Referenced by updateFedVector().

const int L1RCTProducer::maxHF = 32
staticprivate

Definition at line 87 of file L1RCTProducer.h.

Referenced by updateFedVector().

const int L1RCTProducer::minBarrel = 1
staticprivate

Definition at line 82 of file L1RCTProducer.h.

Referenced by updateFedVector().

const int L1RCTProducer::minEndcap = 17
staticprivate

Definition at line 84 of file L1RCTProducer.h.

Referenced by updateFedVector().

const int L1RCTProducer::minHF = 29
staticprivate

Definition at line 86 of file L1RCTProducer.h.

Referenced by updateFedVector().

unsigned int L1RCTProducer::queryDelayInLS
private

Definition at line 71 of file L1RCTProducer.h.

Referenced by beginLuminosityBlock().

unsigned int L1RCTProducer::queryIntervalInLS
private

Definition at line 72 of file L1RCTProducer.h.

Referenced by beginLuminosityBlock().

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(), updateFedVector(), 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().