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

 CVNProngTF (fhicl::ParameterSet const &pset)
 
virtual ~CVNProngTF ()
 
void produce (art::Event &evt)
 
bool IsRHC (const 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::TFHandlerGetModel (const art::Event &evt)
 
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
 
std::string fNuMILabel
 
bool fObeyPreselection
 
std::vector< std::stringfPreselectionLabels
 
bool fUseGeV
 
std::string fLibPath
 
std::string fModelFHCName
 
std::string fModelRHCName
 
bool fFourView
 
std::string fProngModLabel
 
std::string fProng3DLabel
 
unsigned int fNOutput
 
std::string fInputName
 
std::string fOutputName
 
unsigned int fCPUlimit
 
std::vector< intfOutputPtypes
 
bool fUseOppositeHornCurrentNetwork
 
tensorflow::TFHandlerfTFFHC
 
tensorflow::TFHandlerfTFRHC
 

Detailed Description

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

cvnprongtf::CVNProngTF::CVNProngTF ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 76 of file CVNProngTF_module.cc.

References util::EnvExpansion(), fLibPath, fNOutput, fOutputPtypes, MECModelEnuComparisons::i, and submit_hadd::u.

76  :
77  fSliceLabel (pset.get<std::string>("SliceLabel")),
78  fPixelMapInput(pset.get<std::string>("PixelMapInput")),
79  fGeneratorLabel (pset.get<std::string>("GeneratorLabel")),
80  fNuMILabel (pset.get<std::string>("NuMILabel")),
81  fObeyPreselection (pset.get<bool> ("ObeyPreselection" )),
82  fPreselectionLabels(pset.get<std::vector<std::string>> ("PreselectionLabels")),
83  fUseGeV (pset.get<bool> ("UseGeV")),
84  fLibPath (pset.get<std::string>("LibPath")),
85  fModelFHCName (pset.get<std::string>("ModelFHCName")),
86  fModelRHCName (pset.get<std::string>("ModelRHCName")),
87  fFourView (pset.get<bool> ("IsFourView")),
88  fProngModLabel(pset.get<std::string>("ProngModLabel")),
89  fProng3DLabel (pset.get<std::string>("Prong3DLabel")),
90  fNOutput (pset.get<unsigned int>("NOutput")),
91  fInputName (pset.get<std::string>("InputName")),
92  fOutputName (pset.get<std::string>("OutputName")),
93  fCPUlimit (pset.get<unsigned int>("CPUlimit")),
94  fOutputPtypes (pset.get("OutputPtypes", std::vector<int>())),
95  fUseOppositeHornCurrentNetwork(pset.get<bool>("UseOppositeHornCurrentNetwork")),
96  fTFFHC(0),
97  fTFRHC(0)
98  {
100  produces< std::vector<cvn::Result> >();
101  produces< art::Assns<cvn::Result, rb::Cluster> >();
102  produces< art::Assns<cvn::Result, rb::Prong> >();
103  produces< std::vector<rb::PID> >();
104  produces< art::Assns<rb::PID,rb::Prong> >();
105 
106  // if output labels not provided, fall back to the default case
107  if( fOutputPtypes.size() == 0 )
108  for(auto i = 0u; i < fNOutput; i++)
109  fOutputPtypes.push_back(i);
110  }
tensorflow::TFHandler * fTFFHC
tensorflow::TFHandler * fTFRHC
std::string EnvExpansion(const std::string &inString)
Function to expand environment variables.
Definition: EnvExpand.cxx:8
std::vector< int > fOutputPtypes
std::vector< std::string > fPreselectionLabels
enum BeamMode string
cvnprongtf::CVNProngTF::~CVNProngTF ( )
virtual

Definition at line 112 of file CVNProngTF_module.cc.

References fTFFHC, and fTFRHC.

113  {
114  if(fTFFHC) delete fTFFHC;
115  if(fTFRHC) delete fTFRHC;
116  }
tensorflow::TFHandler * fTFFHC
tensorflow::TFHandler * fTFRHC

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
tensorflow::TFHandler * cvnprongtf::CVNProngTF::GetModel ( const art::Event evt)

Definition at line 139 of file CVNProngTF_module.cc.

References fCPUlimit, fLibPath, fModelFHCName, fModelRHCName, fTFFHC, fTFRHC, and IsRHC().

Referenced by produce().

140  {
141  if (IsRHC(evt)) {
142  if (!fTFRHC)
144  return fTFRHC;
145  }
146  else {
147  if (!fTFFHC)
149  return fTFFHC;
150  }
151  }
tensorflow::TFHandler * fTFFHC
tensorflow::TFHandler * fTFRHC
bool IsRHC(const art::Event &evt)
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  }
bool cvnprongtf::CVNProngTF::IsRHC ( const art::Event evt)

