// Storing digits in a binary file
// according to the DDL mapping
-//
+// To be used in Alice Data Challenges
+// This class is used by AliTPCDDL.C macro
// Author: D.Favretto
-//
-#include "Riostream.h"
-#include "TObjArray.h"
+
+#include <Riostream.h>
+#include <TObjArray.h>
#include "AliTPCBuffer.h"
#include "AliSimDigits.h"
ClassImp(AliTPCBuffer)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
-AliTPCBuffer::AliTPCBuffer(const char* fileName){
- //
+AliTPCBuffer::AliTPCBuffer(const char* /*fileName*/){
// Constructor
- //
+#ifndef __DECCXX
f.open("AliTPCDDL.dat",ios::binary|ios::out);
+#else
+ f.open("AliTPCDDL.dat",ios::out);
+#endif
// fout=new TFile(fileName,"recreate");
// tree=new TTree("tree","Values");
fNumberOfDigits=0;
fVerbose=0;
+ remove("TPCdigits.txt");
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
AliTPCBuffer::~AliTPCBuffer(){
+ // The destructor closes the IO stream
f.close();
//delete tree;
//delete fout;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
-AliTPCBuffer::AliTPCBuffer(const AliTPCBuffer &source){
+AliTPCBuffer::AliTPCBuffer(const AliTPCBuffer &source):TObject(source){
// Copy Constructor
+ this->fVerbose=source.fVerbose;
return;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
AliTPCBuffer& AliTPCBuffer::operator=(const AliTPCBuffer &source){
//Assigment operator
+ this->fVerbose=source.fVerbose;
return *this;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
*/
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
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){
- //flag=0 the whole row is written intto the file
+ //It writes TPC digits as par the flag specifications. Being called by AliTPCDDL.C
+ //flag=0 the whole row is written into the file
//flag=1 only value in the range [minPad,MaxPasd] are written into the file
//flag=2 complementary case of 1
+
struct DataPad{
Int_t Sec;
Int_t SubSec;
data.SubSec=SubSec;
data.Row=row;
digrow->First();
+ Int_t padID=-1;
+ Int_t ddlNumber=0;
+ ofstream ftxt;
+ if (fVerbose==2){
+ ftxt.open("TPCdigits.txt",ios::app);
+ if(sec<36)
+ ddlNumber=sec*2+SubSec;
+ else
+ ddlNumber=72+(sec-36)*4+SubSec;
+ }//end if
do{
- data.Dig=digrow->CurrentDigit(); //adc
- data.Time=digrow->CurrentRow(); //time
- data.Pad =digrow->CurrentColumn(); // pad
+ data.Dig=digrow->CurrentDigit(); //adc
+ data.Time=digrow->CurrentRow(); //time
+ data.Pad =digrow->CurrentColumn(); // pad
+ if(fVerbose==2)
+ if (padID!=data.Pad){
+ ftxt<<"S:"<<data.Sec<<" DDL:"<<ddlNumber<<" R:"<<data.Row<<" P:"<<data.Pad<<endl;
+ padID=data.Pad;
+ }//end if
if(data.Dig>eth){
switch (flag){
case 0:{
fNumberOfDigits++;
f.write((char*)(&data),sizeof(data));
+ if(fVerbose==2)
+ ftxt<<"A:"<<data.Dig<<" T:"<<data.Time<<endl;
break;
}//end case 0
case 1:{
if((data.Pad>=minPad)&&(data.Pad<=maxPad)){
f.write((char*)(&data),sizeof(data));
+ if(fVerbose==2)
+ ftxt<<"A:"<<data.Dig<<" T:"<<data.Time<<endl;
fNumberOfDigits++;
}
break;
case 2:{
if((data.Pad<minPad)||(data.Pad>maxPad)){
f.write((char*)(&data),sizeof(data));
+ if(fVerbose==2)
+ ftxt<<"A:"<<data.Dig<<" T:"<<data.Time<<endl;
fNumberOfDigits++;
}
break;
};//end switch
}//end if
}while (digrow->Next());
+ if (fVerbose==2)
+ ftxt.close();
return;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////