CMS 3D CMS Logo

CSCDigitizer Class Reference

Digitizer class for endcap muon CSCs. More...

#include <SimMuon/CSCDigitizer/src/CSCDigitizer.h>

List of all members.

Public Types

typedef edm::DetSetVector
< StripDigiSimLink
DigiSimLinks

Public Member Functions

 CSCDigitizer (const edm::ParameterSet &p)
 configurable parameters
void doAction (MixCollection< PSimHit > &simHits, CSCWireDigiCollection &wireDigis, CSCStripDigiCollection &stripDigis, CSCComparatorDigiCollection &comparators, DigiSimLinks &wireDigiSimLinks, DigiSimLinks &stripDigiSimLinks)
 digitize
const CSCLayerfindLayer (int detId) const
 finds the layer in the geometry associated with this det ID
void setGeometry (const CSCGeometry *geom)
 sets geometry
void setMagneticField (const MagneticField *field)
 sets the magnetic field
void setParticleDataTable (const ParticleDataTable *pdt)
void setRandomEngine (CLHEP::HepRandomEngine &engine)
void setStripConditions (CSCStripConditions *cond)
 ~CSCDigitizer ()

Private Attributes

CSCStripConditionstheConditions
const CSCGeometrytheCSCGeometry
CSCDriftSimtheDriftSim
CSCNeutronReadertheNeutronReader
CSCStripElectronicsSimtheStripElectronicsSim
CSCStripHitSimtheStripHitSim
CSCWireElectronicsSimtheWireElectronicsSim
CSCWireHitSimtheWireHitSim


Detailed Description

Digitizer class for endcap muon CSCs.

Author:
Rick Wilkinson

Definition at line 37 of file CSCDigitizer.h.


Member Typedef Documentation

typedef edm::DetSetVector<StripDigiSimLink> CSCDigitizer::DigiSimLinks

Definition at line 40 of file CSCDigitizer.h.


Constructor & Destructor Documentation

CSCDigitizer::CSCDigitizer ( const edm::ParameterSet p  )  [explicit]

configurable parameters

Definition at line 17 of file CSCDigitizer.cc.

References edm::ParameterSet::getParameter(), and theNeutronReader.

00018 : theDriftSim(new CSCDriftSim()),
00019   theWireHitSim(new CSCWireHitSim(theDriftSim)),
00020   theStripHitSim(new CSCStripHitSim()),
00021   theWireElectronicsSim(new CSCWireElectronicsSim(p.getParameter<edm::ParameterSet>("wires"))),
00022   theStripElectronicsSim(new CSCStripElectronicsSim(p.getParameter<edm::ParameterSet>("strips"))),
00023   theNeutronReader(0),
00024   theCSCGeometry(0)
00025 {
00026   if(p.getParameter<bool>("doNeutrons"))
00027   {
00028     theNeutronReader = new CSCNeutronReader(p.getParameter<edm::ParameterSet>("neutrons"));
00029   }
00030 }

CSCDigitizer::~CSCDigitizer (  ) 

Definition at line 33 of file CSCDigitizer.cc.

References theDriftSim, theNeutronReader, theStripElectronicsSim, theStripHitSim, theWireElectronicsSim, and theWireHitSim.

00033                             {
00034   delete theNeutronReader;
00035   delete theStripElectronicsSim;
00036   delete theWireElectronicsSim;
00037   delete theStripHitSim;
00038   delete theWireHitSim;
00039   delete theDriftSim;
00040 }


Member Function Documentation

void CSCDigitizer::doAction ( MixCollection< PSimHit > &  simHits,
CSCWireDigiCollection wireDigis,
CSCStripDigiCollection stripDigis,
CSCComparatorDigiCollection comparators,
DigiSimLinks wireDigiSimLinks,
DigiSimLinks stripDigiSimLinks 
)

digitize

Definition at line 44 of file CSCDigitizer.cc.

