1 //////////////////////////////////////////////////////////////////
2 // Macro to check ESD info provided by the 2 SPD layers //
5 // - distribution of the SPD vertex Z-coord //
6 // - SPD vertex Z-coord and sigma for each event //
7 // 1 canvas for tracklets with //
9 // - #tracklets vs #clusters (inner layer) //
12 // 1 canvas for clusters (inner layer) not associated with //
13 // - #single clusters //
17 // Maria.Nicassio@ba.infn.it //
18 // Domenico.Elia@ba.infn.it //
19 //////////////////////////////////////////////////////////////////
21 #if !defined(__CINT__) || defined(__MAKECINT__)
23 #include <Riostream.h>
30 #include "AliESDEvent.h"
31 #include "AliESDHeader.h"
32 #include "AliESDVertex.h"
33 #include "AliESDtrack.h"
34 #include "AliMultiplicity.h"
38 void ShowSPDESDs (Int_t RunStart, Int_t RunStop) {
42 Char_t* dir = "/home/elia/alice/pp/data/first";
44 TH1F* hSPDVertex = new TH1F("SPDVertex","",80,-20.,20.);
45 TH1F* hSPDVertexPerEvent = new TH1F("SPDVertexPerEvent","",100,0.,100.);
47 TH1F* hnTracklets = new TH1F("nTracklets","",200,0.,200.);
48 TH2F* hnTracklets_nCl1 = new TH2F("nTracklets_nCl1","",200,0.,200.,200,0.,200.);
49 TH1F* hDePhiTracklets = new TH1F("DePhiTracklets","",200,-0.2,0.2);
50 TH1F* hPhiTracklets = new TH1F("PhiTracklets","",600,0.,2*TMath::Pi());
51 TH1F* hThetaTracklets = new TH1F("ThetaTracklets","",300,0.,TMath::Pi());
52 TH1F* hnSingleClustersLay1 = new TH1F("nSingleClustersLay1","",200,0.,200.);
53 TH1F* hPhiSingleClustersLay1 = new TH1F("PhiSingleClustersLay1","",600,0.,2*TMath::Pi());
54 TH1F* hThetaSingleClustersLay1 = new TH1F("ThetaSingleClustersLay1","",600,0.,TMath::Pi());
57 for (Int_t run=RunStart; run<RunStop+1; run++) {
59 sprintf(fileName,"%s/AliESDsRAW_%04d.root",dir,run);
61 // Open input file and get the TTree
62 TFile inFile(fileName, "READ");
64 TTree *esdTree = (TTree*)inFile.Get("esdTree");
65 AliESDEvent *esd = new AliESDEvent();
66 esd->ReadFromTree(esdTree);
69 Int_t nESDEvents = esdTree->GetEntries();
70 for (Int_t iEv = 0; iEv < nESDEvents; iEv++) {
71 // cout << "Event: " << iEv+1 << "/" << nESDEvents << endl;
74 esdTree->GetEvent(iEv);
77 const AliESDVertex* vtxESD = esd->GetVertex();
80 Double_t sigmaESDvtx[3];
81 vtxESD->GetXYZ(ESDvtx);
82 vtxESD->GetSigmaXYZ(sigmaESDvtx);
83 // cout<<"SPD vtx: x="<<ESDvtx[0]<<" y="<<ESDvtx[1]<<" z="<<ESDvtx[2]<<endl;
84 // cout<<"sigma SPD vtx: x="<<sigmaESDvtx[0]<<" y="<<sigmaESDvtx[1]<<" z="<<sigmaESDvtx[2]<<endl;
85 hSPDVertex->Fill(ESDvtx[2]);
86 if (ESDvtx[2]!=0.) hSPDVertexPerEvent->SetBinError(iEv,sigmaESDvtx[2]);
87 hSPDVertexPerEvent->Fill(iEv,ESDvtx[2]);
89 // Get the SPD reconstructed multiplicity
90 const AliMultiplicity* SPDMult = esd->GetMultiplicity();
92 Int_t nTracklets = SPDMult->GetNumberOfTracklets();
93 // Loop over tracklets
94 for (Int_t itr=0; itr<nTracklets; ++itr) {
95 Float_t thetaTr = SPDMult->GetTheta(itr);
96 Float_t phiTr = SPDMult->GetPhi(itr);
97 Float_t dePhiTr = SPDMult->GetDeltaPhi(itr);
98 hPhiTracklets->Fill(phiTr);
99 hDePhiTracklets->Fill(dePhiTr);
100 hThetaTracklets->Fill(thetaTr);
103 Int_t nSingleCl1 = SPDMult->GetNumberOfSingleClusters();
104 Int_t nCl1 = nSingleCl1 + nTracklets;
105 // Loop over unassociated clusters
106 for (Int_t icl=0; icl<nSingleCl1; ++icl) {
107 Float_t phiSing = SPDMult->GetPhiSingle(icl);
108 Float_t thetaSing = SPDMult->GetThetaSingle(icl);
109 hPhiSingleClustersLay1->Fill(phiSing);
110 hThetaSingleClustersLay1->Fill(thetaSing);
112 hnTracklets_nCl1->Fill(nCl1,nTracklets);
113 hnTracklets->Fill(nTracklets);
114 hnSingleClustersLay1->Fill(nSingleCl1);
116 } // end loop over events
117 } // end loop over runs
119 TFile* fout = new TFile("out_ShowSPDESDs.root","RECREATE");
121 TCanvas *cVertex = new TCanvas("cVertex","SPD vertex");
122 cVertex->Divide(1,2);
124 hSPDVertex->GetYaxis()->SetTitle("Entries");
125 hSPDVertex->GetXaxis()->SetTitle("Reconstructed vertex [cm]");
128 hSPDVertexPerEvent->SetMarkerStyle(21);
129 hSPDVertexPerEvent->SetMarkerColor(2);
130 hSPDVertexPerEvent->SetMarkerSize(0.4);
131 hSPDVertexPerEvent->GetXaxis()->SetTitle("Event number");
132 hSPDVertexPerEvent->GetYaxis()->SetTitle("Reconstructed vertex [cm]");
133 hSPDVertexPerEvent->Draw("p");
134 TCanvas *cTracklets = new TCanvas("cTracklets","SPD Tracklets");
135 cTracklets->Divide(2,2);
137 hnTracklets->GetXaxis()->SetTitle("Number of tracklets");
138 hnTracklets->GetYaxis()->SetTitle("Entries");
141 hnTracklets_nCl1->GetXaxis()->SetTitle("# clusters (inner layer)");
142 hnTracklets_nCl1->GetYaxis()->SetTitle("# tracklets");
143 hnTracklets_nCl1->Draw();
145 hDePhiTracklets->GetXaxis()->SetTitle("#Delta#phi [rad]");
146 hDePhiTracklets->GetYaxis()->SetTitle("Entries");
147 hDePhiTracklets->Draw();
149 hPhiTracklets->GetXaxis()->SetTitle("#phi [rad]");
150 hPhiTracklets->GetYaxis()->SetTitle("Entries");
151 hPhiTracklets->Draw();
153 TCanvas *cSingleClusters = new TCanvas("cSingleClusters","Unassociated clusters");
154 cSingleClusters->Divide(2,2);
155 cSingleClusters->cd(1);
156 hnSingleClustersLay1->GetXaxis()->SetTitle("# clusters (inner layer)");
157 hnSingleClustersLay1->GetYaxis()->SetTitle("Entries");
158 hnSingleClustersLay1->Draw();
159 cSingleClusters->cd(2);
160 hPhiSingleClustersLay1->GetXaxis()->SetTitle("#phi [rad]");
161 hPhiSingleClustersLay1->GetYaxis()->SetTitle("Entries");
162 hPhiSingleClustersLay1->Draw();
163 cSingleClusters->cd(3);
164 hThetaSingleClustersLay1->GetXaxis()->SetTitle("#theta [rad]");
165 hThetaSingleClustersLay1->GetYaxis()->SetTitle("Entries");
166 hThetaSingleClustersLay1->Draw();
169 hSPDVertexPerEvent->Write();
170 hnTracklets_nCl1->Write();
171 hnTracklets->Write();
173 hDePhiTracklets->Write();
174 hPhiTracklets->Write();
175 hThetaTracklets->Write();
176 hnSingleClustersLay1->Write();
177 hPhiSingleClustersLay1->Write();
178 hThetaSingleClustersLay1->Write();