]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONChamber.cxx
Cleaning of the code (continued ) :
[u/mrichter/AliRoot.git] / MUON / AliMUONChamber.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15 /*
16 $Log$
17 Revision 1.4  2000/06/29 12:34:09  morsch
18 AliMUONSegmentation class has been made independent of AliMUONChamber. This makes
19 it usable with any other geometry class. The link to the object to which it belongs is
20 established via an index. This assumes that there exists a global geometry manager
21 from which the pointer to the parent object can be obtained (in our case gAlice).
22
23 Revision 1.3  2000/06/28 15:16:35  morsch
24 (1) Client code adapted to new method signatures in AliMUONSegmentation (see comments there)
25 to allow development of slat-muon chamber simulation and reconstruction code in the MUON
26 framework. The changes should have no side effects (mostly dummy arguments).
27 (2) Hit disintegration uses 3-dim hit coordinates to allow simulation
28 of chambers with overlapping modules (MakePadHits, Disintegration).
29
30 Revision 1.2  2000/06/15 07:58:48  morsch
31 Code from MUON-dev joined
32
33 Revision 1.1.2.5  2000/06/09 21:27:01  morsch
34 Most coding rule violations corrected.
35
36 Revision 1.1.2.4  2000/05/05 11:34:12  morsch
37 Log inside comments.
38
39 Revision 1.1.2.3  2000/05/05 10:09:52  morsch
40 Log messages included
41 */
42
43 #include "AliMUONChamber.h"
44 #include "AliMUONResponse.h"
45
46 #include "TMath.h"
47 ClassImp(AliMUONChamber)        
48
49     AliMUONChamber::AliMUONChamber()
50 {
51 // Default constructor
52     fSegmentation = new TObjArray(2);
53     (*fSegmentation)[0] = 0;
54     (*fSegmentation)[1] = 0;    
55     fResponse=0;
56     fnsec=1;
57     fReconstruction=0;
58     fId=0;
59 }
60
61     AliMUONChamber::AliMUONChamber(Int_t id) 
62 {
63 // Construtor with chamber id 
64     fSegmentation = new TObjArray(2);
65     (*fSegmentation)[0] = 0;
66     (*fSegmentation)[1] = 0;    
67     fResponse=0;
68     fnsec=1;
69     fReconstruction=0;
70     fId=id;
71 }
72
73 AliMUONChamber::~AliMUONChamber() 
74 {
75 // Destructor
76     if (fSegmentation) delete fSegmentation;
77 }
78
79 AliMUONChamber::AliMUONChamber(const AliMUONChamber& rChamber)
80 {
81 // Dummy copy constructor
82     ;
83 }
84
85
86 void AliMUONChamber::Init()
87 {
88 // Initalisation ..
89 //
90 // ... for chamber segmentation
91     if ((*fSegmentation)[0]) 
92     ((AliSegmentation *) (*fSegmentation)[0])->Init(fId);
93
94     if (fnsec==2) {
95         if ((*fSegmentation)[1])
96         ((AliSegmentation *) (*fSegmentation)[1])->Init(fId);
97     }
98 }
99
100 Int_t   AliMUONChamber::SigGenCond(Float_t x, Float_t y, Float_t z)
101 {
102 // Ask segmentation if signal should be generated 
103     if (fnsec==1) {
104         return ((AliSegmentation*) (*fSegmentation)[0])
105             ->SigGenCond(x, y, z) ;
106     } else {
107         return (((AliSegmentation*) (*fSegmentation)[0])
108                 ->SigGenCond(x, y, z)) ||
109             (((AliSegmentation*) (*fSegmentation)[1])
110              ->SigGenCond(x, y, z)) ;
111     }
112 }
113
114
115 void    AliMUONChamber::SigGenInit(Float_t x, Float_t y, Float_t z)
116 {
117 //
118 // Initialisation of segmentation for hit
119 //  
120     if (fnsec==1) {
121         ((AliSegmentation*) (*fSegmentation)[0])->SigGenInit(x, y, z) ;
122     } else {
123         ((AliSegmentation*) (*fSegmentation)[0])->SigGenInit(x, y, z) ;
124         ((AliSegmentation*) (*fSegmentation)[1])->SigGenInit(x, y, z) ;
125     }
126 }
127
128 void AliMUONChamber::DisIntegration(Float_t eloss, Float_t tof, 
129                                     Float_t xhit, Float_t yhit, Float_t zhit,
130                                     Int_t& nnew,Float_t newclust[6][500]) 
131 {
132 //    
133 //  Generates pad hits (simulated cluster) 
134 //  using the segmentation and the response model 
135     Float_t dx, dy;
136     //
137     // Width of the integration area
138     //
139     dx=fResponse->SigmaIntegration()*fResponse->ChargeSpreadX();
140     dy=fResponse->SigmaIntegration()*fResponse->ChargeSpreadY();
141     //
142     // Get pulse height from energy loss
143     Float_t qtot = fResponse->IntPH(eloss);
144     //
145     // Loop Over Pads
146     
147     Float_t qcheck=0, qp;
148     nnew=0;
149     for (Int_t i=1; i<=fnsec; i++) {
150         qcheck=0;
151         AliSegmentation * segmentation=
152             (AliSegmentation *) (*fSegmentation)[i-1];
153         for (segmentation->FirstPad(xhit, yhit, zhit, dx, dy); 
154              segmentation->MorePads(); 
155              segmentation->NextPad()) 
156         {
157             qp=fResponse->IntXY(segmentation);
158             qp=TMath::Abs(qp);
159             
160 //
161 //
162             if (qp > 1.e-4) {
163                 qcheck+=qp;
164             //
165             // --- store signal information
166                 newclust[0][nnew]=qtot;                     // total charge
167                 newclust[1][nnew]=segmentation->Ix();       // ix-position of pad
168                 newclust[2][nnew]=segmentation->Iy();       // iy-position of pad
169                 newclust[3][nnew]=qp * qtot;                // charge on pad
170                 newclust[4][nnew]=segmentation->ISector();  // sector id
171                 newclust[5][nnew]=(Float_t) i;              // counter
172                 nnew++;
173             }
174         } // Pad loop
175     } // Cathode plane loop
176 }
177
178
179
180 void AliMUONChamber::InitGeo(Float_t zpos)
181 {
182 //    sensitive gas gap
183       fdGas= 0.5;
184 //    3% radiation length of aluminum (X0=8.9 cm)      
185       fdAlu= 3.0/100*8.9;
186 }
187
188
189 AliMUONChamber & AliMUONChamber::operator =(const AliMUONChamber& rhs)
190 {
191 // Dummy assignment operator
192     return *this;
193 }