Corrected protection.
[u/mrichter/AliRoot.git] / STEER / AliTriggerConfiguration.h
CommitLineData
51f6d619 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>
24class TString;
25
26class AliTriggerCluster;
27class AliTriggerDescriptor;
28class AliTriggerInput;
29class AliTriggerInteraction;
30class AliTriggerPFProtection;
31class AliTriggerBCMask;
32class AliTriggerDescriptor;
33class AliTriggerClass;
34
35class AliTriggerConfiguration : public TNamed {
36
37public:
38 AliTriggerConfiguration();
39 AliTriggerConfiguration( TString & name, TString & description );
40 virtual ~AliTriggerConfiguration();
41 // Setters
42 AliTriggerInput* AddInput(TString &name, TString &det, UChar_t level, UInt_t signature, UChar_t number);
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
895affe8 72 void Reset();
73
51f6d619 74 // Getters
75 TString GetActiveDetectors() const;
76 TString GetTriggeringDetectors() const;
77 TString GetTriggeringModules() const;
78
79 const TObjArray& GetInputs() const { return fInputs; }
80 const TObjArray& GetInteractions() const { return fInteractions; }
81 const TObjArray& GetFunctions() const { return fFunctions; }
82 const TObjArray& GetPFProtections() const { return fPFProtections; }
83 const TObjArray& GetMasks() const { return fMasks; }
84 const TObjArray& GetClusters() const { return fClusters; }
85 const TObjArray& GetDescriptors() const { return fDescriptors; }
86 const TObjArray& GetClasses() const { return fClasses; }
87
509b7052 88 Int_t GetVersion() const { return fVersion; }
89
51f6d619 90 // AliTriggerCluster* GetTriggerCluster(UInt_t index)
91 // { return (index < kNMaxClusters) ? (AliTriggerCluster*)fClusters[index] : NULL; }
92
93 //AliTriggerPFProtection* GetPFProtection(UInt_t index)
94 // { return (index < kNMaxPFProtections) ? (AliTriggerPFProtection*)fPFProtections[index] : NULL; }
95 Bool_t CheckConfiguration( TString & configfile );
96 void Print( const Option_t* opt ="" ) const;
97
98 // Configurations Database (root file)
99 void WriteConfiguration( const char* filename="" );
100 static TObjArray* GetAvailableConfigurations( const char* filename="" );
43afc9d8 101
102 static AliTriggerConfiguration* LoadConfiguration(TString & des);
103 static AliTriggerConfiguration* LoadConfigurationFromString(const char* configuration);
51f6d619 104
01d54727 105 enum {kNMaxInputs = 60}; // CTP handles up to 60 trigger detector inputs
51f6d619 106 enum {kNMaxInteractions = 2}; // CTP handles up to two different interactions
107 enum {kNMaxFunctions = 2}; // CTP handles up to two different logical functions
108 enum {kNMaxClasses = 50}; // Maximum number of trigger classes = 50
109 enum {kNMaxClusters = 6}; // Maximum number of different detector clusters that can be handled by CTP
110 enum {kNMaxPFProtections = 4}; // Maximum number of different past-future protections that can be handled by CTP
111 enum {kNMaxMasks = 4}; // CTP handles up to 4 different BC masks
112
113private:
43afc9d8 114 Bool_t ProcessConfigurationLine(const char* line, Int_t& level);
115
51f6d619 116 TObjArray fInputs; // Array with active CTP inputs
117 TObjArray fInteractions; // Array with the trigger interactions
118 TObjArray fFunctions; // Array with the logical functions of the first 4 inputs
119 TObjArray fPFProtections; // Array of Past-Future Protections
120 TObjArray fMasks; // Array with BC masks
121 TObjArray fDescriptors; // Array with trigger descriptors
122 TObjArray fClusters; // Array of Detector Trigger Clusters
123 TObjArray fClasses; // Array of Trigger Classes
124
509b7052 125 Int_t fVersion; // Configuration format version
126
51f6d619 127 Bool_t IsSelected( TString detName, TString & detectors ) const;
128 static const TString fgkConfigurationFileName; //! name of default configurations file
129
130 AliTriggerConfiguration& operator=(const AliTriggerConfiguration& des);
131 AliTriggerConfiguration( const AliTriggerConfiguration& des );
132
509b7052 133 ClassDef( AliTriggerConfiguration, 2 ) // Define a trigger configuration
51f6d619 134};
135
136#endif