17 std::cout <<
"Configuring MCTrackerHitProcessor" << std::endl;
24 catch (std::runtime_error& error)
26 std::cout << error.what() << std::endl;
39 EVENT::LCCollection* lcio_trackerhits{
nullptr};
42 lcio_trackerhits =
event->getLCCollection(
hitCollLcio_.c_str());
44 catch (EVENT::DataNotAvailableException e)
46 std::cout << e.what() << std::endl;
50 UTIL::BitField64 decoder(
"system:0:6,barrel:6:3,layer:9:4,module:13:12,sensor:25:1,side:32:-2,strip:34:12");
57 for (
int ihit = 0; ihit < lcio_trackerhits->getNumberOfElements(); ++ihit) {
60 EVENT::SimTrackerHit* lcio_mcTracker_hit
61 =
static_cast<EVENT::SimTrackerHit*
>(lcio_trackerhits->getElementAt(ihit));
63 EVENT::long64 value = EVENT::long64( lcio_mcTracker_hit->getCellID0() & 0xffffffff ) |
64 ( EVENT::long64( lcio_mcTracker_hit->getCellID1() ) << 32 ) ;
65 decoder.setValue(value);
71 mc_tracker_hit->
setLayer(decoder[
"layer"]);
72 mc_tracker_hit->
setModule(decoder[
"module"]);
74 mc_tracker_hit->
setPosition(lcio_mcTracker_hit->getPosition());
75 mc_tracker_hit->
setMomentum(lcio_mcTracker_hit->getMomentum());
78 mc_tracker_hit->
setEdep(lcio_mcTracker_hit->getEDep());
81 if(lcio_mcTracker_hit->getMCParticle())
82 mc_tracker_hit->
setPDG(lcio_mcTracker_hit->getMCParticle()->getPDG());
85 mc_tracker_hit->
setTime(lcio_mcTracker_hit->getTime());
Processor used to add simulated tracker hits to the event.
#define DECLARE_PROCESSOR(CLASS)
Macro which allows the framework to construct a producer given its name during configuration.
Insert description here. more details.
virtual bool process(IEvent *ievent)
Process the event and put new data products into it.
virtual void configure(const ParameterSet ¶meters)
Callback for the Processor to configure itself from the given set of parameters.
virtual void finalize()
Callback for the Processor to take any necessary action when the processing of events finishes.
virtual void initialize(TTree *tree)
Callback for the Processor to take any necessary action when the processing of events starts.
MCTrackerHitProcessor(const std::string &name, Process &process)
Class constructor.
std::string hitCollRoot_
description
std::vector< MCTrackerHit * > trackerhits_
std::string hitCollLcio_
description
void setLayer(const int layer)
void setPDG(const int pdg)
void setModule(const int module)
void setPosition(const double *position, bool rotate=false)
void setEdep(const double edep)
void setTime(const double time)
void setMomentum(const float *momentum, bool rotate=false)
Processor(const std::string &name, Process &process)
Class constructor.
virtual bool process()
Process the histograms and generate analysis output.