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

 CVNNeutronProngTF (fhicl::ParameterSet const &pset)
 
virtual ~CVNNeutronProngTF ()
 
void produce (art::Event &evt)
 
tensorflow::Tensor vector_to_tensor (std::vector< unsigned char >)
 
tensorflow::Tensor vector_to_tensor (std::vector< unsigned char >, std::vector< unsigned char >)
 
tensorflow::TFHandlerGetModel2D (const art::Event &evt)
 
tensorflow::TFHandlerGetModel3D (const art::Event &evt)
 
void CalcResult (std::vector< art::Ptr< cvn::PixelMap > > pixelMaps, tensorflow::TFHandler *fTF, unsigned int NOutput, std::vector< std::pair< int, double >> &outputwithpdg, std::vector< float > &result, std::vector< unsigned char > pmslc)
 
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
 

Protected Attributes

std::string fSliceLabel
 
std::string fPixelMapInput
 
std::string fGeneratorLabel
 
bool fObeyPreselection
 
std::vector< std::stringfPreselectionLabels
 
bool fUseGeV
 
std::string fLibPath
 
std::string fProngModLabel
 
std::string fProng2DLabel
 
std::string fModel2DName
 
unsigned int fNOutput2D
 
std::string fProng3DLabel
 
std::string fModel3DName
 
unsigned int fNOutput3D
 
std::string fInputNameSlc
 
std::string fInputName
 
std::string fOutputName
 
unsigned int fCPUlimit
 
tensorflow::TFHandlerfTF2D
 
tensorflow::TFHandlerfTF3D
 

Detailed Description

Definition at line 39 of file CVNNeutronProngTF_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

cvnneutronprongtf::CVNNeutronProngTF::CVNNeutronProngTF ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 79 of file CVNNeutronProngTF_module.cc.

References util::EnvExpansion(), and fLibPath.

79  :
80  fSliceLabel (pset.get<std::string>("SliceLabel")),
81  fPixelMapInput(pset.get<std::string>("PixelMapInput")),
82  fGeneratorLabel (pset.get<std::string>("GeneratorLabel")),
83  fObeyPreselection (pset.get<bool> ("ObeyPreselection" )),
84  fPreselectionLabels(pset.get<std::vector<std::string>> ("PreselectionLabels")),
85  fUseGeV (pset.get<bool> ("UseGeV")),
86  fLibPath (pset.get<std::string>("LibPath")),
87 
88  fProngModLabel(pset.get<std::string>("ProngModLabel")),
89  fProng2DLabel (pset.get<std::string>("Prong2DLabel")),
90  fModel2DName (pset.get<std::string>("Model2DName")),
91  fNOutput2D (pset.get<unsigned int>("NOutput2D")),
92 
93  fProng3DLabel (pset.get<std::string>("Prong3DLabel")),
94  fModel3DName (pset.get<std::string>("Model3DName")),
95  fNOutput3D (pset.get<unsigned int>("NOutput3D")),
96 
97  fInputNameSlc (pset.get<std::string>("InputNameSlice")),
98  fInputName (pset.get<std::string>("InputName")),
99  fOutputName (pset.get<std::string>("OutputName")),
100  fCPUlimit (pset.get<unsigned int>("CPUlimit")),
101  fTF2D(0),
102  fTF3D(0)
103  {
105  produces< std::vector<cvn::Result> >();
106  produces< art::Assns<cvn::Result, rb::Cluster> >();
107  produces< art::Assns<cvn::Result, rb::Prong> >();
108  produces< std::vector<rb::PID> >();
109  produces< art::Assns<rb::PID,rb::Prong> >();
110  }
std::string EnvExpansion(const std::string &inString)
Function to expand environment variables.
Definition: EnvExpand.cxx:8
std::vector< std::string > fPreselectionLabels
enum BeamMode string
cvnneutronprongtf::CVNNeutronProngTF::~CVNNeutronProngTF ( )
virtual

Definition at line 112 of file CVNNeutronProngTF_module.cc.

References fTF2D, and fTF3D.

113  {
114  if(fTF2D) delete fTF2D;
115  if(fTF3D) delete fTF3D;
116 
117  }

Member Function Documentation

