Old behavior restored including feedback photons for backward compartability and...
[u/mrichter/AliRoot.git] / RICH / AliRICH.h
CommitLineData
2f614988 1#ifndef AliRICH_h
2#define AliRICH_h
2e5f0f7b 3
3da30618 4/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
6
7/* $Id$ */
8
2e5f0f7b 9
c11ee6f0 10#include <TObjArray.h>
853634d3 11#include <TClonesArray.h>
c11ee6f0 12#include <AliDetector.h>
853634d3 13#include <AliHit.h>
14#include <AliDigit.h>
dfb4e77d 15#include "AliRICHConst.h"
16#include "AliRICHChamber.h"
853634d3 17
237c933d 18static const int kNCH=7;
fe4da5cc 19
2ab0c725 20class TFile;
fe4da5cc 21
b251a2b5 22class AliRICHSDigit;
2e5f0f7b 23class AliRICHRawCluster;
a4622d0f 24class AliRICHRecHit1D;
25class AliRICHRecHit3D;
2e5f0f7b 26class AliRICHClusterFinder;
27class AliRICHDetect;
28class AliRICHChamber;
29class AliRICHCerenkov;
a2f7eaf6 30class AliSegmentation;
2e5f0f7b 31class AliRICHResponse;
237c933d 32class AliRICHGeometry;
d8a72780 33class AliRICHMerger;
ddae0931 34
853634d3 35
36
37class AliRICHhit : public AliHit
38{
39public:
40 inline AliRICHhit();
41 inline AliRICHhit(Int_t fIshunt, Int_t track, Int_t *vol, Float_t *hits);
42 virtual ~AliRICHhit() {;}
43
44 Int_t Chamber() {return fChamber;}
45 Float_t Particle() {return fParticle;}
46 Float_t Theta() {return fTheta;}
47 Float_t Phi() {return fPhi;}
48 Float_t Tlength() {return fTlength;}
49 Float_t Eloss() {return fEloss;}
50 Float_t Loss() {return fLoss;}
51 Float_t PHfirst() {return fPHfirst;}
52 Float_t PHlast() {return fPHlast;}
53 Float_t MomX() {return fMomX;}
54 Float_t MomY() {return fMomY;}
55 Float_t MomZ() {return fMomZ;}
56 Float_t CerenkovAngle() {return fMomX;}
57 Float_t MomFreoX() {return fMomX;}
58 Float_t MomFreoY() {return fMomY;}
59 Float_t MomFreoZ() {return fMomZ;}
60protected:
61 Int_t fChamber; // Chamber number
62 Float_t fParticle; // Geant3 particle type
63 Float_t fTheta ; // Incident theta angle in degrees
64 Float_t fPhi ; // Incident phi angle in degrees
65 Float_t fTlength; // Track length inside the chamber
66 Float_t fEloss; // ionisation energy loss in gas
67 Float_t fPHfirst; // first padhit
68 Float_t fPHlast; // last padhit
69 Float_t fLoss; // did it hit the freon?
70 Float_t fMomX; // x Momentum at photochatode entry point
71 Float_t fMomY; // y Momentum at photochatode entry point
72 Float_t fMomZ; // z Momentum at photochatode entry point
73 Float_t fNPads; // Pads hit
74 Float_t fCerenkovAngle; // Dummy cerenkov angle
75 Float_t fMomFreoX; // x Momentum at freon entry point
76 Float_t fMomFreoY; // y Momentum at freon entry point
77 Float_t fMomFreoZ; // z Momentum at freon entry point
78
79 ClassDef(AliRICHhit,1) //RICH hit class
80};//class AliRICHhit
81//______________________________________________________________________________
82AliRICHhit::AliRICHhit()
83 :AliHit()
84{//default ctor
85 fChamber=-1;
86 fParticle=fTheta=fPhi=fTlength=fEloss=fPHfirst=fPHlast=fLoss=-1;
87 fMomX=fMomY=fMomZ=fNPads=fCerenkovAngle=fMomFreoX=fMomFreoY=fMomFreoZ=-1;
88}//AliRICHhit::default ctor
89//______________________________________________________________________________
90AliRICHhit::AliRICHhit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
91 AliHit(shunt, track)
92{//ctor
93 fChamber=vol[0];
94 fParticle=hits[0];
95 fX=hits[1];
96 fY=hits[2];
97 fZ=hits[3];
98 fTheta=hits[4];
99 fPhi=hits[5];
100 fTlength=hits[6];
101 fEloss=hits[7];
102 fPHfirst=(Int_t) hits[8];
103 fPHlast=(Int_t) hits[9];
104 fLoss=hits[13];
105 fMomX=hits[14];
106 fMomY=hits[15];
107 fMomZ=hits[16];
108 fNPads=hits[17];
109 fCerenkovAngle=hits[18];
110 fMomFreoX=hits[19];
111 fMomFreoY=hits[20];
112 fMomFreoZ=hits[21];
113}//AliRICHhit::ctor
114//______________________________________________________________________________
115//______________________________________________________________________________
116//______________________________________________________________________________
117class AliRICHCerenkov: public AliHit
118{
119public:
120 inline AliRICHCerenkov();
121 inline AliRICHCerenkov(Int_t fIshunt, Int_t track, Int_t *vol, Float_t *Cerenkovs);
122 virtual ~AliRICHCerenkov() {;}
123public:
124 Int_t fChamber; // Chamber number
125 Float_t fTheta ; // Incident theta angle in degrees
126 Float_t fPhi ; // Incident phi angle in degrees
127 Float_t fTlength; // Track length inside the chamber
128 Float_t fEloss; // ionisation energy loss in gas
129 Int_t fPHfirst; // first padhit
130 Int_t fPHlast; // last padhit
131 Int_t fCMother; // index of mother particle
132 Float_t fLoss; // nature of particle loss
133 Float_t fIndex; // Index of photon
134 Float_t fProduction; // Point of production
135 Float_t fMomX; // Local Momentum
136 Float_t fMomY; // Local Momentum
137 Float_t fMomZ; // Local Momentum
138 Float_t fNPads; // Pads hit
139 Float_t fCerenkovAngle; // Cerenkov Angle
140
141 ClassDef(AliRICHCerenkov,1) //RICH cerenkov class
142};//class AliRICHCerenkov
143//______________________________________________________________________________
144AliRICHCerenkov::AliRICHCerenkov()
145{//ctor
146 fChamber=-1;
147 fX=fY=fZ=fTheta=fPhi=fTlength=fEloss=-1;
148 fPHfirst=fPHlast=fCMother=-1;
149 fLoss=fIndex=fProduction=fMomX=fMomY=fMomZ=fNPads=fCerenkovAngle=-1;
150}//AliRICHCerenkov::ctor
151//______________________________________________________________________________
152AliRICHCerenkov::AliRICHCerenkov(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits)
153 :AliHit(shunt, track)
154{//ctor
155 fChamber=vol[0];
156 fX=hits[1];
157 fY=hits[2];
158 fZ=hits[3];
159 fTheta=hits[4];
160 fPhi=hits[5];
161 fTlength=hits[6];
162 fEloss=hits[7];
163 fPHfirst=(Int_t) hits[8];
164 fPHlast=(Int_t) hits[9];
165 fCMother=Int_t(hits[10]);
166 fIndex = hits[11];
167 fProduction = hits[12];
168 fLoss=hits[13];
169 fMomX=hits[14];
170 fMomY=hits[15];
171 fMomZ=hits[16];
172 fNPads=hits[17];
173 fCerenkovAngle=hits[18];
174}//AliRICHCerenkov::ctor
175//______________________________________________________________________________
176//______________________________________________________________________________
177//______________________________________________________________________________
178class AliRICHdigit :public AliDigit
179{
180public:
181 AliRICHdigit() {fPadX=fPadY=fChamber=fAdc=fTracks[0]=fTracks[1]=fTracks[2]=-1;}
182 inline AliRICHdigit(Int_t iC,Int_t iX,Int_t iY,Int_t iAdc,Int_t iT1,Int_t iT2,Int_t iT3);
183 virtual ~AliRICHdigit() {;}
184 Int_t C() const{return fChamber;}
185 Int_t X() const{return fPadX;}
186 Int_t Y() const{return fPadY;}
187 Int_t Adc() const{return fAdc;}
188protected:
189 Int_t fChamber; //module number
190 Int_t fPadX; //pad number along X
191 Int_t fPadY; //pad number along Y
192 Int_t fAdc; //ADC value
193 ClassDef(AliRICHdigit,1) //RICH digit class
194};//class AliRICHdigit
195//______________________________________________________________________________
196AliRICHdigit::AliRICHdigit(Int_t iC,Int_t iX,Int_t iY,Int_t iAdc,Int_t iT0,Int_t iT1,Int_t iT2)
197{
198 fChamber=iC;fPadX=iX;fPadY=iY;fAdc=iAdc;
199 fTracks[0]=iT0;fTracks[1]=iT1;fTracks[2]=iT2;
200}//AliRICHdigit::ctor
201//______________________________________________________________________________
202//______________________________________________________________________________
203//______________________________________________________________________________
2f614988 204class AliRICH : public AliDetector
205{
2f614988 206public:
853634d3 207 AliRICH();
208 AliRICH(const char *name, const char *title);
942194a4 209 AliRICH(const AliRICH& RICH):AliDetector(RICH) {;}
853634d3 210 virtual ~AliRICH();
dfb4e77d 211
942194a4 212 AliRICH& operator=(const AliRICH&) {return *this;}
3ba5db3e 213 virtual Int_t IsVersion() const =0;
dfb4e77d 214
853634d3 215 inline void AddHit(Int_t track, Int_t *vol, Float_t *hits);//virtual
216 inline void AddCerenkov(Int_t track, Int_t *vol, Float_t *cerenkovs);
217 inline void AddSDigit(Int_t iC,Int_t iX,Int_t iY,Int_t iAdc,Int_t iT0,Int_t iT1=-1,Int_t iT2=-1);
dfb4e77d 218 void AddDigits(Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits);
219 void AddRawCluster(Int_t id, const AliRICHRawCluster& cluster);
220 void AddRecHit1D(Int_t id, Float_t* rechit, Float_t* photons, Int_t* padsx, Int_t* padsy);
221 void AddRecHit3D(Int_t id, Float_t* rechit, Float_t omega, Float_t theta, Float_t phi);
853634d3 222 inline void ResetHits(); //virtual
223 inline void ResetSDigits(); //virtual
224 void ResetDigits(); //virtual
dfb4e77d 225 void ResetRawClusters();
226 void ResetRecHits1D();
227 void ResetRecHits3D();
942194a4 228 virtual void FindClusters(Int_t nev);
853634d3 229 void Hits2SDigits(); //virtual
230 void Hits2SDigits(Int_t iEventN);
231 void Hits2SDigits(Float_t xhit,Float_t yhit,Float_t eloss,Int_t id, ResponseType res);
dfb4e77d 232 virtual void SDigits2Digits();
233 virtual void Digits2Reco();
234
235 virtual void CreateMaterials(); //GEANT materials definition
236 Float_t AbsoCH4(Float_t x);
237 Float_t Fresnel(Float_t ene,Float_t pdoti, Bool_t pola);
238 virtual void BuildGeometry(); //TNode ROOT variant for event display
239 virtual void CreateGeometry(); //GEANT volumes tree for simulation
240 virtual void StepManager()=0;
2f614988 241
942194a4 242 Int_t DistancetoPrimitive(Int_t /*px*/, Int_t /*py*/) {return 9999;}
2f614988 243
dfb4e77d 244 virtual void MakeBranch(Option_t *opt=" ");
245 virtual void MakeBranchInTreeD(TTree *treeD, const char *file=0);
246 virtual void SetTreeAddress();
2f614988 247
853634d3 248
2f614988 249
853634d3 250 AliRICHSDigit* FirstPad(AliRICHhit *hit, TClonesArray *clusters);
dfb4e77d 251 AliRICHSDigit* NextPad(TClonesArray *clusters);
2f614988 252
c11ee6f0 253
dfb4e77d 254 void SetGeometryModel(Int_t iChamberN, AliRICHGeometry *pRICHGeo) { GetChamber(iChamberN)->SetGeometryModel(pRICHGeo);}
255 AliRICHGeometry* GetGeometryModel(Int_t iChamberN=0) const{return GetChamber(iChamberN)->GetGeometryModel();}
256 void SetSegmentationModel(Int_t iChamberN, AliSegmentation *pAliSeg) { GetChamber(iChamberN)->SetSegmentationModel(pAliSeg);}
257 AliSegmentation* GetSegmentationModel(Int_t iChamberN=0) const{return GetChamber(iChamberN)->GetSegmentationModel();}
258 void SetResponseModel(Int_t iChamberN, AliRICHResponse *pRICHRes) { GetChamber(iChamberN)->SetResponseModel(pRICHRes);}
259 AliRICHResponse* GetResponseModel(Int_t iChamberN) const{return GetChamber(iChamberN)->GetResponseModel();}
260 void SetReconstructionModel(Int_t iChamberN, AliRICHClusterFinder *pRICHReco){GetChamber(iChamberN)->SetReconstructionModel(pRICHReco);}
261
853634d3 262//kir virtual void SetMerger(AliRICHMerger* thisMerger) {fMerger=thisMerger;}
dfb4e77d 263 AliRICHChamber& Chamber(Int_t id) {return *((AliRICHChamber *) (*fChambers)[id]);}
264 AliRICHChamber* GetChamber(Int_t iChamberN) const{return (AliRICHChamber*) (*fChambers)[iChamberN];}
265
3ba5db3e 266 TObjArray *Dchambers() {return fDchambers;}
267 TObjArray *RecHits3D() const{return fRecHits3D;}
268 TObjArray *RecHits1D() const{return fRecHits1D;}
269 Int_t *Ndch() {return fNdch;}
270 Int_t *Nrechits1D() {return fNrechits1D;}
271 Int_t *Nrechits3D() {return fNrechits3D;}
272 TClonesArray *SDigits() const{return fSDigits;}
273 TClonesArray *Cerenkovs() const{return fCerenkovs;}
274 TClonesArray *DigitsAddress(Int_t id) {return ((TClonesArray *) (*fDchambers)[id]);}
275 TClonesArray *RecHitsAddress1D(Int_t id) const{return ((TClonesArray *) (*fRecHits1D)[id]);}
276 TClonesArray *RecHitsAddress3D(Int_t id) const{return ((TClonesArray *) (*fRecHits3D)[id]);}
277 TClonesArray *RawClustAddress(Int_t id) const{return ((TClonesArray *) (*fRawClusters)[id]);}
dfb4e77d 278
279 void DiagnosticsFE(Int_t evNumber1=0,Int_t evNumber2=0); // Full events
280 void DiagnosticsSE(Int_t diaglevel,Int_t evNumber1=0,Int_t evNumber2=0); // Single events
c11ee6f0 281
dfb4e77d 282 virtual void Print(Option_t *option)const; // Prints debug information
2f614988 283
284protected:
dfb4e77d 285 TObjArray *fChambers; //! List of RICH chambers
853634d3 286 Int_t fNsdigits; //Current number of sdigits
dfb4e77d 287 Int_t fNcerenkovs; //Current number of cerenkovs
288 TClonesArray *fSDigits; //! List of sdigits
289 TObjArray *fDchambers; //! Array of lists of digits
290 TClonesArray *fCerenkovs; //! List of cerenkovs
291 Int_t fNdch[kNCH]; //Array of current numbers of digits
292 TObjArray *fRawClusters; // !List of raw clusters
293 TObjArray *fRecHits1D; // !List of rec. hits
294 TObjArray *fRecHits3D; // !List of rec. hits
295 Int_t fNrawch[kNCH]; //Array of current numbers of raw clusters
296 Int_t fNrechits1D[kNCH]; //Array of current numbers of rec hits 1D
297 Int_t fNrechits3D[kNCH]; //Array of current numbers of rec hits 3D
298
299 Int_t fCkovNumber; // Number of Cerenkov photons
dfb4e77d 300 Int_t fFreonProd; // Cerenkovs produced in freon
dfb4e77d 301 Int_t fFeedbacks; // Number of feedback photons
853634d3 302//kir Int_t fCkovQuarz; // Cerenkovs crossing quartz
303//kir Int_t fCkovGap; // Cerenkovs crossing gap
304//kir Int_t fCkovCsi; // Cerenkovs crossing csi
305//kir Int_t fLostRfreo; // Cerenkovs reflected in freon
306//kir Int_t fLostRquar; // Cerenkovs reflected in quartz
307//kir Int_t fLostAfreo; // Cerenkovs absorbed in freon
308//kir Int_t fLostAquarz; // Cerenkovs absorbed in quartz
309//kir Int_t fLostAmeta; // Cerenkovs absorbed in methane
310//kir Int_t fLostCsi; // Cerenkovs below csi quantum efficiency
311//kir Int_t fLostWires; // Cerenkovs lost in wires
312//kir Float_t fMipx; // x coord. of MIP
313//kir Float_t fMipy; // y coord. of MIP
314//kir Int_t fLostFresnel; // Cerenkovs lost by Fresnel reflection
d8a72780 315
853634d3 316//kir Text_t *fFileName; //! File with background hits
317//kir AliRICHMerger *fMerger; //! pointer to merger
ddae0931 318
dfb4e77d 319 ClassDef(AliRICH,2) //Main RICH class
c11ee6f0 320};//class AliRICH
853634d3 321
322//______________________________________________________________________________
323void AliRICH::AddHit(Int_t track, Int_t *vol, Float_t *hits)
324{//Adds the current hit to the RICH hits list
325 TClonesArray &tmp=*fHits;
326 new(tmp[fNhits++])AliRICHhit(fIshunt,track,vol,hits);
327}
328//______________________________________________________________________________
329void AliRICH::AddCerenkov(Int_t track, Int_t *vol, Float_t *cerenkovs)
330{//Adds the current RICH cerenkov hit to the Cerenkovs list
331 TClonesArray &tmp=*fCerenkovs;
332 new(tmp[fNcerenkovs++]) AliRICHCerenkov(fIshunt,track,vol,cerenkovs);
333}
334//______________________________________________________________________________
335void AliRICH::ResetHits()
336{//Resets hits and cerenkovs
337 AliDetector::ResetHits();
338 fNcerenkovs = 0;
339 if(fCerenkovs)fCerenkovs->Clear();
340}
341//______________________________________________________________________________
342void AliRICH::AddSDigit(Int_t iC,Int_t iX,Int_t iY,Int_t iAdc,Int_t iT0,Int_t iT1,Int_t iT2)
343{//Adds the current Sdigit to the RICH list of Sdigits
344 TClonesArray &tmp = *fSDigits;
345 new(tmp[fNsdigits++])AliRICHdigit(iC,iX,iY,iAdc,iT0,iT1,iT2);
346}
347//______________________________________________________________________________
348void AliRICH::ResetSDigits()
349{//Resets sdigits
350 fNsdigits=0;
351 if(fSDigits)fSDigits->Clear();
352}
353//______________________________________________________________________________
2f614988 354#endif