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
16 #include "AliLoader.h"
17 #include "AliDetector.h"
18 #include "AliITSDetType.h"
24 //class AliITSDetType;
25 class AliITSsimulation;
26 class AliITSClusterFinder;
28 class AliITSsegmentation;
32 class AliITSpListItem;
35 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(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);
52 //===================== Simulation Geometry ========================
53 // get geometry version - detailed (major) or coarse (minor)
54 virtual Int_t GetMajorVersion(){return -1;}
55 virtual Int_t GetMinorVersion(){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=1) {fEuclidOut = euclid;}
59 //-------------------- Geometry Transformations --------------------
60 // ITS geometry functions
61 AliITSgeom *GetITSgeom() const {return fITSgeom;}
62 // Sets ITS geometry ! be very careful using this function.
63 void SetITSgeom(AliITSgeom *geom) {fITSgeom = geom;}
64 // return pointer to the array of modules
65 TObjArray *GetModules() const {return fITSmodules;}
66 // return pointer to a particular module
67 AliITSmodule *GetModule(Int_t index) {return (AliITSmodule *)
68 (fITSmodules->At(index));}
70 //================ Necessary general Classes =======================
72 virtual AliLoader* MakeLoader(const char* topfoldername);
73 virtual void SetDefaults();
74 virtual void SetDefaultSimulation();
75 virtual void SetDefaultClusterFinders();
76 virtual void MakeBranch(Option_t *opt=" ");
77 virtual void SetTreeAddress();
78 // For a give branch from the treeH sets the TClonesArray address.
79 virtual void SetHitsAddressBranch(TBranch *b){b->SetAddress(&fHits);}
80 // Return pointer to DetType #id
81 AliITSDetType *DetType(Int_t id);
82 //Int_t NDetTypes() {return fNDetTypes;}
83 //---------- Configuration Methods (per detector type) -------------
84 // Determines which ITS subdetectors will be processed. Effects
85 // digitization, and Reconstruction only.
86 void SetDetectors(Option_t *opt="All"){fOpt = opt;}
87 // Returns the list of ITS subdetectors that will be processed.
88 Option_t* GetDetectors(){return fOpt;}
90 virtual void SetResponseModel(Int_t id, AliITSresponse *response);
92 virtual void SetSegmentationModel(Int_t id, AliITSsegmentation *seg);
93 // Set simulation - temporary
94 virtual void SetSimulationModel(Int_t id, AliITSsimulation *sim);
95 // Set simulation - temporary
96 virtual AliITSsimulation* GetSimulationModel(Int_t id){
97 return ((AliITSDetType*)(fDetTypes->At(id)))->GetSimulationModel();}
99 virtual void SetReconstructionModel(Int_t id, AliITSClusterFinder *rec);
100 // Set class names for digit and rec point
101 virtual void SetClasses(Int_t id, const char *digit, const char *cluster);
103 //=================== Hits =========================================
104 virtual void StepManager() {} // See Step Manager for specific geometry.
105 virtual void AddHit(Int_t track, Int_t *vol, Float_t *hits);
106 //------------ sort hits by module for Digitisation ----------------
107 virtual void InitModules(Int_t size,Int_t &nmodules);
108 virtual void FillModules(TTree *treeH, Int_t mask = 0);
109 virtual void FillModules(Int_t evnt,Int_t bgrev,Int_t nmodules,
110 Option_t *opt,Text_t *filename);
111 virtual void ClearModules();
113 //===================== Digitisation ===============================
114 void MakeBranchS(const char *file);
115 void SetTreeAddressS(TTree *treeS);
116 TClonesArray * GetSDigits() { return fSDigits; }
117 void MakeBranchInTreeD(TTree *treeD,const char *file=0);
118 void MakeBranchD(const char *file){
119 MakeBranchInTreeD(gAlice->TreeD(),file);}
120 void SetTreeAddressD(TTree *treeD);
121 void Hits2SDigits(); // Turn hits into SDigits
122 void Hits2PreDigits(); // Turn hits into SDigits
123 void SDigits2Digits(){SDigitsToDigits("All");} // Turn SDigits to Digits
124 void SDigitsToDigits(Option_t *opt="All"); // Turn SDigits to Digits
125 void Hits2Digits(); // Turn hits straight into Digits.
126 //------------------ Internal functions ----------------------------
127 // Standard Hits To SDigits function
128 void HitsToSDigits(Int_t evNumber,Int_t bgrev,Int_t size,
129 Option_t *add, Option_t *det, Text_t *filename);
130 // Standard Hits To SDigits function
131 void HitsToPreDigits(Int_t evNumber,Int_t bgrev,Int_t size,
132 Option_t *add, Option_t *det, Text_t *filename);
133 // Standard Hits To Digits function
134 void HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t size,
135 Option_t *add, Option_t *det, Text_t *filename);
136 void ResetSDigits(); // Resets the Summable digits.
137 void ResetDigits(); // depending on how the
138 void ResetDigits(Int_t branch); // tree will be filled only
139 void AddSumDigit(AliITSpListItem &sdig);
140 void AddRealDigit(Int_t branch, Int_t *digits);
141 void AddSimDigit(Int_t branch, AliITSdigit *d);
142 void AddSimDigit(Int_t branch,Float_t phys,Int_t* digits,
143 Int_t* tracks,Int_t *hits,Float_t* trkcharges);
144 // Return pointers to digits
145 TObjArray *Dtype() {return fDtype;}
146 Int_t *Ndtype() {return fNdtype;}
147 TClonesArray *DigitsAddress(Int_t id)
148 {return ((TClonesArray *) (*fDtype)[id]);}
150 //===================== Raw Data IO ================================
151 // Write digits into raw data format
152 virtual void Digits2RawData() {}
153 // Decode raw data and store digits
154 virtual void RawData2Digits() {}
156 //==================== Clusterization ==============================
157 // create separate tree for clusters - declustering refining
158 void MakeTreeC(Option_t *option="C");
159 void GetTreeC(Int_t event);
160 void AddCluster(Int_t branch, AliITSRawCluster *c);
161 void ResetClusters(); // one of the methods in
162 void ResetClusters(Int_t branch); // the pair will be kept
163 // Return pointers to clusters
164 TObjArray *Ctype() {return fCtype;}
165 Int_t *Nctype() {return fNctype;}
166 TClonesArray *ClustersAddress(Int_t id)
167 {return ((TClonesArray *) (*fCtype)[id]);}
169 //=================== Reconstruction ===============================
170 void MakeBranchR(const char *file, Option_t *opt=" ");
171 void MakeBranchRF(const char *file){MakeBranchR(file,"Fast");}
173 void SetTreeAddressR(TTree *treeR);
174 void AddRecPoint(const AliITSRecPoint &p);
175 void HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size,
176 Option_t *add, Option_t *det, Text_t *filename);
178 void DigitsToRecPoints(Int_t evNumber,Int_t lastEntry,Option_t *det);
179 void ResetRecPoints();
180 // Return pointer to rec points
181 TClonesArray *RecPoints() {return fRecPoints;}
184 //================== Data Members ==================================
185 AliITSgeom *fITSgeom; // Pointer to ITS geometry
186 Bool_t fEuclidOut; // Flag to write geometry in euclid format
187 TObjArray *fITSmodules; //! Pointer to ITS modules
188 Option_t *fOpt; //! Detector option ="All" unless changed.
190 Int_t fIdN; // the number of layers
191 Int_t *fIdSens; //[fIdN] layer identifier
192 TString *fIdName; //[fIdN] layer identifier
194 Int_t fNDetTypes; // Number of detector types
195 TObjArray *fDetTypes; // List of detector types
197 TClonesArray *fSDigits; //! List of Summable digits.
198 Int_t fNSDigits; // Number of Summable Digits.
200 TObjArray *fDtype; //! List of digits
201 Int_t *fNdtype; //[fNDetTypes] Num. of digits per type of det.
203 TObjArray *fCtype; //! List of clusters
204 Int_t *fNctype; //[fNDetTypes] Num. of clust. per type of det.
206 TClonesArray *fRecPoints; //! List of reconstructed points
207 Int_t fNRecPoints; // Number of rec points
209 ClassDef(AliITS,3) // Base class for ITS