Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
ncid::NCNNKeras Class Reference
Inheritance diagram for ncid::NCNNKeras:
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

 NCNNKeras (fhicl::ParameterSet const &p)
 
 ~NCNNKeras ()
 
void beginJob () override
 
void beginRun (art::Run &evt) override
 
void reconfigure (const fhicl::ParameterSet &pset)
 
void produce (art::Event &e) override
 
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 Member Functions

double TransMomFraction (const std::vector< art::Ptr< rb::Prong > > &prongs) const
 Return transverse momentum fraction of the event. Calculation based on reconstructed prongs. More...
 

Private Attributes

std::string fSliceLabel
 
std::string fVertexLabel
 
std::string fProngLabel
 
std::string fProngInstance
 
std::string fCVNLabel
 
std::string fShowerLIDLabel
 
std::string fShowerLabel
 
std::string fCosmicTrackLabel
 
std::string fMCTruthModuleLabel
 
std::string fPIDLibPath
 
std::string fNCKerasFile
 
keras::KerasModelkeras_5nn
 
TTree * fTree
 
float cosmicid
 
float shwGap
 
float shwnhit
 
float shwnhitx
 
float shwnhity
 
float shwwwidth
 
float shwcalE
 
float partptp
 
float shwdirY
 
float shwlen
 
float shwxminusy
 
float shwxplusy
 
float shwxovery
 
float nmiphit
 
float nshwlid
 
float kerasValue
 
fhicl::ParameterSet fParticleIDAlgPSet
 Particle ID alorithm (loglikelihoods and dE/dx) More...
 

Detailed Description

Definition at line 61 of file NCNNKeras_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

ncid::NCNNKeras::NCNNKeras ( fhicl::ParameterSet const &  p)
explicit

Definition at line 121 of file NCNNKeras_module.cc.

References reconfigure().

121  :
122  fMCTruthModuleLabel(p.get<std::string>("MCTruthModuleLabel")),
123  //fParticleIDAlg(0),
124  fParticleIDAlgPSet(p.get<fhicl::ParameterSet>("ParticleIDAlgPSet"))
125  {
126  produces< std::vector<ncid::NCKeras> > ();
127  produces< art::Assns<ncid::NCKeras, rb::Cluster> > ();
128  this->reconfigure(p);
129  }
fhicl::ParameterSet fParticleIDAlgPSet
Particle ID alorithm (loglikelihoods and dE/dx)
std::string fMCTruthModuleLabel
const char * p
Definition: xmltok.h:285
void reconfigure(const fhicl::ParameterSet &pset)
enum BeamMode string
ncid::NCNNKeras::~NCNNKeras ( )

Definition at line 132 of file NCNNKeras_module.cc.

133  {
134  }

Member Function Documentation

void ncid::NCNNKeras::beginJob ( )
overridevirtual

Reimplemented from art::EDProducer.

Definition at line 137 of file NCNNKeras_module.cc.

References cosmicid, fTree, kerasValue, art::TFileDirectory::make(), nmiphit, nshwlid, partptp, shwcalE, shwdirY, shwGap, shwlen, shwnhit, shwnhitx, shwnhity, shwwwidth, shwxminusy, shwxovery, and shwxplusy.

138  {
140  fTree = tfs->make<TTree>("Testtree", "Testtree");
141 
142  fTree->Branch("cosmicid", &cosmicid, "cosmicid/F");
143  fTree->Branch("shwGap", &shwGap, "shwGap/F");
144  fTree->Branch("shwnhit", &shwnhit, "shwnhit/F");
145  fTree->Branch("shwnhitx", &shwnhitx, "shwnhitx/F");
146  fTree->Branch("shwnhity", &shwnhity, "shwnhity/F");
147  fTree->Branch("shwwwidth", &shwwwidth, "shwwwidth/F");
148  fTree->Branch("shwcalE", &shwcalE, "shwcalE/F");
149  fTree->Branch("partptp", &partptp, "partptp/F");
150  fTree->Branch("shwdirY", &shwdirY, "shwdirY/F");
151  fTree->Branch("shwlen", &shwlen, "shwlen/F");
152  fTree->Branch("shwxminusy", &shwxminusy, "shwxminusy/F");
153  fTree->Branch("shwxplusy", &shwxplusy, "shwxplusy/F");
154  fTree->Branch("shwxovery", &shwxovery, "shwxovery/F");
155  fTree->Branch("nmiphit", &nmiphit, "nmiphit/F");
156  fTree->Branch("nshwlid", &nshwlid, "nshwlid/F");
157  fTree->Branch("kerasValue", &kerasValue, "kerasValue/F");
158  }
T * make(ARGS...args) const
void ncid::NCNNKeras::beginRun ( art::Run evt)
overridevirtual

