Skip to content

Commit

Permalink
Merge pull request #12 from JeffersonLab/develop
Browse files Browse the repository at this point in the history
Picked up the PREX injector test changes into the master branch
  • Loading branch information
paulmking authored Aug 6, 2018
2 parents 470582b + 8ecf2e5 commit 411bd7e
Show file tree
Hide file tree
Showing 52 changed files with 1,450 additions and 498 deletions.
10 changes: 5 additions & 5 deletions Analysis/include/MQwF1TDC.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class MQwF1TDC{

friend std::ostream& operator<<(std::ostream& os, const MQwF1TDC &f1tdc);

void DecodeTDCWord(UInt_t &word, const UInt_t roc_id);
void DecodeTDCWord(UInt_t &word, const ROCID_t roc_id);

Bool_t IsValidDataword() const;
const Bool_t& IsHeaderword() const {return fF1HeaderFlag;};
Expand All @@ -63,7 +63,7 @@ class MQwF1TDC{

/* Double_t SubtractReference(Double_t rawtime, Double_t reftime); */
/* Double_t ActualTimeDifference(Double_t raw_time, Double_t ref_time); */
/* Bool_t CheckDataIntegrity(const UInt_t roc_id, UInt_t *buffer, UInt_t num_words); */
/* Bool_t CheckDataIntegrity(const ROCID_t roc_id, UInt_t *buffer, UInt_t num_words); */
void PrintTDCHeader(Bool_t flag);
void PrintTDCData(Bool_t flag);
void Print(Bool_t flag);
Expand Down Expand Up @@ -181,9 +181,9 @@ class MQwF1TDC{
// MQwV775TDC. I think "IsSlotRegistered()" can do instead of this
//

void PrintHitFIFOStatus(const UInt_t roc_id);
void PrintOutputFIFOStatus(const UInt_t roc_id);
void PrintResolutionLockStatus(const UInt_t roc_id);
void PrintHitFIFOStatus(const ROCID_t roc_id);
void PrintOutputFIFOStatus(const ROCID_t roc_id);
void PrintResolutionLockStatus(const ROCID_t roc_id);



Expand Down
5 changes: 3 additions & 2 deletions Analysis/include/MQwV775TDC.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#define __MQwV775TDC__

#include "Rtypes.h"
#include "QwTypes.h"
#include <cstdlib>
#include <iostream>

Expand All @@ -34,7 +35,7 @@ class MQwV775TDC{
MQwV775TDC();
~MQwV775TDC();

void DecodeTDCWord(UInt_t &word, const UInt_t roc_id=0);
void DecodeTDCWord(UInt_t &word, const ROCID_t roc_id=0);

Bool_t IsValidDataword() {return fV775ValidFlag;};
Bool_t IsHeaderword() {return fV775HeaderFlag;};
Expand All @@ -54,7 +55,7 @@ class MQwV775TDC{
};

Double_t SubtractReference(Double_t rawtime, Double_t reftime);
Bool_t CheckDataIntegrity(const UInt_t roc_id, UInt_t *buffer, UInt_t num_words);
Bool_t CheckDataIntegrity(const ROCID_t roc_id, UInt_t *buffer, UInt_t num_words);
void PrintTDCHeader(Bool_t flag) ;
void PrintTDCData(Bool_t flag) ;

Expand Down
25 changes: 19 additions & 6 deletions Analysis/include/QwEventBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include "MQwCodaControlEvent.h"
#include "QwParameterFile.h"

#include <unordered_map>

class QwOptions;
class QwEPICSEvent;
class VQwSubsystem;
Expand Down Expand Up @@ -207,9 +209,9 @@ class QwEventBuffer: public MQwCodaControlEvent{

const TString& DataFile(const UInt_t run, const Short_t seg);

void SetEventLength(const ULong_t tmplength) {fEvtLength = tmplength;};
void SetEventType(const UInt_t tmptype) {fEvtType = tmptype;};
void SetWordsSoFar(const ULong_t tmpwords) {fWordsSoFar = tmpwords;};
// void SetEventLength(const ULong_t tmplength) {fEvtLength = tmplength;};
// void SetEventType(const UInt_t tmptype) {fEvtType = tmptype;};
// void SetWordsSoFar(const ULong_t tmpwords) {fWordsSoFar = tmpwords;};



Expand Down Expand Up @@ -245,14 +247,25 @@ class QwEventBuffer: public MQwCodaControlEvent{
Double_t fCleanParameter[3]; ///< Scan data/clean data from the green monster

UInt_t fFragLength;
UInt_t fSubbankTag;
BankID_t fSubbankTag;
UInt_t fSubbankType;
UInt_t fSubbankNum;
UInt_t fROC;
ROCID_t fROC;

TStopwatch fRunTimer; ///< Timer used for runlet processing loop
TStopwatch fStopwatch; ///< Timer used for internal timing

protected:
/// Methods and data members needed to find marker words
typedef ULong64_t RocBankLabel_t;
std::unordered_map<RocBankLabel_t, std::vector<UInt_t> > fMarkerList;
std::unordered_map<RocBankLabel_t, std::vector<UInt_t> > fOffsetList;

Int_t CheckForMarkerWords(QwSubsystemArray &subsystems);
RocBankLabel_t fThisRocBankLabel;
UInt_t FindMarkerWord(UInt_t markerID, UInt_t* buffer, UInt_t num_words);
UInt_t GetMarkerWord(UInt_t markerID);

protected:
UInt_t fNumPhysicsEvents;
UInt_t fStartingPhysicsEvent;
Expand All @@ -268,7 +281,7 @@ template < class T > Bool_t QwEventBuffer::FillObjectWithEventData(T &object){
/// - Bool_t T::CanUseThisEventType(const UInt_t event_type);
/// - Bool_t T::ClearEventData(const UInt_t event_type);
/// - Int_t T::ProcessBuffer(const UInt_t event_type,
/// const UInt_t roc_id, const UInt_t bank_id,
/// const ROCID_t roc_id, const BankID_t bank_id,
/// const UInt_t banktype, UInt_t* buffer, UInt_t num_words);
///
Bool_t okay = kFALSE;
Expand Down
19 changes: 6 additions & 13 deletions Analysis/include/QwF1TDContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,7 @@ class QwF1TDC : public TObject

UInt_t GetTotal(UInt_t* error_counter);

#if ROOT_VERSION_CODE < ROOT_VERSION(5,90,0)
ClassDef(QwF1TDC,1);
#endif
ClassDef(QwF1TDC,1);

};

Expand Down Expand Up @@ -323,7 +321,7 @@ class QwF1TDContainer : public TObject
void AddS30(Int_t roc, Int_t slot, Int_t channel);


Bool_t CheckDataIntegrity(const UInt_t roc_id, UInt_t *buffer, UInt_t num_words);
Bool_t CheckDataIntegrity(const ROCID_t roc_id, UInt_t *buffer, UInt_t num_words);

const MQwF1TDC GetF1TDCDecoder() const {return fF1TDCDecoder;};

Expand Down Expand Up @@ -377,9 +375,7 @@ class QwF1TDContainer : public TObject

Bool_t CheckSlot20Chan30(Int_t slot, Int_t chan);

#if ROOT_VERSION_CODE < ROOT_VERSION(5,90,0)
ClassDef(QwF1TDContainer,1);
#endif
ClassDef(QwF1TDContainer,1);

};

Expand Down Expand Up @@ -461,9 +457,7 @@ class F1TDCReferenceSignal : public TObject

void Clear() { fRefTimeArbUnit = (Double_t) fNoRefTimeArbUnit; fFirstHitFlag = false;};

#if ROOT_VERSION_CODE < ROOT_VERSION(5,90,0)
ClassDef(F1TDCReferenceSignal,1);
#endif
ClassDef(F1TDCReferenceSignal,1);

};

Expand Down Expand Up @@ -506,9 +500,8 @@ class F1TDCReferenceContainer : public TObject
private:

TString fSystemName;
#if ROOT_VERSION_CODE < ROOT_VERSION(5,90,0)
ClassDef(F1TDCReferenceContainer,1);
#endif

ClassDef(F1TDCReferenceContainer,1);

};

Expand Down
6 changes: 3 additions & 3 deletions Analysis/include/QwOmnivore.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class QwOmnivore: public VQwSubsystem_t {
void ClearEventData() { };

/// Process the configuration events
Int_t ProcessConfigurationBuffer(const UInt_t roc_id, const UInt_t bank_id, UInt_t* buffer, UInt_t num_words) {
Int_t ProcessConfigurationBuffer(const ROCID_t roc_id, const BankID_t bank_id, UInt_t* buffer, UInt_t num_words) {
/// Om nom nom nom
// TODO (wdc) configuration events seem to have num_words = 0xffffffff
//UInt_t cheeseburger;
Expand All @@ -70,13 +70,13 @@ class QwOmnivore: public VQwSubsystem_t {
};

/// Process the event buffer
Int_t ProcessEvBuffer(const UInt_t event_type, const UInt_t roc_id, const UInt_t bank_id, UInt_t* buffer, UInt_t num_words) {
Int_t ProcessEvBuffer(const UInt_t event_type, const ROCID_t roc_id, const BankID_t bank_id, UInt_t* buffer, UInt_t num_words) {
/// TODO: Subsystems should be changing their ProcessEvBuffer routines to take the event_type as the first
/// arguement. But in the meantime, default to just calling the non-event-type-aware ProcessEvBuffer routine.
return this->ProcessEvBuffer(roc_id, bank_id, buffer, num_words);
};
/// TODO: The non-event-type-aware ProcessEvBuffer routine should be replaced with the event-type-aware version.
Int_t ProcessEvBuffer(const UInt_t roc_id, const UInt_t bank_id, UInt_t* buffer, UInt_t num_words) {
Int_t ProcessEvBuffer(const ROCID_t roc_id, const BankID_t bank_id, UInt_t* buffer, UInt_t num_words) {
/// Om nom nom nom
UInt_t cheeseburger;
for (UInt_t word = 0; word < num_words; word++)
Expand Down
8 changes: 2 additions & 6 deletions Analysis/include/QwPromptSummary.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,7 @@ class PromptSummaryElement : public TObject
/* Double_t fAsymmetryWidthError; */
/* TString fAsymmetryWidthUnit; */

#if ROOT_VERSION_CODE < ROOT_VERSION(5,90,0)
ClassDef(PromptSummaryElement,0);
#endif
ClassDef(PromptSummaryElement,0);

};

Expand Down Expand Up @@ -179,9 +177,7 @@ class QwPromptSummary : public TObject

Bool_t fLocalDebug;

#if ROOT_VERSION_CODE < ROOT_VERSION(5,90,0)
ClassDef(QwPromptSummary,0);
#endif
ClassDef(QwPromptSummary,0);

};

Expand Down
2 changes: 0 additions & 2 deletions Analysis/include/QwSIS3320_Samples.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,7 @@ class QwSIS3320_Samples: public TObject {
size_t fTreeArrayIndex; //!< Index of this data element in tree
size_t fTreeArrayNumEntries; //!< Number of entries from this data element

#if ROOT_VERSION_CODE < ROOT_VERSION(5,90,0)
ClassDef(QwSIS3320_Samples,1);
#endif
};

// Output stream operator<< for the samples
Expand Down
9 changes: 6 additions & 3 deletions Analysis/include/QwSubsystemArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@ class QwSubsystemArray: public std::vector<boost::shared_ptr<VQwSubsystem> > {
void ClearEventData();

/// \brief Process the event buffer for configuration events
Int_t ProcessConfigurationBuffer(const UInt_t roc_id, const UInt_t bank_id,
Int_t ProcessConfigurationBuffer(const ROCID_t roc_id, const BankID_t bank_id,
UInt_t *buffer, UInt_t num_words);

/// \brief Process the event buffer for events
Int_t ProcessEvBuffer(const UInt_t event_type, const UInt_t roc_id,
const UInt_t bank_id, UInt_t *buffer,
Int_t ProcessEvBuffer(const UInt_t event_type, const ROCID_t roc_id,
const BankID_t bank_id, UInt_t *buffer,
UInt_t num_words);

/// \brief Randomize the data in this event
Expand Down Expand Up @@ -259,6 +259,9 @@ class QwSubsystemArray: public std::vector<boost::shared_ptr<VQwSubsystem> > {
protected:
void LoadSubsystemsFromParameterFile(QwParameterFile& detectors);

public:
void GetMarkerWordList(const ROCID_t roc_id, const BankID_t bank_id, std::vector<UInt_t>& marker) const;

protected:
size_t fTreeArrayIndex; //! Index of this data element in root tree

Expand Down
5 changes: 5 additions & 0 deletions Analysis/include/QwTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ class TString;
// Qweak headers
#include "QwUnits.h"

// Types for the ROC_ID and Bank_ID used in decoding and destributing data
typedef UInt_t ROCID_t;
typedef ULong64_t BankID_t; /// Bank ID will combine both bank and marker words


// Enumerator types for regions and directions
enum EQwRegionID {
kRegionIDNull = 0,
Expand Down
58 changes: 43 additions & 15 deletions Analysis/include/VQwSubsystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ class VQwSubsystem: virtual public VQwSubsystemCloneable, public MQwHistograms {
: MQwHistograms(orig),
fPublishList(orig.fPublishList),
fROC_IDs(orig.fROC_IDs),
fBank_IDs(orig.fBank_IDs)
fBank_IDs(orig.fBank_IDs),
fMarkerWords(orig.fMarkerWords)
{
fSystemName = orig.fSystemName;
fIsDataLoaded = orig.fIsDataLoaded;
Expand Down Expand Up @@ -168,16 +169,16 @@ class VQwSubsystem: virtual public VQwSubsystemCloneable, public MQwHistograms {

virtual void ClearEventData() = 0;

virtual Int_t ProcessConfigurationBuffer(const UInt_t roc_id, const UInt_t bank_id, UInt_t* buffer, UInt_t num_words) = 0;
virtual Int_t ProcessConfigurationBuffer(const ROCID_t roc_id, const BankID_t bank_id, UInt_t* buffer, UInt_t num_words) = 0;

virtual Int_t ProcessEvBuffer(const UInt_t event_type, const UInt_t roc_id, const UInt_t bank_id, UInt_t* buffer, UInt_t num_words){
virtual Int_t ProcessEvBuffer(const UInt_t event_type, const ROCID_t roc_id, const BankID_t bank_id, UInt_t* buffer, UInt_t num_words){
/// TODO: Subsystems should be changing their ProcessEvBuffer routines to take the event_type as the first
/// argument. But in the meantime, default to just calling the non-event-type-aware ProcessEvBuffer routine.
if (((0x1 << (event_type - 1)) & this->GetEventTypeMask()) == 0) return 0;
else return this->ProcessEvBuffer(roc_id, bank_id, buffer, num_words);
};
/// TODO: The non-event-type-aware ProcessEvBuffer routine should be replaced with the event-type-aware version.
virtual Int_t ProcessEvBuffer(const UInt_t roc_id, const UInt_t bank_id, UInt_t* buffer, UInt_t num_words) = 0;
virtual Int_t ProcessEvBuffer(const ROCID_t roc_id, const BankID_t bank_id, UInt_t* buffer, UInt_t num_words) = 0;

virtual void ProcessEvent() = 0;
/*! \brief Request processed data from other subsystems for internal
Expand Down Expand Up @@ -292,22 +293,46 @@ class VQwSubsystem: virtual public VQwSubsystemCloneable, public MQwHistograms {

/*! \brief Tell the object that it will decode data from this ROC and sub-bank
*/
virtual Int_t RegisterROCNumber(const UInt_t roc_id, const UInt_t bank_id = 0);
virtual Int_t RegisterROCNumber(const ROCID_t roc_id, const BankID_t bank_id = 0);

/*! \brief Tell the object that it will decode data from this sub-bank in the ROC currently open for registration
*/
Int_t RegisterSubbank(const UInt_t bank_id);
Int_t RegisterSubbank(const BankID_t bank_id);

Int_t GetSubbankIndex() const { return GetSubbankIndex(fCurrentROC_ID, fCurrentBank_ID); }
Int_t GetSubbankIndex(const UInt_t roc_id, const UInt_t bank_id) const;
void SetDataLoaded(Bool_t flag){fIsDataLoaded = flag;};
Int_t RegisterMarkerWord(const UInt_t markerword);

void RegisterRocBankMarker(QwParameterFile &mapstr);

Int_t GetSubbankIndex() const { return GetSubbankIndex(fCurrentROC_ID, fCurrentBank_ID); }
Int_t GetSubbankIndex(const ROCID_t roc_id, const BankID_t bank_id) const;
void SetDataLoaded(Bool_t flag){fIsDataLoaded = flag;};

public:
void GetMarkerWordList(const ROCID_t roc_id, const BankID_t bank_id, std::vector<UInt_t> &marker)const{
Int_t rocindex = FindIndex(fROC_IDs, roc_id);
if (rocindex>=0){
Int_t bankindex = FindIndex(fBank_IDs[rocindex],bank_id);
if (bankindex>=0 && fMarkerWords.at(rocindex).at(bankindex).size()>0){
std::vector<UInt_t> m = fMarkerWords.at(rocindex).at(bankindex);
marker.insert(marker.end(), m.begin(), m.end());
}
}
}

protected:
Int_t FindIndex(const std::vector<UInt_t> &myvec, const UInt_t value) const ;

template < class T >
Int_t FindIndex(const std::vector<T> &myvec, const T value) const
{
Int_t index = -1;
for (size_t i=0 ; i < myvec.size(); i++ ){
if (myvec[i]==value){
index=i;
break;
}
}
return index;
};

protected:

TString fSystemName; ///< Name of this subsystem
Expand All @@ -320,13 +345,16 @@ class VQwSubsystem: virtual public VQwSubsystemCloneable, public MQwHistograms {
std::map<TString, TString> fDetectorMaps;
protected:

Int_t fCurrentROC_ID; ///< ROC ID that is currently being processed
Int_t fCurrentBank_ID; ///< Bank ID that is currently being processed
ROCID_t fCurrentROC_ID; ///< ROC ID that is currently being processed
BankID_t fCurrentBank_ID; ///< Bank ID (and Marker word) that is currently being processed;

/// Vector of ROC IDs associated with this subsystem
std::vector<UInt_t> fROC_IDs;
std::vector<ROCID_t> fROC_IDs;
/// Vector of Bank IDs per ROC ID associated with this subsystem
std::vector< std::vector<UInt_t> > fBank_IDs;
std::vector< std::vector<BankID_t> > fBank_IDs;
/// Vector of marker words per ROC & subbank associated with this subsystem
std::vector< std::vector< std::vector<UInt_t> > > fMarkerWords;


/// Vector of pointers to subsystem arrays that contain this subsystem
std::vector<QwSubsystemArray*> fArrays;
Expand Down
Loading

0 comments on commit 411bd7e

Please sign in to comment.