Belle II Software  release-06-00-14
TrackIsoCalculatorModule.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/StoreObjPtr.h>
13 #include <framework/dataobjects/EventMetaData.h>
14 #include <framework/logging/LogConfig.h>
15 #include <analysis/dataobjects/Particle.h>
16 #include <analysis/dataobjects/ParticleList.h>
17 #include <analysis/VariableManager/Manager.h>
18 #include <analysis/VariableManager/Utility.h>
19 
20 
21 namespace Belle2 {
32 
33  public:
41  DetSurfCylBoundaries(float rho, float zfwd, float zbwd, float th_fwd, float th_fwd_brl, float th_bwd_brl, float th_bwd)
42  {
43  m_rho = rho;
44  m_zfwd = zfwd;
45  m_zbwd = zbwd;
46  m_th_fwd = th_fwd;
47  m_th_fwd_brl = th_fwd_brl;
48  m_th_bwd_brl = th_bwd_brl;
49  m_th_bwd = th_bwd;
50  };
51  float m_rho;
52  float m_zfwd;
53  float m_zbwd;
54  float m_th_fwd;
55  float m_th_fwd_brl;
56  float m_th_bwd_brl;
57  float m_th_bwd;
58  };
59 
67 
68  public:
69 
74 
78  ~TrackIsoCalculatorModule() override;
79 
86  void initialize() override;
87 
93  void event() override;
94 
98  void terminate() override;
99 
104  double get3DDistAtDetSurface(Particle* iParticle, Particle* jParticle);
105 
112  double get2DRhoPhiDistAsChordLength(Particle* iParticle, Particle* jParticle);
113 
114  private:
115 
119  std::string m_pListName;
120 
124  std::string m_detInnerSurface;
125 
129  bool m_use2DRhoPhiDist = false;
130 
134  std::string m_extraInfoName;
135 
139  std::unordered_map<std::string, DetSurfCylBoundaries> m_detSurfBoundaries = {
140  {"CDC", DetSurfCylBoundaries(16.0, 150.0, -75.0, 0.0, 0.29, 2.61, 3.14)},
141  {"PID", DetSurfCylBoundaries(116.4, 167.0, -335.1, 0.24, 0.52, 2.23, 3.14)}, // PID : TOP, ARICH
142  {"ECL", DetSurfCylBoundaries(125.0, 196.0, -102.0, 0.21, 0.56, 2.24, 2.70)},
143  {"KLM", DetSurfCylBoundaries(202.0, 283.9, -189.9, 0.40, 0.82, 2.13, 2.60)},
144  };
145 
150 
155 
159  inline bool isStdChargedList()
160  {
161  return (Const::chargedStableSet.find(abs(m_pList->getPDGCode())) != Const::invalidParticle);
162  };
163 
167  void printDistancesArr(const std::vector<std::vector<double>>& arr, int size);
168 
169  };
171 }
static const ParticleSet chargedStableSet
set of charged stable particles
Definition: Const.h:499
static const ParticleType invalidParticle
Invalid particle, used internally.
Definition: Const.h:561
Simple class to encapsulate a detector inner surface's boundaries in cylindrical coordinates.
DetSurfCylBoundaries()
Default constructor.
DetSurfCylBoundaries(float rho, float zfwd, float zbwd, float th_fwd, float th_fwd_brl, float th_bwd_brl, float th_bwd)
Constructor with parameters.
float m_zfwd
Inner surface z fwd [cm].
float m_th_fwd_brl
fwd/barrel separation theta [rad]
float m_th_fwd
Lower theta edge of fwd region [rad].
float m_th_bwd_brl
bwd/barrel separation theta [rad]
float m_zbwd
Inner surface z bwd [cm].
float m_rho
Inner surface radius [cm].
float m_th_bwd
Upper theta edge of bwd region [rad].
Base class for Modules.
Definition: Module.h:72
Class to store reconstructed particles.
Definition: Particle.h:74
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:95
Calculate track isolation variables on the input ParticleList.
std::unordered_map< std::string, DetSurfCylBoundaries > m_detSurfBoundaries
Map that associates to each detector its innermost layer's boundaries.
StoreObjPtr< EventMetaData > m_event_metadata
The event information.
~TrackIsoCalculatorModule() override
Destructor, use this to clean up anything you created in the constructor.
bool m_use2DRhoPhiDist
If true, will calculate the pair-wise track distance as the cord length on the (rho,...
void initialize() override
Use this to initialize resources or memory your module needs.
double get2DRhoPhiDistAsChordLength(Particle *iParticle, Particle *jParticle)
Calculate the 2D distance between the points where the two input extraplolated track helices cross th...
void event() override
Called once for each event.
std::string m_detInnerSurface
The name of the detector at whose innermost layer we extrapolate each track's polar and azimuthal ang...
void terminate() override
Module terminate().
double get3DDistAtDetSurface(Particle *iParticle, Particle *jParticle)
Calculate the 3D distance between the points where the two input extraplolated track helices cross th...
std::string m_pListName
The name of the input ParticleList.
void printDistancesArr(const std::vector< std::vector< double >> &arr, int size)
Print 2D array of pair-wise distances.
TrackIsoCalculatorModule()
Constructor: Sets the description, the properties and the parameters of the module.
std::string m_extraInfoName
The name of the distance variable to be added to each particle as extraInfo.
bool isStdChargedList()
Check whether input particle list is of a valid charged stable particle.
StoreObjPtr< ParticleList > m_pList
The input ParticleList object.
Abstract base class for different kinds of events.