298 std::cout <<
" **************************************** analyze ************ " <<
std::endl;
304 const sim::ParticleList& plist = pi_serv->
ParticleList();
314 taulife = detProp.ElectronLifetime();
318 std::vector<art::Ptr<recob::Hit> > hitlist;
324 std::vector<art::Ptr<recob::Track> > tracklist;
330 std::vector<art::Ptr<recob::Vertex> > vtxlist;
336 std::vector<art::Ptr<recob::Shower>> shwlist;
342 std::vector<art::Ptr<recob::OpFlash> > flashlist;
354 nhits = hitlist.size();
358 hit_plane[i] = hitlist[i]->WireID().Plane;
359 hit_wire[i] = hitlist[i]->WireID().Wire;
360 hit_tpc[i] = hitlist[i]->WireID().TPC;
364 hit_startT[i] = hitlist[i]->PeakTimeMinusRMS();
365 hit_endT[i] = hitlist[i]->PeakTimePlusRMS();
377 std::tie(trackStart, trackEnd) = tracklist[i]->Extent();
378 larStart = tracklist[i]->VertexDirection();
379 larEnd = tracklist[i]->EndDirection();
381 trkid[i] = tracklist[i]->ID();
394 trklen[i] = tracklist[i]->Length();
396 if (fmthm.isValid()){
397 auto vhit = fmthm.at(i);
398 auto vmeta = fmthm.data(i);
399 for (
size_t h = 0;
h < vhit.size(); ++
h){
410 else if (fmth.isValid()){
411 std::vector< art::Ptr<recob::Hit> > vhit = fmth.at(i);
412 for (
size_t h = 0; h < vhit.size(); ++
h){
418 if (fmcal.isValid()){
419 unsigned maxnumhits = 0;
420 std::vector<const anab::Calorimetry*> calos = fmcal.at(i);
421 for (
auto const&
calo : calos){
422 if (
calo->PlaneID().isValid){
424 if (
calo->dEdx().size()>maxnumhits){
425 maxnumhits =
calo->dEdx().size();
430 for (
size_t ip = 0; ip<
calo->dEdx().size(); ++ip){
431 if (
calo->ResidualRange()[ip]<30){
432 pida +=
calo->dEdx()[ip]*
pow(
calo->ResidualRange()[ip],0.42);
436 if (used_trkres) pida/=used_trkres;
441 if (!
isdata&&fmth.isValid()){
444 std::vector< art::Ptr<recob::Hit> > allHits = fmth.at(i);
446 std::map<int,double> trkide;
447 for(
size_t h = 0; h < allHits.size(); ++
h){
450 for(
size_t e = 0;
e < TrackIDs.size(); ++
e){
451 trkide[TrackIDs[
e].trackID] += TrackIDs[
e].energy;
459 if ((ii->second)>maxe){
472 float sum_energy = 0;
478 double mindis = 1e10;
480 for(
size_t h = 0; h < allHits.size(); ++
h){
483 std::vector<art::Ptr<recob::SpacePoint> > spts = fmhs.at(hit.
key());
490 x = spts[0]->XYZ()[0];
491 y = spts[0]->XYZ()[1];
492 z = spts[0]->XYZ()[2];
497 for(
size_t h = 0; h < allHits.size(); ++
h){
500 std::vector<art::Ptr<recob::SpacePoint> > spts = fmhs.at(hit.
key());
502 if (sqrt(
pow(spts[0]->XYZ()[0]-x,2)+
503 pow(spts[0]->XYZ()[1]-y,2)+
504 pow(spts[0]->XYZ()[2]-z,2))<3){
505 std::vector<sim::TrackIDE> TrackIDs = bt_serv->
HitToTrackIDEs(clockData, hit);
507 for(
size_t e = 0;
e < TrackIDs.size(); ++
e){
509 toten+=TrackIDs[
e].energy;
543 if ( pitch && numhits ) {
554 nvtx = vtxlist.size();
556 Double_t xyz[3] = {};
557 vtxlist[i]->XYZ(xyz);
558 for (
size_t j = 0; j<3; ++j)
vtx[i][j] = xyz[j];
562 if (shwListHandle.isValid()){
565 nshws = shwlist.size();
568 shwid[i] = shwlist[i]->ID();
569 shwdcosx[i] = shwlist[i]->Direction().X();
570 shwdcosy[i] = shwlist[i]->Direction().Y();
571 shwdcosz[i] = shwlist[i]->Direction().Z();
572 shwstartx[i] = shwlist[i]->ShowerStart().X();
573 shwstarty[i] = shwlist[i]->ShowerStart().Y();
574 shwstartz[i] = shwlist[i]->ShowerStart().Z();
575 for (
size_t j = 0; j<(shwlist[i]->Energy()).
size(); ++j){
576 shwenergy[i][j] = shwlist[i]->Energy()[j];
578 for (
size_t j = 0; j<(shwlist[i]->dEdx()).
size(); ++j){
579 shwdedx[i][j] = shwlist[i]->dEdx()[j];
583 auto vhit = fmsh.at(i);
584 for (
size_t h = 0; h < vhit.size(); ++
h){
590 if (!
isdata&&fmsh.isValid()){
593 std::vector< art::Ptr<recob::Hit> > allHits = fmsh.at(i);
594 std::map<int,double> trkide;
595 for(
size_t h = 0; h < allHits.size(); ++
h){
597 std::vector<sim::TrackIDE> TrackIDs = bt_serv->
HitToTrackIDEs(clockData, hit);
598 for(
size_t e = 0;
e < TrackIDs.size(); ++
e){
599 trkide[TrackIDs[
e].trackID] += TrackIDs[
e].energy;
607 if ((ii->second)>maxe){
638 std::vector<art::Ptr<simb::MCTruth> > mclist;
640 if (mctruthListHandle)
643 std::vector<art::Ptr<simb::MCFlux> > fluxlist;
645 if (mcfluxListHandle)
684 float mindist2 = 9999;
691 for(
size_t i = 0; i < vtxlist.size(); ++i){
692 Double_t xyz[3] = {};
693 vtxlist[i]->XYZ(xyz);
694 TVector3 vtxreco(xyz);
696 if (dist2 < mindist2)
707 for (
size_t i = 0; i < tracklist.size(); ++i){
709 if (dist2 < mindist2)
719 if (dist2 < mindist2)
733 if (fluxlist.size()){
745 std::vector<const simb::MCParticle* > geant_part;
748 for(
size_t p = 0;
p < plist.size(); ++
p)
751 geant_part.push_back(plist.Particle(
p));
760 int geant_particle=0;
765 for(
unsigned int i = 0; i < geant_part.size(); ++i ){
768 if(geant_part[i]->Process()==pri)
779 for(
unsigned int i = 0; i < geant_part.size(); ++i ){
782 if(geant_part[i]->Process()==pri)
789 Mother[i]=geant_part[i]->Mother();
791 TrackId[i]=geant_part[i]->TrackId();
793 pdg[i]=geant_part[i]->PdgCode();
795 Eng[i]=geant_part[i]->E();
798 Px[i]=geant_part[i]->Px();
799 Py[i]=geant_part[i]->Py();
800 Pz[i]=geant_part[i]->Pz();
806 EndPointx[i]=geant_part[i]->EndPosition()[0];
807 EndPointy[i]=geant_part[i]->EndPosition()[1];
808 EndPointz[i]=geant_part[i]->EndPosition()[2];
812 G4Process.push_back( geant_part[i]->Process() );
820 Startdcosx[i] = geant_part[i]->Momentum(0).Px() / geant_part[i]->Momentum(0).P();
821 Startdcosy[i] = geant_part[i]->Momentum(0).Py() / geant_part[i]->Momentum(0).P();
822 Startdcosz[i] = geant_part[i]->Momentum(0).Pz() / geant_part[i]->Momentum(0).P();
double E(const int i=0) const
bool insideFidVol(const double posX, const double posY, const double posZ)
std::string fCalorimetryModuleLabel
Float_t hit_startT[kMaxHits]
int TrackId[kMaxPrimaries]
constexpr std::uint32_t timeLow() const
const simb::MCNeutrino & GetNeutrino() const
double Py(const int i=0) const
Float_t flash_YWidth[kMaxFlash]
float trkenddcosy[kMaxTrack]
float trkstartdcosz[kMaxTrack]
std::vector< sim::TrackIDE > HitToTrackIDEs(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
Short_t hit_wire[kMaxHits]
int Mother[kMaxPrimaries]
double Dist2(const TVector2 &v1, const TVector2 &v2)
Float_t hit_dQds[kMaxHits]
float trkg4startx[kMaxTrack]
Float_t shwdedx[kMaxShower][3]
Float_t flash_ZWidth[kMaxFlash]
Float_t shwstartx[kMaxShower]
std::vector< TrackID > TrackIDs
const simb::MCParticle * TrackIdToParticle_P(int id) const
float trkg4startz[kMaxTrack]
geo::WireID WireID() const
Float_t shwdcosz[kMaxShower]
Float_t EndPointy[kMaxPrimaries]
Float_t hit_summedADC[kMaxHits]
Float_t flash_TotalPE[kMaxFlash]
const simb::MCParticle & Nu() const
constexpr std::uint32_t timeHigh() const
Float_t shwstarty[kMaxShower]
simb::Origin_t Origin() const
double Px(const int i=0) const
Short_t hit_plane[kMaxHits]
Float_t hit_dEds[kMaxHits]
Float_t Pz[kMaxPrimaries]
Float_t shwdcosx[kMaxShower]
float trkmomrange[kMaxTrack]
int shwbestplane[kMaxShower]
Int_t hit_trkkey[kMaxHits]
Planes which measure Z direction.
Float_t flash_abstime[kMaxFlash]
int process_primary[kMaxPrimaries]
float trkstartx[kMaxTrack]
float trkstartz[kMaxTrack]
Float_t hit_endT[kMaxHits]
std::string fVertexModuleLabel
int NumberDaughters[kMaxPrimaries]
Float_t hit_charge[kMaxHits]
tracking::Vector_t Vector_t
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
float trkpida[kMaxTrack][3]
float trkg4starty[kMaxTrack]
Float_t shwdcosy[kMaxShower]
const simb::MCParticle & Lepton() const
std::string fHitsModuleLabel
Float_t Eng[kMaxPrimaries]
Float_t flash_time[kMaxFlash]
double P(const int i=0) const
key_type key() const noexcept
double T(const int i=0) const
PlaneID_t Plane
Index of the plane within its TPC.
Float_t hit_peakT[kMaxHits]
std::string fGenieGenModuleLabel
float trkke[kMaxTrack][3]
Float_t shwenergy[kMaxShower][3]
Float_t StartPointx[kMaxPrimaries]
Detector simulation of raw signals on wires.
const sim::ParticleList & ParticleList() const
const simb::MCParticle & GetParticle(int i) const
Float_t flash_ZCenter[kMaxFlash]
std::vector< std::string > G4FinalProcess
float trkenddcosz[kMaxTrack]
std::string fTrackModuleLabel
Float_t hit_resrange[kMaxHits]
double Vx(const int i=0) const
Float_t vtx[kMaxVertices][3]
std::string fShowerModuleLabel
std::string fFlashModuleLabel
calo::CalorimetryAlg fCalorimetryAlg
float trkstartdcosx[kMaxTrack]
Float_t Startdcosx[kMaxPrimaries]
Float_t Py[kMaxPrimaries]
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
constexpr int kMaxVertices
Float_t Startdcosy[kMaxPrimaries]
int trkbestplane[kMaxTrack]
Float_t shwstartz[kMaxShower]
Float_t flash_width[kMaxFlash]
float trkg4initdedx[kMaxTrack]
tracking::Point_t Point_t
double TrackPitchInView(recob::Track const &track, geo::View_t view, size_t trajectory_point=0U)
Returns the projected length of track on a wire pitch step [cm].
double Pz(const int i=0) const
double dEdx_AREA(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, recob::Hit const &hit, double pitch, double T0=0) const
double Vz(const int i=0) const
Int_t hit_shwkey[kMaxHits]
Float_t EndPointx[kMaxPrimaries]
Float_t StartPointz[kMaxPrimaries]
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
Float_t Px[kMaxPrimaries]
Float_t Startdcosz[kMaxPrimaries]
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Float_t flash_YCenter[kMaxFlash]
double LifetimeCorrection(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, double time, double T0=0) const
Float_t StartPointy[kMaxPrimaries]
float trkstarty[kMaxTrack]
float trkenddcosx[kMaxTrack]
Float_t EndPointz[kMaxPrimaries]
Int_t hit_channel[kMaxHits]
double Vy(const int i=0) const
double GetTrackMomentum(double trkrange, int pdg) const
float trkstartdcosy[kMaxTrack]
Short_t hit_tpc[kMaxHits]
QTextStream & endl(QTextStream &s)
std::vector< std::string > G4Process