HitEva_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file HitEva.cxx
3 /// \brief TODO
4 /// \version $Id: HitEva.cxx,v 1.7 2012-09-25 06:30:12 ricken Exp $
5 /// \author ricken@fnal.gov
6 ////////////////////////////////////////////////////////////////////////
7 #include <cmath>
8 #include <vector>
9 #include <string>
10 
11 // ROOT includes
12 #include "TH1I.h"
13 #include "TNtuple.h"
14 #include "TBenchmark.h"
15 
16 // NOvA includes
17 #include "Calibrator/Calibrator.h"
19 #include "Geometry/Geometry.h"
21 #include "RecoBase/CellHit.h"
22 #include "RecoBase/Cluster.h"
23 #include "RecoBase/RecoHit.h"
24 #include "MCCheater/BackTracker.h"
26 
27 // Framework includes
34 
35 class TTree;
36 class TVector3;
37 
38 namespace geo { class Geometry; }
39 namespace rb { class CellHit; class Cluster; }
40 
41 ///tracking algorithms
42 namespace pa {
43  class HitEva : public art::EDAnalyzer {
44  public:
45  explicit HitEva(fhicl::ParameterSet const& pset);
46  virtual ~HitEva();
47 
48  void beginJob();
49  void analyze(const art::Event& evt);
50  void reconfigure(const fhicl::ParameterSet& p);
51 
52  private:
54  TTree* HitTruth;
55  bool _IsNoise, _TagAsNoise;
56  int ph_DCS, ph_MCS;
57  int tdc_DCS, tdc_MCS;
58 
59  };
60 }
61 
62 namespace pa{
63  //......................................................................
64  HitEva::HitEva(fhicl::ParameterSet const& pset)
65  : EDAnalyzer(pset)
66  {
67  reconfigure(pset);
68  }
69 
70  //......................................................................
72  {
73  }
74 
75  //......................................................................
77  {
78  fCellHitInput = pset.get< std::string >("CellHitInput");
79  }
80 
81  //......................................................................
83  {
85  HitTruth = tfs->make<TTree>("HitTruth","");
86 
87  HitTruth -> Branch("isNoise", &_IsNoise, "isNoise/O");
88  HitTruth -> Branch("tagAsNoise", &_TagAsNoise, "tagAsNoise/O");
89  HitTruth -> Branch("ph_DCS", &ph_DCS, "ph_DCS/I");
90  HitTruth -> Branch("ph_MCS", &ph_MCS, "ph_MCS/I");
91  HitTruth -> Branch("tdc_DCS", &tdc_DCS, "tdc_DCS/I");
92  HitTruth -> Branch("tdc_MCS", &tdc_MCS, "tdc_MCS/I");
93 
94  }
95 
97  {
98  //make a backtracker
100 
102  evt.getByLabel(fCellHitInput, hitcol);
103 
104  for (unsigned i = 0; i!= hitcol->size(); ++i) {
105  art::Ptr<rb::CellHit> hit_ptr(hitcol, i);
106  _IsNoise = bt->IsNoise(hit_ptr);
107  ph_DCS = hit_ptr->ADC();
108  ph_MCS = ph_DCS;
109  tdc_DCS = hit_ptr->TDC();
110  tdc_MCS = tdc_DCS;
111  _TagAsNoise = false;
112 
113  //Start MCS algorithm:
114  bool timeshifted = false;
115  int ADC_sigma = 0;
116  for (int j = 3; j!=0; --j) {
117  if (hit_ptr->ADC(j) < hit_ptr->ADC(j-1)) {
118  if (!timeshifted) {
119  tdc_MCS = tdc_MCS+32*j;
120  timeshifted = true;
121  }
122  if (hit_ptr->ADC(j-1) - hit_ptr->ADC(j) >ADC_sigma)
123  ADC_sigma = hit_ptr->ADC(j-1) - hit_ptr->ADC(j);
124  }
125 
126  }
127 
128  if (ph_MCS > 5*ADC_sigma ) {
129  if (ph_MCS<hit_ptr->ADC(3) - hit_ptr->ADC(1))
130  ph_MCS = hit_ptr->ADC(3) - hit_ptr->ADC(1);
131  if (ph_MCS<hit_ptr->ADC(2) - hit_ptr->ADC(0))
132  ph_MCS = hit_ptr->ADC(2) - hit_ptr->ADC(0);
133  }
134 
135  else if (timeshifted)
136  _TagAsNoise = true;
137 
138  HitTruth->Fill();
139  }
140 
141 
142  return;
143 
144  } //end analyze
145 
147 
148 }
void analyze(const art::Event &evt)
back track the reconstruction to the simulation
int32_t TDC() const
The time of the last baseline sample.
Definition: RawDigit.h:94
tracking algorithms
const char * p
Definition: xmltok.h:285
DEFINE_ART_MODULE(TestTMapFile)
bool IsNoise(const art::Ptr< rb::CellHit > &hit) const
Is this hit not associated with any particles?
void beginJob()
TTree * HitTruth
T get(std::string const &key) const
Definition: ParameterSet.h:231
int evt
const double j
Definition: BetheBloch.cxx:29
Perform a "2 point" Hough transform on a collection of hits.
std::string fCellHitInput
T * make(ARGS...args) const
void reconfigure(const fhicl::ParameterSet &p)
int16_t ADC(uint32_t i) const
Definition: RawDigit.cxx:58
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
bool _TagAsNoise
Helper for AttenCurve.
Definition: Path.h:10
void beginJob()
Encapsulate the geometry of one entire detector (near, far, ndos)
virtual ~HitEva()
enum BeamMode string