Public Member Functions | Private Attributes | List of all members
cvn::CVNMapperProtoDUNE Class Reference
Inheritance diagram for cvn::CVNMapperProtoDUNE:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Member Functions

 CVNMapperProtoDUNE (fhicl::ParameterSet const &pset)
 
 ~CVNMapperProtoDUNE ()
 
void produce (art::Event &evt)
 
void beginJob ()
 
void endJob ()
 
- Public Member Functions inherited from art::EDProducer
 EDProducer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDProducer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Producer
virtual ~Producer () noexcept
 
 Producer (fhicl::ParameterSet const &)
 
 Producer (Producer const &)=delete
 
 Producer (Producer &&)=delete
 
Produceroperator= (Producer const &)=delete
 
Produceroperator= (Producer &&)=delete
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Modifier
 ~Modifier () noexcept
 
 Modifier ()
 
 Modifier (Modifier const &)=delete
 
 Modifier (Modifier &&)=delete
 
Modifieroperator= (Modifier const &)=delete
 
Modifieroperator= (Modifier &&)=delete
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Attributes

std::string fHitsModuleLabel
 Module label for input hits. More...
 
std::string fParticleModuleLabel
 Module label for input particles. More...
 
std::string fTrackLabel
 Module label for input tracks. More...
 
std::string fShowerLabel
 Module label for input showers. More...
 
std::string fClusterPMLabel
 Instance lablel for cluster pixelmaps. More...
 
unsigned short fMinClusterHits
 Minimum number of hits for cluster to be converted to pixel map. More...
 
unsigned short fTdcWidth
 Width of pixel map in tdcs. More...
 
unsigned short fWireLength
 Length of pixel map in wires. More...
 
double fTimeResolution
 Length of pixel map in wires. More...
 
unsigned short fUnwrappedPixelMap
 Use unwrapped pixel maps? More...
 
float fTrackLengthCut
 Track length cut. More...
 
bool fUseWholeEvent
 Use the whole event instead of each track and shower. More...
 
bool fUseBeamSliceOnly
 For protoDUNE vertex finding, we only want the beam slice. More...
 
PixelMapProducer fProducer
 PixelMapProducer does the work for us. More...
 

Additional Inherited Members

- Public Types inherited from art::EDProducer
using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
- Public Types inherited from art::detail::Producer
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 
- Public Types inherited from art::Modifier
template<typename UserConfig , typename UserKeysToIgnore = void>
using Table = ProducerTable< UserConfig, detail::ModuleConfig, UserKeysToIgnore >
 
- Static Public Member Functions inherited from art::EDProducer
static void commitEvent (EventPrincipal &ep, Event &e)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Definition at line 38 of file CVNMapperProtoDUNE_module.cc.

Constructor & Destructor Documentation

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

Definition at line 102 of file CVNMapperProtoDUNE_module.cc.

102  : EDProducer{pset},
103  fHitsModuleLabel (pset.get<std::string> ("HitsModuleLabel")),
104  fParticleModuleLabel (pset.get<std::string> ("ParticleModuleLabel")),
105  fTrackLabel (pset.get<std::string> ("TrackLabel")),
106  fShowerLabel (pset.get<std::string> ("ShowerLabel")),
107  fClusterPMLabel(pset.get<std::string> ("ClusterPMLabel")),
108  fMinClusterHits(pset.get<unsigned short> ("MinClusterHits")),
109  fTdcWidth (pset.get<unsigned short> ("TdcWidth")),
110  fWireLength (pset.get<unsigned short> ("WireLength")),
111  fTimeResolution (pset.get<unsigned short> ("TimeResolution")),
112  fUnwrappedPixelMap(pset.get<unsigned short> ("UnwrappedPixelMap")),
113  fTrackLengthCut(pset.get<unsigned short> ("TrackLengthCut")),
114  fUseWholeEvent(pset.get<bool> ("UseWholeEvent")),
115  fUseBeamSliceOnly(pset.get<bool> ("UseBeamSliceOnly")),
117  {
118 
119  produces< std::vector<cvn::PixelMap> >(fClusterPMLabel);
120 
121  }
std::string fTrackLabel
Module label for input tracks.
unsigned short fTdcWidth
Width of pixel map in tdcs.
PixelMapProducer fProducer
PixelMapProducer does the work for us.
std::string string
Definition: nybbler.cc:12
bool fUseWholeEvent
Use the whole event instead of each track and shower.
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
unsigned short fMinClusterHits
Minimum number of hits for cluster to be converted to pixel map.
double fTimeResolution
Length of pixel map in wires.
std::string fClusterPMLabel
Instance lablel for cluster pixelmaps.
float fTrackLengthCut
Track length cut.
bool fUseBeamSliceOnly
For protoDUNE vertex finding, we only want the beam slice.
std::string fParticleModuleLabel
Module label for input particles.
unsigned short fUnwrappedPixelMap
Use unwrapped pixel maps?
std::string fShowerLabel
Module label for input showers.
unsigned short fWireLength
Length of pixel map in wires.
std::string fHitsModuleLabel
Module label for input hits.
cvn::CVNMapperProtoDUNE::~CVNMapperProtoDUNE ( )

