]>
Commit | Line | Data |
---|---|---|
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 | |
21 | // Author: | |
22 | ||
23 | #include <Riostream.h> | |
24 | #include <TObjArray.h> | |
25 | #include "AliVZEROBuffer.h" | |
26 | ||
27 | //#include "TFile.h" | |
28 | //#include "TTree.h" | |
29 | ||
30 | ClassImp(AliVZEROBuffer) | |
31 | //_____________________________________________________________________________ | |
32 | AliVZEROBuffer::AliVZEROBuffer(const char* fileName){ | |
33 | // Constructor | |
34 | #ifndef __DECCXX | |
35 | f.open(fileName,ios::binary|ios::out); | |
36 | #else | |
37 | f.open(fileName,ios::out); | |
38 | #endif | |
39 | // fout=new TFile(fileName,"recreate"); | |
40 | // tree=new TTree("tree","Values"); | |
41 | fNumberOfDigits=0; | |
42 | fVerbose=0; | |
43 | remove("VZEROdigits.txt"); | |
44 | } | |
45 | ||
46 | //_____________________________________________________________________________ | |
47 | AliVZEROBuffer::~AliVZEROBuffer(){ | |
48 | // Destructor, it closes the IO stream | |
49 | f.close(); | |
50 | //delete tree; | |
51 | //delete fout; | |
52 | } | |
53 | ||
54 | //_____________________________________________________________________________ | |
55 | AliVZEROBuffer::AliVZEROBuffer(const AliVZEROBuffer &source):TObject(source){ | |
56 | // Copy Constructor | |
57 | this->fVerbose=source.fVerbose; | |
58 | return; | |
59 | } | |
60 | ||
61 | //_____________________________________________________________________________ | |
62 | AliVZEROBuffer& AliVZEROBuffer::operator=(const AliVZEROBuffer &source){ | |
63 | //Assigment operator | |
64 | this->fVerbose=source.fVerbose; | |
65 | return *this; | |
66 | } | |
67 | ||
68 | //_____________________________________________________________________________ | |
69 | void AliVZEROBuffer::WriteBinary(Int_t cell,Int_t ADC){ | |
70 | // It writes VZERO digits as a raw data file. | |
71 | // Being called by AliVZERODDL.C | |
72 | ||
73 | struct DataFile{ | |
74 | Int_t cell; | |
75 | Int_t ADC; | |
76 | }; | |
77 | ||
78 | DataFile data; | |
79 | data.cell = cell; | |
80 | data.ADC = ADC; | |
81 | ||
82 | ofstream ftxt; | |
83 | ftxt.open("VZEROdigits.txt",ios::app); | |
84 | ||
85 | fNumberOfDigits++; | |
86 | f.write((char*)(&data),sizeof(data)); | |
87 | ||
88 | } | |
89 |