8 #ifndef VERTEX_VERTEXCHEATER_H 9 #define VERTEX_VERTEXCHEATER_H 63 produces< std::vector<recob::Vertex> >();
64 produces< art::Assns<recob::Vertex, recob::Shower> >();
65 produces< art::Assns<recob::Vertex, recob::Track> >();
66 produces< art::Assns<recob::Vertex, recob::Hit> >();
99 std::vector< art::Ptr<recob::Shower> > showers;
113 std::vector< art::Ptr<recob::Track> > tracks;
125 std::vector< art::Ptr<recob::Shower> >
::iterator shwitr = showers.begin();
126 std::vector< art::Ptr<recob::Track> >
::iterator trkitr = tracks.begin();
129 if(tracks.size() < 1) trkitr = tracks.end();
130 if(showers.size() < 1) shwitr = showers.end();
133 std::map<int, std::vector< std::pair<size_t, art::Ptr<recob::Shower> > > > eveShowerMap;
134 std::map<int, std::vector< std::pair<size_t, art::Ptr<recob::Track> > > > eveTrackMap;
137 std::vector<int> eveIDs;
140 for(
size_t s = 0;
s < showers.size(); ++
s){
142 std::pair<size_t, art::Ptr<recob::Shower> > idxShw(
s, showers[
s]);
147 int prongID = showers[
s]->ID();
152 int eveID = plist[prongID]->Mother();
153 if( eveID < 1 ) eveID = prongID;
155 if(std::find(eveIDs.begin(), eveIDs.end(), eveID) == eveIDs.end())
156 eveIDs.push_back(eveID);
161 eveShowerMap[eveID].push_back(idxShw);
163 mf::LogInfo(
"VertexCheater") <<
"shower: " << prongID <<
" has mother " << eveID;
168 for(
size_t t = 0; t < tracks.size(); ++t){
170 std::pair<size_t, art::Ptr<recob::Track> > idxTrk(t, tracks[t]);
175 int prongID = tracks[t]->ID();
180 int eveID = plist[prongID]->Mother();
181 if( eveID < 1 ) eveID = prongID;
183 if(std::find(eveIDs.begin(), eveIDs.end(), eveID) == eveIDs.end())
184 eveIDs.push_back(eveID);
189 eveTrackMap[eveID].push_back(idxTrk);
191 mf::LogInfo(
"VertexCheater") <<
"track: " << prongID <<
" has mother " << eveID;
195 std::unique_ptr< std::vector<recob::Vertex> > vertexcol(
new std::vector<recob::Vertex>);
201 for(
auto const& eveID : eveIDs){
207 std::vector<size_t> idxShw;
208 std::vector<size_t> idxTrk;
211 if(eveShowerMap.find(eveID) != eveShowerMap.end()){
212 auto const& eveShowers = eveShowerMap[eveID];
213 for(
auto const& is : eveShowers){
215 idxShw.push_back(is.first);
220 if(eveTrackMap.find(eveID) != eveTrackMap.end()){
221 auto const& eveTracks = eveTrackMap[eveID];
222 for(
auto const& it : eveTracks){
224 idxTrk.push_back(it.first);
228 double xyz[3] = { plist[eveID]->Vx(),
230 plist[eveID]->Vz() };
237 if( ptrvtrk.
size() > 0 ){
241 for(
auto const& i : idxTrk){
242 std::vector< art::Ptr<recob::Hit> >
hits = fmht.at(i);
247 if( ptrvshw.
size() > 0 ){
250 for(
auto const& i : idxShw){
251 std::vector< art::Ptr<recob::Hit> >
hits = fmhs.at(i);
256 mf::LogInfo(
"VertexCheater") <<
"adding vertex: \n" 258 <<
"\nto collection.";
262 evt.
put(std::move(vertexcol));
263 evt.
put(std::move(vsassn));
264 evt.
put(std::move(vtassn));
265 evt.
put(std::move(vhassn));
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
Declaration of signal hit object.
std::string fCheatedTrackLabel
label for module creating recob::Track objects
std::string fG4ModuleLabel
label for module running G4 and making particles, etc
Definition of vertex object for LArSoft.
ProductID put(std::unique_ptr< PROD > &&product)
#define DEFINE_ART_MODULE(klass)
void push_back(Ptr< U > const &p)
T get(std::string const &key) const
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.
Provides recob::Track data product.
std::string fCheatedShowerLabel
label for module creating recob::Shower objects
void reconfigure(fhicl::ParameterSet const &pset)
Utility object to perform functions of association.
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
const sim::ParticleList & ParticleList()
VertexCheater(fhicl::ParameterSet const &pset)
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Particle list in DetSim contains Monte Carlo particle information.
cet::coded_exception< error, detail::translate > exception
void produce(art::Event &evt)