]>
Commit | Line | Data |
---|---|---|
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 | ||
6291d256 | 19 | /** @file AliHLTRunSummaryProducerComponent.cxx |
2ff24e4c | 20 | @author Jochen Thaeder |
21 | @date | |
22 | @brief Produces a run summary as @see AliHLTRunSummary | |
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 "AliHLTRunSummaryProducerComponent.h" | |
36 | #include "AliHLTEventSummary.h" | |
37 | #include "AliHLTDataTypes.h" | |
38 | ||
39 | #include <cerrno> | |
40 | ||
41 | // ** This is a global object used for automatic component registration, do not use this | |
42 | AliHLTRunSummaryProducerComponent gAliHLTRunSummaryProducerComponent; | |
43 | ||
44 | ClassImp(AliHLTRunSummaryProducerComponent) | |
45 | ||
46 | // ------------------------------------------------------------------------------------------ | |
47 | AliHLTRunSummaryProducerComponent::AliHLTRunSummaryProducerComponent() : | |
48 | fRunSummary(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 | AliHLTRunSummaryProducerComponent::~AliHLTRunSummaryProducerComponent() { | |
58 | // see header file for class documentation | |
59 | } | |
60 | ||
61 | // ------------------------------------------------------------------------------------------ | |
62 | const char* AliHLTRunSummaryProducerComponent::GetComponentID() { | |
63 | // see header file for class documentation | |
64 | return "TriggerRunSummaryProducer"; | |
65 | } | |
66 | ||
67 | // ------------------------------------------------------------------------------------------ | |
68 | void AliHLTRunSummaryProducerComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list) { | |
69 | // see header file for class documentationAliHLTRunSummary | |
70 | ||
71 | list.clear(); | |
72 | list.push_back( kAliHLTDataTypeEventSummary ); | |
73 | list.push_back( kAliHLTDataTypeRunStatistics ); | |
74 | } | |
75 | ||
76 | // ------------------------------------------------------------------------------------------ | |
77 | AliHLTComponentDataType AliHLTRunSummaryProducerComponent::GetOutputDataType() { | |
78 | // see header file for class documentation | |
79 | ||
80 | return kAliHLTDataTypeRunSummary; | |
81 | } | |
82 | ||
83 | // ------------------------------------------------------------------------------------------ | |
84 | void AliHLTRunSummaryProducerComponent::GetOutputDataSize( unsigned long& constBase, | |
85 | double& inputMultiplier ) { | |
86 | // see header file for class documentation | |
87 | ||
88 | constBase = sizeof( AliHLTRunSummary ); | |
89 | inputMultiplier = 0.0; | |
90 | } | |
91 | ||
92 | // ------------------------------------------------------------------------------------------ | |
93 | AliHLTComponent* AliHLTRunSummaryProducerComponent::Spawn() { | |
94 | // Spawn function, return new instance of this class | |
95 | // see header file for class documentation | |
96 | ||
97 | return new AliHLTRunSummaryProducerComponent; | |
98 | } | |
99 | ||
100 | ||
101 | // ------------------------------------------------------------------------------------------ | |
2b4385d9 | 102 | Int_t AliHLTRunSummaryProducerComponent::DoInit( int /*argc*/, const char** /*argv*/ ) { |
2ff24e4c | 103 | // see header file for class documentation |
104 | ||
105 | Int_t iResult = 0; | |
106 | ||
107 | if ( fRunSummary ) | |
108 | return EINPROGRESS; | |
109 | ||
110 | fRunSummary = new AliHLTRunSummary(); | |
111 | ||
112 | return iResult; | |
113 | } | |
114 | ||
115 | // ------------------------------------------------------------------------------------------ | |
116 | Int_t AliHLTRunSummaryProducerComponent::DoDeinit() { | |
117 | // see header file for class documentation | |
118 | ||
119 | if ( fRunSummary ) | |
120 | delete fRunSummary; | |
121 | fRunSummary = NULL; | |
122 | ||
123 | return 0; | |
124 | } | |
125 | ||
126 | // ------------------------------------------------------------------------------------------ | |
127 | Int_t AliHLTRunSummaryProducerComponent::DoEvent( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& trigData ) { | |
128 | // see header file for class documentation | |
129 | ||
130 | // ** Process EventSummary Block | |
131 | AliHLTEventSummary* eventSummary = (AliHLTEventSummary*) GetFirstInputObject ( kAliHLTDataTypeEventSummary, "AliHLTEventSummary" ); | |
132 | ||
133 | if ( eventSummary ) | |
134 | ProcessEventSummary ( eventSummary ); | |
135 | ||
136 | // ** Increase Number of Events | |
137 | fRunSummary->AddNEvents(); | |
138 | ||
139 | // ** Process CTP trigger information | |
140 | ProcessTriggerData( trigData ); | |
141 | ||
142 | // ** Set RunType / Run Number | |
143 | fRunSummary->SetRunNumber ( GetRunNo() ); | |
144 | fRunSummary->SetRunType ( GetRunType() ); | |
145 | ||
146 | // ** PushBack Run Summary | |
147 | PushBack ( (TObject*) fRunSummary, sizeof(AliHLTRunSummary), kAliHLTDataTypeRunSummary, (AliHLTUInt32_t) 0 ); | |
148 | ||
149 | return 0; | |
150 | } | |
151 | ||
152 | // -- ********************************************************************************************** | |
153 | // -- ******************************* Processing Functions ************************************** | |
154 | // -- ********************************************************************************************** | |
155 | ||
156 | // -- ********************************************************************************************** | |
157 | void AliHLTRunSummaryProducerComponent::ProcessEventSummary( AliHLTEventSummary* eventSummary ) { | |
158 | // see header file for class documentation | |
159 | ||
160 | // ** Check if event was accepted or rejected | |
161 | if ( ! eventSummary->IsAccepted() ) | |
162 | fRunSummary->AddNEventsRejected(); | |
163 | } | |
164 | ||
165 | // -- ********************************************************************************************** | |
166 | void AliHLTRunSummaryProducerComponent::ProcessTriggerData( AliHLTComponentTriggerData& trigData ) { | |
167 | // see header file for class documentation | |
168 | ||
169 | AliHLTEventTriggerData* trg = ( AliHLTEventTriggerData* ) trigData.fData; | |
170 | ||
171 | AliHLTUInt64_t triggerClasses = 0; | |
172 | ||
173 | // ** Higher bits | |
174 | triggerClasses |= ( trg->fCommonHeader[6] & 0x3FFFF ); | |
175 | ||
176 | triggerClasses = triggerClasses << 32; | |
177 | ||
178 | // ** Lower bits | |
179 | triggerClasses |= trg->fCommonHeader[5] ; | |
180 | ||
181 | for ( Int_t ndx = 0; ndx < gkNCTPTriggerClasses; ndx ++ ) { | |
182 | ||
183 | if ( triggerClasses & 0x1 ) | |
184 | fRunSummary->AddTriggerClass( ndx ); | |
185 | ||
5eefc803 | 186 | triggerClasses = triggerClasses >> 1; |
2ff24e4c | 187 | } |
188 | ||
189 | } | |
190 |