Public Member Functions | Private Attributes | List of all members
opdet::OpFlashMCTruthAna Class Reference
Inheritance diagram for opdet::OpFlashMCTruthAna:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Public Member Functions

 OpFlashMCTruthAna (const fhicl::ParameterSet &)
 
void analyze (const art::Event &)
 
- Public Member Functions inherited from art::EDAnalyzer
 EDAnalyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDAnalyzer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Analyzer
virtual ~Analyzer () noexcept
 
 Analyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 Analyzer (Table< Config > const &config)
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Observer
 ~Observer () noexcept
 
 Observer (Observer const &)=delete
 
 Observer (Observer &&)=delete
 
Observeroperator= (Observer const &)=delete
 
Observeroperator= (Observer &&)=delete
 
void registerProducts (ProductDescriptions &, ModuleDescription const &)
 
void fillDescriptions (ModuleDescription const &)
 
fhicl::ParameterSetID selectorConfig () const
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Attributes

std::string fFlashInputModule
 
std::string fTruthInputModule
 
TTree * fAnalysisTree
 
TTree * fPerEventTree
 
Int_t fEventID
 
Int_t fNFlashes
 
Int_t fNTruths
 
Float_t fFlashY
 
Float_t fFlashZ
 
Float_t fFlashU
 
Float_t fFlashV
 
Float_t fFlashT
 
Float_t fFlashPE
 
Float_t fFlashFastToTotal
 
Float_t fFlashWidthY
 
Float_t fFlashWidthZ
 
Float_t fFlashWidthU
 
Float_t fFlashWidthV
 
Float_t fVertexX
 
Float_t fVertexY
 
Float_t fVertexZ
 
Float_t fVertexT
 
Float_t fTrueE
 
Int_t fTruePDG
 
Float_t fCenterX
 
Float_t fCenterY
 
Float_t fCenterZ
 
Float_t fDistFlashCenter
 
Float_t fDistFlashVertex
 
Float_t fDistFlashCenterNorm
 
Float_t fDistFlashVertexNorm
 

Additional Inherited Members

- Public Types inherited from art::EDAnalyzer
using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 
- Protected Member Functions inherited from art::Observer
std::string const & processName () const
 
bool wantAllEvents () const noexcept
 
bool wantEvent (ScheduleID id, Event const &e) const
 
Handle< TriggerResultsgetTriggerResults (Event const &e) const
 
 Observer (fhicl::ParameterSet const &config)
 
 Observer (std::vector< std::string > const &select_paths, std::vector< std::string > const &reject_paths, fhicl::ParameterSet const &config)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Definition at line 31 of file OpFlashMCTruthAna_module.cc.

Constructor & Destructor Documentation

opdet::OpFlashMCTruthAna::OpFlashMCTruthAna ( const fhicl::ParameterSet )

Definition at line 88 of file OpFlashMCTruthAna_module.cc.

89  : EDAnalyzer(pset)
90  {
91 
92  // Indicate that the Input Module comes from .fcl
93  fFlashInputModule = pset.get<std::string>("FlashInputModule");
94  fTruthInputModule = pset.get<std::string>("TruthInputModule");
95 
96 
97 
99 
100  fPerEventTree = tfs->make<TTree>("PerEventTree", "PerEventTree");
101 
102  fPerEventTree->Branch("EventID", &fEventID, "EventID/I");
103  fPerEventTree->Branch("NFlashes", &fNFlashes, "NFlashes/I");
104 
105  fPerEventTree->Branch("VertexX", &fVertexX, "VertexX/F");
106  fPerEventTree->Branch("VertexY", &fVertexY, "VertexY/F");
107  fPerEventTree->Branch("VertexZ", &fVertexZ, "VertexZ/F");
108 
109  fPerEventTree->Branch("TrueE", &fTrueE, "TrueE/F");
110  fPerEventTree->Branch("TruePDG", &fTruePDG, "TruePDG/I");
111 
112  fPerEventTree->Branch("CenterX", &fCenterX, "CenterX/F");
113  fPerEventTree->Branch("CenterY", &fCenterY, "CenterY/F");
114  fPerEventTree->Branch("CenterZ", &fCenterZ, "CenterZ/F");
115 
116 
117 
118  fAnalysisTree = tfs->make<TTree>("AnalysisTree", "AnalysisTree");
119 
120  fAnalysisTree->Branch("EventID", &fEventID, "EventID/I");
121  fAnalysisTree->Branch("NFlashes", &fNFlashes, "NFlashes/I");
122 
123  fAnalysisTree->Branch("FlashY", &fFlashY, "FlashY/F");
124  fAnalysisTree->Branch("FlashZ", &fFlashZ, "FlashZ/F");
125  fAnalysisTree->Branch("FlashU", &fFlashU, "FlashU/F");
126  fAnalysisTree->Branch("FlashV", &fFlashV, "FlashV/F");
127 
128  fAnalysisTree->Branch("FlashWidthY", &fFlashWidthY, "FlashWidthY/F");
129  fAnalysisTree->Branch("FlashWidthZ", &fFlashWidthZ, "FlashWidthZ/F");
130  fAnalysisTree->Branch("FlashWidthU", &fFlashWidthU, "FlashWidthU/F");
131  fAnalysisTree->Branch("FlashWidthV", &fFlashWidthV, "FlashWidthV/F");
132 
133  fAnalysisTree->Branch("FlashT", &fFlashT, "FlashT/F");
134  fAnalysisTree->Branch("FlashPE", &fFlashPE, "FlashPE/F");
135  fAnalysisTree->Branch("FlashFastToTotal", &fFlashFastToTotal, "FlashFastToTotal/F");
136 
137  fAnalysisTree->Branch("VertexX", &fVertexX, "VertexX/F");
138  fAnalysisTree->Branch("VertexY", &fVertexY, "VertexY/F");
139  fAnalysisTree->Branch("VertexZ", &fVertexZ, "VertexZ/F");
140 
141  fAnalysisTree->Branch("TrueE", &fTrueE, "TrueE/F");
142  fAnalysisTree->Branch("TruePDG", &fTruePDG, "TruePDG/I");
143 
144  fAnalysisTree->Branch("CenterX", &fCenterX, "CenterX/F");
145  fAnalysisTree->Branch("CenterY", &fCenterY, "CenterY/F");
146  fAnalysisTree->Branch("CenterZ", &fCenterZ, "CenterZ/F");
147 
148  fAnalysisTree->Branch("DistFlashCenter", &fDistFlashCenter, "DistFlashCenter/F");
149  fAnalysisTree->Branch("DistFlashVertex", &fDistFlashVertex, "DistFlashVertex/F");
150 
151 
152  }
std::string string
Definition: nybbler.cc:12
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25

