25 #include "art_root_io/TFileService.h" 136 fSimLabels = p.
get<std::vector<art::InputTag>>(
"SimLabels", {});
150 std::map<int, simb::MCParticle> idToPart;
151 for(
const auto& part: *parts) idToPart[part.TrackId()] = part;
153 idToPart[-1] = idToPart[0];
154 mf::LogInfo(
"Number of Particles") <<
"There are " << parts->size() <<
" simb::MCParticles in this event.\n";
165 const auto center = sens.GetCenter();
167 for(
const auto& ide:
channel.AuxDetIDEs())
169 const auto found = idToPart.find(ide.trackID);
170 if(
found != idToPart.end())
172 const auto& part =
found->second;
173 const auto closestPt = std::min_element(part.Trajectory().begin(), part.Trajectory().end(),
174 [¢erV](
const auto& first,
const auto&
second)
178 return (first.first*0.1-centerV).Vect().Mag() < (
second.first*0.1-centerV).Vect().Mag();
181 if(closestPt != part.Trajectory().end())
197 else mf::LogWarning(
"No Closest Point") <<
"No point found that is considered \"closest\" to AuxDetSensitive!\n";
199 else mf::LogWarning(
"No Such TrackID") <<
"No map entry for TrackID " << ide.trackID <<
"\n";
208 const auto geom = lar::providerFrom<geo::Geometry>();
211 for(
size_t det = 0; det < geom->NAuxDets(); ++det)
213 const auto&
geo = geom->AuxDet(det);
214 mf::LogInfo(
"AuxDetGeometry") <<
"AuxDetGeo number " << det <<
", " <<
geo.Name() <<
", is centered at " <<
geo.GetCenter()
215 <<
" and has sensitive volumes:\n";
216 for(
size_t sens = 0; sens <
geo.NSensitiveVolume(); ++sens)
218 const auto& sensGeo =
geo.SensitiveVolume(sens);
219 const auto center = sensGeo.GetCenter();
222 mf::LogInfo(
"AuxDetGeometry") <<
"Sensitive volume " << sens <<
": " << sensGeo.TotalVolume()->GetName() <<
" with center " 223 << sensGeo.GetCenter() <<
" which gives information about " <<
std::string(xPos?
"X":
"Y") <<
" coordinates.\n";
230 consumes<std::vector<simb::MCParticle>>(
fPartLabel);
234 fXDistToTrueTrackFront = tfs->make<TH1D>(
"XDistToTrueTrackFront",
"X Distance from True Trajectory to CRT Hits" 235 ";X[mm];Events", 150, -30, 30);
236 fYDistToTrueTrackFront = tfs->make<TH1D>(
"YDistToTrueTrackFront",
"Y Distance from True Trajectory to CRT Hits" 237 ";Y[mm];Events", 150, -30, 30);
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
AuxDetSensitiveGeo const & SensitiveVolume(size_t sv) const
HelloAuxDet(fhicl::ParameterSet const &p)
TH1D * fXDistToTrueTrackFront
std::vector< art::InputTag > fDigitLabels
EDAnalyzer(fhicl::ParameterSet const &pset)
art framework interface to geometry description
TH1D * fYDistToTrueTrackFront
HelloAuxDet & operator=(HelloAuxDet const &)=delete
#define DEFINE_ART_MODULE(klass)
T get(std::string const &key) const
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
void analyze(art::Event const &e) override
AuxDetGeo const & AuxDet(unsigned int const ad=0) const
Returns the specified auxiliary detector.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
geo::Point3DBase_t< AuxDetSensitiveGeoCoordinatesTag > LocalPoint_t
Type of points in the local GDML auxiliary detector frame.
Access the description of detector geometry.
second_as<> second
Type of time stored in seconds, in double precision.
LArSoft geometry interface.
std::vector< art::InputTag > fSimLabels