From dfbb4bb92ed662dc13b0f8ab7f32fe80068b55dd Mon Sep 17 00:00:00 2001 From: cblume Date: Fri, 25 Jan 2008 15:35:04 +0000 Subject: [PATCH] Introduction of raw stream base class --- TRD/AliTRDRawStream.cxx | 13 +- TRD/AliTRDRawStream.h | 8 +- TRD/AliTRDRawStreamV2.cxx | 13 +- TRD/AliTRDRawStreamV2.h | 8 +- TRD/AliTRDclusterizer.cxx | 260 +++++++++++++++++++----------------- TRD/AliTRDrawData.cxx | 55 ++++++++ TRD/AliTRDrawData.h | 1 + TRD/AliTRDrawStreamBase.cxx | 161 ++++++++++++++++++++++ TRD/AliTRDrawStreamBase.h | 133 ++++++++++++++++++ TRD/AliTRDrawStreamTB.cxx | 12 +- TRD/AliTRDrawStreamTB.h | 13 +- TRD/TRDbaseLinkDef.h | 1 + TRD/libTRDbase.pkg | 1 + 13 files changed, 528 insertions(+), 151 deletions(-) create mode 100644 TRD/AliTRDrawStreamBase.cxx create mode 100644 TRD/AliTRDrawStreamBase.h diff --git a/TRD/AliTRDRawStream.cxx b/TRD/AliTRDRawStream.cxx index 3e1b495feb2..5ea06d4cdb6 100644 --- a/TRD/AliTRDRawStream.cxx +++ b/TRD/AliTRDRawStream.cxx @@ -45,7 +45,8 @@ ClassImp(AliTRDRawStream) //_____________________________________________________________________________ AliTRDRawStream::AliTRDRawStream() - :TObject() + :AliTRDrawStreamBase() +// :TObject() ,fGeo(NULL) ,fSig() ,fADC(0) @@ -124,7 +125,8 @@ AliTRDRawStream::AliTRDRawStream() //_____________________________________________________________________________ AliTRDRawStream::AliTRDRawStream(AliRawReader *rawReader) - :TObject() + :AliTRDrawStreamBase(rawReader) +// :TObject() ,fGeo(NULL) ,fSig() ,fADC(0) @@ -205,7 +207,8 @@ AliTRDRawStream::AliTRDRawStream(AliRawReader *rawReader) //_____________________________________________________________________________ AliTRDRawStream::AliTRDRawStream(const AliTRDRawStream& stream) - :TObject(stream) + :AliTRDrawStreamBase(stream) +// :TObject() ,fGeo(NULL) ,fSig() ,fADC(-1) @@ -337,7 +340,7 @@ Bool_t AliTRDRawStream::SetRawVersion(Int_t rv) } //____________________________________________________________________________ -Int_t AliTRDRawStream::Init() +Bool_t AliTRDRawStream::Init() { // // Initialization @@ -345,7 +348,7 @@ Int_t AliTRDRawStream::Init() if (!AliTRDcalibDB::Instance()) { AliError("Could not get calibration object"); - return 0; + return kFALSE; } if (!fGeo) { diff --git a/TRD/AliTRDRawStream.h b/TRD/AliTRDRawStream.h index 83e9356d321..9d0164c77f8 100644 --- a/TRD/AliTRDRawStream.h +++ b/TRD/AliTRDRawStream.h @@ -12,6 +12,7 @@ //////////////////////////////////////////////////////////////////////////// #include +#include "AliTRDrawStreamBase.h" class AliRawReader; @@ -23,7 +24,8 @@ const UInt_t kEndoftrackletmarker = 0xAAAAAAAA; /*This marks the end of tracklet const UInt_t kEndofrawdatamarker = 0x00000000; /*This marks the end of half-chamber-data*/ const UInt_t kSizeWord = sizeof(UInt_t); -class AliTRDRawStream: public TObject { +//class AliTRDRawStream: public TObject { +class AliTRDRawStream: public AliTRDrawStreamBase { public : @@ -33,7 +35,7 @@ class AliTRDRawStream: public TObject { virtual Bool_t Next(); // Read the next data virtual Int_t NextChamber(AliTRDdigitsManager *man); // Read next chamber data - virtual Int_t Init(); // Init for the fRawVersion > 1 + virtual Bool_t Init(); // Init for the fRawVersion > 1 enum { kDDLOffset = 0x400 }; // Offset for DDL numbers @@ -57,7 +59,7 @@ class AliTRDRawStream: public TObject { Bool_t IsGTULinkActive(Int_t sm, Int_t la, Int_t sta, Int_t side) { return ( ((fGTUlinkMask[sm][sta]) >> (2*la+side)) & 0x1 ); }; - Int_t *GetSignals() { return fSig; } // Signals in the three time bins from Data Word + Int_t *GetSignals() const { return (Int_t*)fSig; } // Signals in the three time bins from Data Word Int_t GetADC() const { return fADC; } // MCM ADC channel and Time Bin of word 1 Int_t GetTimeBin() const { return fTB - 3; } // MCM ADC channel and Time Bin of word 1 Int_t GetEventNumber() const { return fEv; } // MCM Event number and position of current MCM diff --git a/TRD/AliTRDRawStreamV2.cxx b/TRD/AliTRDRawStreamV2.cxx index c4274ab0596..e1621e439c4 100644 --- a/TRD/AliTRDRawStreamV2.cxx +++ b/TRD/AliTRDRawStreamV2.cxx @@ -44,7 +44,8 @@ ClassImp(AliTRDRawStreamV2) //_____________________________________________________________________________ AliTRDRawStreamV2::AliTRDRawStreamV2() - :TObject() + :AliTRDrawStreamBase() +// :TObject() ,fGeo(NULL) ,fSig() ,fADC(0) @@ -131,7 +132,8 @@ AliTRDRawStreamV2::AliTRDRawStreamV2() //_____________________________________________________________________________ AliTRDRawStreamV2::AliTRDRawStreamV2(AliRawReader *rawReader) - :TObject() + :AliTRDrawStreamBase(rawReader) +// :TObject() ,fGeo(NULL) ,fADC(0) ,fTB(0) @@ -219,7 +221,8 @@ AliTRDRawStreamV2::AliTRDRawStreamV2(AliRawReader *rawReader) //_____________________________________________________________________________ AliTRDRawStreamV2::AliTRDRawStreamV2(const AliTRDRawStreamV2& stream) - :TObject(stream) + :AliTRDrawStreamBase(stream) +// :TObject() ,fGeo(NULL) ,fSig() ,fADC(-1) @@ -358,7 +361,7 @@ Bool_t AliTRDRawStreamV2::SetRawVersion(Int_t rv) } //____________________________________________________________________________ -Int_t AliTRDRawStreamV2::Init() +Bool_t AliTRDRawStreamV2::Init() { // // Initialization @@ -366,7 +369,7 @@ Int_t AliTRDRawStreamV2::Init() if (!AliTRDcalibDB::Instance()) { AliError("Could not get calibration object"); - return 0; + return kFALSE; } if (!fGeo) { diff --git a/TRD/AliTRDRawStreamV2.h b/TRD/AliTRDRawStreamV2.h index 5c9ec027a65..1f67e3d3c69 100644 --- a/TRD/AliTRDRawStreamV2.h +++ b/TRD/AliTRDRawStreamV2.h @@ -12,12 +12,14 @@ /////////////////////////////////////////////////////////////////////////////// #include +#include "AliTRDrawStreamBase.h" class AliTRDgeometry; class AliRawReader; class AliTRDdigitsManager; -class AliTRDRawStreamV2: public TObject { +//class AliTRDRawStreamV2: public TObject { +class AliTRDRawStreamV2 : public AliTRDrawStreamBase { public : @@ -27,7 +29,7 @@ class AliTRDRawStreamV2: public TObject { virtual Bool_t Next(); // Read the next data virtual Int_t NextChamber(AliTRDdigitsManager *man); // Read next chamber data - virtual Int_t Init(); // Init for the fRawVersion > 1 + virtual Bool_t Init(); // Init for the fRawVersion > 1 enum { kDDLOffset = 0x400 }; // Offset for DDL numbers @@ -51,7 +53,7 @@ class AliTRDRawStreamV2: public TObject { Bool_t IsGTULinkActive(Int_t sm, Int_t la, Int_t sta, Int_t side) { return ( ((fGTUlinkMask[sm][sta]) >> (2*la+side)) & 0x1 ); }; - Int_t *GetSignals() { return fSig; } // Signals in the three time bins from Data Word + Int_t *GetSignals() const { return (Int_t*)fSig; } // Signals in the three time bins from Data Word Int_t GetADC() const { return fADC; } // MCM ADC channel and Time Bin of word 1 Int_t GetTimeBin() const { return fTB - 3; } // MCM ADC channel and Time Bin of word 1 Int_t GetEventNumber() const { return fEv; } // MCM Event number and position of current MCM on TRD chamber diff --git a/TRD/AliTRDclusterizer.cxx b/TRD/AliTRDclusterizer.cxx index 8c517eb1e94..c9744aa04ff 100644 --- a/TRD/AliTRDclusterizer.cxx +++ b/TRD/AliTRDclusterizer.cxx @@ -48,8 +48,9 @@ #include "AliTRDCommonParam.h" #include "AliTRDtransform.h" #include "AliTRDSignalIndex.h" -#include "AliTRDRawStream.h" -#include "AliTRDRawStreamV2.h" +#include "AliTRDrawStreamBase.h" +// #include "AliTRDRawStream.h" +// #include "AliTRDRawStreamV2.h" #include "AliTRDfeeParam.h" #include "Cal/AliTRDCalROC.h" @@ -68,7 +69,7 @@ AliTRDclusterizer::AliTRDclusterizer() ,fRawVersion(2) ,fIndexesOut(NULL) ,fIndexesMaxima(NULL) - ,fTransform(NULL) + ,fTransform(new AliTRDtransform(0)) { // // AliTRDclusterizer default constructor @@ -509,136 +510,138 @@ Bool_t AliTRDclusterizer::Raw2Clusters(AliRawReader *rawReader) // Creates clusters from raw data // - AliTRDdataArrayS *digits = 0; - AliTRDdataArrayI *track0 = 0; - AliTRDdataArrayI *track1 = 0; - AliTRDdataArrayI *track2 = 0; +// AliTRDdataArrayS *digits = 0; +// AliTRDdataArrayI *track0 = 0; +// AliTRDdataArrayI *track1 = 0; +// AliTRDdataArrayI *track2 = 0; - AliTRDSignalIndex *indexes = 0; +// AliTRDSignalIndex *indexes = 0; - // Create the digits manager - if (!fDigitsManager) - { - fDigitsManager = new AliTRDdigitsManager(); - fDigitsManager->CreateArrays(); - } +// // Create the digits manager +// if (!fDigitsManager) +// { +// fDigitsManager = new AliTRDdigitsManager(); +// fDigitsManager->CreateArrays(); +// } - AliTRDRawStreamV2 input(rawReader); - input.SetRawVersion( fRawVersion ); - input.Init(); +// // AliTRDRawStreamV2 input(rawReader); +// // input.SetRawVersion( fRawVersion ); +// // input.Init(); +// AliTRDrawStreamBase &input = *AliTRDrawStreamBase::GetRawStream(rawReader); - AliInfo(Form("Stream version: %s", input.IsA()->GetName())); +// AliInfo(Form("Stream version: %s", input.IsA()->GetName())); - // Loop through the digits - Int_t lastdet = -1; - Int_t det = 0; - Int_t it = 0; - while (input.Next()) - { +// // Loop through the digits +// Int_t lastdet = -1; +// Int_t det = 0; +// Int_t it = 0; +// while (input.Next()) +// { - det = input.GetDet(); +// det = input.GetDet(); - if (det != lastdet) - { +// if (det != lastdet) +// { - if (lastdet != -1) - { - digits = (AliTRDdataArrayS *) fDigitsManager->GetDigits(lastdet); - Bool_t iclusterBranch = kFALSE; - if (indexes->HasEntry()) - iclusterBranch = MakeClusters(lastdet); - if (iclusterBranch == kFALSE) - { - WriteClusters(lastdet); - ResetRecPoints(); - } - } - - if (digits) - { - fDigitsManager->RemoveDigits(lastdet); - fDigitsManager->RemoveDictionaries(lastdet); - fDigitsManager->ClearIndexes(lastdet); - } - - lastdet = det; - - // Add a container for the digits of this detector - digits = (AliTRDdataArrayS *) fDigitsManager->GetDigits(det); - track0 = (AliTRDdataArrayI *) fDigitsManager->GetDictionary(det,0); - track1 = (AliTRDdataArrayI *) fDigitsManager->GetDictionary(det,1); - track2 = (AliTRDdataArrayI *) fDigitsManager->GetDictionary(det,2); - - // Allocate memory space for the digits buffer - if (!digits->HasData()) - { - //AliDebug(5, Form("Alloc digits for det %d", det)); - digits->Allocate(input.GetMaxRow(),input.GetMaxCol(), input.GetNumberOfTimeBins()); - track0->Allocate(input.GetMaxRow(),input.GetMaxCol(), input.GetNumberOfTimeBins()); - track1->Allocate(input.GetMaxRow(),input.GetMaxCol(), input.GetNumberOfTimeBins()); - track2->Allocate(input.GetMaxRow(),input.GetMaxCol(), input.GetNumberOfTimeBins()); - } +// if (lastdet != -1) +// { +// digits = (AliTRDdataArrayS *) fDigitsManager->GetDigits(lastdet); +// Bool_t iclusterBranch = kFALSE; +// if (indexes->HasEntry()) +// iclusterBranch = MakeClusters(lastdet); +// if (iclusterBranch == kFALSE) +// { +// WriteClusters(lastdet); +// ResetRecPoints(); +// } +// } + +// if (digits) +// { +// fDigitsManager->RemoveDigits(lastdet); +// fDigitsManager->RemoveDictionaries(lastdet); +// fDigitsManager->ClearIndexes(lastdet); +// } + +// lastdet = det; + +// // Add a container for the digits of this detector +// digits = (AliTRDdataArrayS *) fDigitsManager->GetDigits(det); +// track0 = (AliTRDdataArrayI *) fDigitsManager->GetDictionary(det,0); +// track1 = (AliTRDdataArrayI *) fDigitsManager->GetDictionary(det,1); +// track2 = (AliTRDdataArrayI *) fDigitsManager->GetDictionary(det,2); + +// // Allocate memory space for the digits buffer +// if (!digits->HasData()) +// { +// //AliDebug(5, Form("Alloc digits for det %d", det)); +// digits->Allocate(input.GetMaxRow(),input.GetMaxCol(), input.GetNumberOfTimeBins()); +// track0->Allocate(input.GetMaxRow(),input.GetMaxCol(), input.GetNumberOfTimeBins()); +// track1->Allocate(input.GetMaxRow(),input.GetMaxCol(), input.GetNumberOfTimeBins()); +// track2->Allocate(input.GetMaxRow(),input.GetMaxCol(), input.GetNumberOfTimeBins()); +// } - indexes = fDigitsManager->GetIndexes(det); - indexes->SetSM(input.GetSM()); - indexes->SetStack(input.GetStack()); - indexes->SetLayer(input.GetLayer()); - indexes->SetDetNumber(det); - if (indexes->IsAllocated() == kFALSE) - { - indexes->Allocate(input.GetMaxRow(), input.GetMaxCol(), input.GetNumberOfTimeBins()); - } - - } +// indexes = fDigitsManager->GetIndexes(det); +// indexes->SetSM(input.GetSM()); +// indexes->SetStack(input.GetStack()); +// indexes->SetLayer(input.GetLayer()); +// indexes->SetDetNumber(det); +// if (indexes->IsAllocated() == kFALSE) +// { +// indexes->Allocate(input.GetMaxRow(), input.GetMaxCol(), input.GetNumberOfTimeBins()); +// } + +// } - for (it = 0; it < 3; it++) - { - if ( input.GetTimeBin() + it < input.GetNumberOfTimeBins() ) - { - if (input.GetSignals()[it] > 0) - { - digits->SetDataUnchecked(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); - } - } - } - - } - - if (lastdet != -1) - { - Bool_t iclusterBranch = kFALSE; - if (indexes->HasEntry()) - { - iclusterBranch = MakeClusters(lastdet); - } - if (iclusterBranch == kFALSE) - { - WriteClusters(lastdet); - ResetRecPoints(); - } - //MakeClusters(lastdet); - if (digits) - { - fDigitsManager->RemoveDigits(lastdet); - fDigitsManager->RemoveDictionaries(lastdet); - fDigitsManager->ClearIndexes(lastdet); - } - } - - delete fDigitsManager; - fDigitsManager = NULL; - return kTRUE; - +// for (it = 0; it < 3; it++) +// { +// if ( input.GetTimeBin() + it < input.GetNumberOfTimeBins() ) +// { +// if (input.GetSignals()[it] > 0) +// { +// digits->SetDataUnchecked(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); +// } +// } +// } + +// } + +// if (lastdet != -1) +// { +// Bool_t iclusterBranch = kFALSE; +// if (indexes->HasEntry()) +// { +// iclusterBranch = MakeClusters(lastdet); +// } +// if (iclusterBranch == kFALSE) +// { +// WriteClusters(lastdet); +// ResetRecPoints(); +// } +// //MakeClusters(lastdet); +// if (digits) +// { +// fDigitsManager->RemoveDigits(lastdet); +// fDigitsManager->RemoveDictionaries(lastdet); +// fDigitsManager->ClearIndexes(lastdet); +// } +// } + +// delete fDigitsManager; +// fDigitsManager = NULL; +// return kTRUE; + +return Raw2ClustersChamber(rawReader); } //_____________________________________________________________________________ @@ -657,9 +660,11 @@ Bool_t AliTRDclusterizer::Raw2ClustersChamber(AliRawReader *rawReader) fDigitsManager->SetUseDictionaries(fAddLabels); - AliTRDRawStreamV2 input(rawReader); - input.SetRawVersion( fRawVersion ); - input.Init(); +// AliTRDRawStreamV2 input(rawReader); +// input.SetRawVersion( fRawVersion ); +// input.Init(); + AliTRDrawStreamBase *pinput = AliTRDrawStreamBase::GetRawStream(rawReader); + AliTRDrawStreamBase &input = *pinput; AliInfo(Form("Stream version: %s", input.IsA()->GetName())); @@ -683,6 +688,9 @@ Bool_t AliTRDclusterizer::Raw2ClustersChamber(AliRawReader *rawReader) delete fDigitsManager; fDigitsManager = NULL; + + delete pinput; + pinput = NULL; return kTRUE; } diff --git a/TRD/AliTRDrawData.cxx b/TRD/AliTRDrawData.cxx index ebed36f421b..16e1a7b6d5b 100644 --- a/TRD/AliTRDrawData.cxx +++ b/TRD/AliTRDrawData.cxx @@ -35,6 +35,7 @@ #include "AliTRDgeometry.h" #include "AliTRDdataArrayI.h" #include "AliTRDdataArrayS.h" +#include "AliTRDrawStreamBase.h" #include "AliTRDRawStream.h" #include "AliTRDRawStreamV2.h" #include "AliTRDcalibDB.h" @@ -575,6 +576,60 @@ AliTRDdigitsManager *AliTRDrawData::Raw2Digits(AliRawReader *rawReader) AliTRDdataArrayI *track1 = 0; AliTRDdataArrayI *track2 = 0; + //AliTRDSignalIndex *indexes = 0; + // Create the digits manager + AliTRDdigitsManager* digitsManager = new AliTRDdigitsManager(); + digitsManager->CreateArrays(); + + //AliTRDRawStream input(rawReader); + // AliTRDRawStreamV2 input(rawReader); + // input.SetRawVersion( fFee->GetRAWversion() ); + // input.Init(); + + AliTRDrawStreamBase *pinput = AliTRDrawStreamBase::GetRawStream(rawReader); + AliTRDrawStreamBase &input = *pinput; + + AliInfo(Form("Stream version: %s", input.IsA()->GetName())); + + // Loop through the digits + Int_t det = 0; + + while (det >= 0) + { + det = input.NextChamber(digitsManager); + 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); + // 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); + } + } + + delete pinput; + pinput = NULL; + + return digitsManager; +} + +//_____________________________________________________________________________ +AliTRDdigitsManager *AliTRDrawData::Raw2DigitsOLD(AliRawReader *rawReader) +{ + // + // Vx of the raw data reading + // + + AliTRDdataArrayS *digits = 0; + AliTRDdataArrayI *track0 = 0; + AliTRDdataArrayI *track1 = 0; + AliTRDdataArrayI *track2 = 0; + AliTRDSignalIndex *indexes = 0; // Create the digits manager AliTRDdigitsManager* digitsManager = new AliTRDdigitsManager(); diff --git a/TRD/AliTRDrawData.h b/TRD/AliTRDrawData.h index bb5f843db65..f91004b2af6 100644 --- a/TRD/AliTRDrawData.h +++ b/TRD/AliTRDrawData.h @@ -35,6 +35,7 @@ class AliTRDrawData : public TObject { virtual Bool_t Digits2Raw(TTree *digits, TTree *tracks = NULL); virtual AliTRDdigitsManager *Raw2Digits(AliRawReader *rawReader); + virtual AliTRDdigitsManager *Raw2DigitsOLD(AliRawReader *rawReader); protected: diff --git a/TRD/AliTRDrawStreamBase.cxx b/TRD/AliTRDrawStreamBase.cxx new file mode 100644 index 00000000000..835f27d177a --- /dev/null +++ b/TRD/AliTRDrawStreamBase.cxx @@ -0,0 +1,161 @@ +/************************************************************************** + * Copyright(c) 1998-1999, 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: AliTRDrawStreamBase.cxx 23387 2008-01-17 17:25:16Z cblume $ */ + +/////////////////////////////////////////////////////////////////////////////// +// // +// This class defines access to TRD digits in raw data. // +// // +// It loops over all TRD digits in the raw data given by the AliRawReader. // +// The Next method goes to the next digit. If there are no digits left // +// it returns kFALSE. // +// Several getters provide information about the current digit. // +// // +// Author: M. Ploskon (ploskon@ikf.uni-frankfurt.de) // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include "AliRawReader.h" + +#include "AliTRDRawStream.h" +#include "AliTRDRawStreamV2.h" +#include "AliTRDrawStreamTB.h" + +#include "AliTRDrawStreamBase.h" + +//-------------------------------------------------------- +ClassImp(AliTRDrawStreamBase) + +Int_t AliTRDrawStreamBase::fgRawStreamVersion = AliTRDrawStreamBase::kTRDsimStream; + +//_____________________________________________________________________________ +AliTRDrawStreamBase::AliTRDrawStreamBase() + : TObject() +{ + // + // this is just for API + // + ; +} + +//_____________________________________________________________________________ +AliTRDrawStreamBase::AliTRDrawStreamBase(AliRawReader */*rawReader*/) + : TObject() +{ + // + // this is just for API + // + ; +} + +//_____________________________________________________________________________ +AliTRDrawStreamBase::AliTRDrawStreamBase(const AliTRDrawStreamBase& /*st*/) + : TObject() +{ + // + // copy + // + TRD_NOIMP(); + ; +} + +//_____________________________________________________________________________ +AliTRDrawStreamBase::~AliTRDrawStreamBase() +{ + // + // destructor + // + ; +} + +//_____________________________________________________________________________ +AliTRDrawStreamBase & +AliTRDrawStreamBase::operator=(const AliTRDrawStreamBase &) +{ + // + // we are not using this functionality + // + TRD_NOIMP(); + return *this; +} + +//_____________________________________________________________________________ +AliTRDrawStreamBase *AliTRDrawStreamBase::GetRawStream() +{ + // + // Returns the selected raw stream implementation + // + + if (fgRawStreamVersion == kTRDoldStream) + return new AliTRDRawStream(); + + if (fgRawStreamVersion == kTRDrealStream) + return new AliTRDrawStreamTB(); + + if (fgRawStreamVersion == kTRDsimStream) + { + AliTRDRawStreamV2 *rstream = new AliTRDRawStreamV2(); + rstream->Init(); + return rstream; + } + + return new AliTRDrawStreamBase; +} + +//_____________________________________________________________________________ +AliTRDrawStreamBase *AliTRDrawStreamBase::GetRawStream(AliRawReader *reader) +{ + // + // Returns the selected raw stream implementation + // + + if (fgRawStreamVersion == kTRDoldStream) + return new AliTRDRawStream(reader); + + if (fgRawStreamVersion == kTRDrealStream) + return new AliTRDrawStreamTB(reader); + + if (fgRawStreamVersion == kTRDsimStream) + { + AliTRDRawStreamV2 *rstream = new AliTRDRawStreamV2(reader); + rstream->Init(); + return rstream; + } + return new AliTRDrawStreamBase; +} + +//_____________________________________________________________________________ +void AliTRDrawStreamBase::SetRawStreamVersion(const char *opt) +{ + // + // Sets the raw stream version + // + + fgRawStreamVersion = 0; + + if (strstr(opt, "sim" ) != 0 || strstr(opt, "SIM") != 0) + fgRawStreamVersion = kTRDsimStream; + + if (strstr(opt, "tb" ) != 0 || strstr(opt, "TB") != 0) + fgRawStreamVersion = kTRDrealStream; + + if (strstr(opt, "real" ) != 0 || strstr(opt, "REAL") != 0) + fgRawStreamVersion = kTRDrealStream; + + if (strstr(opt, "old" ) != 0 || strstr(opt, "OLD") != 0) + fgRawStreamVersion = kTRDoldStream; + +} diff --git a/TRD/AliTRDrawStreamBase.h b/TRD/AliTRDrawStreamBase.h new file mode 100644 index 00000000000..98dc6568725 --- /dev/null +++ b/TRD/AliTRDrawStreamBase.h @@ -0,0 +1,133 @@ +#ifndef ALITRDRAWSTREAMBASE_H +#define ALITRDRAWSTREAMBASE_H + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id: AliTRDrawStreamBase.h 23387 2008-01-17 17:25:16Z cblume $ */ + +/////////////////////////////////////////////////////////////////////////////// +// // +// This base class defines access to TRD digits in raw data. // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include "TObject.h" +#include "TString.h" +#include "AliLog.h" + +class AliRawReader; +class AliTRDdigitsManager; + +#define TRD_MAX_TBINS 30 +#define TRD_MAX_ADC 21 +#define TRD_MAX_MCM 4 * 16 + +/* // old raw stream */ +/* #define TRD_OLD_STREAM -1 */ +/* // read simulated data */ +/* #define TRD_SIM_STREAM 0 */ +/* // read real data - including test beam 2007 */ +/* #define TRD_REAL_STREAM 1 */ + +#define TRD_NOIMP() AliFatal("Not Implemented for this class. Use inherited."); + +class AliTRDrawStreamBase : public TObject +{ // class def begin + + public: + + AliTRDrawStreamBase(); + AliTRDrawStreamBase(AliRawReader *rawReader); + virtual ~AliTRDrawStreamBase(); + + AliTRDrawStreamBase(const AliTRDrawStreamBase& st); + AliTRDrawStreamBase &operator=(const AliTRDrawStreamBase &); + + //-------------------------------------------------------- + + enum STREAMTYPE + { + kTRDsimStream = 0, + kTRDrealStream = 1, + kTRDoldStream = 99 + }; + + static AliTRDrawStreamBase *GetRawStream(); + static AliTRDrawStreamBase *GetRawStream(AliRawReader *reader); + + static void SetRawStreamVersion(Int_t iver) { fgRawStreamVersion = iver; } + static void SetRawStreamVersion(const char *opt); + + virtual Bool_t Next() {TRD_NOIMP(); return 0;} + virtual Int_t NextChamber(AliTRDdigitsManager */*man*/) {TRD_NOIMP(); return 0;} + virtual Bool_t Init() {TRD_NOIMP(); return -1;} + + virtual Bool_t SetRawVersion(Int_t /*fraw*/) {TRD_NOIMP(); return 0;} + + virtual Bool_t IsCurrentPadShared() const {TRD_NOIMP(); return 0;} + virtual void SetSharedPadReadout(Bool_t /*fv*/) {TRD_NOIMP();} + virtual Bool_t IsDataZeroSuppressed() const {TRD_NOIMP(); return 0;} + + virtual Bool_t SetReader(AliRawReader */*reader*/) {TRD_NOIMP(); return 0;} + + virtual Bool_t IsTrackletEnableBitSet() const {TRD_NOIMP(); return 0;} + virtual Bool_t IsStackActive(Int_t /*is*/) const {TRD_NOIMP(); return 0;} + virtual Int_t GetNofActiveStacks() const {TRD_NOIMP(); return 0;} + virtual UInt_t *GetSMstreamPosition() const {TRD_NOIMP(); return 0;} + + virtual Bool_t IsSMbufferClean() const {TRD_NOIMP(); return 0;} + + virtual Bool_t IsLinkActiveInStack(Int_t /*is*/, Int_t /*il*/) const {TRD_NOIMP(); return 0;} + virtual Int_t GetActiveLinksInStack(Int_t /*is*/) const {TRD_NOIMP(); return 0;} + + virtual Int_t GetSpecialRawVersion() const {TRD_NOIMP(); return 0;} + virtual Int_t GetMajorRawVersion() const {TRD_NOIMP(); return 0;} + virtual Int_t GetRawVersion() const {TRD_NOIMP(); return 0;} + virtual Int_t GetMinorRawVersion() const {TRD_NOIMP(); return 0;} + + virtual Int_t GetSM() const {TRD_NOIMP(); return 0;} + virtual Int_t GetLayer() const {TRD_NOIMP(); return 0;} + virtual Int_t GetStack() const {TRD_NOIMP(); return 0;} + virtual Int_t GetSide() const {TRD_NOIMP(); return 0;} + virtual Int_t GetDCS() const {TRD_NOIMP(); return 0;} + + virtual Int_t GetROC() const {TRD_NOIMP(); return 0;} + virtual Int_t GetNumberOfTimeBins() const {TRD_NOIMP(); return 0;} + virtual UInt_t GetBunchCrossCounter() const {TRD_NOIMP(); return 0;} + virtual UInt_t GetPreTriggerCounter() const {TRD_NOIMP(); return 0;} + virtual UInt_t GetPreTriggerPhase() const {TRD_NOIMP(); return 0;} + + virtual Int_t GetRow() const {TRD_NOIMP(); return 0;} + virtual Int_t GetCol() const {TRD_NOIMP(); return 0;} + virtual Int_t GetRowMax() const {TRD_NOIMP(); return 0;} + virtual Int_t GetColMax() const {TRD_NOIMP(); return 0;} + // compatibility + virtual Int_t GetMaxRow() const {TRD_NOIMP(); return 0;} + virtual Int_t GetMaxCol() const {TRD_NOIMP(); return 0;} + + virtual Int_t GetDET() const {TRD_NOIMP(); return 0;} + virtual Int_t GetDet() const {TRD_NOIMP(); return 0;} + + virtual Int_t GetROB() const {TRD_NOIMP(); return 0;} + virtual Int_t GetMCM() const {TRD_NOIMP(); return 0;} + virtual Int_t GetEventNumber() const {TRD_NOIMP(); return 0;} + virtual Int_t IsMCMcorrupted() const {TRD_NOIMP(); return 0;} + + virtual Int_t *GetSignals() const {TRD_NOIMP(); return 0;} + virtual Int_t GetADC() const {TRD_NOIMP(); return 0;} + virtual Int_t GetTimeBin() const {TRD_NOIMP(); return 0;} + + //---------------------------------------------------------- + + protected: + + private: + + static Int_t fgRawStreamVersion; // Raw stream version number + + ClassDef(AliTRDrawStreamBase, 0) // TRD raw stream base class + +}; //clas def end + +#endif diff --git a/TRD/AliTRDrawStreamTB.cxx b/TRD/AliTRDrawStreamTB.cxx index 0e0df4cc88f..4dcf93b4baa 100644 --- a/TRD/AliTRDrawStreamTB.cxx +++ b/TRD/AliTRDrawStreamTB.cxx @@ -122,7 +122,8 @@ Int_t AliTRDrawStreamTB::fgEmptySignals[] = }; AliTRDrawStreamTB::AliTRDrawStreamTB() - : TObject() + : AliTRDrawStreamBase() +//: TObject() , fSM() , fStack(0) , fHC(0) @@ -162,7 +163,8 @@ AliTRDrawStreamTB::AliTRDrawStreamTB() //-------------------------------------------------------- AliTRDrawStreamTB::AliTRDrawStreamTB(AliRawReader *rawReader) - : TObject() + : AliTRDrawStreamBase(rawReader) +//: TObject() , fSM() , fStack(0) , fHC(0) @@ -209,7 +211,8 @@ AliTRDrawStreamTB::AliTRDrawStreamTB(AliRawReader *rawReader) //------------------------------------------------------------ AliTRDrawStreamTB::AliTRDrawStreamTB(const AliTRDrawStreamTB& /*st*/) - : TObject() + : AliTRDrawStreamBase() +//: TObject() , fSM() , fStack(0) , fHC(0) @@ -244,13 +247,14 @@ AliTRDrawStreamTB::AliTRDrawStreamTB(const AliTRDrawStreamTB& /*st*/) } //------------------------------------------------------------ -void AliTRDrawStreamTB::SetRawVersion(Int_t fraw) +Bool_t AliTRDrawStreamTB::SetRawVersion(Int_t fraw) { // // function provided for backward compatibility // AliWarning("Raw data version is read from raw data stream! No point of setting it in here."); fraw = 0; // avoid warnings + return kFALSE; } //------------------------------------------------------------ diff --git a/TRD/AliTRDrawStreamTB.h b/TRD/AliTRDrawStreamTB.h index c13a274c3bf..ef25c0e5edf 100644 --- a/TRD/AliTRDrawStreamTB.h +++ b/TRD/AliTRDrawStreamTB.h @@ -14,6 +14,7 @@ #include "TObject.h" #include "TString.h" +#include "AliTRDrawStreamBase.h" class AliTRDgeometry; class AliRawReader; @@ -21,11 +22,13 @@ class AliTRDdigitsManager; class TTreeSRedirector; class AliTRDfeeParam; -#define TRD_MAX_TBINS 30 -#define TRD_MAX_ADC 21 -#define TRD_MAX_MCM 4 * 16 +// definitions in AliTRDrawStreamBase.h: +/* #define TRD_MAX_TBINS 30 */ +/* #define TRD_MAX_ADC 21 */ +/* #define TRD_MAX_MCM 4 * 16 */ -class AliTRDrawStreamTB : public TObject +//class AliTRDrawStreamTB : public TObject +class AliTRDrawStreamTB : public AliTRDrawStreamBase { // class def begin public: @@ -393,7 +396,7 @@ class AliTRDrawStreamTB : public TObject virtual Int_t NextChamber(AliTRDdigitsManager *man); // read next chamber data virtual Bool_t Init(); // Init some internal variables - void SetRawVersion(Int_t fraw); // set the raw version - used for backward compat. + Bool_t SetRawVersion(Int_t fraw); // set the raw version - used for backward compat. Bool_t IsCurrentPadShared() const {return fADC->fIsShared;} // is current pad shared between mcms void SetSharedPadReadout(Bool_t fv) {fSharedPadsOn = fv;} // set the flag on if the reader should return the shared pads diff --git a/TRD/TRDbaseLinkDef.h b/TRD/TRDbaseLinkDef.h index 28bf9be2d4b..6ef92387c15 100644 --- a/TRD/TRDbaseLinkDef.h +++ b/TRD/TRDbaseLinkDef.h @@ -32,6 +32,7 @@ #pragma link C++ class AliTRDRawStreamV2+; #pragma link C++ class AliTRDrawStreamTB+; +#pragma link C++ class AliTRDrawStreamBase+; #pragma link C++ class AliTRDtestBeam+; #pragma link C++ class AliTRDCommonParam+; diff --git a/TRD/libTRDbase.pkg b/TRD/libTRDbase.pkg index 19e0566b961..a9110b482f1 100644 --- a/TRD/libTRDbase.pkg +++ b/TRD/libTRDbase.pkg @@ -16,6 +16,7 @@ SRCS= AliTRDarrayI.cxx \ AliTRDRawStream.cxx \ AliTRDRawStreamV2.cxx \ AliTRDrawStreamTB.cxx \ + AliTRDrawStreamBase.cxx \ AliTRDtestBeam.cxx \ AliTRDCommonParam.cxx \ AliTRDfeeParam.cxx \ -- 2.39.3