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
22 #include "Riostream.h"
23 #include "TObjArray.h"
24 #include "AliTPCBuffer.h"
25 #include "AliSimDigits.h"
30 ClassImp(AliTPCBuffer)
31 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
32 AliTPCBuffer::AliTPCBuffer(const char* fileName){
36 f.open("AliTPCDDL.dat",ios::binary|ios::out);
37 // fout=new TFile(fileName,"recreate");
38 // tree=new TTree("tree","Values");
43 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
44 AliTPCBuffer::~AliTPCBuffer(){
49 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
50 AliTPCBuffer::AliTPCBuffer(const AliTPCBuffer &source){
54 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
55 AliTPCBuffer& AliTPCBuffer::operator=(const AliTPCBuffer &source){
59 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
61 void AliTPCBuffer::WriteRow(Int_t eth,AliSimDigits *digrow,Int_t minPad,Int_t maxPad,Int_t flag,Int_t sec,Int_t SubSec,Int_t row){
62 //flag=0 the whole row is written to the root file
63 //flag=1 only value in the range [minPad,MaxPasd] are written to the root file
64 //flag=2 complementary case of 1
68 tree->Branch("sec",&sec,"sec/I");
69 tree->Branch("SubSec",&SubSec,"SubSec/I");
70 tree->Branch("row",&row,"row/I");
71 tree->Branch("Pad",&Pad,"Pad/I");
72 tree->Branch("Dig",&Dig,"Dig/I");
73 tree->Branch("Time",&Time,"Time/I");
76 Dig=digrow->CurrentDigit(); //adc
77 Time=digrow->CurrentRow(); //time
78 Pad =digrow->CurrentColumn(); // pad
79 // cout<<"Sec "<<sec<<" row "<<row<<" Pad "<<Pad<<" Dig "<<Dig<<" Time "<<Time<<endl;
88 if((Pad>=minPad)&&(Pad<=maxPad)){
95 if((Pad<minPad)||(Pad>maxPad)){
103 }while (digrow->Next());
108 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
109 void AliTPCBuffer::WriteRowBinary(Int_t eth,AliSimDigits *digrow,Int_t minPad,Int_t maxPad,Int_t flag,Int_t sec,Int_t SubSec,Int_t row){
110 //flag=0 the whole row is written intto the file
111 //flag=1 only value in the range [minPad,MaxPasd] are written into the file
112 //flag=2 complementary case of 1
127 data.Dig=digrow->CurrentDigit(); //adc
128 data.Time=digrow->CurrentRow(); //time
129 data.Pad =digrow->CurrentColumn(); // pad
134 f.write((char*)(&data),sizeof(data));
138 if((data.Pad>=minPad)&&(data.Pad<=maxPad)){
139 f.write((char*)(&data),sizeof(data));
145 if((data.Pad<minPad)||(data.Pad>maxPad)){
146 f.write((char*)(&data),sizeof(data));
153 }while (digrow->Next());
156 //////////////////////////////////////////////////////////////////////////////////////////////////////////////