Implementation of BitPattern for ACORDE in AliACORDEQADataMakerSim
[u/mrichter/AliRoot.git] / ACORDE / AliACORDEQADataMakerSim.cxx
CommitLineData
51504028 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
18//---
19// Produces the data needed to calculate the quality assurance.
20// All data must be mergeable objects.
21
22// Authors:
23//
24// Luciano Diaz Gonzalez <luciano.diaz@nucleares.unam.mx> (ICN-UNAM)
25// Mario Rodriguez Cahuantzi <mrodrigu@mail.cern.ch> (FCFM-BUAP)
26// Arturo Fernandez Tellez <afernan@mail.cern.ch (FCFM-BUAP)
27//
28// Created: June 13th 2008
29//---
30
31// --- ROOT system ---
32#include <TClonesArray.h>
33#include <TFile.h>
34#include <TH1F.h>
35#include <TH2F.h>
36#include <TDirectory.h>
37// --- Standard library ---
38
39// --- AliRoot header files ---
40#include "AliESDEvent.h"
41#include "AliLog.h"
42#include "AliACORDEdigit.h"
43#include "AliACORDEhit.h"
44#include "AliACORDEQADataMakerSim.h"
45#include "AliQAChecker.h"
46#include "AliACORDERawReader.h"
47ClassImp(AliACORDEQADataMakerSim)
48
49//____________________________________________________________________________
50AliACORDEQADataMakerSim::AliACORDEQADataMakerSim():AliQADataMakerSim(AliQA::GetDetName(AliQA::kACORDE), "ACORDE Quality Assurance Data Maker")
51{
52}
53//____________________________________________________________________________
54AliACORDEQADataMakerSim::AliACORDEQADataMakerSim(const AliACORDEQADataMakerSim& qadm) :
55 AliQADataMakerSim()
56{
57 SetName((const char*)qadm.GetName()) ;
58 SetTitle((const char*)qadm.GetTitle());
59}
60//__________________________________________________________________
61AliACORDEQADataMakerSim& AliACORDEQADataMakerSim::operator = (const AliACORDEQADataMakerSim& qadm )
62{
63 // Equal operator.
64 this->~AliACORDEQADataMakerSim();
65 new(this) AliACORDEQADataMakerSim(qadm);
66 return *this;
67}
68//____________________________________________________________________________
69void AliACORDEQADataMakerSim::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray * list)
70{
71 //Detector specific actions at end of cycle
72 // do the QA checking
73 printf("ACORDE---->Detector specific actions at END of cycle\n................\n");
74
75 AliQAChecker::Instance()->Run(AliQA::kACORDE, task, list) ;
76}
77//____________________________________________________________________________
78void AliACORDEQADataMakerSim::StartOfDetectorCycle()
79{
80 //Detector specific actions at start of cycle
81 printf("ACORDE---->Detector specific actions at START of cycle\n................\n");
82}
83//____________________________________________________________________________
84void AliACORDEQADataMakerSim::InitHits()
85{
86 // create Hits histograms in Hits subdir
d461c877 87
88 TH1F * fHitsACORDE;
89 fHitsACORDE = new TH1F("hACORDEBitPattern","Distribution of fired modules",60,0,60);
90 Add2HitsList(fHitsACORDE,0);
51504028 91}
92//____________________________________________________________________________
93void AliACORDEQADataMakerSim::InitDigits()
94{
95 // create Digits histograms in Digits subdir
96
97 TH1F * fhDigitsModule;
98 TString modulename;
99 modulename = "hDigitsModule";
100 fhDigitsModule = new TH1F(modulename.Data(),"hDigitsModuleSingle",60,0,60);
101 Add2DigitsList( fhDigitsModule,0);
102
103}
104//____________________________________________________________________________
105
106void AliACORDEQADataMakerSim::MakeHits(TTree *hitTree)
107{
108 // Here we fill the QA histos for Hits declared above
109
d461c877 110 TClonesArray * hits = new TClonesArray("AliACORDEhit",1000);
111 TBranch * branch = hitTree->GetBranch("ACORDE");
112 if (!branch)
113 {
114 AliWarning("ACORDE branch in Hit Tree not found");
115 }else
116 {
117 if (branch)
118 {
119 branch->SetAddress(&hits);
120 }else
121 {
122 AliError("Branch ACORDE hit not found");
123 exit(111);
124 }
125 Int_t ntracks = (Int_t)hitTree->GetEntries();
126 if (ntracks<=0) return;
127 for(Int_t track=0;track<ntracks;track++)
128 {
129 branch->GetEntry(track);
130 Int_t nhits = hits->GetEntriesFast();
131 for(Int_t ihit=1;ihit<=nhits;ihit++)
132 {
133 AliACORDEhit *AcoHit = (AliACORDEhit*) hits->UncheckedAt(ihit);
134 if(!AcoHit)
135 {
136 AliError("The unchecked hit doesn't exist");
137 break;
138 }
139 GetHitsData(0)->Fill(AcoHit->GetModule()-1);
140 }
141 }
142 }
51504028 143
144}
145//____________________________________________________________________________
146void AliACORDEQADataMakerSim::MakeDigits( TTree *digitsTree)
147{
148 //fills QA histos for Digits
149
150
151 TClonesArray * digits = new TClonesArray("AliACORDEdigit",1000);
152 TBranch * branch = digitsTree->GetBranch("ACORDEdigit");
153 if (!branch)
154 {
155 AliWarning("ACORDE branch in Digits Tree not found");
156 }else
157 {
158 if (branch)
159 {
160 branch->SetAddress(&digits);
161 }else
162 {
163 AliError("Branch ACORDE digit not found");
164 exit(111);
165 }
166 Int_t ntracks = (Int_t)digitsTree->GetEntries();
167 if (ntracks<=0) return;
168 printf("Entries in DigitsTree:%d\n",ntracks);
169 for(Int_t track=0;track<ntracks;track++)
170 {
171 branch->GetEntry(track);
172 Int_t ndigits = digits->GetEntriesFast();
173 for(Int_t idigit=0;idigit<ndigits;idigit++)
174 {
175 AliACORDEdigit *AcoDigit = (AliACORDEdigit*) digits->UncheckedAt(idigit);
176 if (!AcoDigit)
177 {
178 AliError("The unchecked digit doesn't exist");
179 break;
180 }
181 GetDigitsData(0)->Fill(AcoDigit->GetModule()-1);
182 }
183 }
184
185
186 }
187
188}