Belle II Software  release-08-01-10
TRGGRLMatchModule.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 <trg/cdc/dataobjects/CDCTriggerTrack.h>
13 #include <trg/ecl/dataobjects/TRGECLCluster.h>
14 #include <trg/klm/dataobjects/KLMTrgSummary.h>
15 #include <trg/cdc/dataobjects/CDCTriggerSegmentHit.h>
16 #include <trg/grl/dataobjects/TRGGRLShortTrack.h>
17 #include <trg/grl/dataobjects/TRGGRLInnerTrack.h>
18 #include <trg/grl/dataobjects/TRGGRLInfo.h>
19 #include <string>
20 #include <vector>
21 
22 #include <framework/datastore/StoreArray.h>
23 #include <framework/datastore/StoreObjPtr.h>
24 
25 
26 namespace Belle2 {
39  class TRGGRLMatchModule : public Module {
40 
41  public:
42 
47 
49  virtual ~TRGGRLMatchModule();
50 
52  virtual void initialize() override;
53 
55  virtual void beginRun() override;
56 
58  virtual void event() override;
59 
61  virtual void endRun() override;
62 
64  virtual void terminate() override;
65 
67  void calculationdistance(CDCTriggerTrack* track, TRGECLCluster* cluster, double* ds, int _match3D);
68 
70  void calculationphiangle(CDCTriggerTrack* track, TRGECLCluster* cluster, int& dphi_d, std::vector<bool>& track_phimap,
71  std::vector<bool>& track_phimap_i);
72 
74  void sectormatching_klm(CDCTriggerTrack* track, StoreObjPtr<KLMTrgSummary> klmtrgsummary, double& dphi, int& klmtrack_ind_phi);
75 
77  bool photon_cluster(TRGECLCluster* cluster, std::vector<bool> track_phimap, double e_threshold);
78 
80  int N64(int x);
81 
83  int N36(int x);
84 
86  void fill_pattern_base2(std::vector< std::vector<int> >& patt);
87 
89  void make_veto_map(StoreArray<CDCTriggerTrack> track2Dlist, std::vector<bool>& map_veto);
90 
92  void make_eecl_map(StoreArray<TRGECLCluster> clusterlist, std::vector<bool>& ecl_phimap, std::vector<bool>& ecl_phimap_fwd,
93  std::vector<bool>& ecl_phimap_bwd, std::vector<bool>& ecl_sectormap_fwd, std::vector<bool>& ecl_sectormap_bwd);
94 
96  void make_eklm_map(StoreObjPtr<KLMTrgSummary> klmtrgsummary,
97  std::vector<bool>& eklm_sectormap, std::vector<bool>& eklm_sectormap_fwd, std::vector<bool>& eklm_sectormap_bwd);
98 
100  void short_tracking(StoreArray<CDCTriggerSegmentHit> tslist, std::vector<bool> map_veto, std::vector<bool> phimap_i,
101  std::vector<bool> ecl_phimap_fwd, std::vector<bool> ecl_phimap_bwd,
102  std::vector<bool> klm_sectormap_fwd, std::vector<bool> klm_sectormap_bwd,
103  std::vector< std::vector<int> >& pattern_base0, std::vector< std::vector<int> >& pattern_base2,
105  StoreObjPtr<TRGGRLInfo> trgInfo);
106 
107  void inner_tracking(StoreArray<CDCTriggerSegmentHit> tslist, std::vector<bool> phimap_i,
108  std::vector<bool> ecl_phimap, std::vector<bool> klm_sectormap,
110  StoreObjPtr<TRGGRLInfo> trgInfo);
111 
112  void matching_eecl_eklm(std::vector<bool> eecl_sectormap_fw,
113  std::vector<bool> eecl_setormap_bw,
114  std::vector<bool> eklm_sectormap_fw,
115  std::vector<bool> eklm_sectormap_bw,
116  StoreObjPtr<TRGGRLInfo> trgInfo);
117 
119  void extrapolation(int pattern, int& l, int& r, int& ec);
120 
121  private:
127 
131 
134 
146  std::vector<bool> track_phimap;
148  std::vector<bool> track_phimap_i;
150  std::vector<bool> eecl_phimap;
152  std::vector<bool> eecl_phimap_fwd;
154  std::vector<bool> eecl_phimap_bwd;
156  std::vector<bool> eecl_sectormap_fwd;
158  std::vector<bool> eecl_sectormap_bwd;
160  std::vector<bool> eklm_sectormap;
162  std::vector<bool> eklm_sectormap_fwd;
164  std::vector<bool> eklm_sectormap_bwd;
166  std::string m_2d_tracklist;
168  std::string m_3d_tracklist;
170  std::string m_clusterlist;
172  std::string m_klmtrgsummarylist;
174  //double m_dr;
176  //double m_dz;
178  std::string m_2dmatch_tracklist;
180  std::string m_phimatch_tracklist;
182  std::string m_3dmatch_tracklist;
184  std::string m_klmmatch_tracklist;
186  std::string m_grlphotonlist;
188  std::string m_hitCollectionName;
196  std::vector< std::vector<int> > patterns_base0;
198  std::vector< std::vector<int> > patterns_base2;
199  };
201 }
Track created by the CDC trigger.
Base class for Modules.
Definition: Module.h:72
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
Example Detector.
Definition: TRGECLCluster.h:24
Match between CDC trigger track and ECL trigger cluster.
std::string m_klmtrgsummarylist
the KLM track list
std::vector< bool > eklm_sectormap
8 bits phi map of KLM clusters at endcap
StoreObjPtr< TRGGRLInfo > m_TRGGRLInfo
output for TRGGRLInfo
std::string m_2dmatch_tracklist
the distance in phi direction between track and cluster
int m_fastSimulationMode
Switch for the fast simulation.
int N36(int x)
Force an int to be witnin 0 to 35.
int m_simulationMode
Mode for TRGGRL simulation.
std::string m_grlitCollectionName
GRL inner track list.
int m_firmwareSimulationMode
Switch for the firmware simulation. 0:do nothing, 1:do everything.
double m_dr_threshold
max value of dr to be identified as match
int m_dphi_d_threshold
max value of dphi_d to be identified as match, 1 digit = 10 degrees
std::vector< std::vector< int > > patterns_base2
Short tracking patterns based on SL2.
virtual void initialize() override
Initialize the parameters.
std::string m_phimatch_tracklist
the matched 2d track list by phi matching
std::vector< std::vector< int > > patterns_base0
Short tracking patterns based on SL0.
std::vector< bool > track_phimap_i
36 bits phi map of all 2D tracks
bool photon_cluster(TRGECLCluster *cluster, std::vector< bool > track_phimap, double e_threshold)
determine photon from isolated cluster
std::vector< bool > eecl_phimap
36 bits phi map of ECL clusters at endcap
virtual void event() override
Event processor.
void make_veto_map(StoreArray< CDCTriggerTrack > track2Dlist, std::vector< bool > &map_veto)
Make the full track phi veto map for short tracking.
std::vector< bool > eklm_sectormap_fwd
8 bits sector map of KLM clusters at forward endcap
virtual void endRun() override
End-of-run action.
void calculationdistance(CDCTriggerTrack *track, TRGECLCluster *cluster, double *ds, int _match3D)
calculate dr and dz between track and cluster
void calculationphiangle(CDCTriggerTrack *track, TRGECLCluster *cluster, int &dphi_d, std::vector< bool > &track_phimap, std::vector< bool > &track_phimap_i)
calculate dphi_d between track and cluster
virtual void terminate() override
Termination action.
virtual ~TRGGRLMatchModule()
Destructor.
double m_dz_threshold
max value of dz to be identified as match
void short_tracking(StoreArray< CDCTriggerSegmentHit > tslist, std::vector< bool > map_veto, std::vector< bool > phimap_i, std::vector< bool > ecl_phimap_fwd, std::vector< bool > ecl_phimap_bwd, std::vector< bool > klm_sectormap_fwd, std::vector< bool > klm_sectormap_bwd, std::vector< std::vector< int > > &pattern_base0, std::vector< std::vector< int > > &pattern_base2, StoreArray< TRGGRLShortTrack > grlst, StoreObjPtr< TRGGRLInfo > trgInfo)
Short tracking logic.
std::vector< bool > eecl_sectormap_fwd
8 bits sector map of ECL clusters at forward endcap
std::string m_2d_tracklist
the 2D finder track list
virtual void beginRun() override
Called when entering a new run.
void extrapolation(int pattern, int &l, int &r, int &ec)
Short track extrapolation (to endcap) function.
std::string m_grlstCollectionName
GRL short track list.
std::string m_klmmatch_tracklist
the matched 2d track list by KLM matching
double m_dphi_klm_threshold
max value of dphi (CDC track to KLM sector) to be identified as match (in degrees)
std::string m_TrgGrlInformationName
Name of the StoreArray holding projects information from grl.
int N64(int x)
Force an int to be witnin 0 to 63.
TRGGRLMatchModule()
Constructor: Sets the description, the properties and the parameters of the module.
std::vector< bool > track_phimap
36 bits phi map of all 2D tracks
void make_eecl_map(StoreArray< TRGECLCluster > clusterlist, std::vector< bool > &ecl_phimap, std::vector< bool > &ecl_phimap_fwd, std::vector< bool > &ecl_phimap_bwd, std::vector< bool > &ecl_sectormap_fwd, std::vector< bool > &ecl_sectormap_bwd)
Make the ecl endcap phi map for inner/short track matching.
void sectormatching_klm(CDCTriggerTrack *track, StoreObjPtr< KLMTrgSummary > klmtrgsummary, double &dphi, int &klmtrack_ind_phi)
calculate dphi between 2D track and KLM track
std::string m_grlphotonlist
Non-matched cluster list at GRL.
std::vector< bool > eecl_phimap_bwd
36 bits phi map of ECL clusters at backward endcap
std::vector< bool > eecl_phimap_fwd
36 bits phi map of ECL clusters at forward endcap
void fill_pattern_base2(std::vector< std::vector< int > > &patt)
Fill the patterns in short tracking logic.
std::string m_3d_tracklist
the 3D NN track list
double m_e_threshold
min value of isolated cluster energy
std::vector< bool > eklm_sectormap_bwd
8 bits sector map of KLM clusters at backward endcap
std::string m_clusterlist
the ecl cluster list
std::string m_hitCollectionName
Track Segment list.
std::vector< bool > eecl_sectormap_bwd
8 bits sector map of ECL clusters at backward endcap
void make_eklm_map(StoreObjPtr< KLMTrgSummary > klmtrgsummary, std::vector< bool > &eklm_sectormap, std::vector< bool > &eklm_sectormap_fwd, std::vector< bool > &eklm_sectormap_bwd)
Make the klm endcap phi map for inner/short track matching.
std::string m_3dmatch_tracklist
the matched 3d track list
Abstract base class for different kinds of events.