21 #include "art_root_io/TFileService.h" 24 #include "canvas/Persistency/Common/FindManyP.h" 43 #include "dune/DuneObj/ProtoDUNEBeamEvent.h" 53 #include "dune/Protodune/singlephase/DataUtils/ProtoDUNEDataUtils.h" 61 #include "TTimeStamp.h" 97 virtual void endJob()
override;
388 fPandoraBeam = tfs->make<TTree>(
"PandoraBeam",
"Beam events reconstructed with Pandora");
613 std::vector<const anab::T0*> T0s;
622 std::cout <<
"No T0s found" <<
std::endl;
644 for(
int k=0;
k < 6;
k++)
648 for(
int k=0;
k < 6;
k++)
652 bool beamTriggerEvent =
false;
673 if(geantGoodParticle != 0x0){
674 std::cout <<
"Found GEANT particle corresponding to the good particle with pdg = " << geantGoodParticle->PdgCode()
675 <<
" , track id = " << geantGoodParticle->TrackId()
676 <<
" , Vx/Vy/Vz = " << geantGoodParticle->Vx() <<
"/"<< geantGoodParticle->Vy() <<
"/" << geantGoodParticle->Vz()
682 beamTriggerEvent =
true;
697 for(
size_t i_s=0; i_s < geantGoodParticle->NumberTrajectoryPoints(); i_s++){
698 beamtrk_x.push_back(geantGoodParticle->Position(i_s).X());
699 beamtrk_y.push_back(geantGoodParticle->Position(i_s).Y());
700 beamtrk_z.push_back(geantGoodParticle->Position(i_s).Z());
702 beamtrk_Px.push_back(geantGoodParticle->Momentum(i_s).X());
703 beamtrk_Py.push_back(geantGoodParticle->Momentum(i_s).Y());
704 beamtrk_Pz.push_back(geantGoodParticle->Momentum(i_s).Z());
706 beamtrk_Eng.push_back(geantGoodParticle->Momentum(i_s).E()-geantGoodParticle->Mass());
710 int key_reach_tpc=-99;
711 for (
size_t kk=0; kk<
beamtrk_z.size(); ++kk) {
713 if ((zpos_beam+0.49375)<0.01&&(zpos_beam+0.49375)>-0.01) {
719 if (key_reach_tpc!=-99) {
730 std::cout<<
"This particle doesn't enter TPC!!!"<<
std::endl;
737 beamid = geantGoodParticle->TrackId();
777 std::vector< art::Ptr<beam::ProtoDUNEBeamEvent> > beaminfo;
781 for(
unsigned int i = 0; i < beaminfo.size(); ++i){
787 if(beaminfo[i]->GetTOFChan() >= 0)
788 ftof = beaminfo[i]->GetTOF();
791 if(beaminfo[i]->GetBITrigger() == 1){
797 auto &
tracks = beaminfo[i]->GetBeamTracks();
808 auto & beammom = beaminfo[i]->GetRecoBeamMomenta();
850 std::vector<art::Ptr<recob::Track> > tracklist;
851 std::vector<art::Ptr<recob::PFParticle> > pfplist;
853 auto trackListHandle = evt.
getHandle< std::vector<recob::Track> >(
"pandoraTrack");
856 auto PFPListHandle = evt.
getHandle< std::vector<recob::PFParticle> > (
"pandora");
859 std::vector<art::Ptr<recob::Cluster>> clusterlist;
860 auto clusterListHandle = evt.
getHandle< std::vector<recob::Cluster> >(
"pandora"); ;
863 art::FindManyP<recob::Cluster> fmcp(PFPListHandle,evt,
"pandora");
864 art::FindManyP<recob::Track> pftrack(PFPListHandle,evt,
"pandoraTrack");
866 std::cout<<
"number of pfp_particles "<<pfplist.size()<<
std::endl;
867 std::cout<<
" size of pfParticles "<<pfParticles.size()<<
std::endl;
868 art::FindManyP<recob::Hit, recob::TrackHitMeta> fmthm(trackListHandle, evt,
"pandoraTrack");
909 if(thisTrack != 0x0) {
912 std::cout<<
"inside the this track loop "<<
std::endl;
913 if(mcparticle0!=0x0) {
917 truthid=mcparticle0->
TrackId();
969 if (hi->WireID().Plane==2) {
973 if (hi->WireID().Plane==1) {
977 if (hi->WireID().Plane==0) {
986 if(calovector.size() != 3)
987 std::cerr <<
"WARNING::Calorimetry vector size for primary is = " << calovector.size() <<
std::endl;
990 std::vector<double> tmp_primtrk_dqdx;
991 std::vector<double> tmp_primtrk_resrange;
992 std::vector<double> tmp_primtrk_dedx;
993 std::vector<double> tmp_primtrk_hitx;
994 std::vector<double> tmp_primtrk_hity;
995 std::vector<double> tmp_primtrk_hitz;
996 std::vector<double> tmp_primtrk_pitch;
998 for (
auto &
calo : calovector) {
999 if (
calo.PlaneID().Plane == 2){
1002 for (
size_t ihit = 0; ihit <
calo.dQdx().size(); ++ihit){
1003 tmp_primtrk_dqdx.push_back(
calo.dQdx()[ihit]);
1004 tmp_primtrk_resrange.push_back(
calo.ResidualRange()[ihit]);
1005 tmp_primtrk_dedx.push_back(
calo.dEdx()[ihit]);
1006 tmp_primtrk_pitch.push_back(
calo.TrkPitchVec()[ihit]);
1008 const auto &primtrk_pos=(
calo.XYZ())[ihit];
1009 tmp_primtrk_hitx.push_back(primtrk_pos.X());
1010 tmp_primtrk_hity.push_back(primtrk_pos.Y());
1011 tmp_primtrk_hitz.push_back(primtrk_pos.Z());
1026 std::vector<double> tmp_primtrk_hitx_true;
1027 std::vector<double> tmp_primtrk_hity_true;
1028 std::vector<double> tmp_primtrk_hitz_true;
1029 std::vector<double> tmp_primtrk_trkid_true;
1030 std::vector<double> tmp_primtrk_edept_true;
1032 std::vector<double> tmp_primtrk_true_x;
1033 std::vector<double> tmp_primtrk_true_y;
1034 std::vector<double> tmp_primtrk_true_z;
1035 std::vector<double> tmp_primtrk_true_trkid;
1036 std::vector<double> tmp_primtrk_true_edept;
1038 std::vector<double> tmp_primtrj_true_x;
1039 std::vector<double> tmp_primtrj_true_y;
1040 std::vector<double> tmp_primtrj_true_z;
1041 std::vector<double> tmp_primtrj_true_edept;
1043 if(geantGoodParticle1!= 0x0 && geantGoodParticle1->
Process()==
"primary") {
1046 double ke_reco=
ke_ff;
1047 double ke_true=
ke_ff;
1055 if (thisTrajectoryProcessMap1.size()){
1056 for(
auto const& couple: thisTrajectoryProcessMap1){
1076 if (thisTrajectoryProcessMap1.size()) {
1077 for(
auto const& couple1: thisTrajectoryProcessMap1) {
1078 interactionX.push_back(((truetraj.
at(couple1.first)).first).X());
1079 interactionY.push_back(((truetraj.
at(couple1.first)).first).Y());
1080 interactionZ.push_back(((truetraj.
at(couple1.first)).first).Z());
1081 interactionE.push_back(((truetraj.
at(couple1.first)).first).E());
1085 double xval=((truetraj.
at(couple1.first)).first).X();
1086 double yval=((truetraj.
at(couple1.first)).first).Y();
1087 double zval=((truetraj.
at(couple1.first)).first).Z();
1088 unsigned int tpcno=1;
1089 if(xval<=0 && zval<232) tpcno=1;
1090 if(xval<=0 && zval>232 && zval<464) tpcno=5;
1091 if(xval<=0 && zval>=464) tpcno=9;
1092 if(xval>0 && zval<232) tpcno=2;
1093 if(xval>0 && zval>232 && zval<464) tpcno=6;
1094 if(xval>0 && zval>=464) tpcno=10;
1120 if ((truetraj.
KeyToProcess(couple1.second)).find(
"CoulombScat")!= std::string::npos)
continue;
1123 auto interactionPos4D = (truetraj.
at(couple1.first)).first ;
1125 if (interactionPos4D.Z() <
minZ || interactionPos4D.Z() >
maxZ )
continue;
1126 else if (interactionPos4D.X() <
minX || interactionPos4D.X() >
maxX )
continue;
1127 else if (interactionPos4D.Y() <
minY || interactionPos4D.Y() >
maxY )
continue;
1130 double interactionAngle = 999999.;
1133 auto prevInteractionPos4D = (truetraj.
at(couple1.first-1)).first ;
1134 auto prevInteractionPos3D = prevInteractionPos4D.Vect() ;
1135 auto interactionPos3D = interactionPos4D.Vect() ;
1136 auto distanceBtwPoint = interactionPos3D - prevInteractionPos3D;
1139 if (truetraj.
size() > couple1.first + 1) {
1141 auto nextInteractionPos4D = (truetraj.
at(couple1.first+1)).first ;
1142 auto nextInteractionPos3D = nextInteractionPos4D.Vect() ;
1143 auto distanceBtwPointNext = nextInteractionPos3D - interactionPos3D;
1144 interactionAngles.push_back(TMath::ACos(distanceBtwPointNext.Dot(distanceBtwPoint)/(distanceBtwPointNext.Mag()*distanceBtwPoint.Mag() ) ));
1151 double maxAngle = 0.;
1152 int numberOfTroubleDaugther = 0;
1154 const sim::ParticleList& plist=pi_serv->
ParticleList();
1156 for(
size_t dPart1=0;(dPart1<plist.size()) && (plist.begin()!=plist.end());++dPart1) {
1158 if (dPart->
Mother() != 1 )
continue;
1164 interactionAngle=999999;
1168 numberOfTroubleDaugther++;
1170 auto daughtFirstPt = ((daugthTraj[0]).first).Vect() ;
1171 auto daughtSecondPt = ((daugthTraj[1]).first).Vect() ;
1172 auto distanceBtwPointNext = daughtSecondPt - daughtFirstPt;
1173 interactionAngle = TMath::ACos(distanceBtwPointNext.Dot(distanceBtwPoint)/(distanceBtwPointNext.Mag()*distanceBtwPoint.Mag()));
1174 if ( maxAngle < interactionAngle ) maxAngle = interactionAngle;
1175 interactionAngle = maxAngle;
1177 if (!numberOfTroubleDaugther) interactionAngle = 9999999.;
1178 if (interactionAngle < 0.0001) std::cout<<
"-------------------------------------------------> \n";
1187 std::cout<<
"\n MCTrajectory of this prim. trk has:"<<truetraj.
size()<<
" hits!!"<<
std::endl;
1188 for (
size_t tt=0;
tt<truetraj.
size(); ++
tt) {
1189 tmp_primtrj_true_x.push_back(truetraj.
X(
tt));
1190 tmp_primtrj_true_y.push_back(truetraj.
Y(
tt));
1191 tmp_primtrj_true_z.push_back(truetraj.
Z(
tt));
1192 tmp_primtrj_true_edept.push_back(truetraj.
E(
tt));
1200 std::map<double, sim::IDE> orderedSimIDE;
1201 for (
auto& ide : simIDE_prim) orderedSimIDE[ide->z]= *ide;
1202 auto inTPCPoint = truetraj.
begin();
1203 auto Momentum0 = inTPCPoint->second;
1210 bool run_me_onetime=
true;
1211 double xi=0.0;
double yi=0.0;
double zi=0.0;
1214 if(tmp_primtrk_dqdx.size()!=0) {
1215 if(tmp_primtrk_hitz[0]>tmp_primtrk_hitz[tmp_primtrk_hitz.size()-1]) {
1216 std::reverse(tmp_primtrk_hitz.begin(), tmp_primtrk_hitz.end());
1217 std::reverse(tmp_primtrk_hity.begin(), tmp_primtrk_hity.end());
1218 std::reverse(tmp_primtrk_hitx.begin(), tmp_primtrk_hitx.end());
1219 std::reverse(tmp_primtrk_pitch.begin(),tmp_primtrk_pitch.end());
1220 std::reverse(tmp_primtrk_dedx.begin(), tmp_primtrk_dedx.end());
1221 std::reverse(tmp_primtrk_dqdx.begin(), tmp_primtrk_dqdx.end());
1222 std::reverse(tmp_primtrk_resrange.begin(), tmp_primtrk_resrange.end());
1226 for(
size_t idx1=0; idx1<tmp_primtrk_dqdx.size()-1; idx1++) {
1227 ke_reco-=tmp_primtrk_pitch[idx1]*tmp_primtrk_dedx[idx1];
1228 double currentDepEng = 0.;
1229 for (
auto iter= orderedSimIDE.begin(); iter!= orderedSimIDE.end(); iter++) {
1230 auto currentIde = iter->second;
1233 if(currentIde.z<
minZ || currentIde.z >
maxZ )
continue;
1234 else if (currentIde.x <
minX || currentIde.x >
maxX )
continue;
1235 else if (currentIde.y <
minY || currentIde.y >
maxY )
continue;
1238 if(cnt==0&¤tIde.trackID>=0) {
1244 tmp_primtrk_hitx_true.push_back(currentIde.x);
1245 tmp_primtrk_hity_true.push_back(currentIde.y);
1246 tmp_primtrk_hitz_true.push_back(currentIde.z);
1247 tmp_primtrk_trkid_true.push_back(currentIde.trackID);
1248 tmp_primtrk_edept_true.push_back(currentIde.energy);
1254 if (currentIde.trackID>=0) {
1255 if(cnt>0 && run_me_onetime) {
1266 tmp_primtrk_hitx_true.push_back(currentIde.x);
1267 tmp_primtrk_hity_true.push_back(currentIde.y);
1268 tmp_primtrk_hitz_true.push_back(currentIde.z);
1269 tmp_primtrk_trkid_true.push_back(currentIde.trackID);
1270 tmp_primtrk_edept_true.push_back(currentIde.energy);
1272 xi=currentIde.x; yi=currentIde.y; zi=currentIde.z;
1278 if ( currentIde.z <= tmp_primtrk_hitz[idx1])
continue;
1279 if ( currentIde.z > tmp_primtrk_hitz[idx1+1])
continue;
1280 currentDepEng += currentIde.energy;
1282 ke_true -= currentDepEng;
1283 run_me_onetime=
false;
1285 if(currentDepEng>0.001) {
1297 for (
auto iter2=orderedSimIDE.begin(); iter2!=orderedSimIDE.end(); iter2++) {
1298 auto currentIde2 = iter2->second;
1301 if(currentIde2.z<
minZ || currentIde2.z >
maxZ )
continue;
1302 else if (currentIde2.x <
minX || currentIde2.x >
maxX )
continue;
1303 else if (currentIde2.y <
minY || currentIde2.y >
maxY )
continue;
1307 tmp_primtrk_true_x.push_back(currentIde2.x);
1308 tmp_primtrk_true_y.push_back(currentIde2.y);
1309 tmp_primtrk_true_z.push_back(currentIde2.z);
1310 tmp_primtrk_true_trkid.push_back(currentIde2.trackID);
1311 tmp_primtrk_true_edept.push_back(currentIde2.energy);
1355 tmp_primtrk_dqdx.clear();
1356 tmp_primtrk_resrange.clear();
1357 tmp_primtrk_dedx.clear();
1358 tmp_primtrk_hitx.clear();
1359 tmp_primtrk_hity.clear();
1360 tmp_primtrk_hitz.clear();
1361 tmp_primtrk_pitch.clear();
1364 tmp_primtrk_hitx_true.clear();
1365 tmp_primtrk_hity_true.clear();
1366 tmp_primtrk_hitz_true.clear();
1367 tmp_primtrk_trkid_true.clear();
1368 tmp_primtrk_edept_true.clear();
1370 tmp_primtrk_true_x.clear();
1371 tmp_primtrk_true_y.clear();
1372 tmp_primtrk_true_z.clear();
1373 tmp_primtrk_true_trkid.clear();
1374 tmp_primtrk_true_edept.clear();
1376 tmp_primtrj_true_x.clear();
1377 tmp_primtrj_true_y.clear();
1378 tmp_primtrj_true_z.clear();
1379 tmp_primtrj_true_edept.clear();
1381 for(
size_t k = 0;
k < calovector.size() &&
k<3;
k++){
1395 if(fmthm.isValid()){
1398 for (
size_t ii = 0; ii<vhit.size(); ++ii){
1399 bool fBadhit =
false;
1405 if (vmeta[ii]->
Index()>=tracklist[
fprimaryID]->NumberTrajectoryPoints()){
1406 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!!";
1423 unsigned int tpc_no=1;
1424 if(xpos<=0 && zpos<232) tpc_no=1;
1425 if(xpos<=0 && zpos>232 && zpos<464) tpc_no=5;
1426 if(xpos<=0 && zpos>=464) tpc_no=9;
1427 if(xpos>0 && zpos<232) tpc_no=2;
1428 if(xpos>0 && zpos>232 && zpos<464) tpc_no=6;
1429 if(xpos>0 && zpos>=464) tpc_no=10;
1432 if (fBadhit)
continue;
1433 if (zpos<-100)
continue;
1434 planenum=vhit[ii]->WireID().Plane;
1438 std::array<float,3> cnn_out=hitResults.
getOutput(vhit[ii]);
1447 x_c.push_back(xpos);
1448 y_c.push_back(ypos);
1449 z_c.push_back(zpos);
1454 tt_c.push_back(detProp.ConvertXToTicks(xpos, planenum, tpc_no, 0));
1480 tt_v.push_back(detProp.ConvertXToTicks(xpos, planenum, tpc_no, 0));
1489 tt_u.push_back(detProp.ConvertXToTicks(xpos, planenum, tpc_no, 0));
1505 std::vector<float> Stw, Endw, Stt, Endt, Stwires, Endwires, Stticks, Endticks, TPCb, TPCcl;
1506 Stw.clear(); Endw.clear(); Stt.clear(); Endt.clear(); Stwires.clear(); Endwires.clear(); Stticks.clear(); Endticks.clear(); TPCb.clear(); TPCcl.clear();
1508 float numw, numt,wire_no,ticks_no;
1509 for(
size_t p1=0;p1<pfplist.size();p1++){
1510 std::vector<art::Ptr<recob::Track>>
trk=pftrack.at(p1);
1511 std::vector<art::Ptr<recob::Cluster>> allClusters=fmcp.at(p1);
1513 for(
size_t c1=0;
c1<allClusters.size();
c1++){
1516 Stw.push_back(allClusters[
c1]->StartWire());
1517 Endw.push_back(allClusters[
c1]->EndWire());
1518 Stt.push_back(allClusters[
c1]->StartTick());
1519 Endt.push_back(allClusters[
c1]->EndTick());
1520 TPCb.push_back(allClusters[
c1]->
Plane().
TPC);
1524 Stwires.push_back(allClusters[
c1]->StartWire());
1525 Endwires.push_back(allClusters[
c1]->EndWire());
1526 Stticks.push_back(allClusters[
c1]->StartTick());
1527 Endticks.push_back(allClusters[
c1]->EndTick());
1528 TPCcl.push_back(allClusters[
c1]->
Plane().
TPC);
1533 for(
size_t clt=0;clt<Stw.size();clt++){
1534 for(
size_t cl1=0;cl1<Stwires.size();cl1++){
1535 if(TPCcl[cl1]!=TPCb[clt])
continue;
1537 den=(Stw[clt]-Endw[clt])*(Stticks[cl1]-Endticks[cl1])-(Stt[clt]-Endt[clt])*(Stwires[cl1]-Endwires[cl1]);
1538 if(den==0)
continue;
1539 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]);
1540 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]);
1544 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))) {
1545 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;
1548 unsigned int wireno=std::round(wire_no);
1551 std::cout<<
"Z position of intersection = "<<xyzStart[2]<<
" "<<xyzEnd[2]<<
" "<<wireno<<
std::endl;
1566 else if(thisShower != 0x0){
1584 if( (thisShower->
dEdx()).
size() > 0 )
1588 std::cout <<
"INFO::Primary pfParticle is not track or shower. Skip!" <<
std::endl;
1605 std::cout <<
"INFO::Number of daughters is " << particle->NumDaughters() <<
". Only the first NMAXDAUGTHERS are processed." <<
std::endl;
1608 for(
const int daughterID : particle->Daughters()){
1611 std::cout <<
"Daughter " << daughterID <<
" has " << daughterParticle->
NumDaughters() <<
" daughters" <<
std::endl;
1616 if(daughterTrack != 0x0){
1641 if(daughtercalovector.size() != 3)
1642 std::cerr <<
"WARNING::Calorimetry vector size for daughter is = " << daughtercalovector.size() <<
std::endl;
1644 for(
size_t k = 0;
k < daughtercalovector.size() &&
k<3;
k++){
1651 if(mcdaughterparticle != 0x0){
1676 std::cout <<
"Daughter Process = " << (mcdaughterparticle->
Process()).c_str()
1677 <<
" , mother = " << mcdaughterparticle->
Mother()
1681 else if(daughterShower != 0x0){
1697 if( (daughterShower->
dEdx()).
size() > 0 )
1701 std::cout <<
"INFO::Daughter pfParticle is not track or shower. Skip!" <<
std::endl;
1730 if(beamTriggerEvent)
1753 for(
int k=0;
k < 5;
k++)
1756 for(
int k=0;
k < 3;
k++){
1780 for(
int l=0;
l < 3;
l++){
1845 for(
int l=0;
l < 4;
l++){
1863 for(
int l=0;
l < 3;
l++){
1889 for(
int l=0;
l < 4;
l++){
double E(const int i=0) const
geo::Length_t WireCoordinate(double YPos, double ZPos, geo::PlaneID const &planeid) const
Returns the index of the nearest wire to the specified position.
std::vector< double > wid_v
std::vector< float > inelscore_c
int fdaughterNHits[NMAXDAUGTHERS]
std::vector< std::vector< double > > primtrj_true_edept
unsigned int NumberTrajectoryPoints() const
std::vector< std::vector< double > > primtrk_true_y
std::vector< double > pfphit_wireid_u
const TVector3 & ShowerStart() const
double fprimary_truth_Theta
double Z(const size_type i) const
double X(const size_type i) const
double EndMomentum() const
double fdaughter_truth_EndPosition[NMAXDAUGTHERS][4]
constexpr std::uint32_t timeLow() const
std::vector< std::vector< double > > primtrj_true_x
int fisdaughtertrack[NMAXDAUGTHERS]
std::vector< double > beamtrk_Eng
std::vector< double > Xintersection
std::vector< double > pfphit_wireid_v
std::vector< double > interactionAngles
double Py(const int i=0) const
double fdaughter_truth_StartPosition[NMAXDAUGTHERS][4]
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.
double fprimaryStartDirection[3]
int NumDaughters() const
Returns the number of daughter particles flowing from this one.
std::vector< double > beamtrk_y
const simb::MCParticle * GetGeantGoodParticle(const simb::MCTruth &genTruth, const art::Event &evt) const
geo::GeometryCore const * fGeometry
double E(const size_type i) const
std::vector< double > interaction_wid_u
std::string primtrk_end_g4process
double fdaughter_truth_EndMomentum[NMAXDAUGTHERS][4]
protonmccnn & operator=(protonmccnn const &)=delete
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 > timeintersection
std::vector< double > beamtrk_z
const recob::TrackTrajectory & Trajectory() const
Access to the stored recob::TrackTrajectory.
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.
std::vector< double > interactionY
double fdaughter_truth_Momentum[NMAXDAUGTHERS][4]
const value_type & at(const size_type i) const
constexpr std::uint32_t timeHigh() const
std::string KeyToProcess(unsigned char const &key) const
virtual void beginJob() override
void FillCosmicsTree(art::Event const &evt, std::string pfParticleTag)
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
int fprimary_truth_NDaughters
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.
std::vector< double > interaction_tt_u
Plane(const Point_t &planePos, const Vector_t &planeDir)
Constructor from reference position on the plane and direction orthogonal to the plane.
int getIndex(const std::string &name) const
Index of column with given name, or -1 if name not found.
std::vector< const sim::IDE * > TrackIdToSimIDEs_Ps(int const &id) const
int fprimary_truth_TrackId
std::vector< double > primtrk_ke_true
double fprimary_truth_EndMomentum[4]
void analyze(art::Event const &evt) override
std::vector< double > beamtrk_Py
int fdaughter_truth_Process[NMAXDAUGTHERS]
double fdaughterLength[NMAXDAUGTHERS]
EDAnalyzer(fhicl::ParameterSet const &pset)
std::string Process() const
double fdaughterMomentum[NMAXDAUGTHERS]
std::vector< std::vector< double > > primtrk_true_x
unsigned char ProcessToKey(std::string const &process) const
double fprimaryMomentumByRangeMuon
std::vector< double > wid_u
std::string fprimary_truth_EndProcess
std::vector< std::vector< double > > primtrk_dqdx
double fprimaryOpeningAngle
int NumberDaughters() const
std::vector< std::vector< double > > primtrk_hity_true
std::vector< std::vector< double > > primtrj_true_y
virtual void endJob() override
protoana::ProtoDUNETruthUtils truthUtil
std::vector< double > tt_u
std::vector< double > wid_c
double fprimary_truth_Momentum[4]
std::vector< double > pos_ff
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
double fdaughterMomentumByRangeProton[NMAXDAUGTHERS]
double fprimary_truth_Phi
protoana::ProtoDUNEDataUtils dataUtil
std::string fCalorimetryTag
double fprimaryShowerEnergy
double Pt(const int i=0) const
int fisdaughtershower[NMAXDAUGTHERS]
double fdaughter_truth_P[NMAXDAUGTHERS]
double fprimaryEndPosition[3]
protoana::ProtoDUNETrackUtils trackUtil
double Length(size_t p=0) const
Access to various track properties.
double Y(const size_type i) const
const std::vector< double > & dEdx() const
#define DEFINE_ART_MODULE(klass)
const std::vector< double > & MIPEnergy() const
double fdaughter_truth_Mass[NMAXDAUGTHERS]
std::vector< double > pfphit_wireid_c
double Theta() const
Access to spherical or geographical angles at vertex or at any point.
double fdaughterKineticEnergy[NMAXDAUGTHERS][3]
double P(const int i=0) const
double fprimaryKineticEnergy[3]
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.
double fprimary_truth_EndPosition_MC[4]
double T(const int i=0) const
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
double fprimaryShowerdEdx
std::vector< double > beamtrk_x
std::vector< std::vector< double > > primtrk_hity
double fprimaryStartPosition[3]
int fprimary_truth_Isbeammatched
SubRunNumber_t subRun() const
std::vector< double > interaction_tt_c
double fdaughter_truth_Pt[NMAXDAUGTHERS]
std::vector< std::vector< double > > primtrk_hitz_true
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...
double fdaughterPhi[NMAXDAUGTHERS]
const TVector3 & Direction() const
double fdaughter_truth_Phi[NMAXDAUGTHERS]
std::vector< double > interaction_wid_c
static int max(int a, int b)
double fdaughterOpeningAngle[NMAXDAUGTHERS]
Description of geometry of one entire detector.
ProcessMap const & TrajectoryProcesses() const
std::vector< double > interaction_tt_v
double fprimary_truth_StartPosition_MC[4]
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
double fdaughterTheta[NMAXDAUGTHERS]
double fdaughterShowerdEdx[NMAXDAUGTHERS]
std::vector< double > interactionZ
std::vector< double > primtrk_range
int fdaughterID[NMAXDAUGTHERS]
const sim::ParticleList & ParticleList() const
double fdaughterStartPosition[NMAXDAUGTHERS][3]
std::vector< double > pfphit_peaktime_c
std::string fGeneratorTag
Vector_t EndDirection() const
Returns the direction of the trajectory at the last point.
std::vector< double > beamtrk_Pz
double fprimaryEndDirection[3]
double Vx(const int i=0) const
protoana::ProtoDUNEPFParticleUtils pfpUtil
std::string fPFParticleTag
std::vector< std::vector< double > > primtrk_true_edept
double fbeamtrackMomentum
const art::InputTag fBeamModuleLabel
Declaration of signal hit object.
std::vector< std::vector< double > > primtrk_hitz
double StartMomentum() const
std::vector< double > Yintersection
Hierarchical representation of particle flow.
std::vector< std::vector< double > > primtrk_dedx
double fprimaryMomentumByRangeProton
int fdaughter_truth_TrackId[NMAXDAUGTHERS]
int GetNActiveFembsForAPA(art::Event const &evt, int apa) const
Get number of active fembs in an APA.
static unsigned int reverse(QString &chars, unsigned char *level, unsigned int a, unsigned int b)
double fdaughter_truth_Theta[NMAXDAUGTHERS]
double fdaughterShowerEnergy[NMAXDAUGTHERS]
Point_t const & End() const
Returns the position of the last valid point of the trajectory [cm].
std::vector< float > elscore_c
std::vector< std::vector< double > > primtrk_true_z
const TLorentzVector & Momentum(const int i=0) const
double Pz(const int i=0) const
Provides recob::Track data product.
double fdaughterEndDirection[NMAXDAUGTHERS][3]
double fprimary_truth_Mass
double Vz(const int i=0) const
int fdaughter_truth_Pdg[NMAXDAUGTHERS]
double fdaughterShowerMIPEnergy[NMAXDAUGTHERS]
void WireEndPoints(geo::WireID const &wireid, double *xyzStart, double *xyzEnd) const
Fills two arrays with the coordinates of the wire end points.
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
int fprimaryShowerBestPlane
std::vector< double > beamtrk_Px
std::vector< double > interactionE
double fdaughterRange[NMAXDAUGTHERS][3]
std::vector< std::vector< double > > primtrk_resrange
std::vector< double > pfphit_peaktime_u
std::vector< std::vector< double > > primtrk_edept_true
double fprimaryShowerMIPEnergy
2D representation of charge deposited in the TDC/wire plane
std::vector< std::vector< double > > primtrk_trkid_true
std::vector< double > Zintersection
std::vector< std::vector< double > > primtrk_true_trkid
std::vector< std::vector< double > > primtrj_true_z
double fdaughterMomentumByRangeMuon[NMAXDAUGTHERS]
std::vector< double > pfphit_peaktime_v
auto const & get(AssnsNode< L, R, D > const &r)
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
std::vector< std::string > interactionProcesslist
std::vector< float > nonescore_c
const art::InputTag fNNetModuleLabel
unsigned int GetNumberPrimaryPFParticle(art::Event const &evt, const std::string particleLabel) const
Get the number of primary PFParticles.
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.
std::vector< double > tt_c
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
double fprimary_truth_EndPosition[4]
recob::tracking::Plane Plane
double fdaughterStartDirection[NMAXDAUGTHERS][3]
std::vector< double > tt_v
Point_t const & Start() const
Returns the position of the first valid point of the trajectory [cm].
std::vector< double > primtrk_ke_reco
std::vector< double > interactionX
std::array< float, N > getOutput(size_t key) const
Get copy of the MVA output vector at index "key".
std::vector< double > interaction_wid_v
std::vector< double > primtrk_range_true
int fdaughterShowerBestPlane[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.
std::vector< std::vector< double > > primtrk_hitx
double Vy(const int i=0) const
std::vector< std::vector< double > > primtrk_hitx_true
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
double fprimary_truth_StartPosition[4]
QTextStream & endl(QTextStream &s)
bool IsBeamTrigger(art::Event const &evt) const
std::vector< std::vector< double > > primtrk_pitch
protonmccnn(fhicl::ParameterSet const &p)
double fprimaryEndMomentum
double fdaughterEndMomentum[NMAXDAUGTHERS]
double fdaughterEndPosition[NMAXDAUGTHERS][3]