]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliTriggerInput.cxx
bug
[u/mrichter/AliRoot.git] / STEER / AliTriggerInput.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 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
31 //    and the trigger level (L0, L1, L2) separated by "_"
32 //    for valid detector names see AliTriggerCluster::fgkDetectorName
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>
40 #include <TMath.h>
41
42 #include "AliLog.h"
43 #include "AliTriggerInput.h"
44
45 ClassImp( AliTriggerInput )
46
47 Bool_t AliTriggerInput::fgkIsTriggerDetector[AliDAQ::kNDetectors] = {1,0,0,0,1,1,0,1,0,0,0,1,0,1,1,1,1,1,1,0,0};
48 const char* AliTriggerInput::fgkCTPDetectorName[AliDAQ::kNDetectors] = {
49   "SPD",
50   "SDD",
51   "SSD",
52   "TPC",
53   "TRD",
54   "TOF",
55   "HMPID",
56   "PHOS",
57   "CPV",
58   "PMD",
59   "MUON_TRK",
60   "MUON_TRG",
61   "FMD",
62   "T0",
63   "V0",
64   "ZDC",
65   "ACORDE",
66   "CTP",
67   "EMCal",
68   "DAQ_TEST",
69   "HLT"
70 };
71
72 const char* AliTriggerInput::fgkOfflineModuleName[AliDAQ::kNDetectors] = {
73   "ITS",
74   "ITS",
75   "ITS",
76   "TPC",
77   "TRD",
78   "TOF",
79   "HMPID",
80   "PHOS",
81   "CPV",
82   "PMD",
83   "MUON",
84   "MUON",
85   "FMD",
86   "T0",
87   "VZERO",
88   "ZDC",
89   "ACORDE",
90   "CTP",
91   "EMCAL",
92   "",
93   "HLT"
94 };
95
96 //_____________________________________________________________________________
97   AliTriggerInput::AliTriggerInput( TString name, TString det, UChar_t level, Int_t signature, Char_t number ):
98     TNamed( name.Data(), det.Data() ),
99     fMask((number >= 0) ? 1 << number : 0 ),
100     fValue(0),
101     fSignature(signature),
102     fLevel(level),
103     fDetectorId(-1),
104     fIsActive(kFALSE)
105 {
106    //  Standard constructor
107    //
108    //    The name must be globaly unique. Spaces are not allowed.
109    //    For valid detector names see AliDAQ::fgkDetectorName
110
111    // Check for valid detector name
112    Int_t iDet = 0;
113    for( iDet = 0; iDet < AliDAQ::kNDetectors; iDet++ ) {
114      if( !fgkIsTriggerDetector[iDet] ) continue;
115       if( det.CompareTo( fgkCTPDetectorName[iDet] ) == 0 ) {
116         fTitle = AliDAQ::DetectorName(iDet);
117         fDetectorId = iDet;
118         break;
119       }
120       if( det.CompareTo( AliDAQ::DetectorName(iDet) ) == 0 ) {
121         fDetectorId = iDet;
122         break;
123       }
124    }
125    if( iDet == AliDAQ::kNDetectors ) {
126       AliError( Form( "%s is not a valid trigger input, it must contain a valid trigger detector name instead of (%s)", name.Data(), det.Data() ) );
127    }
128 }
129
130 //_____________________________________________________________________________
131 void AliTriggerInput::Print( const Option_t* ) const
132 {
133    // Print
134    cout << "Trigger Input:" << endl; 
135    cout << "  Name:        " << GetName() << endl;
136    cout << "  Detector:    " << GetTitle() << "(Id=" << (Int_t)fDetectorId << ")" << endl;
137    cout << "  Level:       " << fLevel << endl;
138    cout << "  Signature:   " << fSignature << endl;
139    cout << "  Number:      " << (Int_t)TMath::Log2(fMask) << endl;
140    if (IsActive())
141      cout << "   Input is active      " << endl;
142    else
143      cout << "   Input is not active  " << endl;
144    if (Status())
145      cout << "   Input is fired      " << endl;
146    else
147      cout << "   Input is not fired  " << endl;
148 }
149
150 //_____________________________________________________________________________
151 TString AliTriggerInput::GetModule() const
152 {
153   // Get the detector module name (in AliRoot simulation sense)
154   TString name = "";
155   if (fDetectorId >= 0 && fDetectorId < AliDAQ::kNDetectors)
156     name = fgkOfflineModuleName[(Int_t)fDetectorId];
157   else
158     AliError(Form("Invalid detector Id (%d)",(Int_t)fDetectorId));
159
160   return name;
161 }