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

 MichelEfinder (fhicl::ParameterSet const &p)
 
 MichelEfinder (MichelEfinder const &)=delete
 
 MichelEfinder (MichelEfinder &&)=delete
 
MichelEfinderoperator= (MichelEfinder const &)=delete
 
MichelEfinderoperator= (MichelEfinder &&)=delete
 
void produce (art::Event &e) override
 
template<typename PROD , BranchType B = InEvent>
ProductID getProductID (std::string const &instanceName={}) const
 
template<typename PROD , BranchType B>
ProductID getProductID (ModuleDescription const &moduleDescription, std::string const &instanceName) const
 
bool modifiesEvent () const
 
template<typename T , BranchType = InEvent>
ProductToken< Tconsumes (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< Tconsumes (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TconsumesView (InputTag const &it)
 
template<typename T , BranchType = InEvent>
ProductToken< TmayConsume (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< TmayConsume (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TmayConsumeView (InputTag const &it)
 
base_engine_tcreateEngine (seed_t seed)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make, label_t const &engine_label)
 
seed_t get_seed_value (fhicl::ParameterSet const &pset, char const key[]="seed", seed_t const implicit_seed=-1)
 

Static Public Member Functions

static cet::exempt_ptr< Consumernon_module_context ()
 

Protected Member Functions

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

Private Member Functions

bool michelclose (const novaddt::DAQHit &trackend, const novaddt::DAQHit &testcell)
 
void findmichelexclusion (const novaddt::HitList &ends, const novaddt::HitList &allhits, novaddt::HitList &answer)
 

Private Attributes

const int kTDC_PER_USEC = 64
 
art::InputTag fTracksTag
 
art::InputTag fHitsTag
 
double fMaxDistance
 
int fDTime_min
 
int fDTime_max
 

Detailed Description

Definition at line 38 of file MichelEfinder_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

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

Definition at line 245 of file MichelEfinder_module.cc.

References fDTime_max, fDTime_min, fHitsTag, fMaxDistance, and fTracksTag.

246 :fTracksTag(p.get<std::string>("TracksTag")),
247  fHitsTag(p.get<std::string>("HitsTag")),
248  fMaxDistance(p.get<double>("window.MaxDistance")),
249  fDTime_min(p.get<int>("window.TimeRange.min")*kTDC_PER_USEC),
250  fDTime_max(p.get<int>("window.TimeRange.max")*kTDC_PER_USEC)
251 // Initialize member data here.
252 {
253  produces<novaddt::HitList>();
254  mf::LogInfo("MichelEfinder")<<"config:"
255  <<"\n TracksTag:"<<fTracksTag
256  <<"\n HitsTag: "<<fHitsTag
257  <<"\n window: "
258  <<"\n\t MaxDistance: "<<fMaxDistance
259  <<"\n\t DTime limits: ["<<fDTime_min<<","<<fDTime_max<<"]";
260 }
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
const char * p
Definition: xmltok.h:285
enum BeamMode string
novaddt::MichelEfinder::MichelEfinder ( MichelEfinder const &  )
delete
novaddt::MichelEfinder::MichelEfinder ( MichelEfinder &&  )
delete

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
void novaddt::MichelEfinder::findmichelexclusion ( const novaddt::HitList ends,
const novaddt::HitList allhits,
novaddt::HitList answer 
)
private

Definition at line 110 of file MichelEfinder_module.cc.

References cmp_tdc(), febshutoff_auto::end, fDTime_max, fDTime_min, and michelclose().

Referenced by produce().

115 {
116  // Didn't find any track ends, nothing to exclude
117  if(ends.empty()) return;
118 
119  for(const auto & end: ends){
120  //const int endview = end.View().val;
121 
122  //find the time range
123  // Only need to look at the time region around the end
124  auto tmin=end.TDC()+fDTime_min;
125  auto tmax=end.TDC()+fDTime_max;
126  const auto range_beg = std::lower_bound(allhits.begin(),allhits.end(),tmin, cmp_tdc);
127  const auto range_end = std::lower_bound(range_beg, allhits.end(),tmax, cmp_tdc);
128  for(auto hit = range_beg; hit != range_end; hit++){
129  bool res = michelclose(end, *hit);
130  if(res) answer.push_back(*hit);
131  }
132  }
133 }
bool michelclose(const novaddt::DAQHit &trackend, const novaddt::DAQHit &testcell)
bool cmp_tdc(const novaddt::DAQHit &h, const novaddt::TDC &tdc)
Definition: structs.h:12
seed_t art::EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited
template<typename PROD , BranchType B>
ProductID art::EDProducer::getProductID ( std::string const &  instanceName = {}) const
inlineinherited

Definition at line 123 of file EDProducer.h.

References art::EDProducer::moduleDescription_.

Referenced by skim::NueSkimmer::CopyMichelSlice(), and skim::NueSkimmer::CopyMichelTrack().

124  {
125  return ProducerBase::getProductID<PROD, B>(moduleDescription_,
126  instanceName);
127  }
ModuleDescription moduleDescription_
Definition: EDProducer.h:115
template<typename PROD , BranchType B>
ProductID art::ProducerBase::getProductID ( ModuleDescription const &  moduleDescription,
std::string const &  instanceName 
) const
inherited

Definition at line 56 of file ProducerBase.h.

References art::ModuleDescription::moduleLabel().

Referenced by art::ProducerBase::modifiesEvent().

58  {
59  auto const& pd =
60  get_ProductDescription<PROD>(B, md.moduleLabel(), instanceName);
61  return pd.productID();
62  }
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::mayConsume ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::mayConsume ( InputTag const &  it)
inherited

Definition at line 189 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

190 {
191  if (!moduleContext_)
192  return ProductToken<T>::invalid();
193 
194  consumables_[BT].emplace_back(ConsumableType::Product,
195  TypeID{typeid(T)},
196  it.label(),
197  it.instance(),
198  it.process());
199  return ProductToken<T>{it};
200 }
set< int >::iterator it
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename T , art::BranchType BT>
void art::Consumer::mayConsumeMany ( )
inherited

Definition at line 204 of file Consumer.h.

References T.

205 {
206  if (!moduleContext_)
207  return;
208 
209  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
210 }
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::mayConsumeView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::mayConsumeView ( InputTag const &  it)
inherited

Definition at line 214 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

215 {
216  if (!moduleContext_)
217  return ViewToken<T>::invalid();
218 
219  consumables_[BT].emplace_back(ConsumableType::ViewElement,
220  TypeID{typeid(T)},
221  it.label(),
222  it.instance(),
223  it.process());
224  return ViewToken<T>{it};
225 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
bool novaddt::MichelEfinder::michelclose ( const novaddt::DAQHit trackend,
const novaddt::DAQHit testcell 
)
private

Definition at line 77 of file MichelEfinder_module.cc.

References fMaxDistance, and cet::pow().

Referenced by findmichelexclusion().

79 {
80  if(testcell.View()!=trackend.View())return false;
81 
82  const double dplane = 1.5*(trackend.Plane().val - testcell.Plane().val);
83  if(dplane > fMaxDistance) return false;
84 
85  const double dcell = trackend.Cell().val - testcell.Cell().val;
86  if(dcell > fMaxDistance) return false;
87 
88  double dist2 = pow(dplane, 2) + pow(dcell, 2);
89 
90  // Exclude a disc of hits up to N cells = N/1.5 planes away.
91  return dist2 <= fMaxDistance*fMaxDistance;
92 
93  // Now look, this is a very blunt cut, but we could get clever and notice
94  // that Michel hits ought to be in a line connected to the track end and
95  // < 5mus, whereas neutron hits are more random and can be much later, and
96  // B-12 hits, if we care, are 1-2 cells again connected to the track end.
97  // But let's see if this is sufficient before getting fancy.
98 }
novaddt::Plane const & Plane() const
Definition: DAQHit.h:70
value_type val
Definition: BaseProducts.h:109
constexpr T pow(T x)
Definition: pow.h:75
novaddt::View const & View() const
Definition: DAQHit.h:72
value_type val
Definition: BaseProducts.h:84
novaddt::Cell const & Cell() const
Definition: DAQHit.h:71
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
MichelEfinder& novaddt::MichelEfinder::operator= ( MichelEfinder const &  )
delete
MichelEfinder& novaddt::MichelEfinder::operator= ( MichelEfinder &&  )
delete
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
void novaddt::MichelEfinder::produce ( art::Event e)
overridevirtual

Implements art::EDProducer.

Definition at line 263 of file MichelEfinder_module.cc.

References DEFINE_ART_MODULE(), fHitsTag, findmichelexclusion(), findtrackends2d(), fTracksTag, art::DataViewImpl::getValidHandle(), art::Event::put(), and fillBadChanDBTables::result.

264 {
265  auto Tracks=e.getValidHandle<std::vector<novaddt::HitList>>(fTracksTag);
267 
268  std::vector<novaddt::DAQHit> trackEnds;
269  trackEnds.reserve(Tracks->size());
270 
271  mf::LogDebug("MichelEfinder")<<"find tracks ends for Ntrk="<<Tracks->size();
272  for(const auto& track: *Tracks){
273  auto ends=findtrackends2d(track);
274  trackEnds.insert(trackEnds.end(),ends.begin(),ends.end());
275  }
276  auto result=std::make_unique<novaddt::HitList>();
277  findmichelexclusion(trackEnds,*Hits,*result);
278 
279  mf::LogDebug("MichelEfinder")<<"found "<<result->size()<<" michel hits"
280  <<" around "<<trackEnds.size()<<" endpoints";
281  e.put(std::move(result));
282 }
std::vector< DAQHit > HitList
Definition: HitList.h:15
Definition: event.h:19
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
static std::vector< novaddt::DAQHit > findtrackends2d(const std::vector< novaddt::DAQHit > &trackhits)
void findmichelexclusion(const novaddt::HitList &ends, const novaddt::HitList &allhits, novaddt::HitList &answer)
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
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

int novaddt::MichelEfinder::fDTime_max
private

Definition at line 68 of file MichelEfinder_module.cc.

Referenced by findmichelexclusion(), and MichelEfinder().

int novaddt::MichelEfinder::fDTime_min
private

Definition at line 67 of file MichelEfinder_module.cc.

Referenced by findmichelexclusion(), and MichelEfinder().

art::InputTag novaddt::MichelEfinder::fHitsTag
private

Definition at line 64 of file MichelEfinder_module.cc.

Referenced by MichelEfinder(), and produce().

double novaddt::MichelEfinder::fMaxDistance
private

Definition at line 66 of file MichelEfinder_module.cc.

Referenced by michelclose(), and MichelEfinder().

art::InputTag novaddt::MichelEfinder::fTracksTag
private

Definition at line 63 of file MichelEfinder_module.cc.

Referenced by MichelEfinder(), and produce().

const int novaddt::MichelEfinder::kTDC_PER_USEC = 64
private

Definition at line 61 of file MichelEfinder_module.cc.


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