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"
38 #include "AliRawDataHeader.h"
42 // ** This is a global object used for automatic component registration, do not use this
43 AliHLTRunSummaryProducerComponent gAliHLTRunSummaryProducerComponent;
45 ClassImp(AliHLTRunSummaryProducerComponent)
47 // ------------------------------------------------------------------------------------------
48 AliHLTRunSummaryProducerComponent::AliHLTRunSummaryProducerComponent() :
50 // see header file for class documentation
52 // refer to README to build package
54 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
57 // ------------------------------------------------------------------------------------------
58 AliHLTRunSummaryProducerComponent::~AliHLTRunSummaryProducerComponent() {
59 // see header file for class documentation
62 // ------------------------------------------------------------------------------------------
63 const char* AliHLTRunSummaryProducerComponent::GetComponentID() {
64 // see header file for class documentation
65 return "TriggerRunSummaryProducer";
68 // ------------------------------------------------------------------------------------------
69 void AliHLTRunSummaryProducerComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list) {
70 // see header file for class documentationAliHLTRunSummary
73 list.push_back( kAliHLTDataTypeEventSummary );
74 list.push_back( kAliHLTDataTypeRunStatistics );
77 // ------------------------------------------------------------------------------------------
78 AliHLTComponentDataType AliHLTRunSummaryProducerComponent::GetOutputDataType() {
79 // see header file for class documentation
81 return kAliHLTDataTypeRunSummary;
84 // ------------------------------------------------------------------------------------------
85 void AliHLTRunSummaryProducerComponent::GetOutputDataSize( unsigned long& constBase,
86 double& inputMultiplier ) {
87 // see header file for class documentation
89 constBase = sizeof( AliHLTRunSummary );
90 inputMultiplier = 0.0;
93 // ------------------------------------------------------------------------------------------
94 AliHLTComponent* AliHLTRunSummaryProducerComponent::Spawn() {
95 // Spawn function, return new instance of this class
96 // see header file for class documentation
98 return new AliHLTRunSummaryProducerComponent;
102 // ------------------------------------------------------------------------------------------
103 Int_t AliHLTRunSummaryProducerComponent::DoInit( int /*argc*/, const char** /*argv*/ ) {
104 // see header file for class documentation
111 fRunSummary = new AliHLTRunSummary();
116 // ------------------------------------------------------------------------------------------
117 Int_t AliHLTRunSummaryProducerComponent::DoDeinit() {
118 // see header file for class documentation
127 // ------------------------------------------------------------------------------------------
128 Int_t AliHLTRunSummaryProducerComponent::DoEvent( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& trigData ) {
129 // see header file for class documentation
131 // ** Process EventSummary Block
132 AliHLTEventSummary* eventSummary = (AliHLTEventSummary*) GetFirstInputObject ( kAliHLTDataTypeEventSummary, "AliHLTEventSummary" );
135 ProcessEventSummary ( eventSummary );
137 // ** Increase Number of Events
138 fRunSummary->AddNEvents();
140 // ** Process CTP trigger information
141 ProcessTriggerData( trigData );
143 // ** Set RunType / Run Number
144 fRunSummary->SetRunNumber ( GetRunNo() );
145 fRunSummary->SetRunType ( GetRunType() );
147 // ** PushBack Run Summary
148 PushBack ( (TObject*) fRunSummary, sizeof(AliHLTRunSummary), kAliHLTDataTypeRunSummary, (AliHLTUInt32_t) 0 );
153 // -- **********************************************************************************************
154 // -- ******************************* Processing Functions **************************************
155 // -- **********************************************************************************************
157 // -- **********************************************************************************************
158 void AliHLTRunSummaryProducerComponent::ProcessEventSummary( AliHLTEventSummary* eventSummary ) {
159 // see header file for class documentation
161 // ** Check if event was accepted or rejected
162 if ( ! eventSummary->IsAccepted() )
163 fRunSummary->AddNEventsRejected();
166 // -- **********************************************************************************************
167 void AliHLTRunSummaryProducerComponent::ProcessTriggerData( AliHLTComponentTriggerData& trigData ) {
168 // see header file for class documentation
170 const AliRawDataHeader* cdh = NULL;
171 if (AliHLTComponent::ExtractTriggerData(trigData, NULL, NULL, &cdh, NULL, true) != 0) return;
172 AliHLTUInt64_t triggerClasses = cdh->GetTriggerClasses();
174 for ( Int_t ndx = 0; ndx < gkNCTPTriggerClasses; ndx ++ ) {
176 if ( triggerClasses & 0x1 )
177 fRunSummary->AddTriggerClass( ndx );
179 triggerClasses = triggerClasses >> 1;