]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HMPID/AliHMPIDQADataMakerSim.cxx
Splitting of the QA maker into simulation and reconstruction dependent parts (Yves)
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDQADataMakerSim.cxx
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 "AliLog.h"
37 #include "AliHMPIDDigit.h"
38 #include "AliHMPIDHit.h"
39 #include "AliHMPIDQADataMakerSim.h"
40
41 ClassImp(AliHMPIDQADataMakerSim)
42            
43 //____________________________________________________________________________ 
44   AliHMPIDQADataMakerSim::AliHMPIDQADataMakerSim() : 
45   AliQADataMakerSim(AliQA::GetDetName(AliQA::kHMPID), "HMPID Quality Assurance Data Maker"),
46   fhHitQdc(0x0), 
47   fhSDigits(0x0),
48   fhDigPcEvt(0x0),
49   fhDigChEvt(0x0),
50   fhDigQ(0x0)
51  // fhCluEvt(0x0),
52 //  fhCluChi2(0x0),
53 //  fhCluQ(0x0),
54 //  fhCluFlg(0x0), 
55 //  fhCluSize(0x0),  
56 //  fhMipCluSize(0x0),
57 //  fhCkovP(0x0),
58 //  fhSigP(0x0),
59 //  fhMipXY(0x0),
60 //  fhDifXY(0x0)
61 {
62   // ctor
63   for(Int_t i=0; i<7; i++) fhHitMap[i]=0x0;
64 //  for(Int_t j=0; j<5; j++) fhPid[j]=0x0;
65 //   fDetectorDir = fOutput->GetDirectory(GetName()) ;  
66 //   if (!fDetectorDir) 
67 //     fDetectorDir = fOutput->mkdir(GetName()) ;  
68 }
69
70 //____________________________________________________________________________ 
71 AliHMPIDQADataMakerSim::AliHMPIDQADataMakerSim(const AliHMPIDQADataMakerSim& qadm) :
72   AliQADataMakerSim(), 
73   fhHitQdc(qadm.fhHitQdc), 
74   fhSDigits(qadm.fhSDigits),
75   fhDigPcEvt(qadm.fhDigPcEvt),
76   fhDigChEvt(qadm.fhDigChEvt),
77   fhDigQ(qadm.fhDigQ)
78 //  fhCluEvt(qadm.fhCluEvt),
79 //  fhCluChi2(qadm.fhCluChi2),
80 //  fhCluQ(qadm.fhCluQ),
81 //  fhCluFlg(qadm.fhCluFlg),
82 //  fhCluSize(qadm.fhCluSize),
83 //  fhMipCluSize(qadm.fhMipCluSize),
84 //  fhCkovP(qadm.fhCkovP),
85 //  fhSigP(qadm.fhSigP),
86 //  fhMipXY(qadm.fhMipXY),
87 //  fhDifXY(qadm.fhDifXY)
88 {
89   //copy ctor 
90   for(Int_t i=0; i<7; i++) fhHitMap[i]=qadm.fhHitMap[i];
91 //  for(Int_t j=0; j<5; j++) fhPid[j]=qadm.fhPid[j];
92
93   SetName((const char*)qadm.GetName()) ; 
94   SetTitle((const char*)qadm.GetTitle()); 
95 }
96
97 //__________________________________________________________________
98 AliHMPIDQADataMakerSim& AliHMPIDQADataMakerSim::operator = (const AliHMPIDQADataMakerSim& qadm )
99 {
100   // Equal operator.
101   this->~AliHMPIDQADataMakerSim();
102   new(this) AliHMPIDQADataMakerSim(qadm);
103   return *this;
104 }
105  
106 //____________________________________________________________________________ 
107 void AliHMPIDQADataMakerSim::InitHits()
108 {
109   // create Hits histograms in Hits subdir
110      fhHitQdc=new TH1F("HitQdc","HMPID Hit Qdc all chamber;QDC",500,0,4000);
111      for(Int_t iCh=0;iCh<7;iCh++) 
112                  fhHitMap[iCh]=new TH2F(Form("HMPID HitMap%i",iCh),Form("Ch%i;x_{Hit};y_{Hit}",iCh),162,-1,161,146,-1,145);   
113 }
114
115 //____________________________________________________________________________ 
116 void AliHMPIDQADataMakerSim::InitDigits()
117 {
118   // create Digits histograms in Digits subdir
119       fhDigPcEvt=new TH1F("hDigPcEvt","PC occupancy",156,-1,77);
120       fhDigChEvt=new TH1F("hDigChEvt","Chamber occupancy",32,-1,7);
121       fhDigQ  =new TH1F("Q        "," digit charge               ",3000,0,3000);
122 }
123
124 //____________________________________________________________________________ 
125 void AliHMPIDQADataMakerSim::InitSDigits()
126 {
127   // create SDigits histograms in SDigits subdir
128       fhSDigits     = new TH1F("hHmpidSDigits",    "SDigits Q  distribution in HMPID",  500, 0., 5000.) ; 
129 }
130
131 //____________________________________________________________________________
132 void AliHMPIDQADataMakerSim::MakeHits(TObject * data)
133 {
134   //fills QA histos for Hits
135   TClonesArray * hits = dynamic_cast<TClonesArray *>(data) ; 
136   if (!hits){
137     AliError("Wrong type of hits container") ; 
138   } else {
139     TIter next(hits); 
140     AliHMPIDHit * hit ; 
141     while ( (hit = dynamic_cast<AliHMPIDHit *>(next())) ) {
142       if(hit->Pid()<500000) fhHitQdc->Fill(hit->Q()) ;
143       if(hit->Pid()<500000) fhHitMap[hit->Ch()]->Fill(hit->LorsX(),hit->LorsY());
144     }
145   } 
146 }
147
148 //____________________________________________________________________________
149 void AliHMPIDQADataMakerSim::MakeDigits( TObject * data)
150 {
151   //fills QA histos for Digits
152   TObjArray *chambers = dynamic_cast<TObjArray*>(data);
153   if ( !chambers) {
154     AliError("Wrong type of digits container") ; 
155   } else {
156     for(Int_t i =0; i< chambers->GetEntries(); i++)
157       {
158         TClonesArray * digits = dynamic_cast<TClonesArray*>(chambers->At(i)); 
159         fhDigChEvt->Fill(i,digits->GetEntriesFast()/(48.*80.*6.));
160         TIter next(digits); 
161         AliHMPIDDigit * digit; 
162         while ( (digit = dynamic_cast<AliHMPIDDigit *>(next())) ) {
163           fhDigPcEvt->Fill(10.*i+digit->Pc(),1./(48.*80.));
164           fhDigQ->Fill(digit->Q());
165         }  
166       }
167   }
168 }
169
170 //____________________________________________________________________________
171 void AliHMPIDQADataMakerSim::MakeSDigits( TObject * data)
172 {
173   //fills QA histos for SDigits
174   TClonesArray * sdigits = dynamic_cast<TClonesArray *>(data) ; 
175   if (!sdigits) {
176     AliError("Wrong type of sdigits container") ; 
177   } else {
178     AliHMPIDDigit *ref = (AliHMPIDDigit *)sdigits->At(0);
179     Float_t zero = ref->GetTrack(0); 
180     TIter next(sdigits) ; 
181     AliHMPIDDigit * sdigit ; 
182     while ( (sdigit = dynamic_cast<AliHMPIDDigit *>(next())) ) {
183       fhSDigits->Fill(sdigit->Q()) ;
184       if(zero == sdigit->GetTrack(0)) continue;
185       else zero = sdigit->GetTrack(0);
186     } 
187   }
188 }