From 074950ec0e3ced8f1a1d74e76f29b287206a5b60 Mon Sep 17 00:00:00 2001 From: "Stephen A. Wood" <saw@jlab.org> Date: Thu, 30 Nov 2017 11:28:15 -0500 Subject: [PATCH] Flag events as present if evtype is in a list for given spectrometer --- src/THcHallCSpectrometer.cxx | 36 +++++++++++++++++++++++++++++++++++- src/THcHallCSpectrometer.h | 12 ++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/src/THcHallCSpectrometer.cxx b/src/THcHallCSpectrometer.cxx index fd145e8..c2359dc 100644 --- a/src/THcHallCSpectrometer.cxx +++ b/src/THcHallCSpectrometer.cxx @@ -79,7 +79,7 @@ using namespace std; //_____________________________________________________________________________ THcHallCSpectrometer::THcHallCSpectrometer( const char* name, const char* description ) : - THaSpectrometer( name, description ) + THaSpectrometer( name, description ), fPresent(kTRUE) { // Constructor. Defines the standard detectors for the HRS. // AddDetector( new THaTriggerTime("trg","Trigger-based time offset")); @@ -87,6 +87,7 @@ THcHallCSpectrometer::THcHallCSpectrometer( const char* name, const char* descri //sc_ref = static_cast<THaScintillator*>(GetDetector("s1")); SetTrSorting(kTRUE); + eventtypes.clear(); } //_____________________________________________________________________________ @@ -107,6 +108,7 @@ Int_t THcHallCSpectrometer::DefineVariables( EMode mode ) fIsSetup = ( mode == kDefine ); RVarDef vars[] = { { "tr.betachisq", "Chi2 of beta", "fTracks.THaTrack.GetBetaChi2()"}, + { "present", "Trigger Type includes this spectrometer", "fPresent"}, { 0 } }; @@ -864,6 +866,20 @@ Int_t THcHallCSpectrometer::TrackTimes( TClonesArray* Tracks ) { return 0; } +Int_t THcHallCSpectrometer::Decode( const THaEvData& evdata ) +{ + + fPresent=kTRUE; + if(eventtypes.size()!=0) { + Int_t evtype = evdata.GetEvType(); + if(!IsMyEvent(evtype)) { + fPresent = kFALSE; + } + } + + return THaSpectrometer::Decode(evdata); +} + //_____________________________________________________________________________ Int_t THcHallCSpectrometer::ReadRunDatabase( const TDatime& date ) { @@ -873,5 +889,23 @@ Int_t THcHallCSpectrometer::ReadRunDatabase( const TDatime& date ) return kOK; } +void THcHallCSpectrometer::AddEvtType(int evtype) { + eventtypes.push_back(evtype); +} + +void THcHallCSpectrometer::SetEvtType(int evtype) { + eventtypes.clear(); + AddEvtType(evtype); +} + +Bool_t THcHallCSpectrometer::IsMyEvent(Int_t evtype) const +{ + for (UInt_t i=0; i < eventtypes.size(); i++) { + if (evtype == eventtypes[i]) return kTRUE; + } + + return kFALSE; +} + //_____________________________________________________________________________ ClassImp(THcHallCSpectrometer) diff --git a/src/THcHallCSpectrometer.h b/src/THcHallCSpectrometer.h index 3f36798..025bc5a 100644 --- a/src/THcHallCSpectrometer.h +++ b/src/THcHallCSpectrometer.h @@ -49,6 +49,8 @@ public: virtual Int_t BestTrackUsingPrune(); virtual Int_t TrackTimes( TClonesArray* tracks ); + virtual Int_t Decode( const THaEvData& ); + virtual Int_t ReadRunDatabase( const TDatime& date ); virtual Int_t DefineVariables( EMode mode = kDefine ); @@ -60,6 +62,13 @@ public: Double_t GetBetaAtPcentral() const { return fPcentral/TMath::Sqrt(fPcentral*fPcentral+fPartMass*fPartMass);} + virtual void AddEvtType(int evtype); + virtual void SetEvtType(int evtype); + virtual Bool_t IsMyEvent(Int_t evtype) const; + virtual Int_t GetNumTypes() { return eventtypes.size(); }; + virtual Bool_t IsPresent() {return fPresent;}; + + protected: void InitializeReconstruction(); @@ -140,6 +149,9 @@ protected: // Flag for fProperties indicating that tracks are to be sorted by chi2 static const UInt_t kSortTracks = BIT(16); + std::vector<Int_t> eventtypes; + Bool_t fPresent; + ClassDef(THcHallCSpectrometer,0) //A Hall C Spectrometer }; -- GitLab