Reimplemented from art::EDProducer.

Definition at line 161 of file NCNNKeras_module.cc.

References allTimeWatchdog::endl, util::EnvExpansion(), cet::file_exists(), fNCKerasFile, fPIDLibPath, keras_5nn, and string.

162  {
164  // Make sure we can find the Neural Networks weight file
165  if(!cet::file_exists(pidlibpath + fNCKerasFile)){
166  throw cet::exception("NCKeras")
167  << "Couldn't find file " << pidlibpath + fNCKerasFile <<std::endl;
168  }
169  keras_5nn = new keras::KerasModel(pidlibpath + fNCKerasFile, false);
170  }
std::string fNCKerasFile
std::string fPIDLibPath
std::string EnvExpansion(const std::string &inString)
Function to expand environment variables.
Definition: EnvExpand.cxx:8
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
keras::KerasModel * keras_5nn
bool file_exists(std::string const &qualified_filename)
enum BeamMode string
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 ncid::NCNNKeras::produce ( art::Event e)
overridevirtual

Implements art::EDProducer.

Definition at line 188 of file NCNNKeras_module.cc.

References simb::MCNeutrino::CCNC(), slid::CompareByEnergy(), keras::KerasModel::compute_output(), cosmicid, util::CreateAssn(), allTimeWatchdog::endl, fCVNLabel, art::fill_ptr_vector(), check_time_usage::float, fMCTruthModuleLabel, fProngInstance, fProngLabel, fShowerLIDLabel, fSliceLabel, fTree, geom(), art::DataViewImpl::getByLabel(), simb::MCTruth::GetNeutrino(), rb::Cluster::IsNoise(), keras_5nn, kerasValue, simb::kNC, rb::Cluster::NCell(), simb::MCTruth::NeutrinoSet(), nmiphit, nshwlid, partptp, ncid::NCKeras::ProngTransMom(), art::Event::put(), keras::DataChunk::set_data(), ncid::NCKeras::SetCosPIDKeras(), ncid::NCKeras::SetProngTransMom(), shwcalE, shwdirY, shwGap, shwlen, shwnhit, shwnhitx, shwnhity, shwwwidth, shwxminusy, shwxovery, shwxplusy, cheat::BackTracker::SliceToMCTruth(), TransMomFraction(), and registry_explorer::v.

