00001 #ifndef QUICK_ANA__DEFINITION_MAKER_H
00002 #define QUICK_ANA__DEFINITION_MAKER_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <QuickAna/Global.h>
00021
00022 #include <functional>
00023 #include <string>
00024 #include <vector>
00025
00026 class StatusCode;
00027
00028 namespace ana
00029 {
00036
00037 class DefinitionMaker
00038 {
00039
00040
00041
00042
00048 public:
00049 static void addDefinition (DefinitionMaker val_definition);
00050
00051
00059 public:
00060 static StatusCode makeDefinition (DefinitionArgs& args);
00061
00062
00069 public:
00070 static StatusCode
00071 makeDefinitions (const Configuration& config,
00072 InternalConfiguration& internal,
00073 const std::string& prefix,
00074 std::vector<IAnaTool*>& tools);
00075
00076
00077
00078
00079
00080
00084 public:
00085 void testInvariant () const;
00086
00087
00091 public:
00092 DefinitionMaker (ObjectType val_type, const std::string& val_name,
00093 const std::function<StatusCode (DefinitionArgs&)>& val_function);
00094
00095
00096
00097
00098
00099
00100
00102 private:
00103 ObjectType m_type;
00104
00106 private:
00107 std::vector<std::string> m_names;
00108
00110 private:
00111 std::function<StatusCode (DefinitionArgs&)> m_function;
00112
00113
00114
00115
00116
00117
00118
00127 private:
00128 StatusCode
00129 doMakeDefinition (DefinitionArgs& args, bool& foundName) const;
00130 };
00131 }
00132
00134 #define QUICK_ANA_DEFINITION_MAKER(type,name,call) \
00135 namespace { \
00136 int QUICK_ANA_JOIN_STR (quickAnaInit, __LINE__) () { \
00137 ::ana::DefinitionMaker::addDefinition (::ana::DefinitionMaker ((type), (name), [] (::ana::DefinitionArgs& args) {return (call);})); \
00138 return 0; } \
00139 int QUICK_ANA_JOIN_STR (quickAnaDummy, __LINE__) = QUICK_ANA_JOIN_STR (quickAnaInit, __LINE__) (); }
00140
00141 #define QUICK_ANA_EVENTINFO_DEFINITION_MAKER(name,call) \
00142 QUICK_ANA_DEFINITION_MAKER (::ana::OBJECT_EVENTINFO, name, call)
00143 #define QUICK_ANA_EVENT_SELECT_DEFINITION_MAKER(name,call) \
00144 QUICK_ANA_DEFINITION_MAKER (::ana::OBJECT_EVENT_SELECT, name, call)
00145 #define QUICK_ANA_JET_DEFINITION_MAKER(name,call) \
00146 QUICK_ANA_DEFINITION_MAKER (::ana::OBJECT_JET, name, call)
00147 #define QUICK_ANA_PHOTON_DEFINITION_MAKER(name,call) \
00148 QUICK_ANA_DEFINITION_MAKER (::ana::OBJECT_PHOTON, name, call)
00149 #define QUICK_ANA_ELECTRON_DEFINITION_MAKER(name,call) \
00150 QUICK_ANA_DEFINITION_MAKER (::ana::OBJECT_ELECTRON, name, call)
00151 #define QUICK_ANA_MUON_DEFINITION_MAKER(name,call) \
00152 QUICK_ANA_DEFINITION_MAKER (::ana::OBJECT_MUON, name, call)
00153 #define QUICK_ANA_TAU_DEFINITION_MAKER(name,call) \
00154 QUICK_ANA_DEFINITION_MAKER (::ana::OBJECT_TAU, name, call)
00155 #define QUICK_ANA_MET_DEFINITION_MAKER(name,call) \
00156 QUICK_ANA_DEFINITION_MAKER (::ana::OBJECT_MET, name, call)
00157 #define QUICK_ANA_OR_DEFINITION_MAKER(name,call) \
00158 QUICK_ANA_DEFINITION_MAKER (::ana::OBJECT_OVERLAP_REMOVAL, name, call)
00159 #define QUICK_ANA_TRIGGER_DEFINITION_MAKER(name,call) \
00160 QUICK_ANA_DEFINITION_MAKER (::ana::OBJECT_TRIGGER, name, call)
00161
00162 #endif