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

Public Member Functions

 G4RWExampleAnalyzer (fhicl::ParameterSet const &p)
 
 G4RWExampleAnalyzer (G4RWExampleAnalyzer const &)=delete
 
 G4RWExampleAnalyzer (G4RWExampleAnalyzer &&)=delete
 
G4RWExampleAnalyzeroperator= (G4RWExampleAnalyzer const &)=delete
 
G4RWExampleAnalyzeroperator= (G4RWExampleAnalyzer &&)=delete
 
void analyze (art::Event const &e) override
 
void beginJob () override
 
void reset ()
 
- 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

TTree * fTree
 
int run
 
int subrun
 
int event
 
int true_beam_PDG
 
int true_beam_ID
 
double true_beam_len
 
double true_beam_startP
 
double true_beam_endP
 
double true_beam_startX
 
double true_beam_startY
 
double true_beam_startZ
 
double true_beam_endX
 
double true_beam_endY
 
double true_beam_endZ
 
int true_beam_nTrajPts
 
std::vector< double > true_beam_traj_dx
 
std::vector< double > true_beam_traj_X
 
std::vector< double > true_beam_traj_Y
 
std::vector< double > true_beam_traj_Z
 
std::vector< double > true_beam_traj_KE
 
std::vector< double > true_beam_traj_rx
 
std::vector< double > true_beam_traj_ry
 
std::vector< double > true_beam_traj_rz
 
std::vector< std::stringtrue_beam_traj_procs
 
std::vector< double > true_beam_dEdX
 
std::vector< double > reco_beam_len
 
std::vector< double > reco_beam_startX
 
std::vector< double > reco_beam_startY
 
std::vector< double > reco_beam_startZ
 
std::vector< double > reco_beam_endX
 
std::vector< double > reco_beam_endY
 
std::vector< double > reco_beam_endZ
 
std::vector< int > reco_beam_ID
 
std::vector< int > reco_beam_nDaughters
 
int true_beam_nPi0_daughter
 
int true_beam_nPiPlus_daughter
 
int true_beam_nPiMinus_daughter
 
int true_beam_nProton_daughter
 
int true_beam_nNeutron_daughter
 
std::string true_beam_endProcess
 
int true_beam_nElasticScatters
 
std::vector< double > g4rw_primary_plus_sigma_weight
 
std::vector< double > g4rw_primary_minus_sigma_weight
 
std::vector< double > g4rw_primary_weights
 
std::vector< std::stringg4rw_primary_var
 
std::vector< double > g4rw_alt_primary_plus_sigma_weight
 
std::vector< double > g4rw_alt_primary_minus_sigma_weight
 
std::vector< double > g4rw_test_primary_plus_sigma_weight
 
std::vector< double > g4rw_test_primary_minus_sigma_weight
 
std::vector< double > g4rw_full_primary_plus_sigma_weight
 
std::vector< double > g4rw_full_primary_minus_sigma_weight
 
double g4rw_primary_singular_weight
 
std::vector< double > g4rw_set_weights
 
TFile * FracsFile
 
TFile ProtFracsFile
 
G4MultiReweighter * MultiRW
 
std::string fGeneratorTag
 
std::string fPFParticleTag
 
std::string fTrackerTag
 
int RW_PDG
 
std::vector< fhicl::ParameterSetParSet
 
G4ReweightParameterMaker ParMaker
 
G4ReweightManager RWManager
 
bool fDoFull
 

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 80 of file G4RWExampleAnalyzer_module.cc.

Constructor & Destructor Documentation

protoana::G4RWExampleAnalyzer::G4RWExampleAnalyzer ( fhicl::ParameterSet const &  p)
explicit

Definition at line 156 of file G4RWExampleAnalyzer_module.cc.

158  : EDAnalyzer{p},
159  fGeneratorTag(p.get<std::string>("GeneratorTag")),
160  fPFParticleTag(p.get<std::string>("PFParticleTag")),
161  fTrackerTag(p.get<std::string>("TrackerTag")),
162  RW_PDG(p.get<int>("RW_PDG")),
163  ParSet(p.get<std::vector<fhicl::ParameterSet>>("ParameterSet")),
164  ParMaker(ParSet, false, RW_PDG),
165  RWManager({p.get<fhicl::ParameterSet>("Material")}),
166  fDoFull(p.get<bool>("DoFull")) {
167 
168  FracsFile = OpenFile(p.get< std::string >( "FracsFile" ));
169  MultiRW = new G4MultiReweighter(RW_PDG, *FracsFile, ParSet,
170  p.get<fhicl::ParameterSet>("Material"),
171  &RWManager);
172 }
std::string string
Definition: nybbler.cc:12
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
std::vector< fhicl::ParameterSet > ParSet
p
Definition: test.py:223
TFile * OpenFile(const std::string filename)
protoana::G4RWExampleAnalyzer::G4RWExampleAnalyzer ( G4RWExampleAnalyzer const &  )
delete
protoana::G4RWExampleAnalyzer::G4RWExampleAnalyzer ( G4RWExampleAnalyzer &&  )
delete

Member Function Documentation

void protoana::G4RWExampleAnalyzer::analyze ( art::Event const &  e)
overridevirtual

