* provided "as is" without express or implied warranty. *
**************************************************************************/
+
#include "AliHLTPHOSDDLDecoderComponent.h"
#include <iostream>
-#include "stdio.h"
#include "AliRawReaderMemory.h"
#include "AliCaloRawStream.h"
-#include <cstdlib>
#include "AliHLTPHOSRcuChannelDataStruct.h"
+#include "AliHLTPHOSPulseGenerator.h"
+#include "AliHLTPHOSDataCorruptor.h"
- AliHLTPHOSDDLDecoderComponent gAliHLTPHOSDDLDecoderComponent;
-const AliHLTComponentDataType AliHLTPHOSDDLDecoderComponent::fgkInputDataTypes[]={kAliHLTVoidDataType,{0,"",""}}; //'zero' terminated array
-int AliHLTPHOSDDLDecoderComponent::fgEventCount = 0;
+using namespace std;
-AliHLTPHOSDDLDecoderComponent::AliHLTPHOSDDLDecoderComponent():AliHLTProcessor(), fEquippmentID(0), fRcuX(0),
-fRcuZ(0),fRcuZOffset(0), fRcuXOffset(0), fModuleID(0), fSendChannelData(kFALSE), fPHOSRawStream(0), fRawMemoryReader(0), fOutPtr(0)
-{
+AliHLTPHOSDDLDecoderComponent gAliHLTPHOSDDLDecoderComponent;
+
+AliHLTPHOSDDLDecoderComponent::AliHLTPHOSDDLDecoderComponent():AliHLTPHOSProcessor(), fPHOSRawStream(0), fRawMemoryReader(0),
+fOutPtr(0), fDataCorruptorPtr(0)
+{
+ //Default constructor
+ fDataCorruptorPtr = new AliHLTPHOSDataCorruptor();
}
AliHLTPHOSDDLDecoderComponent::~AliHLTPHOSDDLDecoderComponent()
{
- if(fRawMemoryReader != 0)
- {
- delete fRawMemoryReader;
- }
- if(fPHOSRawStream != 0)
- {
- delete fPHOSRawStream;
- }
+ //Destructor
+ delete fRawMemoryReader;
+ delete fPHOSRawStream;
+ delete fDataCorruptorPtr;
}
-AliHLTPHOSDDLDecoderComponent::AliHLTPHOSDDLDecoderComponent(const AliHLTPHOSDDLDecoderComponent & ) : AliHLTProcessor(),
-fEquippmentID(0), fRcuX(0), fRcuZ(0),fRcuZOffset(0), fRcuXOffset(0), fModuleID(0), fSendChannelData(kFALSE), fPHOSRawStream(0), fRawMemoryReader(0), fOutPtr(0)
+AliHLTPHOSDDLDecoderComponent::AliHLTPHOSDDLDecoderComponent(const AliHLTPHOSDDLDecoderComponent & ) : AliHLTPHOSProcessor(),
+fPHOSRawStream(0),fRawMemoryReader(0), fOutPtr(0), fDataCorruptorPtr(0)
{
+
}
int
AliHLTPHOSDDLDecoderComponent::Deinit()
{
+ //Se html documentation of base class
cout << "Deinit" << endl;
- return 0;
-}
-
-
-int
-AliHLTPHOSDDLDecoderComponent::DoDeinit()
-{
- cout << "DoDeinit" << endl;
Logging(kHLTLogInfo, "HLT", "PHOS", ",AliHLTPHOSRawAnalyzerComponen DoDeinit");
if(fRawMemoryReader !=0)
}
return 0;
+ return 0;
}
const char*
AliHLTPHOSDDLDecoderComponent::GetComponentID()
{
+ //Se html documentation of base class
return "PhosDDLDecoder";
}
void
AliHLTPHOSDDLDecoderComponent::GetInputDataTypes(vector<AliHLTComponentDataType>& list)
{
+ //Se html documentation of base class
const AliHLTComponentDataType* pType=fgkInputDataTypes;
while (pType->fID!=0) {
list.push_back(*pType);
AliHLTComponentDataType
AliHLTPHOSDDLDecoderComponent::GetOutputDataType()
{
+ //See html documentation of base class
return AliHLTPHOSDefinitions::fgkCellEnergyDataType;
}
AliHLTPHOSDDLDecoderComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier )
{
+ //Se html documentation of base class
constBase = 30;
inputMultiplier = 1;
}
-
int
AliHLTPHOSDDLDecoderComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr,
AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks )
{
- AliHLTUInt8_t tmpMod = 0;
- AliHLTUInt8_t tmpZ = 0;
- AliHLTUInt8_t tmpX = 0;
- AliHLTUInt8_t tmpGain = 0;
+ //See html documentation of base class
+ double testPulse[70];
+ fDataCorruptorPtr->MakeCorruptedDataTest(testPulse,70);
+
+ // AliHLTUInt8_t tmpMod = 0;
+ // AliHLTUInt8_t tmpZ = 0;
+ // AliHLTUInt8_t tmpX = 0;
+ // AliHLTUInt8_t tmpGain = 0;
Int_t sampleCnt = 0;
Int_t processedChannels = 0;
UInt_t offset = 0;
UInt_t mysize = 0;
UInt_t tSize = 0;
+
Int_t tmpChannelCnt = 0;
- Int_t tmpStartIndex = 0;
+ // Int_t tmpStartIndex = 0;
+
AliHLTUInt8_t* outBPtr;
- unsigned long first;
- unsigned long last;
+ //unsigned long first;
+ // unsigned long last;
outBPtr = outputPtr;
const AliHLTComponentBlockData* iter = NULL;
unsigned long ndx;
}
fOutPtr->fNValidChannels = tmpChannelCnt-1;;
-
+
int tmpSampleCnt=0;
AliHLTComponentBlockData bd;
FillBlockData( bd );
return EMSGSIZE;
}
- fgEventCount++;
+ fPhosEventCount++;
if(fPrintInfo == kTRUE)
{
- if(fgEventCount%fPrintInfoFrequncy == 0)
+ if(fPhosEventCount%fPrintInfoFrequncy == 0)
{
- cout <<"Analyzing event " << fgEventCount << "for Equippment " << fEquippmentID << endl;
+ cout <<"Analyzing event " << fPhosEventCount << "for Equippment " << fkEquippmentID << endl;
}
}
size = tSize;
int
AliHLTPHOSDDLDecoderComponent::DoInit( int argc, const char** argv )
{
- fSendChannelData = kFALSE;
+ //See html documentation of base class
fPrintInfo = kFALSE;
fRawMemoryReader = new AliRawReaderMemory();
fPHOSRawStream = new AliCaloRawStream(fRawMemoryReader,"PHOS");
fPHOSRawStream->SetOldRCUFormat(kFALSE);
int iResult=0;
TString argument="";
- Bool_t isSetEquippmentID = kFALSE;
+ ScanArguments(argc, argv);
- for(int i=0; i<argc && iResult>=0; i++)
- {
- argument=argv[i];
-
- if (argument.IsNull())
- {
- continue;
- }
-
- if (argument.CompareTo("-equipmentID") == 0)
- {
- cout << "AliHLTPHOSDDLDecoderComponent:DoInit argument = -equipmentID " <<endl;
- if(i+1 <= argc)
- {
- fEquippmentID = atoi(argv[i+1]);
- cout << "AliHLTPHOSDDLDecoderComponent:DoInit setting equippment ID to " << fEquippmentID <<endl;
- fRawMemoryReader->SetEquipmentID(fEquippmentID);
- SetEquippmentID(fEquippmentID);
- SetCoordinates(fEquippmentID);
- isSetEquippmentID = kTRUE;
- }
- else
- {
- iResult= -1;
- Logging( kHLTLogFatal, "HLT::AliHLTPHOSRcuHistogramProducerComponent::DoInt( int argc, const char** argv )", "Missing argument",
- "The argument -equippmentID expects a number");
- return iResult;
- }
- }
-
-
- if (argument.CompareTo("-datatype") == 0)
- {
- if(i+1 <= argc)
- {
- // i++;
- argument=argv[i+1];
- if(argument.CompareTo("channeldata") == 0)
- {
- cout << "AliHLTPHOSDDLDecoderComponent::DoIni setting sendChannelData = kTRUE "<< endl;
- fSendChannelData = kTRUE;
- }
- }
- }
-
+ if(fIsSetEquippmentID == kFALSE)
- if (argument.CompareTo("-printinfo") == 0)
- {
- if(i+1 <= argc)
- {
- argument=argv[i+1];
- fPrintInfoFrequncy = atoi(argv[i+1]);
- fPrintInfo = kTRUE;
- cout << "AliHLTPHOSDDLDecoderComponent::DoIni setting printinfo = kTRUE, with update frequency every "<< fPrintInfoFrequncy << "th event" <<endl;
- }
- else
- {
- cout << "WARNING: asking for event info, but no update frequency is specified, otipn is ignored" << endl;
- }
- // }
- }
-
- }
-
-
- if(isSetEquippmentID == kFALSE)
{
Logging( kHLTLogFatal, "HLT::AliHLTPHOSRcuHistogramProducerComponent::DoInt( int argc, const char** argv )", "Missing argument",
"The argument equippmentID is not set: set it with a component argumet like this: -equippmentID <number>");
iResult = -2;
}
-
- return 0;
-}
-
-
-
-void
-AliHLTPHOSDDLDecoderComponent::SetEquippmentID(AliHLTUInt16_t id)
-{
- fEquippmentID = id;
-}
-
-
-AliHLTUInt16_t
-AliHLTPHOSDDLDecoderComponent::GetEquippmentID()
-{
- return fEquippmentID;
-}
-
-
-void
-AliHLTPHOSDDLDecoderComponent::SetCoordinates(AliHLTUInt16_t equippmentID)
-{
- int rcuIndex = (fEquippmentID - 1792)%N_RCUS_PER_MODULE;
- fModuleID = (fEquippmentID -1792 -rcuIndex)/N_RCUS_PER_MODULE;
-
- if(rcuIndex == 0)
- {
- fRcuX = 0;
- fRcuZ = 0;
- }
-
- if(rcuIndex == 1)
- {
- fRcuX = 0;
- fRcuZ = 1;
- }
-
- if(rcuIndex == 2)
- {
- fRcuX = 1;
- fRcuZ = 0;
- }
-
- if(rcuIndex == 3)
- {
- fRcuX = 1;
- fRcuZ = 1;
- }
-
-
-
- fRcuZOffset = N_ZROWS_RCU*fRcuZ;
- fRcuXOffset = N_XCOLUMNS_RCU*fRcuX;
-
- cout <<"********InitInfo************"<< endl;
- cout <<"AliHLTPHOSDDLDecoderComponent::SetCoordinate"<< endl;
- cout <<"Equpippment ID =\t"<< fEquippmentID <<endl;
- cout <<"Module ID =\t"<< (int)fModuleID<<endl;
- cout <<"RCUX =\t\t" << (int)fRcuX << endl;
- cout <<"RCUZ =\t\t" << (int)fRcuZ << endl;
- cout <<"RcuZOffset = \t" << (int)fRcuZOffset << endl;
- cout <<"RcuXOffset = \t" << (int)fRcuXOffset << endl << endl;
+ return iResult;
}
AliHLTComponent*
AliHLTPHOSDDLDecoderComponent::Spawn()
{
+ //See html documentation of base class
return new AliHLTPHOSDDLDecoderComponent;
}
/* Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
-#include "AliHLTProcessor.h"
-#include "AliHLTPHOSRawAnalyzer.h"
-#include "AliRawReaderMemory.h"
-#include "AliCaloRawStream.h"
+#include "AliHLTPHOSProcessor.h"
#include "AliHLTPHOSDefinitions.h"
#include "AliHLTPHOSCommonDefs.h"
-#include "AliHLTPHOSRcuChannelDataStruct.h"
-#include <cstdlib>
+
class AliHLTPHOSRcuCellEnergyDataStruct;
class AliHLTPHOSRcuChannelDataStruct;
+class AliHLTPHOSPulseGenerator;
+class AliHLTPHOSDataCorruptor;
+class AliRawReaderMemory;
+class AliCaloRawStream;
-class AliHLTPHOSDDLDecoderComponent:public AliHLTProcessor
-
+class AliHLTPHOSDDLDecoderComponent:public AliHLTPHOSProcessor
{
public:
AliHLTPHOSDDLDecoderComponent();
{
return *this;
};
-
virtual int DoInit( int argc, const char** argv );
virtual int Deinit();
- virtual int DoDeinit();
- void SetEquippmentID(AliHLTUInt16_t id);
- AliHLTUInt16_t GetEquippmentID();
- void SetCoordinates(AliHLTUInt16_t equippmentID);
virtual const char* GetComponentID();
- virtual void GetInputDataTypes( std::vector <AliHLTComponentDataType>&);
+ virtual void GetInputDataTypes( std::vector <AliHLTComponentDataType>& list);
virtual AliHLTComponentDataType GetOutputDataType();
virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
virtual AliHLTComponent* Spawn();
virtual int DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr,
AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks );
-
+
private:
- static int fgEventCount;
- AliHLTUInt16_t fEquippmentID;
- AliHLTUInt8_t fRcuX;
- AliHLTUInt8_t fRcuZ;
- AliHLTUInt8_t fRcuZOffset;
- AliHLTUInt8_t fRcuXOffset;
- AliHLTUInt8_t fModuleID;
- Bool_t fSendChannelData;
- Bool_t fPrintInfo;
- Double_t fTmpChannelData[ALTRO_MAX_SAMPLES];
- int fPrintInfoFrequncy;
- AliCaloRawStream *fPHOSRawStream;
- AliRawReaderMemory *fRawMemoryReader;
- AliHLTPHOSRcuChannelDataStruct* fOutPtr;
- static const AliHLTComponentDataType fgkInputDataTypes[];
+ AliHLTPHOSDataCorruptor *fDataCorruptorPtr; /**<Pointer to data corruptor*/
+ Double_t fTmpChannelData[ALTRO_MAX_SAMPLES]; /**<Temporary storage for altro dat from a single channel*/
+ AliCaloRawStream *fPHOSRawStream; /**<Streamer for PHOS raw data, used by fPHOSRawMemory reader*/
+ AliRawReaderMemory *fRawMemoryReader; /**<Decoder to read PHOS raw data on the altro format*/
+ AliHLTPHOSRcuChannelDataStruct* fOutPtr; /**<Pointer to outputbuffer to write results from the component into shared memory*/
};
#endif
ClassImp(AliHLTPHOSPulseGenerator)
-//______________________________________________________________________________________________________
+
+
AliHLTPHOSPulseGenerator::AliHLTPHOSPulseGenerator(): fAmplitude(0), fNSamples(0),fTau(0), fSampleFreq(0), fTZero(0), fDataPtr(0), fDT(0)
{
+ //Never to be called
cout << "You cannot invoke the Pulsgenerator without parameters" << endl;
}
-//______________________________________________________________________________________________________
AliHLTPHOSPulseGenerator::AliHLTPHOSPulseGenerator(const AliHLTPHOSPulseGenerator &): fAmplitude(0), fNSamples(0),fTau(0), fSampleFreq(0), fTZero(0), fDataPtr(0), fDT(0)
{
}
-//______________________________________________________________________________________________________
AliHLTPHOSPulseGenerator::~AliHLTPHOSPulseGenerator()
{
+ //Destructor
delete fDataPtr;
fDataPtr=0;
}
-/**
- * Contruct a pulsegenrator object an initializes all necessary parameters
- * @param a Amplitude in ADC levels (0 -1023)
- * @param t0 Timedelay in nanoseconds of signal relative the first sample. This value should be between 0 and Ts
- * @param N the number of samples
- * @param tau Rise time of the semi Gaussian signal
- * @param fs samling rate
- **/
+
AliHLTPHOSPulseGenerator::AliHLTPHOSPulseGenerator(double a, double t0, int N, double tau, double fs): fAmplitude(a), fNSamples(N),fTau(0), fSampleFreq(fs), fTZero(0), fDataPtr(0), fDT(0)
{
+ //See header file for documentation
fDataPtr = new double[100];
SetAmplitude(a);
SetDT(fs);
fNSamples=N;
fTau=tau;
fSampleFreq=fs;
- // MakePulse(fDataPtr,a);
- MakePulse(fDataPtr);
}
-/**
- * Adds a baseline offset to the signal
- * @param baselineLevel The basline level to add
- * @param *samples The sample array for which to add te basline offset
- **/
void
AliHLTPHOSPulseGenerator::AddBaseline(double baselineLevel, double *samples)
{
+ //See header file for documentation
double *tmpSamples;
tmpSamples = samples;
printf("\nbaselineLevel = %f\n", baselineLevel);
cout << "AddBaseline not implemented yet" << endl;
}
-/**
- * Adds Gaussian white noise to the sample array given by *dataPtr.
- * @param dataPtr array of samples
- * @param sigma the noise amplitude in entities of ADC levels
- **/
+
void
AliHLTPHOSPulseGenerator::AddNoise(double *dataPtr, double *sigma)
{
+ //See header file for documentation
printf("\ndataPtr = %f, sigma = %f\n", *dataPtr, *sigma);
cout << "AddNoise is not implemented yet" << endl;
}
-/**
- * Adds correlated Gaussian noise with cutof frequency "cutoff"
- * @param dataPtr array of values
- * @param sigma noise amplitude in entities of ADC levels
- * @param cutoff -30DB cutoff frequency of the noise in entities of sampling frequency
- **/
void
AliHLTPHOSPulseGenerator::AddNoise(double *dataPtr, double *sigma, double cutoff)
{
+ //See header file for documentation
printf("\ndataPtr = %f, sigma = %f, cutoff = %f\n", *dataPtr, *sigma, cutoff);
cout << "AddNoise is not implemeted yet" << endl;
}
-
-/**
- * Adds pretrigger samples to the sample array and returns
- * a new array containing the pretrigger samples concatenatet
- * in front of the samples given by "samples"
- * @param baselineLevel The baseline value of the pretrigger samples
- * @param samples The sample array for which to add the pretrigger samples
- **/
double *
AliHLTPHOSPulseGenerator::AddPretriggerSamples(double baselineLevel, double *samples)
{
+ //See header file for documentation
printf("\nbaslinelevel = %f, samples = %f\n", baselineLevel, *samples);
cout << "AddPretriggerSamples not implemented yet" << endl;
return 0;
}
-/**
- * Returns a Pulse with new amplidude and t0
- * @param a new amplidude, overriding the one given in the constructor
- * @param t0 start time of the pulse relative to the sampling clock.
- **/
double *
AliHLTPHOSPulseGenerator::GetPulse(double a, double t0)
{
+ //See header file for documentation
return fDataPtr;
}
-/**
- * Emulates the ADC. Rounds down to nearest Integerevalue all entries given by
- * dataPtr
- **/
+
void
-AliHLTPHOSPulseGenerator::Quantisize(double *dataPtr)
+AliHLTPHOSPulseGenerator::Quantisize(double *dataPtr) const
{
+ //See header file for documentation
double *dtaPtr;
dtaPtr = new double[100];
dtaPtr = dataPtr;
- // cout << "Quantisize is not implemented yet" << endl;
}
-//______________________________________________________________________________________________________
void
AliHLTPHOSPulseGenerator::SetAmplitude(double a)
{
+ //See header file for documentation
fAmplitude=a;
}
-//______________________________________________________________________________________________________
void
AliHLTPHOSPulseGenerator::SetDT(double fs)
{
+ //See header file for documentation
fDT=1/fs;
}
-//______________________________________________________________________________________________________
+
void
AliHLTPHOSPulseGenerator::SetTZero(double t0)
{
+ //See header file for documentation
fTZero = -t0/1000; // Since time is in nanoseconds and the samplingfrequency is in MHz -> divide by 1000
}
-//______________________________________________________________________________________________________
+void
+AliHLTPHOSPulseGenerator::SetSampleFreq(int fs)
+{
+ //See header file for documentation
+ fSampleFreq = fs;
+ SetDT(fs);
+}
+
+
void
AliHLTPHOSPulseGenerator::MakePulse(double *dtaPtr)
{
-for(int i=0; i<fNSamples; i++)
- {
- dtaPtr[i]=fAmplitude*exp((Double_t)2)*pow((i*fDT-fTZero)/fTau, 2)*exp(-2*(i*fDT-fTZero)/fTau);
- }
+ //See header file for documentation
+ for(int i=0; i<fNSamples; i++)
+ {
+ dtaPtr[i]=fAmplitude*exp((Double_t)2)*pow((i*fDT-fTZero)/fTau, 2)*exp(-2*(i*fDT-fTZero)/fTau);
+ }
}
+
+
+void
+AliHLTPHOSPulseGenerator::MakePulse(double *dtaPtr, int N)
+{
+ //See header file for documentation
+ for(int i=0; i<N; i++)
+ {
+ dtaPtr[i]=fAmplitude*exp((Double_t)2)*pow((i*fDT-fTZero)/fTau, 2)*exp(-2*(i*fDT-fTZero)/fTau);
+ }
+}
+
public:
AliHLTPHOSPulseGenerator();
virtual ~AliHLTPHOSPulseGenerator();
+
+ /**
+ * Contruct a pulsegenrator object an initializes all necessary parameters
+ * @param a Amplitude in ADC levels (0 -1023)
+ * @param t0 Timedelay in nanoseconds of signal relative the first sample. This value should be between 0 and Ts
+ * @param N the number of samples
+ * @param tau Rise time of the semi Gaussian signal
+ * @param fs samling rate
+ **/
AliHLTPHOSPulseGenerator(double a, double t0, const int N , const double tau, const double fs);
+
AliHLTPHOSPulseGenerator(const AliHLTPHOSPulseGenerator & );
- AliHLTPHOSPulseGenerator & operator = (const AliHLTPHOSPulseGenerator)
+
+
+ AliHLTPHOSPulseGenerator & operator = (const AliHLTPHOSPulseGenerator &)
{
return *this;
}
+
+ /**
+ * Adds a baseline offset to the signal
+ * @param baselineLevel The basline level to add
+ * @param *samples The sample array for which to add te basline offset
+ **/
void AddBaseline(double baselineLevel = 0, double *samples = 0);
+
+ /**
+ * Adds Gaussian white noise to the sample array given by *dataPtr.
+ * @param dataPtr array of samples
+ * @param sigma the noise amplitude in entities of ADC levels
+ **/
void AddNoise(double *dataPtr, double *sigma);
+
+ /**
+ * Adds correlated Gaussian noise with cutof frequency "cutoff"
+ * @param dataPtr array of values
+ * @param sigma noise amplitude in entities of ADC levels
+ * @param cutoff -30DB cutoff frequency of the noise in entities of sampling frequency
+ **/
void AddNoise(double *dataPtr, double *sigma, double cutoff);
+
+
+ /**
+ * Adds pretrigger samples to the sample array and returns
+ * a new array containing the pretrigger samples concatenatet
+ * in front of the samples given by "samples"
+ * @param baselineLevel The baseline value of the pretrigger samples
+ * @param samples The sample array for which to add the pretrigger samples
+ **/
double *AddPretriggerSamples(double baslineLevel = 0, double *samples = 0);
+
+
+ /**
+ * Returns a Pulse with new amplidude and t0
+ * @param a new amplidude, overriding the one given in the constructor
+ * @param t0 start time of the pulse relative to the sampling clock.
+ **/
double *GetPulse(double a = 1, double t0 = 0);
- void Quantisize(double *dataPtr = 0);
+
+
+ /**
+ * Emulates the ADC. Rounds down to nearest Integerevalue all entries given by
+ * dataPtr
+ **/
+ void Quantisize(double *dataPtr) const;
+
void SetAmplitude(double a = 1);
void SetDT(double fs = 10);
void SetTZero(double t0 = 0);
+ void SetSampleFreq(int fs);
+ void MakePulse(double *dtaPtr, int N);
+ void MakePulse(double *dtaPtr);
private:
- void MakePulse(double *dtaPtr = 0);
double fAmplitude; /**<The amplitude in entities of ADC counts of the genrated pulse*/
int fNSamples; /**<The number of samples of the genrated pulse*/
double fTau; /**<The risetime in entities of us of the generated pulse*/