]>
Commit | Line | Data |
---|---|---|
51f6d619 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
17 | ||
18 | /////////////////////////////////////////////////////////////////////////////// | |
19 | // | |
20 | // Class to define a Trigger Past Future Protection | |
21 | // | |
22 | // name description INT1 INT2 | |
23 | // Ej: | |
24 | // AliTriggerPFProtection sc( "BARREL", "BARREL DET Pb-Pb", "SC","PE" ); | |
25 | // sc.SetINTa("PE"); // Peripheral | |
26 | // sc.SetINTb("SC"); // Semicentral | |
27 | // sc.SetINT("PE"); | |
28 | // sc.SetNa1( 5 ); | |
29 | // sc.SetNa2( 5 ); | |
30 | // sc.SetTa( 88 ); | |
31 | // sc.SetNb1( 1 ); | |
32 | // sc.SetNb2( 0 ); | |
33 | // sc.SetTb( 88 ); | |
34 | // | |
35 | /////////////////////////////////////////////////////////////////////////////// | |
36 | ||
37 | #include <Riostream.h> | |
38 | ||
39 | #include <TObject.h> | |
40 | #include <TString.h> | |
41 | #include <TObjString.h> | |
42 | ||
43 | #include "AliLog.h" | |
44 | #include "AliTriggerPFProtection.h" | |
45 | ||
66b0310c | 46 | using std::endl; |
47 | using std::cout; | |
48 | using std::hex; | |
49 | using std::dec; | |
51f6d619 | 50 | ClassImp( AliTriggerPFProtection ) |
b87d7e83 | 51 | //_____________________________________________________________________________ |
52 | AliTriggerPFProtection::AliTriggerPFProtection() : | |
53 | TNamed(), | |
54 | fINTa(), fINTb(),fINT(), | |
55 | fNa1(0),fNa2(0),fTa(0), | |
56 | fNb1(0),fNb2(0),fTb(0) | |
57 | { | |
417aea4a | 58 | for(Int_t i=0;i<12;i++)fPFdef[i]=0; |
b87d7e83 | 59 | } |
60 | AliTriggerPFProtection::AliTriggerPFProtection( TString & name) : | |
61 | TNamed(name, name), | |
62 | fINTa(), fINTb(),fINT(), | |
63 | fNa1(0),fNa2(0),fTa(0), | |
64 | fNb1(0),fNb2(0),fTb(0) | |
65 | { | |
417aea4a | 66 | for(Int_t i=0;i<12;i++)fPFdef[i]=0; |
b87d7e83 | 67 | } |
68 | AliTriggerPFProtection::AliTriggerPFProtection( TString & name,TString & inta, TString & intb, TString & interaction ) : | |
69 | TNamed(name, name), | |
70 | fINTa(inta), fINTb(intb),fINT(interaction), | |
71 | fNa1(0),fNa2(0),fTa(0), | |
72 | fNb1(0),fNb2(0),fTb(0) | |
73 | { | |
417aea4a | 74 | for(Int_t i=0;i<12;i++)fPFdef[i]=0; |
b87d7e83 | 75 | } |
417aea4a | 76 | AliTriggerPFProtection::AliTriggerPFProtection(TString& name,UInt_t* pfdef) |
b87d7e83 | 77 | :TNamed(name,name), |
78 | fINTa(), fINTb(),fINT(), | |
79 | fNa1(0),fNa2(0),fTa(0), | |
80 | fNb1(0),fNb2(0),fTb(0) | |
81 | { | |
417aea4a | 82 | for(Int_t i=0;i<12;i++)fPFdef[i]=pfdef[i]; |
b87d7e83 | 83 | } |
51f6d619 | 84 | //_____________________________________________________________________________ |
85 | void AliTriggerPFProtection::Print( const Option_t* ) const | |
86 | { | |
87 | ||
88 | cout << "Trigger Past-Future Protection: " << endl; | |
89 | cout << " Name: " << GetName() << endl; | |
90 | cout << " Interaction_a: " << fINTa.Data() << endl; | |
91 | cout << " Interaction_b: " << fINTb.Data() << endl; | |
92 | cout << " Interaction: " << fINT.Data() << endl; | |
93 | cout << " Na1: " << fNa1 << " Na2: " << fNa2 << " Ta: " << fTa << endl; | |
94 | cout << " Nb1: " << fNb1 << " Nb2: " << fNb2 << " Tb: " << fTb << endl; | |
9c5d274f | 95 | cout << "PFdef: " << hex; |
96 | for(Int_t i=0;i<12;i++)cout << " 0x" << fPFdef[i]; | |
97 | cout << dec << endl; | |
51f6d619 | 98 | } |
99 | ||
100 | //_____________________________________________________________________________ | |
101 | Bool_t AliTriggerPFProtection::CheckInteractions(TObjArray &interactions) const | |
102 | { | |
103 | // Check if the interactions are valid | |
104 | { | |
105 | TString logic( GetINTa() ); | |
106 | TObjArray* tokens = logic.Tokenize(" !&|()\t"); | |
107 | ||
108 | Int_t ntokens = tokens->GetEntriesFast(); | |
109 | for( Int_t i=0; i<ntokens; i++ ) { | |
110 | TObjString* iname = (TObjString*)tokens->At( i ); | |
111 | ||
112 | if (!interactions.FindObject(iname->String().Data())) { | |
113 | AliError( Form( "The trigger interaction (%s) is not available for past-future protection (%s)", | |
114 | iname->String().Data(), GetName() ) ); | |
115 | delete tokens; | |
116 | return kFALSE; | |
117 | } | |
118 | } | |
119 | delete tokens; | |
120 | } | |
121 | { | |
122 | TString logic( GetINTb() ); | |
123 | TObjArray* tokens = logic.Tokenize(" !&|()\t"); | |
124 | ||
125 | Int_t ntokens = tokens->GetEntriesFast(); | |
126 | for( Int_t i=0; i<ntokens; i++ ) { | |
127 | TObjString* iname = (TObjString*)tokens->At( i ); | |
128 | ||
129 | if (!interactions.FindObject(iname->String().Data())) { | |
130 | AliError( Form( "The trigger interaction (%s) is not available for past-future protection (%s)", | |
131 | iname->String().Data(), GetName() ) ); | |
132 | delete tokens; | |
133 | return kFALSE; | |
134 | } | |
135 | } | |
136 | delete tokens; | |
137 | } | |
138 | { | |
139 | TString logic( GetINT() ); | |
140 | TObjArray* tokens = logic.Tokenize(" !&|()\t"); | |
141 | ||
142 | Int_t ntokens = tokens->GetEntriesFast(); | |
143 | for( Int_t i=0; i<ntokens; i++ ) { | |
144 | TObjString* iname = (TObjString*)tokens->At( i ); | |
145 | ||
146 | if (!interactions.FindObject(iname->String().Data())) { | |
147 | AliError( Form( "The trigger interaction (%s) is not available for past-future protection (%s)", | |
148 | iname->String().Data(), GetName() ) ); | |
149 | delete tokens; | |
150 | return kFALSE; | |
151 | } | |
152 | } | |
153 | delete tokens; | |
154 | } | |
155 | return kTRUE; | |
156 | } |