4 |
* |
* |
5 |
**/ |
**/ |
6 |
#include <TObject.h> |
#include <TObject.h> |
7 |
|
#include <TMath.h> |
8 |
#include <CaloLevel1.h> |
#include <CaloLevel1.h> |
|
|
|
9 |
// |
// |
10 |
ClassImp(CaloStrip); |
ClassImp(CaloStrip); |
11 |
ClassImp(CaloLevel1); |
ClassImp(CaloLevel1); |
115 |
**/ |
**/ |
116 |
void CaloStrip::Set(Float_t X, Float_t Y, Float_t Z) { |
void CaloStrip::Set(Float_t X, Float_t Y, Float_t Z) { |
117 |
// |
// |
118 |
// Float_t lShift = 0.; |
fX = X; |
119 |
// Float_t lPos = 0.; |
fY = Y; |
120 |
// extern struct shift shift; |
fZ = Z; |
121 |
// // |
// |
122 |
// fView = view++; |
Float_t zplane[22]; |
123 |
// fPlane = plane++; |
zplane[0] = 0.; |
124 |
// fStrip = strip++; |
Int_t ii = 0; |
125 |
// if ( fPlane%2 ){ |
for ( Int_t i = 2; i < 23; i++){ |
126 |
// lShift = -0.5; |
ii = i-1; |
127 |
// } else { |
if ( i%2 ){ |
128 |
// lShift = 0.5; |
zplane[ii] = zplane[ii-1] - 10.09; |
129 |
// }; |
} else { |
130 |
// // |
zplane[ii] = zplane[ii-1] - 8.09; |
131 |
// shift.shift = lShift; |
}; |
132 |
// // |
}; |
133 |
// Float_t zplane[22]; |
// |
134 |
// zplane[0] = 0.; |
Float_t dzx[22]; |
135 |
// Int_t ii = 0; |
Float_t dzy[22]; |
136 |
// for ( Int_t i = 2; i < 23; i++){ |
for ( Int_t i=0; i < 22; i++){ |
137 |
// ii = i-1; |
dzx[i] = fabs(fZ*10. - (zplane[i] - 5.81 + CTZ)); |
138 |
// if ( i%2 ){ |
dzy[i] = fabs(fZ*10. - (zplane[i] + CTZ)); |
139 |
// zplane[ii] = zplane[ii-1] - 10.09 + CTZ; |
}; |
140 |
// } else { |
// |
141 |
// zplane[ii] = zplane[ii-1] - 8.09 + CTZ; |
Float_t minx = TMath::MinElement(22,dzx); |
142 |
// }; |
Float_t miny = TMath::MinElement(22,dzy); |
143 |
// }; |
// |
144 |
// // |
// find view |
145 |
// millim_(&fStrip,&lPos); |
// |
146 |
// // |
if ( minx < miny ){ |
147 |
// if ( fView == 1 ){ |
fView = 1; |
148 |
// // |
} else { |
149 |
// // X view |
fView = 2; |
150 |
// // |
}; |
151 |
// fX = lPos; |
// |
152 |
// fY = 0.; |
// find plane |
153 |
// fZ = zplane[fPlane-1] - 5.81; |
// |
154 |
// } else { |
Float_t pos = 0.; |
155 |
// // |
// |
156 |
// // Y view |
for ( Int_t i=0; i < 22; i++){ |
157 |
// // |
if ( fView == 1 ){ |
158 |
// fX = 0.; |
if ( dzx[i] == minx ){ |
159 |
// fY = lPos; |
fPlane = i+1; |
160 |
// fZ = zplane[fPlane-1]; |
pos = fX*10. + CTX; |
161 |
// }; |
}; |
162 |
|
} else { |
163 |
|
if ( dzy[i] == miny ){ |
164 |
|
fPlane = i+1; |
165 |
|
pos = fY*10. + CTY; |
166 |
|
}; |
167 |
|
}; |
168 |
|
}; |
169 |
|
// |
170 |
|
// find strip |
171 |
|
// |
172 |
|
Float_t dxy[96]; |
173 |
|
Float_t stpos = 0.; |
174 |
|
// |
175 |
|
CaloStrip *ca = new CaloStrip(); |
176 |
|
// |
177 |
|
for ( Int_t i=0; i < 96; i++){ |
178 |
|
ca->Set(fView-1,fPlane-1,i); |
179 |
|
if ( fView == 1 ){ |
180 |
|
stpos = ca->GetX()*10. + CTX; |
181 |
|
} else { |
182 |
|
stpos = ca->GetY()*10. + CTY; |
183 |
|
}; |
184 |
|
dxy[i] = fabs(pos - stpos); |
185 |
|
}; |
186 |
|
// |
187 |
|
delete ca; |
188 |
// |
// |
189 |
|
Float_t mins = TMath::MinElement(96,dxy); |
190 |
|
// |
191 |
|
for ( Int_t i=0; i < 96; i++){ |
192 |
|
if ( dxy[i] == mins ) fStrip = i+1; |
193 |
|
}; |
194 |
}; |
}; |
|
// DISTY = PIANO(I) |
|
|
// YY(I) = DISTY * TG(2) + CY |
|
|
// BAR(M,I) = YY(I) |
|
|
// CBAR(M,I) = (-YALIG + YY(I))/10. |
|
|
// C |
|
|
// ENDIF |
|
|
// CALL LASTRISCIA(BAR(M,I),IBAR(M,I)) |
|
|
// CIBAR(M,I) = IBAR(M,I) |
|
|
// ENDDO |
|
|
// ENDIF |
|
|
// C |
|
|
// ENDDO |
|
|
|
|
|
|
|
195 |
|
|
196 |
/** |
/** |
197 |
* CaloLevel1 constructor |
* CaloLevel1 constructor |
300 |
return(0.); |
return(0.); |
301 |
} |
} |
302 |
|
|
303 |
|
/* |
304 |
|
* Returns energy released on plane nplane (where 0<= nplane <= 43, 0 = 1Y, 1 = 1X, 2 = 2Y, 3 = 2X, etc. etc.). |
305 |
|
*/ |
306 |
|
Float_t CaloLevel1::qtotpl(Int_t nplane){ |
307 |
|
// |
308 |
|
Int_t sview = 1; |
309 |
|
if ( nplane%2 ) sview = 0; |
310 |
|
// |
311 |
|
Int_t splane = nplane-(sview+1)/2; |
312 |
|
// |
313 |
|
Float_t totmip = qtotpl(sview,splane); |
314 |
|
// |
315 |
|
return(totmip); |
316 |
|
// |
317 |
|
}; |
318 |
|
|
319 |
|
/* |
320 |
|
* Returns energy released on view "view" (0 = X, 1 = Y) and plane "plane" ( 0 <= plane <= 21 ). |
321 |
|
*/ |
322 |
|
Float_t CaloLevel1::qtotpl(Int_t sview, Int_t splane){ |
323 |
|
// |
324 |
|
Int_t view = -1; |
325 |
|
Int_t plane = -1; |
326 |
|
Int_t strip = -1; |
327 |
|
// |
328 |
|
Float_t mip = 0.; |
329 |
|
Float_t totmip = 0.; |
330 |
|
// |
331 |
|
if ( istrip == 0 ) return(0.); |
332 |
|
// |
333 |
|
for (Int_t i = 0; i<istrip; i++ ){ |
334 |
|
// |
335 |
|
mip = DecodeEstrip(i,view,plane,strip); |
336 |
|
// |
337 |
|
if ( view == sview && splane == plane ) totmip += mip; |
338 |
|
// |
339 |
|
// entry are ordered by strip, plane and view number. Go out if you pass the input strip |
340 |
|
// |
341 |
|
if ( view == sview && plane > splane ) return(totmip); |
342 |
|
if ( view > sview ) return(totmip); |
343 |
|
// |
344 |
|
}; |
345 |
|
// |
346 |
|
return(totmip); |
347 |
|
// |
348 |
|
}; |