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"
40 ClassImp( AliTriggerCluster )
42 //_____________________________________________________________________________
43 AliTriggerCluster::AliTriggerCluster():
49 //_____________________________________________________________________________
50 AliTriggerCluster::AliTriggerCluster( TString & name, UChar_t index, TString & detectors ) :
51 TNamed(name,detectors),
52 fClusterMask((index <=6) ? 1 << (index-1) : 0)
55 for( Int_t iDet = 0; iDet < AliDAQ::kNDetectors; iDet++ ) {
56 if( IsSelected( AliTriggerInput::fgkCTPDetectorName[iDet], fTitle )) {
58 detClus.Append( " " );
59 detClus.Append( AliDAQ::DetectorName(iDet) );
62 SetTitle(detClus.Data());
65 //_____________________________________________________________________________
66 AliTriggerCluster::AliTriggerCluster( const AliTriggerCluster &clus ):
68 fClusterMask(clus.fClusterMask)
73 //_____________________________________________________________________________
74 Bool_t AliTriggerCluster::IsDetectorInCluster( TString & detName )
76 // search for the given detector
77 Bool_t result = kFALSE;
78 if( (fTitle.CompareTo( detName ) == 0) ||
79 fTitle.BeginsWith( detName+" " ) ||
80 fTitle.EndsWith( " "+detName ) ||
81 fTitle.Contains( " "+detName+" " ) ) {
88 //_____________________________________________________________________________
89 void AliTriggerCluster::Print( const Option_t* ) const
92 cout << "Detector Cluster:" << endl;
93 cout << " Name: " << GetName() << endl;
94 cout << " Cluster index: " << (Int_t)TMath::Log2(fClusterMask) + 1 << endl;
95 cout << " Detectors: " << GetDetectorsInCluster() << endl;
99 //////////////////////////////////////////////////////////////////////////////
102 //_____________________________________________________________________________
103 Bool_t AliTriggerCluster::IsSelected( TString detName, TString& detectors ) const
105 // check whether detName is contained in detectors
106 // if yes, it is removed from detectors
108 // check if all detectors are selected
109 if( (detectors.CompareTo("ALL") == 0 ) ||
110 detectors.BeginsWith("ALL ") ||
111 detectors.EndsWith(" ALL") ||
112 detectors.Contains(" ALL ") ) {
117 // search for the given detector
118 Bool_t result = kFALSE;
119 if( (detectors.CompareTo( detName ) == 0) ||
120 detectors.BeginsWith( detName+" " ) ||
121 detectors.EndsWith( " "+detName ) ||
122 detectors.Contains( " "+detName+" " ) ) {
123 detectors.ReplaceAll( detName, "" );
127 // clean up the detectors string
128 while( detectors.Contains(" ") ) detectors.ReplaceAll( " ", " " );
129 while( detectors.BeginsWith(" ") ) detectors.Remove( 0, 1 );
130 while( detectors.EndsWith(" ") ) detectors.Remove( detectors.Length()-1, 1 );