Skip to content

Commit

Permalink
miscellaneous updates to EoP testing macros
Browse files Browse the repository at this point in the history
   * avoid overriding variable from the two eop macros
   * do not run pion plotting in the same test as electron one
  • Loading branch information
mmusich committed Dec 14, 2022
1 parent a01b7a1 commit 7e15bdf
Show file tree
Hide file tree
Showing 7 changed files with 596 additions and 561 deletions.
1,101 changes: 558 additions & 543 deletions Alignment/OfflineValidation/macros/momentumBiasValidation.C

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ void momentumElectronBiasValidation(TString variable,
std::cout << "Configuring the ROOT style ..." << std::endl;
configureROOTstyle(verbose);

TCanvas* c = new TCanvas("c", "Canvas", 0, 0, 1150, 800);
TCanvas* ccontrol = new TCanvas("ccontrol", "controlCanvas", 0, 0, 600, 300);
TCanvas* c = new TCanvas("cElectron", "Canvas", 0, 0, 1150, 800);
TCanvas* ccontrol = new TCanvas("ccontrolElectron", "controlCanvas", 0, 0, 600, 300);

// Creating histos
std::vector<HistoType> histos(files.size());
Expand Down Expand Up @@ -417,6 +417,11 @@ void fillFinalHisto(ModeType mode, Bool_t verbose, HistoType& histo) {
// calculate mean of different energy bins
TF1* fit = new TF1("fit", "pol0", 0, histo.eRange.size() - 1);
TF1* fit2 = new TF1("fit2", "pol0", 0, histo.eRange.size() - 1);

if (histo.fit[i]->GetEntries() < 10) {
return;
}

histo.fit[i]->Fit("fit", fitOption + "0");
histo.combinedxAxisBin[i]->Fit("fit2", "Q0");
overallmisalignment = fit->GetParameter(0);
Expand Down Expand Up @@ -543,9 +548,11 @@ void layoutFinalPlot(ModeType mode,
}

// Fit function
histos[i].f2->SetLineColor(i + 1);
histos[i].f2->SetLineStyle(i + 1);
histos[i].f2->SetLineWidth(2);
if (histos[i].f2) {
histos[i].f2->SetLineColor(i + 1);
histos[i].f2->SetLineStyle(i + 1);
histos[i].f2->SetLineWidth(2);
}

// Other settings
histos[i].overallhisto->GetYaxis()->SetTitleOffset(1.05);
Expand Down Expand Up @@ -610,7 +617,9 @@ void layoutFinalPlot(ModeType mode,

// draw final histogram
histos[i].overallhisto->DrawClone("pe1 same");
histos[i].f2->DrawClone("same");
if (histos[i].f2) {
histos[i].f2->DrawClone("same");
}
histos[i].overallGraph->DrawClone("|| same");
histos[i].overallGraph->DrawClone("pz same");
histos[i].overallGraph->SetLineStyle(i + 1);
Expand Down Expand Up @@ -1223,6 +1232,10 @@ void readTree(ModeType mode, TString variable, HistoType& histo, EopElecVariable
//
// -----------------------------------------------------------------------------
std::vector<Double_t> extractgausparams(TH1F* histo, TString option1, TString option2) {
if (histo->GetEntries() < 10) {
return {0., 0., 0., 0.};
}

// Fitting the histogram with a gaussian function
TF1* f1 = new TF1("f1", "gaus");
f1->SetRange(0., 2.);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
'/store/data/Run2022A/JetHT/ALCARECO/TkAlMinBias-PromptReco-v1/000/352/900/00000/96120499-f83f-4b90-a828-58d4c2d26350.root'
)

filesDefaultData_JetHTRun2018DHcalIsoTrk = cms.untracked.vstring(
'/store/data/Run2018D/JetHT/ALCARECO/HcalCalIsoTrkFilter-12Nov2019_UL2018-v3/100000/075A1F1E-20B4-134D-9794-AD764DA6730D.root')

filesDefaultMC_NoPU = cms.untracked.vstring(
'/store/mc/RunIIWinter19PFCalibDR/Single_Pion_gun_E_2to200_13TeV_pythia8/GEN-SIM-RECO/2018ConditionsNoPU_105X_upgrade2018_realistic_v4-v1/270000/2BCBEBAB-BA94-B74F-9BFA-04F849A32558.root'
)
Expand Down
2 changes: 1 addition & 1 deletion Alignment/OfflineValidation/test/eopElecTreeWriter_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

# initialize MessageLogger and output report
process.load("FWCore.MessageService.MessageLogger_cfi")
process.MessageLogger.cerr.FwkReport.reportEvery = 1000
process.MessageLogger.cerr.FwkReport.reportEvery = 100
process.MessageLogger.TrackRefitter=dict()
process.MessageLogger.EopElecTreeWriter=dict()

Expand Down
14 changes: 7 additions & 7 deletions Alignment/OfflineValidation/test/eopTreeWriter_cfg.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import FWCore.ParameterSet.Config as cms
import FWCore.ParameterSet.VarParsing as VarParsing
from Alignment.OfflineValidation.TkAlAllInOneTool.defaultInputFiles_cff import filesDefaultData_JetHTRun2022A
from Alignment.OfflineValidation.TkAlAllInOneTool.defaultInputFiles_cff import filesDefaultData_JetHTRun2018DHcalIsoTrk

options = VarParsing.VarParsing("analysis")

options.register ('GlobalTag',
'auto:run3_data',
'auto:run2_data',
VarParsing.VarParsing.multiplicity.singleton, # singleton or list
VarParsing.VarParsing.varType.string, # string, int, or float
"Global Tag to be used")
Expand All @@ -24,13 +24,13 @@
####################################################################
process.load("FWCore.MessageService.MessageLogger_cfi")
#process.MessageLogger.cerr.threshold = 'ERROR'
process.MessageLogger.cerr.FwkReport.reportEvery = 10
process.MessageLogger.cerr.FwkReport.reportEvery = 100
process.MessageLogger.TrackRefitter=dict()

process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(False) )

# define input files
process.source = cms.Source("PoolSource", fileNames = filesDefaultData_JetHTRun2022A)
process.source = cms.Source("PoolSource", fileNames = filesDefaultData_JetHTRun2018DHcalIsoTrk)

process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(options.maxEvents)
Expand Down Expand Up @@ -97,7 +97,7 @@
# configure alignment track selector
####################################################################
process.load("Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi")
process.AlignmentTrackSelector.src = cms.InputTag('ALCARECOTkAlMinBias') # 'TkAlIsoProd' # trackCollection' # 'ALCARECOTkAlZMuMu' # 'ALCARECOTkAlMinBias' # adjust to input file
process.AlignmentTrackSelector.src = cms.InputTag('TkAlIsoProdFilter') # 'TkAlIsoProd' # trackCollection' # 'ALCARECOTkAlZMuMu' # 'ALCARECOTkAlMinBias' # adjust to input file
process.AlignmentTrackSelector.ptMin = 1.
process.AlignmentTrackSelector.etaMin = -5.
process.AlignmentTrackSelector.etaMax = 5.
Expand All @@ -110,8 +110,8 @@
# configure track refitter
####################################################################
process.load("RecoTracker.MeasurementDet.MeasurementTrackerEventProducer_cfi")
process.MeasurementTrackerEvent.pixelClusterProducer = "ALCARECOTkAlMinBias"
process.MeasurementTrackerEvent.stripClusterProducer = "ALCARECOTkAlMinBias"
process.MeasurementTrackerEvent.pixelClusterProducer = "TkAlIsoProdFilter"
process.MeasurementTrackerEvent.stripClusterProducer = "TkAlIsoProdFilter"
#process.MeasurementTrackerEvent.inactivePixelDetectorLabels = cms.VInputTag([''])
#process.MeasurementTrackerEvent.inactiveStripDetectorLabels = cms.VInputTag([''])

Expand Down
8 changes: 6 additions & 2 deletions Alignment/OfflineValidation/test/testEoPPlotting.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
#include <iostream>
#include <sstream>
#include <TSystem.h>
#include "Alignment/OfflineValidation/macros/momentumBiasValidation.C"
#include "Alignment/OfflineValidation/macros/momentumElectronBiasValidation.C"

int main(int argc, char** argv) {
momentumBiasValidation("eta", "./", "test_EopTree.root=TestPion", true);
momentumElectronBiasValidation("eta", "./", "test_EopTreeElectron.root=TestEle", "gif", true);
//std::cout << "\n==== Executing pion analysis plotting \n" << std::endl;
//eop::momentumBiasValidation("eta", "./", "test_EopTree.root=TestPion");

std::cout << "\n==== Executing electron analysis plotting \n" << std::endl;
momentumElectronBiasValidation("eta", "./", "test_EopTreeElectron.root=TestEle", "png", true);
}
4 changes: 2 additions & 2 deletions Alignment/OfflineValidation/test/test_unitEoP.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#! /bin/bash
function die { echo $1: status $2 ; exit $2; }

echo "TESTING eopTreeWriter (Pion Analysis) ..."
echo -e "\n\nTESTING eopTreeWriter (Pion Analysis) ..."
cmsRun ${LOCAL_TEST_DIR}/eopTreeWriter_cfg.py unitTest=True maxEvents=100 || die "Failure running eopTreeWriter" $?

echo "TESTING eopElecTreeWriter (Electron Analysis) ..."
echo -e "\n\nTESTING eopElecTreeWriter (Electron Analysis) ..."
cmsRun ${LOCAL_TEST_DIR}/eopElecTreeWriter_cfg.py maxEvents=100 || die "Failure running eopElecTreeWriter" $?

0 comments on commit 7e15bdf

Please sign in to comment.