CMS 3D CMS Logo

Public Member Functions | Private Attributes

DTRecSegment2DExtendedProducer Class Reference

#include <DTRecSegment2DExtendedProducer.h>

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

List of all members.

Public Member Functions

 DTRecSegment2DExtendedProducer (const edm::ParameterSet &)
 Constructor.
virtual void produce (edm::Event &event, const edm::EventSetup &setup)
 The method which produces the 2D-segments.
virtual ~DTRecSegment2DExtendedProducer ()
 Destructor.

Private Attributes

bool debug
DTCombinatorialExtendedPatternRecotheAlgo
edm::InputTag theRecClusLabel
edm::InputTag theRecHits1DLabel

Detailed Description

Producer for DT segment in one projection.

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

Definition at line 33 of file DTRecSegment2DExtendedProducer.h.


Constructor & Destructor Documentation

DTRecSegment2DExtendedProducer::DTRecSegment2DExtendedProducer ( const edm::ParameterSet pset)

Constructor.

Definition at line 38 of file DTRecSegment2DExtendedProducer.cc.

References gather_cfg::cout, debug, 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");
  theRecClusLabel = pset.getParameter<InputTag>("recClusLabel");

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

  produces<DTRecSegment2DCollection>();

  // Get the concrete reconstruction algo from the factory
  theAlgo = new DTCombinatorialExtendedPatternReco(pset.getParameter<ParameterSet>("Reco2DAlgoConfig"));
}
DTRecSegment2DExtendedProducer::~DTRecSegment2DExtendedProducer ( ) [virtual]

Destructor.

Definition at line 56 of file DTRecSegment2DExtendedProducer.cc.

References gather_cfg::cout, and debug.

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

Member Function Documentation

void DTRecSegment2DExtendedProducer::produce ( edm::Event event,
const edm::EventSetup setup 
) [virtual]

The method which produces the 2D-segments.

Implements edm::EDProducer.

Definition at line 63 of file DTRecSegment2DExtendedProducer.cc.

References edm::OwnVector< T, P >::begin(), filterCSVwithJSON::copy, 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 << "[DTRecSegment2DExtendedProducer] 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);

  // Get the 1D clusters from the event
  Handle<DTRecClusterCollection> dtClusters; 
  event.getByLabel(theRecClusLabel, dtClusters);
  theAlgo->setClusters(vector<DTSLRecCluster>(dtClusters->begin(),
                                              dtClusters->end()));

  // 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;
      copy(segs.begin(), segs.end(),
           ostream_iterator<DTSLRecSegment2D>(cout, "\n"));
    }

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

Member Data Documentation

Definition at line 52 of file DTRecSegment2DExtendedProducer.h.

Definition at line 55 of file DTRecSegment2DExtendedProducer.h.

Definition at line 59 of file DTRecSegment2DExtendedProducer.h.

Definition at line 58 of file DTRecSegment2DExtendedProducer.h.