Hall A ROOT/C++ Analyzer (podd)
Loading...
Searching...
No Matches
Caen1190Module.h
Go to the documentation of this file.
1#ifndef Podd_Caen1190Module_h_
2#define Podd_Caen1190Module_h_
3
5//
6// Caen1190Module
7//
9
10
11#include "PipeliningModule.h"
12#include <cstring> // for memset
13#include <vector>
14#include <string>
15
16namespace Decoder {
17
19
20public:
21
22 Caen1190Module() : fSlotData(nullptr), fEvBuf(nullptr), fNfill(0) {}
23 Caen1190Module( Int_t crate, Int_t slot );
24 virtual ~Caen1190Module() = default;
25
27 using VmeModule::Init;
28
29 virtual void Init();
30 virtual void Clear( Option_t* opt = "" );
31 virtual Int_t Decode( const UInt_t* p );
32 virtual UInt_t GetData( UInt_t chan, UInt_t hit ) const;
33 virtual UInt_t GetOpt( UInt_t chan, UInt_t hit ) const;
34
35 // Loads slot data
36 virtual UInt_t LoadSlot( THaSlotData* sldat, const UInt_t* evbuffer,
37 const UInt_t* pstop );
38 // Loads slot data for bank structures
39 virtual UInt_t LoadSlot( THaSlotData* sldat, const UInt_t* evbuffer,
40 UInt_t pos, UInt_t len );
41 // Loads slot data for bank structures with support for event blocking
42 virtual UInt_t LoadBank( THaSlotData* sldat, const UInt_t* evbuffer,
43 UInt_t pos, UInt_t len );
44
45private:
46 virtual UInt_t LoadNextEvBuffer( THaSlotData* sldat );
47 std::string Here( const char* function );
48
53 static Long64_t Find1190Word( const uint32_t* buf, size_t start, size_t len,
54 EDataType type, uint32_t slot );
55
56 std::vector<UInt_t> fNumHits;
57 std::vector<UInt_t> fTdcData; // Raw data
58 std::vector<UInt_t> fTdcOpt; // Edge flag =0 Leading edge, = 1 Trailing edge
59
60 THaSlotData* fSlotData; // Need to fix if multi-threading becomes available
61 const UInt_t* fEvBuf; // Pointer to current event buffer (for multi-block)
62 UInt_t fNfill; // Number of filler words at end of current bank
63
90
92
93 ClassDef(Caen1190Module, 0) // CAEN 1190 multi-hit TDC module
94};
95
96//_____________________________________________________________________________
97inline
99 const uint32_t* buf, size_t start, size_t len, EDataType type, uint32_t slot )
100{
101 // Search 'buf' for CAEN 1190 global header/trailer word for 'slot'.
102 // The format is (T=type, S=slot)
103 // TTTT TXXX XXXX XXXX XXXX XXXX XXXS SSSS
104 // bit 28 24 20 16 12 8 4 0
105 //
106 // Supported types:
107 // 8 (0x08) Global header
108 // 16 (0x10) Global trailer
109 //
110 // The buffer is searched between [start,start+len)
111 // Returns the offset into 'buf' containing the word, or -1 if not found.
112
113 assert(type == kGlobalHeader or type == kGlobalTrailer);
114 const uint32_t ID = (type & 0x1F) << 27 | (slot & 0x1F);
115 const auto* p = buf + start;
116 const auto* q = p + len;
117 while( p != q && (*p & 0xF800001F) != ID )
118 ++p;
119 return (p != q) ? p - buf : -1;
120}
121
122} // namespace Decoder
123
124#endif
int Int_t
unsigned int UInt_t
uint32_t chan
const char Option_t
#define ClassDef(name, id)
EDataType
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
float * q
virtual UInt_t LoadSlot(THaSlotData *sldat, const UInt_t *evbuffer, const UInt_t *pstop)
std::vector< UInt_t > fTdcData
virtual UInt_t LoadNextEvBuffer(THaSlotData *sldat)
virtual ~Caen1190Module()=default
virtual UInt_t GetData(UInt_t chan, UInt_t hit) const
virtual UInt_t LoadBank(THaSlotData *sldat, const UInt_t *evbuffer, UInt_t pos, UInt_t len)
std::string Here(const char *function)
std::vector< UInt_t > fNumHits
virtual Int_t Decode(const UInt_t *p)
static TypeIter_t fgThisType
virtual void Clear(Option_t *opt="")
class Decoder::Caen1190Module::tdcData tdc_data
virtual UInt_t GetOpt(UInt_t chan, UInt_t hit) const
static Long64_t Find1190Word(const uint32_t *buf, size_t start, size_t len, EDataType type, uint32_t slot)
std::vector< UInt_t > fTdcOpt
virtual void Init()
Definition Module.cxx:51
TypeSet_t::iterator TypeIter_t
Definition Module.h:40
virtual UInt_t GetData(UInt_t) const
Definition Module.h:51
long long Long64_t
start