Definition at line 118 of file CVNProngTF_module.cc.

References art::Handle< T >::failedToGet(), fGeneratorLabel, fNuMILabel, fUseOppositeHornCurrentNetwork, art::DataViewImpl::getByLabel(), art::Event::isRealData(), and sumdata::SpillData::isRHC.

Referenced by GetModel().

119  {
121  if (!evt.isRealData())
122  evt.getByLabel(fGeneratorLabel, spillPot);
123  else
124  evt.getByLabel(fNuMILabel, spillPot);
125 
126  if (spillPot.failedToGet())
127  {
128  mf::LogError("CVNProngTF") <<
129  "Spill Data not found, aborting without horn current information";
130  abort();
131  }
132 
133  if(fUseOppositeHornCurrentNetwork) return !spillPot->isRHC;
134 
135  // NB - the logic here will cause 0HC to use the FHC network
136  return spillPot->isRHC;
137  }
bool isRHC
is the beam in antineutrino mode, aka RHC
Definition: SpillData.h:28
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
bool isRealData() const
Definition: Event.h:83
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
bool failedToGet() const
Definition: Handle.h:196
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 cvnprongtf::CVNProngTF::produce ( art::Event evt)
virtual

Implements art::EDProducer.

Definition at line 184 of file CVNProngTF_module.cc.

References util::CreateAssn(), DEFINE_ART_MODULE(), fFourView, fInputName, check_time_usage::float, fNOutput, fObeyPreselection, fOutputName, fOutputPtypes, fPixelMapInput, fPreselectionLabels, fProng3DLabel, fProngModLabel, fSliceLabel, fUseGeV, art::DataViewImpl::getByLabel(), GetModel(), cvn::GetPDGByPType(), MECModelEnuComparisons::i, rb::IsFiltered(), make_pair(), tensorflow::TFHandler::Predict(), art::PtrVector< T >::push_back(), art::Event::put(), fillBadChanDBTables::result, moon_position_table_new3::second, art::PtrVector< T >::size(), and vector_to_tensor().

