Skip to content

Commit

Permalink
Merge CMSSW_12_4_X into CMSSW_12_4_DEVEL_X.
Browse files Browse the repository at this point in the history
  • Loading branch information
cmsbuild committed Apr 21, 2022
2 parents ab0f543 + 1481a95 commit fdf7242
Show file tree
Hide file tree
Showing 15 changed files with 95 additions and 85 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,16 +1,58 @@
#include "AnalysisAlgos/SiStripClusterInfoProducer/plugins/SiStripProcessedRawDigiProducer.h"
// system includes
#include <functional>
#include <memory>
#include <string>

// user includes
#include "CalibFormats/SiStripObjects/interface/SiStripGain.h"
#include "CalibTracker/Records/interface/SiStripGainRcd.h"
#include "DataFormats/Common/interface/DetSetVector.h"
#include "DataFormats/SiStripDigi/interface/SiStripDigi.h"
#include "DataFormats/SiStripDigi/interface/SiStripProcessedRawDigi.h"
#include "DataFormats/SiStripDigi/interface/SiStripRawDigi.h"
#include "FWCore/Framework/interface/stream/EDProducer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "FWCore/Utilities/interface/transform.h"
#include "RecoLocalTracker/SiStripZeroSuppression/interface/SiStripCommonModeNoiseSubtractor.h"
#include "RecoLocalTracker/SiStripZeroSuppression/interface/SiStripPedestalsSubtractor.h"
#include "RecoLocalTracker/SiStripZeroSuppression/interface/SiStripRawProcessingFactory.h"

#include "DataFormats/SiStripDigi/interface/SiStripDigi.h"
#include "DataFormats/SiStripDigi/interface/SiStripRawDigi.h"
#include "DataFormats/SiStripDigi/interface/SiStripProcessedRawDigi.h"
class SiStripProcessedRawDigiProducer : public edm::stream::EDProducer<> {
public:
explicit SiStripProcessedRawDigiProducer(edm::ParameterSet const&);

#include <functional>
private:
void produce(edm::Event& e, const edm::EventSetup& es) override;
template <class T>
std::string findInput(edm::Handle<T>& handle, const std::vector<edm::EDGetTokenT<T> >& tokens, const edm::Event& e);

void vr_process(const edm::DetSetVector<SiStripRawDigi>&,
edm::DetSetVector<SiStripProcessedRawDigi>&,
const SiStripGain&);
void pr_process(const edm::DetSetVector<SiStripRawDigi>&,
edm::DetSetVector<SiStripProcessedRawDigi>&,
const SiStripGain&);
void zs_process(const edm::DetSetVector<SiStripDigi>&,
edm::DetSetVector<SiStripProcessedRawDigi>&,
const SiStripGain&);
void common_process(const uint32_t,
std::vector<float>&,
edm::DetSetVector<SiStripProcessedRawDigi>&,
const SiStripGain&);

const std::vector<edm::InputTag> inputTags_;
const std::vector<edm::EDGetTokenT<edm::DetSetVector<SiStripDigi> > > inputTokensDigi_;
const std::vector<edm::EDGetTokenT<edm::DetSetVector<SiStripRawDigi> > > inputTokensRawDigi_;
const edm::ESGetToken<SiStripGain, SiStripGainRcd> gainToken_;

std::unique_ptr<SiStripPedestalsSubtractor> subtractorPed_;
std::unique_ptr<SiStripCommonModeNoiseSubtractor> subtractorCMN_;
};

