Belle II Software  release-08-01-10
MillepedeCollectorModule.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 <analysis/dataobjects/Particle.h>
12 #include <calibration/CalibrationCollectorModule.h>
13 #include <framework/core/ModuleParam.templateDetails.h>
14 #include <framework/dataobjects/EventT0.h>
15 #include <framework/datastore/StoreObjPtr.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 {
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 
105  std::pair<TMatrixD, TMatrixD> getTwoBodyToLocalTransform(Particle& mother, double motherMass);
106 
108  void storeTrajectory(gbl::GblTrajectory& trajectory);
109 
114  std::tuple<B2Vector3D, TMatrixDSym> getPrimaryVertexAndCov() const;
115 
116 
117  private:
119  std::vector<std::string> m_tracks;
121  std::vector<std::string> m_particles;
123  std::vector<std::string> m_vertices;
125  std::vector<std::string> m_primaryVertices;
127  std::vector<std::string> m_twoBodyDecays;
129  std::vector<std::string> m_primaryTwoBodyDecays;
131  std::vector<std::string> m_primaryMassTwoBodyDecays;
133  std::vector<std::string> m_primaryMassVertexTwoBodyDecays;
134 
144  double m_minPValue;
150  std::vector<std::string> m_components{};
154  std::string m_internalIterations;
176 
178  std::vector<std::tuple<int, int, int>> m_eventNumbers{};
179 
181  std::vector< std::tuple< std::vector< int >, std::vector< std::tuple< int, int, int > > > > m_timedepConfig;
182 
184  std::map<std::string, std::tuple<double, double>> m_customMassConfig;
185 
187  std::vector<gbl::GblData> m_currentGblData{};
188 
191 
194 
196  void updateMassWidthIfSet(std::string listName, double& mass, double& width);
197  };
199 }
Calibration collector module base class.
Calibration data collector for Millepede Algorithm.
bool m_updateCDCWeights
Update L/R weights from previous DAF fit result?
std::vector< std::string > m_twoBodyDecays
Name of particle list with mothers of daughters to be used with vertex + mass constraint in calibrati...
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 ...
std::vector< std::string > m_tracks
Names of arrays with single RecoTracks fitted by GBL.
MillepedeCollectorModule()
Constructor: Sets the description, the properties and the parameters of the module.
StoreObjPtr< EventT0 > m_eventT0
Optional input for EventT0.
std::vector< std::string > m_components
Whether to use VXD alignment hierarchy.
double m_minCDCHitWeight
Minimum CDC hit weight.
std::vector< std::string > m_primaryMassTwoBodyDecays
Name of particle list with mothers of daughters to be used with vertex + IP profile + mass constraint...
double m_minPValue
Minimum p.value for output.
std::string getUniqueMilleName()
Make a name for mille binary (encodes module name + starting exp, run and event + process id)
std::vector< std::tuple< int, int, int > > m_eventNumbers
List of event meta data entries at which payloads can change for timedep calibration.
bool m_absFilePaths
Use absolute path to locate binary files in MilleData.
std::vector< std::string > m_vertices
Name of particle list with mothers of daughters to be used with vertex constraint in calibration.
bool m_fitTrackT0
Add local parameter for track T0 fit in GBL (local derivative)
std::vector< genfit::Track * > getParticlesTracks(std::vector< Particle * > particles, bool addVertexPoint=true)
Get all useable tracks for particles.
std::vector< gbl::GblData > m_currentGblData
Current vector of GBL data from trajectory to be stored in a tree.
bool fitRecoTrack(RecoTrack &recoTrack, Particle *particle=nullptr)
Fit given RecoTrack with GBL.
bool m_enableWireSagging
Enable global derivatives for wire sagging.
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 ...
std::tuple< B2Vector3D, TMatrixDSym > getPrimaryVertexAndCov() const
Get the primary vertex position estimation and its size from BeamSpot.
std::map< std::string, std::tuple< double, double > > m_customMassConfig
Map of list_name -> (mass, width) for custom mass and width setting.
int m_recalcJacobians
Up to which external iteration propagation Jacobians should be re-calculated.
bool m_useGblTree
Whether to use TTree to accumulate GBL data instead of binary files.
void storeTrajectory(gbl::GblTrajectory &trajectory)
Write down a GBL trajectory (to TTree or binary file)
bool m_doublePrecision
Use double (instead of single/float) precision for binary files.
virtual void collect() override
Data collection.
StoreObjPtr< EventMetaData > m_evtMetaData
Required object pointer to EventMetaData.
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,...
bool m_enablePXDHierarchy
enable PXD hierarchy
virtual void closeRun() override
Only for closing mille binaries after each run.
bool m_calibrateKinematics
Add derivatives for beam spot kinematics calibration for primary vertices.
double m_minUsedCDCHitFraction
Minimum CDC used hit fraction.
void updateMassWidthIfSet(std::string listName, double &mass, double &width)
Update mass and width of the particle (mother in list) with user custom-defined values.
virtual void prepare() override
Prepration.
bool m_enableSVDHierarchy
enable SVD hierarchy
std::string m_internalIterations
String defining internal GBL iterations for outlier down-weighting.
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, ...
std::vector< std::string > m_particles
Names of particle list with single particles.
virtual void finish() override
Register mille binaries in file catalog.
std::vector< std::string > m_primaryVertices
Name of particle list with mothers of daughters to be used with vertex + IP profile (+ optional calib...
int m_externalIterations
Number of external iterations of GBL fitter.
int m_hierarchyType
Type of alignment hierarchy (for VXD only for now): 0 = None, 1 = Flat (only constraints,...
bool m_enableWireByWireAlignment
Enable global derivatives for wire-by-wire alignment.
double m_stableParticleWidth
Width (in GeV/c/c) to use for invariant mass constraint for 'stable' particles (like K short).
std::vector< std::string > m_primaryTwoBodyDecays
Name of particle list with mothers of daughters to be used with vertex + IP profile (+ optional calib...
std::vector< std::string > m_primaryMassVertexTwoBodyDecays
Name of particle list with mothers of daughters to be used with vertex + IP profile + mass constraint...
bool m_calibrateVertex
Add derivatives for beam spot vertex calibration for primary vertices.
Class to store reconstructed particles.
Definition: Particle.h:75
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:79
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
GBL trajectory.
Definition: GblTrajectory.h:48
#StateOnPlane with additional covariance matrix.
Abstract base class for different kinds of events.