1 //**************************************************************************
2 //* This file is property of and copyright by the ALICE HLT Project *
3 //* ALICE Experiment at CERN, All rights reserved. *
5 //* Primary Authors: Sylwester Radomski radomski@physi.uni-heidelberg.de *
6 //* for The ALICE HLT Project. *
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 //**************************************************************************
17 /** @file AliHLTTRDTrackHistoComponent.cxx
18 @author Raphaelle and Theodor
19 @brief Component for ploting charge in clusters
28 #include "AliHLTTRDTrackHistoComponent.h"
29 #include "AliHLTTRDDefinitions.h"
30 #include "AliCDBEntry.h"
31 #include "AliCDBManager.h"
34 #include "TObjString.h"
35 #include "TClonesArray.h"
36 #include "TTimeStamp.h"
37 #include "AliHLTTRDUtils.h"
39 #include "AliTRDcluster.h"
40 #include "AliTRDtrackV1.h"
41 #include "AliTRDseedV1.h"
43 //#include "AliHLTTRD.h"
47 /** ROOT macro for the implementation of ROOT specific class methods */
48 ClassImp(AliHLTTRDTrackHistoComponent)
50 AliHLTTRDTrackHistoComponent::AliHLTTRDTrackHistoComponent()
62 // see header file for class documentation
64 // refer to README to build package
66 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
70 AliHLTTRDTrackHistoComponent::~AliHLTTRDTrackHistoComponent()
72 // see header file for class documentation
75 // Public functions to implement AliHLTComponent's interface.
76 // These functions are required for the registration process
78 const char* AliHLTTRDTrackHistoComponent::GetComponentID()
80 // see header file for class documentation
82 return "TRDTrackHisto";
85 void AliHLTTRDTrackHistoComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
87 // see header file for class documentation
89 list.push_back( AliHLTTRDDefinitions::fgkTracksDataType );
92 AliHLTComponentDataType AliHLTTRDTrackHistoComponent::GetOutputDataType()
94 // see header file for class documentation
95 return kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD;
99 void AliHLTTRDTrackHistoComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
101 // see header file for class documentation
102 constBase = fOutputSize;
106 AliHLTComponent* AliHLTTRDTrackHistoComponent::Spawn()
108 // see header file for class documentation
109 return new AliHLTTRDTrackHistoComponent;
112 int AliHLTTRDTrackHistoComponent::DoInit(int argc, const char** argv)
114 // Initialize histograms
117 TString configuration="";
119 for (int i=0; i<argc && iResult>=0; i++) {
121 if (!configuration.IsNull()) configuration+=" ";
122 configuration+=argument;
125 if (!configuration.IsNull()) {
126 iResult=Configure(configuration.Data());
129 fTracksArray = new TClonesArray("AliTRDtrackV1");
131 fClPerTrkl = new TH1F("TrdClPerTrkl","Clusters per Tracklet", AliTRDseedV1::kNtb, -0.5, AliTRDseedV1::kNtb - 0.5);
132 fTrklPerTrk = new TH1F("TrdTrklPerTrk","Tracklets per Track", 7, -0.5, 6.5);
133 fEvSize = new TH1F("TrdTrEvSize", "Tracks size per event per ddl in kbyte", 512, 0, 512);
134 fEtaDistrib = new TH1F("TrdTrEtaDistrib", "Eta distribution of tracks", 51, -1, 1);
135 fPhiDistrib = new TH1F("TrdTrPhiDistrib", "Phi distribution of tracks", 63, 0, 6.3);
136 fPtDistrib = new TH1F("TrdTrPtDistrib", "Pt distribution of tracks", 101, 0, 10);
140 int AliHLTTRDTrackHistoComponent::DoDeinit()
142 // see header file for class documentation
144 fTracksArray->Delete();
148 if (fClPerTrkl) delete fClPerTrkl;
149 if (fTrklPerTrk) delete fTrklPerTrk;
154 int AliHLTTRDTrackHistoComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/,
155 AliHLTComponentTriggerData& /*trigData*/)
158 // if (GetFirstInputBlock(kAliHLTDataTypeSOR)) return 0;
159 // else if (GetFirstInputBlock(kAliHLTDataTypeEOR))
161 // TString fileName="/tmp/TracksHistoDump_run";
162 // fileName+=AliCDBManager::Instance()->GetRun();
163 // fileName+=".root";
164 // HLTInfo("Dumping Histogram file to %s",fileName.Data());
165 // TFile* file = TFile::Open(fileName, "RECREATE");
166 // fClPerTrkl->Write();
167 // fTrklPerTrk->Write();
169 // HLTInfo("Histogram file dumped");
173 if(!IsDataEvent())return 0;
175 const AliHLTComponentBlockData* iter = NULL;
176 Bool_t gotData = kFALSE;
178 for(iter = GetFirstInputBlock(AliHLTTRDDefinitions::fgkTracksDataType);
179 iter != NULL; iter = GetNextInputBlock() ) {
181 fEvSize->Fill((iter->fSize+0.5f)/1024);
182 AliHLTTRDUtils::ReadTracks(fTracksArray, iter->fPtr, iter->fSize);
183 HLTDebug("TClonesArray of tracks: nbEntries = %i", fTracksArray->GetEntriesFast());
185 fSpec |= iter->fSpecification;
188 if(!gotData) return 0;
193 for(int i=0;i<fTracksArray->GetEntriesFast();i++) {
194 trk=(AliTRDtrackV1*)fTracksArray->At(i);
195 fEtaDistrib->Fill(trk->Eta());
196 fPhiDistrib->Fill(trk->Phi());
197 fPtDistrib->Fill(trk->Pt());
199 for(int seedNr=0; seedNr<6; seedNr++){
200 AliTRDseedV1* seed = trk->GetTracklet(seedNr);
204 for(int clsNr=0; clsNr<AliTRDseedV1::kNtb; clsNr++)
205 if(seed->GetClusters(clsNr))nrOfCls++;
206 fClPerTrkl->Fill(nrOfCls);
208 fTrklPerTrk->Fill(nrOfTrkls);
211 fTracksArray->Delete();
213 PushBack((TObject*)fClPerTrkl, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, fSpec);
214 PushBack((TObject*)fTrklPerTrk, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, fSpec);
215 PushBack((TObject*)fEvSize, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, fSpec);
216 PushBack((TObject*)fEtaDistrib, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, fSpec);
217 PushBack((TObject*)fPhiDistrib, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, fSpec);
218 PushBack((TObject*)fPtDistrib, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, fSpec);
223 int AliHLTTRDTrackHistoComponent::Configure(const char* arguments){
225 if (!arguments) return iResult;
227 TString allArgs=arguments;
231 TObjArray* pTokens=allArgs.Tokenize(" ");
233 for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
234 argument=((TObjString*)pTokens->At(i))->GetString();
235 if (argument.IsNull()) continue;
237 if (argument.CompareTo("output_size")==0) {
238 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
239 HLTInfo("Setting output size to: %s", ((TObjString*)pTokens->At(i))->GetString().Data());
240 fOutputSize=((TObjString*)pTokens->At(i))->GetString().Atoi();
243 if (argument.CompareTo("-everyNevent")==0) {
244 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
245 HLTInfo("Option -everyNevent depreceated");
249 HLTError("unknown argument: %s", argument.Data());
257 HLTError("missing parameter for argument %s", argument.Data());