Member Function Documentation

void opdet::OpFlashMCTruthAna::analyze ( const art::Event evt)

Definition at line 155 of file OpFlashMCTruthAna_module.cc.

156  {
157 
158  // Create a handles
161 
162  // Read in data
163  evt.getByLabel(fFlashInputModule, FlashHandle);
164  evt.getByLabel(fTruthInputModule, TruthHandle);
165 
166  fEventID=evt.id().event();
167 
168  fNTruths = TruthHandle->at(0).NParticles();
169  fNFlashes = FlashHandle->size();
170 
171  std::cout<<"Size of truth collection : " << TruthHandle->size()<<std::endl;
172  std::cout<<"We found " << fNTruths<<" truth particles and " << fNFlashes<<" flashes" <<std::endl;
173 
174 
175  for(int iPart=0; iPart!=fNTruths; ++iPart)
176  {
177  const simb::MCParticle ThisPart = TruthHandle->at(0).GetParticle(iPart);
178  fTruePDG = ThisPart.PdgCode();
179  fTrueE = ThisPart.E(0);
180 
181  fVertexX = ThisPart.Vx(0);
182  fVertexY = ThisPart.Vy(0);
183  fVertexZ = ThisPart.Vz(0);
184  fVertexT = ThisPart.T(0);
185 
186  fCenterX = (ThisPart.Vx(0) + ThisPart.EndX())/2.;
187  fCenterY = (ThisPart.Vy(0) + ThisPart.EndY())/2.;
188  fCenterZ = (ThisPart.Vz(0) + ThisPart.EndZ())/2.;
189 
190 
191  for(unsigned int i = 0; i < FlashHandle->size(); ++i)
192  {
193 
194  // Get OpFlash
195  art::Ptr< recob::OpFlash > TheFlashPtr(FlashHandle, i);
196 
197  fFlashT = TheFlashPtr->Time();
198  fFlashPE = TheFlashPtr->TotalPE();
199  fFlashFastToTotal = TheFlashPtr->FastToTotal();
200 
201  fFlashY = TheFlashPtr->YCenter();
202  fFlashZ = TheFlashPtr->ZCenter();
203  fFlashU = TheFlashPtr->WireCenters().at(0);
204  fFlashV = TheFlashPtr->WireCenters().at(1);
205 
206  fFlashWidthY = TheFlashPtr->YWidth();
207  fFlashWidthZ = TheFlashPtr->ZWidth();
208  fFlashWidthU = TheFlashPtr->WireWidths().at(0);
209  fFlashWidthV = TheFlashPtr->WireWidths().at(1);
210 
211 
212 
213 
214 
216  pow(fCenterY - fFlashY,2) +
217  pow(fCenterZ - fFlashZ,2),
218  0.5);
219 
221  pow(fVertexY - fFlashY,2) +
222  pow(fVertexZ - fFlashZ,2),
223  0.5);
224 
228  0.5);
229 
233  0.5);
234 
235  fAnalysisTree->Fill();
236 
237  }
238 
239  }
240 
241  fPerEventTree->Fill();
242  }
double E(const int i=0) const
Definition: MCParticle.h:233
int PdgCode() const
Definition: MCParticle.h:212
double EndZ() const
Definition: MCParticle.h:228
constexpr T pow(T x)
Definition: pow.h:72
double EndY() const
Definition: MCParticle.h:227
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:633
double T(const int i=0) const
Definition: MCParticle.h:224
double Vx(const int i=0) const
Definition: MCParticle.h:221
double Vz(const int i=0) const
Definition: MCParticle.h:223
EventNumber_t event() const
Definition: EventID.h:116
double EndX() const
Definition: MCParticle.h:226
EventID id() const
Definition: Event.cc:34
double Vy(const int i=0) const
Definition: MCParticle.h:222
QTextStream & endl(QTextStream &s)

