CMS 3D CMS Logo

Public Member Functions | Private Attributes

DTSegment4DT0Corrector Class Reference

#include <DTSegment4DT0Corrector.h>

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

List of all members.

Public Member Functions

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

Private Attributes

bool debug
edm::InputTag theRecHits4DLabel
DTSegmentUpdatortheUpdator

Detailed Description

Builds the segments in the DT chambers.

Date:
2009/03/10 16:09:13
Revision:
1.2
Author:
Mario Pelliccioni - INFN Torino <pellicci@cern.ch>

Builds the segments in the DT chambers.

Date:
2010/02/16 17:08:20
Revision:
1.2
Author:
Mario Pelliccioni - INFN Torino <pellicci@cern.ch>

Definition at line 22 of file DTSegment4DT0Corrector.h.


Constructor & Destructor Documentation

DTSegment4DT0Corrector::DTSegment4DT0Corrector ( const edm::ParameterSet pset)

Constructor.

Definition at line 24 of file DTSegment4DT0Corrector.cc.

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

                                                                      {
  produces<DTRecSegment4DCollection>();
  
  // debug parameter
  debug = pset.getUntrackedParameter<bool>("debug"); 
  
  if(debug)
    cout << "[DTSegment4DT0Corrector] Constructor called" << endl;
  
  // the name of the 4D rec hits collection
  theRecHits4DLabel = pset.getParameter<InputTag>("recHits4DLabel");

    // the updator
    theUpdator = new DTSegmentUpdator(pset);
}
DTSegment4DT0Corrector::~DTSegment4DT0Corrector ( ) [virtual]

Destructor.

Definition at line 41 of file DTSegment4DT0Corrector.cc.

References gather_cfg::cout, and debug.

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

Member Function Documentation

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

The method which produces the 4D rec segments corrected for t0 offset.

Implements edm::EDProducer.

Definition at line 47 of file DTSegment4DT0Corrector.cc.

References edm::OwnVector< T, P >::begin(), DTRecSegment4D::clone(), gather_cfg::cout, debug, edm::OwnVector< T, P >::end(), edm::EventSetup::get(), edm::OwnVector< T, P >::push_back(), and query::result.

                                                                         {

  // Get the 4D Segment from the event
  Handle<DTRecSegment4DCollection> all4DSegments;
  event.getByLabel(theRecHits4DLabel, all4DSegments);

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

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


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

  // Iterate over the input DTSegment4D
  DTRecSegment4DCollection::id_iterator chamberId;

  if(debug)
    cout << "[DTSegment4DT0Corrector] Starting to loop over segments" << endl;

  for (chamberId = all4DSegments->id_begin(); chamberId != all4DSegments->id_end(); ++chamberId){

    OwnVector<DTRecSegment4D> result;

    // Get the range for the corresponding ChamerId
    DTRecSegment4DCollection::range  range = all4DSegments->get(*chamberId);

    // Loop over the rechits of this ChamberId
    for (DTRecSegment4DCollection::const_iterator segment4D = range.first;
         segment4D!=range.second; ++segment4D) {

      DTRecSegment4D tmpseg = *segment4D;

      DTRecSegment4D *newSeg = tmpseg.clone();

      if(newSeg == 0) continue;

      theUpdator->update(newSeg,true);
      result.push_back(*newSeg);

    }

    segments4DCollection->put(*chamberId, result.begin(), result.end());

  }

  if(debug)
    cout << "[DTSegment4DT0Corrector] Saving modified segments into the event" << endl;

  // Load the output in the Event
  event.put(segments4DCollection);
}

Member Data Documentation

Definition at line 42 of file DTSegment4DT0Corrector.h.

Definition at line 44 of file DTSegment4DT0Corrector.h.

Definition at line 47 of file DTSegment4DT0Corrector.h.