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()
57 // see header file for class documentation
59 // refer to README to build package
61 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
65 AliHLTTRDTrackHistoComponent::~AliHLTTRDTrackHistoComponent()
67 // see header file for class documentation
70 // Public functions to implement AliHLTComponent's interface.
71 // These functions are required for the registration process
73 const char* AliHLTTRDTrackHistoComponent::GetComponentID()
75 // see header file for class documentation
77 return "TRDTrackHisto";
80 void AliHLTTRDTrackHistoComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
82 // see header file for class documentation
84 list.push_back( AliHLTTRDDefinitions::fgkTracksDataType );
87 AliHLTComponentDataType AliHLTTRDTrackHistoComponent::GetOutputDataType()
89 // see header file for class documentation
90 return kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD;
94 void AliHLTTRDTrackHistoComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
96 // see header file for class documentation
97 constBase = fOutputSize;
101 AliHLTComponent* AliHLTTRDTrackHistoComponent::Spawn()
103 // see header file for class documentation
104 return new AliHLTTRDTrackHistoComponent;
107 int AliHLTTRDTrackHistoComponent::DoInit(int argc, const char** argv)
109 // Initialize histograms
112 TString configuration="";
114 for (int i=0; i<argc && iResult>=0; i++) {
116 if (!configuration.IsNull()) configuration+=" ";
117 configuration+=argument;
120 if (!configuration.IsNull()) {
121 iResult=Configure(configuration.Data());
124 fTracksArray = new TClonesArray("AliTRDtrackV1");
126 fClPerTrkl = new TH1F("fClPerTrkl","Clusters per Tracklet", AliTRDseedV1::kNtb, -0.5, AliTRDseedV1::kNtb - 0.5);
127 fTrklPerTrk = new TH1F("fTrklPerTrk","Tracklets per Track", 7, -0.5, 6.5);
132 int AliHLTTRDTrackHistoComponent::DoDeinit()
134 // see header file for class documentation
136 fTracksArray->Delete();
140 if (fClPerTrkl) delete fClPerTrkl;
141 if (fTrklPerTrk) delete fTrklPerTrk;
146 int AliHLTTRDTrackHistoComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/,
147 AliHLTComponentTriggerData& /*trigData*/)
150 // if (GetFirstInputBlock(kAliHLTDataTypeSOR)) return 0;
151 // else if (GetFirstInputBlock(kAliHLTDataTypeEOR))
153 // TString fileName="/tmp/TracksHistoDump_run";
154 // fileName+=AliCDBManager::Instance()->GetRun();
155 // fileName+=".root";
156 // HLTInfo("Dumping Histogram file to %s",fileName.Data());
157 // TFile* file = TFile::Open(fileName, "RECREATE");
158 // fClPerTrkl->Write();
159 // fTrklPerTrk->Write();
161 // HLTInfo("Histogram file dumped");
165 if (GetFirstInputBlock(kAliHLTDataTypeSOR) || GetFirstInputBlock(kAliHLTDataTypeEOR)) return 0;
167 const AliHLTComponentBlockData* iter = NULL;
168 Bool_t gotData = kFALSE;
170 for(iter = GetFirstInputBlock(AliHLTTRDDefinitions::fgkTracksDataType);
171 iter != NULL; iter = GetNextInputBlock() ) {
173 AliHLTTRDUtils::ReadTracks(fTracksArray, iter->fPtr, iter->fSize);
174 HLTDebug("TClonesArray of clusters: nbEntries = %i", fTracksArray->GetEntriesFast());
178 if(!gotData) return 0;
183 for(int i=0;i<fTracksArray->GetEntriesFast();i++) {
184 trk=(AliTRDtrackV1*)fTracksArray->At(i);
186 for(int seedNr=0; seedNr<6; seedNr++){
187 AliTRDseedV1* seed = trk->GetTracklet(seedNr);
191 for(int clsNr=0; clsNr<AliTRDseedV1::kNtb; clsNr++)
192 if(seed->GetClusters(clsNr))nrOfCls++;
193 fClPerTrkl->Fill(nrOfCls);
195 fTrklPerTrk->Fill(nrOfTrkls);
198 fTracksArray->Delete();
200 PushBack((TObject*)fClPerTrkl, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, 0);
201 PushBack((TObject*)fTrklPerTrk, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, 0);
206 int AliHLTTRDTrackHistoComponent::Configure(const char* arguments){
208 if (!arguments) return iResult;
210 TString allArgs=arguments;
214 TObjArray* pTokens=allArgs.Tokenize(" ");
216 for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
217 argument=((TObjString*)pTokens->At(i))->GetString();
218 if (argument.IsNull()) continue;
220 if (argument.CompareTo("output_size")==0) {
221 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
222 HLTInfo("Setting output size to: %s", ((TObjString*)pTokens->At(i))->GetString().Data());
223 fOutputSize=((TObjString*)pTokens->At(i))->GetString().Atoi();
226 if (argument.CompareTo("-everyNevent")==0) {
227 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
228 HLTInfo("Option -everyNevent depreceated");
232 HLTError("unknown argument: %s", argument.Data());
240 HLTError("missing parameter for argument %s", argument.Data());