Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Central bunch spacing producer #11544

Merged
merged 5 commits into from
Oct 1, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Configuration/StandardSequences/python/PATMC_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
from PhysicsTools.PatAlgos.producersLayer1.patCandidates_cff import *
from PhysicsTools.PatAlgos.selectionLayer1.selectedPatCandidates_cff import *
from PhysicsTools.PatAlgos.slimming.slimming_cff import *
from RecoLuminosity.LumiProducer.bunchSpacingProducer_cfi import *

miniAOD=cms.Sequence()
1 change: 1 addition & 0 deletions Configuration/StandardSequences/python/PAT_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
from PhysicsTools.PatAlgos.producersLayer1.patCandidates_cff import *
from PhysicsTools.PatAlgos.selectionLayer1.selectedPatCandidates_cff import *
from PhysicsTools.PatAlgos.slimming.slimming_cff import *
from RecoLuminosity.LumiProducer.bunchSpacingProducer_cfi import *
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, that'll do just fine too. Thanks.


miniAOD=cms.Sequence()
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
# luminosity
#
from RecoLuminosity.LumiProducer.lumiProducer_cff import *
from RecoLuminosity.LumiProducer.bunchSpacingProducer_cfi import *
# no bunchspacing in cosmics
bunchSpacingProducer.overrideBunchSpacing=True
bunchSpacingProducer.bunchSpacingOverride=50

#
# tracker
#
Expand Down Expand Up @@ -46,8 +51,8 @@
caloCosmics_HcalNZS = cms.Sequence(calolocalrecoNZS*ecalClusters)
muonsLocalRecoCosmics = cms.Sequence(muonlocalreco+muonlocalrecoT0Seg)

localReconstructionCosmics = cms.Sequence(trackerCosmics*caloCosmics*muonsLocalRecoCosmics*vertexrecoCosmics+lumiProducer)
localReconstructionCosmics_HcalNZS = cms.Sequence(trackerCosmics*caloCosmics_HcalNZS*muonsLocalRecoCosmics*vertexrecoCosmics +lumiProducer)
localReconstructionCosmics = cms.Sequence(bunchSpacingProducer*trackerCosmics*caloCosmics*muonsLocalRecoCosmics*vertexrecoCosmics+lumiProducer)
localReconstructionCosmics_HcalNZS = cms.Sequence(bunchSpacingProducer*trackerCosmics*caloCosmics_HcalNZS*muonsLocalRecoCosmics*vertexrecoCosmics +lumiProducer)


# global reco
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

# Tracker
from RecoVertex.BeamSpotProducer.BeamSpot_cfi import *
from RecoLuminosity.LumiProducer.bunchSpacingProducer_cfi import *
from RecoLocalTracker.Configuration.RecoLocalTrackerHeavyIons_cff import *
from RecoTracker.MeasurementDet.MeasurementTrackerEventProducer_cfi import *
from RecoPixelVertexing.PixelLowPtUtilities.siPixelClusterShapeCache_cfi import *
Expand Down Expand Up @@ -37,12 +38,12 @@
hbhereco = hbheprereco.clone()
hcalLocalRecoSequence.replace(hbheprereco,hbhereco)
muonReco = cms.Sequence(trackerlocalreco+MeasurementTrackerEvent+siPixelClusterShapeCache+muonlocalreco)
localReco = cms.Sequence(offlineBeamSpot*muonReco*caloReco*castorreco)
localReco = cms.Sequence(bunchSpacingProducer*offlineBeamSpot*muonReco*caloReco*castorreco)

#hbherecoMB = hbheprerecoMB.clone()
#hcalLocalRecoSequenceNZS.replace(hbheprerecoMB,hbherecoMB)
caloRecoNZS = cms.Sequence(caloReco+hcalLocalRecoSequenceNZS)
localReco_HcalNZS = cms.Sequence(offlineBeamSpot*muonReco*caloRecoNZS)
localReco_HcalNZS = cms.Sequence(bunchSpacingProducer*offlineBeamSpot*muonReco*caloRecoNZS)

#--------------------------------------------------------------------------
# Main Sequence
Expand Down
3 changes: 2 additions & 1 deletion Configuration/StandardSequences/python/Reconstruction_cff.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import FWCore.ParameterSet.Config as cms

