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

Public Types

using ModuleType = EDFilter
 
using WorkerType = WorkerT< EDFilter >
 
template<typename UserConfig >
using Table = ProducerBase::Table< UserConfig >
 

Public Member Functions

 NuESelect (fhicl::ParameterSet const &p)
 
virtual ~NuESelect ()
 
virtual bool filter (art::Event &e)
 
virtual void beginJob ()
 
virtual void endJob ()
 
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 ()
 

Static Public Attributes

static constexpr bool Pass {true}
 
static constexpr bool Fail {false}
 

Protected Member Functions

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

Private Attributes

std::string _clustlabel
 
std::string _instan
 
double _linelike
 
bool _trigflag
 
unsigned int _prescale
 
unsigned int _tcounts
 

Detailed Description

Definition at line 34 of file NuESelect_module.cc.

Member Typedef Documentation

using art::EDFilter::ModuleType = EDFilter
inherited

Definition at line 37 of file EDFilter.h.

template<typename UserConfig >
using art::EDFilter::Table = ProducerBase::Table<UserConfig>
inherited

Definition at line 46 of file EDFilter.h.

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

Definition at line 38 of file EDFilter.h.

Constructor & Destructor Documentation

novaddt::NuESelect::NuESelect ( fhicl::ParameterSet const &  p)
explicit

Definition at line 56 of file NuESelect_module.cc.

57 :
58 // Initialize member data here.
59 _clustlabel (p.get< std::string >("cluster_label")),
60 _instan (p.get< std::string >("instance")),
61 _linelike (p.get< double >("LinFitVal")),
62 _trigflag (false),
63 _prescale (p.get<unsigned int>("presale",1)),
64 _tcounts (0)
65 {
66  // Call appropriate Produces<>() functions here.
67  produces< std::vector<TriggerDecision>>();
68 }
const char * p
Definition: xmltok.h:285
unsigned int _prescale
enum BeamMode string
novaddt::NuESelect::~NuESelect ( )
virtual

Definition at line 70 of file NuESelect_module.cc.

71 {
72  // Clean up dynamic memory and other resources here.
73 }

Member Function Documentation

void novaddt::NuESelect::beginJob ( )
virtual

Reimplemented from art::EDFilter.

Definition at line 75 of file NuESelect_module.cc.

76 {
77  // Implementation of optional member function here.
78 }
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::EDFilter::currentContext ( ) const
protectedinherited
void novaddt::NuESelect::endJob ( )
virtual

Reimplemented from art::EDFilter.

Definition at line 189 of file NuESelect_module.cc.

References DEFINE_ART_MODULE().

190 {
191  // Implementation of optional member function here.
192 }
bool novaddt::NuESelect::filter ( art::Event e)
virtual

Implements art::EDFilter.

Definition at line 80 of file NuESelect_module.cc.

References _clustlabel, _linelike, _prescale, _tcounts, _trigflag, art::DataViewImpl::getByLabel(), MECModelEnuComparisons::i, it, util::LinFitUnweighted(), parsePQSLOutput::partition, plot_validation_datamc::pred, art::Event::put(), util::sqr(), std::sqrt(), and daqdataformats::TRIG_ID_DATA_NUE.

