Updated error definitions.
[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
19//---
20// Produces the data needed to calculate the quality assurance.
21// All data must be mergeable objects.
22// A. Mastroserio
23//---
24
25// --- ROOT system ---
26#include <TClonesArray.h>
27#include <TFile.h>
28#include <TH1F.h>
29#include <TH2F.h>
30#include <TH1I.h>
31#include <TDirectory.h>
32#include <Riostream.h>
33// --- Standard library ---
34
35// --- AliRoot header files ---
36#include "AliESDCaloCluster.h"
37#include "AliESDEvent.h"
38#include "AliLog.h"
39#include "AliHMPIDDigit.h"
40#include "AliHMPIDHit.h"
41#include "AliHMPIDCluster.h"
42#include "AliHMPIDQADataMakerRec.h"
43
44ClassImp(AliHMPIDQADataMakerRec)
45
46//____________________________________________________________________________
47 AliHMPIDQADataMakerRec::AliHMPIDQADataMakerRec() :
48 AliQADataMakerRec(AliQA::GetDetName(AliQA::kHMPID), "HMPID Quality Assurance Data Maker"),
49// fhHitQdc(0x0),
50// fhSDigits(0x0),
51// fhDigPcEvt(0x0),
52// fhDigChEvt(0x0),
53// fhDigQ(0x0),
54// fhCluEvt(0x0),
55// fhCluChi2(0x0),
56// fhCluQ(0x0),
57 fhCluFlg(0x0),
58 fhCluSize(0x0),
59 fhMipCluSize(0x0),
60 fhCkovP(0x0),
61 fhSigP(0x0),
62 fhMipXY(0x0),
63 fhDifXY(0x0)
64{
65 // ctor
66// for(Int_t i=0; i<7; i++) fhHitMap[i]=0x0;
67 for(Int_t j=0; j<5; j++) fhPid[j]=0x0;
68// fDetectorDir = fOutput->GetDirectory(GetName()) ;
69// if (!fDetectorDir)
70// fDetectorDir = fOutput->mkdir(GetName()) ;
71}
72
73//____________________________________________________________________________
74AliHMPIDQADataMakerRec::AliHMPIDQADataMakerRec(const AliHMPIDQADataMakerRec& qadm) :
75 AliQADataMakerRec(),
76 // fhHitQdc(qadm.fhHitQdc),
77// fhSDigits(qadm.fhSDigits),
78// fhDigPcEvt(qadm.fhDigPcEvt),
79// fhDigChEvt(qadm.fhDigChEvt),
80// fhDigQ(qadm.fhDigQ),
81 fhCluEvt(qadm.fhCluEvt),
82 fhCluChi2(qadm.fhCluChi2),
83 fhCluQ(qadm.fhCluQ),
84 fhCluFlg(qadm.fhCluFlg),
85 fhCluSize(qadm.fhCluSize),
86 fhMipCluSize(qadm.fhMipCluSize),
87 fhCkovP(qadm.fhCkovP),
88 fhSigP(qadm.fhSigP),
89 fhMipXY(qadm.fhMipXY),
90 fhDifXY(qadm.fhDifXY)
91{
92 //copy ctor
93// for(Int_t i=0; i<7; i++) fhHitMap[i]=qadm.fhHitMap[i];
94 for(Int_t j=0; j<5; j++) fhPid[j]=qadm.fhPid[j];
95
96 SetName((const char*)qadm.GetName()) ;
97 SetTitle((const char*)qadm.GetTitle());
98}
99
100//__________________________________________________________________
101AliHMPIDQADataMakerRec& AliHMPIDQADataMakerRec::operator = (const AliHMPIDQADataMakerRec& qadm )
102{
103 // Equal operator.
104 this->~AliHMPIDQADataMakerRec();
105 new(this) AliHMPIDQADataMakerRec(qadm);
106 return *this;
107}
108
109//____________________________________________________________________________
110
111void AliHMPIDQADataMakerRec::InitRecPoints()
112{
113 // create cluster histograms in RecPoint subdir
114 fhCluEvt=new TH1F("CluPerEvt","# clusters per chamber",16,-1,7);
115 fhCluChi2 =new TH1F("CluChi2" ,"Chi2 " ,1000,0,100);
116 fhCluQ =new TH1F("CluQ" ,"Cluster charge" ,3000,0,3000);
117 fhCluFlg =new TH1F("CluFlg" ,"Cluster flag" ,14,-1.5,12.5);
118 fhCluSize =new TH1F("CluSize" ,"Raw cluster size ",100,0,100);
119 fhMipCluSize =new TH1F("MipCluSize" ,"Mip cluster size ",100,0,100);
120}
121//____________________________________________________________________________
122void AliHMPIDQADataMakerRec::InitESDs()
123{
124 //create ESDs histograms in ESDs subdir
125 fhCkovP = new TH2F("CkovP" , "#theta_{c}, [rad];P, [GeV]" , 150, 0, 7 ,100, 0, 1) ;
126 fhSigP = new TH2F("SigP" ,"#sigma_{#theta_c} [mrad];[GeV]", 150, 0, 7 ,100, 0, 1) ;
127 fhMipXY = new TH2F("MipXY" ,"mip position" , 260, 0,130 ,252, 0,126) ;
128 fhDifXY = new TH2F("DifXY" ,"diff" , 200, -10, 10 ,200,-10,10) ;
129 fhPid[0] = new TH1F("PidE" ,"PID: e yellow #mu magenta" ,100,0,1) ;
130 fhPid[1] = new TH1F("PidMu","pid of #mu" ,100,0,1) ;
131 fhPid[2] = new TH1F("PidPi","PID: #pi red K green p blue",100,0,1) ;
132 fhPid[3] = new TH1F("PidK" ,"pid of K" ,100,0,1) ;
133 fhPid[4] = new TH1F("PidP" ,"pid of p" ,100,0,1) ;
134}
135
136//____________________________________________________________________________
137void AliHMPIDQADataMakerRec::MakeRecPoints(TTree * clustersTree)
138{
139 //fills QA histos for clusters
140
141 TClonesArray *clusters = new TClonesArray("AliHMPIDCluster");
142 for(int i=AliHMPIDParam::kMinCh;i<=AliHMPIDParam::kMaxCh;i++){
143 TBranch *branch = clustersTree->GetBranch(Form("HMPID%d",i));
144 branch->SetAddress(&clusters);
145 branch->GetEntry(0);
146
147 fhCluEvt->Fill(i,clusters->GetEntries());
148 TIter next(clusters);
149 AliHMPIDCluster *clu;
150 while ( (clu = dynamic_cast<AliHMPIDCluster *>(next())) ) {;
151 fhCluFlg->Fill(clu->Status()); fhCluChi2->Fill(clu->Chi2()); fhCluSize->Fill(clu->Size());
152 fhCluQ->Fill(clu->Q());
153 Int_t qCut=100;
154 if(clu->Q()>qCut) {
155 fhMipCluSize->SetTitle(Form("Mip cluster size at a Qcut = %i ADC",qCut));
156 fhMipCluSize->Fill(clu->Size());
157 }
158 }
159 }
160
161 clusters->Delete();
162 delete clusters;
163}
164
165//____________________________________________________________________________
166void AliHMPIDQADataMakerRec::MakeESDs(AliESDEvent * esd)
167{
168 //fills QA histos for ESD
169 for(Int_t iTrk = 0 ; iTrk < esd->GetNumberOfTracks() ; iTrk++){
170 AliESDtrack *pTrk = esd->GetTrack(iTrk) ;
171 fhCkovP->Fill(pTrk->GetP(),pTrk->GetHMPIDsignal());
172 fhSigP->Fill( pTrk->GetP(),TMath::Sqrt(pTrk->GetHMPIDchi2()));
173 Float_t xm,ym; Int_t q,np;
174 pTrk->GetHMPIDmip(xm,ym,q,np); //mip info
175 fhMipXY->Fill(xm,ym);
176 Float_t xRad,yRad,th,ph;
177 pTrk->GetHMPIDtrk(xRad,yRad,th,ph); //track info at the middle of the radiator
178 Float_t xPc = xRad+9.25*TMath::Tan(th)*TMath::Cos(ph); // temporar: linear extrapol (B=0!)
179 Float_t yPc = yRad+9.25*TMath::Tan(th)*TMath::Sin(ph); // temporar: "
180 fhDifXY->Fill(xm-xPc,ym-yPc); //track info
181 Double_t pid[5] ; pTrk->GetHMPIDpid(pid) ;
182 for(Int_t i = 0 ; i < 5 ; i++) fhPid[i]->Fill(pid[i]) ;
183 }
184}
185