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 AliTPCDDL.C macro
23 #include "Riostream.h"
24 #include "TObjArray.h"
25 #include "AliTPCBuffer.h"
26 #include "AliSimDigits.h"
31 ClassImp(AliTPCBuffer)
32 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
33 AliTPCBuffer::AliTPCBuffer(const char* fileName){
36 f.open("AliTPCDDL.dat",ios::binary|ios::out);
38 f.open("AliTPCDDL.dat",ios::out);
40 // fout=new TFile(fileName,"recreate");
41 // tree=new TTree("tree","Values");
46 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
47 AliTPCBuffer::~AliTPCBuffer(){
48 // The destructor closes the IO stream
53 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
54 AliTPCBuffer::AliTPCBuffer(const AliTPCBuffer &source){
56 this->fVerbose=source.fVerbose;
59 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
60 AliTPCBuffer& AliTPCBuffer::operator=(const AliTPCBuffer &source){
62 this->fVerbose=source.fVerbose;
65 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
67 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){
68 //flag=0 the whole row is written to the root file
69 //flag=1 only value in the range [minPad,MaxPasd] are written to the root file
70 //flag=2 complementary case of 1
74 tree->Branch("sec",&sec,"sec/I");
75 tree->Branch("SubSec",&SubSec,"SubSec/I");
76 tree->Branch("row",&row,"row/I");
77 tree->Branch("Pad",&Pad,"Pad/I");
78 tree->Branch("Dig",&Dig,"Dig/I");
79 tree->Branch("Time",&Time,"Time/I");
82 Dig=digrow->CurrentDigit(); //adc
83 Time=digrow->CurrentRow(); //time
84 Pad =digrow->CurrentColumn(); // pad
85 // cout<<"Sec "<<sec<<" row "<<row<<" Pad "<<Pad<<" Dig "<<Dig<<" Time "<<Time<<endl;
94 if((Pad>=minPad)&&(Pad<=maxPad)){
101 if((Pad<minPad)||(Pad>maxPad)){
109 }while (digrow->Next());
114 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
115 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){
116 //It writes TPC digits as par the flag specifications. Being called by AliTPCDDL.C
117 //flag=0 the whole row is written into the file
118 //flag=1 only value in the range [minPad,MaxPasd] are written into the file
119 //flag=2 complementary case of 1
135 data.Dig=digrow->CurrentDigit(); //adc
136 data.Time=digrow->CurrentRow(); //time
137 data.Pad =digrow->CurrentColumn(); // pad
142 f.write((char*)(&data),sizeof(data));
146 if((data.Pad>=minPad)&&(data.Pad<=maxPad)){
147 f.write((char*)(&data),sizeof(data));
153 if((data.Pad<minPad)||(data.Pad>maxPad)){
154 f.write((char*)(&data),sizeof(data));
161 }while (digrow->Next());
164 //////////////////////////////////////////////////////////////////////////////////////////////////////////////