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

 CVNCosmicTFFilt (fhicl::ParameterSet const &pset)
 
virtual ~CVNCosmicTFFilt ()
 
void produce (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 fCVNCosmicFiltInput
 
bool fApplyHitFilter
 
const art::ProductToken< std::vector< cvntf::CVNCosmicFiltList > > fFiltList
 
const art::ProductToken< std::vector< rb::CellHit > > fCellHitToken
 Read CellHits from this input. More...
 

Detailed Description

Definition at line 28 of file CVNCosmicTFFilt_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

cvntf::CVNCosmicTFFilt::CVNCosmicTFFilt ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 46 of file CVNCosmicTFFilt_module.cc.

46  :
47  fCVNCosmicFiltInput(pset.get<std::string>("CVNCosmicFiltInput")),
48  fApplyHitFilter(pset.get<bool>("ApplyHitFilter")),
49  fFiltList(consumes<std::vector<cvntf::CVNCosmicFiltList>>(fCVNCosmicFiltInput)),
50  fCellHitToken(consumes<std::vector<rb::CellHit>>(pset.get<std::string>("CellHitInput")))
51  {
52  produces<std::vector<rb::CellHit> >();
53 
54  }
const art::ProductToken< std::vector< cvntf::CVNCosmicFiltList > > fFiltList
ProductToken< T > consumes(InputTag const &)
const art::ProductToken< std::vector< rb::CellHit > > fCellHitToken
Read CellHits from this input.
enum BeamMode string
cvntf::CVNCosmicTFFilt::~CVNCosmicTFFilt ( )
virtual

Definition at line 56 of file CVNCosmicTFFilt_module.cc.

57  {
58  }

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
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 cvntf::CVNCosmicTFFilt::produce ( art::Event evt)
virtual

Implements art::EDProducer.

Definition at line 60 of file CVNCosmicTFFilt_module.cc.

References a, b, getBrightness::cell, om::cout, DEFINE_ART_MODULE(), allTimeWatchdog::endl, fApplyHitFilter, fCellHitToken, fFiltList, art::DataViewImpl::getByToken(), it, cvntf::CVNCosmicFilt::nHits, cvntf::CVNCosmicFilt::passSel, art::Event::put(), cvntf::CVNCosmicFilt::timeWinMax, cvntf::CVNCosmicFilt::timeWinMin, and rb::CellHit::TNS().

61  {
62 
63 
65  evt.getByToken(fCellHitToken, hitcol);
66  std::vector<rb::CellHit> hitlist = *hitcol;
67  std::sort(hitlist.begin(), hitlist.end(),
68  [](const rb::CellHit& a, const rb::CellHit& b)
69  {return a.TNS() < b.TNS();});
70 
71 
73  evt.getByToken(fFiltList, filtcol);
74  std::vector<cvntf::CVNCosmicFiltList> filtlist = *filtcol;
75 
76  auto cellhitcol = std::make_unique<std::vector<rb::CellHit>>();
77 
78  cvntf::CVNCosmicFiltList cosfiltlist;
79 
80  //
81  // do hit filtering
82  //
83  float minT = -99999;
84  float maxT = -99999;
85  unsigned int cStart = 0;
86  unsigned int checksum = 0;
87  unsigned int hitCount = 0;
88  bool selected = false;
89  for(size_t iP = 0; iP < filtlist[0].ListSize(); ++iP) {
90  cvntf::CVNCosmicFilt cosfilt = filtlist[0].GetTimeSlice(iP);
91 
92  // Keep hits for selected slices or if we are keeping all hits
93  if (!cosfilt.passSel && fApplyHitFilter) continue;
94  unsigned int gapCount = 0;
95  checksum += cosfilt.nHits;
96  minT = cosfilt.timeWinMin;
97  //if we have two consectutive selected slices, count overlap
98  if (selected && (minT < maxT)){
99  for (unsigned int it = 0; it < hitlist.size(); ++it){
100  const rb::CellHit& cell = hitlist[it];
101  if (minT > cell.TNS()) continue;
102  if (cell.TNS() >= maxT) break;
103  gapCount++;
104  }
105  checksum -= gapCount;
106  }
107  if (minT < maxT) minT = maxT;
108  maxT = cosfilt.timeWinMax;
109  for (unsigned int ic = cStart; ic < hitlist.size(); ++ic){
110  const rb::CellHit& cell = hitlist[ic];
111  if (minT > cell.TNS()) continue;
112  if (cell.TNS() >= maxT){
113  cStart = ic;
114  break;
115  }
116  hitCount++;
117  cellhitcol->push_back(cell);
118  }
119  //store selection state for next time slice
120  selected = cosfilt.passSel;
121  if (!fApplyHitFilter) selected = true;
122 
123  } // pixel maps
124 
125  //abort if we are dropping hits and the checksum doesn't match
126  if (checksum != hitCount){
127  std::cout<<"CVNCosmicTFFilter: Expected number of cell hits: "<<
128  checksum<<" not equal to hits in filter list "<<hitCount<<" aborting!"
129  <<std::endl;
130  abort();
131  }
132 
133  evt.put(std::move(cellhitcol));
134 
135  } // produce
float TNS() const
Definition: CellHit.h:46
set< int >::iterator it
const art::ProductToken< std::vector< cvntf::CVNCosmicFiltList > > fFiltList
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
const double a
OStream cout
Definition: OStream.cxx:6
A rawdata::RawDigit with channel information decoded.
Definition: CellHit.h:27
const hit & b
Definition: hits.cxx:21
bool getByToken(ProductToken< PROD > const &token, Handle< PROD > &result) const
Definition: DataViewImpl.h:387
unsigned int nHits
number of hits in time window
const art::ProductToken< std::vector< rb::CellHit > > fCellHitToken
Read CellHits from this input.
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

bool cvntf::CVNCosmicTFFilt::fApplyHitFilter
protected

Definition at line 37 of file CVNCosmicTFFilt_module.cc.

Referenced by produce().

const art::ProductToken<std::vector<rb::CellHit> > cvntf::CVNCosmicTFFilt::fCellHitToken
protected

Read CellHits from this input.

Definition at line 41 of file CVNCosmicTFFilt_module.cc.

Referenced by produce().

std::string cvntf::CVNCosmicTFFilt::fCVNCosmicFiltInput
protected

Definition at line 36 of file CVNCosmicTFFilt_module.cc.

const art::ProductToken<std::vector<cvntf::CVNCosmicFiltList> > cvntf::CVNCosmicTFFilt::fFiltList
protected

Definition at line 39 of file CVNCosmicTFFilt_module.cc.

Referenced by produce().


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