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
24 #include "AliHLTTRDTrackHistoComponent.h"
25 #include "AliHLTTRDDefinitions.h"
26 #include "AliCDBEntry.h"
27 #include "AliCDBManager.h"
30 #include "TObjString.h"
31 #include "TClonesArray.h"
32 #include "TTimeStamp.h"
33 #include "AliHLTTRDUtils.h"
35 #include "AliTRDcluster.h"
36 #include "AliTRDtrackV1.h"
37 #include "AliTRDseedV1.h"
39 //#include "AliHLTTRD.h"
45 /** ROOT macro for the implementation of ROOT specific class methods */
46 ClassImp(AliHLTTRDTrackHistoComponent)
48 AliHLTTRDTrackHistoComponent::AliHLTTRDTrackHistoComponent()
60 // see header file for class documentation
62 // refer to README to build package
64 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
68 AliHLTTRDTrackHistoComponent::~AliHLTTRDTrackHistoComponent()
70 // see header file for class documentation
73 // Public functions to implement AliHLTComponent's interface.
74 // These functions are required for the registration process
76 const char* AliHLTTRDTrackHistoComponent::GetComponentID()
78 // see header file for class documentation
80 return "TRDTrackHisto";
83 void AliHLTTRDTrackHistoComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
85 // see header file for class documentation
87 list.push_back( AliHLTTRDDefinitions::fgkTracksDataType );
90 AliHLTComponentDataType AliHLTTRDTrackHistoComponent::GetOutputDataType()
92 // see header file for class documentation
93 return kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD;
97 void AliHLTTRDTrackHistoComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
99 // see header file for class documentation
100 constBase = fOutputSize;
104 AliHLTComponent* AliHLTTRDTrackHistoComponent::Spawn()
106 // see header file for class documentation
107 return new AliHLTTRDTrackHistoComponent;
110 int AliHLTTRDTrackHistoComponent::DoInit(int argc, const char** argv)
112 // Initialize histograms
115 TString configuration="";
117 for (int i=0; i<argc && iResult>=0; i++) {
119 if (!configuration.IsNull()) configuration+=" ";
120 configuration+=argument;
123 if (!configuration.IsNull()) {
124 iResult=Configure(configuration.Data());
127 fTracksArray = new TClonesArray("AliTRDtrackV1");
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);
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);
138 int AliHLTTRDTrackHistoComponent::DoDeinit()
140 // see header file for class documentation
142 fTracksArray->Delete();
146 if (fClPerTrkl) delete fClPerTrkl;
147 if (fTrklPerTrk) delete fTrklPerTrk;
152 int AliHLTTRDTrackHistoComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/,
153 AliHLTComponentTriggerData& /*trigData*/)
156 // if (GetFirstInputBlock(kAliHLTDataTypeSOR)) return 0;
157 // else if (GetFirstInputBlock(kAliHLTDataTypeEOR))
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();
167 // HLTInfo("Histogram file dumped");
171 if(!IsDataEvent())return 0;
173 const AliHLTComponentBlockData* iter = NULL;
174 Bool_t gotData = kFALSE;
176 for(iter = GetFirstInputBlock(AliHLTTRDDefinitions::fgkTracksDataType);
177 iter != NULL; iter = GetNextInputBlock() ) {
179 fEvSize->Fill((iter->fSize+0.5f)/1024);
180 AliHLTTRDUtils::ReadTracks(fTracksArray, iter->fPtr, iter->fSize);
181 HLTDebug("TClonesArray of tracks: nbEntries = %i", fTracksArray->GetEntriesFast());
183 fSpec |= iter->fSpecification;
186 if(!gotData) return 0;
191 for(int i=0;i<fTracksArray->GetEntriesFast();i++) {
192 trk=(AliTRDtrackV1*)fTracksArray->At(i);
193 fEtaDistrib->Fill(trk->Eta());
194 fPhiDistrib->Fill(trk->Phi());
195 fPtDistrib->Fill(trk->Pt());
197 for(int seedNr=0; seedNr<6; seedNr++){
198 AliTRDseedV1* seed = trk->GetTracklet(seedNr);
202 for(int clsNr=0; clsNr<AliTRDseedV1::kNtb; clsNr++)
203 if(seed->GetClusters(clsNr))nrOfCls++;
204 fClPerTrkl->Fill(nrOfCls);
206 fTrklPerTrk->Fill(nrOfTrkls);
209 fTracksArray->Delete();
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);
221 int AliHLTTRDTrackHistoComponent::Configure(const char* arguments){
223 if (!arguments) return iResult;
225 TString allArgs=arguments;
229 TObjArray* pTokens=allArgs.Tokenize(" ");
231 for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
232 argument=((TObjString*)pTokens->At(i))->GetString();
233 if (argument.IsNull()) continue;
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();
241 if (argument.CompareTo("-everyNevent")==0) {
242 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
243 HLTInfo("Option -everyNevent depreceated");
247 HLTError("unknown argument: %s", argument.Data());
255 HLTError("missing parameter for argument %s", argument.Data());