Line data Source code
1 : #ifndef ALITRIGGERCONFIGURATION_H
2 : #define ALITRIGGERCONFIGURATION_H
3 :
4 : /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 : * See cxx source for full Copyright notice */
6 :
7 : ///////////////////////////////////////////////////////////////////////////////
8 : // //
9 : // This class represents the CTP configuration //
10 : // //
11 : // //
12 : // A Trigger Configuration define a trigger setup for particula run //
13 : // We have default one for different running modes //
14 : // (Pb-Pb, p-p, p-A, Calibration, etc). //
15 : // It keep: //
16 : // All the information contained in the real CTP configuration file //
17 : // used online during the data taking. //
18 : // //
19 : // //
20 : ///////////////////////////////////////////////////////////////////////////////
21 :
22 : #include <TNamed.h>
23 : #include <TObjArray.h>
24 : class TString;
25 :
26 : class AliTriggerCluster;
27 : class AliTriggerDescriptor;
28 : class AliTriggerInput;
29 : class AliTriggerInteraction;
30 : class AliTriggerPFProtection;
31 : class AliTriggerBCMask;
32 : class AliTriggerClass;
33 :
34 : class AliTriggerConfiguration : public TNamed {
35 :
36 : public:
37 : AliTriggerConfiguration();
38 : AliTriggerConfiguration( TString & name, TString & description );
39 : virtual ~AliTriggerConfiguration();
40 : // Setters
41 : AliTriggerInput* AddInput(TString &name, TString &det, UChar_t level, UInt_t signature, UChar_t number);
42 : AliTriggerInput* AddInput(TString &name, TString &det, UChar_t level, UInt_t signature, UInt_t indexCTP, UInt_t indexSwitch);
43 : Bool_t AddInput(AliTriggerInput *input);
44 :
45 : AliTriggerInteraction* AddInteraction(TString &name, TString &logic);
46 : Bool_t AddInteraction(AliTriggerInteraction *interact);
47 :
48 : AliTriggerInteraction* AddFunction(TString &name, TString &logic);
49 : Bool_t AddFunction(AliTriggerInteraction *func);
50 :
51 : Bool_t AddPFProtection( AliTriggerPFProtection* pf );
52 :
53 : AliTriggerBCMask* AddMask( TString &name, TString &mask );
54 : Bool_t AddMask( AliTriggerBCMask* mask );
55 :
56 : AliTriggerCluster* AddCluster( TString &name, UChar_t index, TString &detectors );
57 : Bool_t AddCluster( AliTriggerCluster* cluster );
58 :
59 : AliTriggerDescriptor* AddDescriptor( TString & name, TString & cond);
60 : Bool_t AddDescriptor( AliTriggerDescriptor* desc );
61 :
62 : AliTriggerClass* AddClass( TString &name, UChar_t index,
63 : AliTriggerDescriptor *desc, AliTriggerCluster *clus,
64 : AliTriggerPFProtection *pfp, AliTriggerBCMask *mask,
65 : UInt_t prescaler, Bool_t allrare);
66 : AliTriggerClass* AddClass( TString &name, UChar_t index,
67 : TString &desc, TString &clus,
68 : TString &pfp, TString &mask,
69 : UInt_t prescaler, Bool_t allrare);
70 : Bool_t AddClass( AliTriggerClass *trclass);
71 :
72 : void Reset();
73 :
74 : // Getters
75 0 : const char* GetPartitionName()const {return GetName();}
76 : TString GetActiveDetectors() const;
77 : TString GetTriggeringDetectors() const;
78 : TString GetTriggeringModules() const;
79 :
80 254 : const TObjArray& GetInputs() const { return fInputs; }
81 0 : const TObjArray& GetInteractions() const { return fInteractions; }
82 180 : const TObjArray& GetFunctions() const { return fFunctions; }
83 72 : const TObjArray& GetPFProtections() const { return fPFProtections; }
84 72 : const TObjArray& GetMasks() const { return fMasks; }
85 144 : const TObjArray& GetClusters() const { return fClusters; }
86 72 : const TObjArray& GetDescriptors() const { return fDescriptors; }
87 58 : const TObjArray& GetClasses() const { return fClasses; }
88 :
89 0 : Int_t GetVersion() const { return fVersion; }
90 : Int_t GetClassIndexFromName(const char* className) const;
91 : const char* GetClassNameFromIndex(Int_t classIndex) const;
92 : AliTriggerClass* GetTriggerClass(Int_t classIndex) const;
93 : // AliTriggerCluster* GetTriggerCluster(UInt_t index)
94 : // { return (index < kNMaxClusters) ? (AliTriggerCluster*)fClusters[index] : NULL; }
95 :
96 : //AliTriggerPFProtection* GetPFProtection(UInt_t index)
97 : // { return (index < kNMaxPFProtections) ? (AliTriggerPFProtection*)fPFProtections[index] : NULL; }
98 : void Print( const Option_t* opt ="" ) const;
99 :
100 : // Configurations Database (root file)
101 : void WriteConfiguration( const char* filename="" );
102 : static TObjArray* GetAvailableConfigurations( const char* filename="" );
103 :
104 : static AliTriggerConfiguration* LoadConfiguration(TString & des);
105 : static AliTriggerConfiguration* LoadConfigurationFromString(const char* configuration);
106 : Bool_t IsSelected( TString detName, TString & detectors ) const;
107 :
108 : enum {kNMaxInputs = 64}; // CTP handles up to 60 trigger detector inputs
109 : enum {kNMaxInteractions = 2}; // CTP handles up to two different interactions
110 : enum {kNMaxFunctions = 4}; // CTP handles up to 4 different logical functions
111 : enum {kNMaxClasses = 100}; // Maximum number of trigger classes = 50
112 : enum {kNMaxClusters = 8}; // Maximum number of different detector clusters that can be handled by CTP
113 : enum {kNMaxPFProtections = 4}; // Maximum number of different past-future protections that can be handled by CTP
114 : enum {kNMaxMasks = 13}; // CTP handles up to 12 different BC masks + NONE
115 :
116 : private:
117 : Bool_t ProcessConfigurationLine(const char* line, Int_t& level);
118 :
119 : TObjArray fInputs; // Array with active CTP inputs
120 : TObjArray fInteractions; // Array with the trigger interactions
121 : TObjArray fFunctions; // Array with the logical functions of the first 4 inputs
122 : TObjArray fPFProtections; // Array of Past-Future Protections
123 : TObjArray fMasks; // Array with BC masks
124 : TObjArray fDescriptors; // Array with trigger descriptors
125 : TObjArray fClusters; // Array of Detector Trigger Clusters
126 : TObjArray fClasses; // Array of Trigger Classes
127 :
128 : Int_t fVersion; // Configuration format version
129 :
130 : static const TString fgkConfigurationFileName; //! name of default configurations file
131 :
132 : AliTriggerConfiguration& operator=(const AliTriggerConfiguration& des);
133 : AliTriggerConfiguration( const AliTriggerConfiguration& des );
134 :
135 204 : ClassDef( AliTriggerConfiguration, 3 ) // Define a trigger configuration
136 : };
137 :
138 : #endif
|