/[PAMELA software]/PamVMC/include/PamVMCRawMgr.h
ViewVC logotype

Diff of /PamVMC/include/PamVMCRawMgr.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by nikolas, Thu Feb 19 16:50:36 2009 UTC revision 1.5 by pam-rm2, Fri Jun 12 18:39:19 2009 UTC
# Line 4  Line 4 
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;
# Line 23  class PamVMCRawMgr: public TObject { Line 25  class PamVMCRawMgr: public TObject {
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    
# Line 41  class PamVMCRawMgr: public TObject { Line 43  class PamVMCRawMgr: public TObject {
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:
# Line 59  class PamVMCRawMgr: public TObject { Line 58  class PamVMCRawMgr: public TObject {
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++; }
# Line 181  void AddPadding(UInt_t & pad, UCBuffer * Line 186  void AddPadding(UInt_t & pad, UCBuffer *
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)

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.23