2 #include "AliRunLoader.h"
6 #include "TClonesArray.h"
7 #include "AliMFTCluster.h"
8 #include "AliMFTSegmentation.h"
14 #include "AliMFTClusterQA.h"
16 //====================================================================================================================================================
18 // Class for the analysis of the MFT clusters (a.k.a. rec points). Few QA histograms are created
20 // Contact author: antonio.uras@cern.ch
22 //====================================================================================================================================================
24 ClassImp(AliMFTClusterQA)
26 //====================================================================================================================================================
28 AliMFTClusterQA::AliMFTClusterQA():
41 // default constructor
43 for (Int_t iPlane=0; iPlane<fMaxNPlanesMFT; iPlane++) {
44 fHistNClustersPerEvent[iPlane] = 0;
45 fHistNPixelsPerCluster[iPlane] = 0;
46 fHistClusterSizeX[iPlane] = 0;
47 fHistClusterSizeY[iPlane] = 0;
52 //====================================================================================================================================================
54 void AliMFTClusterQA::Init(Char_t *readDir, Char_t *outDir, Int_t nEventsToAnalyze) {
59 fRunLoader = AliRunLoader::Open(Form("%s/galice.root", fReadDir.Data()));
60 gAlice = fRunLoader->GetAliRun();
61 if (!gAlice) fRunLoader->LoadgAlice();
62 fNEvents = fRunLoader->GetNumberOfEvents();
63 if (nEventsToAnalyze>0) fNEvents = TMath::Min(fNEvents, nEventsToAnalyze);
65 fMFT = (AliMFT*) gAlice->GetDetector("MFT");
66 fNPlanes = fMFT->GetSegmentation()->GetNPlanes();
70 fMFTLoader = fRunLoader->GetDetectorLoader("MFT");
71 fMFTLoader -> LoadRecPoints("READ");
75 //====================================================================================================================================================
77 Bool_t AliMFTClusterQA::LoadNextEvent() {
79 if (fEv>=fNEvents) return kFALSE;
80 AliDebug(1, Form("event %5d",fEv));
82 fRunLoader->GetEvent(fEv);
85 if (!fMFTLoader->TreeR()->GetEvent()) return kTRUE;
87 for (Int_t iPlane=0; iPlane<fNPlanes; iPlane++) {
88 Int_t nClusters = fMFT->GetRecPointsList(iPlane)->GetEntries();
89 fHistNClustersPerEvent[iPlane] -> Fill(nClusters);
90 AliDebug(1,Form("nClusters = %5d", nClusters));
91 for (Int_t iCluster=0; iCluster<nClusters; iCluster++) {
92 AliMFTCluster *cluster = (AliMFTCluster*) (fMFT->GetRecPointsList(iPlane))->At(iCluster);
93 fHistNPixelsPerCluster[iPlane] -> Fill(cluster->GetSize());
94 fHistClusterSizeX[iPlane] -> Fill(cluster->GetErrX()*1.e4); // converted in microns
95 fHistClusterSizeY[iPlane] -> Fill(cluster->GetErrY()*1.e4); // converted in microns
103 //====================================================================================================================================================
105 void AliMFTClusterQA::BookHistos() {
107 fFileOut = new TFile(Form("%s/MFT.RecPoints.QA.root",fOutDir.Data()), "recreate");
109 for (Int_t iPlane=0; iPlane<fNPlanes; iPlane++) {
111 fHistNClustersPerEvent[iPlane] = new TH1D(Form("fHistNClustersPerEvent_Pl%02d",iPlane),
112 Form("Number of clusters per event in Plane%02d",iPlane),
113 10000, -0.5, 9999.5);
115 fHistNPixelsPerCluster[iPlane] = new TH1D(Form("fHistNPixelsPerCluster_Pl%02d",iPlane),
116 Form("Number of pixels per cluster in Plane%02d",iPlane),
119 fHistClusterSizeX[iPlane] = new TH1D(Form("fHistClusterSizeX_Pl%02d",iPlane),
120 Form("#Deltax for clusters in Plane%02d",iPlane),
123 fHistClusterSizeY[iPlane] = new TH1D(Form("fHistClusterSizeY_Pl%02d",iPlane),
124 Form("#Deltay for clusters in Plane%02d",iPlane),
127 fHistNClustersPerEvent[iPlane] -> SetXTitle("N_{clusters} per Event");
128 fHistNPixelsPerCluster[iPlane] -> SetXTitle("N_{pixels} per Cluster");
129 fHistClusterSizeX[iPlane] -> SetXTitle("#Deltax [#mum]");
130 fHistClusterSizeY[iPlane] -> SetXTitle("#Deltay [#mum]");
132 fHistNClustersPerEvent[iPlane] -> Sumw2();
133 fHistNPixelsPerCluster[iPlane] -> Sumw2();
134 fHistClusterSizeX[iPlane] -> Sumw2();
135 fHistClusterSizeY[iPlane] -> Sumw2();
141 //====================================================================================================================================================
143 void AliMFTClusterQA::Terminate() {
145 AliInfo("Writing QA histos...");
149 for (Int_t iPlane=0; iPlane<fNPlanes; iPlane++) {
150 fHistNClustersPerEvent[iPlane] -> Write();
151 fHistNPixelsPerCluster[iPlane] -> Write();
152 fHistClusterSizeX[iPlane] -> Write();
153 fHistClusterSizeY[iPlane] -> Write();
160 //====================================================================================================================================================