Skip to content

Commit

Permalink
Merge pull request #9526 from clacaputo/ME0SimHit_DetectorID
Browse files Browse the repository at this point in the history
BUGFIX to ME0 SimHit
  • Loading branch information
cmsbuild committed Jun 10, 2015
2 parents 7814f7e + f27a109 commit 62e0312
Show file tree
Hide file tree
Showing 11 changed files with 499 additions and 33 deletions.
5 changes: 4 additions & 1 deletion Geometry/GEMGeometryBuilder/src/ME0GeometryBuilderFromDDD.cc
Expand Up @@ -21,13 +21,16 @@
#include "DataFormats/GeometryVector/interface/Basic3DVector.h"

#include "CLHEP/Units/GlobalSystemOfUnits.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

#include <iostream>
#include <algorithm>
#include <boost/lexical_cast.hpp>

ME0GeometryBuilderFromDDD::ME0GeometryBuilderFromDDD()
{ }
{
LogDebug("ME0GeometryBuilderfromDDD") <<"[ME0GeometryBuilderFromDDD::constructor]";
}

ME0GeometryBuilderFromDDD::~ME0GeometryBuilderFromDDD()
{ }
Expand Down
4 changes: 2 additions & 2 deletions Geometry/MuonNumbering/interface/ME0NumberingScheme.h
Expand Up @@ -13,10 +13,10 @@ class ME0NumberingScheme : public MuonNumberingScheme {

ME0NumberingScheme( const DDCompactView& cpv );
ME0NumberingScheme( const MuonDDDConstants& muonConstants );

virtual ~ME0NumberingScheme(){};

virtual int baseNumberToUnitNumber(const MuonBaseNumber);
virtual int baseNumberToUnitNumber(const MuonBaseNumber&);

private:
void initMe ( const MuonDDDConstants& muonConstants );
Expand Down
92 changes: 69 additions & 23 deletions Geometry/MuonNumbering/src/ME0NumberingScheme.cc
Expand Up @@ -2,6 +2,8 @@
#include "Geometry/MuonNumbering/interface/MuonBaseNumber.h"
#include "Geometry/MuonNumbering/interface/MuonDDDConstants.h"
#include "DataFormats/MuonDetId/interface/ME0DetId.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

#include <iostream>

//#define LOCAL_DEBUG
Expand All @@ -21,24 +23,55 @@ void ME0NumberingScheme::initMe ( const MuonDDDConstants& muonConstants ) {
theLayerLevel = muonConstants.getValue("m0_layer")/theLevelPart;
theSectorLevel = muonConstants.getValue("m0_sector")/theLevelPart;
theRollLevel = muonConstants.getValue("m0_roll")/theLevelPart;
#ifdef LOCAL_DEBUG
std::cout << "Initialize ME0NumberingScheme" <<std::endl;
std::cout << "theRegionLevel " << theRegionLevel <<std::endl;
std::cout << "theLayerLevel " << theLayerLevel <<std::endl;
std::cout << "theSectorLevel " << theSectorLevel <<std::endl;
std::cout << "theRollLevel " << theRollLevel <<std::endl;
#endif

// Debug using LOCAL_DEBUG
#ifdef LOCAL_DEBUG
std::cout << "Initialize ME0NumberingScheme" <<std::endl;
std::cout << "theRegionLevel " << theRegionLevel <<std::endl;
std::cout << "theLayerLevel " << theLayerLevel <<std::endl;
std::cout << "theSectorLevel " << theSectorLevel <<std::endl;
std::cout << "theRollLevel " << theRollLevel <<std::endl;
#endif
// -----------------------

// Debug using LogDebug
std::stringstream DebugStringStream;
DebugStringStream << "Initialize ME0NumberingScheme" <<std::endl;
DebugStringStream << "theRegionLevel " << theRegionLevel <<std::endl;
DebugStringStream << "theLayerLevel " << theLayerLevel <<std::endl;
DebugStringStream << "theSectorLevel " << theSectorLevel <<std::endl;
DebugStringStream << "theRollLevel " << theRollLevel <<std::endl;
std::string DebugString = DebugStringStream.str();
edm::LogVerbatim("ME0NumberingScheme")<<DebugString;
// --------------------
}

int ME0NumberingScheme::baseNumberToUnitNumber(const MuonBaseNumber num) {
int ME0NumberingScheme::baseNumberToUnitNumber(const MuonBaseNumber& num) {

edm::LogVerbatim("ME0NumberingScheme")<<"ME0NumberingScheme::baseNumberToUnitNumber BEGIN "<<std::endl;
// Debug using LOCAL_DEBUG
#ifdef LOCAL_DEBUG
std::cout << "ME0Numbering "<<num.getLevels()<<std::endl;
for (int level=1;level<=num.getLevels();level++) {
std::cout << "level "<<level << " " << num.getSuperNo(level)
<< " " << num.getBaseNo(level) << std::endl;
}
#endif
// -----------------------

#ifdef LOCAL_DEBUG
std::cout << "ME0Numbering "<<num.getLevels()<<std::endl;
// Debug using LogDebug
std::stringstream DebugStringStream;
DebugStringStream << "ME0Numbering :: number of levels = "<<num.getLevels()<<std::endl;
DebugStringStream << "Level \t SuperNo \t BaseNo"<<std::endl;
for (int level=1;level<=num.getLevels();level++) {
std::cout << "level "<<level << " " << num.getSuperNo(level)
<< " " << num.getBaseNo(level) << std::endl;
DebugStringStream <<level << " \t " << num.getSuperNo(level)
<< " \t " << num.getBaseNo(level) << std::endl;
}
#endif
std::string DebugString = DebugStringStream.str();
edm::LogVerbatim("ME0NumberingScheme")<<DebugString;
// -----------------------



int maxLevel = theLayerLevel;
if (num.getLevels()!=maxLevel) {
Expand All @@ -61,20 +94,33 @@ int ME0NumberingScheme::baseNumberToUnitNumber(const MuonBaseNumber num) {
chamber = num.getBaseNo(theSectorLevel) + 1;
// collect all info

#ifdef LOCAL_DEBUG
std::cout << "ME0NumberingScheme: Region " << region
<< " Layer " << layer
<< " Chamber " << chamber << " Roll " << roll << std::endl;
#endif
// Debug using LOCAL_DEBUG
#ifdef LOCAL_DEBUG
std::cout << "ME0NumberingScheme: Region " << region
<< " Layer " << layer
<< " Chamber " << chamber << " Roll " << roll << std::endl;
#endif
// -----------------------

// Debug using LogDebug
edm::LogVerbatim("ME0NumberingScheme") << "ME0NumberingScheme: Region " << region
<< " Layer " << layer
<< " Chamber " << chamber << " Roll " << roll << std::endl;
// -----------------------

// Build the actual numbering
ME0DetId id(region,layer,chamber,roll);


#ifdef LOCAL_DEBUG
std::cout << " DetId " << id << std::endl;
#endif

// Debug using LOCAL_DEBUG
#ifdef LOCAL_DEBUG
std::cout << " DetId " << id << std::endl;
#endif
// ---------------------

// Debug using LogDebug
edm::LogVerbatim("ME0NumberingScheme")<< " DetId " << id << std::endl;
// -----------------------

return id.rawId();
}

Expand Down
@@ -0,0 +1,158 @@
# Auto generated configuration file
# using:
# Revision: 1.19
# Source: /local/reps/CMSSW/CMSSW/Configuration/Applications/python/ConfigBuilder.py,v
# with command line options: SingleMuPt100_cfi -s GEN,SIM --conditions auto:run2_design --magField 38T_PostLS1 --datatier GEN-SIM --geometry Extended2015Muon,Extended2015MuonReco --customise=SLHCUpgradeSimulations/Configuration/gemCustoms.customise2023,SLHCUpgradeSimulations/Configuration/me0Customs.customise --eventcontent FEVTDEBUGHLT --era Run2_25ns -n 100 --no_exec --fileout out_sim.root --python_filename SingleMuPt100_cfi_GEM-SIM_Extended2015Muon_Custom_cfg.py
import FWCore.ParameterSet.Config as cms

from Configuration.StandardSequences.Eras import eras

process = cms.Process('SIM',eras.Run2_25ns)

# import of standard configurations
process.load('Configuration.StandardSequences.Services_cff')
process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi')
process.load('FWCore.MessageService.MessageLogger_cfi')
process.load('Configuration.EventContent.EventContent_cff')
process.load('SimGeneral.MixingModule.mixNoPU_cfi')
process.load('Configuration.Geometry.GeometryExtended2015MuonReco_cff')
process.load('Configuration.Geometry.GeometryExtended2015Muon_cff')
# for future releases: use GEMDev
# process.load('Configuration.Geometry.GeometryExtended2015MuonGEMDevReco_cff')
# process.load('Configuration.Geometry.GeometryExtended2015MuonGEMDev_cff')
process.load('Configuration.StandardSequences.MagneticField_38T_PostLS1_cff')
process.load('Configuration.StandardSequences.Generator_cff')
process.load('IOMC.EventVertexGenerators.VtxSmearedNominalCollision2015_cfi')
process.load('GeneratorInterface.Core.genFilterSummary_cff')
process.load('Configuration.StandardSequences.SimIdeal_cff')
process.load('Configuration.StandardSequences.EndOfProcess_cff')
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_condDBv2_cff')

process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(10)
)

# Input source
process.source = cms.Source("EmptySource")
process.options = cms.untracked.PSet()

### TO ACTIVATE LogVerbatim in Simulation Packages NEED TO:
### --------------------------------------------------------------
### scram b disable-biglib
### scram b clean
### scram b -j8 USER_CXXFLAGS="-DEDM_ML_DEBUG"
###
### TO ACTIVATE LogTrace IN GEMRecHit NEED TO COMPILE IT WITH:
### --------------------------------------------------------------
### --> scram b -j8 USER_CXXFLAGS="-DEDM_ML_DEBUG"
### Make sure that you first cleaned your CMSSW version:
### --> scram b clean
### before issuing the scram command above
### --------------------------------------------------------------
### !!! If you want to compile any CSC-related code with LogDebug ON,
### you need to explicitly compile and build the CSCDetId package too,
### i.e. do first: git cms-addpkg DataFormats/MuonDetId.
### This problem can occur at other places as well, so check carefully
### the compilation process when switching on the debug flags
### --------------------------------------------------------------
### LogTrace output goes to cout; all other output to "junk.log"
### Code/Configuration with thanks to Tim Cox
### --------------------------------------------------------------
### to have a handle on the loops inside RPCSimSetup
### I have split the LogDebug stream in several streams
### that can be activated independentl
##################################################################
process.load("FWCore.MessageLogger.MessageLogger_cfi")
process.MessageLogger.categories.append("ME0GeometryBuilderfromDDD") # in Geometry/GEMGeometryBuilder
process.MessageLogger.categories.append("ME0NumberingScheme") # in Geometry/MuonNumbering
process.MessageLogger.categories.append("MuonSimDebug") # in SimG4CMS/Muon
process.MessageLogger.categories.append("MuonME0FrameRotation") # in SimG4CMS/Muon
process.MessageLogger.debugModules = cms.untracked.vstring("*")
process.MessageLogger.destinations = cms.untracked.vstring("cout","junk")
process.MessageLogger.cout = cms.untracked.PSet(
threshold = cms.untracked.string("DEBUG"),
default = cms.untracked.PSet( limit = cms.untracked.int32(0) ),
FwkReport = cms.untracked.PSet( limit = cms.untracked.int32(-1) ),
ME0GeometryBuilderfromDDD = cms.untracked.PSet( limit = cms.untracked.int32(-1) ),
ME0NumberingScheme = cms.untracked.PSet( limit = cms.untracked.int32(-1) ),
MuonME0FrameRotation = cms.untracked.PSet( limit = cms.untracked.int32(-1) ),
MuonSimDebug = cms.untracked.PSet( limit = cms.untracked.int32(-1) ),
)


# Production Info
process.configurationMetadata = cms.untracked.PSet(
annotation = cms.untracked.string('SingleMuPt100_cfi nevts:100'),
name = cms.untracked.string('Applications'),
version = cms.untracked.string('$Revision: 1.19 $')
)

# Output definition

process.FEVTDEBUGHLToutput = cms.OutputModule("PoolOutputModule",
SelectEvents = cms.untracked.PSet(
SelectEvents = cms.vstring('generation_step')
),
dataset = cms.untracked.PSet(
dataTier = cms.untracked.string('GEN-SIM'),
filterName = cms.untracked.string('')
),
eventAutoFlushCompressedSize = cms.untracked.int32(1048576),
fileName = cms.untracked.string('out_sim.root'),
outputCommands = process.FEVTDEBUGHLTEventContent.outputCommands,
splitLevel = cms.untracked.int32(0)
)

# Additional output definition

# Other statements
process.genstepfilter.triggerConditions=cms.vstring("generation_step")
from Configuration.AlCa.GlobalTag_condDBv2 import GlobalTag
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_design', '')

process.generator = cms.EDProducer("FlatRandomPtGunProducer",
AddAntiParticle = cms.bool(True),
PGunParameters = cms.PSet(
MaxEta = cms.double(3.0),
MaxPhi = cms.double(3.14159265359),
MaxPt = cms.double(100.01),
MinEta = cms.double(2.0),
MinPhi = cms.double(-3.14159265359),
MinPt = cms.double(99.99),
PartID = cms.vint32(-13)
),
Verbosity = cms.untracked.int32(0),
firstRun = cms.untracked.uint32(1),
psethack = cms.string('single mu pt 100')
)


# Path and EndPath definitions
process.generation_step = cms.Path(process.pgen)
process.simulation_step = cms.Path(process.psim)
process.genfiltersummary_step = cms.EndPath(process.genFilterSummary)
process.endjob_step = cms.EndPath(process.endOfProcess)
process.FEVTDEBUGHLToutput_step = cms.EndPath(process.FEVTDEBUGHLToutput)

# Schedule definition
process.schedule = cms.Schedule(process.generation_step,process.genfiltersummary_step,process.simulation_step,process.endjob_step,process.FEVTDEBUGHLToutput_step)
# filter all path with the production filter sequence
for path in process.paths:
getattr(process,path)._seq = process.generator * getattr(process,path)._seq

# customisation of the process.

# Automatic addition of the customisation function from SLHCUpgradeSimulations.Configuration.gemCustoms
from SLHCUpgradeSimulations.Configuration.gemCustoms import customise2023

#call to customisation function customise2023 imported from SLHCUpgradeSimulations.Configuration.gemCustoms
process = customise2023(process)

# Automatic addition of the customisation function from SLHCUpgradeSimulations.Configuration.me0Customs
from SLHCUpgradeSimulations.Configuration.me0Customs import customise

#call to customisation function customise imported from SLHCUpgradeSimulations.Configuration.me0Customs
process = customise(process)

# End of customisation functions

Expand Up @@ -17,6 +17,9 @@
process.load('SimGeneral.MixingModule.mixNoPU_cfi')
process.load('Configuration.Geometry.GeometryExtended2015MuonReco_cff')
process.load('Configuration.Geometry.GeometryExtended2015Muon_cff')
# for future releases: use GEMDev
# process.load('Configuration.Geometry.GeometryExtended2015MuonGEMDevReco_cff')
# process.load('Configuration.Geometry.GeometryExtended2015MuonGEMDev_cff')
process.load('Configuration.StandardSequences.MagneticField_38T_PostLS1_cff')
process.load('Configuration.StandardSequences.Generator_cff')
process.load('IOMC.EventVertexGenerators.VtxSmearedNominalCollision2015_cfi')
Expand All @@ -26,14 +29,54 @@
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_condDBv2_cff')

process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(100)
input = cms.untracked.int32(1)
)

# Input source
process.source = cms.Source("EmptySource")

process.options = cms.untracked.PSet(

process.options = cms.untracked.PSet()

### TO ACTIVATE LogVerbatim in Simulation Packages NEED TO:
### --------------------------------------------------------------
### scram b disable-biglib
### scram b clean
### scram b -j8 USER_CXXFLAGS="-DEDM_ML_DEBUG"
###
### TO ACTIVATE LogTrace IN GEMRecHit NEED TO COMPILE IT WITH:
### --------------------------------------------------------------
### --> scram b -j8 USER_CXXFLAGS="-DEDM_ML_DEBUG"
### Make sure that you first cleaned your CMSSW version:
### --> scram b clean
### before issuing the scram command above
### --------------------------------------------------------------
### !!! If you want to compile any CSC-related code with LogDebug ON,
### you need to explicitly compile and build the CSCDetId package too,
### i.e. do first: git cms-addpkg DataFormats/MuonDetId.
### This problem can occur at other places as well, so check carefully
### the compilation process when switching on the debug flags
### --------------------------------------------------------------
### LogTrace output goes to cout; all other output to "junk.log"
### Code/Configuration with thanks to Tim Cox
### --------------------------------------------------------------
### to have a handle on the loops inside RPCSimSetup
### I have split the LogDebug stream in several streams
### that can be activated independentl
##################################################################
process.load("FWCore.MessageLogger.MessageLogger_cfi")
process.MessageLogger.categories.append("ME0GeometryBuilderfromDDD") # in Geometry/GEMGeometryBuilder
process.MessageLogger.categories.append("ME0NumberingScheme") # in Geometry/MuonNumbering
process.MessageLogger.categories.append("MuonSimDebug") # in SimG4CMS/Muon
process.MessageLogger.categories.append("MuonME0FrameRotation") # in SimG4CMS/Muon
process.MessageLogger.debugModules = cms.untracked.vstring("*")
process.MessageLogger.destinations = cms.untracked.vstring("cout","junk")
process.MessageLogger.cout = cms.untracked.PSet(
threshold = cms.untracked.string("DEBUG"),
default = cms.untracked.PSet( limit = cms.untracked.int32(0) ),
FwkReport = cms.untracked.PSet( limit = cms.untracked.int32(-1) ),
ME0GeometryBuilderfromDDD = cms.untracked.PSet( limit = cms.untracked.int32(-1) ),
ME0NumberingScheme = cms.untracked.PSet( limit = cms.untracked.int32(-1) ),
MuonME0FrameRotation = cms.untracked.PSet( limit = cms.untracked.int32(-1) ),
MuonSimDebug = cms.untracked.PSet( limit = cms.untracked.int32(-1) ),
)

# Production Info
Expand Down Expand Up @@ -69,10 +112,10 @@
process.generator = cms.EDProducer("FlatRandomPtGunProducer",
AddAntiParticle = cms.bool(True),
PGunParameters = cms.PSet(
MaxEta = cms.double(2.5),
MaxEta = cms.double(3.0),
MaxPhi = cms.double(3.14159265359),
MaxPt = cms.double(100.01),
MinEta = cms.double(-2.5),
MinEta = cms.double(2.0),
MinPhi = cms.double(-3.14159265359),
MinPt = cms.double(99.99),
PartID = cms.vint32(-13)
Expand Down

0 comments on commit 62e0312

Please sign in to comment.