71 Tree =
tfs->make<TTree>(
"DebugTreeDirCheater",
"DebugTree from shower direction cheater");
87 auto const clockData =
98 std::map<int, const simb::MCParticle*> trueParticles =
100 std::map<int, std::vector<int>> showersMothers =
106 std::vector<art::Ptr<recob::Cluster>> clusters = fmc.at(pfparticle.
key());
111 std::vector<art::Ptr<recob::Hit>> showerHits;
112 for (
auto const&
cluster : clusters) {
114 std::vector<art::Ptr<recob::Hit>>
hits = fmhc.at(
cluster.key());
115 showerHits.insert(showerHits.end(), hits.begin(), hits.end());
119 std::pair<int, double> ShowerTrackInfo =
121 clockData, showersMothers, showerHits, 2);
123 if (ShowerTrackInfo.first == -99999) {
124 mf::LogError(
"ShowerDirectionCheater") <<
"True shower not found, returning";
127 trueParticle = trueParticles[ShowerTrackInfo.first];
132 mf::LogError(
"ShowerDirectionCheater") <<
"True shower not found, returning";
136 auto trueDir =
geo::Vector_t{trueParticle->
Px(), trueParticle->
Py(), trueParticle->
Pz()}.Unit();
144 rmsGradient = std::numeric_limits<float>::lowest();
150 if (!fmspp.isValid()) {
152 <<
"Trying to get the spacepoint and failed. Something is not configured correctly. " 158 if (!fmh.isValid()) {
160 <<
"Spacepoint and hit association not valid. Stopping.";
162 std::vector<art::Ptr<recob::SpacePoint>> spacePoints = fmspp.at(pfparticle.
key());
164 if (spacePoints.size() < 3) {
166 << spacePoints.size() <<
" spacepoints in shower, not calculating direction" << std::endl;
174 clockData, detProp, spacePoints, fmh, TotalCharge);
183 auto const GeneralDir = (ShowerCentre - StartPositionVec).Unit();
192 spacePoints, ShowerCentre, trueDir,
fNSegments);
double Py(const int i=0) const
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
std::map< int, const simb::MCParticle * > GetTrueParticleMap() const
double Px(const int i=0) const
void SetElement(T &dataproduct, const std::string &Name, bool checktag=false)
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
Cluster finding and building.
key_type key() const noexcept
std::map< int, std::vector< int > > GetTrueChain(std::map< int, const simb::MCParticle * > &trueParticles) const
bool CheckElement(const std::string &Name) const
int GetElement(const std::string &Name, T &Element) const
Declaration of cluster object.
std::pair< int, double > TrueParticleIDFromTrueChain(detinfo::DetectorClocksData const &clockData, std::map< int, std::vector< int >> const &ShowersMothers, std::vector< art::Ptr< recob::Hit >> const &hits, int planeid) const
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
decltype(auto) get(T &&obj)
ADL-aware version of std::to_string.
geo::Point_t ShowerCentre(std::vector< art::Ptr< recob::SpacePoint >> const &showersps) const
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
double Pz(const int i=0) const
double RMSShowerGradient(std::vector< art::Ptr< recob::SpacePoint >> &sps, const geo::Point_t &ShowerCentre, const geo::Vector_t &Direction, const unsigned int nSegments) const
cet::coded_exception< error, detail::translate > exception