52 cout <<
"-W- CbmStsSensor: Do not use this constructor! " << endl;
71 :
TNamed(tempName.Data(),
"")
128 }
else if (
fType == 2) {
134 }
else if (
fType == 3) {
142 cout <<
"-E- CbmStsSensor: Illegal sensor type " <<
fType << endl;
143 Fatal(
"",
"Illegal sensor type");
169 if (sensorNumber == 1) {
174 }
else if (sensorNumber == 2) {
182 }
else if (sensorNumber == 3) {
193 cout <<
"-E- CbmStsSensor: Illegal sensor type " <<
fType << endl;
194 Fatal(
"",
"Illegal sensor type");
284 }
else if (
fType == 2) {
290 }
else if (
fType == 3) {
294 cout <<
"-E- CbmStsSensor: Illegal sensor type " <<
fType << endl;
295 Fatal(
"",
"Illegal sensor type");
319 if (sensorNumber == 1) {
324 }
else if (sensorNumber == 2) {
332 }
else if (sensorNumber == 3) {
343 cout <<
"-E- CbmStsSensor: Illegal sensor type " <<
fType << endl;
344 Fatal(
"",
"Illegal sensor type");
377 if (iSide != 0 && iSide != 1) {
378 cout <<
"-W- CbmStsSensor::GetChannel: Illegal side number " << iSide << endl;
395 iChan = iRow * nCol + iCol;
397 cout <<
"-E- CbmStsSensor::GetChannel: "
398 <<
"Channel number " << iChan <<
" exceeds limit " <<
fNChannelsFront << endl;
400 cout << x <<
" " << y <<
" " << iSide << endl;
401 Fatal(
"GetChannel",
"illegal channel number");
411 cout <<
"-E- CbmStsSensor::GetChannel: "
412 <<
"Front channel number " << iChan <<
" exceeds limit " <<
fNChannelsFront << endl;
413 Fatal(
"GetChannel",
"illegal channel number");
421 cout <<
"-E- CbmStsSensor::GetChannel: "
422 <<
"Back channel number " << iChan <<
" exceeds limit " <<
fNChannelsBack << endl;
424 cout <<
" Point coordinates: (" << x <<
", " << y <<
") cm" << endl;
425 Fatal(
"GetChannel",
"illegal channel number");
438 cout <<
"-E- CbmStsSensor::GetChannel: "
439 <<
"Front channel number " << iChan <<
" exceeds limit " <<
fNChannelsFront << endl;
440 Fatal(
"GetChannel",
"illegal channel number");
457 cout <<
"-E- CbmStsSensor::GetChannel: "
458 <<
"Back channel number " << iChan <<
" exceeds limit " <<
fNChannelsBack << endl;
460 cout <<
" Point coordinates: (" << x <<
", " << y <<
") cm" << endl;
461 Fatal(
"GetChannel",
"illegal channel number");
475 if (iSide != 0 && iSide != 1) {
476 cout <<
"-W- CbmStsSensor::GetChannel: Illegal side number " << iSide << endl;
493 iChan = iRow * nCol + iCol;
495 cout <<
"-E- CbmStsSensor::GetChannel: "
496 <<
"Channel number " << iChan <<
" exceeds limit " <<
fNChannelsFront << endl;
498 cout << x <<
" " << y <<
" " << iSide << endl;
499 Fatal(
"GetChannel",
"illegal channel number");
509 cout <<
"-E- CbmStsSensor::GetChannel: "
510 <<
"Front channel number " << iChan <<
" exceeds limit " <<
fNChannelsFront << endl;
511 Fatal(
"GetChannel",
"illegal channel number");
520 cout <<
"-E- CbmStsSensor::GetChannel: "
521 <<
"Back channel number " << iChan <<
" exceeds limit " <<
fNChannelsBack << endl;
523 cout <<
" Point coordinates: (" << x <<
", " << y <<
") cm" << endl;
524 Fatal(
"GetChannel",
"illegal channel number");
538 cout <<
"-E- CbmStsSensor::GetChannel: "
539 <<
"Front channel number " << iChan <<
" exceeds limit " <<
fNChannelsFront << endl;
540 Fatal(
"GetChannel",
"illegal channel number");
555 cout <<
"-E- CbmStsSensor::GetChannel: "
556 <<
"Back channel number " << iChan <<
" exceeds limit " <<
fNChannelsBack << endl;
558 cout <<
" Point coordinates: (" << x <<
", " << y <<
") cm" << endl;
559 Fatal(
"GetChannel",
"illegal channel number");
573 z = z -
fZ0 +
fD / 2.;
604 dPitch = xf - iChan *
fDx;
614 z =
fZ0 +
fD / 2. - z;
653 dPitch = xp - iChan *
fDy;
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;
684 pair<Int_t, Int_t> a(iFront, iBack);
701 cout <<
"-W- CbmStsSensor::Intersect: "
702 <<
"Invalid front channel number ! " << iFStrip <<
" " <<
fNChannelsFront << endl;
706 cout <<
"-W- CbmStsSensor::Intersect: "
707 <<
"Invalid back channel number ! " << iBStrip <<
" " <<
fNChannelsBack << endl;
723 for (Int_t iSegB = 0; iSegB < nSegB; iSegB++) {
725 for (Int_t iSegF = 0; iSegF < nSegF; iSegF++) {
735 if (y < 0. || y >
fLy)
737 if (x < 0. || x >
fLx)
745 xCross.push_back(xHit);
746 yCross.push_back(yHit);
750 return xCross.size();
760 cout <<
"-W- CbmStsSensor::Intersect: "
761 <<
"Invalid front channel number ! " << iFStrip <<
" " <<
fNChannelsFront << endl;
765 cout <<
"-W- CbmStsSensor::Intersect: "
766 <<
"Invalid back channel number ! " << iBStrip <<
" " <<
fNChannelsBack << endl;
769 Double_t xPoint = xCross, yPoint = yCross;
797 if (tanstrF == 0. && tanstrB == 0.0) {
801 xtemp = xint -
fLx / 2.;
802 ytemp = yint -
fLy / 2.;
805 xCross = xtemp * cosrot - ytemp * sinrot;
806 yCross = xtemp * sinrot + ytemp * cosrot;
809 xCross = xCross +
fX0;
810 yCross = yCross +
fY0;
813 }
else if (tanstrF == 0.) {
815 for (
Int_t iStrip = nStripBegB; iStrip <= nStripMaxB; iStrip++) {
819 if (!(yint > 0. && yint <
fLy))
822 if (zCross > 0.001) {
823 Fatal(
"Intersect",
"Intersection of two strips in two different points not valid");
828 xtemp = xint -
fLx / 2.;
829 ytemp = yint -
fLy / 2.;
832 xCross = xtemp * cosrot - ytemp * sinrot;
833 yCross = xtemp * sinrot + ytemp * cosrot;
836 xCross = xCross +
fX0;
837 yCross = yCross +
fY0;
842 for (
Int_t iStripB = 0; iStripB <= 1; iStripB++) {
844 for (
Int_t iStripF = -1; iStripF <= 0; iStripF++) {
848 / ((1. / tanstrF) - (1. / tanstrB));
851 if (!(yint > 0. && yint <
fLy))
853 if (!(x > 0. && x <
fLx))
856 if (zCross > 0.001) {
859 Warning(
"Intersect",
"1 Intersection of two strips in two different points not valid");
863 xtemp = x -
fLx / 2.;
864 ytemp = yint -
fLy / 2.;
869 Double_t xCross1 = xtemp * cosrot - ytemp * sinrot;
870 Double_t yCross1 = xtemp * sinrot + ytemp * cosrot;
907 cout <<
"-W- CbmStsSensor::Intersect: "
908 <<
"Invalid front channel number ! " << fChan <<
" " <<
fNChannelsFront << endl;
912 cout <<
"-W- CbmStsSensor::Intersect: "
913 <<
"Invalid back channel number ! " << bChan <<
" " <<
fNChannelsBack << endl;
946 nStripBegB = nStripMaxB = 0;
948 for (
Int_t iStrip = nStripBegB; iStrip <= nStripMaxB; iStrip++) {
952 if (!(yint > 0. && yint <
fLy))
955 if (zCross > 0.001) {
956 Fatal(
"Intersect",
"Intersection of two strips in two different points not valid");
961 xtemp = xint -
fLx / 2.;
962 ytemp = yint -
fLy / 2.;
965 xCross = xtemp * cosrot - ytemp * sinrot;
966 yCross = xtemp * sinrot + ytemp * cosrot;
969 xCross = xCross +
fX0;
970 yCross = yCross +
fY0;
974 yint = (bChan + 0.5) *
fDy;
976 if (zCross > 0.001) {
977 Fatal(
"Intersect",
"Intersection of two strips in two different points not valid");
982 xtemp = xint -
fLx / 2.;
983 ytemp = yint -
fLy / 2.;
986 xCross = xtemp * cosrot - ytemp * sinrot;
987 yCross = xtemp * sinrot + ytemp * cosrot;
990 xCross = xCross +
fX0;
991 yCross = yCross +
fY0;
1008 nStripBegB = nStripMaxB = 0;
1009 nStripBegF = nStripMaxF = 0;
1016 for (
Int_t iStripB = nStripBegB; iStripB <= nStripMaxB; ++iStripB) {
1018 for (
Int_t iStripF = nStripBegF; iStripF <= nStripMaxF; ++iStripF) {
1025 / ((1. / tanstrF) + (1. / tanstrB));
1029 if (!(yint > 0. && yint <
fLy))
1031 if (!(x > 0. && x <
fLx))
1034 if (zCross > 0.001) {
1035 Fatal(
"Intersect",
"2 Intersection of two strips in two different points not valid");
1040 xtemp = x -
fLx / 2.;
1041 ytemp = yint -
fLy / 2.;
1044 xCross = xtemp * cosrot - ytemp * sinrot;
1045 yCross = xtemp * sinrot + ytemp * cosrot;
1048 xCross = xCross +
fX0;
1049 yCross = yCross +
fY0;
1066 Double_t glob[3] = {xCross, yCross, zCross}, loc[3] = {0};
1080 if (!
fName.Contains(where)) {
1087 if (
fName.Contains(
"Sensor_hot")) {
1105 pair<Int_t, Int_t> a(iFStrip, iBStrip);
1124 cout <<
" Sensor Nr. ";
1128 cout <<
fType <<
", centre (";
1130 cout <<
fX0 <<
", ";
1132 cout <<
fY0 <<
") cm, rotation ";
1136 cout <<
fLx <<
" cm, ly = ";
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");
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");
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");
1229 xint = xint +
fLx / 2.;
1230 yint = yint +
fLy / 2.;
1255 xint = xint +
fLx / 2.;
1256 yint = yint +
fLy / 2.;
R__EXTERN TGeoManager * gGeoManager
Double_t fBackLorentzShift
Float_t GetChannelPlus(Double_t x, Double_t y, Int_t iSide)
Int_t fNChannelsFront
Number of channels in front and back plane.
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 fFrontStripShift
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.
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.
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 fDetectorId
----------— Data members -----------------------—
Int_t GetStationNr() const
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.
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
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)
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)
constexpr Double_t RadToDeg()
vector< string > glob(const string &path)