Skip to content

Commit

Permalink
Merge pull request #75 from steggema/CMSSW_10_1_X_TauRecoMiniAODReview
Browse files Browse the repository at this point in the history
Address comments of RECO review
  • Loading branch information
steggema authored Apr 17, 2018
2 parents d0c7a05 + be005e9 commit a827bdf
Show file tree
Hide file tree
Showing 644 changed files with 81,221 additions and 36,077 deletions.
2 changes: 2 additions & 0 deletions Alignment/CTPPS/data/RPixGeometryCorrections.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<xml DocumentType="AlignmentDescription">
<iov first="286693:0" last="309054:0">
<!-- RP 023 -->
<!-- plane 0 --> <det id="2023227392" sh_x="-24.1001" sh_y="58.1806" rot_z="0.746694"/>
<!-- plane 1 --> <det id="2023292928" sh_x="95.0701" sh_y="-151.826" rot_z="-4.31676"/>
Expand All @@ -13,4 +14,5 @@
<!-- plane 3 --> <det id="2040201216" sh_x="21.9166" sh_y="97.7493" rot_z="1.12857"/>
<!-- plane 4 --> <det id="2040266752" sh_x="-8.24139" sh_y="-143.913" rot_z="1.01097"/>
<!-- plane 5 --> <det id="2040332288" sh_x="-2.92738" sh_y="81.1726" rot_z="-0.672133"/>
</iov>
</xml>
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ class IntegratedCalibrationBase
AlignableMuon *muon,
AlignableExtras *extras) {};

/// Call at beginning of run:
/// default implementation is dummy, to be overwritten in derived class if useful.
virtual void beginRun(const edm::Run&, const edm::EventSetup&) {};

/// Called at beginning of a loop of the AlignmentProducer,
/// to be used for iterative algorithms, default does nothing.
/// FIXME: move call to algorithm?
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,10 @@

# Configuration of the granularity for the Lorentz angle calibration
LorentzAngleModuleGroups = cms.PSet(),

# depending on the TTRHBuilder one has to use different
# 'SiPixelLorentzAngleRcd' flavors, e.g. when using template hit
# reconstruction one has to use "fromAlignment" and for the generic version
# one directly uses the unlabelled version, i.e. ""
lorentzAngleLabel = cms.string("fromAlignment"),
)
38 changes: 21 additions & 17 deletions Alignment/CommonAlignmentProducer/src/AlignmentProducerBase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@ AlignmentProducerBase::beginRunImpl(const edm::Run& run, const edm::EventSetup&
alignmentAlgo_->beginRun(run, setup,
changed && (runAtPCL_ || enableAlignableUpdates_));

for (const auto& iCal:calibrations_) iCal->beginRun(run, setup);

//store the first run analyzed to be used for setting the IOV (for PCL)
if (firstRun_ > static_cast<cond::Time_t>(run.id().run())) {
firstRun_ = static_cast<cond::Time_t>(run.id().run());
Expand Down Expand Up @@ -363,20 +365,6 @@ AlignmentProducerBase::createCalibrations()
->create(iCalib.getParameter<std::string>("calibrationName"),
iCalib));
}

// Not all algorithms support calibrations - so do not pass empty vector
// and throw if non-empty and not supported:
if (!calibrations_.empty()) {
if (alignmentAlgo_->supportsCalibrations()) {
alignmentAlgo_->addCalibrations(calibrations_);

} else {
throw cms::Exception("BadConfig")
<< "@SUB=AlignmentProducerBase::createCalibrations\n"
<< "Configured " << calibrations_.size() << " calibration(s) "
<< "for algorithm not supporting it.";
}
}
}


