]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/PHOS/AliHLTPHOSSandboxComponent.cxx
New component for writing calibration data to fxs (Oystein)
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSSandboxComponent.cxx
1 /**************************************************************************
2  * This file is property of and copyright by the ALICE HLT Project        *
3  * All rights reserved.                                                   *
4  *                                                                        *
5  * Primary Authors: Oystein Djuvsland                                     *
6  *                                                                        *
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"
20
21 const AliHLTComponentDataType AliHLTPHOSSandboxComponent::fgkInputDataTypes[]={kAliHLTVoidDataType,{0,"",""}};
22
23 AliHLTPHOSSandboxComponent gAliHLTPHOSSandboxComponent;
24
25 AliHLTPHOSSandboxComponent::AliHLTPHOSSandboxComponent() :
26   AliHLTPHOSProcessor(),
27   fEvtCnt(0),
28   fChannelCounterPtr(0)
29 {
30   //comment
31 }
32
33 AliHLTPHOSSandboxComponent::~AliHLTPHOSSandboxComponent()
34 {
35   //comment
36 }
37 /*
38 AliHLTPHOSSandboxComponent::AliHLTPHOSSandboxComponent(const AliHLTPHOSSandboxComponent &) :
39   AliHLTDataSink(),
40   fEvtCnt(0),
41   fChannelCounterPtr(0)
42 {
43
44   //Copy constructor, not implemented
45
46 }
47 */
48
49 int 
50 AliHLTPHOSSandboxComponent::Deinit()
51 {
52   //comment
53   printf("AliHLTPHOSSandboxComponent::Deinit()\n");
54
55   //fChannelCounterPtr->PrintOutOfSyncChannels(fEvtCnt);
56   fChannelCounterPtr->FillHistograms(fEvtCnt);
57   fChannelCounterPtr->WriteHistograms("/opt/HLT-public/rundir/channelcount.root");
58   return 0;
59 }
60
61 Int_t
62 AliHLTPHOSSandboxComponent::DoDeinit()
63 {
64   //comment
65   //Deinitialize the component
66   Logging(kHLTLogInfo, "HLT", "PHOS", ",AliHLTPHOSSandboxComponent DoDeinit");
67
68   return 0;
69 }
70
71
72
73 const char*
74 AliHLTPHOSSandboxComponent::GetComponentID()
75 {
76   //comment
77   return "PhosSandbox";
78 }
79
80 void
81 AliHLTPHOSSandboxComponent::GetInputDataTypes(vector<AliHLTComponentDataType>& list)
82
83  //Get datatypes for input
84   const AliHLTComponentDataType* pType=fgkInputDataTypes;
85   while (pType->fID!=0) {
86     list.push_back(*pType); 
87     pType++;
88   }
89 }
90
91 AliHLTComponentDataType 
92 AliHLTPHOSSandboxComponent::GetOutputDataType()
93 {
94   //comment
95   return AliHLTPHOSDefinitions::fgkAliHLTSandboxDataType;
96 }
97
98
99 void 
100 AliHLTPHOSSandboxComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
101 {
102   //comment
103   constBase = 30;
104   inputMultiplier = 1;
105 }
106
107 /*
108 int 
109 AliHLTPHOSSandboxComponent::DoProcessing(const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
110                                     AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size,
111                                     vector<AliHLTComponentBlockData>& outputBlocks, AliHLTComponentEventDoneData *& edd)
112 */
113 int 
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*/)
117 {
118    //Do event
119   
120   
121   const AliHLTComponentBlockData* iter = 0; 
122   unsigned long ndx; 
123
124   for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
125     {
126       iter = blocks+ndx;
127       
128       if(iter->fDataType != AliHLTPHOSDefinitions::fgkCellEnergyDataType)
129         {
130         //  cout << "Warning: data type is not fgkCellEnergyDataType " << endl;
131           continue;
132         }
133      // cout << "Data type is fgkCellEnergyDataType\n";
134       fChannelCounterPtr->CountChannels(reinterpret_cast<AliHLTPHOSRcuCellEnergyDataStruct*>(iter->fPtr));
135     }
136   
137   fEvtCnt++;
138
139   if(fEvtCnt % 10 == 0)
140    {
141         printf("Event #: %d\n", fEvtCnt);   
142         //fChannelCounterPtr->PrintOutOfSyncChannels(fEvtCnt);
143     }
144  
145   if(fEvtCnt % 1000 == 0 && fEvtCnt != 0)
146     {
147 //      fChannelCounterPtr->PrintOutOfSyncChannels(fEvtCnt);
148       fChannelCounterPtr->FillHistograms(fEvtCnt);
149       fChannelCounterPtr->WriteHistograms("/opt/HLT-public/rundir/channelcount.root");
150     }
151
152   //cout << "Doing event... \n";
153   return 0;
154 }
155
156
157 int
158 AliHLTPHOSSandboxComponent::DoInit(int argc, const char** /*argv*/ )
159 {
160   //Do initialization
161
162   fChannelCounterPtr = new AliHLTPHOSChannelCounter();
163   
164   for(int i = 0; i < argc; i++)
165     {
166       /*
167        */
168     }
169
170   return 0;
171 }
172
173 AliHLTComponent*
174 AliHLTPHOSSandboxComponent::Spawn()
175 {
176   //comment
177   return new AliHLTPHOSSandboxComponent();
178 }