Definition at line 124 of file CVNMapperProtoDUNE_module.cc.

125  {
126  //======================================================================
127  // Clean up any memory allocated by your module
128  //======================================================================
129  }

Member Function Documentation

void cvn::CVNMapperProtoDUNE::beginJob ( )
virtual

Reimplemented from art::EDProducer.

Definition at line 132 of file CVNMapperProtoDUNE_module.cc.

133  { }
void cvn::CVNMapperProtoDUNE::endJob ( )
virtual

Reimplemented from art::EDProducer.

Definition at line 136 of file CVNMapperProtoDUNE_module.cc.

137  {
138  }
void cvn::CVNMapperProtoDUNE::produce ( art::Event evt)
virtual

Implements art::EDProducer.

Definition at line 141 of file CVNMapperProtoDUNE_module.cc.

142  {
143 
144  //Declaring containers for things to be stored in event
145  std::unique_ptr< std::vector<cvn::PixelMap> > pmCol(new std::vector<cvn::PixelMap>);
146 
147  // Use unwrapped pixel maps if requested
148  // For protoDUNE unwrapped if > 0
151 
152  // Use the whole event just like we would for the FD
153  auto const detProp = art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(evt);
154  if(fUseWholeEvent){
155  std::vector< art::Ptr< recob::Hit > > hitlist;
156  auto hitListHandle = evt.getHandle< std::vector< recob::Hit > >(fHitsModuleLabel);
157  if (hitListHandle)
158  art::fill_ptr_vector(hitlist, hitListHandle);
159  unsigned short nhits = hitlist.size();
160 
161  std::cout << "nhits: " << nhits << std::endl; // REMOVE
162 
163  if(nhits>fMinClusterHits){
164  PixelMap pm = fProducer.CreateMap(detProp, hitlist);
165  pmCol->push_back(pm);
166  }
167  }
168  else if(fUseBeamSliceOnly){
169  // We want to make a pixel map for just APA3. We can pad out to 500 pixels in the wire number
170  // The best way to do this is to get the Pandora beam slice
171  cvn::CVNProtoDUNEUtils pfpUtil;
172  const unsigned int beamSlice = pfpUtil.GetBeamSlice(evt,fParticleModuleLabel);
173  if(beamSlice < 500){
174  const std::vector<const recob::Hit*> sliceHits = pfpUtil.GetRecoSliceHits(beamSlice,evt,fParticleModuleLabel);
175 
176  PixelMap pm = fProducer.CreateMap(detProp, sliceHits);
177  pmCol->push_back(pm);
178  }
179  }
180  else{
181  // Get the list of tracks and showers and their associated hits
182  auto allTracks=evt.getValidHandle<std::vector<recob::Track> >(fTrackLabel);
183  const art::FindManyP<recob::Hit> findTrackHits(allTracks,evt,fTrackLabel);
184 
185  auto allShowers=evt.getValidHandle<std::vector<recob::Shower> >(fShowerLabel);
186  const art::FindManyP<recob::Hit> findShowerHits(allShowers,evt,fShowerLabel);
187 
188  std::cout << "Event contains " << allTracks->size() << " tracks and " << allShowers->size() << " showers" << std::endl;
189 
190  // Iterate over the tracks and showers making a PixelMap for each
191  for(unsigned int t = 0; t < allTracks->size(); ++t){
192 
193  std::vector<art::Ptr<recob::Hit> > trackHits = findTrackHits.at(t);
194  if(trackHits.size()>fMinClusterHits && (*allTracks)[t].Length() > fTrackLengthCut){
195  // std::cout << "Making PixelMap number " << pmCol->size() + 1 << " with " << trackHits.size() << " hits" << std::endl;
196 
197  PixelMap pm = fProducer.CreateMap(detProp, trackHits);
198  pmCol->push_back(pm);
199  }
200 
201  }
202 
203  for(unsigned int s = 0; s < allShowers->size(); ++s){
204 
205  std::vector<art::Ptr<recob::Hit> > showerHits = findShowerHits.at(s);
206  if(showerHits.size()>fMinClusterHits){
207  PixelMap pm = fProducer.CreateMap(detProp, showerHits);
208  pmCol->push_back(pm);
209  }
210  }
211  }
212 
213  std::cout << "Made " << pmCol->size() << " pixel maps for this event" << std::endl;
214 
215  evt.put(std::move(pmCol), fClusterPMLabel);
216 
217  }
std::string fTrackLabel
Module label for input tracks.
PixelMapProducer fProducer
PixelMapProducer does the work for us.
Handle< PROD > getHandle(SelectorBase const &) const
Definition: DataViewImpl.h:382
bool fUseWholeEvent
Use the whole event instead of each track and shower.
unsigned short fMinClusterHits
Minimum number of hits for cluster to be converted to pixel map.
uint size() const
Definition: qcstring.h:201
std::string fClusterPMLabel
Instance lablel for cluster pixelmaps.
void SetUnwrapped(unsigned short unwrap)
def move(depos, offset)
Definition: depos.py:107
const std::vector< const recob::Hit * > GetRecoSliceHits(const recob::Slice &slice, art::Event const &evt, const std::string sliceModule) const
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
Definition: DataViewImpl.h:441
float fTrackLengthCut
Track length cut.
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: DataViewImpl.h:686
bool fUseBeamSliceOnly
For protoDUNE vertex finding, we only want the beam slice.
std::string fParticleModuleLabel
Module label for input particles.
unsigned short fUnwrappedPixelMap
Use unwrapped pixel maps?
std::string fShowerLabel
Module label for input showers.
unsigned short GetBeamSlice(art::Event const &evt, const std::string particleLabel) const
Try to get the slice tagged as beam. Returns 9999 if no beam slice was found.
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:297
static QCString * s
Definition: config.cpp:1042
QTextStream & endl(QTextStream &s)
PixelMap CreateMap(detinfo::DetectorPropertiesData const &detProp, const std::vector< art::Ptr< recob::Hit > > &slice)
std::string fHitsModuleLabel
Module label for input hits.

