1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 ///////////////////////////////////////////////////////////////////////////////
18 // This class which defines the trigger interaction objects
21 ///////////////////////////////////////////////////////////////////////////////
23 #include <Riostream.h>
24 #include <TObjArray.h>
25 #include <TObjString.h>
27 #include "AliTriggerInteraction.h"
28 #include "AliTriggerInput.h"
29 #include "AliExpression.h"
34 ClassImp(AliTriggerInteraction)
36 //_____________________________________________________________________________
37 AliTriggerInteraction::AliTriggerInteraction():
40 // Default constructor
43 //_____________________________________________________________________________
44 AliTriggerInteraction::AliTriggerInteraction( TString & name, TString &logic ):
49 //_____________________________________________________________________________
50 AliTriggerInteraction::~AliTriggerInteraction()
54 //_____________________________________________________________________________
55 AliTriggerInteraction::AliTriggerInteraction( const AliTriggerInteraction& interact ):
61 //______________________________________________________________________________
62 AliTriggerInteraction& AliTriggerInteraction::operator=(const AliTriggerInteraction& interact)
64 // AliTriggerInteraction assignment operator.
66 if (this != &interact) {
67 TNamed::operator=(interact);
72 //_____________________________________________________________________________
73 Bool_t AliTriggerInteraction::CheckInputs(const TObjArray &inputs) const
75 // Check the existance of trigger inputs
76 // and the logic used.
77 // Return false in case of wrong interaction
80 TString logic( GetTitle() );
81 TObjArray* tokens = logic.Tokenize(" !&|()\t");
83 Int_t ntokens = tokens->GetEntriesFast();
84 for( Int_t i=0; i<ntokens; i++ ) {
85 TObjString* iname = (TObjString*)tokens->At( i );
87 AliTriggerInput *inp = (AliTriggerInput*)inputs.FindObject(iname->String().Data());
89 AliError( Form( "The trigger input (%s) is not available for Interaction (%s)",
90 iname->String().Data(), GetName() ) );
94 if (inp->GetMask() == 0 || inp->GetMask() > (1<<24)) { // New l0f can use all inputs
95 AliError( Form( "The trigger input (%s) is not among the first 4 trigger inputs used to create interactions. Interaction (%s) is invalid",
96 iname->String().Data(), GetName() ) );
106 //_____________________________________________________________________________
107 Bool_t AliTriggerInteraction::IsActive(const TObjArray &inputs) const
109 // Check if the trigger inputs
111 // Return false in one or more inputs
114 TString logic( GetTitle() );
115 TObjArray* tokens = logic.Tokenize(" !&|()\t");
117 Int_t ntokens = tokens->GetEntriesFast();
118 for( Int_t i=0; i<ntokens; i++ ) {
119 TObjString* iname = (TObjString*)tokens->At( i );
121 AliTriggerInput *inp = (AliTriggerInput *)inputs.FindObject(iname->String());
123 AliError( Form( "The trigger input (%s) is not available for Interaction (%s)",
124 iname->String().Data(), GetName() ) );
129 if (!inp->IsActive()) {
130 AliWarning(Form("The interaction/function (%s) will be disabled, because the input (%s) is disabled",
131 GetName(),iname->String().Data()));
142 //_____________________________________________________________________________
143 Bool_t AliTriggerInteraction::Trigger(const TObjArray& inputs ) const
145 // Check if the inputs satify the interaction expression condition
146 AliExpression* exp = new AliExpression( GetTitle() );
147 Bool_t status = exp->Value( inputs );
152 //_____________________________________________________________________________
153 void AliTriggerInteraction::Print( const Option_t* ) const
156 cout << "Trigger Interaction:" << endl;
157 cout << " Name: " << GetName() << endl;
158 cout << " Logic: " << GetTitle() << endl;