StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
dEdxHist.cxx
1 #include "dEdxHist.h"
2 Int_t Hists3D::NtotHist = 2;
3 Hists3D::Hists3D(const Char_t *Name, const Char_t *Title,
4  const Char_t *TitleX, const Char_t *TitleY,
5  Int_t nXBins,
6  Int_t nYBins, Double_t ymin, Double_t ymax,
7  Int_t nZBins, Double_t ZdEdxMin, Double_t ZdEdxMax,
8  Double_t xmin, Double_t xmax, Int_t nh) : fNHist(nh) {
9  const Char_t *Names[9] = {"","C","N","Ne","Npi","NK","NP","Nd","dX"};
10  const Char_t *Titles[9] = {"uncorrected", "correctred","nP measured","nP for e","nP for pi","nP for K","nP for P","nP for d","dX"};
11  memset(hists, 0, 9*sizeof(TH1*));
12  Int_t nx = nXBins;
13  if (xmin >= xmax) {
14  xmin = 0.5;
15  xmax = TMath::Abs(nXBins)+0.5;
16  }
17  if (nx < 0) {
18  xmin = - xmax;
19  nx = 2*TMath::Abs(nXBins) + 1;
20  }
21  if (ymin >= ymax) {
22  ymin = 0.5;
23  ymax = nYBins+0.5;
24  }
25  for (Int_t j = 0; j < fNHist; j++) {
26  TString name(Name);
27  name += Names[j];
28  TString title(Title);
29  title += "("; title += Titles[j]; title += ") versus "; title += TitleX; title += " and "; title += TitleY;
30  if (j < 8) {
31  Int_t nz = nZBins;
32  Double_t zmin = ZdEdxMin;
33  Double_t zmax = ZdEdxMax;
34  if (j > 2) {
35  nz = 40;
36  zmin = 1.4;
37  zmax = 3.4;
38  }
39  hists[j] = (TH1 *) new TH3F(name,title,
40  nx,xmin, xmax, nYBins,ymin, ymax,nz, zmin, zmax);
41  } else {
42  hists[j] = (TH1 *) new TProfile2D(name,title,
43  nx,xmin, xmax, nYBins,ymin, ymax, "S");
44  }
45  hists[j]->SetXTitle(TitleX);
46  hists[j]->SetYTitle(TitleY);
47  }
48 }
49 //________________________________________________________________________________
50 void Hists3D::Fill(Double_t x, Double_t y, Double_t *z) {
51  for (Int_t i = 0; i < fNHist; i++) {
52  if (hists[i]) {
53  if (i < 8) ((TH3F *) hists[i])->Fill(x,y,z[i]);
54  else ((TProfile2D *) hists[i])->Fill(x,y,z[i]);
55  }
56  }
57 }
58 //________________________________________________________________________________
59 void Hists3D::FillY(Double_t x, Double_t *y, Double_t *z) {
60  for (Int_t i = 0; i < TMath::Min(2,fNHist); i++) {
61  if (hists[i]) {
62  if (i < 8) ((TH3F *) hists[i])->Fill(x,y[i],z[i]);
63  else ((TProfile2D *) hists[i])->Fill(x,y[i],z[i]);
64  }
65  }
66 }
67 //________________________________________________________________________________
68 Hists2D::Hists2D(const Char_t *Name) {
69  memset(dev, 0, 3*KPidParticles*sizeof(TH2F*));
70  TString nameP;
71  TString title;
72  const Char_t *Charge[3] = {"P","N","A"};
73  const Char_t *ChargeT[3] = {"+","-","All"};
74  for (Int_t hyp=0; hyp<KPidParticles;hyp++) {
75  for (Int_t sCharge = 0; sCharge < 3; sCharge++) {
76  nameP = Name;
77  nameP += StProbPidTraits::mPidParticleDefinitions[hyp]->name().data();
78  nameP += Charge[sCharge];
79  nameP.ReplaceAll("-","");
80  title = Name; title += " Log(dE/dx_{Meas}/dE/dx_{Pred}) for ";
81  title += StProbPidTraits::mPidParticleDefinitions[hyp]->name().data();
82  title.ReplaceAll("-","");
83  title += " "; title += ChargeT[sCharge];
84  title += " versus log10(p/m)";
85  dev[hyp][sCharge] = new TH2F(nameP.Data(),title.Data(),320,-2,6,2000,-5,5);
86  dev[hyp][sCharge]->SetMarkerColor(hyp+2);
87  dev[hyp][sCharge]->SetXTitle("log_{10}(p/m)");
88  title += " Unique";
89  nameP += "T";
90  devT[hyp][sCharge] = new TH2F(nameP.Data(),title.Data(),320,-2,6,2000,-5,5);
91  devT[hyp][sCharge]->SetMarkerColor(hyp+2);
92  devT[hyp][sCharge]->SetXTitle("log_{10}(p/m)");
93  }
94  }
95 }
Charge
Define charge.
Definition: StPicoCommon.h:20