]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HMPID/AliHMPIDQADataMakerRec.cxx
Warning fixed
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDQADataMakerRec.cxx
CommitLineData
04236e67 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16
17/* $Id$ */
18
04236e67 19// --- ROOT system ---
20#include <TClonesArray.h>
21#include <TFile.h>
22#include <TH1F.h>
23#include <TH2F.h>
aa21372e 24#include <TProfile.h>
04236e67 25#include <Riostream.h>
26// --- Standard library ---
27
28// --- AliRoot header files ---
29#include "AliESDCaloCluster.h"
30#include "AliESDEvent.h"
cc1abc7f 31#include "AliQAChecker.h"
04236e67 32#include "AliLog.h"
33#include "AliHMPIDDigit.h"
34#include "AliHMPIDHit.h"
35#include "AliHMPIDCluster.h"
36#include "AliHMPIDQADataMakerRec.h"
7656d8ac 37#include "AliHMPIDQAChecker.h"
cc1abc7f 38#include "AliHMPIDParam.h"
39#include "AliHMPIDRawStream.h"
40#include "AliLog.h"
b38ac33a 41
606697a8 42//.
b38ac33a 43// HMPID AliHMPIDQADataMakerRec base class
44// for QA of reconstruction
45// here also errors are calculated
46//.
47
04236e67 48ClassImp(AliHMPIDQADataMakerRec)
49
ec575c20 50//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
04236e67 51 AliHMPIDQADataMakerRec::AliHMPIDQADataMakerRec() :
cc1abc7f 52 AliQADataMakerRec(AliQA::GetDetName(AliQA::kHMPID), "HMPID Quality Assurance Data Maker")
04236e67 53{
aa21372e 54 fEvtRaw=0;
04236e67 55 // ctor
04236e67 56}
57
ec575c20 58//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
04236e67 59AliHMPIDQADataMakerRec::AliHMPIDQADataMakerRec(const AliHMPIDQADataMakerRec& qadm) :
cc1abc7f 60 AliQADataMakerRec()
04236e67 61{
62 //copy ctor
04236e67 63 SetName((const char*)qadm.GetName()) ;
64 SetTitle((const char*)qadm.GetTitle());
65}
66
ec575c20 67//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
04236e67 68AliHMPIDQADataMakerRec& AliHMPIDQADataMakerRec::operator = (const AliHMPIDQADataMakerRec& qadm )
69{
70 // Equal operator.
71 this->~AliHMPIDQADataMakerRec();
72 new(this) AliHMPIDQADataMakerRec(qadm);
73 return *this;
74}
75
ec575c20 76//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
04236e67 77void AliHMPIDQADataMakerRec::InitRecPoints()
78{
79 // create cluster histograms in RecPoint subdir
cc1abc7f 80
aa21372e 81 TProfile *hCluMult = new TProfile("CluMult" ,"Cluster multiplicity per chamber" , 16, -1 , 7 , 0, 500);
82 Add2RecPointsList(hCluMult , 0);
83
84 TH2F *hCluFlg = new TH2F("CluFlg" ,"Cluster flag " , 56 ,-1.5, 12.5, 70, -0.5, 6.5);
85 Add2RecPointsList(hCluFlg , 1);
86
87 TH1F *hCluSizeMip[7], *hCluSizePho[7];
88
89 TH1F *hCluQSect[42], *hCluQSectZoom[42];
90
7656d8ac 91 for(Int_t iCh =0; iCh <7; iCh++){
aa21372e 92 hCluSizeMip[iCh] = new TH1F(Form("CluSizeMipCh%i",iCh),Form("Cluster size MIP (cluster Q > 100 ADC) in Chamber %i",iCh), 50 , 0 , 50 );
93 Add2RecPointsList(hCluSizeMip[iCh], iCh+2);
94
95 hCluSizePho[iCh] = new TH1F(Form("CluSizePho%i",iCh ),Form("Cluster size Phots(cluster Q < 100 ADC) in Chamber %i",iCh), 50 , 0 , 50 );
96 Add2RecPointsList(hCluSizePho[iCh], iCh+7+2);
97
98 for(Int_t iSect =0; iSect < 6; iSect++){
99 hCluQSectZoom[iCh*6+iSect] = new TH1F(Form("QClusCh%iSect%iZoom",iCh,iSect) ,Form("Zoom on Cluster charge (ADC) in Chamber %i and sector %i",iCh,iSect),100,0,100);
100 Add2RecPointsList(hCluQSectZoom[iCh*6+iSect],2+14+iCh*6+iSect);
cc1abc7f 101
aa21372e 102 hCluQSect[iCh*6+iSect] = new TH1F(Form("QClusCh%iSect%i",iCh,iSect) ,Form("Cluster charge (ADC) in Chamber %i and sector %i",iCh,iSect),250,0,5000);
103 Add2RecPointsList(hCluQSect[iCh*6+iSect],2+14+42+iCh*6+iSect);
104
105 }
106 }
cc1abc7f 107}
ec575c20 108//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
cc1abc7f 109void AliHMPIDQADataMakerRec::InitRaws()
110{
111//
112// Booking QA histo for Raw data
113//
64f2781e 114// All histograms implemented in InitRaws are used in AMORE. Any change here should be propagated to the amoreHMP-QA as well!!! (clm)
115//
116
b38ac33a 117 const Int_t kNerr = (Int_t)AliHMPIDRawStream::kSumErr+1;
aa21372e 118 TH1F *hSumErr[14];
119 TH2F *hDilo[14];
64f2781e 120 TH2I *hPadMap[42]; //AMORE monitoring
121 TH1I *hPadQ[42]; //AMORE monitoring
3c8e86a0 122 for(Int_t iddl =0; iddl<AliHMPIDRawStream::kNDDL; iddl++) {
3c8e86a0 123
64f2781e 124 hSumErr[iddl] = new TH1F(Form("hSumErrDDL%i",iddl), Form("Error summary for DDL %i",iddl), 2*kNerr,0,2*kNerr);
b38ac33a 125 for(Int_t ilabel=0; ilabel< kNerr; ilabel++) {
3c8e86a0 126 hSumErr[iddl]->GetXaxis()->CenterLabels(kTRUE);
3c8e86a0 127 hSumErr[iddl]->GetXaxis()->SetBinLabel((2*ilabel+1),Form("%i %s",ilabel+1,AliHMPIDRawStream::GetErrName(ilabel)));
128 }
129
aa21372e 130 Add2RawsList(hSumErr[iddl],iddl);
131
64f2781e 132 hDilo[iddl] = new TH2F(Form("hDiloDDL%i",iddl),Form("Dilogic response at DDL;Row # ;Dilogic #",iddl),24,1,25,10,1,11);
133 Add2RawsList(hDilo[iddl],14+iddl);
134 }//DDL loop
135 for(Int_t iCh = AliHMPIDParam::kMinCh; iCh <=AliHMPIDParam::kMaxCh ;iCh++) {
136 for(Int_t iPc = AliHMPIDParam::kMinPc; iPc <= AliHMPIDParam::kMaxPc ;iPc++) {
137 hPadMap[iPc+6*iCh] = new TH2I(Form("hPadMap_Ch_%i_Pc%i",iCh,iPc),Form("Pad Map of Ch: %i Pc: %i;Pad X;Pad Y;",iCh,iPc),80,0,80,48,0,48);
138 Add2RawsList(hPadMap[iPc+6*iCh],28+iPc+6*iCh);
139 hPadQ[iPc+6*iCh] = new TH1I(Form("hPadQ_Ch_%i_Pc%i",iCh,iPc),Form("Pad Charge of Ch: %i Pc: %i;Pad Q;Entries;",iCh,iPc),4100,0,4100);
140 Add2RawsList(hPadQ[iPc+6*iCh],70+iPc+6*iCh);
141 }//PC loop
142 }//Ch loop
143
04236e67 144}
ec575c20 145//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
04236e67 146void AliHMPIDQADataMakerRec::InitESDs()
147{
cc1abc7f 148 //
149 //Booking ESDs histograms
150 TH2F* hCkovP = new TH2F("CkovP" , "#theta_{c}, [rad];P, [GeV]" , 150, 0, 7 ,100, 0, 1) ;
151 TH2F* hSigP = new TH2F("SigP" ,"#sigma_{#theta_c} [mrad];[GeV]", 150, 0, 7 ,100, 0, 1) ;
cc1abc7f 152 TH2F* hDifXY = new TH2F("DifXY" ,"diff" , 200, -10, 10 ,200,-10,10) ;
7656d8ac 153 TH2F* hMvsP = new TH2F("MvsP","Reconstructed Mass vs P",60,0,6,1000,0,1) ;
cc1abc7f 154 TH1F* hPid[5];
155 hPid[0] = new TH1F("PidE" ,"electron response" , 101, -0.005,1.005) ;
156 hPid[1] = new TH1F("PidMu","#mu response" , 101, -0.005,1.005) ;
157 hPid[2] = new TH1F("PidPi","#pi response" , 101, -0.005,1.005) ;
158 hPid[3] = new TH1F("PidK" ,"K response" , 101, -0.005,1.005) ;
64f2781e 159 hPid[4] = new TH1F("PidP" ,"p response" , 101, -0.005,1.005) ;
cc1abc7f 160
ec575c20 161 Add2ESDsList(hCkovP,0);
162 Add2ESDsList(hSigP ,1);
163 Add2ESDsList(hDifXY,2);
164 Add2ESDsList(hMvsP,3);
165 for(Int_t i=0; i< 5; i++) Add2ESDsList(hPid[i],i+4);
7656d8ac 166
167
04236e67 168}
ec575c20 169//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
cc1abc7f 170void AliHMPIDQADataMakerRec::MakeRaws(AliRawReader *rawReader)
04236e67 171{
cc1abc7f 172//
173// Filling Raws QA histos
174//
175 AliHMPIDRawStream stream(rawReader);
176
aa21372e 177 fEvtRaw++;
178
cc1abc7f 179 while(stream.Next())
180 {
181 UInt_t ddl=stream.GetDDLNumber(); //returns 0,1,2 ... 13
64f2781e 182 if(ddl > 13) continue;
cc1abc7f 183 for(Int_t iErr =1; iErr<(Int_t)AliHMPIDRawStream::kSumErr; iErr++){
b38ac33a 184 Int_t numOfErr = stream.GetErrors(ddl,iErr);
aa21372e 185 GetRawsData(ddl)->Fill(iErr,numOfErr);
cc1abc7f 186 }
64f2781e 187 UInt_t word; Int_t Nddl, r, d, a;//pc,pcX,pcY;
aa21372e 188 for(Int_t iPad=0;iPad<stream.GetNPads();iPad++) {
64f2781e 189 AliHMPIDDigit dig(stream.GetPadArray()[iPad],stream.GetChargeArray()[iPad]);dig.Raw(word,Nddl,r,d,a);
aa21372e 190 GetRawsData(ddl+14)->Fill(r,d);
64f2781e 191 GetRawsData(28+stream.Pc(Nddl,r,d,a)+6*AliHMPIDParam::DDL2C(ddl))->Fill(stream.PadPcX(Nddl,r,d,a),stream.PadPcY(Nddl,r,d,a));
192 GetRawsData(70+stream.Pc(Nddl,r,d,a)+6*AliHMPIDParam::DDL2C(ddl))->Fill(stream.GetChargeArray()[iPad]);
193 }
cc1abc7f 194 }
195 stream.Delete();
aa21372e 196
cc1abc7f 197}
ec575c20 198//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
cc1abc7f 199void AliHMPIDQADataMakerRec::MakeRecPoints(TTree * clustersTree)
200{
201 //
202 //filling QA histos for clusters
203 //
7656d8ac 204 AliHMPIDParam *pPar =AliHMPIDParam::Instance();
c2df1ef0 205
206 static TClonesArray *clusters;
207 if(!clusters) clusters = new TClonesArray("AliHMPIDCluster");
208
aa21372e 209 for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){
210 TBranch *branch = clustersTree->GetBranch(Form("HMPID%d",iCh));
04236e67 211 branch->SetAddress(&clusters);
212 branch->GetEntry(0);
aa21372e 213 GetRecPointsData(0)->Fill(iCh,clusters->GetEntries());
04236e67 214 TIter next(clusters);
215 AliHMPIDCluster *clu;
cc1abc7f 216 while ( (clu = dynamic_cast<AliHMPIDCluster *>(next())) ) {
aa21372e 217 GetRecPointsData(1)->Fill(clu->Status(),iCh);
218 Int_t sect = pPar->InHVSector(clu->Y());
219 if(clu->Q()>100) GetRecPointsData(2+iCh)->Fill(clu->Size());
220 else {
221 GetRecPointsData(2+7+iCh)->Fill(clu->Size());
222 GetRecPointsData(2+14+iCh*6+sect)->Fill(clu->Q());
223 }
224 GetRecPointsData(2+14+42+iCh*6+sect)->Fill(clu->Q());
04236e67 225 }
226 }
227
c2df1ef0 228 clusters->Clear();
229
04236e67 230}
ec575c20 231//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
04236e67 232void AliHMPIDQADataMakerRec::MakeESDs(AliESDEvent * esd)
233{
cc1abc7f 234 //
04236e67 235 //fills QA histos for ESD
cc1abc7f 236 //
7656d8ac 237
04236e67 238 for(Int_t iTrk = 0 ; iTrk < esd->GetNumberOfTracks() ; iTrk++){
239 AliESDtrack *pTrk = esd->GetTrack(iTrk) ;
cc1abc7f 240 GetESDsData(0)->Fill(pTrk->GetP(),pTrk->GetHMPIDsignal());
241 GetESDsData(1)->Fill( pTrk->GetP(),TMath::Sqrt(pTrk->GetHMPIDchi2()));
04236e67 242 Float_t xm,ym; Int_t q,np;
243 pTrk->GetHMPIDmip(xm,ym,q,np); //mip info
04236e67 244 Float_t xRad,yRad,th,ph;
245 pTrk->GetHMPIDtrk(xRad,yRad,th,ph); //track info at the middle of the radiator
246 Float_t xPc = xRad+9.25*TMath::Tan(th)*TMath::Cos(ph); // temporar: linear extrapol (B=0!)
247 Float_t yPc = yRad+9.25*TMath::Tan(th)*TMath::Sin(ph); // temporar: "
7656d8ac 248 GetESDsData(2)->Fill(xm-xPc,ym-yPc); //track info
249 if(pTrk->GetHMPIDsignal()>0) {
250 Double_t a = 1.292*1.292*TMath::Cos(pTrk->GetHMPIDsignal())*TMath::Cos(pTrk->GetHMPIDsignal())-1.;
251 if(a > 0) {
252 Double_t mass = pTrk->P()*TMath::Sqrt(1.292*1.292*TMath::Cos(pTrk->GetHMPIDsignal())*TMath::Cos(pTrk->GetHMPIDsignal())-1.);
253 GetESDsData(3)->Fill( pTrk->GetP(),mass);
254 }
255 }
256 Double_t pid[5] ; pTrk->GetHMPIDpid(pid) ;
cc1abc7f 257 for(Int_t i = 0 ; i < 5 ; i++) GetESDsData(4+i)->Fill(pid[i]) ;
258 }
259}
ec575c20 260//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
cc1abc7f 261void AliHMPIDQADataMakerRec::StartOfDetectorCycle()
262{
263 //Detector specific actions at start of cycle
264
265}
ec575c20 266//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
cc1abc7f 267
aa21372e 268void AliHMPIDQADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray *histos)
cc1abc7f 269{
270 //Detector specific actions at end of cycle
271 // do the QA checking
7656d8ac 272 // AliQAChecker::Instance()->Run(AliQA::kHMPID, task, obj);
aa21372e 273
274 if(task==AliQA::kRAWS) {
275 for(Int_t iddl=0;iddl<14;iddl++) {
276 TH1F *h = (TH1F*)histos->At(14+iddl); //ddl histos scaled by the number of events
277 h->Scale(1./(Float_t)fEvtRaw);
278 }
279 }
04236e67 280}
281