#include <VisReco/Analyzer/interface/VisDTRecSegment4D.h>
Public Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
VisDTRecSegment4D (const edm::ParameterSet &) | |
virtual | ~VisDTRecSegment4D (void) |
Private Attributes | |
edm::InputTag | inputTag_ |
Definition at line 18 of file VisDTRecSegment4D.h.
VisDTRecSegment4D::VisDTRecSegment4D | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 30 of file VisDTRecSegment4D.cc.
00031 : inputTag_ (iConfig.getParameter<edm::InputTag>("visDTRecSegment4DTag")) 00032 {}
virtual VisDTRecSegment4D::~VisDTRecSegment4D | ( | void | ) | [inline, virtual] |
void VisDTRecSegment4D::analyze | ( | const edm::Event & | event, | |
const edm::EventSetup & | eventSetup | |||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 35 of file VisDTRecSegment4D.cc.
References IgCollection::addProperty(), collection, edmplugin::standard::config(), funct::cos(), IgCollection::create(), end, error, Exception, edm::EventSetup::get(), IgDataStorage::getCollection(), inputTag_, edm::InputTag::instance(), edm::Service< T >::isAvailable(), edm::Handle< T >::isValid(), edm::ESHandle< T >::isValid(), it, edm::InputTag::label(), PV3DBase< T, PVType, FrameType >::mag(), edm::InputTag::process(), PV3DBase< T, PVType, FrameType >::theta(), PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), y, PV3DBase< T, PVType, FrameType >::z(), and z.
00036 { 00037 edm::Service<IguanaService> config; 00038 if (! config.isAvailable ()) 00039 { 00040 throw cms::Exception ("Configuration") 00041 << "VisDTRecSegment4D requires the IguanaService\n" 00042 "which is not present in the configuration file.\n" 00043 "You must add the service in the configuration file\n" 00044 "or remove the module that requires it"; 00045 } 00046 00047 edm::Handle<DTRecSegment4DCollection> collection; 00048 event.getByLabel (inputTag_, collection); 00049 00050 edm::ESHandle<DTGeometry> geom; 00051 eventSetup.get<MuonGeometryRecord> ().get (geom); 00052 00053 if (collection.isValid () && geom.isValid ()) 00054 { 00055 IgDataStorage *storage = config->storage (); 00056 IgCollection &segments = storage->getCollection ("DTRecSegment4D_V1"); 00057 IgProperty DET_ID = segments.addProperty ("detid", int (0)); 00058 IgProperty POS_1 = segments.addProperty ("pos_1", IgV3d()); 00059 IgProperty POS_2 = segments.addProperty ("pos_2", IgV3d()); 00060 00061 IgProperty SECTOR_ID = segments.addProperty("sectorId", int(0)); 00062 IgProperty STATION_ID = segments.addProperty("stationId", int(0)); 00063 IgProperty WHEEL_ID = segments.addProperty("wheelId", int(0)); 00064 00065 DTRecSegment4DCollection::const_iterator it = collection->begin (); 00066 DTRecSegment4DCollection::const_iterator end = collection->end (); 00067 for (; it != end; ++it) 00068 { 00069 DTChamberId chId ((*it).geographicalId ().rawId ()); 00070 const DTChamber *chamber = geom->chamber (chId); 00071 00072 float halfHeight = chamber->surface ().bounds ().thickness () / 2.0; 00073 // float halfWidth = chamber->surface ().bounds ().width () / 2.0; 00074 LocalVector locDir = (*it).localDirection (); 00075 LocalPoint locPos = (*it).localPosition (); 00076 00077 GlobalPoint posInner = chamber->toGlobal (locPos + locDir / locDir.mag () * halfHeight / cos (locDir.theta ())); 00078 float x = posInner.x () / 100.0; // cm -> m 00079 float y = posInner.y () / 100.0; // cm -> m 00080 float z = posInner.z () / 100.0; // cm -> m 00081 00082 IgCollectionItem isegment = segments.create (); 00083 isegment[DET_ID] = static_cast<int> ((*it).geographicalId ().rawId ()); 00084 isegment[POS_1] = IgV3d(static_cast<double>(x), static_cast<double>(y), static_cast<double>(z)); 00085 00086 GlobalPoint posOuter = chamber->toGlobal (locPos + locDir / (-locDir.mag ()) * halfHeight / cos (locDir.theta ())); 00087 x = posOuter.x () / 100.0; // cm -> m 00088 y = posOuter.y () / 100.0; // cm -> m 00089 z = posOuter.z () / 100.0; // cm -> m 00090 isegment[POS_2] = IgV3d(static_cast<double>(x), static_cast<double>(y), static_cast<double>(z)); 00091 00092 isegment[SECTOR_ID] = static_cast<int>(chId.sector()); 00093 isegment[STATION_ID] = static_cast<int>(chId.station()); 00094 isegment[WHEEL_ID] = static_cast<int>(chId.wheel()); 00095 } 00096 } 00097 else 00098 { 00099 // friendlyName:moduleLabel:instanceName:processName 00100 std::string error = "### Error: DTRecSegment4Ds " 00101 + edm::TypeID (typeid (DTRecSegment4DCollection)).friendlyClassName () + ":" 00102 + inputTag_.label() + ":" 00103 + inputTag_.instance() + ":" 00104 + inputTag_.process() + " are not found."; 00105 00106 IgDataStorage *storage = config->storage (); 00107 IgCollection &collection = storage->getCollection ("Errors_V1"); 00108 IgProperty ERROR_MSG = collection.addProperty ("Error", std::string ()); 00109 IgCollectionItem item = collection.create (); 00110 item [ERROR_MSG] = error; 00111 } 00112 }
edm::InputTag VisDTRecSegment4D::inputTag_ [private] |