1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 /////////////////////////////////////////////////////////////////////////
19 // Class for ITS RecPoint reconstruction //
21 ////////////////////////////////////////////////////////////////////////
25 #include "AliRunLoader.h"
26 #include "AliITSDetTypeRec.h"
27 #include "AliITSLoader.h"
28 #include "AliITSreconstruction.h"
29 #include "AliITSgeom.h"
32 ClassImp(AliITSreconstruction)
34 //______________________________________________________________________
35 AliITSreconstruction::AliITSreconstruction():
45 // Default constructor.
51 // A zero-ed constructed AliITSreconstruction class.
52 fDet[0] = fDet[1] = fDet[2] = kTRUE;
54 //______________________________________________________________________
56 AliITSreconstruction::AliITSreconstruction(AliRunLoader *rl):
66 fDet[0] = fDet[1] = fDet[2] = kTRUE;
68 //______________________________________________________________________
69 AliITSreconstruction::AliITSreconstruction(const char* filename):
79 // Standard constructor.
81 // const char* filename filename containing the digits to be
82 // reconstructed. If filename = 0 (nil)
83 // then no file is opened but a file is
84 // assumed to already be opened. This
85 // already opened file will be used.
89 // A standardly constructed AliITSreconstruction class.
91 fDet[0] = fDet[1] = fDet[2] = kTRUE;
93 fRunLoader = AliRunLoader::Open(filename);
94 if (fRunLoader == 0x0)
96 Error("AliITSreconstruction","Can not load the session",filename);
102 //______________________________________________________________________
103 AliITSreconstruction::AliITSreconstruction(const AliITSreconstruction &rec):TTask(rec),
107 fDetTypeRec(rec.fDetTypeRec),
109 fITSgeom(rec.fITSgeom),
110 fLoader(rec.fLoader),
111 fRunLoader(rec.fRunLoader)
118 //______________________________________________________________________
119 AliITSreconstruction& AliITSreconstruction::operator=(const AliITSreconstruction& source){
120 // Assignment operator.
121 this->~AliITSreconstruction();
122 new(this) AliITSreconstruction(source);
127 //______________________________________________________________________
128 AliITSreconstruction::~AliITSreconstruction(){
129 // A destroyed AliITSreconstruction class.
135 //______________________________________________________________________
136 Bool_t AliITSreconstruction::Init(){
143 // kTRUE if no errors initilizing this class occurse else kFALSE
145 if (fRunLoader == 0x0)
147 Error("Init","Run Loader is NULL");
150 // fRunLoader->LoadgAlice();
151 // fRunLoader->LoadHeader();
153 fLoader = (AliITSLoader*) fRunLoader->GetLoader("ITSLoader");
155 Error("Init","ITS loader not found");
159 // Now ready to init.
161 //fRunLoader->CdGAFile();
162 fITSgeom = fLoader->GetITSgeom();
164 fDetTypeRec = new AliITSDetTypeRec(fLoader);
165 fDetTypeRec->SetDefaults();
166 fDet[0] = fDet[1] = fDet[2] = kTRUE;
169 //fEnt = gAlice->GetEventsPerRun();
170 fEnt = Int_t(fRunLoader->GetNumberOfEvents());
172 fLoader->LoadDigits("read");
173 fLoader->LoadRecPoints("recreate");
174 fLoader->LoadRawClusters("recreate");
175 if (fLoader->TreeR() == 0x0) fLoader->MakeTree("R");
176 if (fLoader->TreeC() == 0x0) fLoader->MakeTree("C");
178 fDetTypeRec->MakeBranchR(0);
179 fDetTypeRec->MakeBranchC();
180 fDetTypeRec->SetTreeAddress();
181 fDetTypeRec->SetTreeAddressR(fLoader->TreeR());
185 Info("Init"," Done\n\n\n");
189 //______________________________________________________________________
190 Bool_t AliITSreconstruction::InitRec(){
191 // Sets up Reconstruction part of AliITSDetType..
199 //AliITSDetType *idt;
200 fDetTypeRec->SetLoader(fLoader);
203 Info("InitRec","SPD");
204 //idt = fITS->DetType(kSPD);
205 AliITSsegmentationSPD *segSPD = (AliITSsegmentationSPD*)fDetTypeRec->GetSegmentationModel(0);
206 TClonesArray *digSPD = fDetTypeRec->DigitsAddress(kSPD);
207 TClonesArray *recpSPD = fDetTypeRec->ClustersAddress(kSPD);
208 Info("InitRec","idt = %#x; digSPD = %#x; recpSPD = %#x",fDetTypeRec,digSPD,recpSPD);
209 AliITSClusterFinderSPD *recSPD = new AliITSClusterFinderSPD(segSPD,digSPD,recpSPD);
210 fDetTypeRec->SetReconstructionModel(kSPD,recSPD);
211 } // end if fDet[kSPD].
214 Info("InitRec","SDD");
215 // idt = fITS->DetType(kSDD);
216 AliITSsegmentationSDD *segSDD = (AliITSsegmentationSDD*)
217 fDetTypeRec->GetSegmentationModel(1);
218 AliITSresponseSDD *resSDD = (AliITSresponseSDD*)
219 fDetTypeRec->GetCalibrationModel(fDetTypeRec->GetITSgeom()->GetStartSDD());
220 TClonesArray *digSDD = fDetTypeRec->DigitsAddress(kSDD);
221 TClonesArray *recpSDD = fDetTypeRec->ClustersAddress(kSDD);
222 AliITSClusterFinderSDD *recSDD =new AliITSClusterFinderSDD(segSDD,
225 fDetTypeRec->SetReconstructionModel(kSDD,recSDD);
226 } // end if fDet[kSDD]
229 Info("InitRec","SSD");
230 //idt = fITS->DetType(kSSD);
231 AliITSsegmentationSSD *segSSD = (AliITSsegmentationSSD*)
232 fDetTypeRec->GetSegmentationModel(2);
233 TClonesArray *digSSD = fDetTypeRec->DigitsAddress(kSSD);
234 AliITSClusterFinderSSD *recSSD =new AliITSClusterFinderSSD(segSSD,
236 recSSD->SetITSgeom(fDetTypeRec->GetITSgeom());
237 fDetTypeRec->SetReconstructionModel(kSSD,recSSD);
238 } // end if fDet[kSSD]
240 fDetTypeRec->SetDefaultClusterFinders();
241 Info("InitRec"," Done\n");
244 //______________________________________________________________________
245 void AliITSreconstruction::Exec(const Option_t *opt){
246 // Main reconstruction function.
248 // Option_t * opt list of subdetector to digitize. =0 all.
256 if(strstr(opt,"All")||strstr(opt,"ALL")||strstr(opt,"ITS")||opt==0){
257 fDet[0] = fDet[1] = fDet[2] = kTRUE;
260 fDet[0] = fDet[1] = fDet[2] = kFALSE;
261 if(strstr(opt,"SPD")) fDet[kSPD] = kTRUE;
262 if(strstr(opt,"SDD")) fDet[kSDD] = kTRUE;
263 if(strstr(opt,"SSD")) fDet[kSSD] = kTRUE;
264 if(fDet[kSPD] && fDet[kSDD] && fDet[kSSD]) lopt = "All";
266 } // end if strstr(opt,...)
269 cout << "Initilization Failed, Can't run Exec." << endl;
272 for(evnt=0;evnt<fEnt;evnt++)
275 Info("Exec","Processing Event %d",evnt);
278 fRunLoader->GetEvent(evnt);
279 if (fLoader->TreeR() == 0x0) fLoader->MakeTree("R");
280 fDetTypeRec->MakeBranchR(0);
281 if (fLoader->TreeC() == 0x0){
282 fDetTypeRec->MakeTreeC();
283 fDetTypeRec->MakeBranchC();
285 fDetTypeRec->SetTreeAddressR(fLoader->TreeR());
286 fDetTypeRec->SetTreeAddressD(fLoader->TreeD());
287 fDetTypeRec->DigitsToRecPoints(evnt,0,lopt);
290 //______________________________________________________________________
291 void AliITSreconstruction::SetOutputFile(TString filename){
292 // Set a new file name for recpoints.
293 // It must be called before Init()
294 if(!fLoader)fLoader = (AliITSLoader*) fRunLoader->GetLoader("ITSLoader");
296 Info("SetOutputFile","name for rec points is %s",filename.Data());
297 fLoader->SetRecPointsFileName(filename);
300 Error("SetOutputFile",
301 "ITS loader not available. Not possible to set name: %s",filename.Data());