Line data Source code
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 :
46 : using std::endl;
47 : using std::cout;
48 : using std::hex;
49 : using std::dec;
50 172 : ClassImp( AliTriggerPFProtection )
51 : //_____________________________________________________________________________
52 : AliTriggerPFProtection::AliTriggerPFProtection() :
53 15 : TNamed(),
54 45 : fINTa(), fINTb(),fINT(),
55 15 : fNa1(0),fNa2(0),fTa(0),
56 15 : fNb1(0),fNb2(0),fTb(0),
57 15 : fInter(0),fBCmask(0xfff),fVersion(0)
58 75 : {
59 390 : for(Int_t i=0;i<12;i++)fPFdef[i]=0;
60 30 : }
61 : AliTriggerPFProtection::AliTriggerPFProtection( TString & name) :
62 1 : TNamed(name, name),
63 3 : fINTa(), fINTb(),fINT(),
64 1 : fNa1(0),fNa2(0),fTa(0),
65 1 : fNb1(0),fNb2(0),fTb(0),
66 1 : fInter(0),fBCmask(0xfff),fVersion(0)
67 5 : {
68 26 : for(Int_t i=0;i<12;i++)fPFdef[i]=0;
69 2 : }
70 : AliTriggerPFProtection::AliTriggerPFProtection( TString & name,TString & inta, TString & intb, TString & interaction ) :
71 2 : TNamed(name, name),
72 6 : fINTa(inta), fINTb(intb),fINT(interaction),
73 2 : fNa1(0),fNa2(0),fTa(0),
74 2 : fNb1(0),fNb2(0),fTb(0),
75 2 : fInter(0),fBCmask(0xfff),fVersion(0)
76 10 : {
77 52 : for(Int_t i=0;i<12;i++)fPFdef[i]=0;
78 4 : }
79 : AliTriggerPFProtection::AliTriggerPFProtection(TString& name,UInt_t* pfdef)
80 0 : :TNamed(name,name),
81 0 : fINTa(), fINTb(),fINT(),
82 0 : fNa1(0),fNa2(0),fTa(0),
83 0 : fNb1(0),fNb2(0),fTb(0),
84 0 : fInter(0),fBCmask(0xfff),fVersion(7)
85 0 : {
86 0 : for(Int_t i=0;i<12;i++)fPFdef[i]=pfdef[i];
87 0 : }
88 : AliTriggerPFProtection::AliTriggerPFProtection( TString & name,TString & inter, TString & bcm,UInt_t PBefore,UInt_t PAfter,UInt_t NBefore,UInt_t NAfter,UInt_t OBefore,UInt_t OAfter)
89 0 : :TNamed(name,name),fINTa(inter),fINTb(bcm),fINT(),
90 0 : fNa1(NAfter),fNa2(OAfter),fTa(PAfter),
91 0 : fNb1(NBefore),fNb2(OBefore),fTb(PBefore),
92 0 : fInter(0),fBCmask(0xfff),fVersion(8)
93 0 : {
94 0 : for(Int_t i=0;i<12;i++)fPFdef[i]=0;
95 0 : }
96 : //_____________________________________________________________________________
97 : void AliTriggerPFProtection::Print( const Option_t* ) const
98 : {
99 : // Print
100 0 : cout << "Trigger Past-Future Protection: " << endl;
101 0 : cout << " Name: " << GetName() << endl;
102 0 : TString name(GetName());
103 0 : if(name.Contains("NONE")) return;
104 0 : if(fVersion<8){
105 0 : cout << " Interaction_a: " << fINTa.Data() << endl;
106 0 : cout << " Interaction_b: " << fINTb.Data() << endl;
107 0 : cout << " Interaction: " << fINT.Data() << endl;
108 0 : cout << " Na1: " << fNa1 << " Na2: " << fNa2 << " Ta: " << fTa << endl;
109 0 : cout << " Nb1: " << fNb1 << " Nb2: " << fNb2 << " Tb: " << fTb << endl;
110 0 : cout << "PFdef: " << hex;
111 0 : for(Int_t i=0;i<12;i++)cout << " 0x" << fPFdef[i];
112 0 : cout << dec << endl;
113 : }else{
114 0 : cout << " Interaction: " << fINTb.Data() << endl;
115 0 : cout << " BCmask : " << fINTa.Data() << endl;
116 0 : cout << " NintBefore: " << fNb1 << " OffBefore: " << fNb2 << " PeriodBefore: " << fTb << endl;
117 0 : cout << " NintAfter : " << fNa1 << " OffAfter : " << fNa2 << " PeriodAfter : " << fTa << endl;
118 : }
119 0 : }
120 :
121 : //_____________________________________________________________________________
122 : Bool_t AliTriggerPFProtection::CheckInteractions(TObjArray &interactions) const
123 : {
124 : // Check if the interactions are valid
125 : {
126 0 : TString logic( GetINTa() );
127 0 : TObjArray* tokens = logic.Tokenize(" !&|()\t");
128 :
129 0 : Int_t ntokens = tokens->GetEntriesFast();
130 0 : for( Int_t i=0; i<ntokens; i++ ) {
131 0 : TObjString* iname = (TObjString*)tokens->At( i );
132 :
133 0 : if (!interactions.FindObject(iname->String().Data())) {
134 0 : AliError( Form( "The trigger interaction (%s) is not available for past-future protection (%s)",
135 : iname->String().Data(), GetName() ) );
136 0 : delete tokens;
137 0 : return kFALSE;
138 : }
139 0 : }
140 0 : delete tokens;
141 0 : }
142 : {
143 0 : TString logic( GetINTb() );
144 0 : TObjArray* tokens = logic.Tokenize(" !&|()\t");
145 :
146 0 : Int_t ntokens = tokens->GetEntriesFast();
147 0 : for( Int_t i=0; i<ntokens; i++ ) {
148 0 : TObjString* iname = (TObjString*)tokens->At( i );
149 :
150 0 : if (!interactions.FindObject(iname->String().Data())) {
151 0 : AliError( Form( "The trigger interaction (%s) is not available for past-future protection (%s)",
152 : iname->String().Data(), GetName() ) );
153 0 : delete tokens;
154 0 : return kFALSE;
155 : }
156 0 : }
157 0 : delete tokens;
158 0 : }
159 : {
160 0 : TString logic( GetINT() );
161 0 : TObjArray* tokens = logic.Tokenize(" !&|()\t");
162 :
163 0 : Int_t ntokens = tokens->GetEntriesFast();
164 0 : for( Int_t i=0; i<ntokens; i++ ) {
165 0 : TObjString* iname = (TObjString*)tokens->At( i );
166 :
167 0 : if (!interactions.FindObject(iname->String().Data())) {
168 0 : AliError( Form( "The trigger interaction (%s) is not available for past-future protection (%s)",
169 : iname->String().Data(), GetName() ) );
170 0 : delete tokens;
171 0 : return kFALSE;
172 : }
173 0 : }
174 0 : delete tokens;
175 0 : }
176 0 : return kTRUE;
177 0 : }
|