9#include <alignment/modules/CopyRecoTracksWithOverlap/CopyRecoTracksWithOverlapModule.h>
11#include <analysis/dataobjects/Particle.h>
12#include <analysis/dataobjects/ParticleList.h>
13#include <framework/datastore/StoreArray.h>
14#include <framework/datastore/StoreObjPtr.h>
15#include <mdst/dataobjects/Track.h>
16#include <tracking/dataobjects/RecoTrack.h>
33 setDescription(
"Copy RecoTracks with overlap hits in VXD to a new StoreArray (Will need a refit).\n"
34 "If particleList is specified, take only RecoTracks associated to the particles (allows to make prior cuts at analysis level)."
60 for (
unsigned int iParticle = 0; iParticle < nParticles; ++iParticle) {
62 auto track = particle->getTrack();
64 B2ERROR(
"No Track for particle.");
67 auto recoTrack = track->getRelatedTo<
RecoTrack>();
69 B2ERROR(
"No RecoTrack for Track");
84 std::array<int, 6> nHitsInLayer = {0, 0, 0, 0, 0, 0};
87 for (
auto hit : track.getPXDHitList())
88 ++nHitsInLayer.at(hit->getSensorID().getLayerNumber() - 1);
91 for (
auto hit : track.getSVDHitList())
92 ++nHitsInLayer.at(hit->getSensorID().getLayerNumber() - 1);
94 bool hasOverlap =
false;
101 if (nHitsInLayer[0] == 2) hasOverlap =
true;
102 if (nHitsInLayer[1] == 2) hasOverlap =
true;
104 if (nHitsInLayer[2] == 4) hasOverlap =
true;
105 if (nHitsInLayer[3] == 4) hasOverlap =
true;
106 if (nHitsInLayer[4] == 4) hasOverlap =
true;
107 if (nHitsInLayer[5] == 4) hasOverlap =
true;
112 overlapTrack->addHitsFromRecoTrack(&track);
std::string m_particleListName
Name of particle list for which associated RecoTracks should be copied.
virtual void initialize() override
init
virtual void event() override
Copy RecoTracks with overlaps (for particle if specified)
void processRecoTrack(const RecoTrack &track)
Check if RecoTrack has overlap hits -> if yes, copy to a new array.
CopyRecoTracksWithOverlapModule()
Constructor: Sets the description, the properties and the parameters of the module.
StoreArray< RecoTrack > m_OverlappingRecoTracks
Overlapping tracks.
StoreObjPtr< ParticleList > m_ParticleList
Particle list.
StoreArray< RecoTrack > m_RecoTracks
Tracks.
std::string m_overlapRecoTracksArrayName
Name of StoreArray with output RecoTracks with overlaps.
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...
This is the Reconstruction Event-Data Model Track.
static void registerRequiredRelations(StoreArray< RecoTrack > &recoTracks, std::string const &pxdHitsStoreArrayName="", std::string const &svdHitsStoreArrayName="", std::string const &cdcHitsStoreArrayName="", std::string const &bklmHitsStoreArrayName="", std::string const &eklmHitsStoreArrayName="", std::string const &recoHitInformationStoreArrayName="")
Convenience method which registers all relations required to fully use a RecoTrack.
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.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.