Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14769 from bapavlov/RPC_and_IRPC_digitization_Pha…
…seII Rpc and irpc digitization phase ii
- Loading branch information
Showing
21 changed files
with
987 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#include "SimMuon/RPCDigitizer/src/IRPCDigitizer.h" | ||
#include "SimMuon/RPCDigitizer/src/RPCSimFactory.h" | ||
#include "SimMuon/RPCDigitizer/src/RPCSim.h" | ||
#include "SimDataFormats/TrackingHit/interface/PSimHit.h" | ||
#include "Geometry/RPCGeometry/interface/RPCRoll.h" | ||
#include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "SimMuon/RPCDigitizer/src/RPCSimSetUp.h" | ||
|
||
// default constructor allocates default wire and strip digitizers | ||
|
||
IRPCDigitizer::IRPCDigitizer(const edm::ParameterSet& config) { | ||
theName = config.getParameter<std::string>("digiIRPCModel"); | ||
theRPCSim = RPCSimFactory::get()->create(theName,config.getParameter<edm::ParameterSet>("digiIRPCModelConfig")); | ||
theNoise=config.getParameter<bool>("doBkgNoise"); | ||
} | ||
|
||
IRPCDigitizer::~IRPCDigitizer() { | ||
if( theRPCSim ) | ||
delete theRPCSim; | ||
theRPCSim = 0; | ||
} | ||
|
||
void IRPCDigitizer::doAction(MixCollection<PSimHit> & simHits, | ||
RPCDigiCollection & rpcDigis, | ||
RPCDigiSimLinks & rpcDigiSimLink, | ||
CLHEP::HepRandomEngine* engine) | ||
{ | ||
|
||
theRPCSim->setRPCSimSetUp(theSimSetUp); | ||
|
||
// arrange the hits by roll | ||
std::map<int, edm::PSimHitContainer> hitMap; | ||
for(MixCollection<PSimHit>::MixItr hitItr = simHits.begin(); | ||
hitItr != simHits.end(); ++hitItr) | ||
{ | ||
hitMap[hitItr->detUnitId()].push_back(*hitItr); | ||
} | ||
|
||
if ( ! theGeometry) { | ||
throw cms::Exception("Configuration") | ||
<< "IRPCDigitizer requires the RPCGeometry \n which is not present in the configuration file. You must add the service\n in the configuration file or remove the modules that require it."; | ||
} | ||
|
||
|
||
const std::vector<const RPCRoll*>& rpcRolls = theGeometry->rolls() ; | ||
for(auto r = rpcRolls.begin(); | ||
r != rpcRolls.end(); r++){ | ||
|
||
RPCDetId id = (*r)->id(); | ||
const edm::PSimHitContainer & rollSimHits = hitMap[id]; | ||
|
||
if((*r)->isIRPC()){ | ||
theRPCSim->simulate(*r, rollSimHits, engine); | ||
|
||
if(theNoise){ | ||
theRPCSim->simulateNoise(*r, engine); | ||
} | ||
} | ||
|
||
|
||
theRPCSim->fillDigis((*r)->id(),rpcDigis); | ||
rpcDigiSimLink.insert(theRPCSim->rpcDigiSimLinks()); | ||
} | ||
} | ||
|
||
const RPCRoll * IRPCDigitizer::findDet(int detId) const { | ||
assert(theGeometry != 0); | ||
const GeomDetUnit* detUnit = theGeometry->idToDetUnit(RPCDetId(detId)); | ||
return dynamic_cast<const RPCRoll *>(detUnit); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#ifndef SimMuon_IRPCDigitizer_h | ||
#define SimMuon_IRPCDigitizer_h | ||
// | ||
|
||
/** \class IRPCDigitizer | ||
* Digitizer class for RPC | ||
* | ||
* \author Borislav Pavlov -- University of Sofia | ||
* | ||
*/ | ||
#include "DataFormats/Common/interface/DetSetVector.h" | ||
#include "SimDataFormats/TrackerDigiSimLink/interface/StripDigiSimLink.h" | ||
#include "SimDataFormats/RPCDigiSimLink/interface/RPCDigiSimLink.h" | ||
#include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h" | ||
#include "DataFormats/RPCDigi/interface/RPCDigiCollection.h" | ||
#include "Geometry/RPCGeometry/interface/RPCGeometry.h" | ||
#include "SimDataFormats/CrossingFrame/interface/MixCollection.h" | ||
#include <string> | ||
#include "CLHEP/Random/RandomEngine.h" | ||
|
||
namespace edm{ | ||
class ParameterSet; | ||
} | ||
|
||
class RPCRoll; | ||
class RPCSim; | ||
class RPCSimSetUp; | ||
|
||
namespace CLHEP { | ||
class HepRandomEngine; | ||
} | ||
|
||
class IRPCDigitizer | ||
{ | ||
public: | ||
typedef edm::DetSetVector<RPCDigiSimLink> RPCDigiSimLinks; | ||
IRPCDigitizer(const edm::ParameterSet& config); | ||
~IRPCDigitizer(); | ||
|
||
// *** digitize *** | ||
void doAction(MixCollection<PSimHit> & simHits, | ||
RPCDigiCollection & rpcDigis, | ||
RPCDigiSimLinks & rpcDigiSimLink, | ||
CLHEP::HepRandomEngine*); | ||
|
||
/// sets geometry | ||
void setGeometry(const RPCGeometry * geom) {theGeometry = geom;} | ||
|
||
void setRPCSimSetUp(RPCSimSetUp *simsetup){theSimSetUp = simsetup;} | ||
|
||
RPCSimSetUp* getRPCSimSetUp(){ return theSimSetUp; } | ||
|
||
/// finds the rpc det unit in the geometry associated with this det ID | ||
const RPCRoll * findDet(int detId) const; | ||
|
||
private: | ||
const RPCGeometry * theGeometry; | ||
RPCSim* theRPCSim; | ||
RPCSimSetUp * theSimSetUp; | ||
std::string theName; | ||
bool theNoise; | ||
}; | ||
|
||
#endif | ||
|
Oops, something went wrong.