Member Data Documentation

TTree* opdet::OpFlashMCTruthAna::fAnalysisTree
private

Definition at line 50 of file OpFlashMCTruthAna_module.cc.

Float_t opdet::OpFlashMCTruthAna::fCenterX
private

Definition at line 60 of file OpFlashMCTruthAna_module.cc.

Float_t opdet::OpFlashMCTruthAna::fCenterY
private

Definition at line 60 of file OpFlashMCTruthAna_module.cc.

Float_t opdet::OpFlashMCTruthAna::fCenterZ
private

Definition at line 60 of file OpFlashMCTruthAna_module.cc.

Float_t opdet::OpFlashMCTruthAna::fDistFlashCenter
private

Definition at line 61 of file OpFlashMCTruthAna_module.cc.

Float_t opdet::OpFlashMCTruthAna::fDistFlashCenterNorm
private

Definition at line 62 of file OpFlashMCTruthAna_module.cc.

Float_t opdet::OpFlashMCTruthAna::fDistFlashVertex
private

Definition at line 61 of file OpFlashMCTruthAna_module.cc.

Float_t opdet::OpFlashMCTruthAna::fDistFlashVertexNorm
private

Definition at line 62 of file OpFlashMCTruthAna_module.cc.

Int_t opdet::OpFlashMCTruthAna::fEventID
private

Definition at line 53 of file OpFlashMCTruthAna_module.cc.

Float_t opdet::OpFlashMCTruthAna::fFlashFastToTotal
private

Definition at line 55 of file OpFlashMCTruthAna_module.cc.

std::string opdet::OpFlashMCTruthAna::fFlashInputModule
private

Definition at line 46 of file OpFlashMCTruthAna_module.cc.

Float_t opdet::OpFlashMCTruthAna::fFlashPE
private

Definition at line 55 of file OpFlashMCTruthAna_module.cc.

Float_t opdet::OpFlashMCTruthAna::fFlashT
private

Definition at line 54 of file OpFlashMCTruthAna_module.cc.

Float_t opdet::OpFlashMCTruthAna::fFlashU
private

Definition at line 54 of file OpFlashMCTruthAna_module.cc.

Float_t opdet::OpFlashMCTruthAna::fFlashV
private

Definition at line 54 of file OpFlashMCTruthAna_module.cc.

Float_t opdet::OpFlashMCTruthAna::fFlashWidthU
private

Definition at line 56 of file OpFlashMCTruthAna_module.cc.

Float_t opdet::OpFlashMCTruthAna::fFlashWidthV
private

Definition at line 56 of file OpFlashMCTruthAna_module.cc.

Float_t opdet::OpFlashMCTruthAna::fFlashWidthY
private

Definition at line 56 of file OpFlashMCTruthAna_module.cc.

Float_t opdet::OpFlashMCTruthAna::fFlashWidthZ
private

Definition at line 56 of file OpFlashMCTruthAna_module.cc.

Float_t opdet::OpFlashMCTruthAna::fFlashY
private

Definition at line 54 of file OpFlashMCTruthAna_module.cc.

Float_t opdet::OpFlashMCTruthAna::fFlashZ
private

Definition at line 54 of file OpFlashMCTruthAna_module.cc.

Int_t opdet::OpFlashMCTruthAna::fNFlashes
private

Definition at line 53 of file OpFlashMCTruthAna_module.cc.

Int_t opdet::OpFlashMCTruthAna::fNTruths
private

Definition at line 53 of file OpFlashMCTruthAna_module.cc.

TTree* opdet::OpFlashMCTruthAna::fPerEventTree
private

Definition at line 51 of file OpFlashMCTruthAna_module.cc.

Float_t opdet::OpFlashMCTruthAna::fTrueE
private

Definition at line 58 of file OpFlashMCTruthAna_module.cc.

Int_t opdet::OpFlashMCTruthAna::fTruePDG
private

Definition at line 59 of file OpFlashMCTruthAna_module.cc.

std::string opdet::OpFlashMCTruthAna::fTruthInputModule
private

Definition at line 47 of file OpFlashMCTruthAna_module.cc.

Float_t opdet::OpFlashMCTruthAna::fVertexT
private

Definition at line 57 of file OpFlashMCTruthAna_module.cc.

Float_t opdet::OpFlashMCTruthAna::fVertexX
private

Definition at line 57 of file OpFlashMCTruthAna_module.cc.

Float_t opdet::OpFlashMCTruthAna::fVertexY
private

Definition at line 57 of file OpFlashMCTruthAna_module.cc.

Float_t opdet::OpFlashMCTruthAna::fVertexZ
private

Definition at line 57 of file OpFlashMCTruthAna_module.cc.


The documentation for this class was generated from the following file: