simple-tof-analysis
 All Classes Namespaces Functions Variables Groups Pages
FillHistograms.h
1 
2 
3 //__________________________________________________________________________________________________________________________
4 void FillSimHistograms(const evt::sim::VertexTrack& simTrack,
5  const std::vector<int>& vParticleETypes,
6  const std::vector<double>& vParticleMass,
7  const TVector3& boost_cms,
8  std::vector<TH2D*> vHist2D,
9  std::vector<double>& vParticleCounters,
10  const double& weight = 1)
11 {
12  const double px = simTrack.GetMomentum().GetX();
13  const double py = simTrack.GetMomentum().GetY();
14  const double pz = simTrack.GetMomentum().GetZ();
15  const double p = simTrack.GetMomentum().GetMag();
16 
17  for (int ip = 0; ip < int(vParticleETypes.size()); ip++)
18  {
19  if (simTrack.GetParticleId() == vParticleETypes[ip]) //eDeuteron, eProton etc; from utl::ParticleConst
20  {
21  TLorentzVector tv; //four momentum of particle in LAB frame of colliding p+p
22  tv.SetPxPyPzE(px, py, pz, sqrt(p*p + vParticleMass[ip]*vParticleMass[ip]));
23 
25  tv.Boost(-boost_cms);
26  vHist2D[ip]->Fill(tv.Rapidity(), tv.Pt(), weight);
27 
28 
30  if (simTrack.GetParticleId() == ParticleConst::eDeuteron)
31  {
32  if (tv.Rapidity() < -0.4 && tv.Rapidity() > -1.2 && tv.Pt() < 0.8)
33  vParticleCounters[ip] = vParticleCounters[ip] + weight;
34  }
35  else if (simTrack.GetParticleId() == ParticleConst::eProton)
36  {
37  if(tv.Rapidity() < 0.2 && tv.Rapidity() > -0.6 && tv.Pt() < 1.0)
38  vParticleCounters[ip] = vParticleCounters[ip] + weight;
39  }
40  else
41  vParticleCounters[ip] = vParticleCounters[ip] + weight;
42 
43 
44  break;
45  }
46  }
47 }
48 
49 
50 
51 
52 //__________________________________________________________________________________________________________________________
53 void FillRecHistograms(const evt::sim::VertexTrack& simTrack,
54  const evt::rec::VertexTrack& recTrack,
55  const std::vector<int>& vParticleETypes,
56  const std::vector<double>& vParticleMass,
57  const TVector3& boost_cms,
58  std::vector<TH2D*> vHist2D,
59  std::vector<double>& vParticleCounters,
60  const double& weight = 1)
61 {
62  const double px = recTrack.GetMomentum().GetX();
63  const double py = recTrack.GetMomentum().GetY();
64  const double pz = recTrack.GetMomentum().GetZ();
65  const double p = recTrack.GetMomentum().GetMag();
66 
67  for (int ip = 0; ip < int(vParticleETypes.size()); ip++)
68  {
69  if (simTrack.GetParticleId() == vParticleETypes[ip]) //eDeuteron, eProton etc; from utl::ParticleConst
70  {
71  TLorentzVector tv; //four momentum of particle in LAB frame of colliding p+p
72  tv.SetPxPyPzE(px, py, pz, sqrt(p*p + vParticleMass[ip]*vParticleMass[ip]));
73 
75  tv.Boost(-boost_cms);
76  vHist2D[ip]->Fill(tv.Rapidity(), tv.Pt(), weight);
77 
78 
80  if (simTrack.GetParticleId() == ParticleConst::eDeuteron)
81  {
82  if (tv.Rapidity() < -0.4 && tv.Rapidity() > -1.2 && tv.Pt() < 0.8)
83  vParticleCounters[ip] = vParticleCounters[ip] + weight;
84  }
85 
86  else if (simTrack.GetParticleId() == ParticleConst::eProton)
87  {
88  if(tv.Rapidity() < 0.2 && tv.Rapidity() > -0.6 && tv.Pt() < 1.0)
89  vParticleCounters[ip] = vParticleCounters[ip] + weight;
90  }
91 
92  else
93  vParticleCounters[ip] = vParticleCounters[ip] + weight;
94 
95 
96  break;
97  }
98  }
99 }