DedxDistribution.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file DedxDistribution.h
3 /// \brief This is a helper class for ParticleIDAlg that provides a tidy structure
4 /// in which to hold the dE/dx histograms and provides access methods to the data.
5 /// This encapsulated all of the messy histogram stuff.
6 ///
7 ///
8 /// \version $Id: DedxDistribution.cxx,v 1.0 2013-10-04 10:00:00 absmith Exp $
9 /// \author Alex Smith (smith@physics.umn.edu)
10 ////////////////////////////////////////////////////////////////////////
11 
12 #ifndef DedxDistribution_h
13 #define DedxDistribution_h
14 
15 #include "fhiclcpp/ParameterSet.h"
16 // ROOT includes
17 #include "TFile.h"
18 #include "TH1F.h"
19 
20 namespace slid {
21 
22  /// Number of XY regions into which detector is divided for dE/dx histograms.
23  static const int kNumXYRegion = 4;
24  /// Number of energy bins into which detector is divided for dE/dx histograms.
25  static const int kNumEnergyBin = 11;
26  /// Number of longitudinal planes considered for dE/dx histograms.
27  static const int kNumLongitudinalPlane = 200;
28  /// Number of "transverse" planes considered for dE/dx histograms ("planes" transverse to shower axis).
29  static const int kNumTransversePlane = 20;
30  /// bin boundaries of energy
31  static const float kEnergyBins[] = {0.00, 0.25, 0.75, 1.25, 1.75, 2.25, 2.75, 3.25, 3.75, 4.25, 4.75, 5.25};
32 
33  /// \brief An enum used to give allowed particle types a visible name in the code. Note that for electron,
34  /// these types are broken down further by the process in which they reside.
35  ///
36 
50  };
51 
53  public:
54  explicit DedxDistribution();
55  // Need a copy constructor to use in a std::vector.
56 
58  // no members set in constructor, so nothing to copy/initialize
59  }
60 
62 
63  /// \brief Load the histogram files
64  ///
65  void Initialize(const fhicl::ParameterSet& pset, std::string fileNameFclTag);
66 
67 
68  /// \brief Longitudinal plane hit dE/dx.
69  TH1F* GetLongitudinalPlaneHitDedxHist(int iXYRegion, int iEnergyBin, int iLongitudinalPlane);
70 
71  /// \brief Transverse plane hit dE/dx ("planes" transverse to shower axis).
72  TH1F* GetTransversePlaneCellDedxHist(int iXYRegion, int iEnergyBin, int iTransversePlane);
73 
74  private:
75 
76  void LoadHistFromFile(std::string filePath);
77 
78  /// \brief Load all of the histograms from the file into arrays of TH1F* objects.
79  /// The details of handling the histograms are taken care of within this method
80  ///
81  bool LoadDedxHistograms(TFile* fDistFile);
82 
83  /// Convert histogram loaded from file to a form requiring less
84  /// memory. NB: the input \a h histogram is deleted.
85  TH1F* TH1DToTH1F(TH1D* h, bool trans);
86 
88 
89  /// Longitudinal plane hit dE/dx
91  /// Transverse plane hit dE/dx
93 
96 
97  /// Need to look up what this in in JM's code and give it a more descriptive name (expected hits?).
99  };
100 } // end namespace slid
101 
102 #endif // DedxDistribution_h
103 
104 ////////////////////////////////////////////////////////////////////////
105 
106 
107 
void Initialize(const fhicl::ParameterSet &pset, std::string fileNameFclTag)
Load the histogram files.
void LoadHistFromFile(std::string filePath)
static const int kNumTransversePlane
Number of "transverse" planes considered for dE/dx histograms ("planes" transverse to shower axis)...
unsigned fHtExpPlane[kNumXYRegion][kNumEnergyBin]
Need to look up what this in in JM's code and give it a more descriptive name (expected hits...
TH1F * GetLongitudinalPlaneHitDedxHist(int iXYRegion, int iEnergyBin, int iLongitudinalPlane)
Longitudinal plane hit dE/dx.
static const int kNumXYRegion
Number of XY regions into which detector is divided for dE/dx histograms.
DedxParticleType
An enum used to give allowed particle types a visible name in the code. Note that for electron...
TH1F * TH1DToTH1F(TH1D *h, bool trans)
DedxDistribution(const DedxDistribution &other)
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
bool LoadDedxHistograms(TFile *fDistFile)
Load all of the histograms from the file into arrays of TH1F* objects. The details of handling the hi...
static const int kNumEnergyBin
Number of energy bins into which detector is divided for dE/dx histograms.
TH1F * fTransversePlaneCellDedx[kNumXYRegion][kNumEnergyBin][kNumTransversePlane]
Transverse plane hit dE/dx.
static const float kEnergyBins[]
bin boundaries of energy
Build slid::LID objects to store electron ID, if asked for, otherwise, calculate LID info and make av...
Definition: FillPIDs.h:13
static const int kNumLongitudinalPlane
Number of longitudinal planes considered for dE/dx histograms.
TH1F * GetTransversePlaneCellDedxHist(int iXYRegion, int iEnergyBin, int iTransversePlane)
Transverse plane hit dE/dx ("planes" transverse to shower axis).
TH1F * fLongitudinalPlaneHitDedx[kNumXYRegion][kNumEnergyBin][kNumLongitudinalPlane]
Longitudinal plane hit dE/dx.