56 #include "geant4reweight/src/ReweightBase/G4ReweighterFactory.hh" 57 #include "geant4reweight/src/ReweightBase/G4Reweighter.hh" 58 #include "geant4reweight/src/ReweightBase/G4ReweightTraj.hh" 59 #include "geant4reweight/src/ReweightBase/G4ReweightStep.hh" 60 #include "geant4reweight/src/PropBase/G4ReweightParameterMaker.hh" 61 #include "geant4reweight/src/ReweightBase/G4MultiReweighter.hh" 65 #include "art_root_io/TFileService.h" 72 #include "TVirtualFitter.h" 73 #include "TPolyLine3D.h" 74 #include "Math/Vector3D.h" 82 return( i1->
z < i2->
z );
86 void line(
double t,
double * p,
double & x,
double & y,
double & z);
87 void SumDistance2(
int &,
double *,
double & sum,
double * par,
int);
91 std::vector<const sim::IDE*> ides,
double the_z0,
double the_pitch,
94 std::map< int, std::vector< const sim::IDE* > > results;
96 for (
size_t i = 0; i < ides.size(); ++i) {
97 int slice_num = std::floor(
98 (ides[i]->z - (the_z0 - the_pitch/2.)) / the_pitch);
108 results[slice_num].push_back(ides[i]);
187 std::vector< std::pair< int, double > > results;
190 std::map< int, double > ID_to_IDE_electrons;
192 for(
size_t i = 0; i < ides.size(); ++i ){
195 ID_to_IDE_electrons[
abs( ides[i]->trackID ) ] += ides[i]->numElectrons;
199 double prev_max_electrons = -999.;
200 for(
auto it = ID_to_IDE_electrons.begin(); it != ID_to_IDE_electrons.end(); ++it ){
201 if( it->second > prev_max_electrons ){
203 prev_max_electrons = it->second;
207 if( max_id != beam_id ){
208 results.push_back( {-999,-999.} );
212 std::unordered_map< int, double > slice_to_nElectrons;
214 for(
size_t i = 0; i < ides.size(); ++i ){
216 for(
auto it = true_slices.begin(); it != true_slices.end(); ++it ){
217 if( std::find( it->second.begin(), it->second.end(), theIDE ) != it->second.end() ){
224 std::vector< std::pair< int, double > > pair_vec(slice_to_nElectrons.begin(), slice_to_nElectrons.end());
226 std::sort( pair_vec.begin(), pair_vec.end(), [](std::pair<int,double>
a, std::pair<int,double>
b){
return (a.second >
b.second);});
289 for(
size_t i = 0; i < ides.size(); ++i ){
290 result += ides[i]->numElectrons;
298 double prev_max_electrons = -999.;
300 std::map< int, double > ID_to_IDE_electrons;
305 for(
size_t i = 0; i < ides.size(); ++i ){
306 ID_to_IDE_electrons[
abs( ides[i]->trackID ) ] += ides[i]->numElectrons;
310 for(
auto it = ID_to_IDE_electrons.begin(); it != ID_to_IDE_electrons.end(); ++it ){
311 if( it->second > prev_max_electrons ){
313 prev_max_electrons = it->second;
343 double input_z,
int t)
344 : wire(w), pitch(p), dEdX(dedx), hit_index(index), z(input_z), tpc(t) {};
357 const std::vector< art::Ptr< recob::Hit > > daughterPFP_hits = pfpUtil.
GetPFParticleHits_Ptrs( part, evt, fPFParticleTag );
359 for(
size_t h = 0;
h < daughterPFP_hits.size(); ++
h ){
360 std::array<float,4> cnn_out = CNN_results.
getOutput( daughterPFP_hits[
h] );
362 output.
em += cnn_out[ CNN_results.
getIndex(
"em") ];
367 output.
nHits = daughterPFP_hits.size();
378 for(
size_t h = 0;
h < daughterPFP_hits.size(); ++
h ){
379 std::array<float,4> cnn_out = CNN_results.
getOutput( daughterPFP_hits[
h] );
381 output.
em += cnn_out[ CNN_results.
getIndex(
"em") ];
386 output.
nHits = daughterPFP_hits.size();
411 void endJob()
override;
414 double lateralDist( TVector3 &
n, TVector3 & x0, TVector3 & p );
431 const sim::ParticleList & plist,
433 G4ReweightTraj * theTraj);
437 const sim::ParticleList & plist,
473 std::vector< double > true_beam_elastic_costheta, true_beam_elastic_X,
475 true_beam_elastic_deltaE, true_beam_elastic_IDE_edep;
486 true_beam_reco_byHits_allTrack_ID;
505 true_beam_daughter_reco_byHits_allTrack_ID, true_beam_daughter_reco_byHits_allShower_ID;
521 true_beam_Pi0_decay_reco_byHits_allTrack_ID, true_beam_Pi0_decay_reco_byHits_allShower_ID;
590 reco_track_endX, reco_track_endY, reco_track_endZ,
591 reco_track_michel_score;
634 std::vector< double > true_beam_incidentEnergies;
637 double true_beam_interactingEnergy;
747 std::vector<int> reco_daughter_PFP_nHits,
804 std::vector<std::vector<double>>
805 reco_daughter_allTrack_calibrated_dEdX_SCE_plane0,
808 std::vector<std::vector<double>>
809 reco_daughter_allTrack_resRange_plane0,
812 std::vector<double> reco_daughter_allTrack_Chi2_proton_plane0,
815 std::vector<int> reco_daughter_allTrack_Chi2_ndof_plane0,
831 std::vector<double> reco_daughter_allShower_len,
832 reco_daughter_allShower_startX,
833 reco_daughter_allShower_startY,
835 reco_daughter_allShower_dirX,
836 reco_daughter_allShower_dirY,
837 reco_daughter_allShower_dirZ,
838 reco_daughter_allShower_energy;
1012 ParSet =
p.get<std::vector<fhicl::ParameterSet>>(
"ParameterSet");
1013 ParMaker = G4ReweightParameterMaker(ParSet);
1023 ParSet =
p.get<std::vector<fhicl::ParameterSet>>(
"ParameterSet");
1024 ParMaker = G4ReweightParameterMaker(ParSet);
1103 double startX = tempTrack->
Start().X();
1104 double startY = tempTrack->
Start().Y();
1105 double startZ = tempTrack->
Start().Z();
1107 double endX = tempTrack->
End().X();
1108 double endY = tempTrack->
End().Y();
1109 double endZ = tempTrack->
End().Z();
1111 double start[3] = {startX, startY, startZ};
1112 double end[3] = {endX, endY, endZ};
1116 if (!((end_tpc == 1 || end_tpc == 5) &&
1117 (start_tpc == 1 || start_tpc == 5)))
1120 std::pair<double, int> vertex_michel_score =
1139 const sim::ParticleList & plist = pi_serv->
ParticleList();
1149 double pitch = geom->
WirePitch( 2, 1, 0);
1150 size_t nWires = geom->
Nwires( 2, 1, 0 );
1154 std::cout <<
"Pitch: " << pitch <<
std::endl;
1155 std::cout <<
"nWires: " << nWires <<
std::endl;
1158 std::cout <<
"APA 2 Z0: " << z0_APA2 <<
std::endl;
1165 true_beam_particle = truthUtil.GetGeantGoodParticle((*mcTruths)[0],evt);
1166 if( !true_beam_particle ){
1171 std::cout <<
"Got " << (*mcTruths)[0].NParticles() <<
1173 for (
int i = 0; i < (*mcTruths)[0].NParticles(); ++i) {
1188 std::vector<art::Ptr<beam::ProtoDUNEBeamEvent>> beamVec;
1189 if( beamHandle.isValid()){
1202 int nMomenta = momenta.size();
1207 const std::vector<double> the_tofs = beamEvent.
GetTOFs();
1208 const std::vector<int> the_chans = beamEvent.
GetTOFChans();
1209 for (
size_t iTOF = 0; iTOF < the_tofs.size(); ++iTOF) {
1236 auto beamHandle = evt.
getValidHandle<std::vector<beam::ProtoDUNEBeamEvent>>(
"generator");
1238 std::vector<art::Ptr<beam::ProtoDUNEBeamEvent>> beamVec;
1239 if( beamHandle.isValid()){
1248 int nMomenta = momenta.size();
1251 std::cout <<
"Got beam event" <<
std::endl;
1252 std::cout <<
"Got " << nTracks <<
" Tracks" <<
std::endl;
1253 std::cout <<
"Got " << nMomenta <<
" Momenta" <<
std::endl;
1261 const std::vector<double> the_tofs = beamEvent.
GetTOFs();
1262 const std::vector<int> the_chans = beamEvent.
GetTOFChans();
1263 for (
size_t iTOF = 0; iTOF < the_tofs.size(); ++iTOF) {
1308 art::FindManyP<recob::Hit> findHits(recoTracks,evt,
fTrackerTag);
1311 art::FindManyP<recob::Hit> findHitsFromShowers(recoShowers,evt,
fShowerTag);
1313 std::map< int, std::vector< int > > trueToPFPs;
1322 if(beamParticles.size() == 0){
1323 std::cout <<
"We found no beam particles for this event... moving on" <<
std::endl;
1327 std::cout <<
"Found " << beamParticles.size() <<
" particles" <<
std::endl;
1370 auto list = truthUtil.GetMCParticleListByHits( clockData, *particle, evt,
fPFParticleTag,
fHitTag );
1372 double matched_hits = 0.;
1373 for(
size_t j = 0; j < list.size(); ++j ){
1379 if( list[j].particle == beam_match.
particle ){
1380 matched_hits = list[j].nSharedHits + list[j].nSharedDeltaRayHits;
1383 total += list[j].nSharedHits + list[j].nSharedDeltaRayHits;
1390 trueParticle = truthUtil.GetMCParticleFromPFParticle(clockData, *particle, evt,
fPFParticleTag);
1460 for(
size_t i = 0; i < trueToPFPs[
true_beam_ID ].size(); ++i ){
1477 if( pandora2Track ){
1492 for(
auto itProc = true_beam_proc_map.begin(); itProc != true_beam_proc_map.end(); ++itProc ){
1493 int index = itProc->first;
1499 if( process ==
"hadElastic" ){
1503 double process_X = true_beam_trajectory.
X( index );
1504 double process_Y = true_beam_trajectory.
Y( index );
1505 double process_Z = true_beam_trajectory.
Z( index );
1507 double PX = true_beam_trajectory.
Px( index );
1508 double next_PX = true_beam_trajectory.
Px( index + 1 );
1509 double PY = true_beam_trajectory.
Py( index );
1510 double next_PY = true_beam_trajectory.
Py( index + 1 );
1511 double PZ = true_beam_trajectory.
Pz( index );
1512 double next_PZ = true_beam_trajectory.
Pz( index + 1 );
1514 double total_P = sqrt( PX*PX + PY*PY + PZ*PZ );
1515 double total_next_P = sqrt( next_PX*next_PX + next_PY*next_PY + next_PZ*next_PZ );
1519 ( ( PX * next_PX ) + ( PY * next_PY ) + ( PZ * next_PZ ) ) / ( total_P * total_next_P )
1522 double mass = 139.57;
1529 double total_E = sqrt(total_P*total_P*1.e6 + mass*mass);
1530 double total_next_E = sqrt(total_next_P*total_next_P*1.e6 + mass*mass);
1538 std::vector<const sim::IDE *> ides_between_points =
1539 truthUtil.GetSimIDEsBetweenPoints(
1540 *true_beam_particle, true_beam_trajectory.
Position(index),
1541 true_beam_trajectory.
Position(index +1));
1543 double total_edep = 0.;
1544 for (
size_t i = 0; i < ides_between_points.size(); ++i) {
1545 total_edep += ides_between_points[i]->energy;
1562 std::sort( view2_IDEs.begin(), view2_IDEs.end(),
sort_IDEs );
1567 size_t remove_index = 0;
1568 bool do_remove =
false;
1569 if( view2_IDEs.size() ){
1570 for(
size_t i = 1; i < view2_IDEs.size()-1; ++i ){
1571 const sim::IDE * prev_IDE = view2_IDEs[i-1];
1572 const sim::IDE * this_IDE = view2_IDEs[i];
1579 if( this_IDE->
trackID < 0 && ( this_IDE->
z - prev_IDE->
z ) > 5 ){
1588 view2_IDEs.erase( view2_IDEs.begin() + remove_index, view2_IDEs.end() );
1592 double mass = 139.57;
1630 if (sliced_ides.size()) {
1631 auto first_slice = sliced_ides.begin();
1635 auto theIDEs = first_slice->second;
1637 if (theIDEs.size()) {
1639 double ide_z = theIDEs[0]->z;
1644 for (
size_t i = 1; i < true_beam_trajectory.
size(); ++i) {
1645 double z0 = true_beam_trajectory.
Z(i-1);
1646 double z1 = true_beam_trajectory.
Z(i);
1648 if (z0 < ide_z && z1 > ide_z) {
1649 init_KE = 1.e3 * true_beam_trajectory.
E(i-1) - mass;
1651 std::cout <<
"Found matching position" << z0 <<
" " << ide_z <<
1653 std::cout <<
"init KE: " << init_KE <<
std::endl;
1663 for(
auto it = sliced_ides.begin(); it != sliced_ides.end(); ++it ){
1665 auto theIDEs = it->second;
1671 for(
size_t i = 0; i < theIDEs.size(); ++i ){
1672 deltaE += theIDEs[i]->energy;
1682 for (
size_t i = 0; i < true_beam_trajectory.
size(); ++i) {
1692 int daughterID = true_beam_particle->
Daughter(i);
1694 if (
fVerbose) std::cout <<
"Daughter " << i <<
" ID: " << daughterID <<
std::endl;
1695 auto part = plist[ daughterID ];
1696 int pid = part->PdgCode();
1700 if (process ==
"muIoni" || process ==
"hIoni")
1725 std::cout <<
"Process: " << part->Process() <<
std::endl;
1726 std::cout <<
"PID: " << pid <<
std::endl;
1727 std::cout <<
"Start: " << part->Position(0).X() <<
" " << part->Position(0).Y() <<
" " << part->Position(0).Z() <<
std::endl;
1728 std::cout <<
"End: " << part->EndPosition().X() <<
" " << part->EndPosition().Y() <<
" " << part->EndPosition().Z() <<
std::endl;
1729 std::cout <<
"Len: " << part->Trajectory().TotalLength() <<
std::endl;
1732 if( part->Process().find(
"Inelastic" ) != std::string::npos ){
1744 for(
int j = 0; j < part->NumberDaughters(); ++j ){
1745 int pi0_decay_daughter_ID = part->Daughter(j);
1746 auto pi0_decay_part = plist[ pi0_decay_daughter_ID ];
1780 for(
size_t k = 0;
k < trueToPFPs[ pi0_decay_part->TrackId() ].size(); ++
k ){
1783 const recob::PFParticle * thePFP = &(pfpVec->at( trueToPFPs[ pi0_decay_part->TrackId() ][
k] ));
1799 if( pandora2Track ){
1829 if( pandora2Shower ){
1850 for(
int j = 0; j < part->NumberDaughters(); ++j ){
1851 int grand_daughter_ID = part->Daughter(j);
1852 auto grand_daughter_part = plist[ grand_daughter_ID ];
1882 for(
size_t j = 0; j < trueToPFPs[ part->TrackId() ].size(); ++j ){
1885 const recob::PFParticle * thePFP = &(pfpVec->at( trueToPFPs[ part->TrackId() ][j] ));
1901 if( pandora2Track ){
1931 if( pandora2Shower ){
1961 if( cnn.
nHits > 0 ){
1973 if( cnn_collection.
nHits > 0 ){
2000 std::pair<double, int> vertex_michel_score =
2007 if (
fVerbose) std::cout <<
"Beam particle is track-like " << thisTrack->
ID() <<
std::endl;
2056 thisTrack->
Length(), 2212);
2058 thisTrack->
Length(), 13);
2070 if( ( pt.X() - -999. ) < 1.
e-6 )
continue;
2072 TVector3
p( pt.X(), pt.Y(), pt.Z() );
2077 if( i < thisTrack->NumberTrajectoryPoints() - 1 ){
2079 if( ( next_pt.X() - -999. ) > 1.
e-6 ){
2081 TVector3 next_p( next_pt.X(), next_pt.Y(), next_pt.Z() );
2082 double segment = ( next_p -
p ).Mag();
2088 std::map< const recob::Hit *, int > hitsToSlices;
2089 std::map< int, std::vector< const recob::Hit * > > slicesToHits;
2097 std::vector<int> view_0_TPC;
2098 std::vector<int> view_1_TPC;
2099 std::vector<int> view_2_TPC;
2101 for(
auto it = trajPtsToHits.begin(); it != trajPtsToHits.end(); ++it ){
2104 size_t i = it->first;
2118 int slice = std::floor(
2120 hitsToSlices[theHit] = slice;
2121 slicesToHits[slice].push_back(theHit);
2130 switch( theHit->
View() ){
2136 view_0_TPC.push_back( theHit->
WireID().
TPC );
2143 view_1_TPC.push_back( theHit->
WireID().
TPC );
2151 view_2_TPC.push_back( theHit->
WireID().
TPC );
2193 bool found_calo =
false;
2195 for ( index = 0; index <
calo.size(); ++
index) {
2201 std::cout <<
"Cali index " << index <<
std::endl;
2212 auto calo_range =
calo[
index].ResidualRange();
2213 auto TpIndices =
calo[
index].TpIndices();
2217 size_t this_index = 0;
2218 for ( this_index = 0; this_index < pandoracalo.size(); ++this_index) {
2219 if (pandoracalo[this_index].
PlaneID().Plane == 2) {
2224 TpIndices = pandoracalo[this_index].TpIndices();
2225 std::cout <<
"pandoracalo hits " << pandoracalo[this_index].dQdx().size() <<
std::endl;
2227 std::cout << calo_dQdX.size() <<
std::endl;
2231 std::vector< size_t > calo_hit_indices;
2232 for(
size_t i = 0; i < calo_dQdX.size(); ++i ){
2239 const recob::Hit & theHit = (*allHits)[ TpIndices[i] ];
2251 calo_hit_indices.push_back( TpIndices[i] );
2254 geom->
Wire(theHit.
WireID()).GetCenter().Z());
2257 std::cout << theXYZPoints[i].X() <<
" " << theXYZPoints[i].Y() <<
" " <<
2258 theXYZPoints[i].Z() <<
" " << theHit.
WireID().
Wire <<
" " <<
2259 geom->
Wire(theHit.
WireID()).GetCenter().Z() <<
" " <<
2264 std::sort(theXYZPoints.begin(), theXYZPoints.end(), [](
auto a,
auto b)
2265 {
return (
a.Z() <
b.Z());});
2268 if (theXYZPoints.size()) {
2276 TVector3
dir((theXYZPoints.back().X() - theXYZPoints[0].X()),
2277 (theXYZPoints.back().Y() - theXYZPoints[0].Y()),
2278 (theXYZPoints.back().Z() - theXYZPoints[0].Z()));
2295 if (theXYZPoints.size() > 1) {
2296 TVector3 start_p1(theXYZPoints[0].
X(),
2297 theXYZPoints[0].
Y(), theXYZPoints[0].
Z());
2298 TVector3 start_p2(theXYZPoints[1].
X(),
2299 theXYZPoints[1].
Y(), theXYZPoints[1].
Z());
2300 TVector3 start_diff = start_p2 - start_p1;
2306 size_t nPoints = theXYZPoints.size();
2307 TVector3 end_p1(theXYZPoints[nPoints - 2].
X(),
2308 theXYZPoints[nPoints - 2].
Y(), theXYZPoints[nPoints - 2].
Z());
2309 TVector3 end_p2(theXYZPoints[nPoints - 1].
X(),
2310 theXYZPoints[nPoints - 1].
Y(), theXYZPoints[nPoints - 1].
Z());
2311 TVector3 end_diff = end_p2 - end_p1;
2326 if (theXYZPoints.size() > 2) {
2327 std::vector<TVector3>
input;
2328 for (
size_t iP = 0; iP < 3; ++iP) {
2329 input.push_back(TVector3(theXYZPoints[iP].
X(),
2330 theXYZPoints[iP].
Y(),
2331 theXYZPoints[iP].
Z()));
2334 TVector3 startDiff =
FitLine(input);
2339 std::vector<TVector3> end_input;
2340 size_t nPoints = theXYZPoints.size();
2341 for (
size_t iP = nPoints - 3; iP < nPoints; ++iP) {
2342 end_input.push_back(TVector3(theXYZPoints[iP].
X(),
2343 theXYZPoints[iP].
Y(),
2344 theXYZPoints[iP].
Z()));
2347 TVector3 endDiff =
FitLine(end_input);
2361 if (theXYZPoints.size() > 3) {
2362 std::vector<TVector3>
input;
2363 for (
size_t iP = 0; iP < 4; ++iP) {
2364 input.push_back(TVector3(theXYZPoints[iP].
X(),
2365 theXYZPoints[iP].
Y(),
2366 theXYZPoints[iP].
Z()));
2369 TVector3 startDiff =
FitLine(input);
2374 std::vector<TVector3> end_input;
2375 size_t nPoints = theXYZPoints.size();
2376 for (
size_t iP = nPoints - 4; iP < nPoints; ++iP) {
2377 end_input.push_back(TVector3(theXYZPoints[iP].
X(),
2378 theXYZPoints[iP].
Y(),
2379 theXYZPoints[iP].
Z()));
2382 TVector3 endDiff =
FitLine(end_input);
2399 std::cout <<
"Getting reco beam calo" <<
std::endl;
2403 std::cout <<
"got calibrated dedx" <<
std::endl;
2414 std::vector< calo_point > reco_beam_calo_points;
2421 reco_beam_calo_points.push_back(
2430 std::sort( reco_beam_calo_points.begin(), reco_beam_calo_points.end(), [](
calo_point a,
calo_point b) {
return ( a.
z <
b.z );} );
2433 for(
size_t i = 0; i < reco_beam_calo_points.size(); ++i ){
2434 calo_point thePoint = reco_beam_calo_points[i];
2438 calo_hit_indices[i] = thePoint.
hit_index;
2446 double init_KE = 0.;
2466 for(
size_t i = 0; i < reco_beam_calo_points.size() - 1; ++i ){
2479 std::vector< const sim::IDE * > true_ides_from_reco;
2480 for(
auto it = trajPtsToHits.begin(); it != trajPtsToHits.end(); ++it ){
2482 if( theHit->
View() != 2 )
continue;
2484 std::vector< const sim::IDE * > ides = bt_serv->
HitToSimIDEs_Ps( clockData, *theHit );
2485 for(
size_t i = 0; i < ides.size(); ++i ){
2488 true_ides_from_reco.push_back( ides[i] );
2493 if( true_ides_from_reco.size() ){
2494 std::sort( true_ides_from_reco.begin(), true_ides_from_reco.end(),
sort_IDEs );
2495 if (
fVerbose) std::cout <<
"Max IDE z: " << true_ides_from_reco.back()->z <<
std::endl;
2503 std::sort( view2_IDEs.begin(), view2_IDEs.end(),
sort_IDEs );
2505 size_t remove_index = 0;
2506 bool do_remove =
false;
2507 if( view2_IDEs.size() ){
2508 for(
size_t i = 1; i < view2_IDEs.size()-1; ++i ){
2509 const sim::IDE * prev_IDE = view2_IDEs[i-1];
2510 const sim::IDE * this_IDE = view2_IDEs[i];
2513 if( this_IDE->
trackID < 0 && ( this_IDE->
z - prev_IDE->
z ) > 5 ){
2522 view2_IDEs.erase( view2_IDEs.begin() + remove_index, view2_IDEs.end() );
2526 std::vector< int > found_slices;
2528 for(
auto it = sliced_ides.begin(); it != sliced_ides.end(); ++it ){
2530 auto theIDEs = it->second;
2533 bool slice_found =
false;
2534 for(
size_t i = 0; i < theIDEs.size(); ++i ){
2535 if( std::find( true_ides_from_reco.begin(), true_ides_from_reco.end(), theIDEs[i] ) != true_ides_from_reco.end() ){
2542 found_slices.push_back( it->first );
2549 std::cout <<
"Found " << found_slices.size() <<
"/" << sliced_ides.size() <<
" slices" <<
std::endl;
2550 std::cout <<
"Maximum true slice: " << (found_slices.size() ? sliced_ides.rbegin()->first : -999 ) << std::endl;
2551 std::cout <<
"Max found: " << (found_slices.size() ? found_slices.back() : -999 ) << std::endl;
2552 std::cout <<
"Testing hit to true slice matching" <<
std::endl;
2556 std::map< int, std::vector< std::pair<int, double> > > true_slice_to_reco_electrons;
2557 std::map< int, int > reco_beam_hit_to_true_ID;
2558 std::vector< int > reco_beam_hit_index;
2559 for(
size_t i = 0; i < reco_beam_calo_points.size(); ++i ){
2560 calo_point thePoint = reco_beam_calo_points[i];
2562 auto theHit = (*allHits)[thePoint.
hit_index];
2564 reco_beam_hit_index.push_back( thePoint.
hit_index );
2571 if( theMap[0].first != -999 ){
2572 for(
size_t j = 0; j < theMap.size(); ++j ){
2573 true_slice_to_reco_electrons[theMap[j].first].push_back({thePoint.
hit_index, theMap[j].second});
2578 bool all_good =
false;
2579 size_t maxTries = 5;
2584 while( !all_good && nTries < maxTries ){
2587 bool found_duplicate =
false;
2590 for(
auto it = true_slice_to_reco_electrons.begin(); it != true_slice_to_reco_electrons.end(); ++it ){
2593 if( it->first == -999 )
continue;
2597 std::vector< std::pair< int, double > > & reco_electrons = it->second;
2599 if(reco_electrons.size()){
2601 int maxHit = reco_electrons[0].first;
2602 double maxElectrons = reco_electrons[0].second;
2607 for(
auto it2 = true_slice_to_reco_electrons.begin(); it2 != true_slice_to_reco_electrons.end(); ++it2 ){
2610 if( it2->first == -999 )
continue;
2611 if( it->first == it2->first )
continue;
2615 if( it2->second.size() ){
2617 int maxHit2 = it2->second[0].first;
2618 double maxElectrons2 = it2->second[0].second;
2623 if( maxHit == maxHit2 ){
2627 found_duplicate =
true;
2629 if( maxElectrons < maxElectrons2 ){
2631 reco_electrons.erase( reco_electrons.begin(), reco_electrons.begin()+1 );
2643 all_good = !found_duplicate;
2648 std::map< int, int > reco_beam_hit_to_true_slice;
2656 if( true_slice_to_reco_electrons.find( slice ) != true_slice_to_reco_electrons.end() ){
2660 reco_beam_hit_to_true_slice[true_slice_to_reco_electrons[slice][0].first] = slice;
2664 int max_slice_found = -999;
2665 for(
size_t i = 0; i < reco_beam_calo_points.size(); ++i ){
2666 calo_point thePoint = reco_beam_calo_points[i];
2669 bool found_in_true_slices = ( reco_beam_hit_to_true_slice.find( thePoint.
hit_index ) != reco_beam_hit_to_true_slice.end() );
2672 int true_id = reco_beam_hit_to_true_ID[thePoint.
hit_index];
2678 if (reco_beam_hit_to_true_slice[thePoint.
hit_index] > max_slice_found)
2679 max_slice_found = reco_beam_hit_to_true_slice[thePoint.
hit_index];
2689 for(
auto itProc = true_beam_proc_map.begin(); itProc != true_beam_proc_map.end(); ++itProc ){
2690 int index = itProc->first;
2693 double process_X = true_beam_trajectory.
X( index );
2694 double process_Y = true_beam_trajectory.
Y( index );
2695 double process_Z = true_beam_trajectory.
Z( index );
2697 int slice_num = std::floor( ( process_Z - z0 ) / pitch );
2700 std::cout <<
"Process " << index <<
", " << process <<
"(" << process_X <<
","<< process_Y <<
","<< process_Z <<
")" <<
" at slice " << slice_num <<
std::endl;
2701 std::cout <<
"d(Slice) to max slice found: " << slice_num - max_slice_found <<
std::endl;
2711 int slice_num = std::floor( ( process_Z - z0 ) / pitch );
2714 std::cout <<
"Process " << -1 <<
", " <<
true_beam_endProcess <<
"(" << process_X <<
","<< process_Y <<
","<< process_Z <<
")" <<
" at slice " << slice_num <<
std::endl;
2715 std::cout <<
"d(Slice) to max slice found: " << slice_num - max_slice_found <<
std::endl;
2756 for(
size_t daughterID : particle->
Daughters() ){
2761 if (
fVerbose) std::cout <<
"Got " << daughterPFP_hits.size() <<
" hits from daughter " << daughterID <<
std::endl;
2764 size_t nHits_coll = 0;
2765 for (
size_t i = 0; i < daughterPFP_hits.size(); ++i) {
2766 if (daughterPFP_hits[i]->
View() == 2) {
2772 double track_total = 0.;
2773 double em_total = 0.;
2774 double michel_total = 0.;
2775 double none_total = 0.;
2776 for(
size_t h = 0;
h < daughterPFP_hits.size(); ++
h ){
2777 std::array<float,4> cnn_out = hitResults.
getOutput( daughterPFP_hits[
h] );
2778 track_total += cnn_out[ hitResults.
getIndex(
"track") ];
2779 em_total += cnn_out[ hitResults.
getIndex(
"em") ];
2780 michel_total += cnn_out[ hitResults.
getIndex(
"michel") ];
2781 none_total += cnn_out[ hitResults.
getIndex(
"none") ];
2787 std::cout <<
"Testing new CNN: " <<
std::endl;
2788 std::cout << track_total <<
" " << theCNNResults.
track <<
std::endl;
2789 std::cout << em_total <<
" " << theCNNResults.
em <<
std::endl;
2790 std::cout << michel_total <<
" " << theCNNResults.
michel <<
std::endl;
2791 std::cout << none_total <<
" " << theCNNResults.
none <<
std::endl;
2797 if( daughterPFP_hits.size() > 0 ){
2809 if( cnn_collection.
nHits > 0 ){
2862 auto list = truthUtil.GetMCParticleListByHits( clockData, *daughterPFP, evt,
fPFParticleTag,
fHitTag );
2864 double matched_hits = 0.;
2865 for(
size_t j = 0; j < list.size(); ++j ){
2869 if( list[j].particle == match.
particle ){
2870 matched_hits = list[j].nSharedHits + list[j].nSharedDeltaRayHits;
2873 total += list[j].nSharedHits + list[j].nSharedDeltaRayHits;
2878 double totalTruth = truthUtil.GetMCParticleHits( clockData, *match.
particle, evt,
fHitTag).size();
2879 double sharedHits = truthUtil.GetSharedHits( clockData, *match.
particle, *daughterPFP, evt,
fPFParticleTag).size();
2911 if( true_daughter_byE ){
2914 double purity = truthUtil.GetPurity( clockData, *daughterPFP, evt,
fPFParticleTag);
2915 double completeness = truthUtil.GetCompleteness( clockData, *daughterPFP, evt,
fPFParticleTag,
fHitTag );
2931 if( pandora2Track ){
2934 std::cout <<
"Getting calo for " << pandora2Track->
ID() <<
std::endl;
2936 auto dummy_caloSCE =
2939 std::cout << dummy_caloSCE.size() <<
std::endl;
2940 bool found_calo =
false;
2942 for ( index = 0; index < dummy_caloSCE.size(); ++
index) {
2943 if (dummy_caloSCE[index].
PlaneID().Plane == 2) {
2948 std::cout << index <<
" " << found_calo <<
std::endl;
2956 auto dummy_dEdx_SCE = dummy_caloSCE[
index].dEdx();
2957 auto dummy_dQdx_SCE = dummy_caloSCE[
index].dQdx();
2958 auto dummy_Range_SCE = dummy_caloSCE[
index].ResidualRange();
2966 for(
size_t j = 0; j < dummy_dEdx_SCE.size(); ++j ){
2972 for(
size_t j = 0; j < cali_dEdX_SCE.size(); ++j ){
2976 std::pair<double, int> this_chi2_ndof = trackUtil.
Chi2PID(
2992 size_t plane0_index = 0;
2993 bool found_plane0 =
false;
2994 for ( plane0_index = 0; plane0_index < dummy_caloSCE.size(); ++plane0_index) {
2995 std::cout << dummy_caloSCE[plane0_index].PlaneID().Plane <<
std::endl;
2996 if (dummy_caloSCE[plane0_index].
PlaneID().
Plane == 0) {
2997 found_plane0 =
true;
3001 size_t plane1_index = 0;
3002 bool found_plane1 =
false;
3003 for ( plane1_index = 0; plane1_index < dummy_caloSCE.size(); ++plane1_index) {
3004 std::cout << dummy_caloSCE[plane1_index].PlaneID().Plane <<
std::endl;
3005 if (dummy_caloSCE[plane1_index].
PlaneID().
Plane == 1) {
3006 found_plane1 =
true;
3011 std::cout <<
"Plane 0, 1 " << plane0_index <<
" " <<
3016 std::vector<double>());
3018 std::vector<double>());
3021 auto resRange_plane0 = dummy_caloSCE[plane0_index].ResidualRange();
3022 for (
size_t j = 0; j < resRange_plane0.size(); ++j) {
3024 resRange_plane0[j]);
3029 for (
size_t j = 0; j < dEdX_plane0.size(); ++j) {
3033 std::pair<double, int> plane0_chi2_ndof = trackUtil.
Chi2PID(
3037 plane0_chi2_ndof.first);
3039 plane0_chi2_ndof.second);
3050 std::vector<double>());
3053 std::vector<double>());
3056 auto resRange_plane1 = dummy_caloSCE[plane1_index].ResidualRange();
3060 for (
size_t j = 0; j < resRange_plane1.size(); ++j) {
3062 resRange_plane1[j]);
3065 for (
size_t j = 0; j < dEdX_plane1.size(); ++j) {
3070 std::pair<double, int> plane1_chi2_ndof = trackUtil.
Chi2PID(
3074 plane1_chi2_ndof.first);
3076 plane1_chi2_ndof.second);
3097 std::cout <<
"Getting michel" <<
std::endl;
3099 std::pair<double, int> vertex_results =
3101 *pandora2Track, evt,
"pandora2Track",
fHitTag,
3102 0., -500., 500., 0., 500., 0.,
false,
3106 vertex_results.first);
3108 vertex_results.second);
3124 double to_start_of_daughter = sqrt(
3125 ( d_startX - max_X ) * ( d_startX - max_X ) +
3126 ( d_startY - max_Y ) * ( d_startY - max_Y ) +
3127 ( d_startZ - max_Z ) * ( d_startZ - max_Z )
3129 double to_end_of_daughter = sqrt(
3130 ( d_endX - max_X ) * ( d_endX - max_X ) +
3131 ( d_endY - max_Y ) * ( d_endY - max_Y ) +
3132 ( d_endZ - max_Z ) * ( d_endZ - max_Z )
3135 if ( to_end_of_daughter < to_start_of_daughter ){
3154 ( d_startX - X ) * ( d_startX - X ) +
3155 ( d_startY - Y ) * ( d_startY - Y ) +
3156 ( d_startZ - Z ) * ( d_startZ - Z )
3159 if( dr < dr_start ){
3165 ( d_endX - X ) * ( d_endX - X ) +
3166 ( d_endY - Y ) * ( d_endY - Y ) +
3167 ( d_endZ - Z ) * ( d_endZ - Z )
3178 if( dr_end < dr_start ){
3199 std::vector<double>());
3201 std::vector<double>());
3203 std::vector<double>());
3205 std::vector<double>());
3245 if( pandora2Shower ){
3257 const std::vector<art::Ptr<recob::Hit>> hits =
3259 *pandora2Shower, evt,
"pandora2Shower");
3261 art::FindManyP<recob::SpacePoint> spFromHits(hits, evt,
fHitTag);
3264 std::vector<double> x_vec, y_vec, z_vec;
3265 double total_y = 0.;
3267 std::vector<art::Ptr<recob::Hit>> good_hits;
3269 for (
size_t iHit = 0; iHit < hits.size(); ++iHit) {
3270 auto theHit = hits[iHit];
3271 if (theHit->View() != 2)
continue;
3273 good_hits.push_back(theHit);
3275 double shower_hit_x = detProp.ConvertTicksToX(
3277 theHit->WireID().Plane,
3278 theHit->WireID().TPC, 0);
3280 double shower_hit_z = geom->
Wire(theHit->WireID()).GetCenter().Z();
3282 x_vec.push_back(shower_hit_x);
3283 z_vec.push_back(shower_hit_z);
3285 std::vector<art::Ptr<recob::SpacePoint>> sps = spFromHits.at(iHit);
3288 y_vec.push_back(sps[0]->XYZ()[1]);
3289 total_y += y_vec.back();
3294 y_vec.push_back(-999.);
3303 double total_shower_energy = 0.;
3304 for (
size_t iHit = 0; iHit < good_hits.size(); ++iHit) {
3305 auto theHit = good_hits[iHit];
3306 if (theHit->View() != 2)
continue;
3308 if (y_vec[iHit] < -100.)
3309 y_vec[iHit] = total_y / n_good_y;
3312 good_hits[iHit], x_vec[iHit], y_vec[iHit], z_vec[iHit]);
3342 std::map< int, std::pair< double, double > > UpperCosmicROILimits, LowerCosmicROILimits;
3343 std::map< int, int > wire_to_n_ticks;
3344 std::map< int, double > wire_to_avg_ticks;
3345 bool inTPC1 =
false;
3347 if( view_2_TPC[i] != 1 )
continue;
3356 double max_tick = 0.;
3357 double min_tick = 99999.;
3358 for(
auto it = wire_to_n_ticks.begin(); it != wire_to_n_ticks.end(); ++it ){
3359 wire_to_avg_ticks[ it->first ] /= it->second;
3361 if( wire_to_avg_ticks[ it->first ] > max_tick ){
3362 max_tick = wire_to_avg_ticks[ it->first ];
3364 if( wire_to_avg_ticks[ it->first ] < min_tick ){
3365 min_tick = wire_to_avg_ticks[ it->first ];
3372 std::vector< double > these_wires, these_ticks;
3374 for(
auto it = wire_to_avg_ticks.begin(); it != wire_to_avg_ticks.end(); ++it ){
3375 these_wires.push_back( it->first );
3376 these_ticks.push_back( it->second );
3378 TGraph gr_wire_ticks( these_wires.size(), &these_wires[0], &these_ticks[0] );
3383 for(
size_t i = 0; i < pfpVec->size(); ++i ){
3386 if( &(*pfpVec)[i] == particle )
continue;
3388 int nUpperCosmicROI = 0;
3389 int nLowerCosmicROI = 0;
3394 bool found_new =
false;
3401 for(
size_t j = 0; j < planeHits.size(); ++j ){
3402 auto theHit = planeHits[j];
3403 if( theHit->WireID().TPC == 1 ){
3405 if(
int(theHit->WireID().Wire) > wire_to_avg_ticks.begin()->first &&
int(theHit->WireID().Wire) < wire_to_avg_ticks.rbegin()->first &&
3406 theHit->PeakTime() > min_tick && theHit->PeakTime() < max_tick ){
3409 std::cout <<
"Checking " << theHit->WireID().Wire <<
" " << theHit->PeakTime() <<
std::endl;
3410 std::cout <<
"\tBeam: " << gr_wire_ticks.Eval( theHit->WireID().Wire ) << std::endl;
3413 if( theHit->PeakTime() > gr_wire_ticks.Eval( theHit->WireID().Wire ) ){
3425 std::vector< const sim::IDE * > ides = bt_serv->
HitToSimIDEs_Ps( clockData, *theHit );
3426 for(
size_t j = 0; j < ides.size(); ++j ){
3443 std::cout <<
"NHits in Upper ROI: " << nUpperCosmicROI <<
std::endl;
3444 std::cout <<
"NHits in Lower ROI: " << nLowerCosmicROI <<
std::endl;
3447 if( nLowerCosmicROI || nUpperCosmicROI ){
3459 for(
size_t i = 0; i < planeHits.size(); ++i ){
3460 auto theHit = planeHits[i];
3462 if( theHit->WireID().TPC == 1 ){
3463 std::vector< const sim::IDE * > ides = bt_serv->
HitToSimIDEs_Ps( clockData, *theHit );
3464 for(
size_t j = 0; j < ides.size(); ++j ){
3477 else if( thisShower ){
3482 std::cout <<
"Beam particle is shower-like" <<
std::endl;
3496 if( pandora2Track ){
3541 bool found_plane =
false;
3542 for (index = 0; index <
calo.size(); ++
index) {
3550 auto calo_range =
calo[
index].ResidualRange();
3551 for(
size_t i = 0; i < calo_range.size(); ++i ){
3600 bool created =
CreateRWTraj(*true_beam_particle, plist,
3601 fGeometryService,
event, &theTraj);
3602 if (created && theTraj.GetNSteps() > 0) {
3606 std::vector<double> weights_vec =
MultiRW->GetWeightFromAll1DThrows(
3608 std::cout << weights_vec.size() <<
std::endl;
3610 weights_vec.begin(), weights_vec.end());
3616 for (
size_t i = 0; i <
ParSet.size(); ++i) {
3617 std::pair<double, double> pm_weights =
3618 MultiRW->GetPlusMinusSigmaParWeight(theTraj, i);
3628 *true_beam_particle, plist,
3629 fGeometryService,
event);
3632 for (
size_t i = 0; i < trajs.size(); ++i) {
3633 if (trajs[i]->GetNSteps() > 0) {
3635 for (
size_t j = 0; j <
ParSet.size(); ++j) {
3636 std::pair<double, double> pm_weights =
3637 MultiRW->GetPlusMinusSigmaParWeight((*trajs[i]), j);
3658 *true_beam_particle, plist,
3659 fGeometryService,
event);
3662 for (
size_t i = 0; i < trajs.size(); ++i) {
3663 if (trajs[i]->GetNSteps() > 0) {
3665 for (
size_t j = 0; j <
ParSet.size(); ++j) {
3666 std::pair<double, double> pm_weights =
3667 ProtMultiRW->GetPlusMinusSigmaParWeight((*trajs[i]), j);
3695 fTree = tfs->make<TTree>(
"beamana",
"beam analysis tree");
3875 fTree->Branch(
"reco_daughter_allTrack_Chi2_proton_plane0",
3877 fTree->Branch(
"reco_daughter_allTrack_Chi2_proton_plane1",
3880 fTree->Branch(
"reco_daughter_allTrack_Chi2_ndof_plane0",
3882 fTree->Branch(
"reco_daughter_allTrack_Chi2_ndof_plane1",
3885 fTree->Branch(
"reco_daughter_allTrack_calibrated_dEdX_SCE_plane0",
3887 fTree->Branch(
"reco_daughter_allTrack_calibrated_dEdX_SCE_plane1",
3889 fTree->Branch(
"reco_daughter_allTrack_resRange_plane0",
3891 fTree->Branch(
"reco_daughter_allTrack_resRange_plane1",
3909 fTree->Branch(
"reco_daughter_allTrack_vertex_michel_score",
3911 fTree->Branch(
"reco_daughter_allTrack_vertex_nHits",
3989 fTree->Branch(
"reco_daughter_PFP_nHits_collection",
4271 fTree->Branch(
"g4rw_alt_primary_plus_sigma_weight",
4273 fTree->Branch(
"g4rw_alt_primary_minus_sigma_weight",
4298 TVector3
x = ( (p - x0)*n )*
n;
4299 return (x - (p - x0)).Mag();
4799 G4ReweightTraj * theTraj) {
4804 auto d_part = plist[d_index];
4806 int d_PDG = d_part->PdgCode();
4807 int d_ID = d_part->TrackId();
4809 theTraj->AddChild(
new G4ReweightTraj(d_ID, d_PDG, part.
TrackId(),
4815 std::map<size_t, std::string> proc_map;
4816 for (
auto it = procs.begin(); it != procs.end(); ++it) {
4820 std::vector<double> traj_X, traj_Y, traj_Z;
4821 std::vector<double> traj_PX, traj_PY, traj_PZ;
4822 std::vector<size_t> elastic_indices;
4824 bool found_last =
false;
4832 const TGeoMaterial * test_material = geo_serv->
Material(test_point);
4834 if (!
strcmp(test_material->GetName(),
"LAr")) {
4835 traj_X.push_back(x);
4836 traj_Y.push_back(y);
4837 traj_Z.push_back(z);
4839 traj_PX.push_back(part.
Px(i));
4840 traj_PY.push_back(part.
Py(i));
4841 traj_PZ.push_back(part.
Pz(i));
4843 auto itProc = proc_map.find(i);
4844 if (itProc != proc_map.end() && itProc->second ==
"hadElastic") {
4845 elastic_indices.push_back(i);
4848 std::cout <<
"LAr: " << test_material->GetDensity() <<
" " <<
4849 test_material->GetA() <<
" " << test_material->GetZ() <<
4850 " " << x <<
" " << y <<
" " << z <<
" " << part.
P(i);
4851 if (itProc != proc_map.end())
4852 std::cout <<
" " << itProc->second;
4857 auto itProc = proc_map.find(i);
4858 std::cout << test_material->GetName() <<
" " <<
4859 test_material->GetDensity() <<
" " <<
4860 test_material->GetA() <<
" " << test_material->GetZ() <<
4861 " " << x <<
" " << y <<
" " <<
z;
4862 if (itProc != proc_map.end())
4863 std::cout <<
" " << itProc->second;
4888 for (
size_t i = 1; i < traj_X.size(); ++i) {
4890 if (found_last && i == traj_X.size() - 1) {
4893 else if (std::find(elastic_indices.begin(), elastic_indices.end(), i) !=
4894 elastic_indices.end()){
4895 proc =
"hadElastic";
4898 double dX = traj_X[i] - traj_X[i-1];
4899 double dY = traj_Y[i] - traj_Y[i-1];
4900 double dZ = traj_Z[i] - traj_Z[i-1];
4902 double len = sqrt(dX*dX + dY*dY + dZ*dZ);
4904 double preStepP[3] = {traj_PX[i-1]*1.e3,
4908 double postStepP[3] = {traj_PX[i]*1.e3,
4912 double p_squared = preStepP[0]*preStepP[0] + preStepP[1]*preStepP[1] +
4913 preStepP[2]*preStepP[2];
4914 theTraj->SetEnergy(sqrt(p_squared + mass*mass));
4918 0,
event, preStepP, postStepP,
4920 theTraj->AddStep(step);
4930 std::vector<G4ReweightTraj *> results;
4935 std::map<size_t, std::string> proc_map;
4936 for (
auto it = procs.begin(); it != procs.end(); ++it) {
4940 std::vector<double> traj_X, traj_Y, traj_Z;
4944 std::vector<std::pair<size_t, size_t>>
ranges;
4947 bool found_LAr =
false;
4948 size_t start = 0,
end = 0;
4956 const TGeoMaterial * test_material = geo_serv->
Material(test_point);
4958 if (!
strcmp(test_material->GetName(),
"LAr")) {
4960 std::cout << i <<
" " <<
"LAr: " << test_material->GetDensity() <<
" " <<
4961 test_material->GetA() <<
" " << test_material->GetZ() <<
4962 " " << x <<
" " << y <<
" " << z <<
4982 std::cout << i <<
" " << test_material->GetName() <<
" " <<
4983 test_material->GetDensity() <<
" " <<
4984 test_material->GetA() <<
" " << test_material->GetZ() <<
4985 " " << x <<
" " << y <<
" " << z <<
4991 ranges.push_back({start,
end});
5023 for (
size_t i = 0; i < ranges.size(); ++i) {
5025 G4ReweightTraj * theTraj =
new G4ReweightTraj(i, part.
PdgCode(), 0,
event, {0,0});
5027 for (
size_t j = ranges[i].first; j < ranges[i].second; ++j) {
5032 double len = sqrt(dx*dx + dy*dy + dz*dz);
5034 double preStepP[3] = {part.
Px(j)*1.e3,
5038 double postStepP[3] = {part.
Px(j + 1)*1.e3,
5039 part.
Py(j + 1)*1.e3,
5040 part.
Pz(j + 1)*1.e3};
5041 if (j == ranges[i].first) {
5042 double p_squared = preStepP[0]*preStepP[0] + preStepP[1]*preStepP[1] +
5043 preStepP[2]*preStepP[2];
5044 theTraj->SetEnergy(sqrt(p_squared + mass*mass));
5048 auto itProc = proc_map.find(j);
5050 if (itProc != proc_map.end() &&
5052 proc = itProc->second;
5059 G4ReweightStep *
step =
new G4ReweightStep(i, part.
PdgCode(),
5060 0,
event, preStepP, postStepP,
5062 theTraj->AddStep(step);
5065 results.push_back(theTraj);
5068 if (results.size()) {
5072 auto d_part = plist[d_index];
5074 int d_PDG = d_part->PdgCode();
5075 int d_ID = d_part->TrackId();
5077 results.back()->AddChild(
new G4ReweightTraj(d_ID, d_PDG,
5078 results.size() - 1,
event, {0,0}));
5086 double &
x,
double &
y,
double &
z) {
5099 ROOT::Math::XYZVector xp(x,y,z);
5100 ROOT::Math::XYZVector x0(p[0], p[2], 0.);
5101 ROOT::Math::XYZVector x1(p[0] + p[1], p[2] + p[3], 1.);
5102 ROOT::Math::XYZVector u = (x1-x0).Unit();
5103 double d2 = ((xp-x0).Cross(u)) .Mag2();
5109 double * par,
int) {
5111 TGraph2D * gr =
dynamic_cast<TGraph2D*
>( (TVirtualFitter::GetFitter())->GetObjectFit() );
5113 double *
x = gr->GetX();
5114 double *
y = gr->GetY();
5115 double *
z = gr->GetZ();
5116 int npoints = gr->GetN();
5118 for (
int i = 0; i < npoints; ++i) {
5125 TGraph2D * gr =
new TGraph2D();
5126 for (
size_t i = 0; i < input.size(); ++i) {
5127 gr->SetPoint(i, input[i].
X(), input[i].
Y(), input[i].
Z());
5130 TVirtualFitter *
min = TVirtualFitter::Fitter(0,4);
5131 min->SetObjectFit(gr);
5137 min->ExecuteCommand(
"SET PRINT",arglist,1);
5140 double pStart[4] = {1,1,1,1};
5141 min->SetParameter(0,
"x0",pStart[0],0.01,0,0);
5142 min->SetParameter(1,
"Ax",pStart[1],0.01,0,0);
5143 min->SetParameter(2,
"y0",pStart[2],0.01,0,0);
5144 min->SetParameter(3,
"Ay",pStart[3],0.01,0,0);
5148 min->ExecuteCommand(
"MIGRAD", arglist, 2);
5152 for (
int i = 0; i < 4; ++i) {
5153 parFit[i] = min->GetParameter(i);
5155 double startX1, startY1, startZ1;
5156 double startX2, startY2, startZ2;
5157 line(0, parFit, startX1, startY1, startZ1);
5158 line(1, parFit, startX2, startY2, startZ2);
5160 TVector3 diff(startX2 - startX1,
def analyze(root, level, gtrees, gbranches, doprint)
double E(const int i=0) const
std::vector< double > reco_daughter_allShower_dirX
TrackID_t trackID
Geant4 supplied track ID.
std::vector< std::vector< double > > reco_daughter_spacePts_Z
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
std::vector< std::vector< double > > reco_daughter_allTrack_resRange_plane0
std::vector< int > reco_daughter_allTrack_Chi2_ndof_plane0
double true_beam_interactingEnergy
std::vector< std::vector< double > > true_beam_Pi0_decay_reco_byHits_allShower_len
std::vector< int > reco_daughter_PFP_true_byHits_origin
double quality_reco_view_0_max_segment
int true_daughter_nPiMinus
double reco_beam_momByRange_alt_proton
double reco_beam_true_byE_endPx
std::vector< std::vector< int > > true_beam_daughter_reco_byHits_allTrack_ID
unsigned int NumberTrajectoryPoints() const
std::vector< int > true_beam_slices
std::vector< double > true_beam_Pi0_decay_startPx
const std::vector< size_t > & Daughters() const
Returns the collection of daughter particles.
int reco_beam_allTrack_Chi2_ndof
const TVector3 & ShowerStart() const
std::vector< int > reco_daughter_allTrack_ID
double reco_beam_allTrack_trackEndDirX
const TLorentzVector & Position(const int i=0) const
double Z(const size_type i) const
double X(const size_type i) const
std::vector< int > true_beam_Pi0_decay_ID
float z
z position of ionization [cm]
std::vector< double > reco_daughter_allTrack_endX
int true_daughter_nProton
double reco_beam_true_byE_startPy
double true_beam_startDirZ
std::vector< std::string > true_beam_grand_daughter_Process
std::vector< std::vector< double > > true_beam_daughter_reco_byHits_PFP_trackScore
double reco_beam_PFP_michelScore
std::vector< std::vector< double > > true_beam_daughter_reco_byHits_allTrack_endX
protoana::ProtoDUNEBeamCuts beam_cuts
std::vector< int > reco_daughter_PFP_true_byHits_ID
bool quality_reco_view_1_hits_in_TPC5
double Py(const int i=0) const
std::vector< int > true_beam_Pi0_decay_parID
double reco_beam_trackDirZ
std::vector< std::vector< double > > true_beam_Pi0_decay_reco_byHits_allTrack_endX
double reco_beam_allTrack_trackDirY
std::vector< double > reco_daughter_allTrack_momByRange_alt_proton
int reco_beam_true_byE_PDG
std::vector< std::string > true_beam_grand_daughter_endProcess
double reco_beam_calo_startY
const std::vector< double > & GetTOFs() const
std::vector< std::vector< double > > reco_daughter_allTrack_dQdX_SCE
std::vector< std::string > reco_daughter_PFP_true_byHits_process
std::vector< double > reco_track_startY
std::vector< std::string > true_beam_daughter_Process
const TLorentzVector & EndPosition() const
std::vector< double > reco_daughter_PFP_true_byHits_endZ
double reco_beam_true_byHits_endE
bool quality_reco_view_0_hits_in_TPC5
std::vector< int > true_beam_process_dSlice
double reco_beam_true_byHits_endPy
size_t Self() const
Returns the index of this particle.
std::vector< double > reco_beam_dEdX
double reco_beam_true_byE_endP
std::vector< std::vector< int > > true_beam_Pi0_decay_reco_byHits_allTrack_ID
double reco_beam_calo_endY
double E(const size_type i) const
std::vector< double > reco_daughter_PFP_true_byHits_startPy
protoana::ProtoDUNEBeamlineUtils fBeamlineUtils
std::vector< double > reco_daughter_PFP_trackScore_collection
double true_beam_startDirY
double reco_beam_allTrack_endY
std::vector< std::string > reco_daughter_PFP_true_byHits_endProcess
std::vector< std::vector< double > > true_beam_Pi0_decay_reco_byHits_allTrack_startZ
std::vector< int > data_BI_PDG_candidates
std::vector< std::vector< double > > reco_daughter_spacePts_X
AdcChannelData::View View
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.
std::vector< double > reco_daughter_allTrack_endZ
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
std::string true_beam_endProcess
std::string reco_beam_true_byHits_process
const simb::MCTrajectory & Trajectory() const
std::vector< std::string > true_beam_daughter_endProcess
geo::WireID WireID() const
fhicl::ParameterSet BeamCuts
void analyze(art::Event const &evt) override
const recob::TrackTrajectory & Trajectory() const
Access to the stored recob::TrackTrajectory.
double reco_beam_true_byHits_endPx
double reco_beam_allTrack_trackDirX
Declaration of signal hit object.
std::vector< double > reco_daughter_allTrack_startZ
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 reco_beam_true_byE_endPz
std::vector< double > g4rw_primary_weights
double Pz(const size_type i) const
std::vector< double > reco_daughter_PFP_true_byHits_len
void SumDistance2(int &, double *, double &sum, double *par, int)
cnnOutput2D GetCNNOutputFromPFParticle(const recob::PFParticle &part, const art::Event &evt, const anab::MVAReader< recob::Hit, 4 > &CNN_results, protoana::ProtoDUNEPFParticleUtils &pfpUtil, std::string fPFParticleTag)
simb::Origin_t Origin() const
void line(double t, double *p, double &x, double &y, double &z)
cnnOutput2D GetCNNOutputFromPFParticleFromPlane(const recob::PFParticle &part, const art::Event &evt, const anab::MVAReader< recob::Hit, 4 > &CNN_results, protoana::ProtoDUNEPFParticleUtils &pfpUtil, std::string fPFParticleTag, size_t planeID)
std::vector< double > true_beam_incidentEnergies
int reco_beam_nTrackDaughters
std::vector< double > quality_reco_view_0_tick
std::vector< double > g4rw_alt_primary_minus_sigma_weight
std::string KeyToProcess(unsigned char const &key) const
std::map< int, TProfile * > templates
std::map< int, std::vector< const sim::IDE * > > slice_IDEs(std::vector< const sim::IDE * > ides, double the_z0, double the_pitch, double true_endZ)
double Px(const int i=0) const
double reco_beam_PFP_emScore
std::vector< int > true_beam_process_slice
protoana::ProtoDUNECalibration calibration
std::vector< double > reco_daughter_allTrack_len
std::vector< double > data_BI_TOF
double reco_beam_allTrack_trackEndDirZ
std::vector< double > true_beam_traj_Y
double quality_reco_view_2_max_segment
size_t NumberTrajectoryPoints() const
Various functions related to the presence and the number of (valid) points.
std::vector< double > reco_daughter_allTrack_Chi2_proton_plane0
std::vector< double > true_beam_Pi0_decay_startZ
std::vector< std::string > g4rw_primary_var
int true_daughter_nNucleus
std::string fGeneratorTag
std::vector< double > true_beam_daughter_endY
bool true_beam_IDE_found_in_recoVtx
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
std::vector< std::vector< int > > true_beam_Pi0_decay_reco_byHits_PFP_nHits
std::string fPFParticleTag
std::vector< double > true_beam_elastic_IDE_edep
std::vector< double > reco_track_endY
std::vector< double > true_beam_daughter_startX
std::vector< double > reco_track_startX
double quality_reco_view_0_wire_backtrack
std::vector< double > true_beam_daughter_startPx
int reco_beam_vertex_slice
Information about charge reconstructed in the active volume.
std::vector< std::vector< int > > true_beam_reco_byHits_allTrack_ID
geo::View_t View() const
View for the plane of the hit.
std::string reco_beam_true_byE_process
WireID_t Wire
Index of the wire within its plane.
double quality_reco_max_lateral
std::vector< std::vector< int > > true_beam_Pi0_decay_reco_byHits_PFP_ID
std::vector< std::pair< int, double > > getTrueSliceListFromRecoHit_electrons(detinfo::DetectorClocksData const &clockData, const recob::Hit &hit, art::ServiceHandle< cheat::BackTrackerService > bt, const std::map< int, std::vector< const sim::IDE * > > &true_slices, int beam_id)
std::vector< int > reco_daughter_allTrack_vertex_nHits
std::vector< G4ReweightTraj * > CreateNRWTrajs(const simb::MCParticle &part, const sim::ParticleList &plist, art::ServiceHandle< geo::Geometry > geo_serv, int event)
std::vector< double > reco_daughter_PFP_trackScore
std::vector< int > true_beam_daughter_PDG
TVector3 FitLine(const std::vector< TVector3 > &input)
double reco_beam_true_byE_endPy
double reco_beam_momByRange_alt_muon
std::vector< std::vector< double > > true_beam_Pi0_decay_reco_byHits_allTrack_endZ
std::vector< double > true_beam_Pi0_decay_startP
std::vector< double > quality_reco_view_0_wire
BR-MS.
std::string Process() const
std::vector< double > reco_beam_calo_startDirZ
std::vector< int > true_beam_daughter_nHits
std::vector< double > true_beam_Pi0_decay_startPy
std::vector< int > reco_track_ID
std::vector< double > reco_daughter_PFP_michelScore
int getTrueIDFromHit(detinfo::DetectorClocksData const &clockData, const recob::Hit &hit, art::ServiceHandle< cheat::BackTrackerService > bt)
int true_daughter_nNeutron
std::vector< double > reco_daughter_PFP_true_byHits_completeness
std::vector< int > cosmic_has_beam_IDE
geo::Length_t WirePitch(geo::PlaneID const &planeid) const
Returns the distance between two consecutive wires.
bool IsBeamlike(const recob::Track &, const art::Event &, std::string)
std::vector< double > reco_daughter_PFP_true_byE_completeness
std::vector< double > true_beam_daughter_len
double reco_beam_trackDirX
int NumberDaughters() const
unsigned int Nwires(unsigned int p, unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wires in the specified plane.
G4MultiReweighter * ProtMultiRW
std::vector< int > true_beam_process_matched
std::vector< double > reco_beam_incidentEnergies
std::vector< size_t > reco_daughter_PFP_true_byHits_sharedHits
EDIT: quality.
std::vector< std::vector< double > > reco_daughter_shower_spacePts_Z
std::vector< double > reco_beam_calo_tick
int Daughter(const int i) const
std::vector< double > reco_track_endX
double quality_reco_max_segment
std::vector< size_t > reco_daughter_PFP_true_byHits_emHits
const std::vector< art::Ptr< recob::Hit > > GetPFParticleHitsFromPlane_Ptrs(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel, size_t planeID) const
std::string reco_beam_true_byHits_endProcess
std::pair< double, int > GetVertexMichelScore(const recob::Track &track, const art::Event &evt, const std::string trackModule, const std::string hitModule, double min_length=5., double min_x=-200., double max_x=0., double min_y=200., double max_y=500., double min_z=25., bool check_wire=true, double check_x=0, double check_y=0., double check_z=0.)
std::vector< std::vector< double > > true_beam_Pi0_decay_reco_byHits_PFP_trackScore
std::vector< double > true_beam_daughter_startZ
std::vector< double > reco_beam_dQdX
std::vector< double > true_beam_Pi0_decay_startPz
double quality_reco_view_1_wire_backtrack
geo::TPCID FindTPCAtPosition(double const worldLoc[3]) const
Returns the ID of the TPC at specified location.
double reco_beam_trackEndDirX
std::vector< std::vector< double > > reco_daughter_allTrack_calibrated_dEdX_SCE_plane0
std::vector< double > reco_beam_spacePts_Y
std::vector< std::vector< double > > reco_daughter_allTrack_dEdX_SCE
std::vector< double > reco_daughter_allTrack_momByRange_alt_muon
double HitToEnergy(const art::Ptr< recob::Hit > hit, double X, double Y, double Z, double recomb_factor=.6417)
G4MultiReweighter * MultiRW
double distance2(double x, double y, double z, double *p)
std::vector< std::vector< double > > true_beam_daughter_reco_byHits_allShower_len
std::vector< std::vector< double > > reco_daughter_shower_spacePts_Y
std::vector< std::vector< double > > reco_daughter_allTrack_calibrated_dEdX_SCE_plane1
std::vector< std::vector< double > > true_beam_Pi0_decay_reco_byHits_allTrack_len
int reco_beam_true_byHits_origin
double reco_beam_true_byHits_startPy
QTextStream & reset(QTextStream &s)
double reco_beam_true_byE_endE
const std::vector< art::Ptr< recob::Hit > > GetRecoShowerArtHits(const recob::Shower &shower, art::Event const &evt, const std::string showerModule) const
std::vector< double > true_beam_elastic_costheta
std::vector< std::vector< double > > true_beam_daughter_reco_byHits_allShower_startY
Vector_t StartDirection() const
Access to track direction at different points.
bool reco_beam_allTrack_beam_cuts
std::vector< double > reco_daughter_allTrack_momByRange_proton
Reconstructed Daughter Info.
double Length(size_t p=0) const
Access to various track properties.
std::vector< double > reco_daughter_PFP_true_byHits_startP
double reco_beam_true_byE_startP
double Y(const size_type i) const
std::vector< double > reco_daughter_PFP_true_byHits_startX
std::vector< double > quality_reco_view_2_tick
std::vector< double > reco_daughter_PFP_emScore
#define DEFINE_ART_MODULE(klass)
std::vector< double > reco_daughter_allShower_dirY
std::vector< double > reco_daughter_PFP_true_byHits_purity
std::vector< std::vector< double > > reco_daughter_shower_spacePts_X
std::string EndProcess() const
double reco_beam_true_byE_startPz
std::vector< double > reco_daughter_PFP_true_byHits_endX
Point_t const & Start() const
Access to track position at different points.
const std::vector< short > & GetActiveFibers(std::string) const
std::vector< double > quality_reco_view_1_wire
std::vector< std::vector< double > > true_beam_daughter_reco_byHits_allShower_startZ
double reco_beam_vertex_michel_score
std::vector< double > g4rw_primary_plus_sigma_weight
Ionization at a point of the TPC sensitive volume.
const std::vector< double > & GetRecoBeamMomenta() const
double reco_beam_true_byE_startPx
T LocationAtPoint(unsigned int p) const
Position at point p. Use e.g. as:
const art::Ptr< simb::MCTruth > & TrackIdToMCTruth_P(int id) const
std::vector< std::vector< double > > reco_daughter_spacePts_Y
double reco_beam_allTrack_startZ
double Theta() const
Access to spherical or geographical angles at vertex or at any point.
std::vector< std::vector< double > > true_beam_daughter_reco_byHits_allTrack_startZ
std::vector< std::vector< double > > true_beam_Pi0_decay_reco_byHits_allShower_startX
double reco_beam_calo_startZ
std::string dEdX_template_name
std::vector< std::string > true_beam_processes
double reco_beam_PFP_emScore_collection
std::vector< double > true_beam_elastic_deltaE
std::vector< double > reco_daughter_allShower_dirZ
std::vector< double > true_beam_daughter_startP
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< int > reco_daughter_PFP_true_byHits_parID
float energy
energy deposited by ionization by this track ID and time [MeV]
bool CreateRWTraj(const simb::MCParticle &part, const sim::ParticleList &plist, art::ServiceHandle< geo::Geometry > geo_serv, int event, G4ReweightTraj *theTraj)
double reco_beam_allTrack_endZ
std::vector< double > reco_daughter_PFP_true_byHits_startPz
double reco_beam_true_byHits_endPz
std::vector< double > g4rw_alt_primary_plus_sigma_weight
std::vector< double > reco_beam_spacePts_Z
std::vector< int > true_beam_grand_daughter_PDG
std::vector< std::vector< int > > true_beam_reco_byHits_PFP_ID
double reco_beam_true_byE_startE
std::vector< double > reco_beam_TrkPitch
std::vector< std::vector< double > > true_beam_daughter_reco_byHits_allShower_startX
std::vector< double > reco_daughter_allTrack_momByRange_muon
fhicl::ParameterSet BeamPars
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
std::vector< double > reco_beam_cosmic_candidate_lower_hits
int reco_beam_true_byHits_ID
std::vector< double > true_beam_elastic_X
std::vector< std::vector< double > > true_beam_Pi0_decay_reco_byHits_allTrack_startY
std::vector< double > true_beam_daughter_startY
std::vector< std::vector< double > > true_beam_daughter_reco_byHits_allTrack_endY
SubRunNumber_t subRun() const
std::vector< std::vector< double > > true_beam_Pi0_decay_reco_byHits_allTrack_endY
std::vector< int > reco_daughter_PFP_true_byHits_parPDG
bool sort_IDEs(const sim::IDE *i1, const sim::IDE *i2)
std::vector< double > reco_daughter_PFP_true_byHits_endY
std::vector< int > reco_beam_calo_TPC
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 > reco_beam_resRange
const TVector3 & Direction() const
bool IsGoodBeamlineTrigger(art::Event const &evt) const
std::vector< double > reco_daughter_PFP_michelScore_collection
bool reco_beam_true_byE_matched
std::vector< double > reco_beam_spacePts_X
Reconstructed Daughter Info.
const std::vector< const recob::SpacePoint * > GetPFParticleSpacePoints(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const
bool CreateRWTraj(const simb::MCParticle &part, const sim::ParticleList &plist, art::ServiceHandle< geo::Geometry > geo_serv, int event, G4ReweightTraj *theTraj)
double reco_beam_true_byHits_startPz
std::string fCalorimetryTag
static int max(int a, int b)
int reco_beam_true_byE_origin
std::vector< double > true_beam_traj_KE
std::vector< double > reco_beam_calibrated_dEdX
std::vector< int > reco_beam_hit_true_origin
double reco_beam_trackEndDirZ
std::vector< std::vector< int > > true_beam_daughter_reco_byHits_allShower_ID
bool reco_beam_passes_beam_cuts
std::vector< int > true_beam_slices_found
std::vector< double > reco_beam_allTrack_calibrated_dEdX
std::vector< int > reco_daughter_PFP_true_byE_PDG
const TLorentzVector & Position(const size_type) const
The accessor methods described above.
ProcessMap const & TrajectoryProcesses() const
int true_daughter_nPiPlus
std::vector< double > reco_daughter_allShower_len
std::vector< double > reco_track_endZ
std::vector< double > reco_daughter_allShower_startZ
std::vector< int > reco_track_nHits
std::vector< int > reco_daughter_allShower_ID
std::vector< int > true_beam_grand_daughter_ID
Provides recob::Track data product.
size_t nSharedDeltaRayHits
std::vector< double > reco_daughter_allTrack_Chi2_proton
std::vector< double > quality_reco_view_2_z
std::vector< std::vector< double > > reco_daughter_allTrack_calibrated_dEdX_SCE
double reco_beam_allTrack_trackDirZ
Detector simulation of raw signals on wires.
const sim::ParticleList & ParticleList() const
std::vector< int > reco_daughter_PFP_ID
Add by hits?
std::pair< double, int > Chi2PID(const std::vector< double > &track_dedx, const std::vector< double > &range, TProfile *profile)
std::vector< std::vector< int > > true_beam_Pi0_decay_reco_byHits_allShower_ID
double reco_beam_true_byHits_startE
std::vector< double > reco_daughter_allTrack_Theta
std::vector< double > reco_track_michel_score
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
std::vector< std::vector< double > > reco_daughter_allTrack_resRange_SCE
double reco_beam_allTrack_Chi2_proton
std::vector< std::vector< double > > true_beam_Pi0_decay_reco_byHits_allShower_startZ
PionAnalyzer(fhicl::ParameterSet const &p)
const std::vector< const recob::Hit * > GetRecoTrackHitsFromPlane(const recob::Track &track, art::Event const &evt, const std::string trackModule, unsigned int planeID) const
Get the hits from a given reco track from a specific plane.
std::vector< int > reco_daughter_PFP_true_byHits_PDG
double reco_beam_PFP_trackScore_collection
Defines an enumeration for cellhit classification.
std::vector< double > true_beam_Pi0_decay_len
WireGeo const & Wire(geo::WireID const &wireid) const
Returns the specified wire.
double true_beam_IDE_totalDep
std::vector< double > reco_track_startZ
float PeakTime() const
Time of the signal peak, in tick units.
int reco_beam_allTrack_ID
std::vector< int > reco_daughter_allTrack_Chi2_ndof_plane1
std::vector< int > GetPID(beam::ProtoDUNEBeamEvent const &beamevt, double nominal_momentum)
double reco_beam_true_byHits_endP
std::vector< double > reco_daughter_allTrack_startY
const simb::MCParticle * particle
std::vector< std::vector< double > > true_beam_Pi0_decay_reco_byHits_allShower_startY
int reco_beam_vertex_nHits
Hierarchical representation of particle flow.
double reco_beam_true_byHits_startPx
std::vector< double > reco_daughter_PFP_true_byHits_startY
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
const std::vector< int > & GetTOFChans() const
double reco_beam_momByRange_proton
Contains all timing reference information for the detector.
int strcmp(const String &s1, const String &s2)
std::vector< double > reco_beam_calo_wire_z
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
std::vector< int > true_beam_daughter_ID
std::vector< std::vector< int > > true_beam_reco_byHits_PFP_nHits
double reco_beam_calo_startX
double TotalLength() const
std::vector< double > reco_daughter_allShower_energy
std::vector< int > reco_daughter_PFP_nHits_collection
std::vector< double > true_beam_daughter_endZ
std::vector< fhicl::ParameterSet > ParSet
std::vector< int > reco_daughter_allTrack_Chi2_ndof
double reco_beam_trackDirY
double reco_beam_PFP_trackScore
Vector_t EndDirection() const
std::vector< int > reco_beam_hit_true_slice
std::vector< double > reco_beam_calo_endDirX
std::vector< double > true_beam_daughter_endX
std::vector< double > quality_reco_view_1_tick
std::vector< double > reco_daughter_PFP_true_byHits_startE
Point_t const & End() const
Returns the position of the last valid point of the trajectory [cm].
int true_beam_nElasticScatters
std::vector< double > reco_daughter_PFP_true_byE_purity
std::vector< double > reco_daughter_allShower_startX
double Pz(const int i=0) const
std::vector< double > reco_beam_cosmic_candidate_upper_hits
const std::vector< art::Ptr< recob::Hit > > GetPFParticleHits_Ptrs(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const
std::vector< double > true_beam_traj_Z
double reco_beam_PFP_michelScore_collection
std::vector< double > reco_daughter_allTrack_Chi2_proton_plane1
double reco_beam_calo_endX
std::vector< int > reco_beam_hit_true_ID
std::vector< double > true_beam_Pi0_decay_startX
calo_point(size_t w, double p, double dedx, size_t index, double input_z, int t)
bool quality_reco_view_2_hits_in_TPC5
std::vector< double > true_beam_daughter_startPy
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
Point_t const & End() const
const std::vector< recob::Track > & GetBeamTracks() const
double Px(const size_type i) const
detail::Node< FrameID, bool > PlaneID
std::vector< int > true_beam_Pi0_decay_nHits
std::vector< std::vector< double > > reco_daughter_allTrack_resRange_plane1
TGeoMaterial const * Material(geo::Point_t const &point) const
Returns the material at the specified position.
std::vector< double > reco_daughter_allTrack_vertex_michel_score
std::vector< double > true_beam_elastic_Z
std::vector< int > reco_beam_cosmic_candidate_ID
std::vector< int > true_beam_grand_daughter_nHits
double reco_beam_momByRange_muon
std::vector< std::vector< double > > true_beam_daughter_reco_byHits_allTrack_len
bool reco_beam_allTrack_flipped
std::vector< double > true_beam_slices_deltaE
const std::vector< const recob::Hit * > GetPFParticleHitsFromPlane(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel, unsigned int planeID) const
std::vector< const sim::IDE * > HitToSimIDEs_Ps(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
double reco_beam_true_byHits_startP
2D representation of charge deposited in the TDC/wire plane
double true_beam_startDirX
std::vector< int > true_beam_Pi0_decay_PDG
void GetCenter(double *xyz, double localz=0.0) const
Fills the world coordinate of a point on the wire.
std::vector< double > reco_daughter_PFP_true_byHits_startZ
std::vector< double > reco_beam_calo_endDirZ
std::vector< double > reco_daughter_allTrack_to_vertex
std::vector< double > true_beam_elastic_Y
int n_cosmics_with_beam_IDE
std::string fPandora2CaloSCE
#define MF_LOG_WARNING(category)
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 > reco_beam_calo_startDirX
std::string reco_beam_true_byE_endProcess
std::vector< std::vector< int > > true_beam_daughter_reco_byHits_PFP_nHits
std::vector< double > reco_beam_calo_endDirY
std::vector< double > reco_daughter_allTrack_dR
std::vector< std::vector< double > > true_beam_Pi0_decay_reco_byHits_allTrack_startX
std::vector< float > GetCalibratedCalorimetry(const recob::Track &track, art::Event const &evt, const std::string trackModule, const std::string caloModule, size_t planeID, double negativeZFix=0.)
recob::tracking::Plane Plane
std::map< size_t, const recob::Hit * > GetRecoHitsFromTrajPoints(const recob::Track &track, art::Event const &evt, std::string trackModule)
std::vector< double > reco_daughter_allTrack_endY
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Point_t const & Start() const
Returns the position of the first valid point of the trajectory [cm].
std::vector< double > reco_daughter_allTrack_Phi
double reco_beam_allTrack_len
double reco_beam_allTrack_endX
G4ReweightParameterMaker ParMaker
double Py(const size_type i) const
std::vector< double > reco_beam_calo_startDirY
std::vector< double > reco_daughter_allShower_startY
std::vector< double > true_beam_daughter_startPz
std::array< float, N > getOutput(size_t key) const
Get copy of the MVA output vector at index "key".
bool reco_beam_true_byHits_matched
double reco_beam_Chi2_proton
std::vector< double > reco_daughter_allTrack_alt_len
std::vector< std::vector< double > > true_beam_daughter_reco_byHits_allTrack_endZ
std::vector< double > quality_reco_view_2_wire
double quality_reco_view_1_max_segment
std::vector< double > true_beam_Pi0_decay_startY
double reco_beam_allTrack_startX
std::vector< double > reco_daughter_PFP_true_byHits_startPx
std::vector< double > true_beam_traj_X
std::vector< std::vector< double > > true_beam_daughter_reco_byHits_allTrack_startX
std::vector< std::vector< int > > true_beam_daughter_reco_byHits_PFP_ID
double reco_beam_allTrack_trackEndDirY
std::vector< double > reco_daughter_PFP_emScore_collection
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
double reco_beam_true_byHits_purity
double GetTrackMomentum(double trkrange, int pdg) const
std::vector< double > g4rw_primary_minus_sigma_weight
std::vector< int > true_beam_grand_daughter_parID
cet::coded_exception< error, detail::translate > exception
std::vector< double > reco_beam_calo_wire
float numElectrons
number of electrons at the readout for this track ID and time
double lateralDist(TVector3 &n, TVector3 &x0, TVector3 &p)
double quality_reco_view_2_wire_backtrack
QTextStream & endl(QTextStream &s)
double reco_beam_trackEndDirY
std::vector< double > reco_beam_allTrack_resRange
Event finding and building.
int reco_beam_true_byHits_PDG
std::vector< G4ReweightTraj * > CreateNRWTrajs(const simb::MCParticle &part, const sim::ParticleList &plist, art::ServiceHandle< geo::Geometry > geo_serv, int event, bool fVerbose=false)
h
training ###############################
std::string fBeamModuleLabel
double reco_beam_allTrack_startY
int reco_beam_true_byE_ID
double total_electrons(std::vector< const sim::IDE * > ides)
std::vector< double > reco_daughter_allTrack_startX
std::vector< std::vector< double > > true_beam_daughter_reco_byHits_allTrack_startY
int reco_beam_nShowerDaughters
double reco_beam_calo_endZ
std::vector< int > data_BI_TOF_Chan
std::vector< int > reco_daughter_PFP_nHits
fhicl::ParameterSet CalibrationPars
const art::InputTag fTrackModuleLabel
std::vector< int > true_beam_slices_nIDEs
double reco_beam_interactingEnergy
std::vector< double > reco_daughter_PFP_true_byE_len