26 const simb::MCParticle & mcpart,
const std::vector< const recob::Hit * > & hitsVec,
27 bool delta_ray,
bool use_eve )
const {
29 std::vector<const recob::Hit*> outVec;
36 int trackId = ide.trackID;
37 if( !delta_ray && ( trackId == mcpart.
TrackId() ) ){
38 outVec.push_back(hitp);
41 else if( delta_ray && ( trackId == (-1*mcpart.
TrackId()) ) ) {
42 outVec.push_back(hitp);
48 for(
const int & trackId : bt_serv->
HitToTrackIds(clockData, *hitp)) {
49 if( !delta_ray && ( trackId == mcpart.
TrackId() ) ){
50 outVec.push_back(hitp);
53 else if( delta_ray && ( trackId == (-1*mcpart.
TrackId()) ) ) {
54 outVec.push_back(hitp);
72 std::vector<const recob::Hit*> pfpHits = pfpUtils.
GetPFParticleHits(pfpart, evt, pfparticleModule);
85 std::vector<const recob::Hit*> trackHits = trackUtils.
GetRecoTrackHits(track, evt, trackModule);
97 std::vector<const recob::Hit*> shHits = shUtils.
GetRecoShowerHits(shower, evt, showerModule);
108 bool use_eve)
const {
109 std::vector<const recob::Hit*> outVec;
111 auto hitHandle = evt.
getHandle<std::vector<recob::Hit> >(hitModule);
113 std::cout <<
"protoana::ProtoDUNETruthUtils::GetMCParticleHits: could not find hits in event.\n";
123 int trackId = ide.trackID;
126 outVec.push_back(&
hit);
135 outVec.push_back(&
hit);
148 template <
typename T>
158 if(mcmatch == 0x0) {
return 0; }
160 const std::vector<const recob::Hit*> MCHits =
GetMCParticleHits(clockData, *mcmatch, evt, hitModule);
161 if(MCHits.size() == 0) {
return 0; }
163 const std::vector<const recob::Hit*> sharedHits =
GetSharedHits(clockData, *mcmatch, recobj, evt, recoModule);
165 return (
double)sharedHits.size() / MCHits.size();
167 template double protoana::ProtoDUNETruthUtils::GetCompleteness<recob::PFParticle>
169 template double protoana::ProtoDUNETruthUtils::GetCompleteness<recob::Track>
171 template double protoana::ProtoDUNETruthUtils::GetCompleteness<recob::Shower>
178 const recob::PFParticle &pfpart,
179 const art::Event &evt, std::string pfparticleModule)
const {
183 if(mcmatch == 0x0) {
return 0; }
185 const std::vector<const recob::Hit*> sharedHits =
GetSharedHits(clockData, *mcmatch, pfpart, evt, pfparticleModule);
189 std::vector<const recob::Hit*> pfpHits = pfpUtils.
GetPFParticleHits(pfpart, evt, pfparticleModule);
191 return (
double)sharedHits.size() / pfpHits.size();
198 const recob::Track &track,
199 const art::Event &evt, std::string trackModule)
const {
203 if(mcmatch == 0x0) {
return 0; }
205 const std::vector<const recob::Hit*> sharedHits =
GetSharedHits(clockData, *mcmatch, track, evt, trackModule);
209 std::vector<const recob::Hit*> trackHits = trackUtils.
GetRecoTrackHits(track, evt, trackModule);
211 return (
double)sharedHits.size() / trackHits.size();
218 const recob::Shower &shower,
219 const art::Event &evt, std::string showerModule)
const {
223 if(mcmatch == 0x0) {
return 0; }
225 const std::vector<const recob::Hit*> sharedHits =
GetSharedHits(clockData, *mcmatch, shower, evt, showerModule);
229 std::vector<const recob::Hit*> showerHits = showerUtils.
GetRecoShowerHits(shower, evt, showerModule);
231 return (
double)sharedHits.size() / showerHits.size();
236 std::vector<std::pair<const simb::MCParticle*, double>>
238 (detinfo::DetectorClocksData
const& clockData,
239 const std::vector<const recob::Hit*>& hitVec,
bool use_eve)
const {
241 using weightedMCPair = std::pair<const simb::MCParticle*, double>;
242 std::vector<weightedMCPair> outVec;
247 std::unordered_map<const simb::MCParticle*, double> mcEMap;
248 double hitTotalE = 0;
253 mcEMap[curr_part] += ide.energy;
254 hitTotalE += ide.energy;
260 mcEMap[curr_part] += ide.energy;
261 hitTotalE += ide.energy;
267 for (weightedMCPair
const&
p : mcEMap) {
270 std::sort(outVec.begin(), outVec.end(),
271 [](weightedMCPair
a, weightedMCPair
b){
return a.second >
b.second;});
274 if (hitTotalE < 1
e-5) { hitTotalE = 1; }
275 for (weightedMCPair&
p : outVec) {
276 p.second /= hitTotalE;
284 std::vector<std::pair<const simb::MCParticle*, double>>
286 (detinfo::DetectorClocksData
const& clockData,
287 const std::vector<const recob::Hit*>& hitVec)
const {
289 using weightedMCPair = std::pair<const simb::MCParticle*, double>;
290 std::vector<weightedMCPair> outVec;
295 std::unordered_map<const simb::MCParticle*, double> mcEMap;
296 double hitTotalE = 0;
300 mcEMap[curr_part] += ide.energy;
301 hitTotalE += ide.energy;
306 for (weightedMCPair
const&
p : mcEMap) {
309 std::sort(outVec.begin(), outVec.end(),
310 [](weightedMCPair
a, weightedMCPair
b){
return a.second >
b.second;});
313 if (hitTotalE < 1
e-5) { hitTotalE = 1; }
314 for (weightedMCPair&
p : outVec) {
315 p.second /= hitTotalE;
323 std::vector<std::pair<const simb::MCParticle*, double>>
325 (detinfo::DetectorClocksData
const& clockData,
326 const recob::PFParticle &pfpart, art::Event
const & evt, std::string pfparticleModule)
const {
328 std::vector<std::pair<const simb::MCParticle*, double>> outVec;
335 std::vector<const recob::Hit*> pfpHits = pfpUtils.
GetPFParticleHits(pfpart, evt, pfparticleModule);
347 std::vector<std::pair<const recob::PFParticle*, double>>
349 (detinfo::DetectorClocksData
const& clockData,
350 const simb::MCParticle &part, art::Event
const & evt, std::string pfparticleModule,
bool use_eve)
const {
352 using weightedPFPair = std::pair<const recob::PFParticle*, double>;
354 std::vector<weightedPFPair> outVec;
360 auto allPFParticles = evt.
getValidHandle<std::vector<recob::PFParticle> >(pfparticleModule);
364 std::unordered_map<const recob::PFParticle*, double> pfpEMap;
365 double pfpTotalE = 0;
366 for(
const recob::PFParticle& pfpart : *allPFParticles) {
369 for(
const sim::TrackIDE& ide : bt_serv->HitToEveTrackIDEs(clockData, *hitp)) {
370 if(ide.trackID == part.
TrackId()) {
371 pfpEMap[&pfpart] += ide.energy;
373 pfpTotalE += ide.energy;
377 for(
const sim::TrackIDE& ide : bt_serv->HitToTrackIDEs(clockData, *hitp)) {
378 if(ide.trackID == part.
TrackId()) {
379 pfpEMap[&pfpart] += ide.energy;
381 pfpTotalE += ide.energy;
388 for (weightedPFPair
const&
p : pfpEMap) {
391 std::sort(outVec.begin(), outVec.end(),
392 [](weightedPFPair
a, weightedPFPair
b){
return a.second >
b.second;});
395 if (pfpTotalE < 1
e-5) { pfpTotalE = 1; }
396 for (weightedPFPair&
p : outVec) {
397 p.second /= pfpTotalE;
405 std::vector<std::pair<const simb::MCParticle*, double>>
407 (detinfo::DetectorClocksData
const& clockData,
408 const recob::Track &track, art::Event
const & evt, std::string trackModule)
const {
415 std::vector<const recob::Hit*> trackHits = trackUtils.
GetRecoTrackHits(track, evt, trackModule);
422 std::vector<std::pair<const recob::Track*, double>>
424 (detinfo::DetectorClocksData
const& clockData,
425 const simb::MCParticle &part, art::Event
const & evt, std::string trackModule)
const{
427 using weightedTrackPair = std::pair<const recob::Track*, double>;
429 std::vector<weightedTrackPair> outVec;
435 auto allRecoTracks = evt.
getValidHandle<std::vector<recob::Track> >(trackModule);
438 const art::FindManyP<recob::Hit> findTrackHits(allRecoTracks, evt, trackModule);
441 std::unordered_map<int, double> recoTrack;
445 for (recob::Track
const & track : *allRecoTracks)
454 if (ide->trackID == part.
TrackId())
456 recoTrack[track.
ID()] += ide->energy;
458 part_E += ide->energy;
464 for (std::pair<int, double>
const&
p : recoTrack)
466 auto const trackIt = std::find_if(allRecoTracks->begin(), allRecoTracks->end(),
467 [&](recob::Track tr){
return tr.ID() ==
p.first; });
468 outVec.push_back(std::make_pair(&*trackIt,
p.second));
470 std::sort(outVec.begin(), outVec.end(),
471 [](weightedTrackPair
a, weightedTrackPair
b){
return a.second >
b.second;});
474 if (part_E < 1
e-5) { part_E = 1; }
475 for (weightedTrackPair&
p : outVec)
485 std::vector<std::pair<const simb::MCParticle*, double>>
487 (detinfo::DetectorClocksData
const& clockData,
488 const recob::Shower &shower, art::Event
const & evt, std::string showerModule)
const{
495 std::vector<const recob::Hit*> showerHits = showerUtils.
GetRecoShowerHits(shower, evt, showerModule);
502 std::vector<std::pair<const recob::Shower*, double>>
504 (detinfo::DetectorClocksData
const& clockData,
505 const simb::MCParticle &part, art::Event
const & evt, std::string showerModule)
const{
507 using weightedShowerPair = std::pair<const recob::Shower*, double>;
509 std::vector<weightedShowerPair> outVec;
515 auto allRecoShowers = evt.
getValidHandle<std::vector<recob::Shower> >(showerModule);
518 const art::FindManyP<recob::Hit> findShowerHits(allRecoShowers, evt, showerModule);
522 std::unordered_map<int, double> recoShower;
526 for (recob::Shower
const & shower : *allRecoShowers)
528 const unsigned showerIndex = shUtils.
GetShowerIndex(shower, evt, showerModule);
535 if (ide.trackID == part.
TrackId())
537 recoShower[showerIndex] += ide.energy;
539 part_E += ide.energy;
545 for (std::pair<int, double>
const&
p : recoShower)
547 auto const showerIt = std::find_if(allRecoShowers->begin(), allRecoShowers->end(),
548 [&](recob::Shower sh){
return shUtils.
GetShowerIndex(sh, evt, showerModule) ==
p.first; });
549 outVec.push_back(std::make_pair(&*showerIt,
p.second));
551 std::sort(outVec.begin(), outVec.end(),
552 [](weightedShowerPair
a, weightedShowerPair
b){
return a.second >
b.second;});
555 if (part_E < 1
e-5) { part_E = 1; }
556 std::for_each(outVec.begin(), outVec.end(),
557 [&](weightedShowerPair&
p){
p.second /= part_E; });
565 (detinfo::DetectorClocksData
const& clockData,
566 const recob::PFParticle &pfpart, art::Event
const & evt, std::string pfparticleModule)
const{
570 const std::vector<std::pair<const simb::MCParticle*, double>> inVec =
573 if (inVec.size() != 0) outPart = inVec[0].first;
582 (detinfo::DetectorClocksData
const& clockData,
583 const simb::MCParticle &part, art::Event
const & evt, std::string pfparticleModule)
const {
585 const recob::PFParticle* outPFPart = 0x0;
592 for (std::pair<const recob::PFParticle*, double>
p :
595 const recob::PFParticle* pfp =
p.first;
609 (detinfo::DetectorClocksData
const& clockData,
610 const recob::Track &track, art::Event
const & evt, std::string trackModule)
const{
614 const std::vector<std::pair<const simb::MCParticle*, double>> inVec =
617 if (inVec.size() != 0) outPart = inVec[0].first;
626 (detinfo::DetectorClocksData
const& clockData,
627 const simb::MCParticle &part, art::Event
const & evt, std::string trackModule)
const {
629 const recob::Track* outTrack = 0x0;
636 for (std::pair<const recob::Track*, double>
p :
639 const recob::Track* tr =
p.first;
653 (detinfo::DetectorClocksData
const& clockData,
654 const recob::Shower &shower, art::Event
const & evt, std::string showerModule)
const{
658 const std::vector<std::pair<const simb::MCParticle*, double>> inVec =
661 if (inVec.size() != 0) outPart = inVec[0].first;
670 (detinfo::DetectorClocksData
const& clockData,
671 const simb::MCParticle &part, art::Event
const & evt, std::string showerModule)
const {
673 const recob::Shower* outShower = 0x0;
680 for (std::pair<const recob::Shower*, double>
p :
683 const recob::Shower* tr =
p.first;
696 (detinfo::DetectorClocksData
const& clockData,
697 const recob::PFParticle &pfpart, art::Event
const &evt, std::string pfparticleModule)
const {
701 (detinfo::DetectorClocksData
const& clockData,
702 const recob::Track &track, art::Event
const &evt, std::string trackModule)
const {
706 (detinfo::DetectorClocksData
const& clockData,
707 const recob::Shower &shower, art::Event
const &evt, std::string showerModule)
const {
712 std::vector<std::pair<const simb::MCParticle*, double>>
714 (detinfo::DetectorClocksData
const& clockData,
715 const recob::PFParticle &pfpart, art::Event
const &evt, std::string pfparticleModule)
const {
718 std::vector<std::pair<const simb::MCParticle*, double>>
720 (detinfo::DetectorClocksData
const& clockData,
721 const recob::Track &track, art::Event
const &evt, std::string trackModule)
const {
724 std::vector<std::pair<const simb::MCParticle*, double>>
726 (detinfo::DetectorClocksData
const& clockData,
727 const recob::Shower &shower, art::Event
const &evt, std::string showerModule)
const {
734 template <
typename T>
736 std::vector< protoana::MCParticleSharedHits >
738 const T &recobj,
const art::Event &evt, std::string recoModule, std::string hitModule)
const {
741 const std::vector< std::pair< const simb::MCParticle*, double > > mcparts =
GetMCParticleListFromReco(clockData, recobj, evt, recoModule );
745 std::vector< protoana::MCParticleSharedHits > results;
747 for(
const std::pair< const simb::MCParticle*, double > part : mcparts ){
749 const std::vector<const recob::Hit*> hits =
GetSharedHits(clockData, *(part.first), recobj, evt, recoModule);
752 const std::vector<const recob::Hit*> dr_hits =
GetSharedHits(clockData, *(part.first), recobj, evt, recoModule,
true);
758 results.push_back( entry );
765 std::sort( results.begin(), results.end(),
774 (detinfo::DetectorClocksData
const&,
778 (detinfo::DetectorClocksData
const&,
782 (detinfo::DetectorClocksData
const&,
787 template <
typename T>
789 const T &recobj,
const art::Event &evt, std::string recoModule, std::string hitModule )
const {
798 if( !list.size() )
return dummy;
806 (
const detinfo::DetectorClocksData&,
const recob::PFParticle&,
const art::Event&,
std::string,
std::string)
const;
808 (
const detinfo::DetectorClocksData&,
const recob::Track&,
const art::Event&,
std::string,
std::string)
const;
810 (
const detinfo::DetectorClocksData&,
const recob::Shower&,
const art::Event&,
std::string,
std::string)
const;
817 double pDuneEnergy = pDunePart.
E();
821 const sim::ParticleList & plist = pi_serv->
ParticleList();
824 if ( !plist.size() ) {
825 std::cerr <<
"\n\n#####################################\n" 826 <<
"\nEvent " << evt.
id().
event() <<
"\n" 827 <<
"sim::ParticleList from cheat::ParticleInventoryService is empty\n" 828 <<
"A null pointer will be returned\n" 829 <<
"#####################################\n\n";
834 for (
auto partIt = plist.begin() ; partIt != plist.end() ; partIt++ ) {
838 std::cerr <<
"\n\n#####################################\n" 839 <<
"\nEvent " << evt.
id().
event() <<
"\n" 840 <<
"GEANT particle #" << partIt->first <<
" returned a null pointer\n" 841 <<
"This is not necessarily bad. It just means at least one\n" 842 <<
"of the G4 particles returned a null pointer. It may well\n" 843 <<
"have still matched a PD particle and a G4 particle.\n" 844 <<
"#####################################\n\n";
849 if ( (pDunePart.
PdgCode() == pPart->
PdgCode()) && fabs(pPart->
E() - pDuneEnergy) < 0.00001 ) {
855 std::cout <<
"No G4 particle was matched for Event " << evt.
id().
event() <<
". Null pointer returned\n";
867 if(part.
Process() ==
"primary"){
875 std::cerr <<
"No good particle found, returning null pointer" <<
std::endl;
882 const sim::ParticleList & plist = pi_serv->
ParticleList();
884 for(
auto const part : plist){
885 if((goodPart.
PdgCode() == part.second->
PdgCode()) && fabs(part.second->
E() - goodPart.
E()) < 1
e-5){
891 std::cerr <<
"No G4 version of the good particle was found, returning null pointer" <<
std::endl;
904 const float trueTime)
const{
915 const float trueTime)
const{
923 if(process.compare(
"primary") == 0)
return 0;
924 else if(process.compare(
"hadElastic") == 0)
return 1;
925 else if(process.compare(
"pi-Inelastic") == 0)
return 2;
926 else if(process.compare(
"pi+Inelastic") == 0)
return 3;
927 else if(process.compare(
"kaon-Inelastic") == 0)
return 4;
928 else if(process.compare(
"kaon+Inelastic") == 0)
return 5;
929 else if(process.compare(
"protonInelastic") == 0)
return 6;
930 else if(process.compare(
"neutronInelastic") == 0)
return 7;
931 else if(process.compare(
"kaon0SInelastic") == 0)
return 8;
932 else if(process.compare(
"kaon0LInelastic") == 0)
return 9;
933 else if(process.compare(
"lambdaInelastic") == 0)
return 10;
934 else if(process.compare(
"omega-Inelastic") == 0)
return 11;
935 else if(process.compare(
"sigma+Inelastic") == 0)
return 12;
936 else if(process.compare(
"sigma-Inelastic") == 0)
return 13;
937 else if(process.compare(
"sigma0Inelastic") == 0)
return 14;
938 else if(process.compare(
"xi-Inelastic") == 0)
return 15;
939 else if(process.compare(
"xi0Inelastic") == 0)
return 16;
940 else if(process.compare(
"anti_protonInelastic") == 0)
return 20;
941 else if(process.compare(
"anti_neutronInelastic") == 0)
return 21;
942 else if(process.compare(
"anti_lambdaInelastic") == 0)
return 22;
943 else if(process.compare(
"anti_omega-Inelastic") == 0)
return 23;
944 else if(process.compare(
"anti_sigma+Inelastic") == 0)
return 24;
945 else if(process.compare(
"anti_sigma-Inelastic") == 0)
return 25;
946 else if(process.compare(
"anti_xi-Inelastic") == 0)
return 26;
947 else if(process.compare(
"anti_xi0Inelastic") == 0)
return 27;
949 else if(process.compare(
"Decay") == 0)
return 30;
950 else if(process.compare(
"FastScintillation") == 0)
return 31;
951 else if(process.compare(
"nKiller") == 0)
return 32;
952 else if(process.compare(
"nCapture") == 0)
return 33;
954 else if(process.compare(
"compt") == 0)
return 40;
955 else if(process.compare(
"rayleigh") == 0)
return 41;
956 else if(process.compare(
"phot") == 0)
return 42;
957 else if(process.compare(
"conv") == 0)
return 43;
958 else if(process.compare(
"CoupledTransportation") == 0)
return 44;
968 auto simchannelHandle = evt.
getHandle< std::vector<sim::SimChannel> >(
"largeant");
969 if (simchannelHandle) {
971 for(
auto const& simchannel : (*simchannelHandle)){
973 if(fGeom->
View(simchannel.Channel()) != whichview)
continue;
975 auto const& alltimeslices = simchannel.TDCIDEMap();
977 for(
auto const& tslice : alltimeslices){
978 auto const& simide = tslice.second;
980 for(
auto const& eDep : simide){
981 if(eDep.trackID == trackid || eDep.trackID == -trackid)
995 int firstpoint = -999;
997 if(mcpart.
Vx(i) >= tpcactiveXlow && mcpart.
Vx(i) <= tpcactiveXhigh && mcpart.
Vy(i) >= tpcactiveYlow && mcpart.
Vy(i) <= tpcactiveYhigh && mcpart.
Vz(i) >= tpcactiveZlow && mcpart.
Vz(i) <= tpcactiveZhigh){
1010 double length = 0.0;
1013 if(firstpoint < 0)
return length;
1015 TVector3
pos = mcpart.
Position(firstpoint).Vect();
1017 if(mcpart.
Vx(i) >= tpcactiveXlow && mcpart.
Vx(i) <= tpcactiveXhigh && mcpart.
Vy(i) >= tpcactiveYlow && mcpart.
Vy(i) <= tpcactiveYhigh && mcpart.
Vz(i) >= tpcactiveZlow && mcpart.
Vz(i) <= tpcactiveZhigh){
1020 length += pos.Mag();
1033 if(firstpoint < 0)
return 0.0;
1040 double plength = 0.0;
1041 TVector3
pos = mcpart.
Position(firstpoint).Vect();
1042 for(
int i = firstpoint+1; i < ntrajpoints-1; ++i) {
1043 if(mcpart.
Vx(i) >= tpcactiveXlow && mcpart.
Vx(i) <= tpcactiveXhigh && mcpart.
Vy(i) >= tpcactiveYlow && mcpart.
Vy(i) <= tpcactiveYhigh && mcpart.
Vz(i) >= tpcactiveZlow && mcpart.
Vz(i) <= tpcactiveZhigh){
1046 plength += pos.Mag();
1050 if(plength == 0.0)
return 0.0;
1052 double length_laststep = length - plength;
1053 if(length_laststep <= 0.0)
return 0.0;
1056 double kinene_start = std::sqrt(mcpart.
P(firstpoint)*mcpart.
P(firstpoint) + mcpart.
Mass()*mcpart.
Mass()) - mcpart.
Mass();
1057 double kinene_end = std::sqrt(mcpart.
P(ntrajpoints-2)*mcpart.
P(ntrajpoints-2) + mcpart.
Mass()*mcpart.
Mass()) - mcpart.
Mass();
1058 double eneloss = (kinene_start - kinene_end);
1059 if(eneloss < 0.0 || kinene_start <= 0.0)
return 0.0;
1062 double aveneloss_laststep = length_laststep*eneloss/plength;
1064 return aveneloss_laststep;
1072 double kinene_end = std::sqrt(mcpart.
P(ntrajpoints-2)*mcpart.
P(ntrajpoints-2) + mcpart.
Mass()*mcpart.
Mass()) - mcpart.
Mass();
1074 return (kinene_end - kinene_lastpoint);
1078 std::map< size_t, std::vector< const sim::IDE * > >
1089 std::sort( ides.begin(), ides.end(),
sort_IDEs );
1091 std::map< size_t, std::vector< const sim::IDE * > > results;
1093 size_t ide_start = 0;
1095 for(
size_t i = 0; i < mctraj.
size(); ++i ){
1096 results[i] = std::vector< const sim::IDE * >();
1098 for(
size_t j = ide_start; j < ides.size(); ++j ){
1100 if( ( ides[j]->
z > mctraj.
Z(i) ) && ( ides[j]->
z < mctraj.
Z(i+1) ) ){
1101 results[i].push_back( ides[j] );
1104 else if( ( ides[j]->
z < mctraj.
Z(i) ) && ( ides[j]->
z < mctraj.
Z(i+1) ) ){
1118 std::vector<const sim::IDE*>
1120 const TLorentzVector & p1,
1121 const TLorentzVector &p2)
1125 std::vector<const sim::IDE *> ides =
1128 std::vector<const sim::IDE *> results;
1129 for (
const sim::IDE * theIDE : ides) {
1130 if (theIDE->z > p1.Z() && theIDE->z < p2.Z()
1133 results.push_back(theIDE);
1141 const art::Event & evt, std::string pfpTag, std::string hitTag ){
1143 std::map< int, std::vector< int > > results;
1145 auto allPFPs = evt.
getValidHandle< std::vector< recob::PFParticle > >( pfpTag );
1147 for(
size_t i = 0; i < allPFPs->size(); ++i ){
1148 auto thePFP = &(allPFPs->at(i));
1159 return( i1->
z < i2->
z );
double E(const int i=0) const
unsigned int NumberTrajectoryPoints() const
const TLorentzVector & Position(const int i=0) const
double Z(const size_type i) const
const std::vector< const recob::Hit * > GetRecoShowerHits(const recob::Shower &shower, art::Event const &evt, const std::string showerModule) const
Get the hits from a given reco shower.
float z
z position of ionization [cm]
std::vector< std::pair< const simb::MCParticle *, double > > GetMCParticleListFromTrackHits(detinfo::DetectorClocksData const &clockData, const std::vector< const recob::Hit * > &hitVec, bool use_eve=true) const
double GetDepEnergyMC(const art::Event &evt, geo::GeometryCore const *fGeom, int trackid, int whichview) const
const simb::MCParticle * GetGeantGoodParticle(const simb::MCTruth &genTruth, const art::Event &evt) const
const recob::Shower * GetRecoShowerFromMCParticle(detinfo::DetectorClocksData const &clockData, const simb::MCParticle &part, art::Event const &evt, std::string showerModule) const
std::vector< art::Ptr< recob::Hit > > TrackIdToHits_Ps(detinfo::DetectorClocksData const &clockData, int tkId, std::vector< art::Ptr< recob::Hit >> const &hitsIn) const
std::vector< sim::TrackIDE > HitToTrackIDEs(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
Handle< PROD > getHandle(SelectorBase const &) const
template const protoana::MCParticleSharedHits protoana::ProtoDUNETruthUtils::GetMCParticleByHits< recob::PFParticle >(const detinfo::DetectorClocksData &, const recob::PFParticle &, const art::Event &, std::string, std::string) const
const simb::MCTrajectory & Trajectory() const
const simb::MCParticle * TrackIdToParticle_P(int id) const
double GetCompleteness(detinfo::DetectorClocksData const &clockData, const T &recobj, const art::Event &evt, std::string recoModule, std::string hitModule) const
template std::vector< protoana::MCParticleSharedHits > protoana::ProtoDUNETruthUtils::GetMCParticleListByHits< recob::Shower >(detinfo::DetectorClocksData const &, const recob::Shower &, const art::Event &, std::string, std::string) const
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.
template const protoana::MCParticleSharedHits protoana::ProtoDUNETruthUtils::GetMCParticleByHits< recob::Shower >(const detinfo::DetectorClocksData &, const recob::Shower &, const art::Event &, std::string, std::string) const
std::vector< const sim::IDE * > TrackIdToSimIDEs_Ps(int const &id) const
int PdgCode() const
Return the type of particle as a PDG ID.
const MCParticleSharedHits GetMCParticleByHits(detinfo::DetectorClocksData const &clockData, const T &recobj, const art::Event &evt, std::string recoModule, std::string hitModule) const
const float ConvertTrueTimeToPandoraTimeNano(detinfo::DetectorClocksData const &clockData, const simb::MCParticle &part) const
std::string Process() const
template std::vector< protoana::MCParticleSharedHits > protoana::ProtoDUNETruthUtils::GetMCParticleListByHits< recob::Track >(detinfo::DetectorClocksData const &, const recob::Track &, const art::Event &, std::string, std::string) const
const recob::PFParticle * GetPFParticleFromMCParticle(detinfo::DetectorClocksData const &clockData, const simb::MCParticle &part, art::Event const &evt, std::string pfparticleModule) const
std::vector< int > HitToTrackIds(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
template std::vector< protoana::MCParticleSharedHits > protoana::ProtoDUNETruthUtils::GetMCParticleListByHits< recob::PFParticle >(detinfo::DetectorClocksData const &, const recob::PFParticle &, const art::Event &, std::string, std::string) const
double GetKinEnergyAtVertex(const simb::MCParticle &mcpart, double kinene_lastpoint=0.0)
double GetDepEnergyAtLastTrajPoint(const simb::MCParticle &mcpart, double tpcactiveXlow, double tpcactiveXhigh, double tpcactiveYlow, double tpcactiveYhigh, double tpcactiveZlow, double tpcactiveZhigh)
double GetMCParticleLengthInTPCActiveVolume(const simb::MCParticle &mcpart, double tpcactiveXlow, double tpcactiveXhigh, double tpcactiveYlow, double tpcactiveYhigh, double tpcactiveZlow, double tpcactiveZhigh)
std::vector< const recob::Hit * > GetMCParticleHits(detinfo::DetectorClocksData const &clockData, const simb::MCParticle &mcpart, const art::Event &evt, std::string hitModule, bool use_eve=true) const
const simb::MCParticle * GetMCParticleFromReco(detinfo::DetectorClocksData const &clockData, const recob::PFParticle &pfpart, art::Event const &evt, std::string pfparticleModule) const
std::vector< MCParticleSharedHits > GetMCParticleListByHits(detinfo::DetectorClocksData const &clockData, const T &recobj, const art::Event &evt, std::string recoModule, std::string hitModule) const
std::vector< const recob::Hit * > FillSharedHits(detinfo::DetectorClocksData const &clockData, const simb::MCParticle &mcpart, const std::vector< const recob::Hit * > &hitsVec, bool delta_ray, bool use_eve=true) const
std::map< int, std::vector< int > > GetMapMCToPFPs_ByHits(detinfo::DetectorClocksData const &clockData, const art::Event &evt, std::string pfpTag, std::string hitTag)
const recob::Track * GetRecoTrackFromMCParticle(detinfo::DetectorClocksData const &clockData, const simb::MCParticle &part, art::Event const &evt, std::string trackModule) const
double GetPurity(detinfo::DetectorClocksData const &clockData, const recob::PFParticle &pfpart, const art::Event &evt, std::string pfparticleModule) const
int GetShowerIndex(const recob::Shower &shower, art::Event const &evt, const std::string showerModule) const
If the shower.ID() isn't filled we must find the actual shower index ourselves.
Ionization at a point of the TPC sensitive volume.
const simb::MCParticle * GetMCParticleFromPFParticle(detinfo::DetectorClocksData const &clockData, const recob::PFParticle &pfpart, art::Event const &evt, std::string pfparticleModule) const
double P(const int i=0) const
double T(const int i=0) const
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
const simb::MCParticle * MatchPduneMCtoG4(const simb::MCParticle &pDunePart, const art::Event &evt)
bool sort_IDEs(const sim::IDE *i1, const sim::IDE *i2)
const simb::MCParticle * GetMCParticleFromRecoTrack(detinfo::DetectorClocksData const &clockData, const recob::Track &track, art::Event const &evt, std::string trackModule) const
Description of geometry of one entire detector.
std::vector< std::pair< const recob::Shower *, double > > GetRecoShowerListFromMCParticle(detinfo::DetectorClocksData const &clockData, const simb::MCParticle &part, art::Event const &evt, std::string showerModule) const
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
template const protoana::MCParticleSharedHits protoana::ProtoDUNETruthUtils::GetMCParticleByHits< recob::Track >(const detinfo::DetectorClocksData &, const recob::Track &, const art::Event &, std::string, std::string) const
size_t nSharedDeltaRayHits
Detector simulation of raw signals on wires.
const sim::ParticleList & ParticleList() const
std::map< size_t, std::vector< const sim::IDE * > > GetSimIDEs(const simb::MCParticle &mcpart)
const simb::MCParticle & GetParticle(int i) const
std::vector< const sim::IDE * > GetSimIDEsBetweenPoints(const simb::MCParticle &mcpart, const TLorentzVector &p1, const TLorentzVector &p2)
std::vector< std::pair< const simb::MCParticle *, double > > GetMCParticleListFromRecoShower(detinfo::DetectorClocksData const &clockData, const recob::Shower &shower, art::Event const &evt, std::string showerModule) const
double Vx(const int i=0) const
const std::vector< const recob::Hit * > GetRecoTrackHits(const recob::Track &track, art::Event const &evt, const std::string trackModule) const
Get the hits from a given reco track.
std::vector< std::pair< const simb::MCParticle *, double > > GetMCParticleListFromReco(detinfo::DetectorClocksData const &clockData, const recob::PFParticle &pfpart, art::Event const &evt, std::string pfparticleModule) const
Declaration of signal hit object.
const simb::MCParticle * particle
Hierarchical representation of particle flow.
double G4ToElecTime(double const g4_time) const
std::vector< std::pair< const simb::MCParticle *, double > > GetMCParticleListFromPFParticle(detinfo::DetectorClocksData const &clockData, const recob::PFParticle &pfpart, art::Event const &evt, std::string pfparticleModule) const
Contains all timing reference information for the detector.
const float ConvertTrueTimeToPandoraTimeMicro(detinfo::DetectorClocksData const &clockData, const simb::MCParticle &part) const
std::vector< sim::TrackIDE > HitToEveTrackIDEs(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
double Vz(const int i=0) const
std::vector< std::pair< const simb::MCParticle *, double > > GetMCParticleListFromShowerHits(detinfo::DetectorClocksData const &clockData, const std::vector< const recob::Hit * > &hitVec) const
cet::LibraryManager dummy("noplugin")
int GetFirstTrajectoryPointInTPCActiveVolume(const simb::MCParticle &mcpart, double tpcactiveXlow, double tpcactiveXhigh, double tpcactiveYlow, double tpcactiveYhigh, double tpcactiveZlow, double tpcactiveZhigh)
EventNumber_t event() const
std::vector< const sim::IDE * > HitToSimIDEs_Ps(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
2D representation of charge deposited in the TDC/wire plane
std::vector< std::pair< const recob::PFParticle *, double > > GetPFParticleListFromMCParticle(detinfo::DetectorClocksData const &clockData, const simb::MCParticle &part, art::Event const &evt, std::string pfparticleModule, bool use_eve=true) const
std::vector< std::pair< const recob::Track *, double > > GetRecoTrackListFromMCParticle(detinfo::DetectorClocksData const &clockData, const simb::MCParticle &part, art::Event const &evt, std::string trackModule) const
Event generator information.
const simb::MCParticle * GetMCParticleFromRecoShower(detinfo::DetectorClocksData const &clockData, const recob::Shower &shower, art::Event const &evt, std::string showerModule) const
std::vector< std::pair< const simb::MCParticle *, double > > GetMCParticleListFromRecoTrack(detinfo::DetectorClocksData const &clockData, const recob::Track &track, art::Event const &evt, std::string trackModule) const
Ionization energy from a Geant4 track.
std::vector< const recob::Hit * > GetSharedHits(detinfo::DetectorClocksData const &clockData, const simb::MCParticle &mcpart, const recob::PFParticle &pfpart, const art::Event &evt, std::string pfparticleModule, bool delta_ray=false) const
double Vy(const int i=0) const
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
int GetProcessKey(std::string process)
QTextStream & endl(QTextStream &s)