#include "TObject.h" #include "AliRunLoader.h" #include "AliRun.h" #include "AliLoader.h" #include "AliMFT.h" #include "TClonesArray.h" #include "AliMFTCluster.h" #include "AliMFTSegmentation.h" #include "TFile.h" #include "TH1D.h" #include "TH2D.h" #include "AliLog.h" #include "TString.h" #include "AliMFTClusterQA.h" //==================================================================================================================================================== // // Class for the analysis of the MFT clusters (a.k.a. rec points). Few QA histograms are created // // Contact author: antonio.uras@cern.ch // //==================================================================================================================================================== ClassImp(AliMFTClusterQA) //==================================================================================================================================================== AliMFTClusterQA::AliMFTClusterQA(): TObject(), fMFTLoader(0), fRunLoader(0), fMFT(0), fNPlanes(0), fNEvents(0), fEv(0), fFileOut(0), fReadDir(0), fOutDir(0) { // default constructor for (Int_t iPlane=0; iPlaneGetAliRun(); if (!gAlice) fRunLoader->LoadgAlice(); fNEvents = fRunLoader->GetNumberOfEvents(); if (nEventsToAnalyze>0) fNEvents = TMath::Min(fNEvents, nEventsToAnalyze); fMFT = (AliMFT*) gAlice->GetDetector("MFT"); fNPlanes = fMFT->GetSegmentation()->GetNPlanes(); BookHistos(); fMFTLoader = fRunLoader->GetDetectorLoader("MFT"); fMFTLoader -> LoadRecPoints("READ"); } //==================================================================================================================================================== Bool_t AliMFTClusterQA::LoadNextEvent() { if (fEv>=fNEvents) return kFALSE; AliDebug(1, Form("event %5d",fEv)); fRunLoader->GetEvent(fEv); fEv++; if (!fMFTLoader->TreeR()->GetEvent()) return kTRUE; for (Int_t iPlane=0; iPlaneGetRecPointsList(iPlane)->GetEntries(); fHistNClustersPerEvent[iPlane] -> Fill(nClusters); fClusterScatterPlotXY[iPlane] -> Fill(0., 0.); // "scaler" bin AliDebug(1,Form("nClusters = %5d", nClusters)); for (Int_t iCluster=0; iClusterGetRecPointsList(iPlane))->At(iCluster); fHistNPixelsPerCluster[iPlane] -> Fill(cluster->GetSize()); fHistClusterSizeX[iPlane] -> Fill(cluster->GetErrX()*1.e4); // converted in microns fHistClusterSizeY[iPlane] -> Fill(cluster->GetErrY()*1.e4); // converted in microns fHistClusterRadialPosition[iPlane] -> Fill(TMath::Sqrt(cluster->GetX()*cluster->GetX()+cluster->GetY()*cluster->GetY())); fClusterScatterPlotXY[iPlane] -> Fill(cluster->GetX(), cluster->GetY()); } } return kTRUE; } //==================================================================================================================================================== void AliMFTClusterQA::BookHistos() { fFileOut = new TFile(Form("%s/MFT.RecPoints.QA.root",fOutDir.Data()), "recreate"); for (Int_t iPlane=0; iPlane SetXTitle("N_{clusters} per Event"); fHistNPixelsPerCluster[iPlane] -> SetXTitle("N_{pixels} per Cluster"); fHistClusterSizeX[iPlane] -> SetXTitle("#Deltax [#mum]"); fHistClusterSizeY[iPlane] -> SetXTitle("#Deltay [#mum]"); fHistNClustersPerEvent[iPlane] -> Sumw2(); fHistNPixelsPerCluster[iPlane] -> Sumw2(); fHistClusterSizeX[iPlane] -> Sumw2(); fHistClusterSizeY[iPlane] -> Sumw2(); //------------------------------------------------------------ Int_t rMax = Int_t(10.*(fMFT->GetSegmentation()->GetPlane(iPlane)->GetRMaxSupport())); // expressed in mm fHistClusterRadialPosition[iPlane] = new TH1D(Form("fHistClusterRadialPosition_Pl%02d",iPlane), Form("Cluster radial position (Plane%02d)",iPlane), rMax, 0, Double_t(rMax)/10.); fClusterScatterPlotXY[iPlane] = new TH2D(Form("fClusterScatterPlotXY_Pl%02d",iPlane), Form("Cluster scatter plot (Plane%02d)",iPlane), 2*rMax+1, (-rMax-0.5)/10., (rMax+0.5)/10., 2*rMax+1, (-rMax-0.5)/10., (rMax+0.5)/10.); fHistClusterRadialPosition[iPlane] -> SetXTitle("R [cm]"); fClusterScatterPlotXY[iPlane] -> SetXTitle("X [cm]"); fClusterScatterPlotXY[iPlane] -> SetYTitle("Y [cm]"); fHistClusterRadialPosition[iPlane] -> Sumw2(); fClusterScatterPlotXY[iPlane] -> Sumw2(); } } //==================================================================================================================================================== void AliMFTClusterQA::Terminate() { AliInfo("Writing QA histos..."); // ---- equalize radial clusters distribution ---------------------- for (Int_t iPlane=0; iPlaneGetNbinsX(); iBin++) { Double_t rMin = fHistClusterRadialPosition[iPlane]->GetBinLowEdge(iBin); // in cm Double_t rMax = fHistClusterRadialPosition[iPlane]->GetBinWidth(iBin) + rMin; // in cm Double_t area = 100.*TMath::Pi()*(rMax*rMax - rMin*rMin); // in mm^2 Double_t density = fHistClusterRadialPosition[iPlane]->GetBinContent(iBin)/area; fHistClusterRadialPosition[iPlane]->SetBinContent(iBin, density); fHistClusterRadialPosition[iPlane]->SetBinError(iBin, fHistClusterRadialPosition[iPlane]->GetBinError(iBin)/area); } fHistClusterRadialPosition[iPlane] -> SetBinContent(1, fEv); // "scaler" bin } // ----------------------------------------------------------------- fFileOut->cd(); for (Int_t iPlane=0; iPlane Write(); fHistNPixelsPerCluster[iPlane] -> Write(); fHistClusterSizeX[iPlane] -> Write(); fHistClusterSizeY[iPlane] -> Write(); fHistClusterRadialPosition[iPlane] -> Write(); fClusterScatterPlotXY[iPlane] -> Write(); } fFileOut -> Close(); } //====================================================================================================================================================