void cvnneutronprongtf::CVNNeutronProngTF::CalcResult ( std::vector< art::Ptr< cvn::PixelMap > >  pixelMaps,
tensorflow::TFHandler fTF,
unsigned int  NOutput,
std::vector< std::pair< int, double >> &  outputwithpdg,
std::vector< float > &  result,
std::vector< unsigned char >  pmslc 
)

Definition at line 286 of file CVNNeutronProngTF_module.cc.

References DEFINE_ART_MODULE(), fInputName, fInputNameSlc, check_time_usage::float, fOutputName, fUseGeV, MECModelEnuComparisons::i, make_pair(), tensorflow::TFHandler::Predict(), and vector_to_tensor().

Referenced by produce().

287  {
288 
289  std::vector<unsigned char> pmprong = (*pixelMaps[0]).PixelMapToVector(fUseGeV);
290 
291  tensorflow::Tensor tensorslc;
292  tensorflow::Tensor tensor;
293  tensor = vector_to_tensor(pmprong);
294  tensorslc = vector_to_tensor(pmslc);
295 
296 
297  std::vector<tensorflow::Tensor> TFResult = fTF->Predict({{fInputNameSlc, tensorslc}, {fInputName, tensor}}, {fOutputName});
298  auto tfoutput = TFResult[0].tensor<float,2>();
299 
300 
301  for(unsigned int i = 0; i < NOutput; i++){
302  //Fill and create PID assn
303  if(i==0){
304  outputwithpdg.push_back(std::make_pair(2212, (double)tfoutput(0,i)));
305  }
306  else if (i==1){
307  outputwithpdg.push_back(std::make_pair(22 , (double)tfoutput(0,i)));
308  }
309  else if (i==2){
310  outputwithpdg.push_back(std::make_pair(0 , (double)tfoutput(0,i)));
311  }
312  //Fill Result column
313  result.push_back( (float)tfoutput(0,i) );
314  }
315 
316  return;
317  }
std::pair< Spectrum *, CheatDecomp * > make_pair(SpectrumLoaderBase &loader_data, SpectrumLoaderBase &loader_mc, HistAxis *axis, Cut *cut, const SystShifts &shift, const Var &wei)
Definition: DataMCLoad.C:336
tensorflow::Tensor vector_to_tensor(std::vector< unsigned char >)
std::vector< Tensor > Predict(std::vector< std::pair< std::string, Tensor >> inputs, std::vector< std::string > outputLabels)
Definition: TFHandler.cxx:64
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
tensorflow::TFHandler * cvnneutronprongtf::CVNNeutronProngTF::GetModel2D ( const art::Event evt)

Definition at line 119 of file CVNNeutronProngTF_module.cc.

References fCPUlimit, fLibPath, fModel2DName, and fTF2D.

Referenced by produce().

120  {
121  if (!fTF2D)
123  return fTF2D;
124  }
Wrapper for Tensorflow which handles construction and prediction.
Definition: TFHandler.h:19
tensorflow::TFHandler * cvnneutronprongtf::CVNNeutronProngTF::GetModel3D ( const art::Event evt)

Definition at line 126 of file CVNNeutronProngTF_module.cc.

References fCPUlimit, fLibPath, fModel3DName, and fTF3D.

Referenced by produce().

127  {
128  if (!fTF3D)
130  return fTF3D;
131  }
Wrapper for Tensorflow which handles construction and prediction.
Definition: TFHandler.h:19
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 cvnneutronprongtf::CVNNeutronProngTF::produce ( art::Event evt)
virtual

Implements art::EDProducer.

Definition at line 164 of file CVNNeutronProngTF_module.cc.

References ana::assert(), CalcResult(), util::CreateAssn(), fNOutput2D, fNOutput3D, fObeyPreselection, fPixelMapInput, fPreselectionLabels, fProng2DLabel, fProng3DLabel, fProngModLabel, fSliceLabel, fTF2D, fTF3D, fUseGeV, art::DataViewImpl::getByLabel(), GetModel2D(), GetModel3D(), MECModelEnuComparisons::i, rb::IsFiltered(), art::PtrVector< T >::push_back(), art::Event::put(), fillBadChanDBTables::result, moon_position_table_new3::second, and art::PtrVector< T >::size().

