10#include <top/modules/TOPMCTrackMaker/TOPMCTrackMakerModule.h>
13#include <framework/datastore/StoreArray.h>
16#include <framework/gearbox/Unit.h>
17#include <framework/gearbox/Const.h>
18#include <framework/geometry/BFieldManager.h>
21#include <mdst/dataobjects/Track.h>
22#include <mdst/dataobjects/TrackFitResult.h>
23#include <tracking/dataobjects/ExtHit.h>
24#include <mdst/dataobjects/MCParticle.h>
25#include <top/dataobjects/TOPBarHit.h>
49 setDescription(
"Constructs Tracks and ExtHits from MCParticles and TOPBarHits. "
50 "Utility needed for testing and debugging of TOP reconstruction.");
71 tracks.registerInDataStore();
74 fitResults.registerInDataStore();
79 tracks.registerRelationTo(mcParticles);
80 tracks.registerRelationTo(extHits);
94 for (
const auto& mcParticle : mcParticles) {
96 if (mcParticle.getCharge() == 0)
continue;
97 const auto* barHit = mcParticle.getRelated<
TOPBarHit>();
98 if (!barHit)
continue;
101 fitResults.appendNew(mcParticle.getVertex(),
102 mcParticle.getMomentum(),
104 mcParticle.getCharge(),
110 auto* track = tracks.appendNew();
111 track->setTrackFitResultIndex(
Const::pion, fitResults.getEntries() - 1);
112 track->addRelationTo(&mcParticle);
115 double pmom = barHit->getMomentum().R();
116 double mass = chargedStable.
getMass();
117 double beta = pmom /
sqrt(pmom * pmom + mass * mass);
119 const auto* extHit = extHits.
appendNew(tof,
122 barHit->getModuleID(),
125 barHit->getPosition(),
126 barHit->getMomentum(),
128 track->addRelationTo(extHit);
Provides a type-safe way to pass members of the chargedStableSet set.
int getPDGCode() const
PDG code.
double getMass() const
Particle mass.
static const ChargedStable pion
charged pion particle
static const double speedOfLight
[cm/ns]
@ c_PrimaryParticle
bit 0: Particle is primary particle.
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
Accessor to arrays stored in the data store.
T * appendNew()
Construct a new T object at the end of the array.
Class to store track parameters of incoming MC particles relation to MCParticle filled in top/simulat...
static const double T
[tesla]
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
static void getField(const double *pos, double *field)
return the magnetic field at a given position.
double sqrt(double a)
sqrt for double
TOPMCTrackMakerModule()
Constructor.
virtual void initialize() override
Initialize the Module.
virtual void event() override
Event processor.
Abstract base class for different kinds of events.