Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,24 @@ class SiStripApproximateCluster {
public:
SiStripApproximateCluster() {}

explicit SiStripApproximateCluster(float barycenter, uint8_t width, float avgCharge) {
explicit SiStripApproximateCluster(float barycenter, uint8_t width, float avgCharge, bool isSaturated) {
barycenter_ = barycenter;
width_ = width;
avgCharge_ = avgCharge;
isSaturated_ = isSaturated;
}

explicit SiStripApproximateCluster(const SiStripCluster& cluster);
explicit SiStripApproximateCluster(const SiStripCluster& cluster, unsigned int maxNSat);

float barycenter() const { return barycenter_; }
uint8_t width() const { return width_; }
float avgCharge() const { return avgCharge_; }
bool isSaturated() const { return isSaturated_; }

private:
float barycenter_ = 0;
uint8_t width_ = 0;
float avgCharge_ = 0;
bool isSaturated_ = false;
};
#endif // DATAFORMATS_SiStripApproximateCluster_H
22 changes: 21 additions & 1 deletion DataFormats/SiStripCluster/src/SiStripApproximateCluster.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
#include "DataFormats/SiStripCluster/interface/SiStripApproximateCluster.h"

SiStripApproximateCluster::SiStripApproximateCluster(const SiStripCluster& cluster) {
SiStripApproximateCluster::SiStripApproximateCluster(const SiStripCluster& cluster, unsigned int maxNSat) {
barycenter_ = cluster.barycenter();
width_ = cluster.size();
avgCharge_ = cluster.charge() / cluster.size();
isSaturated_ = false;

//mimicing the algorithm used in StripSubClusterShapeTrajectoryFilter...
//Looks for 3 adjacent saturated strips (ADC>=254)
const auto& ampls = cluster.amplitudes();
unsigned int thisSat = (ampls[0] >= 254), maxSat = thisSat;
for (unsigned int i = 1, n = ampls.size(); i < n; ++i) {
if (ampls[i] >= 254) {
thisSat++;
} else if (thisSat > 0) {
maxSat = std::max<int>(maxSat, thisSat);
thisSat = 0;
}
}
if (thisSat > 0) {
maxSat = std::max<int>(maxSat, thisSat);
}
if (maxSat >= maxNSat) {
isSaturated_ = true;
}
}
4 changes: 2 additions & 2 deletions DataFormats/SiStripCluster/src/classes_def.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
<class name="edm::Wrapper<edmNew::DetSetVector<edm::Ref<edmNew::DetSetVector<SiStripCluster>,SiStripCluster,edmNew::DetSetVector<SiStripCluster>::FindForDetSetVector> > >" />


<class name="SiStripApproximateCluster" ClassVersion="3">
<version ClassVersion="3" checksum="2041370183"/>
<class name="SiStripApproximateCluster" ClassVersion="9">
<version ClassVersion="9" checksum="2854791577"/>
Copy link
Contributor

Choose a reason for hiding this comment

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

why did it jump from 3 -> 9?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have updated this file to be version '4' now.

</class>

<class name="edmNew::DetSetVector<SiStripApproximateCluster>"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ void SiStripApprox2ApproxClusters::produce(edm::Event& event, edm::EventSetup co
float barycenter = cluster.barycenter();
uint8_t width = cluster.width();
float avgCharge = cluster.avgCharge();
bool isSaturated = cluster.isSaturated();

switch (approxVersion) {
case 0: //ORIGINAL
Expand All @@ -85,7 +86,7 @@ void SiStripApprox2ApproxClusters::produce(edm::Event& event, edm::EventSetup co
break;
}

ff.push_back(SiStripApproximateCluster(barycenter, width, avgCharge));
ff.push_back(SiStripApproximateCluster(barycenter, width, avgCharge, isSaturated));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@ class SiStripClusters2ApproxClusters : public edm::stream::EDProducer<> {
private:
edm::InputTag inputClusters;
edm::EDGetTokenT<edmNew::DetSetVector<SiStripCluster> > clusterToken;

unsigned int maxNSat;
};

SiStripClusters2ApproxClusters::SiStripClusters2ApproxClusters(const edm::ParameterSet& conf) {
inputClusters = conf.getParameter<edm::InputTag>("inputClusters");
maxNSat = conf.getParameter<unsigned int>("maxSaturatedStrips");

clusterToken = consumes<edmNew::DetSetVector<SiStripCluster> >(inputClusters);
produces<edmNew::DetSetVector<SiStripApproximateCluster> >();
Expand All @@ -42,7 +45,7 @@ void SiStripClusters2ApproxClusters::produce(edm::Event& event, edm::EventSetup
edmNew::DetSetVector<SiStripApproximateCluster>::FastFiller ff{*result, detClusters.id()};

for (const auto& cluster : detClusters)
ff.push_back(SiStripApproximateCluster(cluster));
ff.push_back(SiStripApproximateCluster(cluster, maxNSat));
}

event.put(std::move(result));
Expand All @@ -51,7 +54,8 @@ void SiStripClusters2ApproxClusters::produce(edm::Event& event, edm::EventSetup
void SiStripClusters2ApproxClusters::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.add<edm::InputTag>("inputClusters", edm::InputTag("siStripClusters"));
desc.add<unsigned int>("maxSaturatedStrips", 3);
descriptions.add("SiStripClusters2ApproxClusters", desc);
}

DEFINE_FWK_MODULE(SiStripClusters2ApproxClusters);
DEFINE_FWK_MODULE(SiStripClusters2ApproxClusters);