1 /**************************************************************************
2 * This file is property of and copyright by the ALICE HLT Project *
3 * All rights reserved. *
5 * Primary Authors: Oystein Djuvsland *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15 #include "AliHLTPHOSSandboxComponent.h"
16 #include "AliHLTPHOSProcessor.h"
17 #include "AliHLTPHOSChannelCounter.h"
18 #include "AliHLTPHOSRcuCellEnergyDataStruct.h"
19 #include "AliHLTPHOSDefinitions.h"
21 const AliHLTComponentDataType AliHLTPHOSSandboxComponent::fgkInputDataTypes[]={kAliHLTVoidDataType,{0,"",""}};
23 AliHLTPHOSSandboxComponent gAliHLTPHOSSandboxComponent;
25 AliHLTPHOSSandboxComponent::AliHLTPHOSSandboxComponent() :
26 AliHLTPHOSProcessor(),
33 AliHLTPHOSSandboxComponent::~AliHLTPHOSSandboxComponent()
38 AliHLTPHOSSandboxComponent::AliHLTPHOSSandboxComponent(const AliHLTPHOSSandboxComponent &) :
44 //Copy constructor, not implemented
50 AliHLTPHOSSandboxComponent::Deinit()
53 printf("AliHLTPHOSSandboxComponent::Deinit()\n");
55 //fChannelCounterPtr->PrintOutOfSyncChannels(fEvtCnt);
56 fChannelCounterPtr->FillHistograms(fEvtCnt);
57 fChannelCounterPtr->WriteHistograms("/opt/HLT-public/rundir/channelcount.root");
62 AliHLTPHOSSandboxComponent::DoDeinit()
65 //Deinitialize the component
66 Logging(kHLTLogInfo, "HLT", "PHOS", ",AliHLTPHOSSandboxComponent DoDeinit");
74 AliHLTPHOSSandboxComponent::GetComponentID()
81 AliHLTPHOSSandboxComponent::GetInputDataTypes(vector<AliHLTComponentDataType>& list)
83 //Get datatypes for input
84 const AliHLTComponentDataType* pType=fgkInputDataTypes;
85 while (pType->fID!=0) {
86 list.push_back(*pType);
91 AliHLTComponentDataType
92 AliHLTPHOSSandboxComponent::GetOutputDataType()
95 return AliHLTPHOSDefinitions::fgkAliHLTSandboxDataType;
100 AliHLTPHOSSandboxComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
109 AliHLTPHOSSandboxComponent::DoProcessing(const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
110 AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size,
111 vector<AliHLTComponentBlockData>& outputBlocks, AliHLTComponentEventDoneData *& edd)
114 AliHLTPHOSSandboxComponent::DoEvent(const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
115 AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* /*outputPtr*/, AliHLTUInt32_t& /*size*/, //TODO: I think size should be set to zero when returning from this method if not data was written to the output buffer.
116 vector<AliHLTComponentBlockData>& /*outputBlocks*/)
121 const AliHLTComponentBlockData* iter = 0;
124 for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
128 if(iter->fDataType != AliHLTPHOSDefinitions::fgkCellEnergyDataType)
130 // cout << "Warning: data type is not fgkCellEnergyDataType " << endl;
133 // cout << "Data type is fgkCellEnergyDataType\n";
134 fChannelCounterPtr->CountChannels(reinterpret_cast<AliHLTPHOSRcuCellEnergyDataStruct*>(iter->fPtr));
139 if(fEvtCnt % 10 == 0)
141 printf("Event #: %d\n", fEvtCnt);
142 //fChannelCounterPtr->PrintOutOfSyncChannels(fEvtCnt);
145 if(fEvtCnt % 1000 == 0 && fEvtCnt != 0)
147 // fChannelCounterPtr->PrintOutOfSyncChannels(fEvtCnt);
148 fChannelCounterPtr->FillHistograms(fEvtCnt);
149 fChannelCounterPtr->WriteHistograms("/opt/HLT-public/rundir/channelcount.root");
152 //cout << "Doing event... \n";
158 AliHLTPHOSSandboxComponent::DoInit(int argc, const char** /*argv*/ )
162 fChannelCounterPtr = new AliHLTPHOSChannelCounter();
164 for(int i = 0; i < argc; i++)
174 AliHLTPHOSSandboxComponent::Spawn()
177 return new AliHLTPHOSSandboxComponent();