#include <VisReco/Analyzer/interface/VisHFRecHit.h>
Public Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
VisHFRecHit (const edm::ParameterSet &) | |
virtual | ~VisHFRecHit () |
Private Attributes | |
edm::InputTag | inputTag_ |
Definition at line 18 of file VisHFRecHit.h.
VisHFRecHit::VisHFRecHit | ( | const edm::ParameterSet & | iConfig | ) |
Definition at line 35 of file VisHFRecHit.cc.
00036 : inputTag_ (iConfig.getParameter<edm::InputTag>("visHFRecHitTag")) 00037 {}
virtual VisHFRecHit::~VisHFRecHit | ( | ) | [inline, virtual] |
void VisHFRecHit::analyze | ( | const edm::Event & | event, | |
const edm::EventSetup & | eventSetup | |||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 40 of file VisHFRecHit.cc.
References IgCollection::addProperty(), collection, edmplugin::standard::config(), IgCollection::create(), relval_parameters_module::energy, error, ETA, eta, PV3DBase< T, PVType, FrameType >::eta(), Exception, edm::EventSetup::get(), IgDataStorage::getCollection(), CaloCellGeometry::getCorners(), CaloCellGeometry::getPosition(), inputTag_, edm::InputTag::instance(), edm::Service< T >::isAvailable(), edm::Handle< T >::isValid(), edm::ESHandle< T >::isValid(), it, edm::InputTag::label(), PHI, PV3DBase< T, PVType, FrameType >::phi(), phi, edm::InputTag::process(), x, y, and z.
00041 { 00042 edm::Service<IguanaService> config; 00043 if (! config.isAvailable ()) 00044 { 00045 throw cms::Exception ("Configuration") 00046 << "VisHFRecHit requires the IguanaService\n" 00047 "which is not present in the configuration file.\n" 00048 "You must add the service in the configuration file\n" 00049 "or remove the module that requires it"; 00050 } 00051 00052 edm::Handle<HFRecHitCollection> collection; 00053 event.getByLabel (inputTag_, collection); 00054 00055 edm::ESHandle<CaloGeometry> geom; 00056 eventSetup.get<CaloGeometryRecord> ().get (geom); 00057 00058 if (collection.isValid () && geom.isValid ()) 00059 { 00060 IgDataStorage *storage = config->storage (); 00061 IgCollection &recHits = storage->getCollection("HFRecHits_V1"); 00062 IgProperty E = recHits.addProperty("energy", 0.0); 00063 IgProperty ETA = recHits.addProperty("eta", 0.0); 00064 IgProperty PHI = recHits.addProperty("phi", 0.0); 00065 IgProperty DETID = recHits.addProperty("detid", int (0)); 00066 IgProperty FRONT_1 = recHits.addProperty("front_1", IgV3d()); 00067 IgProperty FRONT_2 = recHits.addProperty("front_2", IgV3d()); 00068 IgProperty FRONT_3 = recHits.addProperty("front_3", IgV3d()); 00069 IgProperty FRONT_4 = recHits.addProperty("front_4", IgV3d()); 00070 IgProperty BACK_1 = recHits.addProperty("back_1", IgV3d()); 00071 IgProperty BACK_2 = recHits.addProperty("back_2", IgV3d()); 00072 IgProperty BACK_3 = recHits.addProperty("back_3", IgV3d()); 00073 IgProperty BACK_4 = recHits.addProperty("back_4", IgV3d()); 00074 00075 for (std::vector<HFRecHit>::const_iterator it=collection->begin(), itEnd=collection->end(); it!=itEnd; ++it) 00076 { 00077 const CaloCellGeometry *cell = (*geom).getGeometry ((*it).detid ()); 00078 const CaloCellGeometry::CornersVec& corners = cell->getCorners (); 00079 const GlobalPoint& pos = cell->getPosition (); 00080 float energy = (*it).energy (); 00081 float eta = pos.eta (); 00082 float phi = pos.phi (); 00083 00084 IgCollectionItem irechit = recHits.create(); 00085 irechit[E] = static_cast<double>(energy); 00086 irechit[ETA] = static_cast<double>(eta); 00087 irechit[PHI] = static_cast<double>(phi); 00088 irechit[DETID] = static_cast<int>((*it).detid ()); 00089 irechit[FRONT_1] = IgV3d(static_cast<double>(corners[0].x()/100.0), 00090 static_cast<double>(corners[0].y()/100.0), 00091 static_cast<double>(corners[0].z()/100.0)); 00092 irechit[FRONT_2] = IgV3d(static_cast<double>(corners[1].x()/100.0), 00093 static_cast<double>(corners[1].y()/100.0), 00094 static_cast<double>(corners[1].z()/100.0)); 00095 irechit[FRONT_3] = IgV3d(static_cast<double>(corners[2].x()/100.0), 00096 static_cast<double>(corners[2].y()/100.0), 00097 static_cast<double>(corners[2].z()/100.0)); 00098 irechit[FRONT_4] = IgV3d(static_cast<double>(corners[3].x()/100.0), 00099 static_cast<double>(corners[3].y()/100.0), 00100 static_cast<double>(corners[3].z()/100.0)); 00101 00102 irechit[BACK_1] = IgV3d(static_cast<double>(corners[4].x()/100.0), 00103 static_cast<double>(corners[4].y()/100.0), 00104 static_cast<double>(corners[4].z()/100.0)); 00105 irechit[BACK_2] = IgV3d(static_cast<double>(corners[5].x()/100.0), 00106 static_cast<double>(corners[5].y()/100.0), 00107 static_cast<double>(corners[5].z()/100.0)); 00108 irechit[BACK_3] = IgV3d(static_cast<double>(corners[6].x()/100.0), 00109 static_cast<double>(corners[6].y()/100.0), 00110 static_cast<double>(corners[6].z()/100.0)); 00111 irechit[BACK_4] = IgV3d(static_cast<double>(corners[7].x()/100.0), 00112 static_cast<double>(corners[7].y()/100.0), 00113 static_cast<double>(corners[7].z()/100.0)); 00114 } 00115 } 00116 else 00117 { 00118 // friendlyName:moduleLabel:instanceName:processName 00119 std::string error = "### Error: HFRecHits " 00120 + edm::TypeID (typeid (HFRecHitCollection)).friendlyClassName () + ":" 00121 + inputTag_.label() + ":" 00122 + inputTag_.instance() + ":" 00123 + inputTag_.process() + " are not found."; 00124 00125 IgDataStorage *storage = config->storage (); 00126 IgCollection &collection = storage->getCollection ("Errors_V1"); 00127 IgProperty ERROR_MSG = collection.addProperty ("Error", std::string ()); 00128 IgCollectionItem item = collection.create (); 00129 item [ERROR_MSG] = error; 00130 } 00131 }
edm::InputTag VisHFRecHit::inputTag_ [private] |