189  {
190 
191  bool isMCTruthListEmpty = false;
193  try {
194  evt.getByLabel(fMCTruthModuleLabel, mclist);
195  if(mclist->empty()) { isMCTruthListEmpty = true; }
196  }
197  catch(...) { isMCTruthListEmpty = true; }
198  if(isMCTruthListEmpty){
199  mf::LogError("MCTruth Error") << "Error retrieving MCTruth list." << std::endl;
200  return;
201  }
202 
205 
206  std::unique_ptr< std::vector<ncid::NCKeras> >
207  ncCosKeras(new std::vector<ncid::NCKeras>);
208  std::unique_ptr< art::Assns<ncid::NCKeras, rb::Cluster> >
210 
211  // Get the slices in the event
213  evt.getByLabel(fSliceLabel, sliceHandle);
214  std::vector<art::Ptr<rb::Cluster> > slices;
215  art::fill_ptr_vector(slices, sliceHandle);
216 
217  // Get things associated with slices
219  art::FindMany<slid::ShowerLID> showerLidAssn(sliceHandle, evt, fShowerLIDLabel);
220 
221  const int nslices = slices.size();
222  for(int isli = 0; isli < nslices; ++isli){
223 
224  std::vector<cheat::NeutrinoEffPur> SlicePurr = bt->SliceToMCTruth(slices[isli]->AllCells(), slices[isli]->AllCells());
225 
226  if(SlicePurr.size() == 0) continue;
227 
228  const art::Ptr<simb::MCTruth> &SliceTruth = SlicePurr[0].neutrinoInt;
229  if(!SliceTruth->NeutrinoSet()) continue;
230  const simb::MCNeutrino& nu = SliceTruth->GetNeutrino();
231  art::Ptr<rb::Cluster> thisSlice = slices.at(isli);
232 
233  if(thisSlice->IsNoise()) continue;
234  if(!prongAssn.isValid()) continue;
235 
236  int intCurrent = nu.CCNC();
237 
238  if(intCurrent != simb::kNC) continue; // select only CC
239 
240  ncid::NCKeras nckeras;
241  std::vector< art::Ptr<rb::Prong> > prongs = prongAssn.at(isli);
242  if(prongs.empty()) continue;
243 
244  nckeras.SetProngTransMom(TransMomFraction(prongs));
245 
246  art::FindManyP<cvn::Result> fmCVN(slices, evt, fCVNLabel);
247  if(!fmCVN.isValid()) continue; // CVN Validation
248  std::vector< art::Ptr<cvn::Result> > cvns = fmCVN.at(isli);
249  cosmicid = -5.; // CVN values
250  if(!cvns.empty()) cosmicid = cvns[0]->fOutput[14];
251  shwGap = -5.; // LIDShower values
252  shwnhit = -5.;
253  shwnhitx = -5.;
254  shwnhity = -5.;
255  shwwwidth = -5.;
256  shwcalE = -5.;
257  partptp = nckeras.ProngTransMom();
258  shwdirY = -5.;
259  shwlen = -5.;
260  kerasValue = -5.;
261 
262  if(!showerLidAssn.isValid()) continue; // showerLidAssn Validation
263 
264  std::vector<const slid::ShowerLID*> shwlids = showerLidAssn.at(isli);
265  if(shwlids.empty()) continue;
266 
267  sort(shwlids.begin(), shwlids.end(), slid::CompareByEnergy);
269  nshwlid = shwlids.size();
270 
271  cet::maybe_ref< art::Ptr<rb::Shower> const > roSh(foSh.at(0));
272  art::Ptr<rb::Shower> shower = roSh.ref();
273  std::vector< art::Ptr<rb::Shower> > showers;
274  showers.push_back(shower);
276  if(!foShLID.isValid()) continue; // foShLID validation
277 
278  cet::maybe_ref< art::Ptr<slid::ShowerLID> const > roShLID(foShLID.at(0));
279  art::Ptr<slid::ShowerLID> showerLID = roShLID.ref();
280  shwGap = showerLID->Gap();
281  shwnhit = shower->NCell();
282  shwwwidth = showerLID->Radius();
283  shwcalE = showerLID->ShowerEnergy();
284  shwnhitx = shower->NXCell();
285  shwdirY = (float)shower->Dir().Y();
286  shwnhity = shower->NYCell();
287  shwlen = shower->TotalLength();
291  nmiphit = thisSlice->NCell();
292 
293  // Keras model
294  keras::DataChunk *sample = new keras::DataChunkFlat();
295  float myfloats[] = {partptp,
296  cosmicid,
297  nmiphit,
298  shwcalE,
299  shwnhit,
300  nshwlid,
301  shwnhitx,
302  shwnhity,
303  shwxminusy,
304  shwxplusy,
305  shwxovery,
306  shwdirY,
307  shwlen,
308  shwwwidth,
309  shwGap};
310 
311  std::vector<float> v (myfloats, myfloats + sizeof(myfloats) / sizeof(float));
312  sample->set_data(v);
313  kerasValue = keras_5nn->compute_output(sample)[0];
314 
315  nckeras.SetCosPIDKeras(kerasValue);
316 
317  delete sample;
318  ncCosKeras->push_back(nckeras);
319 
320  util::CreateAssn(*this, evt, *ncCosKeras, thisSlice ,*sliceAssn);
321  fTree->Fill();
322  } // end loop over slices
323  evt.put(std::move(sliceAssn));
324  evt.put(std::move(ncCosKeras));
325  } // end of producer
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.
int CCNC() const
Definition: MCNeutrino.h:148
unsigned int NCell(geo::View_t view) const
Number of cells in view view.
Definition: Cluster.cxx:134
const simb::MCNeutrino & GetNeutrino() const
Definition: MCTruth.h:76
std::string fMCTruthModuleLabel
std::string fProngLabel
void SetCosPIDKeras(double input)
Definition: NCKeras.h:28
std::string fCVNLabel
virtual void set_data(std::vector< std::vector< std::vector< float > > > const &)
Definition: KerasModel.h:38
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
double ProngTransMom() const
Transverse component of the energy-weighted average of prong directions.
Definition: NCKeras.h:20
std::vector< float > compute_output(keras::DataChunk *dc)
Definition: KerasModel.cxx:354
bool CompareByEnergy(const slid::ShowerLID *a, const slid::ShowerLID *b)
Definition: ShowerLID.cxx:51
std::string fProngInstance
std::string fShowerLIDLabel
double TransMomFraction(const std::vector< art::Ptr< rb::Prong > > &prongs) const
Return transverse momentum fraction of the event. Calculation based on reconstructed prongs...
int evt
keras::KerasModel * keras_5nn
void geom(int which=0)
Definition: geom.C:163
void SetProngTransMom(double input)
Definition: NCKeras.h:25
std::string fSliceLabel
bool NeutrinoSet() const
Definition: MCTruth.h:77
bool IsNoise() const
Is the noise flag set?
Definition: Cluster.h:163
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:464
Event generator information.
Definition: MCNeutrino.h:18
std::vector< NeutrinoEffPur > SliceToMCTruth(const std::vector< const rb::CellHit * > &sliceHits, const std::vector< const rb::CellHit * > &allHits, bool sortPur=false) const
Given a collection of hits (often a slice), returns vector of structures of MCTruth, efficiency, and purity of that neutrino interaction relative to the slice. Efficiency is defined as FLS energy from neutrino interaction in slice / total FLS energy from neutrino interaction in event. This vector is sorted from the highest efficiency interaction to lowest. This function returns all MCTruth, including those without neutrino interactions, i.e. cosmics.
void ncid::NCNNKeras::reconfigure ( const fhicl::ParameterSet pset)

