Installing the content of data folder
[u/mrichter/AliRoot.git] / BCM / bcmhits.C
CommitLineData
716f1c1c 1void bcmhits(Int_t events = 10)
2{
3 TH1::AddDirectory(kFALSE);
4 zH = new TH1F("zH", "z coordinate of hit", 210., -2100., 2100.);
5 rH = new TH1F("rH", "r coordinate of hit", 200., 0., 20.);
6 tH = new TH1F("tH", "time of hits", 100., 0., 100.);
7
8 // Creating Run Loader and openning file containing Hits
9 TClonesArray* hits = new TClonesArray ("AliBCMHit", 1000);
10 AliRunLoader* rl = AliRunLoader::Open("galice.root");
11 if (rl ==0x0) {
12 printf(">>> Error : Error Opening file \n");
13 return;
14 }
15 rl->LoadgAlice();
16 rl->LoadHeader();
17 rl->LoadKinematics();
18 gAlice = rl->GetAliRun();
19 AliBCM* pBCM = (AliBCM*) gAlice->GetDetector("BCM");
20
21// Histos
22 for (Int_t nev = 0; nev < events; nev++) {
23 // Load event
24 rl->GetEvent(nev);
25 AliLoader* bcmL = rl->GetLoader("BCMLoader");
26// bcmL->InitDefaults();
27 bcmL->LoadHits();
28 TTree* treeH = bcmL->TreeH();
29 Int_t ntracks = (Int_t) treeH->GetEntries();
30 printf("Number of particles %6d %6d \n", nev, ntracks);
31 for (Int_t itr = 0; itr < ntracks; itr++) {
32 gAlice->ResetHits ();
33 treeH->GetEvent(itr);
34 hits = pBCM->Hits();
35 Int_t nhits = hits->GetEntriesFast();
36 for (Int_t hit = 0; hit < nhits; hit++)
37 {
38
39 AliBCMHit* mHit = (AliBCMHit *) hits->UncheckedAt(hit);
40 Float_t x = mHit->X();
41 Float_t y = mHit->Y();
42 Float_t z = mHit->Z();
43 Float_t r = TMath::Sqrt(x * x + y * y);
44
45 zH->Fill(z);
46 tH->Fill(mHit->Time() * 1.e9);
47 rH->Fill(r);
48
49
50 } // hits
51 } // tracks
52 } // events
53 new TCanvas("c1");
54 zH->Draw();
55
56 new TCanvas("c2");
57 tH->Draw();
58
59 new TCanvas("c3");
60 rH->Draw();
61
62}