Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
import sys
import FWCore.ParameterSet.Config as cms

def customlog(s):
print("# MSG-i trackselectionRefitting: %s" % s)

def getSequence(process, collection,
saveCPU = False,
TTRHBuilder = "WithAngleAndTemplate",
Expand Down Expand Up @@ -52,13 +55,13 @@ def getSequence(process, collection,
# resolve default values incl. consistency checks #
###################################################

print("g4Refitting=",g4Refitting)
customlog("g4Refitting=%s" % g4Refitting)

if usePixelQualityFlag is None:
if "Template" not in TTRHBuilder:
usePixelQualityFlag = False # not defined without templates
print("Using 'TTRHBuilder' without templates:", TTRHBuilder)
print(" --> Turning off pixel quality flag in hit filter.")
customlog("Using 'TTRHBuilder' without templates %s" % TTRHBuilder)
customlog(" --> Turning off pixel quality flag in hit filter.")
else:
usePixelQualityFlag = True # default for usage with templates

Expand Down Expand Up @@ -375,11 +378,11 @@ def getSequence(process, collection,
else:
if mods[-1][-1]["method"] == "load" and \
not mods[-1][-1].get("clone", False):
print("Name of the last module needs to be modifiable.")
customlog("Name of the last module needs to be modifiable.")
sys.exit(1)

if g4Refitting:
print("Here we must include geopro first")
customlog("Here we must include geopro first")
process.load('Configuration.StandardSequences.GeometryDB_cff')
process.load("TrackPropagation.Geant4e.geantRefit_cff")
modules.append(getattr(process,"geopro"))
Expand Down Expand Up @@ -457,7 +460,7 @@ def _getModule(process, src, modType, moduleName, options, **kwargs):
obj = getattr(process, objTuple[1])
moduleName = objTuple[1]
else:
print("Unknown method:", method)
customlog("Unknown method: %s" % method)
sys.exit(1)

if modType == "TrackSplitting":
Expand Down
2 changes: 0 additions & 2 deletions Alignment/OfflineValidation/bin/exceptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ namespace AllInOneConfig {
std::cerr << colorify("Logic Error: ") << e.what() << '\n';
} catch (const std::exception &e) {
std::cerr << colorify("Standard Error: ") << e.what() << '\n';
} catch (...) {
std::cerr << colorify("Unkown failure\n");
}
return EXIT_FAILURE;
}
Expand Down
4 changes: 2 additions & 2 deletions Alignment/OfflineValidation/bin/jetHtPlotter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void drawSingleHistogram(TH1D *histogram[kMaxFiles],
bool logScale,
int color[kMaxFiles]) {
// Create and setup the histogram drawer
JDrawer *drawer = new JDrawer();
const auto &drawer = std::make_unique<JDrawer>();
drawer->SetLogY(logScale);
drawer->SetTopMargin(0.08);

Expand Down Expand Up @@ -812,7 +812,7 @@ void jetHtPlotter(std::string configurationFileName) {
// Draw the plots
// ===============================================

JDrawer *drawer = new JDrawer();
const auto &drawer = std::make_unique<JDrawer>();
TLegend *legend[nMaxLegendColumns];
int columnOrder[nMaxLegendColumns];
bool noIovFound = true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef ALIGNMENT_OFFLINEVALIDATION_PLOTALIGNNMENTVALIDATION_H_
#define ALIGNMENT_OFFLINEVALIDATION_PLOTALIGNNMENTVALIDATION_H_

#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "Alignment/OfflineValidation/interface/TkAlStyle.h"
#include "Alignment/OfflineValidation/interface/TkOffTreeVariables.h"

Expand Down
2 changes: 1 addition & 1 deletion Alignment/OfflineValidation/plugins/DMRChecker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2101,7 +2101,7 @@ void DMRChecker::fillDescriptions(edm::ConfigurationDescriptions &descriptions)
desc.add<edm::InputTag>("BeamSpotTag", edm::InputTag("offlineBeamSpot"));
desc.add<edm::InputTag>("VerticesTag", edm::InputTag("offlinePrimaryVertices"));
desc.add<bool>("isCosmics", false);
descriptions.add("DMRChecker", desc);
descriptions.addWithDefaultLabel(desc);
}

DEFINE_FWK_MODULE(DMRChecker);
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,7 @@ void GeneralPurposeTrackAnalyzer::fillDescriptions(edm::ConfigurationDescription
desc.add<edm::InputTag>("BeamSpotTag", edm::InputTag("offlineBeamSpot"));
desc.add<edm::InputTag>("VerticesTag", edm::InputTag("offlinePrimaryVertices"));
desc.add<bool>("isCosmics", false);
descriptions.add("GeneralPurposeTrackAnalyzer", desc);
descriptions.addWithDefaultLabel(desc);
}

DEFINE_FWK_MODULE(GeneralPurposeTrackAnalyzer);
49 changes: 22 additions & 27 deletions Alignment/OfflineValidation/plugins/JetHTAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,12 @@
//
// class declaration
//

// If the analyzer does not use TFileService, please remove
// the template argument to the base class so the class inherits
// from edm::one::EDAnalyzer<>
// This will improve performance in multithreaded jobs.

using reco::TrackCollection;

class JetHTAnalyzer : public edm::one::EDAnalyzer<edm::one::SharedResources> {
public:
explicit JetHTAnalyzer(const edm::ParameterSet&);
~JetHTAnalyzer() override;
~JetHTAnalyzer() override = default;

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
static bool mysorter(reco::Track i, reco::Track j) { return (i.pt() > j.pt()); }
Expand All @@ -78,23 +72,23 @@ class JetHTAnalyzer : public edm::one::EDAnalyzer<edm::one::SharedResources> {
void endJob() override;

// ----------member data ---------------------------
const edm::InputTag pvsTag_;
const edm::EDGetTokenT<reco::VertexCollection> pvsToken_;

edm::InputTag pvsTag_;
edm::EDGetTokenT<reco::VertexCollection> pvsToken_;
const edm::InputTag tracksTag_;
const edm::EDGetTokenT<reco::TrackCollection> tracksToken_;

edm::InputTag tracksTag_;
edm::EDGetTokenT<reco::TrackCollection> tracksToken_;
const edm::InputTag triggerTag_;
const edm::EDGetTokenT<edm::TriggerResults> triggerToken_;

edm::InputTag triggerTag_;
edm::EDGetTokenT<edm::TriggerResults> triggerToken_;
const int printTriggerTable_;
const double minVtxNdf_;
const double minVtxWgt_;

int printTriggerTable_;
double minVtxNdf_;
double minVtxWgt_;

std::vector<double> profilePtBorders_;
std::vector<int> iovList_;
const std::vector<double> profilePtBorders_;
const std::vector<int> iovList_;

// output histograms
edm::Service<TFileService> outfile_;
TH1F* h_ntrks;
TH1F* h_probePt;
Expand All @@ -106,6 +100,9 @@ class JetHTAnalyzer : public edm::one::EDAnalyzer<edm::one::SharedResources> {
TH1F* h_probeDzErr;

SmartSelectionMonitor mon;

// for the conversions
static constexpr double cmToum = 10000;
};

//
Expand All @@ -127,11 +124,6 @@ JetHTAnalyzer::JetHTAnalyzer(const edm::ParameterSet& iConfig)
usesResource(TFileService::kSharedResource);
}

//
// Default destructor
//
JetHTAnalyzer::~JetHTAnalyzer() = default;

//
// member functions
//
Expand All @@ -140,8 +132,6 @@ JetHTAnalyzer::~JetHTAnalyzer() = default;
void JetHTAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
using namespace edm;

const double cmToum = 10000;

const auto& vertices = iEvent.get(pvsToken_);
const reco::VertexCollection& pvtx = vertices;

Expand Down Expand Up @@ -341,7 +331,12 @@ void JetHTAnalyzer::fillDescriptions(edm::ConfigurationDescriptions& description
desc.add<edm::InputTag>("vtxCollection", edm::InputTag("offlinePrimaryVerticesFromRefittedTrks"));
desc.add<edm::InputTag>("triggerResults", edm::InputTag("TriggerResults", "", "HLT"));
desc.add<edm::InputTag>("trackCollection", edm::InputTag("TrackRefitter"));
descriptions.add("JetHTAnalyzer", desc);
desc.add<int>("printTriggerTable", false);
desc.add<double>("minVertexNdf", 10.);
desc.add<double>("minVertexMeanWeight", 0.5);
desc.add<std::vector<double>>("profilePtBorders", {3, 5, 10, 20, 50, 100});
desc.add<std::vector<double>>("iovList", {0, 500000});
descriptions.addWithDefaultLabel(desc);
}

//define this as a plug-in
Expand Down
2 changes: 2 additions & 0 deletions Alignment/OfflineValidation/src/PlotAlignmentValidation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2239,6 +2239,7 @@ double PlotAlignmentValidation::resampleTestOfEqualRMS(TH1F* h1, TH1F* h2, int n
test_mean += abs(d1 - d2 - rmsdiff);
}
test_mean /= numSamples;
edm::LogPrint("") << "test mean:" << test_mean;
//p value
double p = 0;
for (double d : diff) {
Expand Down Expand Up @@ -2283,6 +2284,7 @@ double PlotAlignmentValidation::resampleTestOfEqualMeans(TH1F* h1, TH1F* h2, int
test_mean += abs(d1 - d2 - meandiff);
}
test_mean /= numSamples;
edm::LogPrint("") << "test mean:" << test_mean;
//p-value
double p = 0;
for (double d : diff) {
Expand Down
8 changes: 8 additions & 0 deletions Alignment/OfflineValidation/src/PreparePVTrends.cc
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,12 @@ pv::biases PreparePVTrends::getBiases(TH1F *hist)
/*--------------------------------------------------------------------*/
{
int nbins = hist->GetNbinsX();
// if there are no bins in the histogram then return default constructed object
// shouldn't really ever happen
if (nbins <= 0) {
logError << "No bins in the input histogram";
return pv::biases();
}

//extract median from histogram
double *y = new double[nbins];
Expand Down Expand Up @@ -712,6 +718,8 @@ pv::biases PreparePVTrends::getBiases(TH1F *hist)

delete theZero;
delete displaced;
delete[] y;
delete[] err;
return result;
}

Expand Down
25 changes: 12 additions & 13 deletions Alignment/OfflineValidation/test/PVValidation_TEMPL_cfg.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function
import FWCore.ParameterSet.Config as cms
import sys

Expand Down Expand Up @@ -45,15 +44,15 @@ def customiseKinksAndBows(process):
# Event source and run selection
###################################################################
if (useFileList):
print(">>>>>>>>>> testPVValidation_cfg.py: msg%-i: Reading local input files list")
print("############ testPVValidation_cfg.py: msg%-i: Reading local input files list")
readFiles = cms.untracked.vstring()
readFiles.extend(FILESOURCETEMPLATE)
process.source = cms.Source("PoolSource",
fileNames = readFiles ,
duplicateCheckMode = cms.untracked.string('checkAllFilesOpened')
)
else:
print(">>>>>>>>>> testPVValidation_cfg.py: msg%-i: Reading from configuration fragment")
print("############ testPVValidation_cfg.py: msg%-i: Reading from configuration fragment")
process.load("Alignment.OfflineValidation.DATASETTEMPLATE")

###################################################################
Expand All @@ -67,12 +66,12 @@ def customiseKinksAndBows(process):
# JSON Filtering
###################################################################
if isMC:
print(">>>>>>>>>> testPVValidation_cfg.py: msg%-i: This is simulation!")
print("############ testPVValidation_cfg.py: msg%-i: This is simulation!")
runboundary = 1
else:
print(">>>>>>>>>> testPVValidation_cfg.py: msg%-i: This is real DATA!")
print("############ testPVValidation_cfg.py: msg%-i: This is real DATA!")
if ('LUMILISTTEMPLATE'):
print(">>>>>>>>>> testPVValidation_cfg.py: msg%-i: JSON filtering with: LUMILISTTEMPLATE")
print("############ testPVValidation_cfg.py: msg%-i: JSON filtering with: LUMILISTTEMPLATE")
import FWCore.PythonUtilities.LumiList as LumiList
process.source.lumisToProcess = LumiList.LumiList(filename ='LUMILISTTEMPLATE').getVLuminosityBlockRange()

Expand Down Expand Up @@ -110,7 +109,7 @@ def customiseKinksAndBows(process):
process.GlobalTag = GlobalTag(process.GlobalTag, 'GLOBALTAGTEMPLATE', '')

if allFromGT:
print(">>>>>>>>>> testPVValidation_cfg.py: msg%-i: All is taken from GT")
print("############ testPVValidation_cfg.py: msg%-i: All is taken from GT")
else:
####################################################################
# Get Alignment and APE constants
Expand All @@ -121,24 +120,24 @@ def customiseKinksAndBows(process):
# Kinks and Bows (optional)
####################################################################
if applyBows:
print(">>>>>>>>>> testPVValidation_cfg.py: msg%-i: Applying TrackerSurfaceDeformations!")
print("############ testPVValidation_cfg.py: msg%-i: Applying TrackerSurfaceDeformations!")
process=customiseKinksAndBows(process)
else:
print(">>>>>>>>>> testPVValidation_cfg.py: msg%-i: MultiPVValidation: Not applying TrackerSurfaceDeformations!")
print("############ testPVValidation_cfg.py: msg%-i: MultiPVValidation: Not applying TrackerSurfaceDeformations!")

####################################################################
# Extra corrections not included in the GT
####################################################################
if applyExtraConditions:
print(">>>>>>>>>> testPVValidation_cfg.py: msg%-i: Applying extra calibration constants!")
print("############ testPVValidation_cfg.py: msg%-i: Applying extra calibration constants!")

import CalibTracker.Configuration.Common.PoolDBESSource_cfi

# Extra conditions to be plugged here
##### END OF EXTRA CONDITIONS

else:
print(">>>>>>>>>> testPVValidation_cfg.py: msg%-i: Not applying extra calibration constants!")
print("############ testPVValidation_cfg.py: msg%-i: Not applying extra calibration constants!")


####################################################################
Expand Down Expand Up @@ -224,10 +223,10 @@ def customiseKinksAndBows(process):
####################################################################
def switchClusterizerParameters(da):
if da:
print(">>>>>>>>>> testPVValidation_cfg.py: msg%-i: Running DA Algorithm!")
print("############ testPVValidation_cfg.py: msg%-i: Running DA Algorithm!")
return DAClusterizationParams
else:
print(">>>>>>>>>> testPVValidation_cfg.py: msg%-i: Running GAP Algorithm!")
print("############ testPVValidation_cfg.py: msg%-i: Running GAP Algorithm!")
return GapClusterizationParams

####################################################################
Expand Down
Loading