]>
Commit | Line | Data |
---|---|---|
792f66f1 | 1 | /************************************************************************** |
2 | * Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Authors: Boris Polichtchouk & Per Thomas Hille for the ALICE * | |
5 | * offline/HLT Project. Contributors are mentioned in the code where * | |
6 | * appropriate. * | |
7 | * * | |
8 | * Permission to use, copy, modify and distribute this software and its * | |
9 | * documentation strictly for non-commercial purposes is hereby granted * | |
10 | * without fee, provided that the above copyright notice appears in all * | |
11 | * copies and that both the copyright notice and this permission notice * | |
12 | * appear in the supporting documentation. The authors make no claims * | |
13 | * about the suitability of this software for any purpose. It is * | |
14 | * provided "as is" without express or implied warranty. * | |
15 | **************************************************************************/ | |
16 | ||
792f66f1 | 17 | #include "AliHLTPHOSRcuCellEnergyDataStruct.h" |
792f66f1 | 18 | #include "AliHLTPHOSRcuHistogramProducer.h" |
19 | #include "AliHLTPHOSRcuHistogramProducerComponent.h" | |
1b486665 | 20 | #include "AliHLTPHOSRcuCellAccumulatedEnergyDataStruct.h" |
14ff16ed | 21 | #include "AliHLTPHOSSharedMemoryInterface.h" |
22 | #include "AliHLTPHOSValidCellDataStruct.h" | |
792f66f1 | 23 | |
792f66f1 | 24 | AliHLTPHOSRcuHistogramProducerComponent gAliHLTPHOSRcuHistogramProducerComponent; |
792f66f1 | 25 | /************************************************************************* |
26 | * Class AliHLTPHOSRcuHistogramProducerComponent accumulating histograms * | |
27 | * with amplitudes per PHOS channel * | |
28 | * It is intended to run at the HLT farm * | |
29 | * and it fills the histograms with amplitudes per channel. * | |
30 | * Usage example see in PHOS/macros/Shuttle/AliPHOSCalibHistoProducer.C * | |
31 | **************************************************************************/ | |
1804b020 | 32 | AliHLTPHOSRcuHistogramProducerComponent:: AliHLTPHOSRcuHistogramProducerComponent() : |
33 | AliHLTPHOSRcuProcessor(), fHistoWriteFrequency(100), fRcuHistoProducerPtr(0), fOutPtr(NULL) | |
792f66f1 | 34 | { |
14ff16ed | 35 | fShmPtr = new AliHLTPHOSSharedMemoryInterface(); |
36 | //Default constructor | |
792f66f1 | 37 | } |
38 | ||
39 | ||
792f66f1 | 40 | AliHLTPHOSRcuHistogramProducerComponent::~ AliHLTPHOSRcuHistogramProducerComponent() |
41 | { | |
1b486665 | 42 | //Destructor |
792f66f1 | 43 | } |
44 | ||
45 | ||
792f66f1 | 46 | int |
47 | AliHLTPHOSRcuHistogramProducerComponent::Deinit() | |
48 | { | |
1b486665 | 49 | //See html documentation of base class |
792f66f1 | 50 | cout << "AliHLTPHOSRcuHistogramProducerComponent::Deinit()" << endl; |
c0b4e7eb | 51 | fRcuHistoProducerPtr->WriteAllHistograms("recreate"); |
792f66f1 | 52 | return 0; |
53 | } | |
54 | ||
55 | ||
792f66f1 | 56 | const char* |
57 | AliHLTPHOSRcuHistogramProducerComponent::GetComponentID() | |
58 | { | |
1b486665 | 59 | //See html documentation of base class |
792f66f1 | 60 | return "RcuHistogramProducer"; |
61 | } | |
62 | ||
63 | ||
64 | void | |
1b486665 | 65 | AliHLTPHOSRcuHistogramProducerComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) |
792f66f1 | 66 | { |
1b486665 | 67 | //See html documentation of base class |
68 | const AliHLTComponentDataType* pType=fgkInputDataTypes; | |
792f66f1 | 69 | while (pType->fID!=0) |
70 | { | |
71 | list.push_back(*pType); | |
72 | pType++; | |
73 | } | |
74 | } | |
75 | ||
76 | ||
77 | AliHLTComponentDataType | |
78 | AliHLTPHOSRcuHistogramProducerComponent::GetOutputDataType() | |
79 | { | |
1b486665 | 80 | //See html documentation of base class |
d504c864 | 81 | return AliHLTPHOSDefinitions::fgkCellEnergyDataType; |
792f66f1 | 82 | } |
83 | ||
84 | ||
85 | void | |
86 | AliHLTPHOSRcuHistogramProducerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier ) | |
87 | { | |
1b486665 | 88 | //See html documentation of base class |
792f66f1 | 89 | constBase = 30; |
90 | inputMultiplier = 1; | |
91 | } | |
92 | ||
93 | ||
c0b4e7eb | 94 | |
792f66f1 | 95 | int AliHLTPHOSRcuHistogramProducerComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, |
14ff16ed | 96 | AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, |
792f66f1 | 97 | AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks ) |
98 | { | |
1b486665 | 99 | //See html documentation of base class |
14ff16ed | 100 | AliHLTPHOSValidCellDataStruct *currentChannel =0; |
792f66f1 | 101 | unsigned long ndx = 0; |
102 | UInt_t offset = 0; | |
103 | UInt_t mysize = 0; | |
104 | UInt_t tSize = 0; | |
105 | const AliHLTComponentBlockData* iter = NULL; | |
106 | AliHLTPHOSRcuCellEnergyDataStruct *cellDataPtr; | |
107 | AliHLTUInt8_t* outBPtr; | |
c0b4e7eb | 108 | |
792f66f1 | 109 | for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) |
110 | { | |
111 | iter = blocks+ndx; | |
c0b4e7eb | 112 | if(iter->fDataType != AliHLTPHOSDefinitions::fgkCellEnergyDataType) |
113 | { | |
c0b4e7eb | 114 | continue; |
115 | } | |
14ff16ed | 116 | |
117 | cellDataPtr = (AliHLTPHOSRcuCellEnergyDataStruct*)( iter->fPtr); | |
118 | fShmPtr->SetMemory(cellDataPtr); | |
119 | currentChannel = fShmPtr->NextChannel(); | |
c0b4e7eb | 120 | |
14ff16ed | 121 | while(currentChannel != 0) |
792f66f1 | 122 | { |
14ff16ed | 123 | fRcuHistoProducerPtr->FillEnergy(currentChannel->fX, currentChannel->fZ, currentChannel->fGain, currentChannel->fEnergy); |
124 | fRcuHistoProducerPtr->FillLiveChannels(currentChannel->fData, fNTotalSamples, currentChannel->fX, currentChannel->fZ,currentChannel->fGain); | |
125 | currentChannel = fShmPtr->NextChannel(); | |
792f66f1 | 126 | } |
127 | } | |
14ff16ed | 128 | |
792f66f1 | 129 | outBPtr = outputPtr; |
130 | fOutPtr = (AliHLTPHOSRcuCellAccumulatedEnergyDataStruct*)outBPtr; | |
131 | const AliHLTPHOSRcuCellAccumulatedEnergyDataStruct &innPtr = fRcuHistoProducerPtr->GetCellAccumulatedEnergies(); | |
792f66f1 | 132 | fOutPtr->fModuleID = fModuleID; |
133 | fOutPtr->fRcuX = fRcuX; | |
134 | fOutPtr->fRcuZ = fRcuZ; | |
135 | ||
1804b020 | 136 | for(unsigned int x=0; x < N_XCOLUMNS_RCU; x ++) |
792f66f1 | 137 | { |
1804b020 | 138 | for(unsigned int z=0; z < N_ZROWS_RCU; z ++) |
792f66f1 | 139 | { |
1804b020 | 140 | for(unsigned int gain =0; gain < N_GAINS; gain ++) |
792f66f1 | 141 | { |
142 | fOutPtr->fAccumulatedEnergies[x][z][gain] = innPtr.fAccumulatedEnergies[x][z][gain]; | |
143 | fOutPtr->fHits[x][z][gain] = innPtr.fHits[x][z][gain]; | |
c0b4e7eb | 144 | fOutPtr->fDeadChannelMap[x][z][gain] = innPtr.fDeadChannelMap[x][z][gain]; |
792f66f1 | 145 | } |
146 | } | |
147 | } | |
148 | ||
792f66f1 | 149 | mysize += sizeof(AliHLTPHOSRcuCellAccumulatedEnergyDataStruct); |
150 | AliHLTComponentBlockData bd; | |
151 | FillBlockData( bd ); | |
152 | bd.fOffset = offset; | |
153 | bd.fSize = mysize; | |
d504c864 | 154 | bd.fDataType = AliHLTPHOSDefinitions::fgkCellAccumulatedEnergyDataType; |
792f66f1 | 155 | bd.fSpecification = 0xFFFFFFFF; |
156 | outputBlocks.push_back( bd ); | |
157 | tSize += mysize; | |
158 | outBPtr += mysize; | |
159 | ||
160 | if( tSize > size ) | |
161 | { | |
162 | Logging( kHLTLogFatal, "HLT::AliHLTRcuHistogramProducerComponent::DoEvent", "Too much data", | |
163 | "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu." | |
164 | , tSize, size ); | |
165 | return EMSGSIZE; | |
166 | } | |
167 | ||
1b486665 | 168 | fPhosEventCount++; |
c0b4e7eb | 169 | |
c0b4e7eb | 170 | if( (fPhosEventCount%fHistoWriteFrequency == 0) && ( fPhosEventCount != 0)) |
c0b4e7eb | 171 | { |
c0b4e7eb | 172 | fRcuHistoProducerPtr->WriteAllHistograms("recreate"); |
173 | } | |
792f66f1 | 174 | return 0; |
175 | }//end DoEvent | |
176 | ||
177 | ||
178 | int | |
179 | AliHLTPHOSRcuHistogramProducerComponent::DoInit( int argc, const char** argv ) | |
180 | { | |
1b486665 | 181 | //See html documentation of base class |
182 | fPrintInfo = kFALSE; | |
792f66f1 | 183 | int iResult=0; |
184 | TString argument=""; | |
1b486665 | 185 | iResult = ScanArguments(argc, argv); |
1b486665 | 186 | if(fIsSetEquippmentID == kFALSE) |
792f66f1 | 187 | { |
1b486665 | 188 | Logging( kHLTLogFatal, "HLT::AliHLTPHOSRcuHistogramProducerComponent::DoInt( int argc, const char** argv )", "Missing argument", |
189 | "The argument equippmentID is not set: set it with a component argumet like this: -equippmentID <number>"); | |
190 | iResult = -2; | |
792f66f1 | 191 | } |
1b486665 | 192 | fRcuHistoProducerPtr = new AliHLTPHOSRcuHistogramProducer( fModuleID, fRcuX, fRcuZ); |
1b486665 | 193 | return iResult; |
792f66f1 | 194 | |
792f66f1 | 195 | } |
196 | ||
197 | ||
198 | AliHLTComponent* | |
199 | AliHLTPHOSRcuHistogramProducerComponent::Spawn() | |
200 | { | |
1b486665 | 201 | //See html documentation of base class |
792f66f1 | 202 | return new AliHLTPHOSRcuHistogramProducerComponent; |
203 | } | |
204 | ||
205 | ||
14ff16ed | 206 |