81 {
82  // Define product to be put in the event
83  std::unique_ptr<std::vector<novaddt::TriggerDecision>> td(new std::vector<novaddt::TriggerDecision>);
84 
85  // Grab the clusters from the event
87  e.getByLabel(_clustlabel, clusters);
88 
89  if(clusters->empty()){
90  mf::LogWarning ("No Clusters")<<"No Clusters in the input file";
91  e.put(std::move(td));
92  return false;
93  }
94 
95  // Grab the hitlists associated with the clusters
97 
98  // Time to go through the clusters, C++11 style!
99  unsigned int i(0);
100  for(auto const& clust: *clusters) {
101  art::Ptr<novaddt::HitList> hl_ptr(hls.at(i));
102  ++i;
103 
104  // Split the hits in x and y to do 2D fitting
105  novaddt::HitList hlist(*hl_ptr);
106  auto bound = std::partition(hlist.begin(),hlist.end(),CompareDAQHit<View>());
107 
108  unsigned int xsize = bound-hlist.begin();
109  unsigned int ysize = hlist.end()-bound;
110 
111  // Smarter way of vector managment
112  std::vector<double> XXpoints;
113  std::vector<double> XZpoints;
114  std::vector<double> YYpoints;
115  std::vector<double> YZpoints;
116 
117  XXpoints.reserve(xsize);
118  XZpoints.reserve(xsize);
119  YYpoints.reserve(ysize);
120  YZpoints.reserve(ysize);
121 
122  {
123  auto it = hlist.begin();
124  for(it=hlist.begin();it!=bound;++it){
125  XXpoints.emplace_back((*it).Cell().val);
126  XZpoints.emplace_back((*it).Plane().val);
127  }
128  for(it=bound;it!=hlist.end();++it){
129  YYpoints.emplace_back((*it).Cell().val);
130  YZpoints.emplace_back((*it).Plane().val);
131  }
132  }
133 
134  // Now we can do the actual fitting
135  double xslope;
136  double xint;
137  unsigned int xdof = xsize-1;
138  double xsigm=0.0;
139  double pred;
140 
141  // First the X fit
142  if(xsize > 1){
143  util::LinFitUnweighted(XXpoints, XZpoints, xslope, xint);
144 
145  // Evaluate the goodness of fit
146  for(unsigned int xi=0;xi<xsize;++xi){
147  pred = xslope*XXpoints[xi] + xint;
148  xsigm += sqrt(util::sqr(XZpoints[xi]-pred));
149  }
150  }
151  else xdof = 1;
152 
153  // Now the Y fit
154  double yslope;
155  double yint;
156  unsigned int ydof = ysize-1;
157  double ysigm=0.0;
158 
159  if(ysize > 1){
160  util::LinFitUnweighted(YYpoints, YZpoints, yslope, yint);
161 
162  // Evaluate the goodness of fit
163  for(unsigned int yi=0;yi<ysize;++yi){
164  pred = yslope*YYpoints[yi] + yint;
165  ysigm += sqrt(util::sqr(YZpoints[yi]-pred));
166  }
167  }
168  else ydof = 1;
169 
170  // Let's see if it passes trigger criterion
171  double ThreeDFit = sqrt(util::sqr(xsigm/xdof)+util::sqr(ysigm/ydof));
172  if(_linelike < ThreeDFit) {
173  ++_tcounts;
174  if (_tcounts%_prescale == 0) {
175  td->emplace_back(clust.EarliestTDC().val,
176  clust.LatestTDC().val - clust.EarliestTDC().val,
178  _prescale);
179  }
180  }
181  } // end of clusters
182 
183  _trigflag = (td->size() > 0);
184  e.put(std::move(td));
185  return _trigflag;
186 } // end filter
set< int >::iterator it
std::vector< DAQHit > HitList
Definition: HitList.h:15
T sqrt(T number)
Definition: d0nt_math.hpp:156
T sqr(T x)
More efficient square function than pow(x,2)
Definition: MathUtil.h:23
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
unsigned int _prescale
void LinFitUnweighted(const std::vector< double > &x, const std::vector< double > &y, double &m, double &c)
Simplified version of LinFit.
Definition: MathUtil.cxx:8
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
Definition: fwd.h:28
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::EDFilter::getProductID ( std::string const &  instanceName = {}) const
inlineinherited

Definition at line 131 of file EDFilter.h.

References art::EDFilter::moduleDescription_.

Referenced by novaddt::HoughTrackMaker::create_associations().

132  {
133  return ProducerBase::getProductID<PROD, B>(moduleDescription_,
134  instanceName);
135  }
ModuleDescription moduleDescription_
Definition: EDFilter.h:124
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 art::Consumer::showMissingConsumes ( ) const
protectedinherited

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

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

Member Data Documentation

std::string novaddt::NuESelect::_clustlabel
private

Definition at line 47 of file NuESelect_module.cc.

Referenced by filter().

std::string novaddt::NuESelect::_instan
private

Definition at line 48 of file NuESelect_module.cc.

double novaddt::NuESelect::_linelike
private

Definition at line 49 of file NuESelect_module.cc.

Referenced by filter().

unsigned int novaddt::NuESelect::_prescale
private

Definition at line 51 of file NuESelect_module.cc.

Referenced by filter().

unsigned int novaddt::NuESelect::_tcounts
private

Definition at line 52 of file NuESelect_module.cc.

Referenced by filter().

bool novaddt::NuESelect::_trigflag
private

Definition at line 50 of file NuESelect_module.cc.

Referenced by filter().

constexpr bool art::EDFilter::Fail {false}
staticinherited

Definition at line 33 of file EDFilter.h.

Referenced by evgen::GENIEFilter::filter().

constexpr bool art::EDFilter::Pass {true}
staticinherited

Definition at line 32 of file EDFilter.h.

Referenced by evgen::GENIEFilter::filter().


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