165  {
166 
169  //Containers for things we're gonna produce
170  std::unique_ptr< std::vector<cvn::Result> >
171  resultCol(new std::vector<cvn::Result>);
172  std::unique_ptr< art::Assns<cvn::Result, rb::Cluster> >
173  assocresultslice(new art::Assns<cvn::Result, rb::Cluster>);
174  std::unique_ptr< art::Assns<cvn::Result, rb::Prong> >
175  assocresultprong(new art::Assns<cvn::Result, rb::Prong>);
176  std::unique_ptr< std::vector<rb::PID> >
177  pidCol(new std::vector<rb::PID>);
178  std::unique_ptr< art::Assns<rb::PID, rb::Prong> >
179  assocpid(new art::Assns<rb::PID, rb::Prong>);
180 
181  // Get slices
183  evt.getByLabel(fSliceLabel, slicecol);
184  art::PtrVector<rb::Cluster> slicelist;
185  for(unsigned int i = 0; i < slicecol->size(); ++i){
186  slicelist.push_back(art::Ptr<rb::Cluster>(slicecol, i));
187  }
188 
189  // Get pixel maps
190  art::FindManyP<cvn::PixelMap> fmPixelMap(slicecol, evt, fPixelMapInput);
191 
192  //loop over slices
193  for(size_t iClust = 0; iClust < slicelist.size(); ++iClust) {
194  if(!fmPixelMap.isValid()) continue;
195  if(slicelist[iClust]->IsNoise()) continue;
196  if(fObeyPreselection && rb::IsFiltered(evt, slicecol, iClust, fPreselectionLabels)) continue;
197 
198  //get slice pixel maps
199  const std::vector<art::Ptr<cvn::PixelMap> > pixelMapsSl = fmPixelMap.at(iClust);
200  if(pixelMapsSl.empty()) continue;
201  std::vector<unsigned char> pmslice = (*pixelMapsSl[0]).PixelMapToVector(fUseGeV);
202 
203 
204  // --- 2D Prongs.
206  if( fmProng2D.isValid() ) {
207  // Get everything out of the event.
208  std::vector<art::Ptr<rb::Prong>> prongs2D = fmProng2D.at(iClust);
209  art::FindManyP<cvn::PixelMap> fmPixelMap2D(prongs2D, evt, fPixelMapInput);
210  if ( fmPixelMap2D.isValid() ) {
211 
212  for( unsigned int iProng = 0; iProng < prongs2D.size(); ++iProng ){
213  // Calculate result
214  std::vector<std::pair<int, double>> outputwithpdg;
215  std::vector<float> result;
216  if ( fmPixelMap2D.at(iProng).empty() ) continue;
217  CalcResult( fmPixelMap2D.at(iProng), fTF2D, fNOutput2D, outputwithpdg, result , pmslice );
218  // Ensure that result.size() equals fNOutput
219  assert( result.size() == fNOutput2D);
220  // Make Assn between result and this prong.
221  float resultvec[fNOutput2D];
222  for(unsigned int i = 0; i < fNOutput2D; i++){
223  resultvec[i] = result[i];
224  // Make Assn.
225  pidCol->emplace_back(outputwithpdg[i].first, outputwithpdg[i].second);
226  util::CreateAssn(*this, evt, *(pidCol.get()),
227  prongs2D[iProng], *(assocpid.get()), UINT_MAX);
228  }
229  // Make Assn between full result output and prong.
230  const float* resultoutput = resultvec;
231  resultCol->emplace_back(resultoutput, fNOutput2D);
232  util::CreateAssn(*this, evt, *(resultCol.get()),
233  slicelist[iClust], *(assocresultslice.get()), UINT_MAX);
234  util::CreateAssn(*this, evt, *(resultCol.get()),
235  prongs2D[iClust], *(assocresultprong.get()), UINT_MAX);
236  }
237  }
238  }
239 
240  // --- 3D Prongs.
242  std::vector<art::Ptr<rb::Prong>> prongs3D;
243  if( fmProng3D.isValid() ) {
244  // Get everything out of the event.
245  std::vector<art::Ptr<rb::Prong>> prongs3D = fmProng3D.at(iClust);
246  art::FindManyP<cvn::PixelMap> fmPixelMap3D(prongs3D, evt, fPixelMapInput);
247  if ( fmPixelMap3D.isValid() ) {
248  for( unsigned int iProng = 0; iProng < prongs3D.size(); ++iProng ){
249  // Calculate result
250  std::vector<std::pair<int, double>> outputwithpdg;
251  std::vector<float> result;
252  if ( fmPixelMap3D.at(iProng).empty() ) continue;
253  CalcResult( fmPixelMap3D.at(iProng), fTF3D, fNOutput3D, outputwithpdg, result , pmslice );
254  // Ensure that result.size() equals fNOutput
255  //assert( result.size() == fNOutput3D);
256  // Make Assn between result and this prong.
257  float resultvec[fNOutput3D];
258  for(unsigned int i = 0; i < result.size(); i++){
259  resultvec[i] = result[i];
260  // Make Assn.
261  pidCol->emplace_back(outputwithpdg[i].first, outputwithpdg[i].second);
262  util::CreateAssn(*this, evt, *(pidCol.get()),
263  prongs3D[iProng], *(assocpid.get()), UINT_MAX);
264  }
265  // Make Assn between full result output and prong.
266  const float* resultoutput = resultvec;
267  resultCol->emplace_back(resultoutput, fNOutput3D);
268  util::CreateAssn(*this, evt, *(resultCol.get()),
269  slicelist[iClust], *(assocresultslice.get()), UINT_MAX);
270  util::CreateAssn(*this, evt, *(resultCol.get()),
271  prongs3D[iClust], *(assocresultprong.get()), UINT_MAX);
272  }
273  }
274  }
275 
276  } // slices
277  evt.put(std::move(resultCol));
278  evt.put(std::move(assocresultslice));
279  evt.put(std::move(assocresultprong));
280  evt.put(std::move(pidCol));
281  evt.put(std::move(assocpid));
282  } // 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.
tensorflow::TFHandler * GetModel2D(const art::Event &evt)
void CalcResult(std::vector< art::Ptr< cvn::PixelMap > > pixelMaps, tensorflow::TFHandler *fTF, unsigned int NOutput, std::vector< std::pair< int, double >> &outputwithpdg, std::vector< float > &result, std::vector< unsigned char > pmslc)
tensorflow::TFHandler * GetModel3D(const art::Event &evt)
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
void push_back(Ptr< U > const &p)
Definition: PtrVector.h:441
std::vector< std::string > fPreselectionLabels
bool IsFiltered(const art::Event &evt, art::Ptr< T > x, const std::vector< std::string > &labels)
Is this Ptr marked "filtered out"?
Definition: FilterList.h:96
size_type size() const
Definition: PtrVector.h:308
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
assert(nhit_max >=nhit_nbins)
Wrapper for Tensorflow which handles construction and prediction.
Definition: TFHandler.h:19
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

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

