45 fName = tempName.Data();
92 cout << tempName.Data() <<
"-W- !!! type " <<
fType <<
" with OuterRadius/InnerRadius " <<
fOuterRadius/
fInnerRadius <<
" is currently not supported !!!" << endl;
93 cout <<
" Please use type 0 instead !!!" << endl;
117 fName = tempName.Data();
164 cout << tempName.Data() <<
"-W- !!! type " <<
fType <<
" with OuterRadius/InnerRadius " <<
fOuterRadius/
fInnerRadius <<
" is currently not supported !!!" << endl;
165 cout <<
" Please use type 0 instead !!!" << endl;
182 fDetectorId (tempSensor.fDetectorId),
183 fType (tempSensor.fType),
187 fRotation (tempSensor.fRotation),
188 fInnerRadius (tempSensor.fInnerRadius),
189 fOuterRadius (tempSensor.fOuterRadius),
195 fNChannelsFront(tempSensor.fNChannelsFront),
196 fNChannelsBack (tempSensor.fNChannelsBack),
197 fSigmaX (tempSensor.fSigmaX),
198 fSigmaY (tempSensor.fSigmaY),
199 fSigmaXY (tempSensor.fSigmaXY)
222 cout << fName.Data() <<
": Sensor #";
226 cout <<
fType <<
", centre (";
230 cout << fPosition[1] <<
", ";
232 cout << fPosition[2] <<
") cm, rotation " ;
240 cout <<
fD <<
" cm, strip angle (";
244 cout << fStripAngle[1] <<
") cm, pitch (";
246 cout <<
fPitch[0] <<
", ";
248 cout << fPitch[1] <<
") cm. ";
253 cout <<
"SENSOR : " << flush;
254 while ( tempSId > 0 ) {
256 cout <<
"\b" << tempSId%2 <<
"\b" << flush;
257 if ( bc == 27 || bc == 21 || bc == 8 || bc == 6 || bc == 5 )
258 cout <<
"\b|\b" << flush;
269 if (iSide !=0 && iSide != 1) {
270 cout <<
"-W- PndGemSensor::GetChannel: Illegal side number "
275 if ( !
Inside(x,y) )
return -1;
279 cout <<
"do not use this type anymore" << endl;
284 Double_t hitPhi = TMath::ACos(y/radius);
305 if ( x < 0. && y >= 0. )
307 if ( x < 0. && y < 0. )
313 return nlStrips+2*nsStrips+(Int_t)((x)/
fPitch[0]);
315 return nlStrips+3*nsStrips+(Int_t)((x)/
fPitch[0]);
326 Double_t hitPhi = TMath::ACos(y/radius);
341 ifac_r |= (ifac_r >> 1);
342 ifac_r |= (ifac_r >> 2);
343 ifac_r |= (ifac_r >> 4);
344 ifac_r -= (ifac_r >> 1);
346 if ( ifac_r == 0 )
return -1;
347 else ich_step = (Int_t) (ifac / ifac_r);
439 if (iSide !=0 && iSide != 1)
return -1.;
440 if ( !
Inside(x,y) )
return -1.;
448 Double_t hitPhi = TMath::ACos(y/radius);
456 Double_t hitPhi = TMath::ACos(y/radius);
474 Double_t hitPhi = TMath::ACos(y/radius);
482 Double_t hitPhi = TMath::ACos(y/radius);
495 if ( chan1 == -1 || chan2 == -1 ){
521 else chan1 = chan1+nsStrips;
530 else chan2 = chan2+nsStrips;
534 if ( part1*part2 == -1 )
return -1;
569 if ( chanMin == -1 || chanMax == -1 || chanTest ==-1 ){
576 if ( chanTest > chanMin && chanTest < chanMax )
return 0;
580 if ( chanTest > chanMin && chanTest < chanMax )
return 0;
595 else chanMin += nsStrips;
602 else chanMax += nsStrips;
609 else chanTest += nsStrips;
612 if ( chanTest > chanMin && chanTest < chanMax )
return 0;
616 if ( chanTest > chanMin && chanTest < chanMax )
return 0;
623 if ( chanTest > chanMin && chanTest < chanMax )
return 0;
641 if ( chanTest > chanMin && chanTest < chanMax )
return 0;
654 if ( chan1 == -1 || chan2 == -1 )
return -1.;
677 else chan1 = chan1+nsStrips;
686 else chan2 = chan2+nsStrips;
690 if ( part1*part2 == -1 )
return -1;
700 Int_t ifac=1,ifac_test=1, ifac1=1, ifac2=1,icom_ifac=0;
701 Int_t ideno,iring_test=0,iring1=0,iring2=0;
702 Int_t itest1,itest2,i1ok=0,i2ok=0;
714 for( ideno=ifac; ideno>=1; ideno/=2){
718 if( itest1 == 0 && i1ok == 0){
725 if( itest2 == 0 && i2ok == 0){
734 if( iring1 >= iring2 ){
743 if(ifac%icom_ifac == 0){
744 icom_chstep=ifac/icom_ifac;
747 cout<<
"-W- !!! something wrong on ifac..in PndGemSensor::GetDistance2() !!!"<<endl;
765 if ( chan1 == -1 || chan2 == -1 )
return -1.;
769 return (chan1*weight1+chan2*weight2)/(weight1+weight2);
772 return (chan1*weight1+chan2*weight2)/(weight1+weight2);
788 else chan1 = chan1+nsStrips;
797 else chan2 = chan2+nsStrips;
801 if ( part1*part2 == -1 )
return -1;
803 Double_t meanCh = (chan1*weight1+chan2*weight2)/(weight1+weight2);
805 if ( part1+part2 < 0 ) {
806 if ( meanCh > nlStrips && meanCh < nlStrips+nsStrips ) meanCh += nsStrips;
813 return (chan1*weight1+chan2*weight2)/(weight1+weight2);
817 return (chan1*weight1+chan2*weight2)/(weight1+weight2);
827 if (iSide !=0 && iSide != 1) {
828 cout <<
"-W- PndGemSensor::GetChannel: Illegal side number "
833 if ( !
Inside(x,y) )
return -1;
837 cout <<
"-E- !!! do not use this type anymore" << endl;
844 Double_t hitPhi = TMath::ACos(y/radius);
851 Double_t hitPhi = TMath::ACos(y/radius);
857 feeDist = hitPhi*radius;
863 feeDist = (2.*
TMath::Pi()-hitPhi)*radius;
874 Double_t hitPhi = TMath::ACos(y/radius);
887 if ( x < 0. && y >= 0. )
889 if ( x < 0. && y < 0. )
895 return (Int_t)(nlStrips+2*nsStrips+(
x)/
fPitch[0]);
897 return (Int_t)(nlStrips+3*nsStrips+(
x)/
fPitch[0]);
912 Double_t hitPhi = TMath::ACos(y/radius);
926 ifac_r |= (ifac_r >> 1);
927 ifac_r |= (ifac_r >> 2);
928 ifac_r |= (ifac_r >> 4);
929 ifac_r -= (ifac_r >> 1);
932 if ( ifac_r == 0 )
return -1;
933 else ich_step = (Int_t) (ifac / ifac_r);
938 Double_t hitPhi = TMath::ACos(y/radius);
943 feeDist = hitPhi*radius;
949 feeDist = (2.*
TMath::Pi()-hitPhi)*radius;
1048 if (
fType == -1 ) {
1049 cout <<
"-E- !!! not supported anymore" << endl;
1053 if ( iFStrip < fNChannelsFront/2 && iBStrip >=
fNChannelsBack/2 )
return -1;
1064 if (
Inside(xCross,yCross) )
1077 if ( iFStrip < nlStrips ) {
1079 if ( !
Inside(xCross,yCross) )
return -1;
1082 if ( iFStrip < nlStrips+ nsStrips ) {
1085 if ( !
Inside(xCross,yCross) )
return -1;
1088 if ( iFStrip < nlStrips+2*nsStrips ) {
1091 if ( !
Inside(xCross,yCross) )
return -1;
1094 if ( iFStrip < nlStrips+3*nsStrips ) {
1097 if ( !
Inside(xCross,yCross) )
return -1;
1100 if ( iFStrip < nlStrips+4*nsStrips ) {
1103 if ( !
Inside(xCross,yCross) )
return -1;
1113 if (
Inside(xCross,yCross) )
1128 if (
fType == -1 ) {
1129 cout <<
"-E- !!! not supported anymore" << endl;
1134 if ( iFStrip < fNChannelsFront/2 && iBStrip >=
fNChannelsBack/2 )
return -1;
1148 if (
Inside(xCross,yCross) )
1162 if ( iFStrip < nlStrips )
1164 else if ( iFStrip < nlStrips+ nsStrips ) {
1168 else if ( iFStrip < nlStrips+2*nsStrips ) {
1172 else if ( iFStrip < nlStrips+3*nsStrips ) {
1176 else if ( iFStrip < nlStrips+4*nsStrips ) {
1183 if ( !
Inside(xCross,yCross) )
return -1;
1212 ifac_r |= (ifac_r >> 1);
1213 ifac_r |= (ifac_r >> 2);
1214 ifac_r |= (ifac_r >> 4);
1215 ifac_r -= (ifac_r >> 1);
1219 if (
Inside(xCross,yCross) )
1233 if (
fType == -1 ) {
1234 cout <<
"-E- !!! not supported anymore" << endl;
1239 if ( iFStrip < fNChannelsFront/2 && iBStrip >=
fNChannelsBack/2 )
return -1;
1255 if (
Inside(xCross,yCross) )
1270 if ( iFStrip < nlStrips )
1272 else if ( iFStrip < nlStrips+ nsStrips ) {
1276 else if ( iFStrip < nlStrips+2*nsStrips ) {
1280 else if ( iFStrip < nlStrips+3*nsStrips ) {
1284 else if ( iFStrip < nlStrips+4*nsStrips ) {
1292 if ( !
Inside(xCross,yCross) )
return -1;
1319 ifac |= (ifac >> 1);
1320 ifac |= (ifac >> 2);
1321 ifac |= (ifac >> 4);
1322 ifac -= (ifac >> 1);
1326 if ( ifac_r == 0 ) {
1327 cout<<
"-W- PndGemSensor::Intersect() radius (" << radius <<
") in smaller than InnerRadius (" <<
fInnerRadius <<
").. return -1! (strip " << iFStrip <<
" / " << iBStrip <<
" )" <<endl;
1330 ifac_r |= (ifac_r >> 1);
1331 ifac_r |= (ifac_r >> 2);
1332 ifac_r |= (ifac_r >> 4);
1333 ifac_r -= (ifac_r >> 1);
1336 if ( ifac_r == 0 )
return -1;
1337 else ich_step = (Int_t) (ifac / ifac_r);
1347 if (
Inside(xCross,yCross) )
Int_t Intersect(Double_t iFStrip, Double_t iBStrip, Double_t &xCross, Double_t &yCross, Double_t &zCross)
static T Sqrt(const T &x)
Double_t GetStripOrientation(Double_t x, Double_t y, Int_t iSide)
void SetDetectorId(Int_t stationNr, Int_t sensorNr)
Int_t GetChannel(Double_t x, Double_t y, Int_t iSide)
static T Min(const T &x, const T &y)
Double_t GetDistance(Int_t iSide, Double_t chan1, Double_t chan2)
Int_t GetChannel2(Double_t x, Double_t y, Int_t iSide, Double_t &feeDist)
Bool_t Inside(Double_t x, Double_t y)
Int_t GetSensorPart(Int_t iSide, Int_t chan)
Int_t GetSensorNr() const
Double_t GetDistance2(Int_t iSide, Double_t chan1, Double_t chan2)
Int_t GetNeighbours(Int_t iSide, Int_t iChan, Int_t &nChan1, Int_t &nChan2, Int_t &nChan3)
Double_t GetMeanChannel(Int_t iSide, Double_t chan1, Double_t weight1, Double_t chan2, Double_t weight2)