12 #include "art_root_io/TFileService.h" 63 void get_MC_particle_list(
sim::ParticleList const&, std::vector<simb::MCParticle>&);
68 void match_flashes_to_tracks(std::vector<recob::OpFlash>
const&,
69 std::vector<recob::Track>
const&);
71 void match_flashes_to_particles(std::vector<recob::OpFlash>
const&,
72 std::vector<simb::MCParticle>
const&,
132 "Time difference between particles and flashes; t_diff (ns); flash/particle pairs",
138 "Time difference between particles and flashes; t_diff (ns); flash/particle pairs",
143 "hNBeamFlashes",
"Number of flashes OnBeamTime per event; N_{Flashes}; Events", 5, 0, 5);
145 fMatchTree_PF = tfs->make<TTree>(
"MatchTree_PF",
"MatchTree_PF");
146 fMatchTree_PF->Branch(
"Run", &
fRun,
"Run/I");
147 fMatchTree_PF->Branch(
"Event", &
fEvent,
"Event/I");
148 fMatchTree_PF->Branch(
"p_id", &
fParticleID,
"p_id/I");
150 fMatchTree_PF->Branch(
"p_vx", &
fParticleVx,
"p_vx/F");
151 fMatchTree_PF->Branch(
"p_vy", &
fParticleVy,
"p_vy/F");
152 fMatchTree_PF->Branch(
"p_vz", &
fParticleVz,
"p_vz/F");
155 fMatchTree_PF->Branch(
"FlashID", &
fFlashID,
"flash_id/I");
156 fMatchTree_PF->Branch(
"f_time", &
fFlashTime,
"f_time/F");
157 fMatchTree_PF->Branch(
"f_timewidth", &
fFlashTimeWidth,
"f_timewidth/F");
158 fMatchTree_PF->Branch(
"f_y", &
fFlashY,
"f_y/F");
159 fMatchTree_PF->Branch(
"f_z", &
fFlashZ,
"f_z/F");
160 fMatchTree_PF->Branch(
"f_ywidth", &
fFlashYWidth,
"f_ywidth/F");
161 fMatchTree_PF->Branch(
"f_zwidth", &
fFlashYWidth,
"f_zwidth/F");
163 fMatchTree_PF->Branch(
"f_pe", &
fFlashPE,
"f_pe/F");
164 fMatchTree_PF->Branch(
"matchIndex", &
fMatchIndex,
"matchIndex/I");
201 std::vector<recob::OpFlash>
const& flash_vector(*flash_handle);
204 MF_LOG_INFO(
"OpticalRecoAna") <<
"Number of flashes is " << flash_vector.size() << std::flush;
210 std::vector<simb::MCParticle> particle_list;
214 mf::LogInfo(
"OpticalRecoAna") <<
"Number of MC particles is " << particle_list.size();
217 const float ns_per_PMT_tick =
223 for (
auto const& my_flash : flash_vector) {
224 if (my_flash.OnBeamTime() == 1) n_flashes++;
237 std::vector<simb::MCParticle>& particle_vector)
261 particle_vector.emplace_back(*particle);
275 while (t_iter < numtraj) {
278 geo::Point_t const pos{particle.
Vx(t_iter), particle.
Vy(t_iter), particle.
Vz(t_iter)};
288 if (t_iter == numtraj)
return 0;
291 return particle.
T(t_iter);
295 std::vector<recob::OpFlash>
const& flash_vector,
296 std::vector<simb::MCParticle>
const& particle_vector,
297 float const& ns_per_PMT_tick,
302 int lastFlashID = -1;
304 for (
size_t i_particle = 0; i_particle < particle_vector.size(); i_particle++) {
307 bool pass_check =
false;
309 if (!pass_check)
continue;
311 for (
size_t i_flash = 0; i_flash < flash_vector.size(); i_flash++) {
314 if (my_flash.TotalPE() <
fPEMin)
continue;
316 const float flash_time = my_flash.
Time() * ns_per_PMT_tick;
318 fTimeDiff->Fill(particle_time - flash_time);
351 else if (nonbeam_match) {
double E(const int i=0) const
unsigned int NumberTrajectoryPoints() const
void match_flashes_to_particles(std::vector< recob::OpFlash > const &, std::vector< simb::MCParticle > const &, float const &, geo::Geometry const &)
std::string fFlashModuleLabel
OpticalRecoAna(const fhicl::ParameterSet &)
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
list_type::const_iterator const_iterator
enum simb::_ev_origin Origin_t
event origin types
constexpr auto abs(T v)
Returns the absolute value of the argument.
void analyze(const art::Event &)
std::vector< flash_match > fFlash_match_vector
std::vector< size_t > track_indices
simb::Origin_t get_MC_particle_origin(simb::MCParticle const &)
std::vector< size_t > flash_indices
std::string fTrackModuleLabel
#define DEFINE_ART_MODULE(klass)
const art::Ptr< simb::MCTruth > & TrackIdToMCTruth_P(int id) const
TPCGeo const & PositionToTPC(Point_t const &point) const
Returns the TPC at specified location.
TTree * fMatchTree_PF_NotNu
T get(std::string const &key) const
double T(const int i=0) const
std::vector< size_t > flash_indices
Provides recob::Track data product.
The geometry of one entire detector, as served by art.
#define MF_LOG_INFO(category)
const sim::ParticleList & ParticleList() const
double Vx(const int i=0) const
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
std::vector< particle_match > fParticle_match_vector
void get_MC_particle_list(sim::ParticleList const &, std::vector< simb::MCParticle > &)
double Vz(const int i=0) const
std::vector< size_t > particle_indices
EventNumber_t event() const
float update_MC_particle_time(simb::MCParticle const &, bool &, geo::Geometry const &)
std::vector< size_t > particle_indices
std::vector< size_t > track_indices
std::vector< track_match > fTrack_match_vector
double Vy(const int i=0) const
art framework interface to geometry description
cet::coded_exception< error, detail::translate > exception