AliHLTCaloMapper(const unsigned long specification, TString det);
virtual ~AliHLTCaloMapper();
- virtual void InitAltroMapping( const unsigned long specification ) = 0;
+ virtual Bool_t InitAltroMapping( const unsigned long specification ) = 0;
virtual void InitDDLSpecificationMapping() = 0;
bool GetIsInitializedMapping();
- char* GetFilePath();
+ virtual char* GetFilePath();
int GetChannelID(const AliHLTUInt32_t spec, const Int_t hadd);
- void GetChannelCoord(const UShort_t channelId, UShort_t* channelCoord);
+ static void GetChannelCoord(const UShort_t channelId, UShort_t* channelCoord);
static void ChannelId2Coordinate(const int channelId, AliHLTCaloCoordinate &channelCoord);
virtual void GetLocalCoord(const int channelId, Float_t* localCoord) const;
int GetDDLFromSpec( const AliHLTUInt32_t spec );
//** Pointer to a mapper opbject */
AliHLTCaloMapper *fMapperPtr; //COMMENT
+ virtual void InitMapping(const int specification ) = 0;
+
private:
/** Keep default constructor private since it should not be used */
/** Keep the assignement operator private since it should not be used */
AliHLTCaloRawAnalyzerComponentv3 & operator = (const AliHLTCaloRawAnalyzerComponentv3 &);
- virtual void InitMapping(const int specification ) = 0;
+ //virtual void InitMapping(const int specification ) = 0;
/** Mapping from harware address to geometrical address */
// AliHLTCaloMapper *fMapperPtr; //!transient
}
-void
+Bool_t
AliHLTEMCALMapper::InitAltroMapping(const unsigned long specification )
{
char *base = getenv("ALICE_ROOT");
public:
AliHLTEMCALMapper( const unsigned long specifiaction );
virtual ~AliHLTEMCALMapper();
- virtual void InitAltroMapping( const unsigned long specification );
+ virtual Bool_t InitAltroMapping( const unsigned long specification );
virtual void InitDDLSpecificationMapping();
virtual void GetLocalCoord(const int channelId, Float_t* localCoord) const;
// static const int GlobalX2ModuleId(const int globalX);
#include "AliHLTPHOSChannelDataStruct.h"
#include "AliHLTPHOSCoordinate.h"
#include "Rtypes.h"
-#include "AliHLTPHOSConstant.h"
-
-using namespace PhosHLTConst;
struct AliHLTPHOSChannelRawDataStruct : public AliHLTPHOSChannelDataStruct
{
AliHLTPHOSCoordinate fCoordinate;
int nSamplesUsed;
- UShort_t fDataPtr[ALTROMAXSAMPLES];
+ UShort_t fDataPtr[1008];
};
#endif
//
//
-#include "AliPHOSEMCAGeometry.h"
#include "AliHLTPHOSMapper.h"
-#include "AliHLTPHOSConstant.h"
-#include "AliHLTLogging.h"
-#include "Rtypes.h"
#include "unistd.h"
#include <iostream>
#include "AliHLTPHOSCoordinate.h"
-using namespace PhosHLTConst;
-AliHLTPHOSMapper::AliHLTPHOSMapper(): AliHLTLogging(),
- fHw2geomapPtr(0),
- fIsInitializedMapping(false),
- fSpecificationMapPtr(0)
- // fPHOSGeometry(0)
+AliHLTPHOSMapper::AliHLTPHOSMapper():
+ AliHLTCaloMapper(0,"PHOS")
+ ,fDDLId(-1)
+ ,fModuleId(-1)
{
- InitAltroMapping();
InitDDLSpecificationMapping();
- // fPHOSGeometry = new AliPHOSEMCAGeometry();
-
+ sprintf(fFilepath, "\0");
}
fHw2geomapPtr = 0;
}
-void
-AliHLTPHOSMapper::InitAltroMapping()
+
+Bool_t
+AliHLTPHOSMapper::InitAltroMapping(const unsigned long specification)
{
// Loads mapping between Altro addresses and geometrical addresses from file
+
+ fDDLId = GetDDLFromSpec(specification);
+ Int_t modId = GetModuleFromSpec(specification);
- // char filename[256];
char *base = getenv("ALICE_ROOT");
- int nChannels = 0;
- int maxaddr = 0;
- int tmpHwaddr = 0;
- int tmpZRow = 0;
- int tmpXCol = 0;
- int tmpGain = 0;
- int res = 0;
- if(base !=0)
- {
- sprintf(fFilepath,"%s/PHOS/mapping/RCU0.data", base);
-
- FILE *fp = fopen(fFilepath, "r");
- if(fp != 0)
- {
- res = fscanf(fp, "%d", &nChannels);
- res = fscanf(fp, "%d", &maxaddr);
- fHw2geomapPtr = new fAltromap[maxaddr +1];
-
- for(int i=0; i< maxaddr + 1 ; i ++)
- {
- fHw2geomapPtr[i].fXCol = 0;
- fHw2geomapPtr[i].fZRow = 0;
- fHw2geomapPtr[i].fGain = 0;
- }
- for(int i=0; i<nChannels; i ++)
- {
- res = fscanf(fp, "%d %d %d %d\n", &tmpHwaddr, &tmpXCol, &tmpZRow, &tmpGain);
- if(tmpGain < 2)
- {
- fHw2geomapPtr[tmpHwaddr].fXCol = tmpXCol;
- fHw2geomapPtr[tmpHwaddr].fZRow = tmpZRow;
- fHw2geomapPtr[tmpHwaddr].fGain = tmpGain;
- }
+ if ( base )
+ {
+ if ( modId != fModuleId )
+ {
+ fModuleId = modId;
+ if ( base )
+ {
+ sprintf ( fFilepath,"%s/PHOS/mapping/Mod%dRCU0.data", base, GetModuleFromSpec ( specification ) );
+ int nChannels = 0;
+ int maxaddr = 0;
+ int tmpHwaddr = 0;
+ int tmpZRow = 0;
+ int tmpXCol = 0;
+ int tmpGain = 0;
+ int res = 0;
+
+ FILE *fp = fopen ( fFilepath, "r" );
+ if ( fp != 0 )
+ {
+ res = fscanf ( fp, "%d", &nChannels );
+ res = fscanf ( fp, "%d", &maxaddr );
+ if (fHw2geomapPtr)
+ {
+ delete fHw2geomapPtr;
+ }
+ fHw2geomapPtr = new fAltromap[maxaddr +1];
+
+ for ( int i=0; i< maxaddr + 1 ; i ++ )
+ {
+ fHw2geomapPtr[i].fXCol = 0;
+ fHw2geomapPtr[i].fZRow = 0;
+ fHw2geomapPtr[i].fGain = 0;
+ }
+
+ for ( int i=0; i<nChannels; i ++ )
+ {
+ res = fscanf ( fp, "%d %d %d %d\n", &tmpHwaddr, &tmpXCol, &tmpZRow, &tmpGain );
+ if ( tmpGain < 2 )
+ {
+ fHw2geomapPtr[tmpHwaddr].fXCol = tmpXCol;
+ fHw2geomapPtr[tmpHwaddr].fZRow = tmpZRow;
+ fHw2geomapPtr[tmpHwaddr].fGain = tmpGain;
+ }
+ }
+ fIsInitializedMapping = true;
+ fclose ( fp );
+ }
+ else
+ {
+ fIsInitializedMapping = false;
+ }
}
- fIsInitializedMapping = true;
- fclose(fp);
- }
- else
- {
- fIsInitializedMapping = false;
}
}
- else
- {
+ else
+ {
fIsInitializedMapping = false;
- }
-}
+ }
+
+ return fIsInitializedMapping;
+}
+
void
AliHLTPHOSMapper::InitDDLSpecificationMapping()
{
- fSpecificationMapPtr = new fDDLSpecificationMap[PhosHLTConst::NMODULES*PhosHLTConst::NRCUSPERMODULE];
- for(Int_t ddl = 0; ddl < PhosHLTConst::NMODULES*PhosHLTConst::NRCUSPERMODULE; ddl++)
+ fSpecificationMapPtr = new fDDLSpecificationMap[fCaloConstants->GetNMODULES()*fCaloConstants->GetNRCUSPERMODULE()];
+ for(Int_t ddl = 0; ddl < fCaloConstants->GetNMODULES()*fCaloConstants->GetNRCUSPERMODULE(); ddl++)
{
- fSpecificationMapPtr[ddl].fModId = ddl/PhosHLTConst::NRCUSPERMODULE;
+ fSpecificationMapPtr[ddl].fModId = ddl/fCaloConstants->GetNRCUSPERMODULE();
if(ddl%4 == 0)
{
fSpecificationMapPtr[ddl].fRcuZ = 0;
}
- fSpecificationMapPtr[ddl].fRcuZOffset = NZROWSRCU*(fSpecificationMapPtr[ddl].fRcuZ);
- fSpecificationMapPtr[ddl].fRcuXOffset = NXCOLUMNSRCU*(fSpecificationMapPtr[ddl].fRcuX);
+ fSpecificationMapPtr[ddl].fRcuZOffset = fCaloConstants->GetNZROWSRCU()*(fSpecificationMapPtr[ddl].fRcuZ);
+ fSpecificationMapPtr[ddl].fRcuXOffset = fCaloConstants->GetNXCOLUMNSMOD()*(fSpecificationMapPtr[ddl].fRcuX);
}
}
return fIsInitializedMapping;
}
-
-char*
-AliHLTPHOSMapper::GetFilePath()
+Int_t
+AliHLTPHOSMapper::GetChannelID(Int_t hwAddress)
{
- return fFilepath;
+
+ return ((fHw2geomapPtr[hwAddress].fXCol + fSpecificationMapPtr[fDDLId].fRcuXOffset) |
+ ((fHw2geomapPtr[hwAddress].fZRow + fSpecificationMapPtr[fDDLId].fRcuZOffset) << 6) |
+ (fHw2geomapPtr[hwAddress].fGain << 12) |
+ fSpecificationMapPtr[fDDLId].fModId << 13);
}
-UShort_t
-AliHLTPHOSMapper::GetChannelID(Int_t specification, Int_t hwAddress)
+Int_t
+AliHLTPHOSMapper::GetChannelID(AliHLTUInt32_t specification, Int_t hwAddress)
{
Short_t index = 0;
-void
-AliHLTPHOSMapper::GetChannelCoord(const UShort_t channelId, UShort_t* channelCoord)
-{
- channelCoord[0] = channelId&0x3f;
- channelCoord[1] = (channelId >> 6)&0x3f;
- channelCoord[2] = (channelId >> 12)&0x1;
- channelCoord[3] = (channelId >> 13)&0x1f;
- // printf("Channel ID: 0x%X Coordinates: x = %d, z = %d, gain = %d\n", channelId, channelCoord[0], channelCoord[1], channelCoord[2]);
-}
-
-
-
-void
-//AliHLTPHOSMapper::GetChannelCoord(const UShort_t channelId, &AliHLTPHOSCoordinate channelCoord)
-AliHLTPHOSMapper::ChannelId2Coordinate(const UShort_t channelId, AliHLTPHOSCoordinate &channelCoord)
-{
- channelCoord.fX = channelId&0x3f;
- channelCoord.fZ = (channelId >> 6)&0x3f;
- channelCoord.fGain = (channelId >> 12)&0x1;
- channelCoord.fModuleId = (channelId >> 13)&0x1f;
- // printf("Channel ID: 0x%X Coordinates: x = %d, z = %d, gain = %d\n", channelId, channelCoord[0], channelCoord[1], channelCoord[2]);
-}
-
-
-
-void
-AliHLTPHOSMapper::GetLocalCoord(const UShort_t channelId, Float_t* channelCoord)
-{
- channelCoord[0] = (static_cast<Float_t>(channelId&0x3f) - NXCOLUMNSMOD/2)* fCellStep;
- channelCoord[1] = (static_cast<Float_t>((channelId >> 6)&0x3f) - NZROWSMOD/2) * fCellStep;
- // printf("Local coordinates: x = %f, z = %f\n", channelCoord[0], channelCoord[1]);
-}
+// void
+// AliHLTPHOSMapper::GetChannelCoord(const UShort_t channelId, UShort_t* channelCoord)
+// {
+// channelCoord[0] = channelId&0x3f;
+// channelCoord[1] = (channelId >> 6)&0x3f;
+// channelCoord[2] = (channelId >> 12)&0x1;
+// channelCoord[3] = (channelId >> 13)&0x1f;
+// // printf("Channel ID: 0x%X Coordinates: x = %d, z = %d, gain = %d\n", channelId, channelCoord[0], channelCoord[1], channelCoord[2]);
+// }
+//
+//
+//
+// void
+// AliHLTPHOSMapper::ChannelId2Coordinate(const UShort_t channelId, AliHLTPHOSCoordinate &channelCoord)
+// {
+// channelCoord.fX = channelId&0x3f;
+// channelCoord.fZ = (channelId >> 6)&0x3f;
+// channelCoord.fGain = (channelId >> 12)&0x1;
+// channelCoord.fModuleId = (channelId >> 13)&0x1f;
+// // printf("Channel ID: 0x%X Coordinates: x = %d, z = %d, gain = %d\n", channelId, channelCoord[0], channelCoord[1], channelCoord[2]);
+// }
+//
+//
+//
+// void
+// AliHLTPHOSMapper::GetLocalCoord(const UShort_t channelId, Float_t* channelCoord)
+// {
+// channelCoord[0] = (static_cast<Float_t>(channelId&0x3f) - NXCOLUMNSMOD/2)* fCellStep;
+// channelCoord[1] = (static_cast<Float_t>((channelId >> 6)&0x3f) - NZROWSMOD/2) * fCellStep;
+// // printf("Local coordinates: x = %f, z = %f\n", channelCoord[0], channelCoord[1]);
+// }
Int_t
-AliHLTPHOSMapper::GetDDLFromSpec(Int_t specification)
+AliHLTPHOSMapper::GetDDLFromSpec(AliHLTUInt32_t specification)
{
Int_t index = -1;
if(specification == 0x00001) index = 0;
}
Int_t
-AliHLTPHOSMapper::GetModuleFromSpec(Int_t specification)
+AliHLTPHOSMapper::GetModuleFromSpec(AliHLTUInt32_t specification)
{
Int_t module = -1;
//using namespace PhosHLTConst;
#include "Rtypes.h"
-#include "AliHLTLogging.h"
-
+#include "AliHLTCaloMapper.h"
#include "AliPHOSEMCAGeometry.h"
+class AliHLTCaloCoordinate;
class AliHLTPHOSCoordinate;
-class AliHLTPHOSMapper : public AliHLTLogging
-//class AliHLTPHOSMapper
+class AliHLTPHOSMapper : public AliHLTCaloMapper
{
public:
+
AliHLTPHOSMapper();
virtual ~AliHLTPHOSMapper();
- void InitAltroMapping();
+
+ Bool_t InitAltroMapping(const unsigned long specification);
void InitDDLSpecificationMapping();
bool GetIsInitializedMapping();
- char* GetFilePath();
+ char* GetFilePath(const int ddlId);
+
+ Int_t GetChannelID(Int_t hwAddress);
+ Int_t GetChannelID(AliHLTUInt32_t specification, Int_t hwAddress);
- UShort_t GetChannelID(Int_t specification, Int_t hwAddress);
- static void GetChannelCoord(const UShort_t channelId, UShort_t* channelCoord);
- static void ChannelId2Coordinate(const UShort_t channelId, AliHLTPHOSCoordinate &channelCoord );
- static void GetLocalCoord(const UShort_t channelId, Float_t* localCoord);
- int GetDDLFromSpec(Int_t specification);
- int GetModuleFromSpec(Int_t specification);
+ //static void GetChannelCoord(const Int_t channelId, UShort_t* channelCoord);
+ //static void ChannelId2Coordinate(const Int_t channelId, AliHLTCaloCoordinate &channelCoord );
+ //static void GetLocalCoord(const Int_t channelId, Float_t* localCoord);
+ int GetDDLFromSpec(AliHLTUInt32_t specification);
+ int GetModuleFromSpec(AliHLTUInt32_t specification);
struct fAltromap{
int fZRow; // Coordinate in Z direction (beam direction) relatve too one RCU
private:
bool fIsInitializedMapping;
+
AliHLTPHOSMapper(const AliHLTPHOSMapper & );
AliHLTPHOSMapper & operator = (const AliHLTPHOSMapper &);
fDDLSpecificationMap* fSpecificationMapPtr;
//AliPHOSEMCAGeometry fPHOSGeometry;
static const Float_t fCellStep = 2.2;//2.*fPHOSGeometry.GetAirCellHalfSize()[0];
+
+ Int_t fModuleId;
+ int fDDLId;
};
#endif
* provided "as is" without express or implied warranty. *
**************************************************************************/
-#include "AliHLTPHOSRawAnalyzer.h"
#include "AliHLTPHOSRawAnalyzerComponentv3.h"
-#include "AliHLTPHOSChannelDataHeaderStruct.h"
-#include "AliHLTPHOSChannelDataStruct.h"
-#include "AliHLTPHOSMapper.h"
-#include "AliHLTPHOSSanityInspector.h"
-
-#include "AliAltroRawStreamV3.h"
-#include "AliCaloRawStreamV3.h"
-#include "AliRawReaderMemory.h"
-
-#include "AliHLTPHOSConstant.h"
-
+#include "AliHLTPHOSRawAnalyzer.h"
+#include "AliHLTCaloChannelDataHeaderStruct.h"
+#include "AliHLTPHOSDefinitions.h"
#include "AliHLTPHOSUtilities.h"
+#include "AliHLTPHOSMapper.h"
-using namespace PhosHLTConst;
-
-AliHLTPHOSRawAnalyzerComponentv3::AliHLTPHOSRawAnalyzerComponentv3():
- AliHLTPHOSRcuProcessor(),
- fAnalyzerPtr(0),
- fMapperPtr(0),
- fSanityInspectorPtr(0),
- fRawReaderMemoryPtr(0),
- fAltroRawStreamPtr(0),
- fAlgorithm(0),
- fOffset(0),
- fBunchSizeCut(0),
- fMinPeakPosition(0),
- fMaxPeakPosition(100),
- fDoPushRawData(false),
- fInspectSanity(false),
- fRawDataWriter(0)
+AliHLTPHOSRawAnalyzerComponentv3::AliHLTPHOSRawAnalyzerComponentv3() :
+ AliHLTCaloRawAnalyzerComponentv3("PHOS")
+ ,fAnalyzerPtr(0)
{
- //comment
- fMapperPtr = new AliHLTPHOSMapper();
-
- fRawReaderMemoryPtr = new AliRawReaderMemory();
-
- fAltroRawStreamPtr = new AliAltroRawStreamV3(fRawReaderMemoryPtr);
- // fAltroRawStreamPtr = new AliCaloRawStreamV3(fRawReaderMemoryPtr, TString("PHOS"));
- fSanityInspectorPtr = new AliHLTPHOSSanityInspector();
-
- if( fDoPushRawData == true )
- {
-
- fRawDataWriter = new AliHLTPHOSRawAnalyzerComponentv3::RawDataWriter();
-
- }
-
+ // See header file for class documentation
}
-
AliHLTPHOSRawAnalyzerComponentv3::~AliHLTPHOSRawAnalyzerComponentv3()
{
//comment
- Deinit();
-}
-
-int
-AliHLTPHOSRawAnalyzerComponentv3::Deinit()
-{
- //comment
- if(fAnalyzerPtr)
- {
- delete fAnalyzerPtr;
- fAnalyzerPtr = 0;
- }
- if(fMapperPtr)
- {
- delete fMapperPtr;
- fMapperPtr = 0;
- }
- if(fRawReaderMemoryPtr)
- {
- delete fRawReaderMemoryPtr;
- fRawReaderMemoryPtr = 0;
- }
- if(fAltroRawStreamPtr)
- {
- delete fAltroRawStreamPtr;
- fAltroRawStreamPtr = 0;
- }
- return 0;
-}
-
-const char*
-AliHLTPHOSRawAnalyzerComponentv3::GetComponentID()
-{
- //comment
- return "PhosRawAnalyzerv3";
}
{
//comment
list.clear();
- list.push_back( AliHLTPHOSDefinitions::fgkDDLPackedRawDataType | kAliHLTDataOriginPHOS );
+ list.push_back( AliHLTPHOSDefinitions::fgkDDLPackedRawDataType);
}
AliHLTComponentDataType
AliHLTPHOSRawAnalyzerComponentv3::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier )
{
//comment
- constBase = sizeof(AliHLTPHOSChannelDataHeaderStruct);
- inputMultiplier = 0.5;
+ constBase = sizeof(AliHLTCaloChannelDataHeaderStruct);
+ inputMultiplier = 1.5;
}
int
HLTDebug("Data block is not of type fgkDDLPackedRawDataType");
continue;
}
-
+ if(iter->fSpecification != fCurrentSpec)
+ {
+ fCurrentSpec = iter->fSpecification;
+ InitMapping(iter->fSpecification);
+ }
blockSize = DoIt(iter, outputPtr, size, totSize); // Processing the block
if(blockSize == -1) // If the processing returns -1 we are out of buffer and return an error msg.
outputPtr += blockSize; //Updating position of the output buffer
}
- fPhosEventCount++;
+ fCaloEventCount++;
size = totSize; //telling the framework how much buffer space we have used.
return 0;
}//end DoEvent
-Int_t
-AliHLTPHOSRawAnalyzerComponentv3::DoIt(const AliHLTComponentBlockData* iter, AliHLTUInt8_t* outputPtr, const AliHLTUInt32_t size, UInt_t& totSize)
-{
- //comment
- int tmpsize= 0;
- Int_t crazyness = 0;
- Int_t nSamples = 0;
- Short_t channelCount = 0;
-
- // Firs we want to write a header to the output
- AliHLTPHOSChannelDataHeaderStruct *channelDataHeaderPtr = reinterpret_cast<AliHLTPHOSChannelDataHeaderStruct*>(outputPtr);
-
- // Then comes the channel data
- AliHLTPHOSChannelDataStruct *channelDataPtr = reinterpret_cast<AliHLTPHOSChannelDataStruct*>(outputPtr+sizeof(AliHLTPHOSChannelDataHeaderStruct));
-
- //Adding to the total size of data written
- totSize += sizeof( AliHLTPHOSChannelDataHeaderStruct );
-
-
- fRawReaderMemoryPtr->SetMemory(reinterpret_cast<UChar_t*>(iter->fPtr), static_cast<ULong_t>(iter->fSize));
- fRawReaderMemoryPtr->SetEquipmentID(fMapperPtr->GetDDLFromSpec(iter->fSpecification) + 1792);
- fRawReaderMemoryPtr->Reset();
- fRawReaderMemoryPtr->NextEvent();
-
- // if( fDoPushRawData == true)
-// {
-// fRawDataWriter->NewEvent( );
-// }
-
- if(fAltroRawStreamPtr != NULL)
- {
- delete fAltroRawStreamPtr;
- fAltroRawStreamPtr=NULL;
- }
-
- fAltroRawStreamPtr = new AliAltroRawStreamV3(fRawReaderMemoryPtr);
-
- // fAltroRawStreamPtr = new AliCaloRawStreamV3(fRawReaderMemoryPtr, TString("PHOS"));
-
- if(fAltroRawStreamPtr->NextDDL())
- {
- fOffset = (fAltroRawStreamPtr->GetAltroCFG1() >> 10) & 0xf;
- int cnt = 0;
- while( fAltroRawStreamPtr->NextChannel() )
- {
- // Removing TRUs
- if( fAltroRawStreamPtr->GetHWAddress() < 128 || ( fAltroRawStreamPtr->GetHWAddress() ^ 0x800) < 128 )
- {
- continue;
- }
- else
- {
- cnt ++;
- UShort_t* firstBunchPtr = 0;
- UShort_t chId = fMapperPtr->GetChannelID(iter->fSpecification, fAltroRawStreamPtr->GetHWAddress());
-
-// if( fDoPushRawData == true)
-// {
-// fRawDataWriter->SetChannelId( chId );
-// }
- while( fAltroRawStreamPtr->NextBunch() == true )
- {
-
-// if( fDoPushRawData == true)
-// {
-// fRawDataWriter->WriteBunchData( fAltroRawStreamPtr->GetSignals(), nSamples, fAltroRawStreamPtr->GetEndTimeBin() );
-// }
-
- firstBunchPtr = const_cast< UShort_t* >( fAltroRawStreamPtr->GetSignals() );
-
- nSamples = fAltroRawStreamPtr->GetBunchLength();
-
- }
- if(firstBunchPtr)
- {
- totSize += sizeof( AliHLTPHOSChannelDataStruct );
- if(totSize > size)
- {
- HLTError("Buffer overflow: Trying to write data of size: %d bytes. Output buffer available: %d bytes.", totSize, size);
- return -1;
- }
-// if(fInspectSanity)
-// {
-// crazyness = fSanityInspectorPtr->CheckAndHealInsanity(firstBunchPtr, nSamples);
-// }
-
- fAnalyzerPtr->SetData( firstBunchPtr, nSamples);
- fAnalyzerPtr->Evaluate(0, nSamples);
-
- channelDataPtr->fChannelID = chId;
- channelDataPtr->fEnergy = static_cast<Float_t>(fAnalyzerPtr->GetEnergy()) - fOffset;
-
- channelDataPtr->fTime = static_cast<Float_t>(fAnalyzerPtr->GetTiming());
- channelDataPtr->fCrazyness = static_cast<Short_t>(crazyness);
- channelCount++;
- channelDataPtr++; // Updating position of the free output.
- }
- }
-// if(fDoPushRawData)
-// {
-// fRawDataWriter->NewChannel();
-// }
- }
- }
-
- //Writing the header
- channelDataHeaderPtr->fNChannels = channelCount;
- channelDataHeaderPtr->fAlgorithm = fAlgorithm;
- channelDataHeaderPtr->fInfo = 0;
-
-// if( fDoPushRawData == true)
-// {
-// tmpsize += fRawDataWriter->CopyBufferToSharedMemory( (UShort_t *)channelDataPtr, size, totSize);
-// }
-
- // channelDataHeaderPtr->fHasRawData = false;
- channelDataHeaderPtr->fHasRawData = fDoPushRawData;
-
- HLTDebug("Number of channels: %d", channelCount);
- //returning the size used
- // delete fAltroRawStreamPtr;
- tmpsize += sizeof(AliHLTPHOSChannelDataStruct)*channelCount + sizeof(AliHLTPHOSChannelDataHeaderStruct);
-
- // return sizeof(AliHLTPHOSChannelDataStruct)*channelCount + sizeof(AliHLTPHOSChannelDataHeaderStruct);
- return tmpsize;
-
-}
-
-
-int
-AliHLTPHOSRawAnalyzerComponentv3::WriteRawData(AliHLTPHOSChannelDataStruct*) //dtaPtr)
-{
- return 0;
-}
-
-int
-AliHLTPHOSRawAnalyzerComponentv3::DoInit( int argc, const char** argv )
-{
-
- //See base class for documentation
- // fPrintInfo = kFALSE;
- int iResult=0;
- fMapperPtr = new AliHLTPHOSMapper();
-
- for(int i = 0; i < argc; i++)
- {
- if(!strcmp("-bunchsizecut", argv[i]))
- {
- fBunchSizeCut = atoi(argv[i+1]);
- }
- if(!strcmp("-minpeakposition", argv[i]))
- {
- fMinPeakPosition = atoi(argv[i+1]);
- }
- if(!strcmp("-maxpeakposition", argv[i]))
- {
- fMaxPeakPosition = atoi(argv[i+1]);
- }
- if(!strcmp("-pushrawdata", argv[i]))
- {
- fDoPushRawData = true;
- }
- if(!strcmp("-inspectsanity", argv[i]))
- {
- fInspectSanity = true;
- }
- }
-
- if(fMapperPtr->GetIsInitializedMapping() == false)
- {
- Logging(kHLTLogFatal, __FILE__ , IntToChar( __LINE__ ) , "AliHLTPHOSMapper::Could not initialise mapping from file %s, aborting", fMapperPtr->GetFilePath());
- return -4;
- }
-
- return iResult;
-}
-
-
-
-
-AliHLTPHOSRawAnalyzerComponentv3::RawDataWriter::RawDataWriter() : //fIsFirstChannel(true),
- fRawDataBuffer(0),
- fCurrentChannelSize(0),
- // fIsFirstChannel(true),
- fBufferIndex(0),
- fBufferSize( NZROWSRCU*NXCOLUMNSRCU*ALTROMAXSAMPLES*NGAINS +1000 ),
- fCurrentChannelIdPtr(0),
- fCurrentChannelSizePtr(0),
- fCurrentChannelDataPtr(0),
- fTotalSize(0)
-{
- fRawDataBuffer = new UShort_t[fBufferSize];
- Init();
-}
-
-
-
-void
-AliHLTPHOSRawAnalyzerComponentv3::RawDataWriter::Init()
-{
- fCurrentChannelIdPtr = fRawDataBuffer;
- fCurrentChannelSizePtr = fRawDataBuffer +1;
- fCurrentChannelDataPtr = fRawDataBuffer +2;
- ResetBuffer();
-}
-
-
-void
-AliHLTPHOSRawAnalyzerComponentv3::RawDataWriter::NewEvent()
-{
- Init();
- fTotalSize = 0;
-}
-
-void
-AliHLTPHOSRawAnalyzerComponentv3::RawDataWriter::NewChannel( )
+void AliHLTPHOSRawAnalyzerComponentv3::InitMapping ( const int specification )
{
- *fCurrentChannelSizePtr = fCurrentChannelSize;
- fCurrentChannelIdPtr += fCurrentChannelSize;
- fCurrentChannelSizePtr += fCurrentChannelSize;
- fCurrentChannelDataPtr += fCurrentChannelSize;
- fBufferIndex = 0;
- fCurrentChannelSize = 2;
- fTotalSize += 2;
+ // See header file for class documentation
+ fMapperPtr = new AliHLTPHOSMapper;
}
-
-void
-AliHLTPHOSRawAnalyzerComponentv3::RawDataWriter::WriteBunchData(const UShort_t *bunchdata, const int length, const UInt_t starttimebin )
-{
- fCurrentChannelDataPtr[fBufferIndex] = starttimebin;
- fCurrentChannelSize ++;
- fBufferIndex++;
- fCurrentChannelDataPtr[fBufferIndex] = length;
- fCurrentChannelSize ++;
- fBufferIndex++;
-
- fTotalSize +=2;
-
- for(int i=0; i < length; i++)
- {
- fCurrentChannelDataPtr[ fBufferIndex + i ] = bunchdata[i];
- }
-
- fCurrentChannelSize += length;
- fTotalSize += length;
- fBufferIndex += length;
-}
-
-
-void
-AliHLTPHOSRawAnalyzerComponentv3::RawDataWriter::SetChannelId( const UShort_t channeldid )
-{
- *fCurrentChannelIdPtr = channeldid;
-}
-
-
-void
-AliHLTPHOSRawAnalyzerComponentv3::RawDataWriter::ResetBuffer()
-{
- for(int i=0; i < fBufferSize ; i++ )
- {
- fRawDataBuffer[i] = 0;
- }
-}
-
-
-int
-AliHLTPHOSRawAnalyzerComponentv3::RawDataWriter::CopyBufferToSharedMemory(UShort_t *memPtr, const int sizetotal, const int sizeused )
-{
- int sizerequested = (sizeof(int)*fTotalSize + sizeused);
-
- if( sizerequested > sizetotal )
- {
- return 0;
- }
- else
- {
- for(int i=0; i < fTotalSize; i++)
- {
- memPtr[i] = fRawDataBuffer[i];
- }
- return fTotalSize;
- }
-}
-
// or
// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
-#include "AliHLTPHOSRcuProcessor.h"
-
-
+#include <AliHLTCaloRawAnalyzerComponentv3.h>
class AliHLTPHOSRawAnalyzer;
-class AliHLTPHOSRcuCellEnergyDataStruct;
-class AliHLTPHOSMapper;
-class AliHLTPHOSSanityInspector;
-class AliHLTPHOSDigitMaker;
-class AliHLTPHOSDigitContainerDataStruct;
-class AliRawReaderMemory;
-class AliAltroRawStreamV3;
-class AliHLTPHOSChannelDataStruct;
-
-//class RawDataWriter;
-
/**
* @class AliHLTPHOSRawAnalyzerComponentv3
*/
-class AliHLTPHOSRawAnalyzerComponentv3 : public AliHLTPHOSRcuProcessor
+class AliHLTPHOSRawAnalyzerComponentv3 : public AliHLTCaloRawAnalyzerComponentv3
{
public:
/** Destructor */
virtual ~AliHLTPHOSRawAnalyzerComponentv3();
- /** interface function, see @ref AliHLTComponent for description */
- virtual int DoInit(int argc =0, const char** argv = 0);
-
- /** interface function, see @ref AliHLTComponent for description */
- virtual int Deinit();
-
/** interface function, see @ref AliHLTComponent for description */
virtual const char* GetComponentID() = 0;
/** interface function, see @ref AliHLTComponent for description */
virtual AliHLTComponent* Spawn() = 0;
+ //virtual void InitMapping(const AliHLTUInt32_t specification);
+
protected:
- /** interface function, see @ref AliHLTComponent for description */
- using AliHLTPHOSRcuProcessor::DoEvent;
-
/** interface function, see @ref AliHLTComponent for description */
virtual int DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr,
AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks );
-
- /**
- * Do the real processing in the component
- * @param iter is the pointer to the data blocks
- * @param outputPtr is the pointer to the output buffer
- * @param size is the available size for output
- * @param totSize is the total size used for output
- * @return the size output size used
- */
- virtual Int_t DoIt(const AliHLTComponentBlockData* iter, AliHLTUInt8_t* outputPtr, const AliHLTUInt32_t size, UInt_t& totSize);
-
-
+
/** Pointer to an analyzer object used for raw data anlysis */
AliHLTPHOSRawAnalyzer *fAnalyzerPtr; //COMMENT
- private:
+ virtual void InitMapping(const int specification);
- int WriteRawData( AliHLTPHOSChannelDataStruct *dtaPtr );
+ private:
/** Keep the copy constructor private since it should not be used */
AliHLTPHOSRawAnalyzerComponentv3(const AliHLTPHOSRawAnalyzerComponentv3 & );
/** Keep the assignement operator private since it should not be used */
AliHLTPHOSRawAnalyzerComponentv3 & operator = (const AliHLTPHOSRawAnalyzerComponentv3 &);
- /** Mapping from harware address to geometrical address */
- AliHLTPHOSMapper *fMapperPtr; //!transient
-
- /** Pointer to object which may check the integrity of the data */
- AliHLTPHOSSanityInspector *fSanityInspectorPtr; //!transient
-
- /** Pointer to the raw data reader which reads from memory */
- AliRawReaderMemory* fRawReaderMemoryPtr; //!transient
-
- /** Pointer to the raw stream */
- AliAltroRawStreamV3* fAltroRawStreamPtr; //!transient
-
- /** Describing which algorithm we are using */
- Short_t fAlgorithm; //COMMENT
-
- /** The offset applied before ZS */
- Int_t fOffset; //COMMENT
-
- /** The minimum length a bunch can have to be considered */
- Int_t fBunchSizeCut; //COMMENT
-
- /** The lowest position a peak can have to be considered */
- Int_t fMinPeakPosition; //COMMENT
-
- /** The maximum position a peak can have to be considered */
- Int_t fMaxPeakPosition; //COMMENT
-
- /** Should we push raw data? */
- bool fDoPushRawData; //COMMENT
-
- /** Should we check for and heal insanity? */
- bool fInspectSanity; //COMMENT
-
- // const UShort_t* fRawDataBuffer;
- // RawDataWriter *fRawDataWriter;
-
- // class RawDataWriter : public AliHLTLogging
-
- class RawDataWriter
- {
- public:
- RawDataWriter();
- ~RawDataWriter();
- // void WriteChannelId(const UShort_t channeldid );
- void NewChannel( );
- void WriteBunchData(const UShort_t *bunchdata, const int length, const UInt_t starttimebin );
- void ResetBuffer();
- void SetChannelId( const UShort_t channeldid );
-
- //void CopyBufferToSharedMemory(UShort_t *memPtr, const int sizetotal, const int sizeused );
- int CopyBufferToSharedMemory(UShort_t *memPtr, const int sizetotal, const int sizeused );
-
- void NewEvent();
-
- private:
- RawDataWriter (const RawDataWriter & );
- RawDataWriter & operator = (const RawDataWriter &);
-
- void Init();
-
- // bool fIsFirstChannel;
- UShort_t* fRawDataBuffer;
- int fCurrentChannelSize;
- int fBufferIndex;
- int fBufferSize;
- UShort_t *fCurrentChannelIdPtr;
- UShort_t *fCurrentChannelSizePtr;
- UShort_t *fCurrentChannelDataPtr;
- int fTotalSize;
- };
-
- RawDataWriter *fRawDataWriter;
+ /** The current specification for which the mapping is loaded */
+ AliHLTUInt32_t fCurrentSpec;
};
#ifndef ALIHLTPHOSRAWANALYZERCRUDECOMPONENT_H
#define ALIHLTPHOSRAWANALYZERCRUDECOMPONENT_H
-//#include "AliHLTPHOSRawAnalyzerComponent.h"
#include "AliHLTPHOSRawAnalyzerComponentv3.h"
+//#include "AliHLTCaloRawAnalyzerComponentv3.h"
/* Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
-//class AliHLTPHOSRawAnalyzerCrudeComponent: public AliHLTPHOSRawAnalyzerComponent
class AliHLTPHOSRawAnalyzerCrudeComponent: public AliHLTPHOSRawAnalyzerComponentv3
+//class AliHLTPHOSRawAnalyzerCrudeComponent: public AliHLTCaloRawAnalyzerComponentv3
{
public:
AliHLTPHOSRawAnalyzerCrudeComponent();
#include "AliHLTPHOSRawAnalyzerPeakFinderComponent.h"
#include "AliHLTPHOSRawAnalyzerPeakFinder.h"
-//#include <cstdlib>
-//#include "AliHLTPHOSCommonDefs.h"
-#include "AliHLTPHOSConstant.h"
-
-using namespace PhosHLTConst;
AliHLTPHOSRawAnalyzerPeakFinderComponent gAliHLTPHOSRawAnalyzerPeakFinderComponent;
{
fAnalyzerPtr = new AliHLTPHOSRawAnalyzerPeakFinder();
- if(LoadPFVector() == kFALSE)
+ if(1)//LoadPFVector() == kFALSE)
{
// cout << "Warning, could not load PF vectors" << endl;
}
Bool_t
AliHLTPHOSRawAnalyzerPeakFinderComponent::LoadPFVector()
{
- return LoadPFVector(PFDEFAULTSTARTINDEX, PFDEFAULTNSAMPLES, DEFAULTTAU, DEFAULTFS );
+ return LoadPFVector(fCaloConstants->GetPFDEFAULTSTARTINDEX(), fCaloConstants->GetPFDEFAULTNSAMPLES(),
+ fCaloConstants->GetDEFAULTTAU(), fCaloConstants->GetDEFAULTFS() );
}
Bool_t
AliHLTPHOSRawAnalyzerPeakFinderComponent::LoadPFVector(int startIndex, int nSamples, int tau, int fs)
{
- char tmpPFPath[PFMAXPATHLENGTH];
+
+ char tmpPFPath[fCaloConstants->GetPFMAXPATHLENGTH()];
Double_t * tmpAVector = new Double_t[nSamples];
Double_t * tmpTVector = new Double_t[nSamples];
sprintf(tmpPFPath,"%s%s/start%dN%dtau%dfs%d.txt", getenv("ALICE_ROOT"), PFVECTORDIR, startIndex, nSamples, tau, fs);
fRawData.fCrazyness = tmpChannelPtr->fCrazyness;
Reset(fRawData);
//AliHLTPHOSMapper::ChannelId2Coordinate(const UShort_t channelId, AliHLTPHOSCoordinate &channelCoord)
- AliHLTPHOSMapper::ChannelId2Coordinate( fRawData.fChannelID, fRawData.fCoordinate);
+// AliHLTPHOSMapper::ChannelId2Coordinate( fRawData.fChannelID, fRawData.fCoordinate);
if( fRawData.fChannelID == fRawDataPtr[0] )
{
void
AliHLTPHOSSharedMemoryInterfacev2::Reset(AliHLTPHOSChannelRawDataStruct &str)
{
- for(int i=0; i< ALTROMAXSAMPLES; i++ )
+ for(int i=0; i< 1008; i++ )
{
str.fDataPtr[i] = 0;
}