27 #include "TClonesArray.h"
28 #include "TDirectory.h"
33 #include "TGraphErrors.h"
42 #include "TStopwatch.h"
54 #include "CbmTofHit.h"
56 #include "TDatabasePDG.h"
63 #include "FairMCEventHeader.h"
64 #include "KFPTrackVector.h"
65 #include "KFParticleTopoReconstructor.h"
82 KFParticleTopoReconstructor* tr,
94 , fRecoLevel(recoLevel)
142 TDirectory* currentDir = gDirectory;
144 gDirectory->cd(
"Models");
146 histodir = gDirectory;
148 gDirectory->mkdir(
"ImpactParameterModel");
149 gDirectory->cd(
"ImpactParameterModel");
150 gDirectory->mkdir(fModeName);
151 gDirectory->cd(fModeName);
154 TString tname =
"PerEvent";
156 gDirectory->mkdir(tname);
157 gDirectory->cd(tname);
158 int CurrentIndex = 0;
160 Indexb = CurrentIndex;
161 histo1D[CurrentIndex] =
162 new TH1F(
"Impact parameter",
"Event-by-event b", 30, 0., 15.);
163 histo1D[CurrentIndex]->SetXTitle(
"b (fm)");
164 histo1D[CurrentIndex]->SetYTitle(
"Entries");
167 IndexbMC = CurrentIndex;
168 histo1D[CurrentIndex] =
169 new TH1F(
"Impact parameter MC",
"Event-by-event b MC", 30, 0., 15.);
170 histo1D[CurrentIndex]->SetXTitle(
"b (fm)");
171 histo1D[CurrentIndex]->SetYTitle(
"Entries");
175 IndexNwp = CurrentIndex;
176 histo1D[CurrentIndex] =
new TH1F(
"Total electric charge",
177 "Event-by-event electric charge",
181 histo1D[CurrentIndex]->SetXTitle(
"Q");
182 histo1D[CurrentIndex]->SetYTitle(
"Entries");
185 IndexNpe = CurrentIndex;
186 histo1D[CurrentIndex] =
new TH1F(
187 "Electric charge",
"Event-by-event electric charge", 1000, 0.5, 1000.5);
188 histo1D[CurrentIndex]->SetXTitle(
"Event");
189 histo1D[CurrentIndex]->SetYTitle(
"Np");
192 Indexbpe = CurrentIndex;
193 histo1D[CurrentIndex] =
new TH1F(
"Event-by-event impact parameter reco",
194 "Event-by-event impact parameter reco",
198 histo1D[CurrentIndex]->SetXTitle(
"Event");
199 histo1D[CurrentIndex]->SetYTitle(
"b (fm)");
202 IndexbpeMC = CurrentIndex;
203 histo1D[CurrentIndex] =
new TH1F(
"Event-by-event impact parameter MC",
204 "Event-by-event impact parameter MC",
208 histo1D[CurrentIndex]->SetXTitle(
"Event");
209 histo1D[CurrentIndex]->SetYTitle(
"b (fm)");
212 Indexbdiff = CurrentIndex;
213 histo1D[CurrentIndex] =
214 new TH1F(
"Impact parameter diff",
"Event-by-event b diff", 150, -10., 10.);
215 histo1D[CurrentIndex]->SetXTitle(
"b-b_{MC} (fm)");
216 histo1D[CurrentIndex]->SetYTitle(
"Entries");
219 Indexbres = CurrentIndex;
220 histo1D[CurrentIndex] =
221 new TH1F(
"Impact parameter res",
"Event-by-event b res", 30, -1., 1.);
222 histo1D[CurrentIndex]->SetXTitle(
"b_{res}");
223 histo1D[CurrentIndex]->SetYTitle(
"Entries");
226 Indexbpull = CurrentIndex;
227 histo1D[CurrentIndex] =
228 new TH1F(
"Impact parameter pull",
"Event-by-event b pull", 75, -5., 5.);
229 histo1D[CurrentIndex]->SetXTitle(
"b_{pull}");
230 histo1D[CurrentIndex]->SetYTitle(
"Entries");
232 gDirectory->cd(
"..");
233 gDirectory->cd(
"..");
234 gDirectory->cd(
"..");
236 gDirectory = currentDir;
241 ycm = 0.5 *
log((1. + betacm) / (1. - betacm));
246 std::cout <<
"ekin = " << ekin <<
"\n";
247 std::cout <<
"ycm = " << ycm <<
"\n";
251 TString work = getenv(
"VMCWORKDIR");
252 TString dir = work +
"/KF/KFModelParameters/ImpactParameterModel/";
264 flistMCTracks =
dynamic_cast<TClonesArray*
>(fManger->GetObject(
"MCTrack"));
266 dynamic_cast<FairMCEventHeader*
>(fManger->GetObject(
"MCEventHeader."));
283 std::cout << charge <<
" " <<
model->
getB(charge) <<
"\n";
328 if (RecoLevel == -1) {
329 vector<CbmMCTrack> vRTracksMC;
331 std::cout <<
"MC tracks: " << nTracksMC <<
"\n";
332 vRTracksMC.resize(nTracksMC);
333 for (
int iTr = 0; iTr < nTracksMC; iTr++)
337 for (
int iTr = 0; iTr < nTracksMC; iTr++) {
338 if (vRTracksMC[iTr].GetMotherId() == -1) {
339 double pt = vRTracksMC[iTr].GetPt();
341 ret += vRTracksMC[iTr].GetCharge() / 3;
347 for (
int itype = 2; itype <= 3; ++itype) {
349 const kfvector_int& pdgs = tr.PDG();
350 for (
unsigned int ind = 0; ind < pdgs.size(); ++ind) {
351 int iPDG = pdgs[ind];
352 if ((iPDG > 0 && iPDG < 10000) || (iPDG < 0 && iPDG > -10000)) {
353 ret += TDatabasePDG::Instance()->GetParticle(iPDG)->Charge() / 3;