Implements art::EDAnalyzer.

Definition at line 174 of file G4RWExampleAnalyzer_module.cc.

174  {
175 
176  reset();
177 
179  art::ServiceHandle < geo::Geometry > fGeometryService;
181  const sim::ParticleList & plist = pi_serv->ParticleList();
182 
183 
184  // This gets the true beam particle that generated the event
185  const simb::MCParticle* true_beam_particle = 0x0;
186  auto mcTruths = e.getValidHandle<std::vector<simb::MCTruth>>(fGeneratorTag);
187  true_beam_particle = truthUtil.GetGeantGoodParticle((*mcTruths)[0], e);
188  if (!true_beam_particle) {
189  MF_LOG_WARNING("PionAnalyzer") << "No true beam particle" << std::endl;
190  return;
191  }
192  ////////////////////////////
193 
194  true_beam_PDG = true_beam_particle->PdgCode();
195  true_beam_ID = true_beam_particle->TrackId();
196  true_beam_len = true_beam_particle->Trajectory().TotalLength();
197  true_beam_startX = true_beam_particle->Position(0).X();
198  true_beam_startY = true_beam_particle->Position(0).Y();
199  true_beam_startZ = true_beam_particle->Position(0).Z();
200  true_beam_endX = true_beam_particle->EndX();
201  true_beam_endY = true_beam_particle->EndY();
202  true_beam_endZ = true_beam_particle->EndZ();
203  true_beam_startP = true_beam_particle->P();
204  true_beam_endP = true_beam_particle->P(
205  (true_beam_particle->NumberTrajectoryPoints() - 2));
206  true_beam_endProcess = true_beam_particle->EndProcess();
207 
208  for (int i = 0; i < true_beam_particle->NumberDaughters(); ++i) {
209  int daughterID = true_beam_particle->Daughter(i);
210  auto part = plist[ daughterID ];
211  int pdg = part->PdgCode();
212 
213  if (part->Process().find("Inelastic") != std::string::npos) {
214  if (pdg == 211) {
216  }
217  else if (pdg == -211) {
219  }
220  else if (pdg == 111) {
222  }
223  else if (pdg == 2212) {
225  }
226  else if (pdg == 2112) {
228  }
229  }
230 
231  }
232 
234  auto view2_IDEs = bt_serv->TrackIdToSimIDEs_Ps(true_beam_ID, geo::View_t(2));
235  if (view2_IDEs.size() > 1) {
236  std::sort(view2_IDEs.begin(), view2_IDEs.end(),
237  [](const sim::IDE * i1, const sim::IDE * i2)
238  {return (i1->z < i2->z);});
239  for (size_t i = 0; i < view2_IDEs.size()-1; ++i) {
240  const sim::IDE * i1 = view2_IDEs[i];
241  const sim::IDE * i2 = view2_IDEs[i+1];
242 
243  double edep = i1->energy;
244  double len = sqrt(std::pow((i1->x - i2->x), 2) +
245  std::pow((i1->y - i2->y), 2) +
246  std::pow((i1->z - i2->z), 2));
247  if (len > 1.e-5)
248  true_beam_dEdX.push_back((edep/len));
249  }
250  }
251 
252  try {
254  auto pfpVec =
255  e.getValidHandle<std::vector<recob::PFParticle>>(fPFParticleTag);
256  for (const recob::PFParticle & pfp : (*pfpVec)) {
257  const recob::Track * thisTrack =
259 
260  reco_beam_nDaughters.push_back(pfp.NumDaughters());
261  if (thisTrack) {
262  reco_beam_len.push_back(thisTrack->Length());
263  reco_beam_ID.push_back(thisTrack->ID());
264  reco_beam_startX.push_back(thisTrack->Start().X());
265  reco_beam_startY.push_back(thisTrack->Start().Y());
266  reco_beam_startZ.push_back(thisTrack->Start().Z());
267  reco_beam_endX.push_back(thisTrack->End().X());
268  reco_beam_endY.push_back(thisTrack->End().Y());
269  reco_beam_endZ.push_back(thisTrack->End().Z());
270  }
271  else {
272  reco_beam_len.push_back(-1.);
273  reco_beam_ID.push_back(-1);
274  reco_beam_startX.push_back(-1.);
275  reco_beam_startY.push_back(-1.);
276  reco_beam_startZ.push_back(-1.);
277  reco_beam_endX.push_back(-1.);
278  reco_beam_endY.push_back(-1.);
279  reco_beam_endZ.push_back(-1.);
280  }
281 
282  }
283  }
284  catch (const std::exception & e) {
285  std::cout << "No reco info. Moving on" << std::endl;
286  }
287 
288  const simb::MCTrajectory & true_beam_trajectory =
289  true_beam_particle->Trajectory();
290 
291  auto true_beam_proc_map = true_beam_trajectory.TrajectoryProcesses();
292  std::map<size_t, std::string> proc_map;
293  for (auto itProc = true_beam_proc_map.begin();
294  itProc != true_beam_proc_map.end(); ++itProc) {
295  //int index = itProc->first;
296  std::string process = true_beam_trajectory.KeyToProcess(itProc->second);
297  proc_map[itProc->first] = process;
298 
299  if (process == "hadElastic") {
301  }
302  }
303 
304  true_beam_nTrajPts = true_beam_trajectory.size();
305  true_beam_traj_X.push_back(true_beam_trajectory.X(0));
306  true_beam_traj_Y.push_back(true_beam_trajectory.Y(0));
307  true_beam_traj_Z.push_back(true_beam_trajectory.Z(0));
308  true_beam_traj_KE.push_back(
309  1.e3*(true_beam_trajectory.E(0) - true_beam_particle->Mass()));
310  double p_mag = sqrt(true_beam_trajectory.Px(0)*true_beam_trajectory.Px(0) +
311  true_beam_trajectory.Py(0)*true_beam_trajectory.Py(0) +
312  true_beam_trajectory.Pz(0)*true_beam_trajectory.Pz(0));
313  true_beam_traj_rx.push_back(true_beam_trajectory.Px(0)/p_mag);
314  true_beam_traj_ry.push_back(true_beam_trajectory.Py(0)/p_mag);
315  true_beam_traj_rz.push_back(true_beam_trajectory.Pz(0)/p_mag);
316  if (proc_map.find(0) != proc_map.end()) {
317  true_beam_traj_procs.push_back(proc_map.at(0));
318  }
319  else {
320  true_beam_traj_procs.push_back("");
321  }
322  for (int i = 1; i < true_beam_nTrajPts; ++i) {
323  double x0 = true_beam_trajectory.X(i-1);
324  double x1 = true_beam_trajectory.X(i);
325  double y0 = true_beam_trajectory.Y(i-1);
326  double y1 = true_beam_trajectory.Y(i);
327  double z0 = true_beam_trajectory.Z(i-1);
328  double z1 = true_beam_trajectory.Z(i);
329 
330  true_beam_traj_dx.push_back(sqrt((x1 - x0)*(x1 - x0) +
331  (y1 - y0)*(y1 - y0) +
332  (z1 - z0)*(z1 - z0)));
333  true_beam_traj_X.push_back(true_beam_trajectory.X(i));
334  true_beam_traj_Y.push_back(true_beam_trajectory.Y(i));
335  true_beam_traj_Z.push_back(true_beam_trajectory.Z(i));
336  true_beam_traj_KE.push_back(
337  1.e3*(true_beam_trajectory.E(i) - true_beam_particle->Mass()));
338  double p_mag = sqrt(true_beam_trajectory.Px(i)*true_beam_trajectory.Px(i) +
339  true_beam_trajectory.Py(i)*true_beam_trajectory.Py(i) +
340  true_beam_trajectory.Pz(i)*true_beam_trajectory.Pz(i));
341  true_beam_traj_rx.push_back(true_beam_trajectory.Px(i)/p_mag);
342  true_beam_traj_ry.push_back(true_beam_trajectory.Py(i)/p_mag);
343  true_beam_traj_rz.push_back(true_beam_trajectory.Pz(i)/p_mag);
344  if (proc_map.find(i) != proc_map.end()) {
345  true_beam_traj_procs.push_back(proc_map.at(i));
346  }
347  else {
348  true_beam_traj_procs.push_back("");
349  }
350  }
351 
352 
353  event = e.id().event();
354  run = e.run();
355  subrun = e.subRun();
356 
357  if (true_beam_PDG == RW_PDG) {
358  G4ReweightTraj theTraj(true_beam_ID, true_beam_PDG, 0, event, {0,0});
359  /*
360  bool created = CreateRWTraj(*true_beam_particle, plist,
361  fGeometryService, event, &theTraj);
362  if (created && theTraj.GetNSteps()) {
363 
364  g4rw_primary_singular_weight = MultiRW->GetWeightFromNominal(theTraj);
365  //the following method achieves the same result
366  //g4rw_primary_singular_weight = theRW->GetWeight(&theTraj);
367 
368  std::vector<double> weights_vec = MultiRW->GetWeightFromAll1DThrows(
369  theTraj);
370  g4rw_primary_weights.insert(g4rw_primary_weights.end(),
371  weights_vec.begin(), weights_vec.end());
372 
373  for (size_t i = 0; i < ParSet.size(); ++i) {
374  std::pair<double, double> pm_weights =
375  MultiRW->GetPlusMinusSigmaParWeight(theTraj, i);
376 
377  g4rw_primary_plus_sigma_weight.push_back(pm_weights.first);
378  g4rw_primary_minus_sigma_weight.push_back(pm_weights.second);
379  g4rw_primary_var.push_back(ParSet[i].get<std::string>("Name"));
380  }
381 
382  //For testing with Heng-Ye's parameters
383  if (ParSet.size() == 2) {
384  for (size_t i = 0; i < 20; ++i) {
385  for (size_t j = 0; j < 20; ++j) {
386  std::vector<double> input_values = {(.1 + i*.1), (.1 + j*.1)};
387  bool set_values = MultiRW->SetAllParameterValues(input_values);
388  if (!set_values) continue;
389 
390  g4rw_set_weights.push_back(
391  MultiRW->GetWeightFromSetParameters(theTraj));
392  }
393  }
394  }
395 
396 
397  }
398  */
399 
400  std::vector<G4ReweightTraj *> trajs = CreateNRWTrajs(
401  *true_beam_particle, plist,
402  fGeometryService, event, "LAr");
403  bool added = false;
404  for (size_t i = 0; i < trajs.size(); ++i) {
405  if (trajs[i]->GetNSteps() > 0) {
406  //std::cout << i << " " << trajs[i]->GetNSteps() << std::endl;
407  for (size_t j = 0; j < ParSet.size(); ++j) {
408  std::pair<double, double> pm_weights =
409  MultiRW->GetPlusMinusSigmaParWeight((*trajs[i]), j);
410  //std::cout << "got weights" << std::endl;
411  //std::cout << pm_weights.first << " " << pm_weights.second << std::endl;
412 
413  if (!added) {
414  g4rw_alt_primary_plus_sigma_weight.push_back(pm_weights.first);
415  g4rw_alt_primary_minus_sigma_weight.push_back(pm_weights.second);
416  }
417  else {
418  g4rw_alt_primary_plus_sigma_weight[j] *= pm_weights.first;
419  g4rw_alt_primary_minus_sigma_weight[j] *= pm_weights.second;
420  }
421  }
422  added = true;
423  }
424  }
425 
426  for (size_t i = 0; i < ParSet.size(); ++i) {
427  std::pair<double, double> temp_weights = GetNTrajPMSigmaWeights(trajs, *MultiRW, i);
428  g4rw_test_primary_plus_sigma_weight.push_back(temp_weights.first);
429  g4rw_test_primary_minus_sigma_weight.push_back(temp_weights.second);
430  }
431 
432  std::vector<double> input(ParSet.size(), 1.);
433  bool set_values = MultiRW->SetAllParameterValues(input);
434  if (set_values) {
435  }
436 
437  //Heng-Ye's weights
438  //for (ii reac loop)
439  //for (jj elast loop)
440  // bool set_values = MultiRW->SetAllParameterValues(input_values);
441  // if (!set_values) continue;
442  // double temp_w = GetNTrajWeightFromSetPars(trajs, MultiRW);
443  // g4rw_set_weights.push_back(temp_w);
444 
445  if (fDoFull) {
446  std::vector<int> to_create = {true_beam_ID};
447  std::vector<std::vector<G4ReweightTraj *>> created;
448  while (to_create.size()) {
449  auto part = plist[to_create[0]];
450  std::vector<G4ReweightTraj *> temp_trajs =
451  CreateNRWTrajs(*part, plist, fGeometryService,
452  event, "LAr");
453  if (temp_trajs.size()) {
454  auto last_traj = temp_trajs.back();
455  for (size_t i = 0; i < last_traj->GetNChilds(); ++i) {
456  if ((last_traj->GetChild(i)->GetPDG() == 2212) ||
457  (last_traj->GetChild(i)->GetPDG() == 2112) ||
458  (abs(last_traj->GetChild(i)->GetPDG()) == 211) ) {
459  to_create.push_back(last_traj->GetChild(i)->GetTrackID());
460  }
461  }
462 
463  if (temp_trajs[0]->GetPDG() == RW_PDG) {
464  created.push_back(temp_trajs);
465  }
466  }
467  to_create.erase(to_create.begin());
468  }
469 
470 
471  bool new_added = false;
472  for (size_t i = 0; i < created.size(); ++i) {
473  std::vector<G4ReweightTraj *> temp_trajs = created[i];
474  for (size_t j = 0; j < temp_trajs.size(); ++j) {
475  G4ReweightTraj * this_traj = temp_trajs[j];
476  if (this_traj->GetNSteps() > 0) {
477  for (size_t k = 0; k < ParSet.size(); ++k) {
478  std::pair<double, double> pm_weights =
479  MultiRW->GetPlusMinusSigmaParWeight((*this_traj), k);
480 
481  if (!new_added) {
482  g4rw_full_primary_plus_sigma_weight.push_back(pm_weights.first);
483  g4rw_full_primary_minus_sigma_weight.push_back(pm_weights.second);
484  }
485  else {
486  g4rw_full_primary_plus_sigma_weight[k] *= pm_weights.first;
487  g4rw_full_primary_minus_sigma_weight[k] *= pm_weights.second;
488  }
489  }
490  new_added = true;
491  }
492  }
493  }
494  }
495  }
496 
497  fTree->Fill();
498 }
double Z(const size_type i) const
Definition: MCTrajectory.h:151
double X(const size_type i) const
Definition: MCTrajectory.h:149
std::vector< double > g4rw_full_primary_minus_sigma_weight
float z
z position of ionization [cm]
Definition: SimChannel.h:117
const simb::MCParticle * GetGeantGoodParticle(const simb::MCTruth &genTruth, const art::Event &evt) const
double E(const size_type i) const
Definition: MCTrajectory.h:156
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
std::string string
Definition: nybbler.cc:12
double Pz(const size_type i) const
Definition: MCTrajectory.h:155
constexpr T pow(T x)
Definition: pow.h:72
std::string KeyToProcess(unsigned char const &key) const
std::vector< const sim::IDE * > TrackIdToSimIDEs_Ps(int const &id) const
std::vector< fhicl::ParameterSet > ParSet
float x
x position of ionization [cm]
Definition: SimChannel.h:115
std::vector< double > g4rw_alt_primary_minus_sigma_weight
def process(f, kind)
Definition: search.py:254
T abs(T value)
const double e
double Length(size_t p=0) const
Access to various track properties.
Definition: Track.h:167
double Y(const size_type i) const
Definition: MCTrajectory.h:150
static int input(void)
Definition: code.cpp:15695
std::vector< double > g4rw_full_primary_plus_sigma_weight
Point_t const & Start() const
Access to track position at different points.
Definition: Track.h:123
Ionization at a point of the TPC sensitive volume.
Definition: SimChannel.h:84
const recob::Track * GetPFParticleTrack(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel, const std::string trackLabel) const
Get the track associated to this particle. Returns a null pointer if not found.
float energy
energy deposited by ionization by this track ID and time [MeV]
Definition: SimChannel.h:114
ProcessMap const & TrajectoryProcesses() const
Definition: MCTrajectory.h:188
std::vector< double > g4rw_test_primary_minus_sigma_weight
const sim::ParticleList & ParticleList() const
float y
y position of ionization [cm]
Definition: SimChannel.h:116
int ID() const
Definition: Track.h:198
Hierarchical representation of particle flow.
Definition: PFParticle.h:44
size_type size() const
Definition: MCTrajectory.h:166
std::vector< std::string > true_beam_traj_procs
Point_t const & End() const
Definition: Track.h:125
std::vector< double > g4rw_alt_primary_plus_sigma_weight
double Px(const size_type i) const
Definition: MCTrajectory.h:153
#define MF_LOG_WARNING(category)
std::vector< G4ReweightTraj * > CreateNRWTrajs(const simb::MCParticle &part, const sim::ParticleList &plist, art::ServiceHandle< geo::Geometry > geo_serv, int event, std::string material_name="LAr", bool fVerbose=false)
double Py(const size_type i) const
Definition: MCTrajectory.h:154
std::vector< double > g4rw_test_primary_plus_sigma_weight
std::pair< double, double > GetNTrajPMSigmaWeights(const std::vector< G4ReweightTraj * > &trajs, G4MultiReweighter &rw, size_t iPar)
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
Definition: Track.h:49
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
QTextStream & endl(QTextStream &s)
Event finding and building.
void protoana::G4RWExampleAnalyzer::beginJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 500 of file G4RWExampleAnalyzer_module.cc.

