1 /**************************************************************************
2 * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
17 // Storing digits in a binary file
18 // according to the DDL mapping
19 // To be used in Alice Data Challenges
20 // This class is used by AliVZERODDL.C macro
23 #include <Riostream.h>
24 #include <TObjArray.h>
25 #include "AliRawDataHeader.h"
26 #include "AliVZEROBuffer.h"
31 ClassImp(AliVZEROBuffer)
33 //_____________________________________________________________________________
34 AliVZEROBuffer::AliVZEROBuffer():TObject(),
40 // default constructor
43 //_____________________________________________________________________________
44 AliVZEROBuffer::AliVZEROBuffer(const char* fileName):TObject(),
51 f.open(fileName,ios::binary|ios::out);
53 f.open(fileName,ios::out);
55 // fout=new TFile(fileName,"recreate");
56 // tree=new TTree("tree","Values");
57 AliRawDataHeader header;
58 f.write((char*)(&header), sizeof(header));
62 //_____________________________________________________________________________
63 AliVZEROBuffer::~AliVZEROBuffer(){
64 // Destructor, it closes the IO stream
65 AliRawDataHeader header;
66 header.fSize = f.tellp();
67 header.SetAttribute(0); // valid data
69 f.write((char*)(&header), sizeof(header));
75 //_____________________________________________________________________________
76 AliVZEROBuffer::AliVZEROBuffer(const AliVZEROBuffer &source):TObject(source),
83 this->fVerbose=source.fVerbose;
87 //_____________________________________________________________________________
88 AliVZEROBuffer& AliVZEROBuffer::operator=(const AliVZEROBuffer &source)
92 this->fVerbose=source.fVerbose;
96 //_____________________________________________________________________________
97 void AliVZEROBuffer::WriteBinary(Int_t cell,Int_t ADC, Int_t Time){
98 // It writes VZERO digits as a raw data file.
99 // Being called by AliVZERODDL.C
113 f.write((char*)(&data),sizeof(data));