Skip to content

Commit

Permalink
[GenPartIsoProducer.cc] New plugin for gen-part isolation.
Browse files Browse the repository at this point in the history
  • Loading branch information
bonanomi committed Apr 4, 2024
1 parent 577ac03 commit ac7e7ca
Show file tree
Hide file tree
Showing 1,240 changed files with 198,311 additions and 154,343 deletions.
32 changes: 16 additions & 16 deletions Alignment/Geners/interface/IOTraits.hh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace gs {
template <class T>
struct IOTraits {
static const bool IsClass = IOIsClassType<T>::value;
enum { ISCLASS = 1 };
static constexpr int ISCLASS = 1;

// Pointers are not PODs for I/O purposes.
//
Expand All @@ -30,59 +30,59 @@ namespace gs {
// that we need to avoid.
static const bool IsPOD =
(IOIsPOD<T>::value && !IOIsContainer<T>::value && !CPP11_is_pointer<T>::value && !IOIsExternal<T>::value);
enum { ISPOD = 2 };
static constexpr int ISPOD = 2;

static const bool IsWritable = (IOIsWritable<T>::value && !IOIsExternal<T>::value);
enum { ISWRITABLE = 4 };
static constexpr int ISWRITABLE = 4;

static const bool IsStdContainer = (IOIsContainer<T>::value && !IOIsWritable<T>::value && !IOIsExternal<T>::value);
enum { ISSTDCONTAINER = 8 };
static constexpr int ISSTDCONTAINER = 8;

// Readable objects are required to be writable
static const bool IsPlaceReadable = (IOIsPlaceReadable<T>::value && IOIsWritable<T>::value);
enum { ISPLACEREADABLE = 16 };
static constexpr int ISPLACEREADABLE = 16;

// Prefer place readability to heap readability
static const bool IsHeapReadable =
(IOIsHeapReadable<T>::value && !IOIsPlaceReadable<T>::value && IOIsWritable<T>::value);
enum { ISHEAPREADABLE = 32 };
static constexpr int ISHEAPREADABLE = 32;

static const bool IsPointer = (CPP11_is_pointer<T>::value && !IOIsExternal<T>::value);
enum { ISPOINTER = 64 };
static constexpr int ISPOINTER = 64;

static const bool IsSharedPtr = (IOIsSharedPtr<T>::value && !IOIsExternal<T>::value);
enum { ISSHAREDPTR = 128 };
static constexpr int ISSHAREDPTR = 128;

static const bool IsPair = IOIsPair<T>::value;
enum { ISPAIR = 256 };
static constexpr int ISPAIR = 256;

static const bool IsString = IOIsString<T>::value;
enum { ISSTRING = 512 };
static constexpr int ISSTRING = 512;

// The following trait is relevant for containers only
static const bool IsContiguous = IOIsContiguous<T>::value;
enum { ISCONTIGUOUS = 1024 };
static constexpr int ISCONTIGUOUS = 1024;

static const bool IsTuple = IOIsTuple<T>::value;
enum { ISTUPLE = 2048 };
static constexpr int ISTUPLE = 2048;

static const bool IsIOPtr = IOIsIOPtr<T>::value;
enum { ISIOPTR = 4096 };
static constexpr int ISIOPTR = 4096;

// A catch-all definition for externally defined types which
// want to use the template-based I/O within this system but
// do not want to implement the standard "read/write" mechanism.
// The user has to declare the external type by modifying the
// "IOIsExternal" template.
static const bool IsExternal = IOIsExternal<T>::value;
enum { ISEXTERNAL = 8192 };
static constexpr int ISEXTERNAL = 8192;

// Special enums for heap-readable objects known
// to be called with zero pointer as an argument.
// In this case we will avoid compiling an assignment
// operator for the object.
enum { ISNULLPOINTER = 16384 };
enum { ISPUREHEAPREADABLE = 32768 };
static constexpr int ISNULLPOINTER = 16384;
static constexpr int ISPUREHEAPREADABLE = 32768;

static const int Signature = IsClass * ISCLASS + IsPOD * ISPOD + IsWritable * ISWRITABLE +
IsStdContainer * ISSTDCONTAINER + IsPlaceReadable * ISPLACEREADABLE +
Expand Down
1 change: 0 additions & 1 deletion Alignment/LaserAlignment/interface/LASModuleProfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class LASModuleProfile {
void SetValue(unsigned int theStripNumber, const double& theValue) { data.at(theStripNumber) = theValue; }
void SetAllValuesTo(const double&);
void DumpToArray(double[512]);
LASModuleProfile& operator=(const LASModuleProfile&);
LASModuleProfile operator+(const LASModuleProfile&);
LASModuleProfile operator-(const LASModuleProfile&);
LASModuleProfile operator+(const double[512]);
Expand Down
15 changes: 0 additions & 15 deletions Alignment/LaserAlignment/src/LASModuleProfile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,21 +100,6 @@ void LASModuleProfile::Init(void) {
data.resize(512);
}

LASModuleProfile& LASModuleProfile::operator=(const LASModuleProfile& anotherProfile) {
///
///
///

// check for self-assignment
if (this != &anotherProfile) {
for (unsigned int i = 0; i < 512; ++i) {
data.at(i) = anotherProfile.GetValue(i);
}
}

return *this;
}

LASModuleProfile LASModuleProfile::operator+(const LASModuleProfile& anotherProfile) {
///
///
Expand Down
1 change: 1 addition & 0 deletions Alignment/MillePedeAlignmentAlgorithm/test/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<test name="test-pede" command="pede -t">
<use name="millepede"/>
</test>
<test name="test_MilleZmm" command="test_mille.sh"/>
<test name="test_PedeCampaign" command="test_pede.sh"/>
<test name="test_PayloadSanity" command="test_payload_sanity.sh">
<flags PRE_TEST="test_PedeCampaign"/>
Expand Down
215 changes: 215 additions & 0 deletions Alignment/MillePedeAlignmentAlgorithm/test/test_mille.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
import FWCore.ParameterSet.Config as cms
import FWCore.ParameterSet.VarParsing as VarParsing

process = cms.Process("Alignment")

options = VarParsing.VarParsing()
options.register ('algoMode',
"mille", # default value
VarParsing.VarParsing.multiplicity.singleton,
VarParsing.VarParsing.varType.string,
"algo mode")

options.register ('useLapack',
False, # default value
VarParsing.VarParsing.multiplicity.singleton,
VarParsing.VarParsing.varType.bool,
"use lapack?")
options.parseArguments()

################################################################################
# Variables edited by mps_alisetup.py. Used in functions below.
# You can change them manually as well.
# ------------------------------------------------------------------------------
setupGlobaltag = "140X_dataRun3_ForTkAlReReco_v1"
setupCollection = "ALCARECOTkAlZMuMu"
setupCosmicsDecoMode = False
setupCosmicsZeroTesla = False
setupPrimaryWidth = -1.0
setupJson = ""
setupRunStartGeometry = 362350

################################################################################
# Variables edited by MPS (mps_setup and mps_merge). Be careful.
# ------------------------------------------------------------------------------
# Default is "mille". Gets changed to "pede" by mps_merge.
setupAlgoMode = options.algoMode

# MPS looks specifically for the string "101" so don't change this.
setupMonitorFile = "millePedeMonitor101.root"
setupBinaryFile = "milleBinary101.dat"

# Input files. Edited by mps_splice.py
readFiles = cms.untracked.vstring()
readFiles.extend([
'/store/data/Run2022G/Muon/ALCARECO/TkAlZMuMu-PromptReco-v1/000/362/362/00000/d6641b44-f4e4-4054-b5b0-f038e567c61e.root',
'/store/data/Run2022G/Muon/ALCARECO/TkAlZMuMu-PromptReco-v1/000/362/433/00000/1f93221e-23ce-4731-906a-48c9fe405515.root',
'/store/data/Run2022G/Muon/ALCARECO/TkAlZMuMu-PromptReco-v1/000/362/435/00000/df6e27d1-5367-4192-83ed-2be9303d7837.root',
'/store/data/Run2022G/Muon/ALCARECO/TkAlZMuMu-PromptReco-v1/000/362/437/00000/7ce5bac8-0b29-40f3-a63b-fd0813d5678d.root',
'/store/data/Run2022G/Muon/ALCARECO/TkAlZMuMu-PromptReco-v1/000/362/437/00000/ea6b065d-1912-491e-9cce-732eaf6fa038.root'])
################################################################################

################################################################################
# General setup
# ------------------------------------------------------------------------------
import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.GeneralSetup as generalSetup
generalSetup.setup(process, setupGlobaltag, setupCosmicsZeroTesla)

################################################################################
# setup alignment producer
# ------------------------------------------------------------------------------
import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.ConfigureAlignmentProducer as confAliProducer

confAliProducer.setConfiguration(process,
collection = setupCollection,
mode = setupAlgoMode,
monitorFile = setupMonitorFile,
binaryFile = setupBinaryFile,
primaryWidth = setupPrimaryWidth,
cosmicsZeroTesla = setupCosmicsZeroTesla)

################################################################################
# Overwrite some conditions in global tag
# ------------------------------------------------------------------------------
import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.SetCondition as tagwriter

#######################
## insert Alignables ##
#######################

# # to run a high-level alignment on real data (including TOB centering; use
# # pixel-barrel centering for MC) of the whole tracker you can use the
# # following configuration:
#
process.AlignmentProducer.ParameterBuilder.parameterTypes = [
"SelectorRigid,RigidBody",
#"SelectorBowed,BowedSurface",
#"SelectorTwoBowed,TwoBowedSurfaces",
]

# # Define the high-level structure alignables
process.AlignmentProducer.ParameterBuilder.SelectorRigid = cms.PSet(
alignParams = cms.vstring(
"TrackerP1PXBLadder,111111",
"TrackerP1PXECPanel,111111",
"TrackerTIBHalfBarrel,111111",
"TrackerTOBHalfBarrel,rrrrrr",
"TrackerTIDEndcap,111111",
"TrackerTECEndcap,111111",
)
)

process.AlignmentProducer.RunRangeSelection = [
cms.PSet(
RunRanges = cms.vstring(
"362350",
"362440",
"362446",
"362617",
"362632",
"362640",
"362641",
"362645",
"362663",
"362670",
"362679",
"362683",
"362697",
"362711",
"362744"
),
selector = cms.vstring(
"TrackerP1PXBLadder,111111",
"TrackerP1PXECPanel,111111"
)
),

cms.PSet(
RunRanges = cms.vstring(
"362350",
"362520"
),
selector = cms.vstring(
"TrackerTIBHalfBarrel,111111",
"TrackerTIDEndcap,111111",
"TrackerTECEndcap,111111"
)
)
] # end of process.AlignmentProducer.RunRangeSelection

#########################
## insert Pedesettings ##
#########################

# # reasonable pede settings are already defined in
# # 'confAliProducer.setConfiguration' above
# #

if(options.algoMode == "pede"):
if(options.useLapack):
# LAPACK
print("I am going to run fullLAPACK 3 0.8")
process.AlignmentProducer.algoConfig.pedeSteerer.method = "fullLAPACK 3 0.8"
process.AlignmentProducer.algoConfig.pedeSteerer.pedeCommand = "export OMP_STACKSIZE=20M; MKL_THREADING_LAYER=GNU; export OMP_NUM_THREADS=10; export MKL_NUM_THREADS=10; \
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/cvmfs/projects.cern.ch/intelsw/oneAPI/linux/x86_64/2022/mkl/2022.1.0/lib/intel64;"
else:
# MINRES
print("I am going to run sparseMINRES 6 0.8")
process.AlignmentProducer.algoConfig.pedeSteerer.method = "sparseMINRES 6 0.8"
process.AlignmentProducer.algoConfig.pedeSteerer.pedeCommand = "export OMP_STACKSIZE=20M; pede"
else:
pass

# # if you want to obtain alignment errors, use the following setting:
# #
# # a list of possible options is documented here:
# # http://www.desy.de/~kleinwrt/MP2/doc/html/option_page.html#sec-cmd
# #
# # if you need to request a larger stack size for individual threads when
# # running pede, you can do this with this setting:
# #
# # you can change or drop pede options as follows:
#
import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.helper as helper
helper.set_pede_option(process, "threads 10")
helper.set_pede_option(process, "entries 100 10 2")
helper.set_pede_option(process, "skipemptycons")
helper.set_pede_option(process, "countrecords")

#################
## add filters ##
#################

# # please add any EDFilter here that should run before processing the event,
# # e.g. add the following lines to ensure that only 3.8T events are selected
#
# import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.helper as helper
# process.load("Alignment.CommonAlignment.magneticFieldFilter_cfi")
# process.magneticFieldFilter.magneticField = 38 # in units of kGauss (=0.1T)
# helper.add_filter(process, process.magneticFieldFilter)

################################################################################
# Mille-procedure
# ------------------------------------------------------------------------------
if setupAlgoMode == "mille":
import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.MilleSetup as mille
mille.setup(process,
input_files = readFiles,
collection = setupCollection,
json_file = setupJson,
cosmics_zero_tesla = setupCosmicsZeroTesla,
cosmics_deco_mode = setupCosmicsDecoMode)

################################################################################
# Pede-procedure
# ------------------------------------------------------------------------------
else:
# placeholers get replaced by mps_merge.py, which is called in mps_setup.pl
merge_binary_files = ['placeholder_binaryList']
merge_tree_files = ['placeholder_treeList']

import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.PedeSetup as pede
pede.setup(process,
binary_files = merge_binary_files,
tree_files = merge_tree_files,
run_start_geometry = setupRunStartGeometry)
20 changes: 20 additions & 0 deletions Alignment/MillePedeAlignmentAlgorithm/test/test_mille.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
function die { echo $1: status $2; exit $2; }

# Check if doPede argument is provided and is true
if [[ "$1" == "--doPede" ]]; then
doPede=true
else
doPede=false
fi

echo -e "testing mille step ..."
(cmsRun ${SCRAM_TEST_PATH}/test_mille.py algoMode="mille") || die 'failed running test_mille.py (LAPACK)' $?

if [[ "$doPede" == "true" ]]; then
echo -e "\n\ntesting pede step with sparseMINRES ..."
(cmsRun ${SCRAM_TEST_PATH}/test_mille.py algoMode="pede" useLapack=False) || die 'failed running test_mille.py (MINRES)' $?

echo -e "\n\ntesting pedes step with LAPACK ..."
(cmsRun ${SCRAM_TEST_PATH}/test_mille.py algoMode="pede" useLapack=True) || die 'failed running test_mille.py (LAPACK)' $?
fi
2 changes: 1 addition & 1 deletion Alignment/OfflineValidation/bin/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<flags CXXFLAGS="-g -Wall -O3 -Wall -std=c++17 -lASImage -lMultiProc" />
<flags CXXFLAGS="-g -O3 -Wall -lASImage -lMultiProc" />
<use name="Alignment/OfflineValidation"/>
<use name="boost" />
<use name="boost_filesystem"/>
Expand Down
18 changes: 9 additions & 9 deletions Alignment/OfflineValidation/bin/DMRtrends.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,17 @@ int trends(int argc, char *argv[]) {

for (auto const &Variable : validation.get_child("Variables")) {
vector<tuple<TString, TString, float, float>> DMRs{{"mu", "#mu [#mum]", -6, 6},
{"sigma", "#sigma_{#mu} [#mum]", -15, 15},
{"sigma", "#sigma_{#mu} [#mum]", -5, 5},
{"muplus", "#mu outward [#mum]", -6, 6},
{"sigmaplus", "#sigma_{#mu outward} [#mum]", -15, 15},
{"sigmaplus", "#sigma_{#mu outward} [#mum]", -5, 5},
{"muminus", "#mu inward [#mum]", -6, 6},
{"sigmaminus", "#sigma_{#mu inward} [#mum]", -15, 15},
{"deltamu", "#Delta#mu [#mum]", -15, 15},
{"sigmadeltamu", "#sigma_{#Delta#mu} [#mum]", -15, 15},
{"musigma", "#mu [#mum]", -6, 6},
{"muplussigmaplus", "#mu outward [#mum]", -15, 15},
{"muminussigmaminus", "#mu inward [#mum]", -15, 15},
{"deltamusigmadeltamu", "#Delta#mu [#mum]", -15, 15}};
{"sigmaminus", "#sigma_{#mu inward} [#mum]", -5, 5},
{"deltamu", "#Delta#mu [#mum]", -5, 5},
{"sigmadeltamu", "#sigma_{#Delta#mu} [#mum]", -5, 5},
{"musigma", "#mu [#mum]", -2, 4},
{"muplussigmaplus", "#mu outward [#mum]", -5, 5},
{"muminussigmaminus", "#mu inward [#mum]", -5, 5},
{"deltamusigmadeltamu", "#Delta#mu [#mum]", -5, 10}};

if (Variable.second.get_value<string>() == "DrmsNR") {
DMRs = {{"mu", "RMS(x'_{pred}-x'_{hit} /#sigma)", -1.2, 1.2},
Expand Down
1 change: 1 addition & 0 deletions Alignment/OfflineValidation/bin/DiMuonVmerge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#include "TString.h"
#include "TASImage.h"
#include "TGraph.h"

#include "Alignment/OfflineValidation/macros/loopAndPlot.C"
#include "Alignment/OfflineValidation/interface/TkAlStyle.h"
Expand Down
Loading

0 comments on commit ac7e7ca

Please sign in to comment.