From 89ca71afb80faad97146aa296e9bc380ffe77f92 Mon Sep 17 00:00:00 2001 From: Ivan Date: Fri, 30 Apr 2021 11:23:59 +0200 Subject: [PATCH] renaming class and adding extra res approx clusters --- .../interface/SiStripApproximateCluster.h | 15 +------ ...ripApproximateClusterHigherBarycenterRes.h | 40 +++++++++++++++++++ .../interface/SiStripApproximateClusterv1.h | 32 --------------- DataFormats/SiStripCluster/src/classes.h | 1 + .../SiStripCluster/src/classes_def.xml | 17 ++++++++ ...1.cc => SiStripClusters2ApproxClusters.cc} | 14 +++---- .../test/SiStripApproximatedClustersDump.cc | 2 +- ...ep2_RAW2DIGI_L1Reco_RECO_ApproxClusters.py | 8 ++-- ...Reco_RECO_ApproxClusters_streamerOutput.py | 8 ++-- 9 files changed, 76 insertions(+), 61 deletions(-) create mode 100644 DataFormats/SiStripCluster/interface/SiStripApproximateClusterHigherBarycenterRes.h delete mode 100644 DataFormats/SiStripCluster/interface/SiStripApproximateClusterv1.h rename RecoLocalTracker/SiStripClusterizer/plugins/{SiStripClusters2ApproxClustersv1.cc => SiStripClusters2ApproxClusters.cc} (76%) diff --git a/DataFormats/SiStripCluster/interface/SiStripApproximateCluster.h b/DataFormats/SiStripCluster/interface/SiStripApproximateCluster.h index 33508f7732179..ef13bf2feb49f 100644 --- a/DataFormats/SiStripCluster/interface/SiStripApproximateCluster.h +++ b/DataFormats/SiStripCluster/interface/SiStripApproximateCluster.h @@ -13,25 +13,14 @@ class SiStripApproximateCluster { SiStripApproximateCluster() {} explicit SiStripApproximateCluster(const SiStripCluster& cluster){ - rawBarycenter_=static_cast(std::round(cluster.barycenter()*16)); + rawBarycenter_=static_cast(std::round(cluster.barycenter())); width_=cluster.size(); if(width_>0x3F) width_=0x3F; avgCharge_ = static_cast(cluster.charge()/cluster.size()); - - std::cout << " rawBaricenter " << rawBarycenter_ << " barycenter: " << this->barycenter() << " OrigBarycenter: " << cluster.barycenter() << " OrigBarycenterCasted: " << static_cast(cluster.barycenter()) << " ratio " << barycenter()/cluster.barycenter() << std::endl; } - /* - explicit SiStripApproximateCluster(uint8_t avgCharge, uint16_t barycenter, uint8_t width){ - barycenter_ = barycenter; - width_ = width; - if(width_>0x3F) width_=0x3F; - avgCharge_=avgCharge; - } -*/ - float barycenter() const {return (float)rawBarycenter_/16;} - uint16_t rawBarycenter() const {return rawBarycenter_;} + uint16_t barycenter() const {return rawBarycenter_;} uint8_t width() const {return width_;} uint8_t avgCharge() const{return avgCharge_;} diff --git a/DataFormats/SiStripCluster/interface/SiStripApproximateClusterHigherBarycenterRes.h b/DataFormats/SiStripCluster/interface/SiStripApproximateClusterHigherBarycenterRes.h new file mode 100644 index 0000000000000..14d13523074fe --- /dev/null +++ b/DataFormats/SiStripCluster/interface/SiStripApproximateClusterHigherBarycenterRes.h @@ -0,0 +1,40 @@ +#ifndef DATAFORMATS_SiStripApproximateClusterHigherBarycenterRes_H +#define DATAFORMATS_SiStripApproximateClusterHigherBarycenterRes_H + +#include +#include +#include +#include + +#include "DataFormats/SiStripCluster/interface/SiStripCluster.h" + +class SiStripApproximateClusterHigherBarycenterRes { +public: + + SiStripApproximateClusterHigherBarycenterRes() {} + explicit SiStripApproximateClusterHigherBarycenterRes(const SiStripCluster& cluster){ + rawBarycenter_=static_cast(std::round(cluster.barycenter()*8)); + width_=cluster.size(); + if(width_>0x3F) width_=0x3F; + avgCharge_ = static_cast(cluster.charge()/cluster.size()); + + std::cout << " rawBaricenter " << rawBarycenter_ << + " barycenter: " << this->barycenter() << + " OrigBarycenter: " << cluster.barycenter() << + " OrigBarycenterCasted: " << static_cast(cluster.barycenter()) << + " OrigBarycenterCastedRounded: " << static_cast(cluster.barycenter())<< + " ratio " << barycenter()/cluster.barycenter() << std::endl; + } + + + float barycenter() const {return (float)rawBarycenter_/8;} + uint16_t rawBarycenter() const {return rawBarycenter_;} + uint8_t width() const {return width_;} + uint8_t avgCharge() const{return avgCharge_;} + +private: + uint16_t rawBarycenter_ = 0; + uint8_t width_=0; + uint8_t avgCharge_ = 0; +}; +#endif // DATAFORMATS_SiStripApproximateClusterHigherBarycenterRes_H diff --git a/DataFormats/SiStripCluster/interface/SiStripApproximateClusterv1.h b/DataFormats/SiStripCluster/interface/SiStripApproximateClusterv1.h deleted file mode 100644 index e8c7d654a8632..0000000000000 --- a/DataFormats/SiStripCluster/interface/SiStripApproximateClusterv1.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef DATAFORMATS_SISTRIPAPPROXIMATECLUSTERv1_H -#define DATAFORMATS_SISTRIPAPPROXIMATECLUSTERv1_H - -#include -#include "DataFormats/SiStripCluster/interface/SiStripCluster.h" - -class SiStripApproximateClusterv1 { -public: - - SiStripApproximateClusterv1() {} - explicit SiStripApproximateClusterv1(const SiStripCluster& cluster){ - barycenter_=static_cast(cluster.barycenter()); - width_=cluster.size(); - avgCharge_ = static_cast(cluster.charge()/cluster.size()); - } - - explicit SiStripApproximateClusterv1(uint8_t avgCharge, uint16_t barycenter, uint8_t width):avgCharge_(avgCharge) { - barycenter_ = barycenter; - width_ = width; - if(width_>0x3F) width_=0x3F; - } - - uint16_t barycenter() const {return barycenter_;} - uint8_t width() const {return width_;} - uint8_t avgCharge() const{return avgCharge_;} - -private: - uint16_t barycenter_ = 0; - uint8_t width_=0; - uint8_t avgCharge_ = 0; -}; -#endif // DATAFORMATS_SISTRIPAPPROXIMATECLUSTERv1_H diff --git a/DataFormats/SiStripCluster/src/classes.h b/DataFormats/SiStripCluster/src/classes.h index 40a776a39a016..2638c149a3883 100644 --- a/DataFormats/SiStripCluster/src/classes.h +++ b/DataFormats/SiStripCluster/src/classes.h @@ -6,6 +6,7 @@ #include "DataFormats/Common/interface/Ref.h" #include "DataFormats/SiStripCluster/interface/SiStripCluster.h" #include "DataFormats/SiStripCluster/interface/SiStripApproximateCluster.h" +#include "DataFormats/SiStripCluster/interface/SiStripApproximateClusterHigherBarycenterRes.h" #include "DataFormats/Common/interface/ContainerMask.h" diff --git a/DataFormats/SiStripCluster/src/classes_def.xml b/DataFormats/SiStripCluster/src/classes_def.xml index 4482bb528c1ea..b4af149c7a06e 100755 --- a/DataFormats/SiStripCluster/src/classes_def.xml +++ b/DataFormats/SiStripCluster/src/classes_def.xml @@ -40,4 +40,21 @@ + + + + + + + + + + + + + + + + + diff --git a/RecoLocalTracker/SiStripClusterizer/plugins/SiStripClusters2ApproxClustersv1.cc b/RecoLocalTracker/SiStripClusterizer/plugins/SiStripClusters2ApproxClusters.cc similarity index 76% rename from RecoLocalTracker/SiStripClusterizer/plugins/SiStripClusters2ApproxClustersv1.cc rename to RecoLocalTracker/SiStripClusterizer/plugins/SiStripClusters2ApproxClusters.cc index d868aae20af57..a556a67e026d0 100644 --- a/RecoLocalTracker/SiStripClusterizer/plugins/SiStripClusters2ApproxClustersv1.cc +++ b/RecoLocalTracker/SiStripClusterizer/plugins/SiStripClusters2ApproxClusters.cc @@ -16,11 +16,11 @@ #include #include -class SiStripClusters2ApproxClustersv1: public edm::stream::EDProducer<> { +class SiStripClusters2ApproxClusters: public edm::stream::EDProducer<> { public: - explicit SiStripClusters2ApproxClustersv1(const edm::ParameterSet& conf); + explicit SiStripClusters2ApproxClusters(const edm::ParameterSet& conf); void produce(edm::Event&, const edm::EventSetup&) override; static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); @@ -33,7 +33,7 @@ class SiStripClusters2ApproxClustersv1: public edm::stream::EDProducer<> { -SiStripClusters2ApproxClustersv1::SiStripClusters2ApproxClustersv1(const edm::ParameterSet& conf){ +SiStripClusters2ApproxClusters::SiStripClusters2ApproxClusters(const edm::ParameterSet& conf){ inputClusters = conf.getParameter< edm::InputTag >("inputClusters"); clusterToken = consumes< edmNew::DetSetVector< SiStripCluster > >(inputClusters); @@ -41,7 +41,7 @@ SiStripClusters2ApproxClustersv1::SiStripClusters2ApproxClustersv1(const edm::Pa } -void SiStripClusters2ApproxClustersv1::produce(edm::Event& e, edm::EventSetup const&){ +void SiStripClusters2ApproxClusters::produce(edm::Event& e, edm::EventSetup const&){ auto result = std::make_unique >(); edm::Handle> clusterCollection = e.getHandle(clusterToken); @@ -57,11 +57,11 @@ void SiStripClusters2ApproxClustersv1::produce(edm::Event& e, edm::EventSetup co e.put(std::move(result)); } -void SiStripClusters2ApproxClustersv1::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { +void SiStripClusters2ApproxClusters::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.add("inputClusters", edm::InputTag("siStripClusters")); - descriptions.add("SiStripClusters2ApproxClustersv1", desc); + descriptions.add("SiStripClusters2ApproxClusters", desc); } -DEFINE_FWK_MODULE(SiStripClusters2ApproxClustersv1); \ No newline at end of file +DEFINE_FWK_MODULE(SiStripClusters2ApproxClusters); \ No newline at end of file diff --git a/RecoLocalTracker/SiStripClusterizer/test/SiStripApproximatedClustersDump.cc b/RecoLocalTracker/SiStripClusterizer/test/SiStripApproximatedClustersDump.cc index 62a31619a11fc..714078e10d1eb 100644 --- a/RecoLocalTracker/SiStripClusterizer/test/SiStripApproximatedClustersDump.cc +++ b/RecoLocalTracker/SiStripClusterizer/test/SiStripApproximatedClustersDump.cc @@ -37,7 +37,7 @@ void SiStripApproximatedClustersDump::analyze(const edm::Event& event, const edm void SiStripApproximatedClustersDump::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; - desc.add("approximatedClustersTag", edm::InputTag("SiStripClusters2ApproxClustersv1")); + desc.add("approximatedClustersTag", edm::InputTag("SiStripClusters2ApproxClusters")); descriptions.add("SiStripApproximatedClustersDump", desc); } diff --git a/RecoLocalTracker/SiStripClusterizer/test/step2_RAW2DIGI_L1Reco_RECO_ApproxClusters.py b/RecoLocalTracker/SiStripClusterizer/test/step2_RAW2DIGI_L1Reco_RECO_ApproxClusters.py index a6bf7e69a2e1a..e8b322f15d789 100644 --- a/RecoLocalTracker/SiStripClusterizer/test/step2_RAW2DIGI_L1Reco_RECO_ApproxClusters.py +++ b/RecoLocalTracker/SiStripClusterizer/test/step2_RAW2DIGI_L1Reco_RECO_ApproxClusters.py @@ -63,7 +63,7 @@ fileName = cms.untracked.string('file:step2approximated.root'), outputCommands = cms.untracked.vstring( 'drop *', - 'keep *_*SiStripClusters2ApproxClustersv1*_*_*' + 'keep *_*SiStripClusters2ApproxClusters*_*_*' ) ) @@ -78,19 +78,19 @@ process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_data', '') -process.SiStripClusters2ApproxClustersv1 = cms.EDProducer("SiStripClusters2ApproxClustersv1", +process.SiStripClusters2ApproxClusters = cms.EDProducer("SiStripClusters2ApproxClusters", inputClusters = cms.InputTag("siStripClusters") ) process.SiStripApproximatedClustersDump = cms.EDAnalyzer("SiStripApproximatedClustersDump", - approximatedClustersTag = cms.InputTag("SiStripClusters2ApproxClustersv1") + approximatedClustersTag = cms.InputTag("SiStripClusters2ApproxClusters") ) # Path and EndPath definitions process.raw2digi_step = cms.Path(process.RawToDigi) process.L1Reco_step = cms.Path(process.L1Reco) process.reconstruction_step = cms.Path(process.reconstruction) -process.approxClustersv1_step = cms.Path(process.SiStripClusters2ApproxClustersv1) +process.approxClustersv1_step = cms.Path(process.SiStripClusters2ApproxClusters) process.analyzer_step = cms.Path(process.SiStripApproximatedClustersDump) process.endjob_step = cms.EndPath(process.endOfProcess) process.output_step = cms.EndPath(process.outputClusters+process.outputCompressed) diff --git a/RecoLocalTracker/SiStripClusterizer/test/step2_RAW2DIGI_L1Reco_RECO_ApproxClusters_streamerOutput.py b/RecoLocalTracker/SiStripClusterizer/test/step2_RAW2DIGI_L1Reco_RECO_ApproxClusters_streamerOutput.py index d27fb304b9a62..bd42014de0630 100644 --- a/RecoLocalTracker/SiStripClusterizer/test/step2_RAW2DIGI_L1Reco_RECO_ApproxClusters_streamerOutput.py +++ b/RecoLocalTracker/SiStripClusterizer/test/step2_RAW2DIGI_L1Reco_RECO_ApproxClusters_streamerOutput.py @@ -66,7 +66,7 @@ outputCommands = cms.untracked.vstring( 'drop *', - 'keep *_*SiStripClusters2ApproxClustersv1*_*_*' + 'keep *_*SiStripClusters2ApproxClusters*_*_*' ) ) @@ -75,19 +75,19 @@ #process.GlobalTag = GlobalTag(process.GlobalTag, '103X_dataRun2_Prompt_v2', '') process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_data', '') -process.SiStripClusters2ApproxClustersv1 = cms.EDProducer("SiStripClusters2ApproxClustersv1", +process.SiStripClusters2ApproxClusters = cms.EDProducer("SiStripClusters2ApproxClusters", inputClusters = cms.InputTag("siStripClusters") ) process.SiStripApproximatedClustersDump = cms.EDAnalyzer("SiStripApproximatedClustersDump", - approximatedClustersTag = cms.InputTag("SiStripClusters2ApproxClustersv1") + approximatedClustersTag = cms.InputTag("SiStripClusters2ApproxClusters") ) # Path and EndPath definitions process.raw2digi_step = cms.Path(process.RawToDigi) process.L1Reco_step = cms.Path(process.L1Reco) process.reconstruction_step = cms.Path(process.reconstruction) -process.approxClusters_step = cms.Path(process.SiStripClusters2ApproxClustersv1) +process.approxClusters_step = cms.Path(process.SiStripClusters2ApproxClusters) process.analyzer_step = cms.Path(process.SiStripApproximatedClustersDump) process.endjob_step = cms.EndPath(process.endOfProcess) process.output_step = cms.EndPath(process.outputClusters+process.outputCompressed)