--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+/* $Id$ */
+
+// Storing digits in a binary file
+// according to the DDL mapping
+// To be used in Alice Data Challenges
+// This class is used by AliVZERODDL.C macro
+// Author:
+
+#include <Riostream.h>
+#include <TObjArray.h>
+#include "AliVZEROBuffer.h"
+
+//#include "TFile.h"
+//#include "TTree.h"
+
+ClassImp(AliVZEROBuffer)
+//_____________________________________________________________________________
+AliVZEROBuffer::AliVZEROBuffer(const char* fileName){
+ // Constructor
+#ifndef __DECCXX
+ f.open(fileName,ios::binary|ios::out);
+#else
+ f.open(fileName,ios::out);
+#endif
+ // fout=new TFile(fileName,"recreate");
+ // tree=new TTree("tree","Values");
+ fNumberOfDigits=0;
+ fVerbose=0;
+ remove("VZEROdigits.txt");
+}
+
+//_____________________________________________________________________________
+AliVZEROBuffer::~AliVZEROBuffer(){
+ // Destructor, it closes the IO stream
+ f.close();
+ //delete tree;
+ //delete fout;
+}
+
+//_____________________________________________________________________________
+AliVZEROBuffer::AliVZEROBuffer(const AliVZEROBuffer &source):TObject(source){
+ // Copy Constructor
+ this->fVerbose=source.fVerbose;
+ return;
+}
+
+//_____________________________________________________________________________
+AliVZEROBuffer& AliVZEROBuffer::operator=(const AliVZEROBuffer &source){
+ //Assigment operator
+ this->fVerbose=source.fVerbose;
+ return *this;
+}
+
+//_____________________________________________________________________________
+void AliVZEROBuffer::WriteBinary(Int_t cell,Int_t ADC){
+ // It writes VZERO digits as a raw data file.
+ // Being called by AliVZERODDL.C
+
+ struct DataFile{
+ Int_t cell;
+ Int_t ADC;
+ };
+
+ DataFile data;
+ data.cell = cell;
+ data.ADC = ADC;
+
+ ofstream ftxt;
+ ftxt.open("VZEROdigits.txt",ios::app);
+
+ fNumberOfDigits++;
+ f.write((char*)(&data),sizeof(data));
+
+}
+
--- /dev/null
+#ifndef AliVZEROBUFFER_H
+#define AliVZEROBUFFER_H
+/* Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+///////////////////////////////////////////////////////////////////
+// Class used for storing TPC digits according to the DDLs format//
+//////////////////////////////////////////////////////////////////
+
+#ifdef __CINT__
+class fstream;
+#else
+#include "Riostream.h"
+#endif
+
+
+class AliVZEROBuffer:public TObject{
+
+public:
+ AliVZEROBuffer(){
+ //default constructor
+ }
+ AliVZEROBuffer(const char* fileName); //constructor
+ virtual ~AliVZEROBuffer(); //destructor
+ AliVZEROBuffer(const AliVZEROBuffer &source); // copy constructor
+ AliVZEROBuffer& operator=(const AliVZEROBuffer &source); // ass. op.
+ void WriteBinary(Int_t cell,Int_t ADC);
+ UInt_t GetDigNumber()const{return fNumberOfDigits;}
+ void SetVerbose(Int_t val){fVerbose=val;}
+ Int_t GetVerbose() const{return fVerbose;}
+
+private:
+ Int_t fVerbose; //Verbosity level: 0-silent, 1:cout msg, 2: txt files for checking
+ fstream f; //The IO file name
+ UInt_t fNumberOfDigits; //Number of VZERO digits
+ ClassDef(AliVZEROBuffer,1)
+};
+
+#endif