Skip to content

Commit

Permalink
Merged RPC_and_IRPC_digitization_PhaseII from repository bapavlov
Browse files Browse the repository at this point in the history
  • Loading branch information
bapavlov committed Jun 11, 2016
2 parents cd46192 + 490778f commit 1a247db
Show file tree
Hide file tree
Showing 15 changed files with 710 additions and 86 deletions.
37 changes: 34 additions & 3 deletions DataFormats/RPCDigi/interface/RPCDigi.h
Expand Up @@ -7,8 +7,11 @@
*
*
* \author I. Segoni -- CERN & M. Maggi -- INFN Bari
*
*/
*
* modified by Borislav Pavlov - University of Sofia
* modification to be used for upgrade and for "pseudodigi"
*
*/

#include <boost/cstdint.hpp>
#include <iosfwd>
Expand All @@ -25,10 +28,38 @@ class RPCDigi{
int strip() const ;
int bx() const;
void print() const;
double time() const;
double deltaTime() const;
double coordinateX() const;
double deltaX() const;
double coordinateY() const;
double deltaY() const;
void setTime(double);
void setDeltaTime(double);
void setX(double);
void setY(double);
void setDeltaX(double);
void setDeltaY(double);
bool hasTime() const;
bool hasX() const;
bool hasY() const;
void hasTime(bool);
void hasX(bool);
void hasY(bool);
bool isPseudoDigi() const;

private:
uint16_t strip_;
int32_t bx_;
int32_t bx_;
double time_;
double coordinateX_;
double coordinateY_;
double deltaTime_;
double deltaX_;
double deltaY_;
bool hasTime_;
bool hasX_;
bool hasY_;
};

std::ostream & operator<<(std::ostream & o, const RPCDigi& digi);
Expand Down
135 changes: 125 additions & 10 deletions DataFormats/RPCDigi/src/RPCDigi.cc
Expand Up @@ -2,6 +2,11 @@
*
*
* \author Ilaria Segoni
*
* modified by Borislav Pavlov - University of Sofia
* modification to be used for upgrade and for "pseudodigi"
*
*
*/


Expand All @@ -10,27 +15,42 @@

RPCDigi::RPCDigi (int strip, int bx) :
strip_(strip),
bx_(bx)
bx_(bx),
time_(0),
coordinateX_(0),
coordinateY_(0),
deltaTime_(0),
deltaX_(0),
deltaY_(0),
hasTime_(false),
hasX_(false),
hasY_(false)
{}

RPCDigi::RPCDigi ():
strip_(0),
bx_(0)
bx_(0),
time_(0),
coordinateX_(0),
coordinateY_(0),
deltaTime_(0),
deltaX_(0),
deltaY_(0),
hasTime_(false),
hasX_(false),
hasY_(false)
{}


