]>
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 | ||
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 | ||
38 | #include <cerrno> | |
39 | ||
40 | // ** This is a global object used for automatic component registration, do not use this | |
41 | AliHLTEventSummaryProducerComponent gAliHLTEventSummaryProducerComponent; | |
42 | ||
43 | ClassImp(AliHLTEventSummaryProducerComponent) | |
44 | ||
45 | // ------------------------------------------------------------------------------------------ | |
46 | AliHLTEventSummaryProducerComponent::AliHLTEventSummaryProducerComponent() : | |
47 | fEventSummary(NULL) { | |
48 | // see header file for class documentation | |
49 | // or | |
50 | // refer to README to build package | |
51 | // or | |
52 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
53 | } | |
54 | ||
55 | // ------------------------------------------------------------------------------------------ | |
56 | AliHLTEventSummaryProducerComponent::~AliHLTEventSummaryProducerComponent() { | |
57 | // see header file for class documentation | |
58 | } | |
59 | ||
60 | // ------------------------------------------------------------------------------------------ | |
61 | const char* AliHLTEventSummaryProducerComponent::GetComponentID() { | |
62 | // see header file for class documentation | |
63 | return "TriggerEventSummaryProducer"; | |
64 | } | |
65 | ||
66 | // ------------------------------------------------------------------------------------------ | |
67 | void AliHLTEventSummaryProducerComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list) { | |
68 | // see header file for class documentation | |
69 | ||
70 | list.clear(); | |
71 | list.push_back( kAliHLTDataTypeEventStatistics ); | |
72 | } | |
73 | ||
74 | // ------------------------------------------------------------------------------------------ | |
75 | AliHLTComponentDataType AliHLTEventSummaryProducerComponent::GetOutputDataType() { | |
76 | // see header file for class documentation | |
77 | ||
78 | return kAliHLTDataTypeEventSummary; | |
79 | } | |
80 | ||
81 | // ------------------------------------------------------------------------------------------ | |
82 | void AliHLTEventSummaryProducerComponent::GetOutputDataSize( unsigned long& constBase, | |
83 | double& inputMultiplier ) { | |
84 | // see header file for class documentation | |
85 | ||
86 | constBase = sizeof( AliHLTEventSummary ); | |
87 | inputMultiplier = 0.0; | |
88 | } | |
89 | ||
90 | // ------------------------------------------------------------------------------------------ | |
91 | AliHLTComponent* AliHLTEventSummaryProducerComponent::Spawn() { | |
92 | // Spawn function, return new instance of this class | |
93 | // see header file for class documentation | |
94 | ||
95 | return new AliHLTEventSummaryProducerComponent; | |
96 | } | |
97 | ||
98 | ||
99 | // ------------------------------------------------------------------------------------------ | |
2b4385d9 | 100 | Int_t AliHLTEventSummaryProducerComponent::DoInit( int /*argc*/, const char** /*argv*/ ) { |
2ff24e4c | 101 | // see header file for class documentation |
102 | ||
103 | Int_t iResult = 0; | |
104 | ||
105 | return iResult; | |
106 | } | |
107 | ||
108 | // ------------------------------------------------------------------------------------------ | |
109 | Int_t AliHLTEventSummaryProducerComponent::DoDeinit() { | |
110 | // see header file for class documentation | |
111 | ||
112 | if ( fEventSummary ) | |
113 | delete fEventSummary; | |
114 | fEventSummary = NULL; | |
115 | ||
116 | return 0; | |
117 | } | |
118 | ||
119 | // ------------------------------------------------------------------------------------------ | |
120 | Int_t AliHLTEventSummaryProducerComponent::DoEvent( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& trigData ) { | |
121 | // see header file for class documentation | |
122 | ||
123 | if ( fEventSummary ) | |
124 | delete fEventSummary; | |
125 | ||
126 | fEventSummary = new AliHLTEventSummary; | |
127 | ||
128 | const TObject* iter = NULL; | |
129 | ||
130 | // ** Loop over all event statistics input objs and add them to the event summary | |
131 | for ( iter = GetFirstInputObject(kAliHLTDataTypeEventStatistics|kAliHLTDataOriginAny); iter != NULL; iter = GetNextInputObject() ) { | |
132 | ||
133 | fEventSummary->AddDetector( (TObject*) iter ); | |
134 | ||
135 | } // for ( iter = GetFirstInputObject(kAliHLTDataTypeEventEventStatistics|kAliHLTDataOriginAny); iter != NULL; iter = GetNextInputObject() ) { | |
136 | ||
137 | // ** Process CTP trigger information | |
138 | ProcessTriggerData( trigData ); | |
139 | ||
140 | // ** Set RunType / Run Number | |
141 | fEventSummary->SetRunNumber ( GetRunNo() ); | |
142 | fEventSummary->SetRunType ( GetRunType() ); | |
143 | ||
144 | // ** PushBack Event Summary | |
145 | PushBack ( (TObject*) fEventSummary, sizeof(AliHLTEventSummary), kAliHLTDataTypeEventSummary, (AliHLTUInt32_t) 0 ); | |
146 | ||
147 | return 0; | |
148 | } | |
149 | ||
150 | // -- ********************************************************************************************** | |
151 | // -- ******************************* Processing Functions ************************************** | |
152 | // -- ********************************************************************************************** | |
153 | ||
154 | // -- ********************************************************************************************** | |
155 | void AliHLTEventSummaryProducerComponent::ProcessTriggerData( AliHLTComponentTriggerData& trigData ) { | |
156 | // see header file for class documentation | |
157 | ||
158 | AliHLTEventTriggerData* trg = ( AliHLTEventTriggerData* ) trigData.fData; | |
159 | ||
160 | AliHLTUInt64_t triggerClass = 0; | |
161 | ||
162 | // ** Higher bits | |
163 | triggerClass |= ( trg->fCommonHeader[6] & 0x3FFFF ); | |
164 | ||
165 | triggerClass = triggerClass << 32; | |
166 | ||
167 | // ** Lower bits | |
168 | triggerClass |= trg->fCommonHeader[5] ; | |
169 | ||
170 | fEventSummary->SetTriggerClass( triggerClass ); | |
171 | } |