+// $Id$
/**************************************************************************
* This file is property of and copyright by the ALICE HLT Project *
* provided "as is" without express or implied warranty. *
**************************************************************************/
+
#include "AliCaloRawAnalyzer.h"
#include "AliCaloBunchInfo.h"
#include "AliCaloFitResults.h"
#include "AliHLTCaloChannelDataStruct.h"
#include "AliHLTCaloMapper.h"
#include "AliHLTCaloSanityInspector.h"
-// #include "AliAltroRawStreamV3.h"
#include "AliRawReaderMemory.h"
#include "AliCaloRawStreamV3.h"
#include "AliHLTCaloConstantsHandler.h"
#include "AliHLTCaloChannelRawDataStruct.h"
#include "AliLog.h"
+#include "TStopwatch.h"
+
+#include "AliCaloRawAnalyzerFactory.h"
+
+//#include "AliCaloConstants.h"
+
+//#include "AliCaloRawAnalyzer.h"
+
+//using namespace Algo;
#include <vector>
using namespace std;
ClassImp(AliHLTCaloRawAnalyzerComponentv3);
-#include "TStopwatch.h"
-
-//TStopwatch fgWatch; //CRAP PTH
-
-
-AliHLTCaloRawAnalyzerComponentv3::AliHLTCaloRawAnalyzerComponentv3(TString det):AliHLTCaloProcessor(),
- AliHLTCaloConstantsHandler(det),
- fAnalyzerPtr(0),
- fMapperPtr(0),
- fCurrentSpec(-1),
- fDebug(false),
- fSanityInspectorPtr(0),
- fRawReaderMemoryPtr(0),
- fAltroRawStreamPtr(0),
- fAlgorithm(0),
- fOffset(0),
- fBunchSizeCut(0),
- fMinPeakPosition(0),
- fMaxPeakPosition(100),
- fDoPushBadRawData(false),
- fDoPushRawData(false),
- fRawDataWriter(0)
+
+AliHLTCaloRawAnalyzerComponentv3::AliHLTCaloRawAnalyzerComponentv3(TString det, fitAlgorithm algo ):AliHLTCaloProcessor(),
+ AliHLTCaloConstantsHandler(det),
+ fAnalyzerPtr(0),
+ fMapperPtr(0),
+ fCurrentSpec(-1),
+ fDebug(false),
+ fSanityInspectorPtr(0),
+ fRawReaderMemoryPtr(0),
+ fAltroRawStreamPtr(0),
+ fDetector(det),
+ fAlgorithm(algo),
+ fOffset(0),
+ fBunchSizeCut(0),
+ fMinPeakPosition(0),
+ fMaxPeakPosition(100),
+ fDoPushBadRawData(false),
+ fDoPushRawData(false),
+ fRawDataWriter(0)
{
- fSanityInspectorPtr = new AliHLTCaloSanityInspector();
+ //Constructor
- if( fDoPushRawData == true )
- {
- fRawDataWriter = new RawDataWriter(fCaloConstants);
- }
-
- fRawReaderMemoryPtr = new AliRawReaderMemory();
- fAltroRawStreamPtr = new AliCaloRawStreamV3(fRawReaderMemoryPtr, det);
}
AliHLTCaloRawAnalyzerComponentv3::~AliHLTCaloRawAnalyzerComponentv3()
{
- delete fRawReaderMemoryPtr;
- delete fAltroRawStreamPtr;
- delete fRawDataWriter;
- delete fSanityInspectorPtr;
+ //destructor
}
-
int
AliHLTCaloRawAnalyzerComponentv3::DoInit( int argc, const char** argv )
{
AliLog::SetGlobalLogLevel(AliLog::kError); //PHOS sometimes produces bad data -> Fill up the HLT logs...
}
}
+
+ fAnalyzerPtr = AliCaloRawAnalyzerFactory::CreateAnalyzer(fAlgorithm);
+ fAnalyzerPtr->SetIsZeroSuppressed(true);
+ fSanityInspectorPtr = new AliHLTCaloSanityInspector();
+
+ if( fDoPushRawData == true )
+ {
+ fRawDataWriter = new RawDataWriter(fCaloConstants);
+ }
+ fRawReaderMemoryPtr = new AliRawReaderMemory();
+ fAltroRawStreamPtr = new AliCaloRawStreamV3(fRawReaderMemoryPtr, fDetector);
return iResult;
}
int
AliHLTCaloRawAnalyzerComponentv3::DoDeinit()
{
+ //comment
if(fAltroRawStreamPtr)
{
delete fAltroRawStreamPtr;
fAltroRawStreamPtr = 0;
}
+
+ if (fRawReaderMemoryPtr) delete fRawReaderMemoryPtr;
+ fRawReaderMemoryPtr=NULL;
+ if (fAltroRawStreamPtr) delete fAltroRawStreamPtr;
+ fAltroRawStreamPtr=NULL;
+ if (fRawDataWriter) delete fRawDataWriter;
+ fRawDataWriter=NULL;
+ if (fSanityInspectorPtr) delete fSanityInspectorPtr;
+ fSanityInspectorPtr=NULL;
+
return 0;
}
void
AliHLTCaloRawAnalyzerComponentv3::PrintDebugInfo()
{
- static TStopwatch Watch; //CRAP PTH
+ //comment
+ static TStopwatch watch; //CRAP PTH
static double wlast = -1;
static double wcurrent = 0;
{
cout << __FILE__ << __LINE__ << " : Processing event " << fCaloEventCount << endl;
wlast = wcurrent;
- wcurrent = Watch.RealTime();
+ wcurrent = watch.RealTime();
cout << __FILE__ << __LINE__ << "The event rate is " <<
- 1000/( wcurrent - wlast ) << " Hz" << endl; Watch.Start(kFALSE);
+ 1000/( wcurrent - wlast ) << " Hz" << endl; watch.Start(kFALSE);
}
}
}
bool
AliHLTCaloRawAnalyzerComponentv3::CheckInputDataType(const AliHLTComponentDataType &datatype)
{
+ //comment
vector <AliHLTComponentDataType> validTypes;
GetInputDataTypes(validTypes);
- for(int i=0; i < validTypes.size(); i++ )
+ for(UInt_t i=0; i < validTypes.size(); i++ )
{
if ( datatype == validTypes.at(i) )
{
AliHLTComponentTriggerData& /*trigData*/,
AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks )
{
+ //comment
if(!IsDataEvent())
{
size = 0;
Int_t
AliHLTCaloRawAnalyzerComponentv3::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;
else
{
++ cnt;
- UShort_t* firstBunchPtr = 0;
+ //UShort_t* firstBunchPtr = 0;
int chId = fMapperPtr->GetChannelID(iter->fSpecification, fAltroRawStreamPtr->GetHWAddress());
-
+ //patch to skip LG in EMC
+ if(fDetector.CompareTo("EMCAL") == 0 && (int)((chId >> 12)&0x1) == 0) continue;
if( fDoPushRawData == true)
{
fRawDataWriter->SetChannelId( chId );
fRawDataWriter->WriteBunchData( fAltroRawStreamPtr->GetSignals(),
nSamples, fAltroRawStreamPtr->GetEndTimeBin() );
}
- firstBunchPtr = const_cast< UShort_t* >( fAltroRawStreamPtr->GetSignals() );
+ //firstBunchPtr = const_cast< UShort_t* >( fAltroRawStreamPtr->GetSignals() );
}
totSize += sizeof( AliHLTCaloChannelDataStruct );
channelDataPtr->fChannelID = chId;
channelDataPtr->fEnergy = static_cast<Float_t>( res.GetAmp() ) - fOffset;
channelDataPtr->fTime = static_cast<Float_t>( res.GetTof() );
+ if(fDetector.CompareTo("EMCAL") == 0) channelDataPtr->fTime = static_cast<Float_t>( res.GetTof() )*100E-9 - fAltroRawStreamPtr->GetL1Phase();
channelDataPtr->fCrazyness = static_cast<Short_t>(crazyness);
channelCount++;
channelDataPtr++; // Updating position of the free output.
fCurrentChannelDataPtr(0),
fTotalSize(0)
{
+ //comment
fRawDataBuffer = new UShort_t[fBufferSize];
Init();
}
void
AliHLTCaloRawAnalyzerComponentv3::RawDataWriter::Init()
{
+ //comment
fCurrentChannelIdPtr = fRawDataBuffer;
fCurrentChannelSizePtr = fRawDataBuffer +1;
fCurrentChannelDataPtr = fRawDataBuffer +2;
void
AliHLTCaloRawAnalyzerComponentv3::RawDataWriter::NewEvent()
{
+ //comment
Init();
fTotalSize = 0;
}
void
AliHLTCaloRawAnalyzerComponentv3::RawDataWriter::NewChannel( )
{
+ //comment
*fCurrentChannelSizePtr = fCurrentChannelSize;
fCurrentChannelIdPtr += fCurrentChannelSize;
fCurrentChannelSizePtr += fCurrentChannelSize;