]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HMPID/AliHMPIDQADataMakerSim.cxx
Remove verbosity
[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 // --- ROOT system ---
20 #include <TClonesArray.h>
21 #include <TFile.h> 
22 #include <TH1F.h> 
23 #include <TH2F.h>
24 #include <TProfile.h>
25 #include <Riostream.h>
26 // --- Standard library ---
27
28 // --- AliRoot header files ---
29 #include "AliESDCaloCluster.h"
30 #include "AliESDEvent.h"
31 #include "AliQAChecker.h"
32 #include "AliLog.h"
33 #include "AliHMPIDDigit.h"
34 #include "AliHMPIDHit.h"
35 #include "AliHMPIDCluster.h"
36 #include "AliHMPIDQADataMakerSim.h"
37 #include "AliHMPIDParam.h"
38 #include "AliHMPIDRawStream.h"
39 #include "AliLog.h"
40 ClassImp(AliHMPIDQADataMakerSim)
41            
42 //____________________________________________________________________________ 
43   AliHMPIDQADataMakerSim::AliHMPIDQADataMakerSim() : 
44   AliQADataMakerSim(AliQA::GetDetName(AliQA::kHMPID), "HMPID Quality Assurance Data Maker")
45 {
46   // ctor
47 }
48
49 //____________________________________________________________________________ 
50 AliHMPIDQADataMakerSim::AliHMPIDQADataMakerSim(const AliHMPIDQADataMakerSim& qadm) :
51   AliQADataMakerSim() 
52 {
53   //copy ctor 
54   SetName((const char*)qadm.GetName()) ; 
55   SetTitle((const char*)qadm.GetTitle()); 
56 }
57
58 //__________________________________________________________________
59 AliHMPIDQADataMakerSim& AliHMPIDQADataMakerSim::operator = (const AliHMPIDQADataMakerSim& qadm )
60 {
61   // Equal operator.
62   this->~AliHMPIDQADataMakerSim();
63   new(this) AliHMPIDQADataMakerSim(qadm);
64   return *this;
65 }
66  
67 //____________________________________________________________________________ 
68 void AliHMPIDQADataMakerSim::InitHits()
69 {
70   // create Hits histograms in Hits subdir
71      TH1F *hHitQdc=new TH1F("HitQdc","HMPID Hit Qdc all chamber;QDC",500,0,4000);
72      Add2HitsList(hHitQdc,0);
73      TH2F *hHitMap[7];
74      for(Int_t iCh=0;iCh<7;iCh++) {
75      hHitMap[iCh]=new TH2F(Form("HMPID HitMap%i",iCh),Form("Ch%i;x_{Hit};y_{Hit}",iCh),162,-1,161,146,-1,145);   
76     Add2HitsList(hHitMap[iCh],iCh+1);
77     }
78
79 }
80
81 //____________________________________________________________________________ 
82 void AliHMPIDQADataMakerSim::InitDigits()
83 {
84   // create Digits histograms in Digits subdir
85       TH1F *hDigPcEvt = new TH1F("hDigPcEvt","PC occupancy",156,-1,77);
86       TH1F *hDigQ     = new TH1F("Q        ","Charge of digits (ADC)     ",3000,0,3000);
87       TH1F *hDigChEvt = new TH1F("hDigChEvt","Chamber occupancy per event",AliHMPIDParam::kMaxCh+1,AliHMPIDParam::kMinCh,AliHMPIDParam::kMaxCh+1);
88
89       TProfile *tDigHighQ = new TProfile("tDigHighQ","Highest charge in chamber  ",AliHMPIDParam::kMaxCh+1,AliHMPIDParam::kMinCh,AliHMPIDParam::kMaxCh+1);
90       TProfile *tDigChEvt = new TProfile("tDigChEvt","Chamber occupancy per event (profile)",AliHMPIDParam::kMaxCh+1,AliHMPIDParam::kMinCh,AliHMPIDParam::kMaxCh+1);
91
92 Add2DigitsList(hDigPcEvt,0);
93 Add2DigitsList(hDigQ    ,1);
94 Add2DigitsList(hDigChEvt,2);
95 Add2DigitsList(tDigHighQ,3);
96 Add2DigitsList(tDigChEvt,4);
97 }
98
99 //____________________________________________________________________________ 
100 void AliHMPIDQADataMakerSim::InitSDigits()
101 {
102   // create SDigits histograms in SDigits subdir
103    TH1F   *hSDigits     = new TH1F("hHmpidSDigits",    "SDigits Q  distribution in HMPID",  500, 0., 5000.) ; 
104
105 Add2SDigitsList(hSDigits,0);
106 }
107
108 //____________________________________________________________________________ 
109
110 void AliHMPIDQADataMakerSim::MakeHits(TClonesArray * data)
111 {
112  //
113  //filling QA histos for Hits
114  //
115   TClonesArray * hits = dynamic_cast<TClonesArray *>(data) ; 
116   if (!hits){
117     AliError("Wrong type of hits container") ; 
118   } else {
119     TIter next(hits); 
120     AliHMPIDHit * hit ; 
121     while ( (hit = dynamic_cast<AliHMPIDHit *>(next())) ) {
122       if(hit->Pid()<500000) GetHitsData(0)->Fill(hit->Q()) ;
123       if(hit->Pid()<500000) GetHitsData(hit->Ch()+1)->Fill(hit->LorsX(),hit->LorsY());
124     }
125   } 
126
127 }
128 //___________________________________________________________________________
129 void AliHMPIDQADataMakerSim::MakeHits(TTree * data)
130 {
131 //
132 //Opening of the Hit TTree 
133 //
134  TClonesArray *pHits=new TClonesArray("AliHMPIDHit");  data->SetBranchAddress("HMPID",&pHits);
135   for(Int_t iEnt=0;iEnt<data->GetEntriesFast();iEnt++){//entries loop
136     data->GetEntry(iEnt);
137     MakeHits(pHits);
138   }//entries loop
139 }
140 //____________________________________________________________________________
141 void AliHMPIDQADataMakerSim::MakeDigits(TClonesArray * data)
142 {
143  //
144  //filling QA histos for Digits
145  //
146   TObjArray *chamber = dynamic_cast<TObjArray*>(data);
147   if ( !chamber) {
148     AliError("Wrong type of digits container") ; 
149   } else {
150     for(Int_t i =0; i< chamber->GetEntries(); i++)
151       {
152         TClonesArray * digits = dynamic_cast<TClonesArray*>(chamber->At(i)); 
153         GetDigitsData(2)->Fill(i,digits->GetEntriesFast()/(48.*80.*6.));
154         GetDigitsData(4)->Fill(i,digits->GetEntriesFast()/(48.*80.*6.));
155         Double_t highQ=0;
156         TIter next(digits); 
157         AliHMPIDDigit * digit; 
158         while ( (digit = dynamic_cast<AliHMPIDDigit *>(next())) ) {
159           GetDigitsData(0)->Fill(10.*i+digit->Pc(),1./(48.*80.));
160           GetDigitsData(1)->Fill(digit->Q());
161           if(digit->Q()>highQ) highQ = digit->Q();
162         }  
163       GetDigitsData(3)->Fill(i,highQ);
164  
165       }
166   }
167 }
168 //___________________________________________________________________________
169 void AliHMPIDQADataMakerSim::MakeDigits(TTree * data)
170 {
171 //
172 //Opening the Digit Tree
173 //
174  TObjArray *pObjDig=new TObjArray(AliHMPIDParam::kMaxCh+1);
175   for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){
176     TClonesArray *pCA=new TClonesArray("AliHMPIDDigit");
177     pObjDig->AddAt(pCA,iCh);
178   }
179
180   pObjDig->SetOwner(kTRUE);
181
182   for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){
183     data->SetBranchAddress(Form("HMPID%i",iCh),&(*pObjDig)[iCh]);
184   }
185   data->GetEntry(0);
186
187    MakeDigits((TClonesArray *)pObjDig);
188 }
189 //____________________________________________________________________________
190
191 void AliHMPIDQADataMakerSim::MakeSDigits(TClonesArray * data)
192 {
193  //
194  //filling QA histos for SDigits
195  //
196   TClonesArray * sdigits = dynamic_cast<TClonesArray *>(data) ; 
197   if (!sdigits) {
198     AliError("Wrong type of sdigits container") ; 
199   } else {
200     TIter next(sdigits) ; 
201     AliHMPIDDigit * sdigit ; 
202     while ( (sdigit = dynamic_cast<AliHMPIDDigit *>(next())) ) {
203             GetSDigitsData(0)->Fill(sdigit->Q());
204     } 
205   }
206 }
207 //___________________________________________________________________________
208 void AliHMPIDQADataMakerSim::MakeSDigits(TTree * data)
209 {
210  //
211  // Opening the SDigit Tree
212  //
213  TClonesArray * sdigits = new TClonesArray("AliHMPIDDigit", 1000) ;
214
215   TBranch * branch = data->GetBranch("HMPID") ;
216   if ( ! branch ) {
217     AliError("HMPID SDigit Tree not found") ;
218     return;
219   }
220   branch->SetAddress(&sdigits) ;
221   branch->GetEntry(0) ;
222   MakeSDigits(sdigits) ;
223 }
224 //____________________________________________________________________________
225 void AliHMPIDQADataMakerSim::StartOfDetectorCycle()
226 {
227   //Detector specific actions at start of cycle
228   
229 }
230
231 void AliHMPIDQADataMakerSim::EndOfDetectorCycle(AliQA::TASKINDEX, TObjArray *)
232 {
233   //Detector specific actions at end of cycle
234   // do the QA checking
235 //  AliQAChecker::Instance()->Run(AliQA::kHMPID, task, obj) ;  
236 }
237