]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONChamberTrigger.cxx
Merging changes from v4-04-Release
[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 "AliMUON.h"
22 #include "AliMUONSegmentation.h"
23 #include "AliMUONGeometrySegmentation.h"
24 #include "AliMUONGeometryTransformer.h"
25 #include "AliLog.h"
26
27 ///
28 /// \class AliMUONChamberTrigger
29 ///
30 /// Implementation of AliMUONChamber for the trigger
31 ///
32 /// This class is to be deprecated.
33 ///
34
35 /// \cond CLASSIMP
36 ClassImp(AliMUONChamberTrigger)
37 /// \endcond
38
39 //-------------------------------------------
40
41 AliMUONChamberTrigger::AliMUONChamberTrigger()
42   : AliMUONChamber(),
43     fkGeomTransformer(0)
44 {
45 // Default constructor
46 }
47
48 //-------------------------------------------
49
50 AliMUONChamberTrigger::AliMUONChamberTrigger(const AliMUONChamberTrigger& right) 
51   : AliMUONChamber(right) 
52 {  
53 /// Protected copy constructor (not implemented)
54
55   AliFatal("Copy constructor not provided.");
56 }
57
58 //-------------------------------------------
59
60 AliMUONChamberTrigger::AliMUONChamberTrigger(Int_t id,
61                               const AliMUONGeometryTransformer* kGeometryTransformer) 
62   : AliMUONChamber(id),
63     fkGeomTransformer(kGeometryTransformer)
64 {
65 // Constructor using chamber id
66 }
67
68 //-------------------------------------------
69 AliMUONChamberTrigger& 
70 AliMUONChamberTrigger::operator=(const AliMUONChamberTrigger& right)
71 {
72 /// Protected assignement operator (not implemented)
73
74   // check assignement to self
75   if (this == &right) return *this;
76
77   AliFatal("Assignement operator not provided.");
78     
79   return *this;  
80 }    
81
82 //-------------------------------------------
83 void AliMUONChamberTrigger::DisIntegration(AliMUONHit* hit,
84                                            Int_t& nnew,
85                                            Float_t newclust[6][500]) 
86 {
87 //    
88 //  Generates pad hits (simulated cluster) 
89 //  using the segmentation and the response model
90
91
92   Float_t   tof = hit->Age();
93   Float_t  xhit = hit->X();
94   Float_t  yhit = hit->Y();
95   Float_t  zhit = hit->Z();
96   Int_t      id = hit->DetElemId();
97
98   Int_t twentyNano;
99   if (tof<75*TMath::Power(10,-9)) {
100     twentyNano=1;
101   } else {
102     twentyNano=100;
103   }
104
105   Float_t qp;
106   nnew=0;
107   for (Int_t i = 1; i <= 2; i++) {
108
109     AliMUONGeometrySegmentation* segmentation=
110       fMUON->GetSegmentation()->GetModuleSegmentation(fId, i-1); 
111
112     
113 // Find the module & strip Id. which has fired
114     Int_t ix(-1);
115     Int_t iy(-1);
116     segmentation->GetPadI(id,xhit,yhit,0,ix,iy);
117 // treatment of GEANT hits w/o corresponding strip (due to the fact that
118 // geometry & segmentation are computed in a very slightly different way) 
119     if ( ix<0 || iy<0 ) 
120     {
121       Float_t lx,ly,lz;
122       fkGeomTransformer->Global2Local(id,xhit,yhit,0,lx,ly,lz);
123       AliWarning(Form("AliMUONChamberTrigger hit w/o strip %i-%d %e %e "
124                       "local %e %e %e ix,iy=%d,%d\n",id,i-1,xhit,yhit,lx,ly,lz,ix,iy));
125     } else 
126     {          
127       segmentation->SetPad(id,ix,iy);
128       if (xhit<0) ix = -ix;
129       //    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);
130       //     if (ix < 0 || ix > 10000) return;
131       //     if (iy < 0 || iy > 10000) return;
132       
133       // --- store signal information for this strip
134       newclust[0][nnew]=1.;                       // total charge
135       newclust[1][nnew]=ix;                       // ix-position of pad
136       newclust[2][nnew]=iy;                       // iy-position of pad
137       newclust[3][nnew]=twentyNano;               // time of flight
138       newclust[4][nnew]=segmentation->ISector();  // sector id
139       newclust[5][nnew]=(Float_t) i;              // counter
140       nnew++;
141       
142       // cluster-size if AliMUONResponseTriggerV1, nothing if AliMUONResponseTrigger
143       if (((AliMUONResponseTrigger*) fResponse)->SetGenerCluster()) {
144             
145             // set hits
146             segmentation->SetHit(id,xhit,yhit,zhit);
147             // get the list of nearest neighbours
148             Int_t nList, xList[10], yList[10];
149             segmentation->Neighbours(id,ix,iy,&nList,xList,yList);
150             
151             qp = 0;
152             for (Int_t j=0; j<nList; j++){       // loop over neighbours          
153                 if (xList[j]!=0) {                 // existing neighbour            
154                     if (j==0||j==5||qp!=0) {         // built-up cluster-size
155                         
156                         // neighbour real coordinates (just for checks here)
157                         Float_t x,y,z;
158                         segmentation->GetPadC(id,xList[j],yList[j],x,y,z);
159                         // set pad (fx fy & fix fiy are the current pad coord. & Id.)
160                         segmentation->SetPad(id,xList[j],yList[j]);       
161                         // get the chamber (i.e. current strip) response
162                         qp=fResponse->IntXY(id,segmentation);     
163                         
164                         if (qp > 0.5) {         
165                             // --- store signal information for neighbours 
166                             newclust[0][nnew]=qp;                      // total charge
167                             newclust[1][nnew]=segmentation->Ix();      // ix-pos. of pad
168                             newclust[2][nnew]=segmentation->Iy();      // iy-pos. of pad
169                             newclust[3][nnew]=twentyNano;              // time of flight
170                             newclust[4][nnew]=segmentation->ISector(); // sector id
171                             newclust[5][nnew]=(Float_t) i;             // counter
172                             nnew++;
173                         } // qp > 0.5 
174                     } // built-up cluster-size
175                 } // existing neighbour
176             } // loop over neighbours
177         } // endif hit w/o strip
178     } // loop over planes
179   } // if AliMUONResponseTriggerV1
180 }
181
182
183
184
185
186