Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:21:38

0001 #ifndef LOGICTOOL_H
0002 #define LOGICTOOL_H 1
0003 
0004 // Include files
0005 #include "L1Trigger/RPCTechnicalTrigger/interface/LogicFactory.h"
0006 #include "L1Trigger/RPCTechnicalTrigger/interface/LogicImp.h"
0007 
0008 #include <ostream>
0009 #include <vector>
0010 #include <cassert>
0011 
0012 /** @class LogicTool LogicTool.h
0013  *  
0014  *
0015  *  @author Andres Osorio
0016  *
0017  *  email: aosorio@uniandes.edu.co
0018  *
0019  *  @date   2008-10-12
0020  */
0021 template <class GenLogic>
0022 class LogicTool {
0023 public:
0024   /// Standard constructor
0025   LogicTool() {}
0026 
0027   ///...
0028 
0029   std::unique_ptr<GenLogic> retrieve(const std::string& _logic_name) { return rbclogic().CreateObject(_logic_name); };
0030 
0031 protected:
0032 private:
0033   using RBCLogicType = LogicFactory<GenLogic, std::string>;
0034 
0035   static RBCLogicType initialise() {
0036     GenLogic* (*createlogic)();
0037     bool status(true);
0038 
0039     RBCLogicType rbclogic;
0040     //...
0041     std::string key = std::string("ChamberORLogic");
0042     createlogic = (GenLogic * (*)()) & createChamberORLogic;
0043     status = rbclogic.Register(key, createlogic);
0044 
0045     key = std::string("TestLogic");
0046     createlogic = (GenLogic * (*)()) & createTestLogic;
0047     status = rbclogic.Register(key, createlogic);
0048 
0049     key = std::string("PatternLogic");
0050     createlogic = (GenLogic * (*)()) & createPatternLogic;
0051     status = rbclogic.Register(key, createlogic);
0052     //...
0053 
0054     key = std::string("TrackingAlg");
0055     createlogic = (GenLogic * (*)()) & createTrackingAlg;
0056     status = rbclogic.Register(key, createlogic);
0057 
0058     key = std::string("SectorORLogic");
0059     createlogic = (GenLogic * (*)()) & createSectorORLogic;
0060     status = rbclogic.Register(key, createlogic);
0061 
0062     key = std::string("TwoORLogic");
0063     createlogic = (GenLogic * (*)()) & createTwoORLogic;
0064     status = rbclogic.Register(key, createlogic);
0065 
0066     key = std::string("WedgeORLogic");
0067     createlogic = (GenLogic * (*)()) & createWedgeORLogic;
0068     status = rbclogic.Register(key, createlogic);
0069 
0070     key = std::string("PointingLogic");
0071     createlogic = (GenLogic * (*)()) & createPointingLogic;
0072     status = rbclogic.Register(key, createlogic);
0073 
0074     assert(status);
0075     return rbclogic;
0076   };
0077 
0078   static RBCLogicType const& rbclogic() {
0079     static const RBCLogicType s_rbclogic = initialise();
0080     return s_rbclogic;
0081   }
0082 };
0083 #endif  // LOGICTOOL_H