#include "AliTRDQADataMaker.h"
#include "AliTRDdigitsManager.h"
#include "AliTRDgeometry.h"
-#include "AliTRDdataArrayS.h"
+#include "AliTRDarrayADC.h"
#include "AliTRDrawStream.h"
#include "AliTRDRawStreamV2.h"
-
#include "AliQAChecker.h"
ClassImp(AliTRDQADataMaker)
for (Int_t i = 0; i < AliTRDgeometry::kNdet; i++) {
- AliTRDdataArrayS *digitsIn = (AliTRDdataArrayS *) digitsManager->GetDigits(i);
+ AliTRDarrayADC *digitsIn = (AliTRDarrayADC *) digitsManager->GetDigits(i);
// This is to take care of switched off super modules
if (digitsIn->GetNtime() == 0) continue;
- digitsIn->Expand();
+ digitsIn->Expand();
//AliTRDSignalIndex* indexes = digitsManager->GetIndexes(i);
//if (indexes->IsAllocated() == kFALSE) digitsManager->BuildIndexes(i);
for(Int_t row = 0; row < nRows; row++)
for(Int_t col = 0; col < nCols; col++)
- for(Int_t time = 0; time < nTbins; time++) {
-
- Float_t signal = digitsIn->GetDataUnchecked(row,col,time);
- GetDigitsData(0)->Fill(i);
- GetDigitsData(1)->Fill(time);
- GetDigitsData(2)->Fill(signal);
- }
+ for(Int_t time = 0; time < nTbins; time++)
+ {
+ Float_t signal = digitsIn->GetData(row,col,time);
+ GetDigitsData(0)->Fill(i);
+ GetDigitsData(1)->Fill(time);
+ GetDigitsData(2)->Fill(signal);
+ }
//delete digitsIn;
}
digitsManager->CreateArrays();
digitsManager->ReadDigits(digits);
- for (Int_t i = 0; i < AliTRDgeometry::kNdet; i++) {
-
- AliTRDdataArrayS *digitsIn = (AliTRDdataArrayS *) digitsManager->GetDigits(i);
+ for (Int_t i = 0; i < AliTRDgeometry::kNdet; i++)
+ {
+ AliTRDarrayADC *digitsIn = (AliTRDarrayADC *) digitsManager->GetDigits(i);
// This is to take care of switched off super modules
if (digitsIn->GetNtime() == 0) continue;
- digitsIn->Expand();
+ digitsIn->Expand();
//AliTRDSignalIndex* indexes = digitsManager->GetIndexes(i);
//if (indexes->IsAllocated() == kFALSE) digitsManager->BuildIndexes(i);
for(Int_t row = 0; row < nRows; row++)
for(Int_t col = 0; col < nCols; col++)
- for(Int_t time = 0; time < nTbins; time++) {
-
- Float_t signal = digitsIn->GetDataUnchecked(row,col,time);
- if (signal <= 0) continue;
- GetSDigitsData(0)->Fill(i);
- GetSDigitsData(1)->Fill(time);
- GetSDigitsData(2)->Fill(signal);
- }
-
+ for(Int_t time = 0; time < nTbins; time++)
+ {
+ Float_t signal = digitsIn->GetData(row,col,time);
+ if (signal <= 0) continue;
+ GetSDigitsData(0)->Fill(i);
+ GetSDigitsData(1)->Fill(time);
+ GetSDigitsData(2)->Fill(signal);
+ }
+
// delete digitsIn;
}
#include "AliTRDQADataMakerSim.h"
#include "AliTRDdigitsManager.h"
#include "AliTRDgeometry.h"
-#include "AliTRDdataArrayS.h"
-#include "AliTRDdataArrayF.h"
+#include "AliTRDarrayADC.h"
+#include "AliTRDarraySignal.h"
//#include "AliTRDrawStream.h"
#include "AliQAChecker.h"
TH1D *histTime = (TH1D*)GetDigitsData(1);
TH1D *histSignal = (TH1D*)GetDigitsData(2);
- for (Int_t i = 0; i < AliTRDgeometry::kNdet; i++) {
-
- AliTRDdataArrayS *digitsIn = (AliTRDdataArrayS *) digitsManager->GetDigits(i);
-
- // This is to take care of switched off super modules
- if (digitsIn->GetNtime() == 0) continue;
-
- digitsIn->Expand();
-
- //AliTRDSignalIndex* indexes = digitsManager->GetIndexes(i);
- //if (indexes->IsAllocated() == kFALSE) digitsManager->BuildIndexes(i);
-
- Int_t nRows = digitsIn->GetNrow();
- Int_t nCols = digitsIn->GetNcol();
- Int_t nTbins = digitsIn->GetNtime();
-
- for(Int_t row = 0; row < nRows; row++)
- for(Int_t col = 0; col < nCols; col++)
- for(Int_t time = 0; time < nTbins; time++) {
-
- Float_t signal = digitsIn->GetDataUnchecked(row,col,time);
- if (signal < 1) continue;
- histDet->Fill(i);
- histTime->Fill(time);
- histSignal->Fill(signal);
- }
+ for (Int_t i = 0; i < AliTRDgeometry::kNdet; i++)
+ {
+ AliTRDarrayADC *digitsIn = (AliTRDarrayADC *) digitsManager->GetDigits(i);
+
+ // This is to take care of switched off super modules
+ if (digitsIn->GetNtime() == 0) continue;
+
+ digitsIn->Expand();
+
+ //AliTRDSignalIndex* indexes = digitsManager->GetIndexes(i);
+ //if (indexes->IsAllocated() == kFALSE) digitsManager->BuildIndexes(i);
+
+ Int_t nRows = digitsIn->GetNrow();
+ Int_t nCols = digitsIn->GetNcol();
+ Int_t nTbins = digitsIn->GetNtime();
+
+ for(Int_t row = 0; row < nRows; row++)
+ for(Int_t col = 0; col < nCols; col++)
+ for(Int_t time = 0; time < nTbins; time++)
+ {
+ Float_t signal = digitsIn->GetData(row,col,time);
+ if (signal < 1) continue;
+ histDet->Fill(i);
+ histTime->Fill(time);
+ histSignal->Fill(signal);
+ }
//delete digitsIn;
}
-
delete digitsManager;
-
}
//____________________________________________________________________________
TH1D *histTime = (TH1D*)GetSDigitsData(1);
TH1D *histSignal = (TH1D*)GetSDigitsData(2);
- for (Int_t i = 0; i < AliTRDgeometry::kNdet; i++) {
-
- //AliTRDdataArrayS *digitsIn = (AliTRDdataArrayS *) digitsManager->GetDigits(i);
- AliTRDdataArrayF *digitsIn = (AliTRDdataArrayF *) digitsManager->GetDigits(i);
-
+ for (Int_t i = 0; i < AliTRDgeometry::kNdet; i++)
+ {
+ AliTRDarraySignal *digitsIn = (AliTRDarraySignal *) digitsManager->GetSDigits(i);
+
// This is to take care of switched off super modules
- if (digitsIn->GetNtime() == 0) continue;
-
- digitsIn->Expand();
-
- //AliTRDSignalIndex* indexes = digitsManager->GetIndexes(i);
- //if (indexes->IsAllocated() == kFALSE) digitsManager->BuildIndexes(i);
-
- Int_t nRows = digitsIn->GetNrow();
- Int_t nCols = digitsIn->GetNcol();
- Int_t nTbins = digitsIn->GetNtime();
-
- for(Int_t row = 0; row < nRows; row++)
- for(Int_t col = 0; col < nCols; col++)
- for(Int_t time = 0; time < nTbins; time++) {
-
- Float_t signal = digitsIn->GetDataUnchecked(row,col,time);
- if (signal < 1) continue;
- histDet->Fill(i);
- histTime->Fill(time);
- histSignal->Fill(signal);
- }
-
- // delete digitsIn;
- }
-
+ if (digitsIn->GetNtime() == 0) continue;
+
+ digitsIn->Expand();
+
+ //AliTRDSignalIndex* indexes = digitsManager->GetIndexes(i);
+ //if (indexes->IsAllocated() == kFALSE) digitsManager->BuildIndexes(i);
+ Int_t nRows = digitsIn->GetNrow();
+ Int_t nCols = digitsIn->GetNcol();
+ Int_t nTbins = digitsIn->GetNtime();
+
+ for(Int_t row = 0; row < nRows; row++)
+ {
+ for(Int_t col = 0; col < nCols; col++)
+ {
+ for(Int_t time = 0; time < nTbins; time++)
+ {
+ Float_t signal = digitsIn->GetData(row,col,time);
+ if (signal < 1) continue;
+ histDet->Fill(i);
+ histTime->Fill(time);
+ histSignal->Fill(signal);
+ }
+ }
+ }
+ // delete digitsIn;
+ }
delete digitsManager;
-
}
//____________________________________________________________________________
#include "AliTRDcalibDB.h"
#include "AliTRDfeeParam.h"
#include "AliTRDdigitsManager.h"
-#include "AliTRDdataArrayI.h"
-#include "AliTRDdataArrayS.h"
+#include "AliTRDarrayDictionary.h"
+#include "AliTRDarrayADC.h"
#include "AliTRDSignalIndex.h"
ClassImp(AliTRDRawStreamV2)
// here we override the value in the buffer!
*fDataWord = iutmp;
}
- fDataWord = fpBegin;
- }
-
- // dump words - debugging perpose
- if (fgDumpHead > 0){
- AliInfo(Form("---------- Dumping %u words from the beginnig of the buffer ----------",fgDumpHead));
- if (DumpWords(fpBegin, fgDumpHead) == kFALSE){AliError("Dump failed. Not enough data.");}
- AliInfo(Form("---------- Dumping ended ----------------------------------------------"));
+ fDataWord = fpBegin;
}
+ // dump words - debugging perpose
+ if (fgDumpHead > 0){
+ AliInfo(Form("---------- Dumping %u words from the beginnig of the buffer ----------",fgDumpHead));
+ if (DumpWords(fpBegin, fgDumpHead) == kFALSE){AliError("Dump failed. Not enough data.");}
+ AliInfo(Form("---------- Dumping ended ----------------------------------------------"));
+ }
+
}
//____________________________________________________________________________
Int_t AliTRDRawStreamV2::NextData()
// Return value is the detector number
//
- AliTRDdataArrayS *digits = 0;
- AliTRDdataArrayI *track0 = 0;
- AliTRDdataArrayI *track1 = 0;
- AliTRDdataArrayI *track2 = 0;
+ AliTRDarrayADC *digits = 0;
+ AliTRDarrayDictionary *track0 = 0;
+ AliTRDarrayDictionary *track1 = 0;
+ AliTRDarrayDictionary *track2 = 0;
AliTRDSignalIndex *indexes = 0;
if (fNextStatus == kStart)
{
if ( fSig[it] > fRawDigitThreshold )
{
- digits->SetDataUnchecked(fROW, fCOL, fTB + it, fSig[it]);
+ digits->SetData(fROW, fCOL, fTB + it, fSig[it]);
indexes->AddIndexTBin(fROW, fCOL, fTB + it);
if (man->UsesDictionaries())
{
- track0->SetDataUnchecked(fROW, fCOL, fTB + it, 0);
- track1->SetDataUnchecked(fROW, fCOL, fTB + it, 0);
- track2->SetDataUnchecked(fROW, fCOL, fTB + it, 0);
+ track0->SetData(fROW, fCOL, fTB + it, 0);
+ track1->SetData(fROW, fCOL, fTB + it, 0);
+ track2->SetData(fROW, fCOL, fTB + it, 0);
} // if dictionaries
} // signal above zero
} // check the tbins range
// AliDebug(4, Form("???? New DET ???? %d last %d", fDET, fLastDET));
// allocate stuff for the new det
//man->ResetArrays();
- digits = (AliTRDdataArrayS *) man->GetDigits(fDET);
- track0 = (AliTRDdataArrayI *) man->GetDictionary(fDET,0);
- track1 = (AliTRDdataArrayI *) man->GetDictionary(fDET,1);
- track2 = (AliTRDdataArrayI *) man->GetDictionary(fDET,2);
+ digits = (AliTRDarrayADC *) man->GetDigits(fDET);
+ track0 = (AliTRDarrayDictionary *) man->GetDictionary(fDET,0);
+ track1 = (AliTRDarrayDictionary *) man->GetDictionary(fDET,1);
+ track2 = (AliTRDarrayDictionary *) man->GetDictionary(fDET,2);
// Allocate memory space for the digits buffer
if (digits->GetNtime() == 0)
Bool_t
AliTRDRawStreamV2::DumpWords(UInt_t *px, UInt_t iw, UInt_t marker)
{
-
+
TString tsreturn = Form("\n[ Dump Sequence at 0x%08x ] : ", px);
for (UInt_t i = 0; i < iw; i++)
{
if (px + iw >= fpEnd)
- return kFALSE;
-
+ return kFALSE;
+
if (i % 8 == 0)
- tsreturn += "\n ";
+ tsreturn += "\n ";
if (marker != 0 && marker == px[i])
- tsreturn += Form(" *>0x%08x<* ", px[i]);
+ tsreturn += Form(" *>0x%08x<* ", px[i]);
else
- tsreturn += Form("0x%08x ", px[i]);
+ tsreturn += Form("0x%08x ", px[i]);
}
tsreturn += "\n";
-
+
AliInfo(tsreturn.Data());
-
+
return kTRUE;
-}
-
-
+}
--- /dev/null
+/*************************************************************************
+* Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
+* *
+* Author: The ALICE Off-line Project. *
+* Contributors are mentioned in the code where appropriate. *
+* *
+* Permission to use, copy, modify and distribute this software and its *
+* documentation strictly for non-commercial purposes is hereby granted *
+* without fee, provided that the above copyright notice appears in all *
+* copies and that both the copyright notice and this permission notice *
+* appear in the supporting documentation. The authors make no claims *
+* about the suitability of this software for any purpose. It is *
+* provided "as is" without express or implied warranty. *
+**************************************************************************/
+
+/* $Id: AliTRDarrayADC.cxx 25392 2008-04-23 19:40:29Z cblume $ */
+
+////////////////////////////////////////////////////////
+// //
+// Container class for ADC values //
+// //
+// Author: //
+// Hermes Leon Vargas (hleon@ikf.uni-frankfurt.de) //
+// //
+////////////////////////////////////////////////////////
+
+#include "AliTRDarrayADC.h"
+#include "Cal/AliTRDCalPadStatus.h"
+
+ClassImp(AliTRDarrayADC)
+
+//____________________________________________________________________________________
+AliTRDarrayADC::AliTRDarrayADC()
+ :TObject()
+ ,fNdet(0)
+ ,fNrow(0)
+ ,fNcol(0)
+ ,fNtime(0)
+ ,fNAdim(0)
+ ,fADC(0)
+{
+ //
+ // AliTRDarrayADC default constructor
+ //
+
+}
+
+//____________________________________________________________________________________
+AliTRDarrayADC::AliTRDarrayADC(Int_t nrow, Int_t ncol, Int_t ntime)
+ :TObject()
+ ,fNdet(0)
+ ,fNrow(0)
+ ,fNcol(0)
+ ,fNtime(0)
+ ,fNAdim(0)
+ ,fADC(0)
+{
+ //
+ // AliTRDarrayADC constructor
+ //
+
+ Allocate(nrow,ncol,ntime);
+
+}
+
+//____________________________________________________________________________________
+AliTRDarrayADC::AliTRDarrayADC(const AliTRDarrayADC &b)
+ :TObject()
+ ,fNdet(b.fNdet)
+ ,fNrow(b.fNrow)
+ ,fNcol(b.fNcol)
+ ,fNtime(b.fNtime)
+ ,fNAdim(b.fNAdim)
+ ,fADC(0)
+{
+ //
+ // AliTRDarrayADC copy constructor
+ //
+
+ fADC = new Short_t[fNAdim];
+ for(Int_t i=0; i<fNAdim; i++)
+ {
+ fADC[i]=b.fADC[i];
+ }
+
+}
+
+//____________________________________________________________________________________
+AliTRDarrayADC::~AliTRDarrayADC()
+{
+ //
+ // AliTRDarrayADC destructor
+ //
+
+ if(fADC)
+ {
+ delete [] fADC;
+ fADC=0;
+ }
+
+}
+
+//____________________________________________________________________________________
+AliTRDarrayADC &AliTRDarrayADC::operator=(const AliTRDarrayADC &b)
+{
+ //
+ // Assignment operator
+ //
+
+ if(this==&b)
+ {
+ return *this;
+ }
+
+ if(fADC)
+ {
+ delete [] fADC;
+ }
+ fNdet=b.fNdet;
+ fNrow=b.fNrow;
+ fNcol=b.fNcol;
+ fNtime=b.fNtime;
+ fNAdim=b.fNAdim;
+ fADC = new Short_t[fNAdim];
+ for(Int_t i=0;i<fNAdim;i++)
+ {
+ fADC[i]=b.fADC[i];
+ }
+ return *this;
+
+}
+
+//____________________________________________________________________________________
+void AliTRDarrayADC::Allocate(Int_t nrow, Int_t ncol, Int_t ntime)
+{
+ //
+ // Allocate memory for an AliTRDarrayADC array with dimensions
+ // Row*Col*Time
+ //
+
+ fNrow=nrow;
+ fNcol=ncol;
+ fNtime=ntime;
+ fNAdim=nrow*ncol*ntime;
+
+ if(fADC)
+ {
+ delete [] fADC;
+ }
+
+ fADC = new Short_t[fNAdim];
+ for(Int_t a=0; a<fNAdim; a++)
+ {
+ fADC[a]=0;
+ }
+
+}
+
+//____________________________________________________________________________________
+Short_t AliTRDarrayADC::GetDataB(Int_t row, Int_t col, Int_t time) const
+{
+ //
+ // Get the ADC value for a given position: row, col, time
+ // Taking bit masking into account
+ //
+ // Adapted from code of the class AliTRDdataArrayDigits
+ //
+
+ Short_t tempval = fADC[(row*fNcol+col)*fNtime+time];
+ // Be aware of manipulations introduced by pad masking in the RawReader
+ // Only output the manipulated Value
+ CLRBIT(tempval, 10);
+ CLRBIT(tempval, 11);
+ CLRBIT(tempval, 12);
+ return tempval;
+
+}
+
+//____________________________________________________________________________________
+UChar_t AliTRDarrayADC::GetPadStatus(Int_t row, Int_t col, Int_t time) const
+{
+ //
+ // Returns the pad status stored in the pad signal
+ //
+ // Output is a UChar_t value
+ // Status Codes:
+ // Noisy Masking: 2
+ // Bridged Left Masking 8
+ // Bridged Right Masking 8
+ // Not Connected Masking Digits
+ //
+ // Adapted from code of the class AliTRDdataArrayDigits
+ //
+
+ UChar_t padstatus = 0;
+ Short_t signal = GetData(row,col,time);
+ if(signal > 0 && TESTBIT(signal, 10)){
+ if(TESTBIT(signal, 11))
+ if(TESTBIT(signal, 12))
+ padstatus = AliTRDCalPadStatus::kPadBridgedRight;
+ else
+ padstatus = AliTRDCalPadStatus::kNotConnected;
+ else
+ if(TESTBIT(signal, 12))
+ padstatus = AliTRDCalPadStatus::kPadBridgedLeft;
+ else
+ padstatus = AliTRDCalPadStatus::kMasked;
+ }
+
+ return padstatus;
+
+}
+
+//____________________________________________________________________________________
+void AliTRDarrayADC::SetPadStatus(Int_t row, Int_t col, Int_t time, UChar_t status)
+{
+ //
+ // Setting the pad status into the signal using the Bits 10 to 14
+ // (currently used: 10 to 12)
+ //
+ // Input codes (Unsigned char):
+ // Noisy Masking: 2
+ // Bridged Left Masking 8
+ // Bridged Right Masking 8
+ // Not Connected Masking 32
+ //
+ // Status codes: Any masking: Bit 10(1)
+ // Noisy masking: Bit 11(0), Bit 12(0)
+ // No Connection masking: Bit 11(1), Bit 12(0)
+ // Bridged Left masking: Bit 11(0), Bit 12(1)
+ // Bridged Right masking: Bit 11(1), Bit 12(1)
+ //
+ // Adapted from code of the class AliTRDdataArrayDigits
+ //
+
+ Short_t signal = GetData(row,col,time);
+
+ // Only set the Pad Status if the signal is > 0
+ if(signal > 0)
+ {
+ switch(status)
+ {
+ case AliTRDCalPadStatus::kMasked:
+ SETBIT(signal, 10);
+ CLRBIT(signal, 11);
+ CLRBIT(signal, 12);
+ break;
+ case AliTRDCalPadStatus::kNotConnected:
+ SETBIT(signal, 10);
+ SETBIT(signal, 11);
+ CLRBIT(signal, 12);
+ break;
+ case AliTRDCalPadStatus::kPadBridgedLeft:
+ SETBIT(signal, 10);
+ CLRBIT(signal, 11);
+ SETBIT(signal, 12);
+ break;
+ case AliTRDCalPadStatus::kPadBridgedRight:
+ SETBIT(signal, 10);
+ SETBIT(signal, 11);
+ SETBIT(signal, 12);
+ default:
+ CLRBIT(signal, 10);
+ CLRBIT(signal, 11);
+ CLRBIT(signal, 12);
+ }
+ SetData(row, col, time, signal);
+ }
+
+}
+
+//____________________________________________________________________________________
+Bool_t AliTRDarrayADC::IsPadCorrupted(Int_t row, Int_t col, Int_t time)
+{
+ //
+ // Checks if the pad has any masking as corrupted (Bit 10 in signal set)
+ //
+ // Adapted from code of the class AliTRDdataArrayDigits
+ //
+
+ Short_t signal = GetData(row,col,time);
+ return (signal > 0 && TESTBIT(signal, 10)) ? kTRUE : kFALSE;
+
+}
+
+//____________________________________________________________________________________
+void AliTRDarrayADC::Compress()
+{
+ //
+ // Compress the array
+ //
+
+ Int_t counter=0;
+ Int_t newDim=0;
+ Int_t j;
+ Int_t l;
+ Int_t r=0;
+ Int_t s=0;
+ Int_t *longm;
+ longm = new Int_t[fNAdim];
+ Int_t *longz;
+ longz = new Int_t[fNAdim];
+ Int_t k=0;
+ for(Int_t i=0; i<fNAdim;i++)
+ {
+ longz[i]=0;
+ longm[i]=0;
+ }
+
+ for(Int_t i=0;i<fNAdim; i++)
+ {
+ j=0;
+ if(fADC[i]==-1)
+ {
+ for(k=i;k<fNAdim;k++)
+ {
+ if((fADC[k]==-1)&&(j<16000))
+ {
+ j=j+1;
+ longm[r]=j;
+ }
+ else
+ {
+ break;
+ }
+ }
+ r=r+1;
+ }
+ l=16001;
+ if(fADC[i]==0)
+ {
+ for(k=i;k<fNAdim;k++)
+ {
+ if((fADC[k]==0)&&(l<32767))
+ {
+ l=l+1;
+ longz[s]=l;
+ }
+ else
+ {
+ break;
+ }
+ }
+ s=s+1;
+ }
+ if(fADC[i]>0)
+ {
+ i=i+1;
+ }
+ i=i+j+(l-16001-1);
+ }
+
+ //Calculate the size of the compressed array
+ for(Int_t i=0; i<fNAdim;i++)
+ {
+ if(longm[i]!=0)
+ {
+ counter=counter+longm[i]-1;
+ }
+ if(longz[i]!=0)
+ {
+ counter=counter+(longz[i]-16001)-1;
+ }
+ }
+ newDim = fNAdim-counter; //Dimension of the compressed array
+ Short_t* buffer;
+ buffer = new Short_t[newDim];
+ Int_t counterTwo=0;
+
+ //Fill the buffer of the compressed array
+ Int_t g=0;
+ Int_t h=0;
+ for(Int_t i=0; i<newDim; i++)
+ {
+ if(counterTwo<fNAdim)
+ {
+ if(fADC[counterTwo]>0)
+ {
+ buffer[i]=fADC[counterTwo];
+ }
+ if(fADC[counterTwo]==-1)
+ {
+ buffer[i]=-(longm[g]);
+ counterTwo=counterTwo+longm[g]-1;
+ g++;
+ }
+ if(fADC[counterTwo]==0)
+ {
+ buffer[i]=-(longz[h]);
+ counterTwo=counterTwo+(longz[h]-16001)-1;
+ h++;
+ }
+ counterTwo++;
+ }
+ }
+
+ //Copy the buffer
+ if(fADC)
+ {
+ delete [] fADC;
+ fADC=0;
+ }
+ fADC = new Short_t[newDim];
+ fNAdim = newDim;
+ for(Int_t i=0; i<newDim; i++)
+ {
+ fADC[i] = buffer[i];
+ }
+
+ //Delete auxiliary arrays
+ if(buffer)
+ {
+ delete [] buffer;
+ buffer=0;
+ }
+ if(longz)
+ {
+ delete [] longz;
+ longz=0;
+ }
+ if(longm)
+ {
+ delete [] longm;
+ longm=0;
+ }
+
+}
+
+//____________________________________________________________________________________
+void AliTRDarrayADC::Expand()
+{
+ //
+ // Expand the array
+ //
+
+ Int_t *longz;
+ longz = new Int_t[fNAdim];
+ Int_t *longm;
+ longm = new Int_t[fNAdim];
+ Int_t dimexp=0;
+ //Initialize arrays
+ for(Int_t i=0; i<fNAdim;i++)
+ {
+ longz[i]=0;
+ longm[i]=0;
+ }
+ Int_t r2=0;
+ Int_t r3=0;
+ for(Int_t i=0; i<fNAdim;i++)
+ {
+ if((fADC[i]<0)&&(fADC[i]>=-16000))
+ {
+ longm[r2]=-fADC[i];
+ r2++;
+ }
+ if(fADC[i]<-16000)
+ {
+ longz[r3]=-fADC[i]-16001;
+ r3++;
+ }
+ }
+ //Calculate the new dimensions of the array
+ for(Int_t i=0; i<fNAdim;i++)
+ {
+ if(longm[i]!=0)
+ {
+ dimexp=dimexp+longm[i]-1;
+ }
+ if(longz[i]!=0)
+ {
+ dimexp=dimexp+longz[i]-1;
+ }
+ }
+ dimexp=dimexp+fNAdim;
+
+ //Write in the buffer the new array
+ Short_t* bufferE;
+ bufferE = new Short_t[dimexp];
+ Int_t contaexp =0;
+ Int_t h=0;
+ Int_t l=0;
+ for(Int_t i=0; i<dimexp; i++)
+ {
+ if(fADC[contaexp]>0)
+ {
+ bufferE[i]=fADC[contaexp];
+ }
+
+ if((fADC[contaexp]<0)&&(fADC[contaexp]>=-16000))
+ {
+ for(Int_t j=0; j<longm[h];j++)
+ {
+ bufferE[i+j]=-1;
+ }
+ i=i+longm[h]-1;
+ h++;
+ }
+ if(fADC[contaexp]<-16000)
+ {
+ for(Int_t j=0; j<longz[l];j++)
+ {
+ bufferE[i+j]=0;
+ }
+ i=i+longz[l]-1;
+ l++;
+ }
+ contaexp++;
+ }
+ //Copy the buffer
+ if(fADC)
+ {
+ delete [] fADC;
+ fADC=0;
+ }
+
+ fADC = new Short_t[dimexp];
+ fNAdim = dimexp;
+ for(Int_t i=0; i<dimexp; i++)
+ {
+ fADC[i] = bufferE[i];
+ }
+
+ //Delete auxiliary arrays
+ if(bufferE) delete [] bufferE;
+ if(longm) delete [] longm;
+ if(longz) delete [] longz;
+
+}
--- /dev/null
+#ifndef ALITRDARRAYADC_H
+#define ALITRDARRAYADC_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id: AliTRDarrayADC.h 23387 2008-01-17 17:25:16Z cblume $ */
+
+///////////////////////////////////////////////
+// //
+// Container class for ADC values //
+// //
+///////////////////////////////////////////////
+
+#include <TObject.h>
+
+class AliTRDarrayADC: public TObject
+{
+ public:
+
+ AliTRDarrayADC();
+ AliTRDarrayADC(Int_t nrow, Int_t ncol, Int_t ntime);
+ AliTRDarrayADC(const AliTRDarrayADC &b);
+ ~AliTRDarrayADC();
+ AliTRDarrayADC &operator=(const AliTRDarrayADC &b);
+
+ void Allocate(Int_t nrow, Int_t ncol, Int_t ntime);
+ void SetNdet(Int_t ndet) {fNdet=ndet;};
+ Int_t GetNdet() const {return fNdet;};
+ void SetData(Int_t nrow, Int_t ncol, Int_t ntime, Short_t value)
+ {fADC[(nrow*fNcol+ncol)*fNtime+ntime]=value;};
+ Bool_t HasData() const {return fNtime ? 1 : 0;};
+ Short_t GetData(Int_t nrow, Int_t ncol, Int_t ntime) const
+ {return fADC[(nrow*fNcol+ncol)*fNtime+ntime];};
+ Short_t GetDataB(Int_t nrow, Int_t ncol, Int_t ntime) const;
+ UChar_t GetPadStatus(Int_t nrow, Int_t ncol, Int_t ntime) const;
+ void SetPadStatus(Int_t nrow, Int_t ncol, Int_t ntime, UChar_t status);
+ Bool_t IsPadCorrupted(Int_t nrow, Int_t ncol, Int_t ntime);
+ void Compress();
+ void Expand();
+ Int_t GetNtime() const {return fNtime;};
+ Int_t GetNrow() const {return fNrow;};
+ Int_t GetNcol() const {return fNcol;};
+ Int_t GetDim() const {return fNAdim;};
+
+ protected:
+
+ Int_t fNdet; //ID number of the chamber
+ Int_t fNrow; //Number of rows
+ Int_t fNcol; //Number of columns
+ Int_t fNtime; //Number of time bins
+ Int_t fNAdim; //Dimension of the ADC array
+ Short_t* fADC; //[fNAdim] //Pointer to adc values
+
+ ClassDef(AliTRDarrayADC,1) //ADC container class
+
+};
+#endif
--- /dev/null
+/*************************************************************************
+* Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
+* *
+* Author: The ALICE Off-line Project. *
+* Contributors are mentioned in the code where appropriate. *
+* *
+* Permission to use, copy, modify and distribute this software and its *
+* documentation strictly for non-commercial purposes is hereby granted *
+* without fee, provided that the above copyright notice appears in all *
+* copies and that both the copyright notice and this permission notice *
+* appear in the supporting documentation. The authors make no claims *
+* about the suitability of this software for any purpose. It is *
+* provided "as is" without express or implied warranty. *
+**************************************************************************/
+
+/* $Id: AliTRDarrayDictionary.cxx 25392 2008-04-23 19:40:29Z cblume $ */
+
+/////////////////////////////////////////////////////////
+// //
+// Container Class for Dictionary Info //
+// //
+// Author: //
+// Hermes Leon Vargas (hleon@ikf.uni-frankfurt.de) //
+// //
+/////////////////////////////////////////////////////////
+
+#include "AliTRDarrayDictionary.h"
+
+ClassImp(AliTRDarrayDictionary)
+
+//________________________________________________________________________________
+AliTRDarrayDictionary::AliTRDarrayDictionary()
+ :TObject()
+ ,fNdet(0)
+ ,fNrow(0)
+ ,fNcol(0)
+ ,fNtime(0)
+ ,fNDdim(0)
+ ,fDictionary(0)
+{
+ //
+ // AliTRDarrayDictionary default contructor
+ //
+
+}
+
+//________________________________________________________________________________
+AliTRDarrayDictionary::AliTRDarrayDictionary(Int_t nrow, Int_t ncol, Int_t ntime)
+ :TObject()
+ ,fNdet(0)
+ ,fNrow(0)
+ ,fNcol(0)
+ ,fNtime(0)
+ ,fNDdim(0)
+ ,fDictionary(0)
+
+{
+ //
+ // AliTRDarrayDictionary contructor
+ //
+
+ Allocate(nrow,ncol,ntime);
+
+}
+
+//________________________________________________________________________________
+AliTRDarrayDictionary::AliTRDarrayDictionary(const AliTRDarrayDictionary &a)
+ :TObject()
+ ,fNdet(a.fNdet)
+ ,fNrow(a.fNrow)
+ ,fNcol(a.fNcol)
+ ,fNtime(a.fNtime)
+ ,fNDdim(a.fNDdim)
+ ,fDictionary(0)
+{
+ //
+ // AliTRDarrayDictionary copy constructor
+ //
+
+ fDictionary = new Int_t[fNDdim];
+ for(Int_t i=0; i<fNDdim; i++)
+ {
+ fDictionary[i]=a.fDictionary[i];
+ }
+
+}
+
+//________________________________________________________________________________
+AliTRDarrayDictionary::~AliTRDarrayDictionary()
+{
+ //
+ // AliTRDarrayDictionary destructor
+ //
+
+ if(fDictionary)
+ {
+ delete [] fDictionary;
+ fDictionary=0;
+ }
+
+}
+
+//________________________________________________________________________________
+AliTRDarrayDictionary &AliTRDarrayDictionary::operator=(const AliTRDarrayDictionary &a)
+{
+ //
+ // Assignment operator
+ //
+
+ if(this==&a)
+ {
+ return *this;
+ }
+
+ if(fDictionary)
+ {
+ delete [] fDictionary;
+ }
+ fNdet=a.fNdet;
+ fNDdim=a.fNDdim;
+ fNrow=a.fNrow;
+ fNcol=a.fNcol;
+ fNtime=a.fNtime;
+ fDictionary = new Int_t[fNDdim];
+ for(Int_t i=0; i<fNDdim; i++)
+ {
+ fDictionary[i]=a.fDictionary[i];
+ }
+ return *this;
+
+}
+
+//________________________________________________________________________________
+void AliTRDarrayDictionary::Allocate(Int_t nrow, Int_t ncol, Int_t ntime)
+{
+ //
+ // Allocates memory for the dictionary array with dimensions
+ // Row*Col*Time
+ // Object initialized to -1
+ //
+
+ fNrow=nrow;
+ fNcol=ncol;
+ fNtime=ntime;
+ fNDdim=nrow*ncol*ntime;
+ if(fDictionary)
+ {
+ delete [] fDictionary;
+ fDictionary=0;
+ }
+ fDictionary = new Int_t[fNDdim];
+ for(Int_t i=0; i<fNDdim; i++)
+ {
+ fDictionary[i] = -1;
+ }
+
+}
+
+//________________________________________________________________________________
+void AliTRDarrayDictionary::Compress()
+{
+ //
+ // Compress the array
+ //
+
+
+ // AliDebug(1,"Compressing");
+ Int_t counter=0;
+ Int_t newDim=0;
+ Int_t j;
+ Int_t r=0;
+ Int_t *longArr;
+ longArr = new Int_t[fNDdim];
+ Int_t k=0;
+ for(Int_t i=0; i<fNDdim;i++)
+ {
+ longArr[i]=0;
+ }
+ for(Int_t i=0;i<fNDdim; i++)
+ {
+ j=0;
+ if(fDictionary[i]==-1)
+ {
+ for(k=i;k<fNDdim;k++)
+ {
+ if(fDictionary[k]==-1)
+ {
+ j=j+1;
+ longArr[r]=j;
+ }
+ else
+ {
+ break;
+ }
+ }
+ r=r+1;
+ }
+ i=i+j;
+ }
+ //Calculate the size of the compressed array
+ for(Int_t i=0; i<fNDdim;i++)
+ {
+ if(longArr[i]!=0)
+ {
+ counter=counter+longArr[i]-1;
+ }
+ }
+ newDim=fNDdim-counter; //Size of the compressed array
+ //Fill the buffer of the compressed array
+ Int_t* buffer;
+ buffer = new Int_t[newDim];
+ Int_t counterTwo=0;
+ Int_t g=0;
+ for(Int_t i=0; i<newDim; i++)
+ {
+ if(counterTwo<fNDdim)
+ {
+ if(fDictionary[counterTwo]!=-1)
+ {
+ buffer[i]=fDictionary[counterTwo];
+ }
+ if(fDictionary[counterTwo]==-1)
+ {
+ buffer[i]=-(longArr[g]);
+ counterTwo=counterTwo+longArr[g]-1;
+ g++;
+ }
+ counterTwo++;
+ }
+ }
+
+ //Copy the buffer
+ if(fDictionary)
+ {
+ delete [] fDictionary;
+ fDictionary=0;
+ }
+ fDictionary = new Int_t[newDim];
+ fNDdim = newDim;
+ for(Int_t i=0; i<newDim; i++)
+ {
+ fDictionary[i] = buffer[i];
+ }
+ if(buffer)
+ {
+ delete [] buffer;
+ buffer=0;
+ }
+ if(longArr)
+ {
+ delete [] longArr;
+ longArr=0;
+ }
+
+}
+
+//________________________________________________________________________________
+void AliTRDarrayDictionary::Expand()
+{
+ //
+ // Expand the array
+ //
+
+ Int_t *longArr;
+ longArr = new Int_t[fNDdim];
+ Int_t dimexp=0;
+ for(Int_t i=0; i<fNDdim;i++)
+ {
+ longArr[i]=0;
+ }
+ Int_t r2=0;
+ for(Int_t i=0; i<fNDdim;i++)
+ {
+ if((fDictionary[i]<0)&&(fDictionary[i]!=-1))
+ {
+ longArr[r2]=-fDictionary[i];
+ r2++;
+ }
+ }
+
+ //Calculate new dimensions
+ for(Int_t i=0; i<fNDdim;i++)
+ {
+ if(longArr[i]!=0)
+ {
+ dimexp=dimexp+longArr[i]-1;
+ }
+ }
+ dimexp=dimexp+fNDdim;
+
+ //Write in the buffer the new array
+ Int_t* bufferE;
+ bufferE = new Int_t[dimexp];
+ Int_t contaexp =0;
+ Int_t h=0;
+ for(Int_t i=0; i<dimexp; i++)
+ {
+ if(fDictionary[contaexp]>=-1)
+ {
+ bufferE[i]=fDictionary[contaexp];
+ }
+ if(fDictionary[contaexp]<-1)
+ {
+ for(Int_t j=0; j<longArr[h];j++)
+ {
+ bufferE[i+j]=-1;
+ }
+ i=i+longArr[h]-1;
+ h++;
+ }
+ contaexp++;
+ }
+
+ //Copy the buffer
+ if(fDictionary)
+ {
+ delete [] fDictionary;
+ fDictionary=0;
+ }
+
+ fDictionary = new Int_t[dimexp];
+ fNDdim = dimexp;
+ for(Int_t i=0; i<dimexp; i++)
+ {
+ fDictionary[i] = bufferE[i];
+ }
+ if(bufferE) delete [] bufferE;
+ if(longArr) delete [] longArr;
+
+}
--- /dev/null
+#ifndef ALITRDARRAYDICTIONARY_H\r
+#define ALITRDARRAYDICTIONARY_H\r
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * \r
+ * See cxx source for full Copyright notice */ \r
+\r
+/* $Id: AliTRDarrayDictionary.h 23387 2008-01-17 17:25:16Z cblume $ */\r
+\r
+///////////////////////////////////////////////////\r
+// //\r
+// Container Class for Dictionary Info //\r
+// //\r
+///////////////////////////////////////////////////\r
+\r
+#include <TObject.h>\r
+\r
+class AliTRDarrayDictionary: public TObject\r
+{\r
+\r
+ public:\r
+\r
+ AliTRDarrayDictionary();\r
+ AliTRDarrayDictionary(Int_t nrow, Int_t ncol, Int_t ntime);\r
+ AliTRDarrayDictionary(const AliTRDarrayDictionary &a);\r
+ ~AliTRDarrayDictionary();\r
+ AliTRDarrayDictionary &operator=(const AliTRDarrayDictionary &a);\r
+\r
+ void Allocate(Int_t nrow, Int_t ncol, Int_t ntime);\r
+ void SetNdet(Int_t ndet) {fNdet=ndet;}; \r
+ Int_t GetNdet() const {return fNdet;};\r
+ void SetData(Int_t nrow, Int_t ncol, Int_t ntime, Int_t value)\r
+ { fDictionary[(nrow*fNcol+ncol)*fNtime+ntime]=value; };\r
+ Int_t GetData(Int_t nrow, Int_t ncol, Int_t ntime) const\r
+ { return fDictionary[(nrow*fNcol+ncol)*fNtime+ntime]; };\r
+ Int_t GetDim() const {return fNDdim;};\r
+ void Compress();\r
+ void Expand();\r
+\r
+ protected:\r
+\r
+ Int_t fNdet; //ID number of the chamber\r
+ Int_t fNrow; //Number of rows\r
+ Int_t fNcol; //Number of columns\r
+ Int_t fNtime; //Number of time bins\r
+ Int_t fNDdim; //Dimension of the Dictionary array\r
+ Int_t* fDictionary; //[fNDdim] //Pointer to integers array\r
+\r
+\r
+ ClassDef(AliTRDarrayDictionary,1) //Dictionary container class\r
+ \r
+};\r
+#endif\r
--- /dev/null
+/*************************************************************************
+* Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
+* *
+* Author: The ALICE Off-line Project. *
+* Contributors are mentioned in the code where appropriate. *
+* *
+* Permission to use, copy, modify and distribute this software and its *
+* documentation strictly for non-commercial purposes is hereby granted *
+* without fee, provided that the above copyright notice appears in all *
+* copies and that both the copyright notice and this permission notice *
+* appear in the supporting documentation. The authors make no claims *
+* about the suitability of this software for any purpose. It is *
+* provided "as is" without express or implied warranty. *
+**************************************************************************/
+
+/* $Id: AliTRDarraySignal.cxx 25392 2008-04-23 19:40:29Z cblume $ */
+
+/////////////////////////////////////////////////////////
+// //
+// Container Class for Signals //
+// //
+// Author: //
+// Hermes Leon Vargas (hleon@ikf.uni-frankfurt.de) //
+// //
+/////////////////////////////////////////////////////////
+
+#include "AliTRDarraySignal.h"
+//#include "AliLog.h"
+
+ClassImp(AliTRDarraySignal)
+
+//_______________________________________________________________________
+AliTRDarraySignal::AliTRDarraySignal()
+ :TObject()
+ ,fNdet(0)
+ ,fNrow(0)
+ ,fNcol(0)
+ ,fNtime(0)
+ ,fNdim(0)
+ ,fSignal(0)
+{
+
+ //
+ // AliTRDarraySignal default constructor
+ //
+
+}
+
+//_______________________________________________________________________
+AliTRDarraySignal::AliTRDarraySignal(Int_t nrow, Int_t ncol,Int_t ntime)
+ :TObject()
+ ,fNdet(0)
+ ,fNrow(0)
+ ,fNcol(0)
+ ,fNtime(0)
+ ,fNdim(0)
+ ,fSignal(0)
+{
+ //
+ // AliTRDarraySignal constructor
+ //
+
+ Allocate(nrow,ncol,ntime);
+
+}
+
+//_______________________________________________________________________
+AliTRDarraySignal::AliTRDarraySignal(const AliTRDarraySignal &d)
+ :TObject()
+ ,fNdet(d.fNdet)
+ ,fNrow(d.fNrow)
+ ,fNcol(d.fNcol)
+ ,fNtime(d.fNtime)
+ ,fNdim(d.fNdim)
+ ,fSignal(0)
+{
+ //
+ // AliTRDarraySignal copy constructor
+ //
+
+ fSignal = new Float_t[fNdim];
+ for(Int_t i=0; i<fNdim; i++)
+ {
+ fSignal[i]=d.fSignal[i];
+ }
+
+}
+
+//_______________________________________________________________________
+AliTRDarraySignal::~AliTRDarraySignal()
+{
+ //
+ // AliTRDarraySignal destructor
+ //
+
+ if (fSignal)
+ {
+ delete [] fSignal;
+ fSignal=0;
+ }
+
+}
+
+//_______________________________________________________________________
+AliTRDarraySignal &AliTRDarraySignal::operator=(const AliTRDarraySignal &d)
+{
+ //
+ // Assignment operator
+ //
+
+ if (this==&d)
+ {
+ return *this;
+ }
+
+ if (fSignal)
+ {
+ delete [] fSignal;
+ }
+ fNdet=d.fNdet;
+ fNrow=d.fNrow;
+ fNcol=d.fNcol;
+ fNtime=d.fNtime;
+ fNdim=d.fNdim;
+ fSignal = new Float_t[fNdim];
+
+ for(Int_t i=0; i<fNdim; i++)
+ {
+ fSignal[i]=d.fSignal[i];
+ }
+
+ return *this;
+
+}
+
+//_______________________________________________________________________
+void AliTRDarraySignal::Allocate(Int_t nrow, Int_t ncol, Int_t ntime)
+{
+ //
+ // Allocates memory for an AliTRDarraySignal object with dimensions
+ // Row*Col*Time
+ //
+
+ fNrow=nrow;
+ fNcol=ncol;
+ fNtime=ntime;
+ fNdim = nrow*ncol*ntime;
+ if (fSignal)
+ {
+ delete [] fSignal;
+ }
+ fSignal = new Float_t[fNdim];
+ for(Int_t i=0; i<fNdim; i++)
+ {
+ fSignal[i]=0;
+ }
+
+}
+
+//_______________________________________________________________________
+Int_t AliTRDarraySignal::GetOverThreshold(Float_t threshold)
+{
+ //
+ // Get the number of entries over the threshold
+ //
+
+ Int_t counter=0;
+ for(Int_t i=0; i<fNdim; i++)
+ {
+ if(fSignal[i]>threshold)
+ {
+ counter++;
+ }
+ }
+ return counter;
+
+}
+
+//_______________________________________________________________________
+void AliTRDarraySignal::Compress(Float_t minval)
+{
+ //
+ // Compress the array, setting values equal or
+ // below minval to zero (minval>=0)
+ //
+
+ Int_t counter=0;
+ Int_t newDim=0;
+ Int_t j;
+ Int_t r=0;
+ Int_t *longArr;
+ longArr = new Int_t[fNdim];
+ Int_t k=0;
+
+ //Initialize the array
+ for(Int_t i=0; i<fNdim;i++)
+ {
+ longArr[i]=0;
+ }
+
+ for(Int_t i=0;i<fNdim; i++)
+ {
+ j=0;
+ if(fSignal[i]<=minval)
+ {
+ for(k=i;k<fNdim;k++)
+ {
+ if(fSignal[k]<=minval)
+ {
+ j=j+1;
+ longArr[r]=j;
+ }
+ else
+ {
+ break;
+ }
+ }
+ r=r+1;
+ }
+ i=i+j;
+ }
+
+ //Calculate the size of the compressed array
+ for(Int_t i=0; i<fNdim;i++)
+ {
+ if(longArr[i]!=0)
+ {
+ counter=counter+longArr[i]-1;
+ }
+ }
+ newDim=fNdim-counter; //New dimension
+
+ //Fill the buffer of the compressed array
+ Float_t* buffer;
+ buffer = new Float_t[newDim];
+ Int_t counterTwo=0;
+
+ //Write the new array
+ Int_t g=0;
+ for(Int_t i=0; i<newDim; i++)
+ {
+ if(counterTwo<fNdim)
+ {
+ if(fSignal[counterTwo]>minval)
+ {
+ buffer[i]=fSignal[counterTwo];
+ }
+ if(fSignal[counterTwo]<=minval)
+ {
+ buffer[i]=-(longArr[g]);
+ counterTwo=counterTwo+longArr[g]-1;
+ g++;
+ }
+ counterTwo++;
+ }
+ }
+
+ //Copy the buffer
+ if(fSignal)
+ {
+ delete [] fSignal;
+ fSignal=0;
+ }
+ fSignal = new Float_t[newDim];
+ fNdim = newDim;
+ for(Int_t i=0; i<newDim; i++)
+ {
+ fSignal[i] = buffer[i];
+ }
+ if(buffer)
+ {
+ delete [] buffer;
+ buffer=0;
+ }
+ if(longArr)
+ {
+ delete [] longArr;
+ longArr=0;
+ }
+
+}
+
+//_______________________________________________________________________
+void AliTRDarraySignal::Expand()
+{
+ //
+ // Expand the array
+ //
+
+ //Check if the array has not been already expanded
+ Int_t verif=0;
+ for(Int_t i=0; i<fNdim; i++)
+ {
+ if(fSignal[i]<0)
+ {
+ verif++;
+ }
+ }
+
+ if(verif==0)
+ {
+ return;
+ }
+
+ Int_t *longArr;
+ longArr = new Int_t[fNdim];
+ Int_t dimexp=0;
+ for(Int_t i=0; i<fNdim;i++)
+ {
+ longArr[i]=0;
+ }
+
+ Int_t r2=0;
+ for(Int_t i=0; i<fNdim;i++)
+ {
+ if(fSignal[i]<0)
+ {
+ longArr[r2]=(Int_t)(-fSignal[i]);
+ r2++;
+ }
+ }
+
+ //Calculate new dimensions
+ for(Int_t i=0; i<fNdim;i++)
+ {
+ if(longArr[i]!=0)
+ {
+ dimexp=dimexp+longArr[i]-1;
+ }
+ }
+ dimexp=dimexp+fNdim; //Dimension of the expanded array
+
+ //Write in the buffer the new array
+ Float_t* bufferE;
+ bufferE = new Float_t[dimexp];
+ Int_t contaexp =0;
+ Int_t h=0;
+ for(Int_t i=0; i<dimexp; i++)
+ {
+ if(fSignal[contaexp]>0)
+ {
+ bufferE[i]=fSignal[contaexp];
+ }
+ if(fSignal[contaexp]<0)
+ {
+ for(Int_t j=0; j<longArr[h];j++)
+ {
+ bufferE[i+j]=0;
+ }
+ i=i+longArr[h]-1;
+ h++;
+ }
+ contaexp++;
+ }
+
+ //Copy the buffer
+ if(fSignal)
+ {
+ delete [] fSignal;
+ fSignal=0;
+ }
+
+ fSignal = new Float_t[dimexp];
+ fNdim = dimexp;
+ for(Int_t i=0; i<dimexp; i++)
+ {
+ fSignal[i] = bufferE[i];
+ }
+
+ if(bufferE) delete [] bufferE;
+ if(longArr) delete [] longArr;
+
+}
--- /dev/null
+#ifndef ALITRDARRAYSIGNAL_H
+#define ALITRDARRAYSIGNAL_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id: AliTRDarraySignal.h 23387 2008-01-17 17:25:16Z cblume $ */
+
+/////////////////////////////////////////////
+// //
+// Container Class for Signals //
+// //
+/////////////////////////////////////////////
+
+#include <TObject.h>
+
+class AliTRDarraySignal: public TObject
+{
+
+ public:
+
+ AliTRDarraySignal();
+ AliTRDarraySignal(Int_t nrow, Int_t ncol,Int_t ntime);
+ AliTRDarraySignal(const AliTRDarraySignal &d);
+ ~AliTRDarraySignal();
+ AliTRDarraySignal &operator=(const AliTRDarraySignal &d);
+
+ void Allocate(Int_t nrow, Int_t ncol, Int_t ntime);
+ void SetNdet(Int_t ndet) {fNdet=ndet;};
+ Int_t GetNdet() const {return fNdet;};
+ Int_t GetNrow() const {return fNrow;};
+ Int_t GetNcol() const {return fNcol;};
+ Int_t GetNtime() const {return fNtime;};
+ Float_t GetData(Int_t row, Int_t col, Int_t time) const
+ {return fSignal[(row*fNcol+col)*fNtime+time];};
+ void SetData(Int_t row, Int_t col, Int_t time, Float_t value)
+ {fSignal[(row*fNcol+col)*fNtime+time]=value;};
+ Bool_t HasData() const {return fNtime ? 1 : 0;};
+ Int_t GetDim() const {return fNdim;};
+ Int_t GetOverThreshold(Float_t threshold);
+ void Compress(Float_t minval);
+ void Expand();
+
+ protected:
+
+ Int_t fNdet; //ID number of the chamber
+ Int_t fNrow; //Number of rows of the chamber
+ Int_t fNcol; //Number of columns of the chamber
+ Int_t fNtime; //Number of time bins
+ Int_t fNdim; //Dimension of the array
+ Float_t *fSignal; //[fNdim] //Pointer to signals
+
+ ClassDef(AliTRDarraySignal,1) //Signal container class
+
+};
+#endif
#include "AliTRDcluster.h"
#include "AliTRDReconstructor.h"
#include "AliTRDgeometry.h"
-#include "AliTRDdataArrayF.h"
-#include "AliTRDdataArrayI.h"
-#include "AliTRDdataArrayS.h"
-#include "AliTRDdataArrayDigits.h"
+#include "AliTRDarraySignal.h"
+#include "AliTRDarrayDictionary.h"
+#include "AliTRDarrayADC.h"
#include "AliTRDdigitsManager.h"
#include "AliTRDrawData.h"
#include "AliTRDcalibDB.h"
Bool_t fReturn = kTRUE;
for (Int_t i = 0; i < AliTRDgeometry::kNdet; i++){
- AliTRDdataArrayDigits *digitsIn = (AliTRDdataArrayDigits*) fDigitsManager->GetDigits(i);
+ AliTRDarrayADC *digitsIn = (AliTRDarrayADC*) fDigitsManager->GetDigits(i); //mod
// This is to take care of switched off super modules
if (!digitsIn->HasData()) continue;
digitsIn->Expand();
if (indexes->HasEntry()){
if (fAddLabels){
for (Int_t iDict = 0; iDict < AliTRDdigitsManager::kNDict; iDict++){
- AliTRDdataArrayI *tracksIn = 0;
- tracksIn = (AliTRDdataArrayI *) fDigitsManager->GetDictionary(i,iDict);
+ AliTRDarrayDictionary *tracksIn = 0; //mod
+ tracksIn = (AliTRDarrayDictionary *) fDigitsManager->GetDictionary(i,iDict); //mod
tracksIn->Expand();
}
}
// Get the digits
// digits should be expanded beforehand!
// digitsIn->Expand();
- AliTRDdataArrayDigits *digitsIn = (AliTRDdataArrayDigits *) fDigitsManager->GetDigits(det);
+ AliTRDarrayADC *digitsIn = (AliTRDarrayADC *) fDigitsManager->GetDigits(det); //mod
// This is to take care of switched off super modules
if (!digitsIn->HasData())
// Start clustering in the chamber
Int_t idet = AliTRDgeometry::GetDetector(ilayer,istack,isector);
- if (idet != det)
- {
- AliError("Strange Detector number Missmatch!");
- return kFALSE;
- }
+ if (idet != det) {
+ AliError("Strange Detector number Missmatch!");
+ return kFALSE;
+ }
// TRD space point transformation
fTransform->SetDetector(det);
Int_t nClusters = 0;
- AliTRDdataArrayF *digitsOut = new AliTRDdataArrayF(nRowMax, nColMax, nTimeTotal);
- AliTRDdataArrayS padStatus(nRowMax, nColMax, nTimeTotal);
+ AliTRDarraySignal *digitsOut = new AliTRDarraySignal(nRowMax, nColMax, nTimeTotal);
+ AliTRDarrayADC padStatus(nRowMax, nColMax, nTimeTotal);
ResetHelperIndexes(indexesIn);
// Apply the gain and the tail cancelation via digital filter
TailCancelation(digitsIn
- ,digitsOut
- ,indexesIn
- ,fIndexesOut
- ,nTimeTotal
- ,adcThreshold
- ,calGainFactorROC
- ,calGainFactorDetValue);
+ ,digitsOut
+ ,indexesIn
+ ,fIndexesOut
+ ,nTimeTotal
+ ,adcThreshold
+ ,calGainFactorROC
+ ,calGainFactorDetValue);
Int_t row = 0;
Int_t col = 0;
fIndexesOut->ResetCounters();
while (fIndexesOut->NextRCTbinIndex(row, col, time)) {
- Float_t signalM = TMath::Abs(digitsOut->GetDataUnchecked(row,col,time));
+ Float_t signalM = TMath::Abs(digitsOut->GetData(row,col,time));
status[1] = digitsIn->GetPadStatus(row,col,time);
if(status[1]) SETBIT(ipos, AliTRDcluster::kMaskedCenter);
if (col + 1 >= nColMax || col-1 < 0) continue;
- Float_t signalL = TMath::Abs(digitsOut->GetDataUnchecked(row,col+1,time));
+ Float_t signalL = TMath::Abs(digitsOut->GetData(row,col+1,time));
status[0] = digitsIn->GetPadStatus(row,col+1,time);
if(status[0]) SETBIT(ipos, AliTRDcluster::kMaskedLeft);
- Float_t signalR = TMath::Abs(digitsOut->GetDataUnchecked(row,col-1,time));
+ Float_t signalR = TMath::Abs(digitsOut->GetData(row,col-1,time));
status[2] = digitsIn->GetPadStatus(row,col-1,time);
if(status[2]) SETBIT(ipos, AliTRDcluster::kMaskedRight);
// reject candidates with more than 1 problematic pad
if(ipos == 3 || ipos > 4) continue;
- if(!status[1]){ // good central pad
- if(!ipos){ // all pads are OK
- if ((signalL <= signalM) && (signalR < signalM)) {
- if ((signalL >= sigThresh) || (signalR >= sigThresh)) {
- Float_t noiseSumThresh = minLeftRightCutSigma*calNoiseDetValue*calNoiseROC->GetValue(col,row);
- if((signalL+signalR+signalM) >= noiseSumThresh){
- // Maximum found, mark the position by a negative signal
- digitsOut->SetDataUnchecked(row,col,time,-signalM);
- fIndexesMaxima->AddIndexTBin(row,col,time);
- padStatus.SetDataUnchecked(row, col, time, ipos);
- }
- }
- }
- } else { // one of the neighbouring pads are bad
- if(status[0] && signalR < signalM && signalR >= sigThresh){
- digitsOut->SetDataUnchecked(row,col,time,-signalM);
- digitsOut->SetDataUnchecked(row, col, time+1, 0.);
- fIndexesMaxima->AddIndexTBin(row,col,time);
- padStatus.SetDataUnchecked(row, col, time, ipos);
- } else if(status[2] && signalL <= signalM && signalL >= sigThresh){
- digitsOut->SetDataUnchecked(row,col,time,-signalM);
- digitsOut->SetDataUnchecked(row, col, time-1, 0.);
+ if (!status[1]) { // good central pad
+ if (!ipos) { // all pads are OK
+ if ((signalL <= signalM) && (signalR < signalM)) {
+ if ((signalL >= sigThresh) || (signalR >= sigThresh)) {
+ Float_t noiseSumThresh = minLeftRightCutSigma
+ * calNoiseDetValue
+ * calNoiseROC->GetValue(col,row);
+ if ((signalL+signalR+signalM) >= noiseSumThresh) {
+ // Maximum found, mark the position by a negative signal
+ digitsOut->SetData(row,col,time,-signalM);
+ fIndexesMaxima->AddIndexTBin(row,col,time);
+ padStatus.SetData(row, col, time, ipos);
+ }
+ }
+ }
+ }
+ else { // one of the neighbouring pads are bad
+ if (status[0] && signalR < signalM && signalR >= sigThresh) {
+ digitsOut->SetData(row,col,time,-signalM);
+ digitsOut->SetData(row, col, time+1, 0.);
fIndexesMaxima->AddIndexTBin(row,col,time);
- padStatus.SetDataUnchecked(row, col, time, ipos);
- }
+ padStatus.SetData(row, col, time, ipos);
+ }
+ else if (status[2] && signalL <= signalM && signalL >= sigThresh) {
+ digitsOut->SetData(row,col,time,-signalM);
+ digitsOut->SetData(row, col, time-1, 0.);
+ fIndexesMaxima->AddIndexTBin(row,col,time);
+ padStatus.SetData(row, col, time, ipos);
+ }
}
- } else { // wrong maximum pad
+ }
+ else { // wrong maximum pad
if ((signalL >= sigThresh) || (signalR >= sigThresh)) {
- // Maximum found, mark the position by a negative signal
- digitsOut->SetDataUnchecked(row,col,time,-maxThresh);
- fIndexesMaxima->AddIndexTBin(row,col,time);
- padStatus.SetDataUnchecked(row, col, time, ipos);
+ // Maximum found, mark the position by a negative signal
+ digitsOut->SetData(row,col,time,-maxThresh);
+ fIndexesMaxima->AddIndexTBin(row,col,time);
+ padStatus.SetData(row, col, time, ipos);
}
}
+
}
// The index to the first cluster of a given ROC
while (fIndexesMaxima->NextRCTbinIndex(row, col, time)) {
// Maximum found ?
- if (digitsOut->GetDataUnchecked(row,col,time) < 0.0) {
+ if (digitsOut->GetData(row,col,time) < 0.0) {
for (iPad = 0; iPad < kNclus; iPad++) {
Int_t iPadCol = col - 1 + iPad;
- clusterSignal[iPad] = TMath::Abs(digitsOut->GetDataUnchecked(row,iPadCol,time));
+ clusterSignal[iPad] = TMath::Abs(digitsOut->GetData(row,iPadCol,time));
}
// Count the number of pads in the cluster
Int_t ii;
// Look to the right
ii = 0;
- while (TMath::Abs(digitsOut->GetDataUnchecked(row,col-ii ,time)) >= sigThresh) {
+ while (TMath::Abs(digitsOut->GetData(row,col-ii ,time)) >= sigThresh) {
nPadCount++;
ii++;
if (col-ii < 0) break;
}
// Look to the left
ii = 0;
- while (TMath::Abs(digitsOut->GetDataUnchecked(row,col+ii+1,time)) >= sigThresh) {
+ while (TMath::Abs(digitsOut->GetData(row,col+ii+1,time)) >= sigThresh) {
nPadCount++;
ii++;
if (col+ii+1 >= nColMax) break;
// Look for 5 pad cluster with minimum in the middle
Bool_t fivePadCluster = kFALSE;
if (col < (nColMax - 3)){
- if (digitsOut->GetDataUnchecked(row,col+2,time) < 0) {
+ if (digitsOut->GetData(row,col+2,time) < 0) {
fivePadCluster = kTRUE;
}
if ((fivePadCluster) && (col < (nColMax - 5))) {
- if (digitsOut->GetDataUnchecked(row,col+4,time) >= sigThresh) {
+ if (digitsOut->GetData(row,col+4,time) >= sigThresh) {
fivePadCluster = kFALSE;
}
}
if ((fivePadCluster) && (col > 1)) {
- if (digitsOut->GetDataUnchecked(row,col-2,time) >= sigThresh) {
+ if (digitsOut->GetData(row,col-2,time) >= sigThresh) {
fivePadCluster = kFALSE;
}
}
}
// Unfold the 5 pad cluster
- if (fivePadCluster){
+ if (fivePadCluster) {
for (iPad = 0; iPad < kNsig; iPad++) {
- padSignal[iPad] = TMath::Abs(digitsOut->GetDataUnchecked(row
- ,col-1+iPad
- ,time));
+ padSignal[iPad] = TMath::Abs(digitsOut->GetData(row
+ ,col-1+iPad
+ ,time));
}
// Unfold the two maxima and set the signal on
// the overlapping pad to the ratio
for (Int_t i = 0; i < kNsig; i++) {
padSignal[i] = 0.0;
}
- padSignal[2] = TMath::Abs(digitsOut->GetDataUnchecked(row,col ,time)); // Central pad
- padSignal[3] = TMath::Abs(digitsOut->GetDataUnchecked(row,col+1,time)); // Left pad
- padSignal[1] = TMath::Abs(digitsOut->GetDataUnchecked(row,col-1,time)); // Right pad
+ padSignal[2] = TMath::Abs(digitsOut->GetData(row,col ,time)); // Central pad
+ padSignal[3] = TMath::Abs(digitsOut->GetData(row,col+1,time)); // Left pad
+ padSignal[1] = TMath::Abs(digitsOut->GetData(row,col-1,time)); // Right pad
if ((col > 2) &&
- (TMath::Abs(digitsOut->GetDataUnchecked(row,col-2,time)) < padSignal[1])) {
- padSignal[4] = TMath::Abs(digitsOut->GetDataUnchecked(row,col-2,time));
+ (TMath::Abs(digitsOut->GetData(row,col-2,time)) < padSignal[1])) {
+ padSignal[4] = TMath::Abs(digitsOut->GetData(row,col-2,time));
}
if ((col < nColMax - 3) &&
- (TMath::Abs(digitsOut->GetDataUnchecked(row,col+2,time)) < padSignal[3])) {
- padSignal[0] = TMath::Abs(digitsOut->GetDataUnchecked(row,col+2,time));
+ (TMath::Abs(digitsOut->GetData(row,col+2,time)) < padSignal[3])) {
+ padSignal[0] = TMath::Abs(digitsOut->GetData(row,col+2,time));
}
clusterPosCol = GetCOG(padSignal);
}
(jPad >= nColMax-1)) {
continue;
}
- signals[jPad-col+3] = TMath::Nint(TMath::Abs(digitsOut->GetDataUnchecked(row,jPad,time)));
+ signals[jPad-col+3] = TMath::Nint(TMath::Abs(digitsOut->GetData(row,jPad,time)));
}
// Transform the local cluster coordinates into calibrated
Int_t n = RecPoints()->GetEntriesFast();
AliTRDcluster *cluster = new((*RecPoints())[n]) AliTRDcluster(idet
- ,clusterCharge
- ,clusterPos
- ,clusterSig
- ,0x0
- ,((Char_t) nPadCount)
- ,signals
- ,((UChar_t) col)
- ,((UChar_t) row)
- ,((UChar_t) time)
- ,clusterTimeBin
- ,clusterPosCol
- ,volid);
+ ,clusterCharge
+ ,clusterPos
+ ,clusterSig
+ ,0x0
+ ,((Char_t) nPadCount)
+ ,signals
+ ,((UChar_t) col)
+ ,((UChar_t) row)
+ ,((UChar_t) time)
+ ,clusterTimeBin
+ ,clusterPosCol
+ ,volid);
cluster->SetInChamber(!out);
- UChar_t maskPosition = padStatus.GetDataUnchecked(row, col, time);
+ UChar_t maskPosition = padStatus.GetData(row, col, time);
if (maskPosition) {
cluster->SetPadMaskedPosition(maskPosition);
if (maskPosition & AliTRDcluster::kMaskedLeft) {
cluster->SetPadMaskedStatus(status[0]);
- }
+ }
else if (maskPosition & AliTRDcluster::kMaskedCenter) {
cluster->SetPadMaskedStatus(status[1]);
- }
+ }
else {
cluster->SetPadMaskedStatus(status[2]);
- }
+ }
}
// Temporarily store the row, column and time bin of the center pad
// Loop through the dictionary arrays one-by-one
// to keep memory consumption low
- AliTRDdataArrayI *tracksIn = 0;
+ AliTRDarrayDictionary *tracksIn = 0; //mod
for (Int_t iDict = 0; iDict < kNdict; iDict++) {
// tracksIn should be expanded beforehand!
- tracksIn = (AliTRDdataArrayI *) fDigitsManager->GetDictionary(idet,iDict);
+ tracksIn = (AliTRDarrayDictionary *) fDigitsManager->GetDictionary(idet,iDict);
// Loop though the clusters found in this ROC
for (iClusterROC = 0; iClusterROC < nClusterROC; iClusterROC++) {
AliTRDcluster *cluster = (AliTRDcluster *)
- RecPoints()->UncheckedAt(firstClusterROC+iClusterROC);
+ RecPoints()->UncheckedAt(firstClusterROC+iClusterROC);
row = cluster->GetLabel(0);
col = cluster->GetLabel(1);
time = cluster->GetLabel(2);
for (iPad = 0; iPad < kNclus; iPad++) {
- Int_t iPadCol = col - 1 + iPad;
- Int_t index = tracksIn->GetDataUnchecked(row,iPadCol,time) - 1;
- idxTracks[3*iPad+iDict + iClusterROC*kNtrack] = index;
+ Int_t iPadCol = col - 1 + iPad;
+ Int_t index = tracksIn->GetData(row,iPadCol,time); //Modification of -1 in Track
+ idxTracks[3*iPad+iDict + iClusterROC*kNtrack] = index;
}
}
}
//_____________________________________________________________________________
-void AliTRDclusterizer::TailCancelation(AliTRDdataArrayDigits *digitsIn
- , AliTRDdataArrayF *digitsOut
- , AliTRDSignalIndex *indexesIn
- , AliTRDSignalIndex *indexesOut
- , Int_t nTimeTotal
- , Float_t adcThreshold
- , AliTRDCalROC *calGainFactorROC
- , Float_t calGainFactorDetValue)
+void AliTRDclusterizer::TailCancelation(AliTRDarrayADC *digitsIn
+ , AliTRDarraySignal *digitsOut
+ , AliTRDSignalIndex *indexesIn
+ , AliTRDSignalIndex *indexesOut
+ , Int_t nTimeTotal
+ , Float_t adcThreshold
+ , AliTRDCalROC *calGainFactorROC
+ , Float_t calGainFactorDetValue)
{
//
// Applies the tail cancelation and gain factors:
Bool_t corrupted = kFALSE;
for (iTime = 0; iTime < nTimeTotal; iTime++)
- {
- // Apply gain gain factor
- inADC[iTime] = digitsIn->GetDataUnchecked(iRow,iCol,iTime);
- if(digitsIn->GetPadStatus(iRow, iCol, iTime)) corrupted = kTRUE;
- inADC[iTime] /= gain;
- outADC[iTime] = inADC[iTime];
- }
- if(!corrupted)
- {
- // Apply the tail cancelation via the digital filter
- // (only for non-coorupted pads)
- if (fReconstructor->GetRecoParam() ->IsTailCancelation())
- {
- DeConvExp(inADC,outADC,nTimeTotal,fReconstructor->GetRecoParam() ->GetTCnexp());
- }
- }
+ {
+ // Apply gain gain factor
+ inADC[iTime] = digitsIn->GetData(iRow,iCol,iTime);
+ if (digitsIn->GetPadStatus(iRow, iCol, iTime)) corrupted = kTRUE;
+ inADC[iTime] /= gain;
+ outADC[iTime] = inADC[iTime];
+ }
+ if (!corrupted)
+ {
+ // Apply the tail cancelation via the digital filter
+ // (only for non-coorupted pads)
+ if (fReconstructor->GetRecoParam() ->IsTailCancelation())
+ {
+ DeConvExp(inADC,outADC,nTimeTotal,fReconstructor->GetRecoParam() ->GetTCnexp());
+ }
+ }
indexesIn->ResetTbinCounter();
+
while (indexesIn->NextTbinIndex(iTime))
- {
- // Store the amplitude of the digit if above threshold
- if (outADC[iTime] > adcThreshold)
- {
- digitsOut->SetDataUnchecked(iRow,iCol,iTime,outADC[iTime]);
- indexesOut->AddIndexTBin(iRow,iCol,iTime);
- }
- } // while itime
+ {
+ // Store the amplitude of the digit if above threshold
+ if (outADC[iTime] > adcThreshold)
+ {
+ digitsOut->SetData(iRow,iCol,iTime,outADC[iTime]);
+ indexesOut->AddIndexTBin(iRow,iCol,iTime);
+ }
+ } // while itime
} // while irow icol
//_____________________________________________________________________________
void AliTRDclusterizer::DeConvExp(Double_t *source, Double_t *target
- , Int_t n, Int_t nexp)
+ , Int_t n, Int_t nexp)
{
//
// Tail cancellation by deconvolution for PASA v4 TRF
class AliTRD;
class AliTRDcluster;
-class AliTRDdataArrayS;
-class AliTRDdataArrayDigits;
-class AliTRDdataArrayF;
+
+class AliTRDarrayADC;
+class AliTRDarraySignal;
class AliTRDdigitsManager;
class AliTRDSignalIndex;
class AliTRDtransform;
class AliTRDCalROC;
class AliTRDReconstructor;
+
class AliTRDclusterizer : public TNamed
{
-public:
+
+ public:
+
// steering flags
enum{
kOwner = BIT(14)
Bool_t IsClustersOwner() const {return TestBit(kOwner);}
void SetClustersOwner(Bool_t own=kTRUE) {SetBit(kOwner, own); if(!own) fRecPoints = 0x0;}
-protected:
- void DeConvExp(Double_t *source, Double_t *target
- , Int_t nTimeTotal, Int_t nexp);
- void TailCancelation(AliTRDdataArrayDigits *digitsIn
- , AliTRDdataArrayF *digitsOut
- , AliTRDSignalIndex *indexesIn
- , AliTRDSignalIndex *indexesOut
- , Int_t nTimeTotal
- , Float_t ADCthreshold
- , AliTRDCalROC *calGainFactorROC
- , Float_t calGainFactorDetValue);
+ protected:
+
+ void DeConvExp(Double_t *source, Double_t *target
+ , Int_t nTimeTotal, Int_t nexp);
+ void TailCancelation(AliTRDarrayADC *digitsIn
+ , AliTRDarraySignal *digitsOut
+ , AliTRDSignalIndex *indexesIn
+ , AliTRDSignalIndex *indexesOut
+ , Int_t nTimeTotal
+ , Float_t ADCthreshold
+ , AliTRDCalROC *calGainFactorROC
+ , Float_t calGainFactorDetValue);
virtual Double_t Unfold(Double_t eps, Int_t layer, Double_t *padSignal);
- Double_t GetCOG(Double_t signal[5]) const;
- void FillLUT();
- Double_t LUTposition(Int_t ilayer, Double_t ampL, Double_t ampC, Double_t ampR) const;
+ Double_t GetCOG(Double_t signal[5]) const;
+ void FillLUT();
+ Double_t LUTposition(Int_t ilayer, Double_t ampL, Double_t ampC, Double_t ampR) const;
virtual void ResetHelperIndexes(AliTRDSignalIndex *indexesIn);
-protected:
const AliTRDReconstructor *fReconstructor; //! reconstructor
AliRunLoader *fRunLoader; //! Run Loader
TTree *fClusterTree; //! Tree with the cluster
TClonesArray *fRecPoints; //! Array of clusters
- TTree *fTrackletTree; //! Tree for tracklets
+ TTree *fTrackletTree; //! Tree for tracklets
AliTRDdigitsManager *fDigitsManager; //! TRD digits manager
- UInt_t **fTrackletContainer; //! tracklet container
+ UInt_t **fTrackletContainer; //! tracklet container
Bool_t fAddLabels; // Should clusters have MC labels?
Int_t fRawVersion; // Expected raw version of the data - default is 2
// - Electronics noise //
// - Electronics gain //
// - Digitization //
+// - Zero suppression //
// //
////////////////////////////////////////////////////////////////////////////
#include <TList.h>
#include <TTask.h>
#include <TGeoManager.h>
-
#include "AliRun.h"
#include "AliRunLoader.h"
#include "AliLoader.h"
#include "AliRunLoader.h"
#include "AliLoader.h"
#include "AliLog.h"
-
#include "AliTRD.h"
#include "AliTRDhit.h"
#include "AliTRDdigitizer.h"
-#include "AliTRDdataArrayI.h"
-#include "AliTRDdataArrayS.h"
-#include "AliTRDdataArrayF.h"
-#include "AliTRDsegmentArray.h"
+
+#include "AliTRDarrayDictionary.h"
+#include "AliTRDarrayADC.h"
+#include "AliTRDarraySignal.h"
#include "AliTRDdigitsManager.h"
#include "AliTRDgeometry.h"
#include "AliTRDpadPlane.h"
#include "AliTRDSimParam.h"
#include "AliTRDCommonParam.h"
#include "AliTRDfeeParam.h"
-
+#include "AliTRDmcmSim.h"
#include "Cal/AliTRDCalROC.h"
#include "Cal/AliTRDCalDet.h"
fTRD = 0;
fGeo = 0;
+
fEvent = 0;
fMasks = 0;
fCompress = kTRUE;
// Do not copy timestructs, just invalidate lastvdrift.
// Next time they are requested, they get recalculated
if (((AliTRDdigitizer &) d).fTimeStruct1) {
- delete [] ((AliTRDdigitizer &) d).fTimeStruct1;
+ delete [] ((AliTRDdigitizer &) d).fTimeStruct1;
((AliTRDdigitizer &) d).fTimeStruct1 = 0;
}
if (((AliTRDdigitizer &) d).fTimeStruct2) {
fDigitsManager = 0;
}
- if (fDigitsManager) {
+ if (fDigitsManager) { //typo? fSDigitsManager?
delete fSDigitsManager;
fSDigitsManager = 0;
}
AliRunLoader *rl = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(iInput));
AliLoader *gimme = rl->GetLoader("TRDLoader");
- if (!gimme->TreeS()) {
- gimme->LoadSDigits();
- }
- sdigitsManager->ReadDigits(gimme->TreeS());
+ if (!gimme->TreeS())
+ {
+ gimme->LoadSDigits();
+ }
+ sdigitsManager->ReadDigits(gimme->TreeS());
+
// Add the s-digits to the input list
AddSDigitsManager(sdigitsManager);
return kTRUE;
}
-
//_____________________________________________________________________________
Bool_t AliTRDdigitizer::MakeBranch(TTree *tree) const
{
Float_t **hits = new Float_t*[kNdet];
Int_t *nhit = new Int_t[kNdet];
- AliTRDdataArrayF *signals = 0x0;
+ AliTRDarraySignal *signals = 0x0;
// Sort all hits according to detector number
if (!SortHits(hits,nhit)) {
// Detectors that are switched off, not installed, etc.
if (( calibration->IsChamberInstalled(det)) &&
- (!calibration->IsChamberMasked(det)) &&
+ (!calibration->IsChamberMasked(det)) &&
( fGeo->ChamberInGeometry(det)) &&
(nhit[det] > 0)) {
- signals = new AliTRDdataArrayF();
-
+ signals = new AliTRDarraySignal();
+
// Convert the hits of the current detector to detector signals
if (!ConvertHits(det,hits[det],nhit[det],signals)) {
- AliError(Form("Conversion of hits failed for detector=%d",det));
+ AliError(Form("Conversion of hits failed for detector=%d",det));
return kFALSE;
}
// Convert the detector signals to digits or s-digits
if (!ConvertSignals(det,signals)) {
- AliError(Form("Conversion of signals failed for detector=%d",det));
- return kFALSE;
+ AliError(Form("Conversion of signals failed for detector=%d",det));
+ return kFALSE;
}
// Delete the signals array
//_____________________________________________________________________________
Bool_t AliTRDdigitizer::ConvertHits(Int_t det, Float_t *hits, Int_t nhit
- , AliTRDdataArrayF *signals)
+ , AliTRDarraySignal *signals)
{
//
// Converts the detectorwise sorted hits to detector signals
Double_t padSignal[kNpad];
Double_t signalOld[kNpad];
- AliTRDdataArrayI *dictionary[kNdict];
+ AliTRDarrayDictionary *dictionary[kNdict];
AliTRDSimParam *simParam = AliTRDSimParam::Instance();
AliTRDCommonParam *commonParam = AliTRDCommonParam::Instance();
Float_t elAttachProp = simParam->GetElAttachProp() / 100.0;
AliTRDpadPlane *padPlane = fGeo->GetPadPlane(det);
- Int_t layer = fGeo->GetLayer(det);
+ Int_t layer = fGeo->GetLayer(det); //update
Float_t row0 = padPlane->GetRow0ROC();
Int_t nRowMax = padPlane->GetNrows();
Int_t nColMax = padPlane->GetNcols();
// Create a new array for the dictionary
for (dict = 0; dict < kNdict; dict++) {
- dictionary[dict] = (AliTRDdataArrayI *) fDigitsManager->GetDictionary(det,dict);
+ dictionary[dict] = (AliTRDarrayDictionary *) fDigitsManager->GetDictionary(det,dict);
dictionary[dict]->Allocate(nRowMax,nColMax,nTimeTotal);
}
colE = padPlane->GetPadColNumber(locC+offsetTilt);
if (colE < 0) continue;
colOffset = padPlane->GetPadColOffset(colE,locC+offsetTilt);
-
+
// Also re-retrieve drift velocity because col and row may have changed
driftvelocity = calVdriftDetValue * calVdriftROC->GetValue(colE,rowE);
Float_t t0 = calT0DetValue + calT0ROC->GetValue(colE,rowE);
if (colPos >= nColMax) break;
// Add the signals
- signalOld[iPad] = signals->GetDataUnchecked(rowE,colPos,iTimeBin);
+ signalOld[iPad] = signals->GetData(rowE,colPos,iTimeBin);
if (colPos != colE) {
// Cross talk added to non-central pads
* timeResponse;
}
- signals->SetDataUnchecked(rowE,colPos,iTimeBin,signalOld[iPad]);
+ signals->SetData(rowE,colPos,iTimeBin,signalOld[iPad]);
// Store the track index in the dictionary
// Note: We store index+1 in order to allow the array to be compressed
+ // Note2: Taking out the +1 in track
if (signalOld[iPad] > 0.0) {
for (dict = 0; dict < kNdict; dict++) {
- Int_t oldTrack = dictionary[dict]->GetDataUnchecked(rowE
- ,colPos
- ,iTimeBin);
- if (oldTrack == track+1) break;
- if (oldTrack == 0) {
- dictionary[dict]->SetDataUnchecked(rowE,colPos,iTimeBin,track+1);
- break;
- }
+ Int_t oldTrack = dictionary[dict]->GetData(rowE,colPos,iTimeBin);
+ if (oldTrack == track) break;
+ if (oldTrack == -1 ) {
+ dictionary[dict]->SetData(rowE,colPos,iTimeBin,track);
+ break;
+ }
}
}
}
//_____________________________________________________________________________
-Bool_t AliTRDdigitizer::ConvertSignals(Int_t det, AliTRDdataArrayF *signals)
+Bool_t AliTRDdigitizer::ConvertSignals(Int_t det, AliTRDarraySignal *signals)
{
//
// Convert signals to digits
}
// Compress the arrays
- CompressOutputArrays(det);
+ CompressOutputArrays(det);
return kTRUE;
}
//_____________________________________________________________________________
-Bool_t AliTRDdigitizer::Signal2ADC(Int_t det, AliTRDdataArrayF *signals)
+Bool_t AliTRDdigitizer::Signal2ADC(Int_t det, AliTRDarraySignal *signals)
{
//
// Converts the sampled electron signals to ADC values for a given chamber
AliTRDCalROC *calGainFactorROC = 0;
Float_t calGainFactorDetValue = 0.0;
- AliTRDdataArrayS *digits = 0x0;
+ AliTRDarrayADC *digits = 0x0;
if (!signals) {
AliError(Form("Signals array for detector %d does not exist\n",det));
}
if (signals->HasData()) {
// Expand the container if neccessary
- signals->Expand();
+ signals->Expand();
}
else {
// Create missing containers
AliError("Digits manager has s-digits");
return kFALSE;
}
- digits = (AliTRDdataArrayS *) fDigitsManager->GetDigits(det);
+
+ digits = (AliTRDarrayADC *) fDigitsManager->GetDigits(det);
// Allocate memory space for the digits buffer
if (!digits->HasData()) {
digits->Allocate(nRowMax,nColMax,nTimeTotal);
for (time = 0; time < nTimeTotal; time++) {
// Get the signal amplitude
- Float_t signalAmp = signals->GetDataUnchecked(row,col,time);
+ Float_t signalAmp = signals->GetData(row,col,time);
// Pad and time coupling
signalAmp *= coupling;
// Gain factors
adc = TMath::Nint(signalAmp * adcConvert);
}
- // Store the amplitude of the digit if above threshold
- //if (adc != 0) {
- // Use temporarily a threshold to reduce the digits file size
- if (adc > (simParam->GetADCbaseline() + 2)) {
- digits->SetDataUnchecked(row,col,time,adc);
- }
+ // Saving all digits
+ digits->SetData(row,col,time,adc);
} // for: time
+
} // for: col
} // for: row
+ // Do the Zero Suppression
+ ZS(digits);
+
return kTRUE;
}
//_____________________________________________________________________________
-Bool_t AliTRDdigitizer::Signal2SDigits(Int_t det, AliTRDdataArrayF *signals)
+Bool_t AliTRDdigitizer::Signal2SDigits(Int_t det, AliTRDarraySignal *signals)
{
//
// Converts the sampled electron signals to s-digits
Int_t nTimeTotal = calibration->GetNumberOfTimeBins();
// Get the container for the digits of this detector
+
if (!fDigitsManager->HasSDigits()) {
AliError("Digits manager has no s-digits");
return kFALSE;
}
- AliTRDdataArrayF *digits = (AliTRDdataArrayF *) fDigitsManager->GetDigits(det);
+
+ AliTRDarraySignal *digits = (AliTRDarraySignal *) fDigitsManager->GetSDigits(det);
// Allocate memory space for the digits buffer
if (!digits->HasData()) {
digits->Allocate(nRowMax,nColMax,nTimeTotal);
for (row = 0; row < nRowMax; row++ ) {
for (col = 0; col < nColMax; col++ ) {
for (time = 0; time < nTimeTotal; time++) {
- digits->SetDataUnchecked(row
- ,col
- ,time
- ,signals->GetDataUnchecked(row,col,time));
+ digits->SetData(row,col,time,signals->GetData(row,col,time));
} // for: time
} // for: col
} // for: row
-
+
return kTRUE;
}
Int_t iDict = 0;
Int_t jDict = 0;
- AliTRDdataArrayF *digitsA;
- AliTRDdataArrayF *digitsB;
- AliTRDdataArrayI *dictionaryA[kNDict];
- AliTRDdataArrayI *dictionaryB[kNDict];
- AliTRDdigitsManager *mergeSDigitsManager = 0x0;
+ AliTRDarraySignal *digitsA;
+ AliTRDarraySignal *digitsB;
+ AliTRDarrayDictionary *dictionaryA[kNDict];
+ AliTRDarrayDictionary *dictionaryB[kNDict];
+ AliTRDdigitsManager *mergeSDigitsManager = 0x0;
// Get the first s-digits
fSDigitsManager = (AliTRDdigitsManager *) fSDigitsManagerList->First();
if (!fSDigitsManager) {
}
// Loop through the other sets of s-digits
- mergeSDigitsManager = (AliTRDdigitsManager *)
- fSDigitsManagerList->After(fSDigitsManager);
+ mergeSDigitsManager = (AliTRDdigitsManager *) fSDigitsManagerList->After(fSDigitsManager);
if (mergeSDigitsManager) {
AliDebug(1,Form("Merge %d input files.",fSDigitsManagerList->GetSize()));
else {
AliDebug(1,"Only one input file.");
}
-
- Int_t nTimeTotal = calibration->GetNumberOfTimeBins();
+ Int_t nTimeTotal = calibration->GetNumberOfTimeBins();
Int_t iMerge = 0;
+
while (mergeSDigitsManager) {
iMerge++;
-
+
// Loop through the detectors
for (Int_t iDet = 0; iDet < AliTRDgeometry::Ndet(); iDet++) {
Int_t nRowMax = fGeo->GetPadPlane(iDet)->GetNrows();
Int_t nColMax = fGeo->GetPadPlane(iDet)->GetNcols();
-
+
// Loop through the pixels of one detector and add the signals
- digitsA = (AliTRDdataArrayF *) fSDigitsManager->GetDigits(iDet);
- digitsB = (AliTRDdataArrayF *) mergeSDigitsManager->GetDigits(iDet);
- digitsA->Expand();
- if (!digitsA->GetDataSize()) continue;
- digitsB->Expand();
- if (!digitsB->GetDataSize()) continue;
+ digitsA = (AliTRDarraySignal *) fSDigitsManager->GetSDigits(iDet);
+ digitsB = (AliTRDarraySignal *) mergeSDigitsManager->GetSDigits(iDet);
+ digitsA->Expand();
+ if (!digitsA->HasData()) continue;
+ digitsB->Expand();
+ if (!digitsB->HasData()) continue;
+
for (iDict = 0; iDict < kNDict; iDict++) {
- dictionaryA[iDict] = (AliTRDdataArrayI *) fSDigitsManager->GetDictionary(iDet,iDict);
- dictionaryB[iDict] = (AliTRDdataArrayI *) mergeSDigitsManager->GetDictionary(iDet,iDict);
- dictionaryA[iDict]->Expand();
+ dictionaryA[iDict] = (AliTRDarrayDictionary *) fSDigitsManager->GetDictionary(iDet,iDict);
+ dictionaryB[iDict] = (AliTRDarrayDictionary *) mergeSDigitsManager->GetDictionary(iDet,iDict);
+ dictionaryA[iDict]->Expand();
dictionaryB[iDict]->Expand();
}
// Merge only detectors that contain a signal
Bool_t doMerge = kTRUE;
if (fMergeSignalOnly) {
- if (digitsA->GetOverThreshold(0) == 0) {
- doMerge = kFALSE;
+ if (digitsA->GetOverThreshold(0) == 0) {
+ doMerge = kFALSE;
}
}
-
+
if (doMerge) {
-
- AliDebug(1,Form("Merge detector %d of input no.%d",iDet,iMerge+1));
-
- for (Int_t iRow = 0; iRow < nRowMax; iRow++ ) {
- for (Int_t iCol = 0; iCol < nColMax; iCol++ ) {
- for (Int_t iTime = 0; iTime < nTimeTotal; iTime++) {
-
+
+ AliDebug(1,Form("Merge detector %d of input no.%d",iDet,iMerge+1));
+
+ for (Int_t iRow = 0; iRow < nRowMax; iRow++ ) {
+ for (Int_t iCol = 0; iCol < nColMax; iCol++ ) {
+ for (Int_t iTime = 0; iTime < nTimeTotal; iTime++) {
+
// Add the amplitudes of the summable digits
- Float_t ampA = digitsA->GetDataUnchecked(iRow,iCol,iTime);
- Float_t ampB = digitsB->GetDataUnchecked(iRow,iCol,iTime);
- ampA += ampB;
- digitsA->SetDataUnchecked(iRow,iCol,iTime,ampA);
-
- // Add the mask to the track id if defined.
- for (iDict = 0; iDict < kNDict; iDict++) {
- Int_t trackB = dictionaryB[iDict]->GetDataUnchecked(iRow,iCol,iTime);
- if ((fMasks) && (trackB > 0)) {
- for (jDict = 0; jDict < kNDict; jDict++) {
- Int_t trackA = dictionaryA[iDict]->GetDataUnchecked(iRow,iCol,iTime);
- if (trackA == 0) {
- trackA = trackB + fMasks[iMerge];
- dictionaryA[iDict]->SetDataUnchecked(iRow,iCol,iTime,trackA);
+ Float_t ampA = digitsA->GetData(iRow,iCol,iTime);
+ Float_t ampB = digitsB->GetData(iRow,iCol,iTime);
+ ampA += ampB;
+ digitsA->SetData(iRow,iCol,iTime,ampA);
+
+ // Add the mask to the track id if defined.
+ for (iDict = 0; iDict < kNDict; iDict++) {
+ Int_t trackB = dictionaryB[iDict]->GetData(iRow,iCol,iTime);
+ if ((fMasks) && (trackB > 0)) {
+ for (jDict = 0; jDict < kNDict; jDict++) {
+ Int_t trackA = dictionaryA[iDict]->GetData(iRow,iCol,iTime);
+ if (trackA == 0) {
+ trackA = trackB + fMasks[iMerge];
+ dictionaryA[iDict]->SetData(iRow,iCol,iTime,trackA);
} // if: track A == 0
- } // for: jDict
- } // if: fMasks and trackB > 0
+ } // for: jDict
+ } // if: fMasks and trackB > 0
} // for: iDict
} // for: iTime
mergeSDigitsManager->RemoveDigits(iDet);
mergeSDigitsManager->RemoveDictionaries(iDet);
-
+
if (fCompress) {
- digitsA->Compress(1,0);
- for (iDict = 0; iDict < kNDict; iDict++) {
- dictionaryA[iDict]->Compress(1,0);
+ digitsA->Compress(0);
+ for (iDict = 0; iDict < kNDict; iDict++) {
+ dictionaryA[iDict]->Compress();
}
}
-
+
} // for: detectors
-
+
// The next set of s-digits
- mergeSDigitsManager = (AliTRDdigitsManager *)
- fSDigitsManagerList->After(mergeSDigitsManager);
-
+ mergeSDigitsManager = (AliTRDdigitsManager *) fSDigitsManagerList->After(mergeSDigitsManager);
+
} // while: mergeDigitsManagers
-
+
return kTRUE;
}
// Converts s-digits to normal digits
//
- AliTRDdataArrayF *digitsIn = 0x0;
+ AliTRDarraySignal *digitsIn = 0x0;
if (!fSDigitsManager->HasSDigits()) {
AliError("No s-digits in digits manager");
for (Int_t det = 0; det < AliTRDgeometry::Ndet(); det++) {
// Get the merged s-digits (signals)
- digitsIn = (AliTRDdataArrayF *) fSDigitsManager->GetDigits(det);
+ digitsIn = (AliTRDarraySignal *) fSDigitsManager->GetSDigits(det);
if (!digitsIn->HasData()) {
AliDebug(2,Form("No digits for det=%d",det));
continue;
AliDebug(1,Form("Start copying dictionaries for detector=%d",det));
const Int_t kNDict = AliTRDdigitsManager::kNDict;
- AliTRDdataArrayI *dictionaryIn[kNDict];
- AliTRDdataArrayI *dictionaryOut[kNDict];
+ AliTRDarrayDictionary *dictionaryIn[kNDict];
+ AliTRDarrayDictionary *dictionaryOut[kNDict];
Int_t nRowMax = fGeo->GetPadPlane(det)->GetNrows();
Int_t nColMax = fGeo->GetPadPlane(det)->GetNcols();
for (dict = 0; dict < kNDict; dict++) {
- dictionaryIn[dict] = (AliTRDdataArrayI *) fSDigitsManager->GetDictionary(det,dict);
+ dictionaryIn[dict] = (AliTRDarrayDictionary *) fSDigitsManager->GetDictionary(det,dict);
dictionaryIn[dict]->Expand();
- dictionaryOut[dict] = (AliTRDdataArrayI *) fDigitsManager->GetDictionary(det,dict);
+ dictionaryOut[dict] = (AliTRDarrayDictionary *) fDigitsManager->GetDictionary(det,dict);
dictionaryOut[dict]->Allocate(nRowMax,nColMax,nTimeTotal);
for (row = 0; row < nRowMax; row++) {
for (col = 0; col < nColMax; col++) {
for (time = 0; time < nTimeTotal; time++) {
-
- Int_t track = dictionaryIn[dict]->GetDataUnchecked(row,col,time);
- dictionaryOut[dict]->SetDataUnchecked(row,col,time,track);
-
+ Int_t track = dictionaryIn[dict]->GetData(row,col,time);
+ dictionaryOut[dict]->SetData(row,col,time,track);
} // for: time
} // for: col
} // for: row
-
+
} // for: dictionaries
-
+
return kTRUE;
}
//
const Int_t kNDict = AliTRDdigitsManager::kNDict;
-
- AliTRDdataArrayS *digits = 0x0;
- AliTRDdataArrayI *dictionary = 0x0;
+ AliTRDarrayDictionary *dictionary = 0x0;
if (fCompress) {
- digits = (AliTRDdataArrayS *) fDigitsManager->GetDigits(det);
- digits->Compress(1,0);
+ if (!fSDigits) {
+ AliTRDarrayADC *digits = 0x0;
+ digits = (AliTRDarrayADC *) fDigitsManager->GetDigits(det);
+ digits->Compress();
+ }
+
+ if (fSDigits) {
+ AliTRDarraySignal *digits = 0x0;
+ digits = (AliTRDarraySignal *) fDigitsManager->GetSDigits(det);
+ digits->Compress(0);
+ }
+
for (Int_t dict = 0; dict < kNDict; dict++) {
- dictionary = (AliTRDdataArrayI *) fDigitsManager->GetDictionary(det,dict);
- dictionary->Compress(1,0);
-
+ dictionary = (AliTRDarrayDictionary *) fDigitsManager->GetDictionary(det,dict);
+ dictionary->Compress();
}
}
tree = loader->TreeD();
}
}
-
fDigitsManager->SetEvent(iEvent);
fDigitsManager->MakeBranch(tree);
fDiffLastVdrift = vdrift;
if (simParam->IsXenon()) {
-
+
//
// Vd and B-field dependent diffusion and Lorentz angle
//
-
+
// The magnetic field strength
Double_t x[3] = { 0.0, 0.0, 0.0 };
Double_t b[3];
gAlice->Field(x,b); // b[] is in kilo Gauss
Float_t field = b[2] * 0.1; // Tesla
-
+
+
+
// DiffusionL
const Int_t kNbL = 5;
Float_t p0L[kNbL] = { 0.007440, 0.007493, 0.007513, 0.007672, 0.007831 };
Float_t p1L[kNbL] = { 0.019252, 0.018912, 0.018636, 0.018012, 0.017343 };
Float_t p2L[kNbL] = { -0.005042, -0.004926, -0.004867, -0.004650, -0.004424 };
Float_t p3L[kNbL] = { 0.000195, 0.000189, 0.000195, 0.000182, 0.000169 };
-
+
Int_t ibL = ((Int_t) (10 * (field - 0.15)));
ibL = TMath::Max( 0,ibL);
ibL = TMath::Min(kNbL,ibL);
-
+
fDiffusionL = p0L[ibL]
- + p1L[ibL] * vdrift
- + p2L[ibL] * vdrift*vdrift
- + p3L[ibL] * vdrift*vdrift*vdrift;
-
+ + p1L[ibL] * vdrift
+ + p2L[ibL] * vdrift*vdrift
+ + p3L[ibL] * vdrift*vdrift*vdrift;
+
// DiffusionT
const Int_t kNbT = 5;
Float_t p0T[kNbT] = { 0.009550, 0.009599, 0.009674, 0.009757, 0.009850 };
Float_t p1T[kNbT] = { 0.006667, 0.006539, 0.006359, 0.006153, 0.005925 };
Float_t p2T[kNbT] = { -0.000853, -0.000798, -0.000721, -0.000635, -0.000541 };
Float_t p3T[kNbT] = { 0.000131, 0.000122, 0.000111, 0.000098, 0.000085 };
-
+
Int_t ibT= ((Int_t) (10 * (field - 0.15)));
ibT = TMath::Max( 0,ibT);
ibT = TMath::Min(kNbT,ibT);
-
+
fDiffusionT = p0T[ibT]
+ p1T[ibT] * vdrift
+ p2T[ibT] * vdrift*vdrift
+ p3T[ibT] * vdrift*vdrift*vdrift;
-
+
// OmegaTau
fOmegaTau = calibration->GetOmegaTau(vdrift,field);
if (commonParam->ExBOn()) {
else {
fLorentzFactor = 1.0;
}
-
+
}
+
else if (simParam->IsArgon()) {
// Diffusion constants and Lorentz angle only for B = 0.5T
return 1;
}
+
+//_____________________________________________________________________________
+void AliTRDdigitizer::ZS(AliTRDarrayADC *digits)
+{
+ //
+ // Apply the ZS
+ //
+
+ // Create the temporary digits container
+ AliTRDarrayADC *tempDigits;
+ tempDigits = new AliTRDarrayADC();
+ Int_t dim4 = digits->GetNrow();
+ Int_t dim5 = digits->GetNcol()+2;
+ Int_t dim6 = digits->GetNtime();
+ Int_t lim = dim5-1;
+
+ tempDigits->Allocate(dim4,dim5,dim6);
+
+ for(Int_t row=0;row<dim4;row++)
+ {
+ for(Int_t col=0;col<dim5;col++)
+ {
+ for(Int_t time=0;time<dim6;time++)
+ {
+ if(col==0||col==lim)
+ {
+ tempDigits->SetData(row,col,time,0);
+ }
+ else
+ {
+ tempDigits->SetData(row,col,time,digits->GetData(row,col-1,time));
+ }
+ }
+ }
+ }
+
+ //Create and initialize the mcm object
+ AliTRDmcmSim* mcmfast;
+ mcmfast = new AliTRDmcmSim();
+ mcmfast->StartfastZS(dim5,dim6);
+
+ //Call the methods in the mcm class using the temporary array as input
+ for(Int_t row=0;row<dim4;row++)
+ {
+ for(Int_t col=0;col<dim5;col++)
+ {
+ for(Int_t time=0;time<dim6;time++)
+ {
+ mcmfast->SetData(col,time,tempDigits->GetData(row,col,time));
+ }
+ }
+ mcmfast->Filter();
+ mcmfast->ZSMapping();
+ mcmfast->FlagDigitsArray(tempDigits,row);
+ mcmfast->StartfastZS(dim5,dim6);
+ }
+
+ //Modify the digits array to indicate suppressed values
+ for(Int_t irow=0; irow<dim4;irow++)
+ {
+ for(Int_t icol=1; icol<lim;icol++)
+ {
+ for(Int_t itime=0; itime<dim6;itime++)
+ {
+ if(tempDigits->GetData(irow,icol,itime)==-1) // If supressed in temporary array
+ {
+ digits->SetData(irow,icol-1,itime,-1); // Supressed values indicated by -1 in the digits array
+ }
+ }
+ }
+ }
+
+ // Delete objects
+ delete mcmfast;
+ delete tempDigits;
+
+}
class AliTRD;
class AliTRDdigitsManager;
class AliTRDgeometry;
-class AliTRDdataArrayF;
-class AliTRDsegmentArray;
+class AliTRDarraySignal;
+class AliTRDarrayADC;
class AliTRDdigitizer : public AliDigitizer {
virtual Bool_t MakeDigits();
Bool_t SortHits(Float_t **hits, Int_t *nhit);
- Bool_t ConvertHits(Int_t det, Float_t *hits, Int_t nhit, AliTRDdataArrayF *signals);
- Bool_t ConvertSignals(Int_t det, AliTRDdataArrayF *signals);
+ Bool_t ConvertHits(Int_t det, Float_t *hits, Int_t nhit, AliTRDarraySignal *signals);
+ Bool_t ConvertSignals(Int_t det, AliTRDarraySignal *signals);
Bool_t SDigits2Digits();
Bool_t MergeSDigits();
Bool_t ConvertSDigits();
- Bool_t Signal2ADC(Int_t det, AliTRDdataArrayF *signals);
- Bool_t Signal2SDigits(Int_t det, AliTRDdataArrayF *signals);
+ Bool_t Signal2ADC(Int_t det, AliTRDarraySignal *signals);
+ Bool_t Signal2SDigits(Int_t det, AliTRDarraySignal *signals);
Bool_t CopyDictionary(Int_t det);
- void CompressOutputArrays(Int_t det);
+ void CompressOutputArrays(Int_t det);
void SetCompress(Int_t c = 1) { fCompress = c; }
void SetSDigits(Int_t v = 1) { fSDigits = v; }
Int_t Diffusion(Float_t vdrift, Double_t absdriftlength
, Double_t &lRow, Double_t &lCol, Double_t &lTime);
Int_t ExB(Float_t vdrift, Double_t driftlength, Double_t &lRow);
-
+ void ZS(AliTRDarrayADC *digits);
+
protected:
virtual Bool_t Init();
Float_t fVDlo; // Lower drift velocity, for interpolation
Float_t fVDhi; // Higher drift velocity, for interpolation
- ClassDef(AliTRDdigitizer,17) // Produces TRD-Digits
+ ClassDef(AliTRDdigitizer,18) // Produces TRD-Digits
};
#endif
///////////////////////////////////////////////////////////////////////////////
// //
// Manages the digits and the track dictionary in the form of //
-// AliTRDdataArray objects. //
+// TObjArray objects //
// //
///////////////////////////////////////////////////////////////////////////////
-#include <Riostream.h>
-
+#include <Riostream.h>
#include <TROOT.h>
#include <TTree.h>
#include <TFile.h>
-
#include "AliRun.h"
#include "AliLog.h"
-
#include "AliTRDdigitsManager.h"
-#include "AliTRDsegmentArray.h"
-#include "AliTRDdataArray.h"
-#include "AliTRDdataArrayI.h"
-#include "AliTRDdataArrayS.h"
-#include "AliTRDdataArrayDigits.h"
+#include "AliTRDarrayDictionary.h"
+#include "AliTRDarrayADC.h"
+#include "AliTRDarraySignal.h"
#include "AliTRDdigit.h"
#include "AliTRDgeometry.h"
-
#include "AliTRDSignalIndex.h"
ClassImp(AliTRDdigitsManager)
:TObject()
,fEvent(0)
,fTree(0)
- ,fDigits(0)
+ ,fDigits(0)
,fHasSDigits(0)
,fSignalIndexes(NULL)
,fUseDictionaries(kTRUE)
+ ,fTreeD(0)
+ ,fBranch(0)
{
//
// Default constructor
//
- for (Int_t iDict = 0; iDict < kNDict; iDict++) {
- fDictionary[iDict] = NULL;
- }
+ for (Int_t iDict = 0; iDict < kNDict; iDict++)
+ {
+ fDict[iDict] = NULL;
+ }
fSignalIndexes = new TObjArray(AliTRDgeometry::Ndet());
:TObject(m)
,fEvent(m.fEvent)
,fTree(0)
- ,fDigits(0)
+ ,fDigits(0)
,fHasSDigits(m.fHasSDigits)
,fSignalIndexes(NULL)
,fUseDictionaries(kTRUE)
+ ,fTreeD(m.fTree)
+ ,fBranch(m.fBranch)
{
//
// AliTRDdigitsManager copy constructor
// AliTRDdigitsManager destructor
//
- if (fDigits) {
- fDigits->Delete();
- delete fDigits;
- fDigits = NULL;
- }
+ if (fDigits)
+ {
+ fDigits->Delete();
+ delete fDigits;
+ fDigits = NULL;
+ }
- for (Int_t iDict = 0; iDict < kNDict; iDict++) {
- fDictionary[iDict]->Delete();
- delete fDictionary[iDict];
- fDictionary[iDict] = NULL;
- }
+ for (Int_t iDict = 0; iDict < kNDict; iDict++)
+ {
+ fDict[iDict]->Delete();
+ delete fDict[iDict];
+ fDict[iDict] = NULL;
+ }
- if (fSignalIndexes) {
- fSignalIndexes->Delete();
- delete fSignalIndexes;
- fSignalIndexes = NULL;
- }
+ if (fSignalIndexes)
+ {
+ fSignalIndexes->Delete();
+ delete fSignalIndexes;
+ fSignalIndexes = NULL;
+ }
}
// Assignment operator
//
- if (this != &m) {
- ((AliTRDdigitsManager &) m).Copy(*this);
- }
+ if (this != &m)
+ {
+ ((AliTRDdigitsManager &) m).Copy(*this);
+ }
return *this;
((AliTRDdigitsManager &) m).fEvent = fEvent;
((AliTRDdigitsManager &) m).fHasSDigits = fHasSDigits;
-
+ ((AliTRDdigitsManager &) m).fDigits = fDigits;
+ for(Int_t i=0; i<kNDict; i++)
+ {
+ ((AliTRDdigitsManager &) m).fDict[i] = fDict[i];
+ }
((AliTRDdigitsManager &) m).fSignalIndexes = fSignalIndexes;
((AliTRDdigitsManager &) m).fUseDictionaries = fUseDictionaries;
// Create the data arrays
//
- if (fHasSDigits) {
- fDigits = new AliTRDsegmentArray("AliTRDdataArrayF",AliTRDgeometry::Ndet());
- }
- else {
- fDigits = new AliTRDsegmentArray("AliTRDdataArrayDigits",AliTRDgeometry::Ndet());
- }
+ if (fHasSDigits)
+ {
+ if(fDigits)
+ {
+ fDigits->Delete();
+ delete fDigits;
+ }
+ fDigits = new TObjArray(AliTRDgeometry::Ndet());
+ for (Int_t index = 0; index < AliTRDgeometry::Ndet(); index++)
+ {
+ AliTRDarraySignal *chamber= new AliTRDarraySignal();
+ chamber->SetNdet(index);
+ fDigits->AddAt(chamber,index);
+ }
+ }
+ else
+ {
+ if(fDigits)
+ {
+ fDigits->Delete();
+ delete fDigits;
+ }
+ fDigits = new TObjArray(AliTRDgeometry::Ndet());
+ for (Int_t index = 0; index < AliTRDgeometry::Ndet(); index++)
+ {
+ AliTRDarrayADC *chamber= new AliTRDarrayADC();
+ chamber->SetNdet(index);
+ fDigits->AddAt(chamber,index);
+ }
+ }
+
+ if (fUseDictionaries)
+ {
+ for(Int_t iDict = 0; iDict < kNDict; iDict++)
+ if(fDict[iDict])
+ {
+ fDict[iDict]->Delete();
+ delete fDict[iDict];
+ }
+ for(Int_t iDict = 0; iDict < kNDict; iDict++)
+ {
+ fDict[iDict] = new TObjArray(AliTRDgeometry::Ndet());
+ }
- if (fUseDictionaries) {
- for (Int_t iDict = 0; iDict < kNDict; iDict++) {
- fDictionary[iDict] = new AliTRDsegmentArray("AliTRDdataArrayI"
- ,AliTRDgeometry::Ndet());
+ for (Int_t iDict = 0; iDict < kNDict; iDict++)
+ {
+ for (Int_t index = 0; index < AliTRDgeometry::Ndet(); index++)
+ {
+ AliTRDarrayDictionary *dictio= new AliTRDarrayDictionary();
+ dictio->SetNdet(index);
+ fDict[iDict]->AddAt(dictio,index);
+ }
+ }
}
- }
- for (Int_t i = 0; i < AliTRDgeometry::Ndet(); i++) {
- fSignalIndexes->AddLast(new AliTRDSignalIndex());
- }
+ for (Int_t i = 0; i < AliTRDgeometry::Ndet(); i++)
+ {
+ fSignalIndexes->AddLast(new AliTRDSignalIndex());
+ }
}
// Reset the data arrays
//
- if (fDigits) {
- fDigits->Delete();
- delete fDigits;
- }
- if (fHasSDigits) {
- fDigits = new AliTRDsegmentArray("AliTRDdataArrayF",AliTRDgeometry::Ndet());
- }
- else {
- fDigits = new AliTRDsegmentArray("AliTRDdataArrayS",AliTRDgeometry::Ndet());
- }
-
- if (fUseDictionaries) {
- for (Int_t iDict = 0; iDict < kNDict; iDict++) {
- if (fDictionary[iDict]) {
- fDictionary[iDict]->Delete();
- delete fDictionary[iDict];
- }
- fDictionary[iDict] = new AliTRDsegmentArray("AliTRDdataArrayI"
- ,AliTRDgeometry::Ndet());
- }
- }
-
- for (Int_t i = 0; i < AliTRDgeometry::Ndet(); i++) {
- AliTRDSignalIndex *idx = (AliTRDSignalIndex *)fSignalIndexes->At(i);
- if (idx) idx->Reset();
- }
+ if (fDigits)
+ {
+ fDigits->Delete();
+ delete fDigits;
+ }
+
+ for (Int_t iDict = 0; iDict < kNDict; iDict++)
+ {
+ if (fDict[iDict])
+ {
+ fDict[iDict]->Delete();
+ delete fDict[iDict];
+ }
+ }
+
+ if (fHasSDigits)
+ {
+ fDigits = new TObjArray(AliTRDgeometry::Ndet());
+ for (Int_t index = 0; index < AliTRDgeometry::Ndet(); index++)
+ {
+ AliTRDarraySignal *chamber= new AliTRDarraySignal();
+ chamber->SetNdet(index);
+ fDigits->AddAt(chamber,index);
+ }
+ }
+ else
+ {
+ fDigits = new TObjArray(AliTRDgeometry::Ndet());
+ for (Int_t index = 0; index < AliTRDgeometry::Ndet(); index++)
+ {
+ AliTRDarrayADC *chamber= new AliTRDarrayADC();
+ chamber->SetNdet(index);
+ fDigits->AddAt(chamber,index);
+ }
+ }
+
+ if (fUseDictionaries)
+ {
+ for(Int_t iDict = 0; iDict < kNDict; iDict++)
+ {
+ fDict[iDict] = new TObjArray(AliTRDgeometry::Ndet());
+ }
+ for (Int_t iDict = 0; iDict < kNDict; iDict++)
+ {
+ for (Int_t index = 0; index < AliTRDgeometry::Ndet(); index++)
+ {
+ AliTRDarrayDictionary *dictio= new AliTRDarrayDictionary();
+ dictio->SetNdet(index);
+ fDict[iDict]->AddAt(dictio,index);
+ }
+ }
+ }
+
+ for (Int_t i = 0; i < AliTRDgeometry::Ndet(); i++)
+ {
+ AliTRDSignalIndex *idx = (AliTRDSignalIndex *) fSignalIndexes->At(i);
+ if (idx) idx->Reset();
+ }
}
//_____________________________________________________________________________
-Short_t AliTRDdigitsManager::GetDigitAmp(Int_t row, Int_t col,Int_t time
- , Int_t det) const
+Short_t AliTRDdigitsManager::GetDigitAmp(Int_t row, Int_t col,Int_t time, Int_t det) const
{
//
// Returns the amplitude of a digit
//
- if (!GetDigits(det)) {
- return 0;
- }
-
- return ((Short_t) ((AliTRDdataArrayDigits *) GetDigits(det))->GetData(row,col,time));
+ if (!GetDigits(det))
+ {
+ return 0;
+ }
+
+ return ((Short_t) ((AliTRDarrayADC *) GetDigits(det))->GetDataB(row,col,time));
}
-
+
//_____________________________________________________________________________
-UChar_t AliTRDdigitsManager::GetPadStatus(Int_t row, Int_t col, Int_t time
- , Int_t det) const
+UChar_t AliTRDdigitsManager::GetPadStatus(Int_t row, Int_t col, Int_t time, Int_t det) const
{
//
// Returns the pad status for the requested pad
//
- if (!GetDigits(det)) {
- return 0;
- }
-
- return ((UChar_t) ((AliTRDdataArrayDigits *) GetDigits(det))->GetPadStatus(row,col,time));
+ if (!GetDigits(det))
+ {
+ return 0;
+ }
+ return ((UChar_t) ((AliTRDarrayADC *) GetDigits(det))->GetPadStatus(row,col,time));
+
}
//_____________________________________________________________________________
-Bool_t AliTRDdigitsManager::MakeBranch(TTree *tree)
+Bool_t AliTRDdigitsManager::MakeBranch(TTree *tree)
{
//
// Creates the tree and branches for the digits and the dictionary
//
- Int_t buffersize = 64000;
+ Int_t buffersize = 64000;
+ Bool_t status = kTRUE;
- Bool_t status = kTRUE;
-
- if (tree) {
- fTree = tree;
- }
+ if (tree)
+ {
+ fTree = tree;
+ }
// Make the branch for the digits
- if (fDigits) {
- const AliTRDdataArray *kDigits = (AliTRDdataArray *) fDigits->At(0);
- if (kDigits) {
- if (!fTree) return kFALSE;
- TBranch* branch = fTree->GetBranch("TRDdigits");
- if (!branch) fTree->Branch("TRDdigits",kDigits->IsA()->GetName()
- ,&kDigits,buffersize,99);
- AliDebug(1,"Making branch TRDdigits\n");
- }
- else {
+ if (fDigits)
+ {
+ if(fHasSDigits)
+ {
+ const AliTRDarraySignal *kDigits = (AliTRDarraySignal *) fDigits->At(0);
+ if (kDigits)
+ {
+ if (!fTree) return kFALSE;
+ AliDebug(1,"Making branch for SDigits!\n");
+ TBranch* branch = fTree->GetBranch("TRDdigits");
+ if (!branch) fTree->Branch("TRDdigits","AliTRDarraySignal",&kDigits,buffersize,99);
+ AliDebug(1,"Making branch TRDdigits\n");
+ }
+ else
+ {
+ status = kFALSE;
+ }
+ }
+
+ if(!fHasSDigits)
+ {
+ const AliTRDarrayADC *kDigits = (AliTRDarrayADC *) fDigits->At(0);
+ if (kDigits)
+ {
+ if (!fTree) return kFALSE;
+ AliDebug(1,"Making branch for Digits!\n");
+ TBranch* branch = fTree->GetBranch("TRDdigits");
+ if (!branch) fTree->Branch("TRDdigits","AliTRDarrayADC",&kDigits,buffersize,99);
+ AliDebug(1,"Making branch TRDdigits\n");
+ }
+ else
+ {
+ status = kFALSE;
+ }
+ }
+
+ }
+ else
+ {
status = kFALSE;
}
- }
- else {
- status = kFALSE;
- }
-
- if (fUseDictionaries) {
- // Make the branches for the dictionaries
- for (Int_t iDict = 0; iDict < kNDict; iDict++) {
- Char_t branchname[15];
- sprintf(branchname,"TRDdictionary%d",iDict);
- if (fDictionary[iDict]) {
- const AliTRDdataArray *kDictionary =
- (AliTRDdataArray *) fDictionary[iDict]->At(0);
- if (kDictionary) {
- if (!fTree) return kFALSE;
- TBranch* branch = fTree->GetBranch(branchname);
- if (!branch) fTree->Branch(branchname,kDictionary->IsA()->GetName()
- ,&kDictionary,buffersize,99);
- AliDebug(1,Form("Making branch %s\n",branchname));
- }
- else {
- status = kFALSE;
+
+ if (fUseDictionaries)
+ {
+ // Make the branches for the dictionaries
+ for (Int_t iDict = 0; iDict < kNDict; iDict++)
+ {
+ Char_t branchname[15];
+ sprintf(branchname,"TRDdictionary%d",iDict);
+ if (fDict[iDict])
+ {
+ const AliTRDarrayDictionary *kDictionary = (AliTRDarrayDictionary *) fDict[iDict]->At(0);
+ if (kDictionary)
+ {
+ if (!fTree) return kFALSE;
+ AliDebug(2,"Making branch for dictionary!\n");
+ TBranch* branch = fTree->GetBranch(branchname);
+ if (!branch) fTree->Branch(branchname,"AliTRDarrayDictionary",&kDictionary,buffersize,99);
+ AliDebug(1,Form("Making branch %s\n",branchname));
+ }
+ else
+ {
+ status = kFALSE;
+ }
+ }
+ else
+ {
+ status = kFALSE;
+ }
}
- }
- else {
- status = kFALSE;
- }
}
- }
-
+
return status;
}
Bool_t status = kTRUE;
- if (tree) {
- fTree = tree;
- }
-
- if (!fDigits) {
- AliDebug(1,"Create the data arrays.\n");
- CreateArrays();
- }
-
- status = fDigits->LoadArray("TRDdigits",fTree);
-
- if (fUseDictionaries) {
- for (Int_t iDict = 0; iDict < kNDict; iDict++) {
- Char_t branchname[15];
- sprintf(branchname,"TRDdictionary%d",iDict);
- status = fDictionary[iDict]->LoadArray(branchname,fTree);
- if (status == kFALSE) {
- fUseDictionaries = kFALSE;
- AliWarning("Unable to load dict arrays. Will not use them.\n");
- break;
- }
- }
- }
+ if (tree)
+ {
+ fTree = tree;
+ }
+
+ if (!fDigits)
+ {
+ AliDebug(1,"Create the data arrays.\n");
+ CreateArrays();
+ }
+
+ status = LoadArray(fDigits,"TRDdigits",fTree);
+
+ if (fUseDictionaries)
+ {
+ for (Int_t iDict = 0; iDict < kNDict; iDict++)
+ {
+ Char_t branchname[15];
+ sprintf(branchname,"TRDdictionary%d",iDict);
+ status = LoadArrayDict(fDict[iDict],branchname,fTree);
+ if (status == kFALSE)
+ {
+ fUseDictionaries = kFALSE;
+ AliWarning("Unable to load dict arrays. Will not use them.\n");
+ break;
+ }
+ }
+ }
return kTRUE;
// Writes out the TRD-digits and the dictionaries
//
- // Store the contents of the segment array in the tree
- if (!fDigits->StoreArray("TRDdigits",fTree)) {
- AliError("Error while storing digits in branch TRDdigits\n");
- return kFALSE;
- }
+ // Store the contents of the detector array in the tree
- if (fUseDictionaries) {
- for (Int_t iDict = 0; iDict < kNDict; iDict++) {
- Char_t branchname[15];
- sprintf(branchname,"TRDdictionary%d",iDict);
- if (!fDictionary[iDict]->StoreArray(branchname,fTree)) {
- AliError(Form("Error while storing dictionary in branch %s\n",branchname));
- return kFALSE;
- }
+ if (!StoreArray(fDigits,"TRDdigits",fTree))
+ {
+ AliError("Error while storing digits in branch TRDdigits\n");
+ return kFALSE;
}
- }
+ if (fUseDictionaries)
+ {
+ for (Int_t iDict = 0; iDict < kNDict; iDict++)
+ {
+ Char_t branchname[15];
+ sprintf(branchname,"TRDdictionary%d",iDict);
+ if (!StoreArrayDict(fDict[iDict],branchname,fTree))
+ {
+ AliError(Form("Error while storing dictionary in branch %s\n",branchname));
+ return kFALSE;
+ }
+ }
+ }
+
// Write the new tree to the output file
- fTree->AutoSave(); // Modification by Jiri
+ fTree->AutoSave();
return kTRUE;
}
//_____________________________________________________________________________
-AliTRDdigit *AliTRDdigitsManager::GetDigit(Int_t row, Int_t col
- , Int_t time, Int_t det) const
+AliTRDdigit *AliTRDdigitsManager::GetDigit(Int_t row
+ , Int_t col
+ , Int_t time
+ , Int_t det) const
{
//
// Creates a single digit object
//
- Int_t digits[4];
+ Int_t digits[4];
Int_t amp[1];
digits[0] = det;
digits[2] = col;
digits[3] = time;
- amp[0] = ((AliTRDdataArrayDigits *) GetDigits(det))->GetData(row,col,time);
+ amp[0] = ((AliTRDarrayADC *) GetDigits(det))->GetData(row,col,time);
return (new AliTRDdigit(digits,amp));
//_____________________________________________________________________________
Int_t AliTRDdigitsManager::GetTrack(Int_t track
- , Int_t row, Int_t col, Int_t time
+ , Int_t row
+ , Int_t col
+ , Int_t time
, Int_t det) const
{
//
// Returns the MC-track numbers from the dictionary.
//
- if ((track < 0) || (track >= kNDict)) {
- AliError(Form("track %d out of bounds (size: %d, this: 0x%08x)"
- ,track,kNDict,this));
- return -1;
- }
+ if ((track < 0) || (track >= kNDict))
+ {
+ AliError(Form("track %d out of bounds (size: %d, this: 0x%08x)",track,kNDict,this));
+ return -1;
+ }
- if (fUseDictionaries == kFALSE) {
- return -1;
- }
+ if (fUseDictionaries == kFALSE)
+ {
+ return -1;
+ }
- // Array contains index+1 to allow data compression
- return (((AliTRDdataArrayI *) GetDictionary(det,track))->GetData(row,col,time) - 1);
+ // Array contains index+1 to allow data compression--->Changed
+ return (((AliTRDarrayDictionary *) GetDictionary(det,track))->GetData(row,col,time) );
}
-//_____________________________________________________________________________
-AliTRDdataArrayDigits *AliTRDdigitsManager::GetDigits(Int_t det) const
+//________________________________________________________________________________
+AliTRDarrayADC *AliTRDdigitsManager::GetDigits(Int_t det) const
{
//
// Returns the digits array for one detector
//
- if (!fDigits) {
- return 0x0;
- }
+ if (!fDigits)
+ {
+ return 0x0;
+ }
- return (AliTRDdataArrayDigits *) fDigits->At(det);
+ if (!fHasSDigits)
+ {
+ return (AliTRDarrayADC *) fDigits->At(det);
+ }
+ else
+ {
+ AliDebug(2,"ERROR IN DATA TYPE!!!!");
+ return 0x0;
+ }
}
//_____________________________________________________________________________
-AliTRDdataArray *AliTRDdigitsManager::GetDictionary(Int_t det, Int_t i) const
+AliTRDarraySignal *AliTRDdigitsManager::GetSDigits(Int_t det) const
{
//
- // Returns the dictionary for one detector
+ // Returns the sdigits array for one detector
//
- if (fUseDictionaries == kFALSE) {
- return 0x0;
- }
+ if (!fDigits)
+ {
+ // AliDebug(1,"NO FDIGITS!");
+ return 0x0;
+ }
+
+ if (fHasSDigits)
+ {
+ return (AliTRDarraySignal *) fDigits->At(det);
+ }
+ else
+ {
+ AliDebug(2,"ERROR IN DATA TYPE!!!!");
+ return 0x0;
+ }
+
+}
+
+//_____________________________________________________________________________
+AliTRDarrayDictionary *AliTRDdigitsManager::GetDictionary(Int_t det
+ , Int_t i) const
+{
+ //
+ // Returns the dictionary for one detector
+ //
- return (AliTRDdataArray *) fDictionary[i]->At(det);
+ if (fUseDictionaries == kFALSE)
+ {
+ return 0x0;
+ }
+ return (AliTRDarrayDictionary *) fDict[i]->At(det);
+
}
//_____________________________________________________________________________
-Int_t AliTRDdigitsManager::GetTrack(Int_t track, AliTRDdigit *Digit) const
+Int_t AliTRDdigitsManager::GetTrack(Int_t track, AliTRDdigit *digit) const
{
//
// Returns the MC-track numbers from the dictionary for a given digit
//
- Int_t row = Digit->GetRow();
- Int_t col = Digit->GetCol();
- Int_t time = Digit->GetTime();
- Int_t det = Digit->GetDetector();
+ Int_t row = digit->GetRow();
+ Int_t col = digit->GetCol();
+ Int_t time = digit->GetTime();
+ Int_t det = digit->GetDetector();
return GetTrack(track,row,col,time,det);
//_____________________________________________________________________________
void AliTRDdigitsManager::RemoveDigits(Int_t det)
{
- //
- // Clear memory
- //
+ //
+ // Clear memory at det for Digits
+ //
- fDigits->ClearSegment(det);
+ if (fDigits->At(det))
+ {
+ fDigits->RemoveAt(det);
+ }
}
// Clear memory
//
- if (fUseDictionaries == kFALSE) {
- return;
- }
+ if (fUseDictionaries == kFALSE)
+ {
+ return;
+ }
- for (Int_t i = 0; i < kNDict; i++) {
- fDictionary[i]->ClearSegment(det);
- }
+ for (Int_t i = 0; i < kNDict; i++)
+ {
+ if (fDict[i]->At(det))
+ {
+ fDict[i]->RemoveAt(det);
+ }
+ }
}
// Build the list of indices
//
- Int_t nRows = 0;
- Int_t nCols = 0;
+ Int_t nRows = 0;
+ Int_t nCols = 0;
Int_t nTbins = 0;
- AliTRDgeometry geom;
- AliTRDdataArrayDigits *digits = 0x0;
+ AliTRDgeometry geom;
+ AliTRDarrayADC *digits = 0x0;
- if (fHasSDigits) {
- return kFALSE;
- }
- else {
- digits = (AliTRDdataArrayDigits *) GetDigits(det);
- }
+ if (fHasSDigits)
+ {
+ return kFALSE;
+ }
+ else
+ {
+ digits = (AliTRDarrayADC *) GetDigits(det);
+ }
//digits should be expanded by now!!!
- if (digits->GetNtime() > 0) {
+ if (digits->GetNtime() > 0)
+ {
+ digits->Expand();
+ nRows = digits->GetNrow();
+ nCols = digits->GetNcol();
+ nTbins = digits->GetNtime();
+
+ AliTRDSignalIndex *indexes = GetIndexes(det);
+ indexes->SetSM(geom.GetSector(det));
+ indexes->SetStack(geom.GetStack(det));
+ indexes->SetLayer(geom.GetLayer(det));
+ indexes->SetDetNumber(det);
+
+ if (indexes->IsAllocated() == kFALSE)
+ {
+ indexes->Allocate(nRows,nCols,nTbins);
+ }
- digits->Expand();
- nRows = digits->GetNrow();
- nCols = digits->GetNcol();
- nTbins = digits->GetNtime();
+ for (Int_t ir = 0; ir < nRows; ir++)
+ {
+ for (Int_t ic = 0; ic < nCols; ic++)
+ {
+ for (Int_t it = 0; it < nTbins; it++)
+ {
+ Int_t isig = digits->GetDataB(ir,ic,it);
+ if (isig > 0)
+ {
+ indexes->AddIndexTBin(ir,ic,it);
+ }
+ } // tbins
+ } // cols
+ } // rows
+
+ } // if GetNtime
+ else
+ {
+ return kFALSE;
+ }
+
+ return kTRUE;
- AliTRDSignalIndex *indexes = GetIndexes(det);
- indexes->SetSM(geom.GetSector(det));
- indexes->SetStack(geom.GetStack(det));
- indexes->SetLayer(geom.GetLayer(det));
- indexes->SetDetNumber(det);
+}
- if (indexes->IsAllocated() == kFALSE) {
- indexes->Allocate(nRows,nCols,nTbins);
+//_____________________________________________________________________________
+Bool_t AliTRDdigitsManager::LoadArray(TObjArray *object
+ , const Char_t *branchname
+ , TTree *tree)
+{
+ //
+ // Loads all detectors of the array from the branch <branchname> of
+ // the digits tree <tree>
+ // Adapted from code of the class AliTRDsegmentArray
+ //
+
+ fTreeD = tree;
+
+ if (!fTreeD)
+ {
+ AliError("Digits tree is not defined\n");
+ return kFALSE;
}
- for (Int_t ir = 0; ir < nRows; ir++) {
- for (Int_t ic = 0; ic < nCols; ic++) {
- for (Int_t it = 0; it < nTbins; it++) {
-
- Int_t isig = digits->GetDataUnchecked(ir,ic,it);
- if (isig > 0) {
- indexes->AddIndexTBin(ir,ic,it);
- }
- } // tbins
- } // cols
- } // rows
+ // Get the branch
+ fBranch = fTreeD->GetBranch(branchname);
+ if (!fBranch)
+ {
+ AliError(Form("Branch %s is not defined\n",branchname));
+ return kFALSE;
+ }
- } // if GetNtime
- else {
- return kFALSE;
- }
+ // Loop through all detectors and read them from the tree
+ Bool_t status = kTRUE;
+ for (Int_t iDet = 0; iDet < AliTRDgeometry::Ndet(); iDet++)
+ {
+ if(fHasSDigits)
+ {
+ AliTRDarraySignal *dataArray = (AliTRDarraySignal *) object->At(iDet);
+ if (!dataArray)
+ {
+ status = kFALSE;
+ break;
+ }
+
+ fBranch->SetAddress(&dataArray);
+ fBranch->GetEntry(iDet);
+ }
+ else
+ {
+ AliTRDarrayADC *dataArray = (AliTRDarrayADC *) object->At(iDet);
+ if (!dataArray)
+ {
+ status = kFALSE;
+ break;
+ }
+ fBranch->SetAddress(&dataArray);
+ fBranch->GetEntry(iDet);
+ }
+ }
- return kTRUE;
+ return status;
+
+}
+
+//________________________________________________________________________________________________
+Bool_t AliTRDdigitsManager::LoadArrayDict(TObjArray *object
+ , const Char_t *branchname
+ , TTree *tree)
+{
+ //
+ // Loads all detectors of the array from the branch <branchname> of
+ // the dictionary tree <tree>
+ // Adapted from code of the class AliTRDsegmentArray
+ //
+
+ fTreeD = tree;
+
+ if (!fTreeD)
+ {
+ AliError("Digits tree is not defined\n");
+ return kFALSE;
+ }
+
+ // Get the branch
+ fBranch = fTreeD->GetBranch(branchname);
+ if (!fBranch)
+ {
+ AliError(Form("Branch %s is not defined\n",branchname));
+ return kFALSE;
+ }
+
+ // Loop through all detectors and read them from the tree
+ Bool_t status = kTRUE;
+ for (Int_t iDet = 0; iDet < AliTRDgeometry::Ndet(); iDet++)
+ {
+ AliTRDarrayDictionary *dataArray = (AliTRDarrayDictionary *) object->At(iDet);
+ if (!dataArray)
+ {
+ status = kFALSE;
+ break;
+ }
+ fBranch->SetAddress(&dataArray);
+ fBranch->GetEntry(iDet);
+ }
+
+ return status;
+
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDdigitsManager::StoreArray(TObjArray *array1
+ , const Char_t *branchname
+ , TTree *tree)
+{
+ //
+ // Stores all the detectors of the array in the branch <branchname> of
+ // the digits tree <tree>
+ // Adapted from code of the class AliTRDsegmentArray
+ //
+
+ fTree = tree;
+
+ if (!fTree)
+ {
+ AliError("Digits tree is not defined\n");
+ return kFALSE;
+ }
+
+ // Get the branch
+ fBranch = fTree->GetBranch(branchname);
+ if (!fBranch)
+ {
+ AliError(Form("Branch %s is not defined\n",branchname));
+ return kFALSE;
+ }
+
+ // Loop through all detectors and fill them into the tree
+ Bool_t status = kTRUE;
+ for (Int_t iDet = 0; iDet < AliTRDgeometry::Ndet(); iDet++)
+ {
+ if (fHasSDigits)
+ {
+ const AliTRDarraySignal *kDataArray = (AliTRDarraySignal *) array1->At(iDet);
+ if (!kDataArray)
+ {
+ status = kFALSE;
+ break;
+ }
+ fBranch->SetAddress(&kDataArray);
+ fBranch->Fill();
+ }
+ else
+ {
+ const AliTRDarrayADC *kDataArray = (AliTRDarrayADC *) array1->At(iDet);
+ if (!kDataArray)
+ {
+ status = kFALSE;
+ break;
+ }
+ fBranch->SetAddress(&kDataArray);
+ fBranch->Fill();
+ }
+ }
+
+ return status;
+
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDdigitsManager::StoreArrayDict(TObjArray *array3
+ , const Char_t *branchname
+ , TTree *tree)
+{
+ //
+ // Stores all the dictionary arrays of the detectors of the array in the branch <branchname> of
+ // the dictionary tree <tree>
+ // Adapted from code of the class AliTRDsegmentArray
+ //
+
+ // AliDebug(1,"Storing Arrays of Dictionary");
+ fTree = tree;
+
+ if (!fTree)
+ {
+ AliError("Digits tree is not defined\n");
+ return kFALSE;
+ }
+
+ // Get the branch
+ fBranch = fTree->GetBranch(branchname);
+ if (!fBranch)
+ {
+ AliError(Form("Branch %s is not defined\n",branchname));
+ return kFALSE;
+ }
+
+ // Loop through all detectors and fill them into the tree
+ Bool_t status = kTRUE;
+ for (Int_t iDet = 0; iDet < AliTRDgeometry::Ndet(); iDet++)
+ {
+ const AliTRDarrayDictionary *kDataArray = (AliTRDarrayDictionary *) array3->At(iDet);
+ if (!kDataArray)
+ {
+ status = kFALSE;
+ break;
+ }
+ fBranch->SetAddress(&kDataArray);
+ fBranch->Fill();
+ }
+
+ return status;
}
class TFile;
class TTree;
-
-class AliTRDsegmentArray;
-class AliTRDdataArray;
-class AliTRDdataArrayDigits;
+class TBranch;
class AliTRDdigit;
class AliTRDSignalIndex;
+class AliTRDarrayADC;
+class AliTRDarraySignal;
+class AliTRDarrayDictionary;
class AliTRDdigitsManager : public TObject {
virtual Bool_t HasSDigits() const { return fHasSDigits; };
static Int_t NDict() { return fgkNDict; };
- virtual AliTRDsegmentArray *GetDigits() const { return fDigits; };
- virtual AliTRDsegmentArray *GetDictionary(Int_t i) const { return fDictionary[i]; };
-
- AliTRDdigit *GetDigit(Int_t row, Int_t col, Int_t time, Int_t det) const;
- Int_t GetTrack(Int_t track, Int_t row, Int_t col
- , Int_t time, Int_t det) const;
-
- AliTRDdataArrayDigits *GetDigits(Int_t det) const;
- AliTRDdataArray *GetDictionary(Int_t det, Int_t i) const;
-
- AliTRDSignalIndex *GetIndexes(Int_t det);
- TObjArray *GetIndexes() { return fSignalIndexes; };
-
- void RemoveDigits(Int_t det);
- void RemoveDictionaries(Int_t det);
- void ClearIndexes(Int_t det);
-
- Int_t GetTrack(Int_t track, AliTRDdigit *digit) const;
- Short_t GetDigitAmp(Int_t row, Int_t col, Int_t time, Int_t det) const;
- UChar_t GetPadStatus(Int_t row, Int_t col, Int_t time, Int_t det) const;
-
+ virtual TObjArray *GetDigits() const { return fDigits; };
+ virtual TObjArray *GetDictionary(Int_t i) const { return fDict[i]; };
+
+ AliTRDdigit *GetDigit(Int_t row, Int_t col, Int_t time, Int_t det) const;
+ Int_t GetTrack(Int_t track, Int_t row, Int_t col, Int_t time, Int_t det) const;
+
+ AliTRDarrayADC *GetDigits(Int_t det) const;
+ AliTRDarraySignal *GetSDigits(Int_t det) const;
+ AliTRDarrayDictionary *GetDictionary(Int_t det, Int_t i) const;
+
+ AliTRDSignalIndex *GetIndexes(Int_t det);
+ TObjArray *GetIndexes() { return fSignalIndexes; };
+
+ void RemoveDigits(Int_t det);
+ void RemoveDictionaries(Int_t det);
+ void ClearIndexes(Int_t det);
+
+ Int_t GetTrack(Int_t track, AliTRDdigit *digit) const;
+ Short_t GetDigitAmp(Int_t row, Int_t col, Int_t time, Int_t det) const;
+ UChar_t GetPadStatus(Int_t row, Int_t col, Int_t time, Int_t det) const;
+
+ Bool_t LoadArray(TObjArray *object, const Char_t *branchname, TTree *tree=0);
+ Bool_t LoadArrayDict(TObjArray *object, const Char_t *branchname, TTree *tree=0);
+ Bool_t StoreArray(TObjArray *array1, const Char_t *branchname, TTree *tree=0);
+ Bool_t StoreArrayDict(TObjArray *array3, const Char_t *branchname, TTree *tree=0);
+
protected:
-
+
static const Int_t fgkNDict; // Number of track dictionary arrays
-
Int_t fEvent; // Event number
TTree *fTree; //! Tree for the digits arrays
-
- AliTRDsegmentArray *fDigits; //! Digits data array
- AliTRDsegmentArray *fDictionary[kNDict]; //! Track dictionary data array
-
+ TObjArray *fDigits; // Digits data array
+ TObjArray *fDict[kNDict]; // Track dictionary data array
Bool_t fHasSDigits; // Switch for the summable digits
-
TObjArray *fSignalIndexes; // Provides access to the active pads and tbins
Bool_t fUseDictionaries; // Use dictionaries or not (case of real data)
+ TTree *fTreeD; // Tree with detector objects
+ TBranch *fBranch; // Branchaddress
ClassDef(AliTRDdigitsManager,7) // Manages the TRD digits
};
-
#endif
#include "AliTRDgeometry.h"
#include "AliTRDcalibDB.h"
#include "AliTRDdigitsManager.h"
-
+#include "AliTRDarrayADC.h"
// additional for new tail filter and/or tracklet
#include "AliTRDtrapAlu.h"
#include "AliTRDpadPlane.h"
// cluster quality threshold (not yet set)
// electron probability
}
+//_____________________________________________________________________________________
+void AliTRDmcmSim::GeneratefZSM1Dim()
+{
+ //
+ // Generate the array fZSM1Dim necessary
+ // for the method ProduceRawStream
+ //
+
+ // Fill the mapping
+ // Supressed zeros indicated by -1 in digits array
+ for( Int_t iadc = 1 ; iadc < fNADC-1; iadc++ )
+ {
+ for( Int_t it = 0 ; it < fNTimeBin ; it++ )
+ {
+
+ if(fADCF[iadc][it]==-1) // If is a supressed value
+ {
+ fZSM[iadc][it]=1;
+ }
+ else // Not suppressed
+ {
+ fZSM[iadc][it]=0;
+ }
+ }
+ }
+
+ // Make the 1 dim projection
+ for( Int_t iadc = 0 ; iadc < fNADC; iadc++ )
+ {
+ for( Int_t it = 0 ; it < fNTimeBin ; it++ )
+ {
+ fZSM1Dim[iadc] &= fZSM[iadc][it];
+ }
+ }
+}
+//_______________________________________________________________________________________
+void AliTRDmcmSim::CopyArrays()
+{
+ //
+ // Initialize filtered data array with raw data
+ // Method added for internal consistency
+ //
+
+ for( Int_t iadc = 0 ; iadc < fNADC; iadc++ )
+ {
+ for( Int_t it = 0 ; it < fNTimeBin ; it++ )
+ {
+ fADCF[iadc][it] = fADCR[iadc][it];
+ }
+ }
+}
+//_______________________________________________________________________________________
+void AliTRDmcmSim::StartfastZS(Int_t pads, Int_t timebins)
+{
+ //
+ // Initialize just the necessary elements to perform
+ // the zero suppression in the digitizer
+ //
+
+ fFeeParam = AliTRDfeeParam::Instance();
+ fSimParam = AliTRDSimParam::Instance();
+ fNADC = pads;
+ fNTimeBin = timebins;
+
+ if( fADCR == NULL )
+ {
+ fADCR = new Int_t *[fNADC];
+ fADCF = new Int_t *[fNADC];
+ fADCT = new Int_t *[fNADC];
+ fZSM = new Int_t *[fNADC];
+ fZSM1Dim = new Int_t [fNADC];
+ for( Int_t iadc = 0 ; iadc < fNADC; iadc++ )
+ {
+ fADCR[iadc] = new Int_t[fNTimeBin];
+ fADCF[iadc] = new Int_t[fNTimeBin];
+ fADCT[iadc] = new Int_t[fNTimeBin];
+ fZSM [iadc] = new Int_t[fNTimeBin];
+ }
+ }
+
+ for( Int_t iadc = 0 ; iadc < fNADC; iadc++ )
+ {
+ for( Int_t it = 0 ; it < fNTimeBin ; it++ )
+ {
+ fADCR[iadc][it] = 0;
+ fADCF[iadc][it] = 0;
+ fADCT[iadc][it] = -1;
+ fZSM [iadc][it] = 1;
+ }
+ fZSM1Dim[iadc] = 1;
+ }
+
+ fInitialized = kTRUE;
+}
+//_______________________________________________________________________________________
+void AliTRDmcmSim::FlagDigitsArray(AliTRDarrayADC *tempdigs, Int_t valrow)
+{
+ //
+ // Modify the digits array to flag suppressed values
+ //
+
+ for( Int_t iadc = 1 ; iadc < fNADC-1; iadc++ )
+ {
+ for( Int_t it = 0 ; it < fNTimeBin ; it++ )
+ {
+ if(fZSM[iadc][it]==1)
+ {
+ tempdigs->SetData(valrow,iadc,it,-1);
+ }
+ }
+ }
+}
+
class AliTRDgeometry;
class AliTRDtrapAlu;
class AliTRDpadPlane;
+class AliTRDarrayADC;
class AliTRDmcmSim : public TObject {
void DumpData( char *f, char *target ); // Dump data stored (only for debugging)
void Tracklet();
void SetPosLUT();
+ void CopyArrays(); // Copy arrays between containers, internal consistency
+ void GeneratefZSM1Dim(); // Generate the ZSM1Dim based on digits array info
+ void StartfastZS(Int_t pads, Int_t timebis); // For ZS in the digitizer
+ void FlagDigitsArray(AliTRDarrayADC *tempdigs, Int_t valrow); //Set flags on the digits array
protected:
#include "AliTRDrawData.h"
#include "AliTRDdigitsManager.h"
#include "AliTRDgeometry.h"
-#include "AliTRDdataArrayI.h"
-#include "AliTRDdataArrayS.h"
+#include "AliTRDarrayDictionary.h"
+#include "AliTRDarrayADC.h"
#include "AliTRDrawStreamBase.h"
#include "AliTRDrawOldStream.h"
#include "AliTRDRawStreamV2.h"
Int_t iDet = fGeo->GetDetector(layer,stack,sect);
if (iDet == 0) newEvent = kTRUE; // it is expected that each event has at least one tracklet; this is only needed for correct readout tree
// Get the digits array
- AliTRDdataArrayS *digits = (AliTRDdataArrayS *) digitsManager->GetDigits(iDet);
+ AliTRDarrayADC *digits = (AliTRDarrayADC *) digitsManager->GetDigits(iDet);
if (digits->HasData() ) { // second part is new!! and is for indicating a new event
digits->Expand();
}
//_____________________________________________________________________________
-Int_t AliTRDrawData::ProduceHcData(AliTRDdataArrayS *digits, Int_t side, Int_t det, UInt_t *buf, Int_t maxSize, Bool_t newEvent = kFALSE){
+Int_t AliTRDrawData::ProduceHcData(AliTRDarrayADC *digits, Int_t side, Int_t det, UInt_t *buf, Int_t maxSize, Bool_t newEvent = kFALSE){
//
// This function can be used for both ZS and NZS data
//
Int_t padcol = mcm[entry]->GetCol( iAdc );
if ((padcol >= 0) && (padcol < nCol)) {
for (Int_t iT = 0; iT < kNTBin; iT++) {
- mcm[entry]->SetData( iAdc, iT, digits->GetDataUnchecked( padrow, padcol, iT) );
+ mcm[entry]->SetData( iAdc, iT, digits->GetData( padrow, padcol, iT) );
}
}
else { // this means it is out of chamber, and masked ADC
}
// Simulate process in MCM
- mcm[entry]->Filter(); // Apply filter
- mcm[entry]->ZSMapping(); // Calculate zero suppression mapping
+ // mcm[entry]->Filter(); // Apply filter
+ // mcm[entry]->ZSMapping(); // Calculate zero suppression mapping
+ mcm[entry]->CopyArrays();
+ mcm[entry]->GeneratefZSM1Dim();
if (tracklet_on) {
mcm[entry]->Tracklet();
//_____________________________________________________________________________
-Int_t AliTRDrawData::ProduceHcDataV1andV2(AliTRDdataArrayS *digits, Int_t side
+Int_t AliTRDrawData::ProduceHcDataV1andV2(AliTRDarrayADC *digits, Int_t side
, Int_t det, UInt_t *buf, Int_t maxSize)
{
//
// 3 timebins are packed into one 32 bits word
for (Int_t iT = 0; iT < kNTBin; iT+=3) {
if ((padcol >= 0) && (padcol < nCol)) {
- a[iT ] = ((iT ) < kNTBin ) ? digits->GetDataUnchecked(padrow,padcol,iT ) : 0;
- a[iT+1] = ((iT + 1) < kNTBin ) ? digits->GetDataUnchecked(padrow,padcol,iT + 1) : 0;
- a[iT+2] = ((iT + 2) < kNTBin ) ? digits->GetDataUnchecked(padrow,padcol,iT + 2) : 0;
+ a[iT ] = ((iT ) < kNTBin ) ? digits->GetData(padrow,padcol,iT ) : 0;
+ a[iT+1] = ((iT + 1) < kNTBin ) ? digits->GetData(padrow,padcol,iT + 1) : 0;
+ a[iT+2] = ((iT + 2) < kNTBin ) ? digits->GetData(padrow,padcol,iT + 2) : 0;
}
else {
a[iT] = a[iT+1] = a[iT+2] = 0; // This happenes at the edge of chamber (should be pedestal! How?)
//_____________________________________________________________________________
-//Int_t AliTRDrawData::ProduceHcDataV3(AliTRDdataArrayS *digits, Int_t side , Int_t det, UInt_t *buf, Int_t maxSize)
-Int_t AliTRDrawData::ProduceHcDataV3(AliTRDdataArrayS *digits, Int_t side , Int_t det, UInt_t *buf, Int_t maxSize, Bool_t newEvent = kFALSE)
+//Int_t AliTRDrawData::ProduceHcDataV3(AliTRDarrayADC *digits, Int_t side , Int_t det, UInt_t *buf, Int_t maxSize)
+Int_t AliTRDrawData::ProduceHcDataV3(AliTRDarrayADC *digits, Int_t side , Int_t det, UInt_t *buf, Int_t maxSize, Bool_t newEvent = kFALSE)
{
//
// This function simulates: Raw Version == 3 (Zero Suppression Prototype)
Int_t padcol = mcm[entry]->GetCol( iAdc );
if ((padcol >= 0) && (padcol < nCol)) {
for (Int_t iT = 0; iT < kNTBin; iT++) {
- mcm[entry]->SetData( iAdc, iT, digits->GetDataUnchecked( padrow, padcol, iT) );
+ mcm[entry]->SetData( iAdc, iT, digits->GetData( padrow, padcol, iT) );
}
}
else { // this means it is out of chamber, and masked ADC
}
// Simulate process in MCM
- mcm[entry]->Filter(); // Apply filter
- mcm[entry]->ZSMapping(); // Calculate zero suppression mapping
+ // mcm[entry]->Filter(); // Apply filter
+ // mcm[entry]->ZSMapping(); // Calculate zero suppression mapping
+ mcm[entry]->CopyArrays();
+ mcm[entry]->GeneratefZSM1Dim();
if (tracklet_on) {
mcm[entry]->Tracklet();
// Vx of the raw data reading
//
- AliTRDdataArrayS *digits = 0;
- AliTRDdataArrayI *track0 = 0;
- AliTRDdataArrayI *track1 = 0;
- AliTRDdataArrayI *track2 = 0;
+ AliTRDarrayADC *digits = 0;
+ AliTRDarrayDictionary *track0 = 0;
+ AliTRDarrayDictionary *track1 = 0;
+ AliTRDarrayDictionary *track2 = 0;
//AliTRDSignalIndex *indexes = 0;
// Create the digits manager
if (det >= 0)
{
// get...
- digits = (AliTRDdataArrayS *) digitsManager->GetDigits(det);
- track0 = (AliTRDdataArrayI *) digitsManager->GetDictionary(det,0);
- track1 = (AliTRDdataArrayI *) digitsManager->GetDictionary(det,1);
- track2 = (AliTRDdataArrayI *) digitsManager->GetDictionary(det,2);
+ digits = (AliTRDarrayADC *) digitsManager->GetDigits(det);
+ track0 = (AliTRDarrayDictionary *) digitsManager->GetDictionary(det,0);
+ track1 = (AliTRDarrayDictionary *) digitsManager->GetDictionary(det,1);
+ track2 = (AliTRDarrayDictionary *) digitsManager->GetDictionary(det,2);
// and compress
- if (digits) digits->Compress(1,0);
- if (track0) track0->Compress(1,0);
- if (track1) track1->Compress(1,0);
- if (track2) track2->Compress(1,0);
+ if (digits) digits->Compress();
+ if (track0) track0->Compress();
+ if (track1) track1->Compress();
+ if (track2) track2->Compress();
}
}
// Vx of the raw data reading
//
- AliTRDdataArrayS *digits = 0;
- AliTRDdataArrayI *track0 = 0;
- AliTRDdataArrayI *track1 = 0;
- AliTRDdataArrayI *track2 = 0;
+ AliTRDarrayADC *digits = 0;
+ AliTRDarrayDictionary *track0 = 0;
+ AliTRDarrayDictionary *track1 = 0;
+ AliTRDarrayDictionary *track2 = 0;
AliTRDSignalIndex *indexes = 0;
// Create the digits manager
lastdet = det;
- if (digits) digits->Compress(1,0);
- if (track0) track0->Compress(1,0);
- if (track1) track1->Compress(1,0);
- if (track2) track2->Compress(1,0);
+ if (digits) digits->Compress();
+ if (track0) track0->Compress();
+ if (track1) track1->Compress();
+ if (track2) track2->Compress();
// Add a container for the digits of this detector
- digits = (AliTRDdataArrayS *) digitsManager->GetDigits(det);
- track0 = (AliTRDdataArrayI *) digitsManager->GetDictionary(det,0);
- track1 = (AliTRDdataArrayI *) digitsManager->GetDictionary(det,1);
- track2 = (AliTRDdataArrayI *) digitsManager->GetDictionary(det,2);
+ digits = (AliTRDarrayADC *) digitsManager->GetDigits(det);
+ track0 = (AliTRDarrayDictionary *) digitsManager->GetDictionary(det,0);
+ track1 = (AliTRDarrayDictionary *) digitsManager->GetDictionary(det,1);
+ track2 = (AliTRDarrayDictionary *) digitsManager->GetDictionary(det,2);
// Allocate memory space for the digits buffer
if (digits->GetNtime() == 0)
{
if (input.GetSignals()[it] > 0)
{
- digits->SetDataUnchecked(input.GetRow(), input.GetCol(),
- input.GetTimeBin() + it, input.GetSignals()[it]);
+ digits->SetData(input.GetRow(), input.GetCol(),input.GetTimeBin() + it, input.GetSignals()[it]);
indexes->AddIndexTBin(input.GetRow(), input.GetCol(),
input.GetTimeBin() + it);
- track0->SetDataUnchecked(input.GetRow(), input.GetCol(),
- input.GetTimeBin() + it, 0);
- track1->SetDataUnchecked(input.GetRow(), input.GetCol(),
- input.GetTimeBin() + it, 0);
- track2->SetDataUnchecked(input.GetRow(), input.GetCol(),
- input.GetTimeBin() + it, 0);
+ track0->SetData(input.GetRow(), input.GetCol(), input.GetTimeBin() + it, 0);
+ track1->SetData(input.GetRow(), input.GetCol(), input.GetTimeBin() + it, 0);
+ track2->SetData(input.GetRow(), input.GetCol(), input.GetTimeBin() + it, 0);
}
}
}
}
- if (digits) digits->Compress(1,0);
- if (track0) track0->Compress(1,0);
- if (track1) track1->Compress(1,0);
- if (track2) track2->Compress(1,0);
+ if (digits) digits->Compress();
+ if (track0) track0->Compress();
+ if (track1) track1->Compress();
+ if (track2) track2->Compress();
return digitsManager;
class AliTRDdigitsManager;
class AliTRDgeometry;
class AliTRDfeeParam;
-class AliTRDdataArrayS;
+class AliTRDarrayADC;
class AliTRDrawData : public TObject {
protected:
virtual Bool_t Digits2Raw(AliTRDdigitsManager* digitsManager); // for fRawVersion > 0
- virtual Int_t ProduceHcData(AliTRDdataArrayS *digits, Int_t side, Int_t det, UInt_t *buf, Int_t maxSize, Bool_t newEvent);
- virtual Int_t ProduceHcDataV1andV2(AliTRDdataArrayS *digits, Int_t side, Int_t det, UInt_t *buf, Int_t maxSize);
- virtual Int_t ProduceHcDataV3(AliTRDdataArrayS *digits, Int_t side, Int_t det, UInt_t *buf, Int_t maxSize, Bool_t newEvent);
- //virtual Int_t ProduceHcDataV3(AliTRDdataArrayS *digits, Int_t side, Int_t det, UInt_t *buf, Int_t maxSize);
+ virtual Int_t ProduceHcData(AliTRDarrayADC *digits, Int_t side, Int_t det, UInt_t *buf, Int_t maxSize, Bool_t newEvent);
+ virtual Int_t ProduceHcDataV1andV2(AliTRDarrayADC *digits, Int_t side, Int_t det, UInt_t *buf, Int_t maxSize);
+ virtual Int_t ProduceHcDataV3(AliTRDarrayADC *digits, Int_t side, Int_t det, UInt_t *buf, Int_t maxSize, Bool_t newEvent);
+ //virtual Int_t ProduceHcDataV3(AliTRDarrayADC *digits, Int_t side, Int_t det, UInt_t *buf, Int_t maxSize);
void ProduceSMIndexData(UInt_t *buf, Int_t& nw); // SM index words and header - real data format
void WriteIntermediateWords(UInt_t *buf, Int_t& nw, Int_t& of, const Int_t& maxSize, const Int_t& det, const Int_t& side); // writes tracklet-endmarker and additional words between tracklet and raw-data
void WriteIntermediateWordsV2(UInt_t *buf, Int_t& nw, Int_t& of, const Int_t& maxSize, const Int_t& det, const Int_t& side); // real data format
private:
- static Int_t fgRawFormatVersion; // simulation raw data version - 0:old , 1:new(real data format)
- static const UInt_t fgkEndOfTrackletMarker = 0x10001000; // This marks the end of tracklet data words
+ static Int_t fgRawFormatVersion; // simulation raw data version - 0:old , 1:new(real data format)
+ static const UInt_t fgkEndOfTrackletMarker = 0x10001000; // This marks the end of tracklet data words
* provided "as is" without express or implied warranty. *
**************************************************************************/
-/* $Id: AliTRDrawOldStream.cxx 29393 2008-10-22 08:38:07Z fca $ */
+/* $Id: AliTRDrawOldStream.cxx 23562 2008-01-25 15:35:04Z cblume $ */
////////////////////////////////////////////////////////////////////////////
// //
#include "AliTRDgeometry.h"
#include "AliTRDcalibDB.h"
#include "AliTRDdigitsManager.h"
-#include "AliTRDdataArrayI.h"
-#include "AliTRDdataArrayS.h"
+#include "AliTRDarrayDictionary.h"
+#include "AliTRDarrayADC.h"
#include "AliTRDSignalIndex.h"
#include "AliTRDfeeParam.h"
// Updates the next data word pointer
//
- AliTRDdataArrayS *digits = 0;
- AliTRDdataArrayI *track0 = 0;
- AliTRDdataArrayI *track1 = 0;
- AliTRDdataArrayI *track2 = 0;
+ AliTRDarrayADC *digits = 0;
+ AliTRDarrayDictionary *track0 = 0;
+ AliTRDarrayDictionary *track1 = 0;
+ AliTRDarrayDictionary *track2 = 0;
AliTRDSignalIndex *indexes = 0;
if (fNextStatus == kStart)
{
if (GetSignals()[it] > 0)
{
- digits->SetDataUnchecked(fROW, fCOL, fTB + it, fSig[it]);
+ digits->SetData(fROW, fCOL, fTB + it, fSig[it]);
indexes->AddIndexTBin(fROW, fCOL, fTB + it);
if (man->UsesDictionaries())
{
- track0->SetDataUnchecked(fROW, fCOL, fTB + it, 0);
- track1->SetDataUnchecked(fROW, fCOL, fTB + it, 0);
- track2->SetDataUnchecked(fROW, fCOL, fTB + it, 0);
+ track0->SetData(fROW, fCOL, fTB + it, 0);
+ track1->SetData(fROW, fCOL, fTB + it, 0);
+ track2->SetData(fROW, fCOL, fTB + it, 0);
}
}
} // check the tbins range
AliDebug(4, "New DET!");
// allocate stuff for the new det
//man->ResetArrays();
- digits = (AliTRDdataArrayS *) man->GetDigits(fDET);
- track0 = (AliTRDdataArrayI *) man->GetDictionary(fDET,0);
- track1 = (AliTRDdataArrayI *) man->GetDictionary(fDET,1);
- track2 = (AliTRDdataArrayI *) man->GetDictionary(fDET,2);
+ digits = (AliTRDarrayADC *) man->GetDigits(fDET);
+ track0 = (AliTRDarrayDictionary *) man->GetDictionary(fDET,0);
+ track1 = (AliTRDarrayDictionary *) man->GetDictionary(fDET,1);
+ track2 = (AliTRDarrayDictionary *) man->GetDictionary(fDET,2);
// Allocate memory space for the digits buffer
if (digits->GetNtime() == 0)
#include "AliTRDgeometry.h"
#include "AliTRDfeeParam.h"
#include "AliTRDdigitsManager.h"
-#include "AliTRDdataArrayS.h"
-#include "AliTRDdataArrayI.h"
-#include "AliTRDdataArrayDigits.h"
+#include "AliTRDarrayDictionary.h" //mod
+#include "AliTRDarrayADC.h" //mod
#include "AliTRDSignalIndex.h"
#include "AliTRDrecoParam.h"
#include "AliTRDcalibDB.h"
//
AliTRDcalibDB *cal = AliTRDcalibDB::Instance();
- AliTRDdataArrayDigits *digits = 0;
- AliTRDdataArrayI *track0 = 0;
- AliTRDdataArrayI *track1 = 0;
- AliTRDdataArrayI *track2 = 0;
+ AliTRDarrayADC *digits = 0;
+ AliTRDarrayDictionary *track0 = 0;
+ AliTRDarrayDictionary *track1 = 0;
+ AliTRDarrayDictionary *track2 = 0;
AliTRDSignalIndex *indexes = 0;
// Loop through the digits
}
// Add a container for the digits of this detector
- digits = (AliTRDdataArrayDigits *) digitsManager->GetDigits(det);
+ digits = (AliTRDarrayADC *) digitsManager->GetDigits(det);
if (digitsManager->UsesDictionaries())
{
- track0 = (AliTRDdataArrayI *) digitsManager->GetDictionary(det,0);
- track1 = (AliTRDdataArrayI *) digitsManager->GetDictionary(det,1);
- track2 = (AliTRDdataArrayI *) digitsManager->GetDictionary(det,2);
+ track0 = (AliTRDarrayDictionary *) digitsManager->GetDictionary(det,0);
+ track1 = (AliTRDarrayDictionary *) digitsManager->GetDictionary(det,1);
+ track2 = (AliTRDarrayDictionary *) digitsManager->GetDictionary(det,2);
}
if (!digits)
{
if (GetSignals()[it] > 0)
{
- digits->SetDataUnchecked(GetRow(), GetCol(), it, GetSignals()[it]);
+ digits->SetData(GetRow(), GetCol(), it, GetSignals()[it]);
if(padStatus)
- digits->SetPadStatus(GetRow(), GetCol(), it, padStatus);
-
+ digits->SetPadStatus(GetRow(), GetCol(), it, padStatus);
+
indexes->AddIndexTBin(GetRow(), GetCol(), it);
if (digitsManager->UsesDictionaries())
{
- track0->SetDataUnchecked(GetRow(), GetCol(), it, 0);
- track1->SetDataUnchecked(GetRow(), GetCol(), it, 0);
- track2->SetDataUnchecked(GetRow(), GetCol(), it, 0);
+ track0->SetData(GetRow(), GetCol(), it, 0);
+ track1->SetData(GetRow(), GetCol(), it, 0);
+ track2->SetData(GetRow(), GetCol(), it, 0);
}
}
} // tbins
* provided "as is" without express or implied warranty. *
**************************************************************************/
+/* $Id$ */
+
///////////////////////////////////////////////////////////////////////////////
// //
// TRD trigger class //
#include "AliLoader.h"
#include "AliTRDdigitsManager.h"
-#include "AliTRDdataArrayI.h"
-#include "AliTRDdataArrayS.h"
+
+#include "AliTRDarrayDictionary.h"
+#include "AliTRDarrayADC.h"
+
#include "AliTRDgeometry.h"
#include "AliTRDcalibDB.h"
#include "AliTRDrawData.h"
Int_t nTimeTotal = AliTRDcalibDB::Instance()->GetNumberOfTimeBins();
// Get the digits
- fDigits = (AliTRDdataArrayS *) fDigitsManager->GetDigits(idet);
+ fDigits = (AliTRDarrayADC *) fDigitsManager->GetDigits(idet);
if (!fDigits) return kFALSE;
// This is to take care of switched off super modules
if (fDigits->GetNtime() == 0) {
continue;
- }
- fDigits->Expand();
- fTrack0 = (AliTRDdataArrayI *) fDigitsManager->GetDictionary(idet,0);
+ }
+ fDigits->Expand();
+ fTrack0 = (AliTRDarrayDictionary *) fDigitsManager->GetDictionary(idet,0);
if (!fTrack0) return kFALSE;
- fTrack0->Expand();
- fTrack1 = (AliTRDdataArrayI *) fDigitsManager->GetDictionary(idet,1);
+ fTrack0->Expand();
+ fTrack1 = (AliTRDarrayDictionary *) fDigitsManager->GetDictionary(idet,1);
if (!fTrack1) return kFALSE;
- fTrack1->Expand();
- fTrack2 = (AliTRDdataArrayI *) fDigitsManager->GetDictionary(idet,2);
+ fTrack1->Expand();
+ fTrack2 = (AliTRDarrayDictionary *) fDigitsManager->GetDictionary(idet,2);
if (!fTrack2) return kFALSE;
- fTrack2->Expand();
+ fTrack2->Expand();
for (Int_t iRob = 0; iRob < fNROB; iRob++) {
for (time = 0; time < nTimeTotal; time++) {
for (col = col1; col < col2; col++) {
if ((col >= 0) && (col < nColMax)) {
- amp = TMath::Abs(fDigits->GetDataUnchecked(row,col,time));
+ amp = TMath::Abs(fDigits->GetData(row,col,time));
}
else {
amp = 0.0;
}
// Compress the arrays
- fDigits->Compress(1,0);
- fTrack0->Compress(1,0);
- fTrack1->Compress(1,0);
- fTrack2->Compress(1,0);
+ fDigits->Compress();
+ fTrack0->Compress();
+ fTrack1->Compress();
+ fTrack2->Compress();
WriteTracklets(idet);
amp[2] = fMCM->GetADC(iCol+1,iTime);
// extract track contribution only from the central pad
- track[0] = fTrack0->GetDataUnchecked(row,iCol+iCol1,iTime);
- track[1] = fTrack1->GetDataUnchecked(row,iCol+iCol1,iTime);
- track[2] = fTrack2->GetDataUnchecked(row,iCol+iCol1,iTime);
+ track[0] = fTrack0->GetData(row,iCol+iCol1,iTime);
+ track[1] = fTrack1->GetData(row,iCol+iCol1,iTime);
+ track[2] = fTrack2->GetData(row,iCol+iCol1,iTime);
if (fMCM->IsCluster(iCol,iTime)) {
if (fMCM->IsCluster(iCol+1,iTime)) {
// extract track contribution only from the central pad
- track[0] = fTrack0->GetDataUnchecked(row,iCol+1+iCol1,iTime);
- track[1] = fTrack1->GetDataUnchecked(row,iCol+1+iCol1,iTime);
- track[2] = fTrack2->GetDataUnchecked(row,iCol+1+iCol1,iTime);
+ track[0] = fTrack0->GetData(row,iCol+1+iCol1,iTime);
+ track[1] = fTrack1->GetData(row,iCol+1+iCol1,iTime);
+ track[2] = fTrack2->GetData(row,iCol+1+iCol1,iTime);
fTrkTest->AddCluster(iCol+1+iCol1,iTime,amp,track);
amp[2] = fMCM->GetADC(iCol+1,iTime);
// extract track contribution only from the central pad
- track[0] = fTrack0->GetDataUnchecked(row,iCol+iCol1,iTime);
- track[1] = fTrack1->GetDataUnchecked(row,iCol+iCol1,iTime);
- track[2] = fTrack2->GetDataUnchecked(row,iCol+iCol1,iTime);
+ track[0] = fTrack0->GetData(row,iCol+iCol1,iTime);
+ track[1] = fTrack1->GetData(row,iCol+iCol1,iTime);
+ track[2] = fTrack2->GetData(row,iCol+iCol1,iTime);
if (fMCM->IsCluster(iCol,iTime)) {
if (fMCM->IsCluster(iCol+1,iTime)) {
// extract track contribution only from the central pad
- track[0] = fTrack0->GetDataUnchecked(row,iCol+1+iCol1,iTime);
- track[1] = fTrack1->GetDataUnchecked(row,iCol+1+iCol1,iTime);
- track[2] = fTrack2->GetDataUnchecked(row,iCol+1+iCol1,iTime);
+ track[0] = fTrack0->GetData(row,iCol+1+iCol1,iTime);
+ track[1] = fTrack1->GetData(row,iCol+1+iCol1,iTime);
+ track[2] = fTrack2->GetData(row,iCol+1+iCol1,iTime);
fTrk->AddCluster(iCol+1+iCol1,iTime,amp,track);
class AliTRDmcm;
class AliTRDmodule;
class AliTRDdigitsManager;
-class AliTRDdataArrayI;
-class AliTRDdataArrayS;
+class AliTRDarrayDictionary;
+class AliTRDarrayADC;
class AliTRDgeometry;
class AliTRDtrigger : public TNamed {
Int_t fNtracklets; //! Tracklets counter
- AliTRDdataArrayS *fDigits; //! Array with digits
- AliTRDdataArrayI *fTrack0; //! Track dictionary 0
- AliTRDdataArrayI *fTrack1; //! Track dictionary 1
- AliTRDdataArrayI *fTrack2; //! Track dictionary 2
+ AliTRDarrayADC *fDigits; //! Array with digits
+ AliTRDarrayDictionary *fTrack0; //! Track dictionary 0
+ AliTRDarrayDictionary *fTrack1; //! Track dictionary 1
+ AliTRDarrayDictionary *fTrack2; //! Track dictionary 2
Int_t fNPrimary; //! Number of primary tracks
AliTRDdataArrayF.cxx
AliTRDdataArrayDigits.cxx
AliTRDsegmentArray.cxx
+ AliTRDarraySignal.cxx
+ AliTRDarrayDictionary.cxx
+ AliTRDarrayADC.cxx
AliTRDSignalIndex.cxx
AliTRDgeometry.cxx
AliTRDdigit.cxx
#pragma link C++ class AliTRDdataArrayDigits+;
#pragma link C++ class AliTRDdataArrayF+;
#pragma link C++ class AliTRDSignalIndex+;
+#pragma link C++ class AliTRDarraySignal+;
+#pragma link C++ class AliTRDarrayDictionary+;
+#pragma link C++ class AliTRDarrayADC+;
#pragma link C++ class AliTRDgeometry+;
#pragma link C++ class AliTRDpadPlane+;
AliTRDdataArrayF.cxx \
AliTRDdataArrayDigits.cxx \
AliTRDsegmentArray.cxx \
+ AliTRDarraySignal.cxx \
+ AliTRDarrayDictionary.cxx \
+ AliTRDarrayADC.cxx \
AliTRDSignalIndex.cxx \
AliTRDgeometry.cxx \
AliTRDdigit.cxx \