#include <VisReco/Analyzer/interface/VisHERecHit.h>
Public Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
VisHERecHit (const edm::ParameterSet &) | |
virtual | ~VisHERecHit () |
Private Attributes | |
edm::InputTag | inputTag_ |
Definition at line 18 of file VisHERecHit.h.
VisHERecHit::VisHERecHit | ( | const edm::ParameterSet & | iConfig | ) |
Definition at line 35 of file VisHERecHit.cc.
00036 : inputTag_ (iConfig.getParameter<edm::InputTag>("visHERecHitTag")) 00037 {}
virtual VisHERecHit::~VisHERecHit | ( | ) | [inline, virtual] |
void VisHERecHit::analyze | ( | const edm::Event & | event, | |
const edm::EventSetup & | eventSetup | |||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 40 of file VisHERecHit.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(), HcalEndcap, 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 << "VisHERecHit 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<HBHERecHitCollection> 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("HERecHits_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<HBHERecHit>::const_iterator it=collection->begin(), itEnd=collection->end(); it!=itEnd; ++it) 00076 { 00077 if ((*it).id ().subdet () == HcalEndcap) 00078 { 00079 const CaloCellGeometry *cell = (*geom).getGeometry ((*it).detid ()); 00080 const CaloCellGeometry::CornersVec& corners = cell->getCorners (); 00081 const GlobalPoint& pos = cell->getPosition (); 00082 float energy = (*it).energy (); 00083 float eta = pos.eta (); 00084 float phi = pos.phi (); 00085 00086 IgCollectionItem irechit = recHits.create(); 00087 irechit[E] = static_cast<double>(energy); 00088 irechit[ETA] = static_cast<double>(eta); 00089 irechit[PHI] = static_cast<double>(phi); 00090 irechit[DETID] = static_cast<int>((*it).detid ()); 00091 irechit[FRONT_1] = IgV3d(static_cast<double>(corners[0].x()/100.0), 00092 static_cast<double>(corners[0].y()/100.0), 00093 static_cast<double>(corners[0].z()/100.0)); 00094 irechit[FRONT_2] = IgV3d(static_cast<double>(corners[1].x()/100.0), 00095 static_cast<double>(corners[1].y()/100.0), 00096 static_cast<double>(corners[1].z()/100.0)); 00097 irechit[FRONT_3] = IgV3d(static_cast<double>(corners[2].x()/100.0), 00098 static_cast<double>(corners[2].y()/100.0), 00099 static_cast<double>(corners[2].z()/100.0)); 00100 irechit[FRONT_4] = IgV3d(static_cast<double>(corners[3].x()/100.0), 00101 static_cast<double>(corners[3].y()/100.0), 00102 static_cast<double>(corners[3].z()/100.0)); 00103 00104 irechit[BACK_1] = IgV3d(static_cast<double>(corners[4].x()/100.0), 00105 static_cast<double>(corners[4].y()/100.0), 00106 static_cast<double>(corners[4].z()/100.0)); 00107 irechit[BACK_2] = IgV3d(static_cast<double>(corners[5].x()/100.0), 00108 static_cast<double>(corners[5].y()/100.0), 00109 static_cast<double>(corners[5].z()/100.0)); 00110 irechit[BACK_3] = IgV3d(static_cast<double>(corners[6].x()/100.0), 00111 static_cast<double>(corners[6].y()/100.0), 00112 static_cast<double>(corners[6].z()/100.0)); 00113 irechit[BACK_4] = IgV3d(static_cast<double>(corners[7].x()/100.0), 00114 static_cast<double>(corners[7].y()/100.0), 00115 static_cast<double>(corners[7].z()/100.0)); 00116 } 00117 } 00118 } 00119 else 00120 { 00121 // friendlyName:moduleLabel:instanceName:processName 00122 std::string error = "### Error: HERecHits " 00123 + edm::TypeID (typeid (HBHERecHitCollection)).friendlyClassName () + ":" 00124 + inputTag_.label() + ":" 00125 + inputTag_.instance() + ":" 00126 + inputTag_.process() + " are not found."; 00127 00128 IgDataStorage *storage = config->storage (); 00129 IgCollection &collection = storage->getCollection ("Errors_V1"); 00130 IgProperty ERROR_MSG = collection.addProperty ("Error", std::string ()); 00131 IgCollectionItem item = collection.create (); 00132 item [ERROR_MSG] = error; 00133 } 00134 }
edm::InputTag VisHERecHit::inputTag_ [private] |