5 #ifndef LARWHEELCALCULATOR_IMPL_WHEELFANCALCULATOR_H
6 #define LARWHEELCALCULATOR_IMPL_WHEELFANCALCULATOR_H
22 template <
typename SaggingType>
31 return lwc->DistanceToTheNeutralFibre(
p,
lwc->adjust_fan_number(fan_number));
40 return lwc->DistanceToTheNeutralFibre(
p, -531135);
50 template <
typename SaggingType, FanSearchDirection_t dir >
54 template <FanSearchDirection_t dir >
58 static inline void next(
int &) {}
67 static inline void next(
int &fan_number) {
70 static inline void adjust(
int &fan_number) {
79 static inline void next(
int &fan_number) {
85 template <FanSearchDirection_t dir>
92 template <
typename T >
102 template <
typename T >
109 template <
typename SaggingType, FanSearchDirection_t dir,
class NFDistance >
111 const double angle, CLHEP::Hep3Vector &
p)
138 template <
typename SaggingType>
139 class WheelFanCalculator :
public IFanCalculator
153 int fan_number =
int((
p.phi() -
halfpi -
lwc()->m_ZeroFanPhi_ForDetNeaFan) /
lwc()->m_FanStepOnPhi);
156 printf(
"DistanceToTheNearestFan: initial FN %4d\n", fan_number);
166 const int delta = (
d0 < 0.) ? -1 : 1;
173 rotate_to_nearest_fan< SaggingType, FORWARD, NFDistance >(
lwc(), fan_number, step_angle,
p);
175 rotate_to_nearest_fan< SaggingType, BACKWARD, NFDistance >(
lwc(), fan_number, step_angle,
p);
196 p.rotateZ(-0.5 * step_angle);
198 printf(
"DistanceToTheNearestFan: final FN %4d\n", fan_number);
213 CLHEP::Hep3Vector
p1 =
p;
215 int fan_number =
int((
p.phi() -
halfpi -
lwc()->m_ZeroFanPhi) /
lwc()->m_FanStepOnPhi);
227 const int delta = (
d0 < 0.) ? -1 : 1;
232 p1.rotateZ(step_angle);
237 }
while(
d0 *
d1 > 0.);
239 if(delta > 0) fan_number --;
240 if(!
lwc()->m_isElectrode) fan_number ++;
242 p1.rotateZ(-0.5 * step_angle);
246 int side =
dd < 0.? -1: 1;
248 printf(
"GetPhiGapAndSide: MFN %4d\n", a_fan_number);
250 return std::pair<int, int>(a_fan_number,
side);
264 #endif // LARWHEELCALCULATOR_IMPL_WHEELFANCALCULATOR_H