diff --git a/src/THcHodoscope.cxx b/src/THcHodoscope.cxx index e3917cef830a8de874d811311d8d4b472c2ca81a..54bf98d7ac9e94b93cbfb2aaf53be022f8fda47b 100644 --- a/src/THcHodoscope.cxx +++ b/src/THcHodoscope.cxx @@ -33,6 +33,9 @@ hodoscope array, not just one plane. #include "TClonesArray.h" #include "TMath.h" +#include "THaOutput.h" +#include "TTree.h" + #include "THaTrackProj.h" #include <vector> @@ -173,7 +176,7 @@ THaAnalysisObject::EStatus THcHodoscope::Init( const TDatime& date ) // maximum number of hits after setting up the detector map // But it needs to happen before the sub detectors are initialized // so that they can get the pointer to the hitlist. - _det_logger->info("Hodo tdc ref time cut = {} {}", fTDC_RefTimeCut, fADC_RefTimeCut); + _det_logger->info("Hodo TDC and ADC ref time cut = {} {}", fTDC_RefTimeCut, fADC_RefTimeCut); //cout << " Hodo tdc ref time cut = " << fTDC_RefTimeCut << " " << fADC_RefTimeCut << endl; InitHitList(fDetMap, "THcRawHodoHit", fDetMap->GetTotNumChan()+1, @@ -190,6 +193,7 @@ THaAnalysisObject::EStatus THcHodoscope::Init( const TDatime& date ) } } + // Why not std::vector? fNScinHits = new Int_t [fNPlanes]; fGoodPlaneTime = new Bool_t [fNPlanes]; fNPlaneTime = new Int_t [fNPlanes]; @@ -547,23 +551,37 @@ Int_t THcHodoscope::DefineVariables( EMode mode ) RVarDef vars[] = { // Move these into THcHallCSpectrometer using track fTracks - {"beta", "Beta including track info", "fBeta"}, - {"betanotrack", "Beta from scintillator hits", "fBetaNoTrk"}, - {"betachisqnotrack", "Chi square of beta from scintillator hits", "fBetaNoTrkChiSq"}, - {"fpHitsTime", "Time at focal plane from all hits", "fFPTimeAll"}, - {"starttime", "Hodoscope Start Time", "fStartTime"}, - {"goodstarttime", "Hodoscope Good Start Time (logical flag)", "fGoodStartTime"}, - {"goodscinhit", "Hit in fid area", "fGoodScinHits"}, - {"TimeHist_Sigma", "", "fTimeHist_Sigma"}, - {"TimeHist_Peak", "", "fTimeHist_Peak"}, - {"TimeHist_Hits", "", "fTimeHist_Hits"}, + {"beta" , "Beta including track info" , "fBeta" } , + {"betanotrack" , "Beta from scintillator hits" , "fBetaNoTrk" } , + {"betachisqnotrack" , "Chi square of beta from scintillator hits" , "fBetaNoTrkChiSq" } , + {"fpHitsTime" , "Time at focal plane from all hits" , "fFPTimeAll" } , + {"starttime" , "Hodoscope Start Time" , "fStartTime" } , + {"goodstarttime" , "Hodoscope Good Start Time (logical flag)" , "fGoodStartTime" } , + {"goodscinhit" , "Hit in fid area" , "fGoodScinHits" } , + {"TimeHist_Sigma" , "" , "fTimeHist_Sigma" } , + {"TimeHist_Peak" , "" , "fTimeHist_Peak" } , + {"TimeHist_Hits" , "" , "fTimeHist_Hits" } , { 0 } }; + return DefineVarsFromList( vars, mode ); // return kOK; } +//_____________________________________________________________________________ +Int_t THcHodoscope::ManualInitTree( TTree* t ){ + // The most direct path to the output tree!!! + std::string app_name = GetApparatus()->GetName(); + std::string det_name = GetName(); + std::string branch_name = (app_name + "_" + det_name + "_data"); + _det_logger->info("THcHodoscope::ManualInitTree : Adding branch, {}, to output tree", branch_name); + if (t) { + t->Branch(branch_name.c_str(), &_basic_data, 32000, 99); + } + return 0; +} //_____________________________________________________________________________ + THcHodoscope::~THcHodoscope() { // Destructor. Remove variables from global list. @@ -805,6 +823,9 @@ void THcHodoscope::EstimateFocalPlaneTime() fTimeHist_Peak= tmin; fTimeHist_Sigma= hTime->GetRMS(); fTimeHist_Hits= hTime->Integral(); + _basic_data.fTimeHist_Peak = fTimeHist_Peak ; + _basic_data.fTimeHist_Sigma = fTimeHist_Sigma; + _basic_data.fTimeHist_Hits = fTimeHist_Hits ; for(Int_t ip=0;ip<fNumPlanesBetaCalc;ip++) { goodplanetime[ip] = kFALSE; Int_t nphits=fPlanes[ip]->GetNScinHits(); @@ -1868,6 +1889,8 @@ Int_t THcHodoscope::FineProcess( TClonesArray& tracks ) if (theTrack->GetIndex()==0) { fBeta=theTrack->GetBeta(); fFPTimeAll=theTrack->GetFPTime(); + _basic_data.fBeta = fBeta; + _basic_data.fFPTimeAll = fFPTimeAll; Double_t shower_track_enorm = theTrack->GetEnergy()/theTrack->GetP(); for (Int_t ip = 0; ip < fNumPlanesBetaCalc; ip++ ){ Double_t pl_xypos=0; diff --git a/src/THcHodoscope.h b/src/THcHodoscope.h index d21f48cad4654aef054dea5499cb47b8ad30bb8e..c7c0a1e3c182ff432854368c59e2ad6de1247447 100644 --- a/src/THcHodoscope.h +++ b/src/THcHodoscope.h @@ -35,15 +35,39 @@ class THaScCalib; +namespace hallc { + namespace data { + + struct Hodoscope { + double fBeta = 0.0; + double fBetaNoTrk = 0.0; + double fBetaNoTrkChiSq = 0.0; + double fFPTimeAll = 0.0; + double fStartTime = 0.0; + double fTimeHist_Sigma = 0.0; + double fTimeHist_Peak = 0.0; + double fTimeHist_Hits = 0.0; + bool fGoodStartTime = 0; + bool fGoodScinHits = 0; + ClassDef(Hodoscope,1) + }; + + } // namespace data +} + class THcHodoscope : public hcana::ConfigLogging<THaNonTrackingDetector>, public THcHitList { public: + + hallc::data::Hodoscope _basic_data; + THcHodoscope( const char* name, const char* description = "", THaApparatus* a = NULL ); virtual ~THcHodoscope(); virtual Int_t Decode( const THaEvData& ); virtual EStatus Init( const TDatime& run_time ); + virtual Int_t ManualInitTree( TTree* t ); virtual void Clear( Option_t* opt="" ); virtual Int_t CoarseProcess( TClonesArray& tracks ); @@ -146,6 +170,8 @@ protected: // Way too many data members!!!!! // Get rid of junk! + // Why does this need to be here? + // bad design THcCherenkov* fCherenkov; Int_t fTDC_RefTimeCut; diff --git a/src/THcScintillatorPlane.cxx b/src/THcScintillatorPlane.cxx index 175ab79d04d556d24da87c1591bf99a7572abff4..c9a6b2e65f822258fbae3122bd2006b5f3ef6708 100644 --- a/src/THcScintillatorPlane.cxx +++ b/src/THcScintillatorPlane.cxx @@ -276,7 +276,7 @@ Int_t THcScintillatorPlane::ReadDatabase( const TDatime& date ) fADCDiagCut = 50.0; fCosmicFlag=0; gHcParms->LoadParmValues((DBRequest*)&list,prefix); - if (fCosmicFlag==1) cout << " setup for cosmics in scint plane"<< endl; + if (fCosmicFlag==1) _det_logger->info("THcScintillatorPlane: setup for cosmics in scint plane"); // cout << " cosmic flag = " << fCosmicFlag << endl; // fetch the parameter from the temporary list @@ -471,6 +471,7 @@ Int_t THcScintillatorPlane::DefineVariables( EMode mode ) } //end debug statement RVarDef vars[] = { + {"betterTest", "List of positive TDC counter numbers.", "frPosTdcTimeRawBetter"}, //Hodo+ raw TDC occupancy {"nhits", "Number of paddle hits (passed TDC && ADC Min and Max cuts for either end)", "GetNScinHits() "}, {"posTdcCounter", "List of positive TDC counter numbers.", "frPosTdcTimeRaw.THcSignalHit.GetPaddleNumber()"}, //Hodo+ raw TDC occupancy diff --git a/src/THcScintillatorPlane.h b/src/THcScintillatorPlane.h index e39d514712ab4c826542a860e03920fd23976006..62ef1761337367b7fec9e82446573291fac5fbb1 100644 --- a/src/THcScintillatorPlane.h +++ b/src/THcScintillatorPlane.h @@ -83,6 +83,8 @@ class THcScintillatorPlane : public THaSubDetector { TClonesArray* frNegADCPeds; TClonesArray* fHodoHits; + std::vector<double> frPosTdcTimeRawBetter; + TClonesArray* frPosTdcTimeRaw; TClonesArray* frPosAdcPedRaw; TClonesArray* frPosAdcPulseIntRaw; diff --git a/src/include/HallC_LinkDef.h b/src/include/HallC_LinkDef.h index e666b7e61449aa49fb75adc7f697ceeecd9b05f4..cd7f32c583ea1590a4bb0ea2c7d1a8633e79422d 100644 --- a/src/include/HallC_LinkDef.h +++ b/src/include/HallC_LinkDef.h @@ -12,6 +12,10 @@ #pragma link C++ namespace hallc; #pragma link C++ namespace hcana; +#pragma link C++ namespace hallc::data; + +#pragma link C++ class hallc::data::Hodoscope+; + #pragma link C++ global gHcParms; #pragma link C++ global gHcDetectorMap;