55 fTimeDiff = tfs->
make<TH1F>(
"htdiff",
"Time difference between particles and flashes; t_diff (ns); flash/particle pairs",1e3,-5e6,5e6);
56 fTimeDiff_fine = tfs->
make<TH1F>(
"htdiff_fine",
"Time difference between particles and flashes; t_diff (ns); flash/particle pairs",100,-1000,1000);
57 fNBeamFlashes = tfs->
make<TH1I>(
"hNBeamFlashes",
"Number of flashes OnBeamTime per event; N_{Flashes}; Events",5,0,5);
60 fMatchTree_PF->Branch(
"Run",&
fRun,
"Run/I");
61 fMatchTree_PF->Branch(
"Event",&
fEvent,
"Event/I");
62 fMatchTree_PF->Branch(
"p_id",&
fParticleID,
"p_id/I");
64 fMatchTree_PF->Branch(
"p_vx",&
fParticleVx,
"p_vx/F");
65 fMatchTree_PF->Branch(
"p_vy",&
fParticleVy,
"p_vy/F");
66 fMatchTree_PF->Branch(
"p_vz",&
fParticleVz,
"p_vz/F");
69 fMatchTree_PF->Branch(
"FlashID",&
fFlashID,
"flash_id/I");
70 fMatchTree_PF->Branch(
"f_time",&
fFlashTime,
"f_time/F");
72 fMatchTree_PF->Branch(
"f_y",&
fFlashY,
"f_y/F");
73 fMatchTree_PF->Branch(
"f_z",&
fFlashZ,
"f_z/F");
74 fMatchTree_PF->Branch(
"f_ywidth",&
fFlashYWidth,
"f_ywidth/F");
75 fMatchTree_PF->Branch(
"f_zwidth",&
fFlashYWidth,
"f_zwidth/F");
77 fMatchTree_PF->Branch(
"f_pe",&
fFlashPE,
"f_pe/F");
78 fMatchTree_PF->Branch(
"matchIndex",&
fMatchIndex,
"matchIndex/I");
118 std::vector<recob::OpFlash>
const& flash_vector(*flash_handle);
122 <<
"Number of flashes is " << flash_vector.size() << std::flush;
138 std::vector<simb::MCParticle> particle_list;
143 <<
"Number of MC particles is " << particle_list.size();
147 const float ns_per_PMT_tick = 1e3;
161 for(
auto const& my_flash : flash_vector){
162 if(my_flash.OnBeamTime()==1) n_flashes++;
193 const int pdg = std::abs(particle->
PdgCode());
207 particle_vector.emplace_back(*particle);
220 unsigned int tpc = 0;
221 unsigned int cstat = 0;
225 while(t_iter < numtraj){
228 double pos[3] = {particle.
Vx(t_iter), particle.
Vy(t_iter), particle.
Vz(t_iter)};
238 if(t_iter == numtraj)
242 return particle.
T(t_iter);
246 std::vector<recob::Track>
const& track_vector){
249 for(
size_t i_flash=0; i_flash < flash_vector.size(); i_flash++){
252 if(my_flash.TotalPE() <
fPEMin)
continue;
254 for(
size_t i_track=0; i_track < track_vector.size(); i_track++){
256 recob::Track const& my_track( track_vector.at(i_track) );
277 std::vector<simb::MCParticle>
const& particle_vector,
278 float const& ns_per_PMT_tick,
283 int lastFlashID = -1;
285 for(
size_t i_particle=0; i_particle < particle_vector.size(); i_particle++){
288 bool pass_check =
false;
290 if(!pass_check)
continue;
294 for(
size_t i_flash=0; i_flash < flash_vector.size(); i_flash++){
297 if(my_flash.TotalPE() <
fPEMin)
continue;
299 const float flash_time = my_flash.
Time()*ns_per_PMT_tick;
304 fTimeDiff->Fill(particle_time-flash_time);
342 else if( nonbeam_match ){
358 std::vector<simb::MCParticle>
const& particle_vector,
359 float const& ns_per_PMT_tick,
362 for(
size_t i_flash=0; i_flash < flash_vector.size(); i_flash++){
365 const float flash_time = my_flash.
Time()*ns_per_PMT_tick;
370 bool pass_check =
false;
373 if(my_particle.Mother()==0 && my_particle.TrackId()>1e4){
402 float const& ns_per_PMT_tick,
407 std::vector<simb::MCParticle>
const& particle_vector,
411 for(
size_t i_track=0; i_track < track_vector.size(); i_track++){
413 recob::Track const& my_track( track_vector.at(i_track) );
415 for(
size_t i_particle=0; i_particle < particle_vector.size(); i_particle++){
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 &)
#define LOG_INFO(category)
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
list_type::const_iterator const_iterator
enum simb::_ev_origin Origin_t
event origin types
void analyze(const art::Event &)
std::vector< flash_match > fFlash_match_vector
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 &)
void FillMatchTree_PF(std::vector< recob::OpFlash > const &, std::vector< simb::MCParticle > const &, float const &, geo::Geometry const &)
std::string fTrackModuleLabel
void compare_particle_and_flash(simb::MCParticle const &, recob::OpFlash const &, bool &, float const &, geo::Geometry const &)
#define DEFINE_ART_MODULE(klass)
TTree * fMatchTree_PF_NotNu
T get(std::string const &key) const
double T(const int i=0) const
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 &)
double Vx(const int i=0) const
T * make(ARGS...args) const
std::vector< particle_match > fParticle_match_vector
void get_MC_particle_list(sim::ParticleList const &, std::vector< simb::MCParticle > &)
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
void compare_particle_and_track(simb::MCParticle const &, recob::Track const &, bool &, geo::Geometry const &)
double Vz(const int i=0) const
EventNumber_t event() const
float update_MC_particle_time(simb::MCParticle const &, bool &, geo::Geometry const &)
const sim::ParticleList & ParticleList()
virtual ~OpticalRecoAna()
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
const art::Ptr< simb::MCTruth > & TrackIdToMCTruth_P(int const &id)