BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
CbmStsSensor.cxx
Go to the documentation of this file.
1// -------------------------------------------------------------------------
2// ----- CbmStsStripSensor source file -----
3// ----- Created 01/07/2008 by R. Karabowicz -----
4// -------------------------------------------------------------------------
5
6#include "CbmStsSensor.h"
7
9#include "TGeoManager.h" //AZ
10#include "TMath.h"
11#include "TRandom.h"
12
13#include <iostream>
14#include <list>
15#include <vector>
16
17using std::cout;
18using std::endl;
19using std::pair;
20using std::vector;
21
22// ----- Default constructor -------------------------------------------
24 : fDetectorId(0)
25 , fType(0)
26 , fX0(0.)
27 , fY0(0.)
28 , fZ0(0.)
29 , fRotation(0.)
30 , fLx(0.)
31 , fLy(0.)
32 , fDx(0.)
33 , fDy(0.)
34 , fStereoF(0.)
35 , fStereoB(0.)
36 , fD(0.)
39 , fBackStripShift(0.)
41 , fSigmaX(0.)
42 , fSigmaY(0.)
43 , fSigmaXY(0.)
44 , fXSmearWidth(0.0005)
45 , fZSmearSlope(0.04)
46 , fFrontLorentzShift(0.132)
47 , fBackLorentzShift(0.026)
48 , fFrontActive()
49 , fBackActive()
50 , fTrueHits()
51{
52 cout << "-W- CbmStsSensor: Do not use this constructor! " << endl;
53}
54// -------------------------------------------------------------------------
55
56// ----- Enhanced constructor (by z0 and d) ------------------------------------------
58 Int_t detId,
59 Int_t iType,
60 Double_t x0,
61 Double_t y0,
62 Double_t z0,
63 Double_t rotation,
64 Double_t lx,
65 Double_t ly,
66 Double_t d,
67 Double_t dx,
68 Double_t dy,
69 Double_t stereoF,
70 Double_t stereoB)
71 : TNamed(tempName.Data(), "")
72 , fDetectorId(0)
73 , fType(0)
74 , fX0(0.)
75 , fY0(0.)
76 , fZ0(0.)
77 , fRotation(0.)
78 , fLx(0.)
79 , fLy(0.)
80 , fDx(0.)
81 , fDy(0.)
82 , fStereoF(0.)
83 , fStereoB(0.)
84 , fD(0.)
87 , fBackStripShift(0.)
89 , fSigmaX(0.)
90 , fSigmaY(0.)
91 , fSigmaXY(0.)
92 , fXSmearWidth(0.0005)
93 , fZSmearSlope(0.04)
94 , fFrontLorentzShift(0.132)
95 , fBackLorentzShift(0.026)
96 , fFrontActive()
97 , fBackActive()
98 , fTrueHits()
99{
100 fName = tempName.Data();
101 fDetectorId = detId;
102 fType = iType;
103 fX0 = x0;
104 fY0 = y0;
105 fZ0 = z0; // z position of the station
106 fRotation = rotation;
107 fLx = lx;
108 fLy = ly;
109 fD = d; // thickness of the station
110 fDx = dx;
111 fDy = dy;
112 fStereoF = stereoF;
113 fStereoB = stereoB;
114 fBackStripShift = 0.;
115 fFrontStripShift = 0.;
116 Double_t dbNoX = fLx / fDx;
117 // AZ
122
123 // Calculate number of channels
124 if (fType == 1) { // Pixel sensor
125 Double_t dbNoY = fLy / fDy;
126 fNChannelsFront = Int_t(TMath::Ceil(dbNoX) * TMath::Ceil(dbNoY));
127 fNChannelsBack = 0;
128 } else if (fType == 2) { // strip sensor
131 // AZ Double_t dbNoB = ( fLx + aPlus ) / fDx ;
132 Double_t dbNoB = (fLx + aPlus) / fDy;
134 } else if (fType == 3) { // strip sensor with double metal layer
136 if (fStereoB * 180 / TMath::Pi() > 80) {
138 } else {
140 }
141 } else {
142 cout << "-E- CbmStsSensor: Illegal sensor type " << fType << endl;
143 Fatal("", "Illegal sensor type");
144 }
145
146 // Calculate errors and covariance
147 if (fType == 1) {
148 fSigmaX = fDx / TMath::Sqrt(12);
149 fSigmaY = fDy / TMath::Sqrt(12);
150 fSigmaXY = 0.;
151 } else if (fType == 2 || fType == 3) {
152
153 if (fStereoF == 0. && fStereoB * 180 / TMath::Pi() < 80) {
154 fSigmaX = fDx / TMath::Sqrt(12);
156 fSigmaXY = (-1. * fDx * fDx) / (12. * TMath::Tan(fStereoB));
157 } else if (fStereoF == 0. && fStereoB * 180 / TMath::Pi() > 80) {
158 fSigmaX = fDx / TMath::Sqrt(12);
159 fSigmaY = fDy / TMath::Sqrt(12);
160 fSigmaXY = 0.;
161 } else {
162 fSigmaX = fDx / TMath::Sqrt(24);
164 fSigmaXY = 0.;
165 }
166
167 Int_t sensorNumber = (fDetectorId & (7 << 1)) >> 1;
168
169 if (sensorNumber == 1) {
170 fBackStripShift = 0.;
171 fFrontStripShift = 0.;
172 if (fStereoB < 0)
174 } else if (sensorNumber == 2) {
175 if (fStereoB * 180 / TMath::Pi() > 80) {
176 fBackStripShift = 0.;
178 } else {
181 }
182 } else if (sensorNumber == 3) {
183 if (fStereoB * 180 / TMath::Pi() > 80) {
184 fBackStripShift = 0.;
186 } else {
189 }
190 }
191
192 } else {
193 cout << "-E- CbmStsSensor: Illegal sensor type " << fType << endl;
194 Fatal("", "Illegal sensor type");
195 }
196
197 // Transform errors to global c.s.
198 Double_t cosRot = TMath::Cos(fRotation);
199 Double_t sinRot = TMath::Sin(fRotation);
200 Double_t vX =
201 cosRot * cosRot * fSigmaX * fSigmaX - 2. * cosRot * sinRot * fSigmaXY + sinRot * sinRot * fSigmaY * fSigmaY;
202 Double_t vY =
203 sinRot * sinRot * fSigmaX * fSigmaX + 2. * cosRot * sinRot * fSigmaXY + cosRot * cosRot * fSigmaY * fSigmaY;
204 Double_t vXY = cosRot * sinRot * fSigmaX * fSigmaX + (cosRot * cosRot - sinRot * sinRot) * fSigmaXY
205 - cosRot * sinRot * fSigmaY * fSigmaY;
206 fSigmaX = TMath::Sqrt(vX);
207 fSigmaY = TMath::Sqrt(vY);
208 fSigmaXY = vXY;
209
210 fXSmearWidth = 0.0005;
211 fZSmearSlope = 0.04;
212
213 fFrontLorentzShift = 0.132;
214 fBackLorentzShift = 0.026;
216}
217// -------------------------------------------------------------------------
218
219// ----- Standard constructor ------------------------------------------
221 Int_t iType,
222 Double_t x0,
223 Double_t y0,
224 Double_t rotation,
225 Double_t lx,
226 Double_t ly,
227 Double_t dx,
228 Double_t dy,
229 Double_t stereoF,
230 Double_t stereoB)
231 : fDetectorId(0)
232 , fType(0)
233 , fX0(0.)
234 , fY0(0.)
235 , fZ0(0.)
236 , fRotation(0.)
237 , fLx(0.)
238 , fLy(0.)
239 , fDx(0.)
240 , fDy(0.)
241 , fStereoF(0.)
242 , fStereoB(0.)
243 , fD(0.)
244 , fNChannelsFront(0)
245 , fNChannelsBack(0)
246 , fBackStripShift(0.)
247 , fFrontStripShift(0.)
248 , fSigmaX(0.)
249 , fSigmaY(0.)
250 , fSigmaXY(0.)
251 , fXSmearWidth(0.0005)
252 , fZSmearSlope(0.04)
253 , fFrontLorentzShift(0.132)
254 , fBackLorentzShift(0.026)
255 , fFrontActive()
256 , fBackActive()
257 , fTrueHits()
258{
259 fDetectorId = detId;
260 fType = iType;
261 fX0 = x0;
262 fY0 = y0;
263 fRotation = rotation;
264 fLx = lx;
265 fLy = ly;
266 fDx = dx;
267 fDy = dy;
268 fStereoF = stereoF;
269 fStereoB = stereoB;
270 fBackStripShift = 0.;
271 fFrontStripShift = 0.;
272 Double_t dbNoX = fLx / fDx;
273 // AZ
278
279 // Calculate number of channels
280 if (fType == 1) { // Pixel sensor
281 Double_t dbNoY = fLy / fDy;
282 fNChannelsFront = Int_t(TMath::Ceil(dbNoX) * TMath::Ceil(dbNoY));
283 fNChannelsBack = 0;
284 } else if (fType == 2) { // strip sensor
287 // AZ Double_t dbNoB = ( fLx + aPlus ) / fDx ;
288 Double_t dbNoB = (fLx + aPlus) / fDy;
290 } else if (fType == 3) { // strip sensor with double metal layer
293 } else {
294 cout << "-E- CbmStsSensor: Illegal sensor type " << fType << endl;
295 Fatal("", "Illegal sensor type");
296 }
297
298 // Calculate errors and covariance
299 if (fType == 1) {
300 fSigmaX = fDx / TMath::Sqrt(12);
301 fSigmaY = fDy / TMath::Sqrt(12);
302 fSigmaXY = 0.;
303 } else if (fType == 2 || fType == 3) {
304 if (fStereoF == 0. && fStereoB * 180 / TMath::Pi() < 80) {
305 fSigmaX = fDx / TMath::Sqrt(12);
307 fSigmaXY = (-1. * fDx * fDx) / (12. * TMath::Tan(fStereoB));
308 } else if (fStereoF == 0. && fStereoB * 180 / TMath::Pi() > 80) {
309 fSigmaX = fDx / TMath::Sqrt(12);
310 fSigmaY = fDy / TMath::Sqrt(12);
311 fSigmaXY = 0.;
312 } else {
313 fSigmaX = fDx / TMath::Sqrt(24);
315 fSigmaXY = 0.;
316 }
317
318 Int_t sensorNumber = (fDetectorId & (7 << 1)) >> 1;
319 if (sensorNumber == 1) {
320 fBackStripShift = 0.;
321 fFrontStripShift = 0.;
322 if (fStereoB < 0)
324 } else if (sensorNumber == 2) {
325 if (fStereoB * 180 / TMath::Pi() > 80) {
326 fBackStripShift = 0.;
328 } else {
331 }
332 } else if (sensorNumber == 3) {
333 if (fStereoB * 180 / TMath::Pi() > 80) {
334 fBackStripShift = 0.;
336 } else {
339 }
340 }
341
342 } else {
343 cout << "-E- CbmStsSensor: Illegal sensor type " << fType << endl;
344 Fatal("", "Illegal sensor type");
345 }
346
347 // Transform errors to global c.s.
348 Double_t cosRot = TMath::Cos(fRotation);
349 Double_t sinRot = TMath::Sin(fRotation);
350 Double_t vX =
351 cosRot * cosRot * fSigmaX * fSigmaX - 2. * cosRot * sinRot * fSigmaXY + sinRot * sinRot * fSigmaY * fSigmaY;
352 Double_t vY =
353 sinRot * sinRot * fSigmaX * fSigmaX + 2. * cosRot * sinRot * fSigmaXY + cosRot * cosRot * fSigmaY * fSigmaY;
354 Double_t vXY = cosRot * sinRot * fSigmaX * fSigmaX + (cosRot * cosRot - sinRot * sinRot) * fSigmaXY
355 - cosRot * sinRot * fSigmaY * fSigmaY;
356 fSigmaX = TMath::Sqrt(vX);
357 fSigmaY = TMath::Sqrt(vY);
358 fSigmaXY = vXY;
359
360 fXSmearWidth = 0.0005;
361 fZSmearSlope = 0.04;
362
363 fFrontLorentzShift = 0.132;
364 fBackLorentzShift = 0.026;
365}
366// -------------------------------------------------------------------------
367
368// ----- Destructor ----------------------------------------------------
370// -------------------------------------------------------------------------
371
372// ----- Public method GetChannel --------------------------------------
374{
375
376 // Check iSide
377 if (iSide != 0 && iSide != 1) {
378 cout << "-W- CbmStsSensor::GetChannel: Illegal side number " << iSide << endl;
379 return -1;
380 }
381
382 // Calculate internal coordinates. Return -1 if outside sensor.
383 Double_t xint = 0;
384 Double_t yint = 0;
385 if (!IntCoord(x, y, xint, yint))
386 return -1;
387 Int_t iChan = 0;
388
389 Double_t dbNoX = fLx / fDx;
390 // Case pixel sensor: iChannel = iRow * nColumns + iColumn
391 if (fType == 1) {
392 Int_t nCol = Int_t(TMath::Ceil(dbNoX));
393 Int_t iCol = Int_t(xint / fDx);
394 Int_t iRow = Int_t(yint / fDy);
395 iChan = iRow * nCol + iCol;
396 if (iChan < 0 || iChan > fNChannelsFront) {
397 cout << "-E- CbmStsSensor::GetChannel: "
398 << "Channel number " << iChan << " exceeds limit " << fNChannelsFront << endl;
399 cout << GetStationNr() << " " << GetSensorNr() << endl;
400 cout << x << " " << y << " " << iSide << endl;
401 Fatal("GetChannel", "illegal channel number");
402 }
403 }
404
405 // Case strip sensor 1
406 else if (fType == 2)
407 {
408 if (iSide == 0) { // Front side
409 iChan = Int_t(xint / fDx);
410 if (iChan < 0 || iChan > fNChannelsFront) {
411 cout << "-E- CbmStsSensor::GetChannel: "
412 << "Front channel number " << iChan << " exceeds limit " << fNChannelsFront << endl;
413 Fatal("GetChannel", "illegal channel number");
414 }
415 } else { // Back side
416 // Project point along backside strip to y=0
417 Double_t xp = xint + yint * TMath::Tan(fStereoB);
418 // Digitise
419 iChan = Int_t(xp / fDx);
420 if (iChan < 0 || iChan > fNChannelsBack) {
421 cout << "-E- CbmStsSensor::GetChannel: "
422 << "Back channel number " << iChan << " exceeds limit " << fNChannelsBack << endl;
423 cout << " Sensor " << GetSensorNr() << " of station " << GetStationNr() << endl;
424 cout << " Point coordinates: (" << x << ", " << y << ") cm" << endl;
425 Fatal("GetChannel", "illegal channel number");
426 }
427 }
428 }
429
430 // Case strip sensor 2 (with double metal layer)
431 else if (fType == 3)
432 {
433 if (iSide == 0) { // Front side
434 Double_t xf = xint + fFrontStripShift + yint * TMath::Tan(fStereoF);
435 xf = xf - TMath::Floor(xf / fLx) * fLx;
436 iChan = Int_t(xf / fDx);
437 if (iChan < 0 || iChan > fNChannelsFront) {
438 cout << "-E- CbmStsSensor::GetChannel: "
439 << "Front channel number " << iChan << " exceeds limit " << fNChannelsFront << endl;
440 Fatal("GetChannel", "illegal channel number");
441 }
442 } else { // Back side
443 if (fStereoB * 180 / TMath::Pi() > 80) {
444 Double_t xp = yint;
445 xp = xp - TMath::Floor(xp / fLy) * fLy;
446 iChan = Int_t(xp / fDy);
447 } else {
448 // Project point along backside strip to y = 0
449 Double_t xp = xint + fBackStripShift + yint * TMath::Tan(fStereoB);
450 // Calculate modulo w.r.t. sensor x width
451 xp = xp - TMath::Floor(xp / fLx) * fLx;
452 // Digitise
453 iChan = Int_t(xp / fDx);
454 }
455
456 if (iChan < 0 || iChan > fNChannelsBack) {
457 cout << "-E- CbmStsSensor::GetChannel: "
458 << "Back channel number " << iChan << " exceeds limit " << fNChannelsBack << endl;
459 cout << " Sensor " << GetSensorNr() << " of station " << GetStationNr() << endl;
460 cout << " Point coordinates: (" << x << ", " << y << ") cm" << endl;
461 Fatal("GetChannel", "illegal channel number");
462 }
463 }
464 }
465
466 return iChan;
467}
468// -------------------------------------------------------------------------
469
470// ----- Public method GetChannel --------------------------------------
472{
473
474 // Check iSide
475 if (iSide != 0 && iSide != 1) {
476 cout << "-W- CbmStsSensor::GetChannel: Illegal side number " << iSide << endl;
477 return -1;
478 }
479
480 // Calculate internal coordinates. Return -1 if outside sensor.
481 Double_t xint = 0;
482 Double_t yint = 0;
483 if (!IntCoord(x, y, xint, yint))
484 return -1;
485 Float_t iChan = 0;
486
487 Double_t dbNoX = fLx / fDx;
488 // Case pixel sensor: iChannel = iRow * nColumns + iColumn
489 if (fType == 1) {
490 Int_t nCol = Int_t(TMath::Ceil(dbNoX));
491 Int_t iCol = Int_t(xint / fDx);
492 Int_t iRow = Int_t(yint / fDy);
493 iChan = iRow * nCol + iCol;
494 if (iChan < 0 || iChan > fNChannelsFront) {
495 cout << "-E- CbmStsSensor::GetChannel: "
496 << "Channel number " << iChan << " exceeds limit " << fNChannelsFront << endl;
497 cout << GetStationNr() << " " << GetSensorNr() << endl;
498 cout << x << " " << y << " " << iSide << endl;
499 Fatal("GetChannel", "illegal channel number");
500 }
501 }
502
503 // Case strip sensor 1
504 else if (fType == 2)
505 {
506 if (iSide == 0) { // Front side
507 iChan = Int_t(xint / fDx);
508 if (iChan < 0 || iChan > fNChannelsFront) {
509 cout << "-E- CbmStsSensor::GetChannel: "
510 << "Front channel number " << iChan << " exceeds limit " << fNChannelsFront << endl;
511 Fatal("GetChannel", "illegal channel number");
512 }
513 } else { // Back side
514 // Project point along backside strip to y=0
515 // AZ Double_t xp = xint + yint * TMath::Tan(fStereoB);
516 Double_t xp = xint + yint * TMath::Tan(fStereoB) + fBackStripShift; // AZ
517 // Digitise
518 iChan = Int_t(xp / fDx);
519 if (iChan < 0 || iChan > fNChannelsBack) {
520 cout << "-E- CbmStsSensor::GetChannel: "
521 << "Back channel number " << iChan << " exceeds limit " << fNChannelsBack << endl;
522 cout << " Sensor " << GetSensorNr() << " of station " << GetStationNr() << endl;
523 cout << " Point coordinates: (" << x << ", " << y << ") cm" << endl;
524 Fatal("GetChannel", "illegal channel number");
525 }
526 }
527 }
528
529 // Case strip sensor 2 (with double metal layer)
530 else if (fType == 3)
531 {
532
533 if (iSide == 0) { // Front side
534 Double_t xf = xint + fFrontStripShift + yint * TMath::Tan(fStereoF);
535 xf = xf - TMath::Floor(xf / fLx) * fLx;
536 iChan = xf / fDx;
537 if (iChan < 0 || iChan > fNChannelsFront) {
538 cout << "-E- CbmStsSensor::GetChannel: "
539 << "Front channel number " << iChan << " exceeds limit " << fNChannelsFront << endl;
540 Fatal("GetChannel", "illegal channel number");
541 }
542 } else { // Back side
543
544 if (fStereoB * 180 / TMath::Pi() > 80) {
545 Double_t xp = yint;
546 xp = xp - TMath::Floor(xp / fLy) * fLy;
547 iChan = xp / fDy;
548 } else {
549 Double_t xp = xint + fBackStripShift + yint * TMath::Tan(fStereoB);
550 xp = xp - TMath::Floor(xp / fLx) * fLx;
551 iChan = xp / fDx;
552 }
553
554 if (iChan < 0 || iChan > fNChannelsBack) {
555 cout << "-E- CbmStsSensor::GetChannel: "
556 << "Back channel number " << iChan << " exceeds limit " << fNChannelsBack << endl;
557 cout << " Sensor " << GetSensorNr() << " of station " << GetStationNr() << endl;
558 cout << " Point coordinates: (" << x << ", " << y << ") cm" << endl;
559 Fatal("GetChannel", "illegal channel number");
560 }
561 }
562 }
563
564 return iChan;
565}
566// -------------------------------------------------------------------------
567
568// ----- Public method GetFrontChannel ---------------------------------
569// Int_t CbmStsSensor::GetFrontChannel(Double_t x, Double_t y, Double_t z) {
571{ // AZ
572 // cout << "frontchannel for " << x << " " << y << " " << z << " (" << fZ0-fD/2. << " " << fZ0+fD/2.<<")" << endl;
573 z = z - fZ0 + fD / 2.;
574 // cout << " temp z = " << z << endl;
575 if (z > fD)
576 return -1;
577 if (z < 0.)
578 return -1;
579
580 // Lorentz shift due to movement of the charges in the magnetic field
581 // translates into an angle: 8.5 deg for electrons
582 x += fFrontLorentzShift * z;
583
584 // Calculate internal coordinates. Return -1 if outside sensor.
585 Double_t xint = 0;
586 Double_t yint = 0;
587 if (!IntCoord(x, y, xint, yint))
588 return -1;
589 Int_t iChan = 0;
590
591 // xint += gRandom->Gaus(0.,fXSmearWidth+fZSmearSlope*z);
592 // yint += gRandom->Gaus(0.,fXSmearWidth+fZSmearSlope*z);
593
594 Double_t xf = xint + fFrontStripShift + yint * TMath::Tan(fStereoF);
595 // AZ xf = xf - TMath::Floor(xf/fLx) * fLx;
596 if (fType != 2)
597 xf = xf - TMath::Floor(xf / fLx) * fLx;
598
599 // AZ iChan = (Int_t)(xf/fDx);
600 iChan = TMath::Nint(xf / fDx); // AZ
601
602 if (iChan < 0 || iChan > fNChannelsFront)
603 return -1;
604 dPitch = xf - iChan * fDx; // AZ
605 return iChan;
606}
607// -------------------------------------------------------------------------
608
609// ----- Public method GetBackChannel ----------------------------------
610// Int_t CbmStsSensor::GetBackChannel (Double_t x, Double_t y, Double_t z) {
612{
613
614 z = fZ0 + fD / 2. - z;
615 if (z > fD)
616 return -1;
617 if (z < 0.)
618 return -1;
619
620 // Lorentz shift due to movement of the charges in the magnetic field
621 // translates into an angle: 1.5 deg for electrons
622 x += fBackLorentzShift * z;
623
624 // Calculate internal coordinates. Return -1 if outside sensor.
625 Double_t xint = 0;
626 Double_t yint = 0;
627 Double_t xp = 0;
628 if (!IntCoord(x, y, xint, yint))
629 return -1;
630 Int_t iChan = 0;
631
632 // xint += gRandom->Gaus(0.,fXSmearWidth+fZSmearSlope*z);
633 // yint += gRandom->Gaus(0.,fXSmearWidth+fZSmearSlope*z);
634 if (fStereoB * 180 / TMath::Pi() > 80) {
635 xp = yint;
636 xp = xp - TMath::Floor(xp / fLy) * fLy;
637 iChan = (Int_t)(xp / fDy);
638 } else {
639 xp = xint + fBackStripShift + yint * TMath::Tan(fStereoB);
640 // AZ xp = xp - TMath::Floor(xp/fLx) * fLx;
641 if (fType != 2)
642 xp = xp - TMath::Floor(xp / fLx) * fLx;
643 // AZ iChan = (Int_t)(xp/fDx);
644 // AZ iChan = (Int_t)(xp/fDy);
645 iChan = TMath::Nint(xp / fDy); // AZ
646 }
647
648 // if (fZ0 < 25) cout << " " << xint << " " << yint << " -> " << xp << " -> " << iChan << " " << fNChannelsBack <<
649 // endl;
650 if (iChan < 0 || iChan > fNChannelsBack)
651 return -1;
652 // AZ dPitch = xp - iChan * fDx; //AZ
653 dPitch = xp - iChan * fDy; // AZ
654 return iChan;
655}
656// -------------------------------------------------------------------------
657
658// ----- Public method Inside ------------------------------------------
660{
661 Double_t xint, yint;
662 return IntCoord(x, y, xint, yint);
663}
664// -------------------------------------------------------------------------
665
666// ----- Public method ActivateChannels --------------------------------
668{
669
670 Int_t iFront = FrontStripNumber(x, y);
671 if (iFront < 0)
672 return kFALSE;
673 Int_t iBack = BackStripNumber(x, y);
674 if (iBack < 0) {
675 cout << "-W- CbmStsSensor::ActivateChannels: "
676 << "No back strip number!" << endl;
677 cout << " Coordinates: (" << x << ", " << y << ")" << endl;
678 cout << " Sensor: " << fDetectorId << ", Front Strip: " << iFront << endl;
679 return kFALSE;
680 }
681
682 fFrontActive.insert(iFront);
683 fBackActive.insert(iBack);
684 pair<Int_t, Int_t> a(iFront, iBack);
685 fTrueHits[a] = ipt;
686
687 return kTRUE;
688}
689// -------------------------------------------------------------------------
690
691// ----- Public method Intersect ---------------------------------------
692Int_t CbmStsSensor::Intersect(Int_t iFStrip, Int_t iBStrip, vector<Double_t>& xCross, vector<Double_t>& yCross)
693{
694
695 // Reset STL vector of intersection y coordinates
696 xCross.clear();
697 yCross.clear();
698
699 // Check for strip numbers
700 if (iFStrip < 0 || iFStrip > fNChannelsFront) {
701 cout << "-W- CbmStsSensor::Intersect: "
702 << "Invalid front channel number ! " << iFStrip << " " << fNChannelsFront << endl;
703 return 0;
704 }
705 if (iBStrip < 0 || iBStrip > fNChannelsBack) {
706 cout << "-W- CbmStsSensor::Intersect: "
707 << "Invalid back channel number ! " << iBStrip << " " << fNChannelsBack << endl;
708 return 0;
709 }
710
711 // x coordinate of centre of front side strip readout pad
712 Double_t xF = Double_t(iFStrip + 0.5) * fDx;
713
714 // x coordinate of centre of back side strip readout pad
715 Double_t xB = Double_t(iBStrip + 0.5) * fDx;
716
717 Double_t x;
718 Double_t y;
719 // Maximal number of back & front strip segments
720 Int_t nSegB = Int_t(fLy * TMath::Tan(fStereoB) / fLx) + 2;
721 Int_t nSegF = Int_t(fLy * TMath::Tan(fStereoF) / fLx) + 2;
722
723 for (Int_t iSegB = 0; iSegB < nSegB; iSegB++) {
724
725 for (Int_t iSegF = 0; iSegF < nSegF; iSegF++) {
726
727 x = ((-1. / TMath::Tan(fStereoB)) * (xB - Double_t(iSegB) * fLx)
728 + ((1. / TMath::Tan(fStereoF)) * (xF - Double_t(iSegF) * fLx)))
729 / ((1. / TMath::Tan(fStereoF)) - (1. / TMath::Tan(fStereoB)));
730 y = (-1. / TMath::Tan(fStereoB)) * x
731 + (1. / TMath::Tan(fStereoB)) * (xB - fBackStripShift + Double_t(iSegB) * fLx);
732 // y & x coordinate of intersection of back strip segment with front strip
733 // Double_t y = (xB - x - Double_t(iSegB) * fLx) / TMath::Tan(fStereoB);
734
735 if (y < 0. || y > fLy)
736 continue;
737 if (x < 0. || x > fLx)
738 continue;
739
740 // Transform x and y coordinates to the global c.s.
743
744 // Fill coordinates in return arrays
745 xCross.push_back(xHit);
746 yCross.push_back(yHit);
747 }
748 }
749
750 return xCross.size();
751}
752// -------------------------------------------------------------------------
753
754// ----- Public method Intersect ---------------------------------------
755Int_t CbmStsSensor::Intersect(Int_t iFStrip, Int_t iBStrip, Double_t& xCross, Double_t& yCross, Double_t& zCross)
756{
757
758 // Check for strip numbers
759 if (iFStrip < 0 || iFStrip > fNChannelsFront) {
760 cout << "-W- CbmStsSensor::Intersect: "
761 << "Invalid front channel number ! " << iFStrip << " " << fNChannelsFront << endl;
762 return -1;
763 }
764 if (iBStrip < 0 || iBStrip > fNChannelsBack) {
765 cout << "-W- CbmStsSensor::Intersect: "
766 << "Invalid back channel number ! " << iBStrip << " " << fNChannelsBack << endl;
767 return -1;
768 }
769 Double_t xPoint = xCross, yPoint = yCross; // AZ
770 xCross = 0.;
771 yCross = 0.;
772 zCross = 0.;
773
774 // x coordinate of centre of front side strip readout pad
775 Double_t xint = (Double_t(iFStrip) + 0.5) * fDx;
776
777 Double_t sinrot = TMath::Sin(fRotation);
778 Double_t cosrot = TMath::Cos(fRotation);
779 Double_t tanstrB = 0.0, sterB = fStereoB * TMath::RadToDeg();
780 if (!(TMath::Abs(sterB - 90.) < 1 || TMath::Abs(sterB + 90.) < 1))
781 tanstrB = TMath::Tan(fStereoB);
782 Double_t tanstrF = TMath::Tan(fStereoF);
783 Int_t nStripMaxB = (fStereoB < 0. ? 0 : Int_t(fLy * (tanstrB) / fLx) + 1); // max. number of strips
784 Int_t nStripBegB = (fStereoB > 0. ? 0 : -Int_t(fLy * (tanstrB) / fLx) - 1);
785
786 // Int_t nStripMaxF = ( fStereoF<=0. ? 0 : Int_t(fLy*(tanstrF)/fLx)+1 ); // max. number of strips
787 // Int_t nStripBegF = ( fStereoF>0. ? 0 : -Int_t(fLy*(tanstrF)/fLx)-1 );
788
789 Double_t x0 = (Double_t(iBStrip) + 0.5) * fDx;
790
791 Double_t yint;
792 Double_t x;
793
794 Double_t xtemp, ytemp;
795
796 // AZ Y and X strips (0 and 90 degs)
797 if (tanstrF == 0. && tanstrB == 0.0) {
798 yint = (Double_t(iBStrip) + 0.5) * fDy;
799
800 // Translation to centre of sector
801 xtemp = xint - fLx / 2.;
802 ytemp = yint - fLy / 2.;
803
804 // Rotation around sector centre
805 xCross = xtemp * cosrot - ytemp * sinrot;
806 yCross = xtemp * sinrot + ytemp * cosrot;
807
808 // Translation into global c.s.
809 xCross = xCross + fX0;
810 yCross = yCross + fY0;
811 zCross = fZ0;
812
813 } else if (tanstrF == 0.) {
814
815 for (Int_t iStrip = nStripBegB; iStrip <= nStripMaxB; iStrip++) {
816
817 yint = (x0 - xint - fBackStripShift + Double_t(iStrip) * fLx) / tanstrB;
818
819 if (!(yint > 0. && yint < fLy))
820 continue;
821
822 if (zCross > 0.001) {
823 Fatal("Intersect", "Intersection of two strips in two different points not valid");
824 return -1;
825 }
826
827 // Translation to centre of sector
828 xtemp = xint - fLx / 2.;
829 ytemp = yint - fLy / 2.;
830
831 // Rotation around sector centre
832 xCross = xtemp * cosrot - ytemp * sinrot;
833 yCross = xtemp * sinrot + ytemp * cosrot;
834
835 // Translation into global c.s.
836 xCross = xCross + fX0;
837 yCross = yCross + fY0;
838 zCross = fZ0;
839 }
840 } else {
841
842 for (Int_t iStripB = 0; iStripB <= 1; iStripB++) {
843
844 for (Int_t iStripF = -1; iStripF <= 0; iStripF++) {
845
846 x = ((-1. / tanstrB) * (x0 - fBackStripShift + Double_t(iStripB) * fLx)
847 + (1. / tanstrF) * (xint - fFrontStripShift + Double_t(iStripF) * fLx))
848 / ((1. / tanstrF) - (1. / tanstrB));
849 yint = (-1. / tanstrB) * x + (1. / tanstrB) * (x0 - fBackStripShift + Double_t(iStripB) * fLx);
850
851 if (!(yint > 0. && yint < fLy))
852 continue;
853 if (!(x > 0. && x < fLx))
854 continue;
855
856 if (zCross > 0.001) {
857 // AZ Fatal("Intersect","1 Intersection of two strips in two different points not valid");
858 // AZ return -1;
859 Warning("Intersect", "1 Intersection of two strips in two different points not valid");
860 }
861
862 // Translation to centre of sector
863 xtemp = x - fLx / 2.;
864 ytemp = yint - fLy / 2.;
865
866 // Rotation around sector centre
867 // AZ xCross = xtemp * cosrot - ytemp * sinrot;
868 // AZ yCross = xtemp * sinrot + ytemp * cosrot;
869 Double_t xCross1 = xtemp * cosrot - ytemp * sinrot;
870 Double_t yCross1 = xtemp * sinrot + ytemp * cosrot;
871
872 // Translation into global c.s.
873 // AZ xCross = xCross + fX0;
874 // AZ yCross = yCross + fY0;
875 xCross1 += fX0;
876 yCross1 += fY0;
877 zCross = fZ0;
878
879 // AZ - pixel simulation
880 if (TMath::Abs(TMath::Abs(fStereoF - fStereoB) * TMath::RadToDeg() - 90) < 0.1) {
881 if (TMath::Abs(xCross1 - xPoint) > 0.5 || TMath::Abs(yCross1 - yPoint) > 0.5)
882 continue;
883 } //
884 xCross = xCross1; // AZ
885 yCross = yCross1; // AZ
886 }
887 }
888 }
889 // No intersection found
890 if (zCross < 0.001)
891 return -1;
892
893 return fDetectorId;
894}
895// -------------------------------------------------------------------------
896
897// ----- Public method Intersect ---------------------------------------
899 Double_t bChan,
900 Double_t& xCross,
901 Double_t& yCross,
902 Double_t& zCross)
903{
904
905 // Check for strip numbers
906 if (fChan < 0 || fChan > fNChannelsFront) {
907 cout << "-W- CbmStsSensor::Intersect: "
908 << "Invalid front channel number ! " << fChan << " " << fNChannelsFront << endl;
909 return -1;
910 }
911 if (bChan < 0 || bChan > fNChannelsBack) {
912 cout << "-W- CbmStsSensor::Intersect: "
913 << "Invalid back channel number ! " << bChan << " " << fNChannelsBack << endl;
914 return -1;
915 }
916
917 xCross = 0.;
918 yCross = 0.;
919 zCross = 0.;
920
921 Double_t sinrot = TMath::Sin(fRotation);
922 Double_t cosrot = TMath::Cos(fRotation);
923
924 // AZ Double_t xint = ( fChan + 0.5 ) * fDx - cosrot*fFrontLorentzShift*fD/2.;
925 Double_t xint = (fChan + 0.0) * fDx - cosrot * fFrontLorentzShift * fD / 2.;
926
927 // AZ Double_t x0 = ( bChan + 0.5 ) * fDx - cosrot*fBackLorentzShift*fD/2. ;
928 // AZ Double_t x0 = ( bChan + 0.5 ) * fDy - cosrot*fBackLorentzShift*fD/2. ;
929 Double_t x0 = (bChan + 0.0) * fDy - cosrot * fBackLorentzShift * fD / 2.;
930
931 Double_t yint;
932 Double_t x;
933
934 Double_t xtemp, ytemp;
935
936 if (fStereoF == 0. && fStereoB * 180 / TMath::Pi() < 80) {
937 // exit(0); //AZ-220322
938 Double_t tanstrB = TMath::Tan(fStereoB);
939 // Double_t tanstrF = TMath::Tan(fStereoF);
940 Int_t nStripMaxB = (fStereoB < 0. ? 0 : Int_t(fLy * tanstrB / fLx) + 1); // max. number of BSts
941 Int_t nStripBegB = (fStereoB > 0. ? 0 : -Int_t(fLy * tanstrB / fLx) - 1);
942
943 // Int_t nStripMaxF = ( fStereoF<=0. ? 0 : Int_t(fLy*tanstrF/fLx)+1 ); // max. number of Fstrips
944 // Int_t nStripBegF = ( fStereoF>0. ? 0 : -Int_t(fLy*tanstrF/fLx)-1 );
945 if (fType == 2)
946 nStripBegB = nStripMaxB = 0; // AZ
947
948 for (Int_t iStrip = nStripBegB; iStrip <= nStripMaxB; iStrip++) {
949
950 yint = (x0 - xint - fBackStripShift + Double_t(iStrip) * fLx) / tanstrB;
951
952 if (!(yint > 0. && yint < fLy))
953 continue;
954
955 if (zCross > 0.001) {
956 Fatal("Intersect", "Intersection of two strips in two different points not valid");
957 return -1;
958 }
959
960 // Translation to centre of sector
961 xtemp = xint - fLx / 2.;
962 ytemp = yint - fLy / 2.;
963
964 // Rotation around sector centre
965 xCross = xtemp * cosrot - ytemp * sinrot;
966 yCross = xtemp * sinrot + ytemp * cosrot;
967
968 // Translation into global c.s.
969 xCross = xCross + fX0;
970 yCross = yCross + fY0;
971 zCross = fZ0;
972 }
973 } else if (fStereoB * 180 / TMath::Pi() > 80) {
974 yint = (bChan + 0.5) * fDy;
975
976 if (zCross > 0.001) {
977 Fatal("Intersect", "Intersection of two strips in two different points not valid");
978 return -1;
979 }
980
981 // Translation to centre of sector
982 xtemp = xint - fLx / 2.;
983 ytemp = yint - fLy / 2.;
984
985 // Rotation around sector centre
986 xCross = xtemp * cosrot - ytemp * sinrot;
987 yCross = xtemp * sinrot + ytemp * cosrot;
988
989 // Translation into global c.s.
990 xCross = xCross + fX0;
991 yCross = yCross + fY0;
992 zCross = fZ0;
993 } else {
994 Double_t tanstrB = TMath::Tan(fStereoB);
995 Double_t tanstrF = TMath::Tan(fStereoF);
996 Int_t nStripMaxB = (fStereoB < 0. ? 0 : Int_t(fLy * tanstrB / fLx) + 1); // max. number of Bstrips
997 Int_t nStripBegB = (fStereoB > 0. ? 0 : -Int_t(fLy * tanstrB / fLx) - 1);
998
999 Int_t nStripMaxF = (fStereoF <= 0. ? 0 : Int_t(fLy * tanstrF / fLx) + 1); // max. number of Fstrips
1000 Int_t nStripBegF = (fStereoF > 0. ? 0 : -Int_t(fLy * tanstrF / fLx) - 1);
1001
1002 // AZ for (Int_t iStripB=0; iStripB<=1; iStripB++) {
1003
1004 // AZ for (Int_t iStripF=-1; iStripF<=0; iStripF++) {
1005
1006 // AZ
1007 if (fType == 2) {
1008 nStripBegB = nStripMaxB = 0;
1009 nStripBegF = nStripMaxF = 0;
1010 } else {
1011 nStripBegB = 0;
1012 nStripMaxB = 1;
1013 nStripBegF = -1;
1014 nStripMaxF = 0;
1015 }
1016 for (Int_t iStripB = nStripBegB; iStripB <= nStripMaxB; ++iStripB) {
1017
1018 for (Int_t iStripF = nStripBegF; iStripF <= nStripMaxF; ++iStripF) {
1019 // AZ
1020
1021 // x = ((-1./tanstrB) * (x0 - fBackStripShift + Double_t(iStripB)*fLx) + (1./tanstrF) * (xint -
1022 // fFrontStripShift + Double_t(iStripF)*fLx))/((1./tanstrF)-(1./tanstrB));
1023 x = ((1. / tanstrB) * (x0 - fBackStripShift + Double_t(iStripB) * fLx)
1024 + (1. / tanstrF) * (xint - fFrontStripShift + Double_t(iStripF) * fLx))
1025 / ((1. / tanstrF) + (1. / tanstrB)); // AZ
1026 // yint = (-1./tanstrB) * x + (1./tanstrB) * (x0 - fBackStripShift + Double_t(iStripB)*fLx);
1027 yint = (1. / tanstrB) * x + (1. / tanstrB) * (x0 - fBackStripShift + Double_t(iStripB) * fLx); // AZ
1028
1029 if (!(yint > 0. && yint < fLy))
1030 continue;
1031 if (!(x > 0. && x < fLx))
1032 continue;
1033
1034 if (zCross > 0.001) {
1035 Fatal("Intersect", "2 Intersection of two strips in two different points not valid");
1036 return -1;
1037 }
1038
1039 // Translation to centre of sector
1040 xtemp = x - fLx / 2.;
1041 ytemp = yint - fLy / 2.;
1042
1043 // Rotation around sector centre
1044 xCross = xtemp * cosrot - ytemp * sinrot;
1045 yCross = xtemp * sinrot + ytemp * cosrot;
1046
1047 // Translation into global c.s.
1048 xCross = xCross + fX0;
1049 yCross = yCross + fY0;
1050 zCross = fZ0;
1051 }
1052 }
1053 }
1054
1055 // No intersection found
1056 if (zCross < 0.001)
1057 return -1;
1058
1059 // AZ - Reject points outside of the sensor boundaries (for complex geometries)
1060 // AZ!!! - add extra smearing (for tests)
1061 // Double_t sigmaEx = 0.02; // 200 um
1062 // xCross += sigmaEx * gRandom->Gaus();
1063 //
1064 // AZ 15.02.2019 - add some safety margin around sensor (edge effect)
1065 Double_t safety = 0.3;
1066 Double_t glob[3] = {xCross, yCross, zCross}, loc[3] = {0};
1067 gGeoManager->cd(fName);
1068 gGeoManager->MasterToLocal(glob, loc);
1069 // cout << loc[0] << " " << loc[1] << " " << fLx << " " << fLy << endl;
1070 if (TMath::Abs(loc[0]) - fLx / 2 > safety || TMath::Abs(loc[1]) - fLy / 2 > safety)
1071 return -1;
1072 //*
1073 if (fLx > 20.0 && abs(loc[0]) < fLx / 2 && abs(loc[1]) < fLy / 2) {
1074 // GEMs - inner boundaries of hot and cold zones
1075 TString where =
1076 gGeoManager->FindNode(xCross + TMath::Sign(safety, fX0), yCross + TMath::Sign(safety, fY0), zCross)
1077 ->GetName();
1078 if (!where.Contains("sens", TString::kIgnoreCase))
1079 return -1;
1080 if (!fName.Contains(where)) {
1081 if (fName.Contains("sens", TString::kIgnoreCase) && !fName.Contains(where))
1082 return -1; // GEMS
1083 }
1084 }
1085 //*/
1086 // AZ-180322 - Exclude beam hole for BM@N "virtual" hot zones
1087 if (fName.Contains("Sensor_hot")) {
1088 gGeoManager->cd(fName);
1089 gGeoManager->CdUp();
1090 TString where =
1091 gGeoManager->FindNode(xCross + TMath::Sign(safety, fX0), yCross + TMath::Sign(safety, fY0), zCross)
1092 ->GetName();
1093 // cout << " WHERE: " << where << " " << fName << endl;
1094 if (!where.Contains("hot"))
1095 return -1;
1096 }
1097 return fDetectorId;
1098}
1099
1100// -------------------------------------------------------------------------
1101
1102// ----- Public method PointIndex --------------------------------------
1104{
1105 pair<Int_t, Int_t> a(iFStrip, iBStrip);
1106 if (fTrueHits.find(a) == fTrueHits.end())
1107 return -1;
1108 return fTrueHits[a];
1109}
1110// -------------------------------------------------------------------------
1111
1112// ----- Public method Reset -------------------------------------------
1114{
1115 fFrontActive.clear();
1116 fBackActive.clear();
1117 fTrueHits.clear();
1118}
1119// -------------------------------------------------------------------------
1120
1121// ----- Public method Print -------------------------------------------
1123{
1124 cout << " Sensor Nr. ";
1125 cout.width(3);
1126 cout << GetSensorNr() << ", Type ";
1127 cout.width(1);
1128 cout << fType << ", centre (";
1129 cout.width(6);
1130 cout << fX0 << ", ";
1131 cout.width(6);
1132 cout << fY0 << ") cm, rotation ";
1133 cout.width(6);
1134 cout << fRotation * 180. / TMath::Pi() << " deg., lx = ";
1135 cout.width(3);
1136 cout << fLx << " cm, ly = ";
1137 cout.width(3);
1138 cout << fLy << " cm, channels: " << GetNChannels() << endl;
1139}
1140// -------------------------------------------------------------------------
1141
1142// ----- Private method FrontStripNumber -------------------------------
1144{
1145
1146 Double_t xint = 0., yint = 0.;
1147
1148 // Calculate internal coordinates.
1149 // If point is inside sensor, return strip number
1150 if (IntCoord(x, y, xint, yint)) {
1151 // Double_t xf = xint + fFrontStripShift + yint * TMath::Tan(fStereoF);
1152 Double_t xf = xint + fFrontStripShift + yint * fTanF; // AZ
1153 xf = xf - TMath::Floor(xf / fLx) * fLx;
1154 Int_t iStrip = Int_t(xf / fDx);
1155
1156 if (iStrip < 0 || iStrip > fNChannelsFront) {
1157 cout << "-E- CbmStsSensor::FrontStripNumber: Invalid strip number"
1158 << " " << iStrip << endl;
1159 cout << " Sensor " << fDetectorId << ", x = " << xint << ", y = " << yint << endl;
1160 Fatal("FrontStripNumber", "Invalid strip number");
1161 }
1162 return iStrip;
1163 }
1164
1165 // Return -1 if point is outside sensor
1166 return -1;
1167}
1168// -------------------------------------------------------------------------
1169
1170// ----- Private method BackStripNumber --------------------------------
1172{
1173
1174 Double_t xint = 0., yint = 0.;
1175
1176 // Calculate internal coordinates.
1177 // If point is inside sensor, calculate projection onto readout line
1178 // and determine channel number
1179 if (IntCoord(x, y, xint, yint)) {
1180 if (fStereoB * 180 / TMath::Pi() > 80) {
1181 Double_t xp = yint;
1182 xp = xp - TMath::Floor(xp / fLy) * fLy;
1183 Int_t iStrip = (Int_t)(xp / fDy);
1184 if (iStrip < 0 || iStrip > fNChannelsBack) {
1185 cout << "-E- CbmStsSensor::BackStripNumber: Invalid strip number"
1186 << " " << iStrip << endl;
1187 cout << " Sensor " << fDetectorId << ", x = " << xint << ", y = " << yint << endl;
1188 Fatal("BackStripNumber", "Invalid strip number");
1189 }
1190 return iStrip;
1191 } else {
1192 // Project point along backside strip to y = 0
1193 // Double_t xp = xint + fBackStripShift + yint * TMath::Tan(fStereoB);
1194 Double_t xp = xint + fBackStripShift + yint * fTanB; // AZ
1195 // Calculate modulo w.r.t. sensor x width
1196 xp = xp - TMath::Floor(xp / fLx) * fLx;
1197 // Digitise
1198 Int_t iStrip = (Int_t)(xp / fDx);
1199 if (iStrip < 0 || iStrip > fNChannelsBack) {
1200 cout << "-E- CbmStsSensor::BackStripNumber: Invalid strip number"
1201 << " " << iStrip << endl;
1202 cout << " Sensor " << fDetectorId << ", x = " << xint << ", y = " << yint << endl;
1203 Fatal("BackStripNumber", "Invalid strip number");
1204 }
1205 return iStrip;
1206 }
1207 }
1208
1209 // Return -1 if point is outside sensor
1210 return -1;
1211}
1212// -------------------------------------------------------------------------
1213
1214// ----- Private method IntCoord ---------------------------------------
1216{
1217
1218 // Translation into sensor centre system
1219 x = x - fX0;
1220 y = y - fY0;
1221
1222 // Rotation around the sensor centre
1223 // xint = x * TMath::Cos(fRotation) + y * TMath::Sin(fRotation);
1224 // yint = y * TMath::Cos(fRotation) - x * TMath::Sin(fRotation);
1225 xint = x * fCosRot + y * fSinRot; // AZ
1226 yint = y * fCosRot - x * fSinRot; // AZ
1227
1228 // Translation into sensor corner system
1229 xint = xint + fLx / 2.;
1230 yint = yint + fLy / 2.;
1231
1232 // Check whether point is inside the sensor
1233 if (!IsInside(xint, yint)) {
1234 xint = yint = 0.;
1235 return kFALSE;
1236 }
1237
1238 return kTRUE;
1239}
1240// -------------------------------------------------------------------------
1241
1242// ----- Private method IntCoord ---------------------------------------
1244{
1245
1246 // Translation into sensor centre system
1247 x = x - fX0;
1248 y = y - fY0;
1249
1250 // Rotation around the sensor centre
1251 xint = x * TMath::Cos(fRotation) + y * TMath::Sin(fRotation);
1252 yint = y * TMath::Cos(fRotation) - x * TMath::Sin(fRotation);
1253
1254 // Translation into sensor corner system
1255 xint = xint + fLx / 2.;
1256 yint = yint + fLy / 2.;
1257
1258 // Check whether point is inside the sensor
1259 if (!IsInside(xint, yint)) {
1260 xint = yint = 0.;
1261 return kFALSE;
1262 }
1263
1264 return kTRUE;
1265}
1266// -------------------------------------------------------------------------
1267
1268// ----- Private method IsInside ---------------------------------------
1270{
1271 if (xint < 0.)
1272 return kFALSE;
1273 if (xint > fLx)
1274 return kFALSE;
1275 if (yint < 0.)
1276 return kFALSE;
1277 if (yint > fLy)
1278 return kFALSE;
1279 return kTRUE;
1280}
1281// -------------------------------------------------------------------------
bool Bool_t
int Int_t
float Float_t
constexpr Bool_t kFALSE
double Double_t
constexpr Bool_t kTRUE
R__EXTERN TGeoManager * gGeoManager
Double_t fBackLorentzShift
Double_t fStereoF
Float_t GetChannelPlus(Double_t x, Double_t y, Int_t iSide)
Int_t fNChannelsFront
Number of channels in front and back plane.
Double_t fSigmaXY
Float_t fSigmaX
Errors of hit coordinates.
Int_t IntersectClusters(Double_t fChan, Double_t bChan, Double_t &xCross, Double_t &yCross, Double_t &zCross)
std::set< Int_t > fBackActive
Int_t FrontStripNumber(Double_t x, Double_t y) const
----------— Private methods ---------------------—
CbmStsSensor()
Default constructor.
Double_t fCosRot
Double_t fFrontStripShift
Double_t fRotation
Double_t fSigmaY
Int_t Intersect(Int_t iFStrip, Int_t iBStrip, std::vector< Double_t > &xCross, std::vector< Double_t > &yCross)
Calculates the coordinates of the intersections of front strip i with back strip j in the global coor...
Bool_t Inside(Double_t x, Double_t y)
Test whether a coordinate pair (x,y) in global coordinates is inside the sensor.
Int_t GetFrontChannel(Double_t x, Double_t y, Double_t z, Double_t &dPitch)
Int_t GetNChannels() const
Int_t GetBackChannel(Double_t x, Double_t y, Double_t z, Double_t &dPitch)
Bool_t ActivateChannels(Int_t ipt, Double_t x, Double_t y)
Activate the channels corresponding to a MCPoint.
Double_t fBackStripShift
Int_t PointIndex(Int_t iFStrip, Int_t iBStrip)
The index of the MCPoint that has caused a combination of front and back strip to be fired.
Double_t fStereoB
std::set< Int_t > fFrontActive
STL sets containing the active channels.
Bool_t IsInside(Double_t xint, Double_t yint) const
Check whether a point is inside the sensor.
void Print()
Screen output.
void Reset()
Clear the maps of fired strips.
Int_t BackStripNumber(Double_t x, Double_t y) const
Strip number of a point in the back plane.
Int_t fNChannelsBack
Double_t fSinRot
Int_t fDetectorId
----------— Data members -----------------------—
Int_t GetStationNr() const
Double_t fZSmearSlope
virtual ~CbmStsSensor()
Destructor.
Double_t fFrontLorentzShift
Int_t GetChannel(Double_t x, Double_t y, Int_t iSide)
Calculate channel number for a coordinate pair.
Bool_t IntCoord(Double_t x, Double_t y, Double_t &xint, Double_t &yint) const
Calculate coordinates in internal coordinate system.
Double_t fTanB
Double_t fXSmearWidth
std::map< std::pair< Int_t, Int_t >, Int_t > fTrueHits
STL map from the indizes of the fired strips to the index of the MCPoint.
Int_t GetSensorNr() const
Double_t fTanF
TString fName
virtual void Warning(const char *method, const char *msgfmt,...) const
virtual void Fatal(const char *method, const char *msgfmt,...) const
const char * Data() const
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
RVec< PromoteType< T > > abs(const RVec< T > &v)
Int_t Nint(T x)
Double_t Sign(Double_t a, Double_t b)
Double_t Floor(Double_t x)
Double_t Ceil(Double_t x)
Double_t Sqrt(Double_t x)
Double_t Cos(Double_t)
constexpr Double_t Pi()
Double_t Abs(Double_t d)
Double_t Sin(Double_t)
Double_t Tan(Double_t)
constexpr Double_t RadToDeg()
vector< string > glob(const string &path)