1 /**************************************************************************
2 * This file is property of and copyright by the Experimental Nuclear *
3 * Physics Group, Dep. of Physics *
4 * University of Oslo, Norway, 2007 *
6 * Author: Per Thomas Hille <perthi@fys.uio.no> for the ALICE HLT Project.*
7 * Contributors are mentioned in the code where appropriate. *
8 * Please report bugs to perthi@fys.uio.no *
10 * Permission to use, copy, modify and distribute this software and its *
11 * documentation strictly for non-commercial purposes is hereby granted *
12 * without fee, provided that the above copyright notice appears in all *
13 * copies and that both the copyright notice and this permission notice *
14 * appear in the supporting documentation. The authors make no claims *
15 * about the suitability of this software for any purpose. It is *
16 * provided "as is" without express or implied warranty. *
17 **************************************************************************/
19 // Base class fro anlyzing EMCAL raww data
20 // Further documentation found in base class
27 #include "AliHLTEMCALRawAnalyzerComponent.h"
28 #include "AliHLTEMCALMapper.h"
29 #include "AliHLTEMCALDefinitions.h"
30 #include "AliHLTCaloChannelDataHeaderStruct.h"
33 //#include "TStopwatch.h"
34 //TStopwatch fgWatch; //CRAP PTH
37 AliHLTEMCALRawAnalyzerComponent::AliHLTEMCALRawAnalyzerComponent() : AliHLTCaloRawAnalyzerComponentv3("EMCAL")
44 AliHLTEMCALRawAnalyzerComponent::~AliHLTEMCALRawAnalyzerComponent()
52 AliHLTEMCALRawAnalyzerComponent::GetInputDataTypes( vector <AliHLTComponentDataType>& list)
55 list.push_back( AliHLTEMCALDefinitions::fgkDDLRawDataType | kAliHLTDataOriginEMCAL );
60 AliHLTComponentDataType
61 AliHLTEMCALRawAnalyzerComponent::GetOutputDataType()
64 return AliHLTEMCALDefinitions::fgkChannelDataType;
69 AliHLTEMCALRawAnalyzerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier )
72 constBase = sizeof(AliHLTCaloChannelDataHeaderStruct);
73 inputMultiplier = 0.5;
78 AliHLTEMCALRawAnalyzerComponent::DoInit()
85 AliHLTEMCALRawAnalyzerComponent::CheckInputDataType(const AliHLTComponentDataType &datatype)
87 // Cheking if datatype is the correct one before processing
88 if ( datatype == AliHLTEMCALDefinitions::fgkDDLRawDataType )
100 AliHLTEMCALRawAnalyzerComponent::InitMapping( const int specification )
103 if ( fMapperPtr == 0 )
105 fMapperPtr = new AliHLTEMCALMapper( specification );
108 if(fMapperPtr->GetIsInitializedMapping() == false )
110 HLTError("%d:%d, ERROR, mapping not initialized ", __FILE__, __LINE__ );
117 AliHLTEMCALRawAnalyzerComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, AliHLTComponentTriggerData& /*trigData*/,
118 AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks )
120 //-----------------------
121 static int evntcnt = 0;
122 // static double wlast = -1;
123 // static double wcurrent = 0;
128 if( evntcnt %100 == 0 )
131 cout << __FILE__ << __LINE__ << " : Processing event " << evntcnt << endl;
133 wcurrent = fgWatch.RealTime();
134 cout << wlast << ":" << wcurrent << endl;
135 cout << __FILE__ << __LINE__ << "The event rate is " << 100/( wcurrent - wlast ) << " Hz" << endl;
136 fgWatch.Start(kFALSE);
137 // wlast = fgWatch.RealTime();
142 Int_t blockSize = -1;
144 const AliHLTComponentBlockData* iter = NULL;
147 for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
150 if( ! CheckInputDataType(iter->fDataType) )
156 InitMapping( iter->fSpecification);
157 blockSize = DoIt(iter, outputPtr, size, totSize); // Processing the block
159 if(blockSize == -1) // If the processing returns -1 we are out of buffer and return an error msg.
164 totSize += blockSize; //Keeping track of the used size
165 AliHLTComponentBlockData bdChannelData;
166 FillBlockData( bdChannelData );
167 bdChannelData.fOffset = 0; //FIXME
168 bdChannelData.fSize = blockSize;
170 // bdChannelData.fDataType = AliHLTPHOSDefinitions::fgkChannelDataType;
171 bdChannelData.fDataType = AliHLTEMCALDefinitions::fgkChannelDataType;
173 bdChannelData.fSpecification = iter->fSpecification;
174 outputBlocks.push_back(bdChannelData);
175 outputPtr += blockSize; //Updating position of the output buffer
179 size = totSize; //telling the framework how much buffer space we have used.