22 #include "art_root_io/TFileService.h" 25 #include "canvas/Persistency/Common/FindManyP.h" 48 #include "dune/DuneObj/ProtoDUNEBeamEvent.h" 60 #include "dune/Protodune/singlephase/DataUtils/ProtoDUNEDataUtils.h" 69 #include "geant4reweight/src/ReweightBase/G4ReweighterFactory.hh" 70 #include "geant4reweight/src/ReweightBase/G4Reweighter.hh" 71 #include "geant4reweight/src/ReweightBase/G4ReweightTraj.hh" 72 #include "geant4reweight/src/PropBase/G4ReweightParameterMaker.hh" 73 #include "geant4reweight/src/ReweightBase/G4MultiReweighter.hh" 82 #include "TTimeStamp.h" 124 virtual void endJob()
override;
486 fPandoraBeam = tfs->make<TTree>(
"PandoraBeam",
"Beam events reconstructed with Pandora");
761 std::vector<const anab::T0*> T0s;
770 std::cout <<
"No T0s found" <<
std::endl;
792 for(
int k=0;
k < 6;
k++)
796 for(
int k=0;
k < 6;
k++)
800 bool beamTriggerEvent =
false;
862 if(geantGoodParticle != 0x0){
863 std::cout <<
"Found GEANT particle corresponding to the good particle with pdg = " << geantGoodParticle->PdgCode()
864 <<
" , track id = " << geantGoodParticle->TrackId()
865 <<
" , Vx/Vy/Vz = " << geantGoodParticle->Vx() <<
"/"<< geantGoodParticle->Vy() <<
"/" << geantGoodParticle->Vz()
871 beamTriggerEvent =
true;
887 for(
size_t i_s=0; i_s < geantGoodParticle->NumberTrajectoryPoints(); i_s++){
888 beamtrk_x.push_back(geantGoodParticle->Position(i_s).X());
889 beamtrk_y.push_back(geantGoodParticle->Position(i_s).Y());
890 beamtrk_z.push_back(geantGoodParticle->Position(i_s).Z());
892 beamtrk_Px.push_back(geantGoodParticle->Momentum(i_s).X());
893 beamtrk_Py.push_back(geantGoodParticle->Momentum(i_s).Y());
894 beamtrk_Pz.push_back(geantGoodParticle->Momentum(i_s).Z());
896 beamtrk_Eng.push_back(geantGoodParticle->Momentum(i_s).E()-geantGoodParticle->Mass());
900 int key_reach_tpc=-99;
902 for (
size_t kk=0; kk<
beamtrk_z.size(); ++kk) {
905 key_reach_tpc=(
int)kk;
909 for (
size_t kk=0; kk<
beamtrk_z.size(); ++kk) {
926 if (key_reach_tpc>=1) {
929 double z1_ff=
beamtrk_z.at(key_reach_tpc-1);
930 double z2_ff=
beamtrk_z.at(key_reach_tpc);
931 double m_ff=(eng1_ff-eng2_ff)/(z1_ff-z2_ff);
932 ke_ff=1000.*(eng1_ff-m_ff*z1_ff);
959 beamid = geantGoodParticle->TrackId();
1083 std::vector<art::Ptr<recob::Track> > tracklist;
1084 std::vector<art::Ptr<recob::PFParticle> > pfplist;
1086 auto trackListHandle = evt.
getHandle< std::vector<recob::Track> >(
"pandoraTrack");
1090 auto PFPListHandle = evt.
getHandle< std::vector<recob::PFParticle> >(
"pandora");
1094 std::vector<art::Ptr<recob::Cluster>> clusterlist;
1095 auto clusterListHandle = evt.
getHandle< std::vector<recob::Cluster> >(
"pandora");
1098 art::FindManyP<recob::Cluster> fmcp(PFPListHandle,evt,
"pandora");
1099 art::FindManyP<recob::Track> pftrack(PFPListHandle,evt,
"pandoraTrack");
1101 std::cout<<
"number of pfp_particles "<<pfplist.size()<<
std::endl;
1102 std::cout<<
" size of pfParticles "<<pfParticles.size()<<
std::endl;
1103 art::FindManyP<recob::Hit, recob::TrackHitMeta> fmthm(trackListHandle, evt,
"pandoraTrack");
1136 if(!pfT0vec.empty())
1162 if(thisTrack != 0x0) {
1166 if(mcparticle0!=0x0) {
1170 truthid=mcparticle0->
TrackId();
1226 if (hi->WireID().Plane==2) {
1230 if (hi->WireID().Plane==1) {
1234 if (hi->WireID().Plane==0) {
1268 if(calovector.size() != 3)
1269 std::cerr <<
"WARNING::Calorimetry vector size for primary is = " << calovector.size() <<
std::endl;
1286 for (
auto &
calo : calovector) {
1287 if (
calo.PlaneID().Plane == 2){
1290 for (
size_t ihit = 0; ihit <
calo.dQdx().size(); ++ihit){
1296 const auto &primtrk_pos=(
calo.XYZ())[ihit];
1301 double pos_reco[3]={primtrk_pos.X(),primtrk_pos.Y(),primtrk_pos.Z()};
1331 const recob::Hit & theHit = (*allHits)[
calo.TpIndices()[ihit] ];
1371 if (geantGoodParticle1== 0x0) std::cout<<
"@@@@ Empty G4 particle!!"<<
std::endl;
1373 if(geantGoodParticle1!= 0x0 && geantGoodParticle1->
Process()==
"primary") {
1376 double ke_reco=
ke_ff;
1377 double ke_true=
ke_ff;
1385 if (thisTrajectoryProcessMap1.size()){
1386 for(
auto const& couple: thisTrajectoryProcessMap1){
1409 if (thisTrajectoryProcessMap1.size()) {
1410 for(
auto const& couple1: thisTrajectoryProcessMap1) {
1411 interactionX.push_back(((truetraj.
at(couple1.first)).first).X());
1412 interactionY.push_back(((truetraj.
at(couple1.first)).first).Y());
1413 interactionZ.push_back(((truetraj.
at(couple1.first)).first).Z());
1414 interactionE.push_back(((truetraj.
at(couple1.first)).first).E());
1420 double xval=((truetraj.
at(couple1.first)).first).X();
1421 double yval=((truetraj.
at(couple1.first)).first).Y();
1422 double zval=((truetraj.
at(couple1.first)).first).Z();
1423 unsigned int tpcno=1;
1424 if(xval<=0 && zval<232) tpcno=1;
1425 if(xval<=0 && zval>232 && zval<464) tpcno=5;
1426 if(xval<=0 && zval>=464) tpcno=9;
1427 if(xval>0 && zval<232) tpcno=2;
1428 if(xval>0 && zval>232 && zval<464) tpcno=6;
1429 if(xval>0 && zval>=464) tpcno=10;
1459 auto interactionPos4D = (truetraj.
at(couple1.first)).first ;
1467 double interactionAngle = 999999.;
1470 auto prevInteractionPos4D = (truetraj.
at(couple1.first-1)).first ;
1471 auto prevInteractionPos3D = prevInteractionPos4D.Vect() ;
1472 auto interactionPos3D = interactionPos4D.Vect() ;
1473 auto distanceBtwPoint = interactionPos3D - prevInteractionPos3D;
1476 if (truetraj.
size() > couple1.first + 1) {
1478 auto nextInteractionPos4D = (truetraj.
at(couple1.first+1)).first ;
1479 auto nextInteractionPos3D = nextInteractionPos4D.Vect() ;
1480 auto distanceBtwPointNext = nextInteractionPos3D - interactionPos3D;
1481 interactionAngles.push_back(TMath::ACos(distanceBtwPointNext.Dot(distanceBtwPoint)/(distanceBtwPointNext.Mag()*distanceBtwPoint.Mag() ) ));
1488 double maxAngle = 0.;
1489 int numberOfTroubleDaugther = 0;
1491 const sim::ParticleList& plist=pi_serv->
ParticleList();
1493 for(
size_t dPart1=0;(dPart1<plist.size()) && (plist.begin()!=plist.end());++dPart1) {
1495 if (dPart->
Mother() != 1 )
continue;
1501 interactionAngle=999999;
1505 numberOfTroubleDaugther++;
1507 auto daughtFirstPt = ((daugthTraj[0]).first).Vect() ;
1508 auto daughtSecondPt = ((daugthTraj[1]).first).Vect() ;
1509 auto distanceBtwPointNext = daughtSecondPt - daughtFirstPt;
1510 interactionAngle = TMath::ACos(distanceBtwPointNext.Dot(distanceBtwPoint)/(distanceBtwPointNext.Mag()*distanceBtwPoint.Mag()));
1511 if ( maxAngle < interactionAngle ) maxAngle = interactionAngle;
1512 interactionAngle = maxAngle;
1514 if (!numberOfTroubleDaugther) interactionAngle = 9999999.;
1515 if (interactionAngle < 0.0001) std::cout<<
"-------------------------------------------------> \n";
1523 std::cout<<
"-->add inel at the end!"<<
std::endl;
1542 std::map<double, sim::IDE> orderedSimIDE;
1543 for (
auto& ide : simIDE_prim) orderedSimIDE[ide->z]= *ide;
1544 auto inTPCPoint = truetraj.
begin();
1545 auto Momentum0 = inTPCPoint->second;
1552 bool run_me_onetime=
true;
1553 double xi=0.0;
double yi=0.0;
double zi=0.0;
1568 for(
size_t idx1=0; idx1<
primtrk_dqdx.size()-1; idx1++) {
1570 double currentDepEng = 0.;
1571 for (
auto iter= orderedSimIDE.begin(); iter!= orderedSimIDE.end(); iter++) {
1572 auto currentIde = iter->second;
1581 if(cnt==0&¤tIde.trackID>=0) {
1597 if (currentIde.trackID>=0) {
1598 if(cnt>0 && run_me_onetime) {
1615 xi=currentIde.x; yi=currentIde.y; zi=currentIde.z;
1623 currentDepEng += currentIde.energy;
1625 ke_true -= currentDepEng;
1626 run_me_onetime=
false;
1628 if(currentDepEng>0.001) {
1640 for (
auto iter2=orderedSimIDE.begin(); iter2!=orderedSimIDE.end(); iter2++) {
1641 auto currentIde2 = iter2->second;
1657 double pos_true[3] = {currentIde2.x, currentIde2.y, currentIde2.z};
1790 for(
size_t k = 0;
k < calovector.size() &&
k<3;
k++){
1804 if(fmthm.isValid()){
1807 for (
size_t ii = 0; ii<vhit.size(); ++ii){
1808 bool fBadhit =
false;
1814 if (vmeta[ii]->
Index()>=tracklist[
fprimaryID]->NumberTrajectoryPoints()){
1815 throw cet::exception(
"Calorimetry_module.cc") <<
"Requested track trajectory index "<<vmeta[ii]->Index()<<
" exceeds the total number of trajectory points "<<tracklist[
fprimaryID]->NumberTrajectoryPoints()<<
" for track index "<<
fprimaryID<<
". Something is wrong with the track reconstruction. Please contact tjyang@fnal.gov!!";
1832 unsigned int tpc_no=1;
1833 if(xpos<=0 && zpos<232) tpc_no=1;
1834 if(xpos<=0 && zpos>232 && zpos<464) tpc_no=5;
1835 if(xpos<=0 && zpos>=464) tpc_no=9;
1836 if(xpos>0 && zpos<232) tpc_no=2;
1837 if(xpos>0 && zpos>232 && zpos<464) tpc_no=6;
1838 if(xpos>0 && zpos>=464) tpc_no=10;
1841 if (fBadhit)
continue;
1842 if (zpos<-100)
continue;
1843 planenum=vhit[ii]->WireID().Plane;
1856 x_c.push_back(xpos);
1857 y_c.push_back(ypos);
1858 z_c.push_back(zpos);
1863 tt_c.push_back(detProp.ConvertXToTicks(xpos, planenum, tpc_no, 0));
1866 ch_c.push_back(vhit[ii]->Channel());
1868 pt_c.push_back(vhit[ii]->PeakTime());
1869 q_c.push_back(vhit[ii]->Integral());
1870 a_c.push_back(vhit[ii]->PeakAmplitude());
1876 unsigned int wireno=vhit[ii]->WireID().Wire;
1878 wirez_c.push_back(xyzStart[2]);
1905 tt_v.push_back(detProp.ConvertXToTicks(xpos, planenum, tpc_no, 0));
1908 ch_v.push_back(vhit[ii]->Channel());
1910 pt_v.push_back(vhit[ii]->PeakTime());
1911 q_v.push_back(vhit[ii]->Integral());
1912 a_v.push_back(vhit[ii]->PeakAmplitude());
1918 unsigned int wireno=vhit[ii]->WireID().Wire;
1920 wirez_v.push_back(xyzStart[2]);
1928 tt_u.push_back(detProp.ConvertXToTicks(xpos, planenum, tpc_no, 0));
1931 ch_u.push_back(vhit[ii]->Channel());
1933 pt_u.push_back(vhit[ii]->PeakTime());
1934 q_u.push_back(vhit[ii]->Integral());
1935 a_u.push_back(vhit[ii]->PeakAmplitude());
1941 unsigned int wireno=vhit[ii]->WireID().Wire;
1943 wirez_u.push_back(xyzStart[2]);
1959 std::vector<float> Stw, Endw, Stt, Endt, Stwires, Endwires, Stticks, Endticks, TPCb, TPCcl;
1960 Stw.clear(); Endw.clear(); Stt.clear(); Endt.clear(); Stwires.clear(); Endwires.clear(); Stticks.clear(); Endticks.clear(); TPCb.clear(); TPCcl.clear();
1962 float numw, numt,wire_no,ticks_no;
1963 for(
size_t p1=0;p1<pfplist.size();p1++){
1964 std::vector<art::Ptr<recob::Track>>
trk=pftrack.at(p1);
1965 std::vector<art::Ptr<recob::Cluster>> allClusters=fmcp.at(p1);
1967 for(
size_t c1=0;
c1<allClusters.size();
c1++){
1970 Stw.push_back(allClusters[
c1]->StartWire());
1971 Endw.push_back(allClusters[
c1]->EndWire());
1972 Stt.push_back(allClusters[
c1]->StartTick());
1973 Endt.push_back(allClusters[
c1]->EndTick());
1974 TPCb.push_back(allClusters[
c1]->
Plane().
TPC);
1978 Stwires.push_back(allClusters[
c1]->StartWire());
1979 Endwires.push_back(allClusters[
c1]->EndWire());
1980 Stticks.push_back(allClusters[
c1]->StartTick());
1981 Endticks.push_back(allClusters[
c1]->EndTick());
1982 TPCcl.push_back(allClusters[
c1]->
Plane().
TPC);
1987 for(
size_t clt=0;clt<Stw.size();clt++){
1988 for(
size_t cl1=0;cl1<Stwires.size();cl1++){
1989 if(TPCcl[cl1]!=TPCb[clt])
continue;
1991 den=(Stw[clt]-Endw[clt])*(Stticks[cl1]-Endticks[cl1])-(Stt[clt]-Endt[clt])*(Stwires[cl1]-Endwires[cl1]);
1992 if(den==0)
continue;
1993 numw=(Stw[clt]*Endt[clt]-Stt[clt]*Endw[clt])*(Stwires[cl1]-Endwires[cl1])-(Stw[clt]-Endw[clt])*(Stwires[cl1]*Endticks[cl1]-Stticks[cl1]*Endwires[cl1]);
1994 numt=(Stw[clt]*Endt[clt]-Stt[clt]*Endw[clt])*(Stticks[cl1]-Endticks[cl1])-(Stt[clt]-Endt[clt])*(Stwires[cl1]*Endticks[cl1]-Stticks[cl1]*Endwires[cl1]);
1998 if(((Stw[clt]<wire_no && Endw[clt]>wire_no)||(Stw[clt]>wire_no && Endw[clt]<wire_no))&&((Stt[clt]<ticks_no && Endt[clt]>ticks_no)||(Stt[clt]>ticks_no && Endt[clt]<ticks_no)) && ((Stwires[cl1]<wire_no && Endwires[cl1]>wire_no)||(Stwires[cl1]>wire_no && Endwires[cl1]<wire_no)) && ((Stticks[cl1]<ticks_no && Endticks[cl1]>ticks_no)||(Stticks[cl1]>ticks_no && Endticks[cl1]<ticks_no))) {
1999 std::cout<<
"intersection wire and ticks are "<<std::round(wire_no)<<
" "<<ticks_no<<
" Stw Endw StT EndT "<<Stwires[cl1]<<
" "<<Endwires[cl1]<<
" "<<Stticks[cl1]<<
" "<<Endticks[cl1]<<
std::endl;
2002 unsigned int wireno=std::round(wire_no);
2005 std::cout<<
"Z position of intersection = "<<xyzStart[2]<<
" "<<xyzEnd[2]<<
" "<<wireno<<
std::endl;
2020 else if(thisShower != 0x0){
2038 if( (thisShower->
dEdx()).
size() > 0 )
2059 std::cout <<
"INFO::Number of daughters is " << particle->NumDaughters() <<
". Only the first NMAXDAUGTHERS are processed." <<
std::endl;
2062 for(
const int daughterID : particle->Daughters()){
2065 std::cout <<
"Daughter " << daughterID <<
" has " << daughterParticle->
NumDaughters() <<
" daughters" <<
std::endl;
2070 if(daughterTrack != 0x0){
2095 if(daughtercalovector.size() != 3)
2096 std::cerr <<
"WARNING::Calorimetry vector size for daughter is = " << daughtercalovector.size() <<
std::endl;
2098 for(
size_t k = 0;
k < daughtercalovector.size() &&
k<3;
k++){
2105 if(mcdaughterparticle != 0x0){
2130 std::cout <<
"Daughter Process = " << (mcdaughterparticle->
Process()).c_str()
2131 <<
" , mother = " << mcdaughterparticle->
Mother()
2135 else if(daughterShower != 0x0){
2151 if( (daughterShower->
dEdx()).
size() > 0 )
2155 std::cout <<
"INFO::Daughter pfParticle is not track or shower. Skip!" <<
std::endl;
2184 if(beamTriggerEvent)
2207 for(
int k=0;
k < 5;
k++)
2210 for(
int k=0;
k < 3;
k++){
2238 for(
int l=0;
l < 3;
l++){
2317 for(
int l=0;
l < 4;
l++){
2335 for(
int l=0;
l < 3;
l++){
2361 for(
int l=0;
l < 4;
l++){
double E(const int i=0) const
bool Isendpoint_outsidetpc
geo::Length_t WireCoordinate(double YPos, double ZPos, geo::PlaneID const &planeid) const
Returns the index of the nearest wire to the specified position.
double fdaughter_truth_Pt[NMAXDAUGTHERS]
std::vector< double > primtrk_true_x
std::vector< double > pt_v
unsigned int NumberTrajectoryPoints() const
const TVector3 & ShowerStart() const
int fdaughterID[NMAXDAUGTHERS]
double EndMomentum() const
double fdaughter_truth_Theta[NMAXDAUGTHERS]
constexpr std::uint32_t timeLow() const
std::vector< double > interaction_tt_u
art::ServiceHandle< geo::Geometry > fGeometryService_rw
std::vector< double > interaction_wid_c
std::vector< double > primtrk_ke_true
double Py(const int i=0) const
std::vector< double > primtrk_pitch
std::vector< anab::T0 > GetPFParticleT0(const recob::PFParticle &particle, art::Event const &evt, std::string particleLabel) const
Get the T0(s) from a given PFParticle.
int NumDaughters() const
Returns the number of daughter particles flowing from this one.
const simb::MCParticle * GetGeantGoodParticle(const simb::MCTruth &genTruth, const art::Event &evt) const
double fprimary_truth_StartPosition_MC[4]
protoana::ProtoDUNEDataUtils dataUtil
double fprimary_truth_Momentum[4]
double fprimaryKineticEnergy[3]
int fprimaryShowerBestPlane
double fdaughterMomentumByRangeMuon[NMAXDAUGTHERS]
const recob::Shower * GetPFParticleShower(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel, const std::string showerLabel) const
Get the shower associated to this particle. Returns a null pointer if not found.
Handle< PROD > getHandle(SelectorBase const &) const
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
const simb::MCTrajectory & Trajectory() const
std::vector< double > wid_u
std::vector< double > tt_c
geo::WireID WireID() const
double fdaughterTheta[NMAXDAUGTHERS]
const recob::TrackTrajectory & Trajectory() const
Access to the stored recob::TrackTrajectory.
protoana::ProtoDUNEPFParticleUtils pfpUtil
std::vector< double > primtrk_edept_true
std::vector< double > primtrk_trkid_true
std::vector< anab::Calorimetry > GetRecoTrackCalorimetry(const recob::Track &track, art::Event const &evt, const std::string trackModule, const std::string caloModule) const
Get the Calorimetry(s) from a given reco track.
double fprimary_truth_EndPosition_MC[4]
std::vector< double > q_v
const value_type & at(const size_type i) const
constexpr std::uint32_t timeHigh() const
double fprimaryEndDirection[3]
double fdaughterStartPosition[NMAXDAUGTHERS][3]
The data type to uniquely identify a Plane.
bool isValid
Whether this ID points to a valid element.
std::string KeyToProcess(unsigned char const &key) const
std::vector< double > pt_c
const std::vector< const recob::Hit * > GetPFParticleHits(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const
Get the hits associated to the PFParticle.
const std::vector< double > & Energy() const
void FillCosmicsTree(art::Event const &evt, std::string pfParticleTag)
double Px(const int i=0) const
double fdaughter_truth_EndPosition[NMAXDAUGTHERS][4]
std::vector< int > wireno_v
const TVector3 GetPFParticleVertex(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel, const std::string trackLabel) const
Function to find the interaction vertex of a primary PFParticle.
protoana::ProtoDUNETruthUtils truthUtil
std::vector< double > primtrk_pt
std::vector< double > pfphit_wireid_c
std::vector< int > primtrk_ch
std::vector< double > pfphit_peaktime_v
Plane(const Point_t &planePos, const Vector_t &planeDir)
Constructor from reference position on the plane and direction orthogonal to the plane.
double fprimaryShowerEnergy
std::vector< const sim::IDE * > TrackIdToSimIDEs_Ps(int const &id) const
double GetNTrajWeightFromSetPars(const std::vector< G4ReweightTraj * > &trajs, G4MultiReweighter &rw)
std::vector< double > wirez_u
double fdaughterEndMomentum[NMAXDAUGTHERS]
WireID_t Wire
Index of the wire within its plane.
int fprimary_truth_NDaughters
std::vector< double > interactionE
double fdaughterShowerMIPEnergy[NMAXDAUGTHERS]
std::vector< int > wireno_u
std::string fprimary_truth_EndProcess
EDAnalyzer(fhicl::ParameterSet const &pset)
double fdaughterLength[NMAXDAUGTHERS]
std::string Process() const
unsigned char ProcessToKey(std::string const &process) const
double fprimaryMomentumByRangeProton
std::vector< double > primtrk_hitx_true
int NumberDaughters() const
double fprimaryShowerdEdx
std::vector< double > interaction_tt_c
std::vector< double > a_c
std::vector< double > q_c
std::vector< double > timeintersection
double fprimaryStartDirection[3]
double fprimaryEndMomentum
std::string fCalorimetryTag
double fprimaryEndPosition[3]
double fdaughterEndPosition[NMAXDAUGTHERS][3]
int fdaughterShowerBestPlane[NMAXDAUGTHERS]
geo::TPCID FindTPCAtPosition(double const worldLoc[3]) const
Returns the ID of the TPC at specified location.
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
double fdaughterOpeningAngle[NMAXDAUGTHERS]
std::vector< double > pfphit_wireid_u
std::vector< double > interactionY
double fdaughterMomentumByRangeProton[NMAXDAUGTHERS]
std::vector< double > primtrk_true_edept
double Pt(const int i=0) const
std::string primtrk_end_g4process
double fprimary_truth_EndMomentum[4]
std::vector< double > interactionX
std::vector< size_t > primtrk_calo_hit_index
double fdaughter_truth_Momentum[NMAXDAUGTHERS][4]
std::vector< double > interaction_wid_u
double Length(size_t p=0) const
Access to various track properties.
double fdaughterKineticEnergy[NMAXDAUGTHERS][3]
const std::vector< double > & dEdx() const
#define DEFINE_ART_MODULE(klass)
int fdaughter_truth_Process[NMAXDAUGTHERS]
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
const std::vector< double > & MIPEnergy() const
Collection of exceptions for Geometry system.
double fprimary_truth_Phi
const art::Ptr< simb::MCTruth > & TrackIdToMCTruth_P(int id) const
double Theta() const
Access to spherical or geographical angles at vertex or at any point.
std::vector< double > wirez_c
std::vector< double > beamtrk_Eng
const simb::MCParticle * GetMCParticleFromPFParticle(detinfo::DetectorClocksData const &clockData, const recob::PFParticle &pfpart, art::Event const &evt, std::string pfparticleModule) const
std::vector< double > Xintersection
double P(const int i=0) const
double fprimary_truth_EndPosition[4]
const recob::Track * GetPFParticleTrack(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel, const std::string trackLabel) const
Get the track associated to this particle. Returns a null pointer if not found.
std::vector< double > primtrk_dedx
std::vector< double > tt_v
double T(const int i=0) const
double fprimaryStartPosition[3]
void analyze(art::Event const &evt) override
std::vector< double > primtrk_true_y
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
double fdaughterStartDirection[NMAXDAUGTHERS][3]
std::vector< double > primtrk_dqdx
std::vector< double > beamtrk_x
int fprimary_truth_TrackId
SubRunNumber_t subRun() const
double fbeamtrackMomentum
double fprimaryMomentumByRangeMuon
const simb::MCParticle * GetMCParticleFromRecoTrack(detinfo::DetectorClocksData const &clockData, const recob::Track &track, art::Event const &evt, std::string trackModule) const
const std::vector< const recob::PFParticle * > GetPFParticlesFromBeamSlice(art::Event const &evt, const std::string particleLabel) const
Return the pointers for the PFParticles in the beam slice. Returns an empty vector is no beam slice w...
std::vector< double > beamtrk_Pz
const TVector3 & Direction() const
int fdaughter_truth_TrackId[NMAXDAUGTHERS]
proton4gen & operator=(proton4gen const &)=delete
bool CreateRWTraj(const simb::MCParticle &part, const sim::ParticleList &plist, art::ServiceHandle< geo::Geometry > geo_serv, int event, G4ReweightTraj *theTraj)
static int max(int a, int b)
int fdaughterNHits[NMAXDAUGTHERS]
The data type to uniquely identify a TPC.
Description of geometry of one entire detector.
ProcessMap const & TrajectoryProcesses() const
std::vector< double > primtrk_hitz
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
double fdaughter_truth_Mass[NMAXDAUGTHERS]
int fprimary_truth_byE_PDG
int fisdaughtershower[NMAXDAUGTHERS]
double fprimary_truth_Mass
std::vector< double > q_u
virtual void endJob() override
std::string fGeneratorTag
double fdaughter_truth_EndMomentum[NMAXDAUGTHERS][4]
double fprimary_truth_StartPosition[4]
std::vector< double > pt_u
std::vector< std::string > interactionProcesslist
const sim::ParticleList & ParticleList() const
std::vector< double > pfphit_wireid_v
Class storing the result of the Maximum Likelihood fit of Multiple Coulomb Scattering angles between ...
geo::GeometryCore const * fGeometry
std::vector< double > pfphit_peaktime_u
double fdaughterRange[NMAXDAUGTHERS][3]
std::vector< double > primtrk_hity_true
double fprimaryOpeningAngle
std::vector< int > wireno_c
Vector_t EndDirection() const
Returns the direction of the trajectory at the last point.
double fdaughterMomentum[NMAXDAUGTHERS]
std::vector< double > interactionZ
double Vx(const int i=0) const
std::vector< double > beamtrk_Px
std::vector< double > primtrk_true_z
double fprimary_truth_Theta
float PeakTime() const
Time of the signal peak, in tick units.
double fprimaryShowerMIPEnergy
Declaration of signal hit object.
std::vector< double > primtrk_ke_reco
double StartMomentum() const
Hierarchical representation of particle flow.
double fdaughter_truth_P[NMAXDAUGTHERS]
int fprimary_truth_byE_ID
std::vector< double > interactionAngles
std::vector< double > pfphit_peaktime_c
std::vector< double > beamtrk_y
proton4gen(fhicl::ParameterSet const &p)
int GetNActiveFembsForAPA(art::Event const &evt, int apa) const
Get number of active fembs in an APA.
std::vector< double > primtrk_hity
int fisdaughtertrack[NMAXDAUGTHERS]
std::vector< double > wirez_v
static unsigned int reverse(QString &chars, unsigned char *level, unsigned int a, unsigned int b)
std::vector< int > primtrk_true_wid
std::vector< double > wid_c
std::vector< double > interaction_tt_v
Point_t const & End() const
Returns the position of the last valid point of the trajectory [cm].
double fdaughter_truth_Phi[NMAXDAUGTHERS]
double fdaughter_truth_StartPosition[NMAXDAUGTHERS][4]
const TLorentzVector & Momentum(const int i=0) const
double Pz(const int i=0) const
Provides recob::Track data product.
double Vz(const int i=0) const
std::vector< double > primtrk_true_trkid
int fprimary_truth_Isbeammatched
std::vector< double > primtrk_range
Exception thrown on invalid wire number.
void WireEndPoints(geo::WireID const &wireid, double *xyzStart, double *xyzEnd) const
Fills two arrays with the coordinates of the wire end points.
double fdaughterShowerEnergy[NMAXDAUGTHERS]
std::vector< double > primtrk_hitz_true
double fdaughterShowerdEdx[NMAXDAUGTHERS]
const TVector3 GetPFParticleSecondaryVertex(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel, const std::string trackLabel) const
Function to find the secondary interaction vertex of a primary PFParticle.
EventNumber_t event() const
geo::WireID NearestWireID(geo::Point_t const &point, geo::PlaneID const &planeid) const
Returns the ID of wire closest to position in the specified TPC.
int fdaughter_truth_Pdg[NMAXDAUGTHERS]
detail::Node< FrameID, bool > PlaneID
virtual void beginJob() override
std::vector< double > beamtrk_Py
2D representation of charge deposited in the TDC/wire plane
std::vector< double > interaction_wid_v
std::vector< int > primtrk_wid0
std::vector< double > primtrk_resrange
auto const & get(AssnsNode< L, R, D > const &r)
double fdaughterPhi[NMAXDAUGTHERS]
std::vector< double > beamtrk_z
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
TPCID_t TPC
Index of the TPC within its cryostat.
std::vector< double > primtrk_hitx
std::vector< double > wid_v
unsigned int GetNumberPrimaryPFParticle(art::Event const &evt, const std::string particleLabel) const
Get the number of primary PFParticles.
std::vector< int > primtrk_wid
std::vector< G4ReweightTraj * > CreateNRWTrajs(const simb::MCParticle &part, const sim::ParticleList &plist, art::ServiceHandle< geo::Geometry > geo_serv, int event, std::string material_name="LAr", bool fVerbose=false)
Vector_t StartDirection() const
Returns the direction of the trajectory at the first point.
second_as<> second
Type of time stored in seconds, in double precision.
geo::WireID suggestedWireID() const
Returns a better wire ID.
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
recob::tracking::Plane Plane
Point_t const & Start() const
Returns the position of the first valid point of the trajectory [cm].
std::vector< double > Yintersection
double fdaughterEndDirection[NMAXDAUGTHERS][3]
std::string fPFParticleTag
std::vector< double > a_v
raw::ChannelID_t Channel() const
ID of the readout channel the hit was extracted from.
std::vector< double > a_u
float GetBeamCosmicScore(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const
Access the BDT output used to decide if a slice is beam-like or cosmic-like.
double Vy(const int i=0) const
std::pair< double, double > GetNTrajPMSigmaWeights(const std::vector< G4ReweightTraj * > &trajs, G4MultiReweighter &rw, size_t iPar)
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
double GetTrackMomentum(double trkrange, int pdg) const
cet::coded_exception< error, detail::translate > exception
std::vector< double > primtrk_range_true
QTextStream & endl(QTextStream &s)
bool IsBeamTrigger(art::Event const &evt) const
std::vector< double > tt_u
std::vector< double > Zintersection
protoana::ProtoDUNETrackUtils trackUtil
int fprimary_truth_byE_origin