Skip to content

Commit

Permalink
Merge pull request #782 from ptcox/consumes_to_cscdigitizer
Browse files Browse the repository at this point in the history
Consumes to CSCDigitizer
  • Loading branch information
ktf committed Sep 12, 2013
2 parents eba4146 + eff196f commit 0156c87
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 50 deletions.
6 changes: 4 additions & 2 deletions SimMuon/CSCDigitizer/python/muonCSCDigis_cfi.py
Expand Up @@ -68,8 +68,10 @@
tailShaping = cms.int32(2),
doNoise = cms.bool(True)
),
mixLabel = cms.string('mix'),
InputCollection = cms.string('g4SimHitsMuonCSCHits'),

mixLabel = cms.string("mix"),
InputCollection = cms.string("g4SimHitsMuonCSCHits"),

stripConditions = cms.string('Database'),
GeometryType = cms.string('idealForDigi'),
digitizeBadChambers = cms.bool(False),
Expand Down
22 changes: 9 additions & 13 deletions SimMuon/CSCDigitizer/src/CSCDigiDump.cc
Expand Up @@ -2,19 +2,14 @@
#include "DataFormats/Common/interface/Handle.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "DataFormats/CSCDigi/interface/CSCStripDigiCollection.h"
#include "DataFormats/CSCDigi/interface/CSCWireDigiCollection.h"
#include "DataFormats/CSCDigi/interface/CSCComparatorDigiCollection.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include <iostream>
using std::endl;
using std::cout;
using std::string;

