* provided "as is" without express or implied warranty. *
**************************************************************************/
-
-/// @class AliHLTPHOSRawAnalyzerComponent
-/// Base class of PHOS HLT online raw analysis component.
-/// The class provides a common interface for the implementation of PHOS
-/// HLT raw data
-/// processors components. The class is intended for processing of
-/// arrays of raw data samples to evaluate energy and timing.
-/// The Energy will be given in entities of ADC leves ranging from 0 to
-/// 1023. Timing will be given in entities of samples periods.
-/// Drived clases must implement the fucntions
-/// - @ref GetComponentID
-/// - @ref Spawn
-
-
-
#include "AliHLTPHOSRawAnalyzer.h"
#include "AliHLTPHOSRawAnalyzerComponent.h"
-#include "AliRawReaderMemory.h"
-#include "AliCaloRawStream.h"
-#include <cstdlib>
#include "AliHLTPHOSRcuCellEnergyDataStruct.h"
-#include "AliHLTPHOSRcuChannelDataStruct.h"
-
-const AliHLTComponentDataType AliHLTPHOSRawAnalyzerComponent::fgkInputDataTypes[]={kAliHLTVoidDataType,{0,"",""}}; //'zero' terminated array
-int AliHLTPHOSRawAnalyzerComponent::fgEventCount = 0;
-
-
-
-AliHLTPHOSRawAnalyzerComponent::AliHLTPHOSRawAnalyzerComponent():AliHLTProcessor(), fAnalyzerPtr(0),
-fEquippmentID(0), fModuleID(0), fRcuX(0), fRcuZ(0),fRcuZOffset(0), fRcuXOffset(0),fPrintInfo(kFALSE),fSendChannelData(kFALSE),fPrintInfoFrequncy(1000),
-fPHOSRawStream(0), fRawMemoryReader(0), fOutPtr(0)
+#include "AliHLTPHOSMapper.h"
+#include "AliHLTPHOSSanityInspector.h"
+#include "AliHLTPHOSBaseline.h"
+#include "TFile.h"
+#include "TTree.h"
+#include "TClonesArray.h"
+#include "TH2F.h"
+#include "AliAltroDecoder.h" // decoder for altro payload
+#include "AliAltroData.h" // container for altro payload
+#include "AliAltroBunch.h" // container for altro bunches
+
+
+AliHLTPHOSRawAnalyzerComponent::AliHLTPHOSRawAnalyzerComponent():AliHLTPHOSRcuProcessor(),
+ fAnalyzerPtr(0),
+ fSendChannelData(kFALSE),
+ fOutPtr(0),
+ fMapperPtr(0),
+ fSanityInspectorPtr(0),
+ fUseBaselineSubtraction(false),
+ fDecoderPtr(0),
+ fAltroDataPtr(0),
+ fAltroBunchPtr(0),
+ fDoPushRawData(false),
+ fDigitContainerPtr(0),
+ fDoSelectiveReadOut(false),
+ fSelectedChannelsList(0),
+ fDoCheckDataSize(false),
+ fNCorruptedBlocks(0),
+ fNOKBlocks(0)
+ //fRawMemoryReader(0), fPHOSRawStream(0)
{
-
-
-
-
-}
+ //comment
+ fMapperPtr = new AliHLTPHOSMapper();
+ fAltroDataPtr = new AliAltroData();
+ fAltroBunchPtr = new AliAltroBunch();
+ fDecoderPtr = new AliAltroDecoder();
+ fSanityInspectorPtr = new AliHLTPHOSSanityInspector();
+ fSelectedChannelsList = new AliHLTUInt16_t[N_XCOLUMNS_RCU*N_ZROWS_RCU*N_GAINS];
+}
AliHLTPHOSRawAnalyzerComponent::~AliHLTPHOSRawAnalyzerComponent()
{
- ///Default destructor
-
- if(fRawMemoryReader != 0)
- {
- delete fRawMemoryReader;
- }
- if(fPHOSRawStream != 0)
- {
- delete fPHOSRawStream;
- }
-
+ Deinit();
}
-AliHLTPHOSRawAnalyzerComponent::AliHLTPHOSRawAnalyzerComponent(const AliHLTPHOSRawAnalyzerComponent & ) : AliHLTProcessor(), fAnalyzerPtr(0),
-fEquippmentID(0), fModuleID(0), fRcuX(0), fRcuZ(0),fRcuZOffset(0), fRcuXOffset(0),fPrintInfo(kFALSE),fSendChannelData(kFALSE),fPrintInfoFrequncy(1000),
-fPHOSRawStream(0), fRawMemoryReader(0), fOutPtr(0)
-{
- //Copy Constructor
-}
int
AliHLTPHOSRawAnalyzerComponent::Deinit()
{
- //See base class for documentation
- cout << "Deinit" << endl;
- return 0;
-}
-
-int
-AliHLTPHOSRawAnalyzerComponent::DoDeinit()
-{
- //See base class for documentation
- cout << "DoDeinit" << endl;
- Logging(kHLTLogInfo, "HLT", "PHOS", ",AliHLTPHOSRawAnalyzerComponen DoDeinit");
-
- if(fRawMemoryReader !=0)
+ //comment
+ if(fMapperPtr)
{
- delete fRawMemoryReader;
+ delete fMapperPtr;
+ fMapperPtr = 0;
}
-
- if(fPHOSRawStream != 0)
+ if(fAltroDataPtr)
{
- delete fPHOSRawStream;
+ delete fAltroDataPtr;
+ fAltroDataPtr = 0;
}
+ if(fAltroBunchPtr)
+ {
+ delete fAltroBunchPtr;
+ fAltroBunchPtr = 0;
+ }
+ if(fDecoderPtr)
+ {
+ delete fDecoderPtr;
+ fDecoderPtr = 0;
+ }
+ Logging(kHLTLogInfo, "HLT", "PHOS", ",AliHLTPHOSRawAnalyzerComponen Deinit");
return 0;
-
}
+
const char*
AliHLTPHOSRawAnalyzerComponent::GetComponentID()
{
- ///Returns the component ID
+ //comment
return "AliPhosTestRaw";
}
void
AliHLTPHOSRawAnalyzerComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
{
- //See Base class for documentation
+ //comment
const AliHLTComponentDataType* pType=fgkInputDataTypes;
while (pType->fID!=0) {
list.push_back(*pType);
AliHLTComponentDataType
AliHLTPHOSRawAnalyzerComponent::GetOutputDataType()
{
- //See Base class for documentation
- return AliHLTPHOSDefinitions::gkCellEnergyDataType;
+ //comment
+ return kAliHLTMultipleDataType;
+ // return AliHLTPHOSDefinitions::fgkDigitDataType;
+}
+
+int
+AliHLTPHOSRawAnalyzerComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList)
+{
+ // Added by OD
+ // see header file for class documentation
+ tgtList.clear();
+ tgtList.push_back(AliHLTPHOSDefinitions::fgkCellEnergyDataType);
+ tgtList.push_back(kAliHLTDataTypeHwAddr16);
+ return tgtList.size();
}
void
AliHLTPHOSRawAnalyzerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier )
-
{
- //See Base class for documentation
+ //comment
constBase = 30;
- // inputMultiplier = 0.1;
- inputMultiplier = 1;
+ inputMultiplier = 1.2;
}
-int AliHLTPHOSRawAnalyzerComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
- AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr,
- AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks )
+
+
+int
+AliHLTPHOSRawAnalyzerComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, AliHLTComponentTriggerData& /*trigData*/,
+ AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks )
{
- /// Function that proceesses the raw date to give Energy and TOF for the
- /// Individual cells/crystals.
-
- 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;
+ //comment
+
+ UInt_t offset = 0;
+ UInt_t mysize = 0;
+ UInt_t tSize = 0;
+ Float_t baseline = 0;
AliHLTUInt8_t* outBPtr;
- unsigned long first;
- unsigned long last;
outBPtr = outputPtr;
const AliHLTComponentBlockData* iter = NULL;
unsigned long ndx;
-
+ Int_t *rawDataBufferPos = (Int_t *)outputPtr;
+ AliHLTPHOSValidCellDataStruct *validCellPtr = 0;
+ Int_t nSamples = 0;
+ UInt_t nSelected = 0;
+ UInt_t specification = 0;
+
for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
{
+
+ Int_t tmpChannelCnt = 0;
iter = blocks+ndx;
mysize = 0;
offset = tSize;
+ Int_t crazyness = 0;
+ UInt_t tmpSize = 0;
+ mysize += sizeof(AliHLTPHOSRcuCellEnergyDataStruct);
- if ( iter->fDataType != AliHLTPHOSDefinitions::gkDDLPackedRawDataType )
+ if ( iter->fDataType != AliHLTPHOSDefinitions::fgkDDLPackedRawDataType )
{
- continue;
+ continue;
}
+ specification = specification|iter->fSpecification;
- fRawMemoryReader->SetMemory( reinterpret_cast<UChar_t*>( iter->fPtr ), iter->fSize );
- fAnalyzerPtr->SetData(fTmpChannelData);
+ fDecoderPtr->SetMemory(reinterpret_cast<UChar_t*>( iter->fPtr ), iter->fSize);
+ fDecoderPtr->Decode();
fOutPtr = (AliHLTPHOSRcuCellEnergyDataStruct*)outBPtr;
- mysize += sizeof(AliHLTPHOSRcuCellEnergyDataStruct);
+
fOutPtr->fRcuX = fRcuX;
fOutPtr->fRcuZ = fRcuZ;
- fOutPtr->fModuleID = fModuleID;
- tmpChannelCnt = 0;
+ fOutPtr->fModuleID =fModuleID;
- while(fPHOSRawStream->Next())
+ rawDataBufferPos += (mysize)/sizeof(Int_t);
+
+ while( fDecoderPtr->NextChannel(fAltroDataPtr) == true )
{
- if (fPHOSRawStream->IsNewHWAddress())
+
+ nSamples = fAltroDataPtr->GetDataSize() - 2;
+
+ if(fDoCheckDataSize)
{
- if(processedChannels > 0)
+ if(nSamples != fNTotalSamples)
{
- fAnalyzerPtr->SetData(fTmpChannelData);
- fAnalyzerPtr->Evaluate(0, sampleCnt);
- fOutPtr->fValidData[tmpChannelCnt].fGain = tmpGain;
- fOutPtr->fValidData[tmpChannelCnt].fZ = tmpZ;
- fOutPtr->fValidData[tmpChannelCnt].fX = tmpX;
- fOutPtr->fValidData[tmpChannelCnt].fEnergy = (float)fAnalyzerPtr->GetEnergy();
- fOutPtr->fValidData[tmpChannelCnt].fTime = (float)fAnalyzerPtr->GetTiming();
- ResetDataPtr(tmpStartIndex, sampleCnt);
- tmpChannelCnt ++;
- sampleCnt = 0;
+ cout <<"processing event " << fPhosEventCount << endl;;
+ cout << "Wrong number of samples Expected "<< fNTotalSamples << " samples (assuming non zero supressed data) but recieved " << nSamples << endl;
+ Logging( kHLTLogError, __FILE__ , "Wrong number of samples", "Expected %lu samples (assuming non zero supressed data) but recieved %lu", fNTotalSamples, nSamples);
+ fNCorruptedBlocks ++;
+ continue;
}
+ }
- tmpMod = (AliHLTUInt8_t)fPHOSRawStream->GetModule() ;
- tmpX =(AliHLTUInt8_t)fPHOSRawStream->GetRow() - fRcuXOffset;
- tmpZ =(AliHLTUInt8_t)fPHOSRawStream->GetColumn() - fRcuZOffset;
- tmpGain = fPHOSRawStream->IsLowGain();
- processedChannels ++;
+ fNOKBlocks ++;
+
+ if((fPhosEventCount%10 ==0) && fPhosEventCount !=0)
+ {
+ // float percent = ((float)(100*fNCorruptedBlocks))/((float)(fNOKBlocks + fNCorruptedBlocks) );
+ }
+
+ crazyness = fSanityInspectorPtr->CheckInsanity((const UInt_t*)fAltroDataPtr->GetData(), (const Int_t)(fAltroDataPtr->GetDataSize() - 2));
+
+ fAnalyzerPtr->SetData(fAltroDataPtr->GetData(), fAltroDataPtr->GetDataSize() -2);
+ fAnalyzerPtr->Evaluate(0, fAltroDataPtr->GetDataSize() -2);
+
+ fOutPtr->fValidData[tmpChannelCnt].fZ = fMapperPtr->fHw2geomapPtr[fAltroDataPtr->GetHadd()].fZRow;
+ fOutPtr->fValidData[tmpChannelCnt].fX = fMapperPtr->fHw2geomapPtr[fAltroDataPtr->GetHadd()].fXCol;
+ fOutPtr->fValidData[tmpChannelCnt].fGain = fMapperPtr->fHw2geomapPtr[fAltroDataPtr->GetHadd()].fGain;
+
+ if(fUseBaselineSubtraction)
+ {
+ baseline = fBaselines[fOutPtr->fValidData[tmpChannelCnt].fX][fOutPtr->fValidData[tmpChannelCnt].fZ][ fOutPtr->fValidData[tmpChannelCnt].fGain];
}
+
+ fOutPtr->fValidData[tmpChannelCnt].fEnergy = (float)fAnalyzerPtr->GetEnergy() - baseline;
+ fOutPtr->fValidData[tmpChannelCnt].fTime = (float)fAnalyzerPtr->GetTiming();
+ fOutPtr->fValidData[tmpChannelCnt].fCrazyness = (int)crazyness;
- if(sampleCnt == 0)
+ const UInt_t *tmpData = fAltroDataPtr->GetData();
+
+ if(fDoPushRawData)
{
- tmpStartIndex = fPHOSRawStream->GetTime();
+ tmpSize += nSamples + 1;
+ *rawDataBufferPos = nSamples;
+ cout << "# samples: " << *rawDataBufferPos << endl;
+ for(int sample = 0; sample < nSamples; sample++)
+ {
+ rawDataBufferPos++;
+ *(rawDataBufferPos) = tmpData[sample] - (Int_t)baseline;
+ }
+ rawDataBufferPos++;
+ }
+ if(fDoSelectiveReadOut)
+ {
+ if(validCellPtr->fEnergy > fSelectiveReadOutThresholds[fOutPtr->fValidData[tmpChannelCnt].fX][fOutPtr->fValidData[tmpChannelCnt].fZ][fOutPtr->fValidData[tmpChannelCnt].fGain])
+ {
+ fSelectedChannelsList[nSelected] = (AliHLTUInt16_t)(fAltroDataPtr->GetHadd());
+ nSelected++;
+ }
}
+
+ // UInt_t tmpSize = sizeof(Int_t)*(fOutPtr->fValidData[tmpChannelCnt].fNSamples);
+ // mysize += sizeof(Int_t)*(fOutPtr->fValidData[tmpChannelCnt].fNSamples);
+ //mysize += tmpSize;
+ //rawDataBufferPos += tmpSize/sizeof(Int_t);
+
- fTmpChannelData[fPHOSRawStream->GetTime()] = fPHOSRawStream->GetSignal();
- sampleCnt ++;
+ tmpChannelCnt ++;
}
- tmpChannelCnt ++;
- fAnalyzerPtr->SetData(fTmpChannelData);
- fAnalyzerPtr->Evaluate(0, sampleCnt);
- fOutPtr->fValidData[tmpChannelCnt].fGain = tmpGain;
- fOutPtr->fValidData[tmpChannelCnt].fZ = tmpZ;
- fOutPtr->fValidData[tmpChannelCnt].fX = tmpX;
- fOutPtr->fValidData[tmpChannelCnt].fEnergy = fAnalyzerPtr->GetEnergy();
- fOutPtr->fValidData[tmpChannelCnt].fTime = fAnalyzerPtr->GetTiming();
- ResetDataPtr(tmpStartIndex, sampleCnt);
-
- sampleCnt = 0;
-
- fOutPtr->fCnt = tmpChannelCnt;
- AliHLTComponentBlockData bd;
- FillBlockData( bd );
- bd.fOffset = offset;
- bd.fSize = mysize;
- bd.fDataType = AliHLTPHOSDefinitions::gkCellEnergyDataType;
- bd.fSpecification = 0xFFFFFFFF;
- outputBlocks.push_back( bd );
+ mysize += tmpSize*4;
+ // cout << "mysize: " << mysize << " - tmpSize: " <<
+
+ if(fDoPushRawData)
+ {
+ fOutPtr->fHasRawData = true;
+ }
+ else
+ {
+ fOutPtr->fHasRawData = false;
+ }
+
+ fOutPtr->fCnt = tmpChannelCnt;
+ fOutPtr->fSize = mysize;
+
+ AliHLTComponentBlockData bdCellEnergy;
+ FillBlockData( bdCellEnergy );
+ bdCellEnergy.fOffset = offset;
+ bdCellEnergy.fSize = mysize;
+ bdCellEnergy.fDataType = AliHLTPHOSDefinitions::fgkCellEnergyDataType;
+ bdCellEnergy.fSpecification = specification;
+ outputBlocks.push_back( bdCellEnergy );
+
tSize += mysize;
outBPtr += mysize;
-
+
+ //Pushing selected channel addresses
+ if(fDoSelectiveReadOut)
+ {
+ UInt_t hwAddSize = sizeof(AliHLTUInt16_t);
+ offset = tSize;
+ for(UInt_t n = 0; n < nSelected; n++)
+ {
+ ((AliHLTUInt16_t*)outBPtr)[n] = fSelectedChannelsList[n];
+ }
+ mysize = nSelected*hwAddSize;
+ AliHLTComponentBlockData bdHwAdd;
+ FillBlockData(bdHwAdd);
+ bdHwAdd.fOffset = offset;
+ bdHwAdd.fSize = mysize;
+ bdHwAdd.fDataType = kAliHLTDataTypeHwAddr16;
+ bdHwAdd.fSpecification = specification;
+ outputBlocks.push_back( bdHwAdd );
+
+
+ tSize += mysize;
+ outBPtr += mysize;
+ }
+
+
if( tSize > size )
{
- cout <<"kHLTLogFatal, HLT::AliHLTPHOSRawAnalyzerComponent::DoEvent Too much data Data written over allowed buffer. Amount written:" << tSize << " allowed" << size << endl;
Logging( kHLTLogFatal, "HLT::AliHLTPHOSRawAnalyzerComponent::DoEvent", "Too much data",
"Data written over allowed buffer. Amount written: %lu, allowed amount: %lu."
, tSize, size );
return EMSGSIZE;
}
-
+
}
-
- fgEventCount++;
+
+ fPhosEventCount++;
+
+
if(fPrintInfo == kTRUE)
{
- if(fgEventCount%fPrintInfoFrequncy == 0)
+
+ if(fPhosEventCount%fPrintInfoFrequncy == 0)
{
- cout <<"Analyzing event " << fgEventCount << "for Equippment " << fEquippmentID << endl;
+ Logging(kHLTLogBenchmark, __FILE__ , IntToChar( __LINE__ ) , "Analyzing event %lu", fPhosEventCount);
}
- }
- size = tSize;
+
+ }
+
return 0;
}//end DoEvent
int
AliHLTPHOSRawAnalyzerComponent::DoInit( int argc, const char** argv )
-{
- /// See base class for documentation
+{
+ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ // fAnalyzerPtr->SetCorrectBaselineUsingFirstFiveSamples();
+ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+
+ //See base class for documentation
fSendChannelData = kFALSE;
fPrintInfo = kFALSE;
- Reset();
- fRawMemoryReader = new AliRawReaderMemory();
- fPHOSRawStream = new AliCaloRawStream(fRawMemoryReader,"PHOS");
- 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)
- {
- fEquippmentID = atoi(argv[i+1]);
- cout << "AliHLTPHOSRawAnalyzerComponent: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)
- {
- 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;
- }
- }
+ const int nSigmas = 3;
+ fMapperPtr = new AliHLTPHOSMapper();
+ if(fMapperPtr->GetIsInitializedMapping() == false)
+ {
+ Logging(kHLTLogFatal, __FILE__ , IntToChar( __LINE__ ) , "AliHLTPHOSMapper::Could not initial mapping from file %s, aborting", fMapperPtr->GetFilePath());
+ return -4;
}
-
- if(isSetEquippmentID == kFALSE)
+ char tmpbaselinfile[256];
+ if(fUtilitiesPtr->ScanSingleNameArgument(argc, argv, "-baselinefile", tmpbaselinfile) == true )
+ {
+ SetBaselines(tmpbaselinfile);
+ }
+
+ char tmpSelectiveThresholdfile[256];
+ if(fUtilitiesPtr->ScanSingleNameArgument(argc, argv, "-baselinefile", tmpSelectiveThresholdfile) == true )
{
- 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;
+ fDoSelectiveReadOut = true;
+ SetSelectiveReadOutThresholds(tmpSelectiveThresholdfile, nSigmas);
}
- return 0;
-}
+ //fDoSelectiveReadOut = fUtilitiesPtr->ScanSingleNameArgument(argc, argv, "-selectivereadout");
-void
-AliHLTPHOSRawAnalyzerComponent::DumpData(int gain)
-{
- //Dumping data to std out
- for(int mod = 0; mod < N_MODULES; mod ++)
- {
- printf("\n *********** MODULE %d ************\n", mod);
- for(int row = 0; row < N_ROWS_MOD; row ++)
- {
- for(int col = 0; col < N_COLUMNS_MOD; col ++)
- {
- if( fMaxValues[mod][row][col][0] != 0)
- {
- cout << fMaxValues[mod][row][col][gain] << "\t";
- }
- }
- }
- }
-}
+ fDoPushRawData = fUtilitiesPtr->ScanSingleArgument(argc, argv, "-pushrawdata");
+ fDoPushRawData = true; //CRAP
-void
-AliHLTPHOSRawAnalyzerComponent::DumpChannelData(Double_t *data)
-{
- cout << endl;
- for(int i=0; i< ALTRO_MAX_SAMPLES; i++)
- {
- if (data[i] != 0)
- {
- cout <<i <<"\t";
- }
- }
- cout << endl;
-
- for(int i=0; i< ALTRO_MAX_SAMPLES; i++)
- {
- if (data[i] != 0)
- {
- cout <<data[i] <<"\t";
- }
- }
-
- cout << endl;
+ fDoCheckDataSize = fUtilitiesPtr->ScanSingleArgument(argc, argv, "-checkdatasize");
+
+ iResult = ScanArguments(argc, argv);
+ return iResult;
}
void
-AliHLTPHOSRawAnalyzerComponent::Reset()
+AliHLTPHOSRawAnalyzerComponent::Reset(AliHLTPHOSRcuCellEnergyDataStruct* cellDataPtr)
{
- for(int mod = 0; mod < N_MODULES; mod ++)
+ //comment
+ // for(unsigned int mod = 0; mod < N_MODULES; mod ++)
+ //{
+ /*
+ for(int x = 0; x < N_XCOLUMNS_RCU; x ++)
{
- for(int row = 0; row < N_ROWS_MOD; row ++)
+
+ for(int z = 0; z < N_ZROWS_RCU; z ++)
{
- for(int col = 0; col < N_COLUMNS_MOD; col ++)
+ for(int gain = 0; gain < N_GAINS; gain ++ )
{
- for(int gain = 0; gain < N_GAINS; gain ++ )
- {
- fMaxValues[mod][row][col][gain] = 0;
- }
+ //fMaxValues[mod][row][col][gain] = 0;
+ cellDataPtr->fValidData[x][z][gain].fEnergy = 0;
+ cellDataPtr->fValidData[x][z][gain].fID = -1;
}
}
}
-
+ */
ResetDataPtr(0, ALTRO_MAX_SAMPLES);
} // end Reset
+
void
AliHLTPHOSRawAnalyzerComponent::ResetDataPtr(int startindex, int sampleCnt)
{
+ //comment
for(int i = startindex ; i< sampleCnt; i++)
{
fTmpChannelData[i] = 0;
}
}
-void
-AliHLTPHOSRawAnalyzerComponent::SetEquippmentID(AliHLTUInt16_t id)
-{
- fEquippmentID = id;
-}
-
-
-const AliHLTUInt16_t
-AliHLTPHOSRawAnalyzerComponent::GetEquippmentID()
-{
- return fEquippmentID;
-}
void
-AliHLTPHOSRawAnalyzerComponent::SetCoordinates(AliHLTUInt16_t equippmentID)
+AliHLTPHOSRawAnalyzerComponent::SetBaselines(const char* file)
{
- int rcuIndex = (fEquippmentID - 1792)%N_RCUS_PER_MODULE;
- fModuleID = (fEquippmentID -1792 -rcuIndex)/N_RCUS_PER_MODULE;
-
- if(rcuIndex == 0)
+ //comment
+ fUseBaselineSubtraction = true;
+ AliHLTPHOSBaseline *baseline = 0;
+ TFile *baselineFile = TFile::Open(file);
+ TTree *baselineTree = (TTree*)baselineFile->Get("baselineTree");
+ TClonesArray *baselineArray = new TClonesArray("AliHLTPHOSBaseline", 7168);
+ baselineTree->SetBranchAddress("Baselines", &baselineArray);
+ baselineTree->GetEntry(0);
+ for(Int_t i = 0; i < baselineArray->GetEntriesFast(); i++)
{
- fRcuX = 0;
- fRcuZ = 0;
+ baseline = (AliHLTPHOSBaseline*)baselineArray->At(i);
+ if((baseline->GetX() < (Int_t)((fRcuX + 1)*N_XCOLUMNS_RCU)) && (baseline->GetX() >= (Int_t)(fRcuX*N_XCOLUMNS_RCU)))
+ {
+ if((baseline->GetZ() < (Int_t)((fRcuZ + 1)*N_ZROWS_RCU)) && (baseline->GetZ() >= (Int_t)(fRcuZ*N_ZROWS_RCU)))
+ {
+ fBaselines[baseline->GetX() - fRcuX*N_XCOLUMNS_RCU][baseline->GetZ() - fRcuZ*N_ZROWS_RCU][baseline->GetGain()] = baseline->GetBaseline();
+ }
+ }
}
+ baselineFile->Close();
+ delete baselineFile;
+ baselineFile = 0;
+}
- if(rcuIndex == 1)
- {
- fRcuX = 0;
- fRcuZ = 1;
- }
-
- if(rcuIndex == 2)
- {
- fRcuX = 1;
- fRcuZ = 0;
- }
+void
+AliHLTPHOSRawAnalyzerComponent::SetSelectiveReadOutThresholds(const char* filepath, Int_t nSigmas)
+{
+ //See header file for documentation
+ TFile *histFile = new TFile(filepath);
+ TH2F *lgHist = (TH2F*)histFile->Get("RMSLGMapHist");
+ TH2F *hgHist = (TH2F*)histFile->Get("RMSHGMapHist");
- if(rcuIndex == 3)
+ for(int x = 0; x < N_XCOLUMNS_MOD; x++)
{
- fRcuX = 1;
- fRcuZ = 1;
+ for(int z = 0; z < N_ZROWS_MOD; z++)
+ {
+ fSelectiveReadOutThresholds[x][z][LOW_GAIN] = lgHist->GetBinContent(x, z) * nSigmas;
+ fSelectiveReadOutThresholds[x][z][HIGH_GAIN] = hgHist->GetBinContent(x, z) * nSigmas;
+ }
}
-
- fRcuZOffset = N_ZROWS_RCU*fRcuZ;
- fRcuXOffset = N_XCOLUMNS_RCU*fRcuX;
-
- cout <<"********InitInfo************"<< endl;
- cout <<"AliHLTPHOSRawAnalyzerComponent::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;
}