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 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////////
20 // Class to define a Trigger Cluster
22 // A Trigger Cluster is a group of detector to be trigger together
24 ///////////////////////////////////////////////////////////////////////////////
26 #include <Riostream.h>
35 #include "AliTriggerCluster.h"
36 #include "AliTriggerInput.h"
38 ClassImp( AliTriggerCluster )
40 //_____________________________________________________________________________
41 AliTriggerCluster::AliTriggerCluster():
47 //_____________________________________________________________________________
48 AliTriggerCluster::AliTriggerCluster( TString & name, UChar_t index, TString & detectors ) :
49 TNamed(name,detectors),
50 fClusterMask((index <=6) ? 1 << (index-1) : 0)
53 for( Int_t iDet = 0; iDet < AliDAQ::kNDetectors; iDet++ ) {
54 if( IsSelected( AliTriggerInput::fgkCTPDetectorName[iDet], fTitle )) {
56 detClus.Append( " " );
57 detClus.Append( AliDAQ::DetectorName(iDet) );
60 SetTitle(detClus.Data());
63 //_____________________________________________________________________________
64 AliTriggerCluster::AliTriggerCluster( const AliTriggerCluster &clus ):
66 fClusterMask(clus.fClusterMask)
71 //_____________________________________________________________________________
72 Bool_t AliTriggerCluster::IsDetectorInCluster( TString & detName )
74 // search for the given detector
75 Bool_t result = kFALSE;
76 if( (fTitle.CompareTo( detName ) == 0) ||
77 fTitle.BeginsWith( detName+" " ) ||
78 fTitle.EndsWith( " "+detName ) ||
79 fTitle.Contains( " "+detName+" " ) ) {
86 //_____________________________________________________________________________
87 void AliTriggerCluster::Print( const Option_t* ) const
90 cout << "Detector Cluster:" << endl;
91 cout << " Name: " << GetName() << endl;
92 cout << " Cluster index: " << (Int_t)TMath::Log2(fClusterMask) + 1 << endl;
93 cout << " Detectors: " << GetDetectorsInCluster() << endl;
97 //////////////////////////////////////////////////////////////////////////////
100 //_____________________________________________________________________________
101 Bool_t AliTriggerCluster::IsSelected( TString detName, TString& detectors ) const
103 // check whether detName is contained in detectors
104 // if yes, it is removed from detectors
106 // check if all detectors are selected
107 if( (detectors.CompareTo("ALL") == 0 ) ||
108 detectors.BeginsWith("ALL ") ||
109 detectors.EndsWith(" ALL") ||
110 detectors.Contains(" ALL ") ) {
115 // search for the given detector
116 Bool_t result = kFALSE;
117 if( (detectors.CompareTo( detName ) == 0) ||
118 detectors.BeginsWith( detName+" " ) ||
119 detectors.EndsWith( " "+detName ) ||
120 detectors.Contains( " "+detName+" " ) ) {
121 detectors.ReplaceAll( detName, "" );
125 // clean up the detectors string
126 while( detectors.Contains(" ") ) detectors.ReplaceAll( " ", " " );
127 while( detectors.BeginsWith(" ") ) detectors.Remove( 0, 1 );
128 while( detectors.EndsWith(" ") ) detectors.Remove( detectors.Length()-1, 1 );