211 auto const pfpHandle =
evt.getValidHandle<std::vector<recob::PFParticle>>(
fPFParticleLabel);
212 std::vector<art::Ptr<recob::PFParticle>> pfps;
213 art::fill_ptr_vector(pfps, pfpHandle);
216 auto const clusterHandle =
evt.getValidHandle<std::vector<recob::Cluster>>(
fPFParticleLabel);
219 const art::FindManyP<recob::Hit>& fmh =
221 const art::FindManyP<recob::Cluster>& fmcp =
223 const art::FindManyP<recob::SpacePoint>& fmspp =
238 for (
auto const& pfp : pfps) {
244 if (!
fUseAllParticles && pfp->PdgCode() != 11 && pfp->PdgCode() != 22)
continue;
247 const std::vector<art::Ptr<recob::Cluster>> showerClusters = fmcp.at(pfp.key());
248 const std::vector<art::Ptr<recob::SpacePoint>> showerSpacePoints = fmspp.at(pfp.key());
251 if (!showerClusters.size())
continue;
254 mf::LogInfo(
"LArPandoraModularShowerCreation")
255 <<
"Running on shower: " << shower_iter << std::endl;
260 for (
unsigned int i = 0; i <
fShowerTools.size(); i++) {
264 mf::LogInfo(
"LArPandoraModularShowerCreation")
267 this->moduleDescription().moduleLabel();
269 err =
fShowerTools[i]->RunShowerTool(pfp, evt, showerEleHolder, evd_disp_append);
272 mf::LogError(
"LArPandoraModularShowerCreation")
273 <<
"Error in shower tool: " <<
fShowerToolNames[i] <<
" with code: " << err << std::endl;
284 mf::LogError(
"LArPandoraModularShowerCreation")
285 <<
"The start position is not set in the element holder. bailing" << std::endl;
290 mf::LogError(
"LArPandoraModularShowerCreation")
291 <<
"The direction is not set in the element holder. bailing" << std::endl;
296 mf::LogError(
"LArPandoraModularShowerCreation")
297 <<
"The energy is not set in the element holder. bailing" << std::endl;
302 mf::LogError(
"LArPandoraModularShowerCreation")
303 <<
"The dEdx is not set in the element holder. bailing" << std::endl;
308 mf::LogError(
"LArPandoraModularShowerCreation")
309 <<
"The BestPlane is not set in the element holder. bailing" << std::endl;
314 mf::LogError(
"LArPandoraModularShowerCreation")
315 <<
"The length is not set in the element holder. bailing" << std::endl;
320 mf::LogError(
"LArPandoraModularShowerCreation")
321 <<
"The opening angle is not set in the element holder. bailing" << std::endl;
327 if (!elements_are_set) {
329 mf::LogError(
"LArPandoraModularShowerCreation")
330 <<
"Not all the elements in the property holder which should be set are not. Bailing. "
337 if (!producers_are_set) {
339 mf::LogError(
"LArPandoraModularShowerCreation")
340 <<
"Not all the elements in the property holder which are produced are not set. "
348 TVector3 ShowerStartPosition(-999, -999, -999);
349 TVector3 ShowerDirection(-999, -999, -999);
351 std::vector<double> ShowerdEdx(
fNumPlanes, -999);
353 double ShowerLength(-999);
354 double ShowerOpeningAngle(-999);
356 TVector3 ShowerStartPositionErr(-999, -999, -999);
357 TVector3 ShowerDirectionErr(-999, -999, -999);
358 std::vector<double> ShowerEnergyErr(
fNumPlanes, -999);
359 std::vector<double> ShowerdEdxErr(
fNumPlanes, -999);
380 throw cet::exception(
"LArPandoraModularShowerCreation")
381 <<
"Error in LArPandoraModularShowerCreation Module. A Check on a shower property failed "
387 std::cout <<
"Shower Vertex: X:" << ShowerStartPosition.X()
388 <<
" Y: " << ShowerStartPosition.Y() <<
" Z: " << ShowerStartPosition.Z()
390 std::cout <<
"Shower Direction: X:" << ShowerDirection.X() <<
" Y: " << ShowerDirection.Y()
391 <<
" Z: " << ShowerDirection.Z() << std::endl;
393 for (
unsigned int i = 0; i <
fNumPlanes; i++) {
394 std::cout <<
" Plane " << i <<
": " << ShowerdEdx.at(i);
398 for (
unsigned int i = 0; i <
fNumPlanes; i++) {
402 std::cout <<
"Shower Best Plane: " << BestPlane << std::endl;
403 std::cout <<
"Shower Length: " << ShowerLength << std::endl;
404 std::cout <<
"Shower Opening Angle: " << ShowerOpeningAngle << std::endl;
411 throw cet::exception(
"LArPandoraModularShowerCreation")
412 <<
"dEdx vector is wrong size: " << ShowerdEdx.size()
413 <<
" compared to Nplanes: " << fNumPlanes << std::endl;
416 throw cet::exception(
"LArPandoraModularShowerCreation")
417 <<
"Energy vector is wrong size: " <<
ShowerEnergy.size()
418 <<
" compared to Nplanes: " << fNumPlanes << std::endl;
436 art::Ptr<recob::Shower> ShowerPtr =
437 this->GetProducedElementPtr<recob::Shower>(
"shower", showerEleHolder);
441 ShowerPtr, pfp,
"pfShowerAssociationsbase");
444 for (
auto const&
cluster : showerClusters) {
447 std::vector<art::Ptr<recob::Hit>> ClusterHits = fmh.at(
cluster.key());
449 ShowerPtr,
cluster,
"clusterAssociationsbase");
452 for (
auto const&
hit : ClusterHits) {
454 ShowerPtr,
hit,
"hitAssociationsbase");
459 for (
auto const& sp : showerSpacePoints) {
461 ShowerPtr, sp,
"spShowerAssociationsbase");
471 assn_err += fShowerTool->AddAssociations(pfp, evt, showerEleHolder);
475 mf::LogError(
"LArPandoraModularShowerCreation")
476 <<
"A association failed and not allowing partial showers. The association will not be "
477 "added to the event "
const std::string fShowerOpeningAngleLabel
const std::string fShowerEnergyLabel
const std::string fShowerdEdxLabel
reco::shower::ShowerProducedPtrsHolder uniqueproducerPtrs
void AddDataProducts(const reco::shower::ShowerElementHolder &selement_holder)
EResult err(const char *call)
const std::string fShowerDirectionLabel
std::vector< std::string > fShowerToolNames
void SetElement(T &dataproduct, const std::string &Name, bool checktag=false)
const art::InputTag fPFParticleLabel
const bool fAllowPartialShowers
constexpr int kBogusI
obviously bogus integer value
Set of hits with a 2D structure.
const art::FindManyP< T1 > & GetFindManyP(const art::ValidHandle< std::vector< T2 > > &handle, const art::Event &evt, const art::InputTag &moduleTag)
double ShowerEnergy(const ShowerStruct3D &ss3)
void MoveAllToEvent(art::Event &evt)
void PrintElements() const
void AddSingle(A &a, B &b, const std::string &Name)
const std::string fShowerStartPositionLabel
bool CheckElement(const std::string &Name) const
const std::string fShowerLengthLabel
void SetPtrMakers(art::Event &evt)
int GetElement(const std::string &Name, T &Element) const
bool CheckAllProducedElements(reco::shower::ShowerElementHolder &selement_holder) const
const std::string fShowerBestPlaneLabel
void SetShowerNumber(int &shower_iter)
const bool fUseAllParticles
std::string to_string(WindowPattern const &pattern)
std::vector< std::unique_ptr< ShowerRecoTools::IShowerTool > > fShowerTools
int GetElementAndError(const std::string &Name, T &Element, T2 &ElementErr) const
2D representation of charge deposited in the TDC/wire plane
bool CheckAllElementTags() const
BEGIN_PROLOG could also be cout