CMS 3D CMS Logo

Public Member Functions | Private Attributes

DTRecSegment4DProducer Class Reference

#include <DTRecSegment4DProducer.h>

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

List of all members.

Public Member Functions

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

Private Attributes

bool debug
DTRecSegment4DBaseAlgothe4DAlgo
edm::InputTag theRecHits1DLabel
edm::InputTag theRecHits2DLabel

Detailed Description

Builds the segments in the DT chambers.

Date:
2008/12/03 12:52:22
Revision:
1.11
Author:
Riccardo Bellan - INFN Torino <riccardo.bellan@cern.ch>

Builds the segments in the DT chambers.

Date:
2010/02/16 17:08:19
Revision:
1.5
Author:
Riccardo Bellan - INFN Torino <riccardo.bellan@cern.ch>

Definition at line 22 of file DTRecSegment4DProducer.h.


Constructor & Destructor Documentation

DTRecSegment4DProducer::DTRecSegment4DProducer ( const edm::ParameterSet pset)

Constructor.

Definition at line 29 of file DTRecSegment4DProducer.cc.

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

                                                                      {
  produces<DTRecSegment4DCollection>();
  
  // debug parameter
  debug = pset.getUntrackedParameter<bool>("debug"); 
  
  if(debug)
    cout << "[DTRecSegment4DProducer] Constructor called" << endl;
  
  // the name of the 1D rec hits collection
  theRecHits1DLabel = pset.getParameter<InputTag>("recHits1DLabel");
  
  // the name of the 2D rec hits collection
  theRecHits2DLabel = pset.getParameter<InputTag>("recHits2DLabel");
  
  // Get the concrete 4D-segments reconstruction algo from the factory
  string theReco4DAlgoName = pset.getParameter<string>("Reco4DAlgoName");
  if(debug) cout << "the Reco4D AlgoName is " << theReco4DAlgoName << endl;
  the4DAlgo = DTRecSegment4DAlgoFactory::get()->create(theReco4DAlgoName,
                                                       pset.getParameter<ParameterSet>("Reco4DAlgoConfig"));
}
DTRecSegment4DProducer::~DTRecSegment4DProducer ( ) [virtual]

Destructor.

Definition at line 52 of file DTRecSegment4DProducer.cc.

References gather_cfg::cout, and debug.

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

Member Function Documentation

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

The method which produces the 4D rec segments.

Implements edm::EDProducer.

Definition at line 58 of file DTRecSegment4DProducer.cc.

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

                                                                         {

  // Get the 1D rechits from the event
  Handle<DTRecHitCollection> all1DHits; 
  event.getByLabel(theRecHits1DLabel,all1DHits);
  
  // Get the 2D rechits from the event
  Handle<DTRecSegment2DCollection> all2DSegments;
  if(the4DAlgo->wants2DSegments())
    event.getByLabel(theRecHits2DLabel, all2DSegments);

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

  // get the geometry
  ESHandle<DTGeometry> theGeom;
  setup.get<MuonGeometryRecord>().get(theGeom);

  // Percolate the setup
  the4DAlgo->setES(setup);

  // Iterate over all hit collections ordered by layerId
  DTRecHitCollection::id_iterator dtLayerIt;

  DTChamberId oldChId;

  for (dtLayerIt = all1DHits->id_begin(); dtLayerIt != all1DHits->id_end(); ++dtLayerIt){

    // Check the DTChamberId
    const DTChamberId chId = (*dtLayerIt).chamberId();
    if (chId==oldChId) continue; // I'm on the same Chamber as before
    oldChId = chId;
    if(debug) cout << "ChamberId: "<< chId << endl;
    the4DAlgo->setChamber(chId);

    if(debug) cout<<"Take the DTRecHits1D and set them in the reconstructor"<<endl;

    the4DAlgo->setDTRecHit1DContainer(all1DHits);

    if(debug) cout<<"Take the DTRecSegments2D and set them in the reconstructor"<<endl;

    the4DAlgo->setDTRecSegment2DContainer(all2DSegments);

    if(debug) cout << "Start 4D-Segments Reco " << endl;
    
    OwnVector<DTRecSegment4D> segments4D = the4DAlgo->reconstruct();
    
    if(debug) {
      cout << "Number of reconstructed 4D-segments " << segments4D.size() << endl;
      copy(segments4D.begin(), segments4D.end(),
           ostream_iterator<DTRecSegment4D>(cout, "\n"));
    }

    if (segments4D.size() > 0 )
      // convert the OwnVector into a Collection
      segments4DCollection->put(chId, segments4D.begin(),segments4D.end());
  }
  // Load the output in the Event
  event.put(segments4DCollection);
}

Member Data Documentation

Definition at line 41 of file DTRecSegment4DProducer.h.

Definition at line 47 of file DTRecSegment4DProducer.h.

Definition at line 43 of file DTRecSegment4DProducer.h.

Definition at line 45 of file DTRecSegment4DProducer.h.