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