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 }
24 
26  iEvent.emplace(runPut_, iEvent.id().run());
27  iEvent.emplace(eventPut_, iEvent.id().event());
28  iEvent.emplace(bxPut_, iEvent.bunchCrossing());
29  iEvent.emplace(lumiPut_, iEvent.luminosityBlock());
30 
31 #ifdef ExtendedCALIBTree
33  iEvent.getByToken(trig_token_, gtRecord);
34 
35  std::vector<bool> TrigTech_(64, false);
36  std::vector<bool> TrigPh_(128, false);
37 
38  // Get dWord after masking disabled bits
39  DecisionWord dWord = gtRecord->decisionWord();
40  if (!dWord.empty()) { // if board not there this is zero
41  // loop over dec. bit to get total rate (no overlap)
42  for (int i = 0; i < 64; ++i) {
43  TrigPh_[i] = dWord[i];
44  }
45  }
46 
48  if (!tw.empty()) {
49  // loop over dec. bit to get total rate (no overlap)
50  for (int i = 0; i < 64; ++i) {
51  TrigTech_[i] = tw[i];
52  }
53  }
54 
55  iEvent.emplace(trigTechPut_, std::move(TrigTech_));
56  iEvent.emplace(trigPhPut_, std::move(TrigPh_));
57 #endif
58 
59  // Luminosity informations
61  float instLumi_ = 0;
62  float PU_ = 0;
63  iEvent.getByToken(scalerToken_, lumiScalers);
64  if (lumiScalers.isValid()) {
65  if (lumiScalers->begin() != lumiScalers->end()) {
66  instLumi_ = lumiScalers->begin()->instantLumi();
67  PU_ = lumiScalers->begin()->pileup();
68  }
69  } else {
70  edm::LogInfo("ShallowEventDataProducer")
71  << "LumiScalers collection not found in the event; will write dummy values";
72  }
73 
74  iEvent.emplace(instLumiPut_, instLumi_);
75  iEvent.emplace(puPut_, PU_);
76 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDPutTokenT< unsigned int > eventPut_
edm::EDPutTokenT< float > instLumiPut_
const DecisionWord & decisionWord(int bxInEventValue) const
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_
edm::EDPutTokenT< float > puPut_
edm::EDPutTokenT< unsigned int > lumiPut_
def move(src, dest)
Definition: eostools.py:511
ShallowEventDataProducer(const edm::ParameterSet &)