1 //____________________________________________________________________
5 // Script that contains a class to draw hits, using the
6 // AliFMDInputHits class in the util library.
8 // It draws the energy loss versus the p/(mq^2). It can be overlayed
9 // with the Bethe-Bloc curve to show how the simulation behaves
10 // relative to the expected.
12 // Use the script `Compile.C' to compile this class using ACLic.
15 #include <AliFMDHit.h>
16 #include <AliFMDInput.h>
20 #include <TParticle.h>
23 @brief Draw hit energy loss
26 Root> Compile("DrawHits.C")
32 class DrawHits : public AliFMDInput
35 TH2D* fElossVsPMQ; // Histogram
38 //__________________________________________________________________
39 TArrayF MakeLogScale(Int_t n, Double_t min, Double_t max)
44 for (Int_t i = 1; i < n+1; i++) bins[i] = bins[i-1] + (max-min)/n;
47 Float_t dp = n / TMath::Log10(max / min);
48 Float_t pmin = TMath::Log10(min);
49 for (Int_t i = 1; i < n+1; i++) {
50 Float_t p = pmin + i / dp;
51 bins[i] = TMath::Power(10, p);
55 //__________________________________________________________________
56 DrawHits(Int_t m=1000, Double_t emin=1, Double_t emax=1000,
57 Int_t n=900, Double_t tmin=1e-2, Double_t tmax=1e3,
63 TArrayF tkine(MakeLogScale(n, tmin, tmax));
64 TArrayF eloss(MakeLogScale(m, emin, emax));
65 TString name(Form("elossVsP%s", (fPdg == 0 ? "MQ" : "")));
66 TString title(Form("#Delta E/#Delta x vs. p%s",
67 (fPdg == 0 ? "/(mq^{2})" : "")));
68 fElossVsPMQ = new TH2D(name.Data(), title.Data(),
69 tkine.fN-1, tkine.fArray,
70 eloss.fN-1, eloss.fArray);
71 fElossVsPMQ->SetXTitle(Form("p%s", (fPdg == 0 ? "/(mq^{2})" : " [GeV]")));
72 fElossVsPMQ->SetYTitle("#Delta E/#Delta x [MeV/cm]");
74 //__________________________________________________________________
75 Bool_t ProcessHit(AliFMDHit* hit, TParticle* p)
78 std::cout << "No hit" << std::endl;
83 std::cout << "No track" << std::endl;
86 if (!p->IsPrimary()) return kTRUE;
87 if (hit->IsStop()) return kTRUE;
89 Float_t y = hit->Edep()/hit->Length();
91 if (TMath::Abs(hit->Pdg()) != fPdg) return kTRUE;
94 Float_t q = hit->Q() / 3.;
95 if (hit->M() == 0 || q == 0) return kTRUE;
99 fElossVsPMQ->Fill(x, y);
102 //__________________________________________________________________
105 gStyle->SetPalette(1);
106 gStyle->SetOptTitle(0);
107 gStyle->SetCanvasColor(0);
108 gStyle->SetCanvasBorderSize(0);
109 gStyle->SetPadColor(0);
110 gStyle->SetPadBorderSize(0);
111 fElossVsPMQ->SetStats(kFALSE);
112 fElossVsPMQ->Draw("COLZ box");
115 ClassDef(DrawHits,0);
118 //____________________________________________________________________