3 #include "AliHLTPHOSNoiseMapperComponent.h"
4 #include "AliHLTPHOSNoiseMapper.h"
5 #include "AliHLTPHOSDigitDataStruct.h"
6 #include "AliHLTPHOSBaseline.h"
7 #include "AliHLTPHOSProcessor.h"
12 #include <sys/types.h>
14 const AliHLTComponentDataType AliHLTPHOSNoiseMapperComponent::fgkInputDataTypes[]={kAliHLTVoidDataType,{0,"",""}};
16 AliHLTPHOSNoiseMapperComponent gAliHLTPHOSNoiseMapperComponent;
18 AliHLTPHOSNoiseMapperComponent::AliHLTPHOSNoiseMapperComponent() :
19 AliHLTPHOSProcessor(),
30 AliHLTPHOSNoiseMapperComponent::~AliHLTPHOSNoiseMapperComponent()
35 AliHLTPHOSNoiseMapperComponent::Deinit()
39 sprintf(filename, "%s/run%d_noisemap.root", fDirectory, fRunNb);
43 cout << "Writing file...";
44 TFile *outfile = new TFile(filename,"recreate");
45 fNoiseCountLowGainHistPtr->Write();
46 fNoiseCountHighGainHistPtr->Write();
47 fNoiseMapLowGainHistPtr->Write();
48 fNoiseMapHighGainHistPtr->Write();
55 delete fNoiseMapperPtr;
66 AliHLTPHOSNoiseMapperComponent::GetComponentID()
68 return "PhosNoiseMapper";
73 AliHLTPHOSNoiseMapperComponent::GetInputDataTypes(vector<AliHLTComponentDataType>& list)
75 //Get datatypes for input
76 const AliHLTComponentDataType* pType=fgkInputDataTypes;
77 while (pType->fID!=0) {
78 list.push_back(*pType);
83 AliHLTComponentDataType
84 AliHLTPHOSNoiseMapperComponent::GetOutputDataType()
86 return AliHLTPHOSDefinitions::fgkAliHLTNoiseMapDataType;
91 AliHLTPHOSNoiseMapperComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
98 AliHLTPHOSNoiseMapperComponent::DoEvent(const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
99 AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size,
100 std::vector<AliHLTComponentBlockData>& outputBlocks)
107 Int_t nRecPoints = 0;
111 Int_t digitCount = 0;
115 AliHLTUInt8_t* outBPtr;
117 const AliHLTComponentBlockData* iter = 0;
120 for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
124 if(iter->fDataType != AliHLTPHOSDefinitions::fgkCellEnergyDataType)
126 // cout << "Warning: data type is not fgkCellEnergyDataType " << endl;
130 fNoiseMapperPtr->MapNoisyChannels(reinterpret_cast<AliHLTPHOSDigitContainerDataStruct*>(iter->fPtr));
135 //PushBack(fDigitArrayPtr, kAliHLTAnyDataType, (AliHLTUInt32_t)0);
137 if(fEventCount % 10 == 0)
139 cout << "Event #: " << fEventCount << endl;
142 if(fEventCount % fWriteInterval == 0)
145 sprintf(filename, "%s/run%d_noisemap.root", fDirectory, fRunNb);
149 cout << "Writing file...";
150 TFile *outfile = new TFile(filename,"recreate");
151 fNoiseCountLowGainHistPtr->Write();
152 fNoiseCountLowGainHistPtr->Write();
153 fNoiseMapLowGainHistPtr->Write();
154 fNoiseMapHighGainHistPtr->Write();
165 AliHLTPHOSNoiseMapperComponent::DoInit(int argc, const char** argv )
168 Bool_t pathSet = false;
169 Bool_t nSamplesSet = false;
171 fDirectory = new char[50];
173 fNoiseMapperPtr = new AliHLTPHOSNoiseMapper();
175 fNoiseCountLowGainHistPtr = new TH2I("noiseCountLowGain", "Noise count for low gain channels", 64, 0, 63, 56, 0, 55);
176 fNoiseCountHighGainHistPtr = new TH2I("noiseCountHighGain", "Noise count for high gain channels", 64, 0, 63, 56, 0, 55);
177 fNoiseMapLowGainHistPtr = new TH2I("noiseMapLowGain", "Noise map for low gain channels", 64, 0, 63, 56, 0, 55);
178 fNoiseMapHighGainHistPtr = new TH2I("noiseMapHighGain", "Noise map for high gain channels", 64, 0, 63, 56, 0, 55);
180 for(int i = 0; i < argc; i++)
182 if(!strcmp("-path", argv[i]))
184 strcpy(fDirectory, argv[i+1]);
187 if(!strcmp("-noisethreshold", argv[i]))
189 fNoiseMapperPtr->SetNoiseThreshold(atof(argv[i+1]));
194 fWriteInterval = 100;
200 AliHLTPHOSNoiseMapperComponent::Spawn()
202 return new AliHLTPHOSNoiseMapperComponent();
206 AliHLTPHOSNoiseMapperComponent::FillHistograms()
208 Int_t channelArray[N_XCOLUMNS_MOD][N_ZROWS_MOD][N_GAINS];
209 fNoiseMapperPtr->GetChannelArray(channelArray);
210 for(Int_t x = 0; x < N_XCOLUMNS_MOD; x++)
212 for(Int_t z = 0; z < N_ZROWS_MOD; z++)
214 fNoiseCountLowGainHistPtr->SetBinContent(x, z, channelArray[x][z][0]);
215 fNoiseCountHighGainHistPtr->SetBinContent(x, z, channelArray[x][z][1]);
216 if((channelArray[x][z][0]/fEventCount) > fRateThreshold)
218 fNoiseMapLowGainHistPtr->SetBinContent(x, z, 10);
220 if((channelArray[x][z][1]/fEventCount) > fRateThreshold)
222 fNoiseMapHighGainHistPtr->SetBinContent(x, z, 10);