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

 CVNCosmicMapper (fhicl::ParameterSet const &pset)
 
 ~CVNCosmicMapper ()
 
void produce (art::Event &evt)
 
void beginJob ()
 
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 ()
 

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

const art::ProductToken< std::vector< rb::CellHit > > fCellHitToken
 Read CellHits from this input. More...
 
unsigned short fCellWidth
 Ratio of Cosmic pixel maps to Nu pixel maps to create. More...
 
unsigned short fPlaneLength
 Length of pixel map in planes. More...
 
unsigned int fMaxPlaneGap
 
int fTimeWinSize
 Size of time window used in map. More...
 
int fTimeWinOffset
 Where to start first time window. More...
 
int fTimeWinOverlap
 amount of overlap between windows More...
 
unsigned int fNumClusters
 number of time windows to make More...
 
bool fWriteClusters
 write clusters to file More...
 

Detailed Description

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

cvn::CVNCosmicMapper::CVNCosmicMapper ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 88 of file CVNCosmicMapper_module.cc.

References fWriteClusters.

88  :
89  fCellHitToken(consumes<std::vector<rb::CellHit>>(pset.get<std::string>("CellHitInput"))),
90  fCellWidth (pset.get<unsigned short> ("CellWidth")),
91  fPlaneLength (pset.get<unsigned short> ("PlaneLength")),
92  fMaxPlaneGap (pset.get<unsigned int> ("MaxPlaneGap")),
93  fTimeWinSize (pset.get<int> ("TimeWinSize")),
94  fTimeWinOffset (pset.get<int> ("TimeWinOffset")),
95  fTimeWinOverlap(pset.get<int> ("TimeWinOverlap")),
96  fNumClusters (pset.get<unsigned int> ("NumClusters")),
97  fWriteClusters (pset.get<bool> ("WriteClusters"))
98  {
99 
100  produces< std::vector<cvn::PixelMap> > ();
101  if (fWriteClusters) produces< std::vector<rb::Cluster> > ();
102  if (fWriteClusters) produces< art::Assns<cvn::PixelMap, rb::Cluster> >();
103  }
unsigned int fNumClusters
number of time windows to make
const art::ProductToken< std::vector< rb::CellHit > > fCellHitToken
Read CellHits from this input.
int fTimeWinSize
Size of time window used in map.
int fTimeWinOverlap
amount of overlap between windows
bool fWriteClusters
write clusters to file
unsigned short fPlaneLength
Length of pixel map in planes.
unsigned short fCellWidth
Ratio of Cosmic pixel maps to Nu pixel maps to create.
int fTimeWinOffset
Where to start first time window.
ProductToken< T > consumes(InputTag const &)
enum BeamMode string
cvn::CVNCosmicMapper::~CVNCosmicMapper ( )

Definition at line 106 of file CVNCosmicMapper_module.cc.

107  {
108  }

Member Function Documentation

void cvn::CVNCosmicMapper::beginJob ( )
virtual

Reimplemented from art::EDProducer.

Definition at line 111 of file CVNCosmicMapper_module.cc.

112  {
113  }
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 cvn::CVNCosmicMapper::endJob ( )
virtual

Reimplemented from art::EDProducer.

Definition at line 116 of file CVNCosmicMapper_module.cc.

117  {
118  }
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 cvn::CVNCosmicMapper::produce ( art::Event evt)
virtual

Implements art::EDProducer.

Definition at line 121 of file CVNCosmicMapper_module.cc.

References a, cvn::PixelMap::Add(), rb::Cluster::Add(), b, rb::CellHit::Cell(), rb::Cluster::Clear(), util::CreateAssn(), DEFINE_ART_MODULE(), fCellHitToken, fCellWidth, fNumClusters, fPlaneLength, fTimeWinOffset, fTimeWinOverlap, fTimeWinSize, fWriteClusters, art::DataViewImpl::getByToken(), hits(), MECModelEnuComparisons::i, makeTrainCVSamples::int, calib::j, cvn::kEmptyHit, rb::CellHit::Plane(), art::Event::put(), cvn::PixelMap::SetMaxTime(), cvn::PixelMap::SetMinTime(), rb::CellHit::TNS(), POTSpillRate::view, and rb::CellHit::View().

