CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends
edm::ServiceRegistry Class Reference

#include <ServiceRegistry.h>

Classes

class  Operate
 

Public Member Functions

template<typename T >
Tget () const
 
template<typename T >
bool isAvailable () const
 
ServiceToken presentToken () const
 
virtual ~ServiceRegistry ()
 

Static Public Member Functions

template<typename T >
static ServiceToken createContaining (std::unique_ptr< T > iService)
 create a service token that holds the service defined by iService More...
 
template<typename T >
static ServiceToken createContaining (std::unique_ptr< T > iService, ServiceToken iToken, serviceregistry::ServiceLegacy iLegacy)
 
template<typename T >
static ServiceToken createContaining (std::shared_ptr< serviceregistry::ServiceWrapper< T > > iWrapper)
 create a service token that holds the service held by iWrapper More...
 
template<typename T >
static ServiceToken createContaining (std::shared_ptr< serviceregistry::ServiceWrapper< T > > iWrapper, ServiceToken iToken, serviceregistry::ServiceLegacy iLegacy)
 
static ServiceToken createServicesFromConfig (std::unique_ptr< ParameterSet > params)
 
static ServiceToken createSet (std::vector< ParameterSet > &)
 
static ServiceToken createSet (std::vector< ParameterSet > &, ServiceToken, serviceregistry::ServiceLegacy, bool associate=true)
 
static ServiceRegistryinstance ()
 

Private Member Functions

ServiceRegistry const & operator= (ServiceRegistry const &)=delete
 
 ServiceRegistry ()
 
 ServiceRegistry (ServiceRegistry const &)=delete
 
ServiceToken setContext (ServiceToken const &iNewToken)
 
void unsetContext (ServiceToken const &iOldToken)
 

Private Attributes

std::shared_ptr< serviceregistry::ServicesManagermanager_
 

Friends

class edm::FwkImpl
 
int main (int argc, char *argv[])
 
class Operate
 

Detailed Description

Definition at line 38 of file ServiceRegistry.h.

Constructor & Destructor Documentation

ServiceRegistry::~ServiceRegistry ( )
virtual

Definition at line 36 of file ServiceRegistry.cc.

36 {}
ServiceRegistry::ServiceRegistry ( )
private

Definition at line 30 of file ServiceRegistry.cc.

30 {}
edm::ServiceRegistry::ServiceRegistry ( ServiceRegistry const &  )
privatedelete

Member Function Documentation

template<typename T >
static ServiceToken edm::ServiceRegistry::createContaining ( std::unique_ptr< T iService)
inlinestatic

create a service token that holds the service defined by iService

Definition at line 97 of file ServiceRegistry.h.

References looper::config, eostools::move(), and wrapper.

Referenced by edm::ScheduleItems::addCPRandTNS(), main(), and topLevelPSet().

97  {
98  std::vector<edm::ParameterSet> config;
99  auto manager = std::make_shared<serviceregistry::ServicesManager>(config);
100  auto wrapper = std::make_shared<serviceregistry::ServiceWrapper<T> >(std::move(iService));
101  manager->put(wrapper);
102  return manager;
103  }
config
Definition: looper.py:291
def move(src, dest)
Definition: eostools.py:511
static HepMC::HEPEVT_Wrapper wrapper
template<typename T >
static ServiceToken edm::ServiceRegistry::createContaining ( std::unique_ptr< T iService,
ServiceToken  iToken,
serviceregistry::ServiceLegacy  iLegacy 
)
inlinestatic

Definition at line 105 of file ServiceRegistry.h.

References looper::config, eostools::move(), and wrapper.

107  {
108  std::vector<edm::ParameterSet> config;
109  auto manager = std::make_shared<serviceregistry::ServicesManager>(iToken, iLegacy, config);
110  auto wrapper = std::make_shared<serviceregistry::ServiceWrapper<T> >(std::move(iService));
111  manager->put(wrapper);
112  return manager;
113  }
config
Definition: looper.py:291
def move(src, dest)
Definition: eostools.py:511
static HepMC::HEPEVT_Wrapper wrapper
template<typename T >
static ServiceToken edm::ServiceRegistry::createContaining ( std::shared_ptr< serviceregistry::ServiceWrapper< T > >  iWrapper)
inlinestatic

create a service token that holds the service held by iWrapper

Definition at line 116 of file ServiceRegistry.h.

References looper::config.

116  {
117  std::vector<edm::ParameterSet> config;
118  auto manager = std::make_shared<serviceregistry::ServicesManager>(config);
119  manager->put(iWrapper);
120  return manager;
121  }
config
Definition: looper.py:291
template<typename T >
static ServiceToken edm::ServiceRegistry::createContaining ( std::shared_ptr< serviceregistry::ServiceWrapper< T > >  iWrapper,
ServiceToken  iToken,
serviceregistry::ServiceLegacy  iLegacy 
)
inlinestatic

Definition at line 123 of file ServiceRegistry.h.

References looper::config.