Member Data Documentation

std::string cvn::CVNMapperProtoDUNE::fClusterPMLabel
private

Instance lablel for cluster pixelmaps.

Definition at line 63 of file CVNMapperProtoDUNE_module.cc.

std::string cvn::CVNMapperProtoDUNE::fHitsModuleLabel
private

Module label for input hits.

Definition at line 51 of file CVNMapperProtoDUNE_module.cc.

unsigned short cvn::CVNMapperProtoDUNE::fMinClusterHits
private

Minimum number of hits for cluster to be converted to pixel map.

Definition at line 66 of file CVNMapperProtoDUNE_module.cc.

std::string cvn::CVNMapperProtoDUNE::fParticleModuleLabel
private

Module label for input particles.

Definition at line 54 of file CVNMapperProtoDUNE_module.cc.

PixelMapProducer cvn::CVNMapperProtoDUNE::fProducer
private

PixelMapProducer does the work for us.

Definition at line 95 of file CVNMapperProtoDUNE_module.cc.

std::string cvn::CVNMapperProtoDUNE::fShowerLabel
private

Module label for input showers.

Definition at line 60 of file CVNMapperProtoDUNE_module.cc.

unsigned short cvn::CVNMapperProtoDUNE::fTdcWidth
private

Width of pixel map in tdcs.

Definition at line 69 of file CVNMapperProtoDUNE_module.cc.

double cvn::CVNMapperProtoDUNE::fTimeResolution
private

Length of pixel map in wires.

Definition at line 75 of file CVNMapperProtoDUNE_module.cc.

std::string cvn::CVNMapperProtoDUNE::fTrackLabel
private

Module label for input tracks.

Definition at line 57 of file CVNMapperProtoDUNE_module.cc.

float cvn::CVNMapperProtoDUNE::fTrackLengthCut
private

Track length cut.

Definition at line 86 of file CVNMapperProtoDUNE_module.cc.

unsigned short cvn::CVNMapperProtoDUNE::fUnwrappedPixelMap
private

Use unwrapped pixel maps?

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

Definition at line 83 of file CVNMapperProtoDUNE_module.cc.

bool cvn::CVNMapperProtoDUNE::fUseBeamSliceOnly
private

For protoDUNE vertex finding, we only want the beam slice.

Definition at line 92 of file CVNMapperProtoDUNE_module.cc.

bool cvn::CVNMapperProtoDUNE::fUseWholeEvent
private

Use the whole event instead of each track and shower.

Definition at line 89 of file CVNMapperProtoDUNE_module.cc.

unsigned short cvn::CVNMapperProtoDUNE::fWireLength
private

Length of pixel map in wires.

Definition at line 72 of file CVNMapperProtoDUNE_module.cc.


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