2 #include "AliRunLoader.h"
6 #include "TClonesArray.h"
7 #include "AliMFTCluster.h"
8 #include "AliMFTSegmentation.h"
15 #include "AliMFTClusterQA.h"
17 //====================================================================================================================================================
19 // Class for the analysis of the MFT clusters (a.k.a. rec points). Few QA histograms are created
21 // Contact author: antonio.uras@cern.ch
23 //====================================================================================================================================================
25 ClassImp(AliMFTClusterQA)
27 //====================================================================================================================================================
29 AliMFTClusterQA::AliMFTClusterQA():
42 // default constructor
44 for (Int_t iPlane=0; iPlane<fNMaxPlanes; iPlane++) {
45 fHistNClustersPerEvent[iPlane] = 0;
46 fHistNPixelsPerCluster[iPlane] = 0;
47 fHistClusterSizeX[iPlane] = 0;
48 fHistClusterSizeY[iPlane] = 0;
49 fClusterScatterPlotXY[iPlane] = 0;
54 //====================================================================================================================================================
56 void AliMFTClusterQA::Init(Char_t *readDir, Char_t *outDir, Int_t nEventsToAnalyze) {
61 fRunLoader = AliRunLoader::Open(Form("%s/galice.root", fReadDir.Data()));
62 gAlice = fRunLoader->GetAliRun();
63 if (!gAlice) fRunLoader->LoadgAlice();
64 fNEvents = fRunLoader->GetNumberOfEvents();
65 if (nEventsToAnalyze>0) fNEvents = TMath::Min(fNEvents, nEventsToAnalyze);
67 fMFT = (AliMFT*) gAlice->GetDetector("MFT");
68 fNPlanes = fMFT->GetSegmentation()->GetNPlanes();
72 fMFTLoader = fRunLoader->GetDetectorLoader("MFT");
73 fMFTLoader -> LoadRecPoints("READ");
77 //====================================================================================================================================================
79 Bool_t AliMFTClusterQA::LoadNextEvent() {
81 if (fEv>=fNEvents) return kFALSE;
82 AliDebug(1, Form("event %5d",fEv));
84 fRunLoader->GetEvent(fEv);
87 if (!fMFTLoader->TreeR()->GetEvent()) return kTRUE;
89 for (Int_t iPlane=0; iPlane<fNPlanes; iPlane++) {
90 Int_t nClusters = fMFT->GetRecPointsList(iPlane)->GetEntries();
91 fHistNClustersPerEvent[iPlane] -> Fill(nClusters);
92 fClusterScatterPlotXY[iPlane] -> Fill(0., 0.); // "scaler" bin
93 AliDebug(1,Form("nClusters = %5d", nClusters));
94 for (Int_t iCluster=0; iCluster<nClusters; iCluster++) {
95 AliMFTCluster *cluster = (AliMFTCluster*) (fMFT->GetRecPointsList(iPlane))->At(iCluster);
96 fHistNPixelsPerCluster[iPlane] -> Fill(cluster->GetSize());
97 fHistClusterSizeX[iPlane] -> Fill(cluster->GetErrX()*1.e4); // converted in microns
98 fHistClusterSizeY[iPlane] -> Fill(cluster->GetErrY()*1.e4); // converted in microns
99 fClusterScatterPlotXY[iPlane] -> Fill(cluster->GetX(), cluster->GetY());
107 //====================================================================================================================================================
109 void AliMFTClusterQA::BookHistos() {
111 fFileOut = new TFile(Form("%s/MFT.RecPoints.QA.root",fOutDir.Data()), "recreate");
113 for (Int_t iPlane=0; iPlane<fNPlanes; iPlane++) {
115 fHistNClustersPerEvent[iPlane] = new TH1D(Form("fHistNClustersPerEvent_Pl%02d",iPlane),
116 Form("Number of clusters per event in Plane%02d",iPlane),
117 25000, -0.5, 24999.5);
119 fHistNPixelsPerCluster[iPlane] = new TH1D(Form("fHistNPixelsPerCluster_Pl%02d",iPlane),
120 Form("Number of pixels per cluster in Plane%02d",iPlane),
123 fHistClusterSizeX[iPlane] = new TH1D(Form("fHistClusterSizeX_Pl%02d",iPlane),
124 Form("#Deltax for clusters in Plane%02d",iPlane),
127 fHistClusterSizeY[iPlane] = new TH1D(Form("fHistClusterSizeY_Pl%02d",iPlane),
128 Form("#Deltay for clusters in Plane%02d",iPlane),
131 fHistNClustersPerEvent[iPlane] -> SetXTitle("N_{clusters} per Event");
132 fHistNPixelsPerCluster[iPlane] -> SetXTitle("N_{pixels} per Cluster");
133 fHistClusterSizeX[iPlane] -> SetXTitle("#Deltax [#mum]");
134 fHistClusterSizeY[iPlane] -> SetXTitle("#Deltay [#mum]");
136 fHistNClustersPerEvent[iPlane] -> Sumw2();
137 fHistNPixelsPerCluster[iPlane] -> Sumw2();
138 fHistClusterSizeX[iPlane] -> Sumw2();
139 fHistClusterSizeY[iPlane] -> Sumw2();
141 //------------------------------------------------------------
143 Int_t rMax = Int_t(10.*(fMFT->GetSegmentation()->GetPlane(iPlane)->GetRMaxSupport()));
144 fClusterScatterPlotXY[iPlane] = new TH2D(Form("fClusterScatterPlotXY_Pl%02d",iPlane),
145 Form("Cluster scatter plot (Plane%02d)",iPlane),
146 2*rMax+1, (-rMax-0.5)/10., (rMax+0.5)/10., 2*rMax+1, (-rMax-0.5)/10., (rMax+0.5)/10.);
148 fClusterScatterPlotXY[iPlane] -> Sumw2();
154 //====================================================================================================================================================
156 void AliMFTClusterQA::Terminate() {
158 AliInfo("Writing QA histos...");
162 for (Int_t iPlane=0; iPlane<fNPlanes; iPlane++) {
163 fHistNClustersPerEvent[iPlane] -> Write();
164 fHistNPixelsPerCluster[iPlane] -> Write();
165 fHistClusterSizeX[iPlane] -> Write();
166 fHistClusterSizeY[iPlane] -> Write();
167 fClusterScatterPlotXY[iPlane] -> Write();
174 //====================================================================================================================================================