Skip to content
Snippets Groups Projects
Commit cd9cc78c authored by Chao Peng's avatar Chao Peng
Browse files

Merge Steve's Helicity Scaler code into the repo

parent 6246cbfb
No related branches found
No related tags found
No related merge requests found
...@@ -270,6 +270,7 @@ Int_t THcHelicity::Decode(const THaEvData& evdata) { ...@@ -270,6 +270,7 @@ Int_t THcHelicity::Decode(const THaEvData& evdata) {
fMPS = fIsMPS ? 1 : 0; fMPS = fIsMPS ? 1 : 0;
fQrt = fIsQrt ? 1 : 0; // Last of quartet fQrt = fIsQrt ? 1 : 0; // Last of quartet
#if 0
if (fglHelicityScaler) { if (fglHelicityScaler) {
Int_t nhelev = fglHelicityScaler->GetNevents(); Int_t nhelev = fglHelicityScaler->GetNevents();
Int_t ncycles = fglHelicityScaler->GetNcycles(); Int_t ncycles = fglHelicityScaler->GetNcycles();
...@@ -303,6 +304,7 @@ Int_t THcHelicity::Decode(const THaEvData& evdata) { ...@@ -303,6 +304,7 @@ Int_t THcHelicity::Decode(const THaEvData& evdata) {
} }
} }
} }
#endif
if (fHelDelay == 0) { // If no delay actual=reported (but zero if in MPS) if (fHelDelay == 0) { // If no delay actual=reported (but zero if in MPS)
fActualHelicity = fIsMPS ? kUnknown : fReportedHelicity; fActualHelicity = fIsMPS ? kUnknown : fReportedHelicity;
......
This diff is collapsed.
...@@ -8,78 +8,94 @@ ...@@ -8,78 +8,94 @@
// //
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
#include "Decoder.h"
#include "THaEvtTypeHandler.h" #include "THaEvtTypeHandler.h"
#include "TString.h" #include "Decoder.h"
#include "TTree.h"
#include <algorithm>
#include <cstring>
#include <set>
#include <string> #include <string>
#include <vector> #include <vector>
#include <algorithm>
#include <set>
#include "TTree.h"
#include "TString.h"
#include <cstring>
class THcHelicity; class THcHelicity;
class THcHelicityScaler : public THaEvtTypeHandler { class THcHelicityScaler : public THaEvtTypeHandler {
public: public:
THcHelicityScaler(const char*, const char*); THcHelicityScaler(const char*, const char*);
virtual ~THcHelicityScaler(); virtual ~THcHelicityScaler();
Int_t Analyze(THaEvData* evdata); Int_t Analyze(THaEvData *evdata);
Int_t AnalyzeBuffer(UInt_t* rdata, Bool_t onlysync); Int_t AnalyzeBuffer(UInt_t *rdata);
Int_t AnalyzeHelicityScaler(UInt_t* p); Int_t AnalyzeHelicityScaler(UInt_t *p);
virtual EStatus Init(const TDatime& run_time); virtual EStatus Init( const TDatime& run_time);
virtual Int_t ReadDatabase(const TDatime& date); virtual Int_t ReadDatabase(const TDatime& date );
virtual Int_t End(THaRunBase* r = 0); virtual Int_t End( THaRunBase* r=0 );
virtual void SetUseFirstEvent(Bool_t b = kFALSE) { fUseFirstEvent = b; } virtual void SetUseFirstEvent(Bool_t b = kFALSE) {fUseFirstEvent = b;}
virtual void SetDelayedType(int evtype); virtual void SetDelayedType(int evtype);
virtual void SetROC(Int_t roc) { fROC = roc; } virtual void SetROC(Int_t roc) {fROC=roc;}
virtual void SetBankID(Int_t bankid) { fBankID = bankid; } virtual void SetBankID(Int_t bankid) {fBankID=bankid;}
virtual void SetHelicityDetector(THcHelicity* f) { fglHelicityDetector = f; } virtual void SetNScalerChannels(Int_t n) {fNScalerChannels = n;}
virtual Int_t GetNevents() { return fNevents; } virtual Int_t GetNevents() { return fNTrigsInBuf;}
virtual Int_t GetNcycles() { return fNcycles; } virtual Int_t GetNcycles() { return fNTriggers;}
virtual Int_t GetEvNum() { return evNumber; } virtual Int_t GetEvNum() { return evNumber;}
virtual Int_t* GetHelicityHistoryP() { return fHelicityHistory; } virtual Int_t* GetHelicityHistoryP() {return fHelicityHistory;}
virtual Int_t GetReportedSeed() {return fRingSeed_reported;}
virtual Int_t GetReportedActual() {return fRingSeed_actual;}
virtual Bool_t IsSeedGood() {return fNBits>=30;}
private: private:
static size_t FindNoCase(const std::string& sdata, const std::string& skey);
Int_t fNumBCMs; Int_t RanBit30(Int_t ranseed);
Double_t* fBCM_Gain; void MakeParms();
Double_t* fBCM_Offset;
Double_t* fBCM_delta_charge;
Int_t fROC;
UInt_t fBankID; UInt_t fBankID;
// Helicity Scaler variables // Helicity Scaler variables
Int_t fNevents; /* # of helicity scaler reads in last event */ Int_t fNTrigsInBuf; /* # of helicity scaler reads in last event */
Int_t fNcycles; Int_t fNTriggers;
Int_t fFirstCycle;
Int_t fHelicityHistory[200]; Int_t fHelicityHistory[200];
// //
Bool_t fUseFirstEvent; Bool_t fUseFirstEvent;
Bool_t fOnlySyncEvents; Int_t fDelayedType;
Bool_t fOnlyBanks;
Int_t fDelayedType; Int_t fRingSeed_reported;
Int_t fClockChan; Int_t fRingSeed_actual;
UInt_t fLastClock; Int_t fNBits;
Int_t fClockOverflows;
Int_t fNTriggersPlus;
Int_t fNTriggersMinus;
Double_t* fHScalers[2];
Int_t fGateCount[2];
Double_t *fScalerSums;
Double_t *fAsymmetry;
Double_t *fAsymmetryError;
Double_t *fCharge;
Double_t *fChargeAsymmetry;
Double_t fTime;
Double_t fTimeAsymmetry;
Double_t fTriggerAsymmetry;
std::vector<UInt_t*> fDelayedEvents; std::vector<UInt_t*> fDelayedEvents;
std::set<UInt_t> fRocSet; Int_t fROC;
Int_t fNScalerChannels; // Number of scaler channels/event
Int_t fNumBCMs;
Double_t *fBCM_Gain;
Double_t *fBCM_Offset;
std::vector <std::string> fBCM_Name;
THcHelicityScaler(const THcHelicityScaler& fh); THcHelicityScaler(const THcHelicityScaler& fh);
THcHelicityScaler& operator=(const THcHelicityScaler& fh); THcHelicityScaler& operator=(const THcHelicityScaler& fh);
UInt_t evcount; UInt_t evNumber;
Double_t evcountR;
UInt_t evNumber; ClassDef(THcHelicityScaler,0) // Scaler Event handler
Int_t ifound;
THcHelicity* fglHelicityDetector;
ClassDef(THcHelicityScaler, 0) // Scaler Event handler
}; };
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment