10 #include <RKTrackRep.h>
20 #include <TDatabasePDG.h>
21 #include <TEveManager.h>
22 #include <TGeoManager.h>
28 #include <TClonesArray.h>
31 #include <TDatabasePDG.h>
46 new TGeoManager(
"Geometry",
"Geane geometry");
47 TGeoManager::Import(
"genfitGeom.root");
61 vertexFactory.
setMethod(
"kalman-smoothing:1");
66 TFile* trackFile =
new TFile(
"tracks.root",
"RECREATE");
68 TTree* tree =
new TTree(
"tree",
"fitted tracks");
69 TClonesArray trackArray(
"genfit::Track");
70 tree->Branch(
"trackBranch", &trackArray, 32000, -1);
72 TClonesArray vertexArray(
"genfit::GFRaveVertex");
73 tree->Branch(
"vertexBranch", &vertexArray, 32000, -1);
75 std::vector<genfit::Track*> tracks;
76 std::vector<genfit::GFRaveVertex*> vertices;
79 for (
unsigned int iEvent=0; iEvent<10; ++iEvent){
88 unsigned int nTracks = gRandom->Uniform(2, 10);
90 for (
unsigned int iTrack=0; iTrack<nTracks; ++iTrack){
93 TVector3
pos(0, 0, 0);
95 mom.SetPhi(gRandom->Uniform(0.,2*TMath::Pi()));
96 mom.SetTheta(gRandom->Uniform(0.4*TMath::Pi(),0.6*TMath::Pi()));
97 mom.SetMag(gRandom->Uniform(0.2, 1.));
102 const double charge = TDatabasePDG::Instance()->GetParticle(pdg)->Charge()/(3.);
107 unsigned int nMeasurements = gRandom->Uniform(5, 15);
111 const bool smearPosMom =
true;
112 const double posSmear = 0.1;
113 const double momSmear = 3. /180.*TMath::Pi();
114 const double momMagSmear = 0.1;
119 posM.SetX(gRandom->Gaus(posM.X(),posSmear));
120 posM.SetY(gRandom->Gaus(posM.Y(),posSmear));
121 posM.SetZ(gRandom->Gaus(posM.Z(),posSmear));
123 momM.SetPhi(gRandom->Gaus(mom.Phi(),momSmear));
124 momM.SetTheta(gRandom->Gaus(mom.Theta(),momSmear));
125 momM.SetMag(gRandom->Gaus(mom.Mag(), momMagSmear*mom.Mag()));
129 double resolution = 0.01;
130 for (
int i = 0; i < 3; ++i)
131 covM(i,i) = resolution*resolution;
132 for (
int i = 3; i < 6; ++i)
133 covM(i,i) = pow(resolution / nMeasurements / sqrt(3), 2);
145 TVectorD seedState(6);
146 TMatrixDSym seedCov(6);
149 new(trackArray[iTrack])
genfit::Track(rep, seedState, seedCov);
150 genfit::Track* trackPtr(static_cast<genfit::Track*>(trackArray.At(iTrack)));
151 tracks.push_back(trackPtr);
154 std::vector<genfit::eMeasurementType> measurementTypes;
155 for (
unsigned int i = 0; i < nMeasurements; ++i)
161 for (
unsigned int i=1; i<measurementTypes.size(); ++i){
162 std::vector<genfit::AbsMeasurement*> measurements = measurementCreator.
create(measurementTypes[i], i*5.);
167 std::cerr<<
"Exception, next track"<<std::endl;
168 std::cerr << e.
what();
180 std::cerr << e.
what();
181 std::cerr <<
"Exception, next track" << std::endl;
195 for (
unsigned int i=0; i<vertices.size(); ++i) {
199 for (
unsigned int j=0; j<vtx->
getNTracks(); ++j) {
205 for (
unsigned int i=0; i<tracks.size(); ++i) {
207 std::cout <<
"track uniqueID: " << trk->GetUniqueID() <<
"\n";
212 std::cout <<
"trackArray nr of entries: " << trackArray.GetEntries() <<
"\n";