CSCDigiDump::CSCDigiDump(edm::ParameterSet const& conf)
: wireDigiTag_(conf.getParameter<edm::InputTag>("wireDigiTag")),
stripDigiTag_(conf.getParameter<edm::InputTag>("stripDigiTag")),
comparatorDigiTag_(conf.getParameter<edm::InputTag>("comparatorDigiTag"))
{
{
wd_token = consumes<CSCWireDigiCollection>(conf.getParameter<edm::InputTag>("wireDigiTag"));
sd_token = consumes<CSCStripDigiCollection>(conf.getParameter<edm::InputTag>("stripDigiTag"));
cd_token = consumes<CSCComparatorDigiCollection>(conf.getParameter<edm::InputTag>("comparatorDigiTag"));
}


Expand All @@ -25,7 +20,8 @@ void CSCDigiDump::analyze(edm::Event const& e, edm::EventSetup const& c) {

std::cout << "Event " << e.id() << std::endl;

e.getByLabel(wireDigiTag_, wires);
e.getByToken(wd_token, wires);

for (CSCWireDigiCollection::DigiRangeIterator j=wires->begin(); j!=wires->end(); j++) {
std::cout << "Wire digis from "<< CSCDetId((*j).first) << std::endl;
std::vector<CSCWireDigi>::const_iterator digiItr = (*j).second.first;
Expand All @@ -35,7 +31,7 @@ void CSCDigiDump::analyze(edm::Event const& e, edm::EventSetup const& c) {
}
}

e.getByLabel(stripDigiTag_, strips);
e.getByToken(sd_token, strips);

for (CSCStripDigiCollection::DigiRangeIterator j=strips->begin(); j!=strips->end(); j++) {
std::cout << "Strip digis from "<< CSCDetId((*j).first) << std::endl;
Expand All @@ -46,7 +42,7 @@ void CSCDigiDump::analyze(edm::Event const& e, edm::EventSetup const& c) {
}
}

e.getByLabel(comparatorDigiTag_, comparators);
e.getByToken(cd_token, comparators);

for (CSCComparatorDigiCollection::DigiRangeIterator j=comparators->begin();
j!=comparators->end(); j++)
Expand Down
11 changes: 7 additions & 4 deletions SimMuon/CSCDigitizer/src/CSCDigiDump.h
@@ -1,19 +1,22 @@
#ifndef CSCDigitizer_CSCDigiDump_h
#define CSCDigitizer_CSCDigiDump_h

#include "FWCore/Framework/interface/ConsumesCollector.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include <string>
#include "DataFormats/CSCDigi/interface/CSCStripDigiCollection.h"
#include "DataFormats/CSCDigi/interface/CSCWireDigiCollection.h"
#include "DataFormats/CSCDigi/interface/CSCComparatorDigiCollection.h"

class CSCDigiDump : public edm::EDAnalyzer {
public:
explicit CSCDigiDump(edm::ParameterSet const& conf);
virtual void analyze(edm::Event const& e, edm::EventSetup const& c);

private:
edm::InputTag wireDigiTag_;
edm::InputTag stripDigiTag_;
edm::InputTag comparatorDigiTag_;
edm::EDGetTokenT<CSCWireDigiCollection> wd_token;
edm::EDGetTokenT<CSCStripDigiCollection> sd_token;
edm::EDGetTokenT<CSCComparatorDigiCollection> cd_token;
};

#endif
Expand Down
24 changes: 14 additions & 10 deletions SimMuon/CSCDigitizer/src/CSCDigiProducer.cc
@@ -1,21 +1,26 @@
#include "DataFormats/Common/interface/Handle.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "SimMuon/CSCDigitizer/src/CSCDigiProducer.h"

#include "DataFormats/Common/interface/Handle.h"

#include "Geometry/CSCGeometry/interface/CSCGeometry.h"
#include "Geometry/Records/interface/MuonGeometryRecord.h"

#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
#include "SimDataFormats/CrossingFrame/interface/MixCollection.h"

#include "SimMuon/CSCDigitizer/src/CSCConfigurableStripConditions.h"
#include "SimMuon/CSCDigitizer/src/CSCDbStripConditions.h"

#include "SimGeneral/HepPDTRecord/interface/ParticleDataTable.h"

#include "FWCore/ServiceRegistry/interface/Service.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "FWCore/Utilities/interface/RandomNumberGenerator.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"


#include <string>

CSCDigiProducer::CSCDigiProducer(const edm::ParameterSet& ps)
: theDigitizer(ps),
Expand Down Expand Up @@ -58,10 +63,9 @@ CSCDigiProducer::CSCDigiProducer(const edm::ParameterSet& ps)
theDigitizer.setRandomEngine(engine);
theStripConditions->setRandomEngine(engine);

//Name of Collection used for create the XF
mix_ = ps.getParameter<std::string>("mixLabel");
collection_for_XF = ps.getParameter<std::string>("InputCollection");

std::string mix_ = ps.getParameter<std::string>("mixLabel");
std::string collection_ = ps.getParameter<std::string>("InputCollection");
cf_token = consumes<CrossingFrame<PSimHit> >( edm::InputTag(mix_, collection_) );
}


Expand All @@ -74,7 +78,7 @@ CSCDigiProducer::~CSCDigiProducer()
void CSCDigiProducer::produce(edm::Event& e, const edm::EventSetup& eventSetup) {

edm::Handle<CrossingFrame<PSimHit> > cf;
e.getByLabel(mix_, collection_for_XF, cf);
e.getByToken(cf_token, cf);

std::auto_ptr<MixCollection<PSimHit> >
hits( new MixCollection<PSimHit>(cf.product()) );
Expand Down
11 changes: 6 additions & 5 deletions SimMuon/CSCDigitizer/src/CSCDigiProducer.h
@@ -1,9 +1,13 @@
#ifndef CSCDigiProducer_h
#define CSCDigiProducer_h

#include "FWCore/Framework/interface/ConsumesCollector.h"
#include "FWCore/Framework/interface/EDProducer.h"
#include "SimMuon/CSCDigitizer/src/CSCDigitizer.h"
class CSCStripConditions;
#include "SimDataFormats/CrossingFrame/interface/MixCollection.h"
#include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"

class CSCStripConditions;

class CSCDigiProducer : public edm::EDProducer
{
Expand All @@ -20,11 +24,8 @@ class CSCDigiProducer : public edm::EDProducer

CSCDigitizer theDigitizer;
CSCStripConditions * theStripConditions;

std::string geometryType;
//Name of Collection used for create the XF
std::string mix_;
std::string collection_for_XF;
edm::EDGetTokenT<CrossingFrame<PSimHit> > cf_token;
};

#endif
Expand Down
76 changes: 60 additions & 16 deletions SimMuon/CSCDigitizer/test/CSCDigitizerTest_cfg.py
@@ -1,43 +1,87 @@

# Test of CSCDigitizer
# Updated for 700pre3 - Tim Cox - 12.09.2013

import FWCore.ParameterSet.Config as cms

process = cms.Process("CSCDigitizerTest")
process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(100))
process.load("SimGeneral.MixingModule.mixNoPU_cfi")

process.load("Configuration.StandardSequences.GeometryPilot2_cff")
process.load("Configuration.StandardSequences.MagneticField_cff")
process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi")

process.load("Geometry.MuonNumbering.muonNumberingInitialization_cfi")

#include "SimMuon/CSCDigitizer/data/muonCSCDbConditions.cfi"
#replace muonCSCDigis.stripConditions = "Database"
#replace muonCSCDigis.strips.ampGainSigma = 0.
#replace muonCSCDigis.strips.peakTimeSigma = 0.
#replace muonCSCDigis.strips.doNoise = false
#replace muonCSCDigis.wires.doNoise = false
#replace muonCSCDigis.strips.doCrosstalk = false
process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
process.GlobalTag.globaltag = "MC_38Y_V9::All"

## process.GlobalTag.globaltag = "MC_38Y_V9::All"
## Non-standard, non-MC, tag because 700pre3 is under development
process.GlobalTag.globaltag = "PRE_62_V8::All"

process.load("Validation.MuonCSCDigis.cscDigiValidation_cfi")

process.load("SimMuon.CSCDigitizer.muonCSCDigis_cfi")
process.load("CalibMuon.CSCCalibration.CSCChannelMapper_cfi")
process.load("CalibMuon.CSCCalibration.CSCIndexer_cfi")

process.source = cms.Source("PoolSource",
fileNames = cms.untracked.vstring(
'/store/relval/CMSSW_3_8_0/RelValSingleMuPt100/GEN-SIM-DIGI-RAW-HLTDEBUG/MC_38Y_V7-v1/0005/62065D40-3D95-DF11-83FA-002618943976.root',
'/store/relval/CMSSW_3_8_0/RelValSingleMuPt100/GEN-SIM-DIGI-RAW-HLTDEBUG/MC_38Y_V7-v1/0004/F0D135F1-0995-DF11-9B08-0018F3D096A2.root',
'/store/relval/CMSSW_3_8_0/RelValSingleMuPt100/GEN-SIM-DIGI-RAW-HLTDEBUG/MC_38Y_V7-v1/0004/CEC41BA0-0895-DF11-B5E9-0018F3D096DA.root',
'/store/relval/CMSSW_3_8_0/RelValSingleMuPt100/GEN-SIM-DIGI-RAW-HLTDEBUG/MC_38Y_V7-v1/0004/521C57A2-0895-DF11-9E35-001BFCDBD160.root' )
'/store/relval/CMSSW_7_0_0_pre3/RelValSingleMuPt100/GEN-SIM-DIGI-RAW-HLTDEBUG/PRE_ST62_V8-v1/00000/5E813E19-8414-E311-A5CB-0025905964B4.root'
)
)