SiStripProcessedRawDigiProducer::SiStripProcessedRawDigiProducer(edm::ParameterSet const& conf)
: inputTags_(conf.getParameter<std::vector<edm::InputTag> >("DigiProducersList")),
Expand Down Expand Up @@ -66,37 +108,37 @@ void SiStripProcessedRawDigiProducer::zs_process(const edm::DetSetVector<SiStrip
edm::DetSetVector<SiStripProcessedRawDigi>& output,
const SiStripGain& gain) {
std::vector<float> digis;
for (edm::DetSetVector<SiStripDigi>::const_iterator detset = input.begin(); detset != input.end(); ++detset) {
for (const auto& detset : input) {
digis.clear();
for (edm::DetSet<SiStripDigi>::const_iterator digi = detset->begin(); digi != detset->end(); ++digi) {
digis.resize(digi->strip(), 0);
digis.push_back(digi->adc());
for (const auto& digi : detset) {
digis.resize(digi.strip(), 0);
digis.push_back(digi.adc());
}
common_process(detset->id, digis, output, gain);
common_process(detset.id, digis, output, gain);
}
}

void SiStripProcessedRawDigiProducer::pr_process(const edm::DetSetVector<SiStripRawDigi>& input,
edm::DetSetVector<SiStripProcessedRawDigi>& output,
const SiStripGain& gain) {
for (edm::DetSetVector<SiStripRawDigi>::const_iterator detset = input.begin(); detset != input.end(); ++detset) {
for (const auto& detset : input) {
std::vector<float> digis;
transform(
detset->begin(), detset->end(), back_inserter(digis), std::bind(&SiStripRawDigi::adc, std::placeholders::_1));
subtractorCMN_->subtract(detset->id, 0, digis);
common_process(detset->id, digis, output, gain);
detset.begin(), detset.end(), back_inserter(digis), std::bind(&SiStripRawDigi::adc, std::placeholders::_1));
subtractorCMN_->subtract(detset.id, 0, digis);
common_process(detset.id, digis, output, gain);
}
}

void SiStripProcessedRawDigiProducer::vr_process(const edm::DetSetVector<SiStripRawDigi>& input,
edm::DetSetVector<SiStripProcessedRawDigi>& output,
const SiStripGain& gain) {
for (edm::DetSetVector<SiStripRawDigi>::const_iterator detset = input.begin(); detset != input.end(); ++detset) {
std::vector<int16_t> int_digis(detset->size());
subtractorPed_->subtract(*detset, int_digis);
for (const auto& detset : input) {
std::vector<int16_t> int_digis(detset.size());
subtractorPed_->subtract(detset, int_digis);
std::vector<float> digis(int_digis.begin(), int_digis.end());
subtractorCMN_->subtract(detset->id, 0, digis);
common_process(detset->id, digis, output, gain);
subtractorCMN_->subtract(detset.id, 0, digis);
common_process(detset.id, digis, output, gain);
}
}

Expand All @@ -106,11 +148,16 @@ void SiStripProcessedRawDigiProducer::common_process(const uint32_t detId,
const SiStripGain& gain) {
//Apply Gains
SiStripApvGain::Range detGainRange = gain.getRange(detId);
for (std::vector<float>::iterator it = digis.begin(); it < digis.end(); ++it)
(*it) /= (gain.getStripGain(it - digis.begin(), detGainRange));
for (auto& it : digis)
it /= (gain.getStripGain(it - *digis.begin(), detGainRange));

//Insert as DetSet
edm::DetSet<SiStripProcessedRawDigi> ds(detId);
copy(digis.begin(), digis.end(), back_inserter(ds.data));
output.insert(ds);
}

#include "FWCore/PluginManager/interface/ModuleDef.h"
#include "FWCore/Framework/interface/MakerMacros.h"

DEFINE_FWK_MODULE(SiStripProcessedRawDigiProducer);

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@
mkFitSeeds = 'detachedQuadStepTrackCandidatesMkFitSeeds',
tracks = 'detachedQuadStepTrackCandidatesMkFit',
))
(pp_on_XeXe_2017 | pp_on_AA).toModify(detachedQuadStepTrackCandidatesMkFitConfig, minPt=0.9)

#For FastSim phase1 tracking
import FastSimulation.Tracking.TrackCandidateProducer_cfi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@
mkFitSeeds = 'detachedTripletStepTrackCandidatesMkFitSeeds',
tracks = 'detachedTripletStepTrackCandidatesMkFit',
))
(pp_on_XeXe_2017 | pp_on_AA).toModify(detachedTripletStepTrackCandidatesMkFitConfig, minPt=0.9)

