#include <RecoLocalMuon/DTSegment/src/DTRecSegment2DProducer.h>
Public Member Functions | |
DTRecSegment2DProducer (const edm::ParameterSet &) | |
Constructor. | |
virtual void | produce (edm::Event &event, const edm::EventSetup &setup) |
The method which produces the 2D-segments. | |
virtual | ~DTRecSegment2DProducer () |
Destructor. | |
Private Attributes | |
bool | debug |
DTRecSegment2DBaseAlgo * | theAlgo |
edm::InputTag | theRecHits1DLabel |
Definition at line 33 of file DTRecSegment2DProducer.h.
DTRecSegment2DProducer::DTRecSegment2DProducer | ( | const edm::ParameterSet & | pset | ) |
Constructor.
Definition at line 38 of file DTRecSegment2DProducer.cc.
References GenMuonPlsPt100GeV_cfg::cout, debug, lat::endl(), DBSPlugin::get(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), theAlgo, and theRecHits1DLabel.
00038 { 00039 // Set verbose output 00040 debug = pset.getUntrackedParameter<bool>("debug"); 00041 00042 // the name of the 1D rec hits collection 00043 theRecHits1DLabel = pset.getParameter<InputTag>("recHits1DLabel"); 00044 00045 if(debug) 00046 cout << "[DTRecSegment2DProducer] Constructor called" << endl; 00047 00048 produces<DTRecSegment2DCollection>(); 00049 00050 // Get the concrete reconstruction algo from the factory 00051 string theAlgoName = pset.getParameter<string>("Reco2DAlgoName"); 00052 if(debug) cout << "the Reco2D AlgoName is " << theAlgoName << endl; 00053 theAlgo = DTRecSegment2DAlgoFactory::get()->create(theAlgoName, 00054 pset.getParameter<ParameterSet>("Reco2DAlgoConfig")); 00055 }
DTRecSegment2DProducer::~DTRecSegment2DProducer | ( | ) | [virtual] |
Destructor.
Definition at line 58 of file DTRecSegment2DProducer.cc.
References GenMuonPlsPt100GeV_cfg::cout, debug, lat::endl(), and theAlgo.
00058 { 00059 if(debug) 00060 cout << "[DTRecSegment2DProducer] Destructor called" << endl; 00061 delete theAlgo; 00062 }
void DTRecSegment2DProducer::produce | ( | edm::Event & | event, | |
const edm::EventSetup & | setup | |||
) | [virtual] |
The method which produces the 2D-segments.
Implements edm::EDProducer.
Definition at line 65 of file DTRecSegment2DProducer.cc.
References edm::OwnVector< T, P >::begin(), GenMuonPlsPt100GeV_cfg::cout, debug, edm::OwnVector< T, P >::end(), lat::endl(), edm::EventSetup::get(), DTRangeMapAccessor::layersBySuperLayer(), mergeAndRegister_online::pairs, range, DTRecSegment2DBaseAlgo::reconstruct(), DTRecSegment2DBaseAlgo::setES(), edm::OwnVector< T, P >::size(), sl, DTLayerId::superlayerId(), theAlgo, and theRecHits1DLabel.
00066 { 00067 if(debug) 00068 cout << "[DTRecSegment2DProducer] produce called" << endl; 00069 // Get the DT Geometry 00070 ESHandle<DTGeometry> dtGeom; 00071 setup.get<MuonGeometryRecord>().get(dtGeom); 00072 00073 theAlgo->setES(setup); 00074 00075 // Get the 1D rechits from the event 00076 Handle<DTRecHitCollection> allHits; 00077 event.getByLabel(theRecHits1DLabel, allHits); 00078 00079 // Create the pointer to the collection which will store the rechits 00080 auto_ptr<DTRecSegment2DCollection> segments(new DTRecSegment2DCollection()); 00081 00082 // Iterate through all hit collections ordered by LayerId 00083 DTRecHitCollection::id_iterator dtLayerIt; 00084 DTSuperLayerId oldSlId; 00085 for (dtLayerIt = allHits->id_begin(); dtLayerIt != allHits->id_end(); ++dtLayerIt){ 00086 // The layerId 00087 DTLayerId layerId = (*dtLayerIt); 00088 const DTSuperLayerId SLId = layerId.superlayerId(); 00089 if (SLId==oldSlId) continue; // I'm on the same SL as before 00090 oldSlId = SLId; 00091 00092 if(debug) cout <<"Reconstructing the 2D segments in "<< SLId << endl; 00093 00094 const DTSuperLayer* sl = dtGeom->superLayer(SLId); 00095 00096 // Get all the rec hit in the same superLayer in which layerId relies 00097 DTRecHitCollection::range range = 00098 allHits->get(DTRangeMapAccessor::layersBySuperLayer(SLId)); 00099 00100 // Fill the vector with the 1D RecHit 00101 vector<DTRecHit1DPair> pairs(range.first,range.second); 00102 00103 if(debug) cout << "Number of 1D-RecHit pairs " << pairs.size() << endl; 00104 00105 if(debug) cout << "Start the 2D-segments Reco "<< endl; 00106 OwnVector<DTSLRecSegment2D> segs = theAlgo->reconstruct(sl, pairs); 00107 if(debug) cout << "Number of Reconstructed segments: " << segs.size() << endl; 00108 00109 if (segs.size() > 0 ) 00110 segments->put(SLId, segs.begin(),segs.end()); 00111 } 00112 event.put(segments); 00113 }
bool DTRecSegment2DProducer::debug [private] |
Definition at line 52 of file DTRecSegment2DProducer.h.
Referenced by DTRecSegment2DProducer(), produce(), and ~DTRecSegment2DProducer().
Definition at line 55 of file DTRecSegment2DProducer.h.
Referenced by DTRecSegment2DProducer(), produce(), and ~DTRecSegment2DProducer().
Definition at line 58 of file DTRecSegment2DProducer.h.
Referenced by DTRecSegment2DProducer(), and produce().