]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONChamberTrigger.cxx
Reducing number of overlaps with SHIELD module (Gines)
[u/mrichter/AliRoot.git] / MUON / AliMUONChamberTrigger.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 /* $Id$ */
17
18 #include "AliMUONChamberTrigger.h"
19 #include "AliMUONResponseTrigger.h"
20 #include "AliMUONHit.h"
21 #include "AliMUONGeometrySegmentation.h"
22 #include "AliLog.h"
23
24 ClassImp(AliMUONChamberTrigger)
25
26 //-------------------------------------------
27
28 AliMUONChamberTrigger::AliMUONChamberTrigger()
29   : AliMUONChamber()
30 {
31 // Default constructor
32 }
33
34
35 AliMUONChamberTrigger::AliMUONChamberTrigger(Int_t id) 
36   : AliMUONChamber(id)
37 {
38 // Constructor using chamber id
39 }
40
41 //-------------------------------------------
42 void AliMUONChamberTrigger::DisIntegration(Float_t /*eloss*/, Float_t tof, 
43                                            Float_t xhit, Float_t yhit, Float_t zhit, 
44                                            Int_t& nnew,
45                                            Float_t newclust[6][500]) 
46 {
47 //    
48 //  Generates pad hits (simulated cluster) 
49 //  using the segmentation and the response model
50
51   Int_t twentyNano;
52   if (tof<75*TMath::Power(10,-9)) {
53     twentyNano=1;
54   } else {
55     twentyNano=100;
56   }
57
58   Float_t qp;
59   nnew=0;
60   for (Int_t i=1; i<=fnsec; i++) {
61     AliSegmentation * segmentation=
62       (AliSegmentation*) (*fSegmentation)[i-1];
63     
64 // Find the module & strip Id. which has fired
65     Int_t ix,iy;
66     
67     segmentation->GetPadI(xhit,yhit,0,ix,iy);
68     segmentation->SetPad(ix,iy);
69 //    printf("  fnsec xhit yhit zhit ix iy %i %f %f %f %i %i \n",i,xhit,yhit,zhit,ix,iy);       
70
71 // treatment of GEANT hits w/o corresponding strip (due to the fact that
72 // the 2 geometries are computed in a very slightly different way) 
73     if (ix==0&&iy==0) {
74       AliInfo(Form("AliMUONChamberTrigger hit w/o strip %f %f \n",xhit,yhit));
75     } else {          
76       // --- store signal information for this strip
77       newclust[0][nnew]=1.;                       // total charge
78       newclust[1][nnew]=ix;                       // ix-position of pad
79       newclust[2][nnew]=iy;                       // iy-position of pad
80       newclust[3][nnew]=twentyNano;               // time of flight
81       newclust[4][nnew]=segmentation->ISector();  // sector id
82       newclust[5][nnew]=(Float_t) i;              // counter
83       nnew++;
84
85 // cluster-size if AliMUONResponseTriggerV1, nothing if AliMUONResponseTrigger
86       if (((AliMUONResponseTrigger*) fResponse)->SetGenerCluster()) {
87   
88         // set hits
89         segmentation->SetHit(xhit,yhit,zhit);
90         // get the list of nearest neighbours
91         Int_t nList, xList[10], yList[10];
92         segmentation->Neighbours(ix,iy,&nList,xList,yList);
93         
94         qp = 0;
95         for (Int_t j=0; j<nList; j++){       // loop over neighbours      
96           if (xList[j]!=0) {                 // existing neighbour          
97             if (j==0||j==5||qp!=0) {         // built-up cluster-size
98               
99               // neighbour real coordinates (just for checks here)
100               Float_t x,y,z;
101               segmentation->GetPadC(xList[j],yList[j],x,y,z);
102               // set pad (fx fy & fix fiy are the current pad coord. & Id.)
103               segmentation->SetPad(xList[j],yList[j]);    
104               // get the chamber (i.e. current strip) response
105               qp=fResponse->IntXY(segmentation);          
106               
107               if (qp > 0.5) {           
108                 // --- store signal information for neighbours 
109                 newclust[0][nnew]=qp;                      // total charge
110                 newclust[1][nnew]=segmentation->Ix();      // ix-pos. of pad
111                 newclust[2][nnew]=segmentation->Iy();      // iy-pos. of pad
112                 newclust[3][nnew]=twentyNano;              // time of flight
113                 newclust[4][nnew]=segmentation->ISector(); // sector id
114                 newclust[5][nnew]=(Float_t) i;             // counter
115                 nnew++;
116               } // qp > 0.5 
117             } // built-up cluster-size
118           } // existing neighbour
119         } // loop over neighbours
120       } // endif hit w/o strip
121     } // loop over planes
122   } // if AliMUONResponseTriggerV1
123 }
124
125
126
127 //-------------------------------------------
128 void AliMUONChamberTrigger::DisIntegration(AliMUONHit* hit,
129                                            Int_t& nnew,
130                                            Float_t newclust[6][500]) 
131 {
132 //    
133 //  Generates pad hits (simulated cluster) 
134 //  using the segmentation and the response model
135
136
137   Float_t   tof = hit->Age();
138   Float_t  xhit = hit->X();
139   Float_t  yhit = hit->Y();
140   Float_t  zhit = hit->Z();
141   Int_t      id = hit->DetElemId();
142
143   Int_t twentyNano;
144   if (tof<75*TMath::Power(10,-9)) {
145     twentyNano=1;
146   } else {
147     twentyNano=100;
148   }
149
150   Float_t qp;
151   nnew=0;
152   for (Int_t i=1; i<=fnsec; i++) {
153     AliMUONGeometrySegmentation * segmentation=
154       (AliMUONGeometrySegmentation*) (*fSegmentation2)[i-1];
155     
156 // Find the module & strip Id. which has fired
157     Int_t ix,iy;
158     segmentation->GetPadI(id,xhit,yhit,0,ix,iy);
159     segmentation->SetPad(id,ix,iy);
160     if (xhit<0) ix = -ix;
161 //    printf(" fId id fnsec xhit yhit zhit ix iy %i %i %i %f %f %f %i %i \n",fId,i,id,xhit,yhit,zhit,ix,iy);
162 //     if (ix < 0 || ix > 10000) return;
163 //     if (iy < 0 || iy > 10000) return;
164
165 // treatment of GEANT hits w/o corresponding strip (due to the fact that
166 // the 2 geometries are computed in a very slightly different way) 
167     if (ix==0&&iy==0) {
168       AliInfo(Form("AliMUONChamberTrigger hit w/o strip %f %f \n",xhit,yhit));
169     } else {          
170       // --- store signal information for this strip
171       newclust[0][nnew]=1.;                       // total charge
172       newclust[1][nnew]=ix;                       // ix-position of pad
173       newclust[2][nnew]=iy;                       // iy-position of pad
174       newclust[3][nnew]=twentyNano;               // time of flight
175       newclust[4][nnew]=segmentation->ISector();  // sector id
176       newclust[5][nnew]=(Float_t) i;              // counter
177       nnew++;
178
179 // cluster-size if AliMUONResponseTriggerV1, nothing if AliMUONResponseTrigger
180       if (((AliMUONResponseTrigger*) fResponse)->SetGenerCluster()) {
181   
182         // set hits
183         segmentation->SetHit(id,xhit,yhit,zhit);
184         // get the list of nearest neighbours
185         Int_t nList, xList[10], yList[10];
186         segmentation->Neighbours(id,ix,iy,&nList,xList,yList);
187         
188         qp = 0;
189         for (Int_t j=0; j<nList; j++){       // loop over neighbours      
190           if (xList[j]!=0) {                 // existing neighbour          
191             if (j==0||j==5||qp!=0) {         // built-up cluster-size
192               
193               // neighbour real coordinates (just for checks here)
194               Float_t x,y,z;
195               segmentation->GetPadC(id,xList[j],yList[j],x,y,z);
196               // set pad (fx fy & fix fiy are the current pad coord. & Id.)
197               segmentation->SetPad(id,xList[j],yList[j]);         
198               // get the chamber (i.e. current strip) response
199               qp=fResponse->IntXY(id,segmentation);       
200               
201               if (qp > 0.5) {           
202                 // --- store signal information for neighbours 
203                 newclust[0][nnew]=qp;                      // total charge
204                 newclust[1][nnew]=segmentation->Ix();      // ix-pos. of pad
205                 newclust[2][nnew]=segmentation->Iy();      // iy-pos. of pad
206                 newclust[3][nnew]=twentyNano;              // time of flight
207                 newclust[4][nnew]=segmentation->ISector(); // sector id
208                 newclust[5][nnew]=(Float_t) i;             // counter
209                 nnew++;
210               } // qp > 0.5 
211             } // built-up cluster-size
212           } // existing neighbour
213         } // loop over neighbours
214       } // endif hit w/o strip
215     } // loop over planes
216   } // if AliMUONResponseTriggerV1
217 }
218
219
220
221
222
223