import FastSimulation.Tracking.TrackCandidateProducer_cfi
_fastSim_detachedTripletStepTrackCandidates = FastSimulation.Tracking.TrackCandidateProducer_cfi.trackCandidateProducer.clone(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@
mkFitSeeds = 'highPtTripletStepTrackCandidatesMkFitSeeds',
tracks = 'highPtTripletStepTrackCandidatesMkFit',
))
(pp_on_XeXe_2017 | pp_on_AA).toModify(highPtTripletStepTrackCandidatesMkFitConfig, minPt=0.7)

# For Phase2PU140
from TrackingTools.TrajectoryCleaning.TrajectoryCleanerBySharedHits_cfi import trajectoryCleanerBySharedHits as _trajectoryCleanerBySharedHits
Expand Down
1 change: 1 addition & 0 deletions RecoTracker/IterativeTracking/python/InitialStep_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@
mkFitSeeds = 'initialStepTrackCandidatesMkFitSeeds',
tracks = 'initialStepTrackCandidatesMkFit',
))
(pp_on_XeXe_2017 | pp_on_AA).toModify(initialStepTrackCandidatesMkFitConfig, minPt=0.6)

import FastSimulation.Tracking.TrackCandidateProducer_cfi
fastSim.toReplaceWith(initialStepTrackCandidates,
Expand Down
1 change: 1 addition & 0 deletions RecoTracker/IterativeTracking/python/LowPtQuadStep_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@
mkFitSeeds = 'lowPtQuadStepTrackCandidatesMkFitSeeds',
tracks = 'lowPtQuadStepTrackCandidatesMkFit',
))
(pp_on_XeXe_2017 | pp_on_AA).toModify(lowPtQuadStepTrackCandidatesMkFitConfig, minPt=0.49)

#For FastSim phase1 tracking
import FastSimulation.Tracking.TrackCandidateProducer_cfi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@
mkFitSeeds = 'lowPtTripletStepTrackCandidatesMkFitSeeds',
tracks = 'lowPtTripletStepTrackCandidatesMkFit',
))
(pp_on_XeXe_2017 | pp_on_AA).toModify(lowPtTripletStepTrackCandidatesMkFitConfig, minPt=0.49)

import FastSimulation.Tracking.TrackCandidateProducer_cfi
fastSim.toReplaceWith(lowPtTripletStepTrackCandidates,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@
mkFitSeeds = 'mixedTripletStepTrackCandidatesMkFitSeeds',
tracks = 'mixedTripletStepTrackCandidatesMkFit',
))
(pp_on_XeXe_2017 | pp_on_AA).toModify(mixedTripletStepTrackCandidatesMkFitConfig, minPt=0.4)

import FastSimulation.Tracking.TrackCandidateProducer_cfi
fastSim.toReplaceWith(mixedTripletStepTrackCandidates,
Expand Down
1 change: 1 addition & 0 deletions RecoTracker/IterativeTracking/python/PixelLessStep_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@
mkFitSeeds = 'pixelLessStepTrackCandidatesMkFitSeeds',
tracks = 'pixelLessStepTrackCandidatesMkFit',
))
(pp_on_XeXe_2017 | pp_on_AA).toModify(pixelLessStepTrackCandidatesMkFitConfig, minPt=2.0)

import FastSimulation.Tracking.TrackCandidateProducer_cfi
fastSim.toReplaceWith(pixelLessStepTrackCandidates,
Expand Down
1 change: 1 addition & 0 deletions RecoTracker/IterativeTracking/python/TobTecStep_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@
mkFitSeeds = 'tobTecStepTrackCandidatesMkFitSeeds',
tracks = 'tobTecStepTrackCandidatesMkFit',
))
(pp_on_XeXe_2017 | pp_on_AA).toModify(tobTecStepTrackCandidatesMkFitConfig, minPt=2.0)

import FastSimulation.Tracking.TrackCandidateProducer_cfi
fastSim.toReplaceWith(tobTecStepTrackCandidates,
Expand Down
7 changes: 6 additions & 1 deletion RecoTracker/MkFit/plugins/MkFitIterationConfigESProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -218,23 +218,28 @@ class MkFitIterationConfigESProducer : public edm::ESProducer {
private:
const edm::ESGetToken<MkFitGeometry, TrackerRecoGeometryRecord> geomToken_;
const std::string configFile_;
const float minPtCut_;
};

MkFitIterationConfigESProducer::MkFitIterationConfigESProducer(const edm::ParameterSet &iConfig)
: geomToken_{setWhatProduced(this, iConfig.getParameter<std::string>("ComponentName")).consumes()},
configFile_{iConfig.getParameter<edm::FileInPath>("config").fullPath()} {}
configFile_{iConfig.getParameter<edm::FileInPath>("config").fullPath()},
minPtCut_{(float)iConfig.getParameter<double>("minPt")} {}

void MkFitIterationConfigESProducer::fillDescriptions(edm::ConfigurationDescriptions &descriptions) {
edm::ParameterSetDescription desc;
desc.add<std::string>("ComponentName")->setComment("Product label");
desc.add<edm::FileInPath>("config")->setComment("Path to the JSON file for the mkFit configuration parameters");
desc.add<double>("minPt", 0.0)->setComment("min pT cut applied during track building");
descriptions.addWithDefaultLabel(desc);
}

std::unique_ptr<mkfit::IterationConfig> MkFitIterationConfigESProducer::produce(
const TrackerRecoGeometryRecord &iRecord) {
mkfit::ConfigJson cj;
auto it_conf = cj.load_File(configFile_);
it_conf->m_params.minPtCut = minPtCut_;
it_conf->m_backward_params.minPtCut = minPtCut_;
it_conf->m_partition_seeds = partitionSeeds1;
return it_conf;
}
Expand Down
3 changes: 3 additions & 0 deletions RecoTracker/MkFitCore/interface/IterationConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ namespace mkfit {
float drth_central = 0.001;
float drth_obarrel = 0.001;
float drth_forward = 0.001;

//min pT cut
float minPtCut = 0.0;
};

//==============================================================================
Expand Down
8 changes: 8 additions & 0 deletions RecoTracker/MkFitCore/src/MkBuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,9 @@ namespace mkfit {

seed_cand_vec.clear();

auto &iter_params = (iteration_dir == SteeringParams::IT_BkwSearch) ? m_job->m_iter_config.m_backward_params
: m_job->m_iter_config.m_params;

for (int iseed = start_seed; iseed < end_seed; ++iseed) {
CombCandidate &ccand = m_event_of_comb_cands[iseed];

Expand All @@ -624,6 +627,11 @@ namespace mkfit {
bool active = false;
for (int ic = 0; ic < (int)ccand.size(); ++ic) {
if (ccand[ic].getLastHitIdx() != -2) {
// Stop candidates with pT<X GeV
if (ccand[ic].pT() < iter_params.minPtCut) {
ccand[ic].addHitIdx(-2, layer, 0.0f);
continue;
}
// Check if the candidate is close to it's max_r, pi/2 - 0.2 rad (11.5 deg)
if (iteration_dir == SteeringParams::IT_FwdSearch && ccand[ic].pT() < 1.2) {
const float dphi = std::abs(ccand[ic].posPhi() - ccand[ic].momPhi());
Expand Down

0 comments on commit fdf7242

Please sign in to comment.