67 art::ServiceHandle<cheat::ParticleInventoryService const> pi_serv;
70 const sim::ParticleList& plist = pi_serv->ParticleList();
73 art::Handle< std::vector<recob::Shower> > showercol;
78 std::vector< art::Ptr<recob::Shower> > showers;
80 art::fill_ptr_vector(showers, showercol);
82 catch(cet::exception &
e){
83 mf::LogWarning(
"VertexCheater") <<
"showers: " <<
e;
87 art::Handle< std::vector<recob::Track> > trackcol;
92 std::vector< art::Ptr<recob::Track> >
tracks;
94 art::fill_ptr_vector(tracks, trackcol);
96 catch(cet::exception &e){
97 mf::LogWarning(
"VertexCheater") <<
"tracks: " <<
e;
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>);
175 std::unique_ptr< art::Assns<recob::Vertex, recob::Shower> > vsassn(
new art::Assns<recob::Vertex, recob::Shower>);
176 std::unique_ptr< art::Assns<recob::Vertex, recob::Track> > vtassn(
new art::Assns<recob::Vertex, recob::Track>);
177 std::unique_ptr< art::Assns<recob::Vertex, recob::Hit> > vhassn(
new art::Assns<recob::Vertex, recob::Hit>);
180 for(
auto const& eveID : eveIDs){
184 art::PtrVector<recob::Shower> ptrvshw;
185 art::PtrVector<recob::Track> ptrvtrk;
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){
193 ptrvshw.push_back(is.second);
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){
202 ptrvtrk.push_back(it.second);
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.";
241 evt.put(std::move(vertexcol));
242 evt.put(std::move(vsassn));
243 evt.put(std::move(vtassn));
244 evt.put(std::move(vhassn));
ClusterModuleLabel join with tracks
std::string fCheatedTrackLabel
label for module creating recob::Track objects
Definition of vertex object for LArSoft.
std::string fCheatedShowerLabel
label for module creating recob::Shower objects
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.
then echo File list $list not found else cat $list while read file do echo $file sed s