608 auto const*
geo = lar::providerFrom<geo::Geometry>();
615 auto MarlTrue =
evt.getHandle< std::vector<simb::MCTruth> >(
fMARLLabel);
617 art::FindManyP<simb::MCParticle> MarlAssn(MarlTrue,
evt,
fGEANTLabel);
620 double Px_(0), Py_(0), Pz_(0), Pnorm(1);
622 for(
size_t i = 0; i < MarlTrue->size(); i++)
624 True_Nu_Type .push_back(MarlTrue->at(i).GetNeutrino().Nu().PdgCode());
625 True_Nu_Lep_Type.push_back(MarlTrue->at(i).GetNeutrino().Lepton().PdgCode());
626 True_Mode .push_back(MarlTrue->at(i).GetNeutrino().Mode());
627 True_CCNC .push_back(MarlTrue->at(i).GetNeutrino().CCNC());
628 True_Target .push_back(MarlTrue->at(i).GetNeutrino().Target());
630 True_VertX .push_back(MarlTrue->at(i).GetNeutrino().Lepton().Vx());
631 True_VertY .push_back(MarlTrue->at(i).GetNeutrino().Lepton().Vy());
632 True_VertZ .push_back(MarlTrue->at(i).GetNeutrino().Lepton().Vz());
633 True_ENu_Lep .push_back(MarlTrue->at(i).GetNeutrino().Lepton().E());
634 True_ENu .push_back(MarlTrue->at(i).GetNeutrino().Nu().E());
635 True_Px .push_back(MarlTrue->at(i).GetNeutrino().Lepton().Px());
636 True_Py .push_back(MarlTrue->at(i).GetNeutrino().Lepton().Py());
637 True_Pz .push_back(MarlTrue->at(i).GetNeutrino().Lepton().Pz());
638 Pnorm = std::sqrt(Px_*Px_+Py_*Py_+Pz_*Pz_);
639 double Px = Px_/Pnorm;
640 double Py = Py_/Pnorm;
641 double Pz = Pz_/Pnorm;
645 True_Time.push_back(MarlTrue->at(i).GetNeutrino().Lepton().T());
648 art::FindManyP<sim::SupernovaTruth> SNTruth(MarlTrue,
evt,
fMARLLabel);
649 for (
size_t j = 0; j < SNTruth.at(i).size(); j++) {
659 <<
" - MarlSample\n";
672 WireID =
geo->NearestWireID(Vertex,
Plane);
688 double drift_velocity = detProp.DriftVelocity(detProp.Efield(),detProp.Temperature());
690 drift_velocity = drift_velocity*0.5;
697 auto APATrue =
evt.getHandle< std::vector<simb::MCTruth> >(
fAPALabel);
699 art::FindManyP<simb::MCParticle> APAAssn(APATrue,
evt,
fGEANTLabel);
706 auto CPATrue =
evt.getHandle< std::vector<simb::MCTruth> >(
fCPALabel);
708 art::FindManyP<simb::MCParticle> CPAAssn(CPATrue,
evt,
fGEANTLabel);
714 auto Ar39True =
evt.getHandle< std::vector<simb::MCTruth> >(
fAr39Label);
716 art::FindManyP<simb::MCParticle> Ar39Assn(Ar39True,
evt,
fGEANTLabel);
722 auto NeutTrue =
evt.getHandle< std::vector<simb::MCTruth> >(
fNeutLabel);
724 art::FindManyP<simb::MCParticle> NeutAssn(NeutTrue,
evt,
fGEANTLabel);
730 auto KrypTrue =
evt.getHandle< std::vector<simb::MCTruth> >(
fKrypLabel);
732 art::FindManyP<simb::MCParticle> KrypAssn(KrypTrue,
evt,
fGEANTLabel);
738 auto PlonTrue =
evt.getHandle< std::vector<simb::MCTruth> >(
fPlonLabel);
740 art::FindManyP<simb::MCParticle> PlonAssn(PlonTrue,
evt,
fGEANTLabel);
746 auto RdonTrue =
evt.getHandle< std::vector<simb::MCTruth> >(
fRdonLabel);
748 art::FindManyP<simb::MCParticle> RdonAssn(RdonTrue,
evt,
fGEANTLabel);
754 auto Ar42True =
evt.getHandle< std::vector<simb::MCTruth> >(
fAr42Label);
756 art::FindManyP<simb::MCParticle> Ar42Assn(Ar42True,
evt,
fGEANTLabel);
762 std::vector<simb::MCParticle> allTruthParts;
764 allTruthParts.push_back(it.second);
766 allTruthParts.push_back(it.second);
768 allTruthParts.push_back(it.second);
770 allTruthParts.push_back(it.second);
772 allTruthParts.push_back(it.second);
774 allTruthParts.push_back(it.second);
776 allTruthParts.push_back(it.second);
778 allTruthParts.push_back(it.second);
780 std::map<PType, std::map< int, simb::MCParticle >&> PTypeToMap{
792 std::map<PType,std::set<int>> PTypeToTrackID;
794 for(
auto const& it : PTypeToMap){
796 auto const&
m=it.second;
797 for(
auto const& it2 :
m){
799 PTypeToTrackID[
p].insert(it2.first);
806 auto reco_hits =
evt.getHandle< std::vector<recob::Hit> >(
fHitLabel);
807 auto rawDigitsVecHandle =
evt.getHandle< std::vector<raw::RawDigit> >(
fRawDigitLabel);
809 if ( reco_hits && rawDigitsVecHandle ) {
810 std::vector< recob::Hit > ColHits_Marl;
811 std::vector< recob::Hit > ColHits_CPA ;
812 std::vector< recob::Hit > ColHits_APA ;
813 std::vector< recob::Hit > ColHits_Ar39;
814 std::vector< recob::Hit > ColHits_Neut;
815 std::vector< recob::Hit > ColHits_Kryp;
816 std::vector< recob::Hit > ColHits_Plon;
817 std::vector< recob::Hit > ColHits_Rdon;
818 std::vector< recob::Hit > ColHits_Oth ;
819 std::vector< recob::Hit > ColHits_Ar42;
825 for(
int hit = 0;
hit < LoopHits; ++
hit) {
838 std::set<int> badChannels;
839 for(
size_t i=0; i<rawDigitsVecHandle->size(); ++i) {
840 int rawWireChannel=(*rawDigitsVecHandle)[i].Channel();
841 std::vector<geo::WireID> adjacentwire =
geo->ChannelToWire(rawWireChannel);
843 if (adjacentwire.size() < 1 || adjacentwire[0].Plane ==
geo::kU ||
844 adjacentwire[0].Plane ==
geo::kV){
845 badChannels.insert(rawWireChannel);
851 for(
int hit = 0;
hit < LoopHits; ++
hit) {
854 if (ThisHit.
View() == 2) {
855 std::vector<sim::TrackIDE> ThisHitIDE;
858 std::vector<const sim::IDE*> ThisSimIDE;
864 const double start = ThisHit.
PeakTime()-20;
900 double wire_start[3] = {0,0,0};
901 double wire_end[3] = {0,0,0};
902 auto& wgeo =
geo->WireIDToWireGeo(ThisHit.
WireID());
903 wgeo.GetStart(wire_start);
904 wgeo.GetEnd(wire_end);
918 if(ThisHitIDE.size()==0)
922 double TopEFrac = -DBL_MAX;
926 for (
size_t ideL=0; ideL < ThisHitIDE.size(); ++ideL) {
928 for (
size_t ipart=0; ipart<allTruthParts.size(); ++ipart) {
930 if (allTruthParts[ipart].TrackId() == ThisHitIDE[ideL].trackID) {
934 if (ThisHitIDE[ideL].energyFrac > TopEFrac) {
935 TopEFrac = ThisHitIDE[ideL].energyFrac;
944 int thisMarleyIndex=-1;
946 if(ThisPType==
kMarl && MainTrID!=0){
952 thisMarleyIndex=it->second;
967 for(
unsigned int i = 0; i < ThisSimIDE.size(); i++)
981 if (ThisPType == 0) { ColHits_Oth .push_back( ThisHit ); }
982 else if (ThisPType == 1) { ColHits_Marl.push_back( ThisHit ); }
983 else if (ThisPType == 2) { ColHits_APA .push_back( ThisHit ); }
984 else if (ThisPType == 3) { ColHits_CPA .push_back( ThisHit ); }
985 else if (ThisPType == 4) { ColHits_Ar39.push_back( ThisHit ); }
986 else if (ThisPType == 5) { ColHits_Neut.push_back( ThisHit ); }
987 else if (ThisPType == 6) { ColHits_Kryp.push_back( ThisHit ); }
988 else if (ThisPType == 7) { ColHits_Plon.push_back( ThisHit ); }
989 else if (ThisPType == 8) { ColHits_Rdon.push_back( ThisHit ); }
990 else if (ThisPType == 9) { ColHits_Ar42.push_back( ThisHit ); }
996 <<
" - Other: " << ColHits_Oth.size() <<
" col plane hits\n" 997 <<
" - Marl : " <<
TotGen_Marl <<
" true parts\t| " << ColHits_Marl.size() <<
" col plane hits\n" 998 <<
" - APA : " <<
TotGen_APA <<
" true parts\t| " << ColHits_APA .size() <<
" col plane hits\n" 999 <<
" - CPA : " <<
TotGen_CPA <<
" true parts\t| " << ColHits_CPA .size() <<
" col plane hits\n" 1000 <<
" - Ar39 : " <<
TotGen_Ar39 <<
" true parts\t| " << ColHits_Ar39.size() <<
" col plane hits\n" 1001 <<
" - Neut : " <<
TotGen_Neut <<
" true parts\t| " << ColHits_Neut.size() <<
" col plane hits\n" 1002 <<
" - Kryp : " <<
TotGen_Kryp <<
" true parts\t| " << ColHits_Kryp.size() <<
" col plane hits\n" 1003 <<
" - Plon : " <<
TotGen_Plon <<
" true parts\t| " << ColHits_Plon.size() <<
" col plane hits\n" 1004 <<
" - Rdon : " <<
TotGen_Rdon <<
" true parts\t| " << ColHits_Rdon.size() <<
" col plane hits\n" 1005 <<
" - Ar42 : " <<
TotGen_Ar42 <<
" true parts\t| " << ColHits_Ar42.size() <<
" col plane hits\n";
1007 mf::LogError(
fname) <<
"Requested to save wire hits, but cannot load any wire hits";
1014 std::vector<art::Ptr<recob::OpHit> > ophitlist;
1015 std::map<PType, std::vector<art::Ptr<recob::OpHit> > > map_of_ophit;
1023 for(
size_t i = 0; i < ophitlist.size(); ++i)
1028 std::sort(vec_tracksdp.begin(), vec_tracksdp.end(),
1031 for (
size_t iSDP=0; iSDP<vec_tracksdp.size(); ++iSDP) {
1038 if (vec_tracksdp.size()>0){
1039 int MainTrID = vec_tracksdp[0].trackID;
1043 int thisMarleyIndex;
1044 if(gen==
kMarl && MainTrID!=0){
1050 thisMarleyIndex=it->second;
1061 map_of_ophit[
gen].push_back(ophitlist.at(i));
1063 double xyz_optdet[3]={0,0,0};
1064 double xyz_world [3]={0,0,0};
1066 geo->OpDetGeoFromOpChannel(ophitlist[i]->
OpChannel()).LocalToWorld(xyz_optdet,xyz_world);
1081 <<
" - Other: " << map_of_ophit[
kUnknown].size() <<
" opt hits\n" 1082 <<
" - Marl : " <<
TotGen_Marl <<
" true parts\t| " << map_of_ophit[
kMarl].size() <<
" opt hits\n" 1083 <<
" - APA : " <<
TotGen_APA <<
" true parts\t| " << map_of_ophit[
kAPA] .size() <<
" opt hits\n" 1084 <<
" - CPA : " <<
TotGen_CPA <<
" true parts\t| " << map_of_ophit[
kCPA] .size() <<
" opt hits\n" 1085 <<
" - Ar39 : " <<
TotGen_Ar39 <<
" true parts\t| " << map_of_ophit[
kAr39].size() <<
" opt hits\n" 1086 <<
" - Neut : " <<
TotGen_Neut <<
" true parts\t| " << map_of_ophit[
kNeut].size() <<
" opt hits\n" 1087 <<
" - Kryp : " <<
TotGen_Kryp <<
" true parts\t| " << map_of_ophit[
kKryp].size() <<
" opt hits\n" 1088 <<
" - Plon : " <<
TotGen_Plon <<
" true parts\t| " << map_of_ophit[
kPlon].size() <<
" opt hits\n" 1089 <<
" - Rdon : " <<
TotGen_Rdon <<
" true parts\t| " << map_of_ophit[
kRdon].size() <<
" opt hits\n" 1090 <<
" - Ar42 : " <<
TotGen_Ar42 <<
" true parts\t| " << map_of_ophit[
kAr42].size() <<
" opt hits\n";
1093 mf::LogError(
fname) <<
"Requested to save optical hits, but cannot load any ophits";
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
Index OpChannel(Index detNum, Index channel)
std::vector< double > PDS_OpHit_X
std::vector< int > PDS_OpHit_True_TrackID
std::vector< float > True_VertY
std::vector< float > Hit_Peak
std::vector< float > True_Dirz
std::vector< float > Hit_True_Energy
std::vector< float > True_MarlTime
std::vector< float > Hit_True_Z
std::vector< unsigned short > PDS_OpHit_Frame
std::vector< int > Hit_Size
std::string fOpHitModuleLabel
std::vector< int > True_CCNC
void SaveNeighbourADC(int channel, art::Handle< std::vector< raw::RawDigit > >rawDigitsVecHandle, std::set< int > badChannels, recob::Hit const &hits)
std::vector< double > PDS_OpHit_PE
std::vector< float > True_Time
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
std::vector< double > PDS_OpHit_True_Energy
geo::WireID WireID() const
std::vector< int > PDS_OpHit_True_IndexAll
float RMS() const
RMS of the hit shape, in tick units.
std::vector< double > Hit_X_end
The data type to uniquely identify a Plane.
std::map< int, int > trkIDToMarleyIndex
std::vector< float > True_Py
std::vector< double > Hit_Y_start
std::vector< float > Hit_SADC
PType WhichParType(int TrID)
Planes which measure Z direction.
std::vector< int > Hit_True_nIDEs
float Integral() const
Integral under the calibrated signal waveform of the hit, in tick x ADC units.
geo::View_t View() const
View for the plane of the hit.
double Width(Resonance_t res)
resonance width (GeV)
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
std::vector< int > Hit_View
std::vector< int > True_MarlSample
std::vector< float > Hit_Time
std::map< int, simb::MCParticle > RdonParts
std::vector< int > True_VertexChan
std::vector< int > True_HitNucleon
std::vector< double > PDS_OpHit_FastToTotal
SupernovaSamplingMode_t SamplingMode
Method used to sample the supernova neutrino's energy and arrival time.
float PeakAmplitude() const
The estimated amplitude of the hit at its peak, in ADC units.
std::vector< int > PDS_OpHit_OpChannel
void FillTruth(const art::FindManyP< simb::MCParticle > Assn, const art::Handle< std::vector< simb::MCTruth >> &Hand, const PType type)
std::vector< double > Hit_Z_start
std::vector< float > True_ENu
double Weight
Statistical weight for this neutrino vertex.
std::string fRawDigitLabel
std::vector< float > True_Pz
std::vector< float > Hit_RMS
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
std::vector< float > Hit_True_X
std::vector< int > Hit_True_GenType
std::vector< int > PDS_OpHit_True_Index
std::vector< int > PDS_OpHit_True_TrackIDAll
std::map< int, simb::MCParticle > MarlParts
float energyFrac
fraction of OpHit energy from the particle with this trackID
std::vector< int > True_Target
std::vector< sim::TrackSDP > OpHitToTrackSDPs(art::Ptr< recob::OpHit > const &opHit_P)
std::map< int, simb::MCParticle > Ar39Parts
std::vector< double > PDS_OpHit_Y
std::vector< double > PDS_OpHit_Z
std::vector< double > PDS_OpHit_True_EnergyAll
std::vector< float > Hit_Int
std::vector< int > Hit_True_MarleyIndex
void FillMyMaps(std::map< int, simb::MCParticle > &MyMap, art::FindManyP< simb::MCParticle > Assn, art::Handle< std::vector< simb::MCTruth > > Hand, std::map< int, int > *indexMap=nullptr)
std::vector< double > Hit_Z_end
std::vector< float > Hit_True_Y
raw::TDCtick_t StartTick() const
Initial tdc tick for hit.
std::vector< int > True_Nu_Lep_Type
void SaveIDEs(art::Event const &evt)
art::ServiceHandle< cheat::PhotonBackTrackerService > pbt_serv
Detector simulation of raw signals on wires.
std::vector< float > True_VertX
std::vector< int > Hit_TPC
std::vector< float > True_VertexT
std::vector< double > PDS_OpHit_Amplitude
raw::TDCtick_t EndTick() const
Final tdc tick for hit.
std::vector< int > Hit_True_MainTrID
Ionization photons from a Geant4 track.
std::vector< int > True_Nu_Type
std::vector< double > PDS_OpHit_Area
std::vector< float > Hit_True_EvEnergy
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
std::vector< double > PDS_OpHit_PeakTimeAbs
std::vector< int > Hit_True_TrackID
std::map< int, simb::MCParticle > NeutParts
float PeakTime() const
Time of the signal peak, in tick units.
std::vector< float > True_VertZ
std::map< int, PType > trkIDToPType
std::vector< int > PDS_OpHit_True_GenType
double SupernovaTime
Arrival time of the supernova neutrino (seconds)
std::map< int, simb::MCParticle > PlonParts
std::vector< int > Hit_Chan
std::vector< double > PDS_OpHit_Width
std::map< int, simb::MCParticle > APAParts
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
std::vector< float > True_Dirx
std::vector< int > True_Mode
std::map< int, simb::MCParticle > CPAParts
std::vector< double > PDS_OpHit_PeakTime
std::map< int, simb::MCParticle > KrypParts
std::map< int, simb::MCParticle > Ar42Parts
std::vector< double > Hit_Y_end
std::vector< float > True_Px
float SummedADC() const
The sum of calibrated ADC counts of the hit (0. by default)
std::vector< int > PDS_OpHit_True_GenTypeAll
std::vector< float > True_ENu_Lep
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
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
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
TPCID_t TPC
Index of the TPC within its cryostat.
std::vector< float > Hit_True_nElec
recob::tracking::Plane Plane
LArSoft geometry interface.
std::vector< double > Hit_X_start
std::vector< float > True_Diry
raw::ChannelID_t Channel() const
ID of the readout channel the hit was extracted from.
std::vector< float > True_MarlWeight
std::vector< sim::TrackIDE > ChannelToTrackIDEs(detinfo::DetectorClocksData const &clockData, raw::ChannelID_t channel, const double hit_start_time, const double hit_end_time) const
QTextStream & endl(QTextStream &s)
art::ServiceHandle< cheat::BackTrackerService > bt_serv