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

Public Member Functions

 CheckMCParticle (fhicl::ParameterSet const &p)
 

Private Member Functions

void beginJob () override
 
void analyze (const art::Event &event) override
 

Private Attributes

std::string const _myName
 
TH1F * _hnParts {nullptr}
 

Detailed Description

Definition at line 34 of file CheckMCParticle_module.cc.

Constructor & Destructor Documentation

larg4::CheckMCParticle::CheckMCParticle ( fhicl::ParameterSet const &  p)
explicit

Definition at line 46 of file CheckMCParticle_module.cc.

46  :
47  art::EDAnalyzer(p),
48  _myName(p.get<std::string>("name", "CheckMCParticle"))
49 {}
pdgs p
Definition: selectors.fcl:22

Member Function Documentation

void larg4::CheckMCParticle::analyze ( const art::Event &  event)
overrideprivate

Definition at line 57 of file CheckMCParticle_module.cc.

58 {
59 #if defined _verbose_
60 
61  auto allDropped = event.getMany<std::map<int,std::set<int>>>();
62 
63  for (auto const& maps : allDropped ) {
64  for (auto const& element : *maps ) {
65  std::cout << "Parent of dropped Tracks: "<<element.first<< std::endl;
66  std::set<int> droppedset= element.second;
67  std::cout<< " droppedid size: "<< droppedset.size()<<std::endl;
68  for(auto const& droppedid : droppedset )
69  {
70  std::cout << droppedid << " ";
71  }
72  std::cout <<std::endl;
73  }
74  }
75 
76 #endif
77  auto allGens = event.getMany<std::vector<simb::MCParticle>>();
78  for (auto const& gens : allGens) {
79  _hnParts->Fill(gens->size());
80 #if defined _verbose_
81  for (auto const& genpart : *gens) {
82  if (genpart.Mother()==0) {
83  cout << "Primary momentum: " << genpart.P();
84  cout << " position: " << genpart.Vx()<< " "<< genpart.Vy()<<" "<< genpart.Vz() << endl;
85  }
86  cout << "Part id: " << genpart.TrackId();
87  cout << " PDG id: " << genpart.PdgCode();
88  cout << " Status Code: " << genpart.StatusCode();
89  cout << " Mother: " << genpart.Mother();
90  cout << " Creation Process: "<<genpart.Process();
91  cout << " End Process: "<<genpart.EndProcess();
92  /*
93  auto trajectory = genpart.Trajectory();
94  cout <<" trajectory size: " << trajectory.size();
95  */
96  cout <<" Nr. of Daughters: " << genpart.NumberDaughters();
97  cout <<" FirstDaughter:" << genpart.FirstDaughter()<<endl;
98  // cout <<" LastDaughter: " << genpart.LastDaughter() <<endl;
99  for (int i=0;i<genpart.NumberDaughters();i++)
100  {
101  cout << genpart.Daughter(i)<<",";
102  }
103  cout<<endl;
104  }
105 #endif
106  }
107 } // end analyze
BEGIN_PROLOG could also be cout
void larg4::CheckMCParticle::beginJob ( )
overrideprivate

Definition at line 51 of file CheckMCParticle_module.cc.

52 {
53  art::ServiceHandle<art::TFileService const> tfs;
54  _hnParts = tfs->make<TH1F>("hnParts", "Number of generated Particles", 100, 0., 2000.);
55 } // end beginJob
art::ServiceHandle< art::TFileService > tfs

Member Data Documentation

TH1F* larg4::CheckMCParticle::_hnParts {nullptr}
private

Definition at line 43 of file CheckMCParticle_module.cc.

std::string const larg4::CheckMCParticle::_myName
private

Definition at line 42 of file CheckMCParticle_module.cc.


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