void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited
tensorflow::Tensor cvnneutronprongtf::CVNNeutronProngTF::vector_to_tensor ( std::vector< unsigned char >  pm)

Definition at line 133 of file CVNNeutronProngTF_module.cc.

References check_time_usage::float, MECModelEnuComparisons::i, and shutoffs::rel.

Referenced by CalcResult().

134  {
135  const unsigned int vectorSize = pm.size();
136 
137  // Initialize the tensors
138  tensorflow::Tensor tensor(tensorflow::DT_FLOAT, {1, vectorSize});
139  auto rel = tensor.tensor<float,2>();
140 
141  // Loop over each element
142  for(unsigned int i = 0; i < vectorSize; ++i) rel(0, i) = pm[i];
143 
144  return tensor;
145  }
string rel
Definition: shutoffs.py:11
tensorflow::Tensor cvnneutronprongtf::CVNNeutronProngTF::vector_to_tensor ( std::vector< unsigned char >  pmslice,
std::vector< unsigned char >  pmprong 
)

Definition at line 147 of file CVNNeutronProngTF_module.cc.

References check_time_usage::float, MECModelEnuComparisons::i, calib::j, and shutoffs::rel.

148  {
149  const unsigned int vectorSizeSlice = pmslice.size();
150  const unsigned int vectorSizeProng = pmprong.size();
151  const unsigned int vectorSizeTotal = vectorSizeSlice + vectorSizeProng;
152 
153  // Initialize the tensors
154  tensorflow::Tensor tensor(tensorflow::DT_FLOAT, {1, vectorSizeTotal});
155  auto rel = tensor.tensor<float,2>();
156 
157  // Loop over each element
158  for(unsigned int i = 0; i < vectorSizeSlice; ++i) rel(0, i) = pmslice[i];
159  for(unsigned int j = vectorSizeSlice; j < vectorSizeTotal; ++j) rel(0, j) = pmprong[j-vectorSizeSlice];
160 
161  return tensor;
162  }
const double j
Definition: BetheBloch.cxx:29
string rel
Definition: shutoffs.py:11

