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 "AliRunLoader.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 class AliRunDigitizer;
40 const Int_t kNTYPES=3;
42 class AliITS : public AliDetector {
45 //================= Standard Classes ===============================
46 AliITS(); // Default creator.
47 AliITS(const char *name, const char *title); // standard Creator
48 virtual ~AliITS(); // destructor
49 AliITS(const AliITS &source); // copy constructor. Not to be used!
50 AliITS& operator=(AliITS &source); // = operator. Not to be used!
51 virtual Int_t IsVersion() const {return 1;}
52 virtual Int_t DistancetoPrimitive(Int_t,Int_t) const{return 999;};
54 //===================== Simulation Geometry ========================
55 // get geometry version - detailed (major) or coarse (minor)
56 virtual Int_t GetMajorVersion() const {return -1;}
57 virtual Int_t GetMinorVersion() const {return -1;}
58 virtual void GetGeometryVersion(Int_t &a,Int_t &b)
59 {a = GetMajorVersion();b=GetMinorVersion();return;}
60 virtual void SetEUCLID(Bool_t euclid=kTRUE) {fEuclidOut = euclid;}
61 virtual Bool_t GetEUCLID()const {return fEuclidOut;}
62 //-------------------- Geometry Transformations --------------------
63 // ITS geometry functions
64 AliITSgeom *GetITSgeom() const {return fITSgeom;}
65 // Sets ITS geometry ! be very careful using this function.
66 void SetITSgeom(AliITSgeom *geom) {fITSgeom = geom;}
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));}
73 //================ Necessary general Classes =======================
75 virtual AliLoader* MakeLoader(const char* topfoldername);
76 virtual void SetDefaults();
77 virtual void SetDefaultSimulation();
78 virtual void SetDefaultClusterFinders();
79 virtual void MakeBranch(Option_t *opt=" ");
80 virtual void SetTreeAddress();
81 // For a given branch from the treeH sets the TClonesArray address.
82 virtual void SetHitsAddressBranch(TBranch *b) {b->SetAddress(&fHits);}
83 // Return pointer to DetType #id
84 AliITSDetType *DetType(Int_t id){
85 return ((AliITSDetType*) fDetTypes->At(id));};
86 //Int_t NDetTypes() {return fNDetTypes;}
87 //---------- Configuration Methods (per detector type) -------------
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;}
94 virtual void SetResponseModel(Int_t id, AliITSresponse *response){
95 ((AliITSDetType*) fDetTypes->At(id))->ResponseModel(response);};
97 virtual void SetSegmentationModel(Int_t id, AliITSsegmentation *seg){
98 ((AliITSDetType*) fDetTypes->At(id))->SegmentationModel(seg);};
99 // Set simulation - temporary
100 virtual void SetSimulationModel(Int_t id, AliITSsimulation *sim){
101 ((AliITSDetType*) fDetTypes->At(id))->SimulationModel(sim);};
102 // Set simulation - temporary
103 virtual AliITSsimulation* GetSimulationModel(Int_t id){
104 return ((AliITSDetType*)(fDetTypes->At(id)))->GetSimulationModel();}
105 // Set reconstruction
106 virtual void SetReconstructionModel(Int_t id, AliITSClusterFinder *rec){
107 ((AliITSDetType*) fDetTypes->At(id))->ReconstructionModel(rec);};
108 // Set class names for digit and rec point
109 virtual void SetClasses(Int_t id, const char *digit, const char *cluster){
110 ((AliITSDetType*) fDetTypes->At(id))->ClassNames(digit,cluster);};
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);
117 virtual void FillModules(TTree *treeH, Int_t mask = 0);
118 virtual void FillModules(Int_t evnt,Int_t bgrev,Int_t nmodules,
119 Option_t *opt, const char *filename);
120 virtual void ClearModules(){if(fITSmodules) fITSmodules->Delete();};
122 //===================== Digitisation ===============================
123 void MakeBranchS(const char *file);
124 void SetTreeAddressS(TTree *treeS);
125 TClonesArray * GetSDigits() { return fSDigits; }
126 void MakeBranchInTreeD(TTree *treeD,const char *file=0);
127 void MakeBranchD(const char *file){
128 MakeBranchInTreeD(GetLoader()->TreeD(),file);}
129 void SetTreeAddressD(TTree *treeD);
130 void Hits2SDigits(); // Turn hits into SDigits
131 void Hits2PreDigits(){ // Turn hits into SDigits
132 HitsToPreDigits(fLoader->GetRunLoader()->GetEventNumber(),
133 0,-1," ",fOpt," ");};
134 AliDigitizer* CreateDigitizer(AliRunDigitizer* manager) const;
135 void SDigits2Digits(){SDigitsToDigits("All");} // Turn SDigits to Digits
136 void SDigitsToDigits(Option_t *opt="All"); // Turn SDigits to Digits
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,
141 Option_t *add, Option_t *det, const char *filename)
142 {HitsToPreDigits(evNumber,bgrev,size,add,det,filename);};
143 // Standard Hits To SDigits function
144 void HitsToPreDigits(Int_t evNumber,Int_t bgrev,Int_t size,
145 Option_t *add, Option_t *det, const char *filename);
146 // Standard Hits To Digits function
147 void HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t size,
148 Option_t *add, Option_t *det, const char *filename);
149 // Resets the Summable digits.
150 void ResetSDigits(){if(fSDigits) fSDigits->Clear();fNSDigits = 0;};
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]);}
163 void SelectVertexer(TString sel=" "){fSelectedVertexer = sel;}
165 //===================== Raw Data IO ================================
166 // Write digits into raw data format
167 virtual void Digits2Raw();
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);
174 // one of the methods in
175 void ResetClusters(){for(Int_t i=0;i<kNTYPES;i++ ) ResetClusters(i);};
176 void ResetClusters(Int_t branch); // the pair will be kept
177 // Return pointers to clusters
178 TObjArray *Ctype() {return fCtype;}
179 Int_t *Nctype() {return fNctype;}
180 TClonesArray *ClustersAddress(Int_t id)
181 {return ((TClonesArray *) (*fCtype)[id]);}
183 //=================== Reconstruction ===============================
184 void MakeBranchR(const char *file, Option_t *opt=" ");
185 void MakeBranchRF(const char *file){MakeBranchR(file,"Fast");}
187 void SetTreeAddressR(TTree *treeR);
188 void AddRecPoint(const AliITSRecPoint &p);
189 void HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size,
190 Option_t *add, Option_t *det, const char *filename);
191 void Digits2Reco(){DigitsToRecPoints(fLoader->GetRunLoader()->GetEventNumber(),0,fOpt);};
192 void DigitsToRecPoints(Int_t evNumber,Int_t lastEntry,Option_t *det);
193 void ResetRecPoints(){if(fRecPoints) fRecPoints->Clear();fNRecPoints = 0;};
194 // Return pointer to rec points
195 TClonesArray *RecPoints() {return fRecPoints;}
198 //================== Data Members ==================================
199 AliITSgeom *fITSgeom; // Pointer to ITS geometry
200 Bool_t fEuclidOut; // Flag to write geometry in euclid format
201 TObjArray *fITSmodules; //! Pointer to ITS modules
202 Option_t *fOpt; //! Detector option ="All" unless changed.
204 Int_t fIdN; // the number of layers
205 Int_t *fIdSens; //[fIdN] layer identifier
206 TString *fIdName; //[fIdN] layer identifier
208 Int_t fNDetTypes; // Number of detector types
209 TObjArray *fDetTypes; // List of detector types
211 TClonesArray *fSDigits; //! List of Summable digits.
212 Int_t fNSDigits; // Number of Summable Digits.
214 TObjArray *fDtype; //! List of digits
215 Int_t *fNdtype; //[fNDetTypes] Num. of digits per type of det.
217 TObjArray *fCtype; //! List of clusters
218 Int_t *fNctype; //[fNDetTypes] Num. of clust. per type of det.
220 TClonesArray *fRecPoints; //! List of reconstructed points
221 Int_t fNRecPoints; // Number of rec points
222 TString fSelectedVertexer; // Vertexer selected in CreateVertexer
224 ClassDef(AliITS,4) // Base class for ITS