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