]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/AliTPCBuffer.cxx
Correction for coding conventions
[u/mrichter/AliRoot.git] / TPC / AliTPCBuffer.cxx
CommitLineData
2e9f335b 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 **************************************************************************/
a763ec6d 15/* $Id$ */
2e9f335b 16
a763ec6d 17// Storing digits in a binary file
18// according to the DDL mapping
19//
20// Author: D.Favretto
21//
2e9f335b 22#include "Riostream.h"
23#include "TObjArray.h"
24#include "AliTPCBuffer.h"
25#include "AliSimDigits.h"
26
27//#include "TFile.h"
28//#include "TTree.h"
29
30ClassImp(AliTPCBuffer)
31//////////////////////////////////////////////////////////////////////////////////////////////////////////////
32AliTPCBuffer::AliTPCBuffer(const char* fileName){
a763ec6d 33 //
34 // Constructor
35 //
2e9f335b 36 f.open("AliTPCDDL.dat",ios::binary|ios::out);
37 // fout=new TFile(fileName,"recreate");
38 // tree=new TTree("tree","Values");
a763ec6d 39 fNumberOfDigits=0;
2e9f335b 40 fVerbose=0;
41}
42
43//////////////////////////////////////////////////////////////////////////////////////////////////////////////
44AliTPCBuffer::~AliTPCBuffer(){
45 f.close();
46 //delete tree;
47 //delete fout;
48}
49//////////////////////////////////////////////////////////////////////////////////////////////////////////////
50AliTPCBuffer::AliTPCBuffer(const AliTPCBuffer &source){
51 // Copy Constructor
52 return;
53}
54//////////////////////////////////////////////////////////////////////////////////////////////////////////////
55AliTPCBuffer& AliTPCBuffer::operator=(const AliTPCBuffer &source){
56 //Assigment operator
57 return *this;
58}
59//////////////////////////////////////////////////////////////////////////////////////////////////////////////
60/*
61void 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
65 Int_t Pad;
66 Int_t Dig;
67 Int_t Time;
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");
74 digrow->First();
75 do{
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;
80 if(Dig>eth){
81 switch (flag){
82 case 0:{
83 tree->Fill();
a763ec6d 84 fNumberOfDigits++;
2e9f335b 85 break;
86 }//end case 0
87 case 1:{
88 if((Pad>=minPad)&&(Pad<=maxPad)){
89 tree->Fill();
a763ec6d 90 fNumberOfDigits++;
2e9f335b 91 }
92 break;
93 }//end case 1
94 case 2:{
95 if((Pad<minPad)||(Pad>maxPad)){
96 tree->Fill();
a763ec6d 97 fNumberOfDigits++;
2e9f335b 98 }
99 break;
100 }//end case 2
101 };//end switch
102 }//end if
103 }while (digrow->Next());
104 tree->Write();
105 return;
106}
107*/
108//////////////////////////////////////////////////////////////////////////////////////////////////////////////
109void 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
113 struct DataPad{
114 Int_t Sec;
115 Int_t SubSec;
116 Int_t Row;
117 Int_t Pad;
118 Int_t Dig;
119 Int_t Time;
120 };
121 DataPad data;
122 data.Sec=sec;
123 data.SubSec=SubSec;
124 data.Row=row;
125 digrow->First();
126 do{
127 data.Dig=digrow->CurrentDigit(); //adc
128 data.Time=digrow->CurrentRow(); //time
129 data.Pad =digrow->CurrentColumn(); // pad
130 if(data.Dig>eth){
131 switch (flag){
132 case 0:{
a763ec6d 133 fNumberOfDigits++;
2e9f335b 134 f.write((char*)(&data),sizeof(data));
135 break;
136 }//end case 0
137 case 1:{
138 if((data.Pad>=minPad)&&(data.Pad<=maxPad)){
139 f.write((char*)(&data),sizeof(data));
a763ec6d 140 fNumberOfDigits++;
2e9f335b 141 }
142 break;
143 }//end case 1
144 case 2:{
145 if((data.Pad<minPad)||(data.Pad>maxPad)){
146 f.write((char*)(&data),sizeof(data));
a763ec6d 147 fNumberOfDigits++;
2e9f335b 148 }
149 break;
150 }//end case 2
151 };//end switch
152 }//end if
153 }while (digrow->Next());
154 return;
155}
156//////////////////////////////////////////////////////////////////////////////////////////////////////////////