3 /**************************************************************************
4 * This file is property of and copyright by the ALICE HLT Project *
5 * ALICE Experiment at CERN, All rights reserved. *
7 * Primary Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de> *
8 * for The ALICE HLT Project. *
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 **************************************************************************/
19 /** @file AliHLTRunSummaryProducerComponent.cxx
20 @author Jochen Thaeder
22 @brief Produces a run summary as @see AliHLTRunSummary
25 // see header file for class documentation
27 // refer to README to build package
29 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
35 #include "AliHLTRunSummaryProducerComponent.h"
36 #include "AliHLTEventSummary.h"
37 #include "AliHLTDataTypes.h"
41 // ** This is a global object used for automatic component registration, do not use this
42 AliHLTRunSummaryProducerComponent gAliHLTRunSummaryProducerComponent;
44 ClassImp(AliHLTRunSummaryProducerComponent)
46 // ------------------------------------------------------------------------------------------
47 AliHLTRunSummaryProducerComponent::AliHLTRunSummaryProducerComponent() :
49 // see header file for class documentation
51 // refer to README to build package
53 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
56 // ------------------------------------------------------------------------------------------
57 AliHLTRunSummaryProducerComponent::~AliHLTRunSummaryProducerComponent() {
58 // see header file for class documentation
61 // ------------------------------------------------------------------------------------------
62 const char* AliHLTRunSummaryProducerComponent::GetComponentID() {
63 // see header file for class documentation
64 return "TriggerRunSummaryProducer";
67 // ------------------------------------------------------------------------------------------
68 void AliHLTRunSummaryProducerComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list) {
69 // see header file for class documentationAliHLTRunSummary
72 list.push_back( kAliHLTDataTypeEventSummary );
73 list.push_back( kAliHLTDataTypeRunStatistics );
76 // ------------------------------------------------------------------------------------------
77 AliHLTComponentDataType AliHLTRunSummaryProducerComponent::GetOutputDataType() {
78 // see header file for class documentation
80 return kAliHLTDataTypeRunSummary;
83 // ------------------------------------------------------------------------------------------
84 void AliHLTRunSummaryProducerComponent::GetOutputDataSize( unsigned long& constBase,
85 double& inputMultiplier ) {
86 // see header file for class documentation
88 constBase = sizeof( AliHLTRunSummary );
89 inputMultiplier = 0.0;
92 // ------------------------------------------------------------------------------------------
93 AliHLTComponent* AliHLTRunSummaryProducerComponent::Spawn() {
94 // Spawn function, return new instance of this class
95 // see header file for class documentation
97 return new AliHLTRunSummaryProducerComponent;
101 // ------------------------------------------------------------------------------------------
102 Int_t AliHLTRunSummaryProducerComponent::DoInit( int /*argc*/, const char** /*argv*/ ) {
103 // see header file for class documentation
110 fRunSummary = new AliHLTRunSummary();
115 // ------------------------------------------------------------------------------------------
116 Int_t AliHLTRunSummaryProducerComponent::DoDeinit() {
117 // see header file for class documentation
126 // ------------------------------------------------------------------------------------------
127 Int_t AliHLTRunSummaryProducerComponent::DoEvent( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& trigData ) {
128 // see header file for class documentation
130 // ** Process EventSummary Block
131 AliHLTEventSummary* eventSummary = (AliHLTEventSummary*) GetFirstInputObject ( kAliHLTDataTypeEventSummary, "AliHLTEventSummary" );
134 ProcessEventSummary ( eventSummary );
136 // ** Increase Number of Events
137 fRunSummary->AddNEvents();
139 // ** Process CTP trigger information
140 ProcessTriggerData( trigData );
142 // ** Set RunType / Run Number
143 fRunSummary->SetRunNumber ( GetRunNo() );
144 fRunSummary->SetRunType ( GetRunType() );
146 // ** PushBack Run Summary
147 PushBack ( (TObject*) fRunSummary, sizeof(AliHLTRunSummary), kAliHLTDataTypeRunSummary, (AliHLTUInt32_t) 0 );
152 // -- **********************************************************************************************
153 // -- ******************************* Processing Functions **************************************
154 // -- **********************************************************************************************
156 // -- **********************************************************************************************
157 void AliHLTRunSummaryProducerComponent::ProcessEventSummary( AliHLTEventSummary* eventSummary ) {
158 // see header file for class documentation
160 // ** Check if event was accepted or rejected
161 if ( ! eventSummary->IsAccepted() )
162 fRunSummary->AddNEventsRejected();
165 // -- **********************************************************************************************
166 void AliHLTRunSummaryProducerComponent::ProcessTriggerData( AliHLTComponentTriggerData& trigData ) {
167 // see header file for class documentation
169 AliHLTEventTriggerData* trg = ( AliHLTEventTriggerData* ) trigData.fData;
171 AliHLTUInt64_t triggerClasses = 0;
174 triggerClasses |= ( trg->fCommonHeader[6] & 0x3FFFF );
176 triggerClasses = triggerClasses << 32;
179 triggerClasses |= trg->fCommonHeader[5] ;
181 for ( Int_t ndx = 0; ndx < gkNCTPTriggerClasses; ndx ++ ) {
183 if ( triggerClasses & 0x1 )
184 fRunSummary->AddTriggerClass( ndx );
186 triggerClasses = triggerClasses >> 1;