from RecoLuminosity.LumiProducer.lumiProducer_cff import *
from RecoLuminosity.LumiProducer.bunchSpacingProducer_cfi import *
from RecoLocalMuon.Configuration.RecoLocalMuon_cff import *
from RecoLocalCalo.Configuration.RecoLocalCalo_cff import *
from RecoTracker.Configuration.RecoTracker_cff import *
Expand Down Expand Up @@ -91,7 +92,7 @@
from FWCore.Modules.logErrorHarvester_cfi import *

# "Export" Section
reconstruction = cms.Sequence(localreco*globalreco*highlevelreco*logErrorHarvester)
reconstruction = cms.Sequence(bunchSpacingProducer*localreco*globalreco*highlevelreco*logErrorHarvester)

#need a fully expanded sequence copy
modulesToRemove = list() # copy does not work well
Expand Down
26 changes: 3 additions & 23 deletions RecoEgamma/EgammaTools/plugins/EGExtraInfoModifierFromDB.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class EGExtraInfoModifierFromDB : public ModifyObjectValueBase {
bool autoDetectBunchSpacing_;
int bunchspacing_;
edm::InputTag bunchspacingTag_;
edm::EDGetTokenT<int> bunchSpacingToken_;
edm::EDGetTokenT<unsigned int> bunchSpacingToken_;
float rhoValue_;
edm::InputTag rhoTag_;
edm::EDGetTokenT<double> rhoToken_;
Expand Down Expand Up @@ -244,29 +244,9 @@ void EGExtraInfoModifierFromDB::setEvent(const edm::Event& evt) {
}

if (autoDetectBunchSpacing_) {
if (evt.isRealData()) {
edm::RunNumber_t run = evt.run();
if (run == 178003 ||
run == 178004 ||
run == 209089 ||
run == 209106 ||
run == 209109 ||
run == 209146 ||
run == 209148 ||
run == 209151) {
bunchspacing_ = 25;
}
else if (run < 253000) {
bunchspacing_ = 50;
}
else {
bunchspacing_ = 25;
}
} else {
edm::Handle<int> bunchSpacingH;
edm::Handle<unsigned int> bunchSpacingH;
evt.getByToken(bunchSpacingToken_,bunchSpacingH);
bunchspacing_ = *bunchSpacingH;
}
}

edm::Handle<double> rhoH;
Expand Down Expand Up @@ -329,7 +309,7 @@ void EGExtraInfoModifierFromDB::setConsumes(edm::ConsumesCollector& sumes) {
vtxToken_ = sumes.consumes<reco::VertexCollection>(vtxTag_);

if (autoDetectBunchSpacing_)
bunchSpacingToken_ = sumes.consumes<int>(bunchspacingTag_);
bunchSpacingToken_ = sumes.consumes<unsigned int>(bunchspacingTag_);

//setup electrons
if(!(empty_tag == e_conf.electron_src))
Expand Down
2 changes: 1 addition & 1 deletion RecoEgamma/EgammaTools/python/regressionModifier_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
regressionModifier = \
cms.PSet( modifierName = cms.string('EGExtraInfoModifierFromDB'),
autoDetectBunchSpacing = cms.bool(True),
bunchSpacingTag = cms.InputTag("addPileupInfo:bunchSpacing"),
bunchSpacingTag = cms.InputTag("bunchSpacingProducer"),
manualBunchSpacing = cms.int32(50),
rhoCollection = cms.InputTag("fixedGridRhoFastjetAll"),
vertexCollection = cms.InputTag("offlinePrimaryVertices"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ EcalUncalibRecHitWorkerMultiFit::EcalUncalibRecHitWorkerMultiFit(const edm::Para
useLumiInfoRunHeader_ = ps.getParameter<bool>("useLumiInfoRunHeader");

if (useLumiInfoRunHeader_) {
bunchSpacing_ = c.consumes<int>(edm::InputTag("addPileupInfo","bunchSpacing"));
bunchSpacing_ = c.consumes<unsigned int>(edm::InputTag("bunchSpacingProducer"));
bunchSpacingManual_ = 0;
} else {
bunchSpacingManual_ = ps.getParameter<int>("bunchSpacing");
Expand Down Expand Up @@ -130,35 +130,13 @@ void
EcalUncalibRecHitWorkerMultiFit::set(const edm::Event& evt)
{

int bunchspacing = 450;
unsigned int bunchspacing = 450;

if (useLumiInfoRunHeader_) {

if (evt.isRealData()) {
edm::RunNumber_t run = evt.run();
if (run == 178003 ||
run == 178004 ||
run == 209089 ||
run == 209106 ||
run == 209109 ||
run == 209146 ||
run == 209148 ||
run == 209151) {
bunchspacing = 25;
}
else if (run < 253000) {
bunchspacing = 50;
}
else {
bunchspacing = 25;
}
}
else {
edm::Handle<int> bunchSpacingH;
edm::Handle<unsigned int> bunchSpacingH;
evt.getByToken(bunchSpacing_,bunchSpacingH);
bunchspacing = *bunchSpacingH;
}

}
else {
bunchspacing = bunchSpacingManual_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class EcalUncalibRecHitWorkerMultiFit : public EcalUncalibRecHitWorkerBaseClass
EcalUncalibRecHitMultiFitAlgo multiFitMethod_;

int bunchSpacingManual_;
edm::EDGetTokenT<int> bunchSpacing_;
edm::EDGetTokenT<unsigned int> bunchSpacing_;

// determine which of the samples must actually be used by ECAL local reco
edm::ESHandle<EcalSampleMask> sampleMaskHand_;
Expand Down
5 changes: 5 additions & 0 deletions RecoLuminosity/LumiProducer/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@
<use name="xerces-c"/>
<flags EDM_PLUGIN="1"/>
</library>
<library file="BunchSpacingProducer.cc" name="BunchSpacingProducer">
<use name="FWCore/PluginManager"/>
<use name="DataFormats/Provenance"/>
<flags EDM_PLUGIN="1"/>
</library>
<library file="ExpressLumiProducer.cc" name="ExpressLumiProducer">
<use name="RecoLuminosity/LumiProducer"/>
<use name="FWCore/PluginManager"/>
Expand Down
116 changes: 116 additions & 0 deletions RecoLuminosity/LumiProducer/plugins/BunchSpacingProducer.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
#include "FWCore/Framework/interface/stream/EDProducer.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/LuminosityBlock.h"
#include "FWCore/Framework/interface/Run.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include <iostream>

namespace edm {
class EventSetup;
}

//
// class declaration
//
class BunchSpacingProducer : public edm::stream::EDProducer<> {

public:

explicit BunchSpacingProducer(const edm::ParameterSet&);

~BunchSpacingProducer();

virtual void produce(edm::Event&, const edm::EventSetup&) override final;

static void fillDescriptions( edm::ConfigurationDescriptions & ) ;

private:

edm::EDGetTokenT<int> bunchSpacing_;
unsigned int bunchSpacingOverride_;
bool overRide_;
};

//
// constructors and destructor
//


BunchSpacingProducer::
BunchSpacingProducer::BunchSpacingProducer(const edm::ParameterSet& iConfig)
{
// register your products
produces<unsigned int>();
bunchSpacing_ = consumes<int>(edm::InputTag("addPileupInfo","bunchSpacing"));
overRide_=false;
if ( iConfig.exists("overrideBunchSpacing") ) {
std::cout << "ok parameter eixsts\n";
overRide_= iConfig.getParameter<bool>("overrideBunchSpacing");
if ( overRide_) {
std::cout << "and its true\n";
bunchSpacingOverride_=iConfig.getParameter<unsigned int>("bunchSpacingOverride");
}
}
}

BunchSpacingProducer::~BunchSpacingProducer(){
}

//
// member functions
//
void BunchSpacingProducer::produce(edm::Event& e, const edm::EventSetup& iSetup)
{
if ( overRide_ ) {
std::auto_ptr<unsigned int> pOut1(new unsigned int);
*pOut1=bunchSpacingOverride_;
e.put(pOut1);
std::cout << "Derived from override " << bunchSpacingOverride_ << std::endl;
return;
}

unsigned int bunchSpacing=50;
unsigned int run=e.run();

if ( e.isRealData()) {
if ( ( run > 252126 && run != 254833 )||
run == 178003 ||
run == 178004 ||
run == 209089 ||
run == 209106 ||
run == 209109 ||
run == 209146 ||
run == 209148 ||
run == 209151) {
bunchSpacing = 25;
}
}
else{
edm::Handle<int> bunchSpacingH;
e.getByToken(bunchSpacing_,bunchSpacingH);
bunchSpacing = *bunchSpacingH;
}

std::cout << "Derived from run number " << bunchSpacing << std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cout, really?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debug printout… whoops

On Oct 1, 2015, at 2:11 PM, Slava Krutelyov [email protected] wrote:

In RecoLuminosity/LumiProducer/plugins/BunchSpacingProducer.cc:

  • run == 209089 ||
  • run == 209106 ||
  • run == 209109 ||
  • run == 209146 ||
  • run == 209148 ||
  • run == 209151) {
  •  bunchSpacing = 25;
    
  • }
  • }
  • else{
  • edm::Handle bunchSpacingH;
  • e.getByToken(bunchSpacing_,bunchSpacingH);
  • bunchSpacing = *bunchSpacingH;
  • }
  • std::cout << "Derived from run number " << bunchSpacing << std::endl;

cout, really?


Reply to this email directly or view it on GitHub.

std::auto_ptr<unsigned int> pOut1(new unsigned int);
*pOut1=bunchSpacing;
e.put(pOut1);
return;
}

void BunchSpacingProducer::fillDescriptions( edm::ConfigurationDescriptions & descriptions )
{
edm::ParameterSetDescription desc ;
desc.add<bool>("overrideBunchSpacing",false); // true for prompt reco
desc.add<unsigned int>("bunchSpacingOverride",25); // override value

descriptions.add("bunchSpacingProducer",desc) ;
}



#include "FWCore/Framework/interface/MakerMacros.h"
DEFINE_FWK_MODULE(BunchSpacingProducer);
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class PFClusterEMEnergyCorrector {
bool autoDetectBunchSpacing_;
int bunchSpacingManual_;

edm::EDGetTokenT<int> bunchSpacing_;
edm::EDGetTokenT<unsigned int> bunchSpacing_;

edm::EDGetTokenT<EcalRecHitCollection> _recHitsEB;
edm::EDGetTokenT<EcalRecHitCollection> _recHitsEE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ PFClusterEMEnergyCorrector::PFClusterEMEnergyCorrector(const edm::ParameterSet&
autoDetectBunchSpacing_ = conf.getParameter<bool>("autoDetectBunchSpacing");

if (autoDetectBunchSpacing_) {
bunchSpacing_ = cc.consumes<int>(edm::InputTag("addPileupInfo","bunchSpacing"));
bunchSpacing_ = cc.consumes<unsigned int>(edm::InputTag("bunchSpacingProducer"));
bunchSpacingManual_ = 0;
}
else {
Expand Down Expand Up @@ -125,30 +125,9 @@ void PFClusterEMEnergyCorrector::correctEnergies(const edm::Event &evt, const ed
int bunchspacing = 450;

if (autoDetectBunchSpacing_) {
if (evt.isRealData()) {
edm::RunNumber_t run = evt.run();
if (run == 178003 ||
run == 178004 ||
run == 209089 ||
run == 209106 ||
run == 209109 ||
run == 209146 ||
run == 209148 ||
run == 209151) {
bunchspacing = 25;
}
else if (run < 253000) {
bunchspacing = 50;
}
else {
bunchspacing = 25;
}
}
else {
edm::Handle<int> bunchSpacingH;
edm::Handle<unsigned int> bunchSpacingH;
evt.getByToken(bunchSpacing_,bunchSpacingH);
bunchspacing = *bunchSpacingH;
}
}
else {
bunchspacing = bunchSpacingManual_;
Expand Down
2 changes: 1 addition & 1 deletion Validation/Configuration/python/ECALHCAL.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def customise(process):
cms.InputTag("interestingEcalDetIdEE"),
)

process.local_digireco = cms.Path(process.mix * process.addPileupInfo * process.calDigi * process.ecalPacker * process.esDigiToRaw * process.hcalRawData * process.rawDataCollector * process.ecalDigis * process.ecalPreshowerDigis * process.hcalDigis * process.calolocalreco *(process.ecalClustersNoPFBox+process.caloTowersRec) * process.reducedEcalRecHitsSequenceEcalOnly )
process.local_digireco = cms.Path(process.mix * process.addPileupInfo * process.bunchSpacingProducer * process.calDigi * process.ecalPacker * process.esDigiToRaw * process.hcalRawData * process.rawDataCollector * process.ecalDigis * process.ecalPreshowerDigis * process.hcalDigis * process.calolocalreco *(process.ecalClustersNoPFBox+process.caloTowersRec) * process.reducedEcalRecHitsSequenceEcalOnly )

process.schedule.append(process.local_digireco)

Expand Down