CbmRoot
CbmHRGModel.cxx
Go to the documentation of this file.
1 /*
2  *====================================================================
3  *
4  * CBM Hadron Resonance Gas
5  *
6  * Authors: V.Vovchenko
7  *
8  * e-mail : new
9  *
10  *====================================================================
11  *
12  * Statistical hadron-resonance gas model calculations
13  *
14  *====================================================================
15  */
16 
17 #include "CbmHRGModel.h"
18 #include "CbmL1Def.h"
19 
20 
21 //#include "KFParticleFinder.h"
22 //#include "KFParticleSIMD.h"
23 #include "CbmKFTrack.h"
24 #include "CbmKFVertex.h"
25 #include "CbmStsTrack.h"
26 
27 #include "TClonesArray.h"
28 #include "TDirectory.h"
29 #include "TFile.h"
30 #include "TMath.h"
31 
32 #include "TCanvas.h"
33 #include "TGraphErrors.h"
34 #include "TH1F.h"
35 #include "TH2F.h"
36 #include "TSpline.h"
37 
38 #include "L1Field.h"
39 
40 #include "CbmVertex.h"
41 
42 #include "TStopwatch.h"
43 #include <cmath>
44 #include <cstdio>
45 #include <iostream>
46 #include <map>
47 
48 //#include "CbmTrackMatch.h"
49 #include "CbmMCTrack.h"
50 #include "CbmTrackMatchNew.h"
51 //for particle ID from global track
52 #include "CbmGlobalTrack.h"
53 #include "CbmRichRing.h"
54 #include "CbmTofHit.h"
55 #include "CbmTrdTrack.h"
56 #include "TDatabasePDG.h"
57 //for RICH identification
58 #include "TSystem.h"
59 // #include "CbmRichElectronIdAnn.h"
60 
61 #include "CbmL1PFFitter.h"
62 
63 #include "KFPTrackVector.h"
64 #include "KFParticleTopoReconstructor.h"
65 
66 #include "ThermalModel.h"
67 #include "ThermalModelEVMF.h"
68 
69 
70 using std::ios;
71 using std::vector;
72 
73 namespace HRGModelNamespace {
74 
75 #include "NumericalIntegration.h"
76 
77  const Double_t kProtonMass = 0.938271998;
78  // const Double_t GeVtoifm = 5.06423;
79 
80  Double_t AcceptanceFunction::getAcceptance(const Double_t& y,
81  const Double_t& pt) const {
82  double ret = sfunc.Eval(y, pt);
83  if (ret < 0.) ret = 0.;
84  if (ret > 1.) ret = 1.;
85  return ret;
86  }
87 } // namespace HRGModelNamespace
88 
89 
90 using namespace HRGModelNamespace;
91 using namespace std;
92 
94 
95  CbmHRGModel::CbmHRGModel(Int_t recoLevel,
96  Int_t /*iVerbose*/,
97  TString Mode,
98  Int_t EventStats,
99  KFParticleTopoReconstructor* tr,
100  Bool_t useWidth,
101  Bool_t useStatistics,
102  Double_t rad)
103  : CbmModelBase(tr)
104  , ekin(25.)
105  , ycm(1.)
106  , fUpdate(true)
107  , fusePID(true)
108  , //fusePID(usePID),
109  fRecoLevel(recoLevel)
110  , fTrackNumber(1)
111  , //fTrackNumber(trackNumber),
112  fEventStats(EventStats)
113  , events(0)
114  ,
115  //flistStsTracks(0),
116  //flistStsTracksMatch(0),
117  //fPrimVtx(0),
118  fUseWidth(useWidth)
119  , fUseStatistics(useStatistics)
120  , fRadius(rad)
121  , fModeName(Mode)
122  ,
123  //flsitGlobalTracks(0),
124  //flistTofHits(0),
125  outfileName("")
126  , histodir(0)
127  , flistMCTracks(0)
128  , IndexTemperature(0)
129  , IndexErrorTemperature(0)
130  , IndexMuB(0)
131  , IndexErrorMuB(0)
132  , IndexMuS(0)
133  , IndexErrorMuS(0)
134  , IndexMuQ(0)
135  , IndexErrorMuQ(0)
136  , IndexnB(0)
137  , IndexEnergy(0)
138  , IndexEntropy(0)
139  , IndexPressure(0)
140  , IndexEoverN(0)
141  , IndexEtaoverS(0)
142  , IndexChi2Fit(0)
143  , IndexTmuB(0)
144  , IndexTnB(0)
145  , IndexTE(0)
146  , grTmuB(NULL)
147  , pullT(NULL)
148  , pullmuB(NULL)
149  , Ts()
150  , muB()
151  , errT()
152  , errmuB()
153  , PDGtoIndex()
154  , ParticlePDGsTrack()
155  , ParticleNames()
156  , RatiosToFit()
157  , SystErrors()
158  , MultGlobal()
159  , MultLocal()
160  , AcceptanceSTS()
161  , AcceptanceSTSTOF()
162  , TPS()
163  , model(NULL)
164 
165 // flistRichRings(0),
166 // flistTrdTracks(0),
167 
168 {
169  // fModeName = Mode;
170  // fEventStats = EventStats;
171 
172  // events = 0;
173  Ts.resize(0);
174  muB.resize(0);
175  errT.resize(0);
176  errmuB.resize(0);
177 
178  PDGtoIndex.clear();
179 
180  TDirectory* currentDir = gDirectory;
181 
182  gDirectory->cd("Models");
183 
184  histodir = gDirectory;
185 
186  gDirectory->mkdir("HadronResonanceGasModel");
187  gDirectory->cd("HadronResonanceGasModel");
188  gDirectory->mkdir(fModeName);
189  gDirectory->cd(fModeName);
190  TString tname = "PerEvent";
191  if (fEventStats != 1)
192  tname =
193  TString("Each ") + TString::Itoa(fEventStats, 10) + TString(" events");
194  gDirectory->mkdir(tname);
195  gDirectory->cd(tname);
196  int CurrentIndex = 0;
197 
198  IndexTemperature = CurrentIndex;
199  histo1D[CurrentIndex] =
200  new TH1F("Temperature", "Event-by-event temperature", 300, 0., 0.2 * 1000.);
201  histo1D[CurrentIndex]->SetXTitle("T (MeV)");
202  histo1D[CurrentIndex]->SetYTitle("Entries");
203  CurrentIndex++;
204 
205  IndexErrorTemperature = CurrentIndex;
206  histo1D[CurrentIndex] = new TH1F("Temperature error",
207  "Event-by-event temperature error",
208  100,
209  0.,
210  0.1 * 1000.);
211  histo1D[CurrentIndex]->SetXTitle("Delta T (MeV)");
212  histo1D[CurrentIndex]->SetYTitle("Entries");
213  CurrentIndex++;
214 
215  IndexMuB = CurrentIndex;
216  histo1D[CurrentIndex] = new TH1F("Baryon chemical potential",
217  "Event-by-event baryon chemical potential",
218  300,
219  0.,
220  0.8 * 1000.);
221  histo1D[CurrentIndex]->SetXTitle("#mu_{B} (MeV)");
222  histo1D[CurrentIndex]->SetYTitle("Entries");
223  CurrentIndex++;
224 
225  IndexErrorMuB = CurrentIndex;
226  histo1D[CurrentIndex] =
227  new TH1F("Baryon chemical potential error",
228  "Event-by-event baryon chemical potential error",
229  100,
230  0.,
231  0.1 * 1000.);
232  histo1D[CurrentIndex]->SetXTitle("Delta #mu_{B} (MeV)");
233  histo1D[CurrentIndex]->SetYTitle("Entries");
234  CurrentIndex++;
235 
236  IndexMuS = CurrentIndex;
237  histo1D[CurrentIndex] =
238  new TH1F("Strangeness chemical potential",
239  "Event-by-event strangeness chemical potential",
240  300,
241  -0.2 * 1000.,
242  0.2 * 1000.);
243  histo1D[CurrentIndex]->SetXTitle("#mu_{S} (MeV)");
244  histo1D[CurrentIndex]->SetYTitle("Entries");
245  CurrentIndex++;
246 
247  IndexErrorMuS = CurrentIndex;
248  histo1D[CurrentIndex] =
249  new TH1F("Strangeness chemical potential error",
250  "Event-by-event baryon strangeness potential error",
251  100,
252  0.,
253  0.2 * 1000.);
254  histo1D[CurrentIndex]->SetXTitle("Delta #mu_{S} (MeV)");
255  histo1D[CurrentIndex]->SetYTitle("Entries");
256  CurrentIndex++;
257 
258  IndexMuQ = CurrentIndex;
259  histo1D[CurrentIndex] = new TH1F("Charge chemical potential",
260  "Event-by-event baryon chemical potential",
261  300,
262  -0.2 * 1000.,
263  0.2 * 1000.);
264  histo1D[CurrentIndex]->SetXTitle("#mu_{Q} (MeV)");
265  histo1D[CurrentIndex]->SetYTitle("Entries");
266  CurrentIndex++;
267 
268  IndexErrorMuQ = CurrentIndex;
269  histo1D[CurrentIndex] =
270  new TH1F("Charge chemical potential error",
271  "Event-by-event charge chemical potential error",
272  100,
273  0.,
274  0.1 * 1000.);
275  histo1D[CurrentIndex]->SetXTitle("Delta muQ (MeV)");
276  histo1D[CurrentIndex]->SetYTitle("Entries");
277  CurrentIndex++;
278 
279  IndexnB = CurrentIndex;
280  histo1D[CurrentIndex] = new TH1F(
281  "Net baryon density", "Event-by-event net baryon density", 100, 0., 0.2);
282  histo1D[CurrentIndex]->SetXTitle("n_{B} (fm^{-3})");
283  histo1D[CurrentIndex]->SetYTitle("Entries");
284  CurrentIndex++;
285 
286  IndexEnergy = CurrentIndex;
287  histo1D[CurrentIndex] = new TH1F(
288  "Energy density", "Event-by-event energy density", 100, 0., 1. * 1000.);
289  histo1D[CurrentIndex]->SetXTitle("#varepsilon (MeV/fm^{3})");
290  histo1D[CurrentIndex]->SetYTitle("Entries");
291  CurrentIndex++;
292 
293  IndexEntropy = CurrentIndex;
294  histo1D[CurrentIndex] =
295  new TH1F("Entropy density", "Event-by-event entropy density", 100, 0., 10.);
296  histo1D[CurrentIndex]->SetXTitle("s (fm^{-3})");
297  histo1D[CurrentIndex]->SetYTitle("Entries");
298  CurrentIndex++;
299 
300  IndexPressure = CurrentIndex;
301  histo1D[CurrentIndex] =
302  new TH1F("Pressure", "Event-by-event pressure", 100, 0., 0.2);
303  histo1D[CurrentIndex]->SetXTitle("P (GeV/fm^{3})");
304  histo1D[CurrentIndex]->SetYTitle("Entries");
305  CurrentIndex++;
306 
307  IndexEoverN = CurrentIndex;
308  histo1D[CurrentIndex] = new TH1F(
309  "Energy per hadron", "Event-by-event energy per hadron", 100, 0., 3.);
310  histo1D[CurrentIndex]->SetXTitle("E/N (GeV)");
311  histo1D[CurrentIndex]->SetYTitle("Entries");
312  CurrentIndex++;
313 
314  IndexEtaoverS = CurrentIndex;
315  histo1D[CurrentIndex] = new TH1F("Shear viscosity to entropy density ratio",
316  "Event-by-event viscosity to entropy",
317  100,
318  0.,
319  1.);
320  histo1D[CurrentIndex]->SetXTitle("#eta/s");
321  histo1D[CurrentIndex]->SetYTitle("Entries");
322  CurrentIndex++;
323 
324  IndexChi2Fit = CurrentIndex;
325  histo1D[CurrentIndex] =
326  new TH1F("chi2/ndf", "Event-by-event chi2/ndf", 100, 0., 20.);
327  histo1D[CurrentIndex]->SetXTitle("#chi^{2}/ndf");
328  histo1D[CurrentIndex]->SetYTitle("Entries");
329  CurrentIndex++;
330 
331  CurrentIndex = 0;
332  IndexTmuB = CurrentIndex;
333  histo2D[CurrentIndex] = new TH2F("T-muB",
334  "Event-by-event T-muB",
335  100,
336  0.,
337  0.8 * 1000.,
338  100,
339  0.,
340  0.2 * 1000.);
341  histo2D[CurrentIndex]->SetXTitle("#mu_{B} (MeV)");
342  histo2D[CurrentIndex]->SetYTitle("T (MeV)");
343  CurrentIndex++;
344 
345  IndexTnB = CurrentIndex;
346  histo2D[CurrentIndex] =
347  new TH2F("T-nB", "Event-by-event T-nB", 100, 0., 0.3, 100, 0., 0.2 * 1000.);
348  histo2D[CurrentIndex]->SetXTitle("n_{B} (fm^{-3})");
349  histo2D[CurrentIndex]->SetYTitle("T (MeV)");
350  CurrentIndex++;
351 
352  IndexTE = CurrentIndex;
353  histo2D[CurrentIndex] = new TH2F(
354  "T-en", "Event-by-event T-en", 100, 0., 0.3 * 1000., 100, 0., 0.2 * 1000.);
355  histo2D[CurrentIndex]->SetXTitle("#varepsilon (MeV/fm^{3})");
356  histo2D[CurrentIndex]->SetYTitle("T (MeV)");
357  CurrentIndex++;
358 
359  pullT = new TH1F("Pull T", "Event-by-event pull T", 300, -5., 5.);
360  pullT->SetXTitle("Pull T");
361  pullT->SetYTitle("Entries");
362 
363  pullmuB = new TH1F("Pull muB", "Event-by-event pull muB", 300, -5., 5.);
364  pullmuB->SetXTitle("Pull muB");
365  pullmuB->SetYTitle("Entries");
366 
367  grTmuB = new TGraphErrors();
368  grTmuB->SetTitle("Event-by-event T-muB");
369  grTmuB->GetXaxis()->SetTitle("#mu_{B} (MeV)");
370  grTmuB->GetYaxis()->SetTitle("T (MeV)");
371  grTmuB->SetName(TString("T-muB-") + fModeName);
372  gDirectory->Add(grTmuB);
373 
374  gDirectory->cd("..");
375  gDirectory->cd("..");
376  gDirectory->cd("..");
377 
378  gDirectory = currentDir;
379 
380  double pbeam = sqrt((kProtonMass + ekin) * (kProtonMass + ekin)
382  double betacm = pbeam / (2. * kProtonMass + ekin);
383  ycm = 0.5 * log((1. + betacm) / (1. - betacm));
384 
385  events = 0;
386 
387  TString work = getenv("VMCWORKDIR");
388  TString dir = work + "/KF/KFModelParameters/HRGModel/";
389 
390  TPS = ThermalParticleSystem(std::string((dir + "Database.dat").Data()));
391 
392  model = NULL;
393 }
394 
396  if (model != NULL) delete model;
397 }
398 
400  TString filename) {
401  double ymin = 0., ymax = 6.;
402  double ptmin = 0., ptmax = 2.5;
403  func.ys.resize(0);
404  func.pts.resize(0);
405  func.probs.resize(0);
406  ifstream fin(filename.Data());
407  fin >> func.dy >> func.dpt;
408  double ty, tpt, prob; //, tmp;
409  func.ys.resize(0);
410  func.pts.resize(0);
411  func.probs.resize(0);
412  while (fin >> ty >> tpt >> prob) {
413  if (tpt < ptmin || tpt > ptmax || ty < ymin || ty > ymax) continue;
414  func.ys.push_back(ty);
415  func.pts.push_back(tpt);
416  func.probs.push_back(prob);
417  }
418  func.setSpline();
419  fin.close();
420 }
421 
422 void CbmHRGModel::ReInit(FairRootManager* fManger) {
423  flistMCTracks = dynamic_cast<TClonesArray*>(fManger->GetObject("MCTrack"));
424 }
425 
427  //ReInit();
428 }
429 
431  if (fRecoLevel == -1 && !flistMCTracks) return;
432  if (fRecoLevel != -1 && !fTopoReconstructor) return;
433 
435 
436  events++;
437 
438  if (events % fEventStats == 0) {
439 
441  /*std::vector< std::pair<int, int> > ratios(0);
442  ratios.push_back(make_pair(0, 1)); // pi-/pi+
443  ratios.push_back(make_pair(2, 3)); // K-/K+
444  ratios.push_back(make_pair(3, 1)); // K+/pi+
445  //ratios.push_back(make_pair(2, 0)); // K-/pi-
446  ratios.push_back(make_pair(4, 0)); // p/pi-
447  ratios.push_back(make_pair(5, 4)); // p+/p-
448  ratios.push_back(make_pair(7, 6)); // Labar/La*/
449  // ratios.push_back(make_pair(-211, 211)); // pi-/pi+
450  // ratios.push_back(make_pair(-321, 321)); // K-/K+
451  // ratios.push_back(make_pair(321, 211)); // K+/pi+
452  // ratios.push_back(make_pair(-321, -211)); // K-/pi-
453  // ratios.push_back(make_pair(2212, -211)); // p/pi-
454 
455  ThermalModelEVMF modell(&TPS);
456  //model.RHad = 0.;
457  modell.SetUseWidth(fUseWidth);
459  modell.Parameters.R = fRadius;
460  double tmpdens = 0., tmpenerd = 0.;
461  double tmpeta = 0., tmpsdens = 0.;
462 
464 
465  if (fabs(params.T.value - params.T.xmin) / params.T.value < 1e-2
466  || fabs(params.T.value - params.T.xmax) / params.T.value < 1e-2
467  || params.T.error * 1.e3 > 20. || params.T.value > 0.160)
468  std::cout << "Fit failed!" << endl;
469  else {
470 
471  histo1D[IndexTemperature]->Fill(params.T.value * 1.e3);
472  histo1D[IndexErrorTemperature]->Fill(params.T.error * 1.e3);
473  histo1D[IndexMuB]->Fill(params.muB.value * 1.e3);
474  histo1D[IndexErrorMuB]->Fill(params.muB.error * 1.e3);
475  histo1D[IndexMuS]->Fill(params.muS.value * 1.e3);
476  histo1D[IndexErrorMuS]->Fill(params.muS.error * 1.e3);
477  histo1D[IndexMuQ]->Fill(params.muQ.value * 1.e3);
478  histo1D[IndexErrorMuQ]->Fill(params.muQ.error * 1.e3);
479  histo1D[IndexChi2Fit]->Fill(params.chi2ndf);
480  histo2D[IndexTmuB]->Fill(params.muB.value * 1.e3, params.T.value * 1.e3);
481  Ts.push_back(params.T.value * 1.e3);
482  muB.push_back(params.muB.value * 1.e3);
483  errT.push_back(params.T.error * 1.e3);
484  errmuB.push_back(params.muB.error * 1.e3);
485 
486  /*hTempFullMC->Fill(params.T.value*1.e3);
487  hTempErrFullMC->Fill(params.T.error*1.e3);
488  hMuBFullMC->Fill(params.muB.value*1.e3);
489  hMuBErrFullMC->Fill(params.muB.error*1.e3);
490  hMuSFullMC->Fill(params.muS.value*1.e3);
491  hMuSErrFullMC->Fill(params.muS.error*1.e3);
492  hMuQFullMC->Fill(params.muQ.value*1.e3);
493  hMuQErrFullMC->Fill(params.muQ.error*1.e3);
494  hChi2NDFMC->Fill(params.chi2ndf);
495  hTMuFullMC->Fill(params.muB.value*1.e3, params.T.value*1.e3);*/
496 
497  modell.SetParameters(params.GetThermalModelParameters()); //, 0.5);
498  tmpdens = modell.CalculateBaryonDensity();
499  tmpenerd = modell.CalculateEnergyDensity();
500  tmpeta = modell.CalculateShearViscosity();
501  tmpsdens = modell.CalculateEntropyDensity();
502  histo1D[IndexnB]->Fill(tmpdens);
503  histo1D[IndexEnergy]->Fill(tmpenerd * 1.e3);
505  histo1D[IndexPressure]->Fill(modell.CalculatePressure());
506  histo1D[IndexEoverN]->Fill(tmpenerd / modell.CalculateHadronDensity());
507  histo2D[IndexTnB]->Fill(tmpdens, params.T.value * 1.e3);
508  histo2D[IndexTE]->Fill(tmpenerd * 1.e3, params.T.value * 1.e3);
509  histo1D[IndexEtaoverS]->Fill(tmpeta / tmpsdens);
510  /*hnBFullMC->Fill(tmpdens);
511  hendFullMC->Fill(tmpenerd*1.e3);
512  hsdFullMC->Fill(model.CalculateEntropyDensity());
513  hpFullMC->Fill(model.CalculatePressure());
514  hENFullMC->Fill(tmpenerd / model.CalculateHadronDensity());
515  hTnBFullMC->Fill(tmpdens, params.T.value*1.e3);
516  hTenFullMC->Fill(tmpenerd*1.e3, params.T.value*1.e3);
517  hetasFullMC->Fill(tmpeta / tmpsdens);*/
518 
519  pullT->Fill((params.T.value - 0.100) / params.T.error);
520  pullmuB->Fill((params.muB.value - 0.550) / params.muB.error);
521 
522 
523  std::cout << "nB = " << tmpdens << endl;
524  std::cout << "eta/s = "
525  << modell.CalculateShearViscosity()
526  / modell.CalculateEntropyDensity()
527  << endl;
528  }
529 
530  events = 0;
531  for (unsigned int i = 0; i < MultLocal.size(); ++i) {
532  MultLocal[i] = 0;
533  }
534  }
535 
536  //delete[] MCTrackSortedArray;
537  //delete[] TrRecons;
538 }
539 
541 CbmHRGModel::GetThermalParameters(const std::vector<int>& Mults) {
542  //ThermalModelFit TFit(&TPS);
543  ThermalModelBase* modelnew;
544  if (fabs(fRadius < 1e-6))
545  modelnew = new ThermalModel(&TPS);
546  else
547  modelnew = new ThermalModelEVMF(&TPS);
548  if (model != NULL) delete model;
549  model = modelnew;
550  ThermalModelFit TFit(model);
551  modelnew->SetUseWidth(fUseWidth);
552  modelnew->SetStatistics(fUseStatistics);
553  modelnew->Parameters.R = fRadius;
554  double Z = 79., B = 197., QBmod = Z / B;
555  TFit.SetQBConstraint(QBmod);
556  for (unsigned int i = 0; i < RatiosToFit.size(); ++i) {
557  double n1 = Mults[PDGtoIndex[RatiosToFit[i].first]];
558  double n2 = Mults[PDGtoIndex[RatiosToFit[i].second]];
559  double err1 = sqrt(n1);
560  double err2 = sqrt(n2);
561  double terr =
562  sqrt(err1 * err1 / n2 / n2 + n1 * n1 / n2 / n2 / n2 / n2 * err2 * err2);
563  double rat = n1 / n2;
564  //terr = sqrt(terr*terr + 0.05*rat*0.05*rat);
565  terr = sqrt(terr * terr + SystErrors[i] * SystErrors[i] * rat * rat);
566  std::cout << "Ratio " << ParticleNames[PDGtoIndex[RatiosToFit[i].first]]
567  << "/" << ParticleNames[PDGtoIndex[RatiosToFit[i].second]] << ": "
568  << n1 / n2 << " " << terr << " " << n1 << " " << n2 << "\n";
569 
570 
571  //if (n1/n2>2.*terr)
572  if (n1 != 0 && n2 != 0)
573  TFit.AddRatio(
576  n1 / n2,
577  terr));
578  else {
579  std::cout << "Bad ratio "
580  << ParticleNames[PDGtoIndex[RatiosToFit[i].first]] << "/"
581  << ParticleNames[PDGtoIndex[RatiosToFit[i].second]] << ": "
582  << n1 / n2 << " " << terr << " " << n1 << " " << n2 << "\n";
583  std::cout << "Aborting fit\n";
585  params.T.error = 100.;
586  return params;
587  }
588  //std::cout << pdgIds[ratios[i].first] << " " << pdgIds[ratios[i].second] << " " << n1/n2 << " " << terr << endl;
589  }
590  return TFit.PerformFit();
591 }
592 
593 Double_t CbmHRGModel::RecEfficiency(Double_t p) {
594  if (fTrackNumber == 0)
595  return 0.99 - 0.98 * exp(-p * p / 2. / 0.135 / 0.135);
596  else
597  return 0.98 - 0.88 * exp(-p * p / 2. / 0.2 / 0.2);
598 }
599 
601  //bool ret = 0;
602  int stsHits = inTrack->GetNStsPoints();
603  int tofHits = inTrack->GetNTofPoints();
604  if (fusePID == 2 && tofHits == 0) return 0;
605  vector<int> hitz(0);
606  for (int hit = 0; hit < stsHits; ++hit) {
607  hitz.push_back(
608  static_cast<int>((inTrack->GetStsPoint(hit)->GetZ() + 5.) / 10.));
609  }
610  sort(hitz.begin(), hitz.end());
611  for (int hit1 = 0; hit1 < stsHits - 3; ++hit1) {
612  int station1 = hitz[hit1];
613  int hitsConsecutive = 1;
614  for (int hit2 = hit1 + 1; hit2 < stsHits && hitsConsecutive < 4; ++hit2) {
615  int station2 = hitz[hit2];
616  if (station2 == station1) continue;
617  if (station2 - station1 > 1) break;
618  if (station2 - station1 == 1) {
619  hitsConsecutive++;
620  station1 = station2;
621  }
622  }
623  if (hitsConsecutive == 4) return 1;
624  }
625  return 0;
626 }
627 
631 
632  for (unsigned int i = 0; i < Ts.size(); ++i) {
633  grTmuB->SetPoint(i, muB[i], Ts[i]);
634  grTmuB->SetPointError(i, errmuB[i], errT[i]);
635  }
636  grTmuB->GetXaxis()->SetLimits(0., 600.);
637  grTmuB->SetMinimum(0.);
638  grTmuB->SetMinimum(300.);
639  grTmuB->GetYaxis()->SetLimits(0., 200.);
640 }
641 
642 void CbmHRGModel::AddRatio(int pdgid1,
643  int pdgid2,
644  /*TString name1, TString name2,*/ double SystError) {
645  RatiosToFit.push_back(make_pair(pdgid1, pdgid2));
646  SystErrors.push_back(SystError);
647  int pIndex1 = -1, pIndex2 = -1;
648  //std::cout << pdgid1 << " " << pdgid2 << " " << name1 << " " << name2 << " " << SystError << "\n";
649  for (unsigned int i = 0; i < ParticlePDGsTrack.size(); ++i) {
650  if (ParticlePDGsTrack[i] == pdgid1) pIndex1 = i;
651  if (ParticlePDGsTrack[i] == pdgid2) pIndex2 = i;
652  }
653 
654  if (pIndex1 == -1) {
655  ParticlePDGsTrack.push_back(pdgid1);
656  ParticleNames.push_back(
657  TString(TDatabasePDG::Instance()->GetParticle(pdgid1)->GetName()));
658  MultGlobal.push_back(0);
659  MultLocal.push_back(0);
660  PDGtoIndex[pdgid1] = ParticlePDGsTrack.size() - 1;
661  }
662  /*else if (ParticleNames[pIndex1]=="") {
663  ParticleNames[pIndex1] = name1;
664  }*/
665 
666  if (pIndex2 == -1) {
667  ParticlePDGsTrack.push_back(pdgid2);
668  //ParticleNames.push_back(name2);
669  ParticleNames.push_back(
670  TString(TDatabasePDG::Instance()->GetParticle(pdgid2)->GetName()));
671  MultGlobal.push_back(0);
672  MultLocal.push_back(0);
673  PDGtoIndex[pdgid2] = ParticlePDGsTrack.size() - 1;
674  }
675 }
676 
678  int RecoLevel,
679  bool UpdateGlobal) {
680 
681  if (RecoLevel == -1) {
682  vector<CbmMCTrack> vRTracksMC;
683  int nTracksMC = flistMCTracks->GetEntries();
684  std::cout << "MC tracks: " << nTracksMC << "\n";
685  vRTracksMC.resize(nTracksMC);
686  for (int iTr = 0; iTr < nTracksMC; iTr++)
687  //vRTracksMC[iTr] = *( (CbmMCTrack*) flistMCTracks->At(iTr));
688  vRTracksMC[iTr] = *(dynamic_cast<CbmMCTrack*>(flistMCTracks->At(iTr)));
689 
690  for (int iTr = 0; iTr < nTracksMC; iTr++) {
691  //iTr = ((CbmTrackMatch*)flistStsTracksMatch->At(iTrs))->GetMCTrackId();
692  for (unsigned int part = 0; part < ParticlePDGsTrack.size(); ++part) {
693  if (vRTracksMC[iTr].GetPdgCode() == ParticlePDGsTrack[part]
694  && vRTracksMC[iTr].GetMotherId() == -1) {
695  Mult[part]++;
696  if (UpdateGlobal) MultGlobal[part]++;
697  }
698  }
699  }
700  } else {
701  //int ind = 2;
702  for (int itype = 2; itype <= 3; ++itype) {
703  const KFPTrackVector& tr = fTopoReconstructor->GetTracks()[itype];
704  const kfvector_int& pdgs = tr.PDG();
705  for (unsigned int ind = 0; ind < pdgs.size(); ++ind) {
706  int iPDG = pdgs[ind];
707  for (unsigned int part = 0; part < ParticlePDGsTrack.size(); ++part) {
708  if (iPDG == ParticlePDGsTrack[part]) {
709  Mult[part]++;
710  if (UpdateGlobal) MultGlobal[part]++;
711  }
712  }
713  }
714  }
715  }
716 }
exp
friend F32vec4 exp(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:134
CbmHRGModel::Ts
std::vector< double > Ts
Definition: CbmHRGModel.h:141
FitParameter::value
double value
Definition: ThermalModelFit.h:10
CbmHRGModel::ParticlePDGsTrack
std::vector< int > ParticlePDGsTrack
Definition: CbmHRGModel.h:144
ThermalModel
Definition: ThermalModel.h:9
ThermalModelFit::PerformFit
ThermalModelFitParameters PerformFit()
Definition: ThermalModelFit.cxx:82
CbmModelBase::fTopoReconstructor
KFParticleTopoReconstructor * fTopoReconstructor
Definition: CbmModelBase.h:42
HRGModelNamespace::AcceptanceFunction::getAcceptance
Double_t getAcceptance(const Double_t &y, const Double_t &pt) const
Definition: CbmHRGModel.cxx:80
CbmHRGModel::Exec
virtual void Exec()
Definition: CbmHRGModel.cxx:430
CbmHRGModel::ReadAcceptanceFunction
void ReadAcceptanceFunction(HRGModelNamespace::AcceptanceFunction &func, TString filename)
Definition: CbmHRGModel.cxx:399
ThermalModelFitParameters::GetThermalModelParameters
ThermalModelParameters GetThermalModelParameters()
Definition: ThermalModelFit.h:147
CbmVertex.h
FitParameter::error
double error
Definition: ThermalModelFit.h:11
CbmHRGModel::IndexEntropy
int IndexEntropy
Definition: CbmHRGModel.h:130
CbmHRGModel::fusePID
Int_t fusePID
Definition: CbmHRGModel.h:107
ThermalModelFitParameters::muQ
FitParameter muQ
Definition: ThermalModelFit.h:80
ThermalModelEVMF::CalculateShearViscosity
virtual double CalculateShearViscosity()
Definition: ThermalModelEVMF.cxx:228
CbmHRGModel::Finish
virtual void Finish()
Definition: CbmHRGModel.cxx:628
CbmHRGModel::MultGlobal
std::vector< int > MultGlobal
Definition: CbmHRGModel.h:148
CbmHRGModel::IndexTmuB
int IndexTmuB
Definition: CbmHRGModel.h:135
L1Field.h
CbmHRGModel::SystErrors
std::vector< double > SystErrors
Definition: CbmHRGModel.h:147
sqrt
friend F32vec4 sqrt(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:41
CbmHRGModel::IndexMuB
int IndexMuB
Definition: CbmHRGModel.h:128
ThermalModelFit::SetQBConstraint
void SetQBConstraint(double QB)
Definition: ThermalModelFit.h:247
CbmHRGModel::ParticleNames
std::vector< TString > ParticleNames
Definition: CbmHRGModel.h:145
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
CbmHRGModel::IndexMuQ
int IndexMuQ
Definition: CbmHRGModel.h:129
CbmHRGModel::MultLocal
std::vector< int > MultLocal
Definition: CbmHRGModel.h:148
CbmHRGModel::histo2D
TH2F * histo2D[nHisto2D]
Definition: CbmHRGModel.h:137
ThermalModelFitParameters::muB
FitParameter muB
Definition: ThermalModelFit.h:80
CbmHRGModel::fEventStats
Int_t fEventStats
Definition: CbmHRGModel.h:110
CbmHRGModel::IndexTemperature
int IndexTemperature
Definition: CbmHRGModel.h:128
CbmGlobalTrack.h
CbmHRGModel::model
ThermalModelBase * model
Definition: CbmHRGModel.h:157
HRGModelNamespace::AcceptanceFunction::ys
std::vector< Double_t > ys
Definition: CbmHRGModel.h:42
ThermalModelFitParameters::chi2ndf
double chi2ndf
Definition: ThermalModelFit.h:81
HRGModelNamespace::AcceptanceFunction::setSpline
void setSpline()
Definition: CbmHRGModel.h:44
ThermalModelFitParameters::muS
FitParameter muS
Definition: ThermalModelFit.h:80
CbmHRGModel::IndexErrorTemperature
int IndexErrorTemperature
Definition: CbmHRGModel.h:128
ThermalModelEVMF::CalculatePressure
virtual double CalculatePressure()
Definition: ThermalModelEVMF.h:267
CbmRichRing.h
CbmHRGModel::checkIfReconstructable
bool checkIfReconstructable(CbmKFTrErrMCPoints *inTrack)
Definition: CbmHRGModel.cxx:600
HRGModelNamespace::kProtonMass
const Double_t kProtonMass
Definition: CbmHRGModel.cxx:77
ThermalModelBase::SetUseWidth
void SetUseWidth(bool useWidth)
Definition: ThermalModelBase.h:85
ThermalModelBase
Definition: ThermalModelBase.h:18
ThermalModelFit
Definition: ThermalModelFit.h:216
CbmHRGModel::IndexTE
int IndexTE
Definition: CbmHRGModel.h:135
CbmL1Def.h
CbmHRGModel::fTrackNumber
Int_t fTrackNumber
Definition: CbmHRGModel.h:109
CbmStsTrack.h
Data class for STS tracks.
CbmHRGModel::PDGtoIndex
std::map< int, int > PDGtoIndex
Definition: CbmHRGModel.h:143
CbmHRGModel::IndexMuS
int IndexMuS
Definition: CbmHRGModel.h:129
CbmHRGModel::IndexErrorMuS
int IndexErrorMuS
Definition: CbmHRGModel.h:129
CbmHRGModel::IndexChi2Fit
int IndexChi2Fit
Definition: CbmHRGModel.h:130
CbmHRGModel::ReInit
virtual void ReInit(FairRootManager *fManger)
Definition: CbmHRGModel.cxx:422
BilinearSplineFunction::Eval
double Eval(double x, double y) const
Definition: CbmBilinearSplineFunction.h:55
CbmHRGModel::CbmHRGModel
CbmHRGModel(Int_t recoLevel=-1, Int_t iVerbose=1, TString Mode="MC", Int_t EventStats=1, KFParticleTopoReconstructor *tr=0, Bool_t useWidth=0, Bool_t useStatistics=0, Double_t rad=0.)
CbmKFTrErrMCPoints::GetStsPoint
CbmStsPoint * GetStsPoint(Int_t i)
Definition: CbmKFTrErrMCPoints.h:39
log
friend F32vec4 log(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:135
ThermalModelFitParameters
Definition: ThermalModelFit.h:79
CbmTrackMatchNew.h
CbmHRGModel.h
CbmHRGModel::TPS
ThermalParticleSystem TPS
Definition: CbmHRGModel.h:155
CbmKFTrErrMCPoints
Definition: CbmKFTrErrMCPoints.h:32
CbmL1PFFitter.h
HRGModelNamespace
Definition: CbmHRGModel.cxx:73
CbmHRGModel::GetThermalParameters
ThermalModelFitParameters GetThermalParameters(const std::vector< int > &Mults)
Definition: CbmHRGModel.cxx:541
CbmHRGModel::RatiosToFit
std::vector< std::pair< int, int > > RatiosToFit
Definition: CbmHRGModel.h:146
CbmHRGModel::AddRatio
void AddRatio(int pdgid1, int pdgid2, double SystError=0.)
Definition: CbmHRGModel.cxx:642
ThermalModelBase::SetStatistics
virtual void SetStatistics(bool stats)
Definition: ThermalModelBase.h:131
CbmHRGModel::pullmuB
TH1F * pullmuB
Definition: CbmHRGModel.h:140
CbmKFTrack.h
ThermalModelEVMF::CalculateBaryonDensity
virtual double CalculateBaryonDensity()
Definition: ThermalModelEVMF.h:188
CbmHRGModel::fRadius
double fRadius
Definition: CbmHRGModel.h:114
CbmHRGModel::flistMCTracks
TClonesArray * flistMCTracks
Definition: CbmHRGModel.h:122
CbmKFTrErrMCPoints::GetNStsPoints
int GetNStsPoints() const
Definition: CbmKFTrErrMCPoints.h:50
CbmModelBase
Definition: CbmModelBase.h:25
ThermalModel.h
first
bool first
Definition: LKFMinuit.cxx:143
CbmHRGModel::events
Int_t events
Definition: CbmHRGModel.h:111
HRGModelNamespace::AcceptanceFunction::dpt
Double_t dpt
Definition: CbmHRGModel.h:41
HRGModelNamespace::AcceptanceFunction::probs
std::vector< Double_t > probs
Definition: CbmHRGModel.h:42
CbmHRGModel::IndexEnergy
int IndexEnergy
Definition: CbmHRGModel.h:129
CbmHRGModel
Definition: CbmHRGModel.h:63
ThermalModelFit::AddRatio
void AddRatio(const ExperimentRatio &Ratio_)
Definition: ThermalModelFit.h:254
CbmHRGModel::RecEfficiency
Double_t RecEfficiency(Double_t p)
Definition: CbmHRGModel.cxx:593
HRGModelNamespace::AcceptanceFunction::pts
std::vector< Double_t > pts
Definition: CbmHRGModel.h:42
CbmHRGModel::IndexErrorMuQ
int IndexErrorMuQ
Definition: CbmHRGModel.h:129
CbmHRGModel::muB
std::vector< double > muB
Definition: CbmHRGModel.h:141
FitParameter::xmax
double xmax
Definition: ThermalModelFit.h:12
CbmHRGModel::~CbmHRGModel
~CbmHRGModel()
Definition: CbmHRGModel.cxx:395
CbmMCTrack.h
ExperimentRatio
Definition: ThermalModelFit.h:165
ThermalModelEVMF::CalculateEntropyDensity
virtual double CalculateEntropyDensity()
Definition: ThermalModelEVMF.h:249
ThermalParticleSystem
Definition: ThermalParticleSystem.h:7
CbmHRGModel::Init
virtual void Init()
Definition: CbmHRGModel.cxx:426
CbmMCTrack
Definition: CbmMCTrack.h:34
ClassImp
ClassImp(CbmHRGModel) CbmHRGModel
Definition: CbmHRGModel.cxx:93
ThermalModelEVMF.h
fabs
friend F32vec4 fabs(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:60
CbmKFTrErrMCPoints::GetNTofPoints
int GetNTofPoints() const
Definition: CbmKFTrErrMCPoints.h:51
CbmHRGModel::IndexPressure
int IndexPressure
Definition: CbmHRGModel.h:130
y
Double_t y
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmHRGModel::histo1D
TH1F * histo1D[nHisto1D]
Definition: CbmHRGModel.h:132
CbmHRGModel::IndexTnB
int IndexTnB
Definition: CbmHRGModel.h:135
ThermalModelParameters::R
double R
Definition: ThermalModelBase.h:7
CbmHRGModel::errT
std::vector< double > errT
Definition: CbmHRGModel.h:141
CbmHRGModel::fUseWidth
Bool_t fUseWidth
Definition: CbmHRGModel.h:113
NumericalIntegration.h
ThermalModelEVMF::CalculateEnergyDensity
virtual double CalculateEnergyDensity()
Definition: ThermalModelEVMF.h:230
CbmTrdTrack.h
CbmHRGModel::errmuB
std::vector< double > errmuB
Definition: CbmHRGModel.h:141
kProtonMass
const Double_t kProtonMass
Definition: CbmPhsdGenerator.cxx:31
CbmHRGModel::CalculateMultiplicitiesInEvent
void CalculateMultiplicitiesInEvent(std::vector< int > &Mult, int RecoLevel, bool UpdateGlobal=0)
Definition: CbmHRGModel.cxx:677
ThermalModelFitParameters::T
FitParameter T
Definition: ThermalModelFit.h:80
HRGModelNamespace::AcceptanceFunction
Definition: CbmHRGModel.h:40
ThermalModelBase::Parameters
ThermalModelParameters Parameters
Definition: ThermalModelBase.h:21
ThermalModelEVMF::CalculateHadronDensity
virtual double CalculateHadronDensity()
Definition: ThermalModelEVMF.h:180
CbmHRGModel::fUseStatistics
Bool_t fUseStatistics
Definition: CbmHRGModel.h:113
CbmKFVertex.h
HRGModelNamespace::AcceptanceFunction::sfunc
BilinearSplineFunction sfunc
Definition: CbmHRGModel.h:43
CbmHRGModel::IndexnB
int IndexnB
Definition: CbmHRGModel.h:129
CbmHRGModel::fRecoLevel
Int_t fRecoLevel
Definition: CbmHRGModel.h:108
ThermalModelEVMF::SetParameters
virtual void SetParameters(double T, double muB, double muS, double muQ, double gammaS, double V, double R)
Definition: ThermalModelEVMF.h:55
FitParameter::xmin
double xmin
Definition: ThermalModelFit.h:12
CbmHRGModel::IndexErrorMuB
int IndexErrorMuB
Definition: CbmHRGModel.h:128
CbmHRGModel::IndexEoverN
int IndexEoverN
Definition: CbmHRGModel.h:130
CbmHRGModel::pullT
TH1F * pullT
Definition: CbmHRGModel.h:140
HRGModelNamespace::AcceptanceFunction::dy
Double_t dy
Definition: CbmHRGModel.h:41
CbmHRGModel::grTmuB
TGraphErrors * grTmuB
Definition: CbmHRGModel.h:139
ThermalModelEVMF
Definition: ThermalModelEVMF.h:12
CbmHRGModel::IndexEtaoverS
int IndexEtaoverS
Definition: CbmHRGModel.h:130