5 #include "art_root_io/TFileService.h" 6 #include "art_root_io/TFileDirectory.h" 8 #include "canvas/Persistency/Common/FindManyP.h" 47 #include "TDirectory.h" 55 #include "TGraphErrors.h" 58 #include "TTimeStamp.h" 64 #include "TTimeStamp.h" 68 #include "TPaveStats.h" 156 fHitsModuleLabel (pset.
get<
std::
string >(
"HitsModuleLabel",
"") ),
157 fTrackModuleLabel (pset.
get<
std::
string >(
"TrackModuleLabel",
"") ),
158 fCalorimetryModuleLabel (pset.
get<
std::
string >(
"CalorimetryModuleLabel",
"") ),
159 fSaveCaloInfo (pset.
get<
bool>(
"SaveCaloInfo",false)),
160 fSaveTrackInfo (pset.
get<
bool>(
"SaveTrackInfo",false))
174 fEventTree = tfs->make<TTree>(
"Event",
"Event Tree from Reco");
248 std::vector<art::Ptr<recob::Track> > tracklist;
252 std::vector<art::Ptr<recob::PFParticle> > pfplist;
253 auto PFPListHandle = evt.
getHandle< std::vector<recob::PFParticle> >(
"pandora");
257 std::vector<art::Ptr<recob::Hit>> hitlist;
266 art::FindManyP<anab::T0> trk_t0_assn_v(PFPListHandle, evt ,
"pandora");
267 art::FindManyP<recob::PFParticle> pfp_trk_assn(trackListHandle,evt,
"pandoraTrack");
268 art::FindManyP<anab::T0> fmT0(trackListHandle, evt ,
"pmtrack");
299 size_t NTracks = tracklist.size();
300 for(
size_t i=0; i<NTracks;++i){
303 std::vector<art::Ptr<recob::PFParticle>> pfps=pfp_trk_assn.at(i);
304 if(!pfps.size())
continue;
305 std::vector<art::Ptr<anab::T0>> t0s=trk_t0_assn_v.at(pfps[0].
key());
306 if(!t0s.size())
continue;
315 std::vector<art::Ptr<anab::T0>> T0s=fmT0.at(i);
320 std::vector<art::Ptr<anab::Calorimetry>> calos=fmcal.at(i);
326 double theta_xz = std::atan2(dir_start.X(), dir_start.Z());
327 double theta_yz = std::atan2(dir_start.Y(), dir_start.Z());
328 float starty=
pos.Y();
329 float startz=
pos.Z();
332 float startcosx=dir_start.X();
333 float startcosy=dir_start.Y();
334 float startcosz=dir_start.Z();
335 float endcosx=dir_end.X();
336 float endcosy=dir_end.Y();
337 float endcosz=dir_end.Z();
338 float tracklength=track.
Length();
344 std::vector<art::Ptr<recob::Hit>> allHits=fmtht.at(i);
348 std::map<int,double> trkide;
349 std::vector<float> hitpeakT;
351 for(
size_t h1=0;
h1<allHits.size();
h1++){
352 hitpeakT.push_back(allHits[
h1]->PeakTime());
356 min=*min_element(hitpeakT.begin(),hitpeakT.end());
357 max=*max_element(hitpeakT.begin(),hitpeakT.end());
360 for(
size_t h=0;
h<allHits.size();
h++){
362 std::vector<sim::TrackIDE> eveIDs = bt_serv->
HitToTrackIDEs(clockData, hit);
363 for(
size_t e=0;
e<eveIDs.size(); ++
e){
364 trkide[eveIDs[
e].trackID] += eveIDs[
e].energy;
371 if((ii->second)>maxe){
385 EndE1 = particle->
EndE();
394 if(!particle)
continue;
401 if(!(((
std::abs(
pos.X())>340 ||
pos.Y()<20 ||
pos.Y()>580 ||
pos.Z()<20 ||
pos.Z()>675) && !(
std::abs(end.X())>310 || end.Y()<50 || end.Y()>550 || end.Z()<50 || end.Z()>645))||(!(
std::abs(
pos.X())>310 ||
pos.Y()<50 ||
pos.Y()>550 ||
pos.Z()<50 ||
pos.Z()>645) && (
std::abs(end.X())>340 || end.Y()<20 || end.Y()>580 || end.Z()<20 || end.Z()>675))))
continue;
406 for(
size_t k=0;
k<NTracks;++
k){
409 auto pos_k = track_k.
Vertex();
412 auto end_k = track_k.
End();
414 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;
415 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;
419 if(!(count==NTracks-1)|| tracklength<100)
continue;
420 int geant_trkID=particle->
TrackId();
421 int n_daughters_electron=0;
422 int n_daughters_positron=0;
424 const sim::ParticleList& plist = pi_serv->
ParticleList();
426 for(
size_t iPart = 0;(iPart<plist.size()) && (itPart!=pend); ++iPart){
430 if(pPart->
Mother()==geant_trkID && pdgcode==11) n_daughters_electron++;
431 if(pPart->
Mother()==geant_trkID && pdgcode==-11) n_daughters_positron++;
437 auto const* SCE = lar::providerFrom<spacecharge::SpaceChargeService>();
472 for(
size_t ical = 0; ical<calos.size(); ++ical){
473 if(!calos[ical])
continue;
474 if(!calos[ical]->
PlaneID().isValid)
continue;
475 int planenum = calos[ical]->PlaneID().Plane;
476 if(planenum<0||planenum>2)
continue;
477 const size_t NHits = calos[ical] ->
dEdx().size();
479 for(
size_t iHit = 0; iHit < NHits; ++iHit){
480 const auto& TrkPos = (calos[ical] -> XYZ())[iHit];
549 for(
int j=0; j<3; j++){
550 for(
int k=0;
k<3000;
k++){
def analyze(root, level, gtrees, gbranches, doprint)
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
Float_t trkstartcosxyz[kMaxTracks][3]
Float_t trkendz[kMaxTracks]
constexpr std::uint32_t timeLow() const
Float_t EndPointx[kMaxTracks]
Float_t StartPointz[kMaxTracks]
const TLorentzVector & EndPosition() const
std::string fHitsModuleLabel
std::vector< sim::TrackIDE > HitToTrackIDEs(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
Int_t daughter_positrons[kMaxTracks]
std::string fTrackModuleLabel
Handle< PROD > getHandle(SelectorBase const &) const
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
const simb::MCParticle * TrackIdToParticle_P(int id) const
Float_t StartPointx[kMaxTracks]
constexpr std::uint32_t timeHigh() const
simb::Origin_t Origin() const
Vector_t VertexDirection() const
virtual ~dEdxcalibration()
Float_t trackthetayz[kMaxTracks]
Float_t trklen[kMaxTracks]
Float_t peakT_max[kMaxTracks]
Float_t trkstarty[kMaxTracks]
Float_t trkhitz[kMaxTracks][3][3000]
object containing MC flux information
art framework interface to geometry description
Float_t trkhitx[kMaxTracks][3][3000]
Float_t trkendx[kMaxTracks]
Float_t EndPointy_corrected[kMaxTracks]
Float_t trkstartx[kMaxTracks]
Float_t EndPointx_corrected[kMaxTracks]
Float_t EndPointz[kMaxTracks]
QTextStream & reset(QTextStream &s)
double dEdx(float dqdx, float Efield)
Double_t EndE[kMaxTracks]
double Length(size_t p=0) const
Access to various track properties.
#define DEFINE_ART_MODULE(klass)
Float_t trkendy[kMaxTracks]
const art::Ptr< simb::MCTruth > & TrackIdToMCTruth_P(int id) const
Float_t trackthetaxz[kMaxTracks]
Point_t const & Vertex() const
Double_t Total_energy[kMaxTracks]
SubRunNumber_t subRun() const
Float_t StartPointy[kMaxTracks]
static int max(int a, int b)
Definition of data types for geometry description.
void analyze(const art::Event &evt)
Detector simulation of raw signals on wires.
Float_t trkhity[kMaxTracks][3][3000]
std::string fCalorimetryModuleLabel
const sim::ParticleList & ParticleList() const
Float_t EndPointy[kMaxTracks]
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
double Vx(const int i=0) const
Float_t xprojectedlen[kMaxTracks]
Declaration of signal hit object.
Float_t trkendcosxyz[kMaxTracks][3]
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Vector_t EndDirection() const
Provides recob::Track data product.
Float_t trkresrange[kMaxTracks][3][3000]
double Vz(const int i=0) const
Float_t trkdedx[kMaxTracks][3][3000]
EventNumber_t event() const
Point_t const & End() const
Float_t peakT_min[kMaxTracks]
Declaration of basic channel signal object.
detail::Node< FrameID, bool > PlaneID
auto const & get(AssnsNode< L, R, D > const &r)
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
void beginRun(const art::Run &run)
Float_t trkpitch[kMaxTracks][3][3000]
Int_t ntrkhits[kMaxTracks][3]
second_as<> second
Type of time stored in seconds, in double precision.
Float_t trkdqdx[kMaxTracks][3][3000]
Float_t EndPointz_corrected[kMaxTracks]
Float_t trkstartz[kMaxTracks]
Int_t daughter_electrons[kMaxTracks]
Int_t TrackId_geant[kMaxTracks]
double Vy(const int i=0) const
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
constexpr Point origin()
Returns a origin position with a point of the specified type.
QTextStream & endl(QTextStream &s)
Event finding and building.
Int_t true_stopping_muons