* 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 <iostream>
#include "AliHLTPHOSRcuCellEnergyDataStruct.h"
-#include "AliHLTPHOSRcuChannelDataStruct.h"
-
-using namespace std;
-
-
-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),
+ fDoMakeDigits(0),
+ fDigitMakerPtr(0),
+
+ fDigitContainerPtr(0),
+ fDoSelectiveReadOut(false),
+ fSelectedChannelsList(0),
+ fDoCheckDataSize(false),
+ fNCorruptedBlocks(0),
+ fNOKBlocks(0)
+ //fRawMemoryReader(0), fPHOSRawStream(0)
{
- /**
- *Default constructor
- */
-}
+ //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 fMapperPtr;
+ fMapperPtr = 0;
+ }
+ if(fAltroDataPtr)
+ {
+ delete fAltroDataPtr;
+ fAltroDataPtr = 0;
+ }
+ if(fAltroBunchPtr)
{
- delete fRawMemoryReader;
+ delete fAltroBunchPtr;
+ fAltroBunchPtr = 0;
}
-
- if(fPHOSRawStream != 0)
+ if(fDecoderPtr)
{
- delete fPHOSRawStream;
+ 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
- const AliHLTComponentDataType* pType=fgkInputDataTypes;
- while (pType->fID!=0) {
- list.push_back(*pType);
- pType++;
- }
+ //comment
+ list.clear();
+ list.push_back( AliHLTPHOSDefinitions::fgkDDLPackedRawDataType | kAliHLTDataOriginPHOS);
}
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 = 4;
+}
+
+
+
+
+void
+AliHLTPHOSRawAnalyzerComponent::FillDataArray(UInt_t *data, const AliAltroData * /*altrodataptr */, const int /* channel */)
+{
+ ResetDataPtr(0, ALTRO_MAX_SAMPLES);
+ bool islastbunch = true;
+
+ while( fAltroDataPtr->NextBunch(fAltroBunchPtr) == true)
+ {
+ const UInt_t *tmpdata = fAltroBunchPtr->GetData();
+
+ if(islastbunch == true)
+ {
+ data[0] = fAltroBunchPtr->GetEndTimeBin();
+ islastbunch = false;
+ }
+
+ int tmpstartbin = fAltroBunchPtr->GetStartTimeBin();
+ int tmpendbin = fAltroBunchPtr->GetEndTimeBin();
+ int tmplength = tmpendbin - tmpstartbin;
+
+ for(int i = 0; i < tmplength ; i++)
+ {
+ data[i+tmpstartbin] = tmpdata[i];
+ }
+ }
+
+
+ /*
+ cout <<__FILE__ <<" : " <<__LINE__ << "the resulting array is"<<endl;
+
+ for(int i=0; i< data[0]; i++)
+ {
+ if(i != 0 && i %16 == 0)
+ {
+ cout << endl;
+ }
+ cout <<data[i] << "\t" ;
+ }
+ cout << endl;
+ */
}
-int AliHLTPHOSRawAnalyzerComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
- AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr,
- AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks )
+
+void
+AliHLTPHOSRawAnalyzerComponent::GetFirstBunch(AliAltroData * /*altrodata */, AliAltroBunch * /*altrobunch */)
+{
+ while( fAltroDataPtr->NextBunch(fAltroBunchPtr) == true)
+ {
+
+ }
+}
+
+
+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;
+ // cout << "Event" << fPhosEventCount << endl;
+
+ 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;
+ Int_t nSamples = 0;
+ UInt_t specification = 0;
+ bool droppedRaw = true;
+ if(fDoPushRawData) {droppedRaw = false;}
+
for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
{
iter = blocks+ndx;
+ if ( iter->fDataType != AliHLTPHOSDefinitions::fgkDDLPackedRawDataType )
+ {
+ continue;
+ }
+
+ Int_t tmpChannelCnt = 0;
mysize = 0;
offset = tSize;
+ Int_t crazyness = 0;
+ mysize += sizeof(AliHLTPHOSRcuCellEnergyDataStruct);
+ tSize += mysize;
- if ( iter->fDataType != AliHLTPHOSDefinitions::gkDDLPackedRawDataType )
+ if(tSize > size)
{
- continue;
- }
+ HLTError("Buffer overflow: Trying to write data of size: %d bytes. Output buffer available: %d bytes.", tSize, size);
+ return -ENOBUFS;
+ }
- fRawMemoryReader->SetMemory( reinterpret_cast<UChar_t*>( iter->fPtr ), iter->fSize );
- fAnalyzerPtr->SetData(fTmpChannelData);
+ specification = specification|iter->fSpecification;
+ 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;
-
- while(fPHOSRawStream->Next())
- {
- if (fPHOSRawStream->IsNewHWAddress())
- {
- if(processedChannels > 0)
+ fOutPtr->fModuleID =fModuleID;
+
+ rawDataBufferPos += (tSize)/sizeof(Int_t);
+
+ while( fDecoderPtr->NextChannel(fAltroDataPtr) == true )
+ {
+ FillDataArray(fTmpChannelData, fAltroDataPtr, tmpChannelCnt);
+
+ if( fAltroDataPtr->GetDataSize() != 0 )
+ {
+ GetFirstBunch(fAltroDataPtr, fAltroBunchPtr);
+ nSamples = fAltroBunchPtr->GetBunchSize();
+ // cout <<__FILE__ <<" : " <<__LINE__ << ", the size of the first bunch is " << nSamples <<endl;
+ crazyness = fSanityInspectorPtr->CheckInsanity((const UInt_t*)fAltroBunchPtr->GetData(), (const Int_t)(fAltroBunchPtr->GetBunchSize()));
+ fAnalyzerPtr->SetData(fAltroBunchPtr->GetData(), fAltroBunchPtr->GetBunchSize());
+ fAnalyzerPtr->Evaluate(0, fAltroBunchPtr->GetBunchSize());
+ 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)
{
- 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;
+ 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;
- tmpMod = (AliHLTUInt8_t)fPHOSRawStream->GetModule() ;
- tmpX =(AliHLTUInt8_t)fPHOSRawStream->GetRow() - fRcuXOffset;
- tmpZ =(AliHLTUInt8_t)fPHOSRawStream->GetColumn() - fRcuZOffset;
- tmpGain = fPHOSRawStream->IsLowGain();
- processedChannels ++;
- }
-
- if(sampleCnt == 0)
- {
- tmpStartIndex = fPHOSRawStream->GetTime();
+ if(fDoPushRawData == true && droppedRaw == false)
+ {
+ int tmpsize = fTmpChannelData[0];
+ // cout << __FILE__ << ":" << __LINE__ << "channel = " << tmpChannelCnt << " size ="<< tmpsize << endl;
+ mysize += (tmpsize + 1)*sizeof(Int_t);
+ tSize += (tmpsize + 1)*sizeof(Int_t);;
+
+ if(tSize > size)
+ {
+ HLTError("Buffer overflow: Trying to write data of size: %d bytes. Output buffer available: %d bytes. Dropping raw data.", tSize, size);
+ droppedRaw = true;
+ tSize -= mysize;
+ }
+ else
+ {
+ *rawDataBufferPos = tmpsize;
+
+ for(int sample = 0; sample < tmpsize; sample++)
+ {
+ rawDataBufferPos++;
+ *(rawDataBufferPos) = fTmpChannelData[sample];
+ }
+ rawDataBufferPos++;
+
+ }
+ }
+ tmpChannelCnt ++;
}
-
- fTmpChannelData[fPHOSRawStream->GetTime()] = fPHOSRawStream->GetSignal();
- sampleCnt ++;
}
- 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 );
- tSize += mysize;
+ if(fDoPushRawData && droppedRaw == false)
+ {
+ 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 );
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;
- }
+ if( tSize > size )
+ {
+ Logging( kHLTLogFatal, "HLT::AliHLTPHOSRawAnalyzerComponent::DoEvent", "Too much data",
+ "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu."
+ , tSize, size );
+ return EMSGSIZE;
+ }
+
}
- fgEventCount++;
-
- if(fPrintInfo == kTRUE)
- {
- if(fgEventCount%fPrintInfoFrequncy == 0)
- {
- cout <<"Analyzing event " << fgEventCount << "for Equippment " << fEquippmentID << endl;
- }
- }
- size = tSize;
+ // *rawDataBufferPos = 0;
+ fPhosEventCount++;
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 )
{
- 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;
+ SetBaselines(tmpbaselinfile);
}
-
- return 0;
-}
-
-
-void
-AliHLTPHOSRawAnalyzerComponent::DumpData(int gain) const
-{
- //Dumping data to std out
- for(int mod = 0; mod < N_MODULES; mod ++)
+
+ char tmpSelectiveThresholdfile[256];
+ if(fUtilitiesPtr->ScanSingleNameArgument(argc, argv, "-baselinefile", tmpSelectiveThresholdfile) == true )
{
- 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";
- }
- }
- }
+ fDoSelectiveReadOut = true;
+ SetSelectiveReadOutThresholds(tmpSelectiveThresholdfile, nSigmas);
}
-}
+ //fDoSelectiveReadOut = fUtilitiesPtr->ScanSingleNameArgument(argc, argv, "-selectivereadout");
-void
-AliHLTPHOSRawAnalyzerComponent::DumpChannelData(Double_t *data) const
-{
- //shutting up the code checker
- 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;
+ fDoPushRawData = fUtilitiesPtr->ScanSingleArgument(argc, argv, "-pushrawdata");
+
+ fDoCheckDataSize = fUtilitiesPtr->ScanSingleArgument(argc, argv, "-checkdatasize");
+
+ iResult = ScanArguments(argc, argv);
+ return iResult;
}
void
-AliHLTPHOSRawAnalyzerComponent::Reset()
+AliHLTPHOSRawAnalyzerComponent::Reset(AliHLTPHOSRcuCellEnergyDataStruct* /* cellDataPtr */)
{
- //shutting code checker
- for(int mod = 0; mod < N_MODULES; mod ++)
- {
- for(int row = 0; row < N_ROWS_MOD; row ++)
- {
- for(int col = 0; col < N_COLUMNS_MOD; col ++)
- {
- for(int gain = 0; gain < N_GAINS; gain ++ )
- {
- fMaxValues[mod][row][col][gain] = 0;
- }
- }
- }
- }
-
ResetDataPtr(0, ALTRO_MAX_SAMPLES);
-
} // end Reset
+
void
AliHLTPHOSRawAnalyzerComponent::ResetDataPtr(int startindex, int sampleCnt)
{
- //shutting up the code checker
+ //comment
for(int i = startindex ; i< sampleCnt; i++)
{
fTmpChannelData[i] = 0;
}
}
-void
-AliHLTPHOSRawAnalyzerComponent::SetEquippmentID(AliHLTUInt16_t id)
-{
- //shutting up the code checker
- fEquippmentID = id;
-}
-
-
-const AliHLTUInt16_t
-AliHLTPHOSRawAnalyzerComponent::GetEquippmentID() const
-{
- //shutting up the code checker
- return fEquippmentID;
-}
void
-AliHLTPHOSRawAnalyzerComponent::SetCoordinates(AliHLTUInt16_t equippmentID)
+AliHLTPHOSRawAnalyzerComponent::SetBaselines(const char* file)
{
- //shutting up the code checker
- 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;
}