 |
Belle II Software
release-05-01-25
|
10 #include <tracking/trackFitting/measurementCreator/adder/MeasurementAdder.h>
11 #include <tracking/trackFitting/measurementCreator/creators/CoordinateMeasurementCreator.h>
13 #include <cdc/dataobjects/CDCRecoHit.h>
14 #include <pxd/reconstruction/PXDRecoHit.h>
15 #include <svd/reconstruction/SVDRecoHit.h>
16 #include <alignment/reconstruction/AlignableBKLMRecoHit.h>
17 #include <alignment/reconstruction/AlignableEKLMRecoHit.h>
19 #include <cdc/translators/LinearGlobalADCCountTranslator.h>
20 #include <cdc/translators/RealisticCDCGeometryTranslator.h>
21 #include <cdc/translators/RealisticTDCCountTranslator.h>
23 #include <genfit/MeasurementFactory.h>
32 bool checkTwoStoreArrayNames(
const std::string& firstName,
const std::string& secondName)
34 return ((firstName == secondName) or
35 (firstName.empty() and secondName == DataStore::defaultArrayName<T>()) or
36 (secondName.empty() and firstName == DataStore::defaultArrayName<T>()));
41 const std::string& storeArrayNameOfPXDHits,
42 const std::string& storeArrayNameOfSVDHits,
43 const std::string& storeArrayNameOfCDCHits,
44 const std::string& storeArrayNameOfBKLMHits,
45 const std::string& storeArrayNameOfEKLMHits,
46 const bool initializeCDCTranslators) :
47 m_param_storeArrayNameOfPXDHits(storeArrayNameOfPXDHits),
48 m_param_storeArrayNameOfSVDHits(storeArrayNameOfSVDHits),
49 m_param_storeArrayNameOfCDCHits(storeArrayNameOfCDCHits),
50 m_param_storeArrayNameOfBKLMHits(storeArrayNameOfBKLMHits),
51 m_param_storeArrayNameOfEKLMHits(storeArrayNameOfEKLMHits)
56 if (initializeCDCTranslators) {
76 if (pxdHits.isOptional())
79 if (svdHits.isOptional())
82 if (cdcHits.isOptional())
85 if (bklmHits.isOptional())
88 if (eklmHits.isOptional())
106 const std::vector<std::shared_ptr<PXDBaseMeasurementCreator>>& pxdMeasurementCreators,
107 const std::vector<std::shared_ptr<SVDBaseMeasurementCreator>>& svdMeasurementCreators,
108 const std::vector<std::shared_ptr<CDCBaseMeasurementCreator>>& cdcMeasurementCreators,
109 const std::vector<std::shared_ptr<BKLMBaseMeasurementCreator>>& bklmMeasurementCreators,
110 const std::vector<std::shared_ptr<EKLMBaseMeasurementCreator>>& eklmMeasurementCreators,
111 const std::vector<std::shared_ptr<BaseMeasurementCreator>>& additionalMeasurementCreators)
124 const std::map<std::string, std::map<std::string, std::string>>& pxdMeasurementCreators,
125 const std::map<std::string, std::map<std::string, std::string>>& svdMeasurementCreators,
126 const std::map<std::string, std::map<std::string, std::string>>& cdcMeasurementCreators,
127 const std::map<std::string, std::map<std::string, std::string>>& bklmMeasurementCreators,
128 const std::map<std::string, std::map<std::string, std::string>>& eklmMeasurementCreators,
129 const std::map<std::string, std::map<std::string, std::string>>& additionalMeasurementCreators)
138 pxdMeasurementCreatorFactory.
setParameters(pxdMeasurementCreators);
139 svdMeasurementCreatorFactory.
setParameters(svdMeasurementCreators);
140 cdcMeasurementCreatorFactory.
setParameters(cdcMeasurementCreators);
141 bklmMeasurementCreatorFactory.
setParameters(bklmMeasurementCreators);
142 eklmMeasurementCreatorFactory.
setParameters(eklmMeasurementCreators);
143 additionalMeasurementCreatorFactory.
setParameters(additionalMeasurementCreators);
150 additionalMeasurementCreatorFactory.
initialize();
164 B2ASSERT(
"Reco Track was built with another CDC store array: Reco Track "
168 B2ASSERT(
"Reco Track was built with another SVD store array: Reco Track "
172 B2ASSERT(
"Reco Track was built with another PXD store array: Reco Track "
176 B2ASSERT(
"Reco Track was built with another BKLM store array: Reco Track "
181 B2ASSERT(
"Reco Track was built with another EKLM store array: Reco Track "
189 B2WARNING(
"No measurement creators where added to this instance, so no measurements where created. Did you forget to call setMeasurementCreators?");
194 B2DEBUG(100,
"Hit content did not change since last measurement adding and you are using default parameters." <<
195 "I will not add the measurements again. " <<
196 "If you still want to do so, set the dirty flag to true.");
204 std::map<genfit::TrackPoint*, RecoHitInformation*> trackPointHitMapping;
209 addMeasurementsFromHitToRecoTrack<RecoHitInformation::UsedPXDHit, Const::PXD>(recoTrack, recoHitInformation, pxdHit,
214 addMeasurementsFromHitToRecoTrack<RecoHitInformation::UsedSVDHit, Const::SVD>(recoTrack, recoHitInformation, svdHit,
219 addMeasurementsFromHitToRecoTrack<RecoHitInformation::UsedCDCHit, Const::CDC>(recoTrack, recoHitInformation, cdcHit,
224 addMeasurementsFromHitToRecoTrack<RecoHitInformation::UsedBKLMHit, Const::BKLM>(recoTrack, recoHitInformation, bklmHit,
229 addMeasurementsFromHitToRecoTrack<RecoHitInformation::UsedEKLMHit, Const::EKLM>(recoTrack, recoHitInformation, EKLMHit,
247 trackPointHitMapping[trackPoint]->setCreatedTrackPointID(counter);
255 const std::vector<std::shared_ptr<BaseMeasurementCreator>>& measurementCreators)
const
257 for (
const auto& measurementCreator : measurementCreators) {
258 const std::vector<genfit::TrackPoint*>& trackPoints = measurementCreator->createMeasurementPoints(recoTrack);
std::vector< std::shared_ptr< SVDBaseMeasurementCreator > > m_svdMeasurementCreators
Internal storage of the SVD measurement creators.
Object containing AbsMeasurement and AbsFitterInfo objects.
Add all measurement creators related to PXD hits.
bool addMeasurements(RecoTrack &recoTrack) const
After you have filled the internal storage with measurement creators (either by providing your own or...
MeasurementAdder(const std::string &storeArrayNameOfPXDHits, const std::string &storeArrayNameOfSVDHits, const std::string &storeArrayNameOfCDCHits, const std::string &storeArrayNameOfBKLMHits, const std::string &storeArrayNameOfEKLMHits, const bool initializeCDCTranslators=true)
Create a new instance of the measurement adder.
static genfit::Track & getGenfitTrack(RecoTrack &recoTrack)
Give access to the RecoTrack's genfit::Track.
Translator mirroring the realistic Digitization.
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
This class simply assumes a linear translation through (0,0)
void insertPoint(TrackPoint *point, int id=-1)
Insert TrackPoint BEFORE TrackPoint with position id, if id >= 0.
std::string m_param_storeArrayNameOfBKLMHits
The name of the store array for the BKLM hits.
void setDirtyFlag(const bool &dirtyFlag=true)
Set to true, if you want to rebuild the measurements and do the fit independent on changes of the hit...
bool m_skipDirtyCheck
Flag to skip the dirty check. Useful when using non default measurement creators.
genfit::MeasurementFactory< genfit::AbsMeasurement > m_genfitMeasurementFactory
Internal storage of the genfit measurement factory;.
void resetMeasurementCreatorsToDefaultSettings()
Reset the internal measurement creator storage to the default settings.
CoordinateMeasurementCreator< RecoHitInformation::UsedCDCHit, Const::CDC > CDCCoordinateMeasurementCreator
Needed for templating.
std::string m_param_storeArrayNameOfEKLMHits
The name of the store array for the EKLM hits.
static void setTranslators(CDC::ADCCountTranslatorBase *const adcCountTranslator, CDC::CDCGeometryTranslatorBase *const cdcGeometryTranslator, CDC::TDCCountTranslatorBase *const tdcCountTranslator, bool useTrackTime=false, bool cosmics=false)
Setter for the Translators.
Add all measurement creators related to EKLM hits.
const std::string & getStoreArrayNameOfPXDHits() const
Name of the store array of the pxd hits.
Template class for a measurement producer module.
This dataobject is used only for EKLM alignment.
std::string m_param_storeArrayNameOfSVDHits
The name of the store array for the SVD hits.
void deleteTrackPointsAndFitStatus()
Delete all measurement information and the track points of the track. Does not delete track represent...
void resetMeasurementCreatorsUsingFactories(const std::map< std::string, std::map< std::string, std::string >> &pxdMeasurementCreators, const std::map< std::string, std::map< std::string, std::string >> &svdMeasurementCreators, const std::map< std::string, std::map< std::string, std::string >> &cdcMeasurementCreators, const std::map< std::string, std::map< std::string, std::string >> &bklmMeasurementCreators, const std::map< std::string, std::map< std::string, std::string >> &eklmMeasurementCreators, const std::map< std::string, std::map< std::string, std::string >> &additionalMeasurementCreators)
If you want to use non-default settings for the store arrays, you can create your own instances of th...
void resetMeasurementCreators(const std::vector< std::shared_ptr< PXDBaseMeasurementCreator >> &pxdMeasurementCreators, const std::vector< std::shared_ptr< SVDBaseMeasurementCreator >> &svdMeasurementCreators, const std::vector< std::shared_ptr< CDCBaseMeasurementCreator >> &cdcMeasurementCreators, const std::vector< std::shared_ptr< BKLMBaseMeasurementCreator >> &bklmMeasurementCreators, const std::vector< std::shared_ptr< EKLMBaseMeasurementCreator >> &eklmMeasurementCreators, const std::vector< std::shared_ptr< BaseMeasurementCreator >> &additionalMeasurementCreators)
If you want to use non-default settings for the store arrays, you can create your own instances of th...
CoordinateMeasurementCreator< RecoHitInformation::UsedBKLMHit, Const::BKLM > BKLMCoordinateMeasurementCreator
Hit to reco hit measurement creator for the BKLM.
const std::vector< std::shared_ptr< BaseMeasurementCreatorType > > & getCreators() const
Return the creators to the module.
std::vector< std::shared_ptr< BaseMeasurementCreator > > m_additionalMeasurementCreators
Internal storage of the additional measurement creators.
This class uses the realistic detector geometry (the one after alignment procedure) for the translati...
This is the Reconstruction Event-Data Model Track.
CoordinateMeasurementCreator< RecoHitInformation::UsedSVDHit, Const::SVD > SVDCoordinateMeasurementCreator
Hit to reco hit measurement creator for the SVD.
Add all measurement creators related to CDC hits.
const std::string & getStoreArrayNameOfCDCHits() const
Name of the store array of the cdc hits.
void mapOnHits(const std::string &storeArrayNameOfHits, std::function< void(RecoHitInformation &, HitType *)> const &mapFunction, std::function< bool(const RecoHitInformation &, const HitType *)> const &pickFunction)
Call a function on all hits of the given type in the store array, that are related to this track.
Abstract base class for different kinds of events.
void addMeasurementsToRecoTrack(RecoTrack &recoTrack, const std::vector< std::shared_ptr< BaseMeasurementCreator >> &measurementCreators) const
Helper: Go through all measurement creators in the given list and create the measurement without a gi...
void setParameters(const std::map< std::string, std::map< std::string, std::string >> &creatorsWithParametersDictionary)
Set the parameters.
void addProducer(int detID, AbsMeasurementProducer< measurement_T > *hitProd)
Register a producer module to the factory.
std::string m_param_storeArrayNameOfCDCHits
The name of the store array for the CDC hits.
The PXD Cluster class This class stores all information about reconstructed PXD clusters The position...
std::vector< std::shared_ptr< BKLMBaseMeasurementCreator > > m_bklmMeasurementCreators
Internal storage of the BKLM measurement creators.
std::vector< std::shared_ptr< CDCBaseMeasurementCreator > > m_cdcMeasurementCreators
Internal storage of the CDC measurement creators.
Add all measurement creators related to SVD hits.
CoordinateMeasurementCreator< RecoHitInformation::UsedEKLMHit, Const::EKLM > EKLMCoordinateMeasurementCreator
Hit to reco hit measurement creator for the EKLM.
Add all measurement creators related to BKLM hits.
TClonesArray * getPtr() const
Raw access to the underlying TClonesArray.
The SVD Cluster class This class stores all information about reconstructed SVD clusters.
std::vector< std::shared_ptr< PXDBaseMeasurementCreator > > m_pxdMeasurementCreators
Internal storage of the PXD measurement creators.
bool getDirtyFlag() const
This returns true, if a hit was added after the last fit and measurement creation and a refit should ...
std::vector< std::shared_ptr< EKLMBaseMeasurementCreator > > m_eklmMeasurementCreators
Internal storage of the EKLM measurement creators.
Add measurement creators that do not rely on a specific hit type, but rather add measurements without...
Accessor to arrays stored in the data store.
std::string m_param_storeArrayNameOfPXDHits
The name of the store array for the PXD hits.
const std::string & getStoreArrayNameOfEKLMHits() const
Name of the store array of the eklm hits.
CoordinateMeasurementCreator< RecoHitInformation::UsedPXDHit, Const::PXD > PXDCoordinateMeasurementCreator
Hit to reco hit measurement creator for the PXD.
void createGenfitMeasurementFactory()
Helper function to create a genfit::MeasurementFactory, needed in the MeasurementCreators.
Store one BKLM strip hit as a ROOT object.
void initialize()
Use the parameters given to the module and create the measurement creators from them.
const std::string & getStoreArrayNameOfBKLMHits() const
Name of the store array of the bklm hits.
const std::string & getStoreArrayNameOfSVDHits() const
Name of the store array of the svd hits.