CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CachedTrajectory.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: TrackAssociator
4 // Class: CachedTrajectory
5 //
6 // $Id: CachedTrajectory.cc,v 1.23 2010/01/24 22:01:56 dmytro Exp $
7 //
8 //
9 
11 // #include "Utilities/Timing/interface/TimerStack.h"
16 #include <deque>
17 #include <algorithm>
18 
26 }
27 
29 {
30  // defined a normal plane wrt the particle trajectory direction
31  // let's hope that I computed the rotation matrix correctly.
32  GlobalVector vector(state.momentum().unit());
33  float r21 = 0;
34  float r22 = vector.z()/sqrt(1-pow(vector.x(),2));
35  float r23 = -vector.y()/sqrt(1-pow(vector.x(),2));
36  float r31 = vector.x();
37  float r32 = vector.y();
38  float r33 = vector.z();
39  float r11 = r22*r33-r23*r32;
40  float r12 = r23*r31;
41  float r13 = -r22*r31;
42 
43  Surface::RotationType rotation(r11, r12, r13,
44  r21, r22, r23,
45  r31, r32, r33);
46  Plane::PlanePointer target = Plane::build(state.position()+vector*distance, rotation);
47  propagate(state, *target);
48 }
49 
51 {
52  if( const SteppingHelixPropagator* shp = dynamic_cast<const SteppingHelixPropagator*>(propagator_) )
53  {
54  try {
55  state = shp->propagate(state, plane);
56  }
57  catch(cms::Exception &ex){
58  edm::LogWarning("TrackAssociator") <<
59  "Caught exception " << ex.category() << ": " << ex.explainSelf();
60  edm::LogWarning("TrackAssociator") << "An exception is caught during the track propagation\n"
61  << state.momentum().x() << ", " << state.momentum().y() << ", " << state.momentum().z();
62  state = SteppingHelixStateInfo();
63  }
64  }
65  else
66  {
68  state.getFreeState( fts );
69  TrajectoryStateOnSurface stateOnSurface = propagator_->propagate(fts, plane);
70  state = SteppingHelixStateInfo( *(stateOnSurface.freeState()) );
71  }
72 }
73 
75 {
76  if( const SteppingHelixPropagator* shp = dynamic_cast<const SteppingHelixPropagator*>(propagator_) )
77  {
78  try {
79  state = shp->propagate(state, cylinder);
80  }
81  catch(cms::Exception &ex){
82  edm::LogWarning("TrackAssociator") <<
83  "Caught exception " << ex.category() << ": " << ex.explainSelf();
84  edm::LogWarning("TrackAssociator") << "An exception is caught during the track propagation\n"
85  << state.momentum().x() << ", " << state.momentum().y() << ", " << state.momentum().z();
86  state = SteppingHelixStateInfo();
87  }
88  }
89  else
90  {
92  state.getFreeState( fts );
93  TrajectoryStateOnSurface stateOnSurface = propagator_->propagate(fts, cylinder);
94  state = SteppingHelixStateInfo( *(stateOnSurface.freeState()) );
95  }
96 }
97 
99 {
100  if ( fullTrajectoryFilled_ ) {
101  edm::LogWarning("TrackAssociator") << "Reseting all trajectories. Please call reset_trajectory() explicitely to avoid this message";
103  }
104 
105 // TimerStack timers(TimerStack::Disableable);
106 
108  if (propagator_==0) throw cms::Exception("FatalError") << "Track propagator is not defined\n";
109  SteppingHelixStateInfo currentState(initialState);
110  fullTrajectory_.push_back(currentState);
111 
112  while (currentState.position().perp()<maxRho_ && fabs(currentState.position().z())<maxZ_ ){
113  LogTrace("TrackAssociator") << "[propagateAll] Propagate outward from (rho, r, z, phi) (" <<
114  currentState.position().perp() << ", " << currentState.position().mag() << ", " <<
115  currentState.position().z() << ", " << currentState.position().phi() << ")";
116  propagateForward(currentState,step_);
117  if (! currentState.isValid() ) {
118  LogTrace("TrackAssociator") << "Failed to propagate the track; moving on\n";
119  break;
120  }
121  LogTrace("TrackAssociator") << "\treached (rho, r, z, phi) (" <<
122  currentState.position().perp() << ", " << currentState.position().mag() << ", " <<
123  currentState.position().z() << ", " << currentState.position().phi() << ")";
124  fullTrajectory_.push_back(currentState);
125  }
126 
127 
128  SteppingHelixStateInfo currentState2(initialState);
129  SteppingHelixStateInfo previousState;
130  while (currentState2.position().perp()>minRho_ || fabs(currentState2.position().z())>minZ_) {
131  previousState=currentState2;
132  propagateForward(currentState2,-step_);
133  if (! currentState2.isValid() ) {
134  LogTrace("TrackAssociator") << "Failed to propagate the track; moving on\n";
135  break;
136  }
137  if(previousState.position().perp()- currentState2.position().perp() < 0) {
138  LogTrace("TrackAssociator") << "Error: TrackAssociator has propogated the particle past the point of closest approach to IP" << std::endl;
139  break;
140  }
141  LogTrace("TrackAssociator") << "[propagateAll] Propagated inward from (rho, r, z, phi) (" <<
142  previousState.position().perp() << ", " << previousState.position().mag() << ", " <<
143  previousState.position().z() << "," << previousState.position().phi() << ") to (" <<
144  currentState2.position().perp() << ", " << currentState2.position().mag() << ", " <<
145  currentState2.position().z() << ", " << currentState2.position().phi() << ")";
146  fullTrajectory_.push_front(currentState2);
147  }
148 
149 
150 
151 
152  // LogTrace("TrackAssociator") << "fullTrajectory_ has " << fullTrajectory_.size() << " states with (R, z):\n";
153  // for(unsigned int i=0; i<fullTrajectory_.size(); i++) {
154  // LogTrace("TrackAssociator") << "state " << i << ": (" << fullTrajectory_[i].position().perp() << ", "
155  // << fullTrajectory_[i].position().z() << ")\n";
156  // }
157 
158 
159 
160 
161 
162  LogTrace("TrackAssociator") << "Done with the track propagation in the detector. Number of steps: " << fullTrajectory_.size();
163  fullTrajectoryFilled_ = true;
164  return ! fullTrajectory_.empty();
165 }
166 
168 {
169  // TimerStack timers(TimerStack::Disableable);
170  // timers.benchmark("CachedTrajectory::propagate::benchmark");
171  // timers.push("CachedTrajectory::propagate",TimerStack::FastMonitoring);
172  // timers.push("CachedTrajectory::propagate::findClosestPoint",TimerStack::FastMonitoring);
173 
174  // Assume that all points along the trajectory are equally spread out.
175  // For simplication assume that the trajectory is just a straight
176  // line and find a point closest to the target plane. Propagate to
177  // the plane from the point.
178 
179  const float matchingDistance = 1;
180  // find the closest point to the plane
181  int leftIndex = 0;
182  int rightIndex = fullTrajectory_.size()-1;
183  int closestPointOnLeft = 0;
184 
185  // check whether the trajectory crossed the plane (signs should be different)
186  if ( sign( distance(plane, leftIndex) ) * sign( distance(plane, rightIndex) ) != -1 ) {
187  LogTrace("TrackAssociator") << "Track didn't cross the plane:\n\tleft distance: "<<distance(plane, leftIndex)
188  <<"\n\tright distance: " << distance(plane, rightIndex);
189  return TrajectoryStateOnSurface();
190  }
191 
192  while (leftIndex + 1 < rightIndex) {
193  closestPointOnLeft = int((leftIndex+rightIndex)/2);
194  float dist = distance(plane,closestPointOnLeft);
195  // LogTrace("TrackAssociator") << "Closest point on left: " << closestPointOnLeft << "\n"
196  // << "Distance to the plane: " << dist;
197  if (fabs(dist)<matchingDistance) {
198  // found close match, verify that we are on the left side
199  if (closestPointOnLeft>0 && sign( distance(plane, closestPointOnLeft-1) ) * dist == -1)
200  closestPointOnLeft--;
201  break;
202  }
203 
204  // check where is the plane
205  if (sign( distance(plane, leftIndex) * dist ) == -1)
206  rightIndex = closestPointOnLeft;
207  else
208  leftIndex = closestPointOnLeft;
209 
210  // LogTrace("TrackAssociator") << "Distance on left: " << distance(plane, leftIndex) << "\n"
211  // << "Distance to closest point: " << distance(plane, closestPointOnLeft) << "\n"
212  // << "Left index: " << leftIndex << "\n"
213  // << "Right index: " << rightIndex;
214 
215  }
216  LogTrace("TrackAssociator") << "closestPointOnLeft: " << closestPointOnLeft
217  << "\n\ttrajectory point (z,R,eta,phi): "
218  << fullTrajectory_[closestPointOnLeft].position().z() << ", "
219  << fullTrajectory_[closestPointOnLeft].position().perp() << " , "
220  << fullTrajectory_[closestPointOnLeft].position().eta() << " , "
221  << fullTrajectory_[closestPointOnLeft].position().phi()
222  << "\n\tplane center (z,R,eta,phi): "
223  << plane->position().z() << ", "
224  << plane->position().perp() << " , "
225  << plane->position().eta() << " , "
226  << plane->position().phi();
227 
228  // propagate to the plane
229  // timers.pop_and_push("CachedTrajectory::propagate::localPropagation",TimerStack::FastMonitoring);
230  if (const SteppingHelixPropagator* shp = dynamic_cast<const SteppingHelixPropagator*>(propagator_))
231  {
233  try {
234  state = shp->propagate(fullTrajectory_[closestPointOnLeft], *plane);
235  }
236  catch(cms::Exception &ex){
237  edm::LogWarning("TrackAssociator") <<
238  "Caught exception " << ex.category() << ": " << ex.explainSelf();
239  edm::LogWarning("TrackAssociator") << "An exception is caught during the track propagation\n"
240  << state.momentum().x() << ", " << state.momentum().y() << ", " << state.momentum().z();
241  return TrajectoryStateOnSurface();
242  }
243  return state.getStateOnSurface(*plane);
244  }
245  else
246  {
248  fullTrajectory_[closestPointOnLeft].getFreeState(fts);
249  return propagator_->propagate(fts, *plane);
250  }
251 }
252 
253 std::pair<float,float> CachedTrajectory::trajectoryDelta( TrajectorType trajectoryType )
254 {
255  // MEaning of trajectory change depends on its usage. In most cases we measure
256  // change in a trajectory as difference between final track position and initial
257  // direction. In some cases such as change of trajectory in the muon detector we
258  // might want to compare theta-phi of two points or even find local maximum and
259  // mimimum. In general it's not essential what defenition of the trajectory change
260  // is used since we use these numbers only as a rough estimate on how much wider
261  // we should make the preselection region.
262  std::pair<float,float> result(0,0);
263  if ( ! stateAtIP_.isValid() ) {
264  edm::LogWarning("TrackAssociator") << "State at IP is not known set. Cannot estimate trajectory change. " <<
265  "Trajectory change is not taken into account in matching";
266  return result;
267  }
268  switch (trajectoryType) {
269  case IpToEcal:
270  if ( ecalTrajectory_.empty() )
271  edm::LogWarning("TrackAssociator") << "ECAL trajector is empty. Cannot estimate trajectory change. " <<
272  "Trajectory change is not taken into account in matching";
273  else return delta( stateAtIP_.momentum().theta(), ecalTrajectory_.front().position().theta(),
274  stateAtIP_.momentum().phi(), ecalTrajectory_.front().position().phi() );
275  break;
276  case IpToHcal:
277  if ( hcalTrajectory_.empty() )
278  edm::LogWarning("TrackAssociator") << "HCAL trajector is empty. Cannot estimate trajectory change. " <<
279  "Trajectory change is not taken into account in matching";
280  else return delta( stateAtIP_.momentum().theta(), hcalTrajectory_.front().position().theta(),
281  stateAtIP_.momentum().phi(), hcalTrajectory_.front().position().phi() );
282  break;
283  case IpToHO:
284  if ( hoTrajectory_.empty() )
285  edm::LogWarning("TrackAssociator") << "HO trajector is empty. Cannot estimate trajectory change. " <<
286  "Trajectory change is not taken into account in matching";
287  else return delta( stateAtIP_.momentum().theta(), hoTrajectory_.front().position().theta(),
288  stateAtIP_.momentum().phi(), hoTrajectory_.front().position().phi() );
289  break;
290  case FullTrajectory:
291  if ( fullTrajectory_.empty() )
292  edm::LogWarning("TrackAssociator") << "Full trajector is empty. Cannot estimate trajectory change. " <<
293  "Trajectory change is not taken into account in matching";
294  else return delta( stateAtIP_.momentum().theta(), fullTrajectory_.back().position().theta(),
295  stateAtIP_.momentum().phi(), fullTrajectory_.back().position().phi() );
296  break;
297  default:
298  edm::LogWarning("TrackAssociator") << "Unkown or not supported trajector type. Cannot estimate trajectory change. " <<
299  "Trajectory change is not taken into account in matching";
300  }
301  return result;
302 }
303 
304 std::pair<float,float> CachedTrajectory::delta(const double& theta1,
305  const double& theta2,
306  const double& phi1,
307  const double& phi2)
308 {
309  std::pair<float,float> result(theta2 - theta1, phi2 - phi1 );
310  // this won't work for loopers, since deltaPhi cannot be larger than Pi.
311  if ( fabs(result.second) > 2*M_PI-fabs(result.second) ) {
312  if (result.second>0)
313  result.second -= 2*M_PI;
314  else
315  result.second += 2*M_PI;
316  }
317  return result;
318 }
319 
320 void CachedTrajectory::getTrajectory(std::vector<SteppingHelixStateInfo>& trajectory,
321  const FiducialVolume& volume,
322  int steps)
323 {
324  if ( ! fullTrajectoryFilled_ ) throw cms::Exception("FatalError") << "trajectory is not defined yet. Please use propagateAll first.";
325  if ( fullTrajectory_.empty() ) {
326  LogTrace("TrackAssociator") << "Trajectory is empty. Move on";
327  return;
328  }
329  if ( ! volume.isValid() ) {
330  LogTrace("TrackAssociator") << "no trajectory is expected to be found since the fiducial volume is not valid";
331  return;
332  }
333  double step = std::max(volume.maxR()-volume.minR(),volume.maxZ()-volume.minZ())/steps;
334 
335  int closestPointOnLeft = -1;
336 
337  // check whether the trajectory crossed the region
338  if ( !
339  ( ( fullTrajectory_.front().position().perp() < volume.maxR() && fabs(fullTrajectory_.front().position().z()) < volume.maxZ() ) &&
340  ( fullTrajectory_.back().position().perp() > volume.minR() || fabs(fullTrajectory_.back().position().z()) > volume.minZ() ) ))
341  {
342  LogTrace("TrackAssociator") << "Track didn't cross the region (R1,R2,L1,L2): " << volume.minR() << ", " << volume.maxR() <<
343  ", " << volume.minZ() << ", " << volume.maxZ();
344  return;
345  }
346 
347  // get distance along momentum to the surface.
348 
349  // the following code can be made faster, but it'll hardly be a significant improvement
350  // simplifications:
351  // 1) direct loop over stored trajectory points instead of some sort
352  // of fast root search (Newton method)
353  // 2) propagate from the closest point outside the region with the
354  // requested step ignoring stored trajectory points.
355  double dZ(-1.);
356  double dR(-1.);
357  int firstPointInside(-1);
358  for(unsigned int i=0; i<fullTrajectory_.size(); i++) {
359  // LogTrace("TrackAssociator") << "Trajectory info (i,perp,r1,r2,z,z1,z2): " << i << ", " << fullTrajectory_[i].position().perp() <<
360  // ", " << volume.minR() << ", " << volume.maxR() << ", " << fullTrajectory_[i].position().z() << ", " << volume.minZ() << ", " <<
361  // volume.maxZ() << ", " << closestPointOnLeft;
362  dR = fullTrajectory_[i].position().perp()-volume.minR();
363  dZ = fabs(fullTrajectory_[i].position().z()) - volume.minZ();
364  if ( dR> 0 || dZ >0 )
365  {
366  if (i>0) {
367  firstPointInside = i;
368  closestPointOnLeft = i - 1;
369  } else {
370  firstPointInside = 0;
371  closestPointOnLeft = 0;
372  }
373  break;
374  }
375  }
376  if (closestPointOnLeft == -1) throw cms::Exception("FatalError") << "This shouls never happen - internal logic error";
377 
378  SteppingHelixStateInfo currentState(fullTrajectory_[closestPointOnLeft]);
379  if ( currentState.position().x()*currentState.momentum().x() +
380  currentState.position().y()*currentState.momentum().y() +
381  currentState.position().z()*currentState.momentum().z() < 0 )
382  step = -step;
383 
384  // propagate to the inner surface of the active volume
385 
386  if (firstPointInside != closestPointOnLeft) {
387  if ( dR > 0 ) {
389  propagate(currentState, *barrel);
390  } else {
392  currentState.position().z()>0?volume.minZ():-volume.minZ()),
393  Plane::RotationType () );
394  propagate(currentState, *endcap);
395  }
396  if ( currentState.isValid() ) trajectory.push_back(currentState);
397  } else
398  LogTrace("TrackAssociator") << "Weird message\n";
399 
400  while (currentState.isValid() &&
401  currentState.position().perp() < volume.maxR() &&
402  fabs(currentState.position().z()) < volume.maxZ() )
403  {
404  propagateForward(currentState,step);
405  if (! currentState.isValid() ) {
406  LogTrace("TrackAssociator") << "Failed to propagate the track; moving on\n";
407  break;
408  }
409  // LogTrace("TrackAssociator") << "New state (perp, z): " << currentState.position().perp() << ", " << currentState.position().z();
410  //if ( ( currentState.position().perp() < volume.maxR() && fabs(currentState.position().z()) < volume.maxZ() ) &&
411  // ( currentState.position().perp()-volume.minR() > 0 || fabs(currentState.position().z()) - volume.minZ() >0 ) )
412  trajectory.push_back(currentState);
413  }
414 }
415 
417  fullTrajectory_.clear();
418  ecalTrajectory_.clear();
419  hcalTrajectory_.clear();
420  hoTrajectory_.clear();
421  preshowerTrajectory_.clear();
422  wideEcalTrajectory_.clear();
423  wideHcalTrajectory_.clear();
424  wideHOTrajectory_.clear();
425  fullTrajectoryFilled_ = false;
426 }
427 
429  LogTrace("TrackAssociator") << "getting trajectory in ECAL";
430  getTrajectory(ecalTrajectory_, volume, 4 );
431  LogTrace("TrackAssociator") << "# of points in ECAL trajectory:" << ecalTrajectory_.size();
432 }
433 
435  LogTrace("TrackAssociator") << "getting trajectory in Preshower";
436  getTrajectory(preshowerTrajectory_, volume, 2 );
437  LogTrace("TrackAssociator") << "# of points in Preshower trajectory:" << preshowerTrajectory_.size();
438 }
439 
440 const std::vector<SteppingHelixStateInfo>& CachedTrajectory::getEcalTrajectory() {
441  return ecalTrajectory_;
442 }
443 
444 const std::vector<SteppingHelixStateInfo>& CachedTrajectory::getPreshowerTrajectory() {
445  return preshowerTrajectory_;
446 }
447 
449  LogTrace("TrackAssociator") << "getting trajectory in HCAL";
450  getTrajectory(hcalTrajectory_, volume, 4 ); // more steps to account for different depth
451  LogTrace("TrackAssociator") << "# of points in HCAL trajectory:" << hcalTrajectory_.size();
452 }
453 
454 const std::vector<SteppingHelixStateInfo>& CachedTrajectory::getHcalTrajectory() {
455  return hcalTrajectory_;
456 }
457 
459  LogTrace("TrackAssociator") << "getting trajectory in HO";
460  getTrajectory(hoTrajectory_, volume, 2 );
461  LogTrace("TrackAssociator") << "# of points in HO trajectory:" << hoTrajectory_.size();
462 }
463 
464 const std::vector<SteppingHelixStateInfo>& CachedTrajectory::getHOTrajectory() {
465  return hoTrajectory_;
466 }
467 
468 std::vector<GlobalPoint>*
469 CachedTrajectory::getWideTrajectory(const std::vector<SteppingHelixStateInfo>& states,
470  WideTrajectoryType wideTrajectoryType) {
471  std::vector<GlobalPoint>* wideTrajectory = 0;
472  switch (wideTrajectoryType) {
473  case Ecal:
474  LogTrace("TrackAssociator") << "Filling ellipses in Ecal trajectory";
475  wideTrajectory = &wideEcalTrajectory_;
476  break;
477  case Hcal:
478  LogTrace("TrackAssociator") << "Filling ellipses in Hcal trajectory";
479  wideTrajectory = &wideHcalTrajectory_;
480  break;
481  case HO:
482  LogTrace("TrackAssociator") << "Filling ellipses in HO trajectory";
483  wideTrajectory = &wideHOTrajectory_;
484  break;
485  }
486  if(!wideTrajectory) return 0;
487 
488  for(std::vector<SteppingHelixStateInfo>::const_iterator state= states.begin();
489  state != states.end(); state++) {
490  // defined a normal plane wrt the particle trajectory direction
491  // let's hope that I computed the rotation matrix correctly.
492  GlobalVector vector(state->momentum().unit());
493  float r21 = 0;
494  float r22 = vector.z()/sqrt(1-pow(vector.x(),2));
495  float r23 = -vector.y()/sqrt(1-pow(vector.x(),2));
496  float r31 = vector.x();
497  float r32 = vector.y();
498  float r33 = vector.z();
499  float r11 = r22*r33-r23*r32;
500  float r12 = r23*r31;
501  float r13 = -r22*r31;
502 
503  Plane::RotationType rotation(r11, r12, r13,
504  r21, r22, r23,
505  r31, r32, r33);
506  Plane* target = new Plane(state->position(), rotation);
507 
508  TrajectoryStateOnSurface tsos = state->getStateOnSurface(*target);
509 
510  if (!tsos.isValid()) {
511  LogTrace("TrackAssociator") << "[getWideTrajectory] TSOS not valid";
512  continue;
513  }
514  if (!tsos.hasError()) {
515  LogTrace("TrackAssociator") << "[getWideTrajectory] TSOS does not have Errors";
516  continue;
517  }
518  LocalError localErr = tsos.localError().positionError();
519  localErr.scale(2); // get the 2 sigma ellipse
520  float xx = localErr.xx();
521  float xy = localErr.xy();
522  float yy = localErr.yy();
523 
524  float denom = yy - xx;
525  float phi = 0., phi_temp=0.;
526  if(xy == 0 && denom==0) phi = M_PI_4;
527  else phi = 0.5 * atan2(2.*xy,denom); // angle of MAJOR axis
528  phi_temp = phi;
529  // Unrotate the error ellipse to get the semimajor and minor axes. Then place points on
530  // the endpoints of semiminor an seminajor axes on original(rotated) error ellipse.
531  LocalError rotErr = localErr.rotate(-phi); // xy covariance of rotErr should be zero
532  float semi1 = sqrt(rotErr.xx());
533  float semi2 = sqrt(rotErr.yy());
534 
535  // Just use one point if the ellipse is small
536  // if(semi1 < 0.1 && semi2 < 0.1) {
537  // LogTrace("TrackAssociator") << "[getWideTrajectory] Error ellipse is small, using one trajectory point";
538  // wideTrajectory->push_back(state->position());
539  // continue;
540  // }
541 
542  Local2DPoint bounds[4];
543  bounds[0] = Local2DPoint(semi1*cos(phi), semi1*sin(phi));
544  bounds[1] = Local2DPoint(semi1*cos(phi+M_PI), semi1*sin(phi+M_PI));
545  phi += M_PI_2; // add pi/2 for the semi2 axis
546  bounds[2] = Local2DPoint(semi2*cos(phi), semi2*sin(phi));
547  bounds[3] = Local2DPoint(semi2*cos(phi+M_PI), semi2*sin(phi+M_PI));
548 
549  // LogTrace("TrackAssociator") << "Axes " << semi1 <<","<< semi2 <<" phi "<< phi;
550  // LogTrace("TrackAssociator") << "Local error ellipse: " << bounds[0] << bounds[1] << bounds[2] << bounds[3];
551 
552  wideTrajectory->push_back(state->position());
553  for(int index=0; index<4; ++index)
554  wideTrajectory->push_back(target->toGlobal(bounds[index]));
555 
556  //LogTrace("TrackAssociator") <<"Global error ellipse: (" << target->toGlobal(bounds[0]) <<","<< target->toGlobal(bounds[1])
557  // <<","<< target->toGlobal(bounds[2]) <<","<< target->toGlobal(bounds[3]) <<","<<state->position() <<")";
558  }
559 
560  return wideTrajectory;
561 }
562 
564 {
565  if ( ecalTrajectory_.empty() )
566  return SteppingHelixStateInfo();
567  else
568  return ecalTrajectory_.front();
569 }
570 
572 {
573  if ( preshowerTrajectory_.empty() )
574  return SteppingHelixStateInfo();
575  else
576  return preshowerTrajectory_.front();
577 }
578 
580 {
581  if ( hcalTrajectory_.empty() )
582  return SteppingHelixStateInfo();
583  else
584  return hcalTrajectory_.front();
585 }
586 
588 {
589  if ( hoTrajectory_.empty() )
590  return SteppingHelixStateInfo();
591  else
592  return hoTrajectory_.front();
593 }
594 
595 
597  if(fullTrajectory_.empty() )
598  return SteppingHelixStateInfo();
599  else
600  return fullTrajectory_.front();
601 }
602 
603 
605  if(fullTrajectory_.empty() )
606  return SteppingHelixStateInfo();
607  else
608  return fullTrajectory_.back();
609 }
610 
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:78
SteppingHelixStateInfo getStateAtHO()
const std::vector< SteppingHelixStateInfo > & getHcalTrajectory()
int i
Definition: DBlmapReader.cc:9
float xx() const
Definition: LocalError.h:19
bool isValid() const
check whether the volume is properly defined
T perp() const
Definition: PV3DBase.h:66
SteppingHelixStateInfo stateAtIP_
std::vector< SteppingHelixStateInfo > ecalTrajectory_
void findPreshowerTrajectory(const FiducialVolume &)
const Propagator * propagator_
void setMinDetectorLength(float l=0.)
virtual std::string explainSelf() const
Definition: Exception.cc:56
void getFreeState(FreeTrajectoryState &fts) const
convert internal structure into the fts
const std::vector< SteppingHelixStateInfo > & getEcalTrajectory()
void setMinDetectorRadius(float r=0.)
double maxZ(bool withTolerance=true) const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Phi< T > phi() const
Definition: PV3DBase.h:63
T y() const
Definition: PV3DBase.h:57
#define M_PI_2
static PlanePointer build(const PositionType &pos, const RotationType &rot, MediumProperties *mp=0)
Definition: Plane.h:25
void setPropagationStep(float s=20.)
void getTrajectory(std::vector< SteppingHelixStateInfo > &, const FiducialVolume &, int steps=4)
std::vector< GlobalPoint > wideHcalTrajectory_
void findHcalTrajectory(const FiducialVolume &)
double minZ(bool withTolerance=true) const
GlobalVector momentum() const
Definition: Plane.h:17
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
std::vector< GlobalPoint > wideEcalTrajectory_
Geom::Theta< T > theta() const
Definition: PV3DBase.h:69
SteppingHelixStateInfo getStateAtPreshower()
std::vector< SteppingHelixStateInfo > hoTrajectory_
std::vector< GlobalPoint > wideHOTrajectory_
float xy() const
Definition: LocalError.h:20
T mag() const
Definition: PV3DBase.h:61
bool propagateAll(const SteppingHelixStateInfo &initialState)
propagate through the whole detector, returns true if successful
Definition: DDAxes.h:10
FreeTrajectoryState * freeState(bool withErrors=true) const
float yy() const
Definition: LocalError.h:21
const T & max(const T &a, const T &b)
GlobalPoint position() const
TrajectoryStateOnSurface getStateOnSurface(const Surface &surf, bool returnTangentPlane=false) const
T sqrt(T t)
Definition: SSEVec.h:28
float distance(const Plane *plane, int index)
T z() const
Definition: PV3DBase.h:58
tuple result
Definition: query.py:137
SteppingHelixStateInfo getInnerState()
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
std::pair< float, float > trajectoryDelta(TrajectorType)
std::vector< SteppingHelixStateInfo > preshowerTrajectory_
std::vector< GlobalPoint > * getWideTrajectory(const std::vector< SteppingHelixStateInfo > &, WideTrajectoryType)
#define LogTrace(id)
SteppingHelixStateInfo getOuterState()
virtual TrajectoryStateOnSurface propagate(const FreeTrajectoryState &, const Surface &) const
Definition: Propagator.cc:9
double minR(bool withTolerance=true) const
Vector3DBase unit() const
Definition: Vector3DBase.h:57
#define M_PI
Definition: BFit3D.cc:3
std::pair< float, float > delta(const double &theta1, const double &theta2, const double &phi1, const double &phi2)
void propagate(SteppingHelixStateInfo &state, const Plane &plane)
std::deque< SteppingHelixStateInfo > fullTrajectory_
void findEcalTrajectory(const FiducialVolume &)
static CylinderPointer build(const PositionType &pos, const RotationType &rot, Scalar radius, MediumProperties *mp=0)
Definition: Cylinder.h:29
const std::vector< SteppingHelixStateInfo > & getHOTrajectory()
char state
Definition: procUtils.cc:75
T eta() const
Definition: PV3DBase.h:70
SteppingHelixStateInfo getStateAtEcal()
void findHOTrajectory(const FiducialVolume &)
Point2DBase< float, LocalTag > Local2DPoint
Definition: LocalPoint.h:8
const std::vector< SteppingHelixStateInfo > & getPreshowerTrajectory()
void propagateForward(SteppingHelixStateInfo &state, float distance)
LocalError rotate(float x, float y) const
Return a new LocalError, rotated by an angle defined by the direction (x,y)
Definition: LocalError.h:34
T x() const
Definition: PV3DBase.h:56
const PositionType & position() const
static int sign(float number)
void setMaxDetectorLength(float l=2200.)
double maxR(bool withTolerance=true) const
SteppingHelixStateInfo getStateAtHcal()
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
std::vector< SteppingHelixStateInfo > hcalTrajectory_
Basic2DVector< T > xy() const
void setMaxDetectorRadius(float r=800.)
LocalError scale(float s) const
Definition: LocalError.h:28
Definition: DDAxes.h:10
std::string category() const
Definition: Exception.cc:74