Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | List of all members
cheat::TrueEnergy Class Reference
Inheritance diagram for cheat::TrueEnergy:
art::EDProducer art::ProducerBase art::Consumer art::EngineCreator art::ProductRegistryHelper

Public Types

using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
template<typename UserConfig , typename KeysToIgnore = void>
using Table = ProducerBase::Table< UserConfig, KeysToIgnore >
 

Public Member Functions

 TrueEnergy (fhicl::ParameterSet const &pset)
 
virtual ~TrueEnergy ()
 
void produce (art::Event &evt)
 
void reconfigure (fhicl::ParameterSet const &pset)
 
template<typename PROD , BranchType B = InEvent>
ProductID getProductID (std::string const &instanceName={}) const
 
template<typename PROD , BranchType B>
ProductID getProductID (ModuleDescription const &moduleDescription, std::string const &instanceName) const
 
bool modifiesEvent () const
 
template<typename T , BranchType = InEvent>
ProductToken< Tconsumes (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< Tconsumes (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TconsumesView (InputTag const &it)
 
template<typename T , BranchType = InEvent>
ProductToken< TmayConsume (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< TmayConsume (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TmayConsumeView (InputTag const &it)
 
base_engine_tcreateEngine (seed_t seed)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make, label_t const &engine_label)
 
seed_t get_seed_value (fhicl::ParameterSet const &pset, char const key[]="seed", seed_t const implicit_seed=-1)
 

Static Public Member Functions

static cet::exempt_ptr< Consumernon_module_context ()
 

Protected Member Functions

CurrentProcessingContext const * currentContext () const
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

Private Attributes

std::string fGeantLabel
 label for module running G4 and making particles, etc More...
 
bool fHeavyDebug
 Boolean flag for whether you want heavy debugging info. More...
 
int fNumWarnings
 The number of warnings I have sent to the screen. More...
 

Detailed Description

Definition at line 31 of file TrueEnergy_module.cc.

Member Typedef Documentation

using art::EDProducer::ModuleType = EDProducer
inherited

Definition at line 34 of file EDProducer.h.

template<typename UserConfig , typename KeysToIgnore = void>
using art::EDProducer::Table = ProducerBase::Table<UserConfig, KeysToIgnore>
inherited

Definition at line 43 of file EDProducer.h.

using art::EDProducer::WorkerType = WorkerT<EDProducer>
inherited

Definition at line 35 of file EDProducer.h.

Constructor & Destructor Documentation

cheat::TrueEnergy::TrueEnergy ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 51 of file TrueEnergy_module.cc.

References fNumWarnings, and reconfigure().

52  {
53  this->reconfigure(pset);
54 
55  produces< std::vector<sim::TrueEnergy> >();
56  produces< art::Assns<sim::TrueEnergy, sim::Particle> >();
57 
58  // Set the number of warning I've sent to the screen to 0.
59  fNumWarnings = 0;
60  }
int fNumWarnings
The number of warnings I have sent to the screen.
void reconfigure(fhicl::ParameterSet const &pset)
cheat::TrueEnergy::~TrueEnergy ( )
virtual

Definition at line 63 of file TrueEnergy_module.cc.

64  {
65  }

Member Function Documentation

template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::consumes ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::consumes ( InputTag const &  it)
inherited

Definition at line 146 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

147 {
148  if (!moduleContext_)
149  return ProductToken<T>::invalid();
150 
151  consumables_[BT].emplace_back(ConsumableType::Product,
152  TypeID{typeid(T)},
153  it.label(),
154  it.instance(),
155  it.process());
156  return ProductToken<T>{it};
157 }
set< int >::iterator it
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename T , art::BranchType BT>
void art::Consumer::consumesMany ( )
inherited

Definition at line 161 of file Consumer.h.

References T.

162 {
163  if (!moduleContext_)
164  return;
165 
166  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
167 }
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::consumesView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::consumesView ( InputTag const &  it)
inherited

Definition at line 171 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

172 {
173  if (!moduleContext_)
174  return ViewToken<T>::invalid();
175 
176  consumables_[BT].emplace_back(ConsumableType::ViewElement,
177  TypeID{typeid(T)},
178  it.label(),
179  it.instance(),
180  it.process());
181  return ViewToken<T>{it};
182 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed)
inherited
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make 
)
inherited
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make,
label_t const &  engine_label 
)
inherited
CurrentProcessingContext const* art::EDProducer::currentContext ( ) const
protectedinherited
seed_t art::EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited
template<typename PROD , BranchType B>
ProductID art::EDProducer::getProductID ( std::string const &  instanceName = {}) const
inlineinherited

Definition at line 123 of file EDProducer.h.

References art::EDProducer::moduleDescription_.

Referenced by skim::NueSkimmer::CopyMichelSlice(), and skim::NueSkimmer::CopyMichelTrack().

124  {
125  return ProducerBase::getProductID<PROD, B>(moduleDescription_,
126  instanceName);
127  }
ModuleDescription moduleDescription_
Definition: EDProducer.h:115
template<typename PROD , BranchType B>
ProductID art::ProducerBase::getProductID ( ModuleDescription const &  moduleDescription,
std::string const &  instanceName 
) const
inherited

Definition at line 56 of file ProducerBase.h.

References art::ModuleDescription::moduleLabel().

Referenced by art::ProducerBase::modifiesEvent().

58  {
59  auto const& pd =
60  get_ProductDescription<PROD>(B, md.moduleLabel(), instanceName);
61  return pd.productID();
62  }
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::mayConsume ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::mayConsume ( InputTag const &  it)
inherited

Definition at line 189 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

190 {
191  if (!moduleContext_)
192  return ProductToken<T>::invalid();
193 
194  consumables_[BT].emplace_back(ConsumableType::Product,
195  TypeID{typeid(T)},
196  it.label(),
197  it.instance(),
198  it.process());
199  return ProductToken<T>{it};
200 }
set< int >::iterator it
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename T , art::BranchType BT>
void art::Consumer::mayConsumeMany ( )
inherited

Definition at line 204 of file Consumer.h.

References T.

205 {
206  if (!moduleContext_)
207  return;
208 
209  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
210 }
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::mayConsumeView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::mayConsumeView ( InputTag const &  it)
inherited

Definition at line 214 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

215 {
216  if (!moduleContext_)
217  return ViewToken<T>::invalid();
218 
219  consumables_[BT].emplace_back(ConsumableType::ViewElement,
220  TypeID{typeid(T)},
221  it.label(),
222  it.instance(),
223  it.process());
224  return ViewToken<T>{it};
225 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
bool art::ProducerBase::modifiesEvent ( ) const
inlineinherited

Definition at line 40 of file ProducerBase.h.

References art::ProducerBase::getProductID(), and string.

41  {
42  return true;
43  }
static cet::exempt_ptr<Consumer> art::Consumer::non_module_context ( )
staticinherited
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
void cheat::TrueEnergy::produce ( art::Event evt)
virtual

Implements art::EDProducer.

Definition at line 76 of file TrueEnergy_module.cc.

References cheat::BackTracker::CalcTotalEscapingEnergy(), om::cout, util::CreateAssn(), DEFINE_ART_MODULE(), allTimeWatchdog::endl, fGeantLabel, fHeavyDebug, art::fill_ptr_vector(), fNumWarnings, art::DataViewImpl::getByLabel(), cheat::BackTracker::InterceptsDetector(), art::Event::isRealData(), and art::Event::put().

77  {
78  // --- Delcare my new vector, and its association.
79  std::unique_ptr<std::vector<sim::TrueEnergy> > trueens (new std::vector<sim::TrueEnergy>);
80  std::unique_ptr<art::Assns<sim::TrueEnergy, sim::Particle> > treassn (new art::Assns<sim::TrueEnergy, sim::Particle>);
81 
82  // --- Make a handle to BackTracker
84 
85  // --- Get my list of sim::Particle's out of the event
87  // --- Make a vector of the sim::Particles.
88  std::vector< art::Ptr<sim::Particle> > particles;
89  if ( evt.getByLabel(fGeantLabel, PartHand) ) {
90  art::fill_ptr_vector(particles, PartHand);
91  } else {
92  if (!evt.isRealData() && fNumWarnings < 10) {
93  std::cout << "TrueEnergy_module::I can't find any sim::Paritcle made by " << fGeantLabel << " in the event, fix the label!" << std::endl;
94  ++fNumWarnings;
95  }
96  evt.put(std::move(trueens));
97  evt.put(std::move(treassn));
98  return;
99  }
100 
101  for ( auto ThisPart : particles ) {
102 
103  if (fHeavyDebug)
104  std::cout << "\n\n**********************\nLooking at particle with TrackID " << ThisPart->TrackId() << ", it is a " << ThisPart->PdgCode() << ".\n" << std::endl;
105  // --- Get the information I need for this particular particle.
106  int This_Ent, This_Exit;
107  bool EntDetector = bt->InterceptsDetector( *ThisPart, This_Ent, This_Exit );
108  float This_EnterEn = 0;
109  float This_EscapEn = 0;
110  if ( EntDetector ) {
111  This_EnterEn = ThisPart->E( This_Ent ) - ThisPart->Mass();
112  if ( This_Exit != (int)(ThisPart->NumberTrajectoryPoints()-1) )
113  This_EscapEn = ThisPart->E( This_Exit ) - ThisPart->Mass();
114  }
115 
116  //std::cout << "\n ********** Worked out the deps from this particle, now work out daughter energies. **********\n" << std::endl;
117  // --- Now work out the deps including the particles daughers.
118  float TotalEnDep = 0.;
119  float TotalEscEn = bt->CalcTotalEscapingEnergy( *ThisPart, TotalEnDep, true );
120 
121  // --- Write out what I got from all of that....
122  if (fHeavyDebug) {
123  std::cout << "\n********** Finished, now what did I get? **********\n"
124  << "For TrackID " << ThisPart->TrackId() << ", PDG " << ThisPart->PdgCode() << ", Mother " << ThisPart->Mother() << ", had " << ThisPart->NumberDaughters() << " daughters.\n"
125  << "\t Using just this particle I got: EnteringEn " << This_EnterEn << ", EscapingEn " << This_EscapEn << ".\n"
126  << "\t Including the daughters I got : TotalDepEn was " << TotalEnDep << ", and the TotalEscEn was " << TotalEscEn << ".\n"
127  << std::endl;
128  }
129  // --- Now, make my association!!
130  // Make my sim::TrueEnergy
131  sim::TrueEnergy ThisEn( ThisPart->TrackId(), This_EnterEn, This_EscapEn, TotalEnDep, TotalEscEn );
132  (*trueens).push_back( ThisEn );
133  // Make the association.
134  util::CreateAssn(*this, evt, *trueens, ThisPart, *treassn);
135  } // Loop over sim::Particles
136 
137  evt.put(std::move(trueens));
138  evt.put(std::move(treassn));
139 
140  return;
141 
142  } // end produce
static bool CreateAssn(art::EDProducer const &prod, art::Event &evt, std::vector< T > &a, art::Ptr< U > b, art::Assns< T, U > &assn, size_t indx=UINT_MAX, std::string const &instance=std::string())
Create a 1 to 1 association between a new product and one already in the event.
bool InterceptsDetector(const sim::Particle &Par, int &TrajEnt, int &TrajEx)
A function which returns the trajectory point at which the particle first enters and leave the detect...
int fNumWarnings
The number of warnings I have sent to the screen.
bool isRealData() const
Definition: Event.h:83
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
std::string fGeantLabel
label for module running G4 and making particles, etc
OStream cout
Definition: OStream.cxx:6
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:464
bool fHeavyDebug
Boolean flag for whether you want heavy debugging info.
float CalcTotalEscapingEnergy(const sim::Particle &Par, bool UseMCPart=true, std::string G4Label="trueens")
An extension of CalcEscapingEnergy which also takes into account the energy which the daughters of gi...
void cheat::TrueEnergy::reconfigure ( fhicl::ParameterSet const &  pset)

Definition at line 68 of file TrueEnergy_module.cc.

References fGeantLabel, fHeavyDebug, fhicl::ParameterSet::get(), and string.

Referenced by TrueEnergy().

69  {
70  fGeantLabel = pset.get< std::string >("G4ModuleLabel");
71  fHeavyDebug = pset.get< bool >("HeavyDebug");
72  return;
73  }
std::string fGeantLabel
label for module running G4 and making particles, etc
bool fHeavyDebug
Boolean flag for whether you want heavy debugging info.
enum BeamMode string
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

Referenced by art::RootOutput::endJob().

void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited

Member Data Documentation

std::string cheat::TrueEnergy::fGeantLabel
private

label for module running G4 and making particles, etc

Definition at line 42 of file TrueEnergy_module.cc.

Referenced by produce(), and reconfigure().

bool cheat::TrueEnergy::fHeavyDebug
private

Boolean flag for whether you want heavy debugging info.

Definition at line 43 of file TrueEnergy_module.cc.

Referenced by produce(), and reconfigure().

int cheat::TrueEnergy::fNumWarnings
private

The number of warnings I have sent to the screen.

Definition at line 44 of file TrueEnergy_module.cc.

Referenced by produce(), and TrueEnergy().


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