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 ///////////////////////////////////////////////////////////////////////////////
20 // class for ITS reconstruction //
22 ///////////////////////////////////////////////////////////////////////////////
24 #include "Riostream.h"
25 #include "AliITSReconstructor.h"
27 #include "AliRunLoader.h"
28 #include "AliRawReader.h"
29 #include "AliITSDetTypeRec.h"
30 #include "AliITSLoader.h"
31 #include "AliITStrackerMI.h"
32 #include "AliITStrackerV2.h"
33 #include "AliITStrackerSA.h"
34 #include "AliITSVertexerIons.h"
35 #include "AliITSVertexerFast.h"
36 #include "AliITSVertexer3D.h"
37 #include "AliITSVertexerZ.h"
38 #include "AliITSVertexerCosmics.h"
40 #include "AliITSpidESD.h"
41 #include "AliITSpidESD1.h"
42 #include "AliITSpidESD2.h"
43 #include "AliITSInitGeometry.h"
45 ClassImp(AliITSReconstructor)
47 //___________________________________________________________________________
48 AliITSReconstructor::AliITSReconstructor() : AliReconstructor(),
51 // Default constructor
53 //___________________________________________________________________________
54 AliITSReconstructor::~AliITSReconstructor(){
58 //______________________________________________________________________
59 AliITSReconstructor::AliITSReconstructor(const AliITSReconstructor &ob) :AliReconstructor(ob),
65 //______________________________________________________________________
66 AliITSReconstructor& AliITSReconstructor::operator=(const AliITSReconstructor& ob ){
67 // Assignment operator
68 this->~AliITSReconstructor();
69 new(this) AliITSReconstructor(ob);
72 //______________________________________________________________________
73 void AliITSReconstructor::Init(AliRunLoader *runLoader) const{
74 // Initalize this constructor bet getting/creating the objects
75 // nesseary for a proper ITS reconstruction.
77 // AliRunLoader *runLoader Pointer to the run loader to allow
78 // the getting of files/folders data
79 // needed to do reconstruction
85 AliITSInitGeometry initgeom;
86 AliITSgeom *geom = initgeom.CreateAliITSgeom();
87 AliInfo(Form("Geometry name: %s",(initgeom.GetGeometryName()).Data()));
88 AliITSLoader* loader = static_cast<AliITSLoader*>
89 (runLoader->GetLoader("ITSLoader"));
91 Error("Init", "ITS loader not found");
94 loader->SetITSgeom(geom);
97 //_____________________________________________________________________________
98 void AliITSReconstructor::Reconstruct(AliRunLoader* runLoader) const
100 // reconstruct clusters
103 AliITSLoader* loader = static_cast<AliITSLoader*>(runLoader->GetLoader("ITSLoader"));
105 Error("Reconstruct", "ITS loader not found");
108 AliITSDetTypeRec* rec = new AliITSDetTypeRec(loader);
111 loader->LoadRecPoints("recreate");
112 loader->LoadDigits("read");
113 runLoader->LoadKinematics();
114 TString option = GetOption();
115 Bool_t clusfinder=kTRUE; // Default: V2 cluster finder
116 if(option.Contains("OrigCF"))clusfinder=kFALSE;
118 Int_t nEvents = runLoader->GetNumberOfEvents();
120 for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
121 runLoader->GetEvent(iEvent);
122 if(loader->TreeR()==0x0) loader->MakeTree("R");
123 rec->MakeBranch("R");
124 rec->SetTreeAddress();
125 rec->DigitsToRecPoints(iEvent,0,"All",clusfinder);
128 loader->UnloadRecPoints();
129 loader->UnloadDigits();
130 runLoader->UnloadKinematics();
133 //_________________________________________________________________
134 void AliITSReconstructor::Reconstruct(AliRunLoader* runLoader,
135 AliRawReader* rawReader) const
137 // reconstruct clusters
140 AliITSLoader* loader = static_cast<AliITSLoader*>(runLoader->GetLoader("ITSLoader"));
142 Error("Reconstruct", "ITS loader not found");
146 AliITSDetTypeRec* rec = new AliITSDetTypeRec(loader);
148 rec->SetDefaultClusterFindersV2(kTRUE);
150 loader->LoadRecPoints("recreate");
154 while(rawReader->NextEvent()) {
155 runLoader->GetEvent(iEvent++);
156 if(loader->TreeR()==0x0) loader->MakeTree("R");
157 rec->DigitsToRecPoints(rawReader);
160 loader->UnloadRecPoints();
163 //_____________________________________________________________________________
164 AliTracker* AliITSReconstructor::CreateTracker(AliRunLoader* runLoader)const
166 // create a ITS tracker
169 TString selectedTracker = GetOption();
171 if (selectedTracker.Contains("MI")) {
172 tracker = new AliITStrackerMI(0);
174 else if (selectedTracker.Contains("V2")) {
175 tracker = new AliITStrackerV2(0);
178 tracker = new AliITStrackerSA(0); // inherits from AliITStrackerMI
179 AliITStrackerSA *sat=(AliITStrackerSA*)tracker;
180 if(selectedTracker.Contains("onlyITS"))sat->SetSAFlag(kTRUE);
181 if(sat->GetSAFlag())AliDebug(1,"Tracking Performed in ITS only\n");
184 TString selectedPIDmethod = GetOption();
185 AliITSLoader *loader = (AliITSLoader*)runLoader->GetLoader("ITSLoader");
187 Error("CreateTracker", "ITS loader not found");
189 if(selectedPIDmethod.Contains("LandauFitPID")){
190 loader->AdoptITSpid(new AliITSpidESD2((AliITStrackerMI*)tracker,loader));
193 Double_t parITS[] = {34., 0.15, 10.};
194 loader->AdoptITSpid(new AliITSpidESD1(parITS));
200 //_____________________________________________________________________________
201 AliVertexer* AliITSReconstructor::CreateVertexer(AliRunLoader* /*runLoader*/) const
203 // create a ITS vertexer
205 TString selectedVertexer = GetOption();
206 if(selectedVertexer.Contains("ions") || selectedVertexer.Contains("IONS")){
207 Info("CreateVertexer","a AliITSVertexerIons object has been selected\n");
208 return new AliITSVertexerIons("null");
210 if(selectedVertexer.Contains("smear") || selectedVertexer.Contains("SMEAR")){
211 Double_t smear[3]={0.005,0.005,0.01};
212 Info("CreateVertexer","a AliITSVertexerFast object has been selected\n");
213 return new AliITSVertexerFast(smear);
215 if(selectedVertexer.Contains("3d") || selectedVertexer.Contains("3D")){
216 Info("CreateVertexer","a AliITSVertexer3D object has been selected\n");
217 return new AliITSVertexer3D("null");
219 if(selectedVertexer.Contains("cosmics") || selectedVertexer.Contains("COSMICS")){
220 Info("CreateVertexer","a AliITSVertexerCosmics object has been selected\n");
221 return new AliITSVertexerCosmics();
223 // by default an AliITSVertexerZ object is instatiated
224 Info("CreateVertexer","a AliITSVertexerZ object has been selected\n");
225 return new AliITSVertexerZ("null");
228 //_____________________________________________________________________________
229 void AliITSReconstructor::FillESD(AliRunLoader* runLoader,
232 // make PID, find V0s and cascade
233 AliITSLoader *loader = (AliITSLoader*)runLoader->GetLoader("ITSLoader");
234 AliITSpidESD *pidESD = 0;
235 TString selectedPIDmethod = GetOption();
236 if(selectedPIDmethod.Contains("LandauFitPID")){
237 Info("FillESD","ITS LandauFitPID option has been selected\n");
238 pidESD=loader->GetITSpid();
241 Info("FillESD","ITS default PID\n");
242 pidESD=loader->GetITSpid();
245 pidESD->MakePID(esd);
248 Error("FillESD","!! cannot do the PID !!\n");
253 //_____________________________________________________________________________
254 AliITSgeom* AliITSReconstructor::GetITSgeom(AliRunLoader* runLoader) const
256 // get the ITS geometry
258 if (!runLoader->GetAliRun()) runLoader->LoadgAlice();
259 if (!runLoader->GetAliRun()) {
260 Error("GetITSgeom", "couldn't get AliRun object");
263 AliITSLoader *loader = (AliITSLoader*)runLoader->GetLoader("ITSLoader");
264 AliITSgeom* geom = (AliITSgeom*)loader->GetITSgeom();
266 Error("GetITSgeom","no ITS geometry available");