From b65e5048d3907115b50d2f0321a8a68684c18261 Mon Sep 17 00:00:00 2001 From: cblume Date: Tue, 18 Nov 2008 18:08:05 +0000 Subject: [PATCH] Introduce new digits structures by Hermes with ZS in digitzer stage --- TRD/AliTRDQADataMaker.cxx | 47 +- TRD/AliTRDQADataMakerSim.cxx | 119 +++-- TRD/AliTRDRawStreamV2.cxx | 64 ++- TRD/AliTRDarrayADC.cxx | 528 ++++++++++++++++++++ TRD/AliTRDarrayADC.h | 57 +++ TRD/AliTRDarrayDictionary.cxx | 330 +++++++++++++ TRD/AliTRDarrayDictionary.h | 51 ++ TRD/AliTRDarraySignal.cxx | 373 ++++++++++++++ TRD/AliTRDarraySignal.h | 55 +++ TRD/AliTRDclusterizer.cxx | 261 +++++----- TRD/AliTRDclusterizer.h | 45 +- TRD/AliTRDdigitizer.cxx | 375 ++++++++------ TRD/AliTRDdigitizer.h | 19 +- TRD/AliTRDdigitsManager.cxx | 893 ++++++++++++++++++++++++---------- TRD/AliTRDdigitsManager.h | 68 +-- TRD/AliTRDmcmSim.cxx | 115 ++++- TRD/AliTRDmcmSim.h | 5 + TRD/AliTRDrawData.cxx | 104 ++-- TRD/AliTRDrawData.h | 14 +- TRD/AliTRDrawOldStream.cxx | 30 +- TRD/AliTRDrawStreamTB.cxx | 33 +- TRD/AliTRDtrigger.cxx | 60 +-- TRD/AliTRDtrigger.h | 12 +- TRD/CMake_libTRDbase.txt | 3 + TRD/TRDbaseLinkDef.h | 3 + TRD/libTRDbase.pkg | 3 + 26 files changed, 2833 insertions(+), 834 deletions(-) create mode 100644 TRD/AliTRDarrayADC.cxx create mode 100644 TRD/AliTRDarrayADC.h create mode 100644 TRD/AliTRDarrayDictionary.cxx create mode 100644 TRD/AliTRDarrayDictionary.h create mode 100644 TRD/AliTRDarraySignal.cxx create mode 100644 TRD/AliTRDarraySignal.h diff --git a/TRD/AliTRDQADataMaker.cxx b/TRD/AliTRDQADataMaker.cxx index d6b0b5a906c..9d85aa652e5 100644 --- a/TRD/AliTRDQADataMaker.cxx +++ b/TRD/AliTRDQADataMaker.cxx @@ -45,10 +45,9 @@ #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) @@ -572,12 +571,12 @@ void AliTRDQADataMaker::MakeDigits(TTree * digits) 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); @@ -588,13 +587,13 @@ void AliTRDQADataMaker::MakeDigits(TTree * digits) 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; } @@ -631,14 +630,14 @@ void AliTRDQADataMaker::MakeSDigits(TTree * digits) 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); @@ -649,15 +648,15 @@ void AliTRDQADataMaker::MakeSDigits(TTree * digits) 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; } diff --git a/TRD/AliTRDQADataMakerSim.cxx b/TRD/AliTRDQADataMakerSim.cxx index 32d480b5a0e..24f5ad80173 100644 --- a/TRD/AliTRDQADataMakerSim.cxx +++ b/TRD/AliTRDQADataMakerSim.cxx @@ -45,8 +45,8 @@ #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" @@ -262,38 +262,36 @@ void AliTRDQADataMakerSim::MakeDigits(TTree * digits) 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; - } //____________________________________________________________________________ @@ -329,39 +327,38 @@ void AliTRDQADataMakerSim::MakeSDigits(TTree * digits) 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; - } //____________________________________________________________________________ diff --git a/TRD/AliTRDRawStreamV2.cxx b/TRD/AliTRDRawStreamV2.cxx index e87552adac3..4297a64f3f5 100644 --- a/TRD/AliTRDRawStreamV2.cxx +++ b/TRD/AliTRDRawStreamV2.cxx @@ -36,8 +36,8 @@ #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) @@ -458,16 +458,16 @@ void AliTRDRawStreamV2::SwapOnEndian() // 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() @@ -1234,10 +1234,10 @@ Int_t AliTRDRawStreamV2::NextChamber(AliTRDdigitsManager *man, UInt_t** /*trackl // 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) @@ -1271,13 +1271,13 @@ Int_t AliTRDRawStreamV2::NextChamber(AliTRDdigitsManager *man, UInt_t** /*trackl { 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 @@ -1331,10 +1331,10 @@ Int_t AliTRDRawStreamV2::NextChamber(AliTRDdigitsManager *man, UInt_t** /*trackl // 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) @@ -1391,25 +1391,23 @@ Int_t AliTRDRawStreamV2::NextChamber(AliTRDdigitsManager *man, UInt_t** /*trackl 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; -} - - +} diff --git a/TRD/AliTRDarrayADC.cxx b/TRD/AliTRDarrayADC.cxx new file mode 100644 index 00000000000..bb0b3cf543c --- /dev/null +++ b/TRD/AliTRDarrayADC.cxx @@ -0,0 +1,528 @@ +/************************************************************************* +* 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 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; i0) + { + i=i+1; + } + i=i+j+(l-16001-1); + } + + //Calculate the size of the compressed array + for(Int_t i=0; i0) + { + 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=-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; i0) + { + bufferE[i]=fADC[contaexp]; + } + + if((fADC[contaexp]<0)&&(fADC[contaexp]>=-16000)) + { + for(Int_t j=0; j + +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 diff --git a/TRD/AliTRDarrayDictionary.cxx b/TRD/AliTRDarrayDictionary.cxx new file mode 100644 index 00000000000..7ee6a1db421 --- /dev/null +++ b/TRD/AliTRDarrayDictionary.cxx @@ -0,0 +1,330 @@ +/************************************************************************* +* 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=-1) + { + bufferE[i]=fDictionary[contaexp]; + } + if(fDictionary[contaexp]<-1) + { + for(Int_t j=0; j + +class AliTRDarrayDictionary: public TObject +{ + + public: + + AliTRDarrayDictionary(); + AliTRDarrayDictionary(Int_t nrow, Int_t ncol, Int_t ntime); + AliTRDarrayDictionary(const AliTRDarrayDictionary &a); + ~AliTRDarrayDictionary(); + AliTRDarrayDictionary &operator=(const AliTRDarrayDictionary &a); + + 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, Int_t value) + { fDictionary[(nrow*fNcol+ncol)*fNtime+ntime]=value; }; + Int_t GetData(Int_t nrow, Int_t ncol, Int_t ntime) const + { return fDictionary[(nrow*fNcol+ncol)*fNtime+ntime]; }; + Int_t GetDim() const {return fNDdim;}; + void Compress(); + void Expand(); + + 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 fNDdim; //Dimension of the Dictionary array + Int_t* fDictionary; //[fNDdim] //Pointer to integers array + + + ClassDef(AliTRDarrayDictionary,1) //Dictionary container class + +}; +#endif diff --git a/TRD/AliTRDarraySignal.cxx b/TRD/AliTRDarraySignal.cxx new file mode 100644 index 00000000000..be54014a82f --- /dev/null +++ b/TRD/AliTRDarraySignal.cxx @@ -0,0 +1,373 @@ +/************************************************************************* +* 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; ithreshold) + { + 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; iminval) + { + 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; i0) + { + bufferE[i]=fSignal[contaexp]; + } + if(fSignal[contaexp]<0) + { + for(Int_t j=0; j + +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 diff --git a/TRD/AliTRDclusterizer.cxx b/TRD/AliTRDclusterizer.cxx index ce5f4f30e0b..5adf95774cc 100644 --- a/TRD/AliTRDclusterizer.cxx +++ b/TRD/AliTRDclusterizer.cxx @@ -38,10 +38,9 @@ #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" @@ -561,7 +560,7 @@ Bool_t AliTRDclusterizer::MakeClusters() 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(); @@ -574,8 +573,8 @@ Bool_t AliTRDclusterizer::MakeClusters() 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(); } } @@ -708,7 +707,7 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det) // 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()) @@ -768,11 +767,10 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det) // 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); @@ -801,20 +799,20 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t 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; @@ -825,7 +823,7 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det) 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); @@ -836,51 +834,57 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det) 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 @@ -893,11 +897,11 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det) 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 @@ -905,14 +909,14 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det) 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; @@ -922,16 +926,16 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det) // 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; } } @@ -946,11 +950,11 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det) } // 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 @@ -975,16 +979,16 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det) 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); } @@ -997,7 +1001,7 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det) (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 @@ -1032,32 +1036,32 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det) 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 @@ -1113,25 +1117,25 @@ Bool_t AliTRDclusterizer::AddLabels(Int_t idet, Int_t firstClusterROC, Int_t nCl // 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; } } @@ -1241,14 +1245,14 @@ Double_t AliTRDclusterizer::Unfold(Double_t eps, Int_t layer, Double_t *padSigna } //_____________________________________________________________________________ -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: @@ -1270,33 +1274,34 @@ void AliTRDclusterizer::TailCancelation(AliTRDdataArrayDigits *digitsIn 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 @@ -1309,7 +1314,7 @@ void AliTRDclusterizer::TailCancelation(AliTRDdataArrayDigits *digitsIn //_____________________________________________________________________________ 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 diff --git a/TRD/AliTRDclusterizer.h b/TRD/AliTRDclusterizer.h index c432ac21256..b356c7359f8 100644 --- a/TRD/AliTRDclusterizer.h +++ b/TRD/AliTRDclusterizer.h @@ -22,17 +22,20 @@ class AliRawReader; 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) @@ -76,34 +79,34 @@ public: 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 diff --git a/TRD/AliTRDdigitizer.cxx b/TRD/AliTRDdigitizer.cxx index 9d2070296d5..062dacad01d 100644 --- a/TRD/AliTRDdigitizer.cxx +++ b/TRD/AliTRDdigitizer.cxx @@ -32,6 +32,7 @@ // - Electronics noise // // - Electronics gain // // - Digitization // +// - Zero suppression // // // //////////////////////////////////////////////////////////////////////////// @@ -45,7 +46,6 @@ #include #include #include - #include "AliRun.h" #include "AliRunLoader.h" #include "AliLoader.h" @@ -55,14 +55,13 @@ #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" @@ -70,7 +69,7 @@ #include "AliTRDSimParam.h" #include "AliTRDCommonParam.h" #include "AliTRDfeeParam.h" - +#include "AliTRDmcmSim.h" #include "Cal/AliTRDCalROC.h" #include "Cal/AliTRDCalDet.h" @@ -223,6 +222,7 @@ Bool_t AliTRDdigitizer::Init() fTRD = 0; fGeo = 0; + fEvent = 0; fMasks = 0; fCompress = kTRUE; @@ -276,7 +276,7 @@ AliTRDdigitizer::AliTRDdigitizer(const AliTRDdigitizer &d) // 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) { @@ -298,7 +298,7 @@ AliTRDdigitizer::~AliTRDdigitizer() fDigitsManager = 0; } - if (fDigitsManager) { + if (fDigitsManager) { //typo? fSDigitsManager? delete fSDigitsManager; fSDigitsManager = 0; } @@ -480,11 +480,13 @@ void AliTRDdigitizer::Exec(Option_t *option) 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); @@ -677,7 +679,6 @@ Bool_t AliTRDdigitizer::InitDetector() return kTRUE; } - //_____________________________________________________________________________ Bool_t AliTRDdigitizer::MakeBranch(TTree *tree) const { @@ -736,7 +737,7 @@ Bool_t AliTRDdigitizer::MakeDigits() 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)) { @@ -749,21 +750,21 @@ Bool_t AliTRDdigitizer::MakeDigits() // 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 @@ -893,7 +894,7 @@ Bool_t AliTRDdigitizer::SortHits(Float_t **hits, Int_t *nhit) //_____________________________________________________________________________ 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 @@ -925,7 +926,7 @@ Bool_t AliTRDdigitizer::ConvertHits(Int_t det, Float_t *hits, Int_t nhit Double_t padSignal[kNpad]; Double_t signalOld[kNpad]; - AliTRDdataArrayI *dictionary[kNdict]; + AliTRDarrayDictionary *dictionary[kNdict]; AliTRDSimParam *simParam = AliTRDSimParam::Instance(); AliTRDCommonParam *commonParam = AliTRDCommonParam::Instance(); @@ -962,7 +963,7 @@ Bool_t AliTRDdigitizer::ConvertHits(Int_t det, Float_t *hits, Int_t nhit 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(); @@ -972,7 +973,7 @@ Bool_t AliTRDdigitizer::ConvertHits(Int_t det, Float_t *hits, Int_t nhit // 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); } @@ -1101,7 +1102,7 @@ Bool_t AliTRDdigitizer::ConvertHits(Int_t det, Float_t *hits, Int_t nhit 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); @@ -1190,7 +1191,7 @@ Bool_t AliTRDdigitizer::ConvertHits(Int_t det, Float_t *hits, Int_t nhit 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 @@ -1203,20 +1204,19 @@ Bool_t AliTRDdigitizer::ConvertHits(Int_t det, Float_t *hits, Int_t nhit * 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; + } } } @@ -1235,7 +1235,7 @@ Bool_t AliTRDdigitizer::ConvertHits(Int_t det, Float_t *hits, Int_t nhit } //_____________________________________________________________________________ -Bool_t AliTRDdigitizer::ConvertSignals(Int_t det, AliTRDdataArrayF *signals) +Bool_t AliTRDdigitizer::ConvertSignals(Int_t det, AliTRDarraySignal *signals) { // // Convert signals to digits @@ -1257,14 +1257,14 @@ Bool_t AliTRDdigitizer::ConvertSignals(Int_t det, AliTRDdataArrayF *signals) } // 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 @@ -1316,7 +1316,7 @@ Bool_t AliTRDdigitizer::Signal2ADC(Int_t det, AliTRDdataArrayF *signals) 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)); @@ -1324,7 +1324,7 @@ Bool_t AliTRDdigitizer::Signal2ADC(Int_t det, AliTRDdataArrayF *signals) } if (signals->HasData()) { // Expand the container if neccessary - signals->Expand(); + signals->Expand(); } else { // Create missing containers @@ -1336,7 +1336,8 @@ Bool_t AliTRDdigitizer::Signal2ADC(Int_t det, AliTRDdataArrayF *signals) 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); @@ -1366,7 +1367,7 @@ Bool_t AliTRDdigitizer::Signal2ADC(Int_t det, AliTRDdataArrayF *signals) 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 @@ -1391,23 +1392,23 @@ Bool_t AliTRDdigitizer::Signal2ADC(Int_t det, AliTRDdataArrayF *signals) 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 @@ -1430,11 +1431,13 @@ Bool_t AliTRDdigitizer::Signal2SDigits(Int_t det, AliTRDdataArrayF *signals) 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); @@ -1444,14 +1447,11 @@ Bool_t AliTRDdigitizer::Signal2SDigits(Int_t det, AliTRDdataArrayF *signals) 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; } @@ -1499,12 +1499,12 @@ Bool_t AliTRDdigitizer::MergeSDigits() 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) { @@ -1513,8 +1513,7 @@ Bool_t AliTRDdigitizer::MergeSDigits() } // 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())); @@ -1522,68 +1521,69 @@ Bool_t AliTRDdigitizer::MergeSDigits() 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 @@ -1594,22 +1594,21 @@ Bool_t AliTRDdigitizer::MergeSDigits() 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; } @@ -1621,7 +1620,7 @@ Bool_t AliTRDdigitizer::ConvertSDigits() // Converts s-digits to normal digits // - AliTRDdataArrayF *digitsIn = 0x0; + AliTRDarraySignal *digitsIn = 0x0; if (!fSDigitsManager->HasSDigits()) { AliError("No s-digits in digits manager"); @@ -1632,7 +1631,7 @@ Bool_t AliTRDdigitizer::ConvertSDigits() 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; @@ -1678,8 +1677,8 @@ Bool_t AliTRDdigitizer::CopyDictionary(Int_t det) 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(); @@ -1692,24 +1691,22 @@ Bool_t AliTRDdigitizer::CopyDictionary(Int_t det) 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; } @@ -1722,18 +1719,25 @@ void AliTRDdigitizer::CompressOutputArrays(Int_t det) // 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(); } } @@ -1793,7 +1797,6 @@ void AliTRDdigitizer::InitOutput(Int_t iEvent) tree = loader->TreeD(); } } - fDigitsManager->SetEvent(iEvent); fDigitsManager->MakeBranch(tree); @@ -2651,49 +2654,51 @@ void AliTRDdigitizer::RecalcDiffusion(Float_t vdrift) 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()) { @@ -2702,8 +2707,9 @@ void AliTRDdigitizer::RecalcDiffusion(Float_t vdrift) else { fLorentzFactor = 1.0; } - + } + else if (simParam->IsArgon()) { // Diffusion constants and Lorentz angle only for B = 0.5T @@ -2801,3 +2807,80 @@ Int_t AliTRDdigitizer::ExB(Float_t vdrift, Double_t driftlength, Double_t &lCol) 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;rowSetData(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;rowSetData(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; irowGetData(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; + +} diff --git a/TRD/AliTRDdigitizer.h b/TRD/AliTRDdigitizer.h index 036d019e7d9..1aebd80d4c4 100644 --- a/TRD/AliTRDdigitizer.h +++ b/TRD/AliTRDdigitizer.h @@ -22,8 +22,8 @@ class AliRunLoader; class AliTRD; class AliTRDdigitsManager; class AliTRDgeometry; -class AliTRDdataArrayF; -class AliTRDsegmentArray; +class AliTRDarraySignal; +class AliTRDarrayADC; class AliTRDdigitizer : public AliDigitizer { @@ -53,17 +53,17 @@ 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; } @@ -84,7 +84,8 @@ class AliTRDdigitizer : public AliDigitizer { 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(); @@ -116,7 +117,7 @@ class AliTRDdigitizer : public AliDigitizer { 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 diff --git a/TRD/AliTRDdigitsManager.cxx b/TRD/AliTRDdigitsManager.cxx index e33dd16637c..898d5046ef7 100644 --- a/TRD/AliTRDdigitsManager.cxx +++ b/TRD/AliTRDdigitsManager.cxx @@ -18,28 +18,22 @@ /////////////////////////////////////////////////////////////////////////////// // // // Manages the digits and the track dictionary in the form of // -// AliTRDdataArray objects. // +// TObjArray objects // // // /////////////////////////////////////////////////////////////////////////////// -#include - +#include #include #include #include - #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) @@ -54,18 +48,21 @@ AliTRDdigitsManager::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()); @@ -76,10 +73,12 @@ AliTRDdigitsManager::AliTRDdigitsManager(const AliTRDdigitsManager &m) :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 @@ -94,23 +93,26 @@ AliTRDdigitsManager::~AliTRDdigitsManager() // 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; + } } @@ -121,9 +123,10 @@ AliTRDdigitsManager &AliTRDdigitsManager::operator=(const AliTRDdigitsManager &m // Assignment operator // - if (this != &m) { - ((AliTRDdigitsManager &) m).Copy(*this); - } + if (this != &m) + { + ((AliTRDdigitsManager &) m).Copy(*this); + } return *this; @@ -138,7 +141,11 @@ void AliTRDdigitsManager::Copy(TObject &m) const ((AliTRDdigitsManager &) m).fEvent = fEvent; ((AliTRDdigitsManager &) m).fHasSDigits = fHasSDigits; - + ((AliTRDdigitsManager &) m).fDigits = fDigits; + for(Int_t i=0; iDelete(); + 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()); + } } @@ -180,125 +229,187 @@ void AliTRDdigitsManager::ResetArrays() // 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; } @@ -312,29 +423,34 @@ Bool_t AliTRDdigitsManager::ReadDigits(TTree *tree) 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; @@ -347,39 +463,46 @@ Bool_t AliTRDdigitsManager::WriteDigits() // 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; @@ -387,7 +510,7 @@ AliTRDdigit *AliTRDdigitsManager::GetDigit(Int_t row, Int_t col 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)); @@ -395,69 +518,108 @@ AliTRDdigit *AliTRDdigitsManager::GetDigit(Int_t row, Int_t col //_____________________________________________________________________________ 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); @@ -477,11 +639,14 @@ AliTRDSignalIndex *AliTRDdigitsManager::GetIndexes(Int_t 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); + } } @@ -492,13 +657,18 @@ void AliTRDdigitsManager::RemoveDictionaries(Int_t 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); + } + } } @@ -520,55 +690,272 @@ Bool_t AliTRDdigitsManager::BuildIndexes(Int_t 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 of + // the digits 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 of + // the dictionary 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 of + // the digits 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 of + // the dictionary 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; } diff --git a/TRD/AliTRDdigitsManager.h b/TRD/AliTRDdigitsManager.h index 658d94925e0..10db6a90b19 100644 --- a/TRD/AliTRDdigitsManager.h +++ b/TRD/AliTRDdigitsManager.h @@ -14,12 +14,12 @@ 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 { @@ -50,44 +50,46 @@ 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 diff --git a/TRD/AliTRDmcmSim.cxx b/TRD/AliTRDmcmSim.cxx index b096c82b3aa..39b1eb25570 100644 --- a/TRD/AliTRDmcmSim.cxx +++ b/TRD/AliTRDmcmSim.cxx @@ -102,7 +102,7 @@ The default raw version is 2. #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" @@ -2622,4 +2622,117 @@ void AliTRDmcmSim::Tracklet(){ // 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); + } + } + } +} + diff --git a/TRD/AliTRDmcmSim.h b/TRD/AliTRDmcmSim.h index b55283c9ca8..9399cf96579 100644 --- a/TRD/AliTRDmcmSim.h +++ b/TRD/AliTRDmcmSim.h @@ -19,6 +19,7 @@ class AliTRDcalibDB; class AliTRDgeometry; class AliTRDtrapAlu; class AliTRDpadPlane; +class AliTRDarrayADC; class AliTRDmcmSim : public TObject { @@ -54,6 +55,10 @@ 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: diff --git a/TRD/AliTRDrawData.cxx b/TRD/AliTRDrawData.cxx index ca9b8afc222..f24638d0ad0 100644 --- a/TRD/AliTRDrawData.cxx +++ b/TRD/AliTRDrawData.cxx @@ -33,8 +33,8 @@ #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" @@ -199,7 +199,7 @@ Bool_t AliTRDrawData::Digits2Raw(AliTRDdigitsManager *digitsManager) 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(); @@ -314,7 +314,7 @@ void AliTRDrawData::ProduceSMIndexData(UInt_t *buf, Int_t& nw){ } //_____________________________________________________________________________ -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 // @@ -368,7 +368,7 @@ Int_t AliTRDrawData::ProduceHcData(AliTRDdataArrayS *digits, Int_t side, Int_t d 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 @@ -377,8 +377,10 @@ Int_t AliTRDrawData::ProduceHcData(AliTRDdataArrayS *digits, Int_t side, Int_t d } // 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(); @@ -456,7 +458,7 @@ Int_t AliTRDrawData::ProduceHcData(AliTRDdataArrayS *digits, Int_t side, Int_t d //_____________________________________________________________________________ -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) { // @@ -590,9 +592,9 @@ Int_t AliTRDrawData::ProduceHcDataV1andV2(AliTRDdataArrayS *digits, Int_t side // 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?) @@ -642,8 +644,8 @@ Int_t AliTRDrawData::ProduceHcDataV1andV2(AliTRDdataArrayS *digits, Int_t side //_____________________________________________________________________________ -//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) @@ -709,7 +711,7 @@ Int_t AliTRDrawData::ProduceHcDataV3(AliTRDdataArrayS *digits, Int_t side , Int_ 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 @@ -718,8 +720,10 @@ Int_t AliTRDrawData::ProduceHcDataV3(AliTRDdataArrayS *digits, Int_t side , Int_ } // 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(); @@ -810,10 +814,10 @@ AliTRDdigitsManager *AliTRDrawData::Raw2Digits(AliRawReader *rawReader) // 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 @@ -840,15 +844,15 @@ AliTRDdigitsManager *AliTRDrawData::Raw2Digits(AliRawReader *rawReader) 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(); } } @@ -974,10 +978,10 @@ AliTRDdigitsManager *AliTRDrawData::Raw2DigitsOLD(AliRawReader *rawReader) // 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 @@ -1003,16 +1007,16 @@ AliTRDdigitsManager *AliTRDrawData::Raw2DigitsOLD(AliRawReader *rawReader) 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) @@ -1039,26 +1043,22 @@ AliTRDdigitsManager *AliTRDrawData::Raw2DigitsOLD(AliRawReader *rawReader) { 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; diff --git a/TRD/AliTRDrawData.h b/TRD/AliTRDrawData.h index b1bbfe46563..fe8bb14e473 100644 --- a/TRD/AliTRDrawData.h +++ b/TRD/AliTRDrawData.h @@ -20,7 +20,7 @@ class AliRawReader; class AliTRDdigitsManager; class AliTRDgeometry; class AliTRDfeeParam; -class AliTRDdataArrayS; +class AliTRDarrayADC; class AliTRDrawData : public TObject { @@ -47,10 +47,10 @@ 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 @@ -63,8 +63,8 @@ class AliTRDrawData : public TObject { 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 diff --git a/TRD/AliTRDrawOldStream.cxx b/TRD/AliTRDrawOldStream.cxx index 1e852bfb657..34361460f01 100644 --- a/TRD/AliTRDrawOldStream.cxx +++ b/TRD/AliTRDrawOldStream.cxx @@ -13,7 +13,7 @@ * 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 $ */ //////////////////////////////////////////////////////////////////////////// // // @@ -36,8 +36,8 @@ #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" @@ -631,10 +631,10 @@ Int_t AliTRDrawOldStream::NextChamber(AliTRDdigitsManager *man, UInt_t** /*track // 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) @@ -711,13 +711,13 @@ Int_t AliTRDrawOldStream::NextChamber(AliTRDdigitsManager *man, UInt_t** /*track { 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 @@ -813,10 +813,10 @@ Int_t AliTRDrawOldStream::NextChamber(AliTRDdigitsManager *man, UInt_t** /*track 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) diff --git a/TRD/AliTRDrawStreamTB.cxx b/TRD/AliTRDrawStreamTB.cxx index fa1e08826e1..2d5a3a2daea 100644 --- a/TRD/AliTRDrawStreamTB.cxx +++ b/TRD/AliTRDrawStreamTB.cxx @@ -36,9 +36,8 @@ #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" @@ -741,10 +740,10 @@ AliTRDrawStreamTB::NextChamber(AliTRDdigitsManager *digitsManager, UInt_t **trac // 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 @@ -809,13 +808,13 @@ AliTRDrawStreamTB::NextChamber(AliTRDdigitsManager *digitsManager, UInt_t **trac } // 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) @@ -863,16 +862,16 @@ AliTRDrawStreamTB::NextChamber(AliTRDdigitsManager *digitsManager, UInt_t **trac { 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 diff --git a/TRD/AliTRDtrigger.cxx b/TRD/AliTRDtrigger.cxx index c1d3de90a28..5112b452da7 100644 --- a/TRD/AliTRDtrigger.cxx +++ b/TRD/AliTRDtrigger.cxx @@ -13,6 +13,8 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ +/* $Id$ */ + /////////////////////////////////////////////////////////////////////////////// // // // TRD trigger class // @@ -33,8 +35,10 @@ #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" @@ -431,22 +435,22 @@ Bool_t AliTRDtrigger::MakeTracklets(Bool_t makeTracks) 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++) { @@ -470,7 +474,7 @@ Bool_t AliTRDtrigger::MakeTracklets(Bool_t makeTracks) 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; @@ -508,10 +512,10 @@ Bool_t AliTRDtrigger::MakeTracklets(Bool_t makeTracks) } // 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); @@ -615,9 +619,9 @@ Bool_t AliTRDtrigger::TestTracklet(Int_t det, Int_t row, Int_t seed, Int_t n) 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)) { @@ -633,9 +637,9 @@ Bool_t AliTRDtrigger::TestTracklet(Int_t det, Int_t row, Int_t seed, Int_t n) 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); @@ -688,9 +692,9 @@ void AliTRDtrigger::AddTracklet(Int_t det, Int_t row, Int_t seed, Int_t n) 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)) { @@ -706,9 +710,9 @@ void AliTRDtrigger::AddTracklet(Int_t det, Int_t row, Int_t seed, Int_t n) 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); diff --git a/TRD/AliTRDtrigger.h b/TRD/AliTRDtrigger.h index c7b71a81e15..effb0c2975d 100644 --- a/TRD/AliTRDtrigger.h +++ b/TRD/AliTRDtrigger.h @@ -25,8 +25,8 @@ class AliTRDgtuTrack; class AliTRDmcm; class AliTRDmodule; class AliTRDdigitsManager; -class AliTRDdataArrayI; -class AliTRDdataArrayS; +class AliTRDarrayDictionary; +class AliTRDarrayADC; class AliTRDgeometry; class AliTRDtrigger : public TNamed { @@ -86,10 +86,10 @@ 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 diff --git a/TRD/CMake_libTRDbase.txt b/TRD/CMake_libTRDbase.txt index 0f32f99114d..c4a3d5d44e8 100644 --- a/TRD/CMake_libTRDbase.txt +++ b/TRD/CMake_libTRDbase.txt @@ -11,6 +11,9 @@ set(SRCS AliTRDdataArrayF.cxx AliTRDdataArrayDigits.cxx AliTRDsegmentArray.cxx + AliTRDarraySignal.cxx + AliTRDarrayDictionary.cxx + AliTRDarrayADC.cxx AliTRDSignalIndex.cxx AliTRDgeometry.cxx AliTRDdigit.cxx diff --git a/TRD/TRDbaseLinkDef.h b/TRD/TRDbaseLinkDef.h index 4598a8b427e..79318312b4a 100644 --- a/TRD/TRDbaseLinkDef.h +++ b/TRD/TRDbaseLinkDef.h @@ -21,6 +21,9 @@ #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+; diff --git a/TRD/libTRDbase.pkg b/TRD/libTRDbase.pkg index 0ff507bbe48..0851b92482c 100644 --- a/TRD/libTRDbase.pkg +++ b/TRD/libTRDbase.pkg @@ -10,6 +10,9 @@ SRCS= AliTRDarrayI.cxx \ AliTRDdataArrayF.cxx \ AliTRDdataArrayDigits.cxx \ AliTRDsegmentArray.cxx \ + AliTRDarraySignal.cxx \ + AliTRDarrayDictionary.cxx \ + AliTRDarrayADC.cxx \ AliTRDSignalIndex.cxx \ AliTRDgeometry.cxx \ AliTRDdigit.cxx \ -- 2.39.3