LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
CheckAuxDetHit_module.cc
Go to the documentation of this file.
1 // STL includes
2 #include <cmath>
3 
4 // art Framework includes.
11 #include "art_root_io/TFileDirectory.h"
12 #include "art_root_io/TFileService.h"
15 
16 // Root includes.
17 #include "TDirectory.h"
18 #include "TFile.h"
19 #include "TH1F.h"
20 #include "TNtuple.h"
21 
22 // Other includes.
23 #include "CLHEP/Units/SystemOfUnits.h"
24 
25 namespace larg4 {
26  class CheckAuxDetHit;
27 }
28 
30 public:
31  explicit CheckAuxDetHit(fhicl::ParameterSet const& p);
32 
33 private:
34  void beginJob() override;
35  void analyze(const art::Event& event) override;
36 
37  TH1F* _hnHits{nullptr}; // number of AuxDetHitHits
38  TH1F* _hEdep{nullptr}; // average energy deposition in AuxDetHitHits
39  TH1F* _hID{nullptr}; // AuxDet ID's
40  TH1F* _hexit{nullptr}; // exit points in z
41  TH1F* _hentry{nullptr}; // entry points in z
42  // TNtuple* _ntuple;
43 };
44 
46 
48 {
50  _hnHits = tfs->make<TH1F>("hnHits", "Number of AuxDetHits", 30, 0, 30);
51  _hEdep = tfs->make<TH1F>("hEdep", "Energy deposition in AuxDetHits", 100, 0., 4.);
52  _hID = tfs->make<TH1F>("hID", "Id of hit AuxDet", 100, 0., 5.);
53  _hexit = tfs->make<TH1F>("hexit", "exit points in z", 100, -100., 100.);
54  _hentry = tfs->make<TH1F>("hentry", "entry points in z", 100, -100., 100.);
55  // _ntuple = tfs->make<TNtuple>("ntuple","Demo ntuple",
56  // "Event:Edep:em_Edep:nonem_Edep:xpos:ypos:zpos:time");
57 } // end beginJob
58 
60 {
61  //std::vector<art::Handle<sim::AuxDetHitCollection>> allSims;
62  //event.getManyByType(allSims);
63  auto allSims = event.getMany<sim::AuxDetHitCollection>();
64  for (auto const& sims : allSims) {
65  _hnHits->Fill(sims->size());
66  for (auto const& hit : *sims) {
67  _hEdep->Fill(hit.GetEnergyDeposited());
68  _hexit->Fill(hit.GetExitZ());
69  _hentry->Fill(hit.GetEntryZ());
70  _hID->Fill(hit.GetID());
71  }
72  }
73 } // end analyze
74 
void analyze(const art::Event &event) override
Geant4 interface.
CheckAuxDetHit(fhicl::ParameterSet const &p)
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.cc:6
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:65
Detector simulation of raw signals on wires.
std::vector< AuxDetHit > AuxDetHitCollection
Definition: AuxDetHit.h:126
Definition: MVAAlg.h:12
Event finding and building.