CMS 3D CMS Logo

ShallowEventDataProducer.cc
Go to the documentation of this file.
6 
7 // #include <bitset>
8 
10  runPut_ = produces<unsigned int>("run");
11  eventPut_ = produces<unsigned int>("event");
12  bxPut_ = produces<unsigned int>("bx");
13  lumiPut_ = produces<unsigned int>("lumi");
14  instLumiPut_ = produces<float>("instLumi");
15  puPut_ = produces<float>("PU");
16 #ifdef ExtendedCALIBTree
17  trigTechPut_ = produces<std::vector<bool>>("TrigTech");
18  trigPhPut_ = produces<std::vector<bool>>("TrigPh");
19  trig_token_ = consumes<L1GlobalTriggerReadoutRecord>(iConfig.getParameter<edm::InputTag>("trigRecord"));
20 #endif
21 
22  scalerToken_ = consumes<LumiScalersCollection>(iConfig.getParameter<edm::InputTag>("lumiScalers"));
23  metaDataToken_ = consumes<OnlineLuminosityRecord>(iConfig.getParameter<edm::InputTag>("metadata"));
24 }
25 
27  iEvent.emplace(runPut_, iEvent.id().run());
28  iEvent.emplace(eventPut_, iEvent.id().event());
29  iEvent.emplace(bxPut_, iEvent.bunchCrossing());
30  iEvent.emplace(lumiPut_, iEvent.luminosityBlock());
31 
32 #ifdef ExtendedCALIBTree
34  iEvent.getByToken(trig_token_, gtRecord);
35 
36  std::vector<bool> TrigTech_(64, false);
37  std::vector<bool> TrigPh_(128, false);
38 
39  // Get dWord after masking disabled bits
40  DecisionWord dWord = gtRecord->decisionWord();
41  if (!dWord.empty()) { // if board not there this is zero
42  // loop over dec. bit to get total rate (no overlap)
43  for (int i = 0; i < 64; ++i) {
44  TrigPh_[i] = dWord[i];
45  }
46  }
47 
49  if (!tw.empty()) {
50  // loop over dec. bit to get total rate (no overlap)
51  for (int i = 0; i < 64; ++i) {
52  TrigTech_[i] = tw[i];
53  }
54  }
55 
56  iEvent.emplace(trigTechPut_, std::move(TrigTech_));
57  iEvent.emplace(trigPhPut_, std::move(TrigPh_));
58 #endif
59 
60  // Luminosity informations
63 
64  float instLumi_ = 0;
65  float PU_ = 0;
66 
67  if (lumiScalers.isValid() && !lumiScalers->empty()) {
68  if (lumiScalers->begin() != lumiScalers->end()) {
69  instLumi_ = lumiScalers->begin()->instantLumi();
70  PU_ = lumiScalers->begin()->pileup();
71  }
72  } else if (metaData.isValid()) {
73  instLumi_ = metaData->instLumi();
74  PU_ = metaData->avgPileUp();
75  } else {
76  edm::LogInfo("ShallowEventDataProducer")
77  << "LumiScalers collection not found in the event; will write dummy values";
78  }
79 
80  iEvent.emplace(instLumiPut_, instLumi_);
81  iEvent.emplace(puPut_, PU_);
82 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDPutTokenT< unsigned int > eventPut_
edm::EDGetTokenT< OnlineLuminosityRecord > metaDataToken_
edm::EDPutTokenT< float > instLumiPut_
const DecisionWord & decisionWord(int bxInEventValue) const
float instLumi() const
Return the luminosity for the current nibble.
edm::EDPutTokenT< unsigned int > runPut_
int iEvent
Definition: GenABIO.cc:224
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
std::vector< bool > DecisionWord
typedefs
edm::EDPutTokenT< unsigned int > bxPut_
std::vector< bool > TechnicalTriggerWord
technical trigger bits (64 bits)
const TechnicalTriggerWord & technicalTriggerWord(int bxInEventValue) const
Log< level::Info, false > LogInfo
edm::EDGetTokenT< LumiScalersCollection > scalerToken_
bool isValid() const
Definition: HandleBase.h:70
edm::EDPutTokenT< float > puPut_
edm::EDPutTokenT< unsigned int > lumiPut_
float avgPileUp() const
Return the average pileup for th current nibble.
def move(src, dest)
Definition: eostools.py:511
ShallowEventDataProducer(const edm::ParameterSet &)