]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/alice-macros/tpc_hits_eta_split.C
Use optimised color lookup from TPCSectorViz.
[u/mrichter/AliRoot.git] / EVE / alice-macros / tpc_hits_eta_split.C
CommitLineData
5a5a1232 1// $Id$
2
3void tpc_hits_eta_split(const char *varexp = "TPC2.fArray.fR:TPC2.fArray.fFi:TPC2.fArray.fZ",
4 const char *selection = "TPC2.fArray.fR>80",
5 Option_t *option = "goff")
6{
7 // Extracts 'major' TPC hits (not the compressed ones).
8 // This gives ~2.5% of all hits.
9
10 AliRunLoader* rl = Alieve::Event::AssertRunLoader();
11 rl->LoadHits("TPC");
12
13 TTree* ht = rl->GetTreeH("TPC", false);
a6c06134 14 ht->SetEstimate(800*ht->GetEntries());
5a5a1232 15 ht->Draw(varexp, selection, option);
16
17 gReve->DisableRedraw();
18
19 Reve::PointSetArray* l = new Reve::PointSetArray
20 ("TPC hits - Eta Slices", "");
21 l->SetMainColor((Color_t)3);
22 TGListTreeItem *ti = gReve->AddRenderElement(l);
23
24 l->InitBins(ti, "Eta", 20, -2, 2);
25
26 Double_t *vr = ht->GetV1(), *vphi = ht->GetV2(), *vz = ht->GetV3();
27 Long64_t nr = ht->GetSelectedRows();
28 while(nr-- > 0) {
29 using namespace TMath;
30 Double_t ctg = *vz / *vr;
31 Double_t eta = -Log(Hypot(1,ctg)-Abs(ctg)); if(ctg < 0) eta = -eta;
32 Double_t cos_theta = *vz / Hypot(*vr, *vz);
33 Double_t eta1 = -0.5*Log( (1.0-cos_theta)/(1.0+cos_theta) );
34 if(Abs(eta1 - eta) > 0.01) printf("etadiff %lf %lf\n", eta1, eta);
35 l->Fill(eta, *vr * Cos(*vphi), *vr * Sin(*vphi), *vz);
36 ++vr; ++vphi; ++vz;
37 }
38
39 l->CloseBins(20, 1); // Full circle, size 1.
40
41 gReve->DrawRenderElement(l);
42 gReve->EnableRedraw();
43}