| 4 |
#include <iostream> |
#include <iostream> |
| 5 |
#include <fstream> |
#include <fstream> |
| 6 |
#include <vector> |
#include <vector> |
| 7 |
|
#include <stdlib.h> |
| 8 |
#include <TObject.h> |
#include <TObject.h> |
| 9 |
|
#include <TRandom.h> |
| 10 |
#include "TString.h" |
#include "TString.h" |
| 11 |
|
|
| 12 |
using namespace std; |
using namespace std; |
| 25 |
UInt_t fCounterPhys; |
UInt_t fCounterPhys; |
| 26 |
UInt_t fOBT; |
UInt_t fOBT; |
| 27 |
|
|
| 28 |
char* fFilename; |
const char* fFilename; |
| 29 |
std::ofstream fFile; |
std::ofstream fFile; |
| 30 |
|
|
| 31 |
|
|
| 43 |
|
|
| 44 |
protected: |
protected: |
| 45 |
PamVMCRawMgr() { |
PamVMCRawMgr() { |
|
fFilename = "pamtest.pam"; //to be redefined in options |
|
| 46 |
fCounter=fCounterPhys=fOBT=0; |
fCounter=fCounterPhys=fOBT=0; |
| 47 |
fbuffer = new PamVMCBuffer(0); |
fbuffer = new PamVMCBuffer(0); |
|
|
|
|
fFile.open(fFilename,ios::out | ios::binary); |
|
| 48 |
}; |
}; |
| 49 |
|
|
| 50 |
public: |
public: |
| 58 |
|
|
| 59 |
static PamVMCRawMgr * Instance(); |
static PamVMCRawMgr * Instance(); |
| 60 |
|
|
| 61 |
|
void CreateOutFile(const char* fname){ |
| 62 |
|
fFilename = fname; |
| 63 |
|
cout<<"OUTPUT RAWFILE: "<<fFilename<<endl; |
| 64 |
|
fFile.open(fFilename,ios::out | ios::binary); |
| 65 |
|
} |
| 66 |
|
|
| 67 |
UInt_t GetCounter(){ return fCounter; } |
UInt_t GetCounter(){ return fCounter; } |
| 68 |
|
|
| 69 |
void AddCounter(){ fCounter++; } |
void AddCounter(){ fCounter++; } |
| 186 |
UShort_t Data; |
UShort_t Data; |
| 187 |
UChar_t tmp[2]; |
UChar_t tmp[2]; |
| 188 |
for (Int_t ur=0; ur<16; ur++){ |
for (Int_t ur=0; ur<16; ur++){ |
| 189 |
Data=(UShort_t)rand(); |
Data=(UShort_t)gRandom->Uniform(0.,RAND_MAX); |
| 190 |
memcpy(tmp,&Data,sizeof(UShort_t)); |
memcpy(tmp,&Data,sizeof(UShort_t)); |
| 191 |
//cout<<"DATA"<<hex<<Data<<endl; |
//cout<<"DATA"<<hex<<Data<<endl; |
| 192 |
//tmp[1] should be first (swapping bytes) |
//tmp[1] should be first (swapping bytes) |