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