1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 ////////////////////////////////////////////////////////////////////////////////
20 // Pre-Trigger simulation
22 // Authors: F. Reidt (Felix.Reidt@cern.ch)
25 // Limitations: input/output width: 32 bits (UInt_t)
27 // Annotation: That LUT is usually used to provide a single output bit
28 // In that case every output value bigger 0 means true
30 ////////////////////////////////////////////////////////////////////////////////
41 #include "AliRunLoader.h"
44 #include "AliTRDptrgLUT.h"
46 ClassImp(AliTRDptrgLUT)
47 //_____________________________________________________________________________
48 AliTRDptrgLUT::AliTRDptrgLUT()
59 //_____________________________________________________________________________
60 AliTRDptrgLUT::~AliTRDptrgLUT()
63 if (this->fCopiedTable) {
64 AliDebug(5, "Deleted LUT data");
65 if (this->fLUTData != 0x0) {
66 delete[] this->fLUTData;
72 //_____________________________________________________________________________
73 Int_t AliTRDptrgLUT::LookUp(UInt_t input)
77 if (input > (UInt_t)this->fTableEntryCount) {
78 // check whether the input value is out of bounds
79 AliWarning("incorrect LUT input value");
82 return this->fLUTData[input]; // do look up and output
85 //______________________________________________________________________________
86 Int_t AliTRDptrgLUT::InitTable(Int_t inputWidth, Int_t outputWidth,
87 Int_t *tableData, Bool_t copy)
89 // load and initialize the look up table
92 this->fInputWidth = inputWidth;
93 this->fOutputWidth = outputWidth;
95 // calculated table entry count
96 this->fTableEntryCount = 0x1;
97 this->fTableEntryCount <<= inputWidth;
98 AliDebug(5,Form("fTableEntryCount=%d", this->fTableEntryCount));
100 this->fCopiedTable = copy;
103 this->fLUTData = new Int_t[this->fTableEntryCount]; // allocate data table
104 for (Int_t i=0; i < this->fTableEntryCount; i++) {
105 this->fLUTData[i] = tableData[i];
108 else { // do not copy (due to performace reasons)
109 this->fLUTData = tableData;