#include <FamosManager.h>
Public Member Functions | |
CalorimetryManager * | calorimetryManager () const |
The calorimeter. | |
FamosManager (edm::ParameterSet const &p) | |
Constructor. | |
void | reconstruct (const HepMC::GenEvent *evt, const reco::GenParticleCollection *particles, const HepMC::GenEvent *pu) |
The real thing is done here. | |
void | reconstruct (const reco::GenParticleCollection *particles) |
void | setupGeometryAndField (edm::Run &run, const edm::EventSetup &es) |
Get information from the Event Setup. | |
FSimEvent * | simEvent () const |
The generated event. | |
TrajectoryManager * | trackerManager () const |
The tracker. | |
~FamosManager () | |
Destructor. | |
Private Attributes | |
int | iEvent |
bool | m_Alignment |
bool | m_Calorimetry |
int | m_pRunNumber |
bool | m_pUseMagneticField |
int | m_pVerbose |
bool | m_Tracking |
CalorimetryManager * | myCalorimetry |
PileUpSimulator * | myPileUpSimulator |
FSimEvent * | mySimEvent |
TrajectoryManager * | myTrajectoryManager |
const RandomEngine * | random |
double | weight_ |
Definition at line 28 of file FamosManager.h.
FamosManager::FamosManager | ( | edm::ParameterSet const & | p | ) |
Constructor.
Initialize the TrajectoryManager
Definition at line 48 of file FamosManager.cc.
References Exception, edm::ParameterSet::getParameter(), edm::Service< T >::isAvailable(), m_Calorimetry, myCalorimetry, myPileUpSimulator, mySimEvent, myTrajectoryManager, and random.
: iEvent(0), myPileUpSimulator(0), myCalorimetry(0), m_pUseMagneticField(p.getParameter<bool>("UseMagneticField")), m_Tracking(p.getParameter<bool>("SimulateTracking")), m_Calorimetry(p.getParameter<bool>("SimulateCalorimetry")), m_Alignment(p.getParameter<bool>("ApplyAlignment")), m_pRunNumber(p.getUntrackedParameter<int>("RunNumber",1)), m_pVerbose(p.getUntrackedParameter<int>("Verbosity",1)) { // Initialize the random number generator service edm::Service<edm::RandomNumberGenerator> rng; if ( ! rng.isAvailable() ) { throw cms::Exception("Configuration") << "FamosManager requires the RandomGeneratorService\n" "which is not present in the configuration file.\n" "You must add the service in the configuration file\n" "or remove the module that requires it"; } random = new RandomEngine(&(*rng)); // Initialize the FSimEvent mySimEvent = new FSimEvent(p.getParameter<edm::ParameterSet>("VertexGenerator"), p.getParameter<edm::ParameterSet>("ParticleFilter"), random); myTrajectoryManager = new TrajectoryManager(mySimEvent, p.getParameter<edm::ParameterSet>("MaterialEffects"), p.getParameter<edm::ParameterSet>("TrackerSimHits"), p.getParameter<edm::ParameterSet>("ActivateDecays"), random); // Initialize PileUp Producer (if requested) myPileUpSimulator = new PileUpSimulator(mySimEvent); // Initialize Calorimetry Fast Simulation (if requested) if ( m_Calorimetry) myCalorimetry = new CalorimetryManager(mySimEvent, p.getParameter<edm::ParameterSet>("Calorimetry"), p.getParameter<edm::ParameterSet>("MaterialEffectsForMuonsInECAL"), p.getParameter<edm::ParameterSet>("MaterialEffectsForMuonsInHCAL"), p.getParameter<edm::ParameterSet>("GFlash"), random); }
FamosManager::~FamosManager | ( | ) |
Destructor.
Definition at line 101 of file FamosManager.cc.
References myCalorimetry, myPileUpSimulator, mySimEvent, myTrajectoryManager, and random.
{ if ( mySimEvent ) delete mySimEvent; if ( myTrajectoryManager ) delete myTrajectoryManager; if ( myPileUpSimulator ) delete myPileUpSimulator; if ( myCalorimetry) delete myCalorimetry; delete random; }
CalorimetryManager* FamosManager::calorimetryManager | ( | ) | const [inline] |
The calorimeter.
Definition at line 60 of file FamosManager.h.
References myCalorimetry.
Referenced by FamosProducer::produce().
{return myCalorimetry;}
void FamosManager::reconstruct | ( | const reco::GenParticleCollection * | particles | ) |
Definition at line 229 of file FamosManager.cc.
References FSimEvent::fill(), errorMatrix2Lands_multiChannel::id, iEvent, m_pRunNumber, myCalorimetry, mySimEvent, myTrajectoryManager, CalorimetryManager::reconstruct(), and TrajectoryManager::reconstruct().
{ iEvent++; edm::EventID id(m_pRunNumber,1U,iEvent); mySimEvent->fill(*particles,id); myTrajectoryManager->reconstruct(); if ( myCalorimetry ) myCalorimetry->reconstruct(); }
void FamosManager::reconstruct | ( | const HepMC::GenEvent * | evt, |
const reco::GenParticleCollection * | particles, | ||
const HepMC::GenEvent * | pu | ||
) |
The real thing is done here.
Definition at line 174 of file FamosManager.cc.
References FSimEvent::fill(), errorMatrix2Lands_multiChannel::id, iEvent, m_pRunNumber, myCalorimetry, myPileUpSimulator, mySimEvent, myTrajectoryManager, FSimEvent::nGenParts(), FSimEvent::nTracks(), FSimEvent::nVertices(), PileUpSimulator::produce(), CalorimetryManager::reconstruct(), TrajectoryManager::reconstruct(), and FSimEvent::weight().
Referenced by FamosProducer::produce().
{ // myGenEvent = evt; if (evt != 0 || particles != 0) { iEvent++; edm::EventID id(m_pRunNumber,1U,iEvent); // Fill the event from the original generated event if (evt ) mySimEvent->fill(*evt,id); else mySimEvent->fill(*particles,id); // mySimEvent->printMCTruth(*evt); /* mySimEvent->print(); std::cout << "----------------------------------------" << std::endl; */ // Get the pileup events and add the particles to the main event myPileUpSimulator->produce(pu); /* mySimEvent->print(); std::cout << "----------------------------------------" << std::endl; */ // And propagate the particles through the detector myTrajectoryManager->reconstruct(); /* mySimEvent->print(); std::cout << "=========================================" << std::endl << std::endl; */ if ( myCalorimetry ) myCalorimetry->reconstruct(); } // Should be moved to LogInfo edm::LogInfo("FamosManager") << " saved : Event " << iEvent << " of weight " << mySimEvent->weight() << " with " << mySimEvent->nTracks() << " tracks and " << mySimEvent->nVertices() << " vertices, generated by " << mySimEvent->nGenParts() << " particles " << std::endl; }
void FamosManager::setupGeometryAndField | ( | edm::Run & | run, |
const edm::EventSetup & | es | ||
) |
Get information from the Event Setup.
Definition at line 111 of file FamosManager.cc.
References g, edm::EventSetup::get(), CalorimetryManager::getCalorimeter(), edm::EventSetup::getData(), CaloGeometryHelper::initialize(), FBaseSimEvent::initializePdt(), TrajectoryManager::initializeRecoGeometry(), TrajectoryManager::initializeTrackerGeometry(), instance, m_Alignment, m_pRunNumber, m_pUseMagneticField, m_Tracking, myCalorimetry, mySimEvent, myTrajectoryManager, edm::RunBase::run(), Calorimeter::setupGeometry(), Calorimeter::setupTopology(), and patCandidatesForDimuonsSequences_cff::tracker.
Referenced by FamosProducer::beginRun().
{ // Particle data table (from Pythia) edm::ESHandle < HepPDT::ParticleDataTable > pdt; es.getData(pdt); mySimEvent->initializePdt(&(*pdt)); ParticleTable::instance(&(*pdt)); // Initialize the full (misaligned) tracker geometry // (only if tracking is requested) std::string misAligned = m_Alignment ? "MisAligned" : ""; // 1) By default, the aligned geometry is chosen (m_Alignment = false) // 2) By default, the misaligned geometry is aligned edm::ESHandle<TrackerGeometry> tracker; es.get<TrackerDigiGeometryRecord>().get(misAligned,tracker); if (m_Tracking) myTrajectoryManager->initializeTrackerGeometry(&(*tracker)); // Initialize the tracker misaligned reco geometry (always needed) // By default, the misaligned geometry is aligned edm::ESHandle<GeometricSearchTracker> theGeomSearchTracker; es.get<TrackerRecoGeometryRecord>().get(misAligned, theGeomSearchTracker ); // Initialize the misaligned tracker interaction geometry edm::ESHandle<TrackerInteractionGeometry> theTrackerInteractionGeometry; es.get<TrackerInteractionGeometryRecord>().get(misAligned, theTrackerInteractionGeometry ); // Initialize the magnetic field double bField000 = 0.; if (m_pUseMagneticField) { edm::ESHandle<MagneticFieldMap> theMagneticFieldMap; es.get<MagneticFieldMapRecord>().get(misAligned, theMagneticFieldMap); const GlobalPoint g(0.,0.,0.); bField000 = theMagneticFieldMap->inTeslaZ(g); myTrajectoryManager->initializeRecoGeometry(&(*theGeomSearchTracker), &(*theTrackerInteractionGeometry), &(*theMagneticFieldMap)); } else { myTrajectoryManager->initializeRecoGeometry(&(*theGeomSearchTracker), &(*theTrackerInteractionGeometry), 0); bField000 = 4.0; } // The following should be on LogInfo //std::cout << "B-field(T) at (0,0,0)(cm): " << bField000 << std::endl; // Initialize the calorimeter geometry if ( myCalorimetry ) { edm::ESHandle<CaloGeometry> pG; es.get<CaloGeometryRecord>().get(pG); myCalorimetry->getCalorimeter()->setupGeometry(*pG); edm::ESHandle<CaloTopology> theCaloTopology; es.get<CaloTopologyRecord>().get(theCaloTopology); myCalorimetry->getCalorimeter()->setupTopology(*theCaloTopology); myCalorimetry->getCalorimeter()->initialize(bField000); } m_pRunNumber = run.run(); }
FSimEvent* FamosManager::simEvent | ( | ) | const [inline] |
The generated event.
The simulated event
Definition at line 47 of file FamosManager.h.
References mySimEvent.
Referenced by FamosProducer::produce().
{ return mySimEvent; }
TrajectoryManager* FamosManager::trackerManager | ( | ) | const [inline] |
The tracker.
Definition at line 57 of file FamosManager.h.
References myTrajectoryManager.
Referenced by FamosProducer::produce().
{return myTrajectoryManager;}
int FamosManager::iEvent [private] |
Definition at line 65 of file FamosManager.h.
Referenced by reconstruct().
bool FamosManager::m_Alignment [private] |
Definition at line 77 of file FamosManager.h.
Referenced by setupGeometryAndField().
bool FamosManager::m_Calorimetry [private] |
Definition at line 76 of file FamosManager.h.
Referenced by FamosManager().
int FamosManager::m_pRunNumber [private] |
Definition at line 79 of file FamosManager.h.
Referenced by reconstruct(), and setupGeometryAndField().
bool FamosManager::m_pUseMagneticField [private] |
Definition at line 74 of file FamosManager.h.
Referenced by setupGeometryAndField().
int FamosManager::m_pVerbose [private] |
Definition at line 80 of file FamosManager.h.
bool FamosManager::m_Tracking [private] |
Definition at line 75 of file FamosManager.h.
Referenced by setupGeometryAndField().
CalorimetryManager* FamosManager::myCalorimetry [private] |
Definition at line 70 of file FamosManager.h.
Referenced by calorimetryManager(), FamosManager(), reconstruct(), setupGeometryAndField(), and ~FamosManager().
PileUpSimulator* FamosManager::myPileUpSimulator [private] |
Definition at line 69 of file FamosManager.h.
Referenced by FamosManager(), reconstruct(), and ~FamosManager().
FSimEvent* FamosManager::mySimEvent [private] |
Definition at line 67 of file FamosManager.h.
Referenced by FamosManager(), reconstruct(), setupGeometryAndField(), simEvent(), and ~FamosManager().
Definition at line 68 of file FamosManager.h.
Referenced by FamosManager(), reconstruct(), setupGeometryAndField(), trackerManager(), and ~FamosManager().
const RandomEngine* FamosManager::random [private] |
Definition at line 84 of file FamosManager.h.
Referenced by FamosManager(), and ~FamosManager().
double FamosManager::weight_ [private] |
Definition at line 78 of file FamosManager.h.