1 Int_t AliTRDanalyzeCluster()
4 // Analyzes the cluster
10 cout << "<AliTRDanalyzeCluster> No AliRun object found" << endl;
16 // Get the pointer to the TRD detector
17 AliTRD *TRD = (AliTRD *) gAlice->GetDetector("TRD");
19 cout << "<AliTRDanalyzeCluster> No TRD detector found" << endl;
24 // Define the histograms
25 TH1F *hClusAll = new TH1F("hClusAll" ,"Amplitude of the cluster (all)" ,501,-0.5,500.5);
26 TH1F *hClusNoise = new TH1F("hClusNoise","Amplitude of the cluster (noise)" ,501,-0.5,500.5);
27 TH1F *hClusEl = new TH1F("hClusEl" ,"Amplitude of the cluster (electron)",501,-0.5,500.5);
28 TH1F *hClusPi = new TH1F("hClusPi" ,"Amplitude of the cluster (pion)" ,501,-0.5,500.5);
30 // Get the pointer to the geometry object
31 AliTRDgeometry *TRDgeometry;
33 TRDgeometry = TRD->GetGeometry();
36 cout << "<AliTRDanalyzeCluster> No TRD geometry found" << endl;
41 // Get the pointer to the hit-tree
42 TFile *file = (TFile *) gROOT->GetListOfFiles()->FindObject("TRD_test.root");
43 TTree *RecTree = file->Get("ClusterTree");
45 cout << "<AliTRDanalyzeCluster> No tree with rec. points found" << endl;
50 // Get the pointer to the hit container
51 TObjArray *RecPointArray = TRD->RecPoints();
52 if (!(RecPointArray)) {
53 cout << "<AliTRDanalyzeCluster> No RecPointArray found" << endl;
58 // Set the branch address
59 RecTree->GetBranch("TRDrecPoints")->SetAddress(&RecPointArray);
60 Int_t nEntries = RecTree->GetEntries();
61 cout << "Number of entries in the rec. point tree = " << nEntries << endl;
63 Int_t countCluster = 0;
65 // Loop through all entries in the tree
67 for (Int_t iEntry = 0; iEntry < nEntries; iEntry++) {
70 nbytes += RecTree->GetEvent(iEntry);
72 // Get the number of points in the detector
73 Int_t nRecPoint = RecPointArray->GetEntriesFast();
75 // Loop through all TRD digits
76 for (Int_t iRecPoint = 0; iRecPoint < nRecPoint; iRecPoint++) {
78 // Get the information for this digit
79 AliTRDrecPoint *RecPoint = (AliTRDrecPoint *) RecPointArray->UncheckedAt(iRecPoint);
80 Int_t detector = RecPoint->GetDetector();
81 Int_t sector = TRDgeometry->GetSector(detector);
82 Int_t plane = TRDgeometry->GetPlane(detector);
83 Int_t chamber = TRDgeometry->GetChamber(detector);
84 Int_t energy = RecPoint->GetEnergy();
86 RecPoint->GetLocalPosition(pos);
87 Int_t track0 = RecPoint->GetTrackIndex(0);
88 Int_t track1 = RecPoint->GetTrackIndex(1);
91 Part = gAlice->Particle(track0);
97 hClusAll->Fill((Float_t) energy);
101 hClusNoise->Fill((Float_t) energy);
105 if ((Part) && (Part->GetPdgCode() == 11) && (track1 < 0)) {
106 hClusEl->Fill((Float_t) energy);
110 if ((Part) && (Part->GetPdgCode() == -211) && (track1 < 0)) {
111 hClusPi->Fill((Float_t) energy);
118 cout << "<AliTRDanalyzeCluster> Found " << countCluster << " cluster in total" << endl;
120 TCanvas *cCluster = new TCanvas("cCluster","AliTRDanalyzeCluster",50,50,600,600);
121 cCluster->Divide(2,2);
126 hClusAll->Fit("landau","0");
127 fun = (TF1 *) hClusAll->GetListOfFunctions()->First();
128 Float_t meanAll = fun->GetParameter(1);
130 fun->SetLineColor(2);
136 Float_t meanNoise = hClusNoise->GetMean();
141 hClusEl->Fit("landau","0");
142 fun = (TF1 *) hClusEl->GetListOfFunctions()->First();
143 fun->SetLineColor(2);
144 Float_t meanEl = fun->GetParameter(1);
150 hClusPi->Fit("landau","0");
151 fun = (TF1 *) hClusPi->GetListOfFunctions()->First();
152 fun->SetLineColor(2);
153 Float_t meanPi = fun->GetParameter(1);
158 cout << "##################################################################" << endl;
159 cout << " Mean all = " << meanAll << endl;
160 cout << " Mean noise = " << meanNoise << endl;
161 cout << " Mean electrons = " << meanEl << endl;
162 cout << " Mean pions = " << meanPi << endl;
163 cout << "##################################################################" << endl;