CMS 3D CMS Logo

Public Member Functions | Private Attributes | Static Private Attributes

DTRecHitProducer Class Reference

#include <DTRecHitProducer.h>

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

List of all members.

Public Member Functions

 DTRecHitProducer (const edm::ParameterSet &)
 Constructor.
virtual void produce (edm::Event &event, const edm::EventSetup &setup)
 The method which produces the rechits.
virtual ~DTRecHitProducer ()
 Destructor.

Private Attributes

DTRecHitBaseAlgotheAlgo
edm::InputTag theDTDigiLabel

Static Private Attributes

static bool debug

Detailed Description

Module for 1D DTRecHitPairs production. The concrete reconstruction algorithm is specified with the parameter "recAlgo" and must be configured with the "recAlgoConfig" parameter set.

Date:
2010/02/20 21:00:58
Revision:
1.3
Author:
G. Cerminara

Definition at line 25 of file DTRecHitProducer.h.


Constructor & Destructor Documentation

DTRecHitProducer::DTRecHitProducer ( const edm::ParameterSet config)

Constructor.

Definition at line 35 of file DTRecHitProducer.cc.

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

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

  if(debug)
    cout << "[DTRecHitProducer] Constructor called" << endl;
  
  produces<DTRecHitCollection>();

  theDTDigiLabel = config.getParameter<InputTag>("dtDigiLabel");
  
  // Get the concrete reconstruction algo from the factory
  string theAlgoName = config.getParameter<string>("recAlgo");
  theAlgo = DTRecHitAlgoFactory::get()->create(theAlgoName,
                                               config.getParameter<ParameterSet>("recAlgoConfig"));
}
DTRecHitProducer::~DTRecHitProducer ( ) [virtual]

Destructor.

Definition at line 52 of file DTRecHitProducer.cc.

References gather_cfg::cout, and debug.

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

Member Function Documentation

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

The method which produces the rechits.

Implements edm::EDProducer.

Definition at line 60 of file DTRecHitProducer.cc.

References edm::OwnVector< T, P >::begin(), gather_cfg::cout, debug, edm::OwnVector< T, P >::end(), edm::EventSetup::get(), and edm::OwnVector< T, P >::size().

                                                                    {
  // Get the DT Geometry
  ESHandle<DTGeometry> dtGeom;
  setup.get<MuonGeometryRecord>().get(dtGeom);

  // Get the digis from the event
  Handle<DTDigiCollection> digis; 
  event.getByLabel(theDTDigiLabel, digis);

  // Pass the EventSetup to the algo
  theAlgo->setES(setup);

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


  // Iterate through all digi collections ordered by LayerId   
  DTDigiCollection::DigiRangeIterator dtLayerIt;
  for (dtLayerIt = digis->begin();
           dtLayerIt != digis->end();
           ++dtLayerIt){
    // The layerId
    const DTLayerId& layerId = (*dtLayerIt).first;
    // Get the GeomDet from the setup
    const DTLayer* layer = dtGeom->layer(layerId);

    // Get the iterators over the digis associated with this LayerId
    const DTDigiCollection::Range& range = (*dtLayerIt).second;
    
    OwnVector<DTRecHit1DPair> recHits =
      theAlgo->reconstruct(layer, layerId, range);
    
    if(debug)
      cout << "Number of hits in this layer: " << recHits.size() << endl;
    if(recHits.size() > 0) //FIXME: is it really needed?
      recHitCollection->put(layerId, recHits.begin(), recHits.end());
  }

  event.put(recHitCollection);
}

Member Data Documentation

bool DTRecHitProducer::debug [static, private]

Definition at line 38 of file DTRecHitProducer.h.

Definition at line 42 of file DTRecHitProducer.h.

Definition at line 40 of file DTRecHitProducer.h.