CMS 3D CMS Logo

FakeTBEventHeaderProducer.cc
Go to the documentation of this file.
1 /*
2  * \file FakeTBEventHeaderProducer.cc
3  *
4  *
5  */
6 
9 
10 using namespace cms;
11 using namespace std;
12 
14  ecalTBInfo_ = consumes<PEcalTBInfo>(edm::InputTag("EcalTBInfoLabel","SimEcalTBG4Object"));
15  produces<EcalTBEventHeader>();
16 }
17 
19 {
20 }
21 
23 {
24  unique_ptr<EcalTBEventHeader> product(new EcalTBEventHeader());
25 
26  // get the vertex information from the event
27 
28  const PEcalTBInfo* theEcalTBInfo = nullptr;
29  edm::Handle<PEcalTBInfo> EcalTBInfo;
30  event.getByToken(ecalTBInfo_,EcalTBInfo);
31  if (EcalTBInfo.isValid()){
32  theEcalTBInfo = EcalTBInfo.product();
33  } else {
34  edm::LogError("FakeTBEventHeaderProducer") << "Error! can't get the product PEcalTBInfo";
35  }
36 
37  if (!theEcalTBInfo)
38  { return; }
39 
40  // 64 bits event ID in CMSSW converted to EcalTBEventHeader ID
41  int evtid = (int)event.id().event();
42  product->setEventNumber(evtid);
43  product->setRunNumber(event.id().run());
44  product->setBurstNumber(1);
45  product->setTriggerMask(0x1);
46  product->setCrystalInBeam(EBDetId(1,theEcalTBInfo->nCrystal(),EBDetId::SMCRYSTALMODE));
47 
48 // LogDebug("FakeTBHeader") << (*product);
49 // LogDebug("FakeTBHeader") << (*product).eventType();
50 // LogDebug("FakeTBHeader") << (*product).crystalInBeam();
51  event.put(std::move(product));
52 
53 }
RunNumber_t run() const
Definition: EventID.h:39
EventNumber_t event() const
Definition: EventID.h:41
void produce(edm::Event &event, const edm::EventSetup &eventSetup) override
Produce digis out of raw data.
int nCrystal() const
Definition: PEcalTBInfo.h:28
bool isValid() const
Definition: HandleBase.h:74
T const * product() const
Definition: Handle.h:81
virtual ~FakeTBEventHeaderProducer()
Destructor.
FakeTBEventHeaderProducer(const edm::ParameterSet &ps)
Constructor.
edm::EventID id() const
Definition: EventBase.h:58
static const int SMCRYSTALMODE
Definition: EBDetId.h:167
def move(src, dest)
Definition: eostools.py:510
Definition: event.py:1