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

Public Member Functions

 TrackContainmentTagger (fhicl::ParameterSet const &p)
 
 TrackContainmentTagger (TrackContainmentTagger const &)=delete
 
 TrackContainmentTagger (TrackContainmentTagger &&)=delete
 
TrackContainmentTaggeroperator= (TrackContainmentTagger const &)=delete
 
TrackContainmentTaggeroperator= (TrackContainmentTagger &&)=delete
 
void produce (art::Event &e) override
 

Private Attributes

trk::TrackContainmentAlg fAlg
 
std::vector< std::string > fTrackModuleLabels
 
std::vector< bool > fApplyTags
 

Detailed Description

Definition at line 25 of file TrackContainmentTagger_module.cc.

Constructor & Destructor Documentation

trk::TrackContainmentTagger::TrackContainmentTagger ( fhicl::ParameterSet const &  p)
explicit

Definition at line 50 of file TrackContainmentTagger_module.cc.

51  : EDProducer{p}
52 {
53  art::ServiceHandle<art::TFileService const> tfs;
54  fAlg.SetupOutputTree(tfs->make<TTree>("myanatree","MyAnalysis Tree"));
55 
56  fAlg.Configure(p.get<fhicl::ParameterSet>("TrackContainmentAlg"));
57  fTrackModuleLabels = p.get< std::vector<std::string> >("TrackModuleLabels");
58  fApplyTags = p.get< std::vector<bool> >("ApplyTags",std::vector<bool>(fTrackModuleLabels.size(),true));
59 
60  if(fApplyTags.size()!=fTrackModuleLabels.size())
61  throw cet::exception("TrackContainmentTagger::TrackContainmentTagger")
62  << "ApplyTags not same size as TrackModuleLabels. ABORT!!!";
63 
65 
66  produces< std::vector<anab::CosmicTag> >();
67  produces< art::Assns<recob::Track, anab::CosmicTag> >();
68 }
void setMakeCosmicTags(bool flag=true)
std::vector< std::string > fTrackModuleLabels
pdgs p
Definition: selectors.fcl:22
void Configure(fhicl::ParameterSet const &)
art::ServiceHandle< art::TFileService > tfs
trk::TrackContainmentTagger::TrackContainmentTagger ( TrackContainmentTagger const &  )
delete
trk::TrackContainmentTagger::TrackContainmentTagger ( TrackContainmentTagger &&  )
delete

Member Function Documentation

TrackContainmentTagger& trk::TrackContainmentTagger::operator= ( TrackContainmentTagger const &  )
delete
TrackContainmentTagger& trk::TrackContainmentTagger::operator= ( TrackContainmentTagger &&  )
delete
void trk::TrackContainmentTagger::produce ( art::Event &  e)
override

Definition at line 70 of file TrackContainmentTagger_module.cc.

71 {
72 
73  std::unique_ptr< std::vector< anab::CosmicTag > > cosmicTagTrackVector( new std::vector<anab::CosmicTag> );
74  std::unique_ptr< art::Assns<recob::Track, anab::CosmicTag > > assnOutCosmicTagTrack( new art::Assns<recob::Track, anab::CosmicTag>);
75 
76  fAlg.SetRunEvent(e.run(),e.event());
77 
78  std::vector< std::vector<recob::Track> > trackVectors;
79  std::vector< art::Handle< std::vector<recob::Track> > > trackHandles;
80  for(size_t i_l=0; i_l<fTrackModuleLabels.size(); ++i_l){
81  art::Handle< std::vector<recob::Track> > trackHandle;
82  e.getByLabel(fTrackModuleLabels[i_l],trackHandle);
83  trackVectors.push_back(*trackHandle);
84  trackHandles.push_back(trackHandle);
85  }
86 
87  art::ServiceHandle<geo::Geometry const> geoHandle;
88  fAlg.ProcessTracks(trackVectors,*geoHandle);
89 
90  auto const& cosmicTags = fAlg.GetTrackCosmicTags();
91 
92  for(size_t i_tc=0; i_tc<cosmicTags.size(); ++i_tc){
93  if(!fApplyTags[i_tc]) continue;
94  for(size_t i_t=0; i_t<fAlg.GetTrackCosmicTags()[i_tc].size(); ++i_t){
95  cosmicTagTrackVector->emplace_back(fAlg.GetTrackCosmicTags()[i_tc][i_t]);
96  util::CreateAssn(*this, e, *cosmicTagTrackVector, art::Ptr<recob::Track>(trackHandles[i_tc],i_t), *assnOutCosmicTagTrack );
97  }
98  }
99 
100  e.put(std::move(cosmicTagTrackVector));
101  e.put(std::move(assnOutCosmicTagTrack));
102 
103 }
std::vector< std::string > fTrackModuleLabels
void ProcessTracks(std::vector< std::vector< recob::Track > > const &, geo::GeometryCore const &)
void SetRunEvent(unsigned int const &, unsigned int const &)
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< anab::CosmicTag > > const & GetTrackCosmicTags()
do i e

Member Data Documentation

trk::TrackContainmentAlg trk::TrackContainmentTagger::fAlg
private

Definition at line 43 of file TrackContainmentTagger_module.cc.

std::vector<bool> trk::TrackContainmentTagger::fApplyTags
private

Definition at line 46 of file TrackContainmentTagger_module.cc.

std::vector<std::string> trk::TrackContainmentTagger::fTrackModuleLabels
private

Definition at line 45 of file TrackContainmentTagger_module.cc.


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