All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CosmicHisto.cc
Go to the documentation of this file.
1 #include "CosmicHisto.h"
2 
3 #include "TH1D.h"
4 #include "TH2D.h"
5 
6 namespace ana {
7  namespace SBNOsc {
8 
9 void CosmicHistos::Initialize(const std::string &postfix, const geo::BoxBoundedGeo &detector_volume) {
10 #define COSMIC_HISTO(name, n_bins, lo, hi) name = new TH1D((#name + postfix).c_str(), #name, n_bins, lo, hi); StoreHisto(name)
11 
12  COSMIC_HISTO(enter_time, 600, -3000., 3000.);
13  COSMIC_HISTO(enter_time_zoom, 300, -20., 10.);
14  COSMIC_HISTO(enter_x, 400, detector_volume.MinX(), detector_volume.MaxX());
15  COSMIC_HISTO(enter_y, 400, detector_volume.MinY(), detector_volume.MaxY());
16  COSMIC_HISTO(enter_z, 500, detector_volume.MinZ(), detector_volume.MaxZ());
17  COSMIC_HISTO(momentum, 100, 0., 5.);
18 
19 #undef COSMIC_HISTO
20 }
21 
22 void CosmicHistos::Fill(const std::map<size_t, numu::TrueParticle> &true_particles) {
23  for (const auto &pair: true_particles) {
24  const numu::TrueParticle &particle = pair.second;
25  // only plot cosmic muons
26  if (particle.is_cosmic && abs(particle.pdgid) == 13) {
27  enter_time->Fill(particle.start_time);
28  enter_time_zoom->Fill(particle.start_time);
29  enter_x->Fill(particle.start.X());
30  enter_y->Fill(particle.start.Y());
31  enter_z->Fill(particle.start.Z());
32  momentum->Fill(particle.start_momentum.Mag());
33  }
34  }
35 }
36 
37  } // namespace SBNOsc
38 } // namespace ana
39 
TVector3 start_momentum
Particle directional momentum for first trajectory point inside TPC AV [GeV].
Definition: TrueParticle.h:24
bool is_cosmic
Whether this particle is of cosmic origin.
Definition: TrueParticle.h:45
double MinX() const
Returns the world x coordinate of the start of the box.
Definition: BoxBoundedGeo.h:88
double MaxX() const
Returns the world x coordinate of the end of the box.
Definition: BoxBoundedGeo.h:91
process_name opflashCryoW ana
TVector3 start
start position of track
Definition: TrueParticle.h:30
T abs(T value)
double MinZ() const
Returns the world z coordinate of the start of the box.
void Fill(const std::map< size_t, numu::TrueParticle > &true_particles)
Definition: CosmicHisto.cc:22
double MaxY() const
Returns the world y coordinate of the end of the box.
void Initialize(const std::string &prefix, const geo::BoxBoundedGeo &detector_volume)
Definition: CosmicHisto.cc:9
A base class aware of world box coordinatesAn object describing a simple shape can inherit from this ...
Definition: BoxBoundedGeo.h:33
int pdgid
Particle ID code.
Definition: TrueParticle.h:43
double MaxZ() const
Returns the world z coordinate of the end of the box.
#define COSMIC_HISTO(name, n_bins, lo, hi)
double MinY() const
Returns the world y coordinate of the start of the box.
float start_time
start time of track
Definition: TrueParticle.h:32