188 string fPFParticleTag =
"pandora";
190 string fCalorimetryTagSCE =
"pandoracalinoxyzt";
191 string fTrackerTag =
"pandoraTrack";
192 string fGeneratorTag =
"generator";
197 std::unique_ptr<std::vector<recob::SpacePoint>> spvp(
new std::vector<recob::SpacePoint>);
198 auto assns = std::make_unique<art::Assns<recob::Hit, recob::SpacePoint>>();
206 if (!
evt.isRealData()) {
208 auto mcTruths =
evt.getValidHandle<std::vector<simb::MCTruth>>(fGeneratorTag);
210 if( !true_beam_particle ){
211 cout <<
"No true beam particle" <<
endl;
222 const std::map<unsigned int, std::vector<const recob::PFParticle*>> sliceMap
224 std::vector<std::vector<const recob::PFParticle*>> beam_slices;
225 for(
auto slice : sliceMap){
226 for(
auto particle : slice.second){
230 beam_slices.push_back(slice.second);
234 if (!added) {
continue;}
240 if (beam_slices.size() > 0){
248 bool found_calo =
false;
250 for ( index = 0; index <
calo.size(); ++
index) {
259 std::sort(theXYZPoints.begin(), theXYZPoints.end(), [](
auto a,
auto b)
260 {
return (
a.Z() <
b.Z());});
261 if (theXYZPoints.size()) {
271 if (
evt.isRealData()) {
272 cout<<
"@@@Is real data"<<
endl;
281 beamdir = beamdir_data.Unit();
285 cout<<
"@@@Is MC"<<
endl;
294 beamdir = beamdir_mc.Unit();
303 TVector3
dir = pt1 - pt0;
318 string fHitModuleLabel =
"hitpdune";
325 auto hitsHandle =
evt.getValidHandle< std::vector<recob::Hit> >(fHitModuleLabel);
327 art::FindOneP<recob::Wire> channelHitWires (hitsHandle,
evt, fHitModuleLabel);
330 std::vector< art::Ptr<recob::Hit> > eventHits;
337 double reco_beam_len = thisTrack->
Length();
338 cout<<
"$$Length:"<<reco_beam_len<<
endl;
340 for (; thisTrack->
Length(i) > reco_beam_len -
sel_len; ++i ){
344 cout<<
"$$"<<
"\tX"<<pos.X()<<
"\tY"<<pos.Y()<<
"\tZ"<<pos.Z()<<
endl;
346 auto TpIndices =
calo[
index].TpIndices();
351 cout<<
"$$$WireCoord: U "<<wirecoord_U<<
"\tV "<<wirecoord_V<<
"\tX "<<wirecoord_X<<
endl;
353 std::vector< art::Ptr< recob::Hit > > remove_hits;
354 std::vector< art::Ptr< recob::Hit > > tag_hits;
356 std::vector< recob::SpacePoint > spv;
359 spvp->insert(spvp->end(), spv.begin(), spv.end());
360 for (
size_t kk = 0; kk < beamPFP_hits.size(); ++kk){
361 auto hit = beamPFP_hits[kk];
368 if (hitid.
Plane == 0) {
369 if (hitid.
Wire > wirecoord_U) {
370 remove_hits.push_back(
hit);
373 tag_hits.push_back(
hit);
376 else if (hitid.
Plane == 1) {
377 if (hitid.
Wire < wirecoord_V) {
378 remove_hits.push_back(
hit);
381 tag_hits.push_back(
hit);
384 else if (hitid.
Plane == 2) {
385 if (hitid.
Wire > wirecoord_X) {
386 remove_hits.push_back(
hit);
389 tag_hits.push_back(
hit);
397 for (
size_t kk = 0; kk < eventHits.size(); ++kk){
398 auto hit = eventHits[kk];
400 itr = find(remove_hits.begin(), remove_hits.end(),
hit);
401 if (itr == remove_hits.end()) {
402 hcol.emplace_back(
std::move(*
hit), channelHitWires.at(kk));
404 vector<art::Ptr<recob::Hit>>
::iterator itr_tag;
405 itr_tag = find(tag_hits.begin(), tag_hits.end(),
hit);
406 if (itr_tag != tag_hits.end()) {
407 auto hitPtr = hitPtrMaker(hcol.size() - 1);
geo::Length_t WireCoordinate(double YPos, double ZPos, geo::PlaneID const &planeid) const
Returns the index of the nearest wire to the specified position.
const double beam_startZ_data
bool IsBeamParticle(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const
Use the pandora metadata to tell us if this is a beam particle or not.
const double beam_startX_data
const simb::MCParticle * GetGeantGoodParticle(const simb::MCTruth &genTruth, const art::Event &evt) const
const double beam_angleX_mc
void TrueBeamInfo(const art::Event &evt, const simb::MCParticle *true_beam_particle)
const double beam_startZ_rms_data
const double beam_startZ_rms_mc
const double beam_angleX_data
double reco_beam_calo_endY
std::vector< anab::Calorimetry > GetRecoTrackCalorimetry(const recob::Track &track, art::Event const &evt, const std::string trackModule, const std::string caloModule) const
Get the Calorimetry(s) from a given reco track.
geo::GeometryCore const * fGeom
Point_t const & LocationAtPoint(size_t i) const
double reco_beam_calo_endX
CryostatID_t Cryostat
Index of cryostat.
WireID_t Wire
Index of the wire within its plane.
const double beam_startX_rms_data
double reco_beam_calo_startZ
protoana::ProtoDUNETruthUtils truthUtil
const double beam_angleZ_data
const double beam_startY_data
double Length(size_t p=0) const
Access to various track properties.
protoana::ProtoDUNETrackUtils trackUtil
A class handling a collection of hits and its associations.
protoana::ProtoDUNEPFParticleUtils pfpUtil
const double beam_startY_rms_data
const recob::Track * GetPFParticleTrack(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel, const std::string trackLabel) const
Get the track associated to this particle. Returns a null pointer if not found.
bool PassBeamQualityCut() const
const std::map< unsigned int, std::vector< const recob::PFParticle * > > GetPFParticleSliceMap(art::Event const &evt, const std::string particleLabel) const
Get a map of slice index to the primary PFParticles within it.
const double beam_angleY_data
const double beam_angleZ_mc
bool CreateAssn(PRODUCER const &prod, art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t indx=UINT_MAX)
Creates a single one-to-one association.
const double beam_startX_mc
PlaneID_t Plane
Index of the plane within its TPC.
double reco_beam_calo_startY
Detector simulation of raw signals on wires.
double reco_beam_calo_startX
const double beam_startZ_mc
std::string true_beam_endProcess
const double beam_angleY_mc
Hierarchical representation of particle flow.
const double beam_startY_mc
const std::vector< art::Ptr< recob::Hit > > GetPFParticleHits_Ptrs(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const
double reco_beam_calo_endZ
detail::Node< FrameID, bool > PlaneID
const double beam_startY_rms_mc
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
TPCID_t TPC
Index of the TPC within its cryostat.
const double beam_startX_rms_mc
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
QTextStream & endl(QTextStream &s)