HighLAND
HighlandConstituentsUtils.cxx
1 #include "HighlandAnalysisUtils.hxx"
2 #include <stdio.h>
3 #include <math.h>
4 
5 
6 //**************************************************
8 //**************************************************
9 
10  int count = 0;
11  for (unsigned int it = 0; it < bunch.Particles.size(); it++) {
12  AnaTrackB* track = static_cast<AnaTrackB*>(bunch.Particles[it]);
13  if (anaUtils::TrackUsesDet(*track, det)) {
14  selTracks[count] = track;
15  count++;
16  }
17  }
18 
19  return count;
20 }
21 
22 
23 //**************************************************
25 //**************************************************
26 
27  int count = 0;
28 
29  for (unsigned int it = 0; it < bunch.Particles.size(); it++) {
30  AnaTrackB* track = static_cast<AnaTrackB*>(bunch.Particles[it]);
31  if (anaUtils::TrackUsesOnlyDet(*track, det)) {
32  selTracks[count] = track;
33  ++count;
34  }
35  }
36 
37  return count;
38 }
39 
40 
41 //**************************************************
43 //**************************************************
44 
45  int count = 0;
46  for (unsigned int it = 0; it < bunch.Particles.size(); it++) {
47  AnaTrackB* track = static_cast<AnaTrackB*>(bunch.Particles[it]);
48  if (!anaUtils::TrackUsesDet(*track, SubDetId::kTPC) && anaUtils::TrackUsesDet(*track, SubDetId::kFGD)) {
49  selTracks[count] = track;
50  ++count;
51  }
52  }
53 
54  // Sort by decreasing number of hits
55  std::sort(&selTracks[0], &selTracks[count], AnaParticleB::CompareNHits);
56 
57  return count;
58 }
59 
60 
61 //**************************************************
62 int anaUtils::GetAllTracksUsingFGDorTPC(const AnaBunchB& bunch, AnaTrackB* selTracks[]) {
63 //**************************************************
64 
65  int count = 0;
66  for (unsigned int it = 0; it < bunch.Particles.size(); it++) {
67  AnaTrackB* track = static_cast<AnaTrackB*>(bunch.Particles[it]);
68  if ( ! (anaUtils::TrackUsesDet(*track, SubDetId::kTPC) || anaUtils::TrackUsesDet(*track, SubDetId::kFGD))) {
69  selTracks[count] = track;
70  ++count;
71  }
72  }
73 
74  return count;
75 }
76 
77 
78 
int GetAllTracksUsingOnlyDet(const AnaBunchB &bunch, SubDetId::SubDetEnum det, AnaTrackB *selTracks[])
static bool CompareNHits(const AnaParticleB *t1, const AnaParticleB *t2)
Compare the NHits of two particles. Return whether t1 is higher NHts than t2.
bool TrackUsesDet(const AnaTrackB &track, SubDetId::SubDetEnum det)
int GetAllTracksUsingFGDorTPC(const AnaBunchB &bunch, AnaTrackB *selTracks[])
SubDetEnum
Enumeration of all detector systems and subdetectors.
Definition: SubDetId.hxx:25
int GetAllTracksUsingFGDAndNoTPC(const AnaBunchB &bunch, AnaTrackB *selTracks[])
Representation of a global track.
std::vector< AnaParticleB * > Particles
int GetAllTracksUsingDet(const AnaBunchB &bunch, SubDetId::SubDetEnum det, AnaTrackB *selTracks[])
bool TrackUsesOnlyDet(const AnaTrackB &track, SubDetId::SubDetEnum det)