ROOT logo
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();
    
}
 bcmhits.C:1
 bcmhits.C:2
 bcmhits.C:3
 bcmhits.C:4
 bcmhits.C:5
 bcmhits.C:6
 bcmhits.C:7
 bcmhits.C:8
 bcmhits.C:9
 bcmhits.C:10
 bcmhits.C:11
 bcmhits.C:12
 bcmhits.C:13
 bcmhits.C:14
 bcmhits.C:15
 bcmhits.C:16
 bcmhits.C:17
 bcmhits.C:18
 bcmhits.C:19
 bcmhits.C:20
 bcmhits.C:21
 bcmhits.C:22
 bcmhits.C:23
 bcmhits.C:24
 bcmhits.C:25
 bcmhits.C:26
 bcmhits.C:27
 bcmhits.C:28
 bcmhits.C:29
 bcmhits.C:30
 bcmhits.C:31
 bcmhits.C:32
 bcmhits.C:33
 bcmhits.C:34
 bcmhits.C:35
 bcmhits.C:36
 bcmhits.C:37
 bcmhits.C:38
 bcmhits.C:39
 bcmhits.C:40
 bcmhits.C:41
 bcmhits.C:42
 bcmhits.C:43
 bcmhits.C:44
 bcmhits.C:45
 bcmhits.C:46
 bcmhits.C:47
 bcmhits.C:48
 bcmhits.C:49
 bcmhits.C:50
 bcmhits.C:51
 bcmhits.C:52
 bcmhits.C:53
 bcmhits.C:54
 bcmhits.C:55
 bcmhits.C:56
 bcmhits.C:57
 bcmhits.C:58
 bcmhits.C:59
 bcmhits.C:60
 bcmhits.C:61
 bcmhits.C:62
 bcmhits.C:63