#if __GNUC__>= 3
using namespace std;
#endif
+
#include "AliHLTTPCNoiseMapComponent.h"
#include "AliHLTTPCDigitReaderDecoder.h"
#include "AliHLTTPCDigitReaderPacked.h"
#include "AliHLTTPCTransform.h"
#include "AliHLTTPCDefinitions.h"
+
#include "AliCDBEntry.h"
#include "AliCDBManager.h"
+
#include "AliTPCCalPad.h"
+#include "AliTPCROC.h"
+#include "AliTPCCalROC.h"
+
#include <cstdlib>
#include <cerrno>
#include "TString.h"
AliHLTTPCNoiseMapComponent::AliHLTTPCNoiseMapComponent()
:
fSpecification(0),
+ noisePad(NULL),
//pDigitReader(0),
fPlotSideA(0),
fPlotSideC(0),
fApplyNoiseMap(0),
+ fResetHistograms(0),
fIsPacked(0),
fIsUnpacked(0),
- fSlice(-99),
- fCurrentPartition(0),
- fCurrentRow(0),
+ fCurrentSlice(-99),
+ fCurrentPartition(-99),
+ fCurrentRow(-99),
+ fHistPartition(NULL),
fHistSideA(NULL),
fHistSideC(NULL),
- fHistCDBMap(NULL)
- //fHistSlice(NULL)
+ fHistCDBMap(NULL)
{
// see header file for class documentation
// or
int AliHLTTPCNoiseMapComponent::DoInit( int argc, const char** argv ) {
// see header file for class documentation
-
+
Int_t i = 0;
Char_t* cpErr;
argument=argv[i];
if (!configuration.IsNull()) configuration+=" ";
- configuration+=argument;
-
+ configuration+=argument;
}
if (!configuration.IsNull()) {
while ( i < argc ) {
if (!strcmp( argv[i], "-apply-noisemap")) {
fApplyNoiseMap = strtoul( argv[i+1], &cpErr ,0);
-
+
if ( *cpErr ) {
HLTError("Cannot convert apply-noisemap specifier '%s'.", argv[i+1]);
return EINVAL;
if (!strcmp( argv[i], "-plot-side-a")) {
fPlotSideA = strtoul( argv[i+1], &cpErr ,0);
-
- fHistSideA = new TH2F("fHistSideA","TPC Side A",250,-250,250,250,-250,250);
- fHistSideA->SetXTitle("global X (cm)"); fHistSideA->SetYTitle("global Y (cm)");
-
+
if ( *cpErr ) {
HLTError("Cannot convert plot-side-a specifier '%s'.", argv[i+1]);
return EINVAL;
if (!strcmp( argv[i], "-plot-side-c")) {
fPlotSideC = strtoul( argv[i+1], &cpErr ,0);
-
- fHistSideC = new TH2F("fHistSideC","TPC Side C",250,-250,250,250,-250,250);
- fHistSideC->SetXTitle("global X (cm)"); fHistSideC->SetYTitle("global Y (cm)");
-
- //fSliceA[18], fSliceC[18]
if ( *cpErr ) {
HLTError("Cannot convert plot-side-c specifier '%s'.", argv[i+1]);
i+=2;
continue;
}
+
+ if (!strcmp( argv[i], "-reset-histograms")) {
+ fResetHistograms = strtoul( argv[i+1], &cpErr ,0);
-// if (!strcmp( argv[i], "-slice")) {
-// fSlice = strtoul( argv[i+1], &cpErr ,0);
-//
-// if ( *cpErr ) {
-// HLTError("Cannot convert slice specifier '%s'. Must be integer", argv[i+1]);
-// return EINVAL;
-// }
-// i+=2;
-// continue;
-// }
-
+ if ( *cpErr ) {
+ HLTError("Cannot convert reset-histograms specifier '%s'.", argv[i+1]);
+ return EINVAL;
+ }
+ i+=2;
+ continue;
+ }
+
Logging(kHLTLogError, "HLT::TPCNoiseMap::DoInit", "Unknown Option", "Unknown option '%s'", argv[i] );
return EINVAL;
} // end while
-
- //HLTDebug("using AliHLTTPCDigitReaderDecoder");
- //pDigitReader = new AliHLTTPCDigitReaderDecoder(); // double-loop
- //pDigitReader = new AliHLTTPCDigitReaderPacked();
-// if(fIsPacked){
-// //cout<<"Digit reader decoder is chosen"<<endl;
-// fDigitReader = new AliHLTTPCDigitReaderDecoder();
-// }
-// else if(fIsUnpacked){
-// //cout<<"Digit reader unpacked is chosen"<<endl;
-// fDigitReader = new AliHLTTPCDigitReaderDecoderUnpacked();
-// }
-// else{
-// HLTFatal("Neither of the two options of digit readers is set no data will be read.");
-// }
-
+// if(fApplyNoiseMap){
+// //TFile *f = TFile::Open("/scratch/noiseComp/Run3398_4000_v0_s72.root");
+// TFile *f = TFile::Open("/home/kanaki/noiseComp/Run3398_4000_v0_s72.root");
+// AliCDBEntry *pEntry = (AliCDBEntry*)f->Get("AliCDBEntry");
+// noisePad = (AliTPCCalPad*)pEntry->GetObject();
+// //fHistCDBMap = noisePad->MakeHisto2D(1); //side C
+// }
+
+
+// HLTDebug("using AliHLTTPCDigitReaderDecoder");
+// pDigitReader = new AliHLTTPCDigitReaderDecoder(); // double-loop
+// pDigitReader = new AliHLTTPCDigitReaderPacked();
+
return 0;
+
} // end DoInit()
int AliHLTTPCNoiseMapComponent::DoDeinit() {
return 0;
}
-// int AliHLTTPCNoiseMapComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
-// AliHLTComponentTriggerData&, AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size,
-// vector<AliHLTComponentBlockData>& outputBlocks ) {
-
-
int AliHLTTPCNoiseMapComponent::DoEvent(const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData){
// see header file for class documentation
HLTInfo("--- Entering DoEvent() in TPCNoiseMap ---");
-
+
if(GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR )) return 0;
- const AliHLTComponentBlockData* iter = NULL;
- //unsigned long ndx;
-
+ fHistSideA = new TH2F("fHistSideA","TPC Side A",250,-250,250,250,-250,250);
+ fHistSideA->SetXTitle("global X (cm)"); fHistSideA->SetYTitle("global Y (cm)");
+
+ fHistSideC = new TH2F("fHistSideC","TPC Side C",250,-250,250,250,-250,250);
+ fHistSideC->SetXTitle("global X (cm)"); fHistSideC->SetYTitle("global Y (cm)");
+
+ const AliHLTComponentBlockData *iter = NULL;
+
+ char name[100];
Float_t xyz[3];
Int_t thissector, thisrow;
- // reading an existing noise map file
- if(fApplyNoiseMap){
- TFile *f = TFile::Open("Run3398_4000_v0_s72.root");
- AliCDBEntry *entry = (AliCDBEntry*)f->Get("AliCDBEntry");
- AliTPCCalPad *noisePad = (AliTPCCalPad*)entry->GetObject();
- fHistCDBMap = noisePad->MakeHisto2D(1); //side C
- }
-
- for (iter = GetFirstInputBlock(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC); iter != NULL; iter = GetNextInputBlock()){
-
- //for ( ndx=0; ndx<evtData.fBlockCnt; ndx++ ) {
- // iter = blocks+ndx;
-
+ for(iter = GetFirstInputBlock(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC); iter != NULL; iter = GetNextInputBlock()){
+
HLTInfo("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s",
evtData.fEventID, evtData.fEventID,
DataType2Text(iter->fDataType).c_str(),
UInt_t slice = AliHLTTPCDefinitions::GetMinSliceNr(*iter);
UInt_t partition = AliHLTTPCDefinitions::GetMinPatchNr(*iter);
-
- //if ( partition < fMinPartition ) fMinPartition = partition;
- //if ( partition > fMaxPartition ) fMaxPartition = partition; // add a warning
- //fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification( slice, slice, partition, partition );
fSpecification = iter->fSpecification;
AliHLTTPCDigitReader *pDigitReader = new AliHLTTPCDigitReaderDecoder;
pDigitReader->InitBlock(iter->fPtr,iter->fSize,partition,slice);
- if(!pDigitReader) break; //AliHLTComponent.cxx, altrochannelselector rcu folder
-
+ if(!pDigitReader) break;
+
+ sprintf(name,"hMaxSignal_slice%d_partition%d", slice, partition);
+ fHistPartition = new TH2F(name,name,250,-250,250,250,-250,250);
+
while( pDigitReader->Next() ){
//while( pDigitReader->NextChannel()) { // pad loop
fCurrentRow += pDigitReader->GetRowOffset();
AliHLTTPCTransform::Slice2Sector(slice,fCurrentRow,thissector,thisrow);
- AliHLTTPCTransform::Raw2Global(xyz,thissector,thisrow,pDigitReader->GetPad(),0);
-
- //use AliTPCPad to fill the data there and use the functions to ask for max charge etc.
-
- Int_t maxSignal = 0;
+ //AliHLTTPCTransform::Raw2Global(xyz,thissector,thisrow,pDigitReader->GetPad(),0);
+
+// AliTPCCalROC *calRoc = noisePad->GetCalROC(thissector);
+// calRoc->GetValue(thisrow,pDigitReader->GetPad());
+
+ Float_t maxSignal = 0.;
//while( pDigitReader->NextBunch()) {
- //in case we want to fill the histograms with the signal value, an additional loop is necessary
+ const UInt_t *bunchData = pDigitReader->GetSignals();
for(Int_t i=0;i<pDigitReader->GetBunchSize();i++) {
- const UInt_t *bunchData = pDigitReader->GetSignals();
- if(bunchData[i]>maxSignal) maxSignal = bunchData[i];
+ if((Float_t)(bunchData[i])>maxSignal){
+ maxSignal = (Float_t)(bunchData[i]);
+ }
- //cout<<"Time: "<<pDigitReader->GetTime()+i<<" Signal: "<<bunchData[i]<<endl;
- }
+// if((Float_t)(bunchData[i])>maxSignal){
+// if(fApplyNoiseMap) { //still in local coordinates
+//
+// if(calRoc->GetValue(thisrow,pDigitReader->GetPad())>0.) maxSignal = 0.;
+// else maxSignal = bunchData[i];
+//
+// } else maxSignal = bunchData[i];
+// } // end if
+ } // end for loop
//} // end of inner while loop
- //cout<<slice<<" "<<partition<<" "<<fCurrentRow<<" "<<pDigitReader->GetPad()<<" "<<xyz[0]<<" "<<xyz[1]<<" "<<maxSignal<<endl;
-
- if(fPlotSideA || fPlotSideC){
- if(slice<18) fHistSideA->Fill(xyz[0],xyz[1],maxSignal);
- else fHistSideC->Fill(xyz[0],xyz[1],maxSignal);
- }
-
- } // end of while loop
+
+ AliHLTTPCTransform::Raw2Global(xyz,thissector,thisrow,pDigitReader->GetPad(),0);
+ // transformation from pad-row coordinates to global ones
+ // time info is not taken into account
+
+ fHistPartition->Fill(xyz[0],xyz[1],maxSignal);
+
+ if(fPlotSideA || fPlotSideC){
+ if(slice<18) fHistSideA->Fill(xyz[0],xyz[1],maxSignal);
+ else fHistSideC->Fill(xyz[0],xyz[1],maxSignal);
+ } // end if plotting sides
+ } // end of while loop
} // end of for loop over data blocks
+ if(fResetHistograms) ResetHistograms();
MakeHistosPublic();
+
return 0;
} // end DoEvent()
// TFile *outputfile = new TFile("test.root","RECREATE");
// fHistSideC->Write();
+// fHistPartition->Write();
// fHistCDBMap->Write();
-// fHistSlice[18]->Write();
// outputfile->Save();
// outputfile->Close();
TObjArray histos;
- histos.Add(fHistSideA);
- histos.Add(fHistSideC);
- PushBack( (TObject*) &histos, kAliHLTDataTypeHistogram, fSpecification);
-
- //PushBack( (TObject*) fHistSideC, kAliHLTDataTypeHistogram, fSpecification);
-
- //fill it with the right specification for every histogram
- //make a TObjArray and add all histos
- //check which pointers are empty and publish only the ones that hold something
+ histos.Add(fHistPartition);
+ if(fPlotSideA) histos.Add(fHistSideA);
+ if(fPlotSideC) histos.Add(fHistSideC);
+ //histos.Add(fHistCDBMap);
+
+ TIter iterator(&histos);
+ while(TObject *pObj=iterator.Next()){
- //delete histos;
+ PushBack(pObj, kAliHLTDataTypeHistogram|kAliHLTDataOriginTPC, fSpecification);
+ }
+
+ //PushBack( (TObject*) &histos, kAliHLTDataTypeHistogram, fSpecification);
+
+ delete fHistPartition;
delete fHistSideA;
delete fHistSideC;
}
+void AliHLTTPCNoiseMapComponent::ResetHistograms(){
+// see header file for class documentation
+
+ fHistPartition->Reset();
+ fHistSideA->Reset();
+ fHistSideC->Reset();
+}
+
int AliHLTTPCNoiseMapComponent::Configure(const char* arguments) {
// see header file for class documentation
HLTError("missing parameter for argument %s", argument.Data());
iResult=-EINVAL;
}
- return iResult;
+ return iResult;
}
int AliHLTTPCNoiseMapComponent::Reconfigure(const char* cdbEntry, const char* chainId) {
// see header file for class documentation
-
int iResult=0;
const char* path="HLT/ConfigTPC/TPCNoiseMapComponent";
const char* defaultNotify="";
}
}
+ const char* pathNoiseMap="TPC/Config/NoiseMap";
+
+ if (pathNoiseMap) {
+ HLTInfo("reconfigure noise map from entry %s, chain id %s", path,(chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
+ AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(pathNoiseMap/*,GetRunNo()*/);
+ if (pEntry) {
+ TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
+ if (pString) {
+ HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data());
+ iResult=Configure(pString->GetString().Data());
+ } else {
+ HLTError("configuration object \"%s\" has wrong type, required TObjString", path);
+ }
+ } else {
+ HLTError("cannot fetch object \"%s\" from CDB", path);
+ }
+ }
+
return iResult;
}
/** @file AliHLTTPCNoiseMapComponent.h
@author Kalliopi Kanaki
@date
- @brief Component for Noise Map
+ @brief Component for plotting TPC data and applying noise map
*/
#include "AliHLTProcessor.h"
//forward declarations
class AliHLTTPCDigitReader;
class TH2;
-
+class AliTPCCalPad;
/**
* @class AliHLTTPCNoiseMapComponent
* Implementation of the component to fill histograms with TPC noise and read
* sent to the clulsterfinder.
*
* The component has the following component arguments:
- * - apply-noise-map Read the noise map from OCDB and apply it on the online data
- *
+ *
+ * The histograms are filled on partition level and no argument is foreseen for this.
+ *
* -plot-side-a Histograms the TPC side A
*
* -plot-side-c Histograms the TPC side C
*
* -apply-noisemap Reads a noise map from a file and subtracts the value contained in every pad from the data
+ * The above option is going to be removed, it makes no sense to read the noise map as
+ * many times as the partitions.
+ *
+ * -resetHistograms Resets histograms
+ *
*
* @ingroup alihlt_tpc
*/
+
class AliHLTTPCNoiseMapComponent : public AliHLTProcessor {
public:
int DoInit( int argc, const char** argv );
int DoDeinit();
-// int DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
-// AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr,
-// AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks );
int DoEvent( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData );
int Reconfigure(const char* cdbEntry, const char* chainId);
/** assignment operator prohibited */
AliHLTTPCNoiseMapComponent& operator=(const AliHLTTPCNoiseMapComponent&);
+ void ResetHistograms();
+
/** the reader object for data decoding */
AliHLTUInt32_t fSpecification; //!transient
- //AliHLTUInt8_t fMinPartition; //!transient
- //AliHLTUInt8_t fMaxPartition; //!transient
-
+ AliTPCCalPad *noisePad; //!transient
//AliHLTTPCDigitReader *pDigitReader;
Bool_t fPlotSideA; //!transient
Bool_t fPlotSideC; //!transient
Bool_t fApplyNoiseMap; //!transient
+ Bool_t fResetHistograms;//!transient
Bool_t fIsPacked; //!transient
Bool_t fIsUnpacked; //!transient
+
+ Int_t fCurrentSlice; //!transient
+ Int_t fCurrentPartition; //!transient
+ Int_t fCurrentRow; //!transient
- Int_t fSlice; //!transient
-
- Int_t fCurrentPartition; //!transient
- Int_t fCurrentRow; //!transient
-
- TH2 *fHistSideA; //!transient
- TH2 *fHistSideC; //!transient
- TH2 *fHistCDBMap; //!transient
+ TH2 *fHistPartition; //!transient
+ TH2 *fHistSideA; //!transient
+ TH2 *fHistSideC; //!transient
+ TH2 *fHistCDBMap; //!transient
- ClassDef(AliHLTTPCNoiseMapComponent, 1)
+ ClassDef(AliHLTTPCNoiseMapComponent, 2)
};
#endif