CMS 3D CMS Logo

ShallowEventDataProducer.cc
Go to the documentation of this file.
5 
7  produces <unsigned int> ( "run" );
8  produces <unsigned int> ( "event" );
9  produces <unsigned int> ( "bx" );
10  produces <unsigned int> ( "lumi" );
11  produces <float> ( "instLumi" );
12  produces <float> ( "PU" );
13  produces <std::vector<bool> > ( "TrigTech" );
14  produces <std::vector<bool> > ( "TrigPh" );
15 
16  trig_token_ = consumes<L1GlobalTriggerReadoutRecord>(iConfig.getParameter<edm::InputTag>("trigRecord"));
17  scalerToken_ = consumes< LumiScalersCollection >(iConfig.getParameter<edm::InputTag>("lumiScalers"));
18 
19 }
20 
23 
24 
25  auto run = std::make_unique<unsigned int>(iEvent.id().run() );
26  auto event = std::make_unique<unsigned int>(iEvent.id().event() );
27  auto bx = std::make_unique<unsigned int>(iEvent.bunchCrossing() );
28  auto lumi = std::make_unique<unsigned int>(iEvent.luminosityBlock() );
29 
31  iEvent.getByToken(trig_token_, gtRecord);
32 
33  std::vector<bool> TrigTech_(64,false);
34  std::vector<bool> TrigPh_(128,false);
35 
36  // Get dWord after masking disabled bits
37  DecisionWord dWord = gtRecord->decisionWord();
38  if ( ! dWord.empty() ) { // if board not there this is zero
39  // loop over dec. bit to get total rate (no overlap)
40  for ( int i = 0; i < 64; ++i ) {
41  TrigPh_[i]= dWord[i];
42  }
43  }
44 
45  TechnicalTriggerWord tw = gtRecord->technicalTriggerWord();
46  if ( ! tw.empty() ) {
47  // loop over dec. bit to get total rate (no overlap)
48  for ( int i = 0; i < 64; ++i ) {
49  TrigTech_[i]=tw[i];
50  }
51  }
52 
53  auto TrigTech = std::make_unique<std::vector<bool>>(TrigTech_);
54  auto TrigPh = std::make_unique<std::vector<bool>>(TrigPh_);
55 
56  // Luminosity informations
58  float instLumi_=0; float PU_=0;
59  iEvent.getByToken(scalerToken_, lumiScalers);
60  if(lumiScalers.isValid()){
61  if (lumiScalers->begin() != lumiScalers->end()) {
62  instLumi_ = lumiScalers->begin()->instantLumi();
63  PU_ = lumiScalers->begin()->pileup();
64  }
65  } else {
66  edm::LogInfo("ShallowEventDataProducer")
67  << "LumiScalers collection not found in the event; will write dummy values";
68  }
69 
70  auto instLumi = std::make_unique<float>(instLumi_);
71  auto PU = std::make_unique<float>(PU_);
72 
73  iEvent.put(std::move(run), "run" );
74  iEvent.put(std::move(event), "event" );
75  iEvent.put(std::move(bx), "bx" );
76  iEvent.put(std::move(lumi), "lumi" );
77  iEvent.put(std::move(TrigTech), "TrigTech" );
78  iEvent.put(std::move(TrigPh), "TrigPh" );
79  iEvent.put(std::move(instLumi), "instLumi");
80  iEvent.put(std::move(PU), "PU");
81 }
RunNumber_t run() const
Definition: EventID.h:39
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:41
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
edm::EDGetTokenT< LumiScalersCollection > scalerToken_
int bunchCrossing() const
Definition: EventBase.h:66
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:63
int iEvent
Definition: GenABIO.cc:230
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > trig_token_
std::vector< bool > DecisionWord
typedefs
std::vector< bool > TechnicalTriggerWord
technical trigger bits (64 bits)
void produce(edm::Event &, const edm::EventSetup &) override
edm::EventID id() const
Definition: EventBase.h:60
def move(src, dest)
Definition: eostools.py:510
Definition: event.py:1
ShallowEventDataProducer(const edm::ParameterSet &)