Code for simulation, sdigitization and digitization moved from macros to compiled...
[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
9ad8b5dd 15#include "AliRun.h"
88cb7938 16#include "AliLoader.h"
fe4da5cc 17#include "AliDetector.h"
54b8cf3b 18#include "AliITSDetType.h"
de82972f 19
d5da1ecf 20class TString;
21class TTree;
55b5a0b3 22class TFile;
fe4da5cc 23
54b8cf3b 24//class AliITSDetType;
3bd79107 25class AliITSsimulation;
26class AliITSClusterFinder;
88cb7938 27class AliITSLoader;
de82972f 28class AliITSsegmentation;
29class AliITSresponse;
30class AliITShit;
31class AliITSgeom;
2aea926d 32class AliITSpListItem;
de82972f 33class AliITSdigit;
34class AliITSRecPoint;
35class AliITSRawCluster;
36class AliITSmodule;
27a043b1 37
a8a6107b 38const Int_t kNTYPES=3;
de82972f 39
3bd79107 40class AliITS : public AliDetector {
58005f18 41
2aea926d 42 public:
43 //================= Standard Classes ===============================
44 AliITS(); // Default creator.
45 AliITS(const char *name, const char *title); // standard Creator
46 virtual ~AliITS(); // destructor
ac74f489 47 AliITS(const AliITS &source); // copy constructor. Not to be used!
2aea926d 48 AliITS& operator=(AliITS &source); // = operator. Not to be used!
49 virtual Int_t IsVersion() const {return 1;}
93f82b23 50 virtual Int_t DistancetoPrimitive(Int_t px, Int_t py) const;
2aea926d 51
52 //===================== Simulation Geometry ========================
e8189707 53 // get geometry version - detailed (major) or coarse (minor)
93f82b23 54 virtual Int_t GetMajorVersion() const {return -1;}
55 virtual Int_t GetMinorVersion() const {return -1;}
2aea926d 56 virtual void GetGeometryVersion(Int_t &a,Int_t &b)
57 {a = GetMajorVersion();b=GetMinorVersion();return;}
41b19549 58 virtual void SetEUCLID(Bool_t euclid=kTRUE) {fEuclidOut = euclid;}
2aea926d 59 //-------------------- Geometry Transformations --------------------
60 // ITS geometry functions
61 AliITSgeom *GetITSgeom() const {return fITSgeom;}
f91c3e58 62 // Sets ITS geometry ! be very careful using this function.
63 void SetITSgeom(AliITSgeom *geom) {fITSgeom = geom;}
2aea926d 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));}
3bd79107 69
88cb7938 70 //================ Necessary general Classes =======================
2aea926d 71 virtual void Init();
88cb7938 72 virtual AliLoader* MakeLoader(const char* topfoldername);
2aea926d 73 virtual void SetDefaults();
74 virtual void SetDefaultSimulation();
75 virtual void SetDefaultClusterFinders();
88cb7938 76 virtual void MakeBranch(Option_t *opt=" ");
2aea926d 77 virtual void SetTreeAddress();
93f82b23 78 // For a given branch from the treeH sets the TClonesArray address.
79 virtual void SetHitsAddressBranch(TBranch *b) {b->SetAddress(&fHits);}
2aea926d 80 // Return pointer to DetType #id
81 AliITSDetType *DetType(Int_t id);
82 //Int_t NDetTypes() {return fNDetTypes;}
83 //---------- Configuration Methods (per detector type) -------------
7d8046e8 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;}
3bd79107 89 // Set response
2aea926d 90 virtual void SetResponseModel(Int_t id, AliITSresponse *response);
3bd79107 91 // Set segmentation
2aea926d 92 virtual void SetSegmentationModel(Int_t id, AliITSsegmentation *seg);
3bd79107 93 // Set simulation - temporary
2aea926d 94 virtual void SetSimulationModel(Int_t id, AliITSsimulation *sim);
54b8cf3b 95 // Set simulation - temporary
96 virtual AliITSsimulation* GetSimulationModel(Int_t id){
97 return ((AliITSDetType*)(fDetTypes->At(id)))->GetSimulationModel();}
3bd79107 98 // Set reconstruction
2aea926d 99 virtual void SetReconstructionModel(Int_t id, AliITSClusterFinder *rec);
3bd79107 100 // Set class names for digit and rec point
2aea926d 101 virtual void SetClasses(Int_t id, const char *digit, const char *cluster);
102
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);
b4012daf 108 virtual void FillModules(TTree *treeH, Int_t mask = 0);
2aea926d 109 virtual void FillModules(Int_t evnt,Int_t bgrev,Int_t nmodules,
110 Option_t *opt,Text_t *filename);
111 virtual void ClearModules();
112
113 //===================== Digitisation ===============================
114 void MakeBranchS(const char *file);
115 void SetTreeAddressS(TTree *treeS);
f91c3e58 116 TClonesArray * GetSDigits() { return fSDigits; }
9ad8b5dd 117 void MakeBranchInTreeD(TTree *treeD,const char *file=0);
118 void MakeBranchD(const char *file){
119 MakeBranchInTreeD(gAlice->TreeD(),file);}
2aea926d 120 void SetTreeAddressD(TTree *treeD);
121 void Hits2SDigits(); // Turn hits into SDigits
122 void Hits2PreDigits(); // Turn hits into SDigits
85a5290f 123 AliDigitizer* CreateDigitizer(AliRunDigitizer* manager);
e0fc0305 124 void SDigits2Digits(){SDigitsToDigits("All");} // Turn SDigits to Digits
125 void SDigitsToDigits(Option_t *opt="All"); // Turn SDigits to Digits
2aea926d 126 void Hits2Digits(); // Turn hits straight into Digits.
127 //------------------ Internal functions ----------------------------
128 // Standard Hits To SDigits function
129 void HitsToSDigits(Int_t evNumber,Int_t bgrev,Int_t size,
130 Option_t *add, Option_t *det, Text_t *filename);
131 // Standard Hits To SDigits function
132 void HitsToPreDigits(Int_t evNumber,Int_t bgrev,Int_t size,
133 Option_t *add, Option_t *det, Text_t *filename);
134 // Standard Hits To Digits function
135 void HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t size,
136 Option_t *add, Option_t *det, Text_t *filename);
137 void ResetSDigits(); // Resets the Summable digits.
138 void ResetDigits(); // depending on how the
139 void ResetDigits(Int_t branch); // tree will be filled only
140 void AddSumDigit(AliITSpListItem &sdig);
141 void AddRealDigit(Int_t branch, Int_t *digits);
142 void AddSimDigit(Int_t branch, AliITSdigit *d);
143 void AddSimDigit(Int_t branch,Float_t phys,Int_t* digits,
144 Int_t* tracks,Int_t *hits,Float_t* trkcharges);
145 // Return pointers to digits
146 TObjArray *Dtype() {return fDtype;}
147 Int_t *Ndtype() {return fNdtype;}
148 TClonesArray *DigitsAddress(Int_t id)
149 {return ((TClonesArray *) (*fDtype)[id]);}
3bd79107 150
2aea926d 151 //===================== Raw Data IO ================================
152 // Write digits into raw data format
153 virtual void Digits2RawData() {}
154 // Decode raw data and store digits
155 virtual void RawData2Digits() {}
58005f18 156
2aea926d 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
3bd79107 164 // Return pointers to clusters
2aea926d 165 TObjArray *Ctype() {return fCtype;}
166 Int_t *Nctype() {return fNctype;}
167 TClonesArray *ClustersAddress(Int_t id)
3bd79107 168 {return ((TClonesArray *) (*fCtype)[id]);}
169
2aea926d 170 //=================== Reconstruction ===============================
ff0e455e 171 void MakeBranchR(const char *file, Option_t *opt=" ");
172 void MakeBranchRF(const char *file){MakeBranchR(file,"Fast");}
88cb7938 173 void MakeBranchC();
2aea926d 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, Text_t *filename);
178 void Digits2Reco();
179 void DigitsToRecPoints(Int_t evNumber,Int_t lastEntry,Option_t *det);
180 void ResetRecPoints();
3bd79107 181 // Return pointer to rec points
182 TClonesArray *RecPoints() {return fRecPoints;}
88cb7938 183
2aea926d 184 protected:
185 //================== Data Members ==================================
186 AliITSgeom *fITSgeom; // Pointer to ITS geometry
e0fc0305 187 Bool_t fEuclidOut; // Flag to write geometry in euclid format
2aea926d 188 TObjArray *fITSmodules; //! Pointer to ITS modules
7d8046e8 189 Option_t *fOpt; //! Detector option ="All" unless changed.
3bd79107 190
e0fc0305 191 Int_t fIdN; // the number of layers
2aea926d 192 Int_t *fIdSens; //[fIdN] layer identifier
193 TString *fIdName; //[fIdN] layer identifier
3bd79107 194
e0fc0305 195 Int_t fNDetTypes; // Number of detector types
2aea926d 196 TObjArray *fDetTypes; // List of detector types
e8189707 197
88cb7938 198 TClonesArray *fSDigits; //! List of Summable digits.
2aea926d 199 Int_t fNSDigits; // Number of Summable Digits.
55b5a0b3 200
88cb7938 201 TObjArray *fDtype; //! List of digits
2aea926d 202 Int_t *fNdtype; //[fNDetTypes] Num. of digits per type of det.
3bd79107 203
88cb7938 204 TObjArray *fCtype; //! List of clusters
2aea926d 205 Int_t *fNctype; //[fNDetTypes] Num. of clust. per type of det.
3bd79107 206
88cb7938 207 TClonesArray *fRecPoints; //! List of reconstructed points
2aea926d 208 Int_t fNRecPoints; // Number of rec points
3bd79107 209
88cb7938 210 ClassDef(AliITS,3) // Base class for ITS
fe4da5cc 211};
3bd79107 212
fe4da5cc 213#endif