CbmRoot
LxTrigger.cxx
Go to the documentation of this file.
1 #include "Lx.h"
2 #include "TDatabasePDG.h"
3 
4 using namespace std;
5 
7  bool trigging = false;
8 
9  for (list<LxTrack*>::iterator i = caSpace.tracks.begin();
10  i != caSpace.tracks.end();
11  ++i) {
12  LxTrack* first = *i;
13 
14  if (first->clone) continue;
15 
16  list<LxTrack*>::iterator j = i;
17  ++j;
18 
19  for (; j != caSpace.tracks.end(); ++j) {
20  LxTrack* second = *j;
21 
22  if (second->clone) continue;
23 
24  LxRay* firstRay = first->rays[0];
25  LxPoint* firstPoint = firstRay->end;
26  LxRay* secondRay = second->rays[0];
27  LxPoint* secondPoint = secondRay->end;
28 
29  scaltype firstParticleCharge =
30  firstRay->tx - firstPoint->x / firstPoint->z;
31  scaltype secondParticleCharge =
32  secondRay->tx - secondPoint->x / secondPoint->z;
33  bool distanceOk = true;
34 
35  if (pPtCut) {
36  scaltype deltaX = firstPoint->x - secondPoint->x;
37  scaltype deltaY = firstPoint->y - secondPoint->y;
38  scaltype distance = sqrt(deltaX * deltaX + deltaY * deltaY);
39  distanceOk = distance >= 50.0;
40  }
41 
42  first->distanceOk = first->distanceOk || distanceOk;
43  second->distanceOk = second->distanceOk || distanceOk;
44  bool oppCharged = firstParticleCharge * secondParticleCharge < 0;
45  first->oppCharged = first->oppCharged || oppCharged;
46  second->oppCharged = second->oppCharged || oppCharged;
47  bool triggering = distanceOk && oppCharged;
48  first->triggering = first->triggering || triggering;
49  second->triggering = second->triggering || triggering;
50  trigging = trigging || triggering;
51  }
52  }
53 
54 #ifdef MAKE_TRIGGERING_HISTOS
55  for (list<LxTrack*>::iterator i = caSpace.tracks.begin();
56  i != caSpace.tracks.end();
57  ++i) {
58  LxTrack* recoTrack = *i;
59 
60  if (recoTrack->clone) continue;
61 
62  LxMCTrack* mcTrack = recoTrack->mcTrack;
63  string particleName(
64  mcTrack ? TDatabasePDG::Instance()->GetParticle(mcTrack->pdg)->GetName()
65  : "ghost");
66 
67  if (!particleName.empty()
68  && (particleName.back() == '+' || particleName.back() == '-'))
69  particleName.pop_back();
70 
71  map<string, unsigned int>::iterator j =
72  particlesCountAll.find(particleName);
73 
74  if (j != particlesCountAll.end())
75  ++(j->second);
76  else
77  particlesCountAll[particleName] = 1;
78 
79  if (recoTrack->distanceOk) {
80  j = particlesCountDist.find(particleName);
81 
82  if (j != particlesCountDist.end())
83  ++(j->second);
84  else
85  particlesCountDist[particleName] = 1;
86  }
87 
88  if (recoTrack->oppCharged) {
89  j = particlesCountSign.find(particleName);
90 
91  if (j != particlesCountSign.end())
92  ++(j->second);
93  else
94  particlesCountSign[particleName] = 1;
95  }
96 
97  if (recoTrack->triggering) {
98  j = particlesCountTrig.find(particleName);
99 
100  if (j != particlesCountTrig.end())
101  ++(j->second);
102  else
103  particlesCountTrig[particleName] = 1;
104  }
105 
106  if (0 == mcTrack) continue;
107 
108  if (13 != mcTrack->pdg && -13 != mcTrack->pdg) continue;
109 
110  triggeringAllTracksVertices->Fill(
111  mcTrack->z); // Save arbitrary track info.
112 
113  if (recoTrack->distanceOk)
114  triggeringDistTracksVertices->Fill(
115  mcTrack->z); // Save track fulfilling distance criterion info.
116 
117  if (recoTrack->oppCharged)
118  triggeringSignTracksVertices->Fill(
119  mcTrack->z); // Save track fulfilling signs criterion info.
120 
121  if (recoTrack->triggering)
122  triggeringTrigTracksVertices->Fill(
123  mcTrack
124  ->z); // Save track fulfilling the both criteria above (triggering track) info.
125  }
126 #endif //MAKE_TRIGGERING_HISTOS
127 
128  return trigging;
129 }
LxTrack
Definition: LxCA.h:268
scaltype
#define scaltype
Definition: CbmGlobalTrackingDefs.h:17
LxMCTrack::pdg
Int_t pdg
Definition: Simple/LxMC.h:30
sqrt
friend F32vec4 sqrt(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:41
LxSpace::tracks
std::list< LxTrack * > tracks
Definition: LxCA.h:326
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
LxFinder::Trigger
bool Trigger()
Definition: LxTrigger.cxx:6
LxTrack::rays
LxRay * rays[LXSTATIONS - 1]
Definition: LxCA.h:281
caSpace
LxSpace caSpace
Definition: riplet/Lx.cxx:72
LxPoint::y
scaltype y
Definition: LxCA.h:53
LxPoint
Definition: LxCA.h:52
LxRay::tx
scaltype tx
Definition: LxCA.h:116
LxPoint::z
scaltype z
Definition: LxCA.h:53
Lx.h
LxTrack::mcTrack
LxMCTrack * mcTrack
Definition: LxCA.h:276
first
bool first
Definition: LKFMinuit.cxx:143
LxMCTrack::z
scaltype z
Definition: Simple/LxMC.h:28
LxTrack::triggering
bool triggering
Definition: LxCA.h:296
LxRay::end
LxPoint * end
Definition: LxCA.h:119
LxTrack::clone
bool clone
Definition: LxCA.h:292
pPtCut
bool pPtCut
Definition: riplet/Lx.cxx:61
LxTrack::distanceOk
bool distanceOk
Definition: LxCA.h:294
LxMCTrack
Definition: Simple/LxMC.h:27
LxTrack::oppCharged
bool oppCharged
Definition: LxCA.h:295
LxPoint::x
scaltype x
Definition: LxCA.h:53
LxRay
Definition: LxCA.h:115