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

Energy threshold update for new MTD geometry #31654

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 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
21 changes: 18 additions & 3 deletions RecoLocalFastTime/FTLCommonAlgos/plugins/MTDRecHitAlgo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
#include "RecoLocalFastTime/Records/interface/MTDTimeCalibRecord.h"
#include "RecoLocalFastTime/FTLCommonAlgos/interface/MTDTimeCalib.h"

#include "Geometry/MTDNumberingBuilder/interface/MTDTopology.h"
#include "Geometry/MTDCommonData/interface/MTDTopologyMode.h"
#include <iostream>
Copy link
Contributor

Choose a reason for hiding this comment

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

this include should not be needed, because cout is not allowed.


class MTDRecHitAlgo : public MTDRecHitAlgoBase {
public:
/// Constructor
MTDRecHitAlgo(const edm::ParameterSet& conf, edm::ConsumesCollector& sumes)
: MTDRecHitAlgoBase(conf, sumes),
thresholdToKeep_(conf.getParameter<double>("thresholdToKeep")),
thresholdToKeep_(conf.getParameter<std::vector<double>>("thresholdToKeep")),
calibration_(conf.getParameter<double>("calibrationConstant")) {}

/// Destructor
Expand All @@ -22,14 +26,20 @@ class MTDRecHitAlgo : public MTDRecHitAlgoBase {
FTLRecHit makeRecHit(const FTLUncalibratedRecHit& uRecHit, uint32_t& flags) const final;

private:
double thresholdToKeep_, calibration_;
std::vector<double> thresholdToKeep_;
double calibration_;
const MTDTimeCalib* time_calib_;
const MTDTopology* topology_;
static constexpr int topologycode1Disk_ = 4;
Copy link
Contributor

Choose a reason for hiding this comment

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

@gsorrentino18 @casarsa there is no need to define hardcoded thresholds, you may simply use the MTDTopologyMode enum class with something like

if (mtdTopologyMode <= static_cast<int>(MTDTopologyMode::Mode::barphiflat)) {

as we are doing elsewhere in the code (and I am using in the RecoMTD/DetLayers code I am preparing)

};

void MTDRecHitAlgo::getEventSetup(const edm::EventSetup& es) {
edm::ESHandle<MTDTimeCalib> pTC;
es.get<MTDTimeCalibRecord>().get("MTDTimeCalib", pTC);
time_calib_ = pTC.product();
edm::ESHandle<MTDTopology> topologyHandle;
es.get<MTDTopologyRcd>().get(topologyHandle);
topology_ = topologyHandle.product();
}

FTLRecHit MTDRecHitAlgo::makeRecHit(const FTLUncalibratedRecHit& uRecHit, uint32_t& flags) const {
Expand All @@ -39,6 +49,11 @@ FTLRecHit MTDRecHitAlgo::makeRecHit(const FTLUncalibratedRecHit& uRecHit, uint32
float energy = 0.;
float time = 0.;

// MTD topology
unsigned int index_topology = 0; //1Disks geometry
Copy link
Contributor

Choose a reason for hiding this comment

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

it looks like this index can be computed in getEventSetup, no need to re-derive it for every hit

if (topology_->getMTDTopologyMode() > topologycode1Disk_)
index_topology = 1; //2Disk geometry

/// position and positionError in unit cm
float position = -1.f;
float positionError = -1.f;
Expand Down Expand Up @@ -80,7 +95,7 @@ FTLRecHit MTDRecHitAlgo::makeRecHit(const FTLUncalibratedRecHit& uRecHit, uint32

// Now fill flags
// all rechits from the digitizer are "good" at present
if (energy > thresholdToKeep_) {
if (energy > thresholdToKeep_[index_topology]) {
flags = FTLRecHit::kGood;
rh.setFlag(flags);
} else {
Expand Down
4 changes: 2 additions & 2 deletions RecoLocalFastTime/FTLRecProducers/python/mtdRecHits_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

_barrelAlgo = cms.PSet(
algoName = cms.string("MTDRecHitAlgo"),
thresholdToKeep = cms.double(1.), # MeV
thresholdToKeep = cms.vdouble(1., 1.), # MeV
calibrationConstant = cms.double(0.03125), # MeV/pC
)


_endcapAlgo = cms.PSet(
algoName = cms.string("MTDRecHitAlgo"),
thresholdToKeep = cms.double(0.0425), # MeV
thresholdToKeep = cms.vdouble(0.0425, 0.005), # MeV
calibrationConstant = cms.double(0.085), # MeV/MIP
)

Expand Down