{"action":"created","issue":{"url":"https://api.github.com/repos/MiT-HEP/NeroProducer/issues/204","repository_url":"https://api.github.com/repos/MiT-HEP/NeroProducer","labels_url":"https://api.github.com/repos/MiT-HEP/NeroProducer/issues/204/labels{/name}","comments_url":"https://api.github.com/repos/MiT-HEP/NeroProducer/issues/204/comments","events_url":"https://api.github.com/repos/MiT-HEP/NeroProducer/issues/204/events","html_url":"https://github.com/MiT-HEP/NeroProducer/pull/204","id":143201765,"number":204,"title":"Factory","user":{"login":"amarini","id":4516989,"avatar_url":"https://avatars.githubusercontent.com/u/4516989?v=3","gravatar_id":"","url":"https://api.github.com/users/amarini","html_url":"https://github.com/amarini","followers_url":"https://api.github.com/users/amarini/followers","following_url":"https://api.github.com/users/amarini/following{/other_user}","gists_url":"https://api.github.com/users/amarini/gists{/gist_id}","starred_url":"https://api.github.com/users/amarini/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amarini/subscriptions","organizations_url":"https://api.github.com/users/amarini/orgs","repos_url":"https://api.github.com/users/amarini/repos","events_url":"https://api.github.com/users/amarini/events{/privacy}","received_events_url":"https://api.github.com/users/amarini/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/MiT-HEP/NeroProducer/labels/core","name":"core","color":"5319e7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-24T09:52:47Z","updated_at":"2016-03-24T16:41:24Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/MiT-HEP/NeroProducer/pulls/204","html_url":"https://github.com/MiT-HEP/NeroProducer/pull/204","diff_url":"https://github.com/MiT-HEP/NeroProducer/pull/204.diff","patch_url":"https://github.com/MiT-HEP/NeroProducer/pull/204.patch"},"body":"* create a factory tool for the bare collection\r\n* on top of PR #202"},"comment":{"url":"https://api.github.com/repos/MiT-HEP/NeroProducer/issues/comments/200917494","html_url":"https://github.com/MiT-HEP/NeroProducer/pull/204#issuecomment-200917494","issue_url":"https://api.github.com/repos/MiT-HEP/NeroProducer/issues/204","id":200917494,"user":{"login":"amarini","id":4516989,"avatar_url":"https://avatars.githubusercontent.com/u/4516989?v=3","gravatar_id":"","url":"https://api.github.com/users/amarini","html_url":"https://github.com/amarini","followers_url":"https://api.github.com/users/amarini/followers","following_url":"https://api.github.com/users/amarini/following{/other_user}","gists_url":"https://api.github.com/users/amarini/gists{/gist_id}","starred_url":"https://api.github.com/users/amarini/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amarini/subscriptions","organizations_url":"https://api.github.com/users/amarini/orgs","repos_url":"https://api.github.com/users/amarini/repos","events_url":"https://api.github.com/users/amarini/events{/privacy}","received_events_url":"https://api.github.com/users/amarini/received_events","type":"User","site_admin":false},"created_at":"2016-03-24T16:41:24Z","updated_at":"2016-03-24T16:41:24Z","body":"Hi, the possibility of switching on/off the reclustering have been introduced in #198, due to #194.\r\n\r\nThe Factory is a nice utility that allows you to create BareCollections from the name of the class (as string):\r\n\r\nE.g.\r\n~~~\r\n    vector<string> classes {\"BareEvent\",                              \r\n            \"BareVertex\",                                             \r\n            \"BareMonteCarlo\",\r\n            \"BareJets\",                                               \r\n            \"BareTaus\",                                               \r\n            \"BareLeptons\",\r\n            \"BareMet\",\r\n            \"BareTrigger\"\r\n            };\r\nvector<BareCollection*> bare_;\r\n    for (const string & c : classes)                        \r\n        bare_ . push_back( BareFactory::get().create( c ) ) ;         \r\n~~~\r\n\r\nIt's a standard pattern in C++. Similar code is used for Plugins in CMSSW, ecc...\r\nThe basic idea is that you create a Singleton (only one instance of the class factory is allowed in the program), and there you register the method to construct the different classes (that can be easily templated).\r\n\r\nIt basically make the operation: new NAME, when you have NAME as a string."}}