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