3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
8 ////////////////////////////////////////////////////////////////////////
9 // Manager class for set: ITS //
10 ////////////////////////////////////////////////////////////////////////
12 #include <TObjArray.h> // used in inline function GetModule.
13 #include <TBranch.h> // used in inline function SetHitsAddressBranch
15 #include "AliLoader.h"
16 #include "AliDetector.h"
17 #include "AliITSDetType.h"
23 //class AliITSDetType;
24 class AliITSsimulation;
25 class AliITSClusterFinder;
27 class AliITSsegmentation;
31 class AliITSpListItem;
34 class AliITSRawCluster;
38 const Int_t kNTYPES=3;
40 class AliITS : public AliDetector {
43 //================= Standard Classes ===============================
44 AliITS(); // Default creator.
45 AliITS(const char *name, const char *title); // standard Creator
46 virtual ~AliITS(); // destructor
47 AliITS(const AliITS &source); // copy constructor. Not to be used!
48 AliITS& operator=(AliITS &source); // = operator. Not to be used!
49 virtual Int_t IsVersion() const {return 1;}
50 virtual Int_t DistancetoPrimitive(Int_t px, Int_t py) const;
52 //===================== Simulation Geometry ========================
53 // get geometry version - detailed (major) or coarse (minor)
54 virtual Int_t GetMajorVersion() const {return -1;}
55 virtual Int_t GetMinorVersion() const {return -1;}
56 virtual void GetGeometryVersion(Int_t &a,Int_t &b)
57 {a = GetMajorVersion();b=GetMinorVersion();return;}
58 virtual void SetEUCLID(Bool_t euclid=kTRUE) {fEuclidOut = euclid;}
59 virtual Bool_t GetEUCLID()const {return fEuclidOut;}
60 //-------------------- Geometry Transformations --------------------
61 // ITS geometry functions
62 AliITSgeom *GetITSgeom() const {return fITSgeom;}
63 // Sets ITS geometry ! be very careful using this function.
64 void SetITSgeom(AliITSgeom *geom) {fITSgeom = geom;}
65 // return pointer to the array of modules
66 TObjArray *GetModules() const {return fITSmodules;}
67 // return pointer to a particular module
68 AliITSmodule *GetModule(Int_t index) {return (AliITSmodule *)
69 (fITSmodules->At(index));}
71 //================ Necessary general Classes =======================
73 virtual AliLoader* MakeLoader(const char* topfoldername);
74 virtual void SetDefaults();
75 virtual void SetDefaultSimulation();
76 virtual void SetDefaultClusterFinders();
77 virtual void MakeBranch(Option_t *opt=" ");
78 virtual void SetTreeAddress();
79 // For a given branch from the treeH sets the TClonesArray address.
80 virtual void SetHitsAddressBranch(TBranch *b) {b->SetAddress(&fHits);}
81 // Return pointer to DetType #id
82 AliITSDetType *DetType(Int_t id);
83 //Int_t NDetTypes() {return fNDetTypes;}
84 //---------- Configuration Methods (per detector type) -------------
85 // Determines which ITS subdetectors will be processed. Effects
86 // digitization, and Reconstruction only.
87 void SetDetectors(Option_t *opt="All"){fOpt = opt;}
88 // Returns the list of ITS subdetectors that will be processed.
89 Option_t* GetDetectors(){return fOpt;}
91 virtual void SetResponseModel(Int_t id, AliITSresponse *response);
93 virtual void SetSegmentationModel(Int_t id, AliITSsegmentation *seg);
94 // Set simulation - temporary
95 virtual void SetSimulationModel(Int_t id, AliITSsimulation *sim);
96 // Set simulation - temporary
97 virtual AliITSsimulation* GetSimulationModel(Int_t id){
98 return ((AliITSDetType*)(fDetTypes->At(id)))->GetSimulationModel();}
100 virtual void SetReconstructionModel(Int_t id, AliITSClusterFinder *rec);
101 // Set class names for digit and rec point
102 virtual void SetClasses(Int_t id, const char *digit, const char *cluster);
104 //=================== Hits =========================================
105 virtual void StepManager() {} // See Step Manager for specific geometry.
106 virtual void AddHit(Int_t track, Int_t *vol, Float_t *hits);
107 //------------ sort hits by module for Digitisation ----------------
108 virtual void InitModules(Int_t size,Int_t &nmodules);
109 virtual void FillModules(TTree *treeH, Int_t mask = 0);
110 virtual void FillModules(Int_t evnt,Int_t bgrev,Int_t nmodules,
111 Option_t *opt, const char *filename);
112 virtual void ClearModules();
114 //===================== Digitisation ===============================
115 void MakeBranchS(const char *file);
116 void SetTreeAddressS(TTree *treeS);
117 TClonesArray * GetSDigits() { return fSDigits; }
118 void MakeBranchInTreeD(TTree *treeD,const char *file=0);
119 void MakeBranchD(const char *file){
120 MakeBranchInTreeD(GetLoader()->TreeD(),file);}
121 void SetTreeAddressD(TTree *treeD);
122 void Hits2SDigits(); // Turn hits into SDigits
123 void Hits2PreDigits(); // Turn hits into SDigits
124 AliDigitizer* CreateDigitizer(AliRunDigitizer* manager) const;
125 void SDigits2Digits(){SDigitsToDigits("All");} // Turn SDigits to Digits
126 void SDigitsToDigits(Option_t *opt="All"); // Turn SDigits to Digits
127 void Hits2Digits(); // Turn hits straight into Digits.
128 //------------------ Internal functions ----------------------------
129 // Standard Hits To SDigits function
130 void HitsToSDigits(Int_t evNumber,Int_t bgrev,Int_t size,
131 Option_t *add, Option_t *det, const char *filename);
132 // Standard Hits To SDigits function
133 void HitsToPreDigits(Int_t evNumber,Int_t bgrev,Int_t size,
134 Option_t *add, Option_t *det, const char *filename);
135 // Standard Hits To Digits function
136 void HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t size,
137 Option_t *add, Option_t *det, const char *filename);
138 void ResetSDigits(); // Resets the Summable digits.
139 void ResetDigits(); // depending on how the
140 void ResetDigits(Int_t branch); // tree will be filled only
141 void AddSumDigit(AliITSpListItem &sdig);
142 void AddRealDigit(Int_t branch, Int_t *digits);
143 void AddSimDigit(Int_t branch, AliITSdigit *d);
144 void AddSimDigit(Int_t branch,Float_t phys,Int_t* digits,
145 Int_t* tracks,Int_t *hits,Float_t* trkcharges);
146 // Return pointers to digits
147 TObjArray *Dtype() {return fDtype;}
148 Int_t *Ndtype() {return fNdtype;}
149 TClonesArray *DigitsAddress(Int_t id)
150 {return ((TClonesArray *) (*fDtype)[id]);}
151 void SelectVertexer(TString sel=" "){fSelectedVertexer = sel;}
153 //===================== Raw Data IO ================================
154 // Write digits into raw data format
155 virtual void Digits2Raw();
157 //==================== Clusterization ==============================
158 // create separate tree for clusters - declustering refining
159 void MakeTreeC(Option_t *option="C");
160 void GetTreeC(Int_t event);
161 void AddCluster(Int_t branch, AliITSRawCluster *c);
162 void ResetClusters(); // one of the methods in
163 void ResetClusters(Int_t branch); // the pair will be kept
164 // Return pointers to clusters
165 TObjArray *Ctype() {return fCtype;}
166 Int_t *Nctype() {return fNctype;}
167 TClonesArray *ClustersAddress(Int_t id)
168 {return ((TClonesArray *) (*fCtype)[id]);}
170 //=================== Reconstruction ===============================
171 void MakeBranchR(const char *file, Option_t *opt=" ");
172 void MakeBranchRF(const char *file){MakeBranchR(file,"Fast");}
174 void SetTreeAddressR(TTree *treeR);
175 void AddRecPoint(const AliITSRecPoint &p);
176 void HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size,
177 Option_t *add, Option_t *det, const char *filename);
179 void DigitsToRecPoints(Int_t evNumber,Int_t lastEntry,Option_t *det);
180 void ResetRecPoints();
181 // Return pointer to rec points
182 TClonesArray *RecPoints() {return fRecPoints;}
184 virtual void Reconstruct() const;
185 virtual AliTracker* CreateTracker() const;
186 virtual AliVertexer* CreateVertexer() const;
187 virtual void FillESD(AliESD* esd) const;
190 //================== Data Members ==================================
191 AliITSgeom *fITSgeom; // Pointer to ITS geometry
192 Bool_t fEuclidOut; // Flag to write geometry in euclid format
193 TObjArray *fITSmodules; //! Pointer to ITS modules
194 Option_t *fOpt; //! Detector option ="All" unless changed.
196 Int_t fIdN; // the number of layers
197 Int_t *fIdSens; //[fIdN] layer identifier
198 TString *fIdName; //[fIdN] layer identifier
200 Int_t fNDetTypes; // Number of detector types
201 TObjArray *fDetTypes; // List of detector types
203 TClonesArray *fSDigits; //! List of Summable digits.
204 Int_t fNSDigits; // Number of Summable Digits.
206 TObjArray *fDtype; //! List of digits
207 Int_t *fNdtype; //[fNDetTypes] Num. of digits per type of det.
209 TObjArray *fCtype; //! List of clusters
210 Int_t *fNctype; //[fNDetTypes] Num. of clust. per type of det.
212 TClonesArray *fRecPoints; //! List of reconstructed points
213 Int_t fNRecPoints; // Number of rec points
214 TString fSelectedVertexer; // Vertexer selected in CreateVertexer
216 ClassDef(AliITS,4) // Base class for ITS