Skip to content

Commit

Permalink
Merge branch 'master' into 121_AddGEMUnpackerL1REPACKandUpdateHLTGetC…
Browse files Browse the repository at this point in the history
…onfig
  • Loading branch information
srimanob committed Aug 5, 2021
2 parents 0d607d2 + 1259e6a commit d7c1197
Show file tree
Hide file tree
Showing 137 changed files with 1,178 additions and 847 deletions.
Expand Up @@ -16,11 +16,13 @@ class HcalPulseContainmentCorrection {
public:
HcalPulseContainmentCorrection(int num_samples,
float fixedphase_ns,
bool phaseAsInSim,
float max_fracerror,
const HcalTimeSlew* hcalTimeSlew_delay);
HcalPulseContainmentCorrection(const HcalPulseShape* shape,
int num_samples,
float fixedphase_ns,
bool phaseAsInSim,
float max_fracerror,
const HcalTimeSlew* hcalTimeSlew_delay);
double getCorrection(double fc_ampl) const;
Expand Down
Expand Up @@ -10,9 +10,9 @@
class HcalPulseContainmentManager {
public:
// for callers not calling beginRun(EventSetup)
HcalPulseContainmentManager(float max_fracerror);
HcalPulseContainmentManager(float max_fracerror, bool phaseAsInSim);
// for callers calling beginRun(EventSetup)
HcalPulseContainmentManager(float max_fracerror, edm::ConsumesCollector iC);
HcalPulseContainmentManager(float max_fracerror, bool phaseAsInSim, edm::ConsumesCollector iC);
double correction(const HcalDetId& detId, int toAdd, float fixedphase_ns, double fc_ampl);
const HcalPulseContainmentCorrection* get(const HcalDetId& detId, int toAdd, float fixedphase_ns);

Expand All @@ -38,6 +38,7 @@ class HcalPulseContainmentManager {
HcalPulseShapes shapes_;
float fixedphase_ns_;
float max_fracerror_;
bool phaseAsInSim_;
const edm::ESGetToken<HcalTimeSlew, HcalTimeSlewRecord> delayToken_;

const HcalTimeSlew* hcalTimeSlew_delay_;
Expand Down
10 changes: 8 additions & 2 deletions CalibCalorimetry/HcalAlgos/plugins/HcalPulseContainmentTest.cc
Expand Up @@ -48,7 +48,7 @@ void HcalPulseContainmentTest::analyze(const edm::Event& iEvent, const edm::Even
float fixedphase_ns = 6.0;
float max_fracerror = 0.02;
std::unique_ptr<HcalPulseContainmentManager> manager;
manager = std::make_unique<HcalPulseContainmentManager>(max_fracerror);
manager = std::make_unique<HcalPulseContainmentManager>(max_fracerror, true);
manager->setTimeSlew(hcalTimeSlew_delay_);

HcalDetId hb1(HcalBarrel, 1, 1, 1);
Expand All @@ -64,7 +64,13 @@ void HcalPulseContainmentTest::analyze(const edm::Event& iEvent, const edm::Even
// HB and HE have the same shape here
double corr4 = manager->correction(he1, 4, fixedphase_ns, fc);
assert(corr4 == corr1);
std::cout << corr1 << " " << corr2 << " " << corr3 << " " << corr4 << " " << std::endl;
edm::LogPrint("HcalPulseContainmentTest") << corr1 << " " << corr2 << " " << corr3 << " " << corr4;
// test 1TS correction at high energy
double corr5 = manager->correction(hb1, 1, fixedphase_ns, 100000.);
edm::LogPrint("HcalPulseContainmentTest") << corr5;
// test 2TS correction at high energy
double corr6 = manager->correction(hb1, 2, fixedphase_ns, 100000.);
edm::LogPrint("HcalPulseContainmentTest") << corr6;
}

//define this as a plug-in
Expand Down
28 changes: 19 additions & 9 deletions CalibCalorimetry/HcalAlgos/src/HcalPulseContainmentAlgo.cc
Expand Up @@ -11,8 +11,10 @@
//
HcalPulseContainmentAlgo::HcalPulseContainmentAlgo(int num_samples,
double fixedphase_ns,
bool phaseAsInSim,
const HcalTimeSlew* hcalTimeSlew_delay)
: fixedphasens_(fixedphase_ns),
phaseAsInSim_(phaseAsInSim),
integrator_(&(HcalPulseShapes().hbShape())),
hcalTimeSlew_delay_(hcalTimeSlew_delay) {
init(num_samples);
Expand All @@ -21,8 +23,12 @@ HcalPulseContainmentAlgo::HcalPulseContainmentAlgo(int num_samples,
HcalPulseContainmentAlgo::HcalPulseContainmentAlgo(const HcalPulseShape* shape,
int num_samples,
double fixedphase_ns,
bool phaseAsInSim,
const HcalTimeSlew* hcalTimeSlew_delay)
: fixedphasens_(fixedphase_ns), integrator_(shape), hcalTimeSlew_delay_(hcalTimeSlew_delay) {
: fixedphasens_(fixedphase_ns),
phaseAsInSim_(phaseAsInSim),
integrator_(shape),
hcalTimeSlew_delay_(hcalTimeSlew_delay) {
init(num_samples);
}

Expand All @@ -48,39 +54,43 @@ void HcalPulseContainmentAlgo::init(int num_samples) {
#if 0
char s[80];
sprintf (s, "%7.3f %8.5f %8.5f\n", tmin, bin0val, bin1val);
cout << s;
edm::LogPrint("HcalPulseContainmentAlgo") << s;
#endif

if (bin1val > bin0val) {
time0shiftns_ = shift_ns;
break;
}
}

#if 0
cout << "time0shiftns_ = " << time0shiftns_ << endl;
edm::LogPrint("HcalPulseContainmentAlgo") << "time0shiftns_ = " << time0shiftns_;
#endif
}

std::pair<double, double> HcalPulseContainmentAlgo::calcpair(double truefc) {
double timeslew_ns = hcalTimeSlew_delay_->delay(std::max(0.0, (double)truefc), HcalTimeSlew::Medium);

double shift_ns = fixedphasens_ - time0shiftns_ + timeslew_ns;
//std::cout << "SHIFT " << fixedphasens_ << " " << time0shiftns_ << " " << timeslew_ns << std::endl;
double tmin = -shift_ns;
double tmin = 0;
if (phaseAsInSim_) { // timePhase as in hcalSimParameters, no time0shift
tmin = fixedphasens_ - timeslew_ns;
} else { // Run 2: timePhase opposite to SIM, time0shift
double shift_ns = fixedphasens_ - time0shiftns_ + timeslew_ns;
//edm::LogPrint("HcalPulseContainmentAlgo") << "SHIFT " << fixedphasens_ << " " << time0shiftns_ << " " << timeslew_ns;
tmin = -shift_ns;
}
double tmax = tmin + integrationwindowns_;

//double integral = shape_.integrate( tmin, tmax );
double integral = integrator_(tmin, tmax);
//std::cout << "INTEGRAL " << integral << " " << truefc << " " << tmin << " " << tmax << std::endl;
//edm::LogPrint("HcalPulseContainmentAlgo") << "INTEGRAL " << integral << " " << truefc << " " << tmin << " " << tmax;
double corfactor = 1.0 / integral;
double recofc = (double)truefc * integral;

#if 0
char s[80];
sprintf (s, "%8.2f %8.4f %8.4f %8.5f %8.5f %8.5f ",
truefc, tmin, tmax, integral, corfactor, recofc);
cout << s;
edm::LogPrint("HcalPulseContainmentAlgo") << s;
#endif

std::pair<double, double> thepair(recofc, corfactor);
Expand Down
7 changes: 6 additions & 1 deletion CalibCalorimetry/HcalAlgos/src/HcalPulseContainmentAlgo.h
Expand Up @@ -11,15 +11,20 @@ class HcalPulseContainmentAlgo {
HcalPulseContainmentAlgo(const HcalPulseShape* shape,
int num_samples,
double fixedphase_ns,
bool phaseAsInSim,
const HcalTimeSlew* hcalTimeSlew_delay);
HcalPulseContainmentAlgo(int num_samples,
double fixedphase_ns,
bool phaseAsInSim,
const HcalTimeSlew* hcalTimeSlew_delay);
HcalPulseContainmentAlgo(int num_samples, double fixedphase_ns, const HcalTimeSlew* hcalTimeSlew_delay);
std::pair<double, double> calcpair(double);

private:
void init(int num_samples);
double fixedphasens_;
double integrationwindowns_;
double time0shiftns_;
bool phaseAsInSim_;
HcalShapeIntegrator integrator_;
const HcalTimeSlew* hcalTimeSlew_delay_;
};
Expand Down
Expand Up @@ -16,9 +16,10 @@
//
HcalPulseContainmentCorrection::HcalPulseContainmentCorrection(int num_samples,
float fixedphase_ns,
bool phaseAsInSim,
float max_fracerror,
const HcalTimeSlew* hcalTimeSlew_delay) {
HcalPulseContainmentAlgo corFalgo(num_samples, (double)fixedphase_ns, hcalTimeSlew_delay);
HcalPulseContainmentAlgo corFalgo(num_samples, (double)fixedphase_ns, phaseAsInSim, hcalTimeSlew_delay);

// Generate lookup map for the correction function, never exceeding
// a maximum fractional error for lookups.
Expand All @@ -37,9 +38,10 @@ HcalPulseContainmentCorrection::HcalPulseContainmentCorrection(int num_samples,
HcalPulseContainmentCorrection::HcalPulseContainmentCorrection(const HcalPulseShape* shape,
int num_samples,
float fixedphase_ns,
bool phaseAsInSim,
float max_fracerror,
const HcalTimeSlew* hcalTimeSlew_delay) {
HcalPulseContainmentAlgo corFalgo(shape, num_samples, (double)fixedphase_ns, hcalTimeSlew_delay);
HcalPulseContainmentAlgo corFalgo(shape, num_samples, (double)fixedphase_ns, phaseAsInSim, hcalTimeSlew_delay);
genlkupmap<HcalPulseContainmentAlgo>(1.0,
200000.0f, // generation domain
max_fracerror, // maximum fractional error
Expand Down
11 changes: 7 additions & 4 deletions CalibCalorimetry/HcalAlgos/src/HcalPulseContainmentManager.cc
Expand Up @@ -3,15 +3,18 @@
#include "FWCore/Framework/interface/EventSetup.h"
#include <iostream>

HcalPulseContainmentManager::HcalPulseContainmentManager(float max_fracerror)
: entries_(), shapes_(), max_fracerror_(max_fracerror) {
HcalPulseContainmentManager::HcalPulseContainmentManager(float max_fracerror, bool phaseAsInSim)
: entries_(), shapes_(), max_fracerror_(max_fracerror), phaseAsInSim_(phaseAsInSim) {
hcalTimeSlew_delay_ = nullptr;
}

HcalPulseContainmentManager::HcalPulseContainmentManager(float max_fracerror, edm::ConsumesCollector iC)
HcalPulseContainmentManager::HcalPulseContainmentManager(float max_fracerror,
bool phaseAsInSim,
edm::ConsumesCollector iC)
: entries_(),
shapes_(iC),
max_fracerror_(max_fracerror),
phaseAsInSim_(phaseAsInSim),
delayToken_(iC.esConsumes<edm::Transition::BeginRun>(edm::ESInputTag("", "HBHE"))) {}

void HcalPulseContainmentManager::beginRun(edm::EventSetup const& es) {
Expand Down Expand Up @@ -75,7 +78,7 @@ const HcalPulseContainmentCorrection* HcalPulseContainmentManager::get(const Hca
toAdd,
fixedphase_ns,
shape,
HcalPulseContainmentCorrection(shape, toAdd, fixedphase_ns, max_fracerror_, hcalTimeSlew_delay_));
HcalPulseContainmentCorrection(shape, toAdd, fixedphase_ns, phaseAsInSim_, max_fracerror_, hcalTimeSlew_delay_));
entries_.push_back(entry);
return &(entries_.back().correction_);
}
2 changes: 1 addition & 1 deletion CalibCalorimetry/HcalTPGAlgos/src/HcaluLUTTPGCoder.cc
Expand Up @@ -81,7 +81,7 @@ void HcaluLUTTPGCoder::init(const HcalTopology* top, const HcalTimeSlew* delay)
linearLSB_QIE8_ = 1.;
linearLSB_QIE11_ = 1.;
linearLSB_QIE11Overlap_ = 1.;
pulseCorr_ = std::make_unique<HcalPulseContainmentManager>(MaximumFractionalError);
pulseCorr_ = std::make_unique<HcalPulseContainmentManager>(MaximumFractionalError, false);
firstHBEta_ = topo_->firstHBRing();
lastHBEta_ = topo_->lastHBRing();
nHBEta_ = (lastHBEta_ - firstHBEta_ + 1);
Expand Down
Expand Up @@ -9,7 +9,7 @@
*
*/

#include "CommonTools/RecoAlgos/src/TrackToRefCandidate.h"
#include "CommonTools/RecoAlgos/interface/TrackToRefCandidate.h"
#include "FWCore/Framework/interface/MakerMacros.h"

typedef CandidateProducer<edm::View<reco::Track>,
Expand Down
Expand Up @@ -11,7 +11,7 @@
*
*/

#include "CommonTools/RecoAlgos/src/TrackToRefCandidate.h"
#include "CommonTools/RecoAlgos/interface/TrackToRefCandidate.h"
#include "FWCore/Framework/interface/MakerMacros.h"

typedef CandidateProducer<reco::TrackCollection, reco::RecoChargedRefCandidateCollection>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions CommonTools/Utils/interface/StringCutObjectSelector.h
Expand Up @@ -7,8 +7,8 @@
* $Id: StringCutObjectSelector.h,v 1.4 2012/06/26 21:09:37 wmtan Exp $
*/
#include "FWCore/Utilities/interface/EDMException.h"
#include "CommonTools/Utils/src/SelectorPtr.h"
#include "CommonTools/Utils/src/SelectorBase.h"
#include "CommonTools/Utils/interface/SelectorPtr.h"
#include "CommonTools/Utils/interface/SelectorBase.h"
#include "CommonTools/Utils/interface/cutParser.h"
#include "FWCore/Reflection/interface/ObjectWithDict.h"

Expand Down
4 changes: 2 additions & 2 deletions CommonTools/Utils/interface/StringObjectFunction.h
Expand Up @@ -7,8 +7,8 @@
* $Id: StringObjectFunction.h,v 1.4 2012/06/26 21:09:37 wmtan Exp $
*/
#include "FWCore/Utilities/interface/EDMException.h"
#include "CommonTools/Utils/src/ExpressionPtr.h"
#include "CommonTools/Utils/src/ExpressionBase.h"
#include "CommonTools/Utils/interface/ExpressionPtr.h"
#include "CommonTools/Utils/interface/ExpressionBase.h"
#include "CommonTools/Utils/interface/expressionParser.h"
#include "FWCore/Reflection/interface/ObjectWithDict.h"

Expand Down
2 changes: 1 addition & 1 deletion CommonTools/Utils/interface/cutParser.h
@@ -1,6 +1,6 @@
#ifndef CommonTools_Utils_cutParset_h
#define CommonTools_Utils_cutParset_h
#include "CommonTools/Utils/src/SelectorPtr.h"
#include "CommonTools/Utils/interface/SelectorPtr.h"
#include "CommonTools/Utils/interface/Exception.h"
#include "FWCore/Reflection/interface/TypeWithDict.h"
#include <string>
Expand Down
2 changes: 1 addition & 1 deletion CommonTools/Utils/interface/expressionParser.h
@@ -1,6 +1,6 @@
#ifndef CommonTools_Utils_expressionParset_h
#define CommonTools_Utils_expressionParset_h
#include "CommonTools/Utils/src/ExpressionPtr.h"
#include "CommonTools/Utils/interface/ExpressionPtr.h"
#include "CommonTools/Utils/interface/Exception.h"
#include "FWCore/Reflection/interface/TypeWithDict.h"
#include <string>
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions CommonTools/Utils/src/AndCombiner.h
Expand Up @@ -10,8 +10,8 @@
* \version $Revision: 1.2 $
*
*/
#include "CommonTools/Utils/src/SelectorBase.h"
#include "CommonTools/Utils/src/SelectorPtr.h"
#include "CommonTools/Utils/interface/SelectorBase.h"
#include "CommonTools/Utils/interface/SelectorPtr.h"

namespace reco {
namespace parser {
Expand Down
2 changes: 1 addition & 1 deletion CommonTools/Utils/src/AnyObjSelector.h
@@ -1,6 +1,6 @@
#ifndef CommonTools_Utils_AnyObjSelector_h
#define CommonTools_Utils_AnyObjSelector_h
#include "CommonTools/Utils/src/SelectorBase.h"
#include "CommonTools/Utils/interface/SelectorBase.h"

namespace reco {
namespace parser {
Expand Down
4 changes: 2 additions & 2 deletions CommonTools/Utils/src/BinarySelector.h
Expand Up @@ -10,8 +10,8 @@
* \version $Revision: 1.2 $
*
*/
#include "CommonTools/Utils/src/SelectorBase.h"
#include "CommonTools/Utils/src/ExpressionBase.h"
#include "CommonTools/Utils/interface/SelectorBase.h"
#include "CommonTools/Utils/interface/ExpressionBase.h"
#include "CommonTools/Utils/src/ComparisonBase.h"

namespace reco {
Expand Down
2 changes: 1 addition & 1 deletion CommonTools/Utils/src/CutSetter.h
Expand Up @@ -10,7 +10,7 @@
* \version $Revision: 1.3 $
*
*/
#include "CommonTools/Utils/src/SelectorPtr.h"
#include "CommonTools/Utils/interface/SelectorPtr.h"
#include "CommonTools/Utils/src/SelectorStack.h"
#include <cassert>

Expand Down
2 changes: 1 addition & 1 deletion CommonTools/Utils/src/ExpressionBinaryOperator.h
Expand Up @@ -10,7 +10,7 @@
* \version $Revision: 1.2 $
*
*/
#include "CommonTools/Utils/src/ExpressionBase.h"
#include "CommonTools/Utils/interface/ExpressionBase.h"
#include "CommonTools/Utils/src/ExpressionStack.h"

namespace reco {
Expand Down
4 changes: 2 additions & 2 deletions CommonTools/Utils/src/ExpressionCondition.h
Expand Up @@ -10,8 +10,8 @@
* \version $Revision: 1.2 $
*
*/
#include "CommonTools/Utils/src/ExpressionBase.h"
#include "CommonTools/Utils/src/SelectorBase.h"
#include "CommonTools/Utils/interface/ExpressionBase.h"
#include "CommonTools/Utils/interface/SelectorBase.h"
#include "CommonTools/Utils/src/SelectorStack.h"
#include "CommonTools/Utils/src/ExpressionStack.h"

Expand Down
2 changes: 1 addition & 1 deletion CommonTools/Utils/src/ExpressionNumber.h
Expand Up @@ -10,7 +10,7 @@
* \version $Revision: 1.2 $
*
*/
#include "CommonTools/Utils/src/ExpressionBase.h"
#include "CommonTools/Utils/interface/ExpressionBase.h"

namespace reco {
namespace parser {
Expand Down
2 changes: 1 addition & 1 deletion CommonTools/Utils/src/ExpressionQuaterOperator.h
Expand Up @@ -10,7 +10,7 @@
* \version $Revision: 1.2 $
*
*/
#include "CommonTools/Utils/src/ExpressionBase.h"
#include "CommonTools/Utils/interface/ExpressionBase.h"
#include "CommonTools/Utils/src/ExpressionStack.h"

namespace reco {
Expand Down
2 changes: 1 addition & 1 deletion CommonTools/Utils/src/ExpressionSetter.h
Expand Up @@ -10,7 +10,7 @@
* \version $Revision: 1.2 $
*
*/
#include "CommonTools/Utils/src/ExpressionPtr.h"
#include "CommonTools/Utils/interface/ExpressionPtr.h"
#include "CommonTools/Utils/src/ExpressionStack.h"

namespace reco {
Expand Down
2 changes: 1 addition & 1 deletion CommonTools/Utils/src/ExpressionUnaryOperator.h
Expand Up @@ -10,7 +10,7 @@
* \version $Revision: 1.2 $
*
*/
#include "CommonTools/Utils/src/ExpressionBase.h"
#include "CommonTools/Utils/interface/ExpressionBase.h"
#include "CommonTools/Utils/src/ExpressionStack.h"

namespace reco {
Expand Down
2 changes: 1 addition & 1 deletion CommonTools/Utils/src/ExpressionVar.h
Expand Up @@ -10,7 +10,7 @@
*
*/

#include "CommonTools/Utils/src/ExpressionBase.h"
#include "CommonTools/Utils/interface/ExpressionBase.h"
#include "CommonTools/Utils/src/MethodInvoker.h"
#include "CommonTools/Utils/src/TypeCode.h"

Expand Down
2 changes: 1 addition & 1 deletion CommonTools/Utils/src/ExpressionVarSetter.cc
@@ -1,6 +1,6 @@
#include "CommonTools/Utils/src/ExpressionVarSetter.h"
#include "CommonTools/Utils/src/ExpressionVar.h"
#include "CommonTools/Utils/src/returnType.h"
#include "CommonTools/Utils/interface/returnType.h"
#include "CommonTools/Utils/interface/Exception.h"
#include <string>
using namespace reco::parser;
Expand Down
2 changes: 1 addition & 1 deletion CommonTools/Utils/src/LogicalBinaryOperator.h
Expand Up @@ -10,7 +10,7 @@
* \version $Revision: 1.2 $
*
*/
#include "CommonTools/Utils/src/SelectorBase.h"
#include "CommonTools/Utils/interface/SelectorBase.h"
#include "CommonTools/Utils/src/SelectorStack.h"

namespace reco {
Expand Down

0 comments on commit d7c1197

Please sign in to comment.