29 class LArPandoraModularShowerCreation;
47 const int& iter = -1);
66 std::vector<std::unique_ptr<ShowerRecoTools::IShowerTool>>
fShowerTools;
87 bool check_element = ShowerEleHolder.
CheckElement(InstanceName);
90 <<
"To get a element that does not exist" <<
std::endl;
96 <<
"Tried to get a ptr that does not exist" <<
std::endl;
101 if (iter != -1) { index = iter; }
116 ,
fVerbose(pset.get<
int>(
"Verbose", 0))
127 auto tool_psets = pset.get<std::vector<fhicl::ParameterSet>>(
"ShowerFinderTools");
128 for (
auto& tool_pset : tool_psets) {
133 if (!tool_pset.has_key(
"PFParticleLabel")) {
140 tool_pset.put<
std::string>(
"PFParticleLabel", PFParticleLabelString);
143 alg_pset.
put<
std::string>(
"PFParticleLabel", PFParticleLabelString);
147 if (tool_pset.has_key(
"LArPandoraShowerCheatingAlg")) {
150 cheat_alg_pset.
put<
std::string>(
"PFParticleLabel", PFParticleLabelString);
158 if (!tool_pset.has_key(
"Verbose")) { tool_pset.
put<
int>(
"Verbose",
fVerbose); }
160 fShowerTools.push_back(art::make_tool<ShowerRecoTools::IShowerTool>(tool_pset));
167 std::vector<std::string> SetupTools;
168 for (
unsigned int i = 0; i <
fShowerTools.size(); ++i) {
169 if (std::find(SetupTools.begin(), SetupTools.end(),
fShowerToolNames[i]) != SetupTools.end()) {
179 produces<std::vector<recob::Shower>>();
180 produces<art::Assns<recob::Shower, recob::Hit>>();
181 produces<art::Assns<recob::Shower, recob::Cluster>>();
182 produces<art::Assns<recob::Shower, recob::SpacePoint>>();
183 produces<art::Assns<recob::Shower, recob::PFParticle>>();
188 "clusterAssociationsbase");
190 "hitAssociationsbase");
192 "spShowerAssociationsbase");
194 "pfShowerAssociationsbase");
209 std::vector<art::Ptr<recob::PFParticle>> pfps;
216 const art::FindManyP<recob::Hit>& fmh =
218 const art::FindManyP<recob::Cluster>& fmcp =
220 const art::FindManyP<recob::SpacePoint>& fmspp =
235 for (
auto const& pfp : pfps) {
241 if (!
fUseAllParticles && pfp->PdgCode() != 11 && pfp->PdgCode() != 22)
continue;
244 const std::vector<art::Ptr<recob::Cluster>> showerClusters = fmcp.at(pfp.key());
245 const std::vector<art::Ptr<recob::SpacePoint>> showerSpacePoints = fmspp.at(pfp.key());
248 if (!showerClusters.size())
continue;
252 <<
"Running on shower: " << shower_iter <<
std::endl;
257 for (
unsigned int i = 0; i <
fShowerTools.size(); i++) {
266 err =
fShowerTools[i]->RunShowerTool(pfp, evt, showerEleHolder, evd_disp_append);
282 <<
"The start position is not set in the element holder. bailing" <<
std::endl;
288 <<
"The direction is not set in the element holder. bailing" <<
std::endl;
294 <<
"The energy is not set in the element holder. bailing" <<
std::endl;
300 <<
"The dEdx is not set in the element holder. bailing" <<
std::endl;
306 <<
"The BestPlane is not set in the element holder. bailing" <<
std::endl;
312 <<
"The length is not set in the element holder. bailing" <<
std::endl;
318 <<
"The opening angle is not set in the element holder. bailing" <<
std::endl;
324 if (!elements_are_set) {
327 <<
"Not all the elements in the property holder which should be set are not. Bailing. " 334 if (!producers_are_set) {
337 <<
"Not all the elements in the property holder which are produced are not set. " 345 TVector3 ShowerStartPosition(-999, -999, -999);
346 TVector3 ShowerDirection(-999, -999, -999);
348 std::vector<double> ShowerdEdx(
fNumPlanes, -999);
350 double ShowerLength(-999);
351 double ShowerOpeningAngle(-999);
353 TVector3 ShowerStartPositionErr(-999, -999, -999);
354 TVector3 ShowerDirectionErr(-999, -999, -999);
355 std::vector<double> ShowerEnergyErr(
fNumPlanes, -999);
356 std::vector<double> ShowerdEdxErr(
fNumPlanes, -999);
378 <<
"Error in LArPandoraModularShowerCreation Module. A Check on a shower property failed " 384 std::cout <<
"Shower Vertex: X:" << ShowerStartPosition.X()
385 <<
" Y: " << ShowerStartPosition.Y() <<
" Z: " << ShowerStartPosition.Z()
387 std::cout <<
"Shower Direction: X:" << ShowerDirection.X() <<
" Y: " << ShowerDirection.Y()
388 <<
" Z: " << ShowerDirection.Z() <<
std::endl;
389 std::cout <<
"Shower dEdx:";
390 for (
unsigned int i = 0; i <
fNumPlanes; i++) {
391 std::cout <<
" Plane " << i <<
": " << ShowerdEdx.at(i);
394 std::cout <<
"Shower Energy:";
395 for (
unsigned int i = 0; i <
fNumPlanes; i++) {
396 std::cout <<
" Plane " << i <<
": " << ShowerEnergy.at(i);
399 std::cout <<
"Shower Best Plane: " << BestPlane <<
std::endl;
400 std::cout <<
"Shower Length: " << ShowerLength <<
std::endl;
401 std::cout <<
"Shower Opening Angle: " << ShowerOpeningAngle <<
std::endl;
409 <<
"dEdx vector is wrong size: " << ShowerdEdx.size()
414 <<
"Energy vector is wrong size: " << ShowerEnergy.size()
434 this->GetProducedElementPtr<recob::Shower>(
"shower", showerEleHolder);
438 ShowerPtr, pfp,
"pfShowerAssociationsbase");
441 for (
auto const&
cluster : showerClusters) {
444 std::vector<art::Ptr<recob::Hit>> ClusterHits = fmh.at(
cluster.key());
446 ShowerPtr,
cluster,
"clusterAssociationsbase");
449 for (
auto const&
hit : ClusterHits) {
451 ShowerPtr,
hit,
"hitAssociationsbase");
456 for (
auto const& sp : showerSpacePoints) {
458 ShowerPtr, sp,
"spShowerAssociationsbase");
468 assn_err += fShowerTool->AddAssociations(pfp, evt, showerEleHolder);
473 <<
"A association failed and not allowing partial showers. The association will not be " 474 "added to the event "
const std::string fShowerOpeningAngleLabel
art::ServiceHandle< geo::Geometry > fGeom
void cluster(In first, In last, Out result, Pred *pred)
const std::string fShowerEnergyLabel
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
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.
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)
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)
unsigned int Nplanes(unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wire planes in the specified TPC.
void PrintElements() const
#define DEFINE_ART_MODULE(klass)
void AddSingle(A &a, B &b, const std::string &Name)
void produce(art::Event &evt)
const std::string fShowerStartPositionLabel
T get(std::string const &key) const
ValidHandle< PROD > getValidHandle(InputTag const &tag) 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
void err(const char *fmt,...)
Detector simulation of raw signals on wires.
ProducesCollector & producesCollector() noexcept
bool CheckAllProducedElements(reco::shower::ShowerElementHolder &selement_holder) const
const std::string fShowerBestPlaneLabel
void SetShowerNumber(int &shower_iter)
const bool fUseAllParticles
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="")
std::string to_string(ModuleType const mt)
bool CheckAllElementTags() const
void put(std::string const &key)
cet::coded_exception< error, detail::translate > exception
QTextStream & endl(QTextStream &s)
ModuleDescription const & moduleDescription() const