221 std::vector<art::Ptr<recob::Track> > tracklist;
222 auto trackListHandle = evt.
getHandle< std::vector<recob::Track> >(
"pandoraTrack");
223 if (trackListHandle){
228 std::vector<art::Ptr<recob::PFParticle> > pfplist;
229 auto PFPListHandle = evt.
getHandle< std::vector<recob::PFParticle> >(
"pandora");
233 std::vector<art::Ptr<recob::Hit>> hitlist;
237 art::FindManyP<recob::Hit, recob::TrackHitMeta> fmthm(trackListHandle, evt,
fTrackModuleLabel);
244 if (!fmcal.isValid()){
249 art::FindManyP<anab::T0> trk_t0_assn_v(PFPListHandle, evt ,
"pandora");
252 art::FindManyP<recob::PFParticle> pfp_trk_assn(trackListHandle,evt,
"pandoraTrack");
253 art::FindManyP<anab::T0> fmT0(trackListHandle, evt ,
"pmtrack");
280 size_t NTracks = tracklist.size();
281 for(
size_t i=0; i<NTracks;++i){
284 std::vector<art::Ptr<recob::PFParticle>> pfps=pfp_trk_assn.at(i);
285 if(!pfps.size())
continue;
286 std::vector<art::Ptr<anab::T0>> t0s=trk_t0_assn_v.at(pfps[0].
key());
287 if(!t0s.size())
continue;
296 std::vector<art::Ptr<anab::T0>> T0s=fmT0.at(i);
301 std::vector<art::Ptr<anab::Calorimetry>> calos=fmcal.at(i);
308 double theta_xz = std::atan2(dir_start.X(), dir_start.Z());
309 double theta_yz = std::atan2(dir_start.Y(), dir_start.Z());
310 float startx=
pos.X();
311 float starty=
pos.Y();
312 float startz=
pos.Z();
317 float startcosx=dir_start.X();
318 float startcosy=dir_start.Y();
319 float startcosz=dir_start.Z();
320 float endcosx=dir_end.X();
321 float endcosy=dir_end.Y();
322 float endcosz=dir_end.Z();
323 float tracklength=track.
Length();
329 std::vector<art::Ptr<recob::Hit>> allHits=fmtht.at(i);
330 std::vector<float> hitpeakT;
331 for(
size_t h1=0;
h1<allHits.size();
h1++){
332 hitpeakT.push_back(allHits[
h1]->PeakTime());
337 min=*min_element(hitpeakT.begin(),hitpeakT.end());
338 max=*max_element(hitpeakT.begin(),hitpeakT.end());
352 for(
size_t k=0;
k<NTracks;++
k){
356 auto pos_k = track_k.
Vertex();
359 auto end_k = track_k.
End();
361 if((
std::abs(((end_k.Y()-pos_k.Y())/(end_k.Z()-pos_k.Z()))*(endz-pos_k.Z())+pos_k.Y()-endy)<30||
std::abs(((end_k.Y()-pos_k.Y())/(end_k.Z()-pos_k.Z()))*(startz-pos_k.Z())+pos_k.Y()-starty)<30)&&(
std::abs(endcosx*dir_pos_k.X()+endcosy*dir_pos_k.Y()+endcosz*dir_pos_k.Z())>0.97||
std::abs(startcosx*dir_pos_k.X()+startcosy*dir_pos_k.Y()+startcosz*dir_pos_k.Z())>0.97||
std::abs(endcosx*dir_end_k.X()+endcosy*dir_end_k.Y()+endcosz*dir_end_k.Z())>0.97||
std::abs(startcosx*dir_end_k.X()+startcosy*dir_end_k.Y()+startcosz*dir_end_k.Z())>0.97))
break;
362 if((
std::abs(((end_k.Y()-pos_k.Y())/(end_k.Z()-pos_k.Z()))*(endz-pos_k.Z())+pos_k.Y()-endy)<50||
std::abs(((end_k.Y()-pos_k.Y())/(end_k.Z()-pos_k.Z()))*(startz-pos_k.Z())+pos_k.Y()-starty)<50)&&(
std::abs(endcosx*dir_pos_k.X()+endcosy*dir_pos_k.Y()+endcosz*dir_pos_k.Z())>0.998||
std::abs(startcosx*dir_pos_k.X()+startcosy*dir_pos_k.Y()+startcosz*dir_pos_k.Z())>0.998||
std::abs(endcosx*dir_end_k.X()+endcosy*dir_end_k.Y()+endcosz*dir_end_k.Z())>0.998||
std::abs(startcosx*dir_end_k.X()+startcosy*dir_end_k.Y()+startcosz*dir_end_k.Z())>0.998))
break;
366 if(!(count==NTracks-1)|| tracklength<100)
continue;
370 std::vector<int> wirenos;
371 std::vector<float> peakts;
380 auto vhit=fmthm.at(i);
381 auto vmeta=fmthm.data(i);
382 for (
size_t ii = 0; ii<vhit.size(); ++ii){
383 bool fBadhit =
false;
389 if (vmeta[ii]->
Index()>=tracklist[i]->NumberTrajectoryPoints()){
390 throw cet::exception(
"Calorimetry_module.cc") <<
"Requested track trajectory index "<<vmeta[ii]->Index()<<
" exceeds the total number of trajectory points "<<tracklist[i]->NumberTrajectoryPoints()<<
" for track index "<<i<<
". Something is wrong with the track reconstruction. Please contact tjyang@fnal.gov!!";
392 if (!tracklist[i]->HasValidPoint(vmeta[ii]->
Index())){
397 auto loc = tracklist[i]->LocationAtPoint(vmeta[ii]->
Index());
402 if (fBadhit)
continue;
403 if (zpos<-100)
continue;
404 planenum1=vhit[ii]->WireID().Plane;
406 if(starty<endy) dist=sqrt(
pow(xpos-startx,2)+
pow(ypos-starty,2)+
pow(zpos-startz,2));
407 if(starty>endy) dist=sqrt(
pow(xpos-endx,2)+
pow(ypos-endy,2)+
pow(zpos-endz,2));
412 peakts.push_back(vhit[ii]->PeakTime());
417 wireno=vhit[ii]->WireID().Wire;
418 peaktime=vhit[ii]->PeakTime();
419 tpcno=vhit[ii]->WireID().TPC;
427 for(
size_t hitl=0;hitl<hitlist.size();hitl++){
428 auto &
tracks = thass.at(hitlist[hitl].
key());
434 if (!
tracks.empty() &&
tracks[0].key()!=ptrack.key() && tracklist[
tracks[0].key()]->Length()>100)
continue;
436 float peakth1=hitlist[hitl]->PeakTime();
437 int wireh1=hitlist[hitl]->WireID().Wire;
438 for(
size_t m=0;
m<wirenos.size();
m++){
439 if(wireh1==wirenos[
m] && peakth1==peakts[
m]){
446 int planeid=hitlist[hitl]->WireID().Plane;
447 int tpcid=hitlist[hitl]->WireID().TPC;
448 if(
abs(wireh1-wireno)<6 &&
abs(peakth1-peaktime)<50 && planeid==2 && tpcid==tpcno){
458 cout<<
"no of hits closeby "<<counter1<<
" "<<
"event "<<
event<<
" TrkackID "<<track.
ID()<<
" startx, y, z "<<startx<<
" "<<starty<<
" "<<startz<<
" wireno, peakt tpcno "<<wireno<<
" "<<peaktime<<
" "<<tpcno<<
" dist "<<dist0<<
"min T, max_T"<<min<<
" "<<max<<
endl;
489 for(
size_t ical = 0; ical<calos.size(); ++ical){
490 if(!calos[ical])
continue;
491 if(!calos[ical]->
PlaneID().isValid)
continue;
492 int planenum = calos[ical]->PlaneID().Plane;
493 if(planenum<0||planenum>2)
continue;
494 const size_t NHits = calos[ical] ->
dEdx().size();
496 for(
size_t iHit = 0; iHit < NHits; ++iHit){
497 const auto& TrkPos = (calos[ical] -> XYZ())[iHit];
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
Float_t lastpeakt[kMaxTracks]
std::string fCalorimetryModuleLabel
constexpr std::uint32_t timeLow() const
Float_t trkhity[kMaxTracks][3][3000]
Float_t trkstartx[kMaxTracks]
Handle< PROD > getHandle(SelectorBase const &) const
Float_t trkhitx[kMaxTracks][3][3000]
constexpr std::uint32_t timeHigh() const
Float_t trkstartcosxyz[kMaxTracks][3]
Float_t trkendcosxyz[kMaxTracks][3]
Vector_t VertexDirection() const
std::string fTrackModuleLabel
Float_t trkendx[kMaxTracks]
Float_t trkdqdx[kMaxTracks][3][3000]
Float_t trkstarty[kMaxTracks]
Float_t trackthetayz[kMaxTracks]
Float_t trackthetaxz[kMaxTracks]
Float_t trkresrange[kMaxTracks][3][3000]
double dEdx(float dqdx, float Efield)
double Length(size_t p=0) const
Access to various track properties.
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
Float_t peakT_max[kMaxTracks]
Int_t ntrkhits[kMaxTracks][3]
Point_t const & Vertex() const
Float_t dist_min[kMaxTracks]
SubRunNumber_t subRun() const
Float_t peakT_min[kMaxTracks]
static int max(int a, int b)
Float_t trkendy[kMaxTracks]
Float_t trkhitz[kMaxTracks][3][3000]
std::string fHitsModuleLabel
Float_t trkdedx[kMaxTracks][3][3000]
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
Vector_t EndDirection() const
Int_t adjacent_hits[kMaxTracks]
Float_t trkstartz[kMaxTracks]
Int_t lastwire[kMaxTracks]
EventNumber_t event() const
Point_t const & End() const
detail::Node< FrameID, bool > PlaneID
Float_t trkpitch[kMaxTracks][3][3000]
Float_t trkendz[kMaxTracks]
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
Float_t trklen[kMaxTracks]
cet::coded_exception< error, detail::translate > exception
QTextStream & endl(QTextStream &s)