]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HMPID/AliHMPIDQADataMakerSim.cxx
Better error monitoring. Pedestal structure updated. Set the sigma cut from a file...
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDQADataMakerSim.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>
cc1abc7f 24#include <TProfile.h>
04236e67 25#include <Riostream.h>
26// --- Standard library ---
27
28// --- AliRoot header files ---
cc1abc7f 29#include "AliESDCaloCluster.h"
30#include "AliESDEvent.h"
31#include "AliQAChecker.h"
04236e67 32#include "AliLog.h"
33#include "AliHMPIDDigit.h"
34#include "AliHMPIDHit.h"
cc1abc7f 35#include "AliHMPIDCluster.h"
04236e67 36#include "AliHMPIDQADataMakerSim.h"
cc1abc7f 37#include "AliHMPIDParam.h"
38#include "AliHMPIDRawStream.h"
39#include "AliLog.h"
04236e67 40ClassImp(AliHMPIDQADataMakerSim)
41
42//____________________________________________________________________________
43 AliHMPIDQADataMakerSim::AliHMPIDQADataMakerSim() :
cc1abc7f 44 AliQADataMakerSim(AliQA::GetDetName(AliQA::kHMPID), "HMPID Quality Assurance Data Maker")
04236e67 45{
46 // ctor
04236e67 47}
48
49//____________________________________________________________________________
50AliHMPIDQADataMakerSim::AliHMPIDQADataMakerSim(const AliHMPIDQADataMakerSim& qadm) :
cc1abc7f 51 AliQADataMakerSim()
04236e67 52{
53 //copy ctor
04236e67 54 SetName((const char*)qadm.GetName()) ;
55 SetTitle((const char*)qadm.GetTitle());
56}
57
58//__________________________________________________________________
59AliHMPIDQADataMakerSim& AliHMPIDQADataMakerSim::operator = (const AliHMPIDQADataMakerSim& qadm )
60{
61 // Equal operator.
62 this->~AliHMPIDQADataMakerSim();
63 new(this) AliHMPIDQADataMakerSim(qadm);
64 return *this;
65}
66
67//____________________________________________________________________________
68void AliHMPIDQADataMakerSim::InitHits()
69{
70 // create Hits histograms in Hits subdir
cc1abc7f 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
04236e67 79}
80
81//____________________________________________________________________________
82void AliHMPIDQADataMakerSim::InitDigits()
83{
84 // create Digits histograms in Digits subdir
cc1abc7f 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
92Add2DigitsList(hDigPcEvt,0);
93Add2DigitsList(hDigQ ,1);
94Add2DigitsList(hDigChEvt,2);
95Add2DigitsList(tDigHighQ,3);
96Add2DigitsList(tDigChEvt,4);
04236e67 97}
98
99//____________________________________________________________________________
100void AliHMPIDQADataMakerSim::InitSDigits()
101{
102 // create SDigits histograms in SDigits subdir
cc1abc7f 103 TH1F *hSDigits = new TH1F("hHmpidSDigits", "SDigits Q distribution in HMPID", 500, 0., 5000.) ;
104
105Add2SDigitsList(hSDigits,0);
04236e67 106}
107
cc1abc7f 108//____________________________________________________________________________
109
110void AliHMPIDQADataMakerSim::MakeHits(TClonesArray * data)
04236e67 111{
cc1abc7f 112 //
113 //filling QA histos for Hits
114 //
04236e67 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())) ) {
cc1abc7f 122 if(hit->Pid()<500000) GetHitsData(0)->Fill(hit->Q()) ;
123 if(hit->Pid()<500000) GetHitsData(hit->Ch()+1)->Fill(hit->LorsX(),hit->LorsY());
04236e67 124 }
125 }
04236e67 126
cc1abc7f 127}
128//___________________________________________________________________________
129void 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}
04236e67 140//____________________________________________________________________________
cc1abc7f 141void AliHMPIDQADataMakerSim::MakeDigits(TClonesArray * data)
04236e67 142{
cc1abc7f 143 //
144 //filling QA histos for Digits
145 //
146 TObjArray *chamber = dynamic_cast<TObjArray*>(data);
147 if ( !chamber) {
04236e67 148 AliError("Wrong type of digits container") ;
149 } else {
cc1abc7f 150 for(Int_t i =0; i< chamber->GetEntries(); i++)
04236e67 151 {
cc1abc7f 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;
04236e67 156 TIter next(digits);
157 AliHMPIDDigit * digit;
158 while ( (digit = dynamic_cast<AliHMPIDDigit *>(next())) ) {
cc1abc7f 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();
04236e67 162 }
cc1abc7f 163 GetDigitsData(3)->Fill(i,highQ);
164
04236e67 165 }
166 }
167}
cc1abc7f 168//___________________________________________________________________________
169void 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);
04236e67 181
cc1abc7f 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}
04236e67 189//____________________________________________________________________________
cc1abc7f 190
191void AliHMPIDQADataMakerSim::MakeSDigits(TClonesArray * data)
04236e67 192{
cc1abc7f 193 //
194 //filling QA histos for SDigits
195 //
04236e67 196 TClonesArray * sdigits = dynamic_cast<TClonesArray *>(data) ;
197 if (!sdigits) {
198 AliError("Wrong type of sdigits container") ;
199 } else {
04236e67 200 TIter next(sdigits) ;
201 AliHMPIDDigit * sdigit ;
202 while ( (sdigit = dynamic_cast<AliHMPIDDigit *>(next())) ) {
cc1abc7f 203 GetSDigitsData(0)->Fill(sdigit->Q());
04236e67 204 }
205 }
206}
cc1abc7f 207//___________________________________________________________________________
208void 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//____________________________________________________________________________
225void AliHMPIDQADataMakerSim::StartOfDetectorCycle()
226{
227 //Detector specific actions at start of cycle
228
229}
230
231void 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