Belle II Software  release-08-01-10
BKLMTrackingModule.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 /* KLM headers. */
12 #include <klm/dataobjects/bklm/BKLMTrack.h>
13 #include <klm/dataobjects/KLMHit2d.h>
14 #include <klm/bklm/geometry/GeometryPar.h>
15 
16 /* Basf2 headers. */
17 #include <framework/core/Module.h>
18 #include <framework/datastore/StoreArray.h>
19 #include <tracking/dataobjects/RecoTrack.h>
20 
21 /* ROOT headers. */
22 #include <TEfficiency.h>
23 #include <TFile.h>
24 #include <TH1F.h>
25 #include <TH2F.h>
26 
27 namespace Belle2 {
34 
37  class BKLMTrackingModule: public Module {
38 
39  public:
40 
43 
46 
48  void initialize() override;
49 
51  void beginRun() override;
52 
54  void event() override;
55 
57  void endRun() override;
58 
60  void terminate() override;
61 
63  bool sameSector(KLMHit2d* hit1, KLMHit2d* hit2);
64 
66  bool findClosestRecoTrack(BKLMTrack* bklmTrk, RecoTrack*& closestTrack);
67 
68 
69  protected:
70 
73 
76 
78  double m_maxAngleRequired = 10;
79 
81  double m_maxDistance = 10;
82 
84  double m_maxSigma = 5;
85 
87  unsigned int m_minHitList = 2;
88 
90  unsigned int m_maxHitList = 60;
91 
94 
96  std::string m_outPath = "bklmEffi.root";
97 
98  private:
99 
102 
104  TFile* m_file = nullptr;
105 
107  TH1F* m_total[2][8];
108 
110  TH1F* m_pass[2][8];
111 
113  TEfficiency* m_effiVsLayer[2][8];
114 
116  //TEfficiency* m_effiYX;
117  TH2F* m_effiYX;
118 
120  //TEfficiency* m_effiYZ;
121  TH2F* m_effiYZ;
122 
124  TH2F* m_passYX;
125 
127  TH2F* m_totalYX;
128 
130  TH2F* m_passYZ;
131 
133  TH2F* m_totalYZ;
136 
139 
142 
145 
147  void runTracking(int mode, int section, int sector, int layer);
148 
150  void generateEffi(int section, int sector, int layer);
151 
153  static bool sortByLayer(KLMHit2d* hit1, KLMHit2d* hit2);
154 
156  bool isLayerUnderStudy(int section, int iSector, int iLayer, KLMHit2d* hit);
157 
159  bool isSectorUnderStudy(int section, int iSector, KLMHit2d* hit);
160 
162  double distanceToHit(BKLMTrack* track, KLMHit2d* hit,
163  double& error,
164  double& sigma);
165 
167  std::vector<int> m_runNumber;
168 
171 
173  std::vector<int> m_totalEvents;
174 
177 
179  std::vector<int> m_totalEventsWithTracks;
180  };
182 } // end namespace Belle2
Store one BKLM Track as a ROOT object.
Definition: BKLMTrack.h:35
This module perform straight line track finding and fitting for BKLM.
bool m_MatchToRecoTrack
whether match BKLMTrack to RecoTrack
TEfficiency * m_effiVsLayer[2][8]
Efficieny of each layer.
std::vector< int > m_runNumber
run number
bool findClosestRecoTrack(BKLMTrack *bklmTrk, RecoTrack *&closestTrack)
find the closest RecoTrack, match BKLMTrack to RecoTrack, if the matched RecoTrack is found,...
TH2F * m_passYZ
passed event at global position Y vs Z
TH2F * m_effiYX
Efficieny at global position Y vs X.
bool m_studyEffi
option for efficieny study mode, in this mode, the layer under study should not be used in tracking
double m_maxSigma
maximum sigma for hit acceptance during efficiency calculation
double m_maxAngleRequired
angle required between RecoTrack and BKLMTrack, if openangle is larger than m_maxAngleRequired,...
double distanceToHit(BKLMTrack *track, KLMHit2d *hit, double &error, double &sigma)
calculate distance from track to hit
void initialize() override
Initialize at start of job.
unsigned int m_minHitList
minimum number of hits in sector for track finder to run (-2 from initial seed)
std::string m_outPath
output file name containing efficiencies plots
void event() override
Unpack one event and create digits.
void endRun() override
end run stuff
StoreArray< RecoTrack > recoTracks
RecoTrack StoreArray.
void runTracking(int mode, int section, int sector, int layer)
run the track finding and fitting
void terminate() override
Terminate at the end of job.
bklm::GeometryPar * m_GeoPar
bklm GeometryPar
TH1F * m_pass[2][8]
Numerator of each layer.
TH2F * m_totalYX
total event at global position Y vs X
StoreArray< RecoHitInformation > recoHitInformation
RecoHitInformation StoreArray.
int m_runTotalEventsWithTracks
total number of processed events in the run with at lease one BKLMTrack
void beginRun() override
begin run stuff
double m_maxDistance
maximum distance required between track and KLMHit2d to be accepted for efficiency calculation
StoreArray< KLMHit2d > hits2D
KLMHit2d StoreArray.
TFile * m_file
TFile that store efficieny plots.
std::vector< int > m_totalEvents
total number of processed events
bool isLayerUnderStudy(int section, int iSector, int iLayer, KLMHit2d *hit)
judge whether the current layer is understudy
TH1F * m_total[2][8]
Denominator of each layer.
StoreArray< BKLMTrack > m_storeTracks
BKLMTrack StoreArray.
bool m_globalFit
do the BKLMTrack fitting in global system (multi-sectors track) or local system (sector by sector)
unsigned int m_maxHitList
max number of hits in sector for track finder to run
std::vector< int > m_totalEventsWithTracks
total number of processed events with at least one BKLMTrack
TH2F * m_effiYZ
Efficieny at global position Y vs Z.
bool isSectorUnderStudy(int section, int iSector, KLMHit2d *hit)
judge whether the hits come from the sctor understudy
static bool sortByLayer(KLMHit2d *hit1, KLMHit2d *hit2)
my defined sort function using layer number
TH2F * m_totalYZ
total event at global position Y vs Z
bool sameSector(KLMHit2d *hit1, KLMHit2d *hit2)
Judge if two hits come from the same sector.
int m_runTotalEvents
total number of processed events in the run
TH2F * m_passYX
passed event at global position Y vs X
void generateEffi(int section, int sector, int layer)
calculate efficiency
KLM 2d hit.
Definition: KLMHit2d.h:33
Base class for Modules.
Definition: Module.h:72
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:79
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
Provides BKLM geometry parameters for simulation, reconstruction etc (from Gearbox or DataBase)
Definition: GeometryPar.h:37
Abstract base class for different kinds of events.