1 #include <ConstField.h>
3 #include <FieldManager.h>
4 #include <KalmanFitterRefTrack.h>
5 #include <StateOnPlane.h>
8 #include <TrackPoint.h>
10 #include <MeasurementProducer.h>
11 #include <MeasurementFactory.h>
13 #include "mySpacepointDetectorHit.h"
14 #include "mySpacepointMeasurement.h"
16 #include <MaterialEffects.h>
17 #include <RKTrackRep.h>
18 #include <TGeoMaterialInterface.h>
20 #include <EventDisplay.h>
22 #include <HelixTrackModel.h>
23 #include <MeasurementCreator.h>
25 #include <TDatabasePDG.h>
26 #include <TEveManager.h>
27 #include <TGeoManager.h>
32 #include "TDatabasePDG.h"
47 new TGeoManager(
"Geometry",
"Geane geometry");
48 TGeoManager::Import(
"genfitGeom.root");
61 TClonesArray myDetectorHitArray(
"genfit::mySpacepointDetectorHit");
71 for (
unsigned int iEvent=0; iEvent<100; ++iEvent){
73 myDetectorHitArray.Clear();
79 TVector3 pos(0, 0, 0);
81 mom.SetPhi(gRandom->Uniform(0.,2*TMath::Pi()));
82 mom.SetTheta(gRandom->Uniform(0.4*TMath::Pi(),0.6*TMath::Pi()));
83 mom.SetMag(gRandom->Uniform(0.2, 1.));
88 const double charge = TDatabasePDG::Instance()->GetParticle(pdg)->Charge()/(3.);
93 unsigned int nMeasurements = gRandom->Uniform(5, 15);
96 double resolution = 0.01;
98 for (
int i = 0; i < 3; ++i)
99 cov(i,i) = resolution*resolution;
101 for (
unsigned int i=0; i<nMeasurements; ++i) {
103 TVector3 currentPos = helix->getPos(i*2.);
104 currentPos.SetX(gRandom->Gaus(currentPos.X(), resolution));
105 currentPos.SetY(gRandom->Gaus(currentPos.Y(), resolution));
106 currentPos.SetZ(gRandom->Gaus(currentPos.Z(), resolution));
112 myCand.addHit(myDetId, i);
117 const bool smearPosMom =
true;
118 const double posSmear = 0.1;
119 const double momSmear = 3. /180.*TMath::Pi();
120 const double momMagSmear = 0.1;
125 posM.SetX(gRandom->Gaus(posM.X(),posSmear));
126 posM.SetY(gRandom->Gaus(posM.Y(),posSmear));
127 posM.SetZ(gRandom->Gaus(posM.Z(),posSmear));
129 momM.SetPhi(gRandom->Gaus(mom.Phi(),momSmear));
130 momM.SetTheta(gRandom->Gaus(mom.Theta(),momSmear));
131 momM.SetMag(gRandom->Gaus(mom.Mag(), momMagSmear*mom.Mag()));
135 TMatrixDSym covSeed(6);
136 for (
int i = 0; i < 3; ++i)
137 covSeed(i,i) = resolution*resolution;
138 for (
int i = 3; i < 6; ++i)
139 covSeed(i,i) = pow(resolution / nMeasurements /
sqrt(3), 2);
153 fitter->processTrack(&fitTrack);
156 std::cerr << e.what();
157 std::cerr <<
"Exception, next track" << std::endl;
161 fitTrack.checkConsistency();
166 display->addEvent(&fitTrack);
Abstract base class for Kalman fitter and derived fitting algorithms.
Event display designed to run with Genfit.
Exception class for error handling in GENFIT (provides storage for diagnostic information)
static FieldManager * getInstance()
Get singleton instance.
void init(AbsBField *b)
set the magnetic field here. Magnetic field classes must be derived from AbsBField.
Helix track model for testing purposes.
Kalman filter implementation with linearization around a reference track.
void init(AbsMaterialInterface *matIfc)
set the material interface here. Material interface classes must be derived from AbsMaterialInterface...
Create different measurement types along a HelixTrackModel for testing purposes.
void setTrackModel(const HelixTrackModel *model)
Takes ownership!
void addProducer(int detID, AbsMeasurementProducer< measurement_T > *hitProd)
Register a producer module to the factory.
Template class for a measurement producer module.
AbsTrackRep with 5D track parameterization in plane coordinates: (q/p, u', v', u, v)
AbsMaterialInterface implementation for use with ROOT's TGeoManager.
Track candidate – seed values and indices.
void setCovSeed(const TMatrixDSym &cov6D)
set the covariance matrix seed (6D).
void setPosMomSeedAndPdgCode(const TVector3 &pos, const TVector3 &mom, const int pdgCode)
This function works the same as setPosMomSeed but instead of a charge hypothesis you can set a pdg co...
Collection of TrackPoint objects, AbsTrackRep objects and FitStatus objects.
Example class for a spacepoint detector hit.
double sqrt(double a)
sqrt for double
double charge(int pdgCode)
Returns electric charge of a particle with given pdg code.
int main(int argc, char **argv)
Run all tests.