All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions | Variables
TrackCaloSkimmer_module.cc File Reference
#include "TrackCaloSkimmer.h"
#include "art/Utilities/make_tool.h"
#include "sbncode/CAFMaker/FillTrue.h"
#include "sbncode/CAFMaker/RecoUtils/RecoUtils.h"

Go to the source code of this file.

Functions

void ConstResiduals (int &npar, double *g, double &result, double *par, int flag)
 
void ExpResiduals (int &npar, double *g, double &result, double *par, int flag)
 
float HitMinTime (const std::vector< sbn::TrackHitInfo > &hits, bool TPCE, sbn::EDet det)
 
float HitMaxTime (const std::vector< sbn::TrackHitInfo > &hits, bool TPCE, sbn::EDet det)
 
sbn::Vector3D ConvertTVector (const TVector3 &tv)
 
geo::Point_t TrajectoryToWirePosition (const geo::Point_t &loc, const geo::TPCID &tpc)
 
geo::Point_t WireToTrajectoryPosition (const geo::Point_t &loc, const geo::TPCID &tpc)
 
sbn::TrueParticle TrueParticleInfo (const simb::MCParticle &particle, const std::vector< geo::BoxBoundedGeo > &active_volumes, const std::vector< std::vector< geo::BoxBoundedGeo >> &tpc_volumes, const std::map< int, std::vector< std::pair< geo::WireID, const sim::IDE * >>> &id_to_ide_map, const std::map< int, std::vector< art::Ptr< recob::Hit >>> &id_to_truehit_map, const detinfo::DetectorPropertiesData &dprop, const geo::GeometryCore *geo)
 

Variables

const size_t MAX_N_FIT_DATA = 30
 
static int N_FIT_DATA = -1
 
static double FIT_RR [MAX_N_FIT_DATA]
 
static double FIT_DQDX [MAX_N_FIT_DATA]
 

Function Documentation

void ConstResiduals ( int &  npar,
double *  g,
double &  result,
double *  par,
int  flag 
)

Definition at line 28 of file TrackCaloSkimmer_module.cc.

28  {
29  double ret = 0;
30 
31  double C = *par;
32 
33  for (int i = 0; i < N_FIT_DATA; i++) {
34  double diff = FIT_DQDX[i] - C;
35  ret += diff*diff;
36  }
37 
38  result = sqrt(ret);
39 }
static double FIT_DQDX[MAX_N_FIT_DATA]
static int N_FIT_DATA
sbn::Vector3D ConvertTVector ( const TVector3 &  tv)

Definition at line 434 of file TrackCaloSkimmer_module.cc.

434  {
435  sbn::Vector3D v;
436  v.x = tv.X();
437  v.y = tv.Y();
438  v.z = tv.Z();
439 
440  return v;
441 }
void ExpResiduals ( int &  npar,
double *  g,
double &  result,
double *  par,
int  flag 
)

Definition at line 41 of file TrackCaloSkimmer_module.cc.

41  {
42  double ret = 0;
43 
44  double A = par[0];
45  double R = par[1];
46 
47  for (int i = 0; i < N_FIT_DATA; i++) {
48  double diff = FIT_DQDX[i] - A*exp(-FIT_RR[i]/R);
49  ret += diff*diff;
50  }
51 
52  result = sqrt(ret);
53 }
static double FIT_RR[MAX_N_FIT_DATA]
static double FIT_DQDX[MAX_N_FIT_DATA]
static int N_FIT_DATA
float A
Definition: dedx.py:137
float HitMaxTime ( const std::vector< sbn::TrackHitInfo > &  hits,
bool  TPCE,
sbn::EDet  det 
)

Definition at line 412 of file TrackCaloSkimmer_module.cc.

