X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=HLT%2FTPCLib%2FAliHLTTPCPad.cxx;h=a3f6562fe3294fb110b3fdf6f181de043a1d8447;hb=9efbb86cef4d706fda1a0bd28b8475ae2b1ae605;hp=6bdd2f6054f5ffcfb3b788ec06422cdc2b55f434;hpb=9be2600f6614107c11a1d269dbac57242e5854f4;p=u%2Fmrichter%2FAliRoot.git diff --git a/HLT/TPCLib/AliHLTTPCPad.cxx b/HLT/TPCLib/AliHLTTPCPad.cxx index 6bdd2f6054f..a3f6562fe32 100644 --- a/HLT/TPCLib/AliHLTTPCPad.cxx +++ b/HLT/TPCLib/AliHLTTPCPad.cxx @@ -1,35 +1,41 @@ -// @(#) $Id$ - -/************************************************************************** - * This file is property of and copyright by the ALICE HLT Project * - * ALICE Experiment at CERN, All rights reserved. * - * * - * Primary Authors: Matthias Richter * - * for The ALICE HLT Project. * - * * - * 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. * - **************************************************************************/ - -/** @file AliHLTTPCPad.cxx - @author Matthias Richter - @date - @brief Container Class for TPC Pads. -*/ - -#if __GNUC__>= 3 -using namespace std; -#endif +// $Id$ + +//************************************************************************** +//* This file is property of and copyright by the ALICE HLT Project * +//* ALICE Experiment at CERN, All rights reserved. * +//* * +//* Primary Authors: Timm Steinbeck, Matthias Richter * +//* Developers: Kenneth Aamodt * +//* for The ALICE HLT Project. * +//* * +//* 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. * +//************************************************************************** + +/// @file AliHLTTPCPad.cxx +/// @author Matthias Richter, Kenneth Aamodt +/// @date +/// @brief Container Class for TPC Pads. +/// #include #include "AliHLTTPCPad.h" #include "AliHLTStdIncludes.h" + +//added by kenneth +#include "AliHLTTPCTransform.h" +#include "AliHLTTPCClusters.h" +#include +#include "TMath.h" +#include "TFile.h" +//------------------------------ + /** margin for the base line be re-avaluated */ #define ALIHLTPAD_BASELINE_MARGIN (2*fAverage) @@ -38,6 +44,10 @@ ClassImp(AliHLTTPCPad) AliHLTTPCPad::AliHLTTPCPad() : + fClusterCandidates(), + fUsedClusterCandidates(), + fSelectedPad(kFALSE), + fHWAddress(0), fRowNo(-1), fPadNo(-1), fThreshold(0), @@ -53,17 +63,34 @@ AliHLTTPCPad::AliHLTTPCPad() fFirstBLBin(0), fNofBins(0), fReadPos(0), - fpRawData(NULL) + fpRawData(NULL), + fDataSignals(NULL), + fSignalPositionArray(NULL), + fSizeOfSignalPositionArray(0), + fNGoodSignalsSent(0), + fCandidateDigitsVector() { // see header file for class documentation // or // refer to README to build package // or // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt + // HLTInfo("Entering default constructor"); + fDataSignals= new AliHLTTPCSignal_t[AliHLTTPCTransform::GetNTimeBins()]; + memset( fDataSignals, 0xFF, sizeof(Int_t)*(AliHLTTPCTransform::GetNTimeBins())); + + fSignalPositionArray= new Int_t[AliHLTTPCTransform::GetNTimeBins()]; + memset( fSignalPositionArray, 0xFF, sizeof(Int_t)*(AliHLTTPCTransform::GetNTimeBins())); + fSizeOfSignalPositionArray=0; + } -AliHLTTPCPad::AliHLTTPCPad(Int_t offset, Int_t nofBins) +AliHLTTPCPad::AliHLTTPCPad(Int_t /*dummy*/) : + fClusterCandidates(), + fUsedClusterCandidates(), + fSelectedPad(kFALSE), + fHWAddress(0), fRowNo(-1), fPadNo(-1), fThreshold(0), @@ -76,18 +103,31 @@ AliHLTTPCPad::AliHLTTPCPad(Int_t offset, Int_t nofBins) fBLMaxBin(-1), fBLMin(-1), fBLMinBin(-1), - fFirstBLBin(offset), - fNofBins(nofBins), + fFirstBLBin(0), + fNofBins(0), fReadPos(0), - fpRawData(NULL) + fpRawData(NULL), + fDataSignals(NULL), + fSignalPositionArray(NULL), + fSizeOfSignalPositionArray(0), + fNGoodSignalsSent(0), + fCandidateDigitsVector() { // see header file for class documentation + // or + // refer to README to build package + // or + // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt } -AliHLTTPCPad::AliHLTTPCPad(const AliHLTTPCPad& srcPad) +AliHLTTPCPad::AliHLTTPCPad(Int_t offset, Int_t nofBins) : - fRowNo(srcPad.fRowNo), - fPadNo(srcPad.fPadNo), + fClusterCandidates(), + fUsedClusterCandidates(), + fSelectedPad(kFALSE), + fHWAddress(0), + fRowNo(-1), + fPadNo(-1), fThreshold(0), fAverage(-1), fNofEvents(0), @@ -98,20 +138,17 @@ AliHLTTPCPad::AliHLTTPCPad(const AliHLTTPCPad& srcPad) fBLMaxBin(-1), fBLMin(-1), fBLMinBin(-1), - fFirstBLBin(0), - fNofBins(0), + fFirstBLBin(offset), + fNofBins(nofBins), fReadPos(0), - fpRawData(NULL) -{ - // see header file for class documentation - HLTFatal("copy constructor not implemented"); -} - -AliHLTTPCPad& AliHLTTPCPad::operator=(const AliHLTTPCPad&) + fpRawData(NULL), + fDataSignals(NULL), + fSignalPositionArray(NULL), + fSizeOfSignalPositionArray(0), + fNGoodSignalsSent(0), + fCandidateDigitsVector() { // see header file for class documentation - HLTFatal("assignment operator not implemented"); - return (*this); } AliHLTTPCPad::~AliHLTTPCPad() @@ -121,6 +158,14 @@ AliHLTTPCPad::~AliHLTTPCPad() HLTWarning("event data acquisition not stopped"); StopEvent(); } + if (fDataSignals) { + delete [] fDataSignals; + fDataSignals=NULL; + } + if (fSignalPositionArray!=NULL) { + delete [] fSignalPositionArray; + fSignalPositionArray=NULL; + } } Int_t AliHLTTPCPad::SetID(Int_t rowno, Int_t padno) @@ -128,6 +173,7 @@ Int_t AliHLTTPCPad::SetID(Int_t rowno, Int_t padno) // see header file for class documentation fRowNo=rowno; fPadNo=padno; + return 0; } @@ -181,10 +227,10 @@ Int_t AliHLTTPCPad::CalculateBaseLine(Int_t reqMinCount) fAverage=fSum/fCount; //HLTDebug("new average %d", fAverage); } else { -// HLTDebug("baseline re-eveluation skipped because of to few " -// "contributing bins: total=%d, contributing=%d, req=%d" -// "\ndata might be already zero suppressed" -// , fTotal, fCount, reqMinCount); + // HLTDebug("baseline re-eveluation skipped because of to few " + // "contributing bins: total=%d, contributing=%d, req=%d" + // "\ndata might be already zero suppressed" + // , fTotal, fCount, reqMinCount); iResult=-ENODATA; } fCount=0;fSum=-1; @@ -204,9 +250,9 @@ Int_t AliHLTTPCPad::CalculateBaseLine(Int_t reqMinCount) fAverage=avBackup; } } else { -// HLTDebug("baseline calculation skipped because of to few contributing " -// "bins: total=%d, contributing=%d, required=%d \ndata might be " -// "already zero suppressed", fTotal, fCount, reqMinCount); + // HLTDebug("baseline calculation skipped because of to few contributing " + // "bins: total=%d, contributing=%d, required=%d \ndata might be " + // "already zero suppressed", fTotal, fCount, reqMinCount); } return iResult; @@ -269,9 +315,9 @@ Int_t AliHLTTPCPad::AddBaseLineValue(Int_t bin, AliHLTTPCSignal_t value) fBLMinBin=bin; } } else { -// HLTDebug("ignoring value %d (bin %d) for base line calculation " -// "(current average is %d)", -// value, bin, fAverage); + // HLTDebug("ignoring value %d (bin %d) for base line calculation " + // "(current average is %d)", + // value, bin, fAverage); } } return iResult; @@ -280,6 +326,7 @@ Int_t AliHLTTPCPad::AddBaseLineValue(Int_t bin, AliHLTTPCSignal_t value) Int_t AliHLTTPCPad::SetRawData(Int_t bin, AliHLTTPCSignal_t value) { // see header file for class documentation + // printf("Row: %d Pad: %d Time: %d Charge %d", fRowNo, fPadNo, bin, value); Int_t iResult=0; if (fpRawData) { if (bin0) + //This cout should be here since using logging produces output that is much more difficult to read + cout<0){ + time = fSignalPositionArray[fNGoodSignalsSent]; + bunchSize=1; + fNGoodSignalsSent++; + while(fNGoodSignalsSent0){ + bunchSize++; + fNGoodSignalsSent++; + } + else{ + break; + } + } + // fNGoodSignalsSent++; + return kTRUE; + } + return kFALSE; +} + +Int_t AliHLTTPCPad::GetDataSignal(Int_t bin) const +{ + // see header file for class documentation + return fDataSignals[bin]; +} + +void AliHLTTPCPad::ZeroSuppress(Double_t nRMS, Int_t threshold, Int_t reqMinPoint, Int_t beginTime, Int_t endTime, Int_t timebinsLeft, Int_t timebinsRight, Int_t valueUnderAverage, bool speedup){ + //see headerfile for documentation + + //HLTDebug("In Pad: nRMS=%d, threshold=%d, reqMinPoint=%d, beginTime=%d, endTime=%d, timebinsLeft=%d timebinsRight=%d valueUnderAverage=%d \n",nRMS,threshold,reqMinPoint,beginTime,endTime,timebinsLeft,timebinsRight,valueUnderAverage); + + Bool_t useRMS= kFALSE; + if(nRMS>0){ + useRMS=kTRUE; + if(threshold>0){ + HLTInfo("Both RMSThreshold and SignalThreshold defined, using RMSThreshold"); + } + } + if(threshold<1 && nRMS<=0){ + //setting the data to -1 for this pad + HLTInfo("Neither of RMSThreshold and SignalThreshold set, zerosuppression aborted"); + return; + } + + Int_t fThresholdUsed=threshold; + + Int_t maxVal=0; + Int_t nAdded=0; + Int_t sumNAdded=0; + fSizeOfSignalPositionArray=0; + if(useRMS){ + for(Int_t i=beginTime;i0){ + nAdded++; + sumNAdded+=fDataSignals[i]*fDataSignals[i]; + if (maxVal0){ + for(Int_t i=beginTime;i0){ + nAdded++; + sumNAdded+=fDataSignals[i]; + if (maxVal0){ + fThresholdUsed =(Int_t)(TMath::Sqrt(averageValue)*nRMS); + } + else{ + HLTFatal("average value in ZeroSuppression less than 0, investigation needed. This should never happen"); + } + } + else{ + fThresholdUsed = (Int_t)(averageValue + threshold); + } + if (maxValfThresholdUsed){ + Int_t firstSignalTime=i; + for(Int_t left=1;left0 && i-left>=beginTime){ + firstSignalTime--; + } + else{ + break; + } + } + Int_t lastSignalTime=i; + while(fDataSignals[lastSignalTime+1]>fThresholdUsed && lastSignalTime+10&&i+right=beginTime;d--){ + if(d==fSignalPositionArray[counterSize-1]&&counterSize-1>=0){ + counterSize--; + } + else{ + fDataSignals[d]=-1; + } + } + if(fDataSignals[beginTime+1]<1){ + fDataSignals[beginTime]=0; + } +} + +void AliHLTTPCPad::AddClusterCandidate(const AliHLTTPCClusters& candidate){ + fClusterCandidates.push_back(candidate); + fUsedClusterCandidates.push_back(0); +} + +void AliHLTTPCPad::AddCandidateDigits(const vector& candidateDigits){ + fCandidateDigitsVector.push_back(candidateDigits); +} + +vector *AliHLTTPCPad::GetCandidateDigits(Int_t candidateIndex){ + return (size_t(candidateIndex) < fCandidateDigitsVector.size()) ? &fCandidateDigitsVector.at(candidateIndex) :0; +}