8 int runPull(std::string propName =
"rk",
bool drawHist =
false)
10 if (propName !=
"geane" && propName !=
"rk") {
11 cout <<
"Choose either \"geane\" or \"rk\"." << endl;
18 TFile *f =
new TFile(Form(
"prop.%s.cal.root", propName.data()));
19 TTree *simtree = (TTree *)f->Get(
"cbmsim");
21 TClonesArray *fTrackParProp =
new TClonesArray(
"FairTrackParP");
22 TClonesArray *fTrackParIni =
new TClonesArray(
"FairTrackParP");
23 TClonesArray *fTrackParFinal =
new TClonesArray(
"FairTrackParP");
25 Double_t maxDist = 0.1;
26 TH1F *hQP =
new TH1F(
"hQP",
"charge over momentum", 200, -maxDist, maxDist);
27 TH1F *hX =
new TH1F(
"hX",
"position X", 200, -maxDist, maxDist);
28 TH1F *hY =
new TH1F(
"hY",
"position Y", 200, -maxDist, maxDist);
29 TH1F *hPx =
new TH1F(
"hPx",
"momentum X", 200, -maxDist, maxDist);
30 TH1F *hPy =
new TH1F(
"hPy",
"momentum Y", 200, -maxDist, maxDist);
31 TH1F *hPz =
new TH1F(
"hPz",
"momentum Z", 200, -maxDist, maxDist);
33 simtree->SetBranchAddress(
"PropTrackFinal", &fTrackParFinal);
34 simtree->SetBranchAddress(
"PropTrackPar", &fTrackParProp);
37 Int_t Nevents = simtree->GetEntriesFast();
38 cout << Nevents << endl;
39 for (Int_t i = 0; i < Nevents; i++) {
41 for (Int_t k = 0; k < fTrackParProp->GetEntriesFast(); k++) {
46 hX->Fill(fTrkF->
GetX() - fTrkG->
GetX());
47 hY->Fill(fTrkF->
GetY() - fTrkG->
GetY());
61 TCanvas *c =
new TCanvas(
"c",
"c", 900, 600);
85 TF1 *fitX =
new TF1(
"fitX",
"gaus", -5., 5.);
86 hX->Fit(
"fitX",
"QN");
88 if (fitX->GetParameter(1) > -1.e-3 && fitX->GetParameter(1) < 1.e-3 && fitX->GetParameter(2) > 0.
89 && fitX->GetParameter(2) < 1.e-2)
90 cout <<
"Macro finished successfully. Mean (" << fitX->GetParameter(1) <<
") and sigma ("
91 << fitX->GetParameter(2) <<
") inside limits." << endl;
93 cout <<
"Macro failed. Mean (" << fitX->GetParameter(1) <<
") or sigma (" << fitX->GetParameter(2)
94 <<
") too far off." << endl;
virtual Double_t GetPz() const
virtual Double_t GetQp() const
virtual Double_t GetPx() const
int runPull(std::string propName="rk", bool drawHist=false)
virtual Double_t GetPy() const