8#include <tracking/trackFitting/measurementCreator/adder/MeasurementAdder.h>
9#include <tracking/trackFitting/measurementCreator/creators/CoordinateMeasurementCreator.h>
11#include <cdc/dataobjects/CDCRecoHit.h>
12#include <pxd/reconstruction/PXDRecoHit.h>
13#include <svd/reconstruction/SVDRecoHit.h>
14#include <alignment/reconstruction/AlignableBKLMRecoHit.h>
15#include <alignment/reconstruction/AlignableEKLMRecoHit.h>
17#include <cdc/translators/LinearGlobalADCCountTranslator.h>
18#include <cdc/translators/RealisticCDCGeometryTranslator.h>
19#include <cdc/translators/RealisticTDCCountTranslator.h>
21#include <genfit/MeasurementFactory.h>
30 bool checkTwoStoreArrayNames(
const std::string& firstName,
const std::string& secondName)
32 return ((firstName == secondName) or
39 const std::string& storeArrayNameOfPXDHits,
40 const std::string& storeArrayNameOfSVDHits,
41 const std::string& storeArrayNameOfCDCHits,
42 const std::string& storeArrayNameOfBKLMHits,
43 const std::string& storeArrayNameOfEKLMHits,
44 const bool initializeCDCTranslators) :
54 if (initializeCDCTranslators) {
76 new genfit::MeasurementProducer<RecoHitInformation::UsedPXDHit, PXDRecoHit>(pxdHits.
getPtr()));
79 new genfit::MeasurementProducer<RecoHitInformation::UsedSVDHit, SVDRecoHit>(svdHits.
getPtr()));
82 new genfit::MeasurementProducer<RecoHitInformation::UsedCDCHit, CDCRecoHit>(cdcHits.
getPtr()));
85 new genfit::MeasurementProducer<RecoHitInformation::UsedBKLMHit, AlignableBKLMRecoHit>(bklmHits.
getPtr()));
88 new genfit::MeasurementProducer<RecoHitInformation::UsedEKLMHit, AlignableEKLMRecoHit>(eklmHits.
getPtr()));
104 const std::vector<std::shared_ptr<PXDBaseMeasurementCreator>>& pxdMeasurementCreators,
105 const std::vector<std::shared_ptr<SVDBaseMeasurementCreator>>& svdMeasurementCreators,
106 const std::vector<std::shared_ptr<CDCBaseMeasurementCreator>>& cdcMeasurementCreators,
107 const std::vector<std::shared_ptr<BKLMBaseMeasurementCreator>>& bklmMeasurementCreators,
108 const std::vector<std::shared_ptr<EKLMBaseMeasurementCreator>>& eklmMeasurementCreators,
109 const std::vector<std::shared_ptr<BaseMeasurementCreator>>& additionalMeasurementCreators)
122 const std::map<std::string, std::map<std::string, std::string>>& pxdMeasurementCreators,
123 const std::map<std::string, std::map<std::string, std::string>>& svdMeasurementCreators,
124 const std::map<std::string, std::map<std::string, std::string>>& cdcMeasurementCreators,
125 const std::map<std::string, std::map<std::string, std::string>>& bklmMeasurementCreators,
126 const std::map<std::string, std::map<std::string, std::string>>& eklmMeasurementCreators,
127 const std::map<std::string, std::map<std::string, std::string>>& additionalMeasurementCreators)
136 pxdMeasurementCreatorFactory.
setParameters(pxdMeasurementCreators);
137 svdMeasurementCreatorFactory.
setParameters(svdMeasurementCreators);
138 cdcMeasurementCreatorFactory.
setParameters(cdcMeasurementCreators);
139 bklmMeasurementCreatorFactory.
setParameters(bklmMeasurementCreators);
140 eklmMeasurementCreatorFactory.
setParameters(eklmMeasurementCreators);
141 additionalMeasurementCreatorFactory.
setParameters(additionalMeasurementCreators);
148 additionalMeasurementCreatorFactory.
initialize();
162 B2ASSERT(
"Reco Track was built with another CDC store array: Reco Track "
166 B2ASSERT(
"Reco Track was built with another SVD store array: Reco Track "
170 B2ASSERT(
"Reco Track was built with another PXD store array: Reco Track "
174 B2ASSERT(
"Reco Track was built with another BKLM store array: Reco Track "
179 B2ASSERT(
"Reco Track was built with another EKLM store array: Reco Track "
187 B2WARNING(
"No measurement creators where added to this instance, so no measurements where created. Did you forget to call setMeasurementCreators?");
192 B2DEBUG(100,
"Hit content did not change since last measurement adding and you are using default parameters." <<
193 "I will not add the measurements again. " <<
194 "If you still want to do so, set the dirty flag to true.");
202 std::map<genfit::TrackPoint*, RecoHitInformation*> trackPointHitMapping;
244 for (genfit::TrackPoint* trackPoint : genfitTrack.getPoints()) {
245 trackPointHitMapping[trackPoint]->setCreatedTrackPointID(counter);
253 const std::vector<std::shared_ptr<BaseMeasurementCreator>>& measurementCreators)
const
255 for (
const auto& measurementCreator : measurementCreators) {
256 const std::vector<genfit::TrackPoint*>& trackPoints = measurementCreator->createMeasurementPoints(recoTrack);
257 for (genfit::TrackPoint* trackPoint : trackPoints) {
Add measurement creators that do not rely on a specific hit type, but rather add measurements without...
Add all measurement creators related to BKLM hits.
Add all measurement creators related to CDC 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.
This class simply assumes a linear translation through (0,0)
This class uses the realistic detector geometry (the one after alignment procedure) for the translati...
Translator mirroring the realistic Digitization.
static std::string defaultArrayName(const std::string &classname)
Return the default storage name for an given class name.
Add all measurement creators related to EKLM hits.
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...
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.
void createGenfitMeasurementFactory()
Helper function to create a genfit::MeasurementFactory, needed in the MeasurementCreators.
std::vector< std::shared_ptr< PXDBaseMeasurementCreator > > m_pxdMeasurementCreators
Internal storage of the PXD measurement creators.
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...
std::vector< std::shared_ptr< EKLMBaseMeasurementCreator > > m_eklmMeasurementCreators
Internal storage of the EKLM measurement creators.
std::string m_param_storeArrayNameOfPXDHits
The name of the store array for the PXD hits.
std::string m_param_storeArrayNameOfBKLMHits
The name of the store array for the BKLM hits.
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.
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.
std::string m_param_storeArrayNameOfSVDHits
The name of the store array for the SVD hits.
std::vector< std::shared_ptr< BaseMeasurementCreator > > m_additionalMeasurementCreators
Internal storage of the additional measurement creators.
std::string m_param_storeArrayNameOfEKLMHits
The name of the store array for the EKLM hits.
std::string m_param_storeArrayNameOfCDCHits
The name of the store array for the CDC hits.
bool m_skipDirtyCheck
Flag to skip the dirty check. Useful when using non default measurement creators.
void addMeasurementsFromHitToRecoTrack(RecoTrack &recoTrack, RecoHitInformation &recoHitInformation, HitType *hit, const std::vector< std::shared_ptr< BaseMeasurementCreatorFromHit< HitType, detector > > > &measurementCreators, std::map< genfit::TrackPoint *, RecoHitInformation * > &trackPointHitMapping) const
Helper: Go through all measurement creators in the given list and create the measurement with a given...
std::vector< std::shared_ptr< SVDBaseMeasurementCreator > > m_svdMeasurementCreators
Internal storage of the SVD measurement creators.
bool addMeasurements(RecoTrack &recoTrack) const
After you have filled the internal storage with measurement creators (either by providing your own or...
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 initialize()
Use the parameters given to the module and create the measurement creators from them.
const std::vector< std::shared_ptr< BaseMeasurementCreatorType > > & getCreators() const
Return the creators to the module.
void setParameters(const std::map< std::string, std::map< std::string, std::string > > &creatorsWithParametersDictionary)
Set the parameters.
Add all measurement creators related to PXD hits.
static genfit::Track & getGenfitTrack(RecoTrack &recoTrack)
Give access to the RecoTrack's genfit::Track.
This is the Reconstruction Event-Data Model Track.
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.
const std::string & getStoreArrayNameOfEKLMHits() const
Name of the store array of the eklm hits.
const std::string & getStoreArrayNameOfSVDHits() const
Name of the store array of the svd hits.
const std::string & getStoreArrayNameOfPXDHits() const
Name of the store array of the pxd 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...
const std::string & getStoreArrayNameOfBKLMHits() const
Name of the store array of the bklm hits.
const std::string & getStoreArrayNameOfCDCHits() const
Name of the store array of the cdc hits.
bool getDirtyFlag() const
This returns true, if a hit was added after the last fit and measurement creation and a refit should ...
Add all measurement creators related to SVD hits.
bool isOptional(const std::string &name="")
Tell the DataStore about an optional input.
Accessor to arrays stored in the data store.
TClonesArray * getPtr() const
Raw access to the underlying TClonesArray.
CoordinateMeasurementCreator< RecoHitInformation::UsedSVDHit, Const::SVD > SVDCoordinateMeasurementCreator
Hit to reco hit measurement creator for the SVD.
CoordinateMeasurementCreator< RecoHitInformation::UsedPXDHit, Const::PXD > PXDCoordinateMeasurementCreator
Hit to reco hit measurement creator for the PXD.
CoordinateMeasurementCreator< RecoHitInformation::UsedBKLMHit, Const::BKLM > BKLMCoordinateMeasurementCreator
Hit to reco hit measurement creator for the BKLM.
CoordinateMeasurementCreator< RecoHitInformation::UsedCDCHit, Const::CDC > CDCCoordinateMeasurementCreator
Needed for templating.
CoordinateMeasurementCreator< RecoHitInformation::UsedEKLMHit, Const::EKLM > EKLMCoordinateMeasurementCreator
Hit to reco hit measurement creator for the EKLM.
Abstract base class for different kinds of events.