125  {
126  std::vector<edm::ParameterSet> config;
127  auto manager = std::make_shared<serviceregistry::ServicesManager>(iToken, iLegacy, config);
128  manager->put(iWrapper);
129  return manager;
130  }
config
Definition: looper.py:291
ServiceToken ServiceRegistry::createServicesFromConfig ( std::unique_ptr< ParameterSet params)
static

Definition at line 69 of file ServiceRegistry.cc.

References createSet(), and AlCaHLTBitMon_QueryRunRegistry::string.

69  {
70  auto serviceSets = params->popVParameterSet(std::string("services"));
71  //create the services
72  return ServiceToken(ServiceRegistry::createSet(serviceSets));
73  }
static ServiceToken createSet(std::vector< ParameterSet > &)
ServiceToken ServiceRegistry::createSet ( std::vector< ParameterSet > &  iPS)
static

Definition at line 75 of file ServiceRegistry.cc.

Referenced by createServicesFromConfig(), edm::ScheduleItems::initServices(), cond::payloadInspector::PlotBase::process(), cond::payloadInspector::PlotBase::processTwoTags(), and cond::Utilities::run().

75  {
76  using namespace serviceregistry;
77  auto returnValue = std::make_shared<ServicesManager>(iPS);
78  return ServiceToken(returnValue);
79  }
ServiceToken ServiceRegistry::createSet ( std::vector< ParameterSet > &  iPS,
ServiceToken  iToken,
serviceregistry::ServiceLegacy  iLegacy,
bool  associate = true 
)
static

Definition at line 81 of file ServiceRegistry.cc.

84  {
85  using namespace serviceregistry;
86  auto returnValue = std::make_shared<ServicesManager>(iToken, iLegacy, iPS, associate);
87  return ServiceToken(returnValue);
88  }
template<typename T >
T& edm::ServiceRegistry::get ( ) const
inline

Definition at line 60 of file ServiceRegistry.h.

References edm::errors::NotFound, and edm::Exception::throwThis().

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), rrapi.RRApi::columns(), rrapi.RRApi::count(), rrapi.RRApi::data(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), betterConfigParser.BetterConfigParser::getResultingSection(), edm::ScheduleItems::initSchedule(), rrapi.RRApi::report(), rrapi.RRApi::reports(), rrapi.RRApi::tables(), rrapi.RRApi::tags(), rrapi.RRApi::templates(), and rrapi.RRApi::workspaces().

60  {
61  if (nullptr == manager_.get()) {
63  "Service"
64  " no ServiceRegistry has been set for this thread");
65  }
66  return manager_->template get<T>();
67  }
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
Definition: EDMException.cc:82
std::shared_ptr< serviceregistry::ServicesManager > manager_
ServiceRegistry & ServiceRegistry::instance ( )
static
template<typename T >
bool edm::ServiceRegistry::isAvailable ( ) const
inline

Definition at line 70 of file ServiceRegistry.h.

References instance, edm::errors::NotFound, and edm::Exception::throwThis().

70  {
71  if (nullptr == manager_.get()) {
73  "Service"
74  " no ServiceRegistry has been set for this thread");
75  }
76  return manager_->template isAvailable<T>();
77  }
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
Definition: EDMException.cc:82
std::shared_ptr< serviceregistry::ServicesManager > manager_
ServiceRegistry const& edm::ServiceRegistry::operator= ( ServiceRegistry const &  )
privatedelete
ServiceToken ServiceRegistry::presentToken ( ) const

The token can be passed to another thread in order to have the same services available in the other thread.

Definition at line 63 of file ServiceRegistry.cc.

References manager_.

Referenced by edm::Worker::doWork(), edm::WorkerManager::processOneOccurrence(), edm::ReducedProvenanceReader::ReducedProvenanceReader(), evf::EvFBuildingThrottle::start(), edm::OutputModuleCommunicatorT< T >::writeLumiAsync(), and edm::OutputModuleCommunicatorT< T >::writeRunAsync().

63 { return manager_; }
std::shared_ptr< serviceregistry::ServicesManager > manager_
ServiceToken ServiceRegistry::setContext ( ServiceToken const &  iNewToken)
private

Definition at line 52 of file ServiceRegistry.cc.

References edm::ServiceToken::manager_, and manager_.

52  {
53  ServiceToken returnValue(manager_);
54  manager_ = iNewToken.manager_;
55  return returnValue;
56  }
std::shared_ptr< serviceregistry::ServicesManager > manager_
void ServiceRegistry::unsetContext ( ServiceToken const &  iOldToken)
private

Definition at line 58 of file ServiceRegistry.cc.

References edm::ServiceToken::manager_, and manager_.

Referenced by edm::ServiceRegistry::Operate::~Operate().

58 { manager_ = iOldToken.manager_; }
std::shared_ptr< serviceregistry::ServicesManager > manager_

Friends And Related Function Documentation

friend class edm::FwkImpl
friend

Definition at line 52 of file ServiceRegistry.h.

int main ( int  argc,
char *  argv[] 
)
friend

CALO JETS


PF JETS

