2 // $Id: AliHLTTriggerMonitoringComponent.cxx 24328 2008-03-06 13:26:00Z richterm $
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 AliHLTTriggerMonitoringComponent.cxx
20 @author Jochen Thaeder
22 @brief Produces a event summary as @see AliHLTEventSummary
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 "AliHLTTriggerMonitoringComponent.h"
36 #include "AliHLTTPCEventStatistics.h"
37 #include "AliHLTEventStatistics.h"
40 // ** This is a global object used for automatic component registration, do not use this
41 AliHLTTriggerMonitoringComponent gAliHLTTriggerMonitoringComponent;
43 ClassImp(AliHLTTriggerMonitoringComponent)
46 * ---------------------------------------------------------------------------------
47 * Constructor / Destructor
48 * ---------------------------------------------------------------------------------
51 // ------------------------------------------------------------------------------------------
52 AliHLTTriggerMonitoringComponent::AliHLTTriggerMonitoringComponent() :
56 // see header file for class documentation
58 // refer to README to build package
60 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
63 // ------------------------------------------------------------------------------------------
64 AliHLTTriggerMonitoringComponent::~AliHLTTriggerMonitoringComponent() {
65 // see header file for class documentation
69 * ---------------------------------------------------------------------------------
70 * Public functions to implement AliHLTComponent's interface.
71 * These functions are required for the registration process
72 * ---------------------------------------------------------------------------------
75 // ------------------------------------------------------------------------------------------
76 const char* AliHLTTriggerMonitoringComponent::GetComponentID() {
77 // see header file for class documentation
78 return "TriggerMonitoring";
81 // ------------------------------------------------------------------------------------------
82 void AliHLTTriggerMonitoringComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list) {
83 // see header file for class documentation
86 list.push_back( kAliHLTDataTypeEventSummary );
89 // ------------------------------------------------------------------------------------------
90 AliHLTComponentDataType AliHLTTriggerMonitoringComponent::GetOutputDataType() {
91 // see header file for class documentation
93 return kAliHLTDataTypeEventSummary;
96 // ------------------------------------------------------------------------------------------
97 void AliHLTTriggerMonitoringComponent::GetOutputDataSize( unsigned long& constBase,
98 double& inputMultiplier ) {
99 // see header file for class documentation
101 constBase = sizeof( AliHLTEventSummary );
102 inputMultiplier = 0.0;
105 // ------------------------------------------------------------------------------------------
106 AliHLTComponent* AliHLTTriggerMonitoringComponent::Spawn() {
107 // Spawn function, return new instance of this class
108 // see header file for class documentation
110 return new AliHLTTriggerMonitoringComponent;
114 // ------------------------------------------------------------------------------------------
115 Int_t AliHLTTriggerMonitoringComponent::DoInit( int argc, const char** argv ) {
116 // see header file for class documentation
120 // ** Argument handling
122 TString argument = "";
123 TString parameter = "";
124 Int_t bMissingParam=0;
126 for ( Int_t ii=0; ii<argc && iResult>=0; ii++ ) {
130 if ( argument.IsNull() ) continue;
132 // -triggerTotalTracks
133 if ( ! argument.CompareTo("-triggerTotalTracks") ) {
135 if ( ( bMissingParam=( ++ii >= argc ) ) ) break;
136 parameter = argv[ii];
137 parameter.Remove( TString::kLeading, ' ' );
139 if (parameter.IsDigit() ) {
140 fTotalTrackCut = (Int_t) parameter.Atoi();
141 HLTInfo( "Trigger on total number of tracks is activated, and threshold is set to %d.", fTotalTrackCut );
144 HLTError( "Cannot convert triggerTotalTracks specifier '%s'.", parameter.Data() );
149 } // if ( ! argument.CompareTo("-triggerTotalTracks") ) {
151 // -triggerLongTracks
152 else if ( ! argument.CompareTo("-triggerLongTracks") ) {
154 if ( ( bMissingParam=( ++ii >= argc ) ) ) break;
155 parameter = argv[ii];
156 parameter.Remove( TString::kLeading, ' ' );
158 if (parameter.IsDigit() ) {
159 fLongTrackCut = (Int_t) parameter.Atoi();
160 HLTInfo( "Trigger on number of long tracks is activated, and threshold is set to %d.", fTotalTrackCut );
163 HLTError( "Cannot convert triggerLongTracks specifier '%s'.", parameter.Data() );
167 } // if ( ! argument.CompareTo("-triggerLongTracks") ) {
168 // - unknow parameter
171 HLTError("Unknown argument '%s'", argument.Data() );
174 } // for ( Int_t ii=0; ii<argc && iResult>=0; ii++ ) {
176 if ( bMissingParam ) {
177 HLTError( "Missing parameter for argument '%s'.", argument.Data() );
184 // ------------------------------------------------------------------------------------------
185 Int_t AliHLTTriggerMonitoringComponent::DoDeinit() {
186 // see header file for class documentation
189 delete fEventSummary;
190 fEventSummary = NULL;
195 // ------------------------------------------------------------------------------------------
196 Int_t AliHLTTriggerMonitoringComponent::DoEvent( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ ) {
197 // see header file for class documentation
199 if(GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR ))
202 const TObject* iter = NULL;
203 iter = GetFirstInputObject(kAliHLTDataTypeEventSummary|kAliHLTDataOriginAny);
205 fEventSummary = (AliHLTEventSummary*) iter;
207 // Trigger on eventSummary
210 if (fEventSummary->IsAccepted()) {
211 HLTWarning( "Triggered" );
213 HLTWarning( "Discarded" );
216 HLTWarning( "RunNumber %d ", GetRunNo() );
218 // ** PushBack Event Summary
219 PushBack ( (TObject*) fEventSummary, sizeof(AliHLTEventSummary), kAliHLTDataTypeEventSummary, (AliHLTUInt32_t) 0 );
224 // -- **********************************************************************************************
225 // -- ******************************* Processing Functions **************************************
226 // -- **********************************************************************************************
228 // -- **********************************************************************************************
229 void AliHLTTriggerMonitoringComponent::Trigger() {
230 // see header file for class documentation
232 TObjArray* detArray = fEventSummary->GetDetectorArray();
234 for ( Int_t iter = 0; iter <= detArray->GetLast(); iter++ ) {
236 AliHLTEventStatistics* evStat = (AliHLTEventStatistics*) (*detArray)[iter];
237 TString detName = evStat->GetDetectorName();
239 if ( detName.CompareTo("TPC") )
242 HLTWarning("TPC statistics found...");
244 AliHLTTPCEventStatistics* tpcStat = (AliHLTTPCEventStatistics*) (*detArray)[iter];
246 if ( fLongTrackCut != -1 && tpcStat->GetNTracksAboveClusterThreshold() < fLongTrackCut ) {
247 fEventSummary->RejectEvent();
251 if ( fTotalTrackCut != -1 && tpcStat->GetNTotalTracks() < fTotalTrackCut ) {
252 fEventSummary->RejectEvent();
256 } // for ( Int_t iter = 0; iter <= detArray->GetLast(); iter++ ) {