137 auto recoParticleHandle =
evt.getHandle<std::vector<recob::PFParticle>>(
fPFParticleTag);
138 if( !recoParticleHandle )
return;
141 std::map<int,std::vector<double>> hit_w_and_t1;
142 std::map<int,std::vector<double>> hit_w_and_t2;
143 std::map<int,std::vector<double>> hit_w_and_y;
144 std::map<int,std::vector<double>> hit_w_and_x;
152 if( thisShower == 0x0 )
continue;
153 if( !
evt.isRealData() ){
155 if(
abs(mcparticle->
PdgCode()) != 11 )
return;
162 art::FindManyP<recob::Wire> wFromHits(sh_hits,
evt,
"hitpdune");
164 for(
size_t j=0; j<sh_hits.size() && j<
MAXHits; ++j){
165 if( sh_hits[j]->
WireID().Plane != 2 )
continue;
166 std::vector<art::Ptr<recob::Wire>> wires = wFromHits.at(j);
168 hit_w_and_t1[wires[0]->Channel()].push_back(sh_hits[j]->PeakTimeMinusRMS(5.0));
169 hit_w_and_t2[wires[0]->Channel()].push_back(sh_hits[j]->PeakTimePlusRMS(5.0));
171 hit_w_and_x[wires[0]->Channel()].push_back(detProp.ConvertTicksToX(sh_hits[j]->PeakTime(),sh_hits[j]->WireID().Plane,sh_hits[j]->WireID().TPC,0));
172 std::vector<art::Ptr<recob::SpacePoint>> sp = spFromShowerHits.at(j);
174 hit_w_and_y[wires[0]->Channel()].push_back(sp[0]->XYZ()[1]);
186 auto const& wires =
evt.getValidHandle<std::vector<recob::Wire> >(
fWireTag);
188 auto w1 = hit_w_and_t1.begin();
189 auto w2 = hit_w_and_t2.begin();
190 auto x = hit_w_and_x.begin();
191 auto y = hit_w_and_y.begin();
192 while( w1 != hit_w_and_t1.end()){
193 int it_w = w1->first;
194 int n_hits = w1->second.size();
196 double t1 = w1->second[0];
197 double t2 = w2->second[n_hits-1];
199 if(
x->second.size() < 1 ){
200 x_w = (
x->second[0]-
x->second[n_hits-1])/2.0;
201 y_w = (
y->second[0]-
y->second[n_hits-1])/2.0;
207 for(
auto & wire : * wires){
208 int channel_no = wire.Channel();
210 if( plane != 2 )
continue;
213 TVector3 xyzWire = pwire->
GetCenter<TVector3>();
214 if( it_w == channel_no ){
216 for(
size_t i = 0; i < wire.Signal().size(); ++i){
217 if( i > t1 && i < t2 ) charge += wire.Signal()[i];
233 if(!
evt.isRealData()){
234 auto mcTruths =
evt.getValidHandle<std::vector<simb::MCTruth>>(
"generator");
236 int trackid = mcparticle->
TrackId();
237 if( mcparticle->
TrackId() == geantGoodParticle->TrackId() ){
239 auto simchannelHandle =
evt.getHandle< std::vector<sim::SimChannel> >(
"largeant");
240 if (simchannelHandle){
241 for(
auto const& simchannel : (*simchannelHandle)){
243 auto const& alltimeslices = simchannel.TDCIDEMap();
245 for(
auto const& tslice : alltimeslices){
246 auto const& simide = tslice.second;
248 for(
auto const& eDep : simide){
249 if(eDep.trackID == trackid || eDep.trackID == -trackid){
250 EperCh += eDep.energy;
254 if( EperCh== 0 )
continue;
Geometry description of a TPC wireThe wire is a single straight segment on a wire plane...
const TVector3 & ShowerStart() 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.
std::vector< float > fprimary_Shower_wire_Z
const simb::MCParticle * GetGeantGoodParticle(const simb::MCTruth &genTruth, const art::Event &evt) const
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< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
protoana::ProtoDUNETruthUtils truthUtil
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
std::vector< float > fprimary_Shower_wire_ch
std::vector< int > fprimary_Shower_MCwire_w
std::vector< float > fprimary_Shower_wire_X
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...
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
std::string fPFParticleTag
std::vector< float > fprimary_Shower_MCwire_E
Hierarchical representation of particle flow.
geo::GeometryCore const * fGeometry
std::vector< int > fprimary_Shower_wire_w
protoana::ProtoDUNEPFParticleUtils pfpUtil
std::vector< float > fprimary_Shower_wire_Y
void GetCenter(double *xyz, double localz=0.0) const
Fills the world coordinate of a point on the wire.
const simb::MCParticle * GetMCParticleFromRecoShower(detinfo::DetectorClocksData const &clockData, const recob::Shower &shower, art::Event const &evt, std::string showerModule) const
protoana::ProtoDUNEShowerUtils showerUtil
float fprimaryStartPosition[3]
WireGeo const * WirePtr(geo::WireID const &wireid) const
Returns the specified wire.