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 
21  unique_ptr<EcalTBEventHeader> product(new EcalTBEventHeader());
22 
23  // get the vertex information from the event
24 
25  const PEcalTBInfo *theEcalTBInfo = nullptr;
26  edm::Handle<PEcalTBInfo> EcalTBInfo;
27  event.getByToken(ecalTBInfo_, EcalTBInfo);
28  if (EcalTBInfo.isValid()) {
29  theEcalTBInfo = EcalTBInfo.product();
30  } else {
31  edm::LogError("FakeTBEventHeaderProducer") << "Error! can't get the product PEcalTBInfo";
32  }
33 
34  if (!theEcalTBInfo) {
35  return;
36  }
37 
38  // 64 bits event ID in CMSSW converted to EcalTBEventHeader ID
39  int evtid = (int)event.id().event();
40  product->setEventNumber(evtid);
41  product->setRunNumber(event.id().run());
42  product->setBurstNumber(1);
43  product->setTriggerMask(0x1);
44  product->setCrystalInBeam(EBDetId(1, theEcalTBInfo->nCrystal(), EBDetId::SMCRYSTALMODE));
45 
46  // LogDebug("FakeTBHeader") << (*product);
47  // LogDebug("FakeTBHeader") << (*product).eventType();
48  // LogDebug("FakeTBHeader") << (*product).crystalInBeam();
49  event.put(std::move(product));
50 }
RunNumber_t run() const
Definition: EventID.h:38
EventNumber_t event() const
Definition: EventID.h:40
void produce(edm::Event &event, const edm::EventSetup &eventSetup) override
Produce digis out of raw data.
~FakeTBEventHeaderProducer() override
Destructor.
int nCrystal() const
Definition: PEcalTBInfo.h:27
bool isValid() const
Definition: HandleBase.h:70
Namespace of DDCMS conversion namespace.
T const * product() const
Definition: Handle.h:69
FakeTBEventHeaderProducer(const edm::ParameterSet &ps)
Constructor.
edm::EventID id() const
Definition: EventBase.h:59
static const int SMCRYSTALMODE
Definition: EBDetId.h:159
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1