]>
Commit | Line | Data |
---|---|---|
a5a091ce | 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 Input from an specific detector // | |
21 | // | |
22 | // | |
23 | // name description id mask | |
24 | // Ej: | |
25 | // AliTriggerInput( "V0_MB_L0", "VO minimum bias", 0x01 ); | |
26 | // AliTriggerInput( "V0_SC_L0", "VO semi central", 0x02 ); | |
27 | // AliTriggerInput( "V0_C_L0", "VO central", 0x04 ); | |
28 | // | |
29 | // The name must be globaly unique. Spaces are not allowed. | |
30 | // As convention should start with detector name then an id | |
51f6d619 | 31 | // and the trigger level (L0, L1, L2) separated by "_" |
32 | // for valid detector names see AliTriggerCluster::fgkDetectorName | |
a5a091ce | 33 | // |
34 | // A maximun of 60 inputs trigger are allow. | |
35 | // So, the id mask should set only bit from the position 1 to 60. | |
36 | // | |
37 | /////////////////////////////////////////////////////////////////////////////// | |
38 | ||
39 | #include <Riostream.h> | |
51f6d619 | 40 | #include <TMath.h> |
a5a091ce | 41 | |
51f6d619 | 42 | #include "AliLog.h" |
a5a091ce | 43 | #include "AliTriggerInput.h" |
44 | ||
66b0310c | 45 | using std::endl; |
46 | using std::cout; | |
a5a091ce | 47 | ClassImp( AliTriggerInput ) |
48 | ||
6439b37e | 49 | Bool_t AliTriggerInput::fgkIsTriggerDetector[AliDAQ::kNDetectors] = {1,0,0,1,1,1,0,1,0,0,0,1,0,1,1,1,1,1,1,1,0,0,0,0,0}; |
51f6d619 | 50 | const char* AliTriggerInput::fgkCTPDetectorName[AliDAQ::kNDetectors] = { |
51 | "SPD", | |
52 | "SDD", | |
53 | "SSD", | |
54 | "TPC", | |
55 | "TRD", | |
56 | "TOF", | |
57 | "HMPID", | |
58 | "PHOS", | |
59 | "CPV", | |
60 | "PMD", | |
61 | "MUON_TRK", | |
62 | "MUON_TRG", | |
63 | "FMD", | |
64 | "T0", | |
65 | "V0", | |
66 | "ZDC", | |
67 | "ACORDE", | |
68 | "CTP", | |
69 | "EMCal", | |
7034c7a7 | 70 | "DAQ_TEST", |
6439b37e | 71 | "EMPTY", |
72 | "AD", | |
73 | "MFT", | |
74 | "FIT", | |
51f6d619 | 75 | "HLT" |
76 | }; | |
77 | ||
51f6d619 | 78 | //_____________________________________________________________________________ |
79 | AliTriggerInput::AliTriggerInput( TString name, TString det, UChar_t level, Int_t signature, Char_t number ): | |
80 | TNamed( name.Data(), det.Data() ), | |
9d1f4be9 | 81 | fMask((number > 0) ? 1 << (number-1) : 0 ), |
51f6d619 | 82 | fValue(0), |
83 | fSignature(signature), | |
84 | fLevel(level), | |
85 | fDetectorId(-1), | |
86 | fIsActive(kFALSE) | |
87 | { | |
88 | // Standard constructor | |
89 | // | |
90 | // The name must be globaly unique. Spaces are not allowed. | |
91 | // For valid detector names see AliDAQ::fgkDetectorName | |
92 | ||
93 | // Check for valid detector name | |
94 | Int_t iDet = 0; | |
95 | for( iDet = 0; iDet < AliDAQ::kNDetectors; iDet++ ) { | |
96 | if( !fgkIsTriggerDetector[iDet] ) continue; | |
97 | if( det.CompareTo( fgkCTPDetectorName[iDet] ) == 0 ) { | |
98 | fTitle = AliDAQ::DetectorName(iDet); | |
99 | fDetectorId = iDet; | |
100 | break; | |
101 | } | |
102 | if( det.CompareTo( AliDAQ::DetectorName(iDet) ) == 0 ) { | |
103 | fDetectorId = iDet; | |
104 | break; | |
105 | } | |
106 | } | |
107 | if( iDet == AliDAQ::kNDetectors ) { | |
108 | AliError( Form( "%s is not a valid trigger input, it must contain a valid trigger detector name instead of (%s)", name.Data(), det.Data() ) ); | |
109 | } | |
110 | } | |
111 | ||
a5a091ce | 112 | //_____________________________________________________________________________ |
113 | void AliTriggerInput::Print( const Option_t* ) const | |
114 | { | |
115 | ||
116 | cout << "Trigger Input:" << endl; | |
117 | cout << " Name: " << GetName() << endl; | |
51f6d619 | 118 | cout << " Detector: " << GetTitle() << "(Id=" << (Int_t)fDetectorId << ")" << endl; |
20643cc3 | 119 | cout << " Level: " << (Int_t)fLevel << endl; |
51f6d619 | 120 | cout << " Signature: " << fSignature << endl; |
b87d7e83 | 121 | if(fMask) |
51f6d619 | 122 | cout << " Number: " << (Int_t)TMath::Log2(fMask) << endl; |
b87d7e83 | 123 | else cout << " fMask: " << fMask << endl; |
51f6d619 | 124 | if (IsActive()) |
125 | cout << " Input is active " << endl; | |
126 | else | |
127 | cout << " Input is not active " << endl; | |
128 | if (Status()) | |
129 | cout << " Input is fired " << endl; | |
130 | else | |
131 | cout << " Input is not fired " << endl; | |
132 | } | |
133 | ||
134 | //_____________________________________________________________________________ | |
135 | TString AliTriggerInput::GetModule() const | |
136 | { | |
137 | // Get the detector module name (in AliRoot simulation sense) | |
138 | TString name = ""; | |
139 | if (fDetectorId >= 0 && fDetectorId < AliDAQ::kNDetectors) | |
7e88424f | 140 | name = AliDAQ::OfflineModuleName((Int_t)fDetectorId); |
51f6d619 | 141 | else |
142 | AliError(Form("Invalid detector Id (%d)",(Int_t)fDetectorId)); | |
143 | ||
144 | return name; | |
a5a091ce | 145 | } |