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