Definition at line 173 of file NCNNKeras_module.cc.

References fCVNLabel, fMCTruthModuleLabel, fNCKerasFile, fParticleIDAlgPSet, fPIDLibPath, fProngInstance, fProngLabel, fShowerLabel, fShowerLIDLabel, fSliceLabel, fhicl::ParameterSet::get(), and string.

Referenced by NCNNKeras().

174  {
175  fMCTruthModuleLabel = p.get< std::string >("MCTruthModuleLabel");
176  fSliceLabel = p.get< std::string >("SliceLabel");
177  fProngLabel = p.get< std::string >("ProngLabel");
178  fProngInstance = p.get< std::string >("ProngInstance");
179  fCVNLabel = p.get< std::string >("CVNLabel");
180  fShowerLabel = p.get< std::string >("ShowerLabel");
181  fShowerLIDLabel = p.get< std::string >("ShowerLIDLabel");
182  fPIDLibPath = p.get< std::string >("PIDLibPath");
183  fNCKerasFile = p.get< std::string >("NCKerasFile");
184  fParticleIDAlgPSet = p.get< fhicl::ParameterSet >("ParticleIDAlgPSet");
185  }
fhicl::ParameterSet fParticleIDAlgPSet
Particle ID alorithm (loglikelihoods and dE/dx)
std::string fNCKerasFile
std::string fPIDLibPath
std::string fMCTruthModuleLabel
std::string fProngLabel
const char * p
Definition: xmltok.h:285
std::string fCVNLabel
std::string fShowerLabel
std::string fProngInstance
std::string fShowerLIDLabel
T get(std::string const &key) const
Definition: ParameterSet.h:231
std::string fSliceLabel
enum BeamMode string
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

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

double ncid::NCNNKeras::TransMomFraction ( const std::vector< art::Ptr< rb::Prong > > &  prongs) const
private

Return transverse momentum fraction of the event. Calculation based on reconstructed prongs.

Definition at line 328 of file NCNNKeras_module.cc.

References a, b, rb::Cluster::CalorimetricEnergy(), ncid::CompareByCalEnergy(), DEFINE_ART_MODULE(), geom(), geo::GeometryBase::NuMIBeamDirection(), runNovaSAM::ret, and w.

Referenced by produce().

329  {
330  if(prongs.empty()) return 0.;
331 
332  TVector3 ret;
333  for(const art::Ptr<rb::Prong>& prong: prongs){
334  if(!prong->Is3D()) continue;
335  const double w = prong->CalorimetricEnergy();
336  ret += w*prong->Dir();
337  }
338 
339  ret = ret.Unit();
340 
342  const TVector3 beamDir = geom->NuMIBeamDirection();
343  const double beamProj = ret.Dot(beamDir);
344 
345  return (ret-beamProj*beamDir).Mag();
346  }
TVector3 NuMIBeamDirection() const
Direction of neutrinos from the NuMI beam (unit vector)
void geom(int which=0)
Definition: geom.C:163
Float_t w
Definition: plot.C:20
Definition: fwd.h:28
void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited

Member Data Documentation

float ncid::NCNNKeras::cosmicid
private

Definition at line 90 of file NCNNKeras_module.cc.

Referenced by beginJob(), and produce().

std::string ncid::NCNNKeras::fCosmicTrackLabel
private

Definition at line 82 of file NCNNKeras_module.cc.

std::string ncid::NCNNKeras::fCVNLabel
private

