12 #include "art_root_io/TFileService.h" 65 void get_MC_particle_list(sim::ParticleList
const& ,std::vector<simb::MCParticle> & );
70 void match_flashes_to_tracks(std::vector<recob::OpFlash>
const& ,
71 std::vector<recob::Track>
const&);
76 void match_flashes_to_particles(std::vector<recob::OpFlash>
const&,
77 std::vector<simb::MCParticle>
const&,
86 void match_flashes_to_particles(std::vector<recob::Track>
const&,
87 std::vector<simb::MCParticle>
const&,
94 void FillMatchTree_PF(std::vector<recob::OpFlash>
const&,
95 std::vector<simb::MCParticle>
const&,
158 fTimeDiff = tfs->make<TH1F>(
"htdiff",
"Time difference between particles and flashes; t_diff (ns); flash/particle pairs",1e3,-5e6,5e6);
159 fTimeDiff_fine = tfs->make<TH1F>(
"htdiff_fine",
"Time difference between particles and flashes; t_diff (ns); flash/particle pairs",100,-1000,1000);
160 fNBeamFlashes = tfs->make<TH1I>(
"hNBeamFlashes",
"Number of flashes OnBeamTime per event; N_{Flashes}; Events",5,0,5);
162 fMatchTree_PF = tfs->make<TTree>(
"MatchTree_PF",
"MatchTree_PF");
163 fMatchTree_PF->Branch(
"Run",&
fRun,
"Run/I");
164 fMatchTree_PF->Branch(
"Event",&
fEvent,
"Event/I");
165 fMatchTree_PF->Branch(
"p_id",&
fParticleID,
"p_id/I");
167 fMatchTree_PF->Branch(
"p_vx",&
fParticleVx,
"p_vx/F");
168 fMatchTree_PF->Branch(
"p_vy",&
fParticleVy,
"p_vy/F");
169 fMatchTree_PF->Branch(
"p_vz",&
fParticleVz,
"p_vz/F");
172 fMatchTree_PF->Branch(
"FlashID",&
fFlashID,
"flash_id/I");
173 fMatchTree_PF->Branch(
"f_time",&
fFlashTime,
"f_time/F");
175 fMatchTree_PF->Branch(
"f_y",&
fFlashY,
"f_y/F");
176 fMatchTree_PF->Branch(
"f_z",&
fFlashZ,
"f_z/F");
177 fMatchTree_PF->Branch(
"f_ywidth",&
fFlashYWidth,
"f_ywidth/F");
178 fMatchTree_PF->Branch(
"f_zwidth",&
fFlashYWidth,
"f_zwidth/F");
180 fMatchTree_PF->Branch(
"f_pe",&
fFlashPE,
"f_pe/F");
181 fMatchTree_PF->Branch(
"matchIndex",&
fMatchIndex,
"matchIndex/I");
221 std::vector<recob::OpFlash>
const& flash_vector(*flash_handle);
225 <<
"Number of flashes is " << flash_vector.size() <<
std::flush;
241 std::vector<simb::MCParticle> particle_list;
246 <<
"Number of MC particles is " << particle_list.size();
250 const float ns_per_PMT_tick = 1e3;
264 for(
auto const& my_flash : flash_vector){
265 if(my_flash.OnBeamTime()==1) n_flashes++;
310 particle_vector.emplace_back(*particle);
323 unsigned int tpc = 0;
324 unsigned int cstat = 0;
328 while(t_iter < numtraj){
331 double pos[3] = {particle.
Vx(t_iter), particle.
Vy(t_iter), particle.
Vz(t_iter)};
341 if(t_iter == numtraj)
345 return particle.
T(t_iter);
349 std::vector<recob::Track>
const& track_vector){
352 for(
size_t i_flash=0; i_flash < flash_vector.size(); i_flash++){
355 if(my_flash.TotalPE() <
fPEMin)
continue;
357 for(
size_t i_track=0; i_track < track_vector.size(); i_track++){
359 recob::Track const& my_track( track_vector.at(i_track) );
380 std::vector<simb::MCParticle>
const& particle_vector,
381 float const& ns_per_PMT_tick,
386 int lastFlashID = -1;
388 for(
size_t i_particle=0; i_particle < particle_vector.size(); i_particle++){
391 bool pass_check =
false;
393 if(!pass_check)
continue;
397 for(
size_t i_flash=0; i_flash < flash_vector.size(); i_flash++){
400 if(my_flash.TotalPE() <
fPEMin)
continue;
402 const float flash_time = my_flash.
Time()*ns_per_PMT_tick;
407 fTimeDiff->Fill(particle_time-flash_time);
445 else if( nonbeam_match ){
461 std::vector<simb::MCParticle>
const& particle_vector,
462 float const& ns_per_PMT_tick,
465 for(
size_t i_flash=0; i_flash < flash_vector.size(); i_flash++){
468 const float flash_time = my_flash.
Time()*ns_per_PMT_tick;
473 bool pass_check =
false;
476 if(my_particle.Mother()==0 && my_particle.TrackId()>1e4){
505 float const& ns_per_PMT_tick,
510 std::vector<simb::MCParticle>
const& particle_vector,
514 for(
size_t i_track=0; i_track < track_vector.size(); i_track++){
516 recob::Track const& my_track( track_vector.at(i_track) );
518 for(
size_t i_particle=0; i_particle < particle_vector.size(); i_particle++){
def analyze(root, level, gtrees, gbranches, doprint)
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 &)
void compare_track_and_flash(recob::Track const &, recob::OpFlash const &, bool &)
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
enum simb::_ev_origin Origin_t
event origin types
void analyze(const art::Event &)
std::vector< flash_match > fFlash_match_vector
std::vector< size_t > track_indices
art framework interface to geometry description
geo::TPCGeo const & PositionToTPC(geo::Point_t const &point) const
Returns the TPC at specified location.
simb::Origin_t get_MC_particle_origin(simb::MCParticle const &)
std::vector< size_t > flash_indices
void FillMatchTree_PF(std::vector< recob::OpFlash > const &, std::vector< simb::MCParticle > const &, float const &, geo::Geometry const &)
std::string fTrackModuleLabel
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
void compare_particle_and_flash(simb::MCParticle const &, recob::OpFlash const &, bool &, float const &, geo::Geometry const &)
#define DEFINE_ART_MODULE(klass)
const art::Ptr< simb::MCTruth > & TrackIdToMCTruth_P(int id) const
TTree * fMatchTree_PF_NotNu
T get(std::string const &key) const
QTextStream & flush(QTextStream &s)
double T(const int i=0) const
std::vector< size_t > flash_indices
The geometry of one entire detector, as served by art.
void match_flashes_to_tracks(std::vector< recob::OpFlash > const &, std::vector< recob::Track > const &)
#define MF_LOG_INFO(category)
const sim::ParticleList & ParticleList() const
double Vx(const int i=0) const
std::vector< particle_match > fParticle_match_vector
void get_MC_particle_list(sim::ParticleList const &, std::vector< simb::MCParticle > &)
void compare_particle_and_track(simb::MCParticle const &, recob::Track const &, bool &, geo::Geometry const &)
Provides recob::Track data product.
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
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
cet::coded_exception< error, detail::translate > exception