]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITS.h
Fixing memory leaks
[u/mrichter/AliRoot.git] / ITS / AliITS.h
CommitLineData
3bd79107 1#ifndef ALIITS_H
2#define ALIITS_H
3da30618 3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6/* $Id$ */
7
58005f18 8////////////////////////////////////////////////////////////////////////
3bd79107 9// Manager class for set: ITS //
58005f18 10////////////////////////////////////////////////////////////////////////
fe4da5cc 11
143d1056 12#include <TObjArray.h> // used in inline function GetModule.
cd77595e 13#include <TBranch.h> // used in inline function SetHitsAddressBranch
3bd79107 14
5d766c75 15#include "AliRunLoader.h"
fe4da5cc 16#include "AliDetector.h"
54b8cf3b 17#include "AliITSDetType.h"
de82972f 18
d5da1ecf 19class TString;
20class TTree;
55b5a0b3 21class TFile;
fe4da5cc 22
54b8cf3b 23//class AliITSDetType;
3bd79107 24class AliITSsimulation;
25class AliITSClusterFinder;
88cb7938 26class AliITSLoader;
de82972f 27class AliITSsegmentation;
28class AliITSresponse;
29class AliITShit;
30class AliITSgeom;
2aea926d 31class AliITSpListItem;
de82972f 32class AliITSdigit;
33class AliITSRecPoint;
34class AliITSRawCluster;
35class AliITSmodule;
2257f27e 36class AliVertexer;
aacedc3e 37class AliDigitizer;
38class AliRunDigitizer;
27a043b1 39
a8a6107b 40const Int_t kNTYPES=3;
de82972f 41
3bd79107 42class AliITS : public AliDetector {
58005f18 43
2aea926d 44 public:
45 //================= Standard Classes ===============================
46 AliITS(); // Default creator.
47 AliITS(const char *name, const char *title); // standard Creator
48 virtual ~AliITS(); // destructor
ac74f489 49 AliITS(const AliITS &source); // copy constructor. Not to be used!
2aea926d 50 AliITS& operator=(AliITS &source); // = operator. Not to be used!
51 virtual Int_t IsVersion() const {return 1;}
aacedc3e 52 virtual Int_t DistancetoPrimitive(Int_t,Int_t) const{return 999;};
2aea926d 53
54 //===================== Simulation Geometry ========================
e8189707 55 // get geometry version - detailed (major) or coarse (minor)
93f82b23 56 virtual Int_t GetMajorVersion() const {return -1;}
57 virtual Int_t GetMinorVersion() const {return -1;}
2aea926d 58 virtual void GetGeometryVersion(Int_t &a,Int_t &b)
59 {a = GetMajorVersion();b=GetMinorVersion();return;}
41b19549 60 virtual void SetEUCLID(Bool_t euclid=kTRUE) {fEuclidOut = euclid;}
a8e8915c 61 virtual Bool_t GetEUCLID()const {return fEuclidOut;}
2aea926d 62 //-------------------- Geometry Transformations --------------------
63 // ITS geometry functions
64 AliITSgeom *GetITSgeom() const {return fITSgeom;}
f91c3e58 65 // Sets ITS geometry ! be very careful using this function.
66 void SetITSgeom(AliITSgeom *geom) {fITSgeom = geom;}
2aea926d 67 // return pointer to the array of modules
68 TObjArray *GetModules() const {return fITSmodules;}
69 // return pointer to a particular module
70 AliITSmodule *GetModule(Int_t index) {return (AliITSmodule *)
71 (fITSmodules->At(index));}
3bd79107 72
88cb7938 73 //================ Necessary general Classes =======================
2aea926d 74 virtual void Init();
88cb7938 75 virtual AliLoader* MakeLoader(const char* topfoldername);
2aea926d 76 virtual void SetDefaults();
77 virtual void SetDefaultSimulation();
78 virtual void SetDefaultClusterFinders();
88cb7938 79 virtual void MakeBranch(Option_t *opt=" ");
2aea926d 80 virtual void SetTreeAddress();
93f82b23 81 // For a given branch from the treeH sets the TClonesArray address.
82 virtual void SetHitsAddressBranch(TBranch *b) {b->SetAddress(&fHits);}
2aea926d 83 // Return pointer to DetType #id
aacedc3e 84 AliITSDetType *DetType(Int_t id){
85 return ((AliITSDetType*) fDetTypes->At(id));};
2aea926d 86 //Int_t NDetTypes() {return fNDetTypes;}
87 //---------- Configuration Methods (per detector type) -------------
7d8046e8 88 // Determines which ITS subdetectors will be processed. Effects
89 // digitization, and Reconstruction only.
90 void SetDetectors(Option_t *opt="All"){fOpt = opt;}
91 // Returns the list of ITS subdetectors that will be processed.
92 Option_t* GetDetectors(){return fOpt;}
3bd79107 93 // Set response
aacedc3e 94 virtual void SetResponseModel(Int_t id, AliITSresponse *response){
95 ((AliITSDetType*) fDetTypes->At(id))->ResponseModel(response);};
3bd79107 96 // Set segmentation
aacedc3e 97 virtual void SetSegmentationModel(Int_t id, AliITSsegmentation *seg){
98 ((AliITSDetType*) fDetTypes->At(id))->SegmentationModel(seg);};
3bd79107 99 // Set simulation - temporary
aacedc3e 100 virtual void SetSimulationModel(Int_t id, AliITSsimulation *sim){
101 ((AliITSDetType*) fDetTypes->At(id))->SimulationModel(sim);};
54b8cf3b 102 // Set simulation - temporary
103 virtual AliITSsimulation* GetSimulationModel(Int_t id){
104 return ((AliITSDetType*)(fDetTypes->At(id)))->GetSimulationModel();}
3bd79107 105 // Set reconstruction
aacedc3e 106 virtual void SetReconstructionModel(Int_t id, AliITSClusterFinder *rec){
107 ((AliITSDetType*) fDetTypes->At(id))->ReconstructionModel(rec);};
3bd79107 108 // Set class names for digit and rec point
aacedc3e 109 virtual void SetClasses(Int_t id, const char *digit, const char *cluster){
110 ((AliITSDetType*) fDetTypes->At(id))->ClassNames(digit,cluster);};
2aea926d 111
112 //=================== Hits =========================================
113 virtual void StepManager() {} // See Step Manager for specific geometry.
114 virtual void AddHit(Int_t track, Int_t *vol, Float_t *hits);
115 //------------ sort hits by module for Digitisation ----------------
116 virtual void InitModules(Int_t size,Int_t &nmodules);
b4012daf 117 virtual void FillModules(TTree *treeH, Int_t mask = 0);
2aea926d 118 virtual void FillModules(Int_t evnt,Int_t bgrev,Int_t nmodules,
8e8eae84 119 Option_t *opt, const char *filename);
aacedc3e 120 virtual void ClearModules(){if(fITSmodules) fITSmodules->Delete();};
2aea926d 121
122 //===================== Digitisation ===============================
123 void MakeBranchS(const char *file);
124 void SetTreeAddressS(TTree *treeS);
f91c3e58 125 TClonesArray * GetSDigits() { return fSDigits; }
9ad8b5dd 126 void MakeBranchInTreeD(TTree *treeD,const char *file=0);
127 void MakeBranchD(const char *file){
8f726cb3 128 MakeBranchInTreeD(GetLoader()->TreeD(),file);}
2aea926d 129 void SetTreeAddressD(TTree *treeD);
130 void Hits2SDigits(); // Turn hits into SDigits
aacedc3e 131 void Hits2PreDigits(){ // Turn hits into SDigits
5d766c75 132 HitsToPreDigits(fLoader->GetRunLoader()->GetEventNumber(),
aacedc3e 133 0,-1," ",fOpt," ");};
c92eb8ad 134 AliDigitizer* CreateDigitizer(AliRunDigitizer* manager) const;
e0fc0305 135 void SDigits2Digits(){SDigitsToDigits("All");} // Turn SDigits to Digits
136 void SDigitsToDigits(Option_t *opt="All"); // Turn SDigits to Digits
2aea926d 137 void Hits2Digits(); // Turn hits straight into Digits.
138 //------------------ Internal functions ----------------------------
139 // Standard Hits To SDigits function
140 void HitsToSDigits(Int_t evNumber,Int_t bgrev,Int_t size,
aacedc3e 141 Option_t *add, Option_t *det, const char *filename)
142 {HitsToPreDigits(evNumber,bgrev,size,add,det,filename);};
2aea926d 143 // Standard Hits To SDigits function
144 void HitsToPreDigits(Int_t evNumber,Int_t bgrev,Int_t size,
8e8eae84 145 Option_t *add, Option_t *det, const char *filename);
2aea926d 146 // Standard Hits To Digits function
147 void HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t size,
8e8eae84 148 Option_t *add, Option_t *det, const char *filename);
aacedc3e 149 // Resets the Summable digits.
150 void ResetSDigits(){if(fSDigits) fSDigits->Clear();fNSDigits = 0;};
2aea926d 151 void ResetDigits(); // depending on how the
152 void ResetDigits(Int_t branch); // tree will be filled only
153 void AddSumDigit(AliITSpListItem &sdig);
154 void AddRealDigit(Int_t branch, Int_t *digits);
155 void AddSimDigit(Int_t branch, AliITSdigit *d);
156 void AddSimDigit(Int_t branch,Float_t phys,Int_t* digits,
157 Int_t* tracks,Int_t *hits,Float_t* trkcharges);
158 // Return pointers to digits
159 TObjArray *Dtype() {return fDtype;}
160 Int_t *Ndtype() {return fNdtype;}
161 TClonesArray *DigitsAddress(Int_t id)
162 {return ((TClonesArray *) (*fDtype)[id]);}
2257f27e 163 void SelectVertexer(TString sel=" "){fSelectedVertexer = sel;}
3bd79107 164
2aea926d 165 //===================== Raw Data IO ================================
166 // Write digits into raw data format
0421c3d1 167 virtual void Digits2Raw();
58005f18 168
2aea926d 169 //==================== Clusterization ==============================
170 // create separate tree for clusters - declustering refining
171 void MakeTreeC(Option_t *option="C");
172 void GetTreeC(Int_t event);
173 void AddCluster(Int_t branch, AliITSRawCluster *c);
aacedc3e 174 // one of the methods in
175 void ResetClusters(){for(Int_t i=0;i<kNTYPES;i++ ) ResetClusters(i);};
2aea926d 176 void ResetClusters(Int_t branch); // the pair will be kept
3bd79107 177 // Return pointers to clusters
2aea926d 178 TObjArray *Ctype() {return fCtype;}
179 Int_t *Nctype() {return fNctype;}
180 TClonesArray *ClustersAddress(Int_t id)
3bd79107 181 {return ((TClonesArray *) (*fCtype)[id]);}
182
2aea926d 183 //=================== Reconstruction ===============================
ff0e455e 184 void MakeBranchR(const char *file, Option_t *opt=" ");
185 void MakeBranchRF(const char *file){MakeBranchR(file,"Fast");}
88cb7938 186 void MakeBranchC();
2aea926d 187 void SetTreeAddressR(TTree *treeR);
188 void AddRecPoint(const AliITSRecPoint &p);
189 void HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size,
8e8eae84 190 Option_t *add, Option_t *det, const char *filename);
5d766c75 191 void Digits2Reco(){DigitsToRecPoints(fLoader->GetRunLoader()->GetEventNumber(),0,fOpt);};
2aea926d 192 void DigitsToRecPoints(Int_t evNumber,Int_t lastEntry,Option_t *det);
aacedc3e 193 void ResetRecPoints(){if(fRecPoints) fRecPoints->Clear();fNRecPoints = 0;};
3bd79107 194 // Return pointer to rec points
195 TClonesArray *RecPoints() {return fRecPoints;}
596a855f 196
2aea926d 197 protected:
198 //================== Data Members ==================================
199 AliITSgeom *fITSgeom; // Pointer to ITS geometry
e0fc0305 200 Bool_t fEuclidOut; // Flag to write geometry in euclid format
2aea926d 201 TObjArray *fITSmodules; //! Pointer to ITS modules
7d8046e8 202 Option_t *fOpt; //! Detector option ="All" unless changed.
3bd79107 203
e0fc0305 204 Int_t fIdN; // the number of layers
2aea926d 205 Int_t *fIdSens; //[fIdN] layer identifier
206 TString *fIdName; //[fIdN] layer identifier
3bd79107 207
e0fc0305 208 Int_t fNDetTypes; // Number of detector types
2aea926d 209 TObjArray *fDetTypes; // List of detector types
e8189707 210
88cb7938 211 TClonesArray *fSDigits; //! List of Summable digits.
2aea926d 212 Int_t fNSDigits; // Number of Summable Digits.
55b5a0b3 213
88cb7938 214 TObjArray *fDtype; //! List of digits
2aea926d 215 Int_t *fNdtype; //[fNDetTypes] Num. of digits per type of det.
3bd79107 216
88cb7938 217 TObjArray *fCtype; //! List of clusters
2aea926d 218 Int_t *fNctype; //[fNDetTypes] Num. of clust. per type of det.
3bd79107 219
88cb7938 220 TClonesArray *fRecPoints; //! List of reconstructed points
2aea926d 221 Int_t fNRecPoints; // Number of rec points
2257f27e 222 TString fSelectedVertexer; // Vertexer selected in CreateVertexer
3bd79107 223
2257f27e 224 ClassDef(AliITS,4) // Base class for ITS
fe4da5cc 225};
3bd79107 226
fe4da5cc 227#endif