#include "AliHLTPHOSRawAnalyzerComponent.h"
#include "AliRawReaderMemory.h"
#include "AliCaloRawStream.h"
-#include <iostream>
#include "AliHLTPHOSRcuCellEnergyDataStruct.h"
#include "AliHLTPHOSRcuChannelDataStruct.h"
-using namespace std;
-
-
-const AliHLTComponentDataType AliHLTPHOSRawAnalyzerComponent::fgkInputDataTypes[]={kAliHLTVoidDataType,{0,"",""}}; //'zero' terminated array
-int AliHLTPHOSRawAnalyzerComponent::fgEventCount = 0;
+using namespace std;
//_________________________________________________________________________________________________
-AliHLTPHOSRawAnalyzerComponent::AliHLTPHOSRawAnalyzerComponent():AliHLTProcessor(), fAnalyzerPtr(0),
-fkEquippmentID(0), fModuleID(0), fRcuX(0), fRcuZ(0),fRcuZOffset(0), fRcuXOffset(0),fPrintInfo(kFALSE),fSendChannelData(kFALSE),fPrintInfoFrequncy(1000),
-fPHOSRawStream(0), fRawMemoryReader(0), fOutPtr(0)
+AliHLTPHOSRawAnalyzerComponent::AliHLTPHOSRawAnalyzerComponent():AliHLTPHOSProcessor(), fAnalyzerPtr(0),
+fSendChannelData(kFALSE),fPHOSRawStream(0), fRawMemoryReader(0), fOutPtr(0)
{
}
//_________________________________________________________________________________________________
AliHLTPHOSRawAnalyzerComponent::~AliHLTPHOSRawAnalyzerComponent()
{
- /**
- *Default destructor
- */
if(fRawMemoryReader != 0)
{
delete fRawMemoryReader;
}
//_________________________________________________________________________________________________
-AliHLTPHOSRawAnalyzerComponent::AliHLTPHOSRawAnalyzerComponent(const AliHLTPHOSRawAnalyzerComponent & ) : AliHLTProcessor(), fAnalyzerPtr(0),
-fkEquippmentID(0), fModuleID(0), fRcuX(0), fRcuZ(0),fRcuZOffset(0), fRcuXOffset(0),fPrintInfo(kFALSE),fSendChannelData(kFALSE),fPrintInfoFrequncy(1000),
-fPHOSRawStream(0), fRawMemoryReader(0), fOutPtr(0)
+AliHLTPHOSRawAnalyzerComponent::AliHLTPHOSRawAnalyzerComponent(const AliHLTPHOSRawAnalyzerComponent & ) : AliHLTPHOSProcessor(), fAnalyzerPtr(0),
+fSendChannelData(kFALSE),fPHOSRawStream(0), fRawMemoryReader(0), fOutPtr(0)
{
- /**
- *Copy Constructor
- */
-}
-//_________________________________________________________________________________________________
-int
-AliHLTPHOSRawAnalyzerComponent::Deinit()
-{
- //See base class for documentation
- cout << "Deinit" << endl;
- return 0;
}
//_________________________________________________________________________________________________
int
-AliHLTPHOSRawAnalyzerComponent::DoDeinit()
+AliHLTPHOSRawAnalyzerComponent::Deinit()
{
- //See base class or for documentation
- cout << "DoDeinit" << endl;
- Logging(kHLTLogInfo, "HLT", "PHOS", ",AliHLTPHOSRawAnalyzerComponen DoDeinit");
+ Logging(kHLTLogInfo, "HLT", "PHOS", ",AliHLTPHOSRawAnalyzerComponen Deinit");
if(fRawMemoryReader !=0)
{
}
return 0;
+ return 0;
}
//_________________________________________________________________________________________________
const char*
AliHLTPHOSRawAnalyzerComponent::GetComponentID()
{
- //Returns the component ID
return "AliPhosTestRaw";
}
void
AliHLTPHOSRawAnalyzerComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
{
- //See Base class for documentation
const AliHLTComponentDataType* pType=fgkInputDataTypes;
while (pType->fID!=0) {
list.push_back(*pType);
AliHLTComponentDataType
AliHLTPHOSRawAnalyzerComponent::GetOutputDataType()
{
- //See Base class for documentation
return AliHLTPHOSDefinitions::fgkCellEnergyDataType;
}
AliHLTPHOSRawAnalyzerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier )
{
- //See Base class for documentation
constBase = 30;
inputMultiplier = 1;
}
int
AliHLTPHOSRawAnalyzerComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks )
{
- //See base class for documentation
AliHLTUInt8_t tmpMod = 0;
AliHLTUInt8_t tmpZ = 0;
AliHLTUInt8_t tmpX = 0;
}
- fgEventCount++;
+ fPhosEventCount++;
if(fPrintInfo == kTRUE)
{
- if(fgEventCount%fPrintInfoFrequncy == 0)
+ if(fPhosEventCount%fPrintInfoFrequncy == 0)
{
- cout <<"Analyzing event " << fgEventCount << "for Equippment " << fkEquippmentID << endl;
+ cout <<"Analyzing event " << fPhosEventCount << "for Equippment " << fkEquippmentID << endl;
}
}
size = tSize;
int
AliHLTPHOSRawAnalyzerComponent::DoInit( int argc, const char** argv )
{
- // See headerfile for documentation
fSendChannelData = kFALSE;
fPrintInfo = kFALSE;
Reset();
fPHOSRawStream->SetOldRCUFormat(kFALSE);
int iResult=0;
TString argument="";
- Bool_t isSetEquippmentID = kFALSE;
-
- for(int i=0; i<argc && iResult>=0; i++)
- {
- argument=argv[i];
-
- if (argument.IsNull())
- {
- continue;
- }
-
- if (argument.CompareTo("-equipmentID") == 0)
- {
- cout << "AliHLTPHOSRawAnalyzerComponent:DoInit argument = -equipmentID " <<endl;
- if(i+1 <= argc)
- {
- SetEquippmentID((AliHLTUInt16_t)atoi(argv[i+1]));
- cout << "AliHLTPHOSRawAnalyzerComponent:DoInit setting equippment ID to " << fkEquippmentID <<endl;
- fRawMemoryReader->SetEquipmentID(fkEquippmentID);
- SetCoordinates(fkEquippmentID);
- 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)
- {
- argument=argv[i+1];
- if(argument.CompareTo("channeldata") == 0)
- {
- cout << "AliHLTPHOSRawAnalyzerComponent::DoIni setting sendChannelData = kTRUE "<< endl;
- fSendChannelData = kTRUE;
- }
- }
- }
-
- if (argument.CompareTo("-printinfo") == 0)
- {
- if(i+1 <= argc)
- {
- argument=argv[i+1];
- fPrintInfoFrequncy = atoi(argv[i+1]);
- fPrintInfo = kTRUE;
- cout << "AliHLTPHOSRawAnalyzerComponent::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;
- }
- }
-
- }
+ iResult = ScanArguments(argc, argv);
- if(isSetEquippmentID == kFALSE)
+ if(fIsSetEquippmentID == 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;
}
+ else
+ {
+ fRawMemoryReader->SetEquipmentID(fkEquippmentID);
+ }
- return 0;
+ return iResult;
}
//_________________________________________________________________________________________________
void
AliHLTPHOSRawAnalyzerComponent::DumpData(int gain) const
{
- //Dumping data to std out
for(int mod = 0; mod < N_MODULES; mod ++)
{
printf("\n *********** MODULE %d ************\n", mod);
void
AliHLTPHOSRawAnalyzerComponent::DumpChannelData(Double_t *data) const
{
- //shutting up the code checker
- cout << endl;
- for(int i=0; i< ALTRO_MAX_SAMPLES; i++)
+ cout << endl;
+ for(int i=0; i< ALTRO_MAX_SAMPLES; i++)
+ {
+ if (data[i] != 0)
{
- if (data[i] != 0)
- {
- cout <<i <<"\t";
- }
+ cout <<i <<"\t";
}
- cout << endl;
-
- for(int i=0; i< ALTRO_MAX_SAMPLES; i++)
+ }
+ cout << endl;
+
+ for(int i=0; i< ALTRO_MAX_SAMPLES; i++)
+ {
+ if (data[i] != 0)
{
- if (data[i] != 0)
- {
- cout <<data[i] <<"\t";
- }
+ cout <<data[i] <<"\t";
}
-
- cout << endl;
+ }
+
+ cout << endl;
}
//_________________________________________________________________________________________________
void
AliHLTPHOSRawAnalyzerComponent::Reset()
{
- //shutting code checker
for(int mod = 0; mod < N_MODULES; mod ++)
{
for(int row = 0; row < N_ROWS_MOD; row ++)
void
AliHLTPHOSRawAnalyzerComponent::ResetDataPtr(int startindex, int sampleCnt)
{
- //shutting up the code checker
for(int i = startindex ; i< sampleCnt; i++)
{
fTmpChannelData[i] = 0;
}
}
-//_________________________________________________________________________________________________
-void
-AliHLTPHOSRawAnalyzerComponent::SetEquippmentID(AliHLTUInt16_t id)
-{
- ///Changing the value of the constant fkEquippmentID
- ///by virue of const_cast as it should only be set once
- ///and then remain constant. It caannot be set in the class constructor
- ///because it should be set in the DoInit fucntion.
- AliHLTUInt16_t &ref = const_cast<AliHLTUInt16_t&>(fkEquippmentID);
- ref = id;
-}
-
-
-//_________________________________________________________________________________________________
-const AliHLTUInt16_t
-AliHLTPHOSRawAnalyzerComponent::GetEquippmentID() const
-{
- //shutting up the code checker
- return fkEquippmentID;
-}
-
-//_________________________________________________________________________________________________
-void
-AliHLTPHOSRawAnalyzerComponent::SetCoordinates(AliHLTUInt16_t equippmentID)
-{
- //shutting up the code checker
- int rcuIndex = (fkEquippmentID - 1792)%N_RCUS_PER_MODULE;
- fModuleID = (fkEquippmentID -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 <<"AliHLTPHOSRawAnalyzerComponent::SetCoordinate casted"<< endl;
- cout <<"Equpippment ID =\t"<< fkEquippmentID <<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;
-}
//Base class for PHOS HLT raw data analysis components
// see cxx file for more details
-#include "AliHLTProcessor.h"
#include "AliHLTPHOSDefinitions.h"
#include "AliHLTPHOSCommonDefs.h"
+#include "AliHLTPHOSProcessor.h"
class AliRawReaderMemory;
class AliHLTPHOSRcuCellEnergyDataStruct;
class AliHLTPHOSRcuChannelDataStruct;
-class AliHLTPHOSRawAnalyzerComponent: public AliHLTProcessor
+class AliHLTPHOSRawAnalyzerComponent: public AliHLTPHOSProcessor
{
public:
AliHLTPHOSRawAnalyzerComponent();
{
return *this;
};
+
virtual int DoInit(int argc =0, const char** argv = 0);
virtual int Deinit();
- virtual int DoDeinit();
void DumpData(int gain =0) const;
void DumpChannelData(Double_t *data =0) const;
- void SetEquippmentID(AliHLTUInt16_t id =0);
- const AliHLTUInt16_t GetEquippmentID() const;
- void SetCoordinates(AliHLTUInt16_t equippmentID =0);
virtual const char* GetComponentID() = 0;
- // virtual void GetInputDataTypes(std::vector<AliHLTComponentDataType, std::allocator<AliHLTComponentDataType> >&);
virtual void GetInputDataTypes( std::vector <AliHLTComponentDataType>& list);
-
virtual AliHLTComponentDataType GetOutputDataType();
virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
virtual AliHLTComponent* Spawn() = 0;
protected:
AliHLTPHOSRawAnalyzer *fAnalyzerPtr; /**<Pointer to an analyzer object used for raw data anlysis*/
+
private:
virtual int DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr,
AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks );
void Reset();
void ResetDataPtr(int startindex = 0, int sampleCnt = 0);
- static int fgEventCount; /**<Global event counter for this component*/
- const AliHLTUInt16_t fkEquippmentID; /**<Equippment ID as defined by ALICE*/
- AliHLTUInt8_t fModuleID; /**<ID of the module this component read data from (0-4)*/
- AliHLTUInt8_t fRcuX; /**<X position of RCU the data from this Equippment comes from (0 or 1)*/
- AliHLTUInt8_t fRcuZ; /**<Z position of RCU the data from this Equippment comes from (0 or 1)*/
- AliHLTUInt8_t fRcuZOffset; /**<offset in therms of towers in the Z direction relative to the module*/
- AliHLTUInt8_t fRcuXOffset; /**<offset in therms of towers in the X direction relative to the module*/
- Bool_t fPrintInfo; /**<wether or not to print debugg info to std out*/
Bool_t fSendChannelData; /**<wether or not to send raw data from the component into shared memory*/
Double_t fTmpChannelData[ALTRO_MAX_SAMPLES]; /**<temporary variable to store raw samples from a single altro channel*/
Double_t fMaxValues[N_MODULES][N_ROWS_MOD][N_COLUMNS_MOD][N_GAINS]; /**<array to store cell energies*/
- int fPrintInfoFrequncy; /**<Defines the update frequency for information printet to std out*/
AliCaloRawStream *fPHOSRawStream; /**<Streamer for PHOS raw data, used by fPHOSRawMemory reader*/
AliRawReaderMemory *fRawMemoryReader; /**<Decoder to read PHOS raw data on the altro format*/
AliHLTPHOSRcuCellEnergyDataStruct* fOutPtr; /**<Pointer to outputbuffer to write results from the component into shared memory*/
- static const AliHLTComponentDataType fgkInputDataTypes[]; /**<List of datatypes that can be given to this component*/
};
#endif