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 "AliITSVertexerPPZ.h"
37 #include "AliITSVertexerZ.h"
39 #include "AliITSpidESD.h"
40 #include "AliITSpidESD1.h"
41 #include "AliITSpidESD2.h"
42 #include "AliITSInitGeometry.h"
44 ClassImp(AliITSReconstructor)
46 //___________________________________________________________________________
47 AliITSReconstructor::AliITSReconstructor() : AliReconstructor(),
50 // Default constructor
52 //___________________________________________________________________________
53 AliITSReconstructor::~AliITSReconstructor(){
57 //______________________________________________________________________
58 AliITSReconstructor::AliITSReconstructor(const AliITSReconstructor &ob) :AliReconstructor(ob),
64 //______________________________________________________________________
65 AliITSReconstructor& AliITSReconstructor::operator=(const AliITSReconstructor& ob ){
66 // Assignment operator
67 this->~AliITSReconstructor();
68 new(this) AliITSReconstructor(ob);
71 //______________________________________________________________________
72 void AliITSReconstructor::Init(AliRunLoader *runLoader) const{
73 // Initalize this constructor bet getting/creating the objects
74 // nesseary for a proper ITS reconstruction.
76 // AliRunLoader *runLoader Pointer to the run loader to allow
77 // the getting of files/folders data
78 // needed to do reconstruction
84 AliITSInitGeometry initgeom;
85 AliITSgeom *geom = initgeom.CreateAliITSgeom();
86 AliInfo(Form("Geometry name: %s",(initgeom.GetGeometryName()).Data()));
87 AliITSLoader* loader = static_cast<AliITSLoader*>
88 (runLoader->GetLoader("ITSLoader"));
90 Error("Init", "ITS loader not found");
93 loader->SetITSgeom(geom);
96 //_____________________________________________________________________________
97 void AliITSReconstructor::Reconstruct(AliRunLoader* runLoader) const
99 // reconstruct clusters
102 AliITSLoader* loader = static_cast<AliITSLoader*>(runLoader->GetLoader("ITSLoader"));
104 Error("Reconstruct", "ITS loader not found");
107 AliITSDetTypeRec* rec = new AliITSDetTypeRec(loader);
110 loader->LoadRecPoints("recreate");
111 loader->LoadDigits("read");
112 runLoader->LoadKinematics();
113 TString option = GetOption();
114 Bool_t clusfinder=kTRUE; // Default: V2 cluster finder
115 if(option.Contains("OrigCF"))clusfinder=kFALSE;
117 Int_t nEvents = runLoader->GetNumberOfEvents();
119 for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
120 runLoader->GetEvent(iEvent);
121 if(loader->TreeR()==0x0) loader->MakeTree("R");
122 rec->MakeBranch("R");
123 rec->SetTreeAddress();
124 rec->DigitsToRecPoints(iEvent,0,"All",clusfinder);
127 loader->UnloadRecPoints();
128 loader->UnloadDigits();
129 runLoader->UnloadKinematics();
132 //_________________________________________________________________
133 void AliITSReconstructor::Reconstruct(AliRunLoader* runLoader,
134 AliRawReader* rawReader) const
136 // reconstruct clusters
139 AliITSLoader* loader = static_cast<AliITSLoader*>(runLoader->GetLoader("ITSLoader"));
141 Error("Reconstruct", "ITS loader not found");
145 AliITSDetTypeRec* rec = new AliITSDetTypeRec(loader);
147 rec->SetDefaultClusterFindersV2(kTRUE);
149 loader->LoadRecPoints("recreate");
153 while(rawReader->NextEvent()) {
154 runLoader->GetEvent(iEvent++);
155 if(loader->TreeR()==0x0) loader->MakeTree("R");
156 rec->DigitsToRecPoints(rawReader);
159 loader->UnloadRecPoints();
162 //_____________________________________________________________________________
163 AliTracker* AliITSReconstructor::CreateTracker(AliRunLoader* runLoader)const
165 // create a ITS tracker
168 TString selectedTracker = GetOption();
170 if (selectedTracker.Contains("MI")) {
171 tracker = new AliITStrackerMI(0);
173 else if (selectedTracker.Contains("V2")) {
174 tracker = new AliITStrackerV2(0);
177 tracker = new AliITStrackerSA(0); // inherits from AliITStrackerMI
178 AliITStrackerSA *sat=(AliITStrackerSA*)tracker;
179 if(selectedTracker.Contains("onlyITS"))sat->SetSAFlag(kTRUE);
180 if(sat->GetSAFlag())AliDebug(1,"Tracking Performed in ITS only\n");
183 TString selectedPIDmethod = GetOption();
184 AliITSLoader *loader = (AliITSLoader*)runLoader->GetLoader("ITSLoader");
186 Error("CreateTracker", "ITS loader not found");
188 if(selectedPIDmethod.Contains("LandauFitPID")){
189 loader->AdoptITSpid(new AliITSpidESD2((AliITStrackerMI*)tracker,loader));
192 Double_t parITS[] = {34., 0.15, 10.};
193 loader->AdoptITSpid(new AliITSpidESD1(parITS));
199 //_____________________________________________________________________________
200 AliVertexer* AliITSReconstructor::CreateVertexer(AliRunLoader* /*runLoader*/) const
202 // create a ITS vertexer
204 TString selectedVertexer = GetOption();
205 if(selectedVertexer.Contains("ions") || selectedVertexer.Contains("IONS")){
206 Info("CreateVertexer","a AliITSVertexerIons object has been selected\n");
207 return new AliITSVertexerIons("null");
209 if(selectedVertexer.Contains("smear") || selectedVertexer.Contains("SMEAR")){
210 Double_t smear[3]={0.005,0.005,0.01};
211 Info("CreateVertexer","a AliITSVertexerFast object has been selected\n");
212 return new AliITSVertexerFast(smear);
214 if(selectedVertexer.Contains("ppz") || selectedVertexer.Contains("PPZ")){
215 Info("CreateVertexer","a AliITSVertexerPPZ object has been selected\n");
216 return new AliITSVertexerPPZ("null");
218 // by default an AliITSVertexerZ object is instatiated
219 Info("CreateVertexer","a AliITSVertexerZ object has been selected\n");
220 return new AliITSVertexerZ("null");
223 //_____________________________________________________________________________
224 void AliITSReconstructor::FillESD(AliRunLoader* runLoader,
227 // make PID, find V0s and cascade
228 AliITSLoader *loader = (AliITSLoader*)runLoader->GetLoader("ITSLoader");
229 AliITSpidESD *pidESD = 0;
230 TString selectedPIDmethod = GetOption();
231 if(selectedPIDmethod.Contains("LandauFitPID")){
232 Info("FillESD","ITS LandauFitPID option has been selected\n");
233 pidESD=loader->GetITSpid();
236 Info("FillESD","ITS default PID\n");
237 pidESD=loader->GetITSpid();
240 pidESD->MakePID(esd);
243 Error("FillESD","!! cannot do the PID !!\n");
248 //_____________________________________________________________________________
249 AliITSgeom* AliITSReconstructor::GetITSgeom(AliRunLoader* runLoader) const
251 // get the ITS geometry
253 if (!runLoader->GetAliRun()) runLoader->LoadgAlice();
254 if (!runLoader->GetAliRun()) {
255 Error("GetITSgeom", "couldn't get AliRun object");
258 AliITSLoader *loader = (AliITSLoader*)runLoader->GetLoader("ITSLoader");
259 AliITSgeom* geom = (AliITSgeom*)loader->GetITSgeom();
261 Error("GetITSgeom","no ITS geometry available");