Belle II Software  release-05-02-19
MillepedeCollectorModule.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2015 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: tadeas *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 #include <analysis/dataobjects/Particle.h>
14 #include <calibration/CalibrationCollectorModule.h>
15 #include <framework/core/ModuleParam.templateDetails.h>
16 #include <framework/geometry/B2Vector3.h>
17 #include <tracking/dataobjects/RecoTrack.h>
18 
19 #include <genfit/GblTrajectory.h>
20 #include <genfit/Track.h>
21 #include <genfit/MeasuredStateOnPlane.h>
22 
23 namespace Belle2 {
34  class MillepedeCollectorModule : public CalibrationCollectorModule {
35 
36  public:
37 
42 
44  virtual void prepare() override;
45 
47  virtual void collect() override;
48 
50  virtual void closeRun() override;
51 
53  virtual void finish() override;
54 
56  std::string getUniqueMilleName();
57 
64  std::vector<genfit::Track*> getParticlesTracks(std::vector<Particle*> particles, bool addVertexPoint = true);
65 
73  bool fitRecoTrack(RecoTrack& recoTrack, Particle* particle = nullptr);
74 
79 
84 
103  std::pair<TMatrixD, TMatrixD> getTwoBodyToLocalTransform(Particle& mother, double motherMass);
104 
106  void storeTrajectory(gbl::GblTrajectory& trajectory);
107 
112  std::tuple<B2Vector3D, TMatrixDSym> getPrimaryVertexAndCov() const;
113 
114 
115  private:
117  std::vector<std::string> m_tracks;
119  std::vector<std::string> m_particles;
121  std::vector<std::string> m_vertices;
123  std::vector<std::string> m_primaryVertices;
125  std::vector<std::string> m_twoBodyDecays;
127  std::vector<std::string> m_primaryTwoBodyDecays;
129  std::vector<std::string> m_primaryMassTwoBodyDecays;
131  std::vector<std::string> m_primaryMassVertexTwoBodyDecays;
132 
134  double m_stableParticleWidth;
136  bool m_doublePrecision;
138  bool m_calibrateVertex;
140  bool m_calibrateKinematics = true;
142  double m_minPValue;
148  std::vector<std::string> m_components{};
152  std::string m_internalIterations;
165  int m_hierarchyType;
174 
176  std::vector<std::tuple<int, int, int>> m_eventNumbers{};
177 
179  std::vector< std::tuple< std::vector< int >, std::vector< std::tuple< int, int, int > > > > m_timedepConfig;
180 
182  std::map<std::string, std::tuple<double, double>> m_customMassConfig;
183 
185  std::vector<gbl::GblData> m_currentGblData{};
186 
188  void updateMassWidthIfSet(std::string listName, double& mass, double& width);
189  };
191 }
Belle2::MillepedeCollectorModule::storeTrajectory
void storeTrajectory(gbl::GblTrajectory &trajectory)
Write down a GBL trajectory (to TTree or binary file)
Definition: MillepedeCollectorModule.cc:1015
Belle2::MillepedeCollectorModule::prepare
virtual void prepare() override
Prepration.
Definition: MillepedeCollectorModule.cc:162
Belle2::MillepedeCollectorModule::m_doublePrecision
bool m_doublePrecision
Use double (instead of single/float) precision for binary files.
Definition: MillepedeCollectorModule.h:144
Belle2::MillepedeCollectorModule::finish
virtual void finish() override
Register mille binaries in file catalog.
Definition: MillepedeCollectorModule.cc:993
Belle2::MillepedeCollectorModule::m_twoBodyDecays
std::vector< std::string > m_twoBodyDecays
Name of particle list with mothers of daughters to be used with vertex + mass constraint in calibrati...
Definition: MillepedeCollectorModule.h:133
Belle2::MillepedeCollectorModule::m_primaryMassVertexTwoBodyDecays
std::vector< std::string > m_primaryMassVertexTwoBodyDecays
Name of particle list with mothers of daughters to be used with vertex + IP profile + mass constraint...
Definition: MillepedeCollectorModule.h:139
Belle2::MillepedeCollectorModule::m_enablePXDHierarchy
bool m_enablePXDHierarchy
enable PXD hierarchy
Definition: MillepedeCollectorModule.h:175
Belle2::MillepedeCollectorModule::fitRecoTrack
bool fitRecoTrack(RecoTrack &recoTrack, Particle *particle=nullptr)
Fit given RecoTrack with GBL.
Definition: MillepedeCollectorModule.cc:1047
Belle2::MillepedeCollectorModule::m_updateCDCWeights
bool m_updateCDCWeights
Update L/R weights from previous DAF fit result?
Definition: MillepedeCollectorModule.h:166
genfit::MeasuredStateOnPlane
#StateOnPlane with additional covariance matrix.
Definition: MeasuredStateOnPlane.h:39
Belle2::MillepedeCollectorModule::m_tracks
std::vector< std::string > m_tracks
Names of arrays with single RecoTracks fitted by GBL.
Definition: MillepedeCollectorModule.h:125
Belle2::MillepedeCollectorModule::updateMassWidthIfSet
void updateMassWidthIfSet(std::string listName, double &mass, double &width)
Update mass and width of the particle (mother in list) with user custom-defined values.
Definition: MillepedeCollectorModule.cc:1582
Belle2::MillepedeCollectorModule::getTwoBodyToLocalTransform
std::pair< TMatrixD, TMatrixD > getTwoBodyToLocalTransform(Particle &mother, double motherMass)
Compute the transformation matrices d(q/p,u'v',u,v)/d(vx,vy,vz,px,py,pz,theta,phi,...
Definition: MillepedeCollectorModule.cc:1300
Belle2::MillepedeCollectorModule::m_customMassConfig
std::map< std::string, std::tuple< double, double > > m_customMassConfig
Map of list_name -> (mass, width) for custom mass and width setting.
Definition: MillepedeCollectorModule.h:190
Belle2::MillepedeCollectorModule::m_minUsedCDCHitFraction
double m_minUsedCDCHitFraction
Minimum CDC used hit fraction.
Definition: MillepedeCollectorModule.h:170
Belle2::MillepedeCollectorModule::m_externalIterations
int m_externalIterations
Number of external iterations of GBL fitter.
Definition: MillepedeCollectorModule.h:158
Belle2::MillepedeCollectorModule::collect
virtual void collect() override
Data collection.
Definition: MillepedeCollectorModule.cc:262
Belle2::MillepedeCollectorModule::getUniqueMilleName
std::string getUniqueMilleName()
Make a name for mille binary (encodes module name + starting exp, run and event + process id)
Definition: MillepedeCollectorModule.cc:1030
Belle2::MillepedeCollectorModule::m_enableWireByWireAlignment
bool m_enableWireByWireAlignment
Enable global derivatives for wire-by-wire alignment.
Definition: MillepedeCollectorModule.h:179
Belle2::MillepedeCollectorModule::closeRun
virtual void closeRun() override
Only for closing mille binaries after each run.
Definition: MillepedeCollectorModule.cc:983
gbl::GblTrajectory
GBL trajectory.
Definition: GblTrajectory.h:48
Belle2::MillepedeCollectorModule::m_fitTrackT0
bool m_fitTrackT0
Add local parameter for track T0 fit in GBL (local derivative)
Definition: MillepedeCollectorModule.h:164
Belle2::MillepedeCollectorModule::getGlobalToLocalTransform
TMatrixD getGlobalToLocalTransform(const genfit::MeasuredStateOnPlane &msop)
Compute the transformation matrix d(q/p,u',v',u,v)/d(x,y,z,px,py,pz) from state at first track point ...
Definition: MillepedeCollectorModule.cc:1442
Belle2::MillepedeCollectorModule::m_useGblTree
bool m_useGblTree
Whether to use TTree to accumulate GBL data instead of binary files.
Definition: MillepedeCollectorModule.h:152
Belle2::RecoTrack
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:78
Belle2::MillepedeCollectorModule::m_calibrateVertex
bool m_calibrateVertex
Add derivatives for beam spot vertex calibration for primary vertices.
Definition: MillepedeCollectorModule.h:146
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::MillepedeCollectorModule::m_minCDCHitWeight
double m_minCDCHitWeight
Minimum CDC hit weight.
Definition: MillepedeCollectorModule.h:168
Belle2::MillepedeCollectorModule::m_eventNumbers
std::vector< std::tuple< int, int, int > > m_eventNumbers
List of event meta data entries at which payloads can change for timedep calibration.
Definition: MillepedeCollectorModule.h:184
Belle2::MillepedeCollectorModule::m_minPValue
double m_minPValue
Minimum p.value for output.
Definition: MillepedeCollectorModule.h:150
Belle2::MillepedeCollectorModule::m_internalIterations
std::string m_internalIterations
String defining internal GBL iterations for outlier down-weighting.
Definition: MillepedeCollectorModule.h:160
Belle2::MillepedeCollectorModule::m_vertices
std::vector< std::string > m_vertices
Name of particle list with mothers of daughters to be used with vertex constraint in calibration.
Definition: MillepedeCollectorModule.h:129
Belle2::MillepedeCollectorModule::m_primaryMassTwoBodyDecays
std::vector< std::string > m_primaryMassTwoBodyDecays
Name of particle list with mothers of daughters to be used with vertex + IP profile + mass constraint...
Definition: MillepedeCollectorModule.h:137
Belle2::MillepedeCollectorModule::m_particles
std::vector< std::string > m_particles
Names of particle list with single particles.
Definition: MillepedeCollectorModule.h:127
Belle2::MillepedeCollectorModule::m_absFilePaths
bool m_absFilePaths
Use absolute path to locate binary files in MilleData.
Definition: MillepedeCollectorModule.h:154
Belle2::MillepedeCollectorModule::m_components
std::vector< std::string > m_components
Whether to use VXD alignment hierarchy.
Definition: MillepedeCollectorModule.h:156
Belle2::MillepedeCollectorModule::m_recalcJacobians
int m_recalcJacobians
Up to which external iteration propagation Jacobians should be re-calculated.
Definition: MillepedeCollectorModule.h:162
Belle2::Particle
Class to store reconstructed particles.
Definition: Particle.h:77
Belle2::MillepedeCollectorModule::m_stableParticleWidth
double m_stableParticleWidth
Width (in GeV/c/c) to use for invariant mass constraint for 'stable' particles (like K short).
Definition: MillepedeCollectorModule.h:142
Belle2::MillepedeCollectorModule::m_enableSVDHierarchy
bool m_enableSVDHierarchy
enable SVD hierarchy
Definition: MillepedeCollectorModule.h:177
Belle2::MillepedeCollectorModule::m_calibrateKinematics
bool m_calibrateKinematics
Add derivatives for beam spot kinematics calibration for primary vertices.
Definition: MillepedeCollectorModule.h:148
Belle2::MillepedeCollectorModule::getLocalToGlobalTransform
TMatrixD getLocalToGlobalTransform(const genfit::MeasuredStateOnPlane &msop)
Compute the transformation matrix d(x,y,z,px,py,pz)/d(q/p,u',v',u,v) from state at first track point ...
Definition: MillepedeCollectorModule.cc:1514
Belle2::MillepedeCollectorModule::m_primaryTwoBodyDecays
std::vector< std::string > m_primaryTwoBodyDecays
Name of particle list with mothers of daughters to be used with vertex + IP profile (+ optional calib...
Definition: MillepedeCollectorModule.h:135
Belle2::MillepedeCollectorModule::MillepedeCollectorModule
MillepedeCollectorModule()
Constructor: Sets the description, the properties and the parameters of the module.
Definition: MillepedeCollectorModule.cc:66
Belle2::MillepedeCollectorModule::m_timedepConfig
std::vector< std::tuple< std::vector< int >, std::vector< std::tuple< int, int, int > > > > m_timedepConfig
Config for time dependence: list( tuple( list( param1, param2, ...
Definition: MillepedeCollectorModule.h:187
Belle2::MillepedeCollectorModule::getPrimaryVertexAndCov
std::tuple< B2Vector3D, TMatrixDSym > getPrimaryVertexAndCov() const
Get the primary vertex position estimation and its size from BeamSpot.
Definition: MillepedeCollectorModule.cc:1576
Belle2::MillepedeCollectorModule::getParticlesTracks
std::vector< genfit::Track * > getParticlesTracks(std::vector< Particle * > particles, bool addVertexPoint=true)
Get all useable tracks for particles.
Definition: MillepedeCollectorModule.cc:1252
Belle2::MillepedeCollectorModule::m_hierarchyType
int m_hierarchyType
Type of alignment hierarchy (for VXD only for now): 0 = None, 1 = Flat (only constraints,...
Definition: MillepedeCollectorModule.h:173
Belle2::MillepedeCollectorModule::m_enableWireSagging
bool m_enableWireSagging
Enable global derivatives for wire sagging.
Definition: MillepedeCollectorModule.h:181
Belle2::MillepedeCollectorModule::m_currentGblData
std::vector< gbl::GblData > m_currentGblData
Current vector of GBL data from trajectory to be stored in a tree.
Definition: MillepedeCollectorModule.h:193
Belle2::MillepedeCollectorModule::m_primaryVertices
std::vector< std::string > m_primaryVertices
Name of particle list with mothers of daughters to be used with vertex + IP profile (+ optional calib...
Definition: MillepedeCollectorModule.h:131