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)"
27 TH1F *hClusNoise = new TH1F("hClusNoise","Amplitude of the cluster (noise)"
29 TH1F *hClusEl = new TH1F("hClusEl" ,"Amplitude of the cluster (electron)"
31 TH1F *hClusPi = new TH1F("hClusPi" ,"Amplitude of the cluster (pion)"
34 // Get the pointer to the geometry object
35 AliTRDgeometry *TRDgeometry;
37 TRDgeometry = TRD->GetGeometry();
40 cout << "<AliTRDanalyzeCluster> No TRD geometry found" << endl;
45 // Get the pointer to the hit-tree
46 TFile *file = (TFile *) gROOT->GetListOfFiles()->FindObject("TRD_test.root");
47 TTree *ClusterTree = file->Get("ClusterTree");
49 cout << "<AliTRDanalyzeCluster> No tree with clusters found" << endl;
54 // Get the pointer to the hit container
55 TObjArray *ClusterArray = TRD->RecPoints();
56 if (!(ClusterArray)) {
57 cout << "<AliTRDanalyzeCluster> No ClusterArray found" << endl;
62 // Set the branch address
63 ClusterTree->GetBranch("TRDcluster")->SetAddress(&ClusterArray);
64 Int_t nEntries = ClusterTree->GetEntries();
65 cout << "<AliTRDanalyzeCluster> Number of entries in the cluster tree = "
69 Int_t countCluster = 0;
70 Int_t countUnfold = 0;
72 // Loop through all entries in the tree
74 for (Int_t iEntry = 0; iEntry < nEntries; iEntry++) {
77 nbytes += ClusterTree->GetEvent(iEntry);
79 // Get the number of points in the detector
80 Int_t nCluster = ClusterArray->GetEntriesFast();
82 // Loop through all TRD digits
83 for (Int_t iCluster = 0; iCluster < nCluster; iCluster++) {
85 // Get the information for this digit
86 AliTRDcluster *Cluster = (AliTRDcluster *) ClusterArray->UncheckedAt(iCluster);
87 Int_t detector = Cluster->GetDetector();
88 Int_t sector = TRDgeometry->GetSector(detector);
89 Int_t plane = TRDgeometry->GetPlane(detector);
90 Int_t chamber = TRDgeometry->GetChamber(detector);
91 Float_t energy = Cluster->GetQ();
92 Int_t track0 = Cluster->GetTrackIndex(0);
93 Int_t track1 = Cluster->GetTrackIndex(1);
94 Int_t track2 = Cluster->GetTrackIndex(2);
97 Part = gAlice->Particle(track0);
101 if (Cluster->FromUnfolding()) countUnfold++;
104 hClusAll->Fill(energy);
106 if (!Cluster->FromUnfolding()) {
110 hClusNoise->Fill(energy);
114 if ((Part) && (Part->GetPdgCode() == 11) && (track1 < 0)) {
115 hClusEl->Fill(energy);
119 if ((Part) && (Part->GetPdgCode() == -211) && (track1 < 0)) {
120 hClusPi->Fill(energy);
129 cout << "<AliTRDanalyzeCluster> Found " << countCluster << " cluster in total" << endl;
130 cout << "<AliTRDanalyzeCluster> Found " << countUnfold << " cluster from unfolding" << endl;
133 TCanvas *cCluster = new TCanvas("cCluster","AliTRDanalyzeCluster",50,50,600,600);
134 cCluster->Divide(2,2);
139 hClusAll->Fit("landau","0");
140 fun = (TF1 *) hClusAll->GetListOfFunctions()->First();
141 Float_t meanAll = fun->GetParameter(1);
143 fun->SetLineColor(2);
148 Float_t meanNoise = hClusNoise->GetMean();
153 hClusEl->Fit("landau","0");
154 fun = (TF1 *) hClusEl->GetListOfFunctions()->First();
155 fun->SetLineColor(2);
156 Float_t meanEl = fun->GetParameter(1);
162 hClusPi->Fit("landau","0");
163 fun = (TF1 *) hClusPi->GetListOfFunctions()->First();
164 fun->SetLineColor(2);
165 Float_t meanPi = fun->GetParameter(1);
170 cout << "##################################################################" << endl;
171 cout << " Mean all = " << meanAll << endl;
172 cout << " Mean noise = " << meanNoise << endl;
173 cout << " Mean electrons = " << meanEl << endl;
174 cout << " Mean pions = " << meanPi << endl;
175 cout << "##################################################################" << endl;