]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/TRD/AliHLTTRDTrackHistoComponent.cxx
Revert "- test commit"
[u/mrichter/AliRoot.git] / HLT / TRD / AliHLTTRDTrackHistoComponent.cxx
CommitLineData
ae24e8b7 1//**************************************************************************
2//* This file is property of and copyright by the ALICE HLT Project *
3//* ALICE Experiment at CERN, All rights reserved. *
4//* *
5//* Primary Authors: Sylwester Radomski radomski@physi.uni-heidelberg.de *
6//* for The ALICE HLT Project. *
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
17/** @file AliHLTTRDTrackHistoComponent.cxx
18 @author Raphaelle and Theodor
19 @brief Component for ploting charge in clusters
20*/
21
ae24e8b7 22#include <time.h>
23
24#include "AliHLTTRDTrackHistoComponent.h"
25#include "AliHLTTRDDefinitions.h"
26#include "AliCDBEntry.h"
27#include "AliCDBManager.h"
28#include <TFile.h>
29#include <TString.h>
30#include "TObjString.h"
31#include "TClonesArray.h"
32#include "TTimeStamp.h"
33#include "AliHLTTRDUtils.h"
34#include "TH1F.h"
35#include "AliTRDcluster.h"
36#include "AliTRDtrackV1.h"
37#include "AliTRDseedV1.h"
38
39//#include "AliHLTTRD.h"
40//#include <stdlib.h>
41//#include <cerrno>
42
a7f38894 43using namespace std;
44
ae24e8b7 45/** ROOT macro for the implementation of ROOT specific class methods */
46ClassImp(AliHLTTRDTrackHistoComponent)
47
48AliHLTTRDTrackHistoComponent::AliHLTTRDTrackHistoComponent()
49: AliHLTProcessor(),
50 fOutputSize(100000),
2d7cea9e 51 fSpec(0),
ae24e8b7 52 fTracksArray(NULL),
53 fClPerTrkl(NULL),
1ea1f8e0 54 fTrklPerTrk(NULL),
802b480b 55 fEvSize(NULL),
56 fEtaDistrib(NULL),
57 fPhiDistrib(NULL),
58 fPtDistrib(NULL)
ae24e8b7 59{
60 // see header file for class documentation
61 // or
62 // refer to README to build package
63 // or
64 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
65
66}
67
68AliHLTTRDTrackHistoComponent::~AliHLTTRDTrackHistoComponent()
69{
70 // see header file for class documentation
71}
72
73// Public functions to implement AliHLTComponent's interface.
74// These functions are required for the registration process
75
76const char* AliHLTTRDTrackHistoComponent::GetComponentID()
77{
78 // see header file for class documentation
79
80 return "TRDTrackHisto";
81}
82
83void AliHLTTRDTrackHistoComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
84{
85 // see header file for class documentation
86 list.clear();
87 list.push_back( AliHLTTRDDefinitions::fgkTracksDataType );
88}
89
90AliHLTComponentDataType AliHLTTRDTrackHistoComponent::GetOutputDataType()
91{
92 // see header file for class documentation
93 return kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD;
94
95}
96
97void AliHLTTRDTrackHistoComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
98{
99 // see header file for class documentation
100 constBase = fOutputSize;
101 inputMultiplier = 0;
102}
103
104AliHLTComponent* AliHLTTRDTrackHistoComponent::Spawn()
105{
106 // see header file for class documentation
107 return new AliHLTTRDTrackHistoComponent;
108}
109
110int AliHLTTRDTrackHistoComponent::DoInit(int argc, const char** argv)
111{
112 // Initialize histograms
113 int iResult=0;
114
115 TString configuration="";
116 TString argument="";
117 for (int i=0; i<argc && iResult>=0; i++) {
118 argument=argv[i];
119 if (!configuration.IsNull()) configuration+=" ";
120 configuration+=argument;
121 }
122
123 if (!configuration.IsNull()) {
124 iResult=Configure(configuration.Data());
125 }
126
127 fTracksArray = new TClonesArray("AliTRDtrackV1");
128
ffdc0ab5 129 fClPerTrkl = new TH1F("TrdClPerTrkl","Clusters per Tracklet", AliTRDseedV1::kNtb, -0.5, AliTRDseedV1::kNtb - 0.5);
130 fTrklPerTrk = new TH1F("TrdTrklPerTrk","Tracklets per Track", 7, -0.5, 6.5);
131 fEvSize = new TH1F("TrdTrEvSize", "Tracks size per event per ddl in kbyte", 512, 0, 512);
802b480b 132 fEtaDistrib = new TH1F("TrdTrEtaDistrib", "Eta distribution of tracks", 51, -1, 1);
133 fPhiDistrib = new TH1F("TrdTrPhiDistrib", "Phi distribution of tracks", 63, 0, 6.3);
134 fPtDistrib = new TH1F("TrdTrPtDistrib", "Pt distribution of tracks", 101, 0, 10);
ae24e8b7 135 return 0;
136}
137
138int AliHLTTRDTrackHistoComponent::DoDeinit()
139{
140 // see header file for class documentation
141
142 fTracksArray->Delete();
143 delete fTracksArray;
144
145 // delete histograms
146 if (fClPerTrkl) delete fClPerTrkl;
147 if (fTrklPerTrk) delete fTrklPerTrk;
148
149 return 0;
150}
151
152int AliHLTTRDTrackHistoComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/,
153 AliHLTComponentTriggerData& /*trigData*/)
154{
155
156 // if (GetFirstInputBlock(kAliHLTDataTypeSOR)) return 0;
157 // else if (GetFirstInputBlock(kAliHLTDataTypeEOR))
158 // {
159 // TString fileName="/tmp/TracksHistoDump_run";
160 // fileName+=AliCDBManager::Instance()->GetRun();
161 // fileName+=".root";
162 // HLTInfo("Dumping Histogram file to %s",fileName.Data());
163 // TFile* file = TFile::Open(fileName, "RECREATE");
164 // fClPerTrkl->Write();
165 // fTrklPerTrk->Write();
166 // file->Close();
167 // HLTInfo("Histogram file dumped");
168 // return 0;
169 // }
170
1ea1f8e0 171 if(!IsDataEvent())return 0;
ae24e8b7 172
173 const AliHLTComponentBlockData* iter = NULL;
1298a070 174 Bool_t gotData = kFALSE;
ae24e8b7 175
176 for(iter = GetFirstInputBlock(AliHLTTRDDefinitions::fgkTracksDataType);
177 iter != NULL; iter = GetNextInputBlock() ) {
178
1ea1f8e0 179 fEvSize->Fill((iter->fSize+0.5f)/1024);
ae24e8b7 180 AliHLTTRDUtils::ReadTracks(fTracksArray, iter->fPtr, iter->fSize);
1ea1f8e0 181 HLTDebug("TClonesArray of tracks: nbEntries = %i", fTracksArray->GetEntriesFast());
1298a070 182 gotData=kTRUE;
2d7cea9e 183 fSpec |= iter->fSpecification;
ae24e8b7 184 }
185
1298a070 186 if(!gotData) return 0;
187
ae24e8b7 188 AliTRDtrackV1 *trk;
189
190 // loop over tracks
191 for(int i=0;i<fTracksArray->GetEntriesFast();i++) {
192 trk=(AliTRDtrackV1*)fTracksArray->At(i);
802b480b 193 fEtaDistrib->Fill(trk->Eta());
194 fPhiDistrib->Fill(trk->Phi());
195 fPtDistrib->Fill(trk->Pt());
ae24e8b7 196 Int_t nrOfTrkls=0;
197 for(int seedNr=0; seedNr<6; seedNr++){
198 AliTRDseedV1* seed = trk->GetTracklet(seedNr);
199 if(!seed)continue;
200 nrOfTrkls++;
201 Int_t nrOfCls=0;
202 for(int clsNr=0; clsNr<AliTRDseedV1::kNtb; clsNr++)
203 if(seed->GetClusters(clsNr))nrOfCls++;
204 fClPerTrkl->Fill(nrOfCls);
205 }
206 fTrklPerTrk->Fill(nrOfTrkls);
207 }
208
209 fTracksArray->Delete();
210
2d7cea9e 211 PushBack((TObject*)fClPerTrkl, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, fSpec);
212 PushBack((TObject*)fTrklPerTrk, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, fSpec);
213 PushBack((TObject*)fEvSize, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, fSpec);
214 PushBack((TObject*)fEtaDistrib, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, fSpec);
215 PushBack((TObject*)fPhiDistrib, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, fSpec);
216 PushBack((TObject*)fPtDistrib, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, fSpec);
ae24e8b7 217
218 return 0;
219}
220
221int AliHLTTRDTrackHistoComponent::Configure(const char* arguments){
222 int iResult=0;
223 if (!arguments) return iResult;
224
225 TString allArgs=arguments;
226 TString argument;
227 int bMissingParam=0;
228
229 TObjArray* pTokens=allArgs.Tokenize(" ");
230 if (pTokens) {
231 for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
232 argument=((TObjString*)pTokens->At(i))->GetString();
233 if (argument.IsNull()) continue;
234
235 if (argument.CompareTo("output_size")==0) {
236 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
237 HLTInfo("Setting output size to: %s", ((TObjString*)pTokens->At(i))->GetString().Data());
238 fOutputSize=((TObjString*)pTokens->At(i))->GetString().Atoi();
239 continue;
240 }
241 if (argument.CompareTo("-everyNevent")==0) {
242 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
243 HLTInfo("Option -everyNevent depreceated");
244 continue;
245 }
246 else {
247 HLTError("unknown argument: %s", argument.Data());
248 iResult=-EINVAL;
249 break;
250 }
251 }
252 delete pTokens;
253 }
254 if (bMissingParam) {
255 HLTError("missing parameter for argument %s", argument.Data());
256 iResult=-EINVAL;
257 }
258 return iResult;
259}