Major update required to handle old and new AliHLTEventDDL structures within HLT...
[u/mrichter/AliRoot.git] / HLT / trigger / AliHLTEventSummaryProducerComponent.cxx
CommitLineData
2ff24e4c 1//-*- Mode: C++ -*-
2// $Id$
3/**************************************************************************
4 * This file is property of and copyright by the ALICE HLT Project *
5 * ALICE Experiment at CERN, All rights reserved. *
6 * *
7 * Primary Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de> *
8 * for The ALICE HLT Project. *
9 * *
10 * Permission to use, copy, modify and distribute this software and its *
11 * documentation strictly for non-commercial purposes is hereby granted *
12 * without fee, provided that the above copyright notice appears in all *
13 * copies and that both the copyright notice and this permission notice *
14 * appear in the supporting documentation. The authors make no claims *
15 * about the suitability of this software for any purpose. It is *
16 * provided "as is" without express or implied warranty. *
17 **************************************************************************/
18
19/** @file AliHLTEventSummaryProducerComponent.cxx
20 @author Jochen Thaeder
21 @date
22 @brief Produces a event summary as @see AliHLTEventSummary
23*/
24
25// see header file for class documentation
26// or
27// refer to README to build package
28// or
29// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
30
31#if __GNUC__ >= 3
32using namespace std;
33#endif
34
35#include "AliHLTEventSummaryProducerComponent.h"
36#include "AliHLTTPCEventStatistics.h"
89413559 37#include "AliRawDataHeader.h"
2ff24e4c 38
39#include <cerrno>
40
41// ** This is a global object used for automatic component registration, do not use this
42AliHLTEventSummaryProducerComponent gAliHLTEventSummaryProducerComponent;
43
44ClassImp(AliHLTEventSummaryProducerComponent)
45
46// ------------------------------------------------------------------------------------------
47AliHLTEventSummaryProducerComponent::AliHLTEventSummaryProducerComponent() :
48 fEventSummary(NULL) {
49 // see header file for class documentation
50 // or
51 // refer to README to build package
52 // or
53 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
54}
55
56// ------------------------------------------------------------------------------------------
57AliHLTEventSummaryProducerComponent::~AliHLTEventSummaryProducerComponent() {
58 // see header file for class documentation
59}
60
61// ------------------------------------------------------------------------------------------
62const char* AliHLTEventSummaryProducerComponent::GetComponentID() {
63 // see header file for class documentation
64 return "TriggerEventSummaryProducer";
65}
66
67// ------------------------------------------------------------------------------------------
68void AliHLTEventSummaryProducerComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list) {
69 // see header file for class documentation
70
71 list.clear();
72 list.push_back( kAliHLTDataTypeEventStatistics );
73}
74
75// ------------------------------------------------------------------------------------------
76AliHLTComponentDataType AliHLTEventSummaryProducerComponent::GetOutputDataType() {
77 // see header file for class documentation
78
79 return kAliHLTDataTypeEventSummary;
80}
81
82// ------------------------------------------------------------------------------------------
83void AliHLTEventSummaryProducerComponent::GetOutputDataSize( unsigned long& constBase,
84 double& inputMultiplier ) {
85 // see header file for class documentation
86
87 constBase = sizeof( AliHLTEventSummary );
88 inputMultiplier = 0.0;
89}
90
91// ------------------------------------------------------------------------------------------
92AliHLTComponent* AliHLTEventSummaryProducerComponent::Spawn() {
93 // Spawn function, return new instance of this class
94 // see header file for class documentation
95
96 return new AliHLTEventSummaryProducerComponent;
97}
98
99
100// ------------------------------------------------------------------------------------------
2b4385d9 101Int_t AliHLTEventSummaryProducerComponent::DoInit( int /*argc*/, const char** /*argv*/ ) {
2ff24e4c 102 // see header file for class documentation
103
104 Int_t iResult = 0;
105
106 return iResult;
107}
108
109// ------------------------------------------------------------------------------------------
110Int_t AliHLTEventSummaryProducerComponent::DoDeinit() {
111 // see header file for class documentation
112
113 if ( fEventSummary )
114 delete fEventSummary;
115 fEventSummary = NULL;
116
117 return 0;
118}
119
120// ------------------------------------------------------------------------------------------
121Int_t AliHLTEventSummaryProducerComponent::DoEvent( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& trigData ) {
122 // see header file for class documentation
123
124 if ( fEventSummary )
125 delete fEventSummary;
126
127 fEventSummary = new AliHLTEventSummary;
128
129 const TObject* iter = NULL;
130
131 // ** Loop over all event statistics input objs and add them to the event summary
132 for ( iter = GetFirstInputObject(kAliHLTDataTypeEventStatistics|kAliHLTDataOriginAny); iter != NULL; iter = GetNextInputObject() ) {
133
134 fEventSummary->AddDetector( (TObject*) iter );
135
136 } // for ( iter = GetFirstInputObject(kAliHLTDataTypeEventEventStatistics|kAliHLTDataOriginAny); iter != NULL; iter = GetNextInputObject() ) {
137
138 // ** Process CTP trigger information
139 ProcessTriggerData( trigData );
140
141 // ** Set RunType / Run Number
142 fEventSummary->SetRunNumber ( GetRunNo() );
143 fEventSummary->SetRunType ( GetRunType() );
144
145 // ** PushBack Event Summary
146 PushBack ( (TObject*) fEventSummary, sizeof(AliHLTEventSummary), kAliHLTDataTypeEventSummary, (AliHLTUInt32_t) 0 );
147
148 return 0;
149}
150
151// -- **********************************************************************************************
152// -- ******************************* Processing Functions **************************************
153// -- **********************************************************************************************
154
155// -- **********************************************************************************************
156void AliHLTEventSummaryProducerComponent::ProcessTriggerData( AliHLTComponentTriggerData& trigData ) {
157 // see header file for class documentation
158
89413559 159 const AliRawDataHeader* cdh = NULL;
160 if (AliHLTComponent::ExtractTriggerData(trigData, NULL, NULL, &cdh, NULL, true) != 0) return;
161 AliHLTUInt64_t triggerClass = cdh->GetTriggerClasses();
2ff24e4c 162 fEventSummary->SetTriggerClass( triggerClass );
163}