References CSCNeutronReader::addHits(), MixCollection< T >::begin(), CSCDetId::chamber(), CSCBaseElectronicsSim::digiSimLinks(), MixCollection< T >::end(), CSCDetId::endcap(), CSCStripElectronicsSim::fillDigis(), CSCWireElectronicsSim::fillDigis(), findLayer(), CSCLayer::id(), edm::DetSetVector< T >::insert(), CSCStripConditions::isInBadChamber(), CSCDetId::layer(), LogTrace, CSCDetId::ring(), CSCBaseElectronicsSim::simulate(), CSCWireHitSim::simulate(), CSCStripHitSim::simulate(), CSCDetId::station(), t, theConditions, theNeutronReader, theStripElectronicsSim, theStripHitSim, theWireElectronicsSim, and theWireHitSim.

Referenced by CSCDigiProducer::produce().

00050 {
00051   // arrange the hits by layer
00052   std::map<int, edm::PSimHitContainer> hitMap;
00053   for(MixCollection<PSimHit>::MixItr hitItr = simHits.begin();
00054       hitItr != simHits.end(); ++hitItr) 
00055   {
00056     hitMap[hitItr->detUnitId()].push_back(*hitItr);
00057   }
00058 
00059   // add neutron background, if needed
00060   if(theNeutronReader != 0)
00061   {
00062     theNeutronReader->addHits(hitMap);
00063   }
00064 
00065   // now loop over layers and run the simulation for each one
00066   for(std::map<int, edm::PSimHitContainer>::const_iterator hitMapItr = hitMap.begin();
00067       hitMapItr != hitMap.end(); ++hitMapItr)
00068   {
00069     if ( theConditions->isInBadChamber( CSCDetId(hitMapItr->first) ) ) continue; // skip 'bad' chamber
00070 
00071     const CSCLayer * layer = findLayer(hitMapItr->first);
00072     const edm::PSimHitContainer & layerSimHits = hitMapItr->second;
00073 
00074     std::vector<CSCDetectorHit> newWireHits, newStripHits;
00075   
00076     LogTrace("CSCDigitizer") << "CSCDigitizer: found " << layerSimHits.size() <<" hit(s) in layer"
00077        << " E" << layer->id().endcap() << " S" << layer->id().station() << " R" << layer->id().ring()
00078        << " C" << layer->id().chamber() << " L" << layer->id().layer();
00079 
00080     // turn the edm::PSimHits into WireHits, using the WireHitSim
00081     {
00082       TimeMe t("CSCWireHitSim");
00083       newWireHits.swap(theWireHitSim->simulate(layer, layerSimHits));
00084     }
00085     if(!newWireHits.empty()) {
00086       TimeMe t("CSCStripHitSim");
00087       newStripHits.swap(theStripHitSim->simulate(layer, newWireHits));
00088     }
00089 
00090     // turn the hits into wire digis, using the electronicsSim
00091     {
00092       TimeMe t("CSCWireElectronicsSim");
00093       theWireElectronicsSim->simulate(layer, newWireHits);
00094       theWireElectronicsSim->fillDigis(wireDigis);
00095       wireDigiSimLinks.insert( theWireElectronicsSim->digiSimLinks() );
00096     }  
00097     {
00098       TimeMe t("CSCStripElectronicsSim");
00099       theStripElectronicsSim->simulate(layer, newStripHits);
00100       theStripElectronicsSim->fillDigis(stripDigis, comparators);
00101       stripDigiSimLinks.insert( theStripElectronicsSim->digiSimLinks() );
00102     }
00103   }
00104 }

const CSCLayer * CSCDigitizer::findLayer ( int  detId  )  const

finds the layer in the geometry associated with this det ID

Definition at line 134 of file CSCDigitizer.cc.

References Exception, CSCGeometry::idToDetUnit(), and theCSCGeometry.

Referenced by doAction().

