Line data Source code
1 : // $Id$
2 :
3 : //**************************************************************************
4 : //* This file is property of and copyright by the ALICE HLT Project *
5 : //* ALICE Experiment at CERN, All rights reserved. *
6 : //* *
7 : //* Primary Authors: Mikolaj Krzewicki <mikolaj.krzewicki@cern.ch> *
8 : //* for The ALICE HLT Project. *
9 : //* *
10 : //* Permission to use, copy, modify and distribute this software and its *
11 : //* documentation strictly for non-commercial purposes is hereby granted *
12 : //* without fee, provided that the above copyright notice appears in all *
13 : //* copies and that both the copyright notice and this permission notice *
14 : //* appear in the supporting documentation. The authors make no claims *
15 : //* about the suitability of this software for any purpose. It is *
16 : //* provided "as is" without express or implied warranty. *
17 : //**************************************************************************
18 :
19 : // @file AliHLTTPCClusterStatComponent.cxx
20 : // @author David Rohr <drohr@cern.ch>
21 : //
22 :
23 : #include "AliHLTTPCClusterStatComponent.h"
24 : #include "AliHLTTPCDefinitions.h"
25 : #include "AliHLTTPCRawCluster.h"
26 :
27 6 : ClassImp(AliHLTTPCClusterStatComponent)
28 :
29 6 : AliHLTTPCClusterStatComponent::AliHLTTPCClusterStatComponent() : AliHLTProcessor()
30 3 : , fTotal(0)
31 3 : , fSplitPad(0)
32 3 : , fSplitTime(0)
33 3 : , fSplitPadTime(0)
34 3 : , fSplitPadOrTime(0)
35 3 : , fPrintClusters(0)
36 3 : , fPrintClustersScaled(0)
37 3 : , fDumpClusters(0)
38 18 : {
39 6 : }
40 :
41 0 : AliHLTTPCClusterStatComponent::~AliHLTTPCClusterStatComponent()
42 12 : {
43 12 : }
44 :
45 : void AliHLTTPCClusterStatComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
46 : {
47 0 : list.push_back(AliHLTTPCDefinitions::fgkRawClustersDataType | kAliHLTDataOriginTPC);
48 0 : }
49 :
50 : AliHLTComponentDataType AliHLTTPCClusterStatComponent::GetOutputDataType()
51 : {
52 0 : return kAliHLTDataTypeHistogram|kAliHLTDataOriginOut;
53 : }
54 :
55 : void AliHLTTPCClusterStatComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
56 : {
57 0 : constBase = 2000000;
58 0 : inputMultiplier = 0.0;
59 0 : }
60 :
61 0 : int AliHLTTPCClusterStatComponent::ProcessOption(TString option, TString value)
62 : {
63 : int iResult = 0;
64 :
65 0 : if (option.EqualTo("print-clusters"))
66 : {
67 0 : fPrintClusters = 1;
68 0 : }
69 0 : else if (option.EqualTo("print-clusters-scaled"))
70 : {
71 0 : fPrintClustersScaled = 1;
72 0 : }
73 0 : else if (option.EqualTo("dump-clusters"))
74 : {
75 0 : fDumpClusters = 1;
76 : }
77 : else
78 : {
79 0 : HLTError("invalid option: %s", value.Data());
80 0 : return -EINVAL;
81 : }
82 0 : return iResult;
83 0 : }
84 :
85 : int AliHLTTPCClusterStatComponent::DoInit(int argc, const char** argv)
86 : {
87 : int iResult=0;
88 :
89 0 : if (ProcessOptionString(GetComponentArgs())<0)
90 : {
91 0 : HLTFatal("wrong config string! %s", GetComponentArgs().c_str());
92 0 : return -EINVAL;
93 : }
94 :
95 0 : if (fDumpClusters) if ((fp = fopen("clusters.dump", "w+b")) == NULL) return -1;
96 :
97 0 : return iResult;
98 0 : }
99 :
100 : int AliHLTTPCClusterStatComponent::DoDeinit()
101 : {
102 0 : if (fDumpClusters) fclose(fp);
103 0 : return 0;
104 : }
105 :
106 : int AliHLTTPCClusterStatComponent::DoEvent(const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* /*outputPtr*/, AliHLTUInt32_t& /*size*/, AliHLTComponentBlockDataList& /*outputBlocks*/)
107 : {
108 : int iResult=0;
109 :
110 0 : if (!IsDataEvent()) {return iResult;}
111 :
112 0 : fTotal = fSplitPad = fSplitTime = fSplitPadTime = fSplitPadOrTime = 0;
113 : int slice, patch;
114 :
115 0 : int nBlocks = evtData.fBlockCnt;
116 :
117 0 : for (int is = 0;is < 36;is++) for (int ip = 0;ip < 6;ip++)
118 0 : for (int ndx=0; ndx<nBlocks; ndx++)
119 : {
120 0 : const AliHLTComponentBlockData* iter = blocks+ndx;
121 :
122 0 : if (iter->fDataType == (AliHLTTPCDefinitions::fgkRawClustersDataType | kAliHLTDataOriginTPC)) //Size of HLT-TPC clusters (uncompressed from HWCF after HWCFDecoder, not yet transformed)
123 : {
124 0 : slice = AliHLTTPCDefinitions::GetMinSliceNr(iter->fSpecification);
125 0 : patch = AliHLTTPCDefinitions::GetMinPatchNr(iter->fSpecification);
126 :
127 0 : if (slice != is || patch != ip) continue;
128 :
129 0 : AliHLTTPCRawClusterData* clusters = (AliHLTTPCRawClusterData*)(iter->fPtr);
130 0 : for(UInt_t iCluster=0;iCluster<clusters->fCount;iCluster++)
131 : {
132 0 : AliHLTTPCRawCluster &cluster = clusters->fClusters[iCluster];
133 0 : fTotal++;
134 0 : if (cluster.GetFlagSplitPad()) fSplitPad++;
135 0 : if (cluster.GetFlagSplitTime()) fSplitTime++;
136 0 : if (cluster.GetFlagSplitAny()) fSplitPadOrTime++;
137 0 : if (cluster.GetFlagSplitPad() && cluster.GetFlagSplitTime()) fSplitPadTime++;
138 :
139 0 : if (fPrintClusters) HLTImportant("Slice %d, Patch %d, Row %d, Pad %.2f, Time %.2f, SPad %.2f, STime %.2f, QMax %d, QTot %d, SplitPad %d, SplitTime %d",
140 : slice, patch, (int) cluster.GetPadRow(), cluster.GetPad(), cluster.GetTime(), cluster.GetSigmaPad2(), cluster.GetSigmaTime2(), (int) cluster.GetQMax(), (int) cluster.GetCharge(), (int) cluster.GetFlagSplitPad(), (int) cluster.GetFlagSplitTime());
141 :
142 : AliHLTUInt64_t pad64=0;
143 0 : if (!isnan(cluster.GetPad())) pad64=(AliHLTUInt64_t)round(cluster.GetPad()*AliHLTTPCDefinitions::fgkClusterParameterDefinitions[AliHLTTPCDefinitions::kPad].fScale);
144 :
145 : AliHLTUInt64_t time64=0;
146 0 : if (!isnan(cluster.GetTime())) time64=(AliHLTUInt64_t)round(cluster.GetTime()*AliHLTTPCDefinitions::fgkClusterParameterDefinitions[AliHLTTPCDefinitions::kTime].fScale);
147 :
148 : AliHLTUInt64_t sigmaPad64=0;
149 0 : if (!isnan(cluster.GetSigmaPad2())) sigmaPad64=(AliHLTUInt64_t)round(cluster.GetSigmaPad2()*AliHLTTPCDefinitions::fgkClusterParameterDefinitions[AliHLTTPCDefinitions::kSigmaY2].fScale);
150 :
151 : AliHLTUInt64_t sigmaTime64=0;
152 0 : if (!isnan(cluster.GetSigmaTime2())) sigmaTime64=(AliHLTUInt64_t)round(cluster.GetSigmaTime2()*AliHLTTPCDefinitions::fgkClusterParameterDefinitions[AliHLTTPCDefinitions::kSigmaZ2].fScale);
153 :
154 0 : if (sigmaPad64 >= (unsigned)1<<AliHLTTPCDefinitions::fgkClusterParameterDefinitions[AliHLTTPCDefinitions::kSigmaY2].fBitLength)
155 0 : sigmaPad64 = (1<<AliHLTTPCDefinitions::fgkClusterParameterDefinitions[AliHLTTPCDefinitions::kSigmaY2].fBitLength)-1;
156 0 : if (sigmaTime64 >= (unsigned)1<<AliHLTTPCDefinitions::fgkClusterParameterDefinitions[AliHLTTPCDefinitions::kSigmaZ2].fBitLength)
157 0 : sigmaTime64 = (1<<AliHLTTPCDefinitions::fgkClusterParameterDefinitions[AliHLTTPCDefinitions::kSigmaZ2].fBitLength)-1;
158 :
159 0 : if (fDumpClusters)
160 : {
161 0 : int dumpVals[11] = {(int) slice, (int) patch, (int) cluster.GetPadRow(), (int) pad64, (int) time64, (int) sigmaPad64, (int) sigmaTime64, (int) cluster.GetQMax(), (int) cluster.GetCharge(), (int) cluster.GetFlagSplitPad(), (int) cluster.GetFlagSplitTime()};
162 0 : fwrite(dumpVals, sizeof(int), 11, fp);
163 0 : }
164 :
165 0 : if (fPrintClustersScaled)
166 : {
167 0 : HLTImportant("Slice %d, Patch %d, Row %d, Pad %d, Time %d, SPad %d, STime %d, QMax %d, QTot %d, SplitPad %d, SplitTime %d",
168 : slice, patch, (int) cluster.GetPadRow(), (int) pad64, (int) time64, (int) sigmaPad64, (int) sigmaTime64, (int) cluster.GetQMax(), (int) cluster.GetCharge(), (int) cluster.GetFlagSplitPad(), (int) cluster.GetFlagSplitTime());
169 : }
170 : }
171 0 : }
172 0 : }
173 :
174 0 : HLTImportant("Total %d SplitPad %d SplitTime %d SplitPadTime %d SplitPadOrTime %d", fTotal, fSplitPad, fSplitTime, fSplitPadTime, fSplitPadOrTime);
175 :
176 : return iResult;
177 0 : }
|