ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Tools.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Tools.cc
1 
7 //GenFit
8 #include <GenFit/RKTrackRep.h>
9 #include <GenFit/AbsTrackRep.h> // for AbsTrackRep
10 #include <GenFit/Exception.h> // for Exception
11 #include <GenFit/MeasuredStateOnPlane.h> // for MeasuredStateOnPlane
12 
13 
14 #include <TVector3.h> // for TVector3
15 
16 //STL
17 #include <cassert> // for assert
18 #include <iostream> // for operator<<, basic_ostream
19 #include <limits>
20 
21 #define LogDebug(exp) std::cout << "DEBUG: " << __FILE__ << ": " << __LINE__ << ": " << exp << std::endl
22 #define LogError(exp) std::cout << "ERROR: " << __FILE__ << ": " << __LINE__ << ": " << exp << std::endl
23 #define LogWarning(exp) std::cout << "WARNING: " << __FILE__ << ": " << __LINE__ << ": " << exp << std::endl
24 
25 //#define _DEBUG_
26 
27 namespace PHGenFit
28 {
30  genfit::MeasuredStateOnPlane* state,
31  double radius, TVector3 line_point, TVector3 line_direction,
32  const int pdg_code, const int direction,
33  const int verbosity)
34 {
35  assert(direction == 1 or direction == -1);
36 
37  assert(state);
38 
39  double pathlenth = std::numeric_limits<double>::quiet_NaN();
40 
41  genfit::AbsTrackRep* rep = new genfit::RKTrackRep(pdg_code);
42  assert(rep);
43 
44  state->setRep(rep);
45 
46  try
47  {
48  pathlenth = rep->extrapolateToCylinder(*state, radius, line_point, line_direction);
49  }
50  catch (genfit::Exception& e)
51  {
52  if (verbosity > 1)
53  {
54  LogWarning("Can't extrapolate track!");
55  std::cerr << e.what();
56  }
57  return pathlenth;
58  }
59 
60  return pathlenth;
61 }
62 
63 } // namespace PHGenFit