77 produces< std::vector<recob::Shower> >();
78 produces< art::Assns<recob::Shower,recob::Cluster> >();
79 produces< art::Assns<recob::Shower,recob::Hit> >();
81 produces< art::Assns<recob::PFParticle,recob::Shower> >();
114 std::unique_ptr<std::vector<recob::Shower> > out_shower_v(
new std::vector<recob::Shower>);
131 throw cet::exception(__FUNCTION__) <<
"Invalid input cluster label!" << std::endl;
134 std::vector<std::vector< ::util::PxHit> > local_clusters;
137 for(
size_t i=0; i<cHandle->size(); ++i) {
139 local_clusters.push_back(std::vector< ::util::PxHit>());
141 const std::vector<art::Ptr<recob::Hit> >&
hits = hit_m.at(i);
150 std::vector<size_t> shower_pfpart_index;
152 std::vector<std::vector<unsigned int> > matched_pairs;
154 std::vector<recob::Shower> shower_v;
164 throw cet::exception(__FUNCTION__) <<
"Invalid input PFParticle label!" << std::endl;
167 std::map<art::Ptr<recob::Cluster>,
size_t> cmap;
168 for(
size_t i=0; i<cHandle->size(); ++i) {
178 for(
size_t i=0; i<pfHandle->size(); ++i) {
182 if(pf->
PdgCode()!=11)
continue;
184 const std::vector<art::Ptr<recob::Cluster> >& clusters = cluster_m.at(i);
186 std::vector<unsigned int> one_pair;
187 one_pair.reserve(clusters.size());
189 for(
auto const& cptr : clusters) {
191 auto iter = cmap.find(cptr);
192 if(iter == cmap.end())
193 throw cet::exception(__FUNCTION__) <<
"PFParticle=>Cluster association not valid!" << std::endl;
195 one_pair.push_back((*iter).second);
197 matched_pairs.push_back(one_pair);
198 shower_pfpart_index.push_back(i);
205 if(shower_v.size() != matched_pairs.size())
206 throw cet::exception(__FUNCTION__) <<
"Logic error: # of matched pairs != # of reco-ed showers!" << std::endl;
209 out_shower_v->reserve(shower_v.size());
211 for(
size_t i=0; i<shower_v.size(); ++i) {
214 shower_v[i].set_id(i);
216 out_shower_v->push_back(shower_v[i]);
219 std::vector<art::Ptr<recob::Cluster> > ass_clusters;
221 std::vector<art::Ptr<recob::Hit> > ass_hits;
222 for(
auto const& cindex : matched_pairs[i]) {
226 const std::vector<art::Ptr<recob::Hit> >&
hits = hit_m.at(cindex);
228 for(
auto const& ptr : hits) ass_hits.push_back(ptr);
233 *(out_shower_v.get()),
240 *(out_shower_v.get()),
254 *(out_shower_v.get()),
262 e.
put(std::move(out_shower_v));
263 e.
put(std::move(sh_assn));
264 e.
put(std::move(sc_assn));
266 e.
put(std::move(sp_assn));
Class def header for a class ShowerRecoAlg.
void Algo(ShowerRecoAlgBase *alg)
::calo::CalorimetryAlg * fCaloAlgo
::cmtool::CPAlgoArray * fCPAlgoArray
Declaration of signal hit object.
::showerreco::ShowerRecoManager fManager
int PdgCode() const
Return the type of particle as a PDG ID.
::cmtool::CFAlgoTimeOverlap * fCFAlgoTimeOverlap
void produce(art::Event &e) override
void CaloAlgo(::calo::CalorimetryAlg *alg)
Calorimetry algorithm setter.
ProductID put(std::unique_ptr< PROD > &&product)
std::string fInputProducer
void GeneratePxHit(const std::vector< unsigned int > &hit_index, const std::vector< art::Ptr< recob::Hit >> hits, std::vector< util::PxHit > &pxhits) const
Generate: from 1 set of hits => 1 set of PxHits using indexes (association)
#define DEFINE_ART_MODULE(klass)
void setEcorrection(bool on)
Function to decide if to use ModBox (True) or Birks (False) for calorimetry.
virtual void Verbose(bool on=true)
Verbosity switch.
T get(std::string const &key) const
Class def header for a class CPAlgoArray.
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.
ClusterAss_t Reconstruct(const std::vector< std::vector< util::PxHit > > &clusters, std::vector< ::recob::Shower > &showers)
Declaration of cluster object.
void SetUseArea(bool on)
Function to decide if to use Area or Pulse Amplitude for calculations.
Class def header for a class CPAlgoNHits.
::cmtool::CMatchManager & MatchManager()
ShowerReco3D(fhicl::ParameterSet const &p)
::cmtool::CPAlgoIgnoreTracks * fCPAlgoIgnoreTracks
Utility object to perform functions of association.
::showerreco::ShowerRecoAlg * fShowerAlgo
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Class def header for a class CPAlgoIgnoreTracks.
ShowerReco3D & operator=(ShowerReco3D const &)=delete
Class def header for a class CFAlgoTimeOverlap.
::cmtool::CPAlgoNHits * fCPAlgoNHits
cet::coded_exception< error, detail::translate > exception
Class def header for a class ShowerRecoManager.