From d02e0f65f9650c7d44cbaa92d7767706202b193d Mon Sep 17 00:00:00 2001 From: Rick Wilkinson Date: Tue, 17 Mar 2009 15:27:09 +0000 Subject: [PATCH] First pass at doing wire suppression --- SimMuon/CSCDigitizer/src/CSCDigiSuppressor.cc | 55 ++++++++++++++++--- SimMuon/CSCDigitizer/src/CSCDigiSuppressor.h | 5 +- 2 files changed, 49 insertions(+), 11 deletions(-) diff --git a/SimMuon/CSCDigitizer/src/CSCDigiSuppressor.cc b/SimMuon/CSCDigitizer/src/CSCDigiSuppressor.cc index e0ef849260ea5..f835ac72747ff 100755 --- a/SimMuon/CSCDigitizer/src/CSCDigiSuppressor.cc +++ b/SimMuon/CSCDigitizer/src/CSCDigiSuppressor.cc @@ -1,13 +1,16 @@ #include "SimMuon/CSCDigitizer/src/CSCDigiSuppressor.h" #include "DataFormats/Common/interface/Handle.h" -#include +#include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h" +#include "DataFormats/CSCDigi/interface/CSCALCTDigiCollection.h" +#include "DataFormats/CSCDigi/interface/CSCWireDigiCollection.h" +#include "DataFormats/CSCDigi/interface/CSCComparatorDigiCollection.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" - +#include CSCDigiSuppressor::CSCDigiSuppressor(const edm::ParameterSet& ps) -: theLCTTag(ps.getParameter("lctTag")), - theStripDigiTag(ps.getParameter("stripDigiTag")), +: theLCTLabel(ps.getParameter("lctLabel")), + theDigiLabel(ps.getParameter("digiLabel")), theStripElectronicsSim(ps), theStripConditions(new CSCDbStripConditions(ps)) { @@ -32,14 +35,15 @@ CSCDigiSuppressor::CSCDigiSuppressor(const edm::ParameterSet& ps) void CSCDigiSuppressor::produce(edm::Event& e, const edm::EventSetup& eventSetup) { edm::Handle oldStripDigis; - e.getByLabel(theStripDigiTag, oldStripDigis); + e.getByLabel(theDigiLabel, "MuonCSCStripDigi", oldStripDigis); if (!oldStripDigis.isValid()) { edm::LogError("CSCDigiValidation") << "Cannot get strips by label " - << theStripDigiTag.encode(); + << theDigiLabel; } edm::Handle lcts; - e.getByLabel(theLCTTag, lcts); + e.getByLabel(theLCTLabel, lcts); + std::auto_ptr newStripDigis(new CSCStripDigiCollection()); theStripConditions->initializeEvent(eventSetup); @@ -68,6 +72,41 @@ void CSCDigiSuppressor::produce(edm::Event& e, const edm::EventSetup& eventSetup } e.put(newStripDigis, "MuonCSCStripDigi"); + suppressWires(e); +} + + +void CSCDigiSuppressor::suppressWires(edm::Event & e) +{ + edm::Handle oldWireDigis; + e.getByLabel(theDigiLabel, "MuonCSCWireDigi", oldWireDigis); + std::auto_ptr newWireDigis(new CSCWireDigiCollection(*oldWireDigis)); + + edm::Handle alctDigis; + e.getByLabel(theLCTLabel, alctDigis); + typedef CSCALCTDigiCollection::DigiRangeIterator ALCTItr; + typedef CSCWireDigiCollection::DigiRangeIterator WireItr; + + for(WireItr wireItr = oldWireDigis->begin(); + wireItr != oldWireDigis->end(); ++wireItr) + { + const CSCDetId& id = (*wireItr).first; + bool found = false; + for(ALCTItr alctItr = alctDigis->begin(); + !found && alctItr != alctDigis->end(); ++alctItr) + { + if((*alctItr).first == id) + { + found = true; + } + } + if(found) + { + newWireDigis->put((*wireItr).second, (*wireItr).first); + } + } + + e.put(newWireDigis, "MuonCSCWireDigi"); } @@ -187,5 +226,3 @@ CSCDigiSuppressor::stripsToRead(const std::list & cfebs) const } return strips; } - - diff --git a/SimMuon/CSCDigitizer/src/CSCDigiSuppressor.h b/SimMuon/CSCDigitizer/src/CSCDigiSuppressor.h index 97d0274ec62ca..4d3bd4b1c2e84 100755 --- a/SimMuon/CSCDigitizer/src/CSCDigiSuppressor.h +++ b/SimMuon/CSCDigitizer/src/CSCDigiSuppressor.h @@ -29,9 +29,10 @@ class CSCDigiSuppressor : public edm::EDProducer std::list stripsToRead(const std::list & cfebs) const; - edm::InputTag theLCTTag; - edm::InputTag theStripDigiTag; + void suppressWires(edm::Event & e); + std::string theLCTLabel; + std::string theDigiLabel; CSCStripElectronicsSim theStripElectronicsSim; CSCStripConditions * theStripConditions;