Skip to content

Commit

Permalink
renaming class and adding extra res approx clusters
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan committed Apr 30, 2021
1 parent bbdf8a8 commit 89ca71a
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 61 deletions.
15 changes: 2 additions & 13 deletions DataFormats/SiStripCluster/interface/SiStripApproximateCluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,14 @@ class SiStripApproximateCluster {

SiStripApproximateCluster() {}
explicit SiStripApproximateCluster(const SiStripCluster& cluster){
rawBarycenter_=static_cast<uint16_t>(std::round(cluster.barycenter()*16));
rawBarycenter_=static_cast<uint16_t>(std::round(cluster.barycenter()));
width_=cluster.size();
if(width_>0x3F) width_=0x3F;
avgCharge_ = static_cast<uint8_t>(cluster.charge()/cluster.size());

std::cout << " rawBaricenter " << rawBarycenter_ << " barycenter: " << this->barycenter() << " OrigBarycenter: " << cluster.barycenter() << " OrigBarycenterCasted: " << static_cast<uint16_t>(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_;}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#ifndef DATAFORMATS_SiStripApproximateClusterHigherBarycenterRes_H
#define DATAFORMATS_SiStripApproximateClusterHigherBarycenterRes_H

#include <numeric>
#include <cmath>
#include <iostream>
#include <iomanip>

#include "DataFormats/SiStripCluster/interface/SiStripCluster.h"

class SiStripApproximateClusterHigherBarycenterRes {
public:

SiStripApproximateClusterHigherBarycenterRes() {}
explicit SiStripApproximateClusterHigherBarycenterRes(const SiStripCluster& cluster){
rawBarycenter_=static_cast<uint16_t>(std::round(cluster.barycenter()*8));
width_=cluster.size();
if(width_>0x3F) width_=0x3F;
avgCharge_ = static_cast<uint8_t>(cluster.charge()/cluster.size());

std::cout << " rawBaricenter " << rawBarycenter_ <<
" barycenter: " << this->barycenter() <<
" OrigBarycenter: " << cluster.barycenter() <<
" OrigBarycenterCasted: " << static_cast<uint16_t>(cluster.barycenter()) <<
" OrigBarycenterCastedRounded: " << static_cast<uint16_t>(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
32 changes: 0 additions & 32 deletions DataFormats/SiStripCluster/interface/SiStripApproximateClusterv1.h

This file was deleted.

1 change: 1 addition & 0 deletions DataFormats/SiStripCluster/src/classes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
17 changes: 17 additions & 0 deletions DataFormats/SiStripCluster/src/classes_def.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,21 @@
<class name="edmNew::DetSetVector<edm::Ref<edmNew::DetSetVector<SiStripApproximateCluster>,SiStripApproximateCluster,edmNew::DetSetVector<SiStripApproximateCluster>::FindForDetSetVector> >" />
<class name="edm::Wrapper<edmNew::DetSetVector<edm::Ref<edmNew::DetSetVector<SiStripApproximateCluster>,SiStripApproximateCluster,edmNew::DetSetVector<SiStripApproximateCluster>::FindForDetSetVector> > >" />

<class name="SiStripApproximateClusterHigherBarycenterRes"/>
<class name="edmNew::DetSetVector<SiStripApproximateClusterHigherBarycenterRes>"/>
<class name="edm::Wrapper<edmNew::DetSetVector<SiStripApproximateClusterHigherBarycenterRes>>"/>

<class name="std::vector<SiStripApproximateClusterHigherBarycenterRes>"/>

<class name="edm::Ref<edmNew::DetSetVector<SiStripApproximateClusterHigherBarycenterRes>, SiStripApproximateClusterHigherBarycenterRes, edmNew::DetSetVector<SiStripApproximateClusterHigherBarycenterRes>::FindForDetSetVector>"/>


<class name="edm::ContainerMask<edmNew::DetSetVector<SiStripApproximateClusterHigherBarycenterRes> >"/>
<class name="edm::Wrapper<edm::ContainerMask<edmNew::DetSetVector<SiStripApproximateClusterHigherBarycenterRes> > >"/>


<class name="std::vector<edm::Ref<edmNew::DetSetVector<SiStripApproximateClusterHigherBarycenterRes>,SiStripApproximateClusterHigherBarycenterRes,edmNew::DetSetVector<SiStripApproximateClusterHigherBarycenterRes>::FindForDetSetVector> >" />
<class name="edmNew::DetSetVector<edm::Ref<edmNew::DetSetVector<SiStripApproximateClusterHigherBarycenterRes>,SiStripApproximateClusterHigherBarycenterRes,edmNew::DetSetVector<SiStripApproximateClusterHigherBarycenterRes>::FindForDetSetVector> >" />
<class name="edm::Wrapper<edmNew::DetSetVector<edm::Ref<edmNew::DetSetVector<SiStripApproximateClusterHigherBarycenterRes>,SiStripApproximateClusterHigherBarycenterRes,edmNew::DetSetVector<SiStripApproximateClusterHigherBarycenterRes>::FindForDetSetVector> > >" />

</lcgdict>
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
#include <vector>
#include <memory>

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);
Expand All @@ -33,15 +33,15 @@ 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);
produces< edmNew::DetSetVector< SiStripApproximateCluster > >();

}

void SiStripClusters2ApproxClustersv1::produce(edm::Event& e, edm::EventSetup const&){
void SiStripClusters2ApproxClusters::produce(edm::Event& e, edm::EventSetup const&){
auto result = std::make_unique<edmNew::DetSetVector< SiStripApproximateCluster > >();
edm::Handle<edmNew::DetSetVector< SiStripCluster >> clusterCollection = e.getHandle(clusterToken);

Expand All @@ -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<edm::InputTag>("inputClusters", edm::InputTag("siStripClusters"));
descriptions.add("SiStripClusters2ApproxClustersv1", desc);
descriptions.add("SiStripClusters2ApproxClusters", desc);
}


DEFINE_FWK_MODULE(SiStripClusters2ApproxClustersv1);
DEFINE_FWK_MODULE(SiStripClusters2ApproxClusters);
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void SiStripApproximatedClustersDump::analyze(const edm::Event& event, const edm

void SiStripApproximatedClustersDump::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.add<edm::InputTag>("approximatedClustersTag", edm::InputTag("SiStripClusters2ApproxClustersv1"));
desc.add<edm::InputTag>("approximatedClustersTag", edm::InputTag("SiStripClusters2ApproxClusters"));
descriptions.add("SiStripApproximatedClustersDump", desc);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
fileName = cms.untracked.string('file:step2approximated.root'),
outputCommands = cms.untracked.vstring(
'drop *',
'keep *_*SiStripClusters2ApproxClustersv1*_*_*'
'keep *_*SiStripClusters2ApproxClusters*_*_*'
)
)

Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@

outputCommands = cms.untracked.vstring(
'drop *',
'keep *_*SiStripClusters2ApproxClustersv1*_*_*'
'keep *_*SiStripClusters2ApproxClusters*_*_*'
)
)

Expand All @@ -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)
Expand Down

0 comments on commit 89ca71a

Please sign in to comment.