All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
cosmic::BeamFlashTrackMatchTagger Class Reference
Inheritance diagram for cosmic::BeamFlashTrackMatchTagger:

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
 

Private Attributes

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

Detailed Description

Definition at line 39 of file BeamFlashTrackMatchTagger_module.cc.

Constructor & Destructor Documentation

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

Definition at line 67 of file BeamFlashTrackMatchTagger_module.cc.

68  : EDProducer{p},
69  fAlg(p.get<fhicl::ParameterSet>("BeamFlashTrackMatchAlgParams")),
70  fTrackModuleLabel(p.get<std::string>("TrackModuleLabel")),
71  fFlashModuleLabel(p.get<std::string>("FlashModuleLabel")),
72  fHitTagAssnsAlg(p.get<fhicl::ParameterSet>("HitTagAssociatorAlgParams")),
73  fMakeHitTagAssns(p.get<bool>("MakeHitTagAssns",false)),
74  fHitModuleLabel(p.get<std::string>("HitModuleLabel","dummy_hit"))
75 {
76  produces< std::vector<anab::CosmicTag> >();
77  produces< art::Assns<recob::Track, anab::CosmicTag> >();
78  if(fMakeHitTagAssns) produces< art::Assns<recob::Hit, anab::CosmicTag> >();
79 }
pdgs p
Definition: selectors.fcl:22
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)
override

Definition at line 81 of file BeamFlashTrackMatchTagger_module.cc.

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

Member Data Documentation

BeamFlashTrackMatchTaggerAlg cosmic::BeamFlashTrackMatchTagger::fAlg
private

Definition at line 56 of file BeamFlashTrackMatchTagger_module.cc.

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

Definition at line 58 of file BeamFlashTrackMatchTagger_module.cc.

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

Definition at line 62 of file BeamFlashTrackMatchTagger_module.cc.

HitTagAssociatorAlg cosmic::BeamFlashTrackMatchTagger::fHitTagAssnsAlg
private

Definition at line 60 of file BeamFlashTrackMatchTagger_module.cc.

bool cosmic::BeamFlashTrackMatchTagger::fMakeHitTagAssns
private

Definition at line 61 of file BeamFlashTrackMatchTagger_module.cc.

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

Definition at line 57 of file BeamFlashTrackMatchTagger_module.cc.


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