]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITS.h
Memory leak corrected (B.Nilsen)
[u/mrichter/AliRoot.git] / ITS / AliITS.h
1 #ifndef ALIITS_H
2 #define ALIITS_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id$ */
7
8 ////////////////////////////////////////////////////////////////////////
9 //           Manager class for set: ITS                               //
10 ////////////////////////////////////////////////////////////////////////
11
12 #include <TObjArray.h> // used in inline function GetModule.
13
14 #include "AliDetector.h"
15
16 class TString;
17 class TTree;
18 class TFile;
19
20 class AliITSDetType;
21 class AliITSsimulation;
22 class AliITSClusterFinder;
23 class AliITSsegmentation;
24 class AliITSresponse;
25 class AliITShit;
26 class AliITSgeom;
27 class AliITSpListItem;
28 class AliITSdigit;
29 class AliITSRecPoint;
30 class AliITSRawCluster;
31 class AliITSmodule;
32
33 const Int_t kNTYPES=3;
34
35 class AliITS : public AliDetector {
36
37  public:
38     //================= Standard Classes ===============================
39     AliITS();  // Default creator.
40     AliITS(const char *name, const char *title); // standard Creator
41     virtual ~AliITS(); // destructor
42     AliITS(AliITS &source); // copy constructor. Not to be used!
43     AliITS& operator=(AliITS &source); // = operator. Not to be used!
44     virtual Int_t IsVersion() const {return 1;}
45     virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
46
47     //===================== Simulation Geometry ========================
48     // get geometry version - detailed (major) or coarse (minor)
49     virtual Int_t GetMajorVersion(){return -1;}
50     virtual Int_t GetMinorVersion(){return -1;}
51     virtual void  GetGeometryVersion(Int_t &a,Int_t &b) 
52                            {a = GetMajorVersion();b=GetMinorVersion();return;}
53     virtual void  SetEUCLID(Bool_t euclid=1) {fEuclidOut = euclid;}
54     //-------------------- Geometry Transformations --------------------
55     // ITS geometry functions
56     AliITSgeom   *GetITSgeom() const {return fITSgeom;}
57     // return pointer to the array of modules
58     TObjArray    *GetModules() const {return fITSmodules;}
59     // return pointer to a particular module
60     AliITSmodule *GetModule(Int_t index) {return (AliITSmodule *)
61                                               (fITSmodules->At(index));}
62
63     //================ Nessesary general Classes =======================
64     virtual void Init();
65     virtual void SetDefaults();
66     virtual void SetDefaultSimulation();
67     virtual void SetDefaultClusterFinders();
68     virtual void MakeBranch(Option_t *opt=" ", const char *file=0);
69     virtual void SetTreeAddress();
70     // Return pointer to DetType #id
71     AliITSDetType *DetType(Int_t id);
72     //Int_t           NDetTypes() {return fNDetTypes;}
73     //---------- Configuration Methods (per detector type) -------------
74     // Set response 
75     virtual void SetResponseModel(Int_t id, AliITSresponse *response);
76     // Set segmentation 
77     virtual void SetSegmentationModel(Int_t id, AliITSsegmentation *seg);
78     // Set simulation - temporary 
79     virtual void SetSimulationModel(Int_t id, AliITSsimulation *sim);
80     // Set reconstruction 
81     virtual void SetReconstructionModel(Int_t id, AliITSClusterFinder *rec);
82     // Set class names for digit and rec point 
83     virtual void SetClasses(Int_t id, const char *digit, const char *cluster);
84
85     //=================== Hits =========================================
86     virtual void StepManager() {} // See Step Manager for specific geometry.
87     virtual void AddHit(Int_t track, Int_t *vol, Float_t *hits);
88     //------------ sort hits by module for Digitisation ----------------
89     virtual void InitModules(Int_t size,Int_t &nmodules);  
90     virtual void FillModules(Int_t evnt,Int_t bgrev,Int_t nmodules,
91                              Option_t *opt,Text_t *filename);
92     virtual void ClearModules();
93
94     //===================== Digitisation ===============================
95     void MakeBranchS(const char *file);
96     void SetTreeAddressS(TTree *treeS);
97     void MakeBranchD(const char *file);
98     void SetTreeAddressD(TTree *treeD);
99     void Hits2SDigits(); // Turn hits into SDigits
100     void Hits2PreDigits(); // Turn hits into SDigits
101     void SDigits2Digits(); // Turn SDigits to Digits
102     void Hits2Digits(); // Turn hits straight into Digits.
103     //------------------ Internal functions ----------------------------
104     // Standard Hits To SDigits function
105     void HitsToSDigits(Int_t evNumber,Int_t bgrev,Int_t size,
106                  Option_t *add, Option_t *det, Text_t *filename);
107     // Standard Hits To SDigits function
108     void HitsToPreDigits(Int_t evNumber,Int_t bgrev,Int_t size,
109                  Option_t *add, Option_t *det, Text_t *filename);
110     // Standard Hits To Digits function
111     void HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t size,
112                  Option_t *add, Option_t *det, Text_t *filename);
113     void ResetSDigits();                  // Resets the Summable digits.
114     void ResetDigits();                   // depending on how the
115     void ResetDigits(Int_t branch);       // tree will be filled only
116     void AddSumDigit(AliITSpListItem &sdig);
117     void AddRealDigit(Int_t branch, Int_t *digits);
118     void AddSimDigit(Int_t branch, AliITSdigit *d);
119     void AddSimDigit(Int_t branch,Float_t phys,Int_t* digits,
120                      Int_t* tracks,Int_t *hits,Float_t* trkcharges);
121     // Return pointers to digits 
122     TObjArray    *Dtype() {return fDtype;}
123     Int_t        *Ndtype() {return fNdtype;}
124     TClonesArray *DigitsAddress(Int_t id)
125         {return ((TClonesArray *) (*fDtype)[id]);}
126
127     //===================== Raw Data IO ================================
128     // Write digits into raw data format
129     virtual void Digits2RawData() {}
130     // Decode raw data and store digits
131     virtual void RawData2Digits() {}
132
133     //==================== Clusterization ==============================
134     // create separate tree for clusters - declustering refining
135     void MakeTreeC(Option_t *option="C");
136     void GetTreeC(Int_t event);
137     void AddCluster(Int_t branch, AliITSRawCluster *c);
138     void ResetClusters();                 // one of the methods in 
139     void ResetClusters(Int_t branch);     // the pair will be kept
140     // Return pointer to the tree of clusters
141     TTree        *TreeC() {return fTreeC;}
142     // Return pointers to clusters 
143     TObjArray    *Ctype() {return fCtype;}
144     Int_t        *Nctype() {return fNctype;}
145     TClonesArray *ClustersAddress(Int_t id) 
146                    {return ((TClonesArray *) (*fCtype)[id]);}
147
148     //=================== Reconstruction ===============================
149     void MakeBranchR(const char *file);
150     void SetTreeAddressR(TTree *treeR);
151     void AddRecPoint(const AliITSRecPoint &p);
152     void HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size,
153                  Option_t *add, Option_t *det, Text_t *filename);
154     void Digits2Reco();
155     void DigitsToRecPoints(Int_t evNumber,Int_t lastEntry,Option_t *det);
156     void ResetRecPoints();
157     // Return pointer to rec points 
158     TClonesArray  *RecPoints()   {return fRecPoints;}
159
160  protected:
161     //================== Data Members ==================================
162     AliITSgeom   *fITSgeom;    // Pointer to ITS geometry
163     Bool_t       fEuclidOut;   // Flag to write geometry in euclid format
164     TObjArray    *fITSmodules; //! Pointer to ITS modules
165
166     Int_t        fIdN;         // the number of layers
167     Int_t        *fIdSens;     //[fIdN] layer identifier
168     TString      *fIdName;     //[fIdN] layer identifier
169
170     Int_t        fNDetTypes;   // Number of detector types
171     TObjArray    *fDetTypes;   // List of detector types
172
173 //    TObjArray    *fSDigits;    // List of Summable digits.
174     TClonesArray  *fSDigits;   // List of Summable digits.
175     Int_t         fNSDigits;   // Number of Summable Digits.
176
177     TObjArray    *fDtype;      // List of digits
178     Int_t        *fNdtype;     //[fNDetTypes] Num. of digits per type of det. 
179
180     TObjArray    *fCtype;      // List of clusters
181     Int_t        *fNctype;     //[fNDetTypes] Num. of clust. per type of det.
182     TTree        *fTreeC;      // Tree for raw clusters
183
184     TClonesArray *fRecPoints;  // List of reconstructed points
185     Int_t         fNRecPoints; // Number of rec points
186
187     ClassDef(AliITS,1) // Base class for ITS
188 };
189
190 #endif