# attempt minimal mixing module w/o pu

from SimGeneral.MixingModule.aliases_cfi import *
from SimGeneral.MixingModule.mixObjects_cfi import *
from SimGeneral.MixingModule.trackingTruthProducer_cfi import *

process.RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService",
moduleSeeds = cms.PSet(
simMuonCSCDigis = cms.untracked.uint32(468)

process.mix = cms.EDProducer("MixingModule",
digitizers = cms.PSet(
mergedtruth = cms.PSet(
trackingParticles
)
),
LabelPlayback = cms.string(' '),
maxBunch = cms.int32(3),
minBunch = cms.int32(-5), ## in terms of 25 ns

bunchspace = cms.int32(25),
mixProdStep1 = cms.bool(False),
mixProdStep2 = cms.bool(False),

playback = cms.untracked.bool(False),
useCurrentProcessOnly = cms.bool(False),
mixObjects = cms.PSet(
mixTracks = cms.PSet(
mixSimTracks
),
mixVertices = cms.PSet(
mixSimVertices
),
mixSH = cms.PSet(
mixSimHits
),
mixHepMC = cms.PSet(
mixHepMCProducts
)
)
)


process.RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService",
simMuonCSCDigis = cms.PSet(
initialSeed = cms.untracked.uint32(1234567),
engineName = cms.untracked.string('TRandom3')
),
mix = cms.PSet(
initialSeed = cms.untracked.uint32(1234567),
engineName = cms.untracked.string('TRandom3')
)
)

process.DQMStore = cms.Service("DQMStore")

process.load("SimMuon.CSCDigitizer.cscDigiDump_cfi")
Expand Down

0 comments on commit 0156c87

Please sign in to comment.