Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
cvnneutronprongtf::CVNNeutronProngTF Class Reference
Inheritance diagram for cvnneutronprongtf::CVNNeutronProngTF:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Types

using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::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)
 
std::string workerType () const
 
void doBeginJob ()
 
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)
 
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< TconsumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< TmayConsumeView (InputTag const &tag)
 

Protected Member Functions

ConsumesCollector & consumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< Tconsumes (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< TmayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

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

Definition at line 17 of file EDProducer.h.

template<typename UserConfig , typename KeysToIgnore = void>
using art::detail::Producer::Table = Modifier::Table<UserConfig, KeysToIgnore>
inherited

Definition at line 25 of file Producer.h.

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

Definition at line 18 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  EDProducer(pset),
81  fSliceLabel (pset.get<std::string>("SliceLabel")),
82  fPixelMapInput(pset.get<std::string>("PixelMapInput")),
83  fGeneratorLabel (pset.get<std::string>("GeneratorLabel")),
84  fObeyPreselection (pset.get<bool> ("ObeyPreselection" )),
85  fPreselectionLabels(pset.get<std::vector<std::string>> ("PreselectionLabels")),
86  fUseGeV (pset.get<bool> ("UseGeV")),
87  fLibPath (pset.get<std::string>("LibPath")),
88 
89  fProngModLabel(pset.get<std::string>("ProngModLabel")),
90  fProng2DLabel (pset.get<std::string>("Prong2DLabel")),
91  fModel2DName (pset.get<std::string>("Model2DName")),
92  fNOutput2D (pset.get<unsigned int>("NOutput2D")),
93 
94  fProng3DLabel (pset.get<std::string>("Prong3DLabel")),
95  fModel3DName (pset.get<std::string>("Model3DName")),
96  fNOutput3D (pset.get<unsigned int>("NOutput3D")),
97 
98  fInputNameSlc (pset.get<std::string>("InputNameSlice")),
99  fInputName (pset.get<std::string>("InputName")),
100  fOutputName (pset.get<std::string>("OutputName")),
101  fCPUlimit (pset.get<unsigned int>("CPUlimit")),
102  fTF2D(0),
103  fTF3D(0)
104  {
106  produces< std::vector<cvn::Result> >();
107  produces< art::Assns<cvn::Result, rb::Cluster> >();
108  produces< art::Assns<cvn::Result, rb::Prong> >();
109  produces< std::vector<rb::PID> >();
110  produces< art::Assns<rb::PID,rb::Prong> >();
111  }
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
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 113 of file CVNNeutronProngTF_module.cc.

References fTF2D, and fTF3D.

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

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 287 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().

288  {
289 
290  std::vector<unsigned char> pmprong = (*pixelMaps[0]).PixelMapToVector(fUseGeV);
291 
292  tensorflow::Tensor tensorslc;
293  tensorflow::Tensor tensor;
294  tensor = vector_to_tensor(pmprong);
295  tensorslc = vector_to_tensor(pmslc);
296 
297 
298  std::vector<tensorflow::Tensor> TFResult = fTF->Predict({{fInputNameSlc, tensorslc}, {fInputName, tensor}}, {fOutputName});
299  auto tfoutput = TFResult[0].tensor<float,2>();
300 
301 
302  for(unsigned int i = 0; i < NOutput; i++){
303  //Fill and create PID assn
304  if(i==0){
305  outputwithpdg.push_back(std::make_pair(2212, (double)tfoutput(0,i)));
306  }
307  else if (i==1){
308  outputwithpdg.push_back(std::make_pair(22 , (double)tfoutput(0,i)));
309  }
310  else if (i==2){
311  outputwithpdg.push_back(std::make_pair(0 , (double)tfoutput(0,i)));
312  }
313  //Fill Result column
314  result.push_back( (float)tfoutput(0,i) );
315  }
316 
317  return;
318  }
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 BT>
ProductToken< T > art::ModuleBase::consumes ( InputTag const &  tag)
protectedinherited

Definition at line 55 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::consumes(), T, and getGoodRuns4SAM::tag.

56  {
57  return collector_.consumes<T, BT>(tag);
58  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
ProductToken< T > consumes(InputTag const &)
double T
Definition: Xdiff_gwt.C:5
ConsumesCollector& art::ModuleBase::consumesCollector ( )
protectedinherited
template<typename T , BranchType BT>
void art::ModuleBase::consumesMany ( )
protectedinherited

Definition at line 69 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::consumesMany(), and T.

70  {
71  collector_.consumesMany<T, BT>();
72  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
double T
Definition: Xdiff_gwt.C:5
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::consumesView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::consumesView ( InputTag const &  tag)
inherited

Definition at line 62 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::consumesView(), T, and getGoodRuns4SAM::tag.

63  {
64  return collector_.consumesView<T, BT>(tag);
65  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
ViewToken< Element > consumesView(InputTag const &)
double T
Definition: Xdiff_gwt.C:5
void art::detail::Producer::doBeginJob ( )
inherited
bool art::detail::Producer::doBeginRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited
bool art::detail::Producer::doBeginSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited
void art::detail::Producer::doEndJob ( )
inherited
bool art::detail::Producer::doEndRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited
bool art::detail::Producer::doEndSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited
bool art::detail::Producer::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 
)
inherited
void art::detail::Producer::doRespondToCloseInputFile ( FileBlock const &  fb)
inherited
void art::detail::Producer::doRespondToCloseOutputFiles ( FileBlock const &  fb)
inherited
void art::detail::Producer::doRespondToOpenInputFile ( FileBlock const &  fb)
inherited
void art::detail::Producer::doRespondToOpenOutputFiles ( FileBlock const &  fb)
inherited
std::array<std::vector<ProductInfo>, NumBranchTypes> const& art::ModuleBase::getConsumables ( ) const
inherited
tensorflow::TFHandler * cvnneutronprongtf::CVNNeutronProngTF::GetModel2D ( const art::Event evt)

Definition at line 120 of file CVNNeutronProngTF_module.cc.

References fCPUlimit, fLibPath, fModel2DName, and fTF2D.

Referenced by produce().

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

Definition at line 127 of file CVNNeutronProngTF_module.cc.

References fCPUlimit, fLibPath, fModel3DName, and fTF3D.

Referenced by produce().

128  {
129  if (!fTF3D)
131  return fTF3D;
132  }
Wrapper for Tensorflow which handles construction and prediction.
Definition: TFHandler.h:19
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::mayConsume ( InputTag const &  tag)
protectedinherited

Definition at line 76 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::mayConsume(), T, and getGoodRuns4SAM::tag.

77  {
78  return collector_.mayConsume<T, BT>(tag);
79  }
ProductToken< T > mayConsume(InputTag const &)
ConsumesCollector collector_
Definition: ModuleBase.h:50
double T
Definition: Xdiff_gwt.C:5
template<typename T , BranchType BT>
void art::ModuleBase::mayConsumeMany ( )
protectedinherited

Definition at line 90 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::mayConsumeMany(), and T.

91  {
93  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
double T
Definition: Xdiff_gwt.C:5
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::mayConsumeView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::mayConsumeView ( InputTag const &  tag)
inherited

Definition at line 83 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::mayConsumeView(), T, and getGoodRuns4SAM::tag.

84  {
85  return collector_.mayConsumeView<T, BT>(tag);
86  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
ViewToken< Element > mayConsumeView(InputTag const &)
double T
Definition: Xdiff_gwt.C:5
ModuleDescription const& art::ModuleBase::moduleDescription ( ) const
inherited
void cvnneutronprongtf::CVNNeutronProngTF::produce ( art::Event evt)
virtual

Implements art::EDProducer.

Definition at line 165 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::DataViewImpl::put(), fillBadChanDBTables::result, moon_position_table_new3::second, and art::PtrVector< T >::size().

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

Definition at line 134 of file CVNNeutronProngTF_module.cc.

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

Referenced by CalcResult().

135  {
136  const unsigned int vectorSize = pm.size();
137 
138  // Initialize the tensors
139  tensorflow::Tensor tensor(tensorflow::DT_FLOAT, {1, vectorSize});
140  auto rel = tensor.tensor<float,2>();
141 
142  // Loop over each element
143  for(unsigned int i = 0; i < vectorSize; ++i) rel(0, i) = pm[i];
144 
145  return tensor;
146  }
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 148 of file CVNNeutronProngTF_module.cc.

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

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

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: