/* $Id$ */
-#include "AliTRDtestBeam.h"
-
-#include "AliTRDRawStreamTB.h"
+////////////////////////////////////////////////////////////////////////////
+// //
+// Class to handle the test beam data of 2007 //
+// //
+// Authors: //
+// Sylwester Radomski (radomski@physi.uni-heidelberg.de) //
+// Anton Andronic (A.Andronic@gsi.de) //
+// //
+////////////////////////////////////////////////////////////////////////////
+
+//#include <iostream>
+//#include <fstream>
+//#include <sys/types.h>
+//#include <sys/stat.h>
+//#include <fcntl.h>
+//include <unistd.h>
+
+#include "AliTRDrawStreamOld.h"
#include "AliRawReaderMemory.h"
-
-#include <iostream>
-#include <fstream>
-
-/*
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-*/
+#include "AliTRDtestBeam.h"
ClassImp(AliTRDtestBeam)
}
+//____________________________________________________________________________
+AliTRDtestBeam::AliTRDtestBeam(const AliTRDtestBeam &tb)
+ :TObject(tb),
+ fDataStream(0),
+ fHeaderIsRead(0),
+ fEventCount(0),
+ fLimit(4),
+ fCurrent(0),
+ fDdlOff(0),
+ fSiOff(0),
+ fQdcOff(0),
+ fDdlSize(0),
+ fFileHeader(0),
+ fEventHeader(0),
+ fEventData(0),
+ fNSi1(0),
+ fNSi2(0),
+ fCher(0),
+ fPb(0)
+{
+ //
+ // Copy constructor
+ //
+
+}
+
//____________________________________________________________________________
AliTRDtestBeam::~AliTRDtestBeam()
{
int aLenSiX = 640;
- int qmaxX; int amaxX;
- int qmaxY; int amaxY;
+ int amaxX=0;
+ int amaxY=0;
+
+ Int_t q, a;
+ Int_t nst1=0,nst2=0;
+ Int_t qclX=0,qclY=0, nclX=0,nclY=0, nstX=0,nstY=0;
+ const Int_t kThr = 20;
+
+ nst1=0;
+ nstX=0;
+ nstY=0;
+ nclX=0;
+ nclY=0;
+ qclX=0;
+ qclY=0;
- qmaxX = 5;
- qmaxY = 5;
- amaxX = -1;
- amaxY = -1+aLenSiX;
-
for( int i = 0; i < GetNSi1(); i++ ) {
if (fSi1Address[i] == 0) continue; // noise
-
- if (fSi1Address[i] < aLenSiX ) {
- if( fSi1Charge[i] > qmaxX ) {
- qmaxX = fSi1Charge[i];
- amaxX = fSi1Address[i];
- }
- } else {
- if( fSi1Charge[i] > qmaxY ) {
- qmaxY = fSi1Charge[i];
- amaxY = fSi1Address[i];
- }
+
+ q = fSi1Charge[i];
+ a = fSi1Address[i];
+
+ if ( q > kThr )
+ {
+ if ( i > 0 && i < (GetNSi1()-1) ) {
+
+ if ( (a-fSi1Address[i+1]) == -1 &&
+ (a-fSi1Address[i-1]) == 1)
+ {
+ nst1++;
+ if (a < aLenSiX) {
+ qclX = q+fSi1Charge[i+1]+fSi1Charge[i-1];
+ nclX++;
+ nstX+=3;
+ amaxX = a;
+ }
+ else {
+ qclY = q+fSi1Charge[i+1]+fSi1Charge[i-1];
+ nclY++;
+ nstY+=3;
+ amaxY = a;
+ }
+ i+=1;
+ }
+ else if ( (a-fSi1Address[i-1]) == 1)
+ {
+ nst1++;
+ if (a < aLenSiX) {
+ qclX = q+fSi1Charge[i-1];
+ nclX++;
+ nstX+=2;
+ amaxX = a;
+ }
+ else {
+ qclY = q+fSi1Charge[i-1];
+ nclY++;
+ nstY+=2;
+ amaxY = a;
+ }
+ }
+ else if ( (a-fSi1Address[i+1]) == -1)
+ {
+ nst1++;
+ if (a < aLenSiX) {
+ qclX = q+fSi1Charge[i+1];
+ nclX++;
+ nstX+=2;
+ amaxX = a;
+ }
+ else {
+ qclY = q+fSi1Charge[i+1];
+ nclY++;
+ nstY+=2;
+ amaxY = a;
+ }
+ i+=1;
+ }
+ }
}
}
+ if (nst1==2 && nstX<4 && nstY<4 ) {
+ fX[0] = (float)(amaxX*0.05); // [mm]
+ fY[0] = (float)((amaxY-aLenSiX)*0.05);
+ fQx[0] = (float)qclX;
+ fQy[0] = (float)qclY;
+ }
+ else {
+ fX[0] = -1.;
+ fY[0] = -1.;
+ fQx[0] = 0.;
+ fQy[0] = 0.;
+ }
- fX[0] = (float)(amaxX*0.05); // [mm]
- fY[0] = (float)((amaxY-aLenSiX)*0.05);
- fQx[0] = (float)qmaxX;
- fQy[0] = (float)qmaxY;
-
- //
- qmaxX = 5;
- qmaxY = 5;
- amaxX = -1;
- amaxY = -1+aLenSiX;
+ // ...and Si2
+
+ nst2=0;
+ nstX=0;
+ nstY=0;
+ nclX=0;
+ nclY=0;
+ qclX=0;
+ qclY=0;
for( int i = 0; i < GetNSi2(); i++ ) {
if (fSi2Address[i] == 1279) continue; // noise
if (fSi2Address[i] == 0) continue; // noise
- if(fSi2Address[i] < aLenSiX) {
- if( fSi2Charge[i] > qmaxX ) {
- qmaxX = fSi2Charge[i];
- amaxX = fSi2Address[i];
- }
- } else {
- if( fSi2Charge[i] > qmaxY ) {
- //if (fSi2Charge[i] > 50) cout << fSi2Charge[i] << " " << i << " " << fSi2Address[i] << endl;
- qmaxY = fSi2Charge[i];
- amaxY = fSi2Address[i];
- }
+ q = fSi2Charge[i];
+ a = fSi2Address[i];
+
+ if ( q > kThr/2 ) //...as Si2 has 1/2 gain!
+ {
+ if ( i > 0 && i < (GetNSi2()-1) ) {
+
+ if ( (a-fSi2Address[i+1]) == -1 &&
+ (a-fSi2Address[i-1]) == 1)
+ {
+ nst2++;
+ if (a < aLenSiX) {
+ qclX = q+fSi2Charge[i+1]+fSi2Charge[i-1];
+ nclX++;
+ nstX+=3;
+ amaxX = a;
+ }
+ else {
+ qclY = q+fSi2Charge[i+1]+fSi2Charge[i-1];
+ nclY++;
+ nstY+=3;
+ amaxY = a;
+ }
+ i+=1;
+ }
+ else if ( (a-fSi2Address[i-1]) == 1)
+ {
+ nst2++;
+ if (a < aLenSiX) {
+ qclX = q+fSi2Charge[i-1];
+ nclX++;
+ nstX+=2;
+ amaxX = a;
+ }
+ else {
+ qclY = q+fSi2Charge[i-1];
+ nclY++;
+ nstY+=2;
+ amaxY = a;
+ }
+ }
+ else if ( (a-fSi2Address[i+1]) == -1)
+ {
+ nst2++;
+ if (a < aLenSiX) {
+ qclX = q+fSi2Charge[i+1];
+ nclX++;
+ nstX+=2;
+ amaxX = a;
+ }
+ else {
+ qclY = q+fSi2Charge[i+1];
+ nclY++;
+ nstY+=2;
+ amaxY = a;
+ }
+ i+=1;
+ }
+ }
}
}
- fX[1] = (float)(amaxX*0.05); // [mm]
- fY[1] = (float)((amaxY-aLenSiX)*0.05);
- fQx[1] = (float)qmaxX;
- fQy[1] = (float)qmaxY;
+ if (nst2==2 && nstX<4 && nstY<4 ) {
+ fX[1] = (float)(amaxX*0.05); // [mm]
+ fY[1] = (float)((amaxY-aLenSiX)*0.05);
+ fQx[1] = (float)qclX;
+ fQy[1] = (float)qclY;
+ }
+ else {
+ fX[1] = -1.;
+ fY[1] = -1.;
+ fQx[1] = 0.;
+ fQy[1] = 0.;
+ }
if (fQdcOff < 0) return 0;
}
//____________________________________________________________________________
-AliTRDRawStreamTB *AliTRDtestBeam::GetTRDrawStream()
+AliTRDrawStreamOld *AliTRDtestBeam::GetTRDrawStream()
{
//
// Get the TRD raw stream
//
- // needs AliTRDRawStreamTB
+ // needs AliTRDrawStream
//cout << "Chamber reader:" << (Int_t)(fEventData+fDdlOff) << " " << fDdlSize << endl;
//int ifout = open("dump.dat", O_WRONLY | O_TRUNC | O_CREAT);
//write(ifout, (void*)(fEventData+fDdlOff+16), fDdlSize);
AliRawReaderMemory *reader = new AliRawReaderMemory((UChar_t*)(fEventData+fDdlOff), (UInt_t)fDdlSize);
reader->SetEquipmentID(1024);
reader->ReadHeader();
- AliTRDRawStreamTB::RawBufferMissAligned(kTRUE);
- AliTRDRawStreamTB::SupressWarnings(kTRUE);
-
- AliTRDRawStreamTB *tb = new AliTRDRawStreamTB(reader);
- tb->Init();
+ //AliTRDrawStream::RawBufferMissAligned(kTRUE);
+
+ AliTRDrawStreamOld::SetExtraWordsFix();
+ AliTRDrawStreamOld::AllowCorruptedData();
+
+ AliTRDrawStreamOld *tb = new AliTRDrawStreamOld(reader);
+ tb->SetNoErrorWarning();
+ //tb->Init();
return tb;
/*
return
- AliRawReaderMemory *rmem = data->GetRawReader();
+ AliEawReaderMemory *rmem = data->GetRawReader();
rmem->ReadHeader();
- AliTRDRawStreamTB tb(rmem);
+ AliTRDrawStream tb(rmem);
tb.Init();
- AliTRDRawStreamTB::SupressWarnings(kTRUE);
+ AliTRDrawStream::SupressWarnings(kTRUE);
*/
}
//____________________________________________________________________________
-Int_t AliTRDtestBeam::Int(Int_t i, Char_t *start)
+Int_t AliTRDtestBeam::Int(Int_t i, const Char_t * const start) const
{
//
// ?????