22 #include <arpa/inet.h>
162 Double_t eventTimeStamp = 0;
182 Double_t timestamp = 0.;
183 Int_t triggerold = -1000;
194 if ( std::abs(Long_t(
fTimeStamp - eventTimeStamp)) < 2 ) {
199 if(trigger != triggerold) {
200 Warning(
"NextEvent",
"Trigger types don't match, %d != %d (%g s)",trigger,triggerold,ts*1e-7);
215 if(n_mes) timestamp /= n_mes;
235 if (
fDone)
return false;
255 if (std::fread(&
lData,dataLen, 1,
fIn) != 1)
300 if (std::fread(&
lData,dataLen, 1,
fIn) != 1)
317 std::cout <<
"Wrong File Read Mode "<<
fRVer << std::endl;
333 assert(blen == 11872);
340 for (
size_t i = 0;i<blen;i += 56) {
350 udata.
_nu0=bits(i+50,i+55);
361 udata.
_Gain=bits(i+29);
365 udata.
_nu0=bits(i+51);
406 Info(
"Constructor",
"Use default nResets %d",
fNreset);
409 Info(
"Constructor",
"Use nResets %d",
fNreset);
412 const char * fn =
fInFile->Data();
413 if (
fInFile->BeginsWith(
"/" )) {
414 if (
verbose) std::cout <<
" Init " << fn << std::endl;
415 if ( gSystem->AccessPathName(fn,kReadPermission) ) {
416 perror(
"Raw File access");
420 if ( gSystem->AccessPathName(fn,kReadPermission) )
425 TString DataDir(gSystem->Getenv(
"HARPO_DATA_DIR"));
427 if ( ! DataDir.EndsWith(
"/") ) DataDir.Append(
"/");
430 if (
verbose) std::cout <<
" Guessed " << fn << std::endl;
431 if ( gSystem->AccessPathName(fn,kReadPermission) ) {
432 perror(
"Raw File access");
438 fIn = std::fopen(fn,
"r");
453 perror(
"Raw File not open");
470 if (++cnt >= maxevents)
break;
481 return Loop(maxevents);
Pmm2Event * GetEvent()
Can Read next event from raw file.
Container of bits stream as string.
A class Pmm2Status is bits representation of pmm2 status register (0x400).
UInt_t _PPSCounter
FPGA data.
void SetRunHeader(HarpoDetHeader *rh)
Return pointer to decoded pmm2 data vector.
u_int32_t asGray(size_t i, size_t j) const
Slice as integer in Gray code.
bin mode like mclientUDP feminis data
#define N_WORD_IN_BLOCK
n word := n mes * sizeof(OneChannelData) / sizeof(int)
void SetTriggerType(Int_t val)
void SetTimeStamp(Double_t val)
TString * GetInFile(Int_t idet)
Get Input file name for detector.
void unPackRawDigi()
Unpack Raw Buffer and create Digi List.
UInt_t _TdcRamp
10 bits(30..39) - Fine Time
HarpoDetAnalyse * fRawAnalyse
A virtual base class for all HARPO detectors readers.
Long_t fRVer
Read buffer from file.
UInt_t _Charge
1 bit(40) - TDC Ramp
Bool_t Init()
Init method : Open in/out files and check run header signature.
ULong_t GetTimeStamp(Int_t after=0)
Data Format.
void SetAnalyseFunction(HarpoDetAnalyse *func)
HarpoDetHeader * fRunHeader
UInt_t _FineTime
1 bit(29) - ADC Gain
virtual void ProcessEvent(HarpoDetEvent *event)
double getTemperature() const
void Push(const Pmm2Mes &val)
Bool_t Lookup(const char *path, Bool_t &val)
Lookup function for scalar values.
A class store HARPO raw PMM2 event buffer and header. End provide access metods to the row data...
A one channel mesurements for Pmm2v2 card The class is represent one channel data of Pmm2v2 card for ...
A virtual class which define interface between HARPO Det Reader and Event Analysis code...
UInt_t _Gain
1 bit(28) - Time Stamp Counter
void AddMes(Pmm2Mes &m)
Ruturn pointer to decoded data vector.
void ReadBuffer()
Can Read next Buffer from raw file.
A class which read HARPO raw file from PMM2 and create Raw Events objects.
bin mode as written by Windows PMMv2_DAQ program
Int_t getTimeStamp() const
Long_t Loop()
Read errors.
void SetHeader(UShort_t *data)
Bool_t NextBuffer()
Have we more Digi to Process.
A class which keeps track of the entire configuration of the analysis.
TEXT mode (?? csv), UNIMPLEMENTED.
virtual void Save(char *=NULL)
Pmm2Header * GetDetHeader()
UInt_t lData[N_WORD_IN_BLOCK]
Long64_t GetVerbose()
Get program verbosity level.
UInt_t _ChannelNum
Event can access to class varibales.