9#include <ecl/modules/eclTrackClusterMatching/ECLTrackClusterMatchingParametrizationExpertModule.h>
10#include <framework/datastore/RelationVector.h>
11#include <framework/gearbox/Const.h>
20REG_MODULE(ECLTrackClusterMatchingParametrizationExpert);
43 setDescription(
"Store ExtHit related infos for track cluster matching");
46 "set true if you want to save the information in a root file named by parameter 'rootFileName'",
bool(
false));
48 "set true if you want to save the information event-wise using an array structure",
bool(
false));
50 "fileName used for root file where info are saved. Will be ignored if parameter 'writeToRoot' is false (standard)",
51 string(
"eclTrackClusterMatchingAnalysis.root"));
71 m_tree =
new TTree(
"tree",
"ECL Track Cluster Matching Analysis tree");
147 if (!relatedMCParticle)
continue;
148 int pdgCode = relatedMCParticle->
getPDG();
153 const TrackFitResult* fitResult = track.getTrackFitResultWithClosestMass(hypothesis);
175 for (
const auto& extHit : track.getRelationsTo<
ExtHit>()) {
178 if (eclCluster !=
nullptr) {
181 double errorPhi = extHit.getErrorPhi();
182 double errorTheta = extHit.getErrorTheta();
183 double phiHit = extHit.getPosition().Phi();
184 double phiCluster = eclCluster->
getPhi();
185 double deltaPhi = phiHit - phiCluster;
186 if (deltaPhi > M_PI) {
187 deltaPhi = deltaPhi - 2 * M_PI;
188 }
else if (deltaPhi < -M_PI) {
189 deltaPhi = deltaPhi + 2 * M_PI;
191 double thetaHit = extHit.getPosition().Theta();
192 double thetaCluster = eclCluster->
getTheta();
193 double deltaTheta = thetaHit - thetaCluster;
196 bool found_match =
false;
197 for (
unsigned int index = 0; index < relatedMCParticles.size() && !found_match; ++index) {
198 const MCParticle* clusterRelatedMCParticle = relatedMCParticles.object(index);
199 if (clusterRelatedMCParticle == relatedMCParticle) {
246 if ((extHit.
getDetectorID() != Const::EDetector::ECL))
return false;
248 if (extHitStatus == EXT_ECLCROSS || extHitStatus == EXT_ECLDL || extHitStatus == EXT_ECLNEAR)
return true;
Provides a type-safe way to pass members of the chargedStableSet set.
static const ParticleSet chargedStableSet
set of charged stable particles
static const ChargedStable pion
charged pion particle
static const ParticleType invalidParticle
Invalid particle, used internally.
bool hasHypothesis(EHypothesisBit bitmask) const
Return if specific hypothesis bit is set.
double getPhi() const
Return Corrected Phi of Shower (radian).
double getTheta() const
Return Corrected Theta of Shower (radian).
@ c_nPhotons
CR is split into n photons (N1)
std::string m_rootFileName
name of the root file
ECLTrackClusterMatchingParametrizationExpertModule()
Constructor, for setting module description and parameters.
std::vector< int > * m_true_match_array
array of booleans indicating if cluster of hit is related to same MCParticle as track
TTree * m_tree
Root tree for saving the output.
float m_phiCluster
azimuthal angle of cluster
int m_iExperiment
Experiment number.
int m_trackNo
counter to distinguish tracks
bool m_writeToRoot
if true, a rootFile named by m_rootFileName will be filled with info
virtual void initialize() override
Use this to initialize resources or memory your module needs.
virtual ~ECLTrackClusterMatchingParametrizationExpertModule()
Use to clean up anything you created in the constructor.
float m_pT
transverse momentum of track
bool m_useArray
if true, info is stored event-wise using array, otherwise hit-wise
virtual void event() override
Called once for each event.
std::vector< float > * m_phiCluster_array
array of azimuthal angles of cluster
int m_true_track_pdg
PDG ID of track according to MC.
float m_errorPhi
uncertainty on azimuthal angle of hit
StoreArray< TrackFitResult > m_trackFitResults
Required input array of TrackFitResults.
std::vector< float > * m_thetaCluster_array
array of polar angles of cluster
std::vector< float > * m_thetaHit_array
array of polar angles of hit
virtual void terminate() override
Clean up anything you created in initialize().
int m_iEvent
Event number.
float m_deltaTheta
difference in polar angle between hit position and cluster
std::vector< float > * m_pT_array
array of transversal track momenta
StoreObjPtr< EventMetaData > m_eventMetaData
Optional input array of EventMetaData.
std::vector< float > * m_deltaTheta_array
array of differences in polar angle between hit and cluster
std::vector< float > * m_errorPhi_array
array of uncertainties on azimuthal angle of hit
bool isECLHit(const ExtHit &extHit) const
Check if extrapolated hit is inside ECL and matches one of the desired categories.
std::vector< float > * m_trackTheta_array
array of track's polar angles
StoreArray< Track > m_tracks
Required input array of Tracks.
std::vector< float > * m_phiHit_array
array of azimuthal angles of hit
float m_thetaHit
polar angle of hit position
int m_true_match
cluster related to hit is related to same MCParticle as track
StoreArray< ECLCluster > m_eclClusters
Required input array of ECLClusters.
float m_trackTheta
polar angle of track
float m_phiHit
azimuthal angle of hit position
float m_trackMomentum
momentum of track
int m_hitstatus
status of hit
StoreArray< ExtHit > m_extHits
Required input array of ExtHits.
float m_thetaCluster
polar angle of cluster
StoreArray< MCParticle > m_mcParticles
Required input array of MCParticles.
float m_deltaPhi
difference in azimuthal angle between hit position and cluster
float m_errorTheta
uncertainty on polar angle of hit
std::vector< float > * m_errorTheta_array
array of uncertainties on polar angle of hit
std::vector< int > * m_hitstatus_array
array of hit status
TFile * m_rootFilePtr
members of ECLTrackClusterMatching Module
std::vector< float > * m_deltaPhi_array
array of differences in azimuthal angle between hit and cluster
std::vector< float > * m_trackMomentum_array
array of track momenta
std::vector< int > * m_true_track_pdg_array
array of true PDG IDs of track
std::vector< int > * m_trackNo_array
array of track numbers
Store one Ext hit as a ROOT object.
ExtHitStatus getStatus() const
Get state of extrapolation at this hit.
Const::EDetector getDetectorID() const
Get detector ID of this extrapolation hit.
A Class to store the Monte Carlo particle information.
int getPDG() const
Return PDG code of 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...
FROM * getRelatedFrom(const std::string &name="", const std::string &namedRelation="") const
Get the object from which this object has a relation.
RelationVector< TO > getRelationsTo(const std::string &name="", const std::string &namedRelation="") const
Get the relations that point from this object to another store array.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
Values of the result of a track fit with a given particle hypothesis.
double getTransverseMomentum() const
Getter for the absolute value of the transverse momentum at the perigee.
ROOT::Math::XYZVector getMomentum() const
Getter for vector of momentum at closest approach of track in r/phi projection.
Class that bundles various TrackFitResults.
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.
ExtHitStatus
Define state of extrapolation for each recorded hit.
Abstract base class for different kinds of events.