]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSBeamTestDigitizer.cxx
Removing compilation warnings (icc)
[u/mrichter/AliRoot.git] / ITS / AliITSBeamTestDigitizer.cxx
CommitLineData
38300302 1////////////////////////////////////////////////////
2// Class to manage the //
3// ITS beam test conversion from rawdata //
4// to digits. It executes the digitization for //
5// SPD, SDD and SSD. //
7d62fb64 6// //
7// //
38300302 8// Origin: E. Crescio crescio@to.infn.it //
9// J. Conrad Jan.Conrad@cern.ch //
10////////////////////////////////////////////////////
11#include "AliHeader.h"
12#include "AliRun.h"
13#include "AliRunLoader.h"
14#include "AliITSEventHeader.h"
15#include "AliITSLoader.h"
38300302 16#include "AliITSBeamTestDigSDD.h"
17#include "AliITSBeamTestDigSPD.h"
18#include "AliITSBeamTestDigSSD.h"
19#include "AliITSBeamTestDigitizer.h"
20#include "AliRawReaderDate.h"
8ace09b6 21#include "AliRawReaderRoot.h"
38300302 22
5ba31760 23const TString AliITSBeamTestDigitizer::fgkDefaultDigitsFileName="ITS.Digits.root";
38300302 24
25ClassImp(AliITSBeamTestDigitizer)
26
27
28//_____________________________________________________________
29AliITSBeamTestDigitizer::AliITSBeamTestDigitizer():TTask()
30{
31 //
32 // Default constructor
33 //
34 fRunLoader = 0;
35 fLoader =0;
36 fEvIn=0;
37 fEvFin=0;
38 fFlagHeader=kTRUE;
39 fDATEEvType=7;
40 fRunNumber=-1;
41 SetFlagInit();
8ace09b6 42 SetOptDate();
5ba31760 43 fPeriod=kNov04;
38300302 44}
45
46//_____________________________________________________________
7d62fb64 47 AliITSBeamTestDigitizer::AliITSBeamTestDigitizer(const Text_t* name, const Text_t* title, Char_t* opt,const char* filename):TTask(name,title)
38300302 48{
49 //
50 // Standard constructor
51 //
5ba31760 52 fRunLoader=0;
53 fLoader=0;
38300302 54 fEvIn=0;
55 fEvFin=0;
56 fDATEEvType=7;
57 fFlagHeader=kTRUE;
58 fRunNumber=-1;
8ace09b6 59 SetOptDate();
5ba31760 60
61 TString choice(opt);
62 Bool_t aug04 = choice.Contains("Aug04");
63 Bool_t nov04 = choice.Contains("Nov04");
64 if(aug04) fPeriod=kAug04;
65 if(nov04) fPeriod=kNov04;
7d62fb64 66 Init(filename);
38300302 67 }
68
69//_____________________________________________________________
7d62fb64 70 AliITSBeamTestDigitizer::AliITSBeamTestDigitizer(const Text_t* name, const Text_t* title, Int_t run, Char_t* opt,const char* filename):TTask(name,title)
38300302 71
72{
73 //
74 // Constructor
75 //
5ba31760 76 fRunLoader=0;
77 fLoader=0;
38300302 78 fEvIn=0;
79 fEvFin=0;
80 fDATEEvType=7;
81 fFlagHeader=kTRUE;
82 fRunNumber=run;
8ace09b6 83 SetOptDate();
5ba31760 84 TString choice(opt);
85 Bool_t aug04 = choice.Contains("Aug04");
86 Bool_t nov04 = choice.Contains("Nov04");
87 if(aug04) fPeriod=kAug04;
88 if(nov04) fPeriod=kNov04;
89
7d62fb64 90 Init(filename);
38300302 91 }
92
93//___________________________________________________________
7d62fb64 94void AliITSBeamTestDigitizer::Init(const char* filename){
38300302 95
96 //
97 //Initialization of run loader and its loader
98 //creation of galice.root
99 //
5ba31760 100
38300302 101
7d62fb64 102 fRunLoader = AliRunLoader::Open(filename,AliConfig::GetDefaultEventFolderName(),"update");
38300302 103 if (fRunLoader == 0x0)
104 {
105 Error("AliITSBeamTestDigitizer","Can not load the session",filename);
106 return;
107 }
108 fRunLoader->LoadgAlice();
109 gAlice = fRunLoader->GetAliRun();
110
111 if(!gAlice) {
112 Error("AliITSBeamTestDigitizer","gAlice not found on file. Aborting.");
113 return;
114 }
7d62fb64 115 fRunLoader->MakeTree("E");
38300302 116 fLoader = (AliITSLoader*)fRunLoader->GetLoader("ITSLoader");
38300302 117
118 fDigitsFileName=fgkDefaultDigitsFileName;
7d62fb64 119 this->Add(new AliITSBeamTestDigSPD("DigSPD","SPD Digitization"));
120 this->Add(new AliITSBeamTestDigSDD("DigSDD","SDD Digitization"));
121 this->Add(new AliITSBeamTestDigSSD("DigSSD","SSD Digitization"));
38300302 122
7d62fb64 123 SetFlagInit(kTRUE);
38300302 124}
125
7d62fb64 126
38300302 127//______________________________________________________________________
128AliITSBeamTestDigitizer::AliITSBeamTestDigitizer(const AliITSBeamTestDigitizer &bt):TTask(bt){
129 // Copy constructor.
130 //not allowed
131 if(this==&bt) return;
132 Error("Copy constructor",
133 "You are not allowed to make a copy of the AliITSBeamTestDigitizer");
134 exit(1);
135
136}
137//______________________________________________________________________
5ba31760 138AliITSBeamTestDigitizer& AliITSBeamTestDigitizer::operator=(const AliITSBeamTestDigitizer &source){
38300302 139 // Assignment operator. This is a function which is not allowed to be
140 // done to the ITS beam test digitizer. It exits with an error.
141 // Inputs:
5ba31760 142 if(this==&source) return *this;
38300302 143 Error("operator=","You are not allowed to make a copy of the AliITSBeamTestDigitizer");
144 exit(1);
145 return *this; //fake return
146}
147
148
149//______________________________________________________________
150AliITSBeamTestDigitizer::~AliITSBeamTestDigitizer(){
151
152 //Destructor
7d62fb64 153 // if(fBt) delete fBt;
38300302 154 if(fLoader) delete fLoader;
5ba31760 155 if(fHeader) delete fHeader;
38300302 156}
157
158
159//_____________________________________________________________
160void AliITSBeamTestDigitizer::SetNumberOfEventsPerFile(Int_t nev)
161{
162 //Sets number of events per file
163
164 if(fRunLoader) fRunLoader->SetNumberOfEventsPerFile(nev);
165 else Warning("SetNumberOfEventsPerFile","fRunLoader is 0");
166}
167
168
169//____________________________________________________
170void AliITSBeamTestDigitizer::ExecDigitization(){
171
172 // Execution of digitisation for SPD,SDD and SSD
173
174 if(!GetFlagInit()){
175 Warning("ExecDigitization()","Run Init() please..");
176 return;
177 }
178 fLoader->SetDigitsFileName(fDigitsFileName);
179 fLoader->LoadDigits("recreate");
180
8ace09b6 181 AliRawReader* rd;
182
183 if(GetOptDate()) rd = new AliRawReaderDate(fRawdataFileName,fEvIn);
184 else rd = new AliRawReaderRoot(fRawdataFileName,fEvIn);
185
38300302 186 AliHeader* header = fRunLoader->GetHeader();
38300302 187 Int_t iev=fEvIn-1;
188
189
190 AliITSBeamTestDigSDD* digSDD = (AliITSBeamTestDigSDD*)fTasks->FindObject("DigSDD");
191 AliITSBeamTestDigSPD* digSPD = (AliITSBeamTestDigSPD*)fTasks->FindObject("DigSPD");
192 AliITSBeamTestDigSSD* digSSD = (AliITSBeamTestDigSSD*)fTasks->FindObject("DigSSD");
193
194
195 do{
196 iev++;
197 if(fEvFin!=0){
198 if(iev>fEvFin) break;
199 }
200 AliITSEventHeader* itsh = new AliITSEventHeader("ITSHeader");
201 fRunLoader->SetEventNumber(iev);
202
8ace09b6 203 rd->RequireHeader(fFlagHeader);
204 rd->SelectEvents(fDATEEvType);
38300302 205
8ace09b6 206 digSDD->SetRawReader(rd);
207 digSPD->SetRawReader(rd);
208 digSSD->SetRawReader(rd);
38300302 209
210 if(fLoader->TreeD() == 0x0) fLoader->MakeTree("D");
211
212 TTree* treeD = (TTree*)fLoader->TreeD();
213
214 // Make branches outside the dig-classes
215
216 TClonesArray* digitsSPD = new TClonesArray("AliITSdigitSPD",1000);
5ba31760 217 treeD->Branch("ITSDigitsSPD",&digitsSPD);
38300302 218
219 TClonesArray* digitsSDD = new TClonesArray("AliITSdigitSDD",1000);
5ba31760 220 treeD->Branch("ITSDigitsSDD",&digitsSDD);
38300302 221
222 TClonesArray* digitsSSD = new TClonesArray("AliITSdigitSSD",1000);
5ba31760 223 treeD->Branch("ITSDigitsSSD",&digitsSSD);
38300302 224
225
226 digSSD->SetTree(treeD);
227 digSDD->SetTree(treeD);
228 digSPD->SetTree(treeD);
5ba31760 229
7d62fb64 230 AliITSgeom* geom = fLoader->GetITSgeom();
231
232 digSSD->SetITSgeom(geom);
233 digSDD->SetITSgeom(geom);
234 digSPD->SetITSgeom(geom);
5ba31760 235
38300302 236 digSSD->SetITSEventHeader(itsh);
237 digSDD->SetITSEventHeader(itsh);
238 digSPD->SetITSEventHeader(itsh);
239
240 digSDD->SetBtPeriod(GetBeamTestPeriod());
5ba31760 241 if(GetBeamTestPeriod()==1)digSDD->SetThreshold(16);
242 else digSDD->SetThreshold(0);
38300302 243 ExecuteTask(0);
244
245 header->SetEventNrInRun(iev);
246 header->SetEvent(iev);
247 header->SetRun(fRunNumber);
248 fRunLoader->GetHeader()->AddDetectorEventHeader(itsh);
249 fRunLoader->TreeE()->Fill();
250 header->Reset(fRunNumber,iev);
251
252 delete digitsSPD;
253 delete digitsSDD;
254 delete digitsSSD;
255
8ace09b6 256 }while(rd->NextEvent());
38300302 257
8ace09b6 258
38300302 259 fRunLoader->WriteHeader("OVERWRITE");
260 fRunLoader->WriteRunLoader("OVERWRITE");
5ba31760 261
8ace09b6 262 delete rd;
38300302 263 fLoader->UnloadDigits();
264 fLoader->UnloadRawClusters();
265 fRunLoader->UnloadHeader();
5ba31760 266
38300302 267
268}
269
270
271
272//_______________________________________________
273void AliITSBeamTestDigitizer:: SetActive(const TString& subdet,Bool_t value){
274
275 //Sets active sub-tasks (detectors)
276
277 Bool_t sdd = subdet.Contains("SDD");
278 Bool_t spd = subdet.Contains("SPD");
279 Bool_t ssd = subdet.Contains("SSD");
280
281 if(sdd){
282 AliITSBeamTestDigSDD* digSDD = (AliITSBeamTestDigSDD*)fTasks->FindObject("DigSDD");
283 digSDD->SetActive(value);
284 }
285
286 if(spd){
287 AliITSBeamTestDigSPD* digSPD = (AliITSBeamTestDigSPD*)fTasks->FindObject("DigSPD");
288 digSPD->SetActive(value);
289
290 }
291
292 if(ssd){
293 AliITSBeamTestDigSSD* digSSD = (AliITSBeamTestDigSSD*)fTasks->FindObject("DigSSD");
294 digSSD->SetActive(value);
295
296 }
297
298
299
300}
301