Definition at line 79 of file NCNNKeras_module.cc.

Referenced by produce(), and reconfigure().

std::string ncid::NCNNKeras::fMCTruthModuleLabel
private

Definition at line 83 of file NCNNKeras_module.cc.

Referenced by produce(), and reconfigure().

std::string ncid::NCNNKeras::fNCKerasFile
private

Definition at line 85 of file NCNNKeras_module.cc.

Referenced by beginRun(), and reconfigure().

fhicl::ParameterSet ncid::NCNNKeras::fParticleIDAlgPSet
private

Particle ID alorithm (loglikelihoods and dE/dx)

FCL parameters for particle ID alorithm (loglikelihoods and dE/dx)

Definition at line 110 of file NCNNKeras_module.cc.

Referenced by reconfigure().

std::string ncid::NCNNKeras::fPIDLibPath
private

Definition at line 84 of file NCNNKeras_module.cc.

Referenced by beginRun(), and reconfigure().

std::string ncid::NCNNKeras::fProngInstance
private

Definition at line 78 of file NCNNKeras_module.cc.

Referenced by produce(), and reconfigure().

std::string ncid::NCNNKeras::fProngLabel
private

Definition at line 77 of file NCNNKeras_module.cc.

Referenced by produce(), and reconfigure().

std::string ncid::NCNNKeras::fShowerLabel
private

Definition at line 81 of file NCNNKeras_module.cc.

Referenced by reconfigure().

std::string ncid::NCNNKeras::fShowerLIDLabel
private

Definition at line 80 of file NCNNKeras_module.cc.

Referenced by produce(), and reconfigure().

std::string ncid::NCNNKeras::fSliceLabel
private

Definition at line 75 of file NCNNKeras_module.cc.

Referenced by produce(), and reconfigure().

TTree* ncid::NCNNKeras::fTree
private

Definition at line 88 of file NCNNKeras_module.cc.

Referenced by beginJob(), and produce().

std::string ncid::NCNNKeras::fVertexLabel
private

Definition at line 76 of file NCNNKeras_module.cc.

keras::KerasModel* ncid::NCNNKeras::keras_5nn
private

Definition at line 87 of file NCNNKeras_module.cc.

Referenced by beginRun(), and produce().

float ncid::NCNNKeras::kerasValue
private

Definition at line 105 of file NCNNKeras_module.cc.

Referenced by beginJob(), and produce().

float ncid::NCNNKeras::nmiphit
private

Definition at line 103 of file NCNNKeras_module.cc.

Referenced by beginJob(), and produce().

float ncid::NCNNKeras::nshwlid
private

Definition at line 104 of file NCNNKeras_module.cc.

Referenced by beginJob(), and produce().

float ncid::NCNNKeras::partptp
private

Definition at line 97 of file NCNNKeras_module.cc.

Referenced by beginJob(), and produce().

float ncid::NCNNKeras::shwcalE
private

Definition at line 96 of file NCNNKeras_module.cc.

Referenced by beginJob(), and produce().

float ncid::NCNNKeras::shwdirY
private

Definition at line 98 of file NCNNKeras_module.cc.

Referenced by beginJob(), and produce().

float ncid::NCNNKeras::shwGap
private

Definition at line 91 of file NCNNKeras_module.cc.

Referenced by beginJob(), and produce().

float ncid::NCNNKeras::shwlen
private

Definition at line 99 of file NCNNKeras_module.cc.

Referenced by beginJob(), and produce().

float ncid::NCNNKeras::shwnhit
private

Definition at line 92 of file NCNNKeras_module.cc.

Referenced by beginJob(), and produce().

float ncid::NCNNKeras::shwnhitx
private

Definition at line 93 of file NCNNKeras_module.cc.

Referenced by beginJob(), and produce().

float ncid::NCNNKeras::shwnhity
private

Definition at line 94 of file NCNNKeras_module.cc.

Referenced by beginJob(), and produce().

float ncid::NCNNKeras::shwwwidth
private

Definition at line 95 of file NCNNKeras_module.cc.

Referenced by beginJob(), and produce().

float ncid::NCNNKeras::shwxminusy
private

Definition at line 100 of file NCNNKeras_module.cc.

Referenced by beginJob(), and produce().

float ncid::NCNNKeras::shwxovery
private

Definition at line 102 of file NCNNKeras_module.cc.

Referenced by beginJob(), and produce().

float ncid::NCNNKeras::shwxplusy
private

Definition at line 101 of file NCNNKeras_module.cc.

Referenced by beginJob(), and produce().


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