]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/trigger/AliHLTEventSummaryProducerComponent.cxx
Moving GUID calculation to base class and setting unique ID of global decisions to...
[u/mrichter/AliRoot.git] / HLT / trigger / AliHLTEventSummaryProducerComponent.cxx
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
32 using namespace std;
33 #endif
34
35 #include "AliHLTEventSummaryProducerComponent.h"
36 #include "AliHLTTPCEventStatistics.h"
37 #include "AliRawDataHeader.h"
38
39 #include <cerrno>
40
41 // ** This is a global object used for automatic component registration, do not use this
42 AliHLTEventSummaryProducerComponent gAliHLTEventSummaryProducerComponent;
43
44 ClassImp(AliHLTEventSummaryProducerComponent)
45     
46 // ------------------------------------------------------------------------------------------
47 AliHLTEventSummaryProducerComponent::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 // ------------------------------------------------------------------------------------------
57 AliHLTEventSummaryProducerComponent::~AliHLTEventSummaryProducerComponent() {
58   // see header file for class documentation
59 }
60
61 // ------------------------------------------------------------------------------------------
62 const char* AliHLTEventSummaryProducerComponent::GetComponentID() {
63   // see header file for class documentation
64   return "TriggerEventSummaryProducer"; 
65 }
66
67 // ------------------------------------------------------------------------------------------
68 void AliHLTEventSummaryProducerComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list) {
69   // see header file for class documentation
70
71   list.clear(); 
72   list.push_back( kAliHLTDataTypeEventStatistics );
73 }
74
75 // ------------------------------------------------------------------------------------------
76 AliHLTComponentDataType AliHLTEventSummaryProducerComponent::GetOutputDataType() {
77   // see header file for class documentation
78
79   return kAliHLTDataTypeEventSummary;
80 }
81
82 // ------------------------------------------------------------------------------------------
83 void 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 // ------------------------------------------------------------------------------------------
92 AliHLTComponent* 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 // ------------------------------------------------------------------------------------------
101 Int_t AliHLTEventSummaryProducerComponent::DoInit( int /*argc*/, const char** /*argv*/ ) {
102   // see header file for class documentation
103
104   Int_t iResult = 0;
105  
106   return iResult;
107 }
108
109 // ------------------------------------------------------------------------------------------
110 Int_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 // ------------------------------------------------------------------------------------------
121 Int_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 // -- **********************************************************************************************
156 void AliHLTEventSummaryProducerComponent::ProcessTriggerData( AliHLTComponentTriggerData& trigData ) {
157   // see header file for class documentation
158   
159   const AliRawDataHeader* cdh = NULL;
160   if (AliHLTComponent::ExtractTriggerData(trigData, NULL, NULL, &cdh, NULL, true) != 0) return;
161   AliHLTUInt64_t triggerClass = cdh->GetTriggerClasses();
162   fEventSummary->SetTriggerClass( triggerClass );
163 }