 |
Belle II Software
release-05-02-19
|
13 #include <reconstruction/modules/KlId/DataWriter/DataWriterModule.h>
14 #include <mdst/dataobjects/KlId.h>
16 #include <framework/datastore/StoreArray.h>
18 #include <tracking/dataobjects/TrackClusterSeparation.h>
20 #include <analysis/ClusterUtility/ClusterUtils.h>
26 #include "reconstruction/modules/KlId/KLMExpert/KlId.h"
40 setDescription(
"Used to write flat ntuple for KlId classifier trainings for both ECL and KLM KlID. Output is a root file.");
72 m_treeKLM =
new TTree(
"KLMdata",
"KLMdata");
218 const TVector3& clusterPos = cluster.getClusterPosition();
241 float best_dist = 100000000;
242 for (
auto trackSeperation : trackSeperations) {
244 if (dist < best_dist) {
246 trackSep = &trackSeperation;
272 ECLCluster* closestECLCluster = get<0>(closestECLAndDist);
275 if (!(closestECLCluster ==
nullptr)) {
310 const auto mcParticleWeightPair = cluster.getRelatedToWithWeight<
MCParticle>();
311 MCParticle* part = mcParticleWeightPair.first;
338 KlId* klid = cluster.getRelatedTo<
KlId>();
353 if (!
m_useECL or !cluster.hasHypothesis(eclHypothesis)) {
continue;}
357 m_ECLE = cluster.getEnergy(eclHypothesis);
362 m_ECLZ51 = cluster.getAbsZernike51();
363 m_ECLZ40 = cluster.getAbsZernike40();
385 KlId* klid = cluster.getRelatedTo<
KlId>();
392 const TVector3& clusterPos = cluster.getClusterPosition();
407 const auto mcParticleWeightPair = cluster.getRelatedToWithWeight<
MCParticle>();
408 MCParticle* part = mcParticleWeightPair.first;
Float_t m_ECLMCWeight
mc weight
Float_t m_ECLE1oE9
central crystal devided by 3x3 area with it in its center
virtual void beginRun() override
beginn run
virtual void terminate() override
terminate
Float_t m_isSignal
isSignal for the classifier
Float_t m_KLMTrackClusterSepAngle
angle between trach momentum and cluster (measured from ip)
Float_t m_ECLnumChrystals
number of crystals in the cluster
Float_t m_ECLTruth
ECL trarget variable.
Float_t m_ECLEerror
uncertainty on E measurement in ECL
Float_t m_KLMTrackSepAngle
angular distance from track separation object
Float_t m_KLMPhi
measured phi
double getE9oE21() const
Return E9/E21 (shower shape variable).
void setDescription(const std::string &description)
Sets the description of the module.
bool m_useECL
write out KLM data
Float_t m_KLMnLayer
number of layers hit in KLM cluster
Float_t m_KLMTheta
measured theta
double getDeltaTime99() const
Return cluster delta time 99.
Float_t m_KLMMCPrimaryPDG
pdg code of MCparticles mother, for example pi0 for some gammas
Helper functions for all klid modules to improve readability of the code.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Float_t m_ECLZ40
Zernike moment 4,0 see Belle2 note on that.
EHypothesisBit
The hypothesis bits for this ECLCluster (Connected region (CR) is split using this hypothesis.
int mcParticleIsKlong(Belle2::MCParticle *part)
return the mc hirachy of the klong 0:not a klong 1:final particle, 2: klong is mother etc
Float_t m_ECLUncertaintyEnergy
measured energy uncertainty
Float_t m_KLMinvM
invariant mass calculated from root vector
Float_t m_KLMMCPDG
pdg code of matched MCparticle
TTree * m_treeECLgamma
tree containing ntuples for ECL cluster with N1 (photon hypothesis)
double getUncertaintyTheta() const
Return Uncertainty on Theta of Shower.
bool m_useKLM
write out KLM data
const TLorentzVector Get4MomentumFromCluster(const ECLCluster *cluster, ECLCluster::EHypothesisBit hypo)
Returns four momentum vector.
@ c_nPhotons
CR is split into n photons (N1)
Float_t m_KLMAngleToMC
angle between KLMcluster and Mcparticle
Float_t m_KLMECLHypo
hypotheis id of closest ecl cluster 5: gamma, 6:hadron
Float_t m_ECLminTrkDistance
more sophisticated distaqnce to track in ECL
Float_t m_KLMECLZMVA
zernike mva output for closest ECL cluster (based on around 10 z-moments)
Float_t m_KLMECLZ40
zernike moment 4,0 of closest ecl cluster
Float_t m_KLMECLZ51
zernike moment 5,1 of closest ECL cluster
Float_t m_KLMECLdeltaL
distance between track entry point and cluster center, might be removed
Float_t m_KLMnInnermostLayer
number of innermost layers hit
Float_t m_ECLE
measured energy
Float_t m_KLMECLEerror
uncertainty on E in associated ECL cluster
virtual void endRun() override
end run
StoreArray< KLMCluster > m_klmClusters
Store array
Float_t m_ECLMCTheta
MC particle momentum; -999 if not MCparticle.
double getZernikeMVA() const
Return MVA based hadron/photon value based on Zernike moments (shower shape variable).
std::pair< Belle2::ECLCluster *, double > findClosestECLCluster(const TVector3 &klmClusterPosition, const Belle2::ECLCluster::EHypothesisBit eclhypothesis=Belle2::ECLCluster::EHypothesisBit::c_neutralHadron)
Find the closest ECLCluster with a neutral hadron hypothesis, and return it with its distance.
Float_t m_KLMMCLifetime
MC partilces life time.
Float_t m_KLMKLid
KlId for that object.
Float_t m_ECLMom
measured momentum
Float_t m_ECLR
distance of cluster to IP
Float_t m_ECLMCLifetime
MC particles lifetime.
Float_t m_ECLDeltaTime
KlId for that object.
double getEnergy(const EHypothesisBit &hypothesis) const
Return Energy (GeV).
Float_t m_KLMnCluster
varibales to write out.
Float_t m_KLMenergy
Energy deposit in KLM (0.2 GeV * nHitCells)
Float_t m_KLMECLminTrackDist
track distance between associated ECL cluster and track extrapolated into ECL
Float_t m_ECLMCStatus
mc status, seen in detector etc.
Float_t m_ECLMCPrimaryPDG
pdg code of higher order MC particle, a cluster related to a photon that originates from a pi0 decay ...
Float_t m_KLMECLTerror
uncertainty on time in associated ECL cluster
Float_t m_ECLPhi
measured phi
Float_t m_KLMInitialTrackSepAngle
angular distance from track to cluster at track starting point
Class to provide momentum-related information from ECLClusters.
unsigned short getHypotheses() const
Return hypothesis (expert only, this returns a bti pattern).
Float_t m_KLMMom
measured momentum
Float_t m_ECLTheta
measured theta
double getUncertaintyPhi() const
Return Uncertainty on Phi of Shower.
Float_t m_ECLMCMom
MC particle momentum; -999 if not MCparticle.
Float_t m_KLMMCMom
momentum of matched mc particle
Float_t m_KLMECLUncertaintyTheta
theta uncertainty of closest ECL cluster
Float_t m_KLMtrackFlag
track flag for belle comparision
Float_t m_KLMtime
timing of KLM Cluster
Abstract base class for different kinds of events.
Float_t m_isBeamBKG
is beam bkg
virtual void event() override
process event
Float_t m_KLMMCStatus
MC particles status.
double getTime() const
Return cluster time.
double getDeltaL() const
Return deltaL.
TTree * m_treeKLM
tree for klm data
Float_t m_KLMhitDepth
hit depth in KLM, distance to IP
double getKlId() const
get the klong classifier output
virtual void initialize() override
init
TTree * m_treeECLhadron
tree containing ntuples for ECL cluster with N2 (hadron hypothesis)
Float_t m_KLMECLE9oE25
E in surrounding 9 crystals divided by surrounding 25 crydtalls.
Float_t m_ECLZMVA
output of a BDT that was fitted on some Zernike Moments on a connected region
Float_t m_KLMMCWeight
mc weight
@ c_neutralHadron
CR is reconstructed as a neutral hadron (N2)
Float_t m_ECLUncertaintyTheta
measured uncertainty on theta
Float_t m_KLMavInterClusterDist
average distance between all KLM clusters
DataWriterModule()
Constructor.
double getAbsZernike40() const
Return Zernike moment 40 (shower shape variable).
double getAbsZernike51() const
Return Zernike moment 51 (shower shape variable).
Float_t m_KLMECLUncertaintyPhi
phi uncertainty oof closeest ecl cluster
Float_t m_ECLZ51
Zernike moment 5,1 see Belle2 note on that.
Float_t m_KLMglobalZ
global Z position in KLM
Float_t m_ECLZ
measured Z-coordinate
Float_t m_KLMMCPhi
phi of matched mc particle
Float_t m_KLMeclFlag
ecl flag for belle comparision
double getDistance() const
Float_t m_ECLdeltaL
distance between track entrace into cluster and cluster center
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
std::tuple< const Belle2::KLMCluster *, double, double > findClosestKLMCluster(const TVector3 &klmClusterPosition)
find nearest KLMCluster, tis distance and the av intercluster distance
Float_t m_ECLLAT
lateral shower shape
Float_t m_KLMTrackSepDist
distance from track separation object
Float_t m_ECLKLid
classifier output
Float_t m_KLMnextCluster
distance to next KLM cluster
Float_t m_KLMMCTheta
theta of matched mc particle
StoreArray< MCParticle > m_mcParticles
Store array
Float_t m_ECLMCPDG
pdg code of the MCparticle directly related to the cluster
Float_t m_ECL2ndMom
second moment, shower shape
std::string m_outPath
Output path variable.
A Class to store the Monte Carlo particle information.
double getUncertaintyEnergy() const
Return Uncertainty on Energy of Shower.
Float_t m_ECLUncertaintyPhi
measured uncertainty of phi
StoreArray< ECLCluster > m_eclClusters
Store array
Float_t m_KLMTruth
target variable for KLM classification
bool isECLClusterSignal(const Belle2::ECLCluster &cluster, float mcWeigthCut=0.66)
checks if a cluster is signal under the mcWeightcondition (mcWeight = energy deposition)
Store one Track-KLMCluster separation as a ROOT object.
Float_t m_ECLMCPhi
MC particle phi; -999 if not MCparticle
Float_t m_ECLTiming
timing of ECL
int mcParticleIsBeamBKG(Belle2::MCParticle *part)
return if MCparticle is beambkg
Float_t m_KLMECLDist
distance associated ECL <-> KLM cluster
Float_t m_KLMECLE
energy measured in associated ECL cluster
virtual ~DataWriterModule()
Destructor.
Float_t m_KLMECLTiming
timing of associated ECL cluster
Float_t m_KLMtrackToECL
primitive distance cluster <-> track for associated ECL cluster
Float_t m_KLMTrackRotationAngle
angle between track at poca and trackbeginning
int getPrimaryPDG(Belle2::MCParticle *part)
return if mc particles primary pdg.
Float_t m_ECLE9oE25
energy of 9/25 chrystall rings (E dispersion shape)
bool isKLMClusterSignal(const Belle2::KLMCluster &cluster, float mcWeigthCut=0.66)
checks if a cluster is signal under the mcWeightcondition (mcWeight = energy deposition)
double getMinTrkDistance() const
Get distance between cluster COG and track extrapolation to ECL.