CMS 3D CMS Logo

HcalTTPTriggerRecord.cc
Go to the documentation of this file.
2 
8 
10 {
11  tok_ttp_ = consumes<HcalTTPDigiCollection>(ps.getParameter<edm::InputTag>("ttpDigiCollection"));
12  ttpBits_ = ps.getParameter< std::vector<unsigned int> >("ttpBits");
13  names_ = ps.getParameter< std::vector<std::string> >("ttpBitNames");
14 
15  produces<L1GtTechnicalTriggerRecord>();
16 }
17 
18 
20 }
21 
23 
24  std::vector<L1GtTechnicalTrigger> vecTT(ttpBits_.size()) ;
25 
26  // Get Inputs
28  e.getByToken(tok_ttp_,ttpDigiCollection) ;
29 
30  if ( !ttpDigiCollection.failedToGet() ) {
31  const HcalTTPDigiCollection* ttpDigis = ttpDigiCollection.product() ;
32  uint8_t ttpResults = ttpDigis->begin()->triggerOutput() ;
33  bool bit8 = ttpResults & 0x1 ;
34  bool bit9 = ttpResults & 0x2 ;
35  bool bit10 = ttpResults & 0x4 ;
36 
37  for (unsigned int i=0; i<ttpBits_.size(); i++) {
38  bool bitValue = false ;
39  if ( ttpBits_.at(i) == 8 ) bitValue = bit8 ;
40  if ( ttpBits_.at(i) == 9 ) bitValue = bit9 ;
41  if ( ttpBits_.at(i) == 10 ) bitValue = bit10 ;
42  vecTT.at(i) = L1GtTechnicalTrigger(names_.at(i), ttpBits_.at(i), 0, bitValue) ;
43  }
44  } else {
45  vecTT.clear() ;
46  }
47 
48  // Put output into event
49  std::unique_ptr<L1GtTechnicalTriggerRecord> output(new L1GtTechnicalTriggerRecord()) ;
50  output->setGtTechnicalTrigger(vecTT) ;
51  e.put(std::move(output)) ;
52 }
53 
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
std::vector< unsigned int > ttpBits_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
std::vector< std::string > names_
HcalTTPTriggerRecord(const edm::ParameterSet &ps)
void produce(edm::Event &e, const edm::EventSetup &c) override
edm::EDGetTokenT< HcalTTPDigiCollection > tok_ttp_
def move(src, dest)
Definition: eostools.py:511
const_iterator begin() const