TutAnalyzer_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \brief TODO
3 /// \author bckhouse@hep.caltech.edu
4 ////////////////////////////////////////////////////////////////////////
5 
6 // Framework includes
13 
14 // ROOT includes
15 #include "TH1F.h"
16 
17 // NOvASoft includes
18 #include "RecoBase/Prong.h"
19 #include "RecoBase/RecoHit.h"
20 
21 namespace tut
22 {
24  {
25  public:
26  explicit TutAnalyzer(const fhicl::ParameterSet& pset);
27  ~TutAnalyzer();
28 
29  void analyze(const art::Event& evt);
30 
31  void reconfigure(const fhicl::ParameterSet& pset);
32 
33  void beginJob();
34 
35  protected:
37 
38  TH1* fMassPeak;
39  };
40 }
41 
42 
43 ////////////////////////////////////////////////////////////////////////
44 namespace tut
45 {
46  //.......................................................................
48  : EDAnalyzer(pset)
49  {
50  reconfigure(pset);
51  }
52 
53  //......................................................................
55  {
56  }
57 
58  //......................................................................
60  {
61  fProngLabel = pset.get<std::string>("ProngLabel");
62  }
63 
64  //......................................................................
66  {
68  fMassPeak = tfs->make<TH1F>("massPeak", ";Reconstructed mass (MeV)", 125, 0, 250);
69  }
70 
71  //......................................................................
73  {
75  evt.getByLabel(fProngLabel, prongs);
76 
77  if(prongs->size() != 2) return;
78 
79  double E[2] = {0,};
80  for(int photIdx = 0; photIdx < 2; ++photIdx){
81  const rb::Prong& phot = (*prongs)[photIdx];
82  for(unsigned int cellIdx = 0; cellIdx < phot.NCell(); ++cellIdx){
83  // The prong knows how to use its 3D information to
84  // attenuation-calibrate this hit.
85  const rb::RecoHit rhit = phot.RecoHit(phot.Cell(cellIdx));
86  if(rhit.IsCalibrated()) E[photIdx] += rhit.GeV();
87  }
88  }
89 
90  // Prong directions are guaranteed to be unit vectors
91  const double dot = (*prongs)[0].Dir().Dot((*prongs)[1].Dir());
92 
93  const double m = sqrt(2*E[0]*E[1]*(1-dot));
94 
95  fMassPeak->Fill(1000*m);
96  }
97 
98 } // end namespace tut
99 
100 ////////////////////////////////////////////////////////////////////////
101 namespace tut
102 {
104 }
unsigned int NCell(geo::View_t view) const
Number of cells in view view.
Definition: Cluster.cxx:134
TutAnalyzer(const fhicl::ParameterSet &pset)
T sqrt(T number)
Definition: d0nt_math.hpp:156
void reconfigure(const fhicl::ParameterSet &pset)
DEFINE_ART_MODULE(TestTMapFile)
Calibrated quantities relying on position in the orthogonal view. To generate a rb::CellHit from a rb...
Definition: RecoHit.h:19
void analyze(const art::Event &evt)
Float_t E
Definition: plot.C:20
T get(std::string const &key) const
Definition: ParameterSet.h:231
int evt
TODO.
rb::RecoHit RecoHit(const art::Ptr< rb::CellHit > &chit) const
Return calibrated hit based on assumed W coordinate.
Definition: Cluster.cxx:259
bool IsCalibrated() const
You MUST check here before accessing PECorr, MIP or GeV.
Definition: RecoHit.cxx:35
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
art::Ptr< rb::CellHit > Cell(geo::View_t view, unsigned int viewIdx) const
Get the ith cell from view view.
Definition: Cluster.cxx:145
double dot(const std::vector< double > &x, const std::vector< double > &y)
Definition: dot.hpp:10
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
T * make(ARGS...args) const
float GeV() const
Definition: RecoHit.cxx:69
A Cluster with defined start position and direction.
Definition: Prong.h:19
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344