diff --git a/src/THcHallCSpectrometer.cxx b/src/THcHallCSpectrometer.cxx index fd145e878c2db8e3a887580c28d9b74accf7e844..c2359dcc35f842f735db47a2db2b484cca906c55 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 3f36798097cb30874b9112bf3e4bbebf17c8bad5..025bc5aa2228b041fd4ef85b3a43ec8e5dd12c97 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 };