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

Public Member Functions

 BeamFlashTrackMatchTagger (fhicl::ParameterSet const &p)
 
 BeamFlashTrackMatchTagger (BeamFlashTrackMatchTagger const &)=delete
 
 BeamFlashTrackMatchTagger (BeamFlashTrackMatchTagger &&)=delete
 
BeamFlashTrackMatchTaggeroperator= (BeamFlashTrackMatchTagger const &)=delete
 
BeamFlashTrackMatchTaggeroperator= (BeamFlashTrackMatchTagger &&)=delete
 
void produce (art::Event &e) override
 
- 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

BeamFlashTrackMatchTaggerAlg fAlg
 
std::string fTrackModuleLabel
 
std::string fFlashModuleLabel
 
HitTagAssociatorAlg fHitTagAssnsAlg
 
bool fMakeHitTagAssns
 
std::string fHitModuleLabel
 

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 37 of file BeamFlashTrackMatchTagger_module.cc.

Constructor & Destructor Documentation

cosmic::BeamFlashTrackMatchTagger::BeamFlashTrackMatchTagger ( fhicl::ParameterSet const &  p)
explicit

Definition at line 65 of file BeamFlashTrackMatchTagger_module.cc.

66  : EDProducer{p},
67  fAlg(p.get<fhicl::ParameterSet>("BeamFlashTrackMatchAlgParams")),
68  fTrackModuleLabel(p.get<std::string>("TrackModuleLabel")),
69  fFlashModuleLabel(p.get<std::string>("FlashModuleLabel")),
70  fHitTagAssnsAlg(p.get<fhicl::ParameterSet>("HitTagAssociatorAlgParams")),
71  fMakeHitTagAssns(p.get<bool>("MakeHitTagAssns",false)),
72  fHitModuleLabel(p.get<std::string>("HitModuleLabel","dummy_hit"))
73 {
74  produces< std::vector<anab::CosmicTag> >();
75  produces< art::Assns<recob::Track, anab::CosmicTag> >();
76  if(fMakeHitTagAssns) produces< art::Assns<recob::Hit, anab::CosmicTag> >();
77 }
std::string string
Definition: nybbler.cc:12
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
p
Definition: test.py:223
cosmic::BeamFlashTrackMatchTagger::BeamFlashTrackMatchTagger ( BeamFlashTrackMatchTagger const &  )
delete
cosmic::BeamFlashTrackMatchTagger::BeamFlashTrackMatchTagger ( BeamFlashTrackMatchTagger &&  )
delete

Member Function Documentation

BeamFlashTrackMatchTagger& cosmic::BeamFlashTrackMatchTagger::operator= ( BeamFlashTrackMatchTagger const &  )
delete
BeamFlashTrackMatchTagger& cosmic::BeamFlashTrackMatchTagger::operator= ( BeamFlashTrackMatchTagger &&  )
delete
void cosmic::BeamFlashTrackMatchTagger::produce ( art::Event e)
overridevirtual

Implements art::EDProducer.

Definition at line 79 of file BeamFlashTrackMatchTagger_module.cc.

