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