]> git.uio.no Git - u/mrichter/AliRoot.git/blame - VZERO/AliVZEROBuffer.cxx
Bug fix in treatment of the vertex finder covariance matrix (Andrea)
[u/mrichter/AliRoot.git] / VZERO / AliVZEROBuffer.cxx
CommitLineData
af095430 1/**************************************************************************
2 * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15/* $Id$ */
16
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
d983817d 21// Author: B. Cheynis
af095430 22
23#include <Riostream.h>
24#include <TObjArray.h>
d983817d 25#include "AliRawDataHeader.h"
af095430 26#include "AliVZEROBuffer.h"
27
28//#include "TFile.h"
29//#include "TTree.h"
30
31ClassImp(AliVZEROBuffer)
0b2bea8b 32
33//_____________________________________________________________________________
34AliVZEROBuffer::AliVZEROBuffer():TObject(),
35 fVerbose(0),
36 f(),
37 fNumberOfDigits(0)
38{
39 //
40 // default constructor
41 //
42}
af095430 43//_____________________________________________________________________________
0b2bea8b 44AliVZEROBuffer::AliVZEROBuffer(const char* fileName):TObject(),
45 fVerbose(0),
46 f(),
47 fNumberOfDigits(0)
48{
af095430 49 // Constructor
50#ifndef __DECCXX
51 f.open(fileName,ios::binary|ios::out);
52#else
53 f.open(fileName,ios::out);
54#endif
55 // fout=new TFile(fileName,"recreate");
56 // tree=new TTree("tree","Values");
d983817d 57 AliRawDataHeader header;
58 f.write((char*)(&header), sizeof(header));
0b2bea8b 59
af095430 60}
61
62//_____________________________________________________________________________
63AliVZEROBuffer::~AliVZEROBuffer(){
64 // Destructor, it closes the IO stream
d983817d 65 AliRawDataHeader header;
66 header.fSize = f.tellp();
67 header.SetAttribute(0); // valid data
68 f.seekp(0);
69 f.write((char*)(&header), sizeof(header));
af095430 70 f.close();
71 //delete tree;
72 //delete fout;
73}
74
75//_____________________________________________________________________________
0b2bea8b 76AliVZEROBuffer::AliVZEROBuffer(const AliVZEROBuffer &source):TObject(source),
77 fVerbose(0),
78 f(),
79 fNumberOfDigits(0)
80
81{
af095430 82 // Copy Constructor
83 this->fVerbose=source.fVerbose;
84 return;
85}
86
87//_____________________________________________________________________________
0b2bea8b 88AliVZEROBuffer& AliVZEROBuffer::operator=(const AliVZEROBuffer &source)
89
90{
af095430 91 //Assigment operator
92 this->fVerbose=source.fVerbose;
93 return *this;
94}
95
96//_____________________________________________________________________________
7caec66b 97void AliVZEROBuffer::WriteBinary(Int_t cell,Int_t ADC, Int_t Time){
af095430 98 // It writes VZERO digits as a raw data file.
99 // Being called by AliVZERODDL.C
100
101 struct DataFile{
102 Int_t cell;
103 Int_t ADC;
7caec66b 104 Int_t Time;
af095430 105 };
106
107 DataFile data;
108 data.cell = cell;
109 data.ADC = ADC;
7caec66b 110 data.Time = Time;
af095430 111
af095430 112 fNumberOfDigits++;
113 f.write((char*)(&data),sizeof(data));
114
115}
116