]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/scripts/DrawXsection.C
New macro for checking new misaligner class.
[u/mrichter/AliRoot.git] / FMD / scripts / DrawXsection.C
CommitLineData
a1f80595 1void
2DrawXsection(const char* file="xsec.root",
3 const char* var="LOSS",
4 const char* medName="FMD_Si$",
5 Double_t thick=.03,
6 const char* pdgName="pi+")
7{
8 TFile* file = TFile::Open("xsec.root", "READ");
9 TTree* tree = static_cast<TTree*>(file->Get(Form("%s_%s",medName,
10 pdgName)));
11 TLeaf* tb = tree->GetLeaf("T");
12 TLeaf* vb = tree->GetLeaf(var);
13 if (!vb) {
14 std::cerr << "Leaf " << var << " not found" << std::endl;
15 return;
16 }
17 Float_t tkine, value;
18 tb->SetAddress(&tkine);
19 vb->SetAddress(&value);
20 Int_t n = tree->GetEntries();
21
22 TDatabasePDG* pdgDb = TDatabasePDG::Instance();
23 TParticlePDG* pdgP = pdgDb->GetParticle(pdgName);
24 if (!pdgP) {
25 std::cerr << "Couldn't find particle " << pdgName << std::endl;
26 return;
27 }
28 Double_t m = pdgP->Mass();
29 Double_t q = pdgP->Charge() / 3;
30 if (m == 0) {
31 std::cerr << "Mass is 0" << std::endl;
32 return;
33 }
34
35 TGraph* graph = new TGraph(n);
36 for (Int_t i = 0; i < n; i++) {
37 tree->GetEntry(i);
38 graph->SetPoint(i, tkine/m/q/q, value*thick);
39 }
40 graph->Draw("ALP");
41}
42
43//____________________________________________________________________
44//
45// EOF
46//