![]() |
![]() |
#include <VisReco/Analyzer/interface/VisDTRecHit.h>
Public Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
VisDTRecHit (const edm::ParameterSet &) | |
virtual | ~VisDTRecHit (void) |
Private Attributes | |
edm::InputTag | inputTag_ |
Definition at line 8 of file VisDTRecHit.h.
VisDTRecHit::VisDTRecHit | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 22 of file VisDTRecHit.cc.
00023 : inputTag_(iConfig.getParameter<edm::InputTag>("visDTRecHitTag")) 00024 {}
virtual VisDTRecHit::~VisDTRecHit | ( | void | ) | [inline, virtual] |
void VisDTRecHit::analyze | ( | const edm::Event & | event, | |
const edm::EventSetup & | eventSetup | |||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 26 of file VisDTRecHit.cc.
References IgCollection::addProperty(), DTTopology::cellLenght(), collection, edmplugin::standard::config(), IgCollection::create(), error, Exception, edm::EventSetup::get(), IgDataStorage::getCollection(), inputTag_, edm::InputTag::instance(), edm::Service< T >::isAvailable(), edm::Handle< T >::isValid(), edm::ESHandle< T >::isValid(), edm::InputTag::label(), DTRecHit1D::localPosition(), edm::InputTag::process(), DTLayer::specificTopology(), GeomDet::toGlobal(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
00027 { 00028 edm::Service<IguanaService> config; 00029 if (! config.isAvailable ()) 00030 { 00031 throw cms::Exception ("Configuration") 00032 << "VisDTRecHit requires the IguanaService\n" 00033 "which is not present in the configuration file.\n" 00034 "You must add the service in the configuration file\n" 00035 "or remove the module that requires it"; 00036 } 00037 00038 edm::ESHandle<DTGeometry> geom; 00039 eventSetup.get<MuonGeometryRecord>().get(geom); 00040 00041 edm::Handle<DTRecHitCollection> collection; 00042 event.getByLabel (inputTag_, collection); 00043 00044 if ( collection.isValid () && geom.isValid ()) 00045 { 00046 IgDataStorage* storage = config->storage(); 00047 IgCollection& recHits = storage->getCollection("DTRecHits_V1"); 00048 00049 IgProperty WIRE_ID = recHits.addProperty("wireId", int(0)); 00050 IgProperty LAYER_ID = recHits.addProperty("layerId", int(0)); 00051 IgProperty SUPERLAYER_ID = recHits.addProperty("superLayerId", int(0)); 00052 IgProperty SECTOR_ID = recHits.addProperty("sectorId", int(0)); 00053 IgProperty STATION_ID = recHits.addProperty("stationId", int(0)); 00054 IgProperty WHEEL_ID = recHits.addProperty("wheelId", int(0)); 00055 IgProperty DIGITIME = recHits.addProperty("digitime", 0.0); 00056 00057 IgProperty LPLUS_GLOBALPOS = recHits.addProperty("lPlusGlobalPos", IgV3d()); 00058 IgProperty LMINUS_GLOBALPOS = recHits.addProperty("lMinusGlobalPos", IgV3d()); 00059 IgProperty RPLUS_GLOBALPOS = recHits.addProperty("rPlusGlobalPos", IgV3d()); 00060 IgProperty RMINUS_GLOBALPOS = recHits.addProperty("rMinusGlobalPos", IgV3d()); 00061 IgProperty LGLOBALPOS = recHits.addProperty("lGlobalPos", IgV3d()); 00062 IgProperty RGLOBALPOS = recHits.addProperty("rGlobalPos", IgV3d()); 00063 00064 for ( DTRecHitCollection::const_iterator dit = collection->begin(); 00065 dit != collection->end(); ++dit ) 00066 { 00067 IgCollectionItem recHit = recHits.create(); 00068 00069 const DTRecHit1D* lrechit = (*dit).componentRecHit(Left); 00070 const DTRecHit1D* rrechit = (*dit).componentRecHit(Right); 00071 00072 int wireId = (*dit).wireId().wire(); 00073 recHit[WIRE_ID] = static_cast<int>(wireId); 00074 00075 int layerId = (*dit).wireId().layerId().layer(); 00076 recHit[LAYER_ID] = static_cast<int>(layerId); 00077 00078 int superLayerId = (*dit).wireId().layerId().superlayerId().superLayer(); 00079 recHit[SUPERLAYER_ID] = static_cast<int>(superLayerId); 00080 00081 int sectorId = (*dit).wireId().layerId().superlayerId().chamberId().sector(); 00082 recHit[SECTOR_ID] = static_cast<int>(sectorId); 00083 00084 int stationId = (*dit).wireId().layerId().superlayerId().chamberId().station(); 00085 recHit[STATION_ID] = static_cast<int>(stationId); 00086 00087 int wheelId = (*dit).wireId().layerId().superlayerId().chamberId().wheel(); 00088 recHit[WHEEL_ID] = static_cast<int>(wheelId); 00089 00090 double digitime = (*dit).digiTime(); 00091 recHit[DIGITIME] = static_cast<double>(digitime); 00092 00093 const DTLayer* layer = geom->layer((*dit).wireId()); 00094 const DTTopology& topo = layer->specificTopology(); 00095 00096 LocalPoint lLocalPos = lrechit->localPosition(); 00097 LocalPoint rLocalPos = rrechit->localPosition(); 00098 00099 LocalPoint yPlusLeft(lLocalPos.x(),topo.cellLenght()/2.,0.); 00100 LocalPoint yMinusLeft(lLocalPos.x(),-topo.cellLenght()/2.,0.); 00101 LocalPoint yPlusRight(rLocalPos.x(),topo.cellLenght()/2.,0.); 00102 LocalPoint yMinusRight(rLocalPos.x(),-topo.cellLenght()/2.,0.); 00103 00104 GlobalPoint lPlusGlobalPos = layer->toGlobal(yPlusLeft); 00105 GlobalPoint lMinusGlobalPos = layer->toGlobal(yMinusLeft); 00106 GlobalPoint rPlusGlobalPos = layer->toGlobal(yPlusRight); 00107 GlobalPoint rMinusGlobalPos = layer->toGlobal(yMinusRight); 00108 00109 GlobalPoint lGlobalPos = layer->toGlobal(lLocalPos); 00110 GlobalPoint rGlobalPos = layer->toGlobal(rLocalPos); 00111 00112 recHit[LPLUS_GLOBALPOS] = IgV3d(static_cast<double>(lPlusGlobalPos.x()/100.0), 00113 static_cast<double>(lPlusGlobalPos.y()/100.0), 00114 static_cast<double>(lPlusGlobalPos.z()/100.0)); 00115 00116 recHit[LMINUS_GLOBALPOS] = IgV3d(static_cast<double>(lMinusGlobalPos.x()/100.0), 00117 static_cast<double>(lMinusGlobalPos.y()/100.0), 00118 static_cast<double>(lMinusGlobalPos.z()/100.0)); 00119 00120 recHit[RPLUS_GLOBALPOS] = IgV3d(static_cast<double>(rPlusGlobalPos.x()/100.0), 00121 static_cast<double>(rPlusGlobalPos.y()/100.0), 00122 static_cast<double>(rPlusGlobalPos.z()/100.0)); 00123 00124 recHit[RMINUS_GLOBALPOS] = IgV3d(static_cast<double>(rMinusGlobalPos.x()/100.0), 00125 static_cast<double>(rMinusGlobalPos.y()/100.0), 00126 static_cast<double>(rMinusGlobalPos.z()/100.0)); 00127 00128 recHit[LGLOBALPOS] = IgV3d(static_cast<double>(lGlobalPos.x()/100.0), 00129 static_cast<double>(lGlobalPos.y()/100.0), 00130 static_cast<double>(lGlobalPos.z()/100.0)); 00131 00132 recHit[RGLOBALPOS] = IgV3d(static_cast<double>(rGlobalPos.x()/100.0), 00133 static_cast<double>(rGlobalPos.y()/100.0), 00134 static_cast<double>(rGlobalPos.z()/100.0)); 00135 } 00136 00137 } 00138 00139 else 00140 { 00141 // friendlyName:moduleLabel:instanceName:processName 00142 std::string error = "### Error: DTRecHits " 00143 + edm::TypeID (typeid (DTRecHitCollection)).friendlyClassName () + ":" 00144 + inputTag_.label() + ":" 00145 + inputTag_.instance() + ":" 00146 + inputTag_.process() + " are not found."; 00147 00148 IgDataStorage *storage = config->storage (); 00149 IgCollection &collection = storage->getCollection ("Errors_V1"); 00150 IgProperty ERROR_MSG = collection.addProperty ("Error", std::string ()); 00151 IgCollectionItem item = collection.create (); 00152 item [ERROR_MSG] = error; 00153 } 00154 }
edm::InputTag VisDTRecHit::inputTag_ [private] |