27 #include "TClonesArray.h"
28 #include "TDirectory.h"
33 #include "TGraphErrors.h"
42 #include "TStopwatch.h"
53 #include "CbmTofHit.h"
55 #include "TDatabasePDG.h"
62 #include "KFPTrackVector.h"
63 #include "KFParticleTopoReconstructor.h"
84 KFParticleTopoReconstructor* tr,
96 , fRecoLevel(recoLevel)
98 , fEventStats(EventStats)
119 , histo1DIntervals(0)
126 , fMass(TDatabasePDG::Instance()->GetParticle(fPDGID)->Mass())
130 , paramGlobalInterval()
131 , param2GlobalInterval()
133 , paramLocalInterval()
136 , totalGlobalInterval()
137 , totalLocalInterval()
158 TDirectory* currentDir = gDirectory;
160 gDirectory->cd(
"Models");
162 histodir = gDirectory;
165 sprintf(ccc,
"InverseSlope %s", name.Data());
166 gDirectory->mkdir(ccc);
168 gDirectory->mkdir(fModeName);
169 gDirectory->cd(fModeName);
170 TString tname =
"PerEvent";
171 if (fEventStats != 1)
173 TString(
"Each ") + TString::Itoa(fEventStats, 10) + TString(
" events");
174 gDirectory->mkdir(tname);
175 gDirectory->cd(tname);
176 int CurrentIndex = 0;
178 IndexT = CurrentIndex;
179 histo1D[CurrentIndex] =
new TH1F(
"T",
"Event-by-event T", 100, 0., 0.4);
180 histo1D[CurrentIndex]->SetXTitle(
"T (GeV)");
181 histo1D[CurrentIndex]->SetYTitle(
"Entries");
184 IndexMt = CurrentIndex;
185 histo1D[CurrentIndex] =
new TH1F(
"f(m_{T})",
"mt distribution", 200, 0., 2.5);
186 histo1D[CurrentIndex]->SetXTitle(
"m_{T} - m_{0} (GeV)");
187 histo1D[CurrentIndex]->SetYTitle(
"Entries");
190 IndexModelMt = CurrentIndex;
191 histo1D[CurrentIndex] =
192 new TH1F(
"Model f(m_{T})",
"Model mt distribution", 200, 0., 2.5);
193 histo1D[CurrentIndex]->SetXTitle(
"m_{T} - m_{0} (GeV)");
194 histo1D[CurrentIndex]->SetYTitle(
"Entries");
197 IndexMt2 = CurrentIndex;
198 histo1D[CurrentIndex] =
199 new TH1F(
"f2(m_{T})",
"mt2 distribution", 40, 0., 2.5);
200 histo1D[CurrentIndex]->SetXTitle(
"m_{T} - m_{0} (GeV)");
201 histo1D[CurrentIndex]->SetYTitle(
202 "#frac{1}{N} #frac{dN}{m_{T} dm_{T}} [(GeV)^{-2}]");
205 IndexModelMt2 = CurrentIndex;
206 histo1D[CurrentIndex] =
207 new TH1F(
"Model f2(m_{T})",
"Model mt2 distribution", 200, 0., 2.5);
208 histo1D[CurrentIndex]->SetXTitle(
"m_{T} - m_{0} (GeV)");
209 histo1D[CurrentIndex]->SetYTitle(
210 "#frac{1}{N} #frac{dN}{m_{T} dm_{T}} [(GeV)^{-2}]");
213 IndexModelMt4Pi = CurrentIndex;
214 histo1D[CurrentIndex] =
215 new TH1F(
"Model f2(m_{T}) 4Pi",
"Model mt2 distribution", 200, 0., 2.5);
216 histo1D[CurrentIndex]->SetXTitle(
"m_{T} - m_{0} (GeV)");
217 histo1D[CurrentIndex]->SetYTitle(
218 "#frac{1}{N} #frac{dN}{m_{T} dm_{T}} [(GeV)^{-2}]");
221 histodndy =
new TH1F(
"dN/dy",
"Rapidity distribution", 40, -3., 3.);
222 histodndy->SetXTitle(
"y");
223 histodndy->SetYTitle(
"dN/dy");
226 new TH1F(
"dN/dy model",
"Rapidity distribution from model", 40, -3., 3.);
227 histodndymodel->SetXTitle(
"y");
228 histodndymodel->SetYTitle(
"dN/dy");
230 grdndyReco =
new TGraphErrors();
231 grdndyReco->SetTitle(
"Rapidity distribution");
232 grdndyReco->GetXaxis()->SetTitle(
"y");
233 grdndyReco->GetYaxis()->SetTitle(
"dN/dy");
234 grdndyReco->SetName(TString(
"dNdy-") + fModeName);
235 gDirectory->Add(grdndyReco);
238 if (fYminv.size() > 0) {
239 histo1DIntervals =
new TH1F**[fYminv.size()];
240 for (
unsigned int ind = 0; ind < fYminv.size(); ++ind) {
241 histo1DIntervals[ind] =
new TH1F*[nHisto1D];
242 char cc[200], cc2[200];
245 sprintf(cc,
"Event-by-event T, %.2lf<y<%.2lf", fYminv[ind], fYmaxv[ind]);
246 sprintf(cc2,
"T, %.2lf<y<%.2lf", fYminv[ind], fYmaxv[ind]);
247 histo1DIntervals[ind][CurrentIndex] =
new TH1F(cc2, cc, 100, 0., 1.);
248 histo1DIntervals[ind][CurrentIndex]->SetXTitle(
"T (GeV)");
249 histo1DIntervals[ind][CurrentIndex]->SetYTitle(
"Entries");
252 sprintf(cc,
"mt distribution, %.2lf<y<%.2lf", fYminv[ind], fYmaxv[ind]);
253 sprintf(cc2,
"f(m_{T}, %.2lf<y<%.2lf", fYminv[ind], fYmaxv[ind]);
254 histo1DIntervals[ind][CurrentIndex] =
new TH1F(cc2, cc, 200, 0., 2.5);
255 histo1DIntervals[ind][CurrentIndex]->SetXTitle(
"m_{T} - m_{0} (GeV)");
256 histo1DIntervals[ind][CurrentIndex]->SetYTitle(
"Entries");
260 cc,
"Model mt distribution, %.2lf<y<%.2lf", fYminv[ind], fYmaxv[ind]);
261 sprintf(cc2,
"Model f(m_{T}), %.2lf<y<%.2lf", fYminv[ind], fYmaxv[ind]);
262 histo1DIntervals[ind][CurrentIndex] =
new TH1F(cc2, cc, 200, 0., 2.5);
263 histo1DIntervals[ind][CurrentIndex]->SetXTitle(
"m_{T} - m_{0} (GeV)");
264 histo1DIntervals[ind][CurrentIndex]->SetYTitle(
"Entries");
267 sprintf(cc,
"mt2 distribution, %.2lf<y<%.2lf", fYminv[ind], fYmaxv[ind]);
268 sprintf(cc2,
"f2(m_{T}, %.2lf<y<%.2lf", fYminv[ind], fYmaxv[ind]);
269 histo1DIntervals[ind][CurrentIndex] =
new TH1F(cc2, cc, 40, 0., 2.5);
270 histo1DIntervals[ind][CurrentIndex]->SetXTitle(
"m_{T} - m_{0} (GeV)");
271 histo1DIntervals[ind][CurrentIndex]->SetYTitle(
272 "#frac{1}{N} #frac{dN}{m_{T} dm_{T}} [(GeV)^{-2}]");
276 cc,
"Model mt2 distribution, %.2lf<y<%.2lf", fYminv[ind], fYmaxv[ind]);
277 sprintf(cc2,
"Model f2(m_{T}), %.2lf<y<%.2lf", fYminv[ind], fYmaxv[ind]);
278 histo1DIntervals[ind][CurrentIndex] =
new TH1F(cc2, cc, 200, 0., 2.5);
279 histo1DIntervals[ind][CurrentIndex]->SetXTitle(
"m_{T} - m_{0} (GeV)");
280 histo1DIntervals[ind][CurrentIndex]->SetYTitle(
281 "#frac{1}{N} #frac{dN}{m_{T} dm_{T}} [(GeV)^{-2}]");
285 "Model mt2 distribution 4Pi, %.2lf<y<%.2lf",
289 cc2,
"Model f2(m_{T}) 4Pi, %.2lf<y<%.2lf", fYminv[ind], fYmaxv[ind]);
290 histo1DIntervals[ind][CurrentIndex] =
new TH1F(cc2, cc, 200, 0., 2.5);
291 histo1DIntervals[ind][CurrentIndex]->SetXTitle(
"m_{T} - m_{0} (GeV)");
292 histo1DIntervals[ind][CurrentIndex]->SetYTitle(
293 "#frac{1}{N} #frac{dN}{m_{T} dm_{T}} [(GeV)^{-2}]");
299 gDirectory->cd(
"..");
300 gDirectory->cd(
"..");
301 gDirectory->cd(
"..");
303 gDirectory = currentDir;
308 ycm = 0.5 *
log((1. + betacm) / (1. - betacm));
313 std::cout <<
"ekin = " << ekin <<
"\n";
314 std::cout <<
"ycm = " << ycm <<
"\n";
324 paramGlobal = paramLocal = 0.;
325 totalGlobal = totalLocal = 0;
326 paramGlobalInterval.resize(0);
327 param2GlobalInterval.resize(0);
328 paramLocalInterval.resize(0);
329 totalGlobalInterval.resize(0);
330 totalLocalInterval.resize(0);
334 if (fRecoLevel == -1 || fRecoLevel > 10)
335 model =
new InverseSlope(fMass, fPDGID,
false, -ycm, ycm, ycm, 1.);
337 model =
new InverseSlope(fMass, fPDGID,
true, -ycm, ycm, ycm, 1.);
343 for (
unsigned int ind = 0; ind <
fYminv.size(); ++ind)
365 TDirectory* currentDir = gDirectory;
367 gDirectory->cd(
"Models");
372 sprintf(ccc,
"InverseSlope %s",
name.Data());
377 TString tname =
"PerEvent";
380 TString(
"Each ") + TString::Itoa(
fEventStats, 10) + TString(
" events");
382 gDirectory->cd(tname);
383 int CurrentIndex = 0;
387 for (
unsigned int ind = 0; ind <
fYminv.size(); ++ind) {
389 sprintf(cc3,
"%.2lf<y<%.2lf",
fYminv[ind],
fYmaxv[ind]);
390 gDirectory->mkdir(cc3);
394 char cc[200], cc2[200];
397 sprintf(cc,
"Event-by-event T, %.2lf<y<%.2lf",
fYminv[ind],
fYmaxv[ind]);
398 sprintf(cc2,
"T, %.2lf<y<%.2lf",
fYminv[ind],
fYmaxv[ind]);
404 sprintf(cc,
"mt distribution, %.2lf<y<%.2lf",
fYminv[ind],
fYmaxv[ind]);
405 sprintf(cc2,
"f(m_{T}, %.2lf<y<%.2lf",
fYminv[ind],
fYmaxv[ind]);
412 cc,
"Model mt distribution, %.2lf<y<%.2lf",
fYminv[ind],
fYmaxv[ind]);
413 sprintf(cc2,
"Model f(m_{T}), %.2lf<y<%.2lf",
fYminv[ind],
fYmaxv[ind]);
419 sprintf(cc,
"mt2 distribution, %.2lf<y<%.2lf",
fYminv[ind],
fYmaxv[ind]);
420 sprintf(cc2,
"f2(m_{T}, %.2lf<y<%.2lf",
fYminv[ind],
fYmaxv[ind]);
424 "#frac{1}{N} #frac{dN}{m_{T} dm_{T}} [(GeV)^{-2}]");
428 cc,
"Model mt2 distribution, %.2lf<y<%.2lf",
fYminv[ind],
fYmaxv[ind]);
429 sprintf(cc2,
"Model f2(m_{T}), %.2lf<y<%.2lf",
fYminv[ind],
fYmaxv[ind]);
433 "#frac{1}{N} #frac{dN}{m_{T} dm_{T}} [(GeV)^{-2}]");
437 "Model mt2 distribution 4Pi, %.2lf<y<%.2lf",
441 cc2,
"Model f2(m_{T}) 4Pi, %.2lf<y<%.2lf",
fYminv[ind],
fYmaxv[ind]);
445 "#frac{1}{N} #frac{dN}{m_{T} dm_{T}} [(GeV)^{-2}]");
448 gDirectory->cd(
"..");
450 grTy =
new TGraphErrors();
451 grTy->SetTitle(
"T(y)");
452 grTy->GetXaxis()->SetTitle(
"y");
453 grTy->GetYaxis()->SetTitle(
"T(y) (MeV)");
455 gDirectory->Add(
grTy);
459 gDirectory->cd(
"..");
460 gDirectory->cd(
"..");
461 gDirectory->cd(
"..");
463 gDirectory = currentDir;
467 flistMCTracks =
dynamic_cast<TClonesArray*
>(fManger->GetObject(
"MCTrack"));
496 for (
unsigned int i = 0;
i <
fYminv.size(); ++
i) {
546 std::vector<double> ys(0), dndys(0), dndyerrs(0);
548 for (
unsigned int ind = 0; ind <
fYminv.size(); ++ind) {
613 std::cout <<
fYminv[ind] <<
"<y<" <<
fYmaxv[ind] <<
"\tT = " << T
616 <<
"\t<m_T>_2 = " << avmt <<
"\n";
622 * TMath::Sqrt((s2 - s1 * s1 / Numb) / (Numb - 1.) / Numb);
624 if (T != T || errT != errT || errT > T / 3.)
continue;
627 grindex, 0. * 0.5 * (
fYmaxv[ind] -
fYminv[ind]), errT * 1.e3);
632 double errA =
modelsY[ind]->GetAerror(
637 std::cout <<
"A = " << A <<
" error = " << errA <<
"\n";
651 grTy->GetXaxis()->SetLimits(-3., 3.);
652 grTy->GetYaxis()->SetLimits(0., 300.);
655 grTy->GetXaxis()->SetTitle(
"y");
656 grTy->GetYaxis()->SetTitle(
"T (MeV)");
677 std::cout <<
"<" <<
name <<
"> = " << params.
A.
value <<
" "
678 <<
"Error = " << params.
A.
error <<
"\n";
683 if (RecoLevel == -1) {
684 vector<CbmMCTrack> vRTracksMC;
686 std::cout <<
"MC tracks: " << nTracksMC <<
"\n";
687 vRTracksMC.resize(nTracksMC);
688 for (
int iTr = 0; iTr < nTracksMC; iTr++)
692 for (
int iTr = 0; iTr < nTracksMC; iTr++) {
693 if (vRTracksMC[iTr].GetPdgCode() ==
fPDGID
694 && vRTracksMC[iTr].GetMotherId() == -1) {
696 double pt = vRTracksMC[iTr].GetPt();
697 double ty = vRTracksMC[iTr].GetRapidity() -
ycm;
698 double mt = TMath::Sqrt(
699 vRTracksMC[iTr].GetMass() * vRTracksMC[iTr].GetMass() + pt * pt);
709 for (
unsigned int ind = 0; ind <
fYminv.size(); ++ind) {
725 for (
int itype = 2; itype <= 3; ++itype) {
727 const kfvector_int& pdgs = tr.PDG();
728 for (
unsigned int ind = 0; ind < pdgs.size(); ++ind) {
729 int iPDG = pdgs[ind];
733 double pt = tr.Pt(ind);
734 double p = tr.P(ind);
735 double m = TDatabasePDG::Instance()->GetParticle(iPDG)->Mass();
736 double p0 = TMath::Sqrt(
m *
m + p * p);
737 double pz = TMath::Sqrt(p * p - pt * pt);
738 double ty = 0.5 *
log((p0 + pz) / (p0 - pz)) -
ycm;
739 pz = TMath::Sqrt(
m *
m + pt * pt) * TMath::SinH(ty);
740 double mt = TMath::Sqrt(
m *
m + pt * pt);
750 for (
unsigned int ind2 = 0; ind2 <
fYminv.size(); ++ind2) {