diff --git a/src/THcDC.cxx b/src/THcDC.cxx index 6ccc9d8cef11b7aa7e7036e02f9b0cd351242c35..cb5c1284b54ca48e69edad2755d48ec36bc400c1 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 60484001319d51b44fd63430254b2648ce608071..92759740e469da2bcb2e85abdacc5823a70b9d53 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 54bf98d7ac9e94b93cbfb2aaf53be022f8fda47b..a4e4ce53fc3429f9041bddf5d451d3005085efa9 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 cd7f32c583ea1590a4bb0ea2c7d1a8633e79422d..76b06d24370095833352e1d1715ae3e801ba3625 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;