![]() |
![]() |
#include <VisReco/Analyzer/interface/VisMET.h>
Public Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
VisMET (const edm::ParameterSet &) | |
virtual | ~VisMET () |
Private Attributes | |
edm::InputTag | inputTag_ |
Definition at line 18 of file VisMET.h.
VisMET::VisMET | ( | const edm::ParameterSet & | iConfig | ) |
Definition at line 27 of file VisMET.cc.
00028 : inputTag_ (iConfig.getParameter<edm::InputTag>("visMETTag")) 00029 {}
void VisMET::analyze | ( | const edm::Event & | event, | |
const edm::EventSetup & | eventSetup | |||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 32 of file VisMET.cc.
References IgCollection::addProperty(), collection, edmplugin::standard::config(), IgCollection::create(), error, Exception, IgDataStorage::getCollection(), inputTag_, edm::InputTag::instance(), edm::Service< T >::isAvailable(), edm::Handle< T >::isValid(), it, edm::InputTag::label(), m, PHI, phi, edm::InputTag::process(), and PT.
00033 { 00034 edm::Service<IguanaService> config; 00035 if (! config.isAvailable ()) 00036 { 00037 throw cms::Exception ("Configuration") 00038 << "VisMET requires the IguanaService\n" 00039 "which is not present in the configuration file.\n" 00040 "You must add the service in the configuration file\n" 00041 "or remove the module that requires it"; 00042 } 00043 00044 edm::Handle<METCollection> collection; 00045 event.getByLabel (inputTag_, collection); 00046 00047 if (collection.isValid ()) 00048 { 00049 IgDataStorage *storage = config->storage (); 00050 IgCollection &mets = storage->getCollection ("METs_V1"); 00051 00052 IgProperty PHI = mets.addProperty ("phi", 0.0); 00053 IgProperty PT = mets.addProperty ("pt", 0.0); 00054 IgProperty PX = mets.addProperty ("px", 0.0); 00055 IgProperty PY = mets.addProperty ("py", 0.0); 00056 IgProperty PZ = mets.addProperty ("pz", 0.0); 00057 00058 for (METCollection::const_iterator it = collection->begin (), itEnd = collection->end (); it != itEnd; ++it) 00059 { 00060 double phi = (*it).phi (); 00061 double pt = (*it).pt (); 00062 00063 IgCollectionItem m = mets.create (); 00064 m [PHI] = static_cast<double>(phi); 00065 m [PT] = static_cast<double>(pt); 00066 m [PX] = static_cast<double>((*it).px ()); 00067 m [PY] = static_cast<double>((*it).py ()); 00068 m [PZ] = static_cast<double>((*it).pz ()); 00069 } 00070 } 00071 else 00072 { 00073 // friendlyName:moduleLabel:instanceName:processName 00074 std::string error = "### Error: MET " 00075 + edm::TypeID (typeid (METCollection)).friendlyClassName () + ":" 00076 + inputTag_.label() + ":" 00077 + inputTag_.instance() + ":" 00078 + inputTag_.process() + " are not found."; 00079 00080 IgDataStorage *storage = config->storage (); 00081 IgCollection &collection = storage->getCollection ("Errors_V1"); 00082 IgProperty ERROR_MSG = collection.addProperty ("Error", std::string ()); 00083 IgCollectionItem item = collection.create (); 00084 item [ERROR_MSG] = error; 00085 } 00086 }
edm::InputTag VisMET::inputTag_ [private] |