Belle II Software  release-05-02-19
MCTrackCandClassifierModule.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2011 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Giulia Casarosa *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #ifndef MCTRACKCANDCLASSIFIER_H_
12 #define MCTRACKCANDCLASSIFIER_H_
13 
14 #include <framework/core/Module.h>
15 #include <string>
16 #include <TFile.h>
17 #include <TList.h>
18 #include <TH1F.h>
19 #include <TH3F.h>
20 #include <time.h>
21 
22 #include <tracking/dataobjects/MCParticleInfo.h>
23 #include <vxd/dataobjects/VXDTrueHit.h>
24 
25 namespace Belle2 {
43  class MCTrackCandClassifierModule : public Module {
44 
45  public:
46 
49 
51  void initialize() override;
52 
54  void beginRun() override;
55 
57  void event() override;
58 
60  void endRun() override;
61 
63  void terminate() override;
64 
65  protected:
67  std::string m_mcTrackCandsColName;
69  std::string m_mcParticlesName;
71  std::string m_rootFileName;
73  int m_nSigma;
75  bool m_usePXD;
81  bool m_applyLap;
87  int m_minHit;
89  double m_fraction;
90 
92  int nWedge = 0;
94  int nBarrel = 0;
95 
97  TFile* m_rootFilePtr = nullptr;
98 
99  TList* m_histoList = nullptr;
100  TH3F* m_h3_MCParticle = nullptr;
101  TH3F* m_h3_idealMCTrackCand = nullptr;
102  TH3F* m_h3_MCTrackCand = nullptr;
104  TH1F* m_h1_thetaMS_SVD = nullptr;
105  TH1F* m_h1_thetaMS_PXD = nullptr;
106  TH1F* m_h1_dR = nullptr;
107  TH1F* m_h1_dRoverR = nullptr;
108  TH1F* m_h1_distOVERdR = nullptr;
109  TH1F* m_h1_hitRadius_accepted = nullptr;
110  TH1F* m_h1_hitRadius_rejected = nullptr;
111  TH1F* m_h1_hitDistance_accepted = nullptr;
112  TH1F* m_h1_hitDistance_rejected = nullptr;
114  TH1F* m_h1_MCTrackCandNhits = nullptr;
115  TH1F* m_h1_firstRejectedHit = nullptr;
116  TH1F* m_h1_firstRejectedOVERMCHit = nullptr;
118  TH1F* m_h1_lapTime = nullptr;
119  TH1F* m_h1_timeDifference = nullptr;
120  TH1F* m_h1_diffOVERlap = nullptr;
122  TH1F* m_h1_nGoodTrueHits = nullptr;
123  TH1F* m_h1_nBadTrueHits = nullptr;
124  TH1F* m_h1_nGood1dInfo = nullptr;
125  TH1F* m_h1_nBad1dInfo = nullptr;
127  private:
128 
135  double semiPlane(TVector3 vertex, TVector3 center, TVector3 hit);
136 
142  bool isInSemiPlane(double semiPlane, double omega);
143 
149  double theDistance(TVector3 center, TVector3 hit);
150 
157  bool isInAnnulus(double hitDistance, double R, double dR);
158 
166  bool isFirstLap(double FirstHitTime, double HitTime, double LapTime);
167 
186  TH3F* createHistogram3D(const char* name, const char* title,
187  Int_t nbinsX, Double_t minX, Double_t maxX, const char* titleX,
188  Int_t nbinsY, Double_t minY, Double_t maxY, const char* titleY,
189  Int_t nbinsZ, Double_t minZ, Double_t maxZ, const char* titleZ,
190  TList* histoList = NULL);
191 
207  TH3F* createHistogram3D(const char* name, const char* title,
208  Int_t nbinsX, Double_t* binsX, const char* titleX,
209  Int_t nbinsY, Double_t* binsY, const char* titleY,
210  Int_t nbinsZ, Double_t* binsZ, const char* titleZ,
211  TList* histoList = NULL);
212 
220  TH1* duplicateHistogram(const char* newname, const char* newtitle,
221  TH1* h, TList* histoList = NULL);
222 
232  TH1F* createHistogramsRatio(const char* name, const char* title,
233  TH1* hNum, TH1* hDen, bool isEffPlot,
234  int axisRef);
235 
239  void addEfficiencyPlots(TList* graphList = NULL);
240 
244  void addInefficiencyPlots(TList* graphList = NULL);
245 
251  float compute_dR(double thetaMS, double omega);
252 
259  float compute_thetaMS(MCParticleInfo& mcParticleInfo, VXDTrueHit* aTrueHit);
260  };
262 }
263 
264 #endif /* MCTrackCandClassifierModule_H_ */
Belle2::MCTrackCandClassifierModule::m_h1_nBadTrueHits
TH1F * m_h1_nBadTrueHits
Histogram.
Definition: MCTrackCandClassifierModule.h:131
Belle2::MCTrackCandClassifierModule::beginRun
void beginRun() override
Begin run.
Definition: MCTrackCandClassifierModule.cc:215
Belle2::MCTrackCandClassifierModule::isInAnnulus
bool isInAnnulus(double hitDistance, double R, double dR)
Function to check if hitDistance is within a given annulus.
Definition: MCTrackCandClassifierModule.cc:571
Belle2::MCTrackCandClassifierModule::addEfficiencyPlots
void addEfficiencyPlots(TList *graphList=NULL)
Function to create efficiency plots and add them to list.
Definition: MCTrackCandClassifierModule.cc:679
Belle2::MCParticleInfo
This struct is used by the TrackingPerformanceEvaluation Module to save information of reconstructed ...
Definition: MCParticleInfo.h:34
Belle2::MCTrackCandClassifierModule::createHistogramsRatio
TH1F * createHistogramsRatio(const char *name, const char *title, TH1 *hNum, TH1 *hDen, bool isEffPlot, int axisRef)
Function to create a ratio histogram from two histograms.
Definition: MCTrackCandClassifierModule.cc:713
Belle2::MCTrackCandClassifierModule::m_rootFileName
std::string m_rootFileName
root file name
Definition: MCTrackCandClassifierModule.h:79
Belle2::MCTrackCandClassifierModule::m_h1_nGoodTrueHits
TH1F * m_h1_nGoodTrueHits
Histogram.
Definition: MCTrackCandClassifierModule.h:130
Belle2::MCTrackCandClassifierModule::compute_thetaMS
float compute_thetaMS(MCParticleInfo &mcParticleInfo, VXDTrueHit *aTrueHit)
Calculate thetaMS.
Definition: MCTrackCandClassifierModule.cc:841
Belle2::MCTrackCandClassifierModule::m_applyLap
bool m_applyLap
Whether to require that the hit belongs to the first lap in the transverse plane.
Definition: MCTrackCandClassifierModule.h:89
Belle2::MCTrackCandClassifierModule::m_fraction
double m_fraction
Fraction of lap.
Definition: MCTrackCandClassifierModule.h:97
Belle2::MCTrackCandClassifierModule::MCTrackCandClassifierModule
MCTrackCandClassifierModule()
Constructor of the module.
Definition: MCTrackCandClassifierModule.cc:36
Belle2::MCTrackCandClassifierModule::m_h1_nBad1dInfo
TH1F * m_h1_nBad1dInfo
Histogram.
Definition: MCTrackCandClassifierModule.h:133
Belle2::VXDTrueHit
Class VXDTrueHit - Records of tracks that either enter or leave the sensitive volume.
Definition: VXDTrueHit.h:38
Belle2::MCTrackCandClassifierModule::terminate
void terminate() override
Termination action.
Definition: MCTrackCandClassifierModule.cc:514
Belle2::MCTrackCandClassifierModule::m_applySemiplane
bool m_applySemiplane
Wether to require that the hit is in the expected semiplane.
Definition: MCTrackCandClassifierModule.h:87
Belle2::MCTrackCandClassifierModule::isFirstLap
bool isFirstLap(double FirstHitTime, double HitTime, double LapTime)
Function to check if a hitTime is within a given lapTime, under consideration of m_fraction and with ...
Definition: MCTrackCandClassifierModule.cc:588
Belle2::MCTrackCandClassifierModule::m_h1_timeDifference
TH1F * m_h1_timeDifference
Histogram.
Definition: MCTrackCandClassifierModule.h:127
Belle2::MCTrackCandClassifierModule::m_h1_nGood1dInfo
TH1F * m_h1_nGood1dInfo
Histogram.
Definition: MCTrackCandClassifierModule.h:132
Belle2::MCTrackCandClassifierModule::m_h1_hitRadius_accepted
TH1F * m_h1_hitRadius_accepted
Histogram.
Definition: MCTrackCandClassifierModule.h:117
Belle2::MCTrackCandClassifierModule::m_mcTrackCandsColName
std::string m_mcTrackCandsColName
TrackCand list name.
Definition: MCTrackCandClassifierModule.h:75
Belle2::MCTrackCandClassifierModule::m_applyWedge
bool m_applyWedge
Whether to require that the hit belong to the barrel part of the SVD.
Definition: MCTrackCandClassifierModule.h:91
Belle2::MCTrackCandClassifierModule::m_rootFilePtr
TFile * m_rootFilePtr
Pointer to root file used for storing histograms.
Definition: MCTrackCandClassifierModule.h:105
Belle2::MCTrackCandClassifierModule::m_h3_MCTrackCand
TH3F * m_h3_MCTrackCand
Histogram.
Definition: MCTrackCandClassifierModule.h:110
Belle2::MCTrackCandClassifierModule::m_h1_firstRejectedOVERMCHit
TH1F * m_h1_firstRejectedOVERMCHit
Histogram.
Definition: MCTrackCandClassifierModule.h:124
Belle2::MCTrackCandClassifierModule::m_h1_diffOVERlap
TH1F * m_h1_diffOVERlap
Histogram.
Definition: MCTrackCandClassifierModule.h:128
Belle2::MCTrackCandClassifierModule::m_h1_hitDistance_accepted
TH1F * m_h1_hitDistance_accepted
Histogram.
Definition: MCTrackCandClassifierModule.h:119
Belle2::MCTrackCandClassifierModule::m_h1_dRoverR
TH1F * m_h1_dRoverR
Histogram.
Definition: MCTrackCandClassifierModule.h:115
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::MCTrackCandClassifierModule::initialize
void initialize() override
Initializes the Module.
Definition: MCTrackCandClassifierModule.cc:83
Belle2::MCTrackCandClassifierModule::m_h1_MCTrackCandNhits
TH1F * m_h1_MCTrackCandNhits
Histogram.
Definition: MCTrackCandClassifierModule.h:122
Belle2::MCTrackCandClassifierModule::m_nSigma
int m_nSigma
nSigma dR
Definition: MCTrackCandClassifierModule.h:81
Belle2::MCTrackCandClassifierModule::compute_dR
float compute_dR(double thetaMS, double omega)
Calculate dR.
Definition: MCTrackCandClassifierModule.cc:817
Belle2::MCTrackCandClassifierModule::isInSemiPlane
bool isInSemiPlane(double semiPlane, double omega)
Function to check if a omega value is in a given semiPlane.
Definition: MCTrackCandClassifierModule.cc:553
Belle2::MCTrackCandClassifierModule::semiPlane
double semiPlane(TVector3 vertex, TVector3 center, TVector3 hit)
Function to get semiplane.
Definition: MCTrackCandClassifierModule.cc:532
Belle2::MCTrackCandClassifierModule::m_removeBadHits
bool m_removeBadHits
Whether to remove the clusters that do not satisfy the criteria from the idealMCTrackCands.
Definition: MCTrackCandClassifierModule.h:93
Belle2::MCTrackCandClassifierModule::m_h1_hitDistance_rejected
TH1F * m_h1_hitDistance_rejected
Histogram.
Definition: MCTrackCandClassifierModule.h:120
Belle2::MCTrackCandClassifierModule::m_h1_distOVERdR
TH1F * m_h1_distOVERdR
Histogram.
Definition: MCTrackCandClassifierModule.h:116
Belle2::MCTrackCandClassifierModule::m_usePXD
bool m_usePXD
Whether to use PXD.
Definition: MCTrackCandClassifierModule.h:83
Belle2::MCTrackCandClassifierModule::m_h1_dR
TH1F * m_h1_dR
Histogram.
Definition: MCTrackCandClassifierModule.h:114
Belle2::MCTrackCandClassifierModule::m_mcParticlesName
std::string m_mcParticlesName
MCParticle list name.
Definition: MCTrackCandClassifierModule.h:77
Belle2::MCTrackCandClassifierModule::m_h1_hitRadius_rejected
TH1F * m_h1_hitRadius_rejected
Histogram.
Definition: MCTrackCandClassifierModule.h:118
Belle2::MCTrackCandClassifierModule::m_applyAnnulus
bool m_applyAnnulus
Whether to require that the hit is in the expected annulus.
Definition: MCTrackCandClassifierModule.h:85
Belle2::MCTrackCandClassifierModule::m_minHit
int m_minHit
Minimum number of 1D Clusters to classify the MCTrackCand as ideal.
Definition: MCTrackCandClassifierModule.h:95
Belle2::MCTrackCandClassifierModule::theDistance
double theDistance(TVector3 center, TVector3 hit)
Get distance between two points.
Definition: MCTrackCandClassifierModule.cc:562
Belle2::MCTrackCandClassifierModule::m_h1_lapTime
TH1F * m_h1_lapTime
Histogram.
Definition: MCTrackCandClassifierModule.h:126
Belle2::MCTrackCandClassifierModule::duplicateHistogram
TH1 * duplicateHistogram(const char *newname, const char *newtitle, TH1 *h, TList *histoList=NULL)
Function to clone a histogram.
Definition: MCTrackCandClassifierModule.cc:653
Belle2::MCTrackCandClassifierModule::m_h3_idealMCTrackCand
TH3F * m_h3_idealMCTrackCand
Histogram.
Definition: MCTrackCandClassifierModule.h:109
Belle2::MCTrackCandClassifierModule::createHistogram3D
TH3F * createHistogram3D(const char *name, const char *title, Int_t nbinsX, Double_t minX, Double_t maxX, const char *titleX, Int_t nbinsY, Double_t minY, Double_t maxY, const char *titleY, Int_t nbinsZ, Double_t minZ, Double_t maxZ, const char *titleZ, TList *histoList=NULL)
Create a 3D ROOT Histogram.
Definition: MCTrackCandClassifierModule.cc:609
Belle2::MCTrackCandClassifierModule::m_h1_thetaMS_SVD
TH1F * m_h1_thetaMS_SVD
Histogram.
Definition: MCTrackCandClassifierModule.h:112
Belle2::MCTrackCandClassifierModule::m_h1_thetaMS_PXD
TH1F * m_h1_thetaMS_PXD
Histogram.
Definition: MCTrackCandClassifierModule.h:113
Belle2::MCTrackCandClassifierModule::nBarrel
int nBarrel
Counter for hits on barrel sensors.
Definition: MCTrackCandClassifierModule.h:102
Belle2::MCTrackCandClassifierModule::addInefficiencyPlots
void addInefficiencyPlots(TList *graphList=NULL)
Function to create inefficiency plots and add them to list.
Definition: MCTrackCandClassifierModule.cc:696
Belle2::MCTrackCandClassifierModule::nWedge
int nWedge
Counter for hits on wedged sensors.
Definition: MCTrackCandClassifierModule.h:100
Belle2::MCTrackCandClassifierModule::m_histoList
TList * m_histoList
List of histograms.
Definition: MCTrackCandClassifierModule.h:107
Belle2::MCTrackCandClassifierModule::endRun
void endRun() override
End run.
Definition: MCTrackCandClassifierModule.cc:474
Belle2::MCTrackCandClassifierModule::event
void event() override
Event function.
Definition: MCTrackCandClassifierModule.cc:222
Belle2::MCTrackCandClassifierModule::m_h3_MCParticle
TH3F * m_h3_MCParticle
Histogram.
Definition: MCTrackCandClassifierModule.h:108
Belle2::MCTrackCandClassifierModule::m_h1_firstRejectedHit
TH1F * m_h1_firstRejectedHit
Histogram.
Definition: MCTrackCandClassifierModule.h:123