1 void fastClusterAna() {
3 /////////////////////////////////////////////////////////////////////////
5 // Example macro for the analysis of the TRD cluster
7 /////////////////////////////////////////////////////////////////////////
9 // Dynamically link some shared libs
10 if (gClassTable->GetID("AliRun") < 0) {
11 gROOT->LoadMacro("loadlibs.C");
16 Char_t *alifile = "galice_c_v0.root";
23 TClonesArray *TRDCluster;
24 AliTRDcluster *OneTRDcluster;
26 TH1F *hZ = new TH1F("hZ","Cluster z-position",700,-350.0,350.0);
28 // Connect the AliRoot file containing Geometry, Kine, Hits, and Digits
29 TFile *gafl = (TFile*) gROOT->GetListOfFiles()->FindObject(alifile);
31 cout << "Open the ALIROOT-file " << alifile << endl;
32 gafl = new TFile(alifile);
35 cout << alifile << " is already open" << endl;
38 // Get AliRun object from file or create it if not on file
40 gAlice = (AliRun*) gafl->Get("gAlice");
42 cout << "AliRun object found on file" << endl;
44 gAlice = new AliRun("gAlice","Alice test program");
47 // Import the Trees for the event nEvent in the file
48 Int_t nparticles = gAlice->GetEvent(nEvent);
49 cout << "nparticles = " << nparticles << endl;
50 if (nparticles <= 0) break;
52 // Get the pointer to the tree
53 TTree *ClusterTree = gAlice->TreeD();
55 // Get the pointer to the detector classes
56 TRD = (AliTRDv1 *) gAlice->GetDetector("TRD");
57 // Get the pointer to the hit container
58 if (TRD) TRDCluster = TRD->Cluster();
60 // Reconstruct the address
61 ClusterTree->GetBranch("TRDcluster")->SetAddress(&TRDCluster);
63 Int_t nEntries = ClusterTree->GetEntries();
64 cout << "Number of entries in cluster tree = " << nEntries << endl;
66 // Loop through all entries in the tree
68 for (Int_t iEntry = 0; iEntry < nEntries; iEntry++) {
70 cout << "iEntry = " << iEntry << endl;
73 gAlice->ResetDigits();
74 nbytes += ClusterTree->GetEvent(iEntry);
76 // Get the number of digits in the detector
77 Int_t nTRDCluster = TRDCluster->GetEntriesFast();
78 cout << " nTRDCluster = " << nTRDCluster << endl;
80 // Loop through all TRD digits
81 for (Int_t iTRDCluster = 0; iTRDCluster < nTRDCluster; iTRDCluster++) {
83 // Get the information for this digit
84 OneTRDcluster = (AliTRDcluster*) TRDCluster->UncheckedAt(iTRDCluster);
85 hZ->Fill(OneTRDcluster->fZ);