70 const sim::ParticleList& plist = pi_serv->
ParticleList();
78 std::vector< art::Ptr<recob::Shower> >
showers;
92 std::vector< art::Ptr<recob::Track> >
tracks;
104 std::vector< art::Ptr<recob::Shower> >
::iterator shwitr = showers.begin();
105 std::vector< art::Ptr<recob::Track> >
::iterator trkitr = tracks.begin();
108 if(tracks.size() < 1) trkitr = tracks.end();
109 if(showers.size() < 1) shwitr = showers.end();
112 std::map<int, std::vector< std::pair<size_t, art::Ptr<recob::Shower> > > > eveShowerMap;
113 std::map<int, std::vector< std::pair<size_t, art::Ptr<recob::Track> > > > eveTrackMap;
116 std::vector<int> eveIDs;
119 for(
size_t s = 0;
s < showers.size(); ++
s){
121 std::pair<size_t, art::Ptr<recob::Shower> > idxShw(
s, showers[
s]);
126 int prongID = showers[
s]->ID();
131 int eveID = plist[prongID]->Mother();
132 if( eveID < 1 ) eveID = prongID;
134 if(std::find(eveIDs.begin(), eveIDs.end(), eveID) == eveIDs.end())
135 eveIDs.push_back(eveID);
140 eveShowerMap[eveID].push_back(idxShw);
142 mf::LogInfo(
"VertexCheater") <<
"shower: " << prongID <<
" has mother " << eveID;
147 for(
size_t t = 0;
t < tracks.size(); ++
t){
149 std::pair<size_t, art::Ptr<recob::Track> > idxTrk(
t, tracks[
t]);
154 int prongID = tracks[
t]->ID();
159 int eveID = plist[prongID]->Mother();
160 if( eveID < 1 ) eveID = prongID;
162 if(std::find(eveIDs.begin(), eveIDs.end(), eveID) == eveIDs.end())
163 eveIDs.push_back(eveID);
168 eveTrackMap[eveID].push_back(idxTrk);
170 mf::LogInfo(
"VertexCheater") <<
"track: " << prongID <<
" has mother " << eveID;
174 std::unique_ptr< std::vector<recob::Vertex> > vertexcol(
new std::vector<recob::Vertex>);
180 for(
auto const& eveID : eveIDs){
186 std::vector<size_t> idxShw;
187 std::vector<size_t> idxTrk;
190 if(eveShowerMap.find(eveID) != eveShowerMap.end()){
191 auto const& eveShowers = eveShowerMap[eveID];
192 for(
auto const& is : eveShowers){
194 idxShw.push_back(is.first);
199 if(eveTrackMap.find(eveID) != eveTrackMap.end()){
200 auto const& eveTracks = eveTrackMap[eveID];
201 for(
auto const& it : eveTracks){
203 idxTrk.push_back(it.first);
207 double xyz[3] = { plist[eveID]->Vx(),
209 plist[eveID]->Vz() };
216 if( ptrvtrk.
size() > 0 ){
220 for(
auto const& i : idxTrk){
221 std::vector< art::Ptr<recob::Hit> > hits = fmht.at(i);
226 if( ptrvshw.
size() > 0 ){
229 for(
auto const& i : idxShw){
230 std::vector< art::Ptr<recob::Hit> > hits = fmhs.at(i);
235 mf::LogInfo(
"VertexCheater") <<
"adding vertex: \n" 237 <<
"\nto collection.";
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
std::string fCheatedTrackLabel
label for module creating recob::Track objects
Definition of vertex object for LArSoft.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
void push_back(Ptr< U > const &p)
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
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.
const sim::ParticleList & ParticleList() const
std::string fCheatedShowerLabel
label for module creating recob::Shower objects
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
cet::coded_exception< error, detail::translate > exception