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 **************************************************************************/
18 Revision 1.2 2002/01/31 18:52:09 nilsen
19 Minor change to allow the use of files that are already open. grun.C macro
20 that also does ITS digitizationa and Reconstruction all in one go.
22 Revision 1.1 2002/01/30 22:20:22 nilsen
23 New TTask based method to do Digits To clusters. Works with files of multiple
24 events in the file. Macro added to show how to use. Also the changes made
25 in the nessesary complilation files.
30 #include <TSeqCollection.h>
32 #include <TClonesArray.h>
37 #include "AliITSDetType.h"
38 #include "AliITSreconstruction.h"
39 #include "AliITSsegmentationSPD.h"
40 #include "AliITSsegmentationSDD.h"
41 #include "AliITSsegmentationSSD.h"
42 #include "AliITSClusterFinderSPD.h"
43 #include "AliITSClusterFinderSDD.h"
44 #include "AliITSClusterFinderSSD.h"
45 #include "AliITSresponseSDD.h"
46 #include "AliITSgeom.h"
48 ClassImp(AliITSreconstruction)
50 //______________________________________________________________________
51 AliITSreconstruction::AliITSreconstruction(){
52 // Default constructor.
58 // A zero-ed constructed AliITSreconstruction class.
63 fDet[0] = fDet[1] = fDet[2] = kTRUE;
66 //______________________________________________________________________
67 AliITSreconstruction::AliITSreconstruction(const char* filename){
68 // Standard constructor.
70 // const char* filename filename containing the digits to be
71 // reconstructed. If filename = 0 (nil)
72 // then no file is opened but a file is
73 // assumed to already be opened. This
74 // already opened file will be used.
78 // A standardly constructed AliITSreconstruction class.
83 fFile = (TFile*)gROOT->GetListOfFiles()->FindObject(fFilename.Data());
84 if(fFile) fFile->Close();
85 fFile = new TFile(fFilename.Data(),"UPDATE");
91 gAlice = (AliRun*)fFile->Get("gAlice");
93 cout << "gAlice not found on file. Aborting." << endl;
97 } // end if !filename.
101 //______________________________________________________________________
102 AliITSreconstruction::~AliITSreconstruction(){
103 // Default constructor.
109 // A destroyed AliITSreconstruction class.
111 if(fFile) fFile->Close();
116 //______________________________________________________________________
117 Bool_t AliITSreconstruction::Init(){
124 // kTRUE if no errors initilizing this class occurse else kFALSE
127 fITS = (AliITS*) gAlice->GetDetector("ITS");
129 cout << "ITS not found aborting. fITS=" << fITS << endl;
133 if(!(fITS->GetITSgeom())){
134 cout << "ITSgeom not found aborting."<< endl;
137 } // end if !GetITSgeom()
138 // Now ready to init.
140 fDet[0] = fDet[1] = fDet[2] = kTRUE;
142 fEnt = gAlice->GetEventsPerRun();
144 nparticles = gAlice->GetEvent(fEnt0);
150 //______________________________________________________________________
151 Bool_t AliITSreconstruction::InitRec(){
152 // Sets up Reconstruction part of AliITSDetType..
163 idt = fITS->DetType(kSPD);
164 AliITSsegmentationSPD *segSPD = (AliITSsegmentationSPD*)
165 idt->GetSegmentationModel();
166 TClonesArray *digSPD = fITS->DigitsAddress(kSPD);
167 TClonesArray *recpSPD = fITS->ClustersAddress(kSPD);
168 AliITSClusterFinderSPD *recSPD = new AliITSClusterFinderSPD(segSPD,
171 fITS->SetReconstructionModel(kSPD,recSPD);
172 } // end if fDet[kSPD].
175 idt = fITS->DetType(kSDD);
176 AliITSsegmentationSDD *segSDD = (AliITSsegmentationSDD*)
177 idt->GetSegmentationModel();
178 AliITSresponseSDD *resSDD = (AliITSresponseSDD*)
179 idt->GetResponseModel();
180 TClonesArray *digSDD = fITS->DigitsAddress(kSDD);
181 TClonesArray *recpSDD = fITS->ClustersAddress(kSDD);
182 AliITSClusterFinderSDD *recSDD =new AliITSClusterFinderSDD(segSDD,
185 fITS->SetReconstructionModel(kSDD,recSDD);
186 } // end if fDet[kSDD]
189 idt = fITS->DetType(kSSD);
190 AliITSsegmentationSSD *segSSD = (AliITSsegmentationSSD*)
191 idt->GetSegmentationModel();
192 TClonesArray *digSSD = fITS->DigitsAddress(kSSD);
193 AliITSClusterFinderSSD *recSSD =new AliITSClusterFinderSSD(segSSD,
195 fITS->SetReconstructionModel(kSSD,recSSD);
196 } // end if fDet[kSSD]
200 //______________________________________________________________________
201 void AliITSreconstruction::Exec(const Option_t *opt){
202 // Main reconstruction function.
204 // Option_t * opt list of subdetector to digitize. =0 all.
210 Int_t nparticles,evnt;
212 if(strstr(opt,"All")||strstr(opt,"ALL")||strstr(opt,"ITS")||opt==0){
213 fDet[0] = fDet[1] = fDet[2] = kTRUE;
216 fDet[0] = fDet[1] = fDet[2] = kFALSE;
217 if(strstr(opt,"SPD")) fDet[kSPD] = kTRUE;
218 if(strstr(opt,"SDD")) fDet[kSDD] = kTRUE;
219 if(strstr(opt,"SSD")) fDet[kSSD] = kTRUE;
220 if(fDet[kSPD] && fDet[kSDD] && fDet[kSSD]) lopt = "All";
222 } // end if strstr(opt,...)
225 cout << "Initilization Failed, Can't run Exec." << endl;
228 for(evnt=0;evnt<fEnt;evnt++){
229 nparticles = gAlice->GetEvent(evnt);
230 gAlice->SetEvent(evnt);
231 if(!gAlice->TreeR()) gAlice->MakeTree("R");
232 fITS->MakeBranch("R");
233 fITS->DigitsToRecPoints(evnt,0,lopt);