]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PHOS/AliPHOSQADataMakerSim.cxx
Make and print an image of QA user flagged histograms (Yves)
[u/mrichter/AliRoot.git] / PHOS / AliPHOSQADataMakerSim.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 Y. Schutz CERN July 2007
23*/
24
25// --- ROOT system ---
26#include <TClonesArray.h>
27#include <TFile.h>
28#include <TH1F.h>
29#include <TH1I.h>
30#include <TH2F.h>
31#include <TTree.h>
32
33// --- Standard library ---
34
35// --- AliRoot header files ---
36#include "AliESDCaloCluster.h"
37#include "AliLog.h"
38#include "AliPHOSDigit.h"
39#include "AliPHOSHit.h"
40#include "AliPHOSQADataMakerSim.h"
41#include "AliQAChecker.h"
42
43ClassImp(AliPHOSQADataMakerSim)
44
45//____________________________________________________________________________
8d8258f6 46AliPHOSQADataMakerSim::AliPHOSQADataMakerSim() :
4e25ac79 47 AliQADataMakerSim(AliQAv1::GetDetName(AliQAv1::kPHOS), "PHOS Quality Assurance Data Maker"),
8d8258f6 48 fHits(0x0)
04236e67 49{
50 // ctor
8d8258f6 51 fHits = new TClonesArray("AliPHOSHit", 1000);
04236e67 52}
53
54//____________________________________________________________________________
55AliPHOSQADataMakerSim::AliPHOSQADataMakerSim(const AliPHOSQADataMakerSim& qadm) :
8d8258f6 56 AliQADataMakerSim(),
57 fHits(0x0)
04236e67 58{
59 //copy ctor
60 SetName((const char*)qadm.GetName()) ;
61 SetTitle((const char*)qadm.GetTitle());
8d8258f6 62 fHits = new TClonesArray("AliPHOSHit", 1000);
04236e67 63}
64
65//__________________________________________________________________
66AliPHOSQADataMakerSim& AliPHOSQADataMakerSim::operator = (const AliPHOSQADataMakerSim& qadm )
67{
68 // Assign operator.
69 this->~AliPHOSQADataMakerSim();
70 new(this) AliPHOSQADataMakerSim(qadm);
71 return *this;
72}
73
74//____________________________________________________________________________
4e25ac79 75void AliPHOSQADataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
04236e67 76{
77 //Detector specific actions at end of cycle
78 // do the QA checking
4e25ac79 79 AliQAChecker::Instance()->Run(AliQAv1::kPHOS, task, list) ;
04236e67 80}
81
82//____________________________________________________________________________
83void AliPHOSQADataMakerSim::InitHits()
84{
85 // create Hits histograms in Hits subdir
7d297381 86 const Bool_t expert = kTRUE ;
87 const Bool_t image = kTRUE ;
04236e67 88 TH1F * h0 = new TH1F("hPhosHits", "Hits energy distribution in PHOS", 100, 0., 100.) ;
89 h0->Sumw2() ;
7d297381 90 Add2HitsList(h0, kHits, !expert, image) ;
8d8258f6 91 TH1I * h1 = new TH1I("hPhosHitsMul", "Hits multiplicity distribution in PHOS", 500, 0., 10000) ;
04236e67 92 h1->Sumw2() ;
7d297381 93 Add2HitsList(h1, kHitsMul, !expert, image) ;
57acd2d2 94
04236e67 95}
96
97//____________________________________________________________________________
98void AliPHOSQADataMakerSim::InitDigits()
99{
100 // create Digits histograms in Digits subdir
7d297381 101 const Bool_t expert = kTRUE ;
102 const Bool_t image = kTRUE ;
5997244b 103 TH1I * h0 = new TH1I("hPhosDigits", "Digits amplitude distribution in PHOS", 500, 0, 1000) ;
04236e67 104 h0->Sumw2() ;
7d297381 105 Add2DigitsList(h0, kDigits, !expert, image) ;
5997244b 106 TH1I * h1 = new TH1I("hPhosDigitsMul", "Digits multiplicity distribution in PHOS", 2000, 0, 10000) ;
04236e67 107 h1->Sumw2() ;
7d297381 108 Add2DigitsList(h1, kDigitsMul, !expert, image) ;
04236e67 109}
110
111//____________________________________________________________________________
112void AliPHOSQADataMakerSim::InitSDigits()
113{
114 // create SDigits histograms in SDigits subdir
7d297381 115 const Bool_t expert = kTRUE ;
116 const Bool_t image = kTRUE ;
5997244b 117 TH1F * h0 = new TH1F("hPhosSDigits", "SDigits energy distribution in PHOS", 500, 0., 1000.) ;
04236e67 118 h0->Sumw2() ;
7d297381 119 Add2SDigitsList(h0, kSDigits, !expert, image) ;
5997244b 120 TH1I * h1 = new TH1I("hPhosSDigitsMul", "SDigits multiplicity distribution in PHOS", 500, 0, 1000) ;
04236e67 121 h1->Sumw2() ;
7d297381 122 Add2SDigitsList(h1, kSDigitsMul, !expert, image) ;
04236e67 123}
124
125//____________________________________________________________________________
8d8258f6 126void AliPHOSQADataMakerSim::MakeHits()
04236e67 127{
8d8258f6 128 //make QA data from Hits
129
130 TIter next(fHits) ;
131 AliPHOSHit * hit ;
132 while ( (hit = dynamic_cast<AliPHOSHit *>(next())) ) {
57acd2d2 133 GetHitsData(kHits)->Fill( hit->GetEnergy()) ;
8d8258f6 134 }
04236e67 135}
136
137//____________________________________________________________________________
138void AliPHOSQADataMakerSim::MakeHits(TTree * hitTree)
139{
8d8258f6 140 // make QA data from Hit Tree
141
142 TBranch * branch = hitTree->GetBranch("PHOS") ;
143 if ( ! branch ) {
144 AliWarning("PHOS branch in Hit Tree not found") ;
145 } else {
146 Int_t nHits = 0;
147 branch->SetAddress(&fHits) ;
148 for (Int_t ientry = 0 ; ientry < branch->GetEntries() ; ientry++) {
149 branch->GetEntry(ientry) ;
150 nHits += fHits->GetEntriesFast();
151 MakeHits() ;
152 fHits->Clear();
153 }
154 GetHitsData(1)->Fill(nHits) ;
155 }
04236e67 156}
157
158//____________________________________________________________________________
159void AliPHOSQADataMakerSim::MakeDigits(TClonesArray * digits)
160{
161 // makes data from Digits
162
163 GetDigitsData(1)->Fill(digits->GetEntriesFast()) ;
164 TIter next(digits) ;
165 AliPHOSDigit * digit ;
166 while ( (digit = dynamic_cast<AliPHOSDigit *>(next())) ) {
57acd2d2 167 GetDigitsData(kDigits)->Fill( digit->GetEnergy()) ;
04236e67 168 }
169}
170
171//____________________________________________________________________________
172void AliPHOSQADataMakerSim::MakeDigits(TTree * digitTree)
173{
174 // makes data from Digit Tree
175 TClonesArray * digits = new TClonesArray("AliPHOSDigit", 1000) ;
176
177 TBranch * branch = digitTree->GetBranch("PHOS") ;
178 if ( ! branch ) {
179 AliWarning("PHOS branch in Digit Tree not found") ;
180 } else {
181 branch->SetAddress(&digits) ;
182 branch->GetEntry(0) ;
183 MakeDigits(digits) ;
184 }
185}
186
187//____________________________________________________________________________
188void AliPHOSQADataMakerSim::MakeSDigits(TClonesArray * sdigits)
189{
190 // makes data from SDigits
191
192 GetSDigitsData(1)->Fill(sdigits->GetEntriesFast()) ;
193 TIter next(sdigits) ;
194 AliPHOSDigit * sdigit ;
195 while ( (sdigit = dynamic_cast<AliPHOSDigit *>(next())) ) {
57acd2d2 196 GetSDigitsData(kSDigits)->Fill( sdigit->GetEnergy()) ;
04236e67 197 }
198}
199
200//____________________________________________________________________________
201void AliPHOSQADataMakerSim::MakeSDigits(TTree * sdigitTree)
202{
203 // makes data from SDigit Tree
204 TClonesArray * sdigits = new TClonesArray("AliPHOSDigit", 1000) ;
205
206 TBranch * branch = sdigitTree->GetBranch("PHOS") ;
207 if ( ! branch ) {
208 AliWarning("PHOS branch in SDigit Tree not found") ;
209 } else {
210 branch->SetAddress(&sdigits) ;
211 branch->GetEntry(0) ;
212 MakeSDigits(sdigits) ;
213 }
214}
215
216//____________________________________________________________________________
217void AliPHOSQADataMakerSim::StartOfDetectorCycle()
218{
219 //Detector specific actions at start of cycle
220
221}