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.");
75 tracks.registerInDataStore();
78 fitResults.registerInDataStore();
83 tracks.registerRelationTo(mcParticles);
84 tracks.registerRelationTo(extHits);
102 for (
const auto& mcParticle : mcParticles) {
104 if (mcParticle.getCharge() == 0)
continue;
105 const auto* barHit = mcParticle.getRelated<
TOPBarHit>();
106 if (!barHit)
continue;
109 fitResults.appendNew(mcParticle.getVertex(),
110 mcParticle.getMomentum(),
112 mcParticle.getCharge(),
118 auto* track = tracks.appendNew();
119 track->setTrackFitResultIndex(
Const::pion, fitResults.getEntries() - 1);
120 track->addRelationTo(&mcParticle);
123 double pmom = barHit->getMomentum().R();
124 double mass = chargedStable.
getMass();
125 double beta = pmom /
sqrt(pmom * pmom + mass * mass);
129 barHit->getModuleID(),
133 barHit->getPosition(),
134 barHit->getMomentum(),
136 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
virtual ~TOPMCTrackMakerModule()
Destructor.
TOPMCTrackMakerModule()
Constructor.
virtual void initialize() override
Initialize the Module.
virtual void event() override
Event processor.
virtual void endRun() override
End-of-run action.
virtual void terminate() override
Termination action.
virtual void beginRun() override
Called when entering a new run.
Abstract base class for different kinds of events.