From 45a0afa7546b26583675c68c071b860c05c05260 Mon Sep 17 00:00:00 2001 From: Whitney Armstrong <warmstrong@anl.gov> Date: Fri, 1 Feb 2019 09:38:10 -0600 Subject: [PATCH] Added manual tree output to THcDC modified: THcDC.cxx modified: THcDC.h modified: THcHodoscope.cxx modified: include/HallC_LinkDef.h --- src/THcDC.cxx | 22 +++++++++++++++++----- src/THcDC.h | 23 +++++++++++++++++++++++ src/THcHodoscope.cxx | 4 ++-- src/include/HallC_LinkDef.h | 1 + 4 files changed, 43 insertions(+), 7 deletions(-) diff --git a/src/THcDC.cxx b/src/THcDC.cxx index 6ccc9d8..cb5c128 100644 --- a/src/THcDC.cxx +++ b/src/THcDC.cxx @@ -277,6 +277,18 @@ THaAnalysisObject::EStatus THcDC::Init( const TDatime& date ) } return fStatus = kOK; } +//_____________________________________________________________________________ + +Int_t THcDC::ManualInitTree( TTree* t ){ + std::string app_name = GetApparatus()->GetName(); + std::string det_name = GetName(); + std::string branch_name = (app_name + "_" + det_name + "_data"); + if (t) { + _det_logger->info("THcDC::ManualInitTree : Adding branch, {}, to output tree", branch_name); + t->Branch(branch_name.c_str(), &_basic_data, 32000, 99); + } + return 0; +} //_____________________________________________________________________________ Int_t THcDC::ReadDatabase( const TDatime& date ) @@ -673,13 +685,13 @@ void THcDC::SetFocalPlaneBestTrack(Int_t golden_track_index) fSp2_ID_best=tr1->GetSp2_ID(); fChisq_best=tr1->GetChisq(); fNsp_best=tr1->GetNSpacePoints(); - for (UInt_t ihit = 0; ihit < UInt_t (tr1->GetNHits()); ihit++) { - THcDCHit *hit = tr1->GetHit(ihit); - Int_t plane = hit->GetPlaneNum() - 1; + for (UInt_t ihit = 0; ihit < UInt_t (tr1->GetNHits()); ihit++) { + THcDCHit *hit = tr1->GetHit(ihit); + Int_t plane = hit->GetPlaneNum() - 1; fResiduals[plane] = tr1->GetResidual(plane); fResidualsExclPlane[plane] = tr1->GetResidualExclPlane(plane); - } - EfficiencyPerWire(golden_track_index); + } + EfficiencyPerWire(golden_track_index); } // void THcDC::EfficiencyPerWire(Int_t golden_track_index) diff --git a/src/THcDC.h b/src/THcDC.h index 6048400..9275974 100644 --- a/src/THcDC.h +++ b/src/THcDC.h @@ -19,6 +19,25 @@ #define NUM_FPRAY 4 +namespace hallc { + namespace data { + + /** Drift chamber data. + * Currently just for testing + */ + struct DriftChamber { + + std::vector<double> _Residuals; + std::vector<double> _ResidualsExclPlane; + std::vector<double> _Wire_hit_did; + std::vector<double> _Wire_hit_should; + + ClassDef(DriftChamber,1) + }; + + } // namespace data +} + //class THaScCalib; class TClonesArray; @@ -28,12 +47,16 @@ protected: std::shared_ptr<spdlog::logger> _sub_logger; //! public: + + hallc::data::DriftChamber _basic_data; + THcDC( const char* name, const char* description = "", THaApparatus* a = NULL ); virtual ~THcDC(); virtual Int_t Decode( const THaEvData& ); virtual EStatus Init( const TDatime& run_time ); + virtual Int_t ManualInitTree( TTree* t ); virtual Int_t End(THaRunBase* run=0); virtual Int_t CoarseTrack( TClonesArray& tracks ); virtual Int_t FineTrack( TClonesArray& tracks ); diff --git a/src/THcHodoscope.cxx b/src/THcHodoscope.cxx index 54bf98d..a4e4ce5 100644 --- a/src/THcHodoscope.cxx +++ b/src/THcHodoscope.cxx @@ -1546,7 +1546,7 @@ void THcHodoscope::TrackEffTest(void) using HitIterator = std::vector<THcHodoHit*>::iterator; using HitRangeVector = typename std::vector<std::pair<HitIterator, HitIterator>>; using ClusterPositions = typename std::vector<double>; - std::vector<std::vector<THcHodoHit*>> hit_vecs; + std::map<int,std::vector<THcHodoHit*>> hit_vecs; std::vector<HitRangeVector> hit_clusters; std::vector<ClusterPositions> pos_clusters; std::vector<std::vector<int>> good_clusters; @@ -1558,7 +1558,7 @@ void THcHodoscope::TrackEffTest(void) TClonesArray* hodoHits = fPlanes[ip]->GetHits(); // Create vector for good hits. - hit_vecs.push_back(std::vector<THcHodoHit*>()); + hit_vecs[ip] = std::vector<THcHodoHit*>(); for (Int_t iphit = 0; iphit < fPlanes[ip]->GetNScinHits(); iphit++ ){ THcHodoHit *hit = (THcHodoHit*)hodoHits->At(iphit); // keep only those with "two good times" diff --git a/src/include/HallC_LinkDef.h b/src/include/HallC_LinkDef.h index cd7f32c..76b06d2 100644 --- a/src/include/HallC_LinkDef.h +++ b/src/include/HallC_LinkDef.h @@ -15,6 +15,7 @@ #pragma link C++ namespace hallc::data; #pragma link C++ class hallc::data::Hodoscope+; +#pragma link C++ class hallc::data::DriftChamber+; #pragma link C++ global gHcParms; -- GitLab