414  {
415  double max = -1;
416  bool hit_is_TPCE = -1;
417 
418  for (const sbn::TrackHitInfo &h: hits) {
419 
420  // In ICARUS, TPC E is 0, 1 and TPC W is 2, 3
421  if(det == sbn::kICARUS) hit_is_TPCE = h.h.tpc <= 1;
422 
423  // In SBND, TPC 0 and 1
424  if(det == sbn::kSBND) hit_is_TPCE = h.h.tpc <= 0;
425 
426  if (h.oncalo && hit_is_TPCE == TPCE) {
427  if (max < 0. || h.h.time > max) max = h.h.time;
428  }
429  }
430 
431  return max;
432 }
while getopts h
float HitMinTime ( const std::vector< sbn::TrackHitInfo > &  hits,
bool  TPCE,
sbn::EDet  det 
)

Definition at line 388 of file TrackCaloSkimmer_module.cc.

390  {
391  double min = -1;
392  bool hit_is_TPCE = -1;
393 
394  for (const sbn::TrackHitInfo &h: hits) {
395 
396  // In ICARUS, TPC E is 0, 1 and TPC W is 2, 3
397  if(det == sbn::kICARUS) hit_is_TPCE = h.h.tpc <= 1;
398 
399  // In SBND, TPC 0 and 1
400  if(det == sbn::kSBND) hit_is_TPCE = h.h.tpc <= 0;
401 
402  if (h.oncalo && hit_is_TPCE == TPCE) {
403  if (min < 0. || h.h.time < min) min = h.h.time;
404  }
405  }
406 
407  return min;
408 }
while getopts h
geo::Point_t TrajectoryToWirePosition ( const geo::Point_t loc,
const geo::TPCID tpc 
)

Definition at line 444 of file TrackCaloSkimmer_module.cc.

444  {
445  auto const* sce = lar::providerFrom<spacecharge::SpaceChargeService>();
446  art::ServiceHandle<geo::Geometry const> geom;
447 
448  geo::Point_t ret = loc;
449 
450  // Returned X is the drift -- multiply by the drift direction to undo this
451  int corr = geom->TPC(tpc.TPC).DriftDir()[0];
452 
453  if (sce && sce->EnableSimSpatialSCE()) {
454  geo::Vector_t offset = sce->GetPosOffsets(ret);
455 
456  ret.SetX(ret.X() + corr * offset.X());
457  ret.SetY(ret.Y() + offset.Y());
458  ret.SetZ(ret.Z() + offset.Z());
459  }
460 
461  return ret;
462 }
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
Definition: geo_vectors.h:164
BEGIN_PROLOG TPC Trig offset(g4 rise time) ProjectToHeight
Definition: CORSIKAGen.fcl:7
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:406
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:184
sbn::TrueParticle TrueParticleInfo ( const simb::MCParticle &  particle,
const std::vector< geo::BoxBoundedGeo > &  active_volumes,
const std::vector< std::vector< geo::BoxBoundedGeo >> &  tpc_volumes,
const std::map< int, std::vector< std::pair< geo::WireID, const sim::IDE * >>> &  id_to_ide_map,
const std::map< int, std::vector< art::Ptr< recob::Hit >>> &  id_to_truehit_map,
const detinfo::DetectorPropertiesData dprop,
const geo::GeometryCore geo 
)

Definition at line 483 of file TrackCaloSkimmer_module.cc.

