All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
PfoUtilities.h
Go to the documentation of this file.
1 #ifndef PFOUTILITIES_H
2 #define PFOUTILITIES_H 1
3 
4 #include <EVENT/LCObject.h>
5 #include <EVENT/ReconstructedParticle.h>
6 #include "TrackHitPair.h"
7 
8 #include <algorithm>
9 #include <map>
10 #include <set>
11 #include <string>
12 #include "HelixClass.h"
13 #include "TrackHitPair.h"
14 #include "lcio.h"
15 
16 #include <marlinutil/GeometryUtil.h>
17 #include <vector>
18 
19 using namespace std;
20 
21 #define FORMATTED_OUTPUT_TRACK_CLUSTER_full(out, N1, E1, E2, E3, N2, E4, N3, E5, E6, E7) \
22  out << std::right << std::setw(widthInt) << N1 << std::right << std::setw(widthFloat) << E1 << std::right \
23  << std::setw(widthFloat) << E2 << std::right << std::setw(widthFloat) << E3 << std::right << std::setw(widthInt) \
24  << N2 << std::right << std::setw(widthFloat) << E4 << std::right << std::setw(widthInt) << N3 << std::right \
25  << std::setw(widthFloat) << E5 << std::right << std::setw(widthFloat) << E6 << std::right << std::setw(widthFloat) \
26  << E7 << std::endl
27 
28 #define FORMATTED_OUTPUT_TRACK_CLUSTER(out, N1, E1, E2, E3, N2, N3) \
29  out << std::right << std::setw(widthInt) << N1 << std::right << std::setw(widthFloat) << E1 << std::right \
30  << std::setw(widthFloat) << E2 << std::right << std::setw(widthFloat) << E3 << std::right << std::setw(widthSmallInt) \
31  << N2 << std::right << std::setw(widthSmallInt) << N3 << std::endl
32 
33 #define FORMATTED_OUTPUT_TRACK(out, N1, E1, E2, E3, N2, N3) \
34  out << std::right << std::setw(widthInt) << N1 << std::right << std::setw(widthFloat) << E1 << std::right \
35  << std::setw(widthFloat) << E2 << std::right << std::setw(widthFloat) << E3 << std::right << std::setw(widthSmallInt) \
36  << N2 << std::right << std::setw(widthSmallInt) << N3 << std::endl
37 
38 #define FORMATTED_OUTPUT_CLUSTER(out, N1, E1, E2, E3, N2, N3) \
39  out << std::right << std::setw(widthInt) << N1 << std::right << std::setw(widthFloat) << E1 << std::right \
40  << std::setw(widthFloat) << E2 << std::right << std::setw(widthFloat) << E3 << std::right << std::setw(widthSmallInt) \
41  << N2 << std::right << std::setw(widthSmallInt) << N3 << std::endl
42 
43 #define FORMATTED_OUTPUT_MC(out, N1, E1) \
44  out << std::right << std::setw(widthInt) << N1 << std::right << std::setw(widthFloat) << E1 << std::endl
45 
46 namespace PfoUtil {
47 
48  typedef std::vector<EVENT::ReconstructedParticle*> PfoList;
49 
50  static bool PfoSortFunction(EVENT::ReconstructedParticle* lhs, EVENT::ReconstructedParticle* rhs) {
51  // true if lhs goes before
52 
53  const float lhs_energy = lhs->getEnergy();
54  const float rhs_energy = rhs->getEnergy();
55  const EVENT::ClusterVec lhs_clusters = lhs->getClusters();
56  const EVENT::TrackVec lhs_tracks = lhs->getTracks();
57  const EVENT::TrackVec rhs_tracks = rhs->getTracks();
58  const EVENT::ClusterVec rhs_clusters = rhs->getClusters();
59  const int lhs_particleType = abs(lhs->getType());
60  const int rhs_particleType = abs(rhs->getType());
61 
62  int lhs_type(0);
63  int rhs_type(0);
64 
65  if (lhs_clusters.size() == 0)
66  lhs_type = 1;
67  if (rhs_clusters.size() == 0)
68  rhs_type = 1;
69  if (lhs_particleType == 22)
70  lhs_type = 10;
71  if (rhs_particleType == 22)
72  rhs_type = 10;
73  if (lhs_particleType == 2112)
74  lhs_type = 20;
75  if (rhs_particleType == 2112)
76  rhs_type = 20;
77 
78  if (lhs_type == rhs_type)
79  return (lhs_energy > rhs_energy);
80  return (lhs_type < rhs_type);
81  }
82 
83  float TimeAtEcal(const Track* pTrack, float& tof);
84 
85  // Calculate cluster times
86  void GetClusterTimes(const Cluster* cluster, float& meanTime, int& nCaloHitsUsed, float& meanTimeEcal, int& nEcal,
87  float& meanTimeHcalEndcap, int& nHcalEnd, bool correctHitTimesForTimeOfFlight);
88 
89 } //namespace
90 
91 #endif // PFOUTILITIES_H
float TimeAtEcal(const Track *pTrack, float &tof)
Definition: PfoUtilities.cc:19
std::vector< EVENT::ReconstructedParticle * > PfoList
Definition: PfoUtilities.h:48
static bool PfoSortFunction(EVENT::ReconstructedParticle *lhs, EVENT::ReconstructedParticle *rhs)
Definition: PfoUtilities.h:50
void GetClusterTimes(const Cluster *cluster, float &meanTime, int &nCaloHitsUsed, float &meanTimeEcal, int &nEcal, float &meanTimeHcalEndcap, int &nHcalEnd, bool correctHitTimesForTimeOfFlight)
Definition: PfoUtilities.cc:49