32 class LArPandoraModularShowerCreation;
50 const int& iter = -1);
69 std::vector<std::unique_ptr<ShowerRecoTools::IShowerTool>>
fShowerTools;
84 const std::string& InstanceName,
89 bool check_element = ShowerEleHolder.
CheckElement(InstanceName);
92 <<
"To get a element that does not exist" << std::endl;
98 <<
"Tried to get a ptr that does not exist" << std::endl;
103 if (iter != -1) { index = iter; }
118 ,
fVerbose(pset.get<
int>(
"Verbose", 0))
129 auto tool_psets = pset.get<std::vector<fhicl::ParameterSet>>(
"ShowerFinderTools");
130 for (
auto& tool_pset : tool_psets) {
132 const std::string tool_name(tool_pset.get<std::string>(
"tool_type"));
135 if (!tool_pset.has_key(
"PFParticleLabel")) {
142 tool_pset.put<std::string>(
"PFParticleLabel", PFParticleLabelString);
145 alg_pset.
put<std::string>(
"PFParticleLabel", PFParticleLabelString);
149 if (tool_pset.has_key(
"LArPandoraShowerCheatingAlg")) {
152 cheat_alg_pset.
put<std::string>(
"PFParticleLabel", PFParticleLabelString);
160 if (!tool_pset.has_key(
"Verbose")) { tool_pset.
put<
int>(
"Verbose",
fVerbose); }
162 fShowerTools.push_back(art::make_tool<ShowerRecoTools::IShowerTool>(tool_pset));
169 std::vector<std::string> SetupTools;
170 for (
unsigned int i = 0; i <
fShowerTools.size(); ++i) {
171 if (std::find(SetupTools.begin(), SetupTools.end(),
fShowerToolNames[i]) != SetupTools.end()) {
181 produces<std::vector<recob::Shower>>();
182 produces<art::Assns<recob::Shower, recob::Hit>>();
183 produces<art::Assns<recob::Shower, recob::Cluster>>();
184 produces<art::Assns<recob::Shower, recob::SpacePoint>>();
185 produces<art::Assns<recob::Shower, recob::PFParticle>>();
190 "clusterAssociationsbase");
192 "hitAssociationsbase");
194 "spShowerAssociationsbase");
196 "pfShowerAssociationsbase");
210 std::vector<art::Ptr<recob::PFParticle>> pfps;
236 for (
auto const& pfp : pfps) {
242 if (!
fUseAllParticles && pfp->PdgCode() != 11 && pfp->PdgCode() != 22)
continue;
245 const std::vector<art::Ptr<recob::Cluster>> showerClusters = fmcp.at(pfp.key());
246 const std::vector<art::Ptr<recob::SpacePoint>> showerSpacePoints = fmspp.at(pfp.key());
249 if (!showerClusters.size())
continue;
253 <<
"Running on shower: " << shower_iter << std::endl;
258 for (
unsigned int i = 0; i <
fShowerTools.size(); i++) {
267 err =
fShowerTools[i]->RunShowerTool(pfp, evt, showerEleHolder, evd_disp_append);
271 <<
"Error in shower tool: " <<
fShowerToolNames[i] <<
" with code: " << err << std::endl;
283 <<
"The start position is not set in the element holder. bailing" << std::endl;
289 <<
"The direction is not set in the element holder. bailing" << std::endl;
295 <<
"The energy is not set in the element holder. bailing" << std::endl;
301 <<
"The dEdx is not set in the element holder. bailing" << std::endl;
307 <<
"The BestPlane is not set in the element holder. bailing" << std::endl;
313 <<
"The length is not set in the element holder. bailing" << std::endl;
319 <<
"The opening angle is not set in the element holder. bailing" << std::endl;
325 if (!elements_are_set) {
328 <<
"Not all the elements in the property holder which should be set are not. Bailing. " 335 if (!producers_are_set) {
338 <<
"Not all the elements in the property holder which are produced are not set. " 349 std::vector<double> ShowerdEdx(
fNumPlanes, -999);
351 double ShowerLength(-999);
352 double ShowerOpeningAngle(-999);
356 std::vector<double> ShowerEnergyErr(
fNumPlanes, -999);
357 std::vector<double> ShowerdEdxErr(
fNumPlanes, -999);
379 <<
"Error in LArPandoraModularShowerCreation Module. A Check on a shower property failed " 385 std::cout <<
"Shower Vertex: X:" << ShowerStartPosition.X()
386 <<
" Y: " << ShowerStartPosition.Y() <<
" Z: " << ShowerStartPosition.Z()
388 std::cout <<
"Shower Direction: X:" << ShowerDirection.X() <<
" Y: " << ShowerDirection.Y()
389 <<
" Z: " << ShowerDirection.Z() << std::endl;
390 std::cout <<
"Shower dEdx:";
391 for (
unsigned int i = 0; i <
fNumPlanes; i++) {
392 std::cout <<
" Plane " << i <<
": " << ShowerdEdx.at(i);
394 std::cout << std::endl;
395 std::cout <<
"Shower Energy:";
396 for (
unsigned int i = 0; i <
fNumPlanes; i++) {
397 std::cout <<
" Plane " << i <<
": " << ShowerEnergy.at(i);
399 std::cout << std::endl;
400 std::cout <<
"Shower Best Plane: " << BestPlane << std::endl;
401 std::cout <<
"Shower Length: " << ShowerLength << std::endl;
402 std::cout <<
"Shower Opening Angle: " << ShowerOpeningAngle << std::endl;
410 <<
"dEdx vector is wrong size: " << ShowerdEdx.size()
411 <<
" compared to Nplanes: " <<
fNumPlanes << std::endl;
415 <<
"Energy vector is wrong size: " << ShowerEnergy.size()
416 <<
" compared to Nplanes: " <<
fNumPlanes << std::endl;
422 convertTo<TVector3>(ShowerDirectionErr),
423 convertTo<TVector3>(ShowerStartPosition),
424 convertTo<TVector3>(ShowerDirectionErr),
436 this->GetProducedElementPtr<recob::Shower>(
"shower", showerEleHolder);
440 ShowerPtr, pfp,
"pfShowerAssociationsbase");
443 for (
auto const&
cluster : showerClusters) {
446 std::vector<art::Ptr<recob::Hit>> ClusterHits = fmh.at(
cluster.key());
448 ShowerPtr,
cluster,
"clusterAssociationsbase");
451 for (
auto const&
hit : ClusterHits) {
453 ShowerPtr,
hit,
"hitAssociationsbase");
458 for (
auto const& sp : showerSpacePoints) {
460 ShowerPtr, sp,
"spShowerAssociationsbase");
470 assn_err += fShowerTool->AddAssociations(pfp, evt, showerEleHolder);
475 <<
"A association failed and not allowing partial showers. The association will not be " 476 "added to the event "
const std::string fShowerOpeningAngleLabel
art::ServiceHandle< geo::Geometry > fGeom
const std::string fShowerEnergyLabel
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
const std::string fShowerdEdxLabel
reco::shower::ShowerProducedPtrsHolder uniqueproducerPtrs
int GetShowerNumber() const
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
void AddDataProducts(const reco::shower::ShowerElementHolder &selement_holder)
LArPandoraModularShowerCreation(fhicl::ParameterSet const &pset)
std::string const & moduleLabel() const
Declaration of signal hit object.
EDProducer(fhicl::ParameterSet const &pset)
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.
double ShowerEnergy(const ShowerStruct3D &ss3)
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
Cluster finding and building.
void MoveAllToEvent(art::Event &evt)
bool CheckUniqueProduerPtr(const std::string &Name) const
art::Ptr< T > GetProducedElementPtr(const std::string &InstanceName, const reco::shower::ShowerElementHolder &ShowerEleHolder, const int &iter=-1)
void PrintElements() const
Utilities to manipulate geometry vectors.The utilities include generic vector interface facilities al...
#define DEFINE_ART_MODULE(klass)
void AddSingle(A &a, B &b, const std::string &Name)
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
void produce(art::Event &evt)
const std::string fShowerStartPositionLabel
T get(std::string const &key) const
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
Declaration of cluster object.
Detector simulation of raw signals on wires.
ProducesCollector & producesCollector() noexcept
bool CheckAllProducedElements(reco::shower::ShowerElementHolder &selement_holder) const
const std::string fShowerBestPlaneLabel
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
void SetShowerNumber(int &shower_iter)
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
Utility object to perform functions of association.
const bool fUseAllParticles
unsigned int Nplanes(TPCID const &tpcid=tpc_zero) const
Returns the total number of planes in the specified TPC.
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
art::Ptr< T > GetArtPtr(const std::string &Name, const int &iter) const
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
void put_or_replace(std::string const &key)
int SetShowerUniqueProduerPtr(type< T >, const std::string &Name, const std::string &Instance="")
const art::FindManyP< T1 > & GetFindManyP(const art::ValidHandle< std::vector< T2 >> &handle, const art::Event &evt, const art::InputTag &moduleTag)
bool CheckAllElementTags() const
void put(std::string const &key)
cet::coded_exception< error, detail::translate > exception
ModuleDescription const & moduleDescription() const