80 {
81  // services and providers we'll be using
82  auto providers = lar::extractProviders<
85  >();
86 
88  phot::PhotonVisibilityService const& pvs(*pvsHandle);
90  opdet::OpDigiProperties const& opdigip(*opdigipHandle);
91 
92  //Get Flashes from event.
94  evt.getByLabel(fFlashModuleLabel, flashHandle);
95  std::vector<recob::OpFlash> const& flashVector(*flashHandle);
96 
97  //Get Tracks from event.
99  evt.getByLabel(fTrackModuleLabel, trackHandle);
100  std::vector<recob::Track> const& trackVector(*trackHandle);
101 
102  //Make the containger for the tag product to put onto the event.
103  std::unique_ptr< std::vector<anab::CosmicTag> > cosmicTagPtr ( new std::vector<anab::CosmicTag>);
104  std::vector<anab::CosmicTag> & cosmicTagVector(*cosmicTagPtr);
105 
106  //Make a container for the track<-->tag associations.
107  //One entry per track, with entry equal to index in cosmic tag collection of associated tag.
108  std::vector<size_t> assnTrackTagVector;
109  std::unique_ptr< art::Assns<recob::Track,anab::CosmicTag> > assnTrackTag(new art::Assns<recob::Track,anab::CosmicTag>);
110 
111  //run the alg!
112  fAlg.RunCompatibilityCheck(flashVector, trackVector,
113  cosmicTagVector, assnTrackTagVector,
114  providers, pvs, opdigip);
115 
116 
117  //Make the associations for ART
118  for(size_t track_iter=0; track_iter<assnTrackTagVector.size(); track_iter++){
119  if(assnTrackTagVector[track_iter]==std::numeric_limits<size_t>::max()) continue;
120  art::Ptr<recob::Track> trk_ptr(trackHandle,track_iter);
121  util::CreateAssn(*this, evt, cosmicTagVector, trk_ptr, *assnTrackTag, assnTrackTagVector[track_iter]);
122  }
123 
124  //make hit<--> tag associations, if requested
125  if(fMakeHitTagAssns){
126 
127  //Get Hits from event.
129  evt.getByLabel(fHitModuleLabel, hitHandle);
130 
131  //Get track<-->hit associations
133  evt.getByLabel(fTrackModuleLabel,assnHitTrackHandle);
134  std::vector< std::vector<size_t> >
135  track_indices_per_hit = util::GetAssociatedVectorManyI(assnHitTrackHandle,
136  hitHandle);
137 
138  std::vector< std::vector<size_t> > assnHitTagVector;
139  std::unique_ptr< art::Assns<recob::Hit,anab::CosmicTag> > assnHitTag(new art::Assns<recob::Hit,anab::CosmicTag>);
140 
141  fHitTagAssnsAlg.MakeHitTagAssociations(track_indices_per_hit,
142  assnTrackTagVector,
143  assnHitTagVector);
144 
145  //Make the associations for ART
146  for(size_t hit_iter=0; hit_iter<assnHitTagVector.size(); hit_iter++){
147  art::Ptr<recob::Hit> hit_ptr(hitHandle,hit_iter);
148  for(size_t tag_iter=0; tag_iter<assnHitTagVector[hit_iter].size(); tag_iter++)
149  util::CreateAssn(*this, evt, cosmicTagVector, hit_ptr, *assnHitTag, assnHitTagVector[hit_iter][tag_iter]);
150  }
151 
152  evt.put( std::move(assnHitTag));
153  }//end if makes hit<-->tag associations
154 
155  //put the data on the event
156  evt.put(std::move(cosmicTagPtr));
157  evt.put(std::move(assnTrackTag));
158 
159 }
ProviderPackFromServices< Services... > extractProviders()
Returns a provider pack with providers from specified services.
Definition: ServicePack.h:54
void RunCompatibilityCheck(std::vector< recob::OpFlash > const &, std::vector< recob::Track > const &, std::vector< anab::CosmicTag > &, std::vector< size_t > &, Providers_t, phot::PhotonVisibilityService const &, opdet::OpDigiProperties const &)
def move(depos, offset)
Definition: depos.py:107
bool CreateAssn(PRODUCER const &prod, art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t indx=UINT_MAX)
Creates a single one-to-one association.
static int max(int a, int b)
The geometry of one entire detector, as served by art.
Definition: Geometry.h:196
std::vector< std::vector< size_t > > GetAssociatedVectorManyI(art::Handle< art::Assns< T, U > > h, art::Handle< std::vector< T > > index_p)
void MakeHitTagAssociations(std::vector< std::vector< size_t > > const &bridges_per_hit, std::vector< std::vector< size_t > > const &tags_per_bridges, std::vector< std::vector< size_t > > &tags_per_hit)
TCEvent evt
Definition: DataStructs.cxx:7

Member Data Documentation

BeamFlashTrackMatchTaggerAlg cosmic::BeamFlashTrackMatchTagger::fAlg
private

Definition at line 54 of file BeamFlashTrackMatchTagger_module.cc.

std::string cosmic::BeamFlashTrackMatchTagger::fFlashModuleLabel
private

Definition at line 56 of file BeamFlashTrackMatchTagger_module.cc.

std::string cosmic::BeamFlashTrackMatchTagger::fHitModuleLabel
private

Definition at line 60 of file BeamFlashTrackMatchTagger_module.cc.

HitTagAssociatorAlg cosmic::BeamFlashTrackMatchTagger::fHitTagAssnsAlg
private

Definition at line 58 of file BeamFlashTrackMatchTagger_module.cc.

bool cosmic::BeamFlashTrackMatchTagger::fMakeHitTagAssns
private

Definition at line 59 of file BeamFlashTrackMatchTagger_module.cc.

std::string cosmic::BeamFlashTrackMatchTagger::fTrackModuleLabel
private

Definition at line 55 of file BeamFlashTrackMatchTagger_module.cc.


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