2 //**************************************************************************
3 //* This file is property of and copyright by the ALICE HLT Project *
4 //* ALICE Experiment at CERN, All rights reserved. *
6 //* Primary Authors: Felix Rettig, Stefan Kirsch *
7 //* for The ALICE HLT Project. *
9 //* Permission to use, copy, modify and distribute this software and its *
10 //* documentation strictly for non-commercial purposes is hereby granted *
11 //* without fee, provided that the above copyright notice appears in all *
12 //* copies and that both the copyright notice and this permission notice *
13 //* appear in the supporting documentation. The authors make no claims *
14 //* about the suitability of this software for any purpose. It is *
15 //* provided "as is" without express or implied warranty. *
16 //**************************************************************************
18 /// @file AliHLTTRDGlobalMonitorComponent.cxx
19 /// @author Felix Rettig, Stefan Kirsch
21 /// @brief A processing component for TRD tracking/trigger data on CN-level
24 #include "AliHLTTRDGlobalMonitorComponent.h"
25 #include "AliHLTDataTypes.h"
26 #include "AliHLTTRDDefinitions.h"
30 #include "TObjString.h"
31 #include "TObjArray.h"
34 #define TRDMAXDDLSIZE 10000
36 /** ROOT macro for the implementation of ROOT specific class methods */
37 ClassImp(AliHLTTRDGlobalMonitorComponent)
39 AliHLTTRDGlobalMonitorComponent::AliHLTTRDGlobalMonitorComponent()
42 , fHistTrackletY(NULL)
43 , fHistTrackletDy(NULL)
44 , fHistTrackletZ(NULL)
45 , fHistTrackletPID(NULL)
46 , fHistTrackletYDy(NULL)
47 , fHistTrackletHC(NULL)
48 , fHistTrackletBadY(NULL)
49 , fHistTrackletBadPID(NULL)
50 , fHistFirstTrackletTime(NULL)
51 , fHistLastTrackletTime(NULL)
56 , fHistTrackStack(NULL)
57 , fHistTrackletsTrack(NULL)
58 , fHistTrackletsTrackHpt(NULL)
59 , fHistTriggerContribs(NULL)
61 // see header file for class documentation
63 // refer to README to build package
65 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
68 AliHLTTRDGlobalMonitorComponent::~AliHLTTRDGlobalMonitorComponent()
70 // see header file for class documentation
73 const char* AliHLTTRDGlobalMonitorComponent::GetComponentID()
75 // see header file for class documentation
76 return "TRDGlobalMonitorComponent";
79 void AliHLTTRDGlobalMonitorComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
81 // see header file for class documentation
82 // list.push_back(AliHLTTRDDefinitions::fgkSimpleIntegerDataType);
83 list.push_back(kAliHLTDataTypeTObject | kAliHLTDataOriginTRD);
86 AliHLTComponentDataType AliHLTTRDGlobalMonitorComponent::GetOutputDataType()
88 // see header file for class documentation
89 return (kAliHLTDataTypeTObjArray | kAliHLTDataOriginTRD);
92 void AliHLTTRDGlobalMonitorComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
94 // see header file for class documentation
99 AliHLTComponent* AliHLTTRDGlobalMonitorComponent::Spawn()
101 // see header file for class documentation
102 return new AliHLTTRDGlobalMonitorComponent;
105 int AliHLTTRDGlobalMonitorComponent::DoInit( int argc, const char** argv )
107 fHistArray = new TObjArray(25);
110 fHistArray->SetOwner(kTRUE);
112 fHistTrackletY = new TH1I("hist_tracklets_y", "Y-Position of online tracklets", 256, -4096, 4096);
113 fHistArray->AddLast(fHistTrackletY);
115 fHistTrackletDy = new TH1I("hist_tracklets_dy", "Deflections of online tracklets", 128, -64, 64);
116 fHistArray->AddLast(fHistTrackletDy);
118 fHistTrackletZ = new TH1I("hist_tracklets_z", "Z-Position of online tracklets", 12, 0, 12);
119 fHistArray->AddLast(fHistTrackletZ);
121 fHistTrackletPID = new TH1I("hist_tracklets_pid", "PID of online tracklets", 256, 0, 256);
122 fHistArray->AddLast(fHistTrackletPID);
124 fHistTrackletYDy = new TH2I("hist_tracklets_y_dy", "Tracklet deflection vs. tracklet position", 256, -4096, 4096, 64, -64, 64);
125 fHistArray->AddLast(fHistTrackletYDy);
127 fHistTrackletHC = new TH2I("hist_tracklets_hc", "Number of online tracklets by HC", 18, 0, 18, 60, 0, 60);
128 fHistArray->AddLast(fHistTrackletHC);
130 fHistTrackletBadY = new TH2I("hist_tracklets_bad_y", "Number of online tracklets with bad y-position by stack", 18, 0, 18, 5, 0, 5);
131 fHistArray->AddLast(fHistTrackletBadY);
133 fHistTrackletBadPID = new TH2I("hist_tracklets_bad_pid", "Number of online tracklets with bad PID value by stack", 18, 0, 18, 5, 0, 5);
134 fHistArray->AddLast(fHistTrackletBadPID);
136 fHistFirstTrackletTime = new TH1F("hist_first_tracklet_time", "Arrival time of first tracklet", 160, 0., 8.);
137 fHistArray->AddLast(fHistFirstTrackletTime);
139 fHistLastTrackletTime = new TH1F("hist_last_tracklet_time", "Arrival time of last tracklet", 160, 0., 8.);
140 fHistArray->AddLast(fHistLastTrackletTime);
142 fHistTmuTime = new TH1F("hist_tmu_time", "Tracking done time TMU-level", 160, 0., 8.);
143 fHistArray->AddLast(fHistTmuTime);
145 fHistSmuTime = new TH1F("hist_smu_time", "Tracking done time SMU-level", 160, 0., 8.);
146 fHistArray->AddLast(fHistSmuTime);
148 fHistTrackPt = new TH1F("hist_tracks_pt", "Transverse momentum of GTU tracks", 100, 0., 20.);
149 fHistArray->AddLast(fHistTrackPt);
151 fHistTrackPID = new TH1I("hist_tracks_pid", "PID value of GTU tracks", 256, 0, 256);
152 fHistArray->AddLast(fHistTrackPID);
154 fHistTrackStack = new TH2I("hist_tracks_stack", "Number of GTU tracks by stack", 18, 0, 18, 5, 0, 5);
155 fHistArray->AddLast(fHistTrackStack);
157 fHistTrackletsTrack = new TH1I("hist_tracklets_track", "Tracklets per GTU track", 7, 0, 7);
158 fHistArray->AddLast(fHistTrackletsTrack);
160 fHistTrackletsTrackHpt = new TH1I("hist_tracklets_track_hpt", "Tracklets per high-pt GTU track", 7, 0, 7);
161 fHistArray->AddLast(fHistTrackletsTrackHpt);
163 fHistTriggerContribs = new TH2I("hist_trigger_contribs", "Trigger contributions by segment", 18, 0, 18, 12, 0, 12);
164 fHistArray->AddLast(fHistTriggerContribs);
169 int AliHLTTRDGlobalMonitorComponent::DoDeinit()
179 int AliHLTTRDGlobalMonitorComponent::DoEvent( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/)
183 // Int_t totaleventsize=0;
187 for (const AliHLTComponentBlockData* pBlock = GetFirstInputBlock(AliHLTTRDDefinitions::fgkSimpleIntegerDataType);
188 pBlock!=NULL && iResult>=0;
189 pBlock=GetNextInputBlock()) {
190 // extract DDL id from specification
192 for (unsigned pos=0; pos<8*sizeof(AliHLTUInt32_t); pos++) {
193 if (pBlock->fSpecification & (0x1<<pos)) {
195 HLTWarning("Can not uniquely identify DDL number from specification, skipping data block %s 0x%08x",
196 DataType2Text(pBlock->fDataType).c_str(),
197 pBlock->fSpecification);
204 if (ddlnum<0 || ddlnum >= TRDMODULES) continue;
206 if ( pBlock->fSize < sizeof(Int_t) ) {
207 HLTWarning("block size (%d) smaller than expected size (%d)!", pBlock->fSize, sizeof(Int_t) );
211 Int_t* eventsize = (Int_t *) pBlock->fPtr;
212 if(*eventsize > TRDMAXDDLSIZE)
213 HLTWarning("eventsize (%d) larger than histogram range (%d)", *eventsize, TRDMAXDDLSIZE);
215 TH1F* h = dynamic_cast<TH1F*>(fHistoArray->At(ddlnum));
216 h->Fill((Double_t)*eventsize);
218 totaleventsize += *eventsize;
222 // reset the high-level histograms, the accumulation over events is done in the lower level
223 fHistTrackletY->Reset();
224 fHistTrackletDy->Reset();
225 fHistTrackletZ->Reset();
226 fHistTrackletPID->Reset();
227 fHistTrackletYDy->Reset();
228 fHistTrackletHC->Reset();
229 fHistTrackletBadY->Reset();
230 fHistTrackletBadPID->Reset();
231 fHistFirstTrackletTime->Reset();
232 fHistLastTrackletTime->Reset();
233 fHistTmuTime->Reset();
234 fHistSmuTime->Reset();
235 fHistTrackPt->Reset();
236 fHistTrackPID->Reset();
237 fHistTrackStack->Reset();
238 fHistTrackletsTrack->Reset();
239 fHistTrackletsTrackHpt->Reset();
240 fHistTriggerContribs->Reset();
242 // loop over TObject-based input data
243 for (const TObject* obj =
244 GetFirstInputObject(kAliHLTDataTypeTObject | kAliHLTDataOriginTRD, "TObjArray");
245 obj!=NULL && iResult>=0;
246 obj=GetNextInputObject()) {
247 // extract DDL id from specification
249 AliHLTUInt32_t specification = GetSpecification(obj);
250 for (unsigned pos=0; pos<8*sizeof(AliHLTUInt32_t); pos++) {
251 if (specification & (0x1<<pos)) {
253 HLTWarning("Can not uniquely identify DDL number from specification, skipping data block %s 0x%08x",
254 DataType2Text(GetDataType(obj)).c_str(),
262 if (ddlnum<0 || ddlnum >= TRDMODULES) continue;
264 // input object is a TObjArray containing the actual data containers
265 const TObjArray* histArray = dynamic_cast<const TObjArray*>(obj);
267 HLTWarning("Received object was not a TObjAarray");
271 // extract data containers and process the data
273 TH1I *hist1 = (TH1I*)histArray->FindObject("hist_tracklets_y");
275 fHistTrackletY->Add(hist1);
277 HLTWarning("Tracklet y-position histogram not found!");
279 hist1 = (TH1I*)histArray->FindObject("hist_tracklets_dy");
281 fHistTrackletDy->Add(hist1);
283 HLTWarning("Tracklet deflection histogram not found!");
285 hist1 = (TH1I*)histArray->FindObject("hist_tracklets_z");
287 fHistTrackletZ->Add(hist1);
289 HLTWarning("Tracklet z-position histogram not found!");
291 hist1 = (TH1I*)histArray->FindObject("hist_tracklets_pid");
293 fHistTrackletPID->Add(hist1);
295 HLTWarning("Tracklet PID histogram not found!");
297 TH2I *hist2 = (TH2I*)histArray->FindObject("hist_tracklets_y_dy");
299 fHistTrackletYDy->Add(hist2);
301 HLTWarning("Tracklet y vs. dy histogram not found!");
303 hist2 = (TH2I*)histArray->FindObject("hist_tracklets_hc");
305 fHistTrackletHC->Add(hist2);
307 HLTWarning("Tracklet number histogram not found!");
309 hist2 = (TH2I*)histArray->FindObject("hist_tracklets_bad_y");
311 fHistTrackletBadY->Add(hist2);
313 HLTWarning("Tracklet number with bad y-position histogram not found!");
315 hist2 = (TH2I*)histArray->FindObject("hist_tracklets_bad_pid");
317 fHistTrackletBadPID->Add(hist2);
319 HLTWarning("Tracklet number with bad y-position histogram not found!");
321 TH1F *hist3 = (TH1F*)histArray->FindObject("hist_first_tracklet_time");
323 fHistFirstTrackletTime->Add(hist3);
325 HLTWarning("First tracklet arrival histogram not found!");
327 hist3 = (TH1F*)histArray->FindObject("hist_last_tracklet_time");
329 fHistLastTrackletTime->Add(hist3);
331 HLTWarning("Last tracklet arrival time histogram not found!");
333 hist3 = (TH1F*)histArray->FindObject("hist_tmu_time");
335 fHistTmuTime->Add(hist3);
337 HLTWarning("TMU-level tracking done time histogram not found!");
339 hist3 = (TH1F*)histArray->FindObject("hist_smu_time");
341 fHistSmuTime->Add(hist3);
343 HLTWarning("SMU-level tracking done time histogram not found!");
345 hist3 = (TH1F*)histArray->FindObject("hist_tracks_pt");
347 fHistTrackPt->Add(hist3);
349 HLTWarning("Track pt histogram not found!");
351 hist1 = (TH1I*)histArray->FindObject("hist_tracks_pid");
353 fHistTrackPID->Add(hist1);
355 HLTWarning("Tracklet PID histogram not found!");
357 hist2 = (TH2I*)histArray->FindObject("hist_tracks_stack");
359 fHistTrackStack->Add(hist2);
361 HLTWarning("Track number histogram not found!");
363 hist1 = (TH1I*)histArray->FindObject("hist_tracklets_track");
365 fHistTrackletsTrack->Add(hist1);
367 HLTWarning("Tracklets per GTU track histogram not found!");
369 hist1 = (TH1I*)histArray->FindObject("hist_tracklets_track_hpt");
371 fHistTrackletsTrackHpt->Add(hist1);
373 HLTWarning("Tracklets per high-pt GTU track histogram not found!");
375 hist2 = (TH2I*)histArray->FindObject("hist_trigger_contribs");
377 fHistTriggerContribs->Add(hist2);
379 HLTWarning("Trigger contribution histogram not found!");
383 iResult = PushBack(fHistArray,
384 (kAliHLTDataTypeTObjArray | kAliHLTDataOriginTRD),
385 //Specification: all 18 bits (links) set
386 (0xFFFFFFFF >> (32 - TRDMODULES) )
392 int AliHLTTRDGlobalMonitorComponent::Configure(const char* arguments)
394 // see header file for class documentation
400 int AliHLTTRDGlobalMonitorComponent::Reconfigure(const char* cdbEntry, const char* /*chainId*/)
402 // see header file for class documentation