Belle II Software  release-08-01-10
MCTrackCandClassifierModule.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #pragma once
10 
11 #include <framework/core/Module.h>
12 #include <framework/datastore/StoreArray.h>
13 #include <pxd/dataobjects/PXDCluster.h>
14 #include <svd/dataobjects/SVDCluster.h>
15 #include <tracking/dataobjects/MCParticleInfo.h>
16 #include <vxd/dataobjects/VXDTrueHit.h>
17 #include <genfit/TrackCand.h>
18 
19 #include <string>
20 #include <TFile.h>
21 #include <TList.h>
22 #include <TH1F.h>
23 #include <TH3F.h>
24 #include <time.h>
25 
26 
27 namespace Belle2 {
46 
47  public:
48 
51 
53  void initialize() override;
54 
56  void beginRun() override;
57 
59  void event() override;
60 
62  void endRun() override;
63 
65  void terminate() override;
66 
67  protected:
69  std::string m_mcTrackCandsColName;
71  std::string m_mcParticlesName;
73  std::string m_rootFileName;
75  int m_nSigma;
77  bool m_usePXD;
83  bool m_applyLap;
89  int m_minHit;
91  double m_fraction;
92 
94  int nWedge = 0;
96  int nBarrel = 0;
97 
99  TFile* m_rootFilePtr = nullptr;
100 
101  TList* m_histoList = nullptr;
102  TH3F* m_h3_MCParticle = nullptr;
103  TH3F* m_h3_idealMCTrackCand = nullptr;
104  TH3F* m_h3_MCTrackCand = nullptr;
106  TH1F* m_h1_thetaMS_SVD = nullptr;
107  TH1F* m_h1_thetaMS_PXD = nullptr;
108  TH1F* m_h1_dR = nullptr;
109  TH1F* m_h1_dRoverR = nullptr;
110  TH1F* m_h1_distOVERdR = nullptr;
111  TH1F* m_h1_hitRadius_accepted = nullptr;
112  TH1F* m_h1_hitRadius_rejected = nullptr;
113  TH1F* m_h1_hitDistance_accepted = nullptr;
114  TH1F* m_h1_hitDistance_rejected = nullptr;
116  TH1F* m_h1_MCTrackCandNhits = nullptr;
117  TH1F* m_h1_firstRejectedHit = nullptr;
118  TH1F* m_h1_firstRejectedOVERMCHit = nullptr;
120  TH1F* m_h1_lapTime = nullptr;
121  TH1F* m_h1_timeDifference = nullptr;
122  TH1F* m_h1_diffOVERlap = nullptr;
124  TH1F* m_h1_nGoodTrueHits = nullptr;
125  TH1F* m_h1_nBadTrueHits = nullptr;
126  TH1F* m_h1_nGood1dInfo = nullptr;
127  TH1F* m_h1_nBad1dInfo = nullptr;
129  private:
130 
137  ROOT::Math::XYZVector m_magField;
145  double semiPlane(ROOT::Math::XYZVector vertex, ROOT::Math::XYZVector center, ROOT::Math::XYZVector hit);
146 
152  bool isInSemiPlane(double semiPlane, double omega);
153 
159  double theDistance(ROOT::Math::XYZVector center, ROOT::Math::XYZVector hit);
160 
167  bool isInAnnulus(double hitDistance, double R, double dR);
168 
176  bool isFirstLap(double FirstHitTime, double HitTime, double LapTime);
177 
196  TH3F* createHistogram3D(const char* name, const char* title,
197  Int_t nbinsX, Double_t minX, Double_t maxX, const char* titleX,
198  Int_t nbinsY, Double_t minY, Double_t maxY, const char* titleY,
199  Int_t nbinsZ, Double_t minZ, Double_t maxZ, const char* titleZ,
200  TList* histoList = nullptr);
201 
217  TH3F* createHistogram3D(const char* name, const char* title,
218  Int_t nbinsX, Double_t* binsX, const char* titleX,
219  Int_t nbinsY, Double_t* binsY, const char* titleY,
220  Int_t nbinsZ, Double_t* binsZ, const char* titleZ,
221  TList* histoList = nullptr);
222 
230  TH1* duplicateHistogram(const char* newname, const char* newtitle,
231  TH1* h, TList* histoList = nullptr);
232 
242  TH1F* createHistogramsRatio(const char* name, const char* title,
243  TH1* hNum, TH1* hDen, bool isEffPlot,
244  int axisRef);
245 
249  void addEfficiencyPlots(TList* graphList = nullptr);
250 
254  void addInefficiencyPlots(TList* graphList = nullptr);
255 
261  float compute_dR(double thetaMS, double omega);
262 
269  float compute_thetaMS(MCParticleInfo& mcParticleInfo, VXDTrueHit* aTrueHit);
270  };
272 }
double R
typedef autogenerated by FFTW
This struct is used by the TrackingPerformanceEvaluation Module to save information of reconstructed ...
The MCTrackCandClassifier Definition Module.
bool m_applySemiplane
Wether to require that the hit is in the expected semiplane.
bool m_applyWedge
Whether to require that the hit belong to the barrel part of the SVD.
void addInefficiencyPlots(TList *graphList=nullptr)
Function to create inefficiency plots and add them to list.
ROOT::Math::XYZVector m_magField
magnetic field needed set particle info
StoreArray< genfit::TrackCand > m_GenfitMCTrackCands
MC Genfit TrackCands StoreArray.
int nWedge
Counter for hits on wedged sensors.
StoreArray< SVDCluster > m_SVDClusters
SVDClusters StoreArray.
bool isInAnnulus(double hitDistance, double R, double dR)
Function to check if hitDistance is within a given annulus.
void initialize() override
Initializes the Module.
std::string m_mcParticlesName
MCParticle list name.
int nBarrel
Counter for hits on barrel sensors.
TH1 * duplicateHistogram(const char *newname, const char *newtitle, TH1 *h, TList *histoList=nullptr)
Function to clone a histogram.
float compute_thetaMS(MCParticleInfo &mcParticleInfo, VXDTrueHit *aTrueHit)
Calculate thetaMS.
void terminate() override
Termination action.
bool m_applyLap
Whether to require that the hit belongs to the first lap in the transverse plane.
MCTrackCandClassifierModule()
Constructor of the module.
StoreArray< genfit::TrackCand > m_GenfitIdealMCTrackCands
Ideal Genfit TrackCands StoreArray.
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 ...
void addEfficiencyPlots(TList *graphList=nullptr)
Function to create efficiency plots and add them to list.
StoreArray< PXDCluster > m_PXDClusters
PXDClusters StoreArray.
double semiPlane(ROOT::Math::XYZVector vertex, ROOT::Math::XYZVector center, ROOT::Math::XYZVector hit)
Function to get semiplane.
double theDistance(ROOT::Math::XYZVector center, ROOT::Math::XYZVector hit)
Get distance between two points.
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=nullptr)
Create a 3D ROOT Histogram.
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.
TFile * m_rootFilePtr
Pointer to root file used for storing histograms.
StoreArray< MCParticle > m_MCParticles
MCParticles StoreArray.
bool m_applyAnnulus
Whether to require that the hit is in the expected annulus.
std::string m_mcTrackCandsColName
TrackCand list name.
bool isInSemiPlane(double semiPlane, double omega)
Function to check if a omega value is in a given semiPlane.
float compute_dR(double thetaMS, double omega)
Calculate dR.
bool m_removeBadHits
Whether to remove the clusters that do not satisfy the criteria from the idealMCTrackCands.
int m_minHit
Minimum number of 1D Clusters to classify the MCTrackCand as ideal.
Base class for Modules.
Definition: Module.h:72
Class VXDTrueHit - Records of tracks that either enter or leave the sensitive volume.
Definition: VXDTrueHit.h:36
Abstract base class for different kinds of events.