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 classes objects
21 ///////////////////////////////////////////////////////////////////////////////
22 #include <Riostream.h>
26 #include "AliTriggerClass.h"
27 #include "AliTriggerConfiguration.h"
28 #include "AliTriggerDescriptor.h"
29 #include "AliTriggerCluster.h"
30 #include "AliTriggerPFProtection.h"
31 #include "AliTriggerBCMask.h"
33 ClassImp(AliTriggerClass)
35 //_____________________________________________________________________________
36 AliTriggerClass::AliTriggerClass():
48 // Default constructor
51 //_____________________________________________________________________________
52 AliTriggerClass::AliTriggerClass( TString & name, UChar_t index,
53 AliTriggerDescriptor *desc, AliTriggerCluster *clus,
54 AliTriggerPFProtection *pfp, AliTriggerBCMask *mask,
55 UInt_t prescaler, Bool_t allrare) :
57 fClassMask( 1ull << ULong64_t(index-1)),
63 fPrescaler( prescaler ),
70 //_____________________________________________________________________________
71 AliTriggerClass::AliTriggerClass( AliTriggerConfiguration *config,
72 TString & name, UChar_t index,
73 TString &desc, TString &clus,
74 TString &pfp, TString &mask,
75 UInt_t prescaler, Bool_t allrare) :
77 fClassMask( 1ull << ULong64_t(index-1)),
81 fPFProtection( NULL ),
83 fPrescaler( prescaler ),
87 fDescriptor = (AliTriggerDescriptor*)config->GetDescriptors().FindObject(desc);
88 fCluster = (AliTriggerCluster*)config->GetClusters().FindObject(clus);
89 pfp.ReplaceAll("{","");
90 pfp.ReplaceAll("}","");
91 fPFProtection = (AliTriggerPFProtection*)config->GetPFProtections().FindObject(pfp);
92 mask.ReplaceAll("{","");
93 mask.ReplaceAll("}","");
94 fMask = (AliTriggerBCMask*)config->GetMasks().FindObject(mask);
97 //_____________________________________________________________________________
98 AliTriggerClass::~AliTriggerClass()
102 //_____________________________________________________________________________
103 AliTriggerClass::AliTriggerClass( const AliTriggerClass& trclass ):
105 fClassMask(trclass.fClassMask),
106 fIndex(trclass.fIndex),
107 fDescriptor(trclass.fDescriptor),
108 fCluster(trclass.fCluster),
109 fPFProtection(trclass.fPFProtection),
110 fMask(trclass.fMask),
111 fPrescaler(trclass.fPrescaler),
112 fAllRare(trclass.fAllRare),
113 fStatus(trclass.fStatus)
118 //______________________________________________________________________________
119 AliTriggerClass& AliTriggerClass::operator=(const AliTriggerClass& trclass)
121 // AliTriggerClass assignment operator.
123 if (this != &trclass) {
124 TNamed::operator=(trclass);
125 fClassMask = trclass.fClassMask;
126 fIndex=trclass.fIndex;
127 fDescriptor = trclass.fDescriptor;
128 fCluster = trclass.fCluster;
129 fPFProtection = trclass.fPFProtection;
130 fMask = trclass.fMask;
131 fPrescaler = trclass.fPrescaler;
132 fAllRare = trclass.fAllRare;
133 fStatus = trclass.fStatus;
138 //_____________________________________________________________________________
139 Bool_t AliTriggerClass::CheckClass(AliTriggerConfiguration* config) const
141 // Check the existance of trigger inputs and functions
142 // and the logic used.
143 // Return false in case of wrong class
147 AliError(Form("The class (%s) has invalid mask pattern !",GetName()));
151 // check comsistency of index and mask
153 if (!config->GetDescriptors().FindObject(fDescriptor)) {
154 AliError(Form("The class (%s) contains invalid descriptor !",GetName()));
158 if (!(fDescriptor->CheckInputsAndFunctions(config->GetInputs(),config->GetFunctions()))) {
159 AliError(Form("The class (%s) contains bad descriptor !",GetName()));
164 if (!config->GetClusters().FindObject(fCluster)) {
165 AliError(Form("The class (%s) contains invalid cluster !",GetName()));
169 if (!config->GetPFProtections().FindObject(fPFProtection)) {
170 AliError(Form("The class (%s) contains invalid past-future protection !",GetName()));
174 if (!config->GetMasks().FindObject(fMask)) {
175 AliError(Form("The class (%s) contains invalid BC mask !",GetName()));
182 //_____________________________________________________________________________
183 void AliTriggerClass::Trigger( const TObjArray& inputs , const TObjArray& functions)
185 // Check if the inputs satify the trigger class conditions
186 fStatus = fDescriptor->Trigger(inputs,functions);
189 //_____________________________________________________________________________
190 Bool_t AliTriggerClass::IsActive( const TObjArray& inputs, const TObjArray& functions) const
192 // Check if the inputs satify the trigger class conditions
194 return fDescriptor->IsActive(inputs,functions);
199 //_____________________________________________________________________________
200 void AliTriggerClass::Print( const Option_t* ) const
203 cout << "Trigger Class:" << endl;
204 cout << " Name: " << GetName() << endl;
205 cout << " ClassBit: 0x" << hex << fClassMask << dec << endl;
206 cout << " Index: " << (UInt_t)fIndex << endl;
207 cout << " Descriptor: " << fDescriptor->GetName() << endl;
208 cout << " Cluster: " << fCluster->GetName() << endl;
209 cout << " PF Protection:" << fPFProtection->GetName() << endl;
210 cout << " BC Mask: " << fMask->GetName() << endl;
211 cout << " Prescaler: " << fPrescaler << endl;
212 cout << " AllRare: " << fAllRare << endl;
214 cout << " Class is fired " << endl;
216 cout << " Class is not fired " << endl;