122  {
123 
124  std::unique_ptr< std::vector<rb::Cluster>> clustercol(new std::vector<rb::Cluster>);
125  std::unique_ptr< art::Assns<PixelMap, rb::Cluster> >
127 
128  //Declaring containers for things to be stored in event
129  auto pmCol = std::make_unique<std::vector<PixelMap>>();
130  pmCol->reserve(fNumClusters+1);
131 
132  // Get the cell hits
134  evt.getByToken(fCellHitToken, hitcol);
135 
136  std::vector<art::Ptr<rb::CellHit > > hits;
137  if (fWriteClusters){
138  for(unsigned int i = 0; i < hitcol->size(); ++i){
139  art::Ptr<rb::CellHit> hit(hitcol, i);
140  hits.push_back(hit);
141  }
142  std::sort(hits.begin(), hits.end(),
144  {return a->TNS() < b->TNS();});
145  }
146 
147  // Extract all the hits as concrete objects
148  std::vector<rb::CellHit> hitlist = *hitcol;
149 
150  // Sort the hits by time to improve the speed.
151  // WARNING: The rest of the code assumes that the hits are
152  // time sorted!
153  std::sort(hitlist.begin(), hitlist.end(),
154  [](const rb::CellHit& a, const rb::CellHit& b)
155  {return a.TNS() < b.TNS();});
156 
157  // Sort hits into time chunks now and make clusters from them.
158  // Also need to associate the hits with an label.
159 
160  //boundary is always the full detector size so just fix that
162 
163 
164  rb::Cluster cluster;
165 
166  // Step through the event and group clusters of hits over 15uSec centered on 217-232 (spill window)
167  // We add a 1uSec overlap on the beginning as well
168  for(unsigned int i = 0; i < fNumClusters; ++i) {
169  pmCol->emplace_back(fPlaneLength, fCellWidth, bound, true); // PEOnly
170  PixelMap& pm = pmCol->back();
171  unsigned int iCount=0;
172  if (fWriteClusters) cluster.Clear();
173  pm.SetMinTime(i*(fTimeWinSize-fTimeWinOverlap)+fTimeWinOffset);
175  for(unsigned int j = 0; j < hitlist.size(); ++j) {
176  const rb::CellHit& hj = hitlist[j];
177 
178  if ((i*(fTimeWinSize-fTimeWinOverlap)+fTimeWinOffset) > (hj.TNS())) continue;
180  if (fWriteClusters){
181  clustercol->push_back(cluster);
182  util::CreateAssn(*this, evt, *(assoc.get()), *(pmCol.get()), *(clustercol), i, i);
183  }
184  break;
185  }
186  unsigned int view = (unsigned int)hj.View();
187  pm.Add(hj.Plane(),
188  hj.Cell(),
189  1.0,
190  view,
191  iCount,
192  hj.TNS(),
193  kEmptyHit,
194  0.0,
195  0,
196  0 );
197  iCount++;
198  if (fWriteClusters) cluster.Add(hits[j]);
199  }
200  }
201 
202 
203 
204  // Drop the cluster collections, pixelmap collections and associations into the event
205  evt.put(std::move(pmCol));
206  if (fWriteClusters){
207  evt.put(std::move(clustercol));
208  evt.put(std::move(assoc));
209  }
210  }
float TNS() const
Definition: CellHit.h:46
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.
unsigned int fNumClusters
number of time windows to make
const art::ProductToken< std::vector< rb::CellHit > > fCellHitToken
Read CellHits from this input.
unsigned short Plane() const
Definition: CellHit.h:39
geo::View_t View() const
Definition: CellHit.h:41
A collection of associated CellHits.
Definition: Cluster.h:47
int fTimeWinSize
Size of time window used in map.
int fTimeWinOverlap
amount of overlap between windows
bool fWriteClusters
write clusters to file
virtual void Add(const art::Ptr< rb::CellHit > &cell, double weight=1)
Definition: Cluster.cxx:84
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
unsigned short Cell() const
Definition: CellHit.h:40
void hits()
Definition: readHits.C:15
const double a
const double j
Definition: BetheBloch.cxx:29
unsigned short fPlaneLength
Length of pixel map in planes.
unsigned short fCellWidth
Ratio of Cosmic pixel maps to Nu pixel maps to create.
A rawdata::RawDigit with channel information decoded.
Definition: CellHit.h:27
Definition: structs.h:12
int fTimeWinOffset
Where to start first time window.
const hit & b
Definition: hits.cxx:21
bool getByToken(ProductToken< PROD > const &token, Handle< PROD > &result) const
Definition: DataViewImpl.h:387
virtual void Clear()
Forget about all owned cell hits.
Definition: Cluster.cxx:279
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

const art::ProductToken<std::vector<rb::CellHit> > cvn::CVNCosmicMapper::fCellHitToken
private

Read CellHits from this input.

Definition at line 52 of file CVNCosmicMapper_module.cc.

Referenced by produce().

unsigned short cvn::CVNCosmicMapper::fCellWidth
private

Ratio of Cosmic pixel maps to Nu pixel maps to create.

Width of pixel map in cells

Definition at line 60 of file CVNCosmicMapper_module.cc.

Referenced by produce().

unsigned int cvn::CVNCosmicMapper::fMaxPlaneGap
private

Maximum gap in planes at front of cluster to prevent pruning of upstream hits

Definition at line 67 of file CVNCosmicMapper_module.cc.

unsigned int cvn::CVNCosmicMapper::fNumClusters
private

number of time windows to make

Definition at line 79 of file CVNCosmicMapper_module.cc.

Referenced by produce().

unsigned short cvn::CVNCosmicMapper::fPlaneLength
private

Length of pixel map in planes.

Definition at line 63 of file CVNCosmicMapper_module.cc.

Referenced by produce().

int cvn::CVNCosmicMapper::fTimeWinOffset
private

Where to start first time window.

Definition at line 73 of file CVNCosmicMapper_module.cc.

Referenced by produce().

int cvn::CVNCosmicMapper::fTimeWinOverlap
private

amount of overlap between windows

Definition at line 76 of file CVNCosmicMapper_module.cc.

Referenced by produce().

int cvn::CVNCosmicMapper::fTimeWinSize
private

Size of time window used in map.

Definition at line 70 of file CVNCosmicMapper_module.cc.

Referenced by produce().

bool cvn::CVNCosmicMapper::fWriteClusters
private

write clusters to file

Definition at line 82 of file CVNCosmicMapper_module.cc.

Referenced by CVNCosmicMapper(), and produce().


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