Member Data Documentation

unsigned int cvnneutronprongtf::CVNNeutronProngTF::fCPUlimit
protected

Definition at line 73 of file CVNNeutronProngTF_module.cc.

Referenced by GetModel2D(), and GetModel3D().

std::string cvnneutronprongtf::CVNNeutronProngTF::fGeneratorLabel
protected

Definition at line 55 of file CVNNeutronProngTF_module.cc.

std::string cvnneutronprongtf::CVNNeutronProngTF::fInputName
protected

Definition at line 71 of file CVNNeutronProngTF_module.cc.

Referenced by CalcResult().

std::string cvnneutronprongtf::CVNNeutronProngTF::fInputNameSlc
protected

Definition at line 70 of file CVNNeutronProngTF_module.cc.

Referenced by CalcResult().

std::string cvnneutronprongtf::CVNNeutronProngTF::fLibPath
protected

Definition at line 59 of file CVNNeutronProngTF_module.cc.

Referenced by CVNNeutronProngTF(), GetModel2D(), and GetModel3D().

std::string cvnneutronprongtf::CVNNeutronProngTF::fModel2DName
protected

Definition at line 63 of file CVNNeutronProngTF_module.cc.

Referenced by GetModel2D().

std::string cvnneutronprongtf::CVNNeutronProngTF::fModel3DName
protected

Definition at line 67 of file CVNNeutronProngTF_module.cc.

Referenced by GetModel3D().

unsigned int cvnneutronprongtf::CVNNeutronProngTF::fNOutput2D
protected

Definition at line 64 of file CVNNeutronProngTF_module.cc.

Referenced by produce().

unsigned int cvnneutronprongtf::CVNNeutronProngTF::fNOutput3D
protected

Definition at line 68 of file CVNNeutronProngTF_module.cc.

Referenced by produce().

bool cvnneutronprongtf::CVNNeutronProngTF::fObeyPreselection
protected

Definition at line 56 of file CVNNeutronProngTF_module.cc.

Referenced by produce().

std::string cvnneutronprongtf::CVNNeutronProngTF::fOutputName
protected

Definition at line 72 of file CVNNeutronProngTF_module.cc.

Referenced by CalcResult().

std::string cvnneutronprongtf::CVNNeutronProngTF::fPixelMapInput
protected

Definition at line 54 of file CVNNeutronProngTF_module.cc.

Referenced by produce().

std::vector<std::string> cvnneutronprongtf::CVNNeutronProngTF::fPreselectionLabels
protected

Definition at line 57 of file CVNNeutronProngTF_module.cc.

Referenced by produce().

std::string cvnneutronprongtf::CVNNeutronProngTF::fProng2DLabel
protected

Definition at line 62 of file CVNNeutronProngTF_module.cc.

Referenced by produce().

std::string cvnneutronprongtf::CVNNeutronProngTF::fProng3DLabel
protected

Definition at line 66 of file CVNNeutronProngTF_module.cc.

Referenced by produce().

std::string cvnneutronprongtf::CVNNeutronProngTF::fProngModLabel
protected

Definition at line 61 of file CVNNeutronProngTF_module.cc.

Referenced by produce().

std::string cvnneutronprongtf::CVNNeutronProngTF::fSliceLabel
protected

Definition at line 53 of file CVNNeutronProngTF_module.cc.

Referenced by produce().

tensorflow::TFHandler* cvnneutronprongtf::CVNNeutronProngTF::fTF2D
protected

Definition at line 74 of file CVNNeutronProngTF_module.cc.

Referenced by GetModel2D(), produce(), and ~CVNNeutronProngTF().

tensorflow::TFHandler* cvnneutronprongtf::CVNNeutronProngTF::fTF3D
protected

Definition at line 75 of file CVNNeutronProngTF_module.cc.

Referenced by GetModel3D(), produce(), and ~CVNNeutronProngTF().

bool cvnneutronprongtf::CVNNeutronProngTF::fUseGeV
protected

Definition at line 58 of file CVNNeutronProngTF_module.cc.

Referenced by CalcResult(), and produce().


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