00134                                                         {
00135   assert(theCSCGeometry != 0);
00136   const GeomDetUnit* detUnit = theCSCGeometry->idToDetUnit(CSCDetId(detId));
00137   if(detUnit == 0)
00138   {
00139     throw cms::Exception("CSCDigiProducer") << "Invalid DetUnit: " << CSCDetId(detId)
00140       << "\nPerhaps your signal or pileup dataset are not compatible with the current release?";
00141   }  
00142   return dynamic_cast<const CSCLayer *>(detUnit);
00143 }

void CSCDigitizer::setGeometry ( const CSCGeometry geom  )  [inline]

sets geometry

Definition at line 57 of file CSCDigitizer.h.

References theCSCGeometry.

Referenced by CSCDigiProducer::produce().

00057 {theCSCGeometry = geom;}

void CSCDigitizer::setMagneticField ( const MagneticField field  ) 

sets the magnetic field

Definition at line 107 of file CSCDigitizer.cc.

References CSCDriftSim::setMagneticField(), and theDriftSim.

Referenced by CSCDigiProducer::produce().

00107                                                                {
00108   theDriftSim->setMagneticField(field);
00109 }

void CSCDigitizer::setParticleDataTable ( const ParticleDataTable pdt  ) 

Definition at line 119 of file CSCDigitizer.cc.

References CSCWireHitSim::setParticleDataTable(), and theWireHitSim.

Referenced by CSCDigiProducer::produce().

00120 {
00121   theWireHitSim->setParticleDataTable(pdt);
00122 }

void CSCDigitizer::setRandomEngine ( CLHEP::HepRandomEngine &  engine  ) 

Definition at line 125 of file CSCDigitizer.cc.

References SubsystemNeutronReader::setRandomEngine(), CSCWireHitSim::setRandomEngine(), CSCBaseElectronicsSim::setRandomEngine(), theNeutronReader, theStripElectronicsSim, theWireElectronicsSim, and theWireHitSim.

Referenced by CSCDigiProducer::CSCDigiProducer().

void CSCDigitizer::setStripConditions ( CSCStripConditions cond  ) 

Definition at line 112 of file CSCDigitizer.cc.

References CSCStripElectronicsSim::setStripConditions(), theConditions, and theStripElectronicsSim.

Referenced by CSCDigiProducer::CSCDigiProducer().

00113 {
00114   theConditions = cond; // cache here
00115   theStripElectronicsSim->setStripConditions(cond); // percolate downwards
00116 }


Member Data Documentation

CSCStripConditions* CSCDigitizer::theConditions [private]

Definition at line 80 of file CSCDigitizer.h.

Referenced by doAction(), and setStripConditions().

const CSCGeometry* CSCDigitizer::theCSCGeometry [private]

Definition at line 79 of file CSCDigitizer.h.

Referenced by findLayer(), and setGeometry().

CSCDriftSim* CSCDigitizer::theDriftSim [private]

Definition at line 73 of file CSCDigitizer.h.

Referenced by setMagneticField(), and ~CSCDigitizer().

CSCNeutronReader* CSCDigitizer::theNeutronReader [private]

Definition at line 78 of file CSCDigitizer.h.

Referenced by CSCDigitizer(), doAction(), setRandomEngine(), and ~CSCDigitizer().

CSCStripElectronicsSim* CSCDigitizer::theStripElectronicsSim [private]

Definition at line 77 of file CSCDigitizer.h.

Referenced by doAction(), setRandomEngine(), setStripConditions(), and ~CSCDigitizer().

CSCStripHitSim* CSCDigitizer::theStripHitSim [private]

Definition at line 75 of file CSCDigitizer.h.

Referenced by doAction(), and ~CSCDigitizer().

CSCWireElectronicsSim* CSCDigitizer::theWireElectronicsSim [private]

Definition at line 76 of file CSCDigitizer.h.

Referenced by doAction(), setRandomEngine(), and ~CSCDigitizer().

CSCWireHitSim* CSCDigitizer::theWireHitSim [private]

Definition at line 74 of file CSCDigitizer.h.

Referenced by doAction(), setParticleDataTable(), setRandomEngine(), and ~CSCDigitizer().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:17:11 2009 for CMSSW by  doxygen 1.5.4