489  {
490 
491  std::vector<std::pair<geo::WireID, const sim::IDE *>> empty;
492  const std::vector<std::pair<geo::WireID, const sim::IDE *>> &particle_ides = id_to_ide_map.count(particle.TrackId()) ? id_to_ide_map.at(particle.TrackId()) : empty;
493 
494  std::vector<art::Ptr<recob::Hit>> emptyHits;
495  const std::vector<art::Ptr<recob::Hit>> &particle_hits = id_to_truehit_map.count(particle.TrackId()) ? id_to_truehit_map.at(particle.TrackId()) : emptyHits;
496 
497  sbn::TrueParticle trueparticle;
498 
499  trueparticle.length = 0.;
500  trueparticle.crosses_tpc = false;
501  trueparticle.wallin = (int)caf::kWallNone;
502  trueparticle.wallout = (int)caf::kWallNone;
503  trueparticle.plane0VisE = 0.;
504  trueparticle.plane1VisE = 0.;
505  trueparticle.plane2VisE = 0.;
506  trueparticle.plane0nhit = 0;
507  trueparticle.plane1nhit = 0;
508  trueparticle.plane2nhit = 0;
509  for (auto const &ide_pair: particle_ides) {
510  const geo::WireID &w = ide_pair.first;
511  const sim::IDE *ide = ide_pair.second;
512 
513  if (w.Plane == 0) {
514  trueparticle.plane0VisE += ide->energy / 1000. /* MeV -> GeV*/;
515  }
516  else if (w.Plane == 1) {
517  trueparticle.plane1VisE += ide->energy / 1000. /* MeV -> GeV*/;
518  }
519  else if (w.Plane == 2) {
520  trueparticle.plane2VisE += ide->energy / 1000. /* MeV -> GeV*/;
521  }
522  }
523 
524  for (const art::Ptr<recob::Hit> h: particle_hits) {
525  const geo::WireID &w = h->WireID();
526 
527  if (w.Plane == 0) {
528  trueparticle.plane0nhit ++;
529  }
530  else if (w.Plane == 1) {
531  trueparticle.plane1nhit ++;
532  }
533  else if (w.Plane == 2) {
534  trueparticle.plane2nhit ++;
535  }
536 
537  }
538 
539  // if no trajectory points, then assume outside AV
540  trueparticle.cont_tpc = particle.NumberTrajectoryPoints() > 0;
541  trueparticle.contained = particle.NumberTrajectoryPoints() > 0;
542 
543  // Get the entry and exit points
544  int entry_point = -1;
545 
546  int cryostat_index = -1;
547  int tpc_index = -1;
548 
549  for (unsigned j = 0; j < particle.NumberTrajectoryPoints(); j++) {
550  for (unsigned i = 0; i < active_volumes.size(); i++) {
551  if (active_volumes.at(i).ContainsPosition(particle.Position(j).Vect())) {
552  entry_point = j;
553  cryostat_index = i;
554  break;
555  }
556  }
557  if (entry_point != -1) break;
558  }
559 
560  // get the wall
561  if (entry_point > 0) {
562  trueparticle.wallin = (int)caf::GetWallCross(active_volumes.at(cryostat_index), particle.Position(entry_point).Vect(), particle.Position(entry_point-1).Vect());
563  }
564 
565  int exit_point = -1;
566 
567  // now setup the cryostat the particle is in
568  std::vector<geo::BoxBoundedGeo> volumes;
569  if (entry_point >= 0) {
570  volumes = tpc_volumes.at(cryostat_index);
571  for (unsigned i = 0; i < volumes.size(); i++) {
572  if (volumes[i].ContainsPosition(particle.Position(entry_point).Vect())) {
573  tpc_index = i;
574  trueparticle.cont_tpc = entry_point == 0;
575  break;
576  }
577  }
578  trueparticle.contained = entry_point == 0;
579  }
580  // if we couldn't find the initial point, set not contained
581  else {
582  trueparticle.contained = false;
583  }
584 
585  if (tpc_index < 0) {
586  trueparticle.cont_tpc = false;
587  }
588 
589  // Get the length and determine if any point leaves the active volume
590  // Use every trajectory point if possible
591  if (entry_point >= 0) {
592  // particle trajectory
593  const simb::MCTrajectory &trajectory = particle.Trajectory();
594  TVector3 pos = trajectory.Position(entry_point).Vect();
595  for (unsigned i = entry_point+1; i < particle.NumberTrajectoryPoints(); i++) {
596  TVector3 this_point = trajectory.Position(i).Vect();
597  // get the exit point
598  // update if particle is contained
599  // check if particle has crossed TPC
600  if (!trueparticle.crosses_tpc) {
601  for (unsigned j = 0; j < volumes.size(); j++) {
602  if (volumes[j].ContainsPosition(this_point) && tpc_index >= 0 && j != ((unsigned)tpc_index)) {
603  trueparticle.crosses_tpc = true;
604  break;
605  }
606  }
607  }
608  // check if particle has left tpc
609  if (trueparticle.cont_tpc) {
610  trueparticle.cont_tpc = volumes[tpc_index].ContainsPosition(this_point);
611  }
612 
613  if (trueparticle.contained) {
614  trueparticle.contained = active_volumes.at(cryostat_index).ContainsPosition(this_point);
615  }
616 
617  trueparticle.length += (this_point - pos).Mag();
618 
619  if (!active_volumes.at(cryostat_index).ContainsPosition(this_point) && active_volumes.at(cryostat_index).ContainsPosition(pos)) {
620  exit_point = i-1;
621  }
622 
623  pos = trajectory.Position(i).Vect();
624  }
625  }
626  if (exit_point < 0 && entry_point >= 0) {
627  exit_point = particle.NumberTrajectoryPoints() - 1;
628  }
629  if (exit_point >= 0 && ((unsigned)exit_point) < particle.NumberTrajectoryPoints() - 1) {
630  trueparticle.wallout = (int)caf::GetWallCross(active_volumes.at(cryostat_index), particle.Position(exit_point).Vect(), particle.Position(exit_point+1).Vect());
631  }
632 
633  // other truth information
634  trueparticle.pdg = particle.PdgCode();
635 
636  trueparticle.gen = ConvertTVector(particle.NumberTrajectoryPoints() ? particle.Position().Vect() : TVector3(-9999, -9999, -9999));
637  trueparticle.genT = particle.NumberTrajectoryPoints() ? particle.Position().T() / 1000. /* ns -> us*/: -9999;
638  trueparticle.genp = ConvertTVector(particle.NumberTrajectoryPoints() ? particle.Momentum().Vect(): TVector3(-9999, -9999, -9999));
639  trueparticle.genE = particle.NumberTrajectoryPoints() ? particle.Momentum().E(): -9999;
640 
641  trueparticle.start = ConvertTVector((entry_point >= 0) ? particle.Position(entry_point).Vect(): TVector3(-9999, -9999, -9999));
642  trueparticle.startT = (entry_point >= 0) ? particle.Position(entry_point).T() / 1000. /* ns-> us*/: -9999;
643  trueparticle.end = ConvertTVector((exit_point >= 0) ? particle.Position(exit_point).Vect(): TVector3(-9999, -9999, -9999));
644  trueparticle.endT = (exit_point >= 0) ? particle.Position(exit_point).T() / 1000. /* ns -> us */ : -9999;
645 
646  trueparticle.startp = ConvertTVector((entry_point >= 0) ? particle.Momentum(entry_point).Vect() : TVector3(-9999, -9999, -9999));
647  trueparticle.startE = (entry_point >= 0) ? particle.Momentum(entry_point).E() : -9999.;
648  trueparticle.endp = ConvertTVector((exit_point >= 0) ? particle.Momentum(exit_point).Vect() : TVector3(-9999, -9999, -9999));
649  trueparticle.endE = (exit_point >= 0) ? particle.Momentum(exit_point).E() : -9999.;
650 
651  trueparticle.start_process = (int)caf::GetG4ProcessID(particle.Process());
652  trueparticle.end_process = (int)caf::GetG4ProcessID(particle.EndProcess());
653 
654  trueparticle.G4ID = particle.TrackId();
655  trueparticle.parent = particle.Mother();
656 
657  // Organize deposition info into per-wire true "Hits" -- key is the Channel Number
658  std::map<unsigned, sbn::TrueHit> truehits;
659 
660  for (auto const &ide_pair: particle_ides) {
661  const geo::WireID &w = ide_pair.first;
662  unsigned c = geo->PlaneWireToChannel(w);
663  const sim::IDE *ide = ide_pair.second;
664 
665  // Set stuff
666  truehits[c].cryo = w.Cryostat;
667  truehits[c].tpc = w.TPC;
668  truehits[c].plane = w.Plane;
669  truehits[c].wire = w.Wire;
670  truehits[c].channel = c;
671 
672  // Average stuff using charge-weighting
673  float old_elec = truehits[c].nelec;
674  float new_elec = old_elec + ide->numElectrons;
675  truehits[c].p.x = (truehits[c].p.x*old_elec + ide->x*ide->numElectrons) / new_elec;
676  truehits[c].p.y = (truehits[c].p.y*old_elec + ide->y*ide->numElectrons) / new_elec;
677  truehits[c].p.z = (truehits[c].p.z*old_elec + ide->z*ide->numElectrons) / new_elec;
678 
679  // Also get the position with space charge un-done
680  geo::Point_t ide_p(ide->x, ide->y, ide->z);
681  geo::Point_t ide_p_scecorr = WireToTrajectoryPosition(ide_p, w);
682 
683  truehits[c].p_scecorr.x = (truehits[c].p_scecorr.x*old_elec + ide_p_scecorr.x()*ide->numElectrons) / new_elec;
684  truehits[c].p_scecorr.y = (truehits[c].p_scecorr.y*old_elec + ide_p_scecorr.y()*ide->numElectrons) / new_elec;
685  truehits[c].p_scecorr.z = (truehits[c].p_scecorr.z*old_elec + ide_p_scecorr.z()*ide->numElectrons) / new_elec;
686 
687  // Sum stuff
688  truehits[c].nelec += ide->numElectrons;
689  truehits[c].e += ide->energy;
690  truehits[c].ndep += 1;
691  }
692 
693  // Compute widths
694  for (auto const &ide_pair: particle_ides) {
695  const geo::WireID &w = ide_pair.first;
696  unsigned c = geo->PlaneWireToChannel(w);
697  const sim::IDE *ide = ide_pair.second;
698 
699  geo::Point_t ide_p(ide->x, ide->y, ide->z);
700  geo::Point_t ide_p_scecorr = WireToTrajectoryPosition(ide_p, w);
701 
702  // Average stuff using charge-weighting
703  float this_elec = ide->numElectrons;
704 
705  truehits[c].p_width.x += (ide_p.x() - truehits[c].p.x) * (ide_p.x() - truehits[c].p.x) * this_elec / truehits[c].nelec;
706  truehits[c].p_width.y += (ide_p.y() - truehits[c].p.y) * (ide_p.y() - truehits[c].p.y) * this_elec / truehits[c].nelec;
707  truehits[c].p_width.z += (ide_p.z() - truehits[c].p.z) * (ide_p.z() - truehits[c].p.z) * this_elec / truehits[c].nelec;
708 
709  truehits[c].p_scecorr_width.x += (ide_p_scecorr.x() - truehits[c].p_scecorr.x) * (ide_p_scecorr.x() - truehits[c].p_scecorr.x) * this_elec / truehits[c].nelec;
710  truehits[c].p_scecorr_width.y += (ide_p_scecorr.y() - truehits[c].p_scecorr.y) * (ide_p_scecorr.y() - truehits[c].p_scecorr.y) * this_elec / truehits[c].nelec;
711  truehits[c].p_scecorr_width.z += (ide_p_scecorr.z() - truehits[c].p_scecorr.z) * (ide_p_scecorr.z() - truehits[c].p_scecorr.z) * this_elec / truehits[c].nelec;
712  }
713 
714  // Convert to vector
715  std::vector<sbn::TrueHit> truehits_v;
716  for (auto const &p: truehits) {
717  truehits_v.push_back(p.second);
718  }
719 
720  // Compute the time of each hit
721  for (sbn::TrueHit &h: truehits_v) {
722  h.time = dprop.ConvertXToTicks(h.p.x, h.plane, h.tpc, h.cryo);
723 
724  double xdrift = abs(h.p.x - geo->TPC(h.tpc, h.cryo).PlaneLocation(0)[0]);
725  h.tdrift = xdrift / dprop.DriftVelocity();
726  }
727 
728  // Compute the pitch of each hit and order it in the trajectory
729  for (sbn::TrueHit &h: truehits_v) {
730  // Use the SCE-undone hit since this matches to the Trajectory
731  TVector3 h_p(h.p_scecorr.x, h.p_scecorr.y, h.p_scecorr.z);
732 
733  TVector3 direction;
734  float closest_dist = -1.;
735  int traj_index = -1;
736  for (unsigned i_traj = 0; i_traj < particle.NumberTrajectoryPoints(); i_traj++) {
737  if (closest_dist < 0. || (particle.Position(i_traj).Vect() - h_p).Mag() < closest_dist) {
738  direction = particle.Momentum(i_traj).Vect().Unit();
739  closest_dist = (particle.Position(i_traj).Vect() - h_p).Mag();
740  traj_index = i_traj;
741  }
742  }
743 
744  // If we got a direction, get the pitch
745  if (closest_dist >= 0. && direction.Mag() > 1e-4) {
746  geo::PlaneID plane(h.cryo, h.tpc, h.plane);
747  float angletovert = geo->WireAngleToVertical(geo->View(plane), plane) - 0.5*::util::pi<>();
748  float cosgamma = abs(cos(angletovert) * direction.Z() + sin(angletovert) * direction.Y());
749  float pitch = geo->WirePitch(plane) / cosgamma;
750  h.pitch = pitch;
751  }
752  else {
753  h.pitch = -1.;
754  }
755  // And the pitch induced by SCE
756  if (closest_dist >= 0. && direction.Mag() > 1e-4) {
757  geo::PlaneID plane(h.cryo, h.tpc, h.plane);
758  float angletovert = geo->WireAngleToVertical(geo->View(plane), plane) - 0.5*::util::pi<>();
759 
760  TVector3 loc_mdx_v = h_p - direction * (geo->WirePitch(geo->View(plane) / 2.));
761  TVector3 loc_pdx_v = h_p + direction * (geo->WirePitch(geo->View(plane) / 2.));
762 
763  // Convert types for helper functions
764  geo::Point_t loc_mdx(loc_mdx_v.X(), loc_mdx_v.Y(), loc_mdx_v.Z());
765  geo::Point_t loc_pdx(loc_pdx_v.X(), loc_pdx_v.Y(), loc_pdx_v.Z());
766  geo::Point_t h_p_point(h_p.X(), h_p.Y(), h_p.Z());
767 
768  loc_mdx = TrajectoryToWirePosition(loc_mdx, plane);
769  loc_pdx = TrajectoryToWirePosition(loc_pdx, plane);
770 
771  // Direction at wires
772  geo::Vector_t dir = (loc_pdx - loc_mdx) / (loc_mdx - loc_pdx).r();
773 
774  // Pitch at wires
775  double cosgamma = std::abs(std::sin(angletovert)*dir.Y() + std::cos(angletovert)*dir.Z());
776  double pitch;
777  if (cosgamma) {
778  pitch = geo->WirePitch(geo->View(plane))/cosgamma;
779  }
780  else {
781  pitch = 0.;
782  }
783 
784  // Now bring that back to the particle trajectory
785  geo::Point_t loc_w = TrajectoryToWirePosition(h_p_point, plane);
786 
787  geo::Point_t locw_pdx_traj = WireToTrajectoryPosition(loc_w + pitch*dir, plane);
788  geo::Point_t loc = WireToTrajectoryPosition(loc_w, plane);
789 
790  h.pitch_sce = (locw_pdx_traj - loc).R();
791  }
792  else {
793  h.pitch_sce = -1.;
794  }
795 
796  // And the trajectory location
797  h.itraj = traj_index;
798 
799  // And the residual range of the hit
800  h.rr = 0.;
801  if (traj_index >= 0) {
802  for (int i_traj = traj_index+1; i_traj < (int)particle.NumberTrajectoryPoints(); i_traj++) {
803  h.rr += (particle.Position(i_traj).Vect() - particle.Position(i_traj-1).Vect()).Mag();
804  }
805 
806  // Also account for the distance from the Hit point to the matched trajectory point
807  double hit_distance_along_particle = (h_p - particle.Position(traj_index).Vect()).Dot(particle.Momentum(traj_index).Vect().Unit());
808  h.rr += -hit_distance_along_particle;
809 
810  }
811  }
812 
813  // Order the hits by their location along the trajectory, start to end
814  std::sort(truehits_v.begin(), truehits_v.end(),
815  [](auto const &lhs, auto const &rhs) {
816  return lhs.itraj < rhs.itraj;
817  });
818 
819  // Save depositions into the True Particle
820  for (sbn::TrueHit &h: truehits_v) {
821  if (h.plane == 0) {
822  trueparticle.truehits0.push_back(h);
823  }
824  else if (h.plane == 1) {
825  trueparticle.truehits1.push_back(h);
826  }
827  else if (h.plane == 2) {
828  trueparticle.truehits2.push_back(h);
829  }
830  }
831 
832  return trueparticle;
833 }
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
Definition: geo_vectors.h:164
int end_process
End G4 process of the particle. Values defined as enum in StandardRecord.
float z
z position of ionization [cm]
Definition: SimChannel.h:121
sbn::Vector3D ConvertTVector(const TVector3 &tv)
int wallout
Wall of cryostat particle exits (wNone if stopping in detector)
Vector3D endp
Momentum at last point in the active TPC volume [GeV/c].
Vector3D genp
Momentum at generation point [GeV/c].
Vector3D gen
Generation position [cm].
pdgs p
Definition: selectors.fcl:22
The data type to uniquely identify a Plane.
Definition: geo_types.h:472
CryostatID_t Cryostat
Index of cryostat.
Definition: geo_types.h:212
WireID_t Wire
Index of the wire within its plane.
Definition: geo_types.h:580
std::vector< TrueHit > truehits0
List of True &quot;hits&quot; of this particle on Plane 0.
float x
x position of ionization [cm]
Definition: SimChannel.h:119
unsigned plane1nhit
Number of hits on plane 1 (2nd Ind.)
int wallin
Wall of cryostat particle enters (wNone if starting in detector)
geo::Length_t WirePitch(geo::PlaneID const &planeid) const
Returns the distance between two consecutive wires.
std::vector< TrueHit > truehits2
List of True &quot;hits&quot; of this particle on Plane 2.
float genE
Energy at generation pt [GeV].
while getopts h
T abs(T value)
geo::Point_t WireToTrajectoryPosition(const geo::Point_t &loc, const geo::TPCID &tpc)
unsigned plane0nhit
Number of hits on plane 0 (1st Ind.)
float plane2VisE
Sum of energy deposited on plane 2 (Col.) [GeV].
caf::g4_process_ GetG4ProcessID(const std::string &name)
Definition: FillTrue.cxx:1094
Ionization at a point of the TPC sensitive volume.
Definition: SimChannel.h:86
bool contained
Whether the particle is contained in a single active volume.
float endT
End time last point in the active [mus – t=0 is spill time].
Vector3D start
Start position in the active TPC volume [cm].
bool crosses_tpc
Whether the particle crosses a TPC boundary.
bool cont_tpc
Whether the particle is contained in a single TPC.
float energy
energy deposited by ionization by this track ID and time [MeV]
Definition: SimChannel.h:118
std::vector< TrueHit > truehits1
List of True &quot;hits&quot; of this particle on Plane 1.
double ConvertXToTicks(double X, int p, int t, int c) const
geo::Point_t TrajectoryToWirePosition(const geo::Point_t &loc, const geo::TPCID &tpc)
double DriftVelocity(double efield=0., double temperature=0.) const
cm/us
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:493
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
float plane1VisE
Sum of energy deposited on plane 1 (2nd Ind.) [GeV].
float endE
Energy at last pt in active TPC volume [GeV].
Vector3D end
End position in the active TPC volume [cm].
float startT
Start time of first TPC point [mus – t=0 is spill time].
tuple dir
Definition: dropbox.py:28
float y
y position of ionization [cm]
Definition: SimChannel.h:120
raw::ChannelID_t PlaneWireToChannel(WireID const &wireid) const
Returns the ID of the TPC channel connected to the specified wire.
float length
Trajectory length in active TPC volume the particle first enters [cm].
float startE
Energy at first pt in active TPC volume [GeV].
float plane0VisE
Sum of energy deposited on plane 0 (1st Ind.) [GeV].
do i e
float genT
Start time of gen point [mus – t=0 is spill time].
unsigned plane2nhit
Number of hits on plane 2 (Col.)
int G4ID
ID of the particle (taken from G4 – -1 if this particle is not propogated by G4)
int pdg
Particle ID code.
TPCGeo const & TPC(unsigned int const tpc=0, unsigned int const cstat=0) const
Returns the specified TPC.
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:406
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:184
bool empty(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:555
int start_process
Start G4 process of the particle. Values defned as enum in StandardRecord.
const double * PlaneLocation(unsigned int p) const
Definition: TPCGeo.cxx:382
double WireAngleToVertical(geo::View_t view, geo::TPCID const &tpcid) const
Returns the angle of the wires in the specified view from vertical.
int parent
ID of parent particle.
float numElectrons
number of electrons at the readout for this track ID and time
Definition: SimChannel.h:117
caf::Wall_t GetWallCross(const geo::BoxBoundedGeo &volume, const TVector3 p0, const TVector3 p1)
Definition: FillTrue.cxx:1052
Vector3D startp
Momentum at first point in the active TPC volume [GeV/c].
geo::Point_t WireToTrajectoryPosition ( const geo::Point_t loc,
const geo::TPCID tpc 
)

Definition at line 465 of file TrackCaloSkimmer_module.cc.

465  {
466  auto const* sce = lar::providerFrom<spacecharge::SpaceChargeService>();
467 
468  geo::Point_t ret = loc;
469 
470  if (sce && sce->EnableSimSpatialSCE()) {
471  geo::Vector_t offset = sce->GetCalPosOffsets(ret, tpc.TPC);
472 
473  ret.SetX(ret.X() + offset.X());
474  ret.SetY(ret.Y() + offset.Y());
475  ret.SetZ(ret.Z() + offset.Z());
476  }
477 
478  return ret;
479 
480 }
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
Definition: geo_vectors.h:164
BEGIN_PROLOG TPC Trig offset(g4 rise time) ProjectToHeight
Definition: CORSIKAGen.fcl:7
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:406
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:184

Variable Documentation

double FIT_DQDX[MAX_N_FIT_DATA]
static

Definition at line 26 of file TrackCaloSkimmer_module.cc.

double FIT_RR[MAX_N_FIT_DATA]
static

Definition at line 25 of file TrackCaloSkimmer_module.cc.

const size_t MAX_N_FIT_DATA = 30

Definition at line 22 of file TrackCaloSkimmer_module.cc.

int N_FIT_DATA = -1
static

Definition at line 24 of file TrackCaloSkimmer_module.cc.