185  {
186 
187  tensorflow::TFHandler* fTF = GetModel(evt);
188  //Containers for things we're gonna produce
189  std::unique_ptr< std::vector<cvn::Result> >
190  resultCol(new std::vector<cvn::Result>);
191  std::unique_ptr< art::Assns<cvn::Result, rb::Cluster> >
192  assocresultslice(new art::Assns<cvn::Result, rb::Cluster>);
193  std::unique_ptr< art::Assns<cvn::Result, rb::Prong> >
194  assocresultprong(new art::Assns<cvn::Result, rb::Prong>);
195  std::unique_ptr< std::vector<rb::PID> >
196  pidCol(new std::vector<rb::PID>);
197  std::unique_ptr< art::Assns<rb::PID, rb::Prong> >
198  assocpid(new art::Assns<rb::PID, rb::Prong>);
199 
200  // Get slices
202  evt.getByLabel(fSliceLabel, slicecol);
203  art::PtrVector<rb::Cluster> slicelist;
204  for(unsigned int i = 0; i < slicecol->size(); ++i){
205  slicelist.push_back(art::Ptr<rb::Cluster>(slicecol, i));
206  }
207 
208  // Get pixel maps
209  art::FindManyP<cvn::PixelMap> fmPixelMap(slicecol, evt, fPixelMapInput);
210 
211  //loop over slices
212  for(size_t iClust = 0; iClust < slicelist.size(); ++iClust) {
213  if(!fmPixelMap.isValid()) continue;
214  if(slicelist[iClust]->IsNoise()) continue;
215  if(fObeyPreselection && rb::IsFiltered(evt, slicecol, iClust, fPreselectionLabels)) continue;
216 
217  art::FindManyP<rb::Prong> fmProng3D(slicecol, evt,
219 
220  std::vector<art::Ptr<rb::Prong>> prongs3D;
221 
222  if( fmProng3D.isValid() ) prongs3D = fmProng3D.at(iClust);
223  else continue;
224 
225  art::FindManyP<cvn::PixelMap> fmPixelMap3D(prongs3D, evt, fPixelMapInput);
226 
227  const std::vector<art::Ptr<cvn::PixelMap> > pixelMaps = fmPixelMap.at(iClust);
228 
229  for( unsigned int iProng = 0; iProng < prongs3D.size(); ++iProng ){
230  if(!fmPixelMap3D.isValid()) continue;
231 
232  const std::vector< art::Ptr<cvn::PixelMap> > pixelMaps3D = fmPixelMap3D.at(iProng);
233 
234  if(pixelMaps3D.empty()) continue;
235 
236  std::vector<unsigned char> pmprong = (*pixelMaps3D[0]).PixelMapToVector(fUseGeV);
237 
238  tensorflow::Tensor tensor;
239 
240  if(fFourView){
241 
242  //make sure slice pixelmap is filled
243  if(pixelMaps.empty()) continue;
244 
245  // Fill the pixel map array for this slice
246  std::vector<unsigned char> pmslice = (*pixelMaps[0]).PixelMapToVector(fUseGeV);
247 
248  // Convert to format expected by the network
249  tensor = vector_to_tensor(pmslice,pmprong);
250  } //4View Results Fill
251  else{
252 
253  tensor = vector_to_tensor(pmprong);
254 
255  } //2View Results Fill
256 
257  std::vector<tensorflow::Tensor> result = fTF->Predict({{fInputName,tensor}},
258  {fOutputName});
259 
260  auto tfoutput = result[0].tensor<float,2>();
261 
262  std::vector<std::pair<int, double>> outputwithpdg;
263 
264  float resultvec[fNOutput];
265 
266  for(unsigned int i = 0; i < fNOutput; i++){
267 
268  //Fill and create PID assn
269  outputwithpdg.push_back(std::make_pair(GetPDGByPType((cvn::PType)fOutputPtypes[i]), (double)tfoutput(0,i)));
270 
271  pidCol->emplace_back(outputwithpdg[i].first, outputwithpdg[i].second);
272 
273  util::CreateAssn(*this, evt, *(pidCol.get()),
274  prongs3D[iProng], *(assocpid.get()), UINT_MAX);
275 
276  //Fill Result column
277  resultvec[i] = (float)tfoutput(0,i);
278 
279  }
280 
281  const float* resultoutput = resultvec;
282 
283  resultCol->emplace_back(resultoutput, fNOutput);
284 
285  util::CreateAssn(*this, evt, *(resultCol.get()),
286  slicelist[iClust], *(assocresultslice.get()), UINT_MAX);
287 
288  util::CreateAssn(*this, evt, *(resultCol.get()),
289  prongs3D[iClust], *(assocresultprong.get()), UINT_MAX);
290 
291  }// prongs
292  } // slices
293 
294  evt.put(std::move(resultCol));
295  evt.put(std::move(assocresultslice));
296  evt.put(std::move(assocresultprong));
297  evt.put(std::move(pidCol));
298  evt.put(std::move(assocpid));
299 
300  } // 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.
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
std::vector< Tensor > Predict(std::vector< std::pair< std::string, Tensor >> inputs, std::vector< std::string > outputLabels)
Definition: TFHandler.cxx:64
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
void push_back(Ptr< U > const &p)
Definition: PtrVector.h:441
std::vector< int > fOutputPtypes
tensorflow::TFHandler * GetModel(const art::Event &evt)
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
int GetPDGByPType(PType ptype)
Definition: ProngType.cxx:5
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
PType
Definition: ProngType.h:18
tensorflow::Tensor vector_to_tensor(std::vector< unsigned char >)
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 cvnprongtf::CVNProngTF::vector_to_tensor ( std::vector< unsigned char >  pm)

Definition at line 153 of file CVNProngTF_module.cc.

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

Referenced by produce().

154  {
155  const unsigned int vectorSize = pm.size();
156 
157  // Initialize the tensors
158  tensorflow::Tensor tensor(tensorflow::DT_FLOAT, {1, vectorSize});
159  auto rel = tensor.tensor<float,2>();
160 
161  // Loop over each element
162  for(unsigned int i = 0; i < vectorSize; ++i) rel(0, i) = pm[i];
163 
164  return tensor;
165  }
string rel
Definition: shutoffs.py:11
tensorflow::Tensor cvnprongtf::CVNProngTF::vector_to_tensor ( std::vector< unsigned char >  pmslice,
std::vector< unsigned char >  pmprong 
)

Definition at line 167 of file CVNProngTF_module.cc.

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

168  {
169  const unsigned int vectorSizeSlice = pmslice.size();
170  const unsigned int vectorSizeProng = pmprong.size();
171  const unsigned int vectorSizeTotal = vectorSizeSlice + vectorSizeProng;
172 
173  // Initialize the tensors
174  tensorflow::Tensor tensor(tensorflow::DT_FLOAT, {1, vectorSizeTotal});
175  auto rel = tensor.tensor<float,2>();
176 
177  // Loop over each element
178  for(unsigned int i = 0; i < vectorSizeSlice; ++i) rel(0, i) = pmslice[i];
179  for(unsigned int j = vectorSizeSlice; j < vectorSizeTotal; ++j) rel(0, j) = pmprong[j-vectorSizeSlice];
180 
181  return tensor;
182  }
const double j
Definition: BetheBloch.cxx:29
string rel
Definition: shutoffs.py:11

Member Data Documentation

unsigned int cvnprongtf::CVNProngTF::fCPUlimit
protected

Definition at line 67 of file CVNProngTF_module.cc.

Referenced by GetModel().

bool cvnprongtf::CVNProngTF::fFourView
protected

Definition at line 61 of file CVNProngTF_module.cc.

Referenced by produce().

std::string cvnprongtf::CVNProngTF::fGeneratorLabel
protected

Definition at line 53 of file CVNProngTF_module.cc.

Referenced by IsRHC().

std::string cvnprongtf::CVNProngTF::fInputName
protected

Definition at line 65 of file CVNProngTF_module.cc.

Referenced by produce().

std::string cvnprongtf::CVNProngTF::fLibPath
protected

Definition at line 58 of file CVNProngTF_module.cc.

Referenced by CVNProngTF(), and GetModel().

std::string cvnprongtf::CVNProngTF::fModelFHCName
protected

Definition at line 59 of file CVNProngTF_module.cc.

Referenced by GetModel().

std::string cvnprongtf::CVNProngTF::fModelRHCName
protected

Definition at line 60 of file CVNProngTF_module.cc.

Referenced by GetModel().

unsigned int cvnprongtf::CVNProngTF::fNOutput
protected

Definition at line 64 of file CVNProngTF_module.cc.

Referenced by CVNProngTF(), and produce().

std::string cvnprongtf::CVNProngTF::fNuMILabel
protected

Definition at line 54 of file CVNProngTF_module.cc.

Referenced by IsRHC().

bool cvnprongtf::CVNProngTF::fObeyPreselection
protected

Definition at line 55 of file CVNProngTF_module.cc.

Referenced by produce().

std::string cvnprongtf::CVNProngTF::fOutputName
protected

Definition at line 66 of file CVNProngTF_module.cc.

Referenced by produce().

std::vector<int> cvnprongtf::CVNProngTF::fOutputPtypes
protected

Definition at line 68 of file CVNProngTF_module.cc.

Referenced by CVNProngTF(), and produce().

std::string cvnprongtf::CVNProngTF::fPixelMapInput
protected

Definition at line 52 of file CVNProngTF_module.cc.

Referenced by produce().

std::vector<std::string> cvnprongtf::CVNProngTF::fPreselectionLabels
protected

Definition at line 56 of file CVNProngTF_module.cc.

Referenced by produce().

std::string cvnprongtf::CVNProngTF::fProng3DLabel
protected

Definition at line 63 of file CVNProngTF_module.cc.

Referenced by produce().

std::string cvnprongtf::CVNProngTF::fProngModLabel
protected

Definition at line 62 of file CVNProngTF_module.cc.

Referenced by produce().

std::string cvnprongtf::CVNProngTF::fSliceLabel
protected

Definition at line 51 of file CVNProngTF_module.cc.

Referenced by produce().

tensorflow::TFHandler* cvnprongtf::CVNProngTF::fTFFHC
protected

Definition at line 70 of file CVNProngTF_module.cc.

Referenced by GetModel(), and ~CVNProngTF().

tensorflow::TFHandler* cvnprongtf::CVNProngTF::fTFRHC
protected

Definition at line 71 of file CVNProngTF_module.cc.

Referenced by GetModel(), and ~CVNProngTF().

bool cvnprongtf::CVNProngTF::fUseGeV
protected

Definition at line 57 of file CVNProngTF_module.cc.

Referenced by produce().

bool cvnprongtf::CVNProngTF::fUseOppositeHornCurrentNetwork
protected

Definition at line 69 of file CVNProngTF_module.cc.

Referenced by IsRHC().


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