33 class LArPandoraModularShowerCreation;
51 const int& iter = -1);
70 std::vector<std::unique_ptr<ShowerRecoTools::IShowerTool>>
fShowerTools;
82 const std::string& InstanceName,
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) {
130 const std::string tool_name(tool_pset.get<std::string>(
"tool_type"));
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));
168 std::vector<std::string> SetupTools;
169 for (
unsigned int i = 0; i <
fShowerTools.size(); ++i) {
170 if (std::find(SetupTools.begin(), SetupTools.end(),
fShowerToolNames[i]) != SetupTools.end()) {
180 produces<std::vector<recob::Shower>>();
181 produces<art::Assns<recob::Shower, recob::Hit>>();
182 produces<art::Assns<recob::Shower, recob::Cluster>>();
183 produces<art::Assns<recob::Shower, recob::SpacePoint>>();
184 produces<art::Assns<recob::Shower, recob::PFParticle>>();
189 "clusterAssociationsbase");
191 "hitAssociationsbase");
193 "spShowerAssociationsbase");
195 "pfShowerAssociationsbase");
209 std::vector<art::Ptr<recob::PFParticle>> pfps;
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);
270 <<
"Error in shower tool: " <<
fShowerToolNames[i] <<
" with code: " << err << std::endl;
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. " 348 std::vector<double> ShowerdEdx(
fNumPlanes, -999);
350 double ShowerLength(-999);
351 double ShowerOpeningAngle(-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);
393 std::cout << std::endl;
394 std::cout <<
"Shower Energy:";
395 for (
unsigned int i = 0; i <
fNumPlanes; i++) {
396 std::cout <<
" Plane " << i <<
": " << ShowerEnergy.at(i);
398 std::cout << std::endl;
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()
410 <<
" compared to Nplanes: " <<
fNumPlanes << std::endl;
414 <<
"Energy vector is wrong size: " << ShowerEnergy.size()
415 <<
" compared to Nplanes: " <<
fNumPlanes << std::endl;
421 convertTo<TVector3>(ShowerDirectionErr),
422 convertTo<TVector3>(ShowerStartPosition),
423 convertTo<TVector3>(ShowerDirectionErr),
435 this->GetProducedElementPtr<recob::Shower>(
"shower", showerEleHolder);
439 ShowerPtr, pfp,
"pfShowerAssociationsbase");
442 for (
auto const&
cluster : showerClusters) {
445 std::vector<art::Ptr<recob::Hit>> ClusterHits = fmh.at(
cluster.key());
447 ShowerPtr,
cluster,
"clusterAssociationsbase");
450 for (
auto const&
hit : ClusterHits) {
452 ShowerPtr,
hit,
"hitAssociationsbase");
457 for (
auto const& sp : showerSpacePoints) {
459 ShowerPtr, sp,
"spShowerAssociationsbase");
469 assn_err += fShowerTool->AddAssociations(pfp, evt, showerEleHolder);
474 <<
"A association failed and not allowing partial showers. The association will not be " 475 "added to the event "
const std::string fShowerOpeningAngleLabel
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
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
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
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)
art framework interface to geometry description
cet::coded_exception< error, detail::translate > exception
ModuleDescription const & moduleDescription() const