CMS 3D CMS Logo

Public Member Functions | Private Attributes

MisalignedTrackerESProducer Class Reference

Inheritance diagram for MisalignedTrackerESProducer:
edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

List of all members.

Public Member Functions

 MisalignedTrackerESProducer (const edm::ParameterSet &p)
 Constructor.
boost::shared_ptr
< TrackerGeometry
produce (const TrackerDigiGeometryRecord &iRecord)
 Produce the misaligned tracker geometry and store it.
virtual ~MisalignedTrackerESProducer ()
 Destructor.

Private Attributes

const std::string theAlignRecordName
const std::string theErrorRecordName
const edm::ParameterSet thePSet
 misalignment scenario
const bool theSaveToDB
const edm::ParameterSet theScenario
 whether or not writing to DB
boost::shared_ptr
< TrackerGeometry
theTracker

Detailed Description

An ESProducer that fills the TrackerDigiGeometryRcd with a misaligned tracker

This should replace the standard TrackerDigiGeometryESModule when producing Misalignment scenarios.

Definition at line 37 of file MisalignedTrackerESProducer.cc.


Constructor & Destructor Documentation

MisalignedTrackerESProducer::MisalignedTrackerESProducer ( const edm::ParameterSet p)

Constructor.

Definition at line 66 of file MisalignedTrackerESProducer.cc.

References edm::ESProducer::setWhatProduced().

                                                                                 :
  theSaveToDB(p.getUntrackedParameter<bool>("saveToDbase")),
  theScenario(p.getParameter<edm::ParameterSet>("scenario")),
  thePSet(p),
  theAlignRecordName("TrackerAlignmentRcd"),
  theErrorRecordName("TrackerAlignmentErrorRcd")
{
  setWhatProduced(this);

}
MisalignedTrackerESProducer::~MisalignedTrackerESProducer ( ) [virtual]

Destructor.

Definition at line 79 of file MisalignedTrackerESProducer.cc.

{}

Member Function Documentation

boost::shared_ptr< TrackerGeometry > MisalignedTrackerESProducer::produce ( const TrackerDigiGeometryRecord iRecord)

Produce the misaligned tracker geometry and store it.

Definition at line 84 of file MisalignedTrackerESProducer.cc.

References GeometryAligner::applyAlignments(), TrackerScenarioBuilder::applyScenario(), TrackerGeomBuilderFromGeometricDet::build(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), edm::Service< T >::isAvailable(), theAlignRecordName, theErrorRecordName, thePSet, theSaveToDB, theScenario, and theTracker.

{ 

  edm::LogInfo("MisalignedTracker") << "Producer called";

  // Create the tracker geometry from ideal geometry
  edm::ESHandle<GeometricDet> gD;
  iRecord.getRecord<IdealGeometryRecord>().get( gD );
  TrackerGeomBuilderFromGeometricDet trackerBuilder;
  theTracker  = boost::shared_ptr<TrackerGeometry>( trackerBuilder.build(&(*gD), thePSet));
 
  // Create the alignable hierarchy
  std::auto_ptr<AlignableTracker> theAlignableTracker(new AlignableTracker( &(*theTracker) ) );

  // Create misalignment scenario, apply to geometry
  TrackerScenarioBuilder scenarioBuilder( &(*theAlignableTracker) );
  scenarioBuilder.applyScenario( theScenario );
  Alignments* alignments =  theAlignableTracker->alignments();
  AlignmentErrors* alignmentErrors = theAlignableTracker->alignmentErrors();
  
  // Store result to EventSetup
  GeometryAligner aligner;
  aligner.applyAlignments<TrackerGeometry>( &(*theTracker), alignments, alignmentErrors, 
                                            AlignTransform()); // dummy global position

  // Write alignments to DB: have to sort beforhand!
  if (theSaveToDB) {

      // Call service
      edm::Service<cond::service::PoolDBOutputService> poolDbService;
      if( !poolDbService.isAvailable() ) // Die if not available
        throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
          
      poolDbService->writeOne<Alignments>(alignments, poolDbService->currentTime(),
                                          theAlignRecordName);
      poolDbService->writeOne<AlignmentErrors>(alignmentErrors, poolDbService->currentTime(),
                                               theErrorRecordName);
  } else {
    // poolDbService::writeOne takes over ownership
    // we have to delete in the case that containers are not written
    delete alignments;
    delete alignmentErrors;
  }
  

  edm::LogInfo("MisalignedTracker") << "Producer done";
  return theTracker;
  
}

Member Data Documentation

Definition at line 54 of file MisalignedTrackerESProducer.cc.

Referenced by produce().

Definition at line 54 of file MisalignedTrackerESProducer.cc.

Referenced by produce().

misalignment scenario

Definition at line 53 of file MisalignedTrackerESProducer.cc.

Referenced by produce().

Definition at line 51 of file MisalignedTrackerESProducer.cc.

Referenced by produce().

whether or not writing to DB

Definition at line 52 of file MisalignedTrackerESProducer.cc.

Referenced by produce().

Definition at line 56 of file MisalignedTrackerESProducer.cc.

Referenced by produce().