39 std::unique_ptr<PFMuonAlgo>
pfmu_;
45 : useMTDTiming_(conf.getParameter<
bool>(
"useMTDTiming")),
46 useTimingAverage_(conf.getParameter<
bool>(
"useTimingAverage")),
47 timingQualityThreshold_(conf.getParameter<double>(
"timingQualityThreshold")),
48 energy_from_regression_(conf.getParameter<
bool>(
"energyFromRegression")),
49 isTICLv5_(conf.getParameter<
bool>(
"isTICLv5")),
59 produces<reco::PFCandidateCollection>();
68 desc.add<
bool>(
"energyFromRegression",
true);
69 desc.add<
double>(
"timingQualityThreshold", 0.5);
70 desc.add<
bool>(
"useMTDTiming",
true);
71 desc.add<
bool>(
"isTICLv5",
false);
72 desc.add<
bool>(
"useTimingAverage",
false);
79 descriptions.
add(
"pfTICLProducer",
desc);
86 const auto ticl_candidates = *ticl_cand_h;
94 const auto&
muons = *muonH;
96 auto candidates = std::make_unique<reco::PFCandidateCollection>();
98 for (
const auto& ticl_cand : ticl_candidates) {
99 const auto abs_pdg_id =
std::abs(ticl_cand.pdgId());
100 const auto charge = ticl_cand.charge();
101 const auto& four_mom = ticl_cand.p4();
102 float total_raw_energy = 0.f;
103 float total_em_raw_energy = 0.f;
104 for (
const auto&
t : ticl_cand.tracksters()) {
105 total_raw_energy +=
t->raw_energy();
106 total_em_raw_energy +=
t->raw_em_energy();
108 float ecal_energy_fraction = total_em_raw_energy / total_raw_energy;
110 : ticl_cand.rawEnergy() * ecal_energy_fraction;
114 hcal_energy =
std::max(0.
f, hcal_energy);
116 switch (abs_pdg_id) {
140 candidate.setEcalEnergy(ecal_energy, ecal_energy);
141 candidate.setHcalEnergy(hcal_energy, hcal_energy);
142 if (candidate.charge()) {
146 candidate.setTrackRef(trackref);
153 (ticl_cand.tracksters().empty() and muonref.
isNonnull() and muonref->isGlobalMuon())) {
156 pfmu_->reconstructMuon(candidate, muonref, allowLoose);
164 pfmu_->reconstructMuon(candidate, muonref, allowLoose);
170 candidate.setTime(ticl_cand.time(), ticl_cand.timeError());
173 auto time = ticl_cand.time();
174 auto timeE = ticl_cand.timeError();
183 const auto timeHGC =
time;
184 const auto timeEHGC = timeE;
185 const auto timeMTD = (*trackTimeH)[candidate.trackRef()];
186 const auto timeEMTD = (*trackTimeErrH)[candidate.trackRef()];
190 const auto invTimeESqHGC =
pow(timeEHGC, -2);
191 const auto invTimeESqMTD =
pow(timeEMTD, -2);
192 timeE = 1.f / (invTimeESqHGC + invTimeESqMTD);
193 time = (timeHGC * invTimeESqHGC + timeMTD * invTimeESqMTD) * timeE;
195 }
else if (timeEMTD > 0) {
201 candidate.setTime(
time, timeE);
static int muAssocToTrack(const reco::TrackRef &trackref, const reco::MuonCollection &muons)
T getParameter(std::string const &) const
const bool energy_from_regression_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
ParticleType
particle types
edm::EDGetTokenT< edm::ValueMap< float > > srcTrackTimeError_
~PFTICLProducer() override
const bool useTimingAverage_
static bool isMuon(const reco::PFBlockElement &elt)
bool isNonnull() const
Checks for non-null.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
PFTICLProducer(const edm::ParameterSet &)
muons
the two sets of parameters below are mutually exclusive, depending if RECO or ALCARECO is used the us...
std::vector< Muon > MuonCollection
collection of Muon objects
EDProductGetter const & productGetter() const
edm::EDGetTokenT< edm::ValueMap< float > > srcTrackTimeQuality_
const edm::EDGetTokenT< edm::View< TICLCandidate > > ticl_candidates_
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
std::unique_ptr< PFMuonAlgo > pfmu_
Abs< T >::type abs(const T &t)
edm::Ref< MuonCollection > MuonRef
presistent reference to a Muon
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< edm::ValueMap< float > > srcTrackTime_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const float timingQualityThreshold_
static void fillPSetDescription(edm::ParameterSetDescription &iDesc)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void produce(edm::Event &, const edm::EventSetup &) override
ParameterSet const & getParameterSet(ParameterSetID const &id)
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
Power< A, B >::type pow(const A &a, const B &b)
const edm::EDGetTokenT< reco::MuonCollection > muons_