Use directly TMath::Pi() and not kPI from TVector.h
[u/mrichter/AliRoot.git] / MUON / AliMUON.h
CommitLineData
fe4da5cc 1#ifndef MUON_H
2#define MUON_H
3////////////////////////////////////////////////
4// Manager and hits classes for set:MUON //
5////////////////////////////////////////////////
6#include "AliDetector.h"
7#include "AliHit.h"
8#include "AliMUONConst.h"
9#include "AliDigit.h"
10#include <TVector.h>
11#include <TObjArray.h>
12
13
14static const int NCH=14;
15
16class AliMUONcluster;
17class AliMUONchamber;
18class AliMUONRecCluster;
19//----------------------------------------------
20class AliMUONgeometry
21{
22 public:
23 AliMUONgeometry(){}
24 virtual ~AliMUONgeometry(){}
25 void InitGeo(Float_t z);
26 Float_t fdGas; // half gaz gap
27 Float_t fdAlu; // half Alu width
28 Float_t frMin; // innermost sensitive radius
29 Float_t frMax; // outermost sensitive radius
30 ClassDef(AliMUONgeometry,1)
31};
32//----------------------------------------------
33//
34// Chamber segmentation virtual base class
35//
36class AliMUONsegmentation :
37public TObject {
38
39 public:
40
41 // Set Chamber Segmentation Parameters
42 virtual void SetPADSIZ(Float_t p1, Float_t p2) =0;
43 virtual void SetDAnod(Float_t D) =0;
44 // Transform from pad (wire) to real coordinates and vice versa
45 virtual Float_t GetAnod(Float_t xhit) =0;
46 virtual void GetPadIxy(Float_t x ,Float_t y ,Int_t &ix,Int_t &iy)=0;
47 virtual void GetPadCxy(Int_t ix,Int_t iy,Float_t &x ,Float_t &y )=0;
48 //
49 // Initialisation
50 virtual void Init(AliMUONchamber*) =0;
51 //
52 // Get member data
53 virtual Float_t Dpx() =0;
54 virtual Float_t Dpy() =0;
55 virtual Int_t Npx() =0;
56 virtual Int_t Npy() =0;
57 //
58 // Iterate over pads
59 virtual void FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy) =0;
60 virtual void NextPad()=0;
61 virtual Int_t MorePads() =0;
62 // Get next neighbours
63 virtual void Neighbours
64 (Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10]) =0;
65 // Provisory RecCluster coordinates reconstructor
66 virtual void FitXY(AliMUONRecCluster* Cluster,TClonesArray* MUONdigits) =0;
67 //
68 // Current pad cursor during disintegration
69 virtual Int_t Ix() =0;
70 virtual Int_t Iy() =0;
71 virtual Int_t ISector() =0;
72 //
73 // Signal Generation Condition during Stepping
74 virtual Int_t SigGenCond(Float_t x, Float_t y, Float_t z) = 0;
75 virtual void SigGenInit(Float_t x, Float_t y, Float_t z) = 0;
76 virtual void IntegrationLimits
77 (Float_t& x1, Float_t& x2, Float_t& y1, Float_t& y2) = 0;
78 //
79 // Identification
fe4da5cc 80 ClassDef(AliMUONsegmentation,1)
81};
82//----------------------------------------------
83//
84// Chamber response virtual base class
85//
86class AliMUONresponse :
87public TObject {
88 public:
89 //
90 // Configuration methods
91 virtual void SetRSIGM(Float_t p1) =0;
92 virtual void SetMUCHSP(Float_t p1) =0;
93 virtual void SetMUSIGM(Float_t p1, Float_t p2) =0;
94 virtual void SetMAXADC(Float_t p1) =0;
95 //
96 // Get member data
97 virtual Float_t Chslope() =0;
98 virtual Float_t ChwX() =0;
99 virtual Float_t ChwY() =0;
100 virtual Float_t Nsigma() =0;
101 virtual Float_t adc_satm() =0;
102 //
103 // Chamber response methods
104 // Pulse height from scored quantity (eloss)
105 virtual Float_t IntPH(Float_t eloss) =0;
106 // Charge disintegration
107 virtual Float_t IntXY(AliMUONsegmentation *) =0;
108 //
109 // Identification
fe4da5cc 110 ClassDef(AliMUONresponse,1)
111};
112
113//----------------------------------------------
114class AliMUONchamber :
115public TObject,
116public AliMUONgeometry{
117 public:
118 AliMUONchamber();
119 ~AliMUONchamber(){}
120//
121// Set and get GEANT id
122 Int_t GetGid() {return fGid;}
123 void SetGid(Int_t id) {fGid=id;}
124//
125// Initialisation and z-Position
126 void Init();
127 void SetZPOS(Float_t p1) {fzPos=p1;}
128 Float_t ZPosition() {return fzPos;}
129//
130// Configure response model
131 void ResponseModel(AliMUONresponse* thisResponse) {fResponse=thisResponse;}
132//
133// Configure segmentation model
134 void SegmentationModel(Int_t i, AliMUONsegmentation* thisSegmentation) {
135 (*fSegmentation)[i-1] = thisSegmentation;
136 }
137//
138// Get reference to response model
139 AliMUONresponse* &GetResponseModel(){return fResponse;}
140//
141// Get reference to segmentation model
142 AliMUONsegmentation* GetSegmentationModel(Int_t isec) {
143 return (AliMUONsegmentation *) (*fSegmentation)[isec-1];
144 }
145 Int_t Nsec() {return fnsec;}
146 void SetNsec(Int_t nsec) {fnsec=nsec;}
147//
148// Member function forwarding to the segmentation and response models
149//
150// Calculate pulse height from energy loss
151 Float_t IntPH(Float_t eloss) {return fResponse->IntPH(eloss);}
152//
153// Ask segmentation if signal should be generated
154 Int_t SigGenCond(Float_t x, Float_t y, Float_t z)
155 {
156 if (fnsec==1) {
157 return ((AliMUONsegmentation*) (*fSegmentation)[0])
158 ->SigGenCond(x, y, z) ;
159 } else {
160 return (((AliMUONsegmentation*) (*fSegmentation)[0])
161 ->SigGenCond(x, y, z)) ||
162 (((AliMUONsegmentation*) (*fSegmentation)[1])
163 ->SigGenCond(x, y, z)) ;
164 }
165 }
166//
167// Initialisation of segmentation for hit
168 void SigGenInit(Float_t x, Float_t y, Float_t z)
169 {
170
171 if (fnsec==1) {
172 ((AliMUONsegmentation*) (*fSegmentation)[0])->SigGenInit(x, y, z) ;
173 } else {
174 ((AliMUONsegmentation*) (*fSegmentation)[0])->SigGenInit(x, y, z) ;
175 ((AliMUONsegmentation*) (*fSegmentation)[1])->SigGenInit(x, y, z) ;
176 }
177 }
178
179// Configuration forwarding
180//
181 void SetRSIGM(Float_t p1) {fResponse->SetRSIGM(p1);}
182 void SetMUCHSP(Float_t p1) {fResponse->SetMUCHSP(p1);}
183 void SetMUSIGM(Float_t p1, Float_t p2) {fResponse->SetMUSIGM(p1,p2);}
184 void SetMAXADC(Float_t p1) {fResponse->SetMAXADC(p1);}
185
186 void SetPADSIZ(Int_t isec, Float_t p1, Float_t p2) {
187 ((AliMUONsegmentation*) (*fSegmentation)[isec-1])->SetPADSIZ(p1,p2);
188 }
189//
190// Cluster formation method
191 void DisIntegration(Float_t, Float_t, Float_t, Int_t&x, Float_t newclust[6][500]);
192 ClassDef(AliMUONchamber,1)
193
194 private:
195// GEANT volume if for sensitive volume of this chamber
196 Int_t fGid;
197// z-position of this chamber
198 Float_t fzPos;
199// The segmentation models for the cathode planes
200// fnsec=1: one plane segmented, fnsec=2: both planes are segmented.
201 Int_t fnsec;
202 TObjArray *fSegmentation;
203 AliMUONresponse *fResponse;
204
205};
206
207
208
209class AliMUONcluster : public TObject {
210public:
211
212 Int_t fHitNumber; // Hit number
213 Int_t fCathode; // Cathode number
214 Int_t fQ ; // Total charge
215 Int_t fPadX ; // Pad number along X
216 Int_t fPadY ; // Pad number along Y
217 Int_t fQpad ; // Charge per pad
218 Int_t fRSec ; // R -sector of pad
219
220public:
221 AliMUONcluster() {
222 fHitNumber=fQ=fPadX=fPadY=fQpad=fRSec=0;
223}
224 AliMUONcluster(Int_t *clhits);
225 virtual ~AliMUONcluster() {;}
226
227 ClassDef(AliMUONcluster,1) //Cluster object for set:MUON
228};
229
230
231class AliMUONreccluster : public TObject {
232public:
233
234 Int_t fTracks[3]; //labels of overlapped tracks
235
236 Int_t fQ ; // Q of cluster (in ADC counts)
237 Float_t fX ; // X of cluster
238 Float_t fY ; // Y of cluster
239
240public:
241 AliMUONreccluster() {
242 fTracks[0]=fTracks[1]=fTracks[2]=0;
243 fQ=0; fX=fY=0;
244 }
245 virtual ~AliMUONreccluster() {;}
246
247 ClassDef(AliMUONreccluster,1) //Cluster object for set:MUON
248};
249
250//_____________________________________________________________________________
251
252class AliMUONdigit : public TObject {
253 public:
254 Int_t fPadX; // Pad number along x
255 Int_t fPadY ; // Pad number along y
256 Int_t fSignal; // Signal amplitude
257
258
259 Int_t fTcharges[10]; // charge per track making this digit (up to 10)
260 Int_t fTracks[10]; // tracks making this digit (up to 10)
261
262
263
264 public:
265 AliMUONdigit() {}
266 AliMUONdigit(Int_t *digits);
267 AliMUONdigit(Int_t *tracks, Int_t *charges, Int_t *digits);
268 virtual ~AliMUONdigit() {}
269
270
271 ClassDef(AliMUONdigit,1) //Digits for set:MUON
272};
273//_____________________________________________________________________________
274
275class AliMUONlist : public AliMUONdigit {
276 public:
277
278 Int_t fRpad; // r_pos of pad
279
280 TObjArray *fTrackList;
281
282
283 public:
284 AliMUONlist() {fTrackList=0;}
285 AliMUONlist(Int_t rpad, Int_t *digits);
286 virtual ~AliMUONlist() {}
287
288 TObjArray *TrackList() {return fTrackList;}
289
290 ClassDef(AliMUONlist,1) //Digits for set:MUON
291};
292//___________________________________________
293
294
295//___________________________________________
296
297class AliMUONhit : public AliHit {
298 public:
299 Int_t fChamber; // Chamber number
1578254f 300 Int_t fParticle; // PDG particle type
fe4da5cc 301 Float_t fTheta ; // Incident theta angle in degrees
302 Float_t fPhi ; // Incident phi angle in degrees
303 Float_t fTlength; // Track length inside the chamber
304 Float_t fEloss; // ionisation energy loss in gas
305 Int_t fPHfirst; // first padhit
306 Int_t fPHlast; // last padhit
307 public:
308 AliMUONhit() {}
309 AliMUONhit(Int_t fIshunt, Int_t track, Int_t *vol, Float_t *hits);
310 virtual ~AliMUONhit() {}
311
312 ClassDef(AliMUONhit,1) //Hits object for set:MUON
313};
314
315class AliMUON : public AliDetector {
316 public:
317 AliMUON();
318 AliMUON(const char *name, const char *title);
319 virtual ~AliMUON();
320 virtual void AddHit(Int_t, Int_t*, Float_t*);
321 virtual void AddCluster(Int_t*);
322 virtual void AddDigits(Int_t, Int_t*, Int_t*, Int_t*);
323 virtual void AddRecCluster(Int_t iCh, Int_t iCat,
324 AliMUONRecCluster* Cluster);
325 virtual void BuildGeometry();
326 virtual void CreateGeometry() {}
327 virtual void CreateMaterials() {}
328 virtual void StepManager();
329 Int_t DistancetoPrimitive(Int_t px, Int_t py);
330 virtual Int_t IsVersion() const =0;
331//
332 TClonesArray *Clusters() {return fClusters;}
333 virtual void MakeBranch(Option_t *opt=" ");
334 void SetTreeAddress();
335 virtual void ResetHits();
336 virtual void ResetDigits();
337 virtual void ResetRecClusters();
338 virtual void ReconstructClusters();
339//
340// Configuration Methods (per station id)
341//
342// Set Chamber Segmentation Parameters
343// id refers to the station and isec to the cathode plane
344 virtual void SetPADSIZ(Int_t id, Int_t isec, Float_t p1, Float_t p2);
345
346// Set Signal Generation Parameters
347 virtual void SetRSIGM(Int_t id, Float_t p1);
348 virtual void SetMUCHSP(Int_t id, Float_t p1);
349 virtual void SetMUSIGM(Int_t id, Float_t p1, Float_t p2);
350 virtual void SetMAXADC(Int_t id, Float_t p1);
351// Set Segmentation and Response Model
352 virtual void SetSegmentationModel(Int_t id, Int_t isec, AliMUONsegmentation *segmentation);
353 virtual void SetResponseModel(Int_t id, AliMUONresponse *response);
354 virtual void SetNsec(Int_t id, Int_t nsec);
355// Set Stepping Parameters
356 virtual void SetSMAXAR(Float_t p1);
357 virtual void SetSMAXAL(Float_t p1);
358 virtual void SetDMAXAR(Float_t p1);
359 virtual void SetDMAXAL(Float_t p1);
360 virtual void SetMUONACC(Bool_t acc=0, Float_t angmin=2, Float_t angmax=9);
361// Response Simulation
362 virtual void MakePadHits(Float_t xhit,Float_t yhit,Float_t eloss,Int_t id);
363// Return reference to Chamber #id
364 virtual AliMUONchamber& Chamber(Int_t id) {return *((AliMUONchamber *) (*fChambers)[id]);}
365// Retrieve pad hits for a given Hit
366 virtual AliMUONcluster* FirstPad(AliMUONhit *);
367 virtual AliMUONcluster* NextPad();
368// Return pointers to digits
369 TObjArray *Dchambers() {return fDchambers;}
370 Int_t *Ndch() {return fNdch;}
371 virtual TClonesArray *DigitsAddress(Int_t id) {return ((TClonesArray *) (*fDchambers)[id]);}
372// Return pointers to reconstructed clusters
373 virtual TObjArray *RecClusters(Int_t iCh, Int_t iCat)
374 {return ( (TObjArray*) (*fRecClusters)[iCh+iCat*10]);}
375
376
377 protected:
378 TObjArray *fChambers; // List of Tracking Chambers
379 Int_t fNclusters; // Number of clusters
380 TClonesArray *fClusters; // List of clusters
381 TObjArray *fDchambers; // List of digits
382 TObjArray *fRecClusters; // List of clusters
383 Int_t *fNdch; // Number of digits
384//
385 Bool_t fAccCut; //Transport acceptance cut
386 Float_t fAccMin; //Minimum acceptance cut used during transport
387 Float_t fAccMax; //Minimum acceptance cut used during transport
388//
389
390// Stepping Parameters
391 Float_t fMaxStepGas; // Maximum step size inside the chamber gas
392 Float_t fMaxStepAlu; // Maximum step size inside the chamber aluminum
393 Float_t fMaxDestepGas; // Maximum relative energy loss in gas
394 Float_t fMaxDestepAlu; // Maximum relative energy loss in aluminum
395
396 protected:
397
398 ClassDef(AliMUON,1) //Hits manager for set:MUON
399};
400//___________________________________________
401class AliMUONRecCluster : public TObject {
402public:
403 AliMUONRecCluster() ;
404 AliMUONRecCluster(Int_t FirstDigit,Int_t Ichamber, Int_t Icathod) ;
405 virtual ~AliMUONRecCluster();
406 virtual void AddDigit(Int_t Digit);
407 virtual Int_t FirstDigitIndex();
408 virtual Int_t NextDigitIndex();
409 virtual Int_t InvalidDigitIndex() {return -1;}
410
411 virtual Int_t NDigits();
412 virtual void Finish(); // Nothing yet ...
413 virtual Int_t GetCathod() {return fCathod;}
414 virtual Int_t GetChamber() {return fChamber;}
415
416public:
417 Float_t fX; // reconstructed x
418 Float_t fY; // reconstructed y
419
420protected:
421 TArrayI *fDigits; // List of digits indexes for that cluster
422 Int_t fNdigit; // Number of digits indexes stored;
423 Int_t fCathod; // Number of the cathod to be used;
424 Int_t fChamber; // Number of the chamber to be used;
425 Int_t fCurrentDigit; // Current Digit inside an iteration
426
427 ClassDef(AliMUONRecCluster,1) //Cluster object for set:MUON
428};
429//___________________________________________
430#endif
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445