500  {
502  fTree = tfs->make<TTree>("tree","output tree");
503 
504  fTree->Branch("run", &run);
505  fTree->Branch("subrun", &subrun);
506  fTree->Branch("event", &event);
507  fTree->Branch("true_beam_ID", &true_beam_ID);
508  fTree->Branch("true_beam_PDG", &true_beam_PDG);
509  fTree->Branch("true_beam_len", &true_beam_len);
510  fTree->Branch("true_beam_nTrajPts", &true_beam_nTrajPts);
511  fTree->Branch("true_beam_traj_dx", &true_beam_traj_dx);
512  fTree->Branch("true_beam_traj_X", &true_beam_traj_X);
513  fTree->Branch("true_beam_traj_Y", &true_beam_traj_Y);
514  fTree->Branch("true_beam_traj_Z", &true_beam_traj_Z);
515  fTree->Branch("true_beam_traj_rx", &true_beam_traj_rx);
516  fTree->Branch("true_beam_traj_ry", &true_beam_traj_ry);
517  fTree->Branch("true_beam_traj_rz", &true_beam_traj_rz);
518  fTree->Branch("true_beam_traj_KE", &true_beam_traj_KE);
519  fTree->Branch("true_beam_traj_procs", &true_beam_traj_procs);
520  fTree->Branch("true_beam_startP", &true_beam_startP);
521  fTree->Branch("true_beam_startX", &true_beam_startX);
522  fTree->Branch("true_beam_startY", &true_beam_startY);
523  fTree->Branch("true_beam_startZ", &true_beam_startZ);
524  fTree->Branch("true_beam_endX", &true_beam_endX);
525  fTree->Branch("true_beam_endY", &true_beam_endY);
526  fTree->Branch("true_beam_endZ", &true_beam_endZ);
527  fTree->Branch("true_beam_endP", &true_beam_endP);
528  fTree->Branch("true_beam_dEdX", &true_beam_dEdX);
529  fTree->Branch("true_beam_nPi0_daughter", &true_beam_nPi0_daughter);
530  fTree->Branch("true_beam_nPiPlus_daughter", &true_beam_nPiPlus_daughter);
531  fTree->Branch("true_beam_nPiMinus_daughter", &true_beam_nPiMinus_daughter);
532  fTree->Branch("true_beam_nProton_daughter", &true_beam_nProton_daughter);
533  fTree->Branch("true_beam_nNeutron_daughter", &true_beam_nNeutron_daughter);
534  fTree->Branch("true_beam_endProcess", &true_beam_endProcess);
535  fTree->Branch("true_beam_nElasticScatters", &true_beam_nElasticScatters);
536 
537  fTree->Branch("reco_beam_len", &reco_beam_len);
538  fTree->Branch("reco_beam_startX", &reco_beam_startX);
539  fTree->Branch("reco_beam_startY", &reco_beam_startY);
540  fTree->Branch("reco_beam_startZ", &reco_beam_startZ);
541  fTree->Branch("reco_beam_endX", &reco_beam_endX);
542  fTree->Branch("reco_beam_endY", &reco_beam_endY);
543  fTree->Branch("reco_beam_endZ", &reco_beam_endZ);
544  fTree->Branch("reco_beam_ID", &reco_beam_ID);
545  fTree->Branch("reco_beam_nDaughters", &reco_beam_nDaughters);
546 
547  fTree->Branch("g4rw_primary_weights", &g4rw_primary_weights);
548  fTree->Branch("g4rw_primary_singular_weight", &g4rw_primary_singular_weight);
549  fTree->Branch("g4rw_primary_plus_sigma_weight", &g4rw_primary_plus_sigma_weight);
550  fTree->Branch("g4rw_primary_minus_sigma_weight", &g4rw_primary_minus_sigma_weight);
551  fTree->Branch("g4rw_primary_var", &g4rw_primary_var);
552  fTree->Branch("g4rw_alt_primary_plus_sigma_weight",
554  fTree->Branch("g4rw_alt_primary_minus_sigma_weight",
556  fTree->Branch("g4rw_test_primary_plus_sigma_weight",
558  fTree->Branch("g4rw_test_primary_minus_sigma_weight",
560 
561  fTree->Branch("g4rw_full_primary_plus_sigma_weight",
563  fTree->Branch("g4rw_full_primary_minus_sigma_weight",
565  fTree->Branch("g4rw_set_weights", &g4rw_set_weights);
566 }
std::vector< std::string > g4rw_primary_var
std::vector< double > g4rw_full_primary_minus_sigma_weight
std::vector< double > g4rw_alt_primary_minus_sigma_weight
std::vector< double > g4rw_full_primary_plus_sigma_weight
std::vector< double > g4rw_primary_plus_sigma_weight
std::vector< double > g4rw_primary_minus_sigma_weight
std::vector< double > g4rw_test_primary_minus_sigma_weight
std::vector< std::string > true_beam_traj_procs
std::vector< double > g4rw_alt_primary_plus_sigma_weight
std::vector< double > g4rw_test_primary_plus_sigma_weight
Event finding and building.
G4RWExampleAnalyzer& protoana::G4RWExampleAnalyzer::operator= ( G4RWExampleAnalyzer const &  )
delete
G4RWExampleAnalyzer& protoana::G4RWExampleAnalyzer::operator= ( G4RWExampleAnalyzer &&  )
delete
void protoana::G4RWExampleAnalyzer::reset ( )

Definition at line 568 of file G4RWExampleAnalyzer_module.cc.

568  {
569  true_beam_PDG = -1;
570  true_beam_ID = -1;
571  true_beam_len = -1.;
572  true_beam_nTrajPts = -1;
573  true_beam_traj_dx.clear();
574  true_beam_traj_X.clear();
575  true_beam_traj_Y.clear();
576  true_beam_traj_Z.clear();
577  true_beam_traj_KE.clear();
578  true_beam_traj_procs.clear();
579  true_beam_traj_rx.clear();
580  true_beam_traj_ry.clear();
581  true_beam_traj_rz.clear();
582  true_beam_startP = -1.;
583  true_beam_startX = -1.;
584  true_beam_startY = -1.;
585  true_beam_startZ = -1.;
586  true_beam_endX = -1.;
587  true_beam_endY = -1.;
588  true_beam_endZ = -1.;
589  true_beam_endP = -1.;
597  true_beam_dEdX.clear();
598 
599  reco_beam_len.clear();
600  reco_beam_ID.clear();
601  reco_beam_nDaughters.clear();
602  reco_beam_startX.clear();
603  reco_beam_startY.clear();
604  reco_beam_startZ.clear();
605  reco_beam_endX.clear();
606  reco_beam_endY.clear();
607  reco_beam_endZ.clear();
608 
609  g4rw_primary_weights.clear();
613  g4rw_primary_var.clear();
620  g4rw_set_weights.clear();
621 }
std::vector< std::string > g4rw_primary_var
std::vector< double > g4rw_full_primary_minus_sigma_weight
std::vector< double > g4rw_alt_primary_minus_sigma_weight
std::vector< double > g4rw_full_primary_plus_sigma_weight
std::vector< double > g4rw_primary_plus_sigma_weight
std::vector< double > g4rw_primary_minus_sigma_weight
std::vector< double > g4rw_test_primary_minus_sigma_weight
std::vector< std::string > true_beam_traj_procs
std::vector< double > g4rw_alt_primary_plus_sigma_weight
std::vector< double > g4rw_test_primary_plus_sigma_weight

Member Data Documentation

int protoana::G4RWExampleAnalyzer::event
private

Definition at line 103 of file G4RWExampleAnalyzer_module.cc.

bool protoana::G4RWExampleAnalyzer::fDoFull
private

Definition at line 148 of file G4RWExampleAnalyzer_module.cc.

std::string protoana::G4RWExampleAnalyzer::fGeneratorTag
private

Definition at line 142 of file G4RWExampleAnalyzer_module.cc.

std::string protoana::G4RWExampleAnalyzer::fPFParticleTag
private

Definition at line 142 of file G4RWExampleAnalyzer_module.cc.

TFile* protoana::G4RWExampleAnalyzer::FracsFile
private

Definition at line 138 of file G4RWExampleAnalyzer_module.cc.

std::string protoana::G4RWExampleAnalyzer::fTrackerTag
private

Definition at line 142 of file G4RWExampleAnalyzer_module.cc.

TTree* protoana::G4RWExampleAnalyzer::fTree
private

Definition at line 102 of file G4RWExampleAnalyzer_module.cc.

std::vector<double> protoana::G4RWExampleAnalyzer::g4rw_alt_primary_minus_sigma_weight
private

Definition at line 129 of file G4RWExampleAnalyzer_module.cc.

std::vector<double> protoana::G4RWExampleAnalyzer::g4rw_alt_primary_plus_sigma_weight
private

Definition at line 128 of file G4RWExampleAnalyzer_module.cc.

std::vector<double> protoana::G4RWExampleAnalyzer::g4rw_full_primary_minus_sigma_weight
private

Definition at line 133 of file G4RWExampleAnalyzer_module.cc.

std::vector<double> protoana::G4RWExampleAnalyzer::g4rw_full_primary_plus_sigma_weight
private

Definition at line 132 of file G4RWExampleAnalyzer_module.cc.

std::vector<double> protoana::G4RWExampleAnalyzer::g4rw_primary_minus_sigma_weight
private

Definition at line 125 of file G4RWExampleAnalyzer_module.cc.

std::vector<double> protoana::G4RWExampleAnalyzer::g4rw_primary_plus_sigma_weight
private

Definition at line 124 of file G4RWExampleAnalyzer_module.cc.

double protoana::G4RWExampleAnalyzer::g4rw_primary_singular_weight
private

Definition at line 134 of file G4RWExampleAnalyzer_module.cc.

std::vector<std::string> protoana::G4RWExampleAnalyzer::g4rw_primary_var
private

Definition at line 127 of file G4RWExampleAnalyzer_module.cc.

std::vector<double> protoana::G4RWExampleAnalyzer::g4rw_primary_weights
private

Definition at line 126 of file G4RWExampleAnalyzer_module.cc.

std::vector<double> protoana::G4RWExampleAnalyzer::g4rw_set_weights
private

Definition at line 135 of file G4RWExampleAnalyzer_module.cc.

std::vector<double> protoana::G4RWExampleAnalyzer::g4rw_test_primary_minus_sigma_weight
private

Definition at line 131 of file G4RWExampleAnalyzer_module.cc.

std::vector<double> protoana::G4RWExampleAnalyzer::g4rw_test_primary_plus_sigma_weight
private

Definition at line 130 of file G4RWExampleAnalyzer_module.cc.

G4MultiReweighter* protoana::G4RWExampleAnalyzer::MultiRW
private

Definition at line 140 of file G4RWExampleAnalyzer_module.cc.

G4ReweightParameterMaker protoana::G4RWExampleAnalyzer::ParMaker
private

Definition at line 146 of file G4RWExampleAnalyzer_module.cc.

std::vector<fhicl::ParameterSet> protoana::G4RWExampleAnalyzer::ParSet
private

Definition at line 145 of file G4RWExampleAnalyzer_module.cc.

TFile protoana::G4RWExampleAnalyzer::ProtFracsFile
private

Definition at line 139 of file G4RWExampleAnalyzer_module.cc.

std::vector<double> protoana::G4RWExampleAnalyzer::reco_beam_endX
private

Definition at line 115 of file G4RWExampleAnalyzer_module.cc.

std::vector<double> protoana::G4RWExampleAnalyzer::reco_beam_endY
private

Definition at line 115 of file G4RWExampleAnalyzer_module.cc.

std::vector<double> protoana::G4RWExampleAnalyzer::reco_beam_endZ
private

Definition at line 115 of file G4RWExampleAnalyzer_module.cc.

std::vector<int> protoana::G4RWExampleAnalyzer::reco_beam_ID
private

Definition at line 118 of file G4RWExampleAnalyzer_module.cc.

std::vector<double> protoana::G4RWExampleAnalyzer::reco_beam_len
private

Definition at line 115 of file G4RWExampleAnalyzer_module.cc.

std::vector<int> protoana::G4RWExampleAnalyzer::reco_beam_nDaughters
private

Definition at line 118 of file G4RWExampleAnalyzer_module.cc.

std::vector<double> protoana::G4RWExampleAnalyzer::reco_beam_startX
private

Definition at line 115 of file G4RWExampleAnalyzer_module.cc.

std::vector<double> protoana::G4RWExampleAnalyzer::reco_beam_startY
private

Definition at line 115 of file G4RWExampleAnalyzer_module.cc.

std::vector<double> protoana::G4RWExampleAnalyzer::reco_beam_startZ
private

Definition at line 115 of file G4RWExampleAnalyzer_module.cc.

int protoana::G4RWExampleAnalyzer::run
private

Definition at line 103 of file G4RWExampleAnalyzer_module.cc.

int protoana::G4RWExampleAnalyzer::RW_PDG
private

Definition at line 144 of file G4RWExampleAnalyzer_module.cc.

G4ReweightManager protoana::G4RWExampleAnalyzer::RWManager
private

Definition at line 147 of file G4RWExampleAnalyzer_module.cc.

int protoana::G4RWExampleAnalyzer::subrun
private

Definition at line 103 of file G4RWExampleAnalyzer_module.cc.

std::vector<double> protoana::G4RWExampleAnalyzer::true_beam_dEdX
private

Definition at line 114 of file G4RWExampleAnalyzer_module.cc.

double protoana::G4RWExampleAnalyzer::true_beam_endP
private

Definition at line 106 of file G4RWExampleAnalyzer_module.cc.

std::string protoana::G4RWExampleAnalyzer::true_beam_endProcess
private

Definition at line 122 of file G4RWExampleAnalyzer_module.cc.

double protoana::G4RWExampleAnalyzer::true_beam_endX
private

Definition at line 107 of file G4RWExampleAnalyzer_module.cc.

double protoana::G4RWExampleAnalyzer::true_beam_endY
private

Definition at line 107 of file G4RWExampleAnalyzer_module.cc.

double protoana::G4RWExampleAnalyzer::true_beam_endZ
private

Definition at line 107 of file G4RWExampleAnalyzer_module.cc.

int protoana::G4RWExampleAnalyzer::true_beam_ID
private

Definition at line 105 of file G4RWExampleAnalyzer_module.cc.

double protoana::G4RWExampleAnalyzer::true_beam_len
private

Definition at line 106 of file G4RWExampleAnalyzer_module.cc.

int protoana::G4RWExampleAnalyzer::true_beam_nElasticScatters
private

Definition at line 123 of file G4RWExampleAnalyzer_module.cc.

int protoana::G4RWExampleAnalyzer::true_beam_nNeutron_daughter
private

Definition at line 119 of file G4RWExampleAnalyzer_module.cc.

int protoana::G4RWExampleAnalyzer::true_beam_nPi0_daughter
private

Definition at line 119 of file G4RWExampleAnalyzer_module.cc.

int protoana::G4RWExampleAnalyzer::true_beam_nPiMinus_daughter
private

Definition at line 119 of file G4RWExampleAnalyzer_module.cc.

int protoana::G4RWExampleAnalyzer::true_beam_nPiPlus_daughter
private

Definition at line 119 of file G4RWExampleAnalyzer_module.cc.

int protoana::G4RWExampleAnalyzer::true_beam_nProton_daughter
private

Definition at line 119 of file G4RWExampleAnalyzer_module.cc.

int protoana::G4RWExampleAnalyzer::true_beam_nTrajPts
private

Definition at line 109 of file G4RWExampleAnalyzer_module.cc.

int protoana::G4RWExampleAnalyzer::true_beam_PDG
private

Definition at line 104 of file G4RWExampleAnalyzer_module.cc.

double protoana::G4RWExampleAnalyzer::true_beam_startP
private

Definition at line 106 of file G4RWExampleAnalyzer_module.cc.

double protoana::G4RWExampleAnalyzer::true_beam_startX
private

Definition at line 107 of file G4RWExampleAnalyzer_module.cc.

double protoana::G4RWExampleAnalyzer::true_beam_startY
private

Definition at line 107 of file G4RWExampleAnalyzer_module.cc.

double protoana::G4RWExampleAnalyzer::true_beam_startZ
private

Definition at line 107 of file G4RWExampleAnalyzer_module.cc.

std::vector<double> protoana::G4RWExampleAnalyzer::true_beam_traj_dx
private

Definition at line 110 of file G4RWExampleAnalyzer_module.cc.

std::vector<double> protoana::G4RWExampleAnalyzer::true_beam_traj_KE
private

Definition at line 110 of file G4RWExampleAnalyzer_module.cc.

std::vector<std::string> protoana::G4RWExampleAnalyzer::true_beam_traj_procs
private

Definition at line 113 of file G4RWExampleAnalyzer_module.cc.

std::vector<double> protoana::G4RWExampleAnalyzer::true_beam_traj_rx
private

Definition at line 110 of file G4RWExampleAnalyzer_module.cc.

std::vector<double> protoana::G4RWExampleAnalyzer::true_beam_traj_ry
private

Definition at line 110 of file G4RWExampleAnalyzer_module.cc.

std::vector<double> protoana::G4RWExampleAnalyzer::true_beam_traj_rz
private

Definition at line 110 of file G4RWExampleAnalyzer_module.cc.

std::vector<double> protoana::G4RWExampleAnalyzer::true_beam_traj_X
private

Definition at line 110 of file G4RWExampleAnalyzer_module.cc.

std::vector<double> protoana::G4RWExampleAnalyzer::true_beam_traj_Y
private

Definition at line 110 of file G4RWExampleAnalyzer_module.cc.

std::vector<double> protoana::G4RWExampleAnalyzer::true_beam_traj_Z
private

Definition at line 110 of file G4RWExampleAnalyzer_module.cc.


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