 |
Belle II Software
release-05-01-25
|
11 #ifndef B2BII_CONVERT_MDST_H
12 #define B2BII_CONVERT_MDST_H
14 #include <framework/core/Module.h>
16 #define BELLE_TARGET_H "belle-x86_64-unknown-linux-gnu-g++.h"
17 #include "belle_legacy/panther/panther.h"
18 #include "belle_legacy/panther/panther_group.h"
21 #include "belle_legacy/tables/belletdf.h"
22 #include "belle_legacy/tables/mdst.h"
24 #include "belle_legacy/helix/Helix.h"
27 #include <mdst/dataobjects/V0.h>
28 #include <mdst/dataobjects/ECLCluster.h>
29 #include <mdst/dataobjects/KLMCluster.h>
30 #include <analysis/dataobjects/Particle.h>
31 #include <analysis/dataobjects/ParticleList.h>
32 #include <mdst/dataobjects/MCParticle.h>
33 #include <mdst/dataobjects/MCParticleGraph.h>
34 #include <mdst/dataobjects/Track.h>
35 #include <mdst/dataobjects/PIDLikelihood.h>
36 #include <analysis/dataobjects/EventExtraInfo.h>
37 #include <b2bii/dataobjects/BelleTrkExtra.h>
40 #include <mdst/dbobjects/BeamSpot.h>
41 #include <mdst/dbobjects/CollisionBoostVector.h>
42 #include <mdst/dbobjects/CollisionInvariantMass.h>
44 #include <framework/datastore/StoreArray.h>
45 #include <framework/database/DBObjPtr.h>
46 #include <framework/gearbox/Const.h>
48 #include "CLHEP/Vector/ThreeVector.h"
49 #include "CLHEP/Vector/LorentzVector.h"
50 #include "CLHEP/Matrix/SymMatrix.h"
51 #include "CLHEP/Geometry/Point3D.h"
68 #define HAVE_NISKSFINDER
71 #define HAVE_GOODLAMBDA
125 virtual void event()
override;
126 virtual void endRun()
override;
267 const CLHEP::HepSymMatrix& error,
268 const short int charge,
271 const uint64_t hitPatternCDCInitializer,
272 const uint32_t hitPatternVXDInitializer,
281 std::vector<float>& helixParams,
282 CLHEP::HepSymMatrix& error5x5,
283 CLHEP::HepLorentzVector& momentum,
285 CLHEP::HepSymMatrix& error7x7,
286 const double dPhi = 0.0);
291 void convertHelix(Belle::Helix& helix, std::vector<float>& helixParams, CLHEP::HepSymMatrix& error5x5);
296 void convertHelix(
const Belle::Mdst_trk_fit& trk_fit,
const HepPoint3D& newPivot, std::vector<float>& helixParams,
297 std::vector<float>& helixError);
303 CLHEP::HepLorentzVector& momentum,
HepPoint3D& position, CLHEP::HepSymMatrix& error,
double dPhi = 0.0);
309 std::vector<float>& helixParam, std::vector<float>& helixError);
315 CLHEP::HepLorentzVector& momentum,
HepPoint3D& position, CLHEP::HepSymMatrix& error);
320 void belleVeeDaughterHelix(
const Belle::Mdst_vee2& vee,
const int charge, std::vector<float>& helixParam,
321 std::vector<float>& helixError);
336 static double acc_pid(
const Belle::Mdst_charged& chg,
int idp);
338 double cdc_pid(
const Belle::Mdst_charged& chg,
int idp);
void convertMdstVee2Table()
Reads and converts all entries of Mdst_vee2 Panther table to V0 dataobjects and adds them to StoreArr...
StoreArray< ECLCluster > m_eclClusters
ECL clusters.
bool m_convertEvtcls
Flag to switch on conversion of Evtcls table.
bool m_nisEnable
Flag to switch on conversion of nisKsFinder info.
bool m_convertTrkExtra
Flag to switch on conversion of first(last)_{x,y,z} of mdst_trk_fit.
void testMCRelation(const Belle::Gen_hepevt &belleMC, const MCParticle *mcP, const std::string &objectName)
Checks if the reconstructed object (Track, ECLCluster, ...) was matched to the same MCParticle.
std::map< int, int > mdstGammaToParticle
map of gamma Panther IDs and corresponding Particle StoreArray indices
virtual void beginRun() override
Module functions to be called from event process.
void convertMdstECLTable()
Reads and converts all entries of Mdst_ecl(_aux) Panther table to ECLCluster dataobjects and adds the...
void convertIPProfile(bool beginRun=false)
Stores the IPProfiles in BeamSpot (currently in DataStore)
TrackFitResult createTrackFitResult(const CLHEP::HepLorentzVector &momentum, const HepPoint3D &position, const CLHEP::HepSymMatrix &error, const short int charge, const Const::ParticleType &pType, const float pValue, const uint64_t hitPatternCDCInitializer, const uint32_t hitPatternVXDInitializer, const uint16_t ndf)
Creates TrackFitResult and fills it.
CollisionBoostVector m_collisionBoostVector
CollisionBoostVector for bosst vector of the beam.
StoreArray< BelleTrkExtra > m_belleTrkExtra
Belle CDC extra information.
void convertHelix(Belle::Helix &helix, std::vector< float > &helixParams, CLHEP::HepSymMatrix &error5x5)
Converts Belle's Helix parameters and it's covariance matrix to Belle II's version.
std::map< int, int > mdstKlongToParticle
map of Klong Panther IDs and corresponding Particle StoreArray indices
void convertEvtclsTable()
Reads and converts all entries of evtcls Panther table.
StoreArray< Particle > m_particles
Particles.
void convertMdstPi0Table()
Reads all entries of Mdst_Pi0 Panther table, creates a particle list 'pi0:mdst' and adds them to Stor...
Class to build, validate and sort a particle decay chain.
void setTracksToECLClustersRelations()
Sets Track -> ECLCluster relations.
virtual void terminate() override
Terminates the module.
virtual void event() override
Called for each event.
void setKLMClustersRelations()
Sets KLMCluster -> Track and ECLCluster relations.
CollisionInvariantMass m_collisionInvM
CollisionInvariantMass for the invariant mass of the beam.
bool m_convertRecTrg
Flag to switch on conversion of rectrg_summary3.
static double acc_pid(const Belle::Mdst_charged &chg, int idp)
Returns ACC likelihood for given hypothesis idp.
int m_lastIPProfileBin
variable to tell us which IPProfile bin was active last time we looked
int belleHelixToCartesian(const Belle::Mdst_trk_fit &trk_fit, const double mass, const HepPoint3D &newPivot, CLHEP::HepLorentzVector &momentum, HepPoint3D &position, CLHEP::HepSymMatrix &error, double dPhi=0.0)
Fills 4-momentum, position and 7x7 error matrix from Belle Helix stored in Mdst_trk_fit.
StoreArray< MCParticle > m_mcParticles
MC particles.
Class to collect log likelihoods from TOP, ARICH, dEdx, ECL and KLM aimed for output to mdst includes...
void belleVeeDaughterToCartesian(const Belle::Mdst_vee2 &vee, const int charge, const Const::ParticleType &pType, CLHEP::HepLorentzVector &momentum, HepPoint3D &position, CLHEP::HepSymMatrix &error)
Fills 4-momentum, position and 7x7 error matrix from Belle Vee daughter.
void initializeDataStore()
Initializes Belle II DataStore.
void convertPIDData(const Belle::Mdst_charged &belleTrack, const Track *track)
Get PID information for belleTrack and add it to PIDLikelihood (with relation from track).
double cdc_pid(const Belle::Mdst_charged &chg, int idp)
Returns CDC likelihood for given hypothesis idp.
EDetector
Enum for identifying the detector components (detector and subdetector).
void setLikelihoods(PIDLikelihood *pid, Const::EDetector det, double likelihoods[c_nHyp], bool discard_allzero=false)
Add given Belle likelihoods (not log-likelihoods, in Belle hypothesis order) for given detector to pi...
Values of the result of a track fit with a given particle hypothesis.
const double KAPPA2OMEGA
Conversion factor for Kappa -> Omega helix parameters.
This class contains the beam spot position and size modeled as a gaussian distribution in space.
OptionalDBObjPtr< CollisionBoostVector > m_collisionBoostVectorDB
CollisionBoostVector for boost vector.
void convertMdstChargedTable()
Reads and converts all entries of Mdst_charged (Mdst_trk and Mdst_trk_fit) Panther table to Track (Tr...
@ c_GeneratorLevel
Match to generator-level particles.
void convertGenHepevtObject(const Belle::Gen_hepevt &genHepevt, MCParticleGraph::GraphParticle *mcParticle)
Converts Gen_hepevt record to MCParticleGraph object.
BeamSpot m_beamSpot
Interaction Point of the beam.
Optional DBObjPtr: This class behaves the same as the DBObjPtr except that it will not raise errors w...
void convertBeamEnergy()
Stores beam parameters (energy, angles) in CollisionInvariantMass and CollisionBoostVector (currently...
void convertMdstKLongTable()
Reads all entries of Mdst_Klong Panther table, creates a particle list 'K_L0:mdst' and adds them to S...
const double BFIELD
B filed in TESLA.
std::map< int, int > mdstKlmToKLMCluster
map of Mdst_klm Panther IDs and corresponding KLMCluster StoreArray indices
StoreArray< KLMCluster > m_klmClusters
KLM clusters.
StoreArray< V0 > m_v0s
V0-particles.
double m_matchType2E9oE25Threshold
E9/E25 threshold value clusters with a value above this threshold are classified as neutral even if t...
StoreArray< TrackFitResult > m_trackFitResults
Track fir results.
const static int c_nHyp
Number of Belle track hypotheses (see c_belleHyp_to_chargedStable).
void convertRecTrgTable()
Reads and converts m_final from rectrg_summary3.
virtual ~B2BIIConvertMdstModule() override
Destructor.
void convertGenHepEvtTable()
Reads and converts all entries of Gen_hepevt Panther table to MCParticle dataobjects and adds them to...
Abstract base class for different kinds of events.
Type-safe access to single objects in the data store.
double atcPID(const PIDLikelihood *pid, int sigHyp, int bkgHyp)
calculates atc_pid(3,1,5,sigHyp,bkgHyp).prob() from converted PIDLikelihood
std::string m_mcMatchingModeString
MC matching mode.
Module converts Belle MDST objects (Panther records) to Belle II MDST objects.
StoreArray< Track > m_tracks
Tracks.
void convertMdstGammaTable()
Reads all entries of Mdst_Gamma Panther table, creates a particle list 'gamma:mdst' and adds them to ...
This class contains the measured average center-of-mass energy, which is equal to the invariant mass ...
bool m_convertBeamParameters
Convert beam parameters or use information stored in Belle II database.
void convertMdstChargedObject(const Belle::Mdst_charged &belleTrack, Track *track)
Converts Mdst_charged (Mdst_trk(_fit)) record to Track (TrackFitResult) object.
OptionalDBObjPtr< BeamSpot > m_beamSpotDB
BeamSpot for IP.
void convertMdstECLObject(const Belle::Mdst_ecl &ecl, const Belle::Mdst_ecl_aux &eclAux, ECLCluster *eclCluster)
Converts Mdst_ecl(_aux) record to ECLCluster object.
bool m_realData
flag that tells whether given data sample is for real data or MC
void convertMdstKLMTable()
Reads and converts all entries of Mdst_klm_cluster Panther table to KLMCluster dataobjects and adds t...
MCMatchingMode
MC matching mode.
int getHelixParameters(const Belle::Mdst_trk_fit &trk_fit, const double mass, const HepPoint3D &newPivot, std::vector< float > &helixParams, CLHEP::HepSymMatrix &error5x5, CLHEP::HepLorentzVector &momentum, HepPoint3D &position, CLHEP::HepSymMatrix &error7x7, const double dPhi=0.0)
Fills Helix parameters (converted to Belle II version), 5x5 error matrix, 4-momentum,...
void belleHelixToHelix(const Belle::Mdst_trk_fit &trk_fit, std::vector< float > &helixParam, std::vector< float > &helixError)
obtains the helix parameters from trk_fit and moves the pivot to 0,0,0
bool m_use6x6CovarianceMatrix4Tracks
flag that tells which form of covariance matrix should be used in the conversion of charged tracks
StoreArray< PIDLikelihood > m_pidLikelihoods
output PIDLikelihood array.
The ParticleType class for identifying different particle types.
std::map< int, int > genHepevtToMCParticle
map of Gen_hepevt Panther IDs and corresponding MCParticle StoreArray indices
Provides a type-safe way to pass members of the chargedStableSet set.
Belle2::MCParticleGraph m_particleGraph
MCParticle Graph to build Belle2 MC Particles.
std::map< int, int > mdstEclToECLCluster
map of Mdst_ecl Panther IDs and corresponding ECLCluster StoreArray indices
Class that bundles various TrackFitResults.
A Class to store the Monte Carlo particle information.
void convertMdstKLMObject(const Belle::Mdst_klm_cluster &klm, KLMCluster *klmCluster)
Converts Mdst_klm_cluster record to KLMCluster object.
@ c_Direct
Direct matching.
This class contains the measured average boost vector vec(beta) = (beta_x, beta_y,...
int recoverMoreThan24bitIDHEP(int id)
Helper function to recover falsely set idhep info in GenHepEvt list.
const static Const::ChargedStable c_belleHyp_to_chargedStable[c_nHyp]
maps Belle hypotheses to Const::ChargedStable (from http://belle.kek.jp/secured/wiki/doku....
MCMatchingMode m_mcMatchingMode
C matching mode.
const int ERRMCONV[7]
CONVERSION OF TRACK ERROR MATRIX ELEMENTS.
Class to represent Particle data in graph.
B2BIIConvertMdstModule()
Constructor.
void belleVeeDaughterHelix(const Belle::Mdst_vee2 &vee, const int charge, std::vector< float > &helixParam, std::vector< float > &helixError)
obtains the helix parameters of the vee daughters
virtual void endRun() override
Called when the current run is finished.
virtual void initialize() override
Initialize the module.
OptionalDBObjPtr< CollisionInvariantMass > m_collisionInvMDB
CollisionInvariantMass for Invariant Mass of Beam.
StoreObjPtr< EventExtraInfo > m_evtInfo
Event Extra Info.