Definition at line 701 of file DMRtrends.cc.

701  {
702  if (argc == 1) {
703 
704  vector<int>IOVlist={290543, 296702, 296966, 297224, 297281, 297429, 297467, 297484, 297494, 297503, 297557, 297599, 297620, 297660, 297670, 298678, 298996, 299062, 299096, 299184, 299327, 299368, 299381, 299443, 299480, 299592, 299594, 299649, 300087, 300155, 300233, 300237, 300280, 300364, 300389, 300399, 300459, 300497, 300515, 300538, 300551, 300574, 300636, 300673, 300780, 300806, 300812, 301046, 301417, 302131, 302573, 302635, 303825, 303998, 304170, 304505, 304672, 305040, 305081};//UL17
705  //vector<int> pixelupdateruns {316758, 317527,317661,317664,318227, 320377};//2018
706  vector<int> pixelupdateruns {290543, 297281, 298653, 299443, 300389, 302131, 303790, 304911, 305898};//2017
707 
708  cout << "WARNING: Running function with arguments specified in DMRtrends.cc" << endl << "If you want to specify the arguments from command line run the macro as follows:" << endl << "DMRtrends labels pathtoDMRs geometriesandcolourspairs outputdirectory showpixelupdate showlumi FORCE" << endl;
709 
710  //Example provided for a currently working set of parameters
711  DMRtrends(IOVlist,{"vUL17","MB"},"2017", "/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/data/commonValidation/results/acardini/DMRs/EOY17/", {"EOY17","full ML pixel + strip","SG-mp2607","mp2993"}, {kRed, kBlack, kBlue, kGreen}, "/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/data/commonValidation/alignmentObjects/acardini/DMRsTrends/", true, pixelupdateruns, true, true);
712 
713 
714  return 0;
715  }
716  else if (argc < 11) {
717  cout << "DMRtrends IOVlist labels Year pathtoDMRs geometriesandcolourspairs outputdirectory pixelupdatelist showpixelupdate showlumi FORCE" << endl;
718 
719  return 1;
720  }
721 
722  TString runlist = argv[1],
723  all_labels = argv[2],
724  Year = argv[3],
725  pathtoDMRs = argv[4],
726  geometrieandcolours = argv[5], //name1:title1:color1,name2:title2:color2,name3:title3:color3
727  outputdirectory = argv[6],
728  pixelupdatelist = argv[7];
729  bool showpixelupdate = argv[8],
730  showlumi = argv[9],
731  FORCE = argv[10];
732  TObjArray *labelarray = all_labels.Tokenize(",");
733  vector<string> labels;
734  for(int i=0; i < labelarray->GetEntries(); i++)labels.push_back((string)(labelarray->At(i)->GetName()));
735  TObjArray *IOVarray = runlist.Tokenize(",");
736  vector<int> IOVlist;
737  for(int i=0; i < IOVarray->GetEntries(); i++)IOVlist.push_back(stoi(IOVarray->At(i)->GetName()));
738  vector<int> pixelupdateruns;
739  TObjArray *PIXarray = pixelupdatelist.Tokenize(",");
740  for(int i=0; i < PIXarray->GetEntries(); i++)pixelupdateruns.push_back(stoi(PIXarray->At(i)->GetName()));
741  vector<string> geometries;
742  vector<Color_t> colours;
743  TObjArray *geometrieandcolourspairs = geometrieandcolours.Tokenize(",");
744  for (int i=0; i < geometrieandcolourspairs->GetEntries(); i++) {
745  TObjArray *geomandcolourvec = TString(geometrieandcolourspairs->At(i)->GetName()).Tokenize(":");
746  geometries.push_back(geomandcolourvec->At(0)->GetName());
747  colours.push_back((Color_t)(atoi(geomandcolourvec->At(1)->GetName())));
748  }
749  DMRtrends(IOVlist,labels,Year,pathtoDMRs.Data(),geometries,colours,outputdirectory.Data(),showpixelupdate, pixelupdateruns,showlumi,FORCE);
750 
751 
752  return 0;
753 }
void DMRtrends(vector< int > IOVlist, vector< string >labels={"MB"}, TString Year="2018", string myValidation="/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/data/commonValidation/results/acardini/DMRs/", vector< string > geometries={"GT","SG","MP pix LBL","PIX HLS+ML STR fix"}, vector< Color_t > colours={kBlue, kRed, kGreen, kCyan}, TString outputdir="/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/data/commonValidation/alignmentObjects/acardini/DMRsTrends/", bool pixelupdate=false, vector< int > pixelupdateruns={314881, 316758, 317527, 318228, 320377}, bool showlumi=false, bool FORCE=false)
Definition: DMRtrends.cc:249
friend class Operate
friend

Definition at line 54 of file ServiceRegistry.h.

Member Data Documentation

std::shared_ptr<serviceregistry::ServicesManager> edm::ServiceRegistry::manager_
private

Definition at line 143 of file ServiceRegistry.h.

Referenced by presentToken(), setContext(), and unsetContext().