1 |
pamelats |
1.1 |
#include <sstream> |
2 |
|
|
#include <fstream> |
3 |
|
|
#include <stdlib.h> |
4 |
|
|
#include <stdio.h> |
5 |
|
|
#include <string.h> |
6 |
|
|
#include <ctype.h> |
7 |
|
|
#include <time.h> |
8 |
|
|
#include "Riostream.h" |
9 |
|
|
#include "TFile.h" |
10 |
|
|
#include "TDirectory.h" |
11 |
|
|
#include "TTree.h" |
12 |
|
|
#include "TLeafI.h" |
13 |
|
|
#include "TH1.h" |
14 |
|
|
#include "TH2.h" |
15 |
|
|
#include "TF1.h" |
16 |
|
|
#include "TMath.h" |
17 |
|
|
#include "TRandom.h" |
18 |
|
|
#include "TSQLServer.h" |
19 |
|
|
#include "TSystem.h" |
20 |
|
|
#include "CalibTrk1Event.h" |
21 |
|
|
#include "CalibTrk2Event.h" |
22 |
|
|
// |
23 |
|
|
#include "Digitizer.h" |
24 |
|
|
#include "CRC.h" |
25 |
|
|
// |
26 |
|
|
#include <PamelaRun.h> |
27 |
|
|
#include <physics/calorimeter/CalorimeterEvent.h> |
28 |
|
|
#include <CalibCalPedEvent.h> |
29 |
|
|
#include "GLTables.h" |
30 |
|
|
|
31 |
|
|
void Digitizer::WriteRunHeader(){ |
32 |
|
|
fOutputfile.write(reinterpret_cast<char*>(fDataRunHeader),sizeof(UShort_t)*fRunHeaderbuffer); |
33 |
|
|
}; |
34 |
|
|
|
35 |
|
|
void Digitizer::WriteRunTrailer(){ |
36 |
|
|
fOutputfile.write(reinterpret_cast<char*>(fDataRunTrailer),sizeof(UShort_t)*fRunTrailerbuffer); |
37 |
|
|
}; |
38 |
|
|
|
39 |
|
|
void Digitizer::WriteData(){ |
40 |
|
|
|
41 |
|
|
// Routine that writes the data to a binary file |
42 |
|
|
// PSCU data are already swapped |
43 |
|
|
fOutputfile.write(reinterpret_cast<char*>(fDataPSCU),sizeof(UShort_t)*fPSCUbuffer); |
44 |
|
|
// TRG |
45 |
|
|
fOutputfile.write(reinterpret_cast<char*>(fDataTrigger),sizeof(UChar_t)*fTRIGGERbuffer); //30/11/07 SO; it was 153 |
46 |
|
|
// TOF |
47 |
|
|
fOutputfile.write(reinterpret_cast<char*>(fDataTof),sizeof(UChar_t)*fTOFbuffer); |
48 |
|
|
// AC |
49 |
|
|
UShort_t temp[1000000]; |
50 |
|
|
memset(temp,0,sizeof(UShort_t)*1000000); |
51 |
|
|
swab(fDataAC,temp,sizeof(UShort_t)*fACbuffer); // WE MUST SWAP THE BYTES!!! |
52 |
|
|
fOutputfile.write(reinterpret_cast<char*>(temp),sizeof(UShort_t)*fACbuffer); |
53 |
|
|
// CALO |
54 |
|
|
memset(temp,0,sizeof(UShort_t)*1000000); |
55 |
|
|
swab(fDataCALO,temp,sizeof(UShort_t)*fCALOlength); // WE MUST SWAP THE BYTES!!! |
56 |
|
|
fOutputfile.write(reinterpret_cast<char*>(temp),sizeof(UShort_t)*fCALOlength); |
57 |
|
|
// TRK |
58 |
|
|
memset(temp,0,sizeof(UShort_t)*1000000); |
59 |
|
|
swab(fDataTrack,temp,sizeof(UShort_t)*fTracklength); // WE MUST SWAP THE BYTES!!! |
60 |
|
|
fOutputfile.write(reinterpret_cast<char*>(temp),sizeof(UShort_t)*fTracklength); |
61 |
|
|
fTracklength=0; |
62 |
|
|
// padding to 64 bytes |
63 |
|
|
// |
64 |
|
|
if ( fPadding ){ |
65 |
|
|
fOutputfile.write(reinterpret_cast<char*>(fDataPadding),sizeof(UChar_t)*fPadding); |
66 |
|
|
}; |
67 |
|
|
// S4 |
68 |
|
|
memset(temp,0,sizeof(UShort_t)*1000000); |
69 |
|
|
swab(fDataS4,temp,sizeof(UShort_t)*fS4buffer); // WE MUST SWAP THE BYTES!!! |
70 |
|
|
fOutputfile.write(reinterpret_cast<char*>(temp),sizeof(UShort_t)*fS4buffer); |
71 |
|
|
// ND |
72 |
|
|
memset(temp,0,sizeof(UShort_t)*1000000); |
73 |
|
|
swab(fDataND,temp,sizeof(UShort_t)*fNDbuffer); // WE MUST SWAP THE BYTES!!! |
74 |
|
|
fOutputfile.write(reinterpret_cast<char*>(temp),sizeof(UShort_t)*fNDbuffer); |
75 |
|
|
}; |