]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliTriggerPFProtection.cxx
Coverity:
[u/mrichter/AliRoot.git] / STEER / AliTriggerPFProtection.cxx
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 ClassImp( AliTriggerPFProtection )
47
48 //_____________________________________________________________________________
49 void AliTriggerPFProtection::Print( const Option_t* ) const
50 {
51    // Print
52   cout << "Trigger Past-Future Protection: " << endl;
53   cout << "  Name:                          " << GetName() << endl;
54   cout << "  Interaction_a:                 " << fINTa.Data() << endl;
55   cout << "  Interaction_b:                 " << fINTb.Data() << endl;
56   cout << "  Interaction:                   " << fINT.Data() << endl;
57   cout << "  Na1: " << fNa1 << " Na2: " << fNa2 << " Ta: " << fTa << endl;
58   cout << "  Nb1: " << fNb1 << " Nb2: " << fNb2 << " Tb: " << fTb << endl;
59 }
60
61 //_____________________________________________________________________________
62 Bool_t AliTriggerPFProtection::CheckInteractions(TObjArray &interactions) const
63 {
64   // Check if the interactions are valid
65   {
66     TString logic( GetINTa() );
67     TObjArray* tokens = logic.Tokenize(" !&|()\t");
68
69     Int_t ntokens = tokens->GetEntriesFast();
70     for( Int_t i=0; i<ntokens; i++ ) {
71       TObjString* iname = (TObjString*)tokens->At( i );
72
73       if (!interactions.FindObject(iname->String().Data())) {
74         AliError( Form( "The trigger interaction (%s) is not available for past-future protection (%s)",
75                         iname->String().Data(), GetName() ) );
76         delete tokens;
77         return kFALSE;
78       }
79     }
80     delete tokens;
81   }
82   {
83     TString logic( GetINTb() );
84     TObjArray* tokens = logic.Tokenize(" !&|()\t");
85
86     Int_t ntokens = tokens->GetEntriesFast();
87     for( Int_t i=0; i<ntokens; i++ ) {
88       TObjString* iname = (TObjString*)tokens->At( i );
89
90       if (!interactions.FindObject(iname->String().Data())) {
91         AliError( Form( "The trigger interaction (%s) is not available for past-future protection (%s)",
92                         iname->String().Data(), GetName() ) );
93         delete tokens;
94         return kFALSE;
95       }
96     }
97     delete tokens;
98   }
99   {
100     TString logic( GetINT() );
101     TObjArray* tokens = logic.Tokenize(" !&|()\t");
102
103     Int_t ntokens = tokens->GetEntriesFast();
104     for( Int_t i=0; i<ntokens; i++ ) {
105       TObjString* iname = (TObjString*)tokens->At( i );
106
107       if (!interactions.FindObject(iname->String().Data())) {
108         AliError( Form( "The trigger interaction (%s) is not available for past-future protection (%s)",
109                         iname->String().Data(), GetName() ) );
110         delete tokens;
111         return kFALSE;
112       }
113     }
114     delete tokens;
115   }
116   return kTRUE;
117 }