38 {
39
40 gRandom->SetSeed(14);
41
42
44
45
46
47 new TGeoManager("Geometry", "Geane geometry");
48 TGeoManager::Import("genfitGeom.root");
51
52
53
55
56
57
59
60
61 TClonesArray myDetectorHitArray("genfit::mySpacepointDetectorHit");
62
63
64 int myDetId(1);
67 factory.addProducer(myDetId, &myProducer);
68
69
70
72
73 myDetectorHitArray.Clear();
74
75
77
78
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.));
84
85
86
88 const double charge = TDatabasePDG::Instance()->GetParticle(pdg)->Charge()/(3.);
91
92
93 unsigned int nMeasurements = gRandom->Uniform(5, 15);
94
95
96 double resolution = 0.01;
97 TMatrixDSym cov(3);
98 for (
int i = 0;
i < 3; ++
i)
99 cov(i,i) = resolution*resolution;
100
101 for (
unsigned int i=0;
i<nMeasurements; ++
i) {
102
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));
107
108
109
110
112 myCand.
addHit(myDetId, i);
113 }
114
115
116
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;
121
122 TVector3 posM(pos);
123 TVector3 momM(mom);
124 if (smearPosMom) {
125 posM.SetX(gRandom->Gaus(posM.X(),posSmear));
126 posM.SetY(gRandom->Gaus(posM.Y(),posSmear));
127 posM.SetZ(gRandom->Gaus(posM.Z(),posSmear));
128
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()));
132 }
133
134
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);
140
141
142
145
146
147
149
150
151
152 try{
153 fitter->processTrack(&fitTrack);
154 }
156 std::cerr << e.
what();
157 std::cerr << "Exception, next track" << std::endl;
158 continue;
159 }
160
161
162 assert(
fitTrack.checkConsistency());
163
164
165 if (iEvent < 1000) {
166
168 }
169
170
171 }
172
174
175
177
178}
Abstract base class for Kalman fitter and derived fitting algorithms.
Event display designed to run with Genfit.
void addEvent(std::vector< genfit::Track * > &tracks)
Add new event.
static EventDisplay * getInstance()
void open()
Open the event display.
Exception class for error handling in GENFIT (provides storage for diagnostic information)
virtual const char * what() const
Standard error message handling for exceptions. use like "std::cerr << e.what();".
void init(AbsBField *b)
set the magnetic field here. Magnetic field classes must be derived from AbsBField.
static FieldManager * getInstance()
Get singleton instance.
Helix track model for testing purposes.
TVector3 getPos(double tracklength) const
Kalman filter implementation with linearization around a reference track.
static MaterialEffects * getInstance()
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!
Factory object to create AbsMeasurement objects from digitized and clustered data.
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 addHit(int detId, int hitId, int planeId=-1, double sortingParameter=0)
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.
fitTrack(hitlist, Pstart=3.)