9 for(
int t = 0;
t < 9;
t++) kindOftest[
t] = 0;
14 TClonesArray *
pnt =
new TClonesArray(
"PndSttPoint");
15 treepnt->SetBranchAddress(
"STTPoint",&pnt);
18 TClonesArray *mctrackarray =
new TClonesArray(
"PndMCTrack");
19 treepnt->SetBranchAddress(
"MCTrack",&mctrackarray);
24 TClonesArray *digiarray =
new TClonesArray(
"PndSttHit");
25 treedigi->SetBranchAddress(
"STTHit",&digiarray);
30 TClonesArray *trackarray =
new TClonesArray(
"PndTrack");
31 treereco->SetBranchAddress(
"SttMvdTrack",&trackarray);
39 TH1F *hisochrone =
new TH1F(
"hisochrone",
"Simulated drift radius", 100, 0., 0.6);
40 TH1F *hptot_mum =
new TH1F(
"hptot_mum",
"Total momentum for #mu^{-}", 100, 0.6, 1.4);
41 TH1F *hptot_mup =
new TH1F(
"hptot_mup",
"Total momentum for #mu^{+}", 100, 0.6, 1.4);
42 TH1F *hptot =
new TH1F(
"hptot",
"Total momentum", 100, 0.6, 1.4);
45 int nevents = treereco->GetEntriesFast();
46 int mum_tracks = 3 * nevents;
47 int mup_tracks = 3 * nevents;
49 double mum_hel_res = 0.03;
50 double mum_hel_res_tol = 0.01;
51 double mum_hel_eff = 0.87;
52 double mum_hel_eff_tol = 0.1;
53 double mum_hel_peak_eff = 0.81;
54 double mum_hel_peak_eff_tol = 0.1;
57 double mup_hel_res = 0.03;
58 double mup_hel_res_tol = 0.01;
59 double mup_hel_eff = 0.87;
60 double mup_hel_eff_tol = 0.1;
61 double mup_hel_peak_eff = 0.81;
62 double mup_hel_peak_eff_tol = 0.1;
66 for (Int_t
evt = 0;
evt < nevents;
evt++) {
68 treepnt->GetEntry(
evt);
69 treedigi->GetEntry(
evt);
70 treereco->GetEntry(
evt);
73 for(Int_t
i = 0;
i < digiarray->GetEntriesFast();
i++) {
79 if(hisochrone->GetBinCenter(hisochrone->FindLastBinAbove(0)) > 0.506) {
80 fTest = kFALSE; kindOftest[0] = 1;
81 cout <<
"TEST 0: hisocrone " << hisochrone->GetBinCenter(hisochrone->FindLastBinAbove(0)) <<
" (limit = 0.506)" << endl;
88 for (Int_t k = 0; k < trackarray->GetEntriesFast(); k++) {
95 if(track->
GetFlag() < 0)
continue;
100 if (track->GetNLinks() > 0){
101 FairLink MCLink = track->GetLink(1);
102 if (MCLink.GetType() == 0)
103 MCTrackID = MCLink.GetIndex();
105 if(MCTrackID == -1)
continue;
107 if(!mctrack)
continue;
110 if(mctrack->
GetPdgCode() == 13) hptot_mum->Fill(lastmom.Mag());
111 else if(mctrack->
GetPdgCode() == -13) hptot_mup->Fill(lastmom.Mag());
112 hptot->Fill(lastmom.Mag());
121 int binmax = hptot->GetMaximumBin();
122 double ymax = hptot->GetMaximum();
123 double xmax = hptot->GetBinCenter(binmax);
124 int bininf = hptot->FindFirstBinAbove(ymax/2., 1);
126 int binsup = hptot->FindLastBinAbove(ymax/2., 1);
128 double xinf = hptot->GetBinCenter(bininf);
129 double xsup = hptot->GetBinCenter(binsup);
130 double gamma = xsup - xinf;
131 double sigma1 = gamma / 2.34;
139 TF1 *
fgaus =
new TF1(
"fgaus",
"gaus", xinf, xsup);
140 hptot_mum->Fit(
"fgaus",
"R0QN");
142 fgaus->GetParameters(gauspar);
148 if(mean < (mean - 3 * sigma) || mean > (mean + 3 * sigma)) {
149 fTest = kFALSE; kindOftest[1] = 1;
150 cout <<
"TEST 1: helix mu- mean " << mean
151 <<
" (limits [" << (mean - 3 *
sigma) <<
", " << (mean + 3 * sigma) <<
"])" << endl;
179 hptot_mup->Fit(
"fgaus",
"R0QN");
180 fgaus->GetParameters(gauspar);
185 if(mean < (mean - 3 * sigma) || mean > (mean + 3 * sigma)) {
186 fTest = kFALSE; kindOftest[5] = 1;
187 cout <<
"TEST 9: helix mu+ mean " << mean
188 <<
" (limits [" << (mean - 3 *
sigma) <<
", " << (mean + 3 * sigma) <<
"])" << endl;
215 cout <<
" Test Passed" << endl;
216 cout <<
" All Ok " << endl;
218 cout <<
" Test Failed" << endl;
219 cout <<
" Not Ok " << endl;
221 for(
int t = 0;
t < 9;
t++) {
223 if(kindOftest[
t] == 0)
continue;
228 cout <<
"isochrone out of 0.5 cm" << endl;
232 cout <<
"negative muon ptot out of 3 sigma" << endl;
236 cout <<
"negative muon ptot resolution wrong" << endl;
240 cout <<
"negative muon ptot efficiency in [0.6, 1.4] wrong" << endl;
244 cout <<
"negative muon ptot efficiency in peak wrong" << endl;
248 cout <<
"positive muon ptot out of 3 sigma" << endl;
252 cout <<
"positive muon ptot resolution wrong" << endl;
256 cout <<
"positive muon ptot efficiency in [0.6, 1.4] wrong" << endl;
260 cout <<
"positive muon ptot efficiency in peak wrong" << endl;
269 printf(
"RealTime=%f seconds, CpuTime=%f seconds\n",rtime,ctime);
TFile filereco("MvdStt_Test_reco.root")
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
Double_t GetIsochrone() const
TFile filedigi("testdigi.root")
FairTrackParP GetParamLast()
TFile filerun("testrun.root")
int hit(Int_t nEvents=0, TString inFile="sim.root", TString parFile="par.root", TString inDigi="digi.root", TString outFile="hit.root", Int_t timeBased=0)
Int_t GetMotherID() const