All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
opdet::OpFlashMCTruthAna Class Reference
Inheritance diagram for opdet::OpFlashMCTruthAna:

Public Member Functions

 OpFlashMCTruthAna (const fhicl::ParameterSet &)
 
void analyze (const art::Event &)
 

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
 

Detailed Description

Definition at line 31 of file OpFlashMCTruthAna_module.cc.

Constructor & Destructor Documentation

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

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 
98  art::ServiceHandle<art::TFileService const> tfs;
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  }
art::ServiceHandle< art::TFileService > tfs

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
159  art::Handle< std::vector< recob::OpFlash > > FlashHandle;
160  art::Handle< std::vector< simb::MCTruth > > TruthHandle;
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 
215  fDistFlashCenter = pow(
216  pow(fCenterY - fFlashY,2) +
217  pow(fCenterZ - fFlashZ,2),
218  0.5);
219 
220  fDistFlashVertex = pow(
221  pow(fVertexY - fFlashY,2) +
222  pow(fVertexZ - fFlashZ,2),
223  0.5);
224 
225  fDistFlashCenterNorm = pow(
226  pow((fCenterY - fFlashY)/fFlashWidthY,2) +
227  pow((fCenterZ - fFlashZ)/fFlashWidthZ,2),
228  0.5);
229 
230  fDistFlashVertexNorm = pow(
231  pow((fVertexY - fFlashY)/fFlashWidthY,2) +
232  pow((fVertexZ - fFlashZ)/fFlashWidthZ,2),
233  0.5);
234 
235  fAnalysisTree->Fill();
236 
237  }
238 
239  }
240 
241  fPerEventTree->Fill();
242  }
unsigned int event
Definition: DataStructs.h:634
TCEvent evt
Definition: DataStructs.cxx:8
BEGIN_PROLOG could also be cout

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: