22 #include "art_root_io/TFileService.h" 25 #include "canvas/Persistency/Common/FindManyP.h" 50 #include "dune/DuneObj/ProtoDUNEBeamEvent.h" 62 #include "dune/Protodune/singlephase/DataUtils/ProtoDUNEDataUtils.h" 73 #include "geant4reweight/src/ReweightBase/G4ReweighterFactory.hh" 74 #include "geant4reweight/src/ReweightBase/G4Reweighter.hh" 75 #include "geant4reweight/src/ReweightBase/G4ReweightTraj.hh" 76 #include "geant4reweight/src/PropBase/G4ReweightParameterMaker.hh" 77 #include "geant4reweight/src/ReweightBase/G4MultiReweighter.hh" 86 #include "TTimeStamp.h" 128 virtual void endJob()
override;
493 fPandoraBeam = tfs->make<TTree>(
"PandoraBeam",
"Beam events reconstructed with Pandora");
751 std::vector<const anab::T0*> T0s;
760 std::cout <<
"No T0s found" <<
std::endl;
786 for(
int k=0;
k < 6;
k++)
790 for(
int k=0;
k < 6;
k++)
794 bool beamTriggerEvent =
false;
799 auto beamHandle = evt.
getValidHandle<std::vector<beam::ProtoDUNEBeamEvent>>(
"generator");
800 std::vector<art::Ptr<beam::ProtoDUNEBeamEvent>> beamVec;
801 if( beamHandle.isValid()){
808 std::cout <<
"Number of reconstructed beam momenta from spec: " << momenta.size() <<
std::endl;
810 if( momenta.size() > 0 ) std::cout <<
"Measured Beam Momentum from spec: " << momenta.at(0) <<
std::endl;
813 for (
size_t i = 0; i<momenta.size(); ++i){
819 std::cout<<
"beam trk size:"<<btracks.size()<<
std::endl;
820 for (
size_t i = 0; i<btracks.size(); ++i){
821 std::cout<<
"beamPosx/beamPosy/beamPosz:"<<btracks[i].End().X()<<
"/"<<btracks[i].End().Y()<<
"/"<<btracks[i].End().Z()<<
std::endl;
822 std::cout<<
"beamDirx/beamDiry/beamDirz:"<<btracks[i].StartDirection().X()<<
"/"<<btracks[i].StartDirection().Y()<<
"/"<<btracks[i].StartDirection().Z()<<
std::endl;
852 if(geantGoodParticle != 0x0){
853 std::cout <<
"Found GEANT particle corresponding to the good particle with pdg = " << geantGoodParticle->PdgCode()
854 <<
" , track id = " << geantGoodParticle->TrackId()
855 <<
" , Vx/Vy/Vz = " << geantGoodParticle->Vx() <<
"/"<< geantGoodParticle->Vy() <<
"/" << geantGoodParticle->Vz()
861 beamTriggerEvent =
true;
877 for(
size_t i_s=0; i_s < geantGoodParticle->NumberTrajectoryPoints(); i_s++){
878 beamtrk_x.push_back(geantGoodParticle->Position(i_s).X());
879 beamtrk_y.push_back(geantGoodParticle->Position(i_s).Y());
880 beamtrk_z.push_back(geantGoodParticle->Position(i_s).Z());
882 beamtrk_Px.push_back(geantGoodParticle->Momentum(i_s).X());
883 beamtrk_Py.push_back(geantGoodParticle->Momentum(i_s).Y());
884 beamtrk_Pz.push_back(geantGoodParticle->Momentum(i_s).Z());
886 beamtrk_Eng.push_back(geantGoodParticle->Momentum(i_s).E()-geantGoodParticle->Mass());
890 int key_reach_tpc=-99;
892 for (
size_t kk=0; kk<
beamtrk_z.size(); ++kk) {
895 key_reach_tpc=(
int)kk;
899 for (
size_t kk=0; kk<
beamtrk_z.size(); ++kk) {
916 if (key_reach_tpc>=1) {
919 double z1_ff=
beamtrk_z.at(key_reach_tpc-1);
920 double z2_ff=
beamtrk_z.at(key_reach_tpc);
921 double m_ff=(eng1_ff-eng2_ff)/(z1_ff-z2_ff);
922 ke_ff=1000.*(eng1_ff-m_ff*z1_ff);
949 beamid = geantGoodParticle->TrackId();
996 std::vector< art::Ptr<beam::ProtoDUNEBeamEvent> > beaminfo;
1001 for(
unsigned int i = 0; i < beaminfo.size(); ++i){
1007 if(beaminfo[i]->GetTOFChan() >= 0)
1008 ftof = beaminfo[i]->GetTOF();
1011 if(beaminfo[i]->GetBITrigger() == 1){
1017 auto &
tracks = beaminfo[i]->GetBeamTracks();
1028 auto & beammom = beaminfo[i]->GetRecoBeamMomenta();
1029 if(!beammom.empty())
1070 std::vector<art::Ptr<recob::Track> > tracklist;
1071 auto trackListHandle = evt.
getHandle< std::vector<recob::Track> >(
"pandoraTrack");
1076 std::vector<art::Ptr<recob::PFParticle> > pfplist;
1077 auto PFPListHandle = evt.
getHandle< std::vector<recob::PFParticle> >(
"pandora");
1081 std::vector<art::Ptr<recob::Cluster>> clusterlist;
1082 auto clusterListHandle = evt.
getHandle< std::vector<recob::Cluster> >(
"pandora");
1085 art::FindManyP<recob::Cluster> fmcp(PFPListHandle,evt,
"pandora");
1086 art::FindManyP<recob::Track> pftrack(PFPListHandle,evt,
"pandoraTrack");
1088 std::cout<<
"number of pfp_particles "<<pfplist.size()<<
std::endl;
1089 std::cout<<
" size of pfParticles "<<pfParticles.size()<<
std::endl;
1090 art::FindManyP<recob::Hit, recob::TrackHitMeta> fmthm(trackListHandle, evt,
"pandoraTrack");
1120 if(!pfT0vec.empty())
1141 if(thisTrack != 0x0) {
1145 if(mcparticle0!=0x0) {
1149 truthid=mcparticle0->
TrackId();
1203 if (hi->WireID().Plane==2) {
1207 if (hi->WireID().Plane==1) {
1211 if (hi->WireID().Plane==0) {
1244 if(calovector.size() != 3)
1245 std::cerr <<
"WARNING::Calorimetry vector size for primary is = " << calovector.size() <<
std::endl;
1262 for (
auto &
calo : calovector) {
1263 if (
calo.PlaneID().Plane == 2){
1266 for (
size_t ihit = 0; ihit <
calo.dQdx().size(); ++ihit){
1272 const auto &primtrk_pos=(
calo.XYZ())[ihit];
1277 double pos_reco[3]={primtrk_pos.X(),primtrk_pos.Y(),primtrk_pos.Z()};
1307 const recob::Hit & theHit = (*allHits)[
calo.TpIndices()[ihit] ];
1347 if (geantGoodParticle1== 0x0) std::cout<<
"@@@@ Empty G4 particle!!"<<
std::endl;
1349 if(geantGoodParticle1!= 0x0 && geantGoodParticle1->
Process()==
"primary") {
1352 double ke_reco=
ke_ff;
1353 double ke_true=
ke_ff;
1361 if (thisTrajectoryProcessMap1.size()){
1362 for(
auto const& couple: thisTrajectoryProcessMap1){
1385 if (thisTrajectoryProcessMap1.size()) {
1386 for(
auto const& couple1: thisTrajectoryProcessMap1) {
1387 interactionX.push_back(((truetraj.
at(couple1.first)).first).X());
1388 interactionY.push_back(((truetraj.
at(couple1.first)).first).Y());
1389 interactionZ.push_back(((truetraj.
at(couple1.first)).first).Z());
1390 interactionE.push_back(((truetraj.
at(couple1.first)).first).E());
1396 double xval=((truetraj.
at(couple1.first)).first).X();
1397 double yval=((truetraj.
at(couple1.first)).first).Y();
1398 double zval=((truetraj.
at(couple1.first)).first).Z();
1399 unsigned int tpcno=1;
1400 if(xval<=0 && zval<232) tpcno=1;
1401 if(xval<=0 && zval>232 && zval<464) tpcno=5;
1402 if(xval<=0 && zval>=464) tpcno=9;
1403 if(xval>0 && zval<232) tpcno=2;
1404 if(xval>0 && zval>232 && zval<464) tpcno=6;
1405 if(xval>0 && zval>=464) tpcno=10;
1435 auto interactionPos4D = (truetraj.
at(couple1.first)).first ;
1443 double interactionAngle = 999999.;
1446 auto prevInteractionPos4D = (truetraj.
at(couple1.first-1)).first ;
1447 auto prevInteractionPos3D = prevInteractionPos4D.Vect() ;
1448 auto interactionPos3D = interactionPos4D.Vect() ;
1449 auto distanceBtwPoint = interactionPos3D - prevInteractionPos3D;
1452 if (truetraj.
size() > couple1.first + 1) {
1454 auto nextInteractionPos4D = (truetraj.
at(couple1.first+1)).first ;
1455 auto nextInteractionPos3D = nextInteractionPos4D.Vect() ;
1456 auto distanceBtwPointNext = nextInteractionPos3D - interactionPos3D;
1457 interactionAngles.push_back(TMath::ACos(distanceBtwPointNext.Dot(distanceBtwPoint)/(distanceBtwPointNext.Mag()*distanceBtwPoint.Mag() ) ));
1464 double maxAngle = 0.;
1465 int numberOfTroubleDaugther = 0;
1467 const sim::ParticleList& plist=pi_serv->
ParticleList();
1469 for(
size_t dPart1=0;(dPart1<plist.size()) && (plist.begin()!=plist.end());++dPart1) {
1471 if (dPart->
Mother() != 1 )
continue;
1477 interactionAngle=999999;
1481 numberOfTroubleDaugther++;
1483 auto daughtFirstPt = ((daugthTraj[0]).first).Vect() ;
1484 auto daughtSecondPt = ((daugthTraj[1]).first).Vect() ;
1485 auto distanceBtwPointNext = daughtSecondPt - daughtFirstPt;
1486 interactionAngle = TMath::ACos(distanceBtwPointNext.Dot(distanceBtwPoint)/(distanceBtwPointNext.Mag()*distanceBtwPoint.Mag()));
1487 if ( maxAngle < interactionAngle ) maxAngle = interactionAngle;
1488 interactionAngle = maxAngle;
1490 if (!numberOfTroubleDaugther) interactionAngle = 9999999.;
1491 if (interactionAngle < 0.0001) std::cout<<
"-------------------------------------------------> \n";
1499 std::cout<<
"-->add inel at the end!"<<
std::endl;
1518 std::map<double, sim::IDE> orderedSimIDE;
1519 for (
auto& ide : simIDE_prim) orderedSimIDE[ide->z]= *ide;
1520 auto inTPCPoint = truetraj.
begin();
1521 auto Momentum0 = inTPCPoint->second;
1528 bool run_me_onetime=
true;
1529 double xi=0.0;
double yi=0.0;
double zi=0.0;
1544 for(
size_t idx1=0; idx1<
primtrk_dqdx.size()-1; idx1++) {
1546 double currentDepEng = 0.;
1547 for (
auto iter= orderedSimIDE.begin(); iter!= orderedSimIDE.end(); iter++) {
1548 auto currentIde = iter->second;
1557 if(cnt==0&¤tIde.trackID>=0) {
1573 if (currentIde.trackID>=0) {
1574 if(cnt>0 && run_me_onetime) {
1591 xi=currentIde.x; yi=currentIde.y; zi=currentIde.z;
1599 currentDepEng += currentIde.energy;
1601 ke_true -= currentDepEng;
1602 run_me_onetime=
false;
1604 if(currentDepEng>0.001) {
1616 for (
auto iter2=orderedSimIDE.begin(); iter2!=orderedSimIDE.end(); iter2++) {
1617 auto currentIde2 = iter2->second;
1633 double pos_true[3] = {currentIde2.x, currentIde2.y, currentIde2.z};
1766 for(
size_t k = 0;
k < calovector.size() &&
k<3;
k++){
1780 if(fmthm.isValid()){
1783 for (
size_t ii = 0; ii<vhit.size(); ++ii){
1784 bool fBadhit =
false;
1790 if (vmeta[ii]->
Index()>=tracklist[
fprimaryID]->NumberTrajectoryPoints()){
1791 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!!";
1808 unsigned int tpc_no=1;
1809 if(xpos<=0 && zpos<232) tpc_no=1;
1810 if(xpos<=0 && zpos>232 && zpos<464) tpc_no=5;
1811 if(xpos<=0 && zpos>=464) tpc_no=9;
1812 if(xpos>0 && zpos<232) tpc_no=2;
1813 if(xpos>0 && zpos>232 && zpos<464) tpc_no=6;
1814 if(xpos>0 && zpos>=464) tpc_no=10;
1817 if (fBadhit)
continue;
1818 if (zpos<-100)
continue;
1819 planenum=vhit[ii]->WireID().Plane;
1832 x_c.push_back(xpos);
1833 y_c.push_back(ypos);
1834 z_c.push_back(zpos);
1839 tt_c.push_back(detProp.ConvertXToTicks(xpos, planenum, tpc_no, 0));
1842 ch_c.push_back(vhit[ii]->Channel());
1844 pt_c.push_back(vhit[ii]->PeakTime());
1845 q_c.push_back(vhit[ii]->Integral());
1846 a_c.push_back(vhit[ii]->PeakAmplitude());
1852 unsigned int wireno=vhit[ii]->WireID().Wire;
1854 wirez_c.push_back(xyzStart[2]);
1881 tt_v.push_back(detProp.ConvertXToTicks(xpos, planenum, tpc_no, 0));
1884 ch_v.push_back(vhit[ii]->Channel());
1886 pt_v.push_back(vhit[ii]->PeakTime());
1887 q_v.push_back(vhit[ii]->Integral());
1888 a_v.push_back(vhit[ii]->PeakAmplitude());
1894 unsigned int wireno=vhit[ii]->WireID().Wire;
1896 wirez_v.push_back(xyzStart[2]);
1904 tt_u.push_back(detProp.ConvertXToTicks(xpos, planenum, tpc_no, 0));
1907 ch_u.push_back(vhit[ii]->Channel());
1909 pt_u.push_back(vhit[ii]->PeakTime());
1910 q_u.push_back(vhit[ii]->Integral());
1911 a_u.push_back(vhit[ii]->PeakAmplitude());
1917 unsigned int wireno=vhit[ii]->WireID().Wire;
1919 wirez_u.push_back(xyzStart[2]);
1935 std::vector<float> Stw, Endw, Stt, Endt, Stwires, Endwires, Stticks, Endticks, TPCb, TPCcl;
1936 Stw.clear(); Endw.clear(); Stt.clear(); Endt.clear(); Stwires.clear(); Endwires.clear(); Stticks.clear(); Endticks.clear(); TPCb.clear(); TPCcl.clear();
1938 float numw, numt,wire_no,ticks_no;
1939 for(
size_t p1=0;p1<pfplist.size();p1++){
1940 std::vector<art::Ptr<recob::Track>>
trk=pftrack.at(p1);
1941 std::vector<art::Ptr<recob::Cluster>> allClusters=fmcp.at(p1);
1943 for(
size_t c1=0;
c1<allClusters.size();
c1++){
1946 Stw.push_back(allClusters[
c1]->StartWire());
1947 Endw.push_back(allClusters[
c1]->EndWire());
1948 Stt.push_back(allClusters[
c1]->StartTick());
1949 Endt.push_back(allClusters[
c1]->EndTick());
1950 TPCb.push_back(allClusters[
c1]->
Plane().
TPC);
1954 Stwires.push_back(allClusters[
c1]->StartWire());
1955 Endwires.push_back(allClusters[
c1]->EndWire());
1956 Stticks.push_back(allClusters[
c1]->StartTick());
1957 Endticks.push_back(allClusters[
c1]->EndTick());
1958 TPCcl.push_back(allClusters[
c1]->
Plane().
TPC);
1963 for(
size_t clt=0;clt<Stw.size();clt++){
1964 for(
size_t cl1=0;cl1<Stwires.size();cl1++){
1965 if(TPCcl[cl1]!=TPCb[clt])
continue;
1967 den=(Stw[clt]-Endw[clt])*(Stticks[cl1]-Endticks[cl1])-(Stt[clt]-Endt[clt])*(Stwires[cl1]-Endwires[cl1]);
1968 if(den==0)
continue;
1969 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]);
1970 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]);
1974 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))) {
1975 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;
1978 unsigned int wireno=std::round(wire_no);
1981 std::cout<<
"Z position of intersection = "<<xyzStart[2]<<
" "<<xyzEnd[2]<<
" "<<wireno<<
std::endl;
1996 else if(thisShower != 0x0){
2014 if( (thisShower->
dEdx()).
size() > 0 )
2035 std::cout <<
"INFO::Number of daughters is " << particle->NumDaughters() <<
". Only the first NMAXDAUGTHERS are processed." <<
std::endl;
2038 for(
const int daughterID : particle->Daughters()){
2041 std::cout <<
"Daughter " << daughterID <<
" has " << daughterParticle->
NumDaughters() <<
" daughters" <<
std::endl;
2046 if(daughterTrack != 0x0){
2071 if(daughtercalovector.size() != 3)
2072 std::cerr <<
"WARNING::Calorimetry vector size for daughter is = " << daughtercalovector.size() <<
std::endl;
2074 for(
size_t k = 0;
k < daughtercalovector.size() &&
k<3;
k++){
2081 if(mcdaughterparticle != 0x0){
2106 std::cout <<
"Daughter Process = " << (mcdaughterparticle->
Process()).c_str()
2107 <<
" , mother = " << mcdaughterparticle->
Mother()
2111 else if(daughterShower != 0x0){
2127 if( (daughterShower->
dEdx()).
size() > 0 )
2131 std::cout <<
"INFO::Daughter pfParticle is not track or shower. Skip!" <<
std::endl;
2160 if(beamTriggerEvent)
2182 for(
int k=0;
k < 5;
k++)
2185 for(
int k=0;
k < 3;
k++){
2213 for(
int l=0;
l < 3;
l++){
2292 for(
int l=0;
l < 4;
l++){
2310 for(
int l=0;
l < 3;
l++){
2336 for(
int l=0;
l < 4;
l++){
double E(const int i=0) const
double fprimary_truth_Momentum[4]
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]
double fdaughterTheta[NMAXDAUGTHERS]
std::vector< double > beamtrk_z
unsigned int NumberTrajectoryPoints() const
const TVector3 & ShowerStart() const
double EndMomentum() const
std::vector< double > a_c
double fprimaryStartDirection[3]
constexpr std::uint32_t timeLow() const
double fdaughterLength[NMAXDAUGTHERS]
protoana::ProtoDUNETrackUtils trackUtil
double fdaughter_truth_Theta[NMAXDAUGTHERS]
double Py(const int i=0) const
double fprimary_truth_EndPosition[4]
double fdaughterRange[NMAXDAUGTHERS][3]
std::vector< double > pt_u
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 fdaughter_truth_Process[NMAXDAUGTHERS]
std::vector< double > primtrk_true_y
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
std::vector< double > pt_v
std::vector< double > q_v
double fprimaryShowerEnergy
art::ServiceHandle< geo::Geometry > fGeometryService_rw
std::string primtrk_end_g4process
std::vector< double > pfphit_peaktime_c
double fprimaryStartPosition[3]
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 > primtrk_hitx
std::vector< double > primtrk_hity
geo::WireID WireID() const
void FillCosmicsTree(art::Event const &evt, std::string pfParticleTag)
const recob::TrackTrajectory & Trajectory() const
Access to the stored recob::TrackTrajectory.
int fdaughterID[NMAXDAUGTHERS]
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 fdaughterMomentum[NMAXDAUGTHERS]
const value_type & at(const size_type i) const
double fdaughter_truth_EndMomentum[NMAXDAUGTHERS][4]
constexpr std::uint32_t timeHigh() const
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< int > wireno_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
double Px(const int i=0) const
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.
double fprimaryMomentumByRangeProton
int fprimary_truth_TrackId
std::vector< double > primtrk_trkid_true
bool reco_reconstructable_beam_event
std::string fCalorimetryTag
double fdaughter_truth_Momentum[NMAXDAUGTHERS][4]
Plane(const Point_t &planePos, const Vector_t &planeDir)
Constructor from reference position on the plane and direction orthogonal to the plane.
std::vector< const sim::IDE * > TrackIdToSimIDEs_Ps(int const &id) const
double GetNTrajWeightFromSetPars(const std::vector< G4ReweightTraj * > &trajs, G4MultiReweighter &rw)
std::vector< int > primtrk_ch
protoana::ProtoDUNETruthUtils truthUtil
std::vector< double > wid_u
WireID_t Wire
Index of the wire within its plane.
double fdaughter_truth_Mass[NMAXDAUGTHERS]
std::vector< double > Xintersection
double fdaughterShowerdEdx[NMAXDAUGTHERS]
std::vector< double > interaction_wid_c
geo::GeometryCore const * fGeometry
double fprimary_truth_EndMomentum[4]
std::vector< double > pfphit_wireid_u
EDAnalyzer(fhicl::ParameterSet const &pset)
std::string Process() const
unsigned char ProcessToKey(std::string const &process) const
std::vector< double > wirez_v
std::vector< double > primtrk_true_edept
bool IsEmptyEvent(const art::Event &evt) const
std::vector< double > primtrk_hitz_true
double fdaughterEndMomentum[NMAXDAUGTHERS]
int fdaughterNHits[NMAXDAUGTHERS]
std::string fGeneratorTag
std::vector< double > primtrk_hitx_true
std::vector< int > primtrk_wid0
int NumberDaughters() const
std::vector< double > pfphit_wireid_c
int fprimary_truth_byE_PDG
std::vector< double > interactionAngles
art framework interface to geometry description
const art::InputTag fBeamModuleLabel
std::vector< double > primtrk_dqdx
std::vector< double > interaction_wid_v
std::vector< double > q_c
double fprimaryEndMomentum
std::vector< double > pfphit_wireid_v
std::vector< double > beamPosx_spec
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.
void analyze(art::Event const &evt) override
int fprimaryShowerBestPlane
int fdaughterShowerBestPlane[NMAXDAUGTHERS]
std::vector< double > beamPosz_spec
double Pt(const int i=0) const
double fprimaryOpeningAngle
std::vector< double > primtrk_true_trkid
std::vector< double > beamtrk_Eng
std::vector< double > timeintersection
double fprimary_truth_EndPosition_MC[4]
std::vector< double > wid_v
double Length(size_t p=0) const
Access to various track properties.
const std::vector< double > & dEdx() const
#define DEFINE_ART_MODULE(klass)
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
std::vector< double > beamtrk_Pz
const std::vector< double > & MIPEnergy() const
protonmcnorw & operator=(protonmcnorw const &)=delete
double fdaughterShowerMIPEnergy[NMAXDAUGTHERS]
double fbeamtrackMomentum
std::vector< double > primtrk_ke_reco
std::vector< double > tt_c
Collection of exceptions for Geometry system.
const std::vector< double > & GetRecoBeamMomenta() const
std::string fPFParticleTag
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 > beamDirz_spec
const simb::MCParticle * GetMCParticleFromPFParticle(detinfo::DetectorClocksData const &clockData, const recob::PFParticle &pfpart, art::Event const &evt, std::string pfparticleModule) const
std::vector< double > primtrk_true_z
double fdaughterEndDirection[NMAXDAUGTHERS][3]
double P(const int i=0) const
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_pitch
std::vector< double > Yintersection
int fprimary_truth_NDaughters
double fdaughterOpeningAngle[NMAXDAUGTHERS]
double fdaughterKineticEnergy[NMAXDAUGTHERS][3]
double T(const int i=0) const
std::vector< int > primtrk_true_wid
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
int fprimary_truth_byE_ID
double fdaughterStartDirection[NMAXDAUGTHERS][3]
std::vector< double > interactionZ
SubRunNumber_t subRun() const
double fprimaryEndPosition[3]
int fdaughter_truth_TrackId[NMAXDAUGTHERS]
std::vector< double > interaction_tt_v
protonmcnorw(fhicl::ParameterSet const &p)
const simb::MCParticle * GetMCParticleFromRecoTrack(detinfo::DetectorClocksData const &clockData, const recob::Track &track, art::Event const &evt, std::string trackModule) const
std::vector< double > interactionY
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...
const TVector3 & Direction() const
std::vector< double > primtrk_dedx
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)
double fprimaryKineticEnergy[3]
std::vector< double > beamMomentum_spec
The data type to uniquely identify a TPC.
Description of geometry of one entire detector.
ProcessMap const & TrajectoryProcesses() const
virtual void endJob() override
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
Definition of data types for geometry description.
int fprimary_truth_Isbeammatched
double fprimary_truth_StartPosition_MC[4]
std::vector< double > interaction_tt_c
std::vector< int > wireno_u
int fisdaughtertrack[NMAXDAUGTHERS]
const sim::ParticleList & ParticleList() const
Class storing the result of the Maximum Likelihood fit of Multiple Coulomb Scattering angles between ...
int fdaughter_truth_Pdg[NMAXDAUGTHERS]
std::vector< double > primtrk_ke_true
std::vector< double > primtrk_range_true
Vector_t EndDirection() const
Returns the direction of the trajectory at the last point.
std::vector< double > wid_c
std::vector< size_t > primtrk_calo_hit_index
bool Isendpoint_outsidetpc
double fdaughterStartPosition[NMAXDAUGTHERS][3]
double fprimaryEndDirection[3]
protoana::ProtoDUNEPFParticleUtils pfpUtil
double fprimaryShowerdEdx
double Vx(const int i=0) const
std::vector< double > beamPosy_spec
float PeakTime() const
Time of the signal peak, in tick units.
Declaration of signal hit object.
std::vector< double > beamtrk_Px
std::vector< double > primtrk_true_x
std::vector< double > primtrk_resrange
double StartMomentum() const
Hierarchical representation of particle flow.
std::vector< double > wirez_u
std::string fprimary_truth_EndProcess
std::vector< double > a_v
std::vector< double > interactionE
int GetNActiveFembsForAPA(art::Event const &evt, int apa) const
Get number of active fembs in an APA.
std::vector< double > interaction_wid_u
double fprimary_truth_Theta
static unsigned int reverse(QString &chars, unsigned char *level, unsigned int a, unsigned int b)
std::vector< double > q_u
double fprimary_truth_StartPosition[4]
std::vector< double > wirez_c
double fdaughterShowerEnergy[NMAXDAUGTHERS]
std::vector< double > beamDiry_spec
Point_t const & End() const
Returns the position of the last valid point of the trajectory [cm].
double fprimary_truth_Mass
std::vector< double > pt_c
std::vector< double > beamtrk_Py
const TLorentzVector & Momentum(const int i=0) const
std::vector< double > Zintersection
double Pz(const int i=0) const
Provides recob::Track data product.
double fdaughter_truth_P[NMAXDAUGTHERS]
double Vz(const int i=0) const
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.
std::vector< double > primtrk_edept_true
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
std::vector< double > primtrk_range
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.
const std::vector< recob::Track > & GetBeamTracks() const
detail::Node< FrameID, bool > PlaneID
std::vector< double > primtrk_hity_true
std::vector< double > interactionX
double fdaughter_truth_Phi[NMAXDAUGTHERS]
std::vector< double > tt_v
double fprimaryShowerMIPEnergy
std::vector< double > beamtrk_x
double fdaughterMomentumByRangeProton[NMAXDAUGTHERS]
std::vector< double > interaction_tt_u
std::vector< double > beamtrk_y
2D representation of charge deposited in the TDC/wire plane
double fdaughterPhi[NMAXDAUGTHERS]
std::vector< std::string > interactionProcesslist
std::vector< double > a_u
double fprimary_truth_Phi
auto const & get(AssnsNode< L, R, D > const &r)
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
TPCID_t TPC
Index of the TPC within its cryostat.
protoana::ProtoDUNEEmptyEventFinder fEmptyEventFinder
double fdaughter_truth_StartPosition[NMAXDAUGTHERS][4]
unsigned int GetNumberPrimaryPFParticle(art::Event const &evt, const std::string particleLabel) const
Get the number of primary PFParticles.
double fdaughter_truth_EndPosition[NMAXDAUGTHERS][4]
double fprimaryMomentumByRangeMuon
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.
std::vector< double > tt_u
recob::tracking::Plane Plane
Point_t const & Start() const
Returns the position of the first valid point of the trajectory [cm].
int fisdaughtershower[NMAXDAUGTHERS]
virtual void beginJob() override
protoana::ProtoDUNEDataUtils dataUtil
raw::ChannelID_t Channel() const
ID of the readout channel the hit was extracted from.
double fdaughterMomentumByRangeMuon[NMAXDAUGTHERS]
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::vector< double > pfphit_peaktime_v
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
QTextStream & endl(QTextStream &s)
bool IsBeamTrigger(art::Event const &evt) const
int fprimary_truth_byE_origin
std::vector< int > primtrk_wid
std::vector< int > wireno_v
std::vector< double > primtrk_pt
std::vector< double > primtrk_hitz
std::vector< double > beamDirx_spec
double fdaughterEndPosition[NMAXDAUGTHERS][3]
std::vector< double > pfphit_peaktime_u