Expand Down Expand Up @@ -442,7 +430,7 @@ AlignmentProducerBase::initAlignmentAlgorithm(const edm::EventSetup& setup,
{
edm::LogInfo("Alignment")
<< "@SUB=AlignmentProducerBase::initAlignmentAlgorithm"
<< "Bwgin";
<< "Begin";

auto isTrueUpdate = update && isAlgoInitialized_;

Expand All @@ -469,6 +457,20 @@ AlignmentProducerBase::initAlignmentAlgorithm(const edm::EventSetup& setup,
alignableMuon_,
alignableExtras_,
alignmentParameterStore_);

// Not all algorithms support calibrations - so do not pass empty vector
// and throw if non-empty and not supported:
if (!calibrations_.empty()) {
if (alignmentAlgo_->supportsCalibrations()) {
alignmentAlgo_->addCalibrations(calibrations_);
} else {
throw cms::Exception("BadConfig")
<< "@SUB=AlignmentProducerBase::createCalibrations\n"
<< "Configured " << calibrations_.size() << " calibration(s) "
<< "for algorithm not supporting it.";
}
}

isAlgoInitialized_ = true;

applyAlignmentsToGeometry();
Expand Down Expand Up @@ -925,8 +927,6 @@ AlignmentProducerBase::finish()
return false;
}

for (const auto& iCal:calibrations_) iCal->endOfJob();

if (saveToDB_ || saveApeToDB_ || saveDeformationsToDB_) {
if (alignmentAlgo_->storeAlignments()) storeAlignmentsToDB();
} else {
Expand All @@ -935,6 +935,10 @@ AlignmentProducerBase::finish()
<< "No payload to be stored!";
}

// takes care of storing output of calibrations, but needs to be called only
// after 'storeAlignmentsToDB()'
for (const auto& iCal:calibrations_) iCal->endOfJob();

return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ bool LaserAlignmentEventFilter::filter(edm::StreamID sid, edm::Event& iEvent, co

// construct FEDBuffer
sistrip::FEDBuffer buffer(input.data(), input.size());
if (not buffer.doChecks()) {
if (not buffer.doChecks(true)) {
edm::LogWarning("LaserAlignmentEventFilter") << "FED Buffer check fails for FED ID " << *ifed << ".";
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ def setup(process, input_files, collection,
process.AlignmentProducer.saveDeformationsToDB = False


# align calibrations to general settings
# --------------------------------------------------------------------------
for calib in process.AlignmentProducer.calibrations:
calib.saveToDB = process.AlignmentProducer.saveToDB
calib.treeFile = process.AlignmentProducer.algoConfig.treeFile
calib.mergeTreeFiles = process.AlignmentProducer.algoConfig.mergeTreeFiles


# Track selection and refitting
# --------------------------------------------------------------------------
import Alignment.CommonAlignment.tools.trackselectionRefitting as trackRefitter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ def setup(process, binary_files, tree_files, run_start_geometry):
process.AlignmentProducer.algoConfig.mergeTreeFiles = tree_files


# align calibrations to general settings
# --------------------------------------------------------------------------
for calib in process.AlignmentProducer.calibrations:
calib.saveToDB = process.AlignmentProducer.saveToDB
calib.treeFile = process.AlignmentProducer.algoConfig.treeFile
calib.mergeTreeFiles = process.AlignmentProducer.algoConfig.mergeTreeFiles


# Configure the empty source to include all needed runs
# --------------------------------------------------------------------------
iovs = mps_tools.make_unique_runranges(process.AlignmentProducer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ def read_db(self, db_file_name = __default_db_file_name):


for line in DBFILE:
line = line.rstrip('\n') #removes the pesky \n from line
parts = line.split(":") #read each line and split into parts list
if line.strip() == "": continue # ignore empty lines
line = line.rstrip('\n') # removes the pesky \n from line
parts = line.split(":") # read each line and split into parts list
self.JOBNUMBER.append(int(parts[0]))
self.JOBDIR.append(parts[1].strip())
self.JOBID.append(parts[2])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@
# connect = "frontier://FrontierProd/CMS_CONDITIONS",
# record = "TrackerAlignmentErrorExtendedRcd",
# tag = "TrackerAlignmentErrorsExtended_Upgrade2017_design_v0")
# tagwriter.setCondition(process,
# connect = "frontier://FrontierProd/CMS_CONDITIONS",
# record = "SiPixelLorentzAngleRcd",
# label = "fromAlignment",
# tag = "SiPixelLorentzAngle_fromAlignment_phase1_mc_v1")


#######################
Expand Down Expand Up @@ -200,6 +205,54 @@
# )
# ] # end of process.AlignmentProducer.RunRangeSelection

# # To run simultaneous calibrations of the pixel Lorentz angle you need to
# # include the corresponding config fragment and configure the granularity and
# # IOVs (must be consistent with input LA/template/alignment IOVs) for it.
# # Note: There are different version of the LA record available in the global
# # tag. Depending on the TTRHBuilder, one has to set a label to configure
# # which of them is to be used. The default TTRHBuilder uses pixel
# # templates which ignores the unlabelled LA record and uses only the one
# # labelled "fromAlignment". This is also the default value in the
# # integrated LA calibration. If you are using the generic CPE instead of
# # the template CPE you have to use the following setting:
# #
# # siPixelLA.lorentzAngleLabel = ""
#
# from Alignment.CommonAlignmentAlgorithm.SiPixelLorentzAngleCalibration_cff \
# import SiPixelLorentzAngleCalibration as siPixelLA
# siPixelLA.LorentzAngleModuleGroups.Granularity = cms.VPSet()
# siPixelLA.LorentzAngleModuleGroups.RunRange = cms.vuint32(290550,
# 295000,
# 298100)
#
# siPixelLA.LorentzAngleModuleGroups.Granularity.extend([
# cms.PSet(
# levels = cms.PSet(
# alignParams = cms.vstring(
# 'TrackerP1PXBModule,,RINGLAYER'
# ),
# RINGLAYER = cms.PSet(
# pxbDetId = cms.PSet(
# moduleRanges = cms.vint32(ring, ring),
# layerRanges = cms.vint32(layer, layer)
# )
# )
# )
# )
# for ring in xrange(1,9) # [1,8]
# for layer in xrange(1,5) # [1,4]
# ])
# siPixelLA.LorentzAngleModuleGroups.Granularity.append(
# cms.PSet(
# levels = cms.PSet(
# alignParams = cms.vstring('TrackerP1PXECModule,,posz'),
# posz = cms.PSet(zRanges = cms.vdouble(-9999.0, 9999.0))
# )
# )
# )
#
# process.AlignmentProducer.calibrations.append(siPixelLA)


#########################
## insert Pedesettings ##
Expand All @@ -208,13 +261,13 @@
# # reasonable pede settings are already defined in
# # 'confAliProducer.setConfiguration' above
# #
# # if you want obtain alignment errors, use "inversion 3 0.8" as
# # process.AlignmentProducer.algoConfig.pedeSteerer.method
# # if you want to obtain alignment errors, use the following setting:
# # process.AlignmentProducer.algoConfig.pedeSteerer.method = "inversion 3 0.8"
# #
# # a list of possible options is documented here:
# # http://www.desy.de/~kleinwrt/MP2/doc/html/option_page.html#sec-cmd
# #
# # you can change or drop pede settings as follows:
# # you can change or drop pede options as follows:
#
# import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.helper as helper
# helper.set_pede_option(process, "entries 50 10 2")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class TtDilepEvtSolution {
//-------------------------------------------
double getJetResidual() const;
double getLeptonResidual() const;
double getFullResidual() const { return getJetResidual()+getFullResidual(); }
double getFullResidual() const { return getJetResidual()+getLeptonResidual(); }
bool getBestSol() const { return bestSol_; }
double getRecTopMass() const {return topmass_; }
double getRecWeightMax() const {return weightmax_; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "CalibCalorimetry/HcalAlgos/interface/HcalPulseShapes.h"
#include "DataFormats/HcalDetId/interface/HcalDetId.h"
#include "CalibCalorimetry/HcalAlgos/interface/HcalTimeSlew.h"
#include "FWCore/Framework/interface/ESHandle.h"

class HcalPulseContainmentManager {
public:
Expand All @@ -13,8 +14,7 @@ class HcalPulseContainmentManager {
const HcalPulseContainmentCorrection * get(const HcalDetId & detId, int toAdd, float fixedphase_ns);

void beginRun(edm::EventSetup const & es);
void beginRun(const HcalTopology *topo, const edm::ESHandle<HcalTimeSlew>& delay, const edm::ESHandle<HcalMCParams>& mcParams, const edm::ESHandle<HcalRecoParams>& recoParams);
void endRun();
void beginRun(const HcalDbService* conditions, const edm::ESHandle<HcalTimeSlew>& delay);

void setTimeSlew(const HcalTimeSlew* timeSlew) {
hcalTimeSlew_delay_ = timeSlew;
Expand Down
12 changes: 3 additions & 9 deletions CalibCalorimetry/HcalAlgos/interface/HcalPulseShapes.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@
#include "CalibCalorimetry/HcalAlgos/interface/HcalPulseShape.h"
#include "DataFormats/HcalDetId/interface/HcalDetId.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "CalibFormats/HcalObjects/interface/HcalDbService.h"

/** \class HcalPulseShapes
*
* \author J. Mans - Minnesota
*/
class HcalMCParams;
class HcalRecoParams;
class HcalTopology;

namespace CLHEP {
class HepRandomEngine;
Expand All @@ -28,8 +25,7 @@ class HcalPulseShapes {
~HcalPulseShapes();
// only needed if you'll be getting shapes by DetId
void beginRun(edm::EventSetup const & es);
void endRun();
void beginRun(const HcalTopology* topo, const edm::ESHandle<HcalMCParams>& mcParams, const edm::ESHandle<HcalRecoParams>& recoParams);
void beginRun(const HcalDbService* conditions);

const Shape& hbShape() const { return hpdShape_; }
const Shape& heShape() const { return hpdShape_; }
Expand Down Expand Up @@ -85,9 +81,7 @@ class HcalPulseShapes {
Shape hpdShape_v2, hpdShapeMC_v2;
Shape hpdShape_v3, hpdShapeMC_v3;
Shape hpdBV30Shape_v2, hpdBV30ShapeMC_v2;
HcalMCParams * theMCParams;
const HcalTopology * theTopology;
HcalRecoParams * theRecoParams;
const HcalDbService * theDbService;
typedef std::map<int, const Shape *> ShapeMap;
ShapeMap theShapes;

Expand Down
9 changes: 2 additions & 7 deletions CalibCalorimetry/HcalAlgos/src/HcalPulseContainmentManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,11 @@ void HcalPulseContainmentManager::beginRun(edm::EventSetup const & es)
shapes_.beginRun(es);
}

void HcalPulseContainmentManager::endRun()
{
shapes_.endRun();
}

void HcalPulseContainmentManager::beginRun(const HcalTopology *topo, const edm::ESHandle<HcalTimeSlew>& delay, const edm::ESHandle<HcalMCParams>& mcParams, const edm::ESHandle<HcalRecoParams>& recoParams)
void HcalPulseContainmentManager::beginRun(const HcalDbService* conditions, const edm::ESHandle<HcalTimeSlew>& delay)
{
hcalTimeSlew_delay_ = &*delay;

shapes_.beginRun(topo, mcParams, recoParams);
shapes_.beginRun(conditions);
}

double HcalPulseContainmentManager::correction(const HcalDetId & detId,
Expand Down
Loading

0 comments on commit a827bdf

Please sign in to comment.