CMS 3D CMS Logo

Public Member Functions | Private Attributes

DTRecSegment2DProducer Class Reference

#include <DTRecSegment2DProducer.h>

Inheritance diagram for DTRecSegment2DProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

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
DTRecSegment2DBaseAlgotheAlgo
edm::InputTag theRecHits1DLabel

Detailed Description

Producer for DT segment in one projection.

Date:
2010/02/16 17:08:18
Revision:
1.8
Author:
Stefano Lacaprara - INFN Legnaro <stefano.lacaprara@pd.infn.it>
Riccardo Bellan - INFN TO <riccardo.bellan@cern.ch>

Definition at line 33 of file DTRecSegment2DProducer.h.


Constructor & Destructor Documentation

DTRecSegment2DProducer::DTRecSegment2DProducer ( const edm::ParameterSet pset)

Constructor.

Definition at line 38 of file DTRecSegment2DProducer.cc.

References gather_cfg::cout, debug, reco::get(), edm::ParameterSet::getParameter(), and edm::ParameterSet::getUntrackedParameter().

                                                                          {
  // Set verbose output
  debug = pset.getUntrackedParameter<bool>("debug"); 

  // the name of the 1D rec hits collection
  theRecHits1DLabel = pset.getParameter<InputTag>("recHits1DLabel");

  if(debug)
    cout << "[DTRecSegment2DProducer] Constructor called" << endl;

  produces<DTRecSegment2DCollection>();

  // Get the concrete reconstruction algo from the factory
  string theAlgoName = pset.getParameter<string>("Reco2DAlgoName");
  if(debug) cout << "the Reco2D AlgoName is " << theAlgoName << endl;
  theAlgo = DTRecSegment2DAlgoFactory::get()->create(theAlgoName,
                                                     pset.getParameter<ParameterSet>("Reco2DAlgoConfig"));
}
DTRecSegment2DProducer::~DTRecSegment2DProducer ( ) [virtual]

Destructor.

Definition at line 58 of file DTRecSegment2DProducer.cc.

References gather_cfg::cout, and debug.

                                                {
  if(debug)
    cout << "[DTRecSegment2DProducer] Destructor called" << endl;
  delete theAlgo;
}

Member Function Documentation

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(), gather_cfg::cout, debug, edm::OwnVector< T, P >::end(), edm::EventSetup::get(), DTRangeMapAccessor::layersBySuperLayer(), edm::OwnVector< T, P >::size(), and DTLayerId::superlayerId().

                                                           {
  if(debug)
    cout << "[DTRecSegment2DProducer] produce called" << endl;
  // Get the DT Geometry
  ESHandle<DTGeometry> dtGeom;
  setup.get<MuonGeometryRecord>().get(dtGeom);

  theAlgo->setES(setup);
  
  // Get the 1D rechits from the event
  Handle<DTRecHitCollection> allHits; 
  event.getByLabel(theRecHits1DLabel, allHits);

  // Create the pointer to the collection which will store the rechits
  auto_ptr<DTRecSegment2DCollection> segments(new DTRecSegment2DCollection());

  // Iterate through all hit collections ordered by LayerId
  DTRecHitCollection::id_iterator dtLayerIt;
  DTSuperLayerId oldSlId;
  for (dtLayerIt = allHits->id_begin(); dtLayerIt != allHits->id_end(); ++dtLayerIt){
    // The layerId
    DTLayerId layerId = (*dtLayerIt);
    const DTSuperLayerId SLId = layerId.superlayerId();
    if (SLId==oldSlId) continue; // I'm on the same SL as before
    oldSlId = SLId;

    if(debug) cout <<"Reconstructing the 2D segments in "<< SLId << endl;

    const DTSuperLayer* sl = dtGeom->superLayer(SLId);

    // Get all the rec hit in the same superLayer in which layerId relies 
    DTRecHitCollection::range range =
      allHits->get(DTRangeMapAccessor::layersBySuperLayer(SLId));

    // Fill the vector with the 1D RecHit
    vector<DTRecHit1DPair> pairs(range.first,range.second);

    if(debug) cout << "Number of 1D-RecHit pairs " << pairs.size() << endl;

    if(debug) cout << "Start the 2D-segments Reco "<< endl;
    OwnVector<DTSLRecSegment2D> segs = theAlgo->reconstruct(sl, pairs);
    if(debug) cout << "Number of Reconstructed segments: " << segs.size() << endl;

    if (segs.size() > 0 )
      segments->put(SLId, segs.begin(),segs.end());
  }
  event.put(segments);
}

Member Data Documentation

Definition at line 52 of file DTRecSegment2DProducer.h.

Definition at line 55 of file DTRecSegment2DProducer.h.

Definition at line 58 of file DTRecSegment2DProducer.h.