#include <tracking.h>
Utility class, to define and fit your own tracks directly on the ROOT file, with your own selected hits and optionally without magnetic field (straight line fit). No multiple scattering is included for the moment. Example of usage:
{
// Resetting and loading AMS library
gROOT->Reset();
gSystem->Exec("cd ../lib; make shared");
gSystem->Exec("cd ../lib; make tracking_shared");
gSystem->Load("../lib/libAMSRoot.so");
gSystem->Load("../lib/libtracking.so");
// Input AMS ROOT Chain
AMSChain *ams = new AMSChain;
ams->Add("../files/test.root");
// Output file and histograms
char* chfile = "amstest.root";
TFile* hfile = new TFile (chfile, "RECREATE");
TH1F* hrig = new TH1F ("hrig", "Rigidity change (GV)", 50, -1., 1.);
// Loop to analyze entries
int ndata = ams->GetEntries();
for (int entry=0; entry<ndata; entry++) {
AMSEventR* pev = ams->GetEvent();
if (pev==NULL) break;
for (int i=0; i<pev->nTrTrack(); i++) {
TrTrackR* ptrk = pev->pTrTrack(i);
// Instantiate your track
MyTrack my_track(ptrk);
// Remove some hits (just to use some additional functions)
for (int j=5; j<my_track.NHits(); j++) {
my_track.del_hit(j);
}
if (ptrk->NTrRecHit()>5) {
double* pred = my_track.Prediction(ptrk->pTrRecHit(5));
if (pred) printf ("X pred %f, measured %f\n"
, pred[0], ptrk->pTrRecHit(5)->Hit[0]);
}
int stat = my_track.Fit();
if (stat==0) {
hrig->Fill(my_track.Rigidity-ptrk->RigidityWithoutMS);
//printf("Track number= %d, Old rig %f, New Rig %f\n"
// , i, ptrk->RigidityWithoutMS, my_track.Rigidity);
}
}
}
hrig->Draw();
hfile->Write();
printf("We have processed %d events\n", ndata);
printf("Histograms saved in '%s'\n", chfile);
}
Definition at line 55 of file tracking.h.
Public Member Functions | |
| int | NHits () |
| Number of hits. | |
| MyHit & | Hit (int l) |
| Get hit number l. | |
| double * | Prediction (int index) |
| Get prediction (x,y,z,theta,phi,dx,dy) at hit index. | |
| double * | PredictionStraightLine (int index) |
| Get prediction from straight line (x,y,z,theta,phi,dx,dy) at hit index. | |
| double * | Prediction (MyHit *phit) |
| Get prediction (x,y,z,theta,phi,dx,dy) at hit given by pointer. | |
| double * | PredictionStraightLine (MyHit *phit) |
| Get prediction from straight line (x,y,z,theta,phi,dx,dy) at hit given by pointer. | |
| double * | Prediction (TrRecHitR *phit) |
| Get prediction (x,y,z,theta,phi,dx,dy) at hit given by pointer. | |
| double * | PredictionStraightLine (TrRecHitR *phit) |
| Get prediction from straight line (x,y,z,theta,phi,dx,dy) at hit given by pointer. | |
| double * | Prediction (double *coo, double *ecoo, double *bfield) |
| Get prediction (x,y,z,theta,phi,dx,dy) at a user defined point. | |
| double * | PredictionStraightLine (double *coo, double *ecoo, double *bfield) |
| Get prediction from straight line (x,y,z,theta,phi,dx,dy) at a user defined point. | |
| int | SimpleFit () |
| Perform simple fit inside magnetic field. | |
| int | StraightLineFit () |
| Perform istraight line fit. | |
| int | Fit () |
| Perform fit inside magnetic field (same as SimpleFit). | |
| void | Clear () |
| Remove al hits. | |
| MyHit * | add_hit (TrRecHitR *phit) |
| Add a hit from pointer. | |
| MyHit * | add_hit (float *coo, float *ecoo, float *bfield) |
| Add a hit at 3D position coo(cm), with 3D error ecoo(cm) and 3D-magnetic field bfield (kG). | |
| MyHit * | add_hit (double *coo, double *ecoo, double *bfield) |
| Add a hit at 3D position coo(cm), with 3D error ecoo(cm) and 3D-magnetic field bfield (kG). | |
| void | use_hits_from (TrTrackR *ptr) |
| Clear hits and use those from track at ptr. | |
| void | del_hit (int index) |
| Remove hit at index. | |
| void | del_hit (MyHit *phit) |
| Remove hit having phit as pointer to "MyHit". | |
| MyTrack () | |
| Default constructor. | |
| MyTrack (TrTrackR *ptr) | |
| Constructor. | |
Data Fields | |
| double | Rigidity |
| Rigidity (GV). | |
| double | Chi2 |
| Chi2 in 3D from fit. | |
| int | Ndof |
| ndof in 3D from fit | |
| double | Theta |
| Theta from fit (rad). | |
| double | Phi |
| Phi from fit (rad). | |
| double | U [3] |
| Unit direction vector. | |
| double | P0 [3] |
| Reference point from fit (cm). | |
1.3.9.1