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