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