// Comparison
bool
RPCDigi::operator == (const RPCDigi& digi) const {
bool RPCDigi::operator == (const RPCDigi& digi) const {
if ( strip_ != digi.strip() ||
bx_ != digi.bx() ) return false;
return true;
}

///Precedence operator
bool
RPCDigi::operator<(const RPCDigi& digi) const{

bool RPCDigi::operator<(const RPCDigi& digi) const{
if(digi.bx() == this->bx())
return digi.strip()<this->strip();
else
Expand All @@ -46,9 +66,104 @@ int RPCDigi::strip() const { return strip_; }

int RPCDigi::bx() const { return bx_; }

void
RPCDigi::print() const {
void RPCDigi::print() const {
std::cout << "Strip " << strip()
<< " bx " << bx() <<std::endl;
<< " bx " << bx() <<std::endl;
}

double RPCDigi::time() const
{
return time_;
}

double RPCDigi::coordinateX() const
{
return coordinateY_;
}

double RPCDigi::coordinateY() const
{
return coordinateY_;
}

bool RPCDigi::hasTime() const
{
return hasTime_;
}

bool RPCDigi::hasX() const
{
return hasX_;
}

bool RPCDigi::hasY() const
{
return hasY_;
}

void RPCDigi::hasTime(bool has)
{
hasTime_ = has;
}

void RPCDigi::hasX(bool has)
{
hasX_ = has;
}


void RPCDigi::hasY(bool has)
{
hasY_ = has;
}

double RPCDigi::deltaTime() const
{
return deltaTime_;
}

double RPCDigi::deltaX() const
{
return deltaX_;
}

double RPCDigi::deltaY() const
{
return deltaY_;
}

void RPCDigi::setTime(double time)
{
time_ = time;
}

void RPCDigi::setDeltaTime(double dt)
{
deltaTime_ = dt;
}

void RPCDigi::setX(double x)
{
coordinateX_ = x;
}

void RPCDigi::setY(double y)
{
coordinateY_ = y;
}

void RPCDigi::setDeltaX(double dx)
{
deltaX_ = dx;
}

void RPCDigi::setDeltaY(double dy)
{
deltaY_ = dy;
}

bool RPCDigi::isPseudoDigi() const
{
return hasX_ || hasY_ ;
}

4 changes: 2 additions & 2 deletions DataFormats/RPCDigi/src/classes_def.xml
@@ -1,6 +1,6 @@
<lcgdict>
<class name="RPCDigi" ClassVersion="10">
<version ClassVersion="10" checksum="3371330358"/>
<class name="RPCDigi" ClassVersion="13">
<version ClassVersion="13" checksum="3650334651"/>
</class>
<class name="std::vector<RPCDigi>"/>
<class name="std::map<RPCDetId,std::vector<RPCDigi> >"/>
Expand Down
@@ -1,8 +1,9 @@
import FWCore.ParameterSet.Config as cms

def fixRPCConditions(process):
if hasattr(process,'simMuonRPCDigis'):
process.simMuonRPCDigis.digiModel = cms.string('RPCSimAverageNoiseEffCls')
# if hasattr(process,'simMuonRPCDigis'):
# process.simMuonRPCDigis.digiModel = cms.string('RPCSimAverageNoiseEffCls')
# process.simMuonRPCDigis.digiModel = cms.string('RPCSimAverageNoiseEffCls')
if not hasattr(process.GlobalTag,'toGet'):
process.GlobalTag.toGet=cms.VPSet()
process.GlobalTag.toGet.extend( cms.VPSet(
Expand All @@ -17,5 +18,3 @@ def fixRPCConditions(process):
)
)
return process


11 changes: 8 additions & 3 deletions SimMuon/RPCDigitizer/python/muonRPCDigis_cfi.py
Expand Up @@ -17,19 +17,24 @@
Gate = cms.double(25.0),
averageEfficiency = cms.double(0.95),
Nbxing = cms.int32(9),
timeJitter = cms.double(1.0)
timeJitter = cms.double(1.0),
IRPC_time_resolution = cms.double(0.1),
IRPC_electronics_jitter = cms.double(0.025)
),
doBkgNoise = cms.bool(True), #False - no noise and bkg simulation
Signal = cms.bool(True),
mixLabel = cms.string('mix'),
InputCollection = cms.string('g4SimHitsMuonRPCHits'),
# digiModel = cms.string('RPCSimAverageNoiseEffCls')
digiModel = cms.string('RPCSimAsymmetricCls')
#the new digitizer is RPCSimAsymmetricCls
# digiModel = cms.string('RPCSimModelTiming')

#the "standard" digitizer is RPCSimAsymmetricCls
)

#the digitizer for PhaseII muon upgrade is RPCSimModelTiming and for the moment is based on RPCSimAverageNoiseEffCls
from Configuration.StandardSequences.Eras import eras
if eras.fastSim.isChosen():
simMuonRPCDigis.InputCollection = 'MuonSimHitsMuonRPCHits'
eras.phase2_muon.toModify( simMuonRPCDigis, digiModel = cms.string('RPCSimAverageNoiseEffCls') )
eras.phase2_muon.toModify( simMuonRPCDigis, digiModel = cms.string('RPCSimModelTiming') )

56 changes: 39 additions & 17 deletions SimMuon/RPCDigitizer/src/RPCDigitizer.cc
Expand Up @@ -26,35 +26,57 @@ void RPCDigitizer::doAction(MixCollection<PSimHit> & simHits,
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")
<< "RPCDigitizer 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.";
{
hitMap[hitItr->detUnitId()].push_back(*hitItr);
}
if ( ! theGeometry) {
throw cms::Exception("Configuration")
<< "RPCDigitizer 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++){

const edm::PSimHitContainer & rollSimHits = hitMap[(*r)->id()];

// LogDebug("RPCDigitizer") << "RPCDigitizer: found " << rollSimHits.size()
// <<" hit(s) in the rpc roll";
RPCDetId id = (*r)->id();
// const edm::PSimHitContainer & rollSimHits = hitMap[(*r)->id()];
const edm::PSimHitContainer & rollSimHits = hitMap[id];


// LogDebug("RPCDigitizer") << "RPCDigitizer: found " << rollSimHits.size()
// <<" hit(s) in the rpc roll";

//if( (id.region()!=0) && ((id.station()==3)||(id.station()==4))&&(id.ring()==1))
//{
//std::cout<<"YESID\t"<<id<<'\t'<<(*r)->nstrips()<<std::endl;
//} else
//{
//std::cout<<"NOID\t"<<id<<'\t'<<(*r)->nstrips()<<std::endl;
//}

if(!((id.region()!=0) && ((id.station()==3)||(id.station()==4))&&(id.ring()==1))) // true if not IRPC (RE3/1 or RE4/1)
{
theRPCSim->simulate(*r, rollSimHits, engine); //"standard" RPC
} else {
theRPCSim->simulateIRPC(*r, rollSimHits, engine); // IRPC
}

theRPCSim->simulate(*r, rollSimHits, engine);
if(theNoise){
theRPCSim->simulateNoise(*r, engine);
if(!((id.region()!=0) && ((id.station()==3)||(id.station()==4))&&(id.ring()==1))) // true if not IRPC (RE3/1 or RE4/1)
{
theRPCSim->simulateNoise(*r, engine); //"standard" RPC
} else {
theRPCSim->simulateIRPCNoise(*r, engine); // IRPC
}
}
theRPCSim->fillDigis((*r)->id(),rpcDigis);
rpcDigiSimLink.insert(theRPCSim->rpcDigiSimLinks());
Expand Down
7 changes: 2 additions & 5 deletions SimMuon/RPCDigitizer/src/RPCDigitizer.h
Expand Up @@ -35,17 +35,14 @@ class RPCDigitizer
public:
typedef edm::DetSetVector<RPCDigiSimLink> RPCDigiSimLinks;
RPCDigitizer(const edm::ParameterSet& config);

~RPCDigitizer();

/** digitize
*/

// *** digitize ***
void doAction(MixCollection<PSimHit> & simHits,
RPCDigiCollection & rpcDigis,
RPCDigiSimLinks & rpcDigiSimLink,
CLHEP::HepRandomEngine*);


/// sets geometry
void setGeometry(const RPCGeometry * geom) {theGeometry = geom;}

Expand Down

0 comments on commit 1a247db

Please sign in to comment.