From 9fab79be1dd8dcbbad503b054cf881ee73285008 Mon Sep 17 00:00:00 2001 From: kkotov Date: Fri, 13 Oct 2017 11:29:11 +0200 Subject: [PATCH 001/426] adding a small README.md to the L1T O2O core framework --- CondTools/L1TriggerExt/README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 CondTools/L1TriggerExt/README.md diff --git a/CondTools/L1TriggerExt/README.md b/CondTools/L1TriggerExt/README.md new file mode 100644 index 0000000000000..8f2615bac5cf9 --- /dev/null +++ b/CondTools/L1TriggerExt/README.md @@ -0,0 +1,27 @@ +L1T O2O code organization +------------------------- + +This README briefly covers some "bolts and nuts" of the L1T O2O system. +For more general information on the system organization check [this link](https://github.com/kkotov/l1o2o). + +The L1T O2O system is partitioned into the core framework (this package) +and a set of system-specific [online producers](https://github.com/cms-sw/cmssw/blob/master/L1TriggerConfig/L1TConfigProducers) +invoked by means of [data writers](https://github.com/cms-sw/cmssw/blob/master/CondTools/L1TriggerExt/src/DataWriterExt.cc) +from the core framework and fetching the information from the online DB. The only component of the core framework that +explicitly queries online DB is +[L1SubsystemKeysOnlineProdExt](https://github.com/cms-sw/cmssw/blob/master/CondTools/L1TriggerExt/plugins/L1SubsystemKeysOnlineProdExt.cc) +generating a L1TriggerKeyExt object with TSC and RS keys for all of the systems. This object is distributed to +system-specific ObjectKey\_online\_producers that in turn generate system-specific L1TriggerKeyExt objects forwarded +to the payload online\_producers. The CondDB tag names are specified in +[this config](https://github.com/cms-sw/cmssw/blob/master/CondTools/L1TriggerExt/python/L1SubsystemParamsExt_cfi.py), +while the current set of versions (suffixes) is given +[here](https://github.com/cms-sw/cmssw/blob/master/CondTools/L1TriggerExt/python/L1O2OTagsExt_cfi.py). +The versions can also be overridden from the top-level scripts as described in the bottom of +[this slide](http://kkotov.github.io/l1o2o/talks/2017.03.01/#4). +The core framework's general design is outlined in [this talk](http://kkotov.github.io/l1o2o/talks/2016.04.19). + +Currently, the RS specific code is still available in the core framework, +but is not used or intended to be used. So if you browse the code, you can +ignore files containing the RS in the name. Same applies to all but +[runL1-O2O-iov.sh](https://github.com/cms-sw/cmssw/blob/master/CondTools/L1TriggerExt/scripts/runL1-O2O-iov.sh) +scripts. From 86d2b0515de26a0ed074f46182ff776cbf07680a Mon Sep 17 00:00:00 2001 From: kkotov Date: Fri, 13 Oct 2017 11:33:46 +0200 Subject: [PATCH 002/426] Updating current tag versions --- CondTools/L1TriggerExt/python/L1O2OTagsExt_cfi.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CondTools/L1TriggerExt/python/L1O2OTagsExt_cfi.py b/CondTools/L1TriggerExt/python/L1O2OTagsExt_cfi.py index eef94292a8660..fc0b89265351e 100644 --- a/CondTools/L1TriggerExt/python/L1O2OTagsExt_cfi.py +++ b/CondTools/L1TriggerExt/python/L1O2OTagsExt_cfi.py @@ -10,12 +10,12 @@ def initL1O2OTagsExt(): initL1O2OTagsExt.tagBaseVec[ L1CondEnumExt.L1TUtmTriggerMenu ] = "Stage2v0_hlt" initL1O2OTagsExt.tagBaseVec[ L1CondEnumExt.L1TGlobalPrescalesVetos ] = "Stage2v0_hlt" - initL1O2OTagsExt.tagBaseVec[ L1CondEnumExt.L1TMuonBarrelParams ] = "Stage2v0_hlt" + initL1O2OTagsExt.tagBaseVec[ L1CondEnumExt.L1TMuonBarrelParams ] = "Stage2v1_hlt" initL1O2OTagsExt.tagBaseVec[ L1CondEnumExt.L1TMuonOverlapParams ] = "Stage2v0_hlt" - initL1O2OTagsExt.tagBaseVec[ L1CondEnumExt.L1TMuonEndCapParams ] = "Stage2v0_hlt" - initL1O2OTagsExt.tagBaseVec[ L1CondEnumExt.L1TMuonEndCapForest ] = "Stage2v0_hlt" + initL1O2OTagsExt.tagBaseVec[ L1CondEnumExt.L1TMuonEndCapParams ] = "Stage2v1_hlt" + initL1O2OTagsExt.tagBaseVec[ L1CondEnumExt.L1TMuonEndCapForest ] = "Stage2v1_hlt" initL1O2OTagsExt.tagBaseVec[ L1CondEnumExt.L1TMuonGlobalParams ] = "Stage2v0_hlt" - initL1O2OTagsExt.tagBaseVec[ L1CondEnumExt.L1TCaloParams ] = "Stage2v0_hlt" + initL1O2OTagsExt.tagBaseVec[ L1CondEnumExt.L1TCaloParams ] = "Stage2v3_hlt" # for i in range( 0, L1CondEnumExt.NumL1Cond ): # print i, initL1O2OTagsExt.tagBaseVec[ i ] From cd577cb302b43d626a4c77e14f8c04929662a95a Mon Sep 17 00:00:00 2001 From: kkotov Date: Fri, 13 Oct 2017 11:51:25 +0200 Subject: [PATCH 003/426] Cleaning legacy rudiments --- .../test/L1ConfigWriteSinglePayloadExt_cfg.py | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/CondTools/L1TriggerExt/test/L1ConfigWriteSinglePayloadExt_cfg.py b/CondTools/L1TriggerExt/test/L1ConfigWriteSinglePayloadExt_cfg.py index bf9313d94eb4c..c416e2adce5b3 100644 --- a/CondTools/L1TriggerExt/test/L1ConfigWriteSinglePayloadExt_cfg.py +++ b/CondTools/L1TriggerExt/test/L1ConfigWriteSinglePayloadExt_cfg.py @@ -55,11 +55,6 @@ VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.int, "Overwrite existing key") -options.register('startup', - 0, #default value - VarParsing.VarParsing.multiplicity.singleton, - VarParsing.VarParsing.varType.int, - "Use L1StartupConfig_cff instead of L1DummyConfig_cff") options.parseArguments() @@ -101,14 +96,8 @@ if options.genFromOMDS == 0: # Generate dummy configuration data process.load('L1TriggerConfig.L1TConfigProducers.L1TMuonOverlapParamsOnlineProxy_cfi') - process.load('L1TriggerConfig.L1TConfigProducers.L1TMuonEndCapParamsOnlineProxy_cfi') +# process.load('L1TriggerConfig.L1TConfigProducers.L1TMuonEndCapParamsOnlineProxy_cfi') process.load('L1TriggerConfig.L1TConfigProducers.L1TMuonEndCapForestOnlineProxy_cfi') -# if options.startup == 0: -# process.load("L1Trigger.Configuration.L1DummyConfig_cff") -# process.load("L1TriggerConfig.L1GtConfigProducers.Luminosity.lumi1031.L1Menu_MC2009_v2_L1T_Scales_20090624_Imp0_Unprescaled_cff") -# else: -# process.load("L1Trigger.Configuration.L1StartupConfig_cff") -# process.load("L1TriggerConfig.L1GtConfigProducers.Luminosity.startup.L1Menu_Commissioning2009_v3_L1T_Scales_20080926_startup_Imp0_Unprescaled_cff") else: # Generate configuration data from OMDS From 1c7822de48682122e8d4a6468b0ae1e88dde79ef Mon Sep 17 00:00:00 2001 From: kkotov Date: Fri, 13 Oct 2017 12:10:39 +0200 Subject: [PATCH 004/426] Implementing a central teams request to be able to proceed with DB commit even in case of errors (a trick of last resort not to be ran by default) --- .../python/L1ConfigTSCKeysExt_cff.py | 24 ++++++++++++++++--- .../python/L1ConfigTSCPayloadsExt_cff.py | 21 ++++++++++++++++ .../L1TriggerExt/scripts/runL1-O2O-iov.sh | 15 ++++++++---- .../test/L1ConfigWritePayloadOnlineExt_cfg.py | 20 +++++++--------- 4 files changed, 61 insertions(+), 19 deletions(-) diff --git a/CondTools/L1TriggerExt/python/L1ConfigTSCKeysExt_cff.py b/CondTools/L1TriggerExt/python/L1ConfigTSCKeysExt_cff.py index 33f98490d37b6..43e4e1c45ba51 100644 --- a/CondTools/L1TriggerExt/python/L1ConfigTSCKeysExt_cff.py +++ b/CondTools/L1TriggerExt/python/L1ConfigTSCKeysExt_cff.py @@ -2,7 +2,7 @@ from L1TriggerConfig.L1TConfigProducers.L1TMuonBarrelObjectKeysOnline_cfi import * from L1TriggerConfig.L1TConfigProducers.L1TMuonGlobalObjectKeysOnline_cfi import * from L1TriggerConfig.L1TConfigProducers.L1TMuonOverlapObjectKeysOnline_cfi import * -from L1TriggerConfig.L1TConfigProducers.L1TMuonEndcapObjectKeysOnline_cfi import * +from L1TriggerConfig.L1TConfigProducers.L1TMuonEndCapObjectKeysOnline_cfi import * from L1TriggerConfig.L1TConfigProducers.L1TCaloParamsObjectKeysOnline_cfi import * from L1TriggerConfig.L1TConfigProducers.L1TGlobalPrescalesVetosObjectKeysOnline_cfi import * @@ -11,7 +11,7 @@ def setTSCKeysDB(process, DBConnect, DBAuth): process.L1TCaloParamsObjectKeysOnline.onlineDB = cms.string( DBConnect ) process.L1TGlobalPrescalesVetosObjectKeysOnline.onlineDB = cms.string( DBConnect ) process.L1TMuonBarrelObjectKeysOnline.onlineDB = cms.string( DBConnect ) - process.L1TMuonEndcapObjectKeysOnline.onlineDB = cms.string( DBConnect ) + process.L1TMuonEndCapObjectKeysOnline.onlineDB = cms.string( DBConnect ) process.L1TMuonGlobalObjectKeysOnline.onlineDB = cms.string( DBConnect ) process.L1TMuonOverlapObjectKeysOnline.onlineDB = cms.string( DBConnect ) process.L1TUtmTriggerMenuObjectKeysOnline.onlineDB = cms.string( DBConnect ) @@ -19,9 +19,27 @@ def setTSCKeysDB(process, DBConnect, DBAuth): process.L1TCaloParamsObjectKeysOnline.onlineAuthentication = cms.string( DBAuth ) process.L1TGlobalPrescalesVetosObjectKeysOnline.onlineAuthentication = cms.string( DBAuth ) process.L1TMuonBarrelObjectKeysOnline.onlineAuthentication = cms.string( DBAuth ) - process.L1TMuonEndcapObjectKeysOnline.onlineAuthentication = cms.string( DBAuth ) + process.L1TMuonEndCapObjectKeysOnline.onlineAuthentication = cms.string( DBAuth ) process.L1TMuonGlobalObjectKeysOnline.onlineAuthentication = cms.string( DBAuth ) process.L1TMuonOverlapObjectKeysOnline.onlineAuthentication = cms.string( DBAuth ) process.L1TUtmTriggerMenuObjectKeysOnline.onlineAuthentication = cms.string( DBAuth ) +def liftKeySafetyFor(process, systems): + if 'CALO' in systems: + process.L1TCaloParamsObjectKeysOnline.transactionSafe = cms.bool(False) + + if 'uGTrs' in systems: + process.L1TGlobalPrescalesVetosObjectKeysOnline.transactionSafe = cms.bool(False) + + if 'BMTF' in systems: + process.L1TMuonBarrelObjectKeysOnline.transactionSafe = cms.bool(False) + + if 'EMTF' in systems: + process.L1TMuonEndCapObjectKeysOnline.transactionSafe = cms.bool(False) + + if 'uGMT' in systems: + process.L1TMuonGlobalObjectKeysOnline.transactionSafe = cms.bool(False) + + if 'OMTF' in systems: + process.L1TMuonOverlapObjectKeysOnline.transactionSafe = cms.bool(False) diff --git a/CondTools/L1TriggerExt/python/L1ConfigTSCPayloadsExt_cff.py b/CondTools/L1TriggerExt/python/L1ConfigTSCPayloadsExt_cff.py index 6801b1010aade..28a156e988286 100644 --- a/CondTools/L1TriggerExt/python/L1ConfigTSCPayloadsExt_cff.py +++ b/CondTools/L1TriggerExt/python/L1ConfigTSCPayloadsExt_cff.py @@ -35,3 +35,24 @@ def setTSCPayloadsDB(process, DBConnect, DBAuth, protoDBConnect, protoDBAuth): process.l1bmtfparProtodb.DBParameters.authenticationPath = cms.untracked.string( protoDBAuth ) process.l1emtfparProtodb.DBParameters.authenticationPath = cms.untracked.string( protoDBAuth ) process.l1gmtparProtodb.DBParameters.authenticationPath = cms.untracked.string( protoDBAuth ) + +def liftPayloadSafetyFor(process, systems): + if 'CALO' in systems: + process.L1TCaloParamsOnlineProd.transactionSafe = cms.bool(False) + + if 'uGTrs' in systems: + process.L1TGlobalPrescalesVetosOnlineProd.transactionSafe = cms.bool(False) + + if 'BMTF' in systems: + process.L1TMuonBarrelParamsOnlineProd.transactionSafe = cms.bool(False) + + if 'EMTF' in systems: + process.L1TMuonEndCapParamsOnlineProd.transactionSafe = cms.bool(False) + process.L1TMuonEndCapForestOnlineProd.transactionSafe = cms.bool(False) + + if 'uGMT' in systems: + process.L1TMuonGlobalParamsOnlineProd.transactionSafe = cms.bool(False) + + if 'OMTF' in systems: + process.L1TMuonOverlapParamsOnlineProd.transactionSafe = cms.bool(False) + diff --git a/CondTools/L1TriggerExt/scripts/runL1-O2O-iov.sh b/CondTools/L1TriggerExt/scripts/runL1-O2O-iov.sh index de13a5f92052b..eb2a8330cf82f 100755 --- a/CondTools/L1TriggerExt/scripts/runL1-O2O-iov.sh +++ b/CondTools/L1TriggerExt/scripts/runL1-O2O-iov.sh @@ -4,8 +4,9 @@ xflag=0 CMS_OPTIONS="" KEY_CONTENT="" TAG_UPDATE="" +UNSAFE="" -while getopts 'xfk:t:h' OPTION +while getopts 'xfk:t:s:h' OPTION do case $OPTION in x) xflag=1 @@ -17,11 +18,15 @@ while getopts 'xfk:t:h' OPTION t) if [ -z $TAG_UPDATE ] ; then TAG_UPDATE="tagUpdate="; else TAG_UPDATE=$TAG_UPDATE","; fi TAG_UPDATE=$TAG_UPDATE$OPTARG ;; + s) if [ -z $UNSAFE ] ; then UNSAFE="unsafe="; else UNSAFE=$UNSAFE","; fi + UNSAFE=$UNSAFE$OPTARG + ;; h) echo "Usage: [-xf] runnum tsckey" echo " -x: write to ORCON instead of sqlite file" echo " -f: force IOV update" echo " -k: limit update to the specific systems (default are all, which is equivalent to -k uGT,uGTrs,GMT,EMTF,OMTF,BMTF,CALO)" echo " -t: override tag name as TYPE:NEW_TAG_BASE (e.g. -t L1TCaloParams:Stage2v1)" + echo " -s: lift transaction safety: carry on even problems are encountered (e.g. -s EMTF,OMTF,CALO)" exit ;; esac @@ -32,11 +37,11 @@ runnum=$1 tsckey=$2 rskey=$3 +export TNS_ADMIN=/opt/offline/slc6_amd64_gcc493/cms/oracle-env/29/etc/ + echo "INFO: ADDITIONAL CMS OPTIONS: " $CMS_OPTIONS $KEY_CONTENT $TAG_UPDATE -#ONLINEDB_OPTIONS="onlineDBConnect=oracle://cms_omds_adg/CMS_TRG_R onlineDBAuth=./" -#ONLINEDB_OPTIONS="onlineDBConnect=oracle://int2r_lb/CMS_TRG_R onlineDBAuth=./" -ONLINEDB_OPTIONS="onlineDBConnect=oracle://cms_orcoff_prep/CMS_TRG_R onlineDBAuth=./" +ONLINEDB_OPTIONS="onlineDBConnect=oracle://cms_omds_adg/CMS_TRG_R onlineDBAuth=./" PROTODB_OPTIONS="protoDBConnect=oracle://cms_orcon_adg/CMS_CONDITIONS protoDBAuth=./" #ONLINEDB_OPTIONS="onlineDBConnect=oracle://cms_omds_lb/CMS_TRG_R onlineDBAuth=/data/O2O/L1T/" #PROTODB_OPTIONS="protoDBConnect=oracle://cms_orcon_prod/CMS_CONDITIONS protoDBAuth=/data/O2O/L1T/" @@ -65,7 +70,7 @@ fi if cmsRun ${CMSSW_RELEASE_BASE}/src/CondTools/L1TriggerExt/test/l1o2otestanalyzer_cfg.py ${INDB_OPTIONS} printL1TriggerKeyListExt=1 | grep "${tsckey}:${rskey}" ; then echo "TSC payloads present" else echo "TSC payloads absent; writing $KEY_CONTENT now" - cmsRun ${CMSSW_RELEASE_BASE}/src/CondTools/L1TriggerExt/test/L1ConfigWritePayloadOnlineExt_cfg.py tscKey=${tsckey} rsKey=${rskey} ${ONLINEDB_OPTIONS} ${PROTODB_OPTIONS} ${OUTDB_OPTIONS} ${COPY_OPTIONS} ${KEY_CONTENT} ${TAG_UPDATE} logTransactions=0 print + cmsRun ${CMSSW_RELEASE_BASE}/src/CondTools/L1TriggerExt/test/L1ConfigWritePayloadOnlineExt_cfg.py tscKey=${tsckey} rsKey=${rskey} ${ONLINEDB_OPTIONS} ${PROTODB_OPTIONS} ${OUTDB_OPTIONS} ${COPY_OPTIONS} ${KEY_CONTENT} ${TAG_UPDATE} ${UNSAFE} logTransactions=0 print o2ocode=$? if [ ${o2ocode} -ne 0 ] then diff --git a/CondTools/L1TriggerExt/test/L1ConfigWritePayloadOnlineExt_cfg.py b/CondTools/L1TriggerExt/test/L1ConfigWritePayloadOnlineExt_cfg.py index 25070b5b5ea87..400d951e16ea3 100644 --- a/CondTools/L1TriggerExt/test/L1ConfigWritePayloadOnlineExt_cfg.py +++ b/CondTools/L1TriggerExt/test/L1ConfigWritePayloadOnlineExt_cfg.py @@ -84,6 +84,11 @@ VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, "Comma-separated list of column-separated pairs relating type to a new tagBase") +options.register('unsafe', + '', #default value + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string, + "Comma-separated list of systems that we do not care about anymore") options.parseArguments() @@ -95,25 +100,18 @@ process.L1SubsystemKeysOnlineExt.onlineAuthentication = cms.string( options.onlineDBAuth ) process.load("CondTools.L1TriggerExt.L1ConfigTSCKeysExt_cff") -from CondTools.L1TriggerExt.L1ConfigTSCKeysExt_cff import setTSCKeysDB +from CondTools.L1TriggerExt.L1ConfigTSCKeysExt_cff import setTSCKeysDB, liftKeySafetyFor setTSCKeysDB( process, options.onlineDBConnect, options.onlineDBAuth ) +liftKeySafetyFor( process, options.unsafe.split(',') ) process.load("CondTools.L1TriggerExt.L1TriggerKeyOnlineExt_cfi") -#process.L1TriggerKeyOnlineExt.subsystemLabels = cms.vstring( -# 'uGT', -# 'uGTrs', -# 'uGMT', -# 'CALO', -# 'BMTF', -# 'OMTF', -# 'EMTF' -# ) process.L1TriggerKeyOnlineExt.subsystemLabels = cms.vstring( options.subsystemLabels.split(',') ) # Generate configuration data from OMDS process.load("CondTools.L1TriggerExt.L1ConfigTSCPayloadsExt_cff") -from CondTools.L1TriggerExt.L1ConfigTSCPayloadsExt_cff import setTSCPayloadsDB +from CondTools.L1TriggerExt.L1ConfigTSCPayloadsExt_cff import setTSCPayloadsDB, liftPayloadSafetyFor setTSCPayloadsDB( process, options.onlineDBConnect, options.onlineDBAuth, options.protoDBConnect, options.protoDBAuth ) +liftPayloadSafetyFor( process, options.unsafe.split(',') ) # Define CondDB tags from CondTools.L1TriggerExt.L1CondEnumExt_cfi import L1CondEnumExt From 8ffa49712cb3cd00b94cd834779beb48e420b594 Mon Sep 17 00:00:00 2001 From: kkotov Date: Fri, 13 Oct 2017 12:15:34 +0200 Subject: [PATCH 005/426] Changing Endcap to EndCap (as it was really two words) to make some other developers happy --- ...e_cfi.py => L1TMuonEndCapObjectKeysOnline_cfi.py} | 2 +- ...eProd.cc => L1TMuonEndCapObjectKeysOnlineProd.cc} | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) rename L1TriggerConfig/L1TConfigProducers/python/{L1TMuonEndcapObjectKeysOnline_cfi.py => L1TMuonEndCapObjectKeysOnline_cfi.py} (76%) rename L1TriggerConfig/L1TConfigProducers/src/{L1TMuonEndcapObjectKeysOnlineProd.cc => L1TMuonEndCapObjectKeysOnlineProd.cc} (88%) diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndcapObjectKeysOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapObjectKeysOnline_cfi.py similarity index 76% rename from L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndcapObjectKeysOnline_cfi.py rename to L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapObjectKeysOnline_cfi.py index 69f59c95d371f..06318016d6c1e 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndcapObjectKeysOnline_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapObjectKeysOnline_cfi.py @@ -1,6 +1,6 @@ import FWCore.ParameterSet.Config as cms -L1TMuonEndcapObjectKeysOnline = cms.ESProducer("L1TMuonEndcapObjectKeysOnlineProd", +L1TMuonEndCapObjectKeysOnline = cms.ESProducer("L1TMuonEndCapObjectKeysOnlineProd", onlineAuthentication = cms.string('.'), subsystemLabel = cms.string('EMTF'), onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R') diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndcapObjectKeysOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapObjectKeysOnlineProd.cc similarity index 88% rename from L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndcapObjectKeysOnlineProd.cc rename to L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapObjectKeysOnlineProd.cc index 3b2f8c2833d6e..d8343044e6a7f 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndcapObjectKeysOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapObjectKeysOnlineProd.cc @@ -5,22 +5,22 @@ #include "L1Trigger/L1TCommon/interface/XmlConfigParser.h" #include "OnlineDBqueryHelper.h" -class L1TMuonEndcapObjectKeysOnlineProd : public L1ObjectKeysOnlineProdBaseExt { +class L1TMuonEndCapObjectKeysOnlineProd : public L1ObjectKeysOnlineProdBaseExt { private: public: void fillObjectKeys( ReturnType pL1TriggerKey ) override ; - L1TMuonEndcapObjectKeysOnlineProd(const edm::ParameterSet&); - ~L1TMuonEndcapObjectKeysOnlineProd(void) override{} + L1TMuonEndCapObjectKeysOnlineProd(const edm::ParameterSet&); + ~L1TMuonEndCapObjectKeysOnlineProd(void) override{} }; -L1TMuonEndcapObjectKeysOnlineProd::L1TMuonEndcapObjectKeysOnlineProd(const edm::ParameterSet& iConfig) +L1TMuonEndCapObjectKeysOnlineProd::L1TMuonEndCapObjectKeysOnlineProd(const edm::ParameterSet& iConfig) : L1ObjectKeysOnlineProdBaseExt( iConfig ){ } -void L1TMuonEndcapObjectKeysOnlineProd::fillObjectKeys( ReturnType pL1TriggerKey ){ +void L1TMuonEndCapObjectKeysOnlineProd::fillObjectKeys( ReturnType pL1TriggerKey ){ std::string EMTFKey = pL1TriggerKey->subsystemKey( L1TriggerKeyExt::kEMTF ) ; @@ -88,4 +88,4 @@ void L1TMuonEndcapObjectKeysOnlineProd::fillObjectKeys( ReturnType pL1TriggerKey //define this as a plug-in -DEFINE_FWK_EVENTSETUP_MODULE(L1TMuonEndcapObjectKeysOnlineProd); +DEFINE_FWK_EVENTSETUP_MODULE(L1TMuonEndCapObjectKeysOnlineProd); From efcf3990b3571ca866d776ba01bc01276e19abcf Mon Sep 17 00:00:00 2001 From: kkotov Date: Fri, 13 Oct 2017 12:57:46 +0200 Subject: [PATCH 006/426] Adding a transactionSafe parameter to the configs --- .../test/L1ConfigWriteSinglePayloadExt_cfg.py | 1 - .../L1TCaloParamsObjectKeysOnline_cfi.py | 5 ++- .../python/L1TCaloParamsOnline_cfi.py | 9 ++-- ...lobalPrescalesVetosObjectKeysOnline_cfi.py | 5 ++- .../L1TGlobalPrescalesVetosOnline_cfi.py | 7 +-- .../L1TMuonBarrelObjectKeysOnline_cfi.py | 5 ++- .../python/L1TMuonBarrelParamsOnline_cfi.py | 9 ++-- .../L1TMuonEndCapForestOnlineProxy_cfi.py | 15 ++++++- .../python/L1TMuonEndCapForestOnline_cfi.py | 1 + .../L1TMuonEndCapObjectKeysOnline_cfi.py | 5 ++- .../L1TMuonEndCapParamsOnlineProxy_cfi.py | 9 ---- .../python/L1TMuonEndCapParamsOnline_cfi.py | 9 ++-- .../L1TMuonGlobalObjectKeysOnline_cfi.py | 5 ++- .../python/L1TMuonGlobalParamsOnline_cfi.py | 9 ++-- .../L1TMuonOverlapObjectKeysOnline_cfi.py | 5 ++- .../python/L1TMuonOverlapParamsOnline_cfi.py | 5 ++- .../L1TUtmTriggerMenuObjectKeysOnline_cfi.py | 5 ++- .../python/L1TUtmTriggerMenuOnline_cfi.py | 5 ++- .../src/L1TMuonEndCapParamsOnlineProxy.cc | 45 ------------------- 19 files changed, 66 insertions(+), 93 deletions(-) delete mode 100644 L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapParamsOnlineProxy_cfi.py delete mode 100644 L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapParamsOnlineProxy.cc diff --git a/CondTools/L1TriggerExt/test/L1ConfigWriteSinglePayloadExt_cfg.py b/CondTools/L1TriggerExt/test/L1ConfigWriteSinglePayloadExt_cfg.py index c416e2adce5b3..10baf80a7599a 100644 --- a/CondTools/L1TriggerExt/test/L1ConfigWriteSinglePayloadExt_cfg.py +++ b/CondTools/L1TriggerExt/test/L1ConfigWriteSinglePayloadExt_cfg.py @@ -96,7 +96,6 @@ if options.genFromOMDS == 0: # Generate dummy configuration data process.load('L1TriggerConfig.L1TConfigProducers.L1TMuonOverlapParamsOnlineProxy_cfi') -# process.load('L1TriggerConfig.L1TConfigProducers.L1TMuonEndCapParamsOnlineProxy_cfi') process.load('L1TriggerConfig.L1TConfigProducers.L1TMuonEndCapForestOnlineProxy_cfi') else: diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TCaloParamsObjectKeysOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TCaloParamsObjectKeysOnline_cfi.py index c8f46c0362d71..9c7c73bb96797 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TCaloParamsObjectKeysOnline_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TCaloParamsObjectKeysOnline_cfi.py @@ -2,7 +2,8 @@ L1TCaloParamsObjectKeysOnline = cms.ESProducer("L1TCaloParamsObjectKeysOnlineProd", onlineAuthentication = cms.string('.'), - subsystemLabel = cms.string('CALO'), - onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R') + subsystemLabel = cms.string('CALO'), + onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'), + transactionSafe = cms.bool(True) # any value has no effect on this particular producer ) diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TCaloParamsOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TCaloParamsOnline_cfi.py index e65a52e1775e4..cf28a10c10586 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TCaloParamsOnline_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TCaloParamsOnline_cfi.py @@ -7,7 +7,7 @@ l1caloparProtodb = cms.ESSource("PoolDBESSource", CondDB, - toGet = cms.VPSet( + toGet = cms.VPSet( cms.PSet( record = cms.string('L1TCaloParamsRcd'), tag = cms.string("L1TCaloParamsPrototype_Stage2v0_hlt") @@ -17,8 +17,9 @@ L1TCaloParamsOnlineProd = cms.ESProducer("L1TCaloParamsOnlineProd", onlineAuthentication = cms.string('.'), - forceGeneration = cms.bool(False), - onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'), - exclusiveLayer = cms.uint32(0) + forceGeneration = cms.bool(False), + onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'), + exclusiveLayer = cms.uint32(0), # process both layers by default + transactionSafe = cms.bool(True) # nothrow guarantee if set to False: carry on no matter what ) diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TGlobalPrescalesVetosObjectKeysOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TGlobalPrescalesVetosObjectKeysOnline_cfi.py index 8bfa5b5cee4be..8062a0bde84da 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TGlobalPrescalesVetosObjectKeysOnline_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TGlobalPrescalesVetosObjectKeysOnline_cfi.py @@ -2,7 +2,8 @@ L1TGlobalPrescalesVetosObjectKeysOnline = cms.ESProducer("L1TGlobalPrescalesVetosObjectKeysOnlineProd", onlineAuthentication = cms.string('.'), - subsystemLabel = cms.string('uGTrs'), - onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R') + subsystemLabel = cms.string('uGTrs'), + onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'), + transactionSafe = cms.bool(True) # any value has no effect on this particular producer ) diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TGlobalPrescalesVetosOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TGlobalPrescalesVetosOnline_cfi.py index f04d66219b749..1a27a0d2916a5 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TGlobalPrescalesVetosOnline_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TGlobalPrescalesVetosOnline_cfi.py @@ -4,7 +4,8 @@ L1TGlobalPrescalesVetosOnlineProd = cms.ESProducer("L1TGlobalPrescalesVetosOnlineProd", onlineAuthentication = cms.string('.'), - forceGeneration = cms.bool(False), - onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'), - xmlModel = cms.int32(2017) + forceGeneration = cms.bool(False), + onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'), + transactionSafe = cms.bool(True), # nothrow guarantee if set to False: carry on no matter what + xmlModel = cms.int32(2017) # can be set to 2016 for backward compatibility ) diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonBarrelObjectKeysOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonBarrelObjectKeysOnline_cfi.py index 311903d477102..0490d17698061 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonBarrelObjectKeysOnline_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonBarrelObjectKeysOnline_cfi.py @@ -2,6 +2,7 @@ L1TMuonBarrelObjectKeysOnline = cms.ESProducer("L1TMuonBarrelObjectKeysOnlineProd", onlineAuthentication = cms.string('.'), - subsystemLabel = cms.string('BMTF'), - onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R') + subsystemLabel = cms.string('BMTF'), + onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'), + transactionSafe = cms.bool(True) # any value has no effect on this particular producer ) diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonBarrelParamsOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonBarrelParamsOnline_cfi.py index 482513400d504..40cba5ceda053 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonBarrelParamsOnline_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonBarrelParamsOnline_cfi.py @@ -7,16 +7,17 @@ l1bmtfparProtodb = cms.ESSource("PoolDBESSource", CondDB, - toGet = cms.VPSet( + toGet = cms.VPSet( cms.PSet( record = cms.string('L1TMuonBarrelParamsRcd'), - tag = cms.string("L1TMuonBarrelParamsPrototype_Stage2v0_hlt") + tag = cms.string("L1TMuonBarrelParamsPrototype_Stage2v0_hlt") ) ) ) L1TMuonBarrelParamsOnlineProd = cms.ESProducer("L1TMuonBarrelParamsOnlineProd", onlineAuthentication = cms.string('.'), - forceGeneration = cms.bool(False), - onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R') + forceGeneration = cms.bool(False), + onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'), + transactionSafe = cms.bool(True) # nothrow guarantee if set to False: carry on no matter what ) diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapForestOnlineProxy_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapForestOnlineProxy_cfi.py index c89ef79d56005..d26aff68cca30 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapForestOnlineProxy_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapForestOnlineProxy_cfi.py @@ -1,5 +1,18 @@ import FWCore.ParameterSet.Config as cms -from L1Trigger.L1TMuonEndCap.fakeEmtfParams_cff import * +#from L1Trigger.L1TMuonEndCap.fakeEmtfParams_cff import * + +from CondCore.CondDB.CondDB_cfi import CondDB +CondDB.connect = cms.string('oracle://cms_orcon_prod/CMS_CONDITIONS') + +l1emtfForestProtodb = cms.ESSource("PoolDBESSource", + CondDB, + toGet = cms.VPSet( + cms.PSet( + record = cms.string('L1TMuonEndCapForestRcd'), + tag = cms.string('L1TMuonEndCapForest_static_Sq_20170613_v7_mc') + ) + ) +) L1TMuonEndCapForestOnlineProxy = cms.ESProducer("L1TMuonEndCapForestOnlineProxy") diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapForestOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapForestOnline_cfi.py index 1cfec9e2c201f..ef6ab79d49259 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapForestOnline_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapForestOnline_cfi.py @@ -6,4 +6,5 @@ onlineAuthentication = cms.string('.'), forceGeneration = cms.bool(False), onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R') + transactionSafe = cms.bool(True) # any value has no effect on this particular producer ) diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapObjectKeysOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapObjectKeysOnline_cfi.py index 06318016d6c1e..60665869c15c3 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapObjectKeysOnline_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapObjectKeysOnline_cfi.py @@ -2,6 +2,7 @@ L1TMuonEndCapObjectKeysOnline = cms.ESProducer("L1TMuonEndCapObjectKeysOnlineProd", onlineAuthentication = cms.string('.'), - subsystemLabel = cms.string('EMTF'), - onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R') + subsystemLabel = cms.string('EMTF'), + onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'), + transactionSafe = cms.bool(True) # nothrow guarantee if set to False: carry on no matter what ) diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapParamsOnlineProxy_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapParamsOnlineProxy_cfi.py deleted file mode 100644 index f8cbe5669ea84..0000000000000 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapParamsOnlineProxy_cfi.py +++ /dev/null @@ -1,9 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -#from L1Trigger.L1TMuonEndcap.fakeEmtfParams_cff import * - -L1TMuonEndCapParamsOnlineProxy = cms.ESProducer("L1TMuonEndCapParamsOnlineProxy", - PtAssignVersion = cms.untracked.uint32(1), - firmwareVersion = cms.untracked.uint32(47423), - changeDate = cms.untracked.uint32(20161101) -) diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapParamsOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapParamsOnline_cfi.py index 530ea4ec8a507..2fd81b7509384 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapParamsOnline_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapParamsOnline_cfi.py @@ -7,16 +7,17 @@ l1emtfparProtodb = cms.ESSource("PoolDBESSource", CondDB, - toGet = cms.VPSet( + toGet = cms.VPSet( cms.PSet( record = cms.string('L1TMuonEndCapParamsRcd'), - tag = cms.string('L1TMuonEndCapParamsPrototype_Stage2v0_hlt') + tag = cms.string('L1TMuonEndCapParamsPrototype_Stage2v0_hlt') ) ) ) L1TMuonEndCapParamsOnlineProd = cms.ESProducer("L1TMuonEndCapParamsOnlineProd", onlineAuthentication = cms.string('.'), - forceGeneration = cms.bool(False), - onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R') + forceGeneration = cms.bool(False), + onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'), + transactionSafe = cms.bool(True) # nothrow guarantee if set to False: carry on no matter what ) diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonGlobalObjectKeysOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonGlobalObjectKeysOnline_cfi.py index 03e8c26ecc6ee..a382e0e72d593 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonGlobalObjectKeysOnline_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonGlobalObjectKeysOnline_cfi.py @@ -2,7 +2,8 @@ L1TMuonGlobalObjectKeysOnline = cms.ESProducer("L1TMuonGlobalObjectKeysOnlineProd", onlineAuthentication = cms.string('.'), - subsystemLabel = cms.string('uGMT'), - onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R') + subsystemLabel = cms.string('uGMT'), + onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'), + transactionSafe = cms.bool(True) # any value has no effect on this particular producer ) diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonGlobalParamsOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonGlobalParamsOnline_cfi.py index 9d141a9a84c93..c753bbbbe2d34 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonGlobalParamsOnline_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonGlobalParamsOnline_cfi.py @@ -7,16 +7,17 @@ l1gmtparProtodb = cms.ESSource("PoolDBESSource", CondDB, - toGet = cms.VPSet( + toGet = cms.VPSet( cms.PSet( record = cms.string('L1TMuonGlobalParamsRcd'), - tag = cms.string('L1TMuonGlobalParamsPrototype_Stage2v0_hlt') + tag = cms.string('L1TMuonGlobalParamsPrototype_Stage2v0_hlt') ) ) ) L1TMuonGlobalParamsOnlineProd = cms.ESProducer("L1TMuonGlobalParamsOnlineProd", onlineAuthentication = cms.string('.'), - forceGeneration = cms.bool(False), - onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R') + forceGeneration = cms.bool(False), + onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'), + transactionSafe = cms.bool(True) # nothrow guarantee if set to False: carry on no matter what ) diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonOverlapObjectKeysOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonOverlapObjectKeysOnline_cfi.py index eaf9fd5f2f632..7f8213d3ba704 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonOverlapObjectKeysOnline_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonOverlapObjectKeysOnline_cfi.py @@ -2,6 +2,7 @@ L1TMuonOverlapObjectKeysOnline = cms.ESProducer("L1TMuonOverlapObjectKeysOnlineProd", onlineAuthentication = cms.string('.'), - subsystemLabel = cms.string('OMTF'), - onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R') + subsystemLabel = cms.string('OMTF'), + onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'), + transactionSafe = cms.bool(True) # nothrow guarantee if set to False: carry on no matter what ) diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonOverlapParamsOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonOverlapParamsOnline_cfi.py index cbdde13313ccb..f1d509f1d584c 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonOverlapParamsOnline_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonOverlapParamsOnline_cfi.py @@ -2,6 +2,7 @@ L1TMuonOverlapParamsOnlineProd = cms.ESProducer("L1TMuonOverlapParamsOnlineProd", onlineAuthentication = cms.string('.'), - forceGeneration = cms.bool(False), - onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R') + forceGeneration = cms.bool(False), + onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'), + transactionSafe = cms.bool(True) # nothrow guarantee if set to False: carry on no matter what ) diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TUtmTriggerMenuObjectKeysOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TUtmTriggerMenuObjectKeysOnline_cfi.py index eaa680e229db0..0778ac264a4ec 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TUtmTriggerMenuObjectKeysOnline_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TUtmTriggerMenuObjectKeysOnline_cfi.py @@ -2,7 +2,8 @@ L1TUtmTriggerMenuObjectKeysOnline = cms.ESProducer("L1TUtmTriggerMenuObjectKeysOnlineProd", onlineAuthentication = cms.string('.'), - subsystemLabel = cms.string('uGT'), - onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R') + subsystemLabel = cms.string('uGT'), + onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R') + # menu producer must be transaction safe otherwise everyone is screwed ) diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TUtmTriggerMenuOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TUtmTriggerMenuOnline_cfi.py index ae0744c66d810..77118c6f732b2 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TUtmTriggerMenuOnline_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TUtmTriggerMenuOnline_cfi.py @@ -2,6 +2,7 @@ L1TUtmTriggerMenuOnlineProd = cms.ESProducer("L1TUtmTriggerMenuOnlineProd", onlineAuthentication = cms.string('.'), - forceGeneration = cms.bool(False), - onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R') + forceGeneration = cms.bool(False), + onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R') + # menu producer must be transaction safe otherwise everyone is screwed ) diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapParamsOnlineProxy.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapParamsOnlineProxy.cc deleted file mode 100644 index cb663a8d324b0..0000000000000 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapParamsOnlineProxy.cc +++ /dev/null @@ -1,45 +0,0 @@ -#include -#include - -#include "FWCore/Framework/interface/ModuleFactory.h" -#include "FWCore/Framework/interface/ESProducer.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "CondFormats/L1TObjects/interface/L1TMuonEndCapParams.h" -#include "CondFormats/DataRecord/interface/L1TMuonEndCapParamsRcd.h" -#include "CondFormats/DataRecord/interface/L1TMuonEndCapParamsO2ORcd.h" - -class L1TMuonEndCapParamsOnlineProxy : public edm::ESProducer { -private: - unsigned int PtAssignVersion, firmwareVersion, changeDate; -public: - std::shared_ptr produce(const L1TMuonEndCapParamsO2ORcd& record); - - L1TMuonEndCapParamsOnlineProxy(const edm::ParameterSet&); - ~L1TMuonEndCapParamsOnlineProxy(void) override{} -}; - -L1TMuonEndCapParamsOnlineProxy::L1TMuonEndCapParamsOnlineProxy(const edm::ParameterSet& iConfig) : edm::ESProducer() { - setWhatProduced(this); - PtAssignVersion = iConfig.getUntrackedParameter("PtAssignVersion", 1); - firmwareVersion = iConfig.getUntrackedParameter("firmwareVersion", 1); - changeDate = iConfig.getUntrackedParameter("changeDate", 1); -} - -std::shared_ptr L1TMuonEndCapParamsOnlineProxy::produce(const L1TMuonEndCapParamsO2ORcd& record) { -/* - const L1TMuonEndCapParamsRcd& baseRcd = record.template getRecord< L1TMuonEndCapParamsRcd >() ; - edm::ESHandle< L1TMuonEndCapParams > baseSettings ; - baseRcd.get( baseSettings ) ; - - return boost::shared_ptr< L1TMuonEndCapParams > ( new L1TMuonEndCapParams( *(baseSettings.product()) ) ); -*/ - std::shared_ptr< L1TMuonEndCapParams > retval = std::make_shared< L1TMuonEndCapParams>(); - - retval->PtAssignVersion_ = PtAssignVersion; - retval->firmwareVersion_ = firmwareVersion; - retval->PhiMatchWindowSt1_ = changeDate; // This should be set to PrimConvVersion - AWB 13.06.17 - return retval; -} - -//define this as a plug-in -DEFINE_FWK_EVENTSETUP_MODULE(L1TMuonEndCapParamsOnlineProxy); From 84cbfd348b03e8cd2f60d5ac062a292d6e8aa7ae Mon Sep 17 00:00:00 2001 From: kkotov Date: Fri, 13 Oct 2017 14:52:24 +0200 Subject: [PATCH 007/426] Adding status printouts for the Function Manager --- .../src/L1TCaloParamsOnlineProd.cc | 114 ++++-- .../src/L1TGlobalPrescalesVetosOnlineProd.cc | 386 +++++++++++------- .../src/L1TMuonBarrelParamsOnlineProd.cc | 74 +++- .../src/L1TMuonEndCapForestOnlineProd.cc | 10 +- .../src/L1TMuonEndCapObjectKeysOnlineProd.cc | 46 ++- .../src/L1TMuonEndCapParamsOnlineProd.cc | 67 +-- .../src/L1TMuonGlobalParamsOnlineProd.cc | 69 +++- .../src/L1TMuonOverlapObjectKeysOnlineProd.cc | 26 +- .../src/L1TMuonOverlapParamsOnlineProd.cc | 11 +- 9 files changed, 518 insertions(+), 285 deletions(-) diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TCaloParamsOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TCaloParamsOnlineProd.cc index cc3852419ead5..454df1f2b3e45 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TCaloParamsOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TCaloParamsOnlineProd.cc @@ -20,6 +20,7 @@ using namespace XERCES_CPP_NAMESPACE; class L1TCaloParamsOnlineProd : public L1ConfigOnlineProdBaseExt { private: unsigned int exclusiveLayer; // 0 - process calol1 and calol2, 1 - only calol1, 2 - only calol2 + bool transactionSafe; bool readCaloLayer1OnlineSettings(l1t::CaloParamsHelperO2O& paramsHelper, std::map& conf, std::map& ); @@ -50,7 +51,7 @@ std::map& ) { }; for (const auto param : expectedParams) { if ( conf.find(param) == conf.end() ) { - std::cerr << "Unable to locate expected CaloLayer1 parameter: " << param << " in L1 settings payload!"; + edm::LogError("L1-O2O: L1TCaloParamsOnlineProd") << "Unable to locate expected CaloLayer1 parameter: " << param << " in L1 settings payload!"; return false; } } @@ -114,7 +115,7 @@ std::map& ) { }; for (const auto param : expectedParams) { if ( conf.find(param) == conf.end() ) { - std::cerr << "Unable to locate expected CaloLayer2 parameter: " << param << " in L1 settings payload!"; + edm::LogError("L1-O2O: L1TCaloParamsOnlineProd") << "Unable to locate expected CaloLayer2 parameter: " << param << " in L1 settings payload!"; return false; } } @@ -188,7 +189,8 @@ std::map& ) { L1TCaloParamsOnlineProd::L1TCaloParamsOnlineProd(const edm::ParameterSet& iConfig) : L1ConfigOnlineProdBaseExt(iConfig) { - exclusiveLayer = iConfig.getParameter("exclusiveLayer"); + exclusiveLayer = iConfig.getParameter("exclusiveLayer"); + transactionSafe = iConfig.getParameter("transactionSafe"); } std::shared_ptr L1TCaloParamsOnlineProd::newObject(const std::string& objectKey, const L1TCaloParamsO2ORcd& record) { @@ -200,15 +202,19 @@ std::shared_ptr L1TCaloParamsOnlineProd::newObject(const std::s if( objectKey.empty() ){ - edm::LogError( "L1-O2O: L1TCaloParamsOnlineProd" ) << "Key is empty, returning empty l1t::CaloParams"; - throw std::runtime_error("Empty objectKey"); + edm::LogError( "L1-O2O: L1TCaloParamsOnlineProd" ) << "Key is empty"; + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: Calo | Faulty | Empty objectKey"); + else { + edm::LogError( "L1-O2O: L1TCaloParamsOnlineProd" ) << "returning unmodified prototype of l1t::CaloParams"; + return std::shared_ptr< l1t::CaloParams >( new l1t::CaloParams( *(baseSettings.product()) ) ) ; + } } std::string tscKey = objectKey.substr(0, objectKey.find(":") ); std::string rsKey = objectKey.substr( objectKey.find(":")+1, std::string::npos ); - edm::LogInfo( "L1-O2O: L1TCaloParamsOnlineProd" ) << "Producing L1TCaloParamsOnlineProd with TSC key = " << tscKey << " and RS key = " << rsKey -; + edm::LogInfo( "L1-O2O: L1TCaloParamsOnlineProd" ) << "Producing L1TCaloParamsOnlineProd with TSC key = " << tscKey << " and RS key = " << rsKey; std::string calol1_top_key, calol1_algo_key; std::string calol1_algo_payload; @@ -279,7 +285,12 @@ std::shared_ptr L1TCaloParamsOnlineProd::newObject(const std::s } catch ( std::runtime_error &e ) { edm::LogError( "L1-O2O: L1TCaloParamsOnlineProd" ) << e.what(); - throw std::runtime_error("Broken key"); + if( transactionSafe ) + throw std::runtime_error(std::string("SummaryForFunctionManager: Calo | Faulty | ") + e.what()); + else { + edm::LogError( "L1-O2O: L1TCaloParamsOnlineProd" ) << "returning unmodified prototype of l1t::CaloParams"; + return std::shared_ptr< l1t::CaloParams >( new l1t::CaloParams( *(baseSettings.product()) ) ) ; + } } if( exclusiveLayer == 0 || exclusiveLayer == 2 ){ @@ -303,48 +314,69 @@ std::shared_ptr L1TCaloParamsOnlineProd::newObject(const std::s l1t::CaloParamsHelperO2O m_params_helper( *(baseSettings.product()) ); - if( exclusiveLayer == 0 || exclusiveLayer == 1 ){ - l1t::XmlConfigParser xmlReader1; - xmlReader1.readDOMFromString( calol1_algo_payload ); + if( exclusiveLayer == 0 || exclusiveLayer == 1 ){ + try { + l1t::XmlConfigParser xmlReader1; + xmlReader1.readDOMFromString( calol1_algo_payload ); - l1t::TriggerSystem calol1; - calol1.addProcessor("processors", "processors","-1","-1"); - xmlReader1.readRootElement( calol1, "calol1" ); - calol1.setConfigured(); + l1t::TriggerSystem calol1; + calol1.addProcessor("processors", "processors","-1","-1"); + xmlReader1.readRootElement( calol1, "calol1" ); + calol1.setConfigured(); - std::map calol1_conf = calol1.getParameters("processors"); - std::map calol1_rs ;//= calol1.getMasks ("processors"); - - if( !readCaloLayer1OnlineSettings(m_params_helper, calol1_conf, calol1_rs) ) - throw std::runtime_error("Parsing error for CaloLayer1"); - } + std::map calol1_conf = calol1.getParameters("processors"); + std::map calol1_rs ;//= calol1.getMasks ("processors"); + if( !readCaloLayer1OnlineSettings(m_params_helper, calol1_conf, calol1_rs) ) + throw std::runtime_error("Parsing error for CaloLayer1"); - if( exclusiveLayer == 0 || exclusiveLayer == 2 ){ - l1t::TriggerSystem calol2; - - l1t::XmlConfigParser xmlReader2; - xmlReader2.readDOMFromString( calol2_hw_payload ); - xmlReader2.readRootElement( calol2, "calol2" ); - - for(auto &conf : calol2_algo_payloads){ - xmlReader2.readDOMFromString( conf.second ); - xmlReader2.readRootElement( calol2, "calol2" ); + } catch ( std::runtime_error &e ){ + edm::LogError( "L1-O2O: L1TCaloParamsOnlineProd" ) << e.what(); + if( transactionSafe ) + throw std::runtime_error(std::string("SummaryForFunctionManager: Calo | Faulty | ") + e.what()); + else { + edm::LogError( "L1-O2O: L1TCaloParamsOnlineProd" ) << "returning unmodified prototype of l1t::CaloParams"; + return std::shared_ptr< l1t::CaloParams >( new l1t::CaloParams( *(baseSettings.product()) ) ) ; + } + } } -// calol2.setSystemId("calol2"); - calol2.setConfigured(); - // Perhaps layer 2 has to look at settings for demux and mp separately? // => No demux settings required - std::map calol2_conf = calol2.getParameters("MP1"); - std::map calol2_rs ;//= calol2.getMasks ("processors"); - - if( !readCaloLayer2OnlineSettings(m_params_helper, calol2_conf, calol2_rs) ) - throw std::runtime_error("Parsing error for CaloLayer2"); - } + if( exclusiveLayer == 0 || exclusiveLayer == 2 ){ + try { + l1t::TriggerSystem calol2; + l1t::XmlConfigParser xmlReader2; + xmlReader2.readDOMFromString( calol2_hw_payload ); + xmlReader2.readRootElement( calol2, "calol2" ); + + for(auto &conf : calol2_algo_payloads){ + xmlReader2.readDOMFromString( conf.second ); + xmlReader2.readRootElement( calol2, "calol2" ); + } + +// calol2.setSystemId("calol2"); + calol2.setConfigured(); + + std::map calol2_conf = calol2.getParameters("MP1"); + std::map calol2_rs ;//= calol2.getMasks ("processors"); + + if( !readCaloLayer2OnlineSettings(m_params_helper, calol2_conf, calol2_rs) ) + throw std::runtime_error("Parsing error for CaloLayer2"); + + } catch ( std::runtime_error &e ){ + edm::LogError( "L1-O2O: L1TCaloParamsOnlineProd" ) << e.what(); + if( transactionSafe ) + throw std::runtime_error(std::string("SummaryForFunctionManager: Calo | Faulty | ") + e.what()); + else { + edm::LogError( "L1-O2O: L1TCaloParamsOnlineProd" ) << "returning unmodified prototype of l1t::CaloParams"; + return std::shared_ptr< l1t::CaloParams >( new l1t::CaloParams( *(baseSettings.product()) ) ) ; + } + } + } - std::shared_ptr< l1t::CaloParams > retval = std::make_shared< l1t::CaloParams >( m_params_helper ) ; + + edm::LogInfo( "L1-O2O: L1TCaloParamsOnlineProd" ) << "SummaryForFunctionManager: Calo | OK | All looks good"; return retval; } diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TGlobalPrescalesVetosOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TGlobalPrescalesVetosOnlineProd.cc index 5f0cbcac58b4b..f7fc1351c4d97 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TGlobalPrescalesVetosOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TGlobalPrescalesVetosOnlineProd.cc @@ -28,6 +28,7 @@ class L1TGlobalPrescalesVetosOnlineProd : public L1ConfigOnlineProdBaseExt { private: int xmlModel; + bool transactionSafe; public: virtual std::shared_ptr newObject(const std::string& objectKey, const L1TGlobalPrescalesVetosO2ORcd& record) override ; @@ -37,6 +38,7 @@ class L1TGlobalPrescalesVetosOnlineProd : public L1ConfigOnlineProdBaseExt(iConfig) { xmlModel = iConfig.getParameter("xmlModel"); + transactionSafe = iConfig.getParameter("transactionSafe"); } std::shared_ptr L1TGlobalPrescalesVetosOnlineProd::newObject(const std::string& objectKey, const L1TGlobalPrescalesVetosO2ORcd& record) { @@ -45,8 +47,12 @@ std::shared_ptr L1TGlobalPrescalesVetosOnlineProd::newO edm::LogInfo( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) << "Producing L1TGlobalPrescalesVetos with TSC:RS key = " << objectKey ; if( objectKey.empty() ){ - edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) << "Key is empty"; - throw std::runtime_error("Empty objecKey"); + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: uGTrs | Faulty | Empty objectKey"); + else { + edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) << "returning empty L1TGlobalPrescalesVetos object"; + return std::shared_ptr< L1TGlobalPrescalesVetos >( new L1TGlobalPrescalesVetos() ) ; + } } unsigned int m_numberPhysTriggers = 512; @@ -76,7 +82,12 @@ std::shared_ptr L1TGlobalPrescalesVetosOnlineProd::newO if( queryResult.queryFailed() || queryResult.numberRows() != 1 ){ edm::LogError( "L1-O2O" ) << "Cannot get UGT_KEYS.L1_MENU for ID = " << uGTtscKey << " " ; - throw std::runtime_error("Broken key"); + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: uGTrs | Faulty | Broken key"); + else { + edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) << "returning empty L1TGlobalPrescalesVetos object"; + return std::shared_ptr< L1TGlobalPrescalesVetos >( new L1TGlobalPrescalesVetos() ) ; + } } if( !queryResult.fillVariable( "L1_MENU", l1_menu_key) ) l1_menu_key = ""; @@ -85,7 +96,12 @@ std::shared_ptr L1TGlobalPrescalesVetosOnlineProd::newO if( uGTtscKey.empty() ){ edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) << "TSC key is empty, returning"; - throw std::runtime_error("Empty objectKey"); + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: uGTrs | Faulty | Empty objectKey"); + else { + edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) << "returning empty L1TGlobalPrescalesVetos object"; + return std::shared_ptr< L1TGlobalPrescalesVetos >( new L1TGlobalPrescalesVetos() ) ; + } } std::vector< std::string > queryColumns; @@ -101,7 +117,12 @@ std::shared_ptr L1TGlobalPrescalesVetosOnlineProd::newO if( queryResult.queryFailed() || queryResult.numberRows() != 1 ){ edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) << "Cannot get UGT_L1_MENU.CONF for ID = " << l1_menu_key; - throw std::runtime_error("Broken key"); + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: uGTrs | Faulty | Broken key"); + else { + edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) << "returning empty L1TGlobalPrescalesVetos object"; + return std::shared_ptr< L1TGlobalPrescalesVetos >( new L1TGlobalPrescalesVetos() ) ; + } } std::string l1Menu; @@ -145,7 +166,12 @@ std::shared_ptr L1TGlobalPrescalesVetosOnlineProd::newO xmlPayload_mask_veto = l1t::OnlineDBqueryHelper::fetch( {"CONF"}, "UGT_RS_CLOBS", vetomask_key, m_omdsReader )["CONF"]; } catch ( std::runtime_error &e ) { edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) << e.what(); - throw std::runtime_error("Broken key"); + if( transactionSafe ) + throw std::runtime_error(std::string("SummaryForFunctionManager: uGTrs | Faulty | ") + e.what()); + else { + edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) << "returning empty L1TGlobalPrescalesVetos object"; + return std::shared_ptr< L1TGlobalPrescalesVetos >( new L1TGlobalPrescalesVetos() ) ; + } } @@ -170,136 +196,162 @@ std::shared_ptr L1TGlobalPrescalesVetosOnlineProd::newO std::vector triggerVetoMasks; std::map > triggerAlgoBxMaskAlgoTrig; - // Prescales - l1t::XmlConfigParser xmlReader_prescale; - l1t::TriggerSystem ts_prescale; - ts_prescale.addProcessor("uGtProcessor", "uGtProcessor","-1","-1"); - - // run the parser - xmlReader_prescale.readDOMFromString( xmlPayload_prescale ); // initialize it - xmlReader_prescale.readRootElement( ts_prescale, "uGT" ); // extract all of the relevant context - ts_prescale.setConfigured(); - - const std::map &settings_prescale = ts_prescale.getParameters("uGtProcessor"); - std::map prescaleColumns = settings_prescale.at("prescales").getColumnIndices(); - - unsigned int numColumns_prescale = prescaleColumns.size(); - int nPrescaleSets = numColumns_prescale - 1; - std::vector algoNames = settings_prescale.at("prescales").getTableColumn("algo/prescale-index"); - - if( nPrescaleSets > 0 ){ - // Fill default prescale set - for( int iSet=0; iSet()); - for(unsigned int iBit = 0; iBit < m_numberPhysTriggers; ++iBit ){ - int inputDefaultPrescale = 0; // only prescales that are set in the block below are used - prescales[iSet].push_back(inputDefaultPrescale); + // Prescales + try { + l1t::XmlConfigParser xmlReader_prescale; + l1t::TriggerSystem ts_prescale; + ts_prescale.addProcessor("uGtProcessor", "uGtProcessor","-1","-1"); + + // run the parser + xmlReader_prescale.readDOMFromString( xmlPayload_prescale ); // initialize it + xmlReader_prescale.readRootElement( ts_prescale, "uGT" ); // extract all of the relevant context + ts_prescale.setConfigured(); + + const std::map &settings_prescale = ts_prescale.getParameters("uGtProcessor"); + std::map prescaleColumns = settings_prescale.at("prescales").getColumnIndices(); + + unsigned int numColumns_prescale = prescaleColumns.size(); + int nPrescaleSets = numColumns_prescale - 1; + std::vector algoNames = settings_prescale.at("prescales").getTableColumn("algo/prescale-index"); + + if( nPrescaleSets > 0 ){ + // Fill default prescale set + for( int iSet=0; iSet()); + for(unsigned int iBit = 0; iBit < m_numberPhysTriggers; ++iBit ){ + int inputDefaultPrescale = 0; // only prescales that are set in the block below are used + prescales[iSet].push_back(inputDefaultPrescale); + } } - } - for(auto &col : prescaleColumns){ - if( col.second<1 ) continue; // we don't care for the algorithms' indicies in 0th column - int iSet = col.second - 1; - std::vector prescalesForSet = settings_prescale.at("prescales").getTableColumn(col.first.c_str()); - for(unsigned int row=0; row prescalesForSet = settings_prescale.at("prescales").getTableColumn(col.first.c_str()); + for(unsigned int row=0; row( new L1TGlobalPrescalesVetos() ) ; } } - /////////////////////////////////////////////////////////////////////////////////////////////////////////// // finor mask - l1t::XmlConfigParser xmlReader_mask_finor; - l1t::TriggerSystem ts_mask_finor; - ts_mask_finor.addProcessor("uGtProcessor", "uGtProcessor","-1","-1"); - - // run the parser - xmlReader_mask_finor.readDOMFromString( xmlPayload_mask_finor ); // initialize it - xmlReader_mask_finor.readRootElement( ts_mask_finor, "uGT" ); // extract all of the relevant context - ts_mask_finor.setConfigured(); - - const std::map& settings_mask_finor = ts_mask_finor.getParameters("uGtProcessor"); - - std::vector algo_mask_finor = settings_mask_finor.at("finorMask").getTableColumn("algo"); - std::vector mask_mask_finor = settings_mask_finor.at("finorMask").getTableColumn("mask"); - - // mask (default=1 - unmask) - unsigned int default_finor_mask = 1; - auto default_finor_row = - std::find_if( algo_mask_finor.cbegin(), - algo_mask_finor.cend(), - [] (const std::string &s){ - // simpler than overweight std::tolower(s[], std::locale()) POSIX solution (thx to BA): - return strcasecmp("all", s.c_str()) == 0; - } - ); - if( default_finor_row == algo_mask_finor.cend() ){ - edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) - << "\nWarning: No default found in FinOR mask xml, use 1 (unmasked) as default" - << std::endl; - } else { - default_finor_mask = mask_mask_finor[ std::distance( algo_mask_finor.cbegin(), default_finor_row ) ]; - } + try { + l1t::XmlConfigParser xmlReader_mask_finor; + l1t::TriggerSystem ts_mask_finor; + ts_mask_finor.addProcessor("uGtProcessor", "uGtProcessor","-1","-1"); + + // run the parser + xmlReader_mask_finor.readDOMFromString( xmlPayload_mask_finor ); // initialize it + xmlReader_mask_finor.readRootElement( ts_mask_finor, "uGT" ); // extract all of the relevant context + ts_mask_finor.setConfigured(); + + const std::map& settings_mask_finor = ts_mask_finor.getParameters("uGtProcessor"); + + std::vector algo_mask_finor = settings_mask_finor.at("finorMask").getTableColumn("algo"); + std::vector mask_mask_finor = settings_mask_finor.at("finorMask").getTableColumn("mask"); + + // mask (default=1 - unmask) + unsigned int default_finor_mask = 1; + auto default_finor_row = + std::find_if( algo_mask_finor.cbegin(), + algo_mask_finor.cend(), + [] (const std::string &s){ + // simpler than overweight std::tolower(s[], std::locale()) POSIX solution (thx to BA): + return strcasecmp("all", s.c_str()) == 0; + } + ); + if( default_finor_row == algo_mask_finor.cend() ){ + edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) + << "\nWarning: No default found in FinOR mask xml, use 1 (unmasked) as default" + << std::endl; + } else { + default_finor_mask = mask_mask_finor[ std::distance( algo_mask_finor.cbegin(), default_finor_row ) ]; + } - for( unsigned int iAlg=0; iAlg < m_numberPhysTriggers; iAlg++ ) - triggerMasks.push_back(default_finor_mask); + for( unsigned int iAlg=0; iAlg < m_numberPhysTriggers; iAlg++ ) + triggerMasks.push_back(default_finor_mask); - for(unsigned int row=0; row( new L1TGlobalPrescalesVetos() ) ; + } } /////////////////////////////////////////////////////////////////////////////////////////////////////////// // veto mask - l1t::XmlConfigParser xmlReader_mask_veto; - l1t::TriggerSystem ts_mask_veto; - ts_mask_veto.addProcessor("uGtProcessor", "uGtProcessor","-1","-1"); - - // run the parser - xmlReader_mask_veto.readDOMFromString( xmlPayload_mask_veto ); // initialize it - xmlReader_mask_veto.readRootElement( ts_mask_veto, "uGT" ); // extract all of the relevant context - ts_mask_veto.setConfigured(); - - const std::map& settings_mask_veto = ts_mask_veto.getParameters("uGtProcessor"); - std::vector algo_mask_veto = settings_mask_veto.at("vetoMask").getTableColumn("algo"); - std::vector veto_mask_veto = settings_mask_veto.at("vetoMask").getTableColumn("veto"); - - // veto mask (default=0 - no veto) - unsigned int default_veto_mask = 1; - auto default_veto_row = - std::find_if( algo_mask_veto.cbegin(), - algo_mask_veto.cend(), - [] (const std::string &s){ - // simpler than overweight std::tolower(s[], std::locale()) POSIX solution (thx to BA): - return strcasecmp("all", s.c_str()) == 0; - } - ); - if( default_veto_row == algo_mask_veto.cend() ){ - edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) - << "\nWarning: No default found in Veto mask xml, use 0 (unvetoed) as default" - << std::endl; - } else { - default_veto_mask = veto_mask_veto[ std::distance( algo_mask_veto.cbegin(), default_veto_row ) ]; - } + try { + l1t::XmlConfigParser xmlReader_mask_veto; + l1t::TriggerSystem ts_mask_veto; + ts_mask_veto.addProcessor("uGtProcessor", "uGtProcessor","-1","-1"); + + // run the parser + xmlReader_mask_veto.readDOMFromString( xmlPayload_mask_veto ); // initialize it + xmlReader_mask_veto.readRootElement( ts_mask_veto, "uGT" ); // extract all of the relevant context + ts_mask_veto.setConfigured(); + + const std::map& settings_mask_veto = ts_mask_veto.getParameters("uGtProcessor"); + std::vector algo_mask_veto = settings_mask_veto.at("vetoMask").getTableColumn("algo"); + std::vector veto_mask_veto = settings_mask_veto.at("vetoMask").getTableColumn("veto"); + + // veto mask (default=0 - no veto) + unsigned int default_veto_mask = 1; + auto default_veto_row = + std::find_if( algo_mask_veto.cbegin(), + algo_mask_veto.cend(), + [] (const std::string &s){ + // simpler than overweight std::tolower(s[], std::locale()) POSIX solution (thx to BA): + return strcasecmp("all", s.c_str()) == 0; + } + ); + if( default_veto_row == algo_mask_veto.cend() ){ + edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) + << "\nWarning: No default found in Veto mask xml, use 0 (unvetoed) as default" + << std::endl; + } else { + default_veto_mask = veto_mask_veto[ std::distance( algo_mask_veto.cbegin(), default_veto_row ) ]; + } - for( unsigned int iAlg=0; iAlg < m_numberPhysTriggers; iAlg++ ) - triggerVetoMasks.push_back(default_veto_mask); + for( unsigned int iAlg=0; iAlg < m_numberPhysTriggers; iAlg++ ) + triggerVetoMasks.push_back(default_veto_mask); - for(unsigned int row=0; row( new L1TGlobalPrescalesVetos() ) ; + } } /////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -309,19 +361,32 @@ std::shared_ptr L1TGlobalPrescalesVetosOnlineProd::newO if( xmlModel > 2016 ){ - l1t::XmlConfigParser xmlReader_mask_algobx; - l1t::TriggerSystem ts_mask_algobx; - ts_mask_algobx.addProcessor("uGtProcessor", "uGtProcessor","-1","-1"); - - // run the parser - xmlReader_mask_algobx.readDOMFromString( xmlPayload_mask_algobx ); // initialize it - xmlReader_mask_algobx.readRootElement( ts_mask_algobx, "uGT" ); // extract all of the relevant context - ts_mask_algobx.setConfigured(); + std::vector bx_algo_name; + std::vector bx_range; + std::vector bx_mask; - const std::map& settings_mask_algobx = ts_mask_algobx.getParameters("uGtProcessor"); - std::vector bx_algo_name = settings_mask_algobx.at("algorithmBxMask").getTableColumn("algo"); - std::vector bx_range = settings_mask_algobx.at("algorithmBxMask").getTableColumn("range"); - std::vector bx_mask = settings_mask_algobx.at("algorithmBxMask").getTableColumn("mask"); + try { + l1t::XmlConfigParser xmlReader_mask_algobx; + l1t::TriggerSystem ts_mask_algobx; + ts_mask_algobx.addProcessor("uGtProcessor", "uGtProcessor","-1","-1"); + + // run the parser + xmlReader_mask_algobx.readDOMFromString( xmlPayload_mask_algobx ); // initialize it + xmlReader_mask_algobx.readRootElement( ts_mask_algobx, "uGT" ); // extract all of the relevant context + ts_mask_algobx.setConfigured(); + + const std::map& settings_mask_algobx = ts_mask_algobx.getParameters("uGtProcessor"); + bx_algo_name = settings_mask_algobx.at("algorithmBxMask").getTableColumn("algo"); + bx_range = settings_mask_algobx.at("algorithmBxMask").getTableColumn("range"); + bx_mask = settings_mask_algobx.at("algorithmBxMask").getTableColumn("mask"); + } catch ( std::runtime_error &e ){ + if( transactionSafe ) + throw std::runtime_error(std::string("SummaryForFunctionManager: uGTrs | Faulty | ") + e.what()); + else { + edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) << "returning empty L1TGlobalPrescalesVetos object"; + return std::shared_ptr< L1TGlobalPrescalesVetos >( new L1TGlobalPrescalesVetos() ) ; + } + } int default_bxmask_row = -1; typedef std::pair Range_t; @@ -586,28 +651,37 @@ if( xmlModel > 2016 ){ } else { // xmlModel <= 2016 - // old algo bx mask - l1t::XmlConfigParser xmlReader_mask_algobx; - l1t::TriggerSystem ts_mask_algobx; - ts_mask_algobx.addProcessor("uGtProcessor", "uGtProcessor","-1","-1"); - - // run the parser - xmlReader_mask_algobx.readDOMFromString( xmlPayload_mask_algobx ); // initialize it - xmlReader_mask_algobx.readRootElement( ts_mask_algobx, "uGT" ); // extract all of the relevant context - ts_mask_algobx.setConfigured(); - - const std::map& settings_mask_algobx = ts_mask_algobx.getParameters("uGtProcessor"); - std::map mask_algobx_columns = settings_mask_algobx.at("algorithmBxMask").getColumnIndices(); - std::vector bunches = settings_mask_algobx.at("algorithmBxMask").getTableColumn("bx/algo"); - - unsigned int numCol_mask_algobx = mask_algobx_columns.size(); - - int NumAlgoBitsInMask = numCol_mask_algobx - 1; - for( int iBit=0; iBit algo = settings_mask_algobx.at("algorithmBxMask").getTableColumn(std::to_string(iBit).c_str()); - for(unsigned int bx=0; bx& settings_mask_algobx = ts_mask_algobx.getParameters("uGtProcessor"); + std::map mask_algobx_columns = settings_mask_algobx.at("algorithmBxMask").getColumnIndices(); + std::vector bunches = settings_mask_algobx.at("algorithmBxMask").getTableColumn("bx/algo"); + + unsigned int numCol_mask_algobx = mask_algobx_columns.size(); + + int NumAlgoBitsInMask = numCol_mask_algobx - 1; + for( int iBit=0; iBit algo = settings_mask_algobx.at("algorithmBxMask").getTableColumn(std::to_string(iBit).c_str()); + for(unsigned int bx=0; bx( new L1TGlobalPrescalesVetos() ) ; + } } } @@ -621,9 +695,11 @@ if( xmlModel > 2016 ){ data_.setTriggerAlgoBxMask ( triggerAlgoBxMaskAlgoTrig ); using namespace edm::es; - std::shared_ptr payload(data_.getWriteInstance()); - return payload; + std::shared_ptr payload( std::make_shared(*data_.getWriteInstance()) ); + + edm::LogInfo( "L1-O2O: L1TCaloParamsOnlineProd" ) << "SummaryForFunctionManager: uGTrs | OK | All looks good"; + return payload; } //define this as a plug-in diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonBarrelParamsOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonBarrelParamsOnlineProd.cc index 4cbeded2c83b1..cfad1fde9afd3 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonBarrelParamsOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonBarrelParamsOnlineProd.cc @@ -15,14 +15,17 @@ using namespace XERCES_CPP_NAMESPACE; class L1TMuonBarrelParamsOnlineProd : public L1ConfigOnlineProdBaseExt { private: + bool transactionSafe; public: - virtual std::shared_ptr newObject(const std::string& objectKey, const L1TMuonBarrelParamsO2ORcd& record) override ; + std::shared_ptr newObject(const std::string& objectKey, const L1TMuonBarrelParamsO2ORcd& record) override ; - L1TMuonBarrelParamsOnlineProd(const edm::ParameterSet&); + L1TMuonBarrelParamsOnlineProd(const edm::ParameterSet&) override ; ~L1TMuonBarrelParamsOnlineProd(void){} }; -L1TMuonBarrelParamsOnlineProd::L1TMuonBarrelParamsOnlineProd(const edm::ParameterSet& iConfig) : L1ConfigOnlineProdBaseExt(iConfig) {} +L1TMuonBarrelParamsOnlineProd::L1TMuonBarrelParamsOnlineProd(const edm::ParameterSet& iConfig) : L1ConfigOnlineProdBaseExt(iConfig) { + transactionSafe = iConfig.getParameter("transactionSafe"); +} std::shared_ptr L1TMuonBarrelParamsOnlineProd::newObject(const std::string& objectKey, const L1TMuonBarrelParamsO2ORcd& record) { using namespace edm::es; @@ -31,10 +34,14 @@ std::shared_ptr L1TMuonBarrelParamsOnlineProd::newObject(co edm::ESHandle< L1TMuonBarrelParams > baseSettings ; baseRcd.get( baseSettings ) ; - if (objectKey.empty()) { edm::LogError( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << "Key is empty, returning empty L1TMuonBarrelParams"; - throw std::runtime_error("Empty objectKey"); + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: BMTF | Faulty | Empty objectKey"); + else { + edm::LogError( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonBarrelParams"; + return std::shared_ptr< L1TMuonBarrelParams >( new L1TMuonBarrelParams( *(baseSettings.product()) ) ) ; + } } std::string tscKey = objectKey.substr(0, objectKey.find(":") ); @@ -94,7 +101,12 @@ std::shared_ptr L1TMuonBarrelParamsOnlineProd::newObject(co } catch ( std::runtime_error &e ) { edm::LogError( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << e.what(); - throw std::runtime_error("Broken key"); + if( transactionSafe ) + throw std::runtime_error(std::string("SummaryForFunctionManager: BMTF | Faulty | ") + e.what()); + else { + edm::LogError( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonBarrelParams"; + return std::shared_ptr< L1TMuonBarrelParams >( new L1TMuonBarrelParams( *(baseSettings.product()) ) ) ; + } } @@ -123,27 +135,49 @@ std::shared_ptr L1TMuonBarrelParamsOnlineProd::newObject(co // finally, push all payloads to the XML parser and construct the TrigSystem objects with each of those l1t::XmlConfigParser xmlRdr; l1t::TriggerSystem parsedXMLs; + try { + // HW settings should always go first + xmlRdr.readDOMFromString( hw_payload ); + xmlRdr.readRootElement ( parsedXMLs ); - // HW settings should always go first - xmlRdr.readDOMFromString( hw_payload ); - xmlRdr.readRootElement ( parsedXMLs ); + // now let's parse ALGO settings + xmlRdr.readDOMFromString( algo_payload ); + xmlRdr.readRootElement ( parsedXMLs ); - // now let's parse ALGO settings - xmlRdr.readDOMFromString( algo_payload ); - xmlRdr.readRootElement ( parsedXMLs ); + // remaining RS settings + xmlRdr.readDOMFromString( mp7_payload ); + xmlRdr.readRootElement ( parsedXMLs ); - // remaining RS settings - xmlRdr.readDOMFromString( mp7_payload ); - xmlRdr.readRootElement ( parsedXMLs ); + xmlRdr.readDOMFromString( amc13_payload ); + xmlRdr.readRootElement ( parsedXMLs ); + parsedXMLs.setConfigured(); - xmlRdr.readDOMFromString( amc13_payload ); - xmlRdr.readRootElement ( parsedXMLs ); - parsedXMLs.setConfigured(); + } catch ( std::runtime_error &e ) { + edm::LogError( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << e.what(); + if( transactionSafe ) + throw std::runtime_error(std::string("SummaryForFunctionManager: BMTF | Faulty | ") + e.what()); + else { + edm::LogError( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonBarrelParams"; + return std::shared_ptr< L1TMuonBarrelParams >( new L1TMuonBarrelParams( *(baseSettings.product()) ) ) ; + } + } L1TMuonBarrelParamsHelper m_params_helper( *(baseSettings.product()) ); - m_params_helper.configFromDB( parsedXMLs ); + try { + m_params_helper.configFromDB( parsedXMLs ); + } catch ( std::runtime_error &e ) { + edm::LogError( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << e.what(); + if( transactionSafe ) + throw std::runtime_error(std::string("SummaryForFunctionManager: BMTF | Faulty | ") + e.what()); + else { + edm::LogError( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonBarrelParams"; + return std::shared_ptr< L1TMuonBarrelParams >( new L1TMuonBarrelParams( *(baseSettings.product()) ) ) ; + } + } + std::shared_ptr< L1TMuonBarrelParams > retval = std::make_shared< L1TMuonBarrelParams>( m_params_helper ); - + + edm::LogInfo( "L1-O2O: L1TCaloParamsOnlineProd" ) << "SummaryForFunctionManager: BMTF | OK | All looks good"; return retval; } diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapForestOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapForestOnlineProd.cc index 64e28ca8a4a35..a41c0df87ba3a 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapForestOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapForestOnlineProd.cc @@ -9,6 +9,7 @@ class L1TMuonEndCapForestOnlineProd : public L1ConfigOnlineProdBaseExt { private: + bool transactionSafe; public: std::shared_ptr newObject(const std::string& objectKey, const L1TMuonEndCapForestO2ORcd& record) override ; @@ -16,15 +17,20 @@ class L1TMuonEndCapForestOnlineProd : public L1ConfigOnlineProdBaseExt(iConfig) {} +L1TMuonEndCapForestOnlineProd::L1TMuonEndCapForestOnlineProd(const edm::ParameterSet& iConfig) : L1ConfigOnlineProdBaseExt(iConfig) { + transactionSafe = iConfig.getParameter("transactionSafe"); +} std::shared_ptr L1TMuonEndCapForestOnlineProd::newObject(const std::string& objectKey, const L1TMuonEndCapForestO2ORcd& record) { edm::LogError( "L1-O2O" ) << "L1TMuonEndCapForest object with key " << objectKey << " not in ORCON!" ; - throw std::runtime_error("You are never supposed to get this code running!"); + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: EMTF | Faulty | You are never supposed to get Forests online producer running!"); std::shared_ptr< L1TMuonEndCapForest > retval = std::make_shared< L1TMuonEndCapForest >(); + + edm::LogError( "L1-O2O: L1TMuonEndCapForestOnlineProd" ) << "SummaryForFunctionManager: EMTF | Faulty | You are never supposed to get Forests online producer running; returning empty L1TMuonEndCapForest"; return retval; } diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapObjectKeysOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapObjectKeysOnlineProd.cc index d8343044e6a7f..1a41a79d53262 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapObjectKeysOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapObjectKeysOnlineProd.cc @@ -7,16 +7,18 @@ class L1TMuonEndCapObjectKeysOnlineProd : public L1ObjectKeysOnlineProdBaseExt { private: - + bool transactionSafe; public: - void fillObjectKeys( ReturnType pL1TriggerKey ) override ; + virtual void fillObjectKeys( ReturnType pL1TriggerKey ) override ; L1TMuonEndCapObjectKeysOnlineProd(const edm::ParameterSet&); - ~L1TMuonEndCapObjectKeysOnlineProd(void) override{} + ~L1TMuonEndCapObjectKeysOnlineProd(void){} }; L1TMuonEndCapObjectKeysOnlineProd::L1TMuonEndCapObjectKeysOnlineProd(const edm::ParameterSet& iConfig) - : L1ObjectKeysOnlineProdBaseExt( iConfig ){ + : L1ObjectKeysOnlineProdBaseExt( iConfig ) +{ + transactionSafe = iConfig.getParameter("transactionSafe"); } @@ -30,7 +32,6 @@ void L1TMuonEndCapObjectKeysOnlineProd::fillObjectKeys( ReturnType pL1TriggerKey EMTFKey) ; std::string tscKey = EMTFKey.substr(0, EMTFKey.find(":") ); - std::string rsKey = EMTFKey.substr( EMTFKey.find(":")+1, std::string::npos ); //////////////////////// // the block below reproduces L1TMuonEndCapParamsOnlineProd identically @@ -61,20 +62,41 @@ void L1TMuonEndCapObjectKeysOnlineProd::fillObjectKeys( ReturnType pL1TriggerKey ) ["CONF"]; } catch ( std::runtime_error &e ) { - edm::LogError( "L1-O2O: L1TMuonEndCapParamsOnlineProd" ) << e.what(); - throw std::runtime_error("Broken key"); + edm::LogError( "L1-O2O: L1TMuonEndCapObjectKeysOnlineProd" ) << e.what(); + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: EMTF | Faulty | Broken key"); + else { + edm::LogError( "L1-O2O: L1TMuonEndCapObjectKeysOnlineProd" ) << "forcing L1TMuonEndCapForest key to be = '7' (known to exist)"; + pL1TriggerKey->add( "L1TMuonEndCapForestO2ORcd", + "L1TMuonEndCapForest", + "7") ; + return; + } } l1t::XmlConfigParser xmlRdr; l1t::TriggerSystem trgSys; - xmlRdr.readDOMFromString( hw_payload ); - xmlRdr.readRootElement ( trgSys ); + try { + xmlRdr.readDOMFromString( hw_payload ); + xmlRdr.readRootElement ( trgSys ); - xmlRdr.readDOMFromString( algo_payload ); - xmlRdr.readRootElement ( trgSys ); + xmlRdr.readDOMFromString( algo_payload ); + xmlRdr.readRootElement ( trgSys ); - trgSys.setConfigured(); + trgSys.setConfigured(); + } catch ( std::runtime_error &e ) { + edm::LogError( "L1-O2O: L1TMuonEndCapObjectKeysOnlineProd" ) << e.what(); + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: EMTF | Faulty | Cannot parse XMLs"); + else { + edm::LogError( "L1-O2O: L1TMuonEndCapObjectKeysOnlineProd" ) << "forcing L1TMuonEndCapForest key to be = '7' (known to exist)"; + pL1TriggerKey->add( "L1TMuonEndCapForestO2ORcd", + "L1TMuonEndCapForest", + "7") ; + return; + } + } std::map conf = trgSys.getParameters("EMTF-1"); // any processor will do diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapParamsOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapParamsOnlineProd.cc index 825ef9e02a287..58ea83c72c729 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapParamsOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapParamsOnlineProd.cc @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include @@ -8,21 +8,23 @@ #include "CondFormats/L1TObjects/interface/L1TMuonEndCapParams.h" #include "CondFormats/DataRecord/interface/L1TMuonEndCapParamsRcd.h" #include "CondFormats/DataRecord/interface/L1TMuonEndCapParamsO2ORcd.h" -#include "L1Trigger/L1TMuonEndCap/interface/EndCapParamsHelper.h" #include "L1Trigger/L1TCommon/interface/TriggerSystem.h" #include "L1Trigger/L1TCommon/interface/XmlConfigParser.h" #include "OnlineDBqueryHelper.h" class L1TMuonEndCapParamsOnlineProd : public L1ConfigOnlineProdBaseExt { private: + bool transactionSafe; public: std::shared_ptr newObject(const std::string& objectKey, const L1TMuonEndCapParamsO2ORcd& record) override ; - L1TMuonEndCapParamsOnlineProd(const edm::ParameterSet&); - ~L1TMuonEndCapParamsOnlineProd(void) override{} + L1TMuonEndCapParamsOnlineProd(const edm::ParameterSet&) override ; + ~L1TMuonEndCapParamsOnlineProd(void){} }; -L1TMuonEndCapParamsOnlineProd::L1TMuonEndCapParamsOnlineProd(const edm::ParameterSet& iConfig) : L1ConfigOnlineProdBaseExt(iConfig){} +L1TMuonEndCapParamsOnlineProd::L1TMuonEndCapParamsOnlineProd(const edm::ParameterSet& iConfig) : L1ConfigOnlineProdBaseExt(iConfig){ + transactionSafe = iConfig.getParameter("transactionSafe"); +} std::shared_ptr L1TMuonEndCapParamsOnlineProd::newObject(const std::string& objectKey, const L1TMuonEndCapParamsO2ORcd& record) { using namespace edm::es; @@ -33,8 +35,13 @@ std::shared_ptr L1TMuonEndCapParamsOnlineProd::newObject(co if (objectKey.empty()) { - edm::LogError( "L1-O2O: L1TMuonEndCapParamsOnlineProd" ) << "Key is empty, returning empty L1TMuonEndCapParams"; - throw std::runtime_error("Empty objectKey"); + edm::LogError( "L1-O2O: L1TMuonEndCapParamsOnlineProd" ) << "Key is empty"; + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: BMTF | Faulty | Empty objectKey"); + else { + edm::LogError( "L1-O2O: L1TMuonEndCapParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonEndCapParams"; + return std::shared_ptr< L1TMuonEndCapParams >( new L1TMuonEndCapParams( *(baseSettings.product()) ) ) ; + } } std::string tscKey = objectKey.substr(0, objectKey.find(":") ); @@ -69,7 +76,12 @@ std::shared_ptr L1TMuonEndCapParamsOnlineProd::newObject(co } catch ( std::runtime_error &e ) { edm::LogError( "L1-O2O: L1TMuonEndCapParamsOnlineProd" ) << e.what(); - throw std::runtime_error("Broken key"); + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: EMTF | Faulty | Broken key"); + else { + edm::LogError( "L1-O2O: L1TMuonEndCapParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonEndCapParams"; + return std::shared_ptr< L1TMuonEndCapParams >( new L1TMuonEndCapParams( *(baseSettings.product()) ) ) ; + } } // for debugging purposes dump the configs to local files @@ -87,13 +99,23 @@ std::shared_ptr L1TMuonEndCapParamsOnlineProd::newObject(co l1t::XmlConfigParser xmlRdr; l1t::TriggerSystem trgSys; - xmlRdr.readDOMFromString( hw_payload ); - xmlRdr.readRootElement ( trgSys ); + try { + xmlRdr.readDOMFromString( hw_payload ); + xmlRdr.readRootElement ( trgSys ); - xmlRdr.readDOMFromString( algo_payload ); - xmlRdr.readRootElement ( trgSys ); + xmlRdr.readDOMFromString( algo_payload ); + xmlRdr.readRootElement ( trgSys ); - trgSys.setConfigured(); + trgSys.setConfigured(); + } catch ( std::runtime_error &e ) { + edm::LogError( "L1-O2O: L1TMuonEndCapParamsOnlineProd" ) << e.what(); + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: EMTF | Faulty | Cannot parse XMLs"); + else { + edm::LogError( "L1-O2O: L1TMuonEndCapParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonEndCapParams"; + return std::shared_ptr< L1TMuonEndCapParams >( new L1TMuonEndCapParams( *(baseSettings.product()) ) ) ; + } + } std::map conf = trgSys.getParameters("EMTF-1"); // any processor will do @@ -102,18 +124,17 @@ std::shared_ptr L1TMuonEndCapParamsOnlineProd::newObject(co strptime(core_fwv.c_str(), "%Y-%m-%d %T", &brokenTime); time_t fw_sinceEpoch = timegm(&brokenTime); - std::string pclut_v = conf["pc_lut_version"].getValueAsStr(); - strptime(pclut_v.c_str(), "%Y-%m-%d", &brokenTime); - time_t pclut_sinceEpoch = timegm(&brokenTime); - - l1t::EndCapParamsHelper data( new L1TMuonEndCapParams() ); - - data.SetFirmwareVersion( fw_sinceEpoch ); - data.SetPtAssignVersion( conf["pt_lut_version"].getValue() ); - data.SetPrimConvVersion( pclut_sinceEpoch ); +// std::string pclut_v = conf["pc_lut_version"].getValueAsStr(); +// strptime(pclut_v.c_str(), "%Y-%m-%d", &brokenTime); +// time_t pclut_sinceEpoch = timegm(&brokenTime); - std::shared_ptr< L1TMuonEndCapParams > retval( data.getWriteInstance() ); + std::shared_ptr< L1TMuonEndCapParams > retval( new L1TMuonEndCapParams() ); + + retval->firmwareVersion_ = fw_sinceEpoch; + retval->PtAssignVersion_ = conf["pt_lut_version"].getValue(); + retval->PhiMatchWindowSt1_ = 1; //pclut_sinceEpoch; + edm::LogInfo( "L1-O2O: L1TMuonEndCapParamsOnlineProd" ) << "SummaryForFunctionManager: EMTF | OK | All looks good"; return retval; } diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonGlobalParamsOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonGlobalParamsOnlineProd.cc index 68a98d792a731..4200c769b4391 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonGlobalParamsOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonGlobalParamsOnlineProd.cc @@ -14,6 +14,7 @@ class L1TMuonGlobalParamsOnlineProd : public L1ConfigOnlineProdBaseExt { private: + bool transactionSafe; public: virtual std::shared_ptr newObject(const std::string& objectKey, const L1TMuonGlobalParamsO2ORcd &record) override ; @@ -21,7 +22,9 @@ class L1TMuonGlobalParamsOnlineProd : public L1ConfigOnlineProdBaseExt(iConfig) {} +L1TMuonGlobalParamsOnlineProd::L1TMuonGlobalParamsOnlineProd(const edm::ParameterSet& iConfig) : L1ConfigOnlineProdBaseExt(iConfig) { + transactionSafe = iConfig.getParameter("transactionSafe"); +} std::shared_ptr L1TMuonGlobalParamsOnlineProd::newObject(const std::string& objectKey, const L1TMuonGlobalParamsO2ORcd &record) { using namespace edm::es; @@ -32,7 +35,12 @@ std::shared_ptr L1TMuonGlobalParamsOnlineProd::newObject(co if( objectKey.empty() ){ edm::LogError( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << "Key is empty"; - throw std::runtime_error("Empty objectKey"); + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: uGMT | Faulty | Empty objectKey"); + else { + edm::LogError( "L1-O2O: L1TMuonGlobalParams" ) << "returning unmodified prototype of L1TMuonGlobalParams"; + return std::shared_ptr< L1TMuonGlobalParams>( new L1TMuonGlobalParams( *(baseSettings.product()) ) ) ; + } } std::string tscKey = objectKey.substr(0, objectKey.find(":") ); @@ -90,10 +98,14 @@ std::shared_ptr L1TMuonGlobalParamsOnlineProd::newObject(co ) ["CONF"]; } catch ( std::runtime_error &e ) { edm::LogError( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << e.what(); - throw std::runtime_error("Broken key"); + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: uGMT | Faulty | Broken key"); + else { + edm::LogError( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonGlobalParams"; + return std::shared_ptr< L1TMuonGlobalParams >( new L1TMuonGlobalParams( *(baseSettings.product()) ) ) ; + } } - // for debugging dump the configs to local files { std::ofstream output(std::string("/tmp/").append(hw_key.substr(0,hw_key.find("/"))).append(".xml")); @@ -115,26 +127,47 @@ std::shared_ptr L1TMuonGlobalParamsOnlineProd::newObject(co l1t::XmlConfigParser xmlRdr; l1t::TriggerSystem trgSys; - // HW settings should always go first - xmlRdr.readDOMFromString( hw_payload ); - xmlRdr.readRootElement ( trgSys ); - - // now let's parse ALGO and then RS settings - for(auto &conf : algo_payloads){ - xmlRdr.readDOMFromString( conf.second ); - xmlRdr.readRootElement ( trgSys ); - } - for(auto &conf : rs_payloads){ - xmlRdr.readDOMFromString( conf.second ); - xmlRdr.readRootElement ( trgSys ); + try { + // HW settings should always go first + xmlRdr.readDOMFromString( hw_payload ); + xmlRdr.readRootElement ( trgSys ); + + // now let's parse ALGO and then RS settings + for(auto &conf : algo_payloads){ + xmlRdr.readDOMFromString( conf.second ); + xmlRdr.readRootElement ( trgSys ); + } + for(auto &conf : rs_payloads){ + xmlRdr.readDOMFromString( conf.second ); + xmlRdr.readRootElement ( trgSys ); + } + trgSys.setConfigured(); + } catch ( std::runtime_error &e ) { + edm::LogError( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << e.what(); + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: uGMT | Faulty | Cannot parse XMLs"); + else { + edm::LogError( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonGlobalParams"; + return std::shared_ptr< L1TMuonGlobalParams >( new L1TMuonGlobalParams( *(baseSettings.product()) ) ) ; + } } - trgSys.setConfigured(); L1TMuonGlobalParamsHelper m_params_helper( *(baseSettings.product()) ); - m_params_helper.loadFromOnline(trgSys); + try { + m_params_helper.loadFromOnline(trgSys); + } catch ( std::runtime_error &e ) { + edm::LogError( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << e.what(); + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: uGMT | Faulty | Cannot run helper"); + else { + edm::LogError( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonGlobalParams"; + return std::shared_ptr< L1TMuonGlobalParams >( new L1TMuonGlobalParams( *(baseSettings.product()) ) ) ; + } + } std::shared_ptr< L1TMuonGlobalParams > retval = std::make_shared< L1TMuonGlobalParams >( cast_to_L1TMuonGlobalParams(m_params_helper) ); + edm::LogInfo( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << "SummaryForFunctionManager: uGMT | OK | All looks good"; return retval ; } diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapObjectKeysOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapObjectKeysOnlineProd.cc index e9ef1a49e0ae9..034d88be8eaeb 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapObjectKeysOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapObjectKeysOnlineProd.cc @@ -4,7 +4,7 @@ class L1TMuonOverlapObjectKeysOnlineProd : public L1ObjectKeysOnlineProdBaseExt { private: - + bool transactionSafe; public: virtual void fillObjectKeys( ReturnType pL1TriggerKey ) override ; @@ -14,6 +14,7 @@ class L1TMuonOverlapObjectKeysOnlineProd : public L1ObjectKeysOnlineProdBaseExt L1TMuonOverlapObjectKeysOnlineProd::L1TMuonOverlapObjectKeysOnlineProd(const edm::ParameterSet& iConfig) : L1ObjectKeysOnlineProdBaseExt( iConfig ){ + transactionSafe = iConfig.getParameter("transactionSafe"); } @@ -23,13 +24,7 @@ void L1TMuonOverlapObjectKeysOnlineProd::fillObjectKeys( ReturnType pL1TriggerKe std::string stage2Schema = "CMS_TRG_L1_CONF" ; - if( OMTFKey.empty() ){ - edm::LogError( "L1-O2O: L1TMuonOverlapObjectKeysOnlineProd" ) << "Key is empty ... do nothing, but that'll probably crash things later on"; - return; - } - std::string tscKey = OMTFKey.substr(0, OMTFKey.find(":") ); - std::string rsKey = OMTFKey.substr( OMTFKey.find(":")+1, std::string::npos ); std::vector< std::string > queryStrings ; queryStrings.push_back( "ALGO" ) ; @@ -45,13 +40,20 @@ void L1TMuonOverlapObjectKeysOnlineProd::fillObjectKeys( ReturnType pL1TriggerKe m_omdsReader.singleAttribute(tscKey) ) ; - if( queryResult.queryFailed() || queryResult.numberRows() != 1 ){ - edm::LogError( "L1-O2O" ) << "Cannot get OMTF_KEYS.ALGO "<<" do nothing, but that'll probably crash things later on"; - return; + if( queryResult.queryFailed() || queryResult.numberRows() != 1 || !queryResult.fillVariable( "ALGO", algo_key) ){ + edm::LogError( "L1-O2O L1TMuonOverlapObjectKeysOnlineProd" ) << "Cannot get OMTF_KEYS.ALGO "; + + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: OMTF | Faulty | Broken key"); + else { + edm::LogError( "L1-O2O: L1TMuonOverlapObjectKeysOnlineProd" ) << "forcing L1TMuonOverlapParams key to be = 'OMTF_ALGO_EMPTY' (known to exist)"; + pL1TriggerKey->add( "L1TMuonOverlapParamsO2ORcd", + "L1TMuonOverlapParams", + "OMTF_ALGO_EMPTY") ; + return; + } } - if( !queryResult.fillVariable( "ALGO", algo_key) ) algo_key = ""; - // simply assign the algo key to the record pL1TriggerKey->add( "L1TMuonOverlapParamsO2ORcd", "L1TMuonOverlapParams", diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapParamsOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapParamsOnlineProd.cc index 8e72d41aebd8c..36172488a90cc 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapParamsOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapParamsOnlineProd.cc @@ -9,6 +9,8 @@ class L1TMuonOverlapParamsOnlineProd : public L1ConfigOnlineProdBaseExt { private: + bool transactionSafe; + public: virtual std::shared_ptr newObject(const std::string& objectKey, const L1TMuonOverlapParamsO2ORcd& record) override ; @@ -16,15 +18,20 @@ class L1TMuonOverlapParamsOnlineProd : public L1ConfigOnlineProdBaseExt(iConfig) {} +L1TMuonOverlapParamsOnlineProd::L1TMuonOverlapParamsOnlineProd(const edm::ParameterSet& iConfig) : L1ConfigOnlineProdBaseExt(iConfig) { + transactionSafe = iConfig.getParameter("transactionSafe"); +} std::shared_ptr L1TMuonOverlapParamsOnlineProd::newObject(const std::string& objectKey, const L1TMuonOverlapParamsO2ORcd& record) { edm::LogError( "L1-O2O" ) << "L1TMuonOverlapParams object with key " << objectKey << " not in ORCON!" ; - throw std::runtime_error("You are never supposed to get this code running!"); + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: OMTF | Faulty | You are never supposed to get OMTF online producer running!"); std::shared_ptr< L1TMuonOverlapParams > retval = std::make_shared< L1TMuonOverlapParams >(); + + edm::LogError( "L1-O2O: L1TMuonOverlapParamsOnlineProd" ) << "SummaryForFunctionManager: OMTF | Faulty | You are never supposed to get OMTF online producer running; returning empty L1TMuonOverlapParams"; return retval; } From 9324eb4f0aaa74ff2f261638991ace5f6607aa7c Mon Sep 17 00:00:00 2001 From: kkotov Date: Fri, 13 Oct 2017 15:03:43 +0200 Subject: [PATCH 008/426] A follow-up on https://github.com/cms-sw/cmssw/pull/19041#issuecomment-305444800 --- L1Trigger/L1TCommon/src/XmlConfigParser.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/L1Trigger/L1TCommon/src/XmlConfigParser.cc b/L1Trigger/L1TCommon/src/XmlConfigParser.cc index 3f0ef2a4880ab..e8c2ae3b296d5 100644 --- a/L1Trigger/L1TCommon/src/XmlConfigParser.cc +++ b/L1Trigger/L1TCommon/src/XmlConfigParser.cc @@ -338,7 +338,7 @@ void XmlConfigParser::readHwDescription(const DOMElement* element, TriggerSystem { XMLSize_t j = 0; if (roleChilds->item(j)->getNodeType() == DOMNode::TEXT_NODE) { - role = xercesc::XMLString::transcode(roleChilds->item(j)->getNodeValue()); + role = cms::xerces::toString(roleChilds->item(j)->getNodeValue()); pruneString(role); } } @@ -358,7 +358,7 @@ void XmlConfigParser::readHwDescription(const DOMElement* element, TriggerSystem { XMLSize_t j = 0; if (crateChilds->item(j)->getNodeType() == DOMNode::TEXT_NODE) { - crate = xercesc::XMLString::transcode(crateChilds->item(j)->getNodeValue()); + crate = cms::xerces::toString(crateChilds->item(j)->getNodeValue()); pruneString(crate); } } From 78613cb368a254427bc6feec550d3f8232bcb3cd Mon Sep 17 00:00:00 2001 From: kkotov Date: Mon, 16 Oct 2017 15:40:04 +0200 Subject: [PATCH 009/426] Adding README.md --- CondTools/L1TriggerExt/README.md | 1 + .../src/{L1MenuReader.cc => L1MenuViewer.cc} | 12 +- .../Utilities/src/L1TCaloParamsViewer.cc | 337 ++++++++++++++++-- .../src/L1TMuonBarrelParamsViewer.cc | 181 ++++++++++ ...Viewer.cc => L1TMuonEndCapParamsViewer.cc} | 10 +- ...Writer.cc => L1TMuonEndCapParamsWriter.cc} | 12 +- ...eader.cc => L1TMuonOverlapParamsViewer.cc} | 22 +- ...riter.cc => L1TMuonOverlapParamsWriter.cc} | 12 +- ...yExtReader.cc => L1TriggerKeyExtViewer.cc} | 12 +- ...Reader.cc => L1TriggerKeyListExtViewer.cc} | 4 +- .../test/{caloDump.py => caloL2Dump.py} | 0 11 files changed, 541 insertions(+), 62 deletions(-) rename L1TriggerConfig/Utilities/src/{L1MenuReader.cc => L1MenuViewer.cc} (85%) create mode 100644 L1TriggerConfig/Utilities/src/L1TMuonBarrelParamsViewer.cc rename L1TriggerConfig/Utilities/src/{L1TMuonEndcapViewer.cc => L1TMuonEndCapParamsViewer.cc} (85%) rename L1TriggerConfig/Utilities/src/{L1TMuonEndcapWriter.cc => L1TMuonEndCapParamsWriter.cc} (81%) rename L1TriggerConfig/Utilities/src/{L1TMuonOverlapReader.cc => L1TMuonOverlapParamsViewer.cc} (92%) rename L1TriggerConfig/Utilities/src/{L1TMuonOverlapWriter.cc => L1TMuonOverlapParamsWriter.cc} (74%) rename L1TriggerConfig/Utilities/src/{L1TriggerKeyExtReader.cc => L1TriggerKeyExtViewer.cc} (86%) rename L1TriggerConfig/Utilities/src/{L1TriggerKeyListExtReader.cc => L1TriggerKeyListExtViewer.cc} (93%) rename L1TriggerConfig/Utilities/test/{caloDump.py => caloL2Dump.py} (100%) diff --git a/CondTools/L1TriggerExt/README.md b/CondTools/L1TriggerExt/README.md index 8f2615bac5cf9..60f07949f7d57 100644 --- a/CondTools/L1TriggerExt/README.md +++ b/CondTools/L1TriggerExt/README.md @@ -25,3 +25,4 @@ but is not used or intended to be used. So if you browse the code, you can ignore files containing the RS in the name. Same applies to all but [runL1-O2O-iov.sh](https://github.com/cms-sw/cmssw/blob/master/CondTools/L1TriggerExt/scripts/runL1-O2O-iov.sh) scripts. + diff --git a/L1TriggerConfig/Utilities/src/L1MenuReader.cc b/L1TriggerConfig/Utilities/src/L1MenuViewer.cc similarity index 85% rename from L1TriggerConfig/Utilities/src/L1MenuReader.cc rename to L1TriggerConfig/Utilities/src/L1MenuViewer.cc index 5ca448b95690a..13d1ab2c5f739 100644 --- a/L1TriggerConfig/Utilities/src/L1MenuReader.cc +++ b/L1TriggerConfig/Utilities/src/L1MenuViewer.cc @@ -18,15 +18,15 @@ #include using namespace std; -class L1MenuReader : public edm::EDAnalyzer { +class L1MenuViewer : public edm::EDAnalyzer { public: - virtual void analyze(const edm::Event&, const edm::EventSetup&); + void analyze(const edm::Event&, const edm::EventSetup&) override ; - explicit L1MenuReader(const edm::ParameterSet&) : edm::EDAnalyzer(){} - virtual ~L1MenuReader(void){} + explicit L1MenuViewer(const edm::ParameterSet&) : edm::EDAnalyzer(){} + ~L1MenuViewer(void) override {} }; -void L1MenuReader::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup){ +void L1MenuViewer::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup){ edm::ESHandle handle1; evSetup.get().get( handle1 ) ; @@ -58,5 +58,5 @@ void L1MenuReader::analyze(const edm::Event& iEvent, const edm::EventSetup& evSe #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/ModuleFactory.h" -DEFINE_FWK_MODULE(L1MenuReader); +DEFINE_FWK_MODULE(L1MenuViewer); diff --git a/L1TriggerConfig/Utilities/src/L1TCaloParamsViewer.cc b/L1TriggerConfig/Utilities/src/L1TCaloParamsViewer.cc index 788cf67c21f23..e02e8e1df97dc 100644 --- a/L1TriggerConfig/Utilities/src/L1TCaloParamsViewer.cc +++ b/L1TriggerConfig/Utilities/src/L1TCaloParamsViewer.cc @@ -7,6 +7,7 @@ #include "FWCore/Framework/interface/ESHandle.h" #include "CondFormats/DataRecord/interface/L1TCaloParamsRcd.h" +#include "CondFormats/DataRecord/interface/L1TCaloStage2ParamsRcd.h" #include "CondFormats/L1TObjects/interface/CaloParams.h" #include "L1Trigger/L1TCalorimeter/interface/CaloParamsHelper.h" #include @@ -15,26 +16,58 @@ class L1TCaloParamsViewer: public edm::EDAnalyzer { private: bool printPUSParams; bool printTauCalibLUT; + bool printTauCompressLUT; bool printJetCalibLUT; bool printJetCalibPar; + bool printJetPUSPar; + bool printJetCompressPtLUT; + bool printJetCompressEtaLUT; bool printEgCalibLUT; bool printEgIsoLUT; + bool printEtSumMetPUSLUT; + bool printHfSF; + bool printHcalSF; + bool printEcalSF; + bool printEtSumEttPUSLUT; + bool printEtSumEcalSumPUSLUT; + bool printEtSumXCalibrationLUT; + bool printEtSumYCalibrationLUT; + bool printEtSumEttCalibrationLUT; + bool printEtSumEcalSumCalibrationLUT; + + bool useStage2Rcd; std::string hash(void *buf, size_t len) const ; public: - virtual void analyze(const edm::Event&, const edm::EventSetup&); + void analyze(const edm::Event&, const edm::EventSetup&) override ; explicit L1TCaloParamsViewer(const edm::ParameterSet& pset) : edm::EDAnalyzer(){ - printPUSParams = pset.getUntrackedParameter("printPUSParams", false); - printTauCalibLUT = pset.getUntrackedParameter("printTauCalibLUT",false); - printJetCalibLUT = pset.getUntrackedParameter("printJetCalibLUT",false); - printJetCalibPar = pset.getUntrackedParameter("printJetCalibParams",false); - printEgCalibLUT = pset.getUntrackedParameter("printEgCalibLUT", false); - printEgIsoLUT = pset.getUntrackedParameter("printEgIsoLUT", false); + printPUSParams = pset.getUntrackedParameter("printPUSParams", false); + printTauCalibLUT = pset.getUntrackedParameter("printTauCalibLUT",false); + printTauCompressLUT = pset.getUntrackedParameter("printTauCompressLUT",false); + printJetCalibLUT = pset.getUntrackedParameter("printJetCalibLUT",false); + printJetCalibPar = pset.getUntrackedParameter("printJetCalibParams",false); + printJetPUSPar = pset.getUntrackedParameter("printJetPUSPar", false); + printJetCompressPtLUT = pset.getUntrackedParameter("printJetCompressPtLUT", false); + printJetCompressEtaLUT = pset.getUntrackedParameter("printJetCompressEtaLUT", false); + printEgCalibLUT = pset.getUntrackedParameter("printEgCalibLUT", false); + printEgIsoLUT = pset.getUntrackedParameter("printEgIsoLUT", false); + printEtSumMetPUSLUT = pset.getUntrackedParameter("printEtSumMetPUSLUT", false); + printHfSF = pset.getUntrackedParameter("printHfSF", false); + printHcalSF = pset.getUntrackedParameter("printHcalSF", false); + printEcalSF = pset.getUntrackedParameter("printEcalSF", false); + printEtSumEttPUSLUT = pset.getUntrackedParameter("printEtSumEttPUSLUT", false); + printEtSumEcalSumPUSLUT = pset.getUntrackedParameter("printEtSumEcalSumPUSLUT", false); + printEtSumXCalibrationLUT = pset.getUntrackedParameter("printEtSumXCalibrationLUT", false); + printEtSumYCalibrationLUT = pset.getUntrackedParameter("printEtSumYCalibrationLUT", false); + printEtSumEttCalibrationLUT = pset.getUntrackedParameter("printEtSumEttCalibrationLUT", false); + printEtSumEcalSumCalibrationLUT = pset.getUntrackedParameter("printEtSumEcalSumCalibrationLUT", false); + + useStage2Rcd = pset.getUntrackedParameter("useStage2Rcd", false); } - virtual ~L1TCaloParamsViewer(void){} + ~L1TCaloParamsViewer(void) override {} }; #include @@ -67,7 +100,11 @@ std::string L1TCaloParamsViewer::hash(void *buf, size_t len) const { void L1TCaloParamsViewer::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup){ edm::ESHandle handle1; - evSetup.get().get( handle1 ) ; + if( useStage2Rcd ) + evSetup.get().get( handle1 ) ; + else + evSetup.get().get( handle1 ) ; + boost::shared_ptr ptr(new l1t::CaloParams(*(handle1.product ()))); l1t::CaloParamsHelper *ptr1 = 0; @@ -93,16 +130,24 @@ void L1TCaloParamsViewer::analyze(const edm::Event& iEvent, const edm::EventSetu cout<<" regionPUSType= "<regionPUSType()<regionPUSParams().size()<<"] "; float pusParams[ptr1->regionPUSParams().size()]; - for(unsigned int i=0; iregionPUSParams().size(); i++){ pusParams[i] = ceil(2*ptr1->regionPUSParams()[i]); if( printPUSParams ) cout<<" "<regionPUSParams().size() ) cout << hash(pusParams, sizeof(float)*ptr1->regionPUSParams().size()) << endl; else cout<regionPUSLUT()->empty() ){ + cout<<" regionPUSLUT= ["<regionPUSLUT()->maxSize()<<"] "; + int regionPUSLUT[ptr1->regionPUSLUT()->maxSize()]; + for(unsigned int i=0; iregionPUSLUT()->maxSize(); i++) regionPUSLUT[i] = ptr1->regionPUSLUT()->data(i); + cout << hash( regionPUSLUT, sizeof(int)*ptr1->regionPUSLUT()->maxSize() ) << endl; + } else { + cout<<" regionPUSLUT= [0]"<egShapeIdLUT()->maxSize()<<"] "<egShapeIdLUT()->maxSize()]; @@ -173,6 +218,18 @@ void L1TCaloParamsViewer::analyze(const edm::Event& iEvent, const edm::EventSetu } else { cout<<" egIsoLUT= [0]"<egIsolationLUT2()->empty() ){ + cout<<" egIsoLUT2= ["<egIsolationLUT2()->maxSize()<<"] "<egIsolationLUT2()->maxSize()]; + for(unsigned int i=0; iegIsolationLUT2()->maxSize(); i++) egIsolation2[i] = ptr1->egIsolationLUT2()->data(i); + cout << hash( egIsolation2, sizeof(int)*ptr1->egIsolationLUT2()->maxSize() ) << endl; + if( printEgIsoLUT ) + for(unsigned int i=0; iegIsolationLUT2()->maxSize(); i++) + cout<egCalibrationLUT()->maxSize()<<"] "<egCalibrationLUT()->maxSize()]; @@ -227,6 +284,23 @@ void L1TCaloParamsViewer::analyze(const edm::Event& iEvent, const edm::EventSetu } else { cout<<" tauIsoLUT= [0]"<tauIsolationLUT2()->empty() ){ + cout<<" tauIsoLUT2= ["<tauIsolationLUT2()->maxSize()<<"] "<tauIsolationLUT2()->maxSize()]; + for(unsigned int i=0; itauIsolationLUT2()->maxSize(); i++) tauIsolation2[i] = ptr1->tauIsolationLUT2()->data(i); + cout << hash( tauIsolation2, sizeof(int)*ptr1->tauIsolationLUT2()->maxSize() ) << endl; + } else { + cout<<" tauIsoLUT2= [0]"<tauTrimmingShapeVetoLUT()->empty() ){ + cout<<" tauTrimmingShapeVetoLUT=["<tauTrimmingShapeVetoLUT()->maxSize()<<"] "<tauTrimmingShapeVetoLUT()->maxSize()]; + for(unsigned int i=0; itauTrimmingShapeVetoLUT()->maxSize(); i++) tauTrimmingShapeVetoLUT[i] = ptr1->tauTrimmingShapeVetoLUT()->data(i); + cout << hash( tauTrimmingShapeVetoLUT, sizeof(int)*ptr1->tauTrimmingShapeVetoLUT()->maxSize() ) << endl; + } else { + cout<<" tauTrimmingShapeVetoLUT=[0]"<tauCalibrationLUT()->empty() ){ cout<<" tauCalibrationLUT= ["<tauCalibrationLUT()->maxSize()<<"] "<tauCalibrationParams().size()<<"] "<tauCalibrationParams().size()]; + for(unsigned int i=0; itauCalibrationParams().size(); i++) tauCalibrationParams[i] = ptr1->tauCalibrationParams()[i]; + + if( ptr1->tauCalibrationParams().size() ) + cout << hash( tauCalibrationParams, sizeof(double)*ptr1->tauCalibrationParams().size() ) << endl; + else cout<tauCompressLUT()->empty() ){ + cout<<" tauCompressLUT= ["<tauCompressLUT()->maxSize()<<"] "<tauCompressLUT()->maxSize()]; + for(unsigned int i=0; itauCompressLUT()->maxSize(); i++) + tauCompress[i] = ptr1->tauCompressLUT()->data(i); + cout << hash( tauCompress, sizeof(int)*ptr1->tauCompressLUT()->maxSize() ) << endl; + + if( printTauCompressLUT ) + for(unsigned int i=0; itauCompressLUT()->maxSize(); i++) + cout<tauEtToHFRingEtLUT()->empty() ){ cout<<" tauEtToHFRingEtLUT= ["<tauEtToHFRingEtLUT()->maxSize()<<"] "<tauEtToHFRingEtLUT()->maxSize()]; @@ -267,12 +368,13 @@ void L1TCaloParamsViewer::analyze(const edm::Event& iEvent, const edm::EventSetu cout<<" jetLsb= "<jetLsb()<jetCalibrationParams().size()<<"] "<jetCalibrationParams().size()]; // deliberately drop double precision for(unsigned int i=0; ijetCalibrationParams().size(); i++) jetCalibrationParams[i] = ptr1->jetCalibrationParams()[i]; - if( ptr1->jetCalibrationParams().size() ){ cout << hash( jetCalibrationParams, sizeof(float)*ptr1->jetCalibrationParams().size() ) << endl; if( printJetCalibPar ) @@ -281,6 +383,18 @@ void L1TCaloParamsViewer::analyze(const edm::Event& iEvent, const edm::EventSetu } else cout<jetPUSParams().size()<<"] "<jetPUSParams().size()]; // deliberately drop double precision + for(unsigned int i=0; ijetPUSParams().size(); i++) jetPUSParams[i] = ptr1->jetPUSParams()[i]; + if( ptr1->jetPUSParams().size() ){ + cout << hash( jetPUSParams, sizeof(float)*ptr1->jetPUSParams().size() ) << endl; + if( printJetPUSPar ) + for(unsigned int i=0; ijetPUSParams().size(); i++) + cout<jetCalibrationLUT()->empty() ){ cout<<" jetCalibrationLUT= ["<jetCalibrationLUT()->maxSize()<<"] "<jetCalibrationLUT()->maxSize()]; @@ -297,6 +411,39 @@ void L1TCaloParamsViewer::analyze(const edm::Event& iEvent, const edm::EventSetu cout<<" jetCalibrationLUT= [0]"<jetCompressPtLUT()->empty() ){ + cout<<" jetCompressPtLUT= ["<jetCompressPtLUT()->maxSize()<<"] "<jetCompressPtLUT()->maxSize()]; + for(unsigned int i=0; ijetCompressPtLUT()->maxSize(); i++) + jetCompressPt[i] = ptr1->jetCompressPtLUT()->data(i); + + cout << hash( jetCompressPt, sizeof(int)*ptr1->jetCompressPtLUT()->maxSize() ) << endl; + + if( printJetCompressPtLUT ) + for(unsigned int i=0; ijetCompressPtLUT()->maxSize(); i++) + cout<jetCompressEtaLUT()->empty() ){ + cout<<" jetCompressEtaLUT= ["<jetCompressEtaLUT()->maxSize()<<"] "<jetCompressEtaLUT()->maxSize()]; + for(unsigned int i=0; ijetCompressEtaLUT()->maxSize(); i++) + jetCompressEta[i] = ptr1->jetCompressEtaLUT()->data(i); + + cout << hash( jetCompressEta, sizeof(int)*ptr1->jetCompressEtaLUT()->maxSize() ) << endl; + + if( printJetCompressEtaLUT ) + for(unsigned int i=0; ijetCompressEtaLUT()->maxSize(); i++) + cout<etSumEtaMax(i)>0.001; i++,nEntities++) cout<<(i==0?"":",")<etSumEtaMax(i); cout<<"]"<etSumEtThreshold(i); cout<<"]"<etSumBypassEcalSumPUS() << endl; + + cout<<" etSumMetPUSType= " << ptr1->etSumMetPUSType() << endl; + cout<<" etSumEttPUSType= " << ptr1->etSumEttPUSType() << endl; + cout<<" etSumEcalSumPUSType= " << ptr1->etSumEcalSumPUSType() << endl; + cout<<" etSumXCalibrationType= " << ptr1->etSumXCalibrationType() << endl; + cout<<" etSumYCalibrationType= " << ptr1->etSumYCalibrationType() << endl; + cout<<" etSumEttCalibrationType=" << ptr1->etSumEttCalibrationType() << endl; + cout<<" etSumEcalSumCalibrationType=" << ptr1->etSumEcalSumCalibrationType() << endl; + + if( !ptr1->etSumMetPUSLUT()->empty() ){ + cout<<" etSumMetPUSLUT= ["<etSumMetPUSLUT()->maxSize()<<"] "<etSumMetPUSLUT()->maxSize()]; + for(unsigned int i=0; ietSumMetPUSLUT()->maxSize(); i++) + etSumMetPUSLUT[i] = ptr1->etSumMetPUSLUT()->data(i); + + cout << hash( etSumMetPUSLUT, sizeof(int)*ptr1->etSumMetPUSLUT()->maxSize() ) << endl; + + if( printEtSumMetPUSLUT ) + for(unsigned int i=0; ietSumMetPUSLUT()->maxSize(); i++) + cout<etSumEttPUSLUT()->empty() ){ + cout<<" etSumEttPUSLUT= ["<etSumEttPUSLUT()->maxSize()<<"] "<etSumEttPUSLUT()->maxSize()]; + for(unsigned int i=0; ietSumEttPUSLUT()->maxSize(); i++) + etSumEttPUSLUT[i] = ptr1->etSumEttPUSLUT()->data(i); + + cout << hash( etSumEttPUSLUT, sizeof(int)*ptr1->etSumEttPUSLUT()->maxSize() ) << endl; + + if( printEtSumEttPUSLUT ) + for(unsigned int i=0; ietSumEttPUSLUT()->maxSize(); i++) + cout<etSumEcalSumPUSLUT()->empty() ){ + cout<<" etSumEcalSumPUSLUT= ["<etSumEcalSumPUSLUT()->maxSize()<<"] "<etSumEcalSumPUSLUT()->maxSize()]; + for(unsigned int i=0; ietSumEcalSumPUSLUT()->maxSize(); i++) + etSumEcalSumPUSLUT[i] = ptr1->etSumEcalSumPUSLUT()->data(i); + + cout << hash( etSumEcalSumPUSLUT, sizeof(int)*ptr1->etSumEcalSumPUSLUT()->maxSize() ) << endl; + + if( printEtSumEcalSumPUSLUT ) + for(unsigned int i=0; ietSumEcalSumPUSLUT()->maxSize(); i++) + cout<etSumXCalibrationLUT()->empty() ){ + cout<<" etSumXCalibrationLUT= ["<etSumXCalibrationLUT()->maxSize()<<"] "<etSumXCalibrationLUT()->maxSize()]; + for(unsigned int i=0; ietSumXCalibrationLUT()->maxSize(); i++) + etSumXCalibrationLUT[i] = ptr1->etSumXCalibrationLUT()->data(i); + + cout << hash( etSumXCalibrationLUT, sizeof(int)*ptr1->etSumXCalibrationLUT()->maxSize() ) << endl; + + if( printEtSumXCalibrationLUT ) + for(unsigned int i=0; ietSumXCalibrationLUT()->maxSize(); i++) + cout<etSumYCalibrationLUT()->empty() ){ + cout<<" etSumYCalibrationLUT= ["<etSumYCalibrationLUT()->maxSize()<<"] "<etSumYCalibrationLUT()->maxSize()]; + for(unsigned int i=0; ietSumYCalibrationLUT()->maxSize(); i++) + etSumYCalibrationLUT[i] = ptr1->etSumYCalibrationLUT()->data(i); + + cout << hash( etSumYCalibrationLUT, sizeof(int)*ptr1->etSumYCalibrationLUT()->maxSize() ) << endl; + + if( printEtSumYCalibrationLUT ) + for(unsigned int i=0; ietSumYCalibrationLUT()->maxSize(); i++) + cout<etSumEttCalibrationLUT()->empty() ){ + cout<<" etSumEttCalibrationLUT= ["<etSumEttCalibrationLUT()->maxSize()<<"] "<etSumEttCalibrationLUT()->maxSize()]; + for(unsigned int i=0; ietSumEttCalibrationLUT()->maxSize(); i++) + etSumEttCalibrationLUT[i] = ptr1->etSumEttCalibrationLUT()->data(i); + + cout << hash( etSumEttCalibrationLUT, sizeof(int)*ptr1->etSumEttCalibrationLUT()->maxSize() ) << endl; + + if( printEtSumEttCalibrationLUT ) + for(unsigned int i=0; ietSumEttCalibrationLUT()->maxSize(); i++) + cout<etSumEcalSumCalibrationLUT()->empty() ){ + cout<<" etSumEcalSumCalibrationLUT=["<etSumEttCalibrationLUT()->maxSize()<<"] "<etSumEcalSumCalibrationLUT()->maxSize()]; + for(unsigned int i=0; ietSumEcalSumCalibrationLUT()->maxSize(); i++) + etSumEcalSumCalibrationLUT[i] = ptr1->etSumEcalSumCalibrationLUT()->data(i); + + cout << hash( etSumEcalSumCalibrationLUT, sizeof(int)*ptr1->etSumEcalSumCalibrationLUT()->maxSize() ) << endl; + + if( printEtSumEcalSumCalibrationLUT ) + for(unsigned int i=0; ietSumEcalSumCalibrationLUT()->maxSize(); i++) + cout<centralityLUT()->maxSize(); i++) cout<<(i==0?"":",")<centralityLUT()->data(i); cout<<"]"< ecalSF = ptr1->layer1ECalScaleFactors(); cout<<" layer1ECalScaleFactors= ["<< ecalSF.size()<<"] "< hcalSF = ptr1->layer1HCalScaleFactors(); cout<<" layer1HCalScaleFactors= ["<< hcalSF.size()<<"] "< hfSF = ptr1->layer1HFScaleFactors(); cout<<" layer1HFScaleFactors= ["<< hfSF.size()<<"] "< ecalScaleET = ptr1->layer1ECalScaleETBins(); cout<<" layer1ECalScaleETBins= ["; for(unsigned int i=0; i hfScaleET = ptr1->layer1HFScaleETBins(); cout<<" layer1HFScaleETBins= ["; for(unsigned int i=0; i layer1ECalScalePhi = ptr1->layer1ECalScalePhiBins(); + cout<<" layer1ECalScalePhi= ["; for(unsigned int i=0; i layer1HCalScalePhi = ptr1->layer1HCalScalePhiBins(); + cout<<" layer1HCalScalePhi= ["; for(unsigned int i=0; i layer1HFScalePhiBins = ptr1->layer1HFScalePhiBins(); + cout<<" layer1HFScalePhiBins= ["; for(unsigned int i=0; i layer1SecondStageLUT = ptr1->layer1SecondStageLUT(); +// cout<<" layer1HFScalePhiBins= ["; for(unsigned int i=0; i +#include + +#include "FWCore/Framework/interface/EDAnalyzer.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ESHandle.h" + +#include "L1Trigger/L1TMuonBarrel/interface/L1TMuonBarrelParamsHelper.h" +#include "CondFormats/DataRecord/interface/L1TMuonBarrelParamsRcd.h" +#include "CondFormats/L1TObjects/interface/L1TMuonBarrelParams.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" +#include "CondCore/CondDB/interface/Session.h" + +#include +using namespace std; + +class L1TMuonBarrelParamsViewer: public edm::EDAnalyzer { +private: + std::string hash(void *buf, size_t len) const ; + bool printPtaThreshold; + +public: + virtual void analyze(const edm::Event&, const edm::EventSetup&); + + explicit L1TMuonBarrelParamsViewer(const edm::ParameterSet&) : edm::EDAnalyzer(){ + printPtaThreshold = false; + } + virtual ~L1TMuonBarrelParamsViewer(void){} +}; + + +#include +#include +#include +using namespace std; + +std::string L1TMuonBarrelParamsViewer::hash(void *buf, size_t len) const { + char tmp[SHA_DIGEST_LENGTH*2+1]; + bzero(tmp,sizeof(tmp)); + SHA_CTX ctx; + if( !SHA1_Init( &ctx ) ) + throw cms::Exception("L1TMuonBarrelParamsViewer::hash")<<"SHA1 initialization error"; + + if( !SHA1_Update( &ctx, buf, len ) ) + throw cms::Exception("L1TMuonBarrelParamsViewer::hash")<<"SHA1 processing error"; + + unsigned char hash[SHA_DIGEST_LENGTH]; + if( !SHA1_Final(hash, &ctx) ) + throw cms::Exception("L1TMuonBarrelParamsViewer::hash")<<"SHA1 finalization error"; + + // re-write bytes in hex + for(unsigned int i=0; i<20; i++) + ::sprintf(&tmp[i*2], "%02x", hash[i]); + + tmp[20*2] = 0; + return std::string(tmp); +} + + +void L1TMuonBarrelParamsViewer::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup){ + + edm::ESHandle handle1; + evSetup.get().get( handle1 ) ; + boost::shared_ptr ptr(new L1TMuonBarrelParams(*(handle1.product ()))); + + L1TMuonBarrelParamsHelper *ptr1 = (L1TMuonBarrelParamsHelper*)ptr.get(); + + cout << "AssLUTPath: " << ptr1->AssLUTPath() << endl; + + // typedef std::map > LUT; + + for(size_t l=0; lpta_lut().size(); l++){ + const LUT &lut = ptr1->pta_lut()[l]; + if( !lut.empty() ){ + cout<<" pta_lut[" << setw(2) << l << "]= ["< &p : lut) lut_[i++] = p.first*0xFFFF + p.second; + cout << hash( lut_, sizeof(int)*lut.size() ) << endl; + } else { + cout<<" pta_lut[" << setw(2) << l << "]= [0] "<pta_threshold().size() << "] "<pta_threshold().size()]; + for(unsigned int i=0; ipta_threshold().size(); i++){ + pta_threshold[i] = ptr1->pta_threshold()[i]; + if( printPtaThreshold ) cout<<" "<pta_threshold().size() ) + cout << hash(pta_threshold, sizeof(int)*ptr1->pta_threshold().size()) << endl; + else cout<phi_lut().size(); l++){ + const LUT &lut = ptr1->phi_lut()[l]; + if( !lut.empty() ){ + cout<<" phi_lut[" << l << "]= ["< &p : lut) lut_[i++] = p.first*0xFFFF + p.second; + cout << hash( lut_, sizeof(int)*lut.size() ) << endl; + } else { + cout<<" phi_lut[" << l << "]= [0] "<ext_lut().size(); l++){ + const LUT &lut = (ptr1->ext_lut()[l]).low; + if( !lut.empty() ){ + cout<<" ext_lut_low[" << setw(2) << l << "]= ["< &p : lut) lut_[i++] = p.first*0xFFFF + p.second; + cout << hash( lut_, sizeof(int)*lut.size() ) << endl; + } else { + cout<<" ext_lut_low[" << setw(2) << l << "]= [0] "<ext_lut().size(); l++){ + const LUT &lut = (ptr1->ext_lut()[l]).high; + if( !lut.empty() ){ + cout<<" ext_lut_high[" << setw(2) << l << "]= ["< &p : lut) lut_[i++] = p.first*0xFFFF + p.second; + cout << hash( lut_, sizeof(int)*lut.size() ) << endl; + } else { + cout<<" ext_lut_high[" << setw(2) << l << "]= [0] "< qpLUT; + for(const pair< pair, pair> > item : ptr1->qp_lut() ){ + cout << " qp_lut[" << item.first.first << "," << item.first.second << "]= " + << item.second.first << ", [" << item.second.second.size() << "] " << flush; + if( !item.second.second.empty() ){ + int lut_[item.second.second.size()]; + for(size_t i=0; i > etaLUT; + for(const pair &item : ptr1->eta_lut()) + cout << " eta_lut[" << item.first << "]= " << endl << item.second << endl; + + cout << "PT_Assignment_nbits_Phi= " << ptr1->get_PT_Assignment_nbits_Phi() << endl; + cout << "PT_Assignment_nbits_PhiB= " << ptr1->get_PT_Assignment_nbits_PhiB() << endl; + cout << "PHI_Assignment_nbits_Phi= " << ptr1->get_PHI_Assignment_nbits_Phi() << endl; + cout << "PHI_Assignment_nbits_PhiB= " << ptr1->get_PHI_Assignment_nbits_PhiB() << endl; + cout << "Extrapolation_nbits_Phi= " << ptr1->get_Extrapolation_nbits_Phi() << endl; + cout << "Extrapolation_nbits_PhiB= " << ptr1->get_Extrapolation_nbits_PhiB() << endl; + cout << "BX_min= " << ptr1->get_BX_min() << endl; + cout << "BX_max= " << ptr1->get_BX_max() << endl; + cout << "Extrapolation_Filter= " << ptr1->get_Extrapolation_Filter() << endl; + cout << "OutOfTime_Filter_Window= " << ptr1->get_OutOfTime_Filter_Window() << endl; + + cout << boolalpha; + cout << "OutOfTime_Filter= " << ptr1->get_OutOfTime_Filter() << endl; + cout << "Open_LUTs= " << ptr1->get_Open_LUTs() << endl; + cout << "EtaTrackFinder= " << ptr1->get_EtaTrackFinder() << endl; + cout << "Extrapolation_21= " << ptr1->get_Extrapolation_21() << endl; + cout << "DisableNewAlgo= " << ptr1->get_DisableNewAlgo() << endl; + cout << noboolalpha; + + // FW version + cout << "fwVersion= " << ptr1->fwVersion() << endl; + cout << "version= " << ptr1->version_ << endl; +} + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/ModuleFactory.h" + +DEFINE_FWK_MODULE(L1TMuonBarrelParamsViewer); + diff --git a/L1TriggerConfig/Utilities/src/L1TMuonEndcapViewer.cc b/L1TriggerConfig/Utilities/src/L1TMuonEndCapParamsViewer.cc similarity index 85% rename from L1TriggerConfig/Utilities/src/L1TMuonEndcapViewer.cc rename to L1TriggerConfig/Utilities/src/L1TMuonEndCapParamsViewer.cc index 2a6e668590465..d47b355946918 100644 --- a/L1TriggerConfig/Utilities/src/L1TMuonEndcapViewer.cc +++ b/L1TriggerConfig/Utilities/src/L1TMuonEndCapParamsViewer.cc @@ -20,15 +20,15 @@ #include using namespace std; -class L1TMuonEndcapViewer: public edm::EDAnalyzer { +class L1TMuonEndCapParamsViewer: public edm::EDAnalyzer { public: void analyze(const edm::Event&, const edm::EventSetup&) override; - explicit L1TMuonEndcapViewer(const edm::ParameterSet&) : edm::EDAnalyzer(){} - ~L1TMuonEndcapViewer(void) override{} + explicit L1TMuonEndCapParamsViewer(const edm::ParameterSet&) : edm::EDAnalyzer(){} + ~L1TMuonEndCapParamsViewer(void) override{} }; -void L1TMuonEndcapViewer::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup){ +void L1TMuonEndCapParamsViewer::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup){ edm::ESHandle handle1; evSetup.get().get( handle1 ) ; @@ -56,5 +56,5 @@ void L1TMuonEndcapViewer::analyze(const edm::Event& iEvent, const edm::EventSetu #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/ModuleFactory.h" -DEFINE_FWK_MODULE(L1TMuonEndcapViewer); +DEFINE_FWK_MODULE(L1TMuonEndCapParamsViewer); diff --git a/L1TriggerConfig/Utilities/src/L1TMuonEndcapWriter.cc b/L1TriggerConfig/Utilities/src/L1TMuonEndCapParamsWriter.cc similarity index 81% rename from L1TriggerConfig/Utilities/src/L1TMuonEndcapWriter.cc rename to L1TriggerConfig/Utilities/src/L1TMuonEndCapParamsWriter.cc index 941e3b7d4bf4e..a88169f631d80 100644 --- a/L1TriggerConfig/Utilities/src/L1TMuonEndcapWriter.cc +++ b/L1TriggerConfig/Utilities/src/L1TMuonEndCapParamsWriter.cc @@ -16,19 +16,19 @@ #include "FWCore/ServiceRegistry/interface/Service.h" #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" -class L1TMuonEndcapWriter : public edm::EDAnalyzer { +class L1TMuonEndCapParamsWriter : public edm::EDAnalyzer { private: bool isO2Opayload; public: - void analyze(const edm::Event&, const edm::EventSetup&) override; + void analyze(const edm::Event&, const edm::EventSetup&) override ; - explicit L1TMuonEndcapWriter(const edm::ParameterSet &pset) : edm::EDAnalyzer(){ + explicit L1TMuonEndCapParamsWriter(const edm::ParameterSet &pset) : edm::EDAnalyzer(){ isO2Opayload = pset.getUntrackedParameter("isO2Opayload", false); } - ~L1TMuonEndcapWriter(void) override{} + ~L1TMuonEndCapParamsWriter(void) override {} }; -void L1TMuonEndcapWriter::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup){ +void L1TMuonEndCapParamsWriter::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup){ edm::ESHandle handle1; if( isO2Opayload ) @@ -50,5 +50,5 @@ void L1TMuonEndcapWriter::analyze(const edm::Event& iEvent, const edm::EventSetu #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/ModuleFactory.h" -DEFINE_FWK_MODULE(L1TMuonEndcapWriter); +DEFINE_FWK_MODULE(L1TMuonEndCapParamsWriter); diff --git a/L1TriggerConfig/Utilities/src/L1TMuonOverlapReader.cc b/L1TriggerConfig/Utilities/src/L1TMuonOverlapParamsViewer.cc similarity index 92% rename from L1TriggerConfig/Utilities/src/L1TMuonOverlapReader.cc rename to L1TriggerConfig/Utilities/src/L1TMuonOverlapParamsViewer.cc index cf60a6e91ab80..ee7bcf4a56741 100644 --- a/L1TriggerConfig/Utilities/src/L1TMuonOverlapReader.cc +++ b/L1TriggerConfig/Utilities/src/L1TMuonOverlapParamsViewer.cc @@ -18,17 +18,17 @@ #include using namespace std; -class L1TMuonOverlapReader: public edm::EDAnalyzer { +class L1TMuonOverlapParamsViewer: public edm::EDAnalyzer { private: bool printLayerMap; public: - virtual void analyze(const edm::Event&, const edm::EventSetup&); + void analyze(const edm::Event&, const edm::EventSetup&) override ; string hash(void *buf, size_t len) const ; - explicit L1TMuonOverlapReader(const edm::ParameterSet& pset) : edm::EDAnalyzer(){ + explicit L1TMuonOverlapParamsViewer(const edm::ParameterSet& pset) : edm::EDAnalyzer(){ printLayerMap = pset.getUntrackedParameter("printLayerMap", false); } - virtual ~L1TMuonOverlapReader(void){} + ~L1TMuonOverlapParamsViewer(void) override {} }; @@ -37,19 +37,19 @@ class L1TMuonOverlapReader: public edm::EDAnalyzer { #include using namespace std; -string L1TMuonOverlapReader::hash(void *buf, size_t len) const { +string L1TMuonOverlapParamsViewer::hash(void *buf, size_t len) const { char tmp[SHA_DIGEST_LENGTH*2+1]; bzero(tmp,sizeof(tmp)); SHA_CTX ctx; if( !SHA1_Init( &ctx ) ) - throw cms::Exception("L1TCaloParamsReader::hash")<<"SHA1 initialization error"; + throw cms::Exception("L1TCaloParamsViewer::hash")<<"SHA1 initialization error"; if( !SHA1_Update( &ctx, buf, len ) ) - throw cms::Exception("L1TCaloParamsReader::hash")<<"SHA1 processing error"; + throw cms::Exception("L1TCaloParamsViewer::hash")<<"SHA1 processing error"; unsigned char hash[SHA_DIGEST_LENGTH]; if( !SHA1_Final(hash, &ctx) ) - throw cms::Exception("L1TCaloParamsReader::hash")<<"SHA1 finalization error"; + throw cms::Exception("L1TCaloParamsViewer::hash")<<"SHA1 finalization error"; // re-write bytes in hex for(unsigned int i=0; i<20; i++) @@ -59,14 +59,14 @@ string L1TMuonOverlapReader::hash(void *buf, size_t len) const { return string(tmp); } -void L1TMuonOverlapReader::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup){ +void L1TMuonOverlapParamsViewer::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup){ // Pull the config from the ES edm::ESHandle handle1; evSetup.get().get( handle1 ) ; boost::shared_ptr ptr1(new L1TMuonOverlapParams(*(handle1.product ()))); - cout<<"Some fields in L1TMuonOverlapParams: "< handle1; evSetup.get().get( handle1 ) ; @@ -41,5 +41,5 @@ void L1TMuonOverlapWriter::analyze(const edm::Event& iEvent, const edm::EventSet #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/ModuleFactory.h" -DEFINE_FWK_MODULE(L1TMuonOverlapWriter); +DEFINE_FWK_MODULE(L1TMuonOverlapParamsWriter); diff --git a/L1TriggerConfig/Utilities/src/L1TriggerKeyExtReader.cc b/L1TriggerConfig/Utilities/src/L1TriggerKeyExtViewer.cc similarity index 86% rename from L1TriggerConfig/Utilities/src/L1TriggerKeyExtReader.cc rename to L1TriggerConfig/Utilities/src/L1TriggerKeyExtViewer.cc index ff7a50d2d17d7..373cd85a4f14e 100644 --- a/L1TriggerConfig/Utilities/src/L1TriggerKeyExtReader.cc +++ b/L1TriggerConfig/Utilities/src/L1TriggerKeyExtViewer.cc @@ -8,21 +8,21 @@ #include "CondFormats/DataRecord/interface/L1TriggerKeyExtRcd.h" #include "CondFormats/L1TObjects/interface/L1TriggerKeyExt.h" -class L1TriggerKeyExtReader : public edm::EDAnalyzer { +class L1TriggerKeyExtViewer : public edm::EDAnalyzer { private: std::string label; public: - virtual void analyze(const edm::Event&, const edm::EventSetup&); + void analyze(const edm::Event&, const edm::EventSetup&) override ; - explicit L1TriggerKeyExtReader(const edm::ParameterSet &pset) : edm::EDAnalyzer(), + explicit L1TriggerKeyExtViewer(const edm::ParameterSet &pset) : edm::EDAnalyzer(), label( pset.getParameter< std::string >( "label" ) ) {} - virtual ~L1TriggerKeyExtReader(void){} + ~L1TriggerKeyExtViewer(void) override {} }; #include using namespace std; -void L1TriggerKeyExtReader::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup){ +void L1TriggerKeyExtViewer::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup){ edm::ESHandle handle1; evSetup.get().get( label, handle1 ) ; @@ -59,5 +59,5 @@ void L1TriggerKeyExtReader::analyze(const edm::Event& iEvent, const edm::EventSe #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/ModuleFactory.h" -DEFINE_FWK_MODULE(L1TriggerKeyExtReader); +DEFINE_FWK_MODULE(L1TriggerKeyExtViewer); diff --git a/L1TriggerConfig/Utilities/src/L1TriggerKeyListExtReader.cc b/L1TriggerConfig/Utilities/src/L1TriggerKeyListExtViewer.cc similarity index 93% rename from L1TriggerConfig/Utilities/src/L1TriggerKeyListExtReader.cc rename to L1TriggerConfig/Utilities/src/L1TriggerKeyListExtViewer.cc index 8a1b2ded986c7..0a5ab5a17ba5f 100644 --- a/L1TriggerConfig/Utilities/src/L1TriggerKeyListExtReader.cc +++ b/L1TriggerConfig/Utilities/src/L1TriggerKeyListExtViewer.cc @@ -12,11 +12,11 @@ class L1TriggerKeyListExtReader : public edm::EDAnalyzer { private: public: - virtual void analyze(const edm::Event&, const edm::EventSetup&); + void analyze(const edm::Event&, const edm::EventSetup&) override ; explicit L1TriggerKeyListExtReader(const edm::ParameterSet&) : edm::EDAnalyzer(){ } - virtual ~L1TriggerKeyListExtReader(void){} + ~L1TriggerKeyListExtReader(void) override {} }; #include diff --git a/L1TriggerConfig/Utilities/test/caloDump.py b/L1TriggerConfig/Utilities/test/caloL2Dump.py similarity index 100% rename from L1TriggerConfig/Utilities/test/caloDump.py rename to L1TriggerConfig/Utilities/test/caloL2Dump.py From 2161287b47f444aa3ec656f1a6a8f62816d114b3 Mon Sep 17 00:00:00 2001 From: kkotov Date: Mon, 16 Oct 2017 16:26:52 +0200 Subject: [PATCH 010/426] Fixing the viewers --- .../Utilities/src/L1TCaloParamsViewer.cc | 24 +++++++------- .../Utilities/test/uploadBmtfParams.py | 1 - .../Utilities/test/uploadCaloParams.py | 1 - .../Utilities/test/uploadEmtfParams.py | 3 +- L1TriggerConfig/Utilities/test/viewAll.py | 29 ++++++++-------- .../Utilities/test/viewCaloParams.py | 33 +++++++++++++++++-- L1TriggerConfig/Utilities/test/viewECpar.py | 2 +- .../Utilities/test/viewGlobalMuon.py | 1 - L1TriggerConfig/Utilities/test/viewMenu.py | 2 +- L1TriggerConfig/Utilities/test/viewOverPar.py | 2 +- ...rescalesVetos.py => viewPrescalesVetos.py} | 0 11 files changed, 61 insertions(+), 37 deletions(-) rename L1TriggerConfig/Utilities/test/{viewL1TGlobalPrescalesVetos.py => viewPrescalesVetos.py} (100%) diff --git a/L1TriggerConfig/Utilities/src/L1TCaloParamsViewer.cc b/L1TriggerConfig/Utilities/src/L1TCaloParamsViewer.cc index e02e8e1df97dc..05252618c46af 100644 --- a/L1TriggerConfig/Utilities/src/L1TCaloParamsViewer.cc +++ b/L1TriggerConfig/Utilities/src/L1TCaloParamsViewer.cc @@ -591,42 +591,42 @@ void L1TCaloParamsViewer::analyze(const edm::Event& iEvent, const edm::EventSetu cout< ecalSF = ptr1->layer1ECalScaleFactors(); cout<<" layer1ECalScaleFactors= ["<< ecalSF.size()<<"] "< hcalSF = ptr1->layer1HCalScaleFactors(); cout<<" layer1HCalScaleFactors= ["<< hcalSF.size()<<"] "< hfSF = ptr1->layer1HFScaleFactors(); cout<<" layer1HFScaleFactors= ["<< hfSF.size()<<"] "< Date: Mon, 16 Oct 2017 16:38:31 +0200 Subject: [PATCH 011/426] Decomissioning 2016 xml scheme --- .../L1TGlobalPrescalesVetosOnline_cfi.py | 3 +- .../python/L1TMuonEndCapForestOnline_cfi.py | 2 +- .../src/L1TGlobalPrescalesVetosOnlineProd.cc | 50 ++----------------- .../src/L1TMuonBarrelParamsOnlineProd.cc | 2 +- .../src/L1TMuonEndCapParamsOnlineProd.cc | 2 +- 5 files changed, 7 insertions(+), 52 deletions(-) diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TGlobalPrescalesVetosOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TGlobalPrescalesVetosOnline_cfi.py index 1a27a0d2916a5..370e13123736f 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TGlobalPrescalesVetosOnline_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TGlobalPrescalesVetosOnline_cfi.py @@ -6,6 +6,5 @@ onlineAuthentication = cms.string('.'), forceGeneration = cms.bool(False), onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'), - transactionSafe = cms.bool(True), # nothrow guarantee if set to False: carry on no matter what - xmlModel = cms.int32(2017) # can be set to 2016 for backward compatibility + transactionSafe = cms.bool(True) # nothrow guarantee if set to False: carry on no matter what ) diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapForestOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapForestOnline_cfi.py index ef6ab79d49259..7ac94d16e93eb 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapForestOnline_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapForestOnline_cfi.py @@ -5,6 +5,6 @@ L1TMuonEndCapForestOnlineProd = cms.ESProducer("L1TMuonEndCapForestOnlineProd", onlineAuthentication = cms.string('.'), forceGeneration = cms.bool(False), - onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R') + onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'), transactionSafe = cms.bool(True) # any value has no effect on this particular producer ) diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TGlobalPrescalesVetosOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TGlobalPrescalesVetosOnlineProd.cc index f7fc1351c4d97..b533af6b8fbad 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TGlobalPrescalesVetosOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TGlobalPrescalesVetosOnlineProd.cc @@ -27,7 +27,6 @@ class L1TGlobalPrescalesVetosOnlineProd : public L1ConfigOnlineProdBaseExt { private: - int xmlModel; bool transactionSafe; public: virtual std::shared_ptr newObject(const std::string& objectKey, const L1TGlobalPrescalesVetosO2ORcd& record) override ; @@ -37,7 +36,6 @@ class L1TGlobalPrescalesVetosOnlineProd : public L1ConfigOnlineProdBaseExt(iConfig) { - xmlModel = iConfig.getParameter("xmlModel"); transactionSafe = iConfig.getParameter("transactionSafe"); } @@ -65,8 +63,6 @@ std::shared_ptr L1TGlobalPrescalesVetosOnlineProd::newO std::string stage2Schema = "CMS_TRG_L1_CONF" ; - if( xmlModel > 2016 ){ - std::string l1_menu_key; std::vector< std::string > queryStrings ; queryStrings.push_back( "L1_MENU" ) ; @@ -139,14 +135,11 @@ std::shared_ptr L1TGlobalPrescalesVetosOnlineProd::newO for(auto algo : pMenu->getAlgorithmMap()) algoName2bit[algo.first] = algo.second.getIndex(); - } else { // xmlModel <= 2016 - // identity - for(unsigned int algoBit = 0; algoBit < m_numberPhysTriggers; algoBit++) - algoName2bit[std::to_string(algoBit)] = algoBit; - } - std::vector< std::string > queryColumns; + + ///std::vector< std::string > queryColumns; + queryColumns.clear(); queryColumns.push_back( "ALGOBX_MASK" ) ; queryColumns.push_back( "ALGO_FINOR_MASK" ) ; queryColumns.push_back( "ALGO_FINOR_VETO" ) ; @@ -359,7 +352,6 @@ std::shared_ptr L1TGlobalPrescalesVetosOnlineProd::newO // Algo bx mask unsigned int m_bx_mask_default = 1; -if( xmlModel > 2016 ){ std::vector bx_algo_name; std::vector bx_range; @@ -649,42 +641,6 @@ if( xmlModel > 2016 ){ } } -} else { // xmlModel <= 2016 - - try { - // old algo bx mask - l1t::XmlConfigParser xmlReader_mask_algobx; - l1t::TriggerSystem ts_mask_algobx; - ts_mask_algobx.addProcessor("uGtProcessor", "uGtProcessor","-1","-1"); - - // run the parser - xmlReader_mask_algobx.readDOMFromString( xmlPayload_mask_algobx ); // initialize it - xmlReader_mask_algobx.readRootElement( ts_mask_algobx, "uGT" ); // extract all of the relevant context - ts_mask_algobx.setConfigured(); - - const std::map& settings_mask_algobx = ts_mask_algobx.getParameters("uGtProcessor"); - std::map mask_algobx_columns = settings_mask_algobx.at("algorithmBxMask").getColumnIndices(); - std::vector bunches = settings_mask_algobx.at("algorithmBxMask").getTableColumn("bx/algo"); - - unsigned int numCol_mask_algobx = mask_algobx_columns.size(); - - int NumAlgoBitsInMask = numCol_mask_algobx - 1; - for( int iBit=0; iBit algo = settings_mask_algobx.at("algorithmBxMask").getTableColumn(std::to_string(iBit).c_str()); - for(unsigned int bx=0; bx( new L1TGlobalPrescalesVetos() ) ; - } - } - -} ///////////// l1t::PrescalesVetosHelper data_( new L1TGlobalPrescalesVetos() ); diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonBarrelParamsOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonBarrelParamsOnlineProd.cc index cfad1fde9afd3..5fe0e4e1e3045 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonBarrelParamsOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonBarrelParamsOnlineProd.cc @@ -19,7 +19,7 @@ class L1TMuonBarrelParamsOnlineProd : public L1ConfigOnlineProdBaseExt newObject(const std::string& objectKey, const L1TMuonBarrelParamsO2ORcd& record) override ; - L1TMuonBarrelParamsOnlineProd(const edm::ParameterSet&) override ; + L1TMuonBarrelParamsOnlineProd(const edm::ParameterSet&); ~L1TMuonBarrelParamsOnlineProd(void){} }; diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapParamsOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapParamsOnlineProd.cc index 58ea83c72c729..af0296bd680a6 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapParamsOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapParamsOnlineProd.cc @@ -18,7 +18,7 @@ class L1TMuonEndCapParamsOnlineProd : public L1ConfigOnlineProdBaseExt newObject(const std::string& objectKey, const L1TMuonEndCapParamsO2ORcd& record) override ; - L1TMuonEndCapParamsOnlineProd(const edm::ParameterSet&) override ; + L1TMuonEndCapParamsOnlineProd(const edm::ParameterSet&); ~L1TMuonEndCapParamsOnlineProd(void){} }; From d2bb6bde5adf7ce85c24e22798ff830770a18b9e Mon Sep 17 00:00:00 2001 From: kkotov Date: Tue, 17 Oct 2017 11:29:51 +0200 Subject: [PATCH 012/426] Instructing forests proxy to fetch payload from protoDB --- .../test/L1ConfigWriteSinglePayloadExt_cfg.py | 15 +++++++++++---- .../python/L1TMuonEndCapForestOnline_cfi.py | 4 ++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CondTools/L1TriggerExt/test/L1ConfigWriteSinglePayloadExt_cfg.py b/CondTools/L1TriggerExt/test/L1ConfigWriteSinglePayloadExt_cfg.py index 10baf80a7599a..bfec35fc0c15a 100644 --- a/CondTools/L1TriggerExt/test/L1ConfigWriteSinglePayloadExt_cfg.py +++ b/CondTools/L1TriggerExt/test/L1ConfigWriteSinglePayloadExt_cfg.py @@ -50,6 +50,11 @@ VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, "Authentication path for outputDB") +options.register('protoDBAuth', + '.', #default value + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string, + "Authentication path for protoDB") options.register('overwriteKey', 0, #default value VarParsing.VarParsing.multiplicity.singleton, @@ -95,13 +100,15 @@ if options.genFromOMDS == 0: # Generate dummy configuration data - process.load('L1TriggerConfig.L1TConfigProducers.L1TMuonOverlapParamsOnlineProxy_cfi') - process.load('L1TriggerConfig.L1TConfigProducers.L1TMuonEndCapForestOnlineProxy_cfi') - + if options.objectType == 'L1TMuonEndCapForest' : + process.load('L1TriggerConfig.L1TConfigProducers.L1TMuonEndCapForestOnlineProxy_cfi') + process.l1emtfForestProtodb.DBParameters.authenticationPath = cms.untracked.string(options.protoDBAuth) + else : + process.load('L1TriggerConfig.L1TConfigProducers.L1TMuonOverlapParamsOnlineProxy_cfi') else: # Generate configuration data from OMDS process.load("CondTools.L1TriggerExt.L1ConfigTSCPayloadsExt_cff") - process.load("CondTools.L1TriggerExt.L1ConfigRSPayloadsExt_cff") + #process.load("CondTools.L1TriggerExt.L1ConfigRSPayloadsExt_cff") # writer modules from CondTools.L1TriggerExt.L1CondDBPayloadWriterExt_cff import initPayloadWriterExt diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapForestOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapForestOnline_cfi.py index 7ac94d16e93eb..0316799fe1f1f 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapForestOnline_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapForestOnline_cfi.py @@ -4,7 +4,7 @@ L1TMuonEndCapForestOnlineProd = cms.ESProducer("L1TMuonEndCapForestOnlineProd", onlineAuthentication = cms.string('.'), - forceGeneration = cms.bool(False), - onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'), + forceGeneration = cms.bool(False), + onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'), transactionSafe = cms.bool(True) # any value has no effect on this particular producer ) From 8b427627ce29ce745102d9b030a6d90d492980ab Mon Sep 17 00:00:00 2001 From: kkotov Date: Tue, 17 Oct 2017 12:03:40 +0200 Subject: [PATCH 013/426] Adding protoDBConnect --- .../test/L1ConfigWriteSinglePayloadExt_cfg.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CondTools/L1TriggerExt/test/L1ConfigWriteSinglePayloadExt_cfg.py b/CondTools/L1TriggerExt/test/L1ConfigWriteSinglePayloadExt_cfg.py index bfec35fc0c15a..08bddc4c4d8bf 100644 --- a/CondTools/L1TriggerExt/test/L1ConfigWriteSinglePayloadExt_cfg.py +++ b/CondTools/L1TriggerExt/test/L1ConfigWriteSinglePayloadExt_cfg.py @@ -49,12 +49,17 @@ '.', #default value VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, - "Authentication path for outputDB") + "Authentication path for output DB") +options.register('protoDBConnect', + 'oracle://cms_orcon_prod/CMS_CONDITIONS', #default value + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string, + "Authentication path for proto DB") options.register('protoDBAuth', '.', #default value VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, - "Authentication path for protoDB") + "Authentication path for proto DB") options.register('overwriteKey', 0, #default value VarParsing.VarParsing.multiplicity.singleton, @@ -102,6 +107,7 @@ # Generate dummy configuration data if options.objectType == 'L1TMuonEndCapForest' : process.load('L1TriggerConfig.L1TConfigProducers.L1TMuonEndCapForestOnlineProxy_cfi') + process.l1emtfForestProtodb.DBParameters.connect = cms.untracked.string(options.protoDBConnect) process.l1emtfForestProtodb.DBParameters.authenticationPath = cms.untracked.string(options.protoDBAuth) else : process.load('L1TriggerConfig.L1TConfigProducers.L1TMuonOverlapParamsOnlineProxy_cfi') From ab8eebd11e19806576e0b95a12d351c68374bdd2 Mon Sep 17 00:00:00 2001 From: kkotov Date: Tue, 17 Oct 2017 15:08:45 +0200 Subject: [PATCH 014/426] Applying suggestions from the automated code-checks --- L1Trigger/L1TCommon/src/XmlConfigParser.cc | 12 +++++----- .../src/L1TCaloParamsOnlineProd.cc | 12 +++++----- .../src/L1TGlobalPrescalesVetosOnlineProd.cc | 24 +++++++++---------- .../src/L1TMuonBarrelParamsOnlineProd.cc | 10 ++++---- .../src/L1TMuonEndCapObjectKeysOnlineProd.cc | 4 ++-- .../src/L1TMuonEndCapParamsOnlineProd.cc | 10 ++++---- .../src/L1TMuonGlobalParamsOnlineProd.cc | 12 +++++----- .../src/L1TMuonOverlapObjectKeysOnlineProd.cc | 4 ++-- .../src/L1TMuonOverlapParamsOnlineProd.cc | 4 ++-- .../Utilities/src/L1TCaloParamsViewer.cc | 18 +++++++------- .../src/L1TMuonBarrelParamsViewer.cc | 8 +++---- 11 files changed, 59 insertions(+), 59 deletions(-) diff --git a/L1Trigger/L1TCommon/src/XmlConfigParser.cc b/L1Trigger/L1TCommon/src/XmlConfigParser.cc index e8c2ae3b296d5..fe84e5146bb2a 100644 --- a/L1Trigger/L1TCommon/src/XmlConfigParser.cc +++ b/L1Trigger/L1TCommon/src/XmlConfigParser.cc @@ -427,8 +427,8 @@ void XmlConfigParser::readContext(const DOMElement* element, const std::string& char *cStr = xercesc::XMLString::transcode( colChilds->item(k)->getNodeValue() ); char *saveptr, first = 1; for(char *item=strtok_r(cStr,delim.c_str(),&saveptr); - item != NULL; - item = strtok_r(NULL,delim.c_str(),&saveptr), first=0 + item != nullptr; + item = strtok_r(nullptr,delim.c_str(),&saveptr), first=0 ) columnsStr += (first ? std::string("") : delim) + pruneString(item); xercesc::XMLString::release( &cStr ); } @@ -447,8 +447,8 @@ void XmlConfigParser::readContext(const DOMElement* element, const std::string& char *tStr = xercesc::XMLString::transcode( colTypesChilds->item(k)->getNodeValue() ); char *saveptr, first = 1; for(char *item=strtok_r(tStr,delim.c_str(),&saveptr); - item != NULL; - item = strtok_r(NULL,delim.c_str(),&saveptr), first=0 + item != nullptr; + item = strtok_r(nullptr,delim.c_str(),&saveptr), first=0 ) typesStr += (first ? std::string("") : delim) + pruneString(item); xercesc::XMLString::release( &tStr ); } @@ -469,8 +469,8 @@ void XmlConfigParser::readContext(const DOMElement* element, const std::string& char *saveptr, first = 1; std::string row; for(char *item=strtok_r(rStr,delim.c_str(),&saveptr); - item != NULL; - item = strtok_r(NULL,delim.c_str(),&saveptr), first=0 + item != nullptr; + item = strtok_r(nullptr,delim.c_str(),&saveptr), first=0 ) row += (first ? std::string("") : delim) + pruneString(item); rowStrs.push_back(row); diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TCaloParamsOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TCaloParamsOnlineProd.cc index 454df1f2b3e45..da9fc4050a8fa 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TCaloParamsOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TCaloParamsOnlineProd.cc @@ -27,10 +27,10 @@ l1t::Mask>& ); bool readCaloLayer2OnlineSettings(l1t::CaloParamsHelperO2O& paramsHelper, std::map& conf, std::map& ); public: - virtual std::shared_ptr newObject(const std::string& objectKey, const L1TCaloParamsO2ORcd& record) override ; + std::shared_ptr newObject(const std::string& objectKey, const L1TCaloParamsO2ORcd& record) override ; L1TCaloParamsOnlineProd(const edm::ParameterSet&); - ~L1TCaloParamsOnlineProd(void){} + ~L1TCaloParamsOnlineProd(void) override{} }; bool @@ -207,7 +207,7 @@ std::shared_ptr L1TCaloParamsOnlineProd::newObject(const std::s throw std::runtime_error("SummaryForFunctionManager: Calo | Faulty | Empty objectKey"); else { edm::LogError( "L1-O2O: L1TCaloParamsOnlineProd" ) << "returning unmodified prototype of l1t::CaloParams"; - return std::shared_ptr< l1t::CaloParams >( new l1t::CaloParams( *(baseSettings.product()) ) ) ; + return std::make_shared< l1t::CaloParams >( *(baseSettings.product()) ) ; } } @@ -289,7 +289,7 @@ std::shared_ptr L1TCaloParamsOnlineProd::newObject(const std::s throw std::runtime_error(std::string("SummaryForFunctionManager: Calo | Faulty | ") + e.what()); else { edm::LogError( "L1-O2O: L1TCaloParamsOnlineProd" ) << "returning unmodified prototype of l1t::CaloParams"; - return std::shared_ptr< l1t::CaloParams >( new l1t::CaloParams( *(baseSettings.product()) ) ) ; + return std::make_shared< l1t::CaloParams >( *(baseSettings.product()) ) ; } } @@ -336,7 +336,7 @@ std::shared_ptr L1TCaloParamsOnlineProd::newObject(const std::s throw std::runtime_error(std::string("SummaryForFunctionManager: Calo | Faulty | ") + e.what()); else { edm::LogError( "L1-O2O: L1TCaloParamsOnlineProd" ) << "returning unmodified prototype of l1t::CaloParams"; - return std::shared_ptr< l1t::CaloParams >( new l1t::CaloParams( *(baseSettings.product()) ) ) ; + return std::make_shared< l1t::CaloParams >( *(baseSettings.product()) ) ; } } } @@ -369,7 +369,7 @@ std::shared_ptr L1TCaloParamsOnlineProd::newObject(const std::s throw std::runtime_error(std::string("SummaryForFunctionManager: Calo | Faulty | ") + e.what()); else { edm::LogError( "L1-O2O: L1TCaloParamsOnlineProd" ) << "returning unmodified prototype of l1t::CaloParams"; - return std::shared_ptr< l1t::CaloParams >( new l1t::CaloParams( *(baseSettings.product()) ) ) ; + return std::make_shared< l1t::CaloParams >( *(baseSettings.product()) ) ; } } } diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TGlobalPrescalesVetosOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TGlobalPrescalesVetosOnlineProd.cc index b533af6b8fbad..b13fc0d0efb0a 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TGlobalPrescalesVetosOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TGlobalPrescalesVetosOnlineProd.cc @@ -29,10 +29,10 @@ class L1TGlobalPrescalesVetosOnlineProd : public L1ConfigOnlineProdBaseExt newObject(const std::string& objectKey, const L1TGlobalPrescalesVetosO2ORcd& record) override ; + std::shared_ptr newObject(const std::string& objectKey, const L1TGlobalPrescalesVetosO2ORcd& record) override ; L1TGlobalPrescalesVetosOnlineProd(const edm::ParameterSet&); - ~L1TGlobalPrescalesVetosOnlineProd(void){} + ~L1TGlobalPrescalesVetosOnlineProd(void) override{} }; L1TGlobalPrescalesVetosOnlineProd::L1TGlobalPrescalesVetosOnlineProd(const edm::ParameterSet& iConfig) : L1ConfigOnlineProdBaseExt(iConfig) { @@ -49,7 +49,7 @@ std::shared_ptr L1TGlobalPrescalesVetosOnlineProd::newO throw std::runtime_error("SummaryForFunctionManager: uGTrs | Faulty | Empty objectKey"); else { edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) << "returning empty L1TGlobalPrescalesVetos object"; - return std::shared_ptr< L1TGlobalPrescalesVetos >( new L1TGlobalPrescalesVetos() ) ; + return std::make_shared< L1TGlobalPrescalesVetos >( ) ; } } @@ -82,7 +82,7 @@ std::shared_ptr L1TGlobalPrescalesVetosOnlineProd::newO throw std::runtime_error("SummaryForFunctionManager: uGTrs | Faulty | Broken key"); else { edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) << "returning empty L1TGlobalPrescalesVetos object"; - return std::shared_ptr< L1TGlobalPrescalesVetos >( new L1TGlobalPrescalesVetos() ) ; + return std::make_shared< L1TGlobalPrescalesVetos >( ) ; } } @@ -96,7 +96,7 @@ std::shared_ptr L1TGlobalPrescalesVetosOnlineProd::newO throw std::runtime_error("SummaryForFunctionManager: uGTrs | Faulty | Empty objectKey"); else { edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) << "returning empty L1TGlobalPrescalesVetos object"; - return std::shared_ptr< L1TGlobalPrescalesVetos >( new L1TGlobalPrescalesVetos() ) ; + return std::make_shared< L1TGlobalPrescalesVetos >( ) ; } } @@ -117,7 +117,7 @@ std::shared_ptr L1TGlobalPrescalesVetosOnlineProd::newO throw std::runtime_error("SummaryForFunctionManager: uGTrs | Faulty | Broken key"); else { edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) << "returning empty L1TGlobalPrescalesVetos object"; - return std::shared_ptr< L1TGlobalPrescalesVetos >( new L1TGlobalPrescalesVetos() ) ; + return std::make_shared< L1TGlobalPrescalesVetos >( ) ; } } @@ -163,7 +163,7 @@ std::shared_ptr L1TGlobalPrescalesVetosOnlineProd::newO throw std::runtime_error(std::string("SummaryForFunctionManager: uGTrs | Faulty | ") + e.what()); else { edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) << "returning empty L1TGlobalPrescalesVetos object"; - return std::shared_ptr< L1TGlobalPrescalesVetos >( new L1TGlobalPrescalesVetos() ) ; + return std::make_shared< L1TGlobalPrescalesVetos >( ) ; } } @@ -234,7 +234,7 @@ std::shared_ptr L1TGlobalPrescalesVetosOnlineProd::newO throw std::runtime_error(std::string("SummaryForFunctionManager: uGTrs | Faulty | ") + e.what()); else { edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) << "returning empty L1TGlobalPrescalesVetos object"; - return std::shared_ptr< L1TGlobalPrescalesVetos >( new L1TGlobalPrescalesVetos() ) ; + return std::make_shared< L1TGlobalPrescalesVetos >( ) ; } } @@ -289,7 +289,7 @@ std::shared_ptr L1TGlobalPrescalesVetosOnlineProd::newO throw std::runtime_error(std::string("SummaryForFunctionManager: uGTrs | Faulty | ") + e.what()); else { edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) << "returning empty L1TGlobalPrescalesVetos object"; - return std::shared_ptr< L1TGlobalPrescalesVetos >( new L1TGlobalPrescalesVetos() ) ; + return std::make_shared< L1TGlobalPrescalesVetos >( ) ; } } @@ -343,7 +343,7 @@ std::shared_ptr L1TGlobalPrescalesVetosOnlineProd::newO throw std::runtime_error(std::string("SummaryForFunctionManager: uGTrs | Faulty | ") + e.what()); else { edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) << "returning empty L1TGlobalPrescalesVetos object"; - return std::shared_ptr< L1TGlobalPrescalesVetos >( new L1TGlobalPrescalesVetos() ) ; + return std::make_shared< L1TGlobalPrescalesVetos >( ) ; } } @@ -376,7 +376,7 @@ std::shared_ptr L1TGlobalPrescalesVetosOnlineProd::newO throw std::runtime_error(std::string("SummaryForFunctionManager: uGTrs | Faulty | ") + e.what()); else { edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) << "returning empty L1TGlobalPrescalesVetos object"; - return std::shared_ptr< L1TGlobalPrescalesVetos >( new L1TGlobalPrescalesVetos() ) ; + return std::make_shared< L1TGlobalPrescalesVetos >( ) ; } } @@ -418,7 +418,7 @@ std::shared_ptr L1TGlobalPrescalesVetosOnlineProd::newO first = 0; last = 3563; } else { - char *dash = 0; + char *dash = nullptr; first = strtoul(s2.data(), &dash, 0); while( *dash != '\0' && *dash != '-' ) ++dash; last = (*dash != '\0' ? strtoul(++dash, &dash, 0) : first); diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonBarrelParamsOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonBarrelParamsOnlineProd.cc index 5fe0e4e1e3045..606976064a507 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonBarrelParamsOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonBarrelParamsOnlineProd.cc @@ -20,7 +20,7 @@ class L1TMuonBarrelParamsOnlineProd : public L1ConfigOnlineProdBaseExt newObject(const std::string& objectKey, const L1TMuonBarrelParamsO2ORcd& record) override ; L1TMuonBarrelParamsOnlineProd(const edm::ParameterSet&); - ~L1TMuonBarrelParamsOnlineProd(void){} + ~L1TMuonBarrelParamsOnlineProd(void) override{} }; L1TMuonBarrelParamsOnlineProd::L1TMuonBarrelParamsOnlineProd(const edm::ParameterSet& iConfig) : L1ConfigOnlineProdBaseExt(iConfig) { @@ -40,7 +40,7 @@ std::shared_ptr L1TMuonBarrelParamsOnlineProd::newObject(co throw std::runtime_error("SummaryForFunctionManager: BMTF | Faulty | Empty objectKey"); else { edm::LogError( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonBarrelParams"; - return std::shared_ptr< L1TMuonBarrelParams >( new L1TMuonBarrelParams( *(baseSettings.product()) ) ) ; + return std::make_shared< L1TMuonBarrelParams >( *(baseSettings.product()) ) ; } } @@ -105,7 +105,7 @@ std::shared_ptr L1TMuonBarrelParamsOnlineProd::newObject(co throw std::runtime_error(std::string("SummaryForFunctionManager: BMTF | Faulty | ") + e.what()); else { edm::LogError( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonBarrelParams"; - return std::shared_ptr< L1TMuonBarrelParams >( new L1TMuonBarrelParams( *(baseSettings.product()) ) ) ; + return std::make_shared< L1TMuonBarrelParams >( *(baseSettings.product()) ) ; } } @@ -158,7 +158,7 @@ std::shared_ptr L1TMuonBarrelParamsOnlineProd::newObject(co throw std::runtime_error(std::string("SummaryForFunctionManager: BMTF | Faulty | ") + e.what()); else { edm::LogError( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonBarrelParams"; - return std::shared_ptr< L1TMuonBarrelParams >( new L1TMuonBarrelParams( *(baseSettings.product()) ) ) ; + return std::make_shared< L1TMuonBarrelParams >( *(baseSettings.product()) ) ; } } @@ -171,7 +171,7 @@ std::shared_ptr L1TMuonBarrelParamsOnlineProd::newObject(co throw std::runtime_error(std::string("SummaryForFunctionManager: BMTF | Faulty | ") + e.what()); else { edm::LogError( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonBarrelParams"; - return std::shared_ptr< L1TMuonBarrelParams >( new L1TMuonBarrelParams( *(baseSettings.product()) ) ) ; + return std::make_shared< L1TMuonBarrelParams >( *(baseSettings.product()) ) ; } } diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapObjectKeysOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapObjectKeysOnlineProd.cc index 1a41a79d53262..2dd7a3c6b7f10 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapObjectKeysOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapObjectKeysOnlineProd.cc @@ -9,10 +9,10 @@ class L1TMuonEndCapObjectKeysOnlineProd : public L1ObjectKeysOnlineProdBaseExt { private: bool transactionSafe; public: - virtual void fillObjectKeys( ReturnType pL1TriggerKey ) override ; + void fillObjectKeys( ReturnType pL1TriggerKey ) override ; L1TMuonEndCapObjectKeysOnlineProd(const edm::ParameterSet&); - ~L1TMuonEndCapObjectKeysOnlineProd(void){} + ~L1TMuonEndCapObjectKeysOnlineProd(void) override{} }; L1TMuonEndCapObjectKeysOnlineProd::L1TMuonEndCapObjectKeysOnlineProd(const edm::ParameterSet& iConfig) diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapParamsOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapParamsOnlineProd.cc index af0296bd680a6..001b99b0421c7 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapParamsOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapParamsOnlineProd.cc @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include @@ -19,7 +19,7 @@ class L1TMuonEndCapParamsOnlineProd : public L1ConfigOnlineProdBaseExt newObject(const std::string& objectKey, const L1TMuonEndCapParamsO2ORcd& record) override ; L1TMuonEndCapParamsOnlineProd(const edm::ParameterSet&); - ~L1TMuonEndCapParamsOnlineProd(void){} + ~L1TMuonEndCapParamsOnlineProd(void) override{} }; L1TMuonEndCapParamsOnlineProd::L1TMuonEndCapParamsOnlineProd(const edm::ParameterSet& iConfig) : L1ConfigOnlineProdBaseExt(iConfig){ @@ -40,7 +40,7 @@ std::shared_ptr L1TMuonEndCapParamsOnlineProd::newObject(co throw std::runtime_error("SummaryForFunctionManager: BMTF | Faulty | Empty objectKey"); else { edm::LogError( "L1-O2O: L1TMuonEndCapParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonEndCapParams"; - return std::shared_ptr< L1TMuonEndCapParams >( new L1TMuonEndCapParams( *(baseSettings.product()) ) ) ; + return std::make_shared< L1TMuonEndCapParams >( *(baseSettings.product()) ) ; } } @@ -80,7 +80,7 @@ std::shared_ptr L1TMuonEndCapParamsOnlineProd::newObject(co throw std::runtime_error("SummaryForFunctionManager: EMTF | Faulty | Broken key"); else { edm::LogError( "L1-O2O: L1TMuonEndCapParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonEndCapParams"; - return std::shared_ptr< L1TMuonEndCapParams >( new L1TMuonEndCapParams( *(baseSettings.product()) ) ) ; + return std::make_shared< L1TMuonEndCapParams >( *(baseSettings.product()) ) ; } } @@ -113,7 +113,7 @@ std::shared_ptr L1TMuonEndCapParamsOnlineProd::newObject(co throw std::runtime_error("SummaryForFunctionManager: EMTF | Faulty | Cannot parse XMLs"); else { edm::LogError( "L1-O2O: L1TMuonEndCapParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonEndCapParams"; - return std::shared_ptr< L1TMuonEndCapParams >( new L1TMuonEndCapParams( *(baseSettings.product()) ) ) ; + return std::make_shared< L1TMuonEndCapParams >( *(baseSettings.product()) ) ; } } diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonGlobalParamsOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonGlobalParamsOnlineProd.cc index 4200c769b4391..a2e36068ace35 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonGlobalParamsOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonGlobalParamsOnlineProd.cc @@ -16,10 +16,10 @@ class L1TMuonGlobalParamsOnlineProd : public L1ConfigOnlineProdBaseExt newObject(const std::string& objectKey, const L1TMuonGlobalParamsO2ORcd &record) override ; + std::shared_ptr newObject(const std::string& objectKey, const L1TMuonGlobalParamsO2ORcd &record) override ; L1TMuonGlobalParamsOnlineProd(const edm::ParameterSet&); - ~L1TMuonGlobalParamsOnlineProd(void){} + ~L1TMuonGlobalParamsOnlineProd(void) override{} }; L1TMuonGlobalParamsOnlineProd::L1TMuonGlobalParamsOnlineProd(const edm::ParameterSet& iConfig) : L1ConfigOnlineProdBaseExt(iConfig) { @@ -39,7 +39,7 @@ std::shared_ptr L1TMuonGlobalParamsOnlineProd::newObject(co throw std::runtime_error("SummaryForFunctionManager: uGMT | Faulty | Empty objectKey"); else { edm::LogError( "L1-O2O: L1TMuonGlobalParams" ) << "returning unmodified prototype of L1TMuonGlobalParams"; - return std::shared_ptr< L1TMuonGlobalParams>( new L1TMuonGlobalParams( *(baseSettings.product()) ) ) ; + return std::make_shared< L1TMuonGlobalParams>( *(baseSettings.product()) ) ; } } @@ -102,7 +102,7 @@ std::shared_ptr L1TMuonGlobalParamsOnlineProd::newObject(co throw std::runtime_error("SummaryForFunctionManager: uGMT | Faulty | Broken key"); else { edm::LogError( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonGlobalParams"; - return std::shared_ptr< L1TMuonGlobalParams >( new L1TMuonGlobalParams( *(baseSettings.product()) ) ) ; + return std::make_shared< L1TMuonGlobalParams >( *(baseSettings.product()) ) ; } } @@ -148,7 +148,7 @@ std::shared_ptr L1TMuonGlobalParamsOnlineProd::newObject(co throw std::runtime_error("SummaryForFunctionManager: uGMT | Faulty | Cannot parse XMLs"); else { edm::LogError( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonGlobalParams"; - return std::shared_ptr< L1TMuonGlobalParams >( new L1TMuonGlobalParams( *(baseSettings.product()) ) ) ; + return std::make_shared< L1TMuonGlobalParams >( *(baseSettings.product()) ) ; } } @@ -161,7 +161,7 @@ std::shared_ptr L1TMuonGlobalParamsOnlineProd::newObject(co throw std::runtime_error("SummaryForFunctionManager: uGMT | Faulty | Cannot run helper"); else { edm::LogError( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonGlobalParams"; - return std::shared_ptr< L1TMuonGlobalParams >( new L1TMuonGlobalParams( *(baseSettings.product()) ) ) ; + return std::make_shared< L1TMuonGlobalParams >( *(baseSettings.product()) ) ; } } diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapObjectKeysOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapObjectKeysOnlineProd.cc index 034d88be8eaeb..a04182c6e33b6 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapObjectKeysOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapObjectKeysOnlineProd.cc @@ -6,10 +6,10 @@ class L1TMuonOverlapObjectKeysOnlineProd : public L1ObjectKeysOnlineProdBaseExt private: bool transactionSafe; public: - virtual void fillObjectKeys( ReturnType pL1TriggerKey ) override ; + void fillObjectKeys( ReturnType pL1TriggerKey ) override ; L1TMuonOverlapObjectKeysOnlineProd(const edm::ParameterSet&); - ~L1TMuonOverlapObjectKeysOnlineProd(void){} + ~L1TMuonOverlapObjectKeysOnlineProd(void) override{} }; L1TMuonOverlapObjectKeysOnlineProd::L1TMuonOverlapObjectKeysOnlineProd(const edm::ParameterSet& iConfig) diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapParamsOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapParamsOnlineProd.cc index 36172488a90cc..aae0f689070ef 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapParamsOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapParamsOnlineProd.cc @@ -12,10 +12,10 @@ class L1TMuonOverlapParamsOnlineProd : public L1ConfigOnlineProdBaseExt newObject(const std::string& objectKey, const L1TMuonOverlapParamsO2ORcd& record) override ; + std::shared_ptr newObject(const std::string& objectKey, const L1TMuonOverlapParamsO2ORcd& record) override ; L1TMuonOverlapParamsOnlineProd(const edm::ParameterSet&); - ~L1TMuonOverlapParamsOnlineProd(void){} + ~L1TMuonOverlapParamsOnlineProd(void) override{} }; L1TMuonOverlapParamsOnlineProd::L1TMuonOverlapParamsOnlineProd(const edm::ParameterSet& iConfig) : L1ConfigOnlineProdBaseExt(iConfig) { diff --git a/L1TriggerConfig/Utilities/src/L1TCaloParamsViewer.cc b/L1TriggerConfig/Utilities/src/L1TCaloParamsViewer.cc index 05252618c46af..817445b3171d1 100644 --- a/L1TriggerConfig/Utilities/src/L1TCaloParamsViewer.cc +++ b/L1TriggerConfig/Utilities/src/L1TCaloParamsViewer.cc @@ -71,7 +71,7 @@ class L1TCaloParamsViewer: public edm::EDAnalyzer { }; #include -#include +#include #include using namespace std; @@ -107,7 +107,7 @@ void L1TCaloParamsViewer::analyze(const edm::Event& iEvent, const edm::EventSetu boost::shared_ptr ptr(new l1t::CaloParams(*(handle1.product ()))); - l1t::CaloParamsHelper *ptr1 = 0; + l1t::CaloParamsHelper *ptr1 = nullptr; ptr1 = (l1t::CaloParamsHelper*) (&(*ptr)); edm::LogInfo("")<<"L1TCaloParamsViewer:"; @@ -134,7 +134,7 @@ void L1TCaloParamsViewer::analyze(const edm::Event& iEvent, const edm::EventSetu pusParams[i] = ceil(2*ptr1->regionPUSParams()[i]); if( printPUSParams ) cout<<" "<regionPUSParams().size() ) + if( !ptr1->regionPUSParams().empty() ) cout << hash(pusParams, sizeof(float)*ptr1->regionPUSParams().size()) << endl; else cout<egPUSParams().size()]; for(unsigned int i=0; iegPUSParams().size(); i++) egPUSParams[i] = ptr1->egPUSParams()[i]; - if( ptr1->egPUSParams().size() ) + if( !ptr1->egPUSParams().empty() ) cout << hash( egPUSParams, sizeof(float)*ptr1->egPUSParams().size() ) << endl; else cout<egCalibrationParams().size()]; for(unsigned int i=0; iegCalibrationParams().size(); i++) egCalibrationParams[i] = ptr1->egCalibrationParams()[i]; - if( ptr1->egCalibrationParams().size() ) + if( !ptr1->egCalibrationParams().empty() ) cout << hash( egCalibrationParams, sizeof(double)*ptr1->egCalibrationParams().size() ) << endl; else cout<tauCalibrationParams().size()]; for(unsigned int i=0; itauCalibrationParams().size(); i++) tauCalibrationParams[i] = ptr1->tauCalibrationParams()[i]; - if( ptr1->tauCalibrationParams().size() ) + if( !ptr1->tauCalibrationParams().empty() ) cout << hash( tauCalibrationParams, sizeof(double)*ptr1->tauCalibrationParams().size() ) << endl; else cout<tauPUSParams().size()]; for(unsigned int i=0; itauPUSParams().size(); i++) tauPUSParams[i] = ptr1->tauPUSParams()[i]; - if( ptr1->tauPUSParams().size() ) + if( !ptr1->tauPUSParams().empty() ) cout << hash( tauPUSParams, sizeof(float)*ptr1->tauPUSParams().size() ) << endl; else cout<jetCalibrationParams().size()<<"] "<jetCalibrationParams().size()]; // deliberately drop double precision for(unsigned int i=0; ijetCalibrationParams().size(); i++) jetCalibrationParams[i] = ptr1->jetCalibrationParams()[i]; - if( ptr1->jetCalibrationParams().size() ){ + if( !ptr1->jetCalibrationParams().empty() ){ cout << hash( jetCalibrationParams, sizeof(float)*ptr1->jetCalibrationParams().size() ) << endl; if( printJetCalibPar ) for(unsigned int i=0; ijetCalibrationParams().size(); i++) @@ -386,7 +386,7 @@ void L1TCaloParamsViewer::analyze(const edm::Event& iEvent, const edm::EventSetu cout<<" jetPUSParams= ["<jetPUSParams().size()<<"] "<jetPUSParams().size()]; // deliberately drop double precision for(unsigned int i=0; ijetPUSParams().size(); i++) jetPUSParams[i] = ptr1->jetPUSParams()[i]; - if( ptr1->jetPUSParams().size() ){ + if( !ptr1->jetPUSParams().empty() ){ cout << hash( jetPUSParams, sizeof(float)*ptr1->jetPUSParams().size() ) << endl; if( printJetPUSPar ) for(unsigned int i=0; ijetPUSParams().size(); i++) diff --git a/L1TriggerConfig/Utilities/src/L1TMuonBarrelParamsViewer.cc b/L1TriggerConfig/Utilities/src/L1TMuonBarrelParamsViewer.cc index f34bdf4dda301..1b81c9e939948 100644 --- a/L1TriggerConfig/Utilities/src/L1TMuonBarrelParamsViewer.cc +++ b/L1TriggerConfig/Utilities/src/L1TMuonBarrelParamsViewer.cc @@ -25,17 +25,17 @@ class L1TMuonBarrelParamsViewer: public edm::EDAnalyzer { bool printPtaThreshold; public: - virtual void analyze(const edm::Event&, const edm::EventSetup&); + void analyze(const edm::Event&, const edm::EventSetup&) override; explicit L1TMuonBarrelParamsViewer(const edm::ParameterSet&) : edm::EDAnalyzer(){ printPtaThreshold = false; } - virtual ~L1TMuonBarrelParamsViewer(void){} + ~L1TMuonBarrelParamsViewer(void) override{} }; #include -#include +#include #include using namespace std; @@ -92,7 +92,7 @@ void L1TMuonBarrelParamsViewer::analyze(const edm::Event& iEvent, const edm::Eve pta_threshold[i] = ptr1->pta_threshold()[i]; if( printPtaThreshold ) cout<<" "<pta_threshold().size() ) + if( !ptr1->pta_threshold().empty() ) cout << hash(pta_threshold, sizeof(int)*ptr1->pta_threshold().size()) << endl; else cout< Date: Wed, 14 Feb 2018 16:21:01 +0100 Subject: [PATCH 015/426] LCT BX shift --- .../CSCCommonTrigger/interface/CSCConstants.h | 2 +- .../python/CSCCommonTrigger_cfi.py | 4 ++-- .../plugins/CSCTriggerPrimitivesProducer.cc | 3 --- .../python/cscTriggerPrimitiveDigis_cfi.py | 3 +++ .../src/CSCAnodeLCTProcessor.cc | 10 +++++++++ .../src/CSCCathodeLCTProcessor.cc | 21 +++++++++++++++++++ .../src/CSCCathodeLCTProcessor.h | 5 +++++ .../src/CSCGEMMotherboard.cc | 7 +++---- .../src/CSCMotherboard.cc | 11 +++++++++- .../CSCTriggerPrimitives/src/CSCMotherboard.h | 3 +++ .../src/CSCTriggerPrimitivesBuilder.cc | 7 ------- .../src/CSCTriggerPrimitivesBuilder.h | 12 ----------- .../L1TMuonEndCap/python/simEmtfDigis_cfi.py | 2 +- .../CSCDigitizer/python/muonCSCDigis_cfi.py | 4 ++-- 14 files changed, 61 insertions(+), 33 deletions(-) diff --git a/L1Trigger/CSCCommonTrigger/interface/CSCConstants.h b/L1Trigger/CSCCommonTrigger/interface/CSCConstants.h index c09c521e90ef9..c20350ca7db78 100644 --- a/L1Trigger/CSCCommonTrigger/interface/CSCConstants.h +++ b/L1Trigger/CSCCommonTrigger/interface/CSCConstants.h @@ -80,7 +80,7 @@ class CSCConstants // An MPC receives up to 18 LCTs from 9 CSCs in the trigger sector MAX_LCTS_PER_MPC = 18, // Reference BX for LCTs in simulation and firmware - LCT_CENTRAL_BX = 6}; + LCT_CENTRAL_BX = 8}; }; #endif diff --git a/L1Trigger/CSCCommonTrigger/python/CSCCommonTrigger_cfi.py b/L1Trigger/CSCCommonTrigger/python/CSCCommonTrigger_cfi.py index a1840ddb6afae..e64e153a398ba 100644 --- a/L1Trigger/CSCCommonTrigger/python/CSCCommonTrigger_cfi.py +++ b/L1Trigger/CSCCommonTrigger/python/CSCCommonTrigger_cfi.py @@ -2,8 +2,8 @@ #Common Parameters for the various CSCTrigger producers CSCCommonTrigger = cms.PSet( - MaxBX = cms.int32(9), + MaxBX = cms.int32(11), #minimum and maximum bx to process - MinBX = cms.int32(3) + MinBX = cms.int32(5) ) diff --git a/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.cc b/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.cc index 4591720e37ec4..77e128122cdb6 100644 --- a/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.cc +++ b/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.cc @@ -110,9 +110,6 @@ void CSCTriggerPrimitivesProducer::produce(edm::StreamID iID, edm::Event& ev, co streamCache(iID)->setConfigParameters(conf.product()); } - // temporary hack to run on data - streamCache(iID)->runOnData(ev.eventAuxiliary().isRealData()); - // Get the collections of comparator & wire digis from event. edm::Handle compDigis; edm::Handle wireDigis; diff --git a/L1Trigger/CSCTriggerPrimitives/python/cscTriggerPrimitiveDigis_cfi.py b/L1Trigger/CSCTriggerPrimitives/python/cscTriggerPrimitiveDigis_cfi.py index 8317425e1995f..f18d8431297c3 100644 --- a/L1Trigger/CSCTriggerPrimitives/python/cscTriggerPrimitiveDigis_cfi.py +++ b/L1Trigger/CSCTriggerPrimitives/python/cscTriggerPrimitiveDigis_cfi.py @@ -42,6 +42,9 @@ # flags to optionally disable finding stubs in ME42 or ME1a disableME1a = cms.bool(False), disableME42 = cms.bool(False), + + # offset between the ALCT and CLCT central BX in simulation + alctClctOffset = cms.uint32(1), ), # Parameters for ALCT processors: old MC studies diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc index 68154ec375ef1..2d1d1ce31afea 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc @@ -1683,6 +1683,16 @@ std::vector CSCAnodeLCTProcessor::readoutALCTs() { tmpV.push_back(*plct); } + + // shift the BX from 8 to 3 + // ALCTs in real data have the central BX in bin 3 + // which is the middle of the 7BX wide L1A window + // ALCTs used in the TMB emulator have central BX at bin 8 + // but right before we put emulated ALCTs in the event, we shift the BX + // by -5 to make sure they are compatible with real data ALCTs! + for (auto& p : tmpV){ + p.setBX(p.getBX() - (CSCConstants::LCT_CENTRAL_BX - l1a_window_width/2)); + } return tmpV; } diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc index 68ef71fd5e6f1..d847f19014fd8 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc @@ -271,6 +271,15 @@ CSCCathodeLCTProcessor::CSCCathodeLCTProcessor(unsigned endcap, // Flag for SLHC studies isSLHC = comm.getParameter("isSLHC"); + // shift the BX from 7 to 8 + // the unpacked real data CLCTs have central BX at bin 7 + // however in simulation the central BX is bin 8 + // to make a proper comparison with ALCTs we need + // CLCT and ALCT to have the central BX in the same bin + // this shift does not affect the readout of the CLCTs + // emulated CLCTs put in the event should be centered at bin 7 (as in data) + alctClctOffset = comm.getParameter("alctClctOffset"); + // special configuration parameters for ME11 treatment smartME1aME1b = comm.getParameter("smartME1aME1b"); disableME1a = comm.getParameter("disableME1a"); @@ -679,6 +688,18 @@ CSCCathodeLCTProcessor::run(const CSCComparatorDigiCollection* compdc) { // Return vector of CLCTs. std::vector tmpV = getCLCTs(); + + // shift the BX from 7 to 8 + // the unpacked real data CLCTs have central BX at bin 7 + // however in simulation the central BX is bin 8 + // to make a proper comparison with ALCTs we need + // CLCT and ALCT to have the central BX in the same bin + // this shift does not affect the readout of the CLCTs + // emulated CLCTs put in the event should be centered at bin 7 (as in data) + for (auto& p : tmpV){ + p.setBX(p.getBX() + alctClctOffset); + } + return tmpV; } diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.h b/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.h index 8e0503ad68762..a5db7174c095b 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.h +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.h @@ -157,6 +157,11 @@ class CSCCathodeLCTProcessor /** Flag for SLHC studies. */ bool isSLHC; + /** Offset between ALCT and CLCT in simulation. + * This is important when ALCTs (at BX0=8) and CLCTs (at BX0=7) + * are correlated in the trigger motherboard. */ + unsigned int alctClctOffset; + /** Configuration parameters. */ unsigned int fifo_tbins, fifo_pretrig; // only for test beam mode. unsigned int hit_persist, drift_delay; diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc index f0574cc4130f4..5ac94f6884c8c 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc @@ -136,7 +136,7 @@ CSCCorrelatedLCTDigi CSCGEMMotherboard::constructLCTsGEM(const CSCALCTDigi& alct keyStrip = clct.getKeyStrip(); keyWG = alct.getKeyWG(); bend = clct.getBend(); - thisLCT.setALCT(alct); + thisLCT.setALCT(getBXShiftedALCT(alct)); thisLCT.setCLCT(clct); thisLCT.setGEM1(gem1); thisLCT.setType(CSCCorrelatedLCTDigi::ALCTCLCTGEM); @@ -148,7 +148,7 @@ CSCCorrelatedLCTDigi CSCGEMMotherboard::constructLCTsGEM(const CSCALCTDigi& alct keyStrip = clct.getKeyStrip(); keyWG = alct.getKeyWG(); bend = clct.getBend(); - thisLCT.setALCT(alct); + thisLCT.setALCT(getBXShiftedALCT(alct)); thisLCT.setCLCT(clct); thisLCT.setGEM1(gem2.first()); thisLCT.setGEM2(gem2.second()); @@ -161,7 +161,7 @@ CSCCorrelatedLCTDigi CSCGEMMotherboard::constructLCTsGEM(const CSCALCTDigi& alct bx = alct.getBX(); keyStrip = mymap1[gem2.pad(2)]; keyWG = alct.getKeyWG(); - thisLCT.setALCT(alct); + thisLCT.setALCT(getBXShiftedALCT(alct)); thisLCT.setGEM1(gem2.first()); thisLCT.setGEM2(gem2.second()); thisLCT.setType(CSCCorrelatedLCTDigi::ALCT2GEM); @@ -440,4 +440,3 @@ int CSCGEMMotherboard::getLctTrigEnable() const { return clct_trig_enable; } - diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc index 8319ebf6480c4..92334e601bda5 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc @@ -623,7 +623,8 @@ CSCCorrelatedLCTDigi CSCMotherboard::constructLCTs(const CSCALCTDigi& aLCT, cLCT.getKeyStrip(), pattern, cLCT.getBend(), bx, 0, 0, 0, theTrigChamber); thisLCT.setType(type); - thisLCT.setALCT(aLCT); + // make sure to shift the ALCT BX from 8 to 3! + thisLCT.setALCT(getBXShiftedALCT(aLCT)); thisLCT.setCLCT(cLCT); return thisLCT; } @@ -850,3 +851,11 @@ void CSCMotherboard::dumpConfigParams() const { strm << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"; LogDebug("CSCMotherboard") << strm.str(); } + +CSCALCTDigi +CSCMotherboard::getBXShiftedALCT(const CSCALCTDigi& aLCT) const +{ + CSCALCTDigi aLCT_shifted = aLCT; + aLCT_shifted.setBX(aLCT_shifted.getBX() - (CSCConstants::LCT_CENTRAL_BX - tmb_l1a_window_size/2)); + return aLCT_shifted; +} diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.h b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.h index 690242b55f945..e5de71156df8c 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.h +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.h @@ -87,6 +87,9 @@ class CSCMotherboard // VK: change to protected, to allow inheritance protected: + // helper function to return ALCT with correct central BX + CSCALCTDigi getBXShiftedALCT(const CSCALCTDigi&) const; + /** Verbosity level: 0: no print (default). * 1: print LCTs found. */ int infoV; diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.cc index 3c187ccfc0f1c..978011b6f9ca0 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.cc @@ -433,13 +433,6 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, // run MPC simulation m_muonportcard->loadDigis(oc_lct); - // temporary hack to ensure that all MPC LCTs are read out - // in the correct readout window - if (runOnData_) { - m_minBX = 5; - m_maxBX = 11; - } - // sort the LCTs per sector // insert them into the result vector std::vector result; diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.h b/L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.h index 1fdfe0abe109a..b5b3d7301bebb 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.h +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.h @@ -56,15 +56,6 @@ class CSCTriggerPrimitivesBuilder void setCSCGeometry(const CSCGeometry *g) { csc_g = g; } void setGEMGeometry(const GEMGeometry *g) { gem_g = g; } - /* temporary function to check if running on data. - * Currently in simulation the central BX is BX6; in data - * it is BX8. This mismatch in conventions is expeced to - * be resolved in the near future. The member runOnData_ - * is used in the builder to shift the LCT BX readout - * with +2 from [3,9] to [5,11]. - */ - void runOnData(bool runOnData) {runOnData_ = runOnData;} - /** Build anode, cathode, and correlated LCTs in each chamber and fill * them into output collections. Select up to three best correlated LCTs * in each (sub)sector and put them into an output collection as well. */ @@ -106,9 +97,6 @@ class CSCTriggerPrimitivesBuilder static const int min_chamber; // chambers per trigger subsector static const int max_chamber; - /// temporary flag to run on data - bool runOnData_; - /// a flag whether to skip chambers from the bad chambers map bool checkBadChambers_; diff --git a/L1Trigger/L1TMuonEndCap/python/simEmtfDigis_cfi.py b/L1Trigger/L1TMuonEndCap/python/simEmtfDigis_cfi.py index 3236bfbdf0391..acc5c1eda02a6 100644 --- a/L1Trigger/L1TMuonEndCap/python/simEmtfDigis_cfi.py +++ b/L1Trigger/L1TMuonEndCap/python/simEmtfDigis_cfi.py @@ -28,7 +28,7 @@ BXWindow = cms.int32(3), # CSC LCT BX offset correction - CSCInputBXShift = cms.int32(-6), + CSCInputBXShift = cms.int32(-8), RPCInputBXShift = cms.int32(0), GEMInputBXShift = cms.int32(0), diff --git a/SimMuon/CSCDigitizer/python/muonCSCDigis_cfi.py b/SimMuon/CSCDigitizer/python/muonCSCDigis_cfi.py index fa9800bce1aa0..b1a8d2225e8e4 100644 --- a/SimMuon/CSCDigitizer/python/muonCSCDigis_cfi.py +++ b/SimMuon/CSCDigitizer/python/muonCSCDigis_cfi.py @@ -24,7 +24,7 @@ timingCalibrationError = cms.vdouble(0., 4.2, 4.2, 0., 0., 0., 0., 0., 0., 0., 0.), # parameters for tuning timing scaTimingOffsets = cms.vdouble(0.0, 10., 10., 0.,0.,0.,0.,0.,0.,0.,0.), - comparatorTimeBinOffset = cms.double(3.0), + comparatorTimeBinOffset = cms.double(5.0), comparatorSamplingTime = cms.double(25.0), scaPeakBin = cms.int32(5), pedestalSigma = cms.double(1.5), @@ -63,7 +63,7 @@ peakTimeSigma = cms.double(0.0), shapingTime = cms.int32(30), readBadChannels = cms.bool(False), - timeBitForBxZero = cms.int32(6), + timeBitForBxZero = cms.int32(8), samplingTime = cms.double(5.0), # bunchTimingOffsets - comments for strips (above) also apply bunchTimingOffsets = cms.vdouble(0.00, 21.64, 21.64, 28.29, 29.36, 29.33, 28.57, 28.61, 28.83, 29.09, 28.22), From a44cc35038725c700416de02a90aaba8656a9d73 Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Wed, 21 Feb 2018 13:48:55 -0600 Subject: [PATCH 016/426] fix comparator time bin offset to 4 --- SimMuon/CSCDigitizer/python/muonCSCDigis_cfi.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SimMuon/CSCDigitizer/python/muonCSCDigis_cfi.py b/SimMuon/CSCDigitizer/python/muonCSCDigis_cfi.py index b1a8d2225e8e4..d36d9f9f25af3 100644 --- a/SimMuon/CSCDigitizer/python/muonCSCDigis_cfi.py +++ b/SimMuon/CSCDigitizer/python/muonCSCDigis_cfi.py @@ -24,7 +24,8 @@ timingCalibrationError = cms.vdouble(0., 4.2, 4.2, 0., 0., 0., 0., 0., 0., 0., 0.), # parameters for tuning timing scaTimingOffsets = cms.vdouble(0.0, 10., 10., 0.,0.,0.,0.,0.,0.,0.,0.), - comparatorTimeBinOffset = cms.double(5.0), + ## this offset ensures that the central CLCT BX is 7 in simulation + comparatorTimeBinOffset = cms.double(4.0), comparatorSamplingTime = cms.double(25.0), scaPeakBin = cms.int32(5), pedestalSigma = cms.double(1.5), From 3540a406252f298e41b8dd3773326e0be520afa9 Mon Sep 17 00:00:00 2001 From: Emily Date: Thu, 22 Feb 2018 17:15:07 -0600 Subject: [PATCH 017/426] DQM Workshop: adding big pixel charge plots --- .../python/SiPixelPhase1Clusters_cfi.py | 46 ++++- .../src/SiPixelPhase1Clusters.cc | 176 ++++++++++-------- .../python/SiPixelPhase1TrackClusters_cfi.py | 85 +++++++-- .../src/SiPixelPhase1TrackClusters.cc | 72 ++++--- 4 files changed, 254 insertions(+), 125 deletions(-) diff --git a/DQM/SiPixelPhase1Clusters/python/SiPixelPhase1Clusters_cfi.py b/DQM/SiPixelPhase1Clusters/python/SiPixelPhase1Clusters_cfi.py index 3fafad77eeee6..9c6fe6240a2e4 100644 --- a/DQM/SiPixelPhase1Clusters/python/SiPixelPhase1Clusters_cfi.py +++ b/DQM/SiPixelPhase1Clusters/python/SiPixelPhase1Clusters_cfi.py @@ -18,6 +18,36 @@ ) ) +SiPixelPhase1ClustersBPCharge = DefaultHistoDigiCluster.clone( + name = "bpcharge", + title = "Big Pixel Charge", + range_min = 0, range_max = 70, range_nbins = 300, + xlabel = "Mysterious units", + + specs = VPSet( + StandardSpecification2DProfile, + StandardSpecificationPixelmapProfile, + StandardSpecificationTrend, + StandardSpecifications1D, + StandardSpecificationTrend2D + ) +) + +SiPixelPhase1ClustersPCharge = DefaultHistoDigiCluster.clone( + name = "pcharge", + title = "All Pixel Charge", + range_min = 0, range_max = 70, range_nbins = 300, + xlabel = "Mysterious units", + + specs = VPSet( + StandardSpecification2DProfile, + StandardSpecificationPixelmapProfile, + StandardSpecificationTrend, + StandardSpecifications1D, + StandardSpecificationTrend2D + ) +) + SiPixelPhase1ClustersSize = DefaultHistoDigiCluster.clone( name = "size", title = "Total Cluster Size", @@ -74,11 +104,11 @@ StandardSpecifications1D_Num, Specification().groupBy("PXBarrel/PXLayer/Event") #this will produce inclusive counts per Layer/Disk - .reduce("COUNT") + .reduce("COUNT") .groupBy("PXBarrel/PXLayer") .save(nbins=50, xmin=0, xmax=10000), Specification().groupBy("PXForward/PXDisk/Event") - .reduce("COUNT") + .reduce("COUNT") .groupBy("PXForward/PXDisk/") .save(nbins=50, xmin=0, xmax=5000), ) @@ -219,18 +249,18 @@ enabled = False, name = "cluster_ratio", title = "Pixel to Strip clusters ratio", - + xlabel = "ratio", dimensions = 1, - + specs = VPSet( - Specification().groupBy("PXAll").save(100, 0, 1), + Specification().groupBy("PXAll").save(100, 0, 1), Specification().groupBy("PXAll/LumiBlock") - .reduce("MEAN") + .reduce("MEAN") .groupBy("PXAll", "EXTEND_X") .save(), Specification().groupBy("PXAll/BX") - .reduce("MEAN") + .reduce("MEAN") .groupBy("PXAll", "EXTEND_X") .save(), ) @@ -238,6 +268,8 @@ SiPixelPhase1ClustersConf = cms.VPSet( SiPixelPhase1ClustersCharge, + SiPixelPhase1ClustersBPCharge, + SiPixelPhase1ClustersPCharge, SiPixelPhase1ClustersSize, SiPixelPhase1ClustersSizeX, SiPixelPhase1ClustersSizeY, diff --git a/DQM/SiPixelPhase1Clusters/src/SiPixelPhase1Clusters.cc b/DQM/SiPixelPhase1Clusters/src/SiPixelPhase1Clusters.cc index f9341076ce81d..56bb822eea4da 100644 --- a/DQM/SiPixelPhase1Clusters/src/SiPixelPhase1Clusters.cc +++ b/DQM/SiPixelPhase1Clusters/src/SiPixelPhase1Clusters.cc @@ -7,6 +7,7 @@ // Original Author: Marcel Schneider #include "DQM/SiPixelPhase1Common/interface/SiPixelPhase1Base.h" +#include "DataFormats/Common/interface/DetSetVector.h" #include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" #include "DataFormats/SiStripCluster/interface/SiStripCluster.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -21,105 +22,126 @@ namespace { -class SiPixelPhase1Clusters final : public SiPixelPhase1Base { - enum { - CHARGE, - SIZE, - SIZEX, - SIZEY, - NCLUSTERS, - NCLUSTERSINCLUSIVE, - EVENTRATE, - POSITION_B, - POSITION_F, - POSITION_XZ, - POSITION_YZ, - SIZE_VS_ETA, - READOUT_CHARGE, - READOUT_NCLUSTERS, - PIXEL_TO_STRIP_RATIO - }; + class SiPixelPhase1Clusters final : public SiPixelPhase1Base { + enum { + CHARGE, + BPCHARGE, + PCHARGE, + SIZE, + SIZEX, + SIZEY, + NCLUSTERS, + NCLUSTERSINCLUSIVE, + EVENTRATE, + POSITION_B, + POSITION_F, + POSITION_XZ, + POSITION_YZ, + SIZE_VS_ETA, + READOUT_CHARGE, + READOUT_NCLUSTERS, + PIXEL_TO_STRIP_RATIO + }; public: - explicit SiPixelPhase1Clusters(const edm::ParameterSet& conf); - void analyze(const edm::Event&, const edm::EventSetup&) override; + explicit SiPixelPhase1Clusters(const edm::ParameterSet& conf); + void analyze(const edm::Event&, const edm::EventSetup&) override; private: - edm::EDGetTokenT > pixelSrcToken_; - edm::EDGetTokenT > stripSrcToken_; -}; + edm::EDGetTokenT > pixelSrcToken_; + edm::EDGetTokenT > stripSrcToken_; + }; -SiPixelPhase1Clusters::SiPixelPhase1Clusters(const edm::ParameterSet& iConfig) : + SiPixelPhase1Clusters::SiPixelPhase1Clusters(const edm::ParameterSet& iConfig) : SiPixelPhase1Base(iConfig) -{ - pixelSrcToken_ = consumes>(iConfig.getParameter("pixelSrc")); + { + pixelSrcToken_ = consumes>(iConfig.getParameter("pixelSrc")); - stripSrcToken_ = consumes>(iConfig.getParameter("stripSrc")); -} + stripSrcToken_ = consumes>(iConfig.getParameter("stripSrc")); + } -void SiPixelPhase1Clusters::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - if( !checktrigger(iEvent,iSetup,DCS) ) return; + void SiPixelPhase1Clusters::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + if( !checktrigger(iEvent,iSetup,DCS) ) return; - edm::Handle> inputPixel; - iEvent.getByToken(pixelSrcToken_, inputPixel); - if (!inputPixel.isValid()) return; + edm::Handle> inputPixel; + iEvent.getByToken(pixelSrcToken_, inputPixel); + if (!inputPixel.isValid()) return; - edm::Handle> inputStrip; - iEvent.getByToken(stripSrcToken_, inputStrip); - if (inputStrip.isValid()) - { - if (!inputStrip.product()->data().empty()) + edm::Handle> inputStrip; + iEvent.getByToken(stripSrcToken_, inputStrip); + if (inputStrip.isValid()) { - histo[PIXEL_TO_STRIP_RATIO].fill((double)inputPixel.product()->data().size() / (double) inputStrip.product()->data().size(), DetId(0), &iEvent); + if (!inputStrip.product()->data().empty()) + { + histo[PIXEL_TO_STRIP_RATIO].fill((double)inputPixel.product()->data().size() / (double) inputStrip.product()->data().size(), DetId(0), &iEvent); + } } - } - bool hasClusters=false; + bool hasClusters=false; - edm::ESHandle tracker; - iSetup.get().get(tracker); - assert(tracker.isValid()); + edm::ESHandle tracker; + iSetup.get().get(tracker); + assert(tracker.isValid()); + + edmNew::DetSetVector::const_iterator it; - edmNew::DetSetVector::const_iterator it; for (it = inputPixel->begin(); it != inputPixel->end(); ++it) { - auto id = DetId(it->detId()); - - const PixelGeomDetUnit* theGeomDet = dynamic_cast ( tracker->idToDet(id) ); - const PixelTopology& topol = theGeomDet->specificTopology(); - - for(SiPixelCluster const& cluster : *it) { - int row = cluster.x()-0.5, col = cluster.y()-0.5; - histo[READOUT_CHARGE].fill(double(cluster.charge()), id, &iEvent, col, row); - histo[CHARGE].fill(double(cluster.charge()), id, &iEvent, col, row); - histo[SIZE ].fill(double(cluster.size() ), id, &iEvent, col, row); - histo[SIZEX ].fill(double(cluster.sizeX() ), id, &iEvent, col, row); - histo[SIZEY ].fill(double(cluster.sizeY() ), id, &iEvent, col, row); - histo[NCLUSTERS].fill(id, &iEvent, col, row); - histo[NCLUSTERSINCLUSIVE].fill(id, &iEvent); - hasClusters=true; - if (cluster.size()>1){ - histo[READOUT_NCLUSTERS].fill(id, &iEvent); - } + auto id = DetId(it->detId()); - LocalPoint clustlp = topol.localPosition(MeasurementPoint(cluster.x(), cluster.y())); - GlobalPoint clustgp = theGeomDet->surface().toGlobal(clustlp); - histo[POSITION_B ].fill(clustgp.z(), clustgp.phi(), id, &iEvent); - histo[POSITION_F ].fill(clustgp.x(), clustgp.y(), id, &iEvent); - histo[POSITION_XZ].fill(clustgp.x(), clustgp.z(), id, &iEvent); - histo[POSITION_YZ].fill(clustgp.y(), clustgp.z(), id, &iEvent); - histo[SIZE_VS_ETA].fill(clustgp.eta(), cluster.sizeY(), id, &iEvent); + const PixelGeomDetUnit* theGeomDet = dynamic_cast ( tracker->idToDet(id) ); + const PixelTopology& topol = theGeomDet->specificTopology(); - } - } + for(SiPixelCluster const& cluster : *it) { + int row = cluster.x()-0.5, col = cluster.y()-0.5; + + const std::vector pixelsVec = cluster.pixels(); + for (unsigned int i = 0; i < pixelsVec.size(); ++i) { - if (hasClusters) histo[EVENTRATE].fill(DetId(0), &iEvent); + float pixx = pixelsVec[i].x; // index as float=iteger, row index + float pixy = pixelsVec[i].y; // same, col index - histo[NCLUSTERS].executePerEventHarvesting(&iEvent); - histo[READOUT_NCLUSTERS].executePerEventHarvesting(&iEvent); - histo[NCLUSTERSINCLUSIVE].executePerEventHarvesting(&iEvent); + bool bigInX = topol.isItBigPixelInX(int(pixx)); + bool bigInY = topol.isItBigPixelInY(int(pixy)); + float pixel_charge = pixelsVec[i].adc/1000; + histo[PCHARGE].fill(pixel_charge, id, &iEvent, col, row); + if (bigInX || bigInY) histo[BPCHARGE].fill(pixel_charge, id, &iEvent, col, row); + } -} + + histo[READOUT_CHARGE].fill(double(cluster.charge()), id, &iEvent, col, row); + histo[CHARGE].fill(double(cluster.charge()), id, &iEvent, col, row); + histo[SIZE ].fill(double(cluster.size() ), id, &iEvent, col, row); + histo[SIZEX ].fill(double(cluster.sizeX() ), id, &iEvent, col, row); + histo[SIZEY ].fill(double(cluster.sizeY() ), id, &iEvent, col, row); + histo[NCLUSTERS].fill(id, &iEvent, col, row); + histo[NCLUSTERSINCLUSIVE].fill(id, &iEvent); + hasClusters=true; + + //if (bigInX || bigInY) histo_BigPixCharge.fill(double(cluster.charge()), id, &iEvent, col, row); + + if (cluster.size()>1){ + histo[READOUT_NCLUSTERS].fill(id, &iEvent); + } + + LocalPoint clustlp = topol.localPosition(MeasurementPoint(cluster.x(), cluster.y())); + GlobalPoint clustgp = theGeomDet->surface().toGlobal(clustlp); + histo[POSITION_B ].fill(clustgp.z(), clustgp.phi(), id, &iEvent); + histo[POSITION_F ].fill(clustgp.x(), clustgp.y(), id, &iEvent); + histo[POSITION_XZ].fill(clustgp.x(), clustgp.z(), id, &iEvent); + histo[POSITION_YZ].fill(clustgp.y(), clustgp.z(), id, &iEvent); + histo[SIZE_VS_ETA].fill(clustgp.eta(), cluster.sizeY(), id, &iEvent); + + } + } + + if (hasClusters) histo[EVENTRATE].fill(DetId(0), &iEvent); + + histo[NCLUSTERS].executePerEventHarvesting(&iEvent); + histo[READOUT_NCLUSTERS].executePerEventHarvesting(&iEvent); + histo[NCLUSTERSINCLUSIVE].executePerEventHarvesting(&iEvent); + + } } // namespace diff --git a/DQM/SiPixelPhase1TrackClusters/python/SiPixelPhase1TrackClusters_cfi.py b/DQM/SiPixelPhase1TrackClusters/python/SiPixelPhase1TrackClusters_cfi.py index 0c35475b3c6a4..01e5fc84a060e 100644 --- a/DQM/SiPixelPhase1TrackClusters/python/SiPixelPhase1TrackClusters_cfi.py +++ b/DQM/SiPixelPhase1TrackClusters/python/SiPixelPhase1TrackClusters_cfi.py @@ -10,10 +10,70 @@ xlabel = "Charge (electrons)", specs = VPSet( - StandardSpecifications1D, + StandardSpecifications1D, StandardSpecification2DProfile, - - #what is below is only for the timing client + + #what is below is only for the timing client + Specification(OverlayCurvesForTiming).groupBy("PXBarrel/OnlineBlock") + .groupBy("PXBarrel", "EXTEND_Y") + .save(), + Specification(OverlayCurvesForTiming).groupBy("PXForward/OnlineBlock") + .groupBy("PXForward", "EXTEND_Y") + .save(), + + Specification().groupBy("PXForward/PXRing").save(), + + Specification(PerModule).groupBy("PXForward/PXRing/Lumisection") + .reduce("MEAN") + .groupBy("PXForward/PXRing","EXTEND_X") + .save(), + + Specification(IsOffline).groupBy("PXForward/PXRing/LumiBlock") + .reduce("MEAN") + .groupBy("PXForward/PXRing","EXTEND_X") + .save(), + + + Specification(PerModule).groupBy("PXBarrel/PXLayer/Lumisection") + .reduce("MEAN") + .groupBy("PXBarrel/PXLayer", "EXTEND_X") + .save(), + + Specification(PerModule).groupBy("PXForward/PXDisk/Lumisection") + .reduce("MEAN") + .groupBy("PXForward/PXDisk", "EXTEND_X") + .save(), + + Specification(IsOffline).groupBy("PXBarrel/PXLayer/LumiBlock") + .reduce("MEAN") + .groupBy("PXBarrel/PXLayer", "EXTEND_X") + .save(), + + Specification(IsOffline).groupBy("PXForward/PXDisk/LumiBlock") + .reduce("MEAN") + .groupBy("PXForward/PXDisk", "EXTEND_X") + .save(), + + Specification(OverlayCurvesForTiming).groupBy("PXForward/PXDisk/OnlineBlock") # per-layer with history for online + .groupBy("PXForward/PXDisk", "EXTEND_Y") + .save(), + Specification(OverlayCurvesForTiming).groupBy("PXBarrel/PXLayer/OnlineBlock") # per-layer with history for online + .groupBy("PXBarrel/PXLayer", "EXTEND_Y") + .save() + ) +) + +SiPixelPhase1TrackClustersOnTrackBPCharge = DefaultHistoTrack.clone( + name = "bpcharge", + title = "Corrected Big Pixel Charge (OnTrack)", + range_min = 0, range_max = 80, range_nbins = 100, + xlabel = "Mysterious units", + + specs = VPSet( + StandardSpecifications1D, + StandardSpecification2DProfile, + + #what is below is only for the timing client Specification(OverlayCurvesForTiming).groupBy("PXBarrel/OnlineBlock") .groupBy("PXBarrel", "EXTEND_Y") .save(), @@ -70,7 +130,7 @@ xlabel = "size[pixels]", specs = VPSet( - StandardSpecifications1D, + StandardSpecifications1D, StandardSpecification2DProfile, Specification().groupBy("PXForward/PXRing").save(), @@ -159,12 +219,12 @@ StandardSpecification2DProfile_Num, Specification().groupBy("PXBarrel/PXLayer/Event") #this will produce inclusive counts per Layer/Disk - .reduce("COUNT") + .reduce("COUNT") .groupBy("PXBarrel/PXLayer") .save(nbins=50, xmin=0, xmax=5000), Specification().groupBy("PXForward/PXDisk/Event") - .reduce("COUNT") + .reduce("COUNT") .groupBy("PXForward/PXDisk/") .save(nbins=50, xmin=0, xmax=2000), @@ -226,7 +286,7 @@ .groupBy("PXBarrel/OnlineBlock") .groupBy("PXBarrel", "EXTEND_Y") .save() - + ) ) @@ -365,7 +425,7 @@ xlabel = "y size", ylabel = "x size", range_min = 0, range_max = 20, range_nbins = 20, - range_y_min = 0, range_y_max = 10, range_y_nbins = 10 + range_y_min = 0, range_y_max = 10, range_y_nbins = 10 ) SiPixelPhase1TrackClustersOnTrackSizeXYInner = SiPixelPhase1TrackClustersOnTrackSizeXYOuter.clone( @@ -407,11 +467,11 @@ Specification().groupBy("PXBarrel/PXLayer").save() ) ) - + SiPixelPhase1TrackClustersOnTrackChargeInner = SiPixelPhase1TrackClustersOnTrackChargeOuter.clone( name = "chargeInner", title = "Corrected Cluster Charge (OnTrack) inner ladders" -) +) SiPixelPhase1TrackClustersOnTrackShapeOuter = DefaultHistoTrack.clone( topFolderName = "PixelPhase1/ClusterShape", @@ -432,6 +492,7 @@ # copy this in the enum SiPixelPhase1TrackClustersConf = cms.VPSet( SiPixelPhase1TrackClustersOnTrackCharge, + SiPixelPhase1TrackClustersOnTrackBPCharge, SiPixelPhase1TrackClustersOnTrackSize, SiPixelPhase1TrackClustersOnTrackShape, SiPixelPhase1TrackClustersOnTrackNClusters, @@ -478,7 +539,3 @@ histograms = SiPixelPhase1TrackClustersConf, geometry = SiPixelPhase1Geometry ) - - - - diff --git a/DQM/SiPixelPhase1TrackClusters/src/SiPixelPhase1TrackClusters.cc b/DQM/SiPixelPhase1TrackClusters/src/SiPixelPhase1TrackClusters.cc index 74512ef6d6b92..9a6841c53f5bb 100644 --- a/DQM/SiPixelPhase1TrackClusters/src/SiPixelPhase1TrackClusters.cc +++ b/DQM/SiPixelPhase1TrackClusters/src/SiPixelPhase1TrackClusters.cc @@ -1,5 +1,5 @@ // -*- C++ -*- -// +// // Package: SiPixelPhase1TrackClusters // Class : SiPixelPhase1TrackClusters // @@ -35,8 +35,9 @@ namespace { class SiPixelPhase1TrackClusters final : public SiPixelPhase1Base { -enum { +enum { ON_TRACK_CHARGE, + ON_TRACK_BPCHARGE, ON_TRACK_SIZE, ON_TRACK_SHAPE, ON_TRACK_NCLUSTERS, @@ -54,20 +55,20 @@ enum { ON_TRACK_SHAPE_OUTER, ON_TRACK_SHAPE_INNER, - + ON_TRACK_SIZE_X_OUTER, ON_TRACK_SIZE_X_INNER, ON_TRACK_SIZE_X_F, ON_TRACK_SIZE_Y_OUTER, ON_TRACK_SIZE_Y_INNER, ON_TRACK_SIZE_Y_F, - + ON_TRACK_SIZE_XY_OUTER, ON_TRACK_SIZE_XY_INNER, ON_TRACK_SIZE_XY_F, CHARGE_VS_SIZE_ON_TRACK, - ENUM_SIZE + ENUM_SIZE }; public: @@ -87,11 +88,11 @@ SiPixelPhase1TrackClusters::SiPixelPhase1TrackClusters(const edm::ParameterSet& applyVertexCut_(iConfig.getUntrackedParameter("VertexCut", true)) { tracksToken_ = consumes(iConfig.getParameter("tracks")); - + offlinePrimaryVerticesToken_ = applyVertexCut_ ? consumes(iConfig.getParameter("vertices")) : edm::EDGetTokenT(); - + pixelClusterShapeCacheToken_ = consumes(iConfig.getParameter("clusterShapeCache")); } @@ -137,18 +138,18 @@ void SiPixelPhase1TrackClusters::analyze(const edm::Event& iEvent, const edm::Ev if ( !pixelClusterShapeCacheH.isValid() ) { edm::LogWarning("SiPixelPhase1TrackClusters") << "PixelClusterShapeCache collection is not valid"; return; - } + } auto const & pixelClusterShapeCache = *pixelClusterShapeCacheH; for (auto const & track : *tracks) { - if (applyVertexCut_ && + if (applyVertexCut_ && (track.pt() < 0.75 || std::abs( track.dxy((*vertices)[0].position()) ) > 5 * track.dxyError())) continue; bool isBpixtrack = false, isFpixtrack = false, crossesPixVol = false; // find out whether track crosses pixel fiducial volume (for cosmic tracks) - auto d0 = track.d0(), dz = track.dz(); + auto d0 = track.d0(), dz = track.dz(); if (std::abs(d0) < 15 && std::abs(dz) < 50) crossesPixVol = true; auto etatk = track.eta(); @@ -156,9 +157,9 @@ void SiPixelPhase1TrackClusters::analyze(const edm::Event& iEvent, const edm::Ev auto const & trajParams = track.extra()->trajParams(); assert(trajParams.size()==track.recHitsSize()); auto hb = track.recHitsBegin(); - + for (unsigned int h = 0; h < track.recHitsSize(); h++){ - + auto hit = *(hb + h); if (!hit->isValid()) continue; auto id = hit->geographicalId(); @@ -169,25 +170,43 @@ void SiPixelPhase1TrackClusters::analyze(const edm::Event& iEvent, const edm::Ev if (subdetid == PixelSubdetector::PixelEndcap) isFpixtrack = true; if (subdetid != PixelSubdetector::PixelBarrel && subdetid != PixelSubdetector::PixelEndcap) continue; bool iAmBarrel = subdetid == PixelSubdetector::PixelBarrel; - + // PXB_L4 IS IN THE OTHER WAY // CAN BE XORed BUT LETS KEEP THINGS SIMPLE - bool iAmOuter = ((tkTpl.pxbLadder(id) % 2 == 1) && tkTpl.pxbLayer(id) != 4) || + bool iAmOuter = ((tkTpl.pxbLadder(id) % 2 == 1) && tkTpl.pxbLayer(id) != 4) || ((tkTpl.pxbLadder(id) % 2 != 1) && tkTpl.pxbLayer(id) == 4); - + auto pixhit = dynamic_cast(hit->hit()); if (!pixhit) continue; - // auto geomdetunit = dynamic_cast(pixhit->detUnit()); - // auto const & topol = geomdetunit->specificTopology(); - + auto geomdetunit = dynamic_cast(pixhit->detUnit()); + auto const & topol = geomdetunit->specificTopology(); + // get the cluster auto clustp = pixhit->cluster(); - if (clustp.isNull()) continue; + if (clustp.isNull()) continue; auto const & cluster = *clustp; + + const std::vector pixelsVec = cluster.pixels(); + + + for (unsigned int i = 0; i < pixelsVec.size(); ++i) { + + float pixx = pixelsVec[i].x; // index as float=iteger, row index + float pixy = pixelsVec[i].y; // same, col index + + bool bigInX = topol.isItBigPixelInX(int(pixx)); + bool bigInY = topol.isItBigPixelInY(int(pixy)); + float pixel_charge = pixelsVec[i].adc/1000; + + if (bigInX || bigInY) histo[ON_TRACK_BPCHARGE].fill(pixel_charge, id, &iEvent); + } + + + auto const & ltp = trajParams[h]; - + auto localDir = ltp.momentum() / ltp.momentum().mag(); // correct charge for track impact angle @@ -201,7 +220,7 @@ void SiPixelPhase1TrackClusters::analyze(const edm::Event& iEvent, const edm::Ev if(shapeFilter.getSizes(*pixhit, localDir, pixelClusterShapeCache, part, meas, pred)) { auto shape = shapeFilter.isCompatible(*pixhit, localDir, pixelClusterShapeCache); unsigned shapeVal = (shape ? 1 : 0); - + if (iAmBarrel) { if(iAmOuter) { histo[ON_TRACK_SIZE_X_OUTER].fill(pred.first, cluster.sizeX(), id, &iEvent); @@ -237,7 +256,7 @@ void SiPixelPhase1TrackClusters::analyze(const edm::Event& iEvent, const edm::Ev histo[ON_TRACK_POSITIONF].fill(clustgp.x(), clustgp.y(), id, &iEvent); histo[CHARGE_VS_SIZE_ON_TRACK].fill(cluster.size(), charge, id, &iEvent); - + if (iAmBarrel) // Avoid mistakes even if specification < should > handle it { if(iAmOuter) { @@ -252,17 +271,17 @@ void SiPixelPhase1TrackClusters::analyze(const edm::Event& iEvent, const edm::Ev // statistics on tracks histo[NTRACKS].fill(1, DetId(0), &iEvent); - if (isBpixtrack || isFpixtrack) + if (isBpixtrack || isFpixtrack) histo[NTRACKS].fill(2, DetId(0), &iEvent); - if (isBpixtrack) + if (isBpixtrack) histo[NTRACKS].fill(3, DetId(0), &iEvent); - if (isFpixtrack) + if (isFpixtrack) histo[NTRACKS].fill(4, DetId(0), &iEvent); if (crossesPixVol) { if (isBpixtrack || isFpixtrack) histo[NTRACKS_INVOLUME].fill(1, DetId(0), &iEvent); - else + else histo[NTRACKS_INVOLUME].fill(0, DetId(0), &iEvent); } } @@ -275,4 +294,3 @@ void SiPixelPhase1TrackClusters::analyze(const edm::Event& iEvent, const edm::Ev #include "FWCore/Framework/interface/MakerMacros.h" DEFINE_FWK_MODULE(SiPixelPhase1TrackClusters); - From 16894901aeb097612d795e3dc5449454f7f85518 Mon Sep 17 00:00:00 2001 From: Emily Date: Fri, 23 Feb 2018 10:34:44 -0600 Subject: [PATCH 018/426] Modified name and axis range of the Big Pixel Charge plots --- .../python/SiPixelPhase1Clusters_cfi.py | 41 +++++----- .../src/SiPixelPhase1Clusters.cc | 10 +-- .../python/SiPixelPhase1TrackClusters_cfi.py | 76 ++++++------------- .../src/SiPixelPhase1TrackClusters.cc | 8 +- 4 files changed, 53 insertions(+), 82 deletions(-) diff --git a/DQM/SiPixelPhase1Clusters/python/SiPixelPhase1Clusters_cfi.py b/DQM/SiPixelPhase1Clusters/python/SiPixelPhase1Clusters_cfi.py index 9c6fe6240a2e4..5f39421e7093d 100644 --- a/DQM/SiPixelPhase1Clusters/python/SiPixelPhase1Clusters_cfi.py +++ b/DQM/SiPixelPhase1Clusters/python/SiPixelPhase1Clusters_cfi.py @@ -18,33 +18,32 @@ ) ) -SiPixelPhase1ClustersBPCharge = DefaultHistoDigiCluster.clone( - name = "bpcharge", +SiPixelPhase1ClustersBigPixelCharge = DefaultHistoDigiCluster.clone( + name = "bigpixelcharge", title = "Big Pixel Charge", - range_min = 0, range_max = 70, range_nbins = 300, - xlabel = "Mysterious units", + range_min = 0, range_max = 80e3, range_nbins = 100, + xlabel = "Charge (electrons)", specs = VPSet( - StandardSpecification2DProfile, - StandardSpecificationPixelmapProfile, - StandardSpecificationTrend, - StandardSpecifications1D, - StandardSpecificationTrend2D + Specification().groupBy("PXBarrel").save(), + Specification().groupBy("PXForward").save(), + Specification().groupBy("PXBarrel/PXLayer").save(), + Specification().groupBy("PXForward/PXDisk").save() ) ) -SiPixelPhase1ClustersPCharge = DefaultHistoDigiCluster.clone( - name = "pcharge", - title = "All Pixel Charge", - range_min = 0, range_max = 70, range_nbins = 300, - xlabel = "Mysterious units", +SiPixelPhase1ClustersNotBigPixelCharge = DefaultHistoDigiCluster.clone( + name = "notbigpixelcharge", + title = "Not Big Pixel Charge", + range_min = 0, range_max = 80e3, range_nbins = 100, + xlabel = "Charge (electrons)", + enabled=False, specs = VPSet( - StandardSpecification2DProfile, - StandardSpecificationPixelmapProfile, - StandardSpecificationTrend, - StandardSpecifications1D, - StandardSpecificationTrend2D + Specification().groupBy("PXBarrel").save(), + Specification().groupBy("PXForward").save(), + Specification().groupBy("PXBarrel/PXLayer").save(), + Specification().groupBy("PXForward/PXDisk").save() ) ) @@ -268,8 +267,8 @@ SiPixelPhase1ClustersConf = cms.VPSet( SiPixelPhase1ClustersCharge, - SiPixelPhase1ClustersBPCharge, - SiPixelPhase1ClustersPCharge, + SiPixelPhase1ClustersBigPixelCharge, + SiPixelPhase1ClustersNotBigPixelCharge, SiPixelPhase1ClustersSize, SiPixelPhase1ClustersSizeX, SiPixelPhase1ClustersSizeY, diff --git a/DQM/SiPixelPhase1Clusters/src/SiPixelPhase1Clusters.cc b/DQM/SiPixelPhase1Clusters/src/SiPixelPhase1Clusters.cc index 56bb822eea4da..553043db46486 100644 --- a/DQM/SiPixelPhase1Clusters/src/SiPixelPhase1Clusters.cc +++ b/DQM/SiPixelPhase1Clusters/src/SiPixelPhase1Clusters.cc @@ -25,8 +25,8 @@ namespace { class SiPixelPhase1Clusters final : public SiPixelPhase1Base { enum { CHARGE, - BPCHARGE, - PCHARGE, + BIGPIXELCHARGE, + NOTBIGPIXELCHARGE, SIZE, SIZEX, SIZEY, @@ -103,9 +103,9 @@ namespace { bool bigInX = topol.isItBigPixelInX(int(pixx)); bool bigInY = topol.isItBigPixelInY(int(pixy)); - float pixel_charge = pixelsVec[i].adc/1000; - histo[PCHARGE].fill(pixel_charge, id, &iEvent, col, row); - if (bigInX || bigInY) histo[BPCHARGE].fill(pixel_charge, id, &iEvent, col, row); + float pixel_charge = pixelsVec[i].adc; + if (bigInX || bigInY) histo[BIGPIXELCHARGE].fill(pixel_charge, id, &iEvent, col, row); + else histo[NOTBIGPIXELCHARGE].fill(pixel_charge, id, &iEvent, col, row); } diff --git a/DQM/SiPixelPhase1TrackClusters/python/SiPixelPhase1TrackClusters_cfi.py b/DQM/SiPixelPhase1TrackClusters/python/SiPixelPhase1TrackClusters_cfi.py index 01e5fc84a060e..5ac9f63e343b0 100644 --- a/DQM/SiPixelPhase1TrackClusters/python/SiPixelPhase1TrackClusters_cfi.py +++ b/DQM/SiPixelPhase1TrackClusters/python/SiPixelPhase1TrackClusters_cfi.py @@ -63,63 +63,32 @@ ) ) -SiPixelPhase1TrackClustersOnTrackBPCharge = DefaultHistoTrack.clone( - name = "bpcharge", +SiPixelPhase1TrackClustersOnTrackBigPixelCharge = DefaultHistoTrack.clone( + name = "bigpixelcharge", title = "Corrected Big Pixel Charge (OnTrack)", - range_min = 0, range_max = 80, range_nbins = 100, - xlabel = "Mysterious units", + range_min = 0, range_max = 80e3, range_nbins = 100, + xlabel = "Charge (electrons)", specs = VPSet( - StandardSpecifications1D, - StandardSpecification2DProfile, - - #what is below is only for the timing client - Specification(OverlayCurvesForTiming).groupBy("PXBarrel/OnlineBlock") - .groupBy("PXBarrel", "EXTEND_Y") - .save(), - Specification(OverlayCurvesForTiming).groupBy("PXForward/OnlineBlock") - .groupBy("PXForward", "EXTEND_Y") - .save(), - - Specification().groupBy("PXForward/PXRing").save(), - - Specification(PerModule).groupBy("PXForward/PXRing/Lumisection") - .reduce("MEAN") - .groupBy("PXForward/PXRing","EXTEND_X") - .save(), - - Specification(IsOffline).groupBy("PXForward/PXRing/LumiBlock") - .reduce("MEAN") - .groupBy("PXForward/PXRing","EXTEND_X") - .save(), - - - Specification(PerModule).groupBy("PXBarrel/PXLayer/Lumisection") - .reduce("MEAN") - .groupBy("PXBarrel/PXLayer", "EXTEND_X") - .save(), - - Specification(PerModule).groupBy("PXForward/PXDisk/Lumisection") - .reduce("MEAN") - .groupBy("PXForward/PXDisk", "EXTEND_X") - .save(), - - Specification(IsOffline).groupBy("PXBarrel/PXLayer/LumiBlock") - .reduce("MEAN") - .groupBy("PXBarrel/PXLayer", "EXTEND_X") - .save(), + Specification().groupBy("PXBarrel").save(), + Specification().groupBy("PXForward").save(), + Specification().groupBy("PXBarrel/PXLayer").save(), + Specification().groupBy("PXForward/PXDisk").save() + ) +) - Specification(IsOffline).groupBy("PXForward/PXDisk/LumiBlock") - .reduce("MEAN") - .groupBy("PXForward/PXDisk", "EXTEND_X") - .save(), +SiPixelPhase1TrackClustersOnTrackNotBigPixelCharge = DefaultHistoTrack.clone( + name = "notbigpixelcharge", + title = "Corrected Not Big Pixel Charge (OnTrack)", + range_min = 0, range_max = 80e3, range_nbins = 100, + xlabel = "Charge (electrons)", + enabled=False, - Specification(OverlayCurvesForTiming).groupBy("PXForward/PXDisk/OnlineBlock") # per-layer with history for online - .groupBy("PXForward/PXDisk", "EXTEND_Y") - .save(), - Specification(OverlayCurvesForTiming).groupBy("PXBarrel/PXLayer/OnlineBlock") # per-layer with history for online - .groupBy("PXBarrel/PXLayer", "EXTEND_Y") - .save() + specs = VPSet( + Specification().groupBy("PXBarrel").save(), + Specification().groupBy("PXForward").save(), + Specification().groupBy("PXBarrel/PXLayer").save(), + Specification().groupBy("PXForward/PXDisk").save() ) ) @@ -492,7 +461,8 @@ # copy this in the enum SiPixelPhase1TrackClustersConf = cms.VPSet( SiPixelPhase1TrackClustersOnTrackCharge, - SiPixelPhase1TrackClustersOnTrackBPCharge, + SiPixelPhase1TrackClustersOnTrackBigPixelCharge, + SiPixelPhase1TrackClustersOnTrackNotBigPixelCharge, SiPixelPhase1TrackClustersOnTrackSize, SiPixelPhase1TrackClustersOnTrackShape, SiPixelPhase1TrackClustersOnTrackNClusters, diff --git a/DQM/SiPixelPhase1TrackClusters/src/SiPixelPhase1TrackClusters.cc b/DQM/SiPixelPhase1TrackClusters/src/SiPixelPhase1TrackClusters.cc index 9a6841c53f5bb..1fef305044989 100644 --- a/DQM/SiPixelPhase1TrackClusters/src/SiPixelPhase1TrackClusters.cc +++ b/DQM/SiPixelPhase1TrackClusters/src/SiPixelPhase1TrackClusters.cc @@ -37,7 +37,8 @@ namespace { class SiPixelPhase1TrackClusters final : public SiPixelPhase1Base { enum { ON_TRACK_CHARGE, - ON_TRACK_BPCHARGE, + ON_TRACK_BIGPIXELCHARGE, + ON_TRACK_NOTBIGPIXELCHARGE, ON_TRACK_SIZE, ON_TRACK_SHAPE, ON_TRACK_NCLUSTERS, @@ -198,9 +199,10 @@ void SiPixelPhase1TrackClusters::analyze(const edm::Event& iEvent, const edm::Ev bool bigInX = topol.isItBigPixelInX(int(pixx)); bool bigInY = topol.isItBigPixelInY(int(pixy)); - float pixel_charge = pixelsVec[i].adc/1000; + float pixel_charge = pixelsVec[i].adc; - if (bigInX || bigInY) histo[ON_TRACK_BPCHARGE].fill(pixel_charge, id, &iEvent); + if (bigInX || bigInY) histo[ON_TRACK_BIGPIXELCHARGE].fill(pixel_charge, id, &iEvent); + else histo[ON_TRACK_NOTBIGPIXELCHARGE].fill(pixel_charge, id, &iEvent); } From 23eb8af871b238fa2cb38112e60944631af8fdc0 Mon Sep 17 00:00:00 2001 From: Emily Date: Sat, 24 Feb 2018 15:55:08 -0600 Subject: [PATCH 019/426] Fixing HLT error --- .../src/SiPixelPhase1Clusters.cc | 180 +++++++++--------- .../src/SiPixelPhase1TrackClusters.cc | 19 +- .../SiPixel_OfflineMonitoring_Cluster_cff.py | 47 ++++- ...ixel_OfflineMonitoring_TrackCluster_cff.py | 61 ++++-- 4 files changed, 185 insertions(+), 122 deletions(-) diff --git a/DQM/SiPixelPhase1Clusters/src/SiPixelPhase1Clusters.cc b/DQM/SiPixelPhase1Clusters/src/SiPixelPhase1Clusters.cc index 553043db46486..b8b53afe2beb2 100644 --- a/DQM/SiPixelPhase1Clusters/src/SiPixelPhase1Clusters.cc +++ b/DQM/SiPixelPhase1Clusters/src/SiPixelPhase1Clusters.cc @@ -7,7 +7,6 @@ // Original Author: Marcel Schneider #include "DQM/SiPixelPhase1Common/interface/SiPixelPhase1Base.h" -#include "DataFormats/Common/interface/DetSetVector.h" #include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" #include "DataFormats/SiStripCluster/interface/SiStripCluster.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -22,126 +21,127 @@ namespace { - class SiPixelPhase1Clusters final : public SiPixelPhase1Base { - enum { - CHARGE, - BIGPIXELCHARGE, - NOTBIGPIXELCHARGE, - SIZE, - SIZEX, - SIZEY, - NCLUSTERS, - NCLUSTERSINCLUSIVE, - EVENTRATE, - POSITION_B, - POSITION_F, - POSITION_XZ, - POSITION_YZ, - SIZE_VS_ETA, - READOUT_CHARGE, - READOUT_NCLUSTERS, - PIXEL_TO_STRIP_RATIO - }; +class SiPixelPhase1Clusters final : public SiPixelPhase1Base { + enum { + CHARGE, + BIGPIXELCHARGE, + NOTBIGPIXELCHARGE, + SIZE, + SIZEX, + SIZEY, + NCLUSTERS, + NCLUSTERSINCLUSIVE, + EVENTRATE, + POSITION_B, + POSITION_F, + POSITION_XZ, + POSITION_YZ, + SIZE_VS_ETA, + READOUT_CHARGE, + READOUT_NCLUSTERS, + PIXEL_TO_STRIP_RATIO + }; public: - explicit SiPixelPhase1Clusters(const edm::ParameterSet& conf); - void analyze(const edm::Event&, const edm::EventSetup&) override; + explicit SiPixelPhase1Clusters(const edm::ParameterSet& conf); + void analyze(const edm::Event&, const edm::EventSetup&) override; private: - edm::EDGetTokenT > pixelSrcToken_; - edm::EDGetTokenT > stripSrcToken_; - }; + edm::EDGetTokenT > pixelSrcToken_; + edm::EDGetTokenT > stripSrcToken_; +}; - SiPixelPhase1Clusters::SiPixelPhase1Clusters(const edm::ParameterSet& iConfig) : +SiPixelPhase1Clusters::SiPixelPhase1Clusters(const edm::ParameterSet& iConfig) : SiPixelPhase1Base(iConfig) - { - pixelSrcToken_ = consumes>(iConfig.getParameter("pixelSrc")); +{ + pixelSrcToken_ = consumes>(iConfig.getParameter("pixelSrc")); - stripSrcToken_ = consumes>(iConfig.getParameter("stripSrc")); - } + stripSrcToken_ = consumes>(iConfig.getParameter("stripSrc")); +} - void SiPixelPhase1Clusters::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - if( !checktrigger(iEvent,iSetup,DCS) ) return; +void SiPixelPhase1Clusters::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + if( !checktrigger(iEvent,iSetup,DCS) ) return; - edm::Handle> inputPixel; - iEvent.getByToken(pixelSrcToken_, inputPixel); - if (!inputPixel.isValid()) return; + edm::Handle> inputPixel; + iEvent.getByToken(pixelSrcToken_, inputPixel); + if (!inputPixel.isValid()) return; - edm::Handle> inputStrip; - iEvent.getByToken(stripSrcToken_, inputStrip); - if (inputStrip.isValid()) + edm::Handle> inputStrip; + iEvent.getByToken(stripSrcToken_, inputStrip); + if (inputStrip.isValid()) + { + if (!inputStrip.product()->data().empty()) { - if (!inputStrip.product()->data().empty()) - { - histo[PIXEL_TO_STRIP_RATIO].fill((double)inputPixel.product()->data().size() / (double) inputStrip.product()->data().size(), DetId(0), &iEvent); - } + histo[PIXEL_TO_STRIP_RATIO].fill((double)inputPixel.product()->data().size() / (double) inputStrip.product()->data().size(), DetId(0), &iEvent); } + } - bool hasClusters=false; - - edm::ESHandle tracker; - iSetup.get().get(tracker); - assert(tracker.isValid()); + bool hasClusters=false; - edmNew::DetSetVector::const_iterator it; + edm::ESHandle tracker; + iSetup.get().get(tracker); + assert(tracker.isValid()); + edmNew::DetSetVector::const_iterator it; for (it = inputPixel->begin(); it != inputPixel->end(); ++it) { - auto id = DetId(it->detId()); - - const PixelGeomDetUnit* theGeomDet = dynamic_cast ( tracker->idToDet(id) ); - const PixelTopology& topol = theGeomDet->specificTopology(); + auto id = DetId(it->detId()); - for(SiPixelCluster const& cluster : *it) { - int row = cluster.x()-0.5, col = cluster.y()-0.5; + const PixelGeomDetUnit* theGeomDet = dynamic_cast ( tracker->idToDet(id) ); + const PixelTopology& topol = theGeomDet->specificTopology(); - const std::vector pixelsVec = cluster.pixels(); + for(SiPixelCluster const& cluster : *it) { + int row = cluster.x()-0.5, col = cluster.y()-0.5; + const std::vector pixelsVec = cluster.pixels(); - for (unsigned int i = 0; i < pixelsVec.size(); ++i) { + for (unsigned int i = 0; i < pixelsVec.size(); ++i) { - float pixx = pixelsVec[i].x; // index as float=iteger, row index - float pixy = pixelsVec[i].y; // same, col index - - bool bigInX = topol.isItBigPixelInX(int(pixx)); - bool bigInY = topol.isItBigPixelInY(int(pixy)); - float pixel_charge = pixelsVec[i].adc; - if (bigInX || bigInY) histo[BIGPIXELCHARGE].fill(pixel_charge, id, &iEvent, col, row); - else histo[NOTBIGPIXELCHARGE].fill(pixel_charge, id, &iEvent, col, row); - } + float pixx = pixelsVec[i].x; // index as float=iteger, row index + float pixy = pixelsVec[i].y; // same, col index + bool bigInX = topol.isItBigPixelInX(int(pixx)); + bool bigInY = topol.isItBigPixelInY(int(pixy)); + float pixel_charge = pixelsVec[i].adc; - histo[READOUT_CHARGE].fill(double(cluster.charge()), id, &iEvent, col, row); - histo[CHARGE].fill(double(cluster.charge()), id, &iEvent, col, row); - histo[SIZE ].fill(double(cluster.size() ), id, &iEvent, col, row); - histo[SIZEX ].fill(double(cluster.sizeX() ), id, &iEvent, col, row); - histo[SIZEY ].fill(double(cluster.sizeY() ), id, &iEvent, col, row); - histo[NCLUSTERS].fill(id, &iEvent, col, row); - histo[NCLUSTERSINCLUSIVE].fill(id, &iEvent); - hasClusters=true; - //if (bigInX || bigInY) histo_BigPixCharge.fill(double(cluster.charge()), id, &iEvent, col, row); + if (bigInX==true || bigInY==true) { + histo[BIGPIXELCHARGE].fill(pixel_charge, id, &iEvent, col, row); + } - if (cluster.size()>1){ - histo[READOUT_NCLUSTERS].fill(id, &iEvent); + else { + histo[NOTBIGPIXELCHARGE].fill(pixel_charge, id, &iEvent, col, row); } + } + histo[READOUT_CHARGE].fill(double(cluster.charge()), id, &iEvent, col, row); + histo[CHARGE].fill(double(cluster.charge()), id, &iEvent, col, row); + histo[SIZE ].fill(double(cluster.size() ), id, &iEvent, col, row); + histo[SIZEX ].fill(double(cluster.sizeX() ), id, &iEvent, col, row); + histo[SIZEY ].fill(double(cluster.sizeY() ), id, &iEvent, col, row); + histo[NCLUSTERS].fill(id, &iEvent, col, row); + histo[NCLUSTERSINCLUSIVE].fill(id, &iEvent); + hasClusters=true; + if (cluster.size()>1){ + histo[READOUT_NCLUSTERS].fill(id, &iEvent); + } - LocalPoint clustlp = topol.localPosition(MeasurementPoint(cluster.x(), cluster.y())); - GlobalPoint clustgp = theGeomDet->surface().toGlobal(clustlp); - histo[POSITION_B ].fill(clustgp.z(), clustgp.phi(), id, &iEvent); - histo[POSITION_F ].fill(clustgp.x(), clustgp.y(), id, &iEvent); - histo[POSITION_XZ].fill(clustgp.x(), clustgp.z(), id, &iEvent); - histo[POSITION_YZ].fill(clustgp.y(), clustgp.z(), id, &iEvent); - histo[SIZE_VS_ETA].fill(clustgp.eta(), cluster.sizeY(), id, &iEvent); + LocalPoint clustlp = topol.localPosition(MeasurementPoint(cluster.x(), cluster.y())); + GlobalPoint clustgp = theGeomDet->surface().toGlobal(clustlp); + histo[POSITION_B ].fill(clustgp.z(), clustgp.phi(), id, &iEvent); + histo[POSITION_F ].fill(clustgp.x(), clustgp.y(), id, &iEvent); + histo[POSITION_XZ].fill(clustgp.x(), clustgp.z(), id, &iEvent); + histo[POSITION_YZ].fill(clustgp.y(), clustgp.z(), id, &iEvent); + histo[SIZE_VS_ETA].fill(clustgp.eta(), cluster.sizeY(), id, &iEvent); - } } + } - if (hasClusters) histo[EVENTRATE].fill(DetId(0), &iEvent); - histo[NCLUSTERS].executePerEventHarvesting(&iEvent); - histo[READOUT_NCLUSTERS].executePerEventHarvesting(&iEvent); - histo[NCLUSTERSINCLUSIVE].executePerEventHarvesting(&iEvent); + if (hasClusters) histo[EVENTRATE].fill(DetId(0), &iEvent); - } + histo[NCLUSTERS].executePerEventHarvesting(&iEvent); + histo[READOUT_NCLUSTERS].executePerEventHarvesting(&iEvent); + histo[NCLUSTERSINCLUSIVE].executePerEventHarvesting(&iEvent); + +} } // namespace diff --git a/DQM/SiPixelPhase1TrackClusters/src/SiPixelPhase1TrackClusters.cc b/DQM/SiPixelPhase1TrackClusters/src/SiPixelPhase1TrackClusters.cc index 1fef305044989..17fc50f9d5671 100644 --- a/DQM/SiPixelPhase1TrackClusters/src/SiPixelPhase1TrackClusters.cc +++ b/DQM/SiPixelPhase1TrackClusters/src/SiPixelPhase1TrackClusters.cc @@ -187,11 +187,7 @@ void SiPixelPhase1TrackClusters::analyze(const edm::Event& iEvent, const edm::Ev auto clustp = pixhit->cluster(); if (clustp.isNull()) continue; auto const & cluster = *clustp; - - const std::vector pixelsVec = cluster.pixels(); - - for (unsigned int i = 0; i < pixelsVec.size(); ++i) { float pixx = pixelsVec[i].x; // index as float=iteger, row index @@ -201,12 +197,17 @@ void SiPixelPhase1TrackClusters::analyze(const edm::Event& iEvent, const edm::Ev bool bigInY = topol.isItBigPixelInY(int(pixy)); float pixel_charge = pixelsVec[i].adc; - if (bigInX || bigInY) histo[ON_TRACK_BIGPIXELCHARGE].fill(pixel_charge, id, &iEvent); - else histo[ON_TRACK_NOTBIGPIXELCHARGE].fill(pixel_charge, id, &iEvent); - } - - + if (bigInX==true || bigInY==true) { + std::cout<<"Failure here 1?"< Date: Mon, 26 Feb 2018 08:38:41 +0100 Subject: [PATCH 020/426] DQM diamond updated with efficiency and pixel tomography --- DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc | 339 +++++++++++++----- DQM/CTPPS/python/ctppsDiamondDQMSource_cfi.py | 3 +- DQM/CTPPS/test/diamond_dqm_test_cfg.py | 66 +++- 3 files changed, 300 insertions(+), 108 deletions(-) diff --git a/DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc b/DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc index c71031024c361..01732d2b9d49d 100644 --- a/DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc +++ b/DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc @@ -28,13 +28,34 @@ #include "DataFormats/CTPPSDetId/interface/CTPPSDiamondDetId.h" #include "DataFormats/CTPPSDigi/interface/CTPPSDiamondDigi.h" +#include "DataFormats/CTPPSReco/interface/CTPPSPixelLocalTrack.h" +#include "DataFormats/CTPPSDetId/interface/CTPPSPixelDetId.h" + #include "DataFormats/CTPPSReco/interface/CTPPSDiamondRecHit.h" #include "DataFormats/CTPPSReco/interface/CTPPSDiamondLocalTrack.h" +#include "Geometry/VeryForwardGeometryBuilder/interface/CTPPSGeometry.h" +#include "Geometry/Records/interface/VeryForwardRealGeometryRecord.h" #include //---------------------------------------------------------------------------------------------------- + +// Utility for efficiency computations +bool channelAlignedWithTrack( const CTPPSGeometry* geom, const CTPPSDiamondDetId& detid, const CTPPSDiamondLocalTrack& localTrack, const float tolerance=1) { + const DetGeomDesc* det = geom->getSensor( detid ); + const float x_pos = det->translation().x(), + x_width = 2.0 * det->params().at( 0 ); // parameters stand for half the size + return + ( ( x_pos + 0.5 * x_width > localTrack.getX0() - localTrack.getX0Sigma() - tolerance + && x_pos + 0.5 * x_width < localTrack.getX0() + localTrack.getX0Sigma() + tolerance ) + || ( x_pos - 0.5 * x_width > localTrack.getX0() - localTrack.getX0Sigma() - tolerance + && x_pos - 0.5 * x_width < localTrack.getX0() + localTrack.getX0Sigma() + tolerance ) + || ( x_pos - 0.5 * x_width < localTrack.getX0() - localTrack.getX0Sigma() - tolerance + && x_pos + 0.5 * x_width > localTrack.getX0() + localTrack.getX0Sigma() + tolerance ) ); +} + + class CTPPSDiamondDQMSource : public DQMEDAnalyzer { public: @@ -59,6 +80,7 @@ class CTPPSDiamondDQMSource : public DQMEDAnalyzer static const int CTPPS_NUM_OF_ARMS; static const int CTPPS_DIAMOND_STATION_ID; static const int CTPPS_DIAMOND_RP_ID; + static const int CTPPS_PIXEL_STATION_ID; static const int CTPPS_NEAR_RP_ID; static const int CTPPS_FAR_RP_ID; static const int CTPPS_DIAMOND_NUM_OF_PLANES; @@ -68,14 +90,15 @@ class CTPPSDiamondDQMSource : public DQMEDAnalyzer edm::EDGetTokenT< edm::DetSetVector > tokenStatus_; edm::EDGetTokenT< edm::DetSetVector > tokenLocalTrack_; + edm::EDGetTokenT< edm::DetSetVector > tokenPixelTrack_; edm::EDGetTokenT< edm::DetSetVector > tokenDigi_; edm::EDGetTokenT< edm::DetSetVector > tokenDiamondHit_; edm::EDGetTokenT< edm::DetSetVector > tokenDiamondTrack_; edm::EDGetTokenT< std::vector > tokenFEDInfo_; bool excludeMultipleHits_; - double minimumStripAngleForTomography_; - double maximumStripAngleForTomography_; + double horizontalShiftBwDiamondPixels_; + double horizontalShiftOfDiamond_; std::vector< std::pair > runParameters_; int centralOOT_; unsigned int verbosity_; @@ -108,12 +131,12 @@ class CTPPSDiamondDQMSource : public DQMEDAnalyzer MonitorElement* trackDistribution = nullptr; MonitorElement* trackDistributionOOT = nullptr; - MonitorElement* stripTomographyAllFar_0_25 = nullptr; - MonitorElement* stripTomographyAllFar_25_50 = nullptr; - MonitorElement* stripTomographyAllFar_50_75 = nullptr; - std::vector< MonitorElement* > stripTomographyAllFar; + MonitorElement* pixelTomographyAll_0_25 = nullptr; + MonitorElement* pixelTomographyAll_25_50 = nullptr; + MonitorElement* pixelTomographyAll_50_75 = nullptr; + std::vector< MonitorElement* > pixelTomographyAll; - MonitorElement* leadingEdgeCumulative_both = nullptr, *leadingEdgeCumulative_le = nullptr, *trailingEdgeCumulative_te = nullptr; + MonitorElement* leadingEdgeCumulative_both = nullptr, *leadingEdgeCumulative_all = nullptr, *leadingEdgeCumulative_le = nullptr, *trailingEdgeCumulative_te = nullptr; MonitorElement* timeOverThresholdCumulativePot = nullptr, *leadingTrailingCorrelationPot = nullptr; MonitorElement* leadingWithoutTrailingCumulativePot = nullptr; @@ -129,7 +152,12 @@ class CTPPSDiamondDQMSource : public DQMEDAnalyzer unsigned int HitCounter, MHCounter, LeadingOnlyCounter, TrailingOnlyCounter, CompleteCounter; - PotPlots() {}; + std::map effTriplecountingChMap; + std::map effDoublecountingChMap; + MonitorElement* EfficiencyOfChannelsInPot = nullptr; + TH2F pixelTracksMap; + + PotPlots() {} PotPlots( DQMStore::IBooker& ibooker, unsigned int id ); }; @@ -143,7 +171,10 @@ class CTPPSDiamondDQMSource : public DQMEDAnalyzer MonitorElement* hitProfile = nullptr; MonitorElement* hit_multiplicity = nullptr; - MonitorElement* stripTomography_far = nullptr; + MonitorElement* pixelTomography_far = nullptr; + MonitorElement* EfficiencyWRTPixelsInPlane = nullptr; + + TH2F pixelTracksMapWithDiamonds; PlanePlots() {} PlanePlots( DQMStore::IBooker& ibooker, unsigned int id ); @@ -164,7 +195,7 @@ class CTPPSDiamondDQMSource : public DQMEDAnalyzer MonitorElement* TimeOverThresholdCumulativePerChannel = nullptr; MonitorElement* LeadingTrailingCorrelationPerChannel = nullptr; MonitorElement* leadingWithoutTrailing = nullptr; - MonitorElement* stripTomography_far = nullptr; + MonitorElement* pixelTomography_far = nullptr; MonitorElement* hit_rate = nullptr; MonitorElement* ECCheckPerChannel = nullptr; unsigned long hitsCounterPerLumisection; @@ -183,11 +214,12 @@ class CTPPSDiamondDQMSource : public DQMEDAnalyzer // Values for all constants const double CTPPSDiamondDQMSource::SEC_PER_LUMI_SECTION = 23.31; const int CTPPSDiamondDQMSource::CHANNEL_OF_VFAT_CLOCK = 30; -const double CTPPSDiamondDQMSource::DISPLAY_RESOLUTION_FOR_HITS_MM = 0.1; +const double CTPPSDiamondDQMSource::DISPLAY_RESOLUTION_FOR_HITS_MM = 0.01; const double CTPPSDiamondDQMSource::INV_DISPLAY_RESOLUTION_FOR_HITS_MM = 1./DISPLAY_RESOLUTION_FOR_HITS_MM; const double CTPPSDiamondDQMSource::HPTDC_BIN_WIDTH_NS = 25./1024; const int CTPPSDiamondDQMSource::CTPPS_NUM_OF_ARMS = 2; const int CTPPSDiamondDQMSource::CTPPS_DIAMOND_STATION_ID = 1; +const int CTPPSDiamondDQMSource::CTPPS_PIXEL_STATION_ID = 2; const int CTPPSDiamondDQMSource::CTPPS_DIAMOND_RP_ID = 6; const int CTPPSDiamondDQMSource::CTPPS_NEAR_RP_ID = 2; const int CTPPSDiamondDQMSource::CTPPS_FAR_RP_ID = 3; @@ -216,7 +248,7 @@ CTPPSDiamondDQMSource::GlobalPlots::GlobalPlots( DQMStore::IBooker& ibooker ) //---------------------------------------------------------------------------------------------------- -CTPPSDiamondDQMSource::PotPlots::PotPlots( DQMStore::IBooker& ibooker, unsigned int id ): HitCounter(0), MHCounter(0), LeadingOnlyCounter(0), TrailingOnlyCounter(0), CompleteCounter(0) +CTPPSDiamondDQMSource::PotPlots::PotPlots( DQMStore::IBooker& ibooker, unsigned int id ): HitCounter(0), MHCounter(0), LeadingOnlyCounter(0), TrailingOnlyCounter(0), CompleteCounter(0), pixelTracksMap("Pixel track maps for efficiency", "Pixel track maps for efficiency", 27, -2, 25, 18, -4, 14 ) { std::string path, title; CTPPSDiamondDetId( id ).rpName( path, CTPPSDiamondDetId::nPath ); @@ -231,26 +263,27 @@ CTPPSDiamondDQMSource::PotPlots::PotPlots( DQMStore::IBooker& ibooker, unsigned activity_per_bx_50_75 = ibooker.book1D( "activity per BX 50 75", title+" Activity per BX 50 - 75 ns;Event.BX", 3600, -1.5, 3598. + 0.5 ); activity_per_bx.emplace_back(activity_per_bx_50_75); - hitDistribution2d = ibooker.book2D( "hits in planes", title+" hits in planes;plane number;x (mm)", 10, -0.5, 4.5, 19.*INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -1, 18 ); - hitDistribution2d_lumisection = ibooker.book2D( "hits in planes lumisection", title+" hits in planes in the last lumisection;plane number;x (mm)", 10, -0.5, 4.5, 19.*INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -1, 18 ); - hitDistribution2dOOT= ibooker.book2D( "hits with OOT in planes", title+" hits with OOT in planes;plane number + 0.25 OOT;x (mm)", 17, -0.25, 4, 19.*INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -1, 18 ); - hitDistribution2dOOT_le= ibooker.book2D( "hits with OOT in planes (le only)", title+" hits with OOT in planes (le only);plane number + 0.25 OOT;x (mm)", 17, -0.25, 4, 19.*INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -1, 18 ); + hitDistribution2d = ibooker.book2D( "hits in planes", title+" hits in planes;plane number;x (mm)", 10, -0.5, 4.5, 19.*INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -0.5, 18.5 ); + hitDistribution2d_lumisection = ibooker.book2D( "hits in planes lumisection", title+" hits in planes in the last lumisection;plane number;x (mm)", 10, -0.5, 4.5, 19.*INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -0.5, 18.5 ); + hitDistribution2dOOT= ibooker.book2D( "hits with OOT in planes", title+" hits with OOT in planes;plane number + 0.25 OOT;x (mm)", 17, -0.25, 4, 19.*INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -0.5, 18.5 ); + hitDistribution2dOOT_le= ibooker.book2D( "hits with OOT in planes (le only)", title+" hits with OOT in planes (le only);plane number + 0.25 OOT;x (mm)", 17, -0.25, 4, 19.*INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -0.5, 18.5 ); activePlanes = ibooker.book1D( "active planes", title+" active planes (per event);number of active planes", 6, -0.5, 5.5 ); activePlanesInclusive = ibooker.book1D( "active planes inclusive", title+" active planes, MH and le only included (per event);number of active planes", 6, -0.5, 5.5 ); - trackDistribution = ibooker.book1D( "tracks", title+" tracks;x (mm)", 19.*INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -1, 18 ); - trackDistributionOOT = ibooker.book2D( "tracks with OOT", title+" tracks with OOT;plane number;x (mm)", 9, -0.5, 4, 19.*INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -1, 18 ); + trackDistribution = ibooker.book1D( "tracks", title+" tracks;x (mm)", 19.*INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -0.5, 18.5 ); + trackDistributionOOT = ibooker.book2D( "tracks with OOT", title+" tracks with OOT;plane number;x (mm)", 9, -0.5, 4, 19.*INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -0.5, 18.5 ); - stripTomographyAllFar_0_25 = ibooker.book2D( "tomography all far 0 25", title+" tomography with strips far 0 - 25 ns (all planes);x + 25*plane(mm);y (mm)", 100, 0, 100, 12, -2, 10 ); - stripTomographyAllFar.emplace_back(stripTomographyAllFar_0_25); - stripTomographyAllFar_25_50 = ibooker.book2D( "tomography all far 25 50", title+" tomography with strips far 25 - 50 ns (all planes);x + 25*plane(mm);y (mm)", 100, 0, 100, 12, -2, 10 ); - stripTomographyAllFar.emplace_back(stripTomographyAllFar_25_50); - stripTomographyAllFar_50_75 = ibooker.book2D( "tomography all far 50 75", title+" tomography with strips far 50 - 75 ns (all planes);x + 25*plane(mm);y (mm)", 100, 0, 100, 12, -2, 10 ); - stripTomographyAllFar.emplace_back(stripTomographyAllFar_50_75); + pixelTomographyAll_0_25 = ibooker.book2D( "tomography pixel 0 25", title+" tomography with pixel 0 - 25 ns (all planes);x + 25*plane(mm);y (mm)", 100, -2, 98, 12, -2, 10 ); + pixelTomographyAll.emplace_back(pixelTomographyAll_0_25); + pixelTomographyAll_25_50 = ibooker.book2D( "tomography pixel 25 50", title+" tomography with pixel 25 - 50 ns (all planes);x + 25*plane(mm);y (mm)", 100, -2, 98, 12, -2, 10 ); + pixelTomographyAll.emplace_back(pixelTomographyAll_25_50); + pixelTomographyAll_50_75 = ibooker.book2D( "tomography pixel 50 75", title+" tomography with pixel 50 - 75 ns (all planes);x + 25*plane(mm);y (mm)", 100, -2, 98, 12, -2, 10 ); + pixelTomographyAll.emplace_back(pixelTomographyAll_50_75); - leadingEdgeCumulative_both = ibooker.book1D( "leading edge (le and te)", title+" leading edge (le and te); leading edge (ns)", 125, 0, 125 ); - leadingEdgeCumulative_le = ibooker.book1D( "leading edge (le only)", title+" leading edge (le only); leading edge (ns)", 125, 0, 125 ); - trailingEdgeCumulative_te = ibooker.book1D( "trailing edge (te only)", title+" trailing edge (te only); trailing edge (ns)", 125, 0, 125 ); + leadingEdgeCumulative_both = ibooker.book1D( "leading edge (le and te)", title+" leading edge (le and te) (recHits); leading edge (ns)", 125, 0, 125 ); + leadingEdgeCumulative_all = ibooker.book1D( "leading edge (all)", title+" leading edge (all) (DIGIs); leading edge (ns)", 125, 0, 125 ); + leadingEdgeCumulative_le = ibooker.book1D( "leading edge (le only)", title+" leading edge (le only) (DIGIs); leading edge (ns)", 125, 0, 125 ); + trailingEdgeCumulative_te = ibooker.book1D( "trailing edge (te only)", title+" trailing edge (te only) (DIGIs); trailing edge (ns)", 125, 0, 125 ); timeOverThresholdCumulativePot = ibooker.book1D( "time over threshold", title+" time over threshold;time over threshold (ns)", 250, -25, 100 ); leadingTrailingCorrelationPot = ibooker.book2D( "leading trailing correlation", title+" leading trailing correlation;leading edge (ns);trailing edge (ns)", 75, 0, 75, 75, 0, 75 ); @@ -268,16 +301,19 @@ CTPPSDiamondDQMSource::PotPlots::PotPlots( DQMStore::IBooker& ibooker, unsigned MHComprensive = ibooker.book2D( "MH in channels", title+" MH (%) in channels;plane number;ch number", 10, -0.5, 4.5, 14, -1, 13 ); + EfficiencyOfChannelsInPot = ibooker.book2D( "Efficiency in channels", title+" Efficiency (%) in channels (diamonds only);plane number;ch number", 10, -0.5, 4.5, 14, -1, 13 ); + ibooker.setCurrentFolder( path+"/clock/" ); clock_Digi1_le = ibooker.book1D( "clock1 leading edge", title+" clock1;leading edge (ns)", 1250, 0, 125 ); clock_Digi1_te = ibooker.book1D( "clock1 trailing edge", title+" clock1;trailing edge (ns)", 75, 0, 75 ); clock_Digi3_le = ibooker.book1D( "clock3 leading edge", title+" clock3;leading edge (ns)", 1250, 0, 125 ); clock_Digi3_te = ibooker.book1D( "clock3 trailing edge", title+" clock3;trailing edge (ns)", 75, 0, 75 ); + } //---------------------------------------------------------------------------------------------------- -CTPPSDiamondDQMSource::PlanePlots::PlanePlots( DQMStore::IBooker& ibooker, unsigned int id ) +CTPPSDiamondDQMSource::PlanePlots::PlanePlots( DQMStore::IBooker& ibooker, unsigned int id ) : pixelTracksMapWithDiamonds("Pixel track maps for efficiency with coincidence", "Pixel track maps for efficiency with coincidence", 27, -2, 25, 18, -4, 14 ) { std::string path, title; CTPPSDiamondDetId( id ).planeName( path, CTPPSDiamondDetId::nPath ); @@ -286,10 +322,12 @@ CTPPSDiamondDQMSource::PlanePlots::PlanePlots( DQMStore::IBooker& ibooker, unsig CTPPSDiamondDetId( id ).planeName( title, CTPPSDiamondDetId::nFull ); digiProfileCumulativePerPlane = ibooker.book1D( "digi profile", title+" digi profile; ch number", 12, -0.5, 11.5 ); - hitProfile = ibooker.book1D( "hit profile", title+" hit profile;x (mm)", 19.*INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -1, 18 ); + hitProfile = ibooker.book1D( "hit profile", title+" hit profile;x (mm)", 19.*INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -0.5, 18.5 ); hit_multiplicity = ibooker.book1D( "channels per plane", title+" channels per plane; ch per plane", 13, -0.5, 12.5 ); - stripTomography_far = ibooker.book2D( "tomography far", title+" tomography with strips far;x + 25 OOT (mm);y (mm)", 50, 0, 50, 12, -2, 10 ); + pixelTomography_far = ibooker.book2D( "tomography pixel", title+" tomography with pixel;x + 25 OOT (mm);y (mm)", 100, -2, 98, 12, -2, 10 ); + EfficiencyWRTPixelsInPlane = ibooker.book2D( "Efficieny wrt pixel", title+" Efficieny wrt pixel;x (mm);y (mm)", 27, -2, 25, 18, -4, 14 ); + } //---------------------------------------------------------------------------------------------------- @@ -319,15 +357,15 @@ CTPPSDiamondDQMSource::ChannelPlots::ChannelPlots( DQMStore::IBooker& ibooker, u HPTDCErrorFlags->getTH1F()->GetXaxis()->SetBinLabel( error_index, HPTDCErrorFlags::getHPTDCErrorName( error_index-1 ).c_str() ); HPTDCErrorFlags->getTH1F()->GetXaxis()->SetBinLabel( 16, "MH (%)" ); - leadingEdgeCumulative_both = ibooker.book1D( "leading edge (le and te)", title+" leading edge; leading edge (ns)", 125, 0, 125 ); - leadingEdgeCumulative_le = ibooker.book1D( "leading edge (le only)", title+" leading edge; leading edge (ns)", 125, 0, 125 ); - trailingEdgeCumulative_te = ibooker.book1D( "trailing edge (te only)", title+" trailing edge (te only); trailing edge (ns)", 125, 0, 125 ); + leadingEdgeCumulative_both = ibooker.book1D( "leading edge (le and te)", title+" leading edge (recHits); leading edge (ns)", 125, 0, 125 ); + leadingEdgeCumulative_le = ibooker.book1D( "leading edge (le only)", title+" leading edge (DIGIs); leading edge (ns)", 125, 0, 125 ); + trailingEdgeCumulative_te = ibooker.book1D( "trailing edge (te only)", title+" trailing edge (te only) (DIGIs); trailing edge (ns)", 125, 0, 125 ); TimeOverThresholdCumulativePerChannel = ibooker.book1D( "time over threshold", title+" time over threshold;time over threshold (ns)", 75, -25, 50 ); LeadingTrailingCorrelationPerChannel = ibooker.book2D( "leading trailing correlation", title+" leading trailing correlation;leading edge (ns);trailing edge (ns)", 75, 0, 75, 75, 0, 75 ); ECCheckPerChannel = ibooker.book1D("optorxEC(8bit) - vfatEC vs optorxEC", title+" EC Error;optorxEC-vfatEC", 128, -64, 64 ); - stripTomography_far = ibooker.book2D( "tomography far", "tomography with strips far;x + 25 OOT (mm);y (mm)", 50, 0, 50, 12, -2, 10 ); + pixelTomography_far = ibooker.book2D( "tomography pixel", "tomography with pixel;x + 25 OOT (mm);y (mm)", 100, -2, 98, 12, -2, 10 ); hit_rate = ibooker.book1D( "hit rate", title+"hit rate;rate (Hz)", 40, 0, 20); } @@ -337,13 +375,12 @@ CTPPSDiamondDQMSource::ChannelPlots::ChannelPlots( DQMStore::IBooker& ibooker, u CTPPSDiamondDQMSource::CTPPSDiamondDQMSource( const edm::ParameterSet& ps ) : tokenStatus_ ( consumes< edm::DetSetVector > ( ps.getParameter( "tagStatus" ) ) ), tokenLocalTrack_ ( consumes< edm::DetSetVector > ( ps.getParameter( "tagLocalTrack" ) ) ), + tokenPixelTrack_ ( consumes< edm::DetSetVector > ( ps.getParameter( "tagPixelLocalTracks" ) ) ), tokenDigi_ ( consumes< edm::DetSetVector > ( ps.getParameter( "tagDigi" ) ) ), tokenDiamondHit_ ( consumes< edm::DetSetVector > ( ps.getParameter( "tagDiamondRecHits" ) ) ), tokenDiamondTrack_( consumes< edm::DetSetVector >( ps.getParameter( "tagDiamondLocalTracks" ) ) ), tokenFEDInfo_ ( consumes< std::vector > ( ps.getParameter( "tagFEDInfo" ) ) ), - excludeMultipleHits_ ( ps.getParameter( "excludeMultipleHits" ) ), - minimumStripAngleForTomography_( ps.getParameter( "minimumStripAngleForTomography" ) ), - maximumStripAngleForTomography_( ps.getParameter( "maximumStripAngleForTomography" ) ), + excludeMultipleHits_ ( ps.getParameter( "excludeMultipleHits" ) ), centralOOT_( -999 ), verbosity_ ( ps.getUntrackedParameter( "verbosity", 0 ) ), EC_difference_56_( -500 ), EC_difference_45_( -500 ) @@ -361,7 +398,7 @@ CTPPSDiamondDQMSource::~CTPPSDiamondDQMSource() //---------------------------------------------------------------------------------------------------- void -CTPPSDiamondDQMSource::dqmBeginRun( const edm::Run& iRun, const edm::EventSetup& ) +CTPPSDiamondDQMSource::dqmBeginRun( const edm::Run& iRun, const edm::EventSetup& iSetup ) { centralOOT_ = -999; for ( const auto& oot : runParameters_ ) { @@ -369,6 +406,19 @@ CTPPSDiamondDQMSource::dqmBeginRun( const edm::Run& iRun, const edm::EventSetup& centralOOT_ = oot.second; break; } } + + // Get detector shifts from the geometry + edm::ESHandle geometry_; + iSetup.get().get( geometry_ ); + const CTPPSGeometry *geom = geometry_.product(); + const CTPPSDiamondDetId detid(0, CTPPS_DIAMOND_STATION_ID, CTPPS_DIAMOND_RP_ID, 0, 0 ); + const DetGeomDesc* det = geom->getSensor( detid ); + horizontalShiftOfDiamond_ = det->translation().x() - det->params().at( 0 ); + + // Rough alignement of pixel detector for diamond thomography + const CTPPSPixelDetId pixid(0, CTPPS_PIXEL_STATION_ID, CTPPS_FAR_RP_ID, 0); + det = geom->getSensor( pixid ); + horizontalShiftBwDiamondPixels_ = det->translation().x() - det->params().at( 0 ) - horizontalShiftOfDiamond_ - 3; } @@ -409,7 +459,7 @@ CTPPSDiamondDQMSource::beginLuminosityBlock( const edm::LuminosityBlock&, const //---------------------------------------------------------------------------------------------------- void -CTPPSDiamondDQMSource::analyze( const edm::Event& event, const edm::EventSetup& ) +CTPPSDiamondDQMSource::analyze( const edm::Event& event, const edm::EventSetup& iSetup ) { // get event data edm::Handle< edm::DetSetVector > diamondVFATStatus; @@ -417,6 +467,9 @@ CTPPSDiamondDQMSource::analyze( const edm::Event& event, const edm::EventSetup& edm::Handle< edm::DetSetVector > stripTracks; event.getByToken( tokenLocalTrack_, stripTracks ); + + edm::Handle< edm::DetSetVector > pixelTracks; + event.getByToken( tokenPixelTrack_, pixelTracks ); edm::Handle< edm::DetSetVector > diamondDigis; event.getByToken( tokenDigi_, diamondDigis ); @@ -430,6 +483,9 @@ CTPPSDiamondDQMSource::analyze( const edm::Event& event, const edm::EventSetup& edm::Handle< edm::DetSetVector > diamondLocalTracks; event.getByToken( tokenDiamondTrack_, diamondLocalTracks ); + edm::ESHandle geometry_; + iSetup.get().get( geometry_ ); + // check validity bool valid = true; valid &= diamondVFATStatus.isValid(); @@ -537,6 +593,9 @@ CTPPSDiamondDQMSource::analyze( const edm::Event& event, const edm::EventSetup& //Leading without trailing investigation if ( digi.getLeadingEdge() != 0 || digi.getTrailingEdge() != 0 ) { ++(potPlots_[detId_pot].HitCounter); + if ( digi.getLeadingEdge() != 0 ) { + potPlots_[detId_pot].leadingEdgeCumulative_all->Fill( HPTDC_BIN_WIDTH_NS * digi.getLeadingEdge() ); + } if ( digi.getLeadingEdge() != 0 && digi.getTrailingEdge() == 0 ) { ++(potPlots_[detId_pot].LeadingOnlyCounter); potPlots_[detId_pot].leadingEdgeCumulative_le->Fill( HPTDC_BIN_WIDTH_NS * digi.getLeadingEdge() ); @@ -622,7 +681,7 @@ CTPPSDiamondDQMSource::analyze( const edm::Event& event, const edm::EventSetup& if ( rechit.getToT() != 0 && centralOOT_ != -999 && rechit.getOOTIndex() == centralOOT_ ) { TH2F *hitHistoTmp = potPlots_[detId_pot].hitDistribution2d->getTH2F(); TAxis *hitHistoTmpYAxis = hitHistoTmp->GetYaxis(); - int startBin = hitHistoTmpYAxis->FindBin( rechit.getX() - 0.5*rechit.getXWidth() ); + int startBin = hitHistoTmpYAxis->FindBin( rechit.getX() - horizontalShiftOfDiamond_ - 0.5*rechit.getXWidth() ); int numOfBins = rechit.getXWidth()*INV_DISPLAY_RESOLUTION_FOR_HITS_MM; for ( int i=0; iFill( detId.plane() + UFSDShift, hitHistoTmpYAxis->GetBinCenter(startBin+i) ); @@ -630,7 +689,7 @@ CTPPSDiamondDQMSource::analyze( const edm::Event& event, const edm::EventSetup& hitHistoTmp = potPlots_[detId_pot].hitDistribution2d_lumisection->getTH2F(); hitHistoTmpYAxis = hitHistoTmp->GetYaxis(); - startBin = hitHistoTmpYAxis->FindBin( rechit.getX() - 0.5*rechit.getXWidth() ); + startBin = hitHistoTmpYAxis->FindBin( rechit.getX() - horizontalShiftOfDiamond_ - 0.5*rechit.getXWidth() ); numOfBins = rechit.getXWidth()*INV_DISPLAY_RESOLUTION_FOR_HITS_MM; for ( int i=0; iFill( detId.plane() + UFSDShift, hitHistoTmpYAxis->GetBinCenter(startBin+i) ); @@ -645,25 +704,25 @@ CTPPSDiamondDQMSource::analyze( const edm::Event& event, const edm::EventSetup& TH2F *hitHistoOOTTmp = potPlots_[detId_pot].hitDistribution2dOOT->getTH2F(); TAxis *hitHistoOOTTmpYAxis = hitHistoOOTTmp->GetYaxis(); - int startBin = hitHistoOOTTmpYAxis->FindBin( rechit.getX() - 0.5*rechit.getXWidth() ); + int startBin = hitHistoOOTTmpYAxis->FindBin( rechit.getX() - horizontalShiftOfDiamond_ - 0.5*rechit.getXWidth() ); int numOfBins = rechit.getXWidth()*INV_DISPLAY_RESOLUTION_FOR_HITS_MM; for ( int i=0; iFill( detId.plane() + 0.2 * rechit.getOOTIndex(), hitHistoOOTTmpYAxis->GetBinCenter(startBin+i) ); } } else { - if ( rechit.getT() != 0 ) { + if ( rechit.getOOTIndex() != CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING ) { // Only leading TH2F *hitHistoOOTTmp = potPlots_[detId_pot].hitDistribution2dOOT_le->getTH2F(); TAxis *hitHistoOOTTmpYAxis = hitHistoOOTTmp->GetYaxis(); - int startBin = hitHistoOOTTmpYAxis->FindBin( rechit.getX() - 0.5*rechit.getXWidth() ); + int startBin = hitHistoOOTTmpYAxis->FindBin( rechit.getX() - horizontalShiftOfDiamond_ - 0.5*rechit.getXWidth() ); int numOfBins = rechit.getXWidth()*INV_DISPLAY_RESOLUTION_FOR_HITS_MM; for ( int i=0; iFill( detId.plane() + 0.2 * rechit.getOOTIndex(), hitHistoOOTTmpYAxis->GetBinCenter(startBin+i) ); } } } - if ( (unsigned int) rechit.getOOTIndex() < potPlots_[detId_pot].activity_per_bx.size() ) + if ( rechit.getOOTIndex() != CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING && rechit.getOOTIndex() < (int) potPlots_[detId_pot].activity_per_bx.size() ) potPlots_[detId_pot].activity_per_bx.at( rechit.getOOTIndex() )->Fill( event.bunchCrossing() ); } } @@ -682,12 +741,13 @@ CTPPSDiamondDQMSource::analyze( const edm::Event& event, const edm::EventSetup& for ( const auto& track : tracks ) { if ( ! track.isValid() ) continue; + if ( track.getOOTIndex() == CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING ) continue; if ( excludeMultipleHits_ && track.getMultipleHits() > 0 ) continue; if ( potPlots_.find( detId_pot ) == potPlots_.end() ) continue; TH2F *trackHistoOOTTmp = potPlots_[detId_pot].trackDistributionOOT->getTH2F(); TAxis *trackHistoOOTTmpYAxis = trackHistoOOTTmp->GetYaxis(); - int startBin = trackHistoOOTTmpYAxis->FindBin( track.getX0() - track.getX0Sigma() ); + int startBin = trackHistoOOTTmpYAxis->FindBin( track.getX0() - horizontalShiftOfDiamond_ - track.getX0Sigma() ); int numOfBins = 2*track.getX0Sigma()*INV_DISPLAY_RESOLUTION_FOR_HITS_MM; for ( int i=0; iFill( track.getOOTIndex(), trackHistoOOTTmpYAxis->GetBinCenter(startBin+i) ); @@ -695,7 +755,7 @@ CTPPSDiamondDQMSource::analyze( const edm::Event& event, const edm::EventSetup& if ( centralOOT_ != -999 && track.getOOTIndex() == centralOOT_ ) { TH1F *trackHistoInTimeTmp = potPlots_[detId_pot].trackDistribution->getTH1F(); - int startBin = trackHistoInTimeTmp->FindBin( track.getX0() - track.getX0Sigma() ); + int startBin = trackHistoInTimeTmp->FindBin( track.getX0() - horizontalShiftOfDiamond_ - track.getX0Sigma() ); int numOfBins = 2*track.getX0Sigma()*INV_DISPLAY_RESOLUTION_FOR_HITS_MM; for ( int i=0; iFill( trackHistoInTimeTmp->GetBinCenter(startBin+i) ); @@ -703,30 +763,78 @@ CTPPSDiamondDQMSource::analyze( const edm::Event& event, const edm::EventSetup& } } } + + // Channel efficiency using CTPPSDiamondLocalTrack + for ( const auto& tracks : *diamondLocalTracks ) { + CTPPSDiamondDetId detId_pot( tracks.detId() ); + detId_pot.setPlane( 0 ); + detId_pot.setChannel( 0 ); + for ( const auto& track : tracks ) { + // Find hits and planes in the track + int numOfHits = 0; + std::set planesInTrackSet; + for ( const auto& vec : *diamondRecHits ) { + const CTPPSDiamondDetId detid( vec.detId() ); + if ( detid.arm() != detId_pot.arm() ) continue; + + for ( const auto& hit : vec ) { + // first check if the hit contributes to the track + if ( track.containsHit(hit) ) { + ++numOfHits; + planesInTrackSet.insert(detid.plane()); + } + } + } + + if ( numOfHits > 0 && numOfHits <= 10 && planesInTrackSet.size() > 2 ) { + for ( int plane=0; plane<4; ++plane ) { + for ( int channel=0; channel<12; ++channel ) { + int map_index = plane*100 + channel; + if ( potPlots_[detId_pot].effDoublecountingChMap.find( map_index ) == potPlots_[detId_pot].effDoublecountingChMap.end() ) { + potPlots_[detId_pot].effTriplecountingChMap[map_index] = 0; + potPlots_[detId_pot].effDoublecountingChMap[map_index] = 0; + } + CTPPSDiamondDetId detId( detId_pot.arm(), CTPPS_DIAMOND_STATION_ID, CTPPS_DIAMOND_RP_ID, plane, channel); + if ( channelAlignedWithTrack( geometry_.product(), detId, track, 0.1) ) { + // Channel should fire + ++(potPlots_[detId_pot].effDoublecountingChMap[map_index]); + for ( const auto& rechits : *diamondRecHits ) { + CTPPSDiamondDetId detId_hit( rechits.detId() ); + if ( detId_hit == detId ) { + for ( const auto& rechit : rechits ) { + if ( track.containsHit( rechit, 1 ) ) { + // Channel fired + ++(potPlots_[detId_pot].effTriplecountingChMap[map_index]); + } + } + } + } + } + } + } + } + } + } - // Tomography of diamonds using strips + // Tomography of diamonds using pixel for ( const auto& rechits : *diamondRecHits ) { CTPPSDiamondDetId detId_pot( rechits.detId() ); detId_pot.setPlane( 0 ); detId_pot.setChannel( 0 ); const CTPPSDiamondDetId detId( rechits.detId() ); - for ( const auto& rechit : rechits ) { if ( excludeMultipleHits_ && rechit.getMultipleHits() > 0 ) continue; if ( rechit.getToT() == 0 ) continue; - if ( !stripTracks.isValid() ) continue; + if ( !pixelTracks.isValid() ) continue; if ( potPlots_.find( detId_pot ) == potPlots_.end() ) continue; - for ( const auto& ds : *stripTracks ) { - const CTPPSDetId stripId( ds.detId() ); - for ( const auto& striplt : ds ) { - if ( !striplt.isValid() ) continue; - if ( stripId.arm() != detId_pot.arm() ) continue; - if ( striplt.getTx() > maximumStripAngleForTomography_ || striplt.getTy() > maximumStripAngleForTomography_) continue; - if ( striplt.getTx() < minimumStripAngleForTomography_ || striplt.getTy() < minimumStripAngleForTomography_) continue; - if ( stripId.rp() == CTPPS_FAR_RP_ID ) { - if ( (unsigned int) rechit.getOOTIndex() < potPlots_[detId_pot].stripTomographyAllFar.size() ) - potPlots_[detId_pot].stripTomographyAllFar.at( rechit.getOOTIndex() )->Fill( striplt.getX0() + 25*detId.plane(), striplt.getY0() ); + for ( const auto& ds : *pixelTracks ) { + const CTPPSPixelDetId pixId( ds.detId() ); + if ( pixId.station() != CTPPS_PIXEL_STATION_ID || pixId.rp() != CTPPS_FAR_RP_ID ) continue; + for ( const auto& lt : ds ) { + if ( lt.isValid() && pixId.arm() == detId_pot.arm() ) { + if ( rechit.getOOTIndex() != CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING && rechit.getOOTIndex() - centralOOT_ + 1 < (int) potPlots_[detId_pot].pixelTomographyAll.size() && rechit.getOOTIndex() - centralOOT_ + 1 >= 0 ) + potPlots_[detId_pot].pixelTomographyAll.at( rechit.getOOTIndex() - centralOOT_ + 1 )->Fill( lt.getX0() - horizontalShiftBwDiamondPixels_ + 25*detId.plane(), lt.getY0() ); } } } @@ -794,7 +902,7 @@ CTPPSDiamondDQMSource::analyze( const edm::Event& event, const edm::EventSetup& if ( planePlots_.find( detId_plane ) != planePlots_.end() ) { if ( centralOOT_ != -999 && rechit.getOOTIndex() == centralOOT_ ) { TH1F *hitHistoTmp = planePlots_[detId_plane].hitProfile->getTH1F(); - int startBin = hitHistoTmp->FindBin( rechit.getX() - 0.5*rechit.getXWidth() ); + int startBin = hitHistoTmp->FindBin( rechit.getX() - horizontalShiftOfDiamond_ - 0.5*rechit.getXWidth() ); int numOfBins = rechit.getXWidth()*INV_DISPLAY_RESOLUTION_FOR_HITS_MM; for ( int i=0; iFill( hitHistoTmp->GetBinCenter(startBin+i) ); @@ -803,31 +911,44 @@ CTPPSDiamondDQMSource::analyze( const edm::Event& event, const edm::EventSetup& } } } - - // Tomography of diamonds using strips - for ( const auto& rechits : *diamondRecHits ) { - CTPPSDiamondDetId detId_plane( rechits.detId() ); - detId_plane.setChannel( 0 ); - for ( const auto& rechit : rechits ) { - if ( excludeMultipleHits_ && rechit.getMultipleHits() > 0 ) continue; - if ( rechit.getToT() == 0 ) continue; - if ( !stripTracks.isValid() ) continue; - if (planePlots_.find(detId_plane) == planePlots_.end()) continue; - - for ( const auto& ds : *stripTracks ) { - const CTPPSDetId stripId(ds.detId()); - for ( const auto& striplt : ds ) { - if (! striplt.isValid()) continue; - if ( stripId.arm() != detId_plane.arm() ) continue; - if ( striplt.getTx() > maximumStripAngleForTomography_ || striplt.getTy() > maximumStripAngleForTomography_) continue; - if ( striplt.getTx() < minimumStripAngleForTomography_ || striplt.getTy() < minimumStripAngleForTomography_) continue; - if ( stripId.rp() == CTPPS_FAR_RP_ID ) { - planePlots_[detId_plane].stripTomography_far->Fill( striplt.getX0() + 25*rechit.getOOTIndex() , striplt.getY0() ); + + + //Tomography of diamonds using pixel and Efficiency WRT Pixels + for ( const auto& ds : *pixelTracks ) { + const CTPPSPixelDetId pixId( ds.detId() ); + if ( pixId.station() != CTPPS_PIXEL_STATION_ID || pixId.rp() != CTPPS_FAR_RP_ID ) continue; + if ( ds.size() > 1 ) continue; + for ( const auto& lt : ds ) { + if ( lt.isValid() ) { + // For efficieny + CTPPSDiamondDetId detId_pot( pixId.arm(), CTPPS_DIAMOND_STATION_ID, CTPPS_DIAMOND_RP_ID ); + potPlots_[detId_pot].pixelTracksMap.Fill( lt.getX0() - horizontalShiftBwDiamondPixels_, lt.getY0() ); + + std::set< CTPPSDiamondDetId > planesWitHits_set; + for ( const auto& rechits : *diamondRecHits ) { + CTPPSDiamondDetId detId_plane( rechits.detId() ); + detId_plane.setChannel( 0 ); + for ( const auto& rechit : rechits ) { + if ( excludeMultipleHits_ && rechit.getMultipleHits() > 0 ) continue; + if ( rechit.getOOTIndex() == CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING || rechit.getToT() == 0 ) continue; + if ( planePlots_.find(detId_plane) == planePlots_.end() ) continue; + if ( pixId.arm() == detId_plane.arm() ) { + planePlots_[detId_plane].pixelTomography_far->Fill( lt.getX0() - horizontalShiftBwDiamondPixels_ + 25*rechit.getOOTIndex(), lt.getY0() ); + if ( centralOOT_ != -999 && rechit.getOOTIndex() == centralOOT_ ) planesWitHits_set.insert( detId_plane ); + } + } } + + for (auto& planeId : planesWitHits_set) + planePlots_[planeId].pixelTracksMapWithDiamonds.Fill( lt.getX0() - horizontalShiftBwDiamondPixels_, lt.getY0() ); + } + } } + + //------------------------------ // Channel Plots //------------------------------ @@ -885,41 +1006,39 @@ CTPPSDiamondDQMSource::analyze( const edm::Event& event, const edm::EventSetup& for ( const auto& rechit : rechits ) { if ( excludeMultipleHits_ && rechit.getMultipleHits() > 0 ) continue; if ( channelPlots_.find( detId ) != channelPlots_.end() ) { - if ( rechit.getToT() != 0 ) { + if ( rechit.getOOTIndex() != CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING && rechit.getToT() != 0 ) { channelPlots_[detId].leadingEdgeCumulative_both->Fill( rechit.getT() + 25*rechit.getOOTIndex() ); channelPlots_[detId].TimeOverThresholdCumulativePerChannel->Fill( rechit.getToT() ); } ++(channelPlots_[detId].hitsCounterPerLumisection); } - if ( (unsigned int) rechit.getOOTIndex() < channelPlots_[detId].activity_per_bx.size() ) + if ( rechit.getOOTIndex() != CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING && rechit.getOOTIndex() < (int) channelPlots_[detId].activity_per_bx.size() ) channelPlots_[detId].activity_per_bx.at( rechit.getOOTIndex() )->Fill( event.bunchCrossing() ); } } - // Tomography of diamonds using strips + // Tomography of diamonds using pixel for ( const auto& rechits : *diamondRecHits ) { const CTPPSDiamondDetId detId( rechits.detId() ); for ( const auto& rechit : rechits ) { if ( excludeMultipleHits_ && rechit.getMultipleHits() > 0 ) continue; - if ( stripTracks.isValid() ) { - if (channelPlots_.find(detId) == channelPlots_.end()) continue; - for ( const auto& ds : *stripTracks ) { - for ( const auto& striplt : ds ) { - CTPPSDetId stripId(ds.detId()); - if ( !striplt.isValid() ) continue; - if ( stripId.arm() != detId.arm() ) continue; - if ( striplt.getTx() > maximumStripAngleForTomography_ || striplt.getTy() > maximumStripAngleForTomography_) continue; - if ( striplt.getTx() < minimumStripAngleForTomography_ || striplt.getTy() < minimumStripAngleForTomography_) continue; - if ( stripId.rp() == CTPPS_FAR_RP_ID ) { - channelPlots_[detId].stripTomography_far->Fill( striplt.getX0() + 25*rechit.getOOTIndex(), striplt.getY0() ); - } - } + if ( rechit.getOOTIndex() == CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING || rechit.getToT() == 0 ) continue; + if ( !pixelTracks.isValid() ) continue; + if (channelPlots_.find(detId) == channelPlots_.end()) continue; + + for ( const auto& ds : *pixelTracks ) { + const CTPPSPixelDetId pixId( ds.detId() ); + if ( pixId.station() != CTPPS_PIXEL_STATION_ID || pixId.rp() != CTPPS_FAR_RP_ID ) continue; + for ( const auto& lt : ds ) { + if ( lt.isValid() && pixId.arm() == detId.arm() ) + channelPlots_[detId].pixelTomography_far->Fill( lt.getX0() - horizontalShiftBwDiamondPixels_ + 25*rechit.getOOTIndex(), lt.getY0() ); } } } } + } //---------------------------------------------------------------------------------------------------- @@ -962,6 +1081,32 @@ CTPPSDiamondDQMSource::endLuminosityBlock( const edm::LuminosityBlock&, const ed } + // Efficiencies of single channels + for ( auto& plot : potPlots_ ) { + plot.second.EfficiencyOfChannelsInPot->Reset(); + for ( auto& element : plot.second.effTriplecountingChMap ) { + if ( plot.second.effDoublecountingChMap[ element.first ] > 0) { + int plane = element.first / 100; + int channel = element.first % 100; + double counted = element.second; + double total = plot.second.effDoublecountingChMap[ element.first ]; + double efficiency = counted / total; +// double error = std::sqrt( efficiency * ( 1 - efficiency ) / total ); + + plot.second.EfficiencyOfChannelsInPot->Fill(plane, channel, 100*efficiency); + } + } + } + + // Efficeincy wrt pixels //TODO + for ( auto& plot : planePlots_ ) { + TH2F *hitHistoTmp = plot.second.EfficiencyWRTPixelsInPlane->getTH2F(); + + CTPPSDiamondDetId detId_pot( plot.first ); + detId_pot.setPlane( 0 ); + + hitHistoTmp->Divide( &(plot.second.pixelTracksMapWithDiamonds), &(potPlots_[detId_pot].pixelTracksMap) ); + } } //---------------------------------------------------------------------------------------------------- diff --git a/DQM/CTPPS/python/ctppsDiamondDQMSource_cfi.py b/DQM/CTPPS/python/ctppsDiamondDQMSource_cfi.py index 9d8fbe6caa9c8..fed435979c19d 100644 --- a/DQM/CTPPS/python/ctppsDiamondDQMSource_cfi.py +++ b/DQM/CTPPS/python/ctppsDiamondDQMSource_cfi.py @@ -8,10 +8,9 @@ tagDiamondRecHits = cms.InputTag("ctppsDiamondRecHits"), tagDiamondLocalTracks = cms.InputTag("ctppsDiamondLocalTracks"), tagLocalTrack = cms.InputTag("totemRPLocalTrackFitter"), + tagPixelLocalTracks = cms.InputTag("ctppsPixelLocalTracks"), excludeMultipleHits = cms.bool(True), - minimumStripAngleForTomography = cms.double(0), - maximumStripAngleForTomography = cms.double(1), offsetsOOT = cms.VPSet( # cut on the OOT bin for physics hits # 2016, after TS2 diff --git a/DQM/CTPPS/test/diamond_dqm_test_cfg.py b/DQM/CTPPS/test/diamond_dqm_test_cfg.py index d1378d02b431e..ae23ee5e6c220 100644 --- a/DQM/CTPPS/test/diamond_dqm_test_cfg.py +++ b/DQM/CTPPS/test/diamond_dqm_test_cfg.py @@ -14,6 +14,12 @@ threshold = cms.untracked.string('WARNING') ) ) + + # import of standard configurations +process.load('Configuration.StandardSequences.Services_cff') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('Configuration.EventContent.EventContent_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') # load DQM framework process.load("DQM.Integration.config.environment_cfi") @@ -23,15 +29,53 @@ process.dqmSaver.tag = "CTPPS" # raw data source -process.source = cms.Source("NewEventStreamFileReader", - fileNames = cms.untracked.vstring( - #'file:/afs/cern.ch/user/j/jkaspar/public/run273062_ls0001-2_stream.root' - #'/store/t0streamer/Data/Physics/000/294/737/run294737_ls0011_streamPhysics_StorageManager.dat', - '/store/t0streamer/Minidaq/A/000/295/626/run295626_ls0001_streamA_StorageManager.dat', - ) +process.source = cms.Source("PoolSource", + # replace 'myfile.root',',' with the source file you want to use + fileNames = cms.untracked.vstring( + *( + '/store/data/Run2017C/ZeroBias/AOD/PromptReco-v2/000/300/088/00000/02448DBC-0A77-E711-8240-02163E01A2ED.root', +#'/store/data/Run2017C/ZeroBias/AOD/PromptReco-v2/000/300/088/00000/106FE4C4-0D77-E711-8785-02163E01373C.root', +'/store/data/Run2017C/ZeroBias/AOD/PromptReco-v2/000/300/088/00000/469D8C89-1477-E711-A6A4-02163E01190C.root', +'/store/data/Run2017C/ZeroBias/AOD/PromptReco-v2/000/300/088/00000/4C729FDF-0C77-E711-A078-02163E014548.root', +'/store/data/Run2017C/ZeroBias/AOD/PromptReco-v2/000/300/088/00000/664E5FE8-0C77-E711-917D-02163E01469B.root', +'/store/data/Run2017C/ZeroBias/AOD/PromptReco-v2/000/300/088/00000/6A5C61DE-0C77-E711-A08C-02163E013720.root', +'/store/data/Run2017C/ZeroBias/AOD/PromptReco-v2/000/300/088/00000/6A76D2EC-0E77-E711-8903-02163E01A7A5.root', +'/store/data/Run2017C/ZeroBias/AOD/PromptReco-v2/000/300/088/00000/82937E4A-0C77-E711-8725-02163E01421E.root', +'/store/data/Run2017C/ZeroBias/AOD/PromptReco-v2/000/300/088/00000/8A8595B1-1177-E711-B1E8-02163E014761.root', +'/store/data/Run2017C/ZeroBias/AOD/PromptReco-v2/000/300/088/00000/A2BDBF69-1677-E711-83E2-02163E01A4ED.root', +'/store/data/Run2017C/ZeroBias/AOD/PromptReco-v2/000/300/088/00000/A4F9404C-0B77-E711-ADB0-02163E0134D7.root', +'/store/data/Run2017C/ZeroBias/AOD/PromptReco-v2/000/300/088/00000/A615970E-1177-E711-9AA8-02163E0139D9.root', +'/store/data/Run2017C/ZeroBias/AOD/PromptReco-v2/000/300/088/00000/ACBCD4BB-0F77-E711-9AB2-02163E014342.root', +'/store/data/Run2017C/ZeroBias/AOD/PromptReco-v2/000/300/088/00000/C2D92F59-0C77-E711-B3AD-02163E01A5B4.root', +#'/store/data/Run2017C/ZeroBias/AOD/PromptReco-v2/000/300/088/00000/E041BD4B-0B77-E711-A90A-02163E012140.root', + +#'/store/data/Run2017D/ZeroBias/AOD/PromptReco-v1/000/302/159/00000/1E2FB550-5190-E711-8010-02163E01A731.root', +#'/store/data/Run2017D/ZeroBias/AOD/PromptReco-v1/000/302/159/00000/ECE07B13-5C90-E711-AA7C-02163E011DDC.root', +#'/store/data/Run2017D/ZeroBias/AOD/PromptReco-v1/000/302/159/00000/AABBE824-5990-E711-BE37-02163E0144E2.root', +#'/store/data/Run2017D/ZeroBias/AOD/PromptReco-v1/000/302/159/00000/562C1C92-5A90-E711-904D-02163E01A2C7.root', +#'/store/data/Run2017D/ZeroBias/AOD/PromptReco-v1/000/302/159/00000/D23D5509-6390-E711-B82E-02163E014785.root', +#'/store/data/Run2017D/ZeroBias/AOD/PromptReco-v1/000/302/159/00000/88377025-5990-E711-8E26-02163E01A4E6.root', +#'/store/data/Run2017D/ZeroBias/AOD/PromptReco-v1/000/302/159/00000/FE7699DC-5990-E711-8DF5-02163E011D9E.root', +#'/store/data/Run2017D/ZeroBias/AOD/PromptReco-v1/000/302/159/00000/600BB493-5A90-E711-84EE-02163E01A1EB.root', +#'/store/data/Run2017D/ZeroBias/AOD/PromptReco-v1/000/302/159/00000/AA6E5A99-6090-E711-B9AA-02163E012B3A.root', +#'/store/data/Run2017D/ZeroBias/AOD/PromptReco-v1/000/302/159/00000/F45AD155-5B90-E711-8ACE-02163E019C49.root', +#'/store/data/Run2017D/ZeroBias/AOD/PromptReco-v1/000/302/159/00000/909B3BB3-5C90-E711-8649-02163E01A1EB.root', +#'/store/data/Run2017D/ZeroBias/AOD/PromptReco-v1/000/302/159/00000/ACC8407D-5890-E711-A88A-02163E0134FB.root', +#'/store/data/Run2017D/ZeroBias/AOD/PromptReco-v1/000/302/159/00000/A4DF7114-5E90-E711-9BD7-02163E011D9E.root', +#'/store/data/Run2017D/ZeroBias/AOD/PromptReco-v1/000/302/159/00000/9EF2EBDC-5990-E711-BC87-02163E0138EC.root', +#'/store/data/Run2017D/ZeroBias/AOD/PromptReco-v1/000/302/159/00000/DE7748D6-5C90-E711-A008-02163E011B3C.root', + + ) + ), + #inputCommands = cms.untracked.vstring( + #'drop CTPPSPixelCluseredmDetSetVector_ctppsPixelClusters__RECO' + #) ) +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_hlt_relval', '') + # raw-to-digi conversion process.load("EventFilter.CTPPSRawToDigi.ctppsRawToDigi_cff") @@ -45,19 +89,23 @@ # local tracks fitter process.load('RecoCTPPS.TotemRPLocal.ctppsDiamondLocalTracks_cfi') +# pixel +process.load('RecoCTPPS.PixelLocal.ctppsPixelLocalTracks_cfi') # CTPPS DQM modules process.load("DQM.CTPPS.ctppsDQM_cff") process.ctppsDiamondDQMSource.excludeMultipleHits = cms.bool(True); process.path = cms.Path( - process.ctppsRawToDigi * + #process.ctppsRawToDigi * process.recoCTPPS * - process.ctppsDiamondRawToDigi * + #process.ctppsDiamondRawToDigi * process.ctppsDiamondRecHits * process.ctppsDiamondLocalTracks * + process.ctppsPixelLocalTracks * process.ctppsDQM -) + ) + process.end_path = cms.EndPath( process.dqmEnv + From a7e793827223f3d773f92d0f2f1f30853f52e760 Mon Sep 17 00:00:00 2001 From: nminafra Date: Mon, 26 Feb 2018 09:15:06 +0100 Subject: [PATCH 021/426] Test modified to use AOD --- DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc | 6 ++-- DQM/CTPPS/test/diamond_dqm_test_cfg.py | 36 +--------------------- 2 files changed, 4 insertions(+), 38 deletions(-) diff --git a/DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc b/DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc index 01732d2b9d49d..e4813af86aaf3 100644 --- a/DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc +++ b/DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc @@ -214,7 +214,7 @@ class CTPPSDiamondDQMSource : public DQMEDAnalyzer // Values for all constants const double CTPPSDiamondDQMSource::SEC_PER_LUMI_SECTION = 23.31; const int CTPPSDiamondDQMSource::CHANNEL_OF_VFAT_CLOCK = 30; -const double CTPPSDiamondDQMSource::DISPLAY_RESOLUTION_FOR_HITS_MM = 0.01; +const double CTPPSDiamondDQMSource::DISPLAY_RESOLUTION_FOR_HITS_MM = 0.1; const double CTPPSDiamondDQMSource::INV_DISPLAY_RESOLUTION_FOR_HITS_MM = 1./DISPLAY_RESOLUTION_FOR_HITS_MM; const double CTPPSDiamondDQMSource::HPTDC_BIN_WIDTH_NS = 25./1024; const int CTPPSDiamondDQMSource::CTPPS_NUM_OF_ARMS = 2; @@ -833,8 +833,8 @@ CTPPSDiamondDQMSource::analyze( const edm::Event& event, const edm::EventSetup& if ( pixId.station() != CTPPS_PIXEL_STATION_ID || pixId.rp() != CTPPS_FAR_RP_ID ) continue; for ( const auto& lt : ds ) { if ( lt.isValid() && pixId.arm() == detId_pot.arm() ) { - if ( rechit.getOOTIndex() != CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING && rechit.getOOTIndex() - centralOOT_ + 1 < (int) potPlots_[detId_pot].pixelTomographyAll.size() && rechit.getOOTIndex() - centralOOT_ + 1 >= 0 ) - potPlots_[detId_pot].pixelTomographyAll.at( rechit.getOOTIndex() - centralOOT_ + 1 )->Fill( lt.getX0() - horizontalShiftBwDiamondPixels_ + 25*detId.plane(), lt.getY0() ); + if ( rechit.getOOTIndex() != CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING && rechit.getOOTIndex() - centralOOT_ < (int) potPlots_[detId_pot].pixelTomographyAll.size() && rechit.getOOTIndex() - centralOOT_ >= 0 ) + potPlots_[detId_pot].pixelTomographyAll.at( rechit.getOOTIndex() - centralOOT_ )->Fill( lt.getX0() - horizontalShiftBwDiamondPixels_ + 25*detId.plane(), lt.getY0() ); } } } diff --git a/DQM/CTPPS/test/diamond_dqm_test_cfg.py b/DQM/CTPPS/test/diamond_dqm_test_cfg.py index ae23ee5e6c220..111de62a5ec61 100644 --- a/DQM/CTPPS/test/diamond_dqm_test_cfg.py +++ b/DQM/CTPPS/test/diamond_dqm_test_cfg.py @@ -30,46 +30,12 @@ # raw data source process.source = cms.Source("PoolSource", - # replace 'myfile.root',',' with the source file you want to use + # replace '*.root',',' with the source file you want to use fileNames = cms.untracked.vstring( *( - '/store/data/Run2017C/ZeroBias/AOD/PromptReco-v2/000/300/088/00000/02448DBC-0A77-E711-8240-02163E01A2ED.root', -#'/store/data/Run2017C/ZeroBias/AOD/PromptReco-v2/000/300/088/00000/106FE4C4-0D77-E711-8785-02163E01373C.root', '/store/data/Run2017C/ZeroBias/AOD/PromptReco-v2/000/300/088/00000/469D8C89-1477-E711-A6A4-02163E01190C.root', -'/store/data/Run2017C/ZeroBias/AOD/PromptReco-v2/000/300/088/00000/4C729FDF-0C77-E711-A078-02163E014548.root', -'/store/data/Run2017C/ZeroBias/AOD/PromptReco-v2/000/300/088/00000/664E5FE8-0C77-E711-917D-02163E01469B.root', -'/store/data/Run2017C/ZeroBias/AOD/PromptReco-v2/000/300/088/00000/6A5C61DE-0C77-E711-A08C-02163E013720.root', -'/store/data/Run2017C/ZeroBias/AOD/PromptReco-v2/000/300/088/00000/6A76D2EC-0E77-E711-8903-02163E01A7A5.root', -'/store/data/Run2017C/ZeroBias/AOD/PromptReco-v2/000/300/088/00000/82937E4A-0C77-E711-8725-02163E01421E.root', -'/store/data/Run2017C/ZeroBias/AOD/PromptReco-v2/000/300/088/00000/8A8595B1-1177-E711-B1E8-02163E014761.root', -'/store/data/Run2017C/ZeroBias/AOD/PromptReco-v2/000/300/088/00000/A2BDBF69-1677-E711-83E2-02163E01A4ED.root', -'/store/data/Run2017C/ZeroBias/AOD/PromptReco-v2/000/300/088/00000/A4F9404C-0B77-E711-ADB0-02163E0134D7.root', -'/store/data/Run2017C/ZeroBias/AOD/PromptReco-v2/000/300/088/00000/A615970E-1177-E711-9AA8-02163E0139D9.root', -'/store/data/Run2017C/ZeroBias/AOD/PromptReco-v2/000/300/088/00000/ACBCD4BB-0F77-E711-9AB2-02163E014342.root', -'/store/data/Run2017C/ZeroBias/AOD/PromptReco-v2/000/300/088/00000/C2D92F59-0C77-E711-B3AD-02163E01A5B4.root', -#'/store/data/Run2017C/ZeroBias/AOD/PromptReco-v2/000/300/088/00000/E041BD4B-0B77-E711-A90A-02163E012140.root', - -#'/store/data/Run2017D/ZeroBias/AOD/PromptReco-v1/000/302/159/00000/1E2FB550-5190-E711-8010-02163E01A731.root', -#'/store/data/Run2017D/ZeroBias/AOD/PromptReco-v1/000/302/159/00000/ECE07B13-5C90-E711-AA7C-02163E011DDC.root', -#'/store/data/Run2017D/ZeroBias/AOD/PromptReco-v1/000/302/159/00000/AABBE824-5990-E711-BE37-02163E0144E2.root', -#'/store/data/Run2017D/ZeroBias/AOD/PromptReco-v1/000/302/159/00000/562C1C92-5A90-E711-904D-02163E01A2C7.root', -#'/store/data/Run2017D/ZeroBias/AOD/PromptReco-v1/000/302/159/00000/D23D5509-6390-E711-B82E-02163E014785.root', -#'/store/data/Run2017D/ZeroBias/AOD/PromptReco-v1/000/302/159/00000/88377025-5990-E711-8E26-02163E01A4E6.root', -#'/store/data/Run2017D/ZeroBias/AOD/PromptReco-v1/000/302/159/00000/FE7699DC-5990-E711-8DF5-02163E011D9E.root', -#'/store/data/Run2017D/ZeroBias/AOD/PromptReco-v1/000/302/159/00000/600BB493-5A90-E711-84EE-02163E01A1EB.root', -#'/store/data/Run2017D/ZeroBias/AOD/PromptReco-v1/000/302/159/00000/AA6E5A99-6090-E711-B9AA-02163E012B3A.root', -#'/store/data/Run2017D/ZeroBias/AOD/PromptReco-v1/000/302/159/00000/F45AD155-5B90-E711-8ACE-02163E019C49.root', -#'/store/data/Run2017D/ZeroBias/AOD/PromptReco-v1/000/302/159/00000/909B3BB3-5C90-E711-8649-02163E01A1EB.root', -#'/store/data/Run2017D/ZeroBias/AOD/PromptReco-v1/000/302/159/00000/ACC8407D-5890-E711-A88A-02163E0134FB.root', -#'/store/data/Run2017D/ZeroBias/AOD/PromptReco-v1/000/302/159/00000/A4DF7114-5E90-E711-9BD7-02163E011D9E.root', -#'/store/data/Run2017D/ZeroBias/AOD/PromptReco-v1/000/302/159/00000/9EF2EBDC-5990-E711-BC87-02163E0138EC.root', -#'/store/data/Run2017D/ZeroBias/AOD/PromptReco-v1/000/302/159/00000/DE7748D6-5C90-E711-A008-02163E011B3C.root', - ) ), - #inputCommands = cms.untracked.vstring( - #'drop CTPPSPixelCluseredmDetSetVector_ctppsPixelClusters__RECO' - #) ) From 9a34e9cb4b63961299dfe7abd5db4ddb6e0f1710 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Thu, 22 Feb 2018 13:56:56 +0100 Subject: [PATCH 022/426] Add skeleton of PreMixingModule --- .../PreMixingModule/plugins/BuildFile.xml | 12 + .../plugins/PreMixingModule.cc | 219 ++++++++++++++++++ .../PreMixingModule/plugins/PreMixingWorker.h | 29 +++ 3 files changed, 260 insertions(+) create mode 100644 SimGeneral/PreMixingModule/plugins/BuildFile.xml create mode 100644 SimGeneral/PreMixingModule/plugins/PreMixingModule.cc create mode 100644 SimGeneral/PreMixingModule/plugins/PreMixingWorker.h diff --git a/SimGeneral/PreMixingModule/plugins/BuildFile.xml b/SimGeneral/PreMixingModule/plugins/BuildFile.xml new file mode 100644 index 0000000000000..a041b27bef95a --- /dev/null +++ b/SimGeneral/PreMixingModule/plugins/BuildFile.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/SimGeneral/PreMixingModule/plugins/PreMixingModule.cc b/SimGeneral/PreMixingModule/plugins/PreMixingModule.cc new file mode 100644 index 0000000000000..1f09970912b83 --- /dev/null +++ b/SimGeneral/PreMixingModule/plugins/PreMixingModule.cc @@ -0,0 +1,219 @@ +/** \class PreMixingModule + * + * PreMixingModule is the EDProducer subclass that overlays premixed + * MC events on top of MC. It is similar to DataMixingModule, but + * tailored for premixing use case. + * + ************************************************************/ +#include "Mixing/Base/interface/BMixingModule.h" + +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventPrincipal.h" +#include "FWCore/Framework/interface/ModuleContextSentry.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/Utilities/interface/EDMException.h" +#include "FWCore/ServiceRegistry/interface/InternalContext.h" +#include "FWCore/ServiceRegistry/interface/ModuleCallingContext.h" +#include "FWCore/ServiceRegistry/interface/ParentContext.h" + +#include "DataFormats/HepMCCandidate/interface/GenParticle.h" +#include "SimDataFormats/CrossingFrame/interface/CrossingFramePlaybackInfoNew.h" +#include "SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h" + +#include "PreMixingWorker.h" + +#include +#include + +namespace edm { + class PreMixingModule: public BMixingModule { + public: + PreMixingModule(const edm::ParameterSet& ps, MixingCache::Config const* globalConf); + + ~PreMixingModule() override = default; + + void checkSignal(const edm::Event &e) override {}; + void createnewEDProduct() override {} + void addSignals(const edm::Event &e, const edm::EventSetup& ES) override; + void doPileUp(edm::Event &e,const edm::EventSetup& ES) override; + void put(edm::Event &e,const edm::EventSetup& ES) override ; + + void initializeEvent(edm::Event const& e, edm::EventSetup const& eventSetup) override; + void beginRun(edm::Run const& run, edm::EventSetup const& eventSetup) override; + void beginLuminosityBlock(LuminosityBlock const& l1, EventSetup const& c) override; + void endLuminosityBlock(LuminosityBlock const& l1, EventSetup const& c) override; + void endRun(const edm::Run& r, const edm::EventSetup& setup) override; + + private: + void pileWorker(const edm::EventPrincipal&, int bcr, int EventId,const edm::EventSetup& ES, ModuleCallingContext const*); + + //DataMixingPileupCopy *PUWorker_; + bool addedPileup_; + + std::vector > workers_; + }; + + PreMixingModule::PreMixingModule(const edm::ParameterSet& ps, MixingCache::Config const* globalConf): + BMixingModule(ps, globalConf), + addedPileup_(false) + { + produces< std::vector >(); + produces< int >("bunchSpacing"); + produces(); + + // TODO: Who produces these? + std::vector GenPUProtonsInputTags; + GenPUProtonsInputTags = ps.getParameter >("GenPUProtonsInputTags"); + for(std::vector::const_iterator it_InputTag = GenPUProtonsInputTags.begin(); + it_InputTag != GenPUProtonsInputTags.end(); ++it_InputTag) + produces< std::vector >( it_InputTag->label() ); + + //PUWorker_ = new DataMixingPileupCopy(ps, consumesCollector()); + + // construct workers + } + + + void PreMixingModule::initializeEvent(const edm::Event &e, const edm::EventSetup& ES) { + for(auto& w: workers_) { + w->initializeEvent(e, ES); + } + } + + + void PreMixingModule::beginRun(edm::Run const& run, const edm::EventSetup& ES) { + BMixingModule::beginRun( run, ES); + for(auto& w: workers_) { + w->beginRun(run, ES); + } + } + + void PreMixingModule::endRun(edm::Run const& run, const edm::EventSetup& ES) { + // Do these have to be implemented? + // HcalDigiWorkerProd_->endRun( run, ES ); // FIXME not implemented + // EcalDigiWorkerProd_->endRun( ES ); // FIXME not implemented + + BMixingModule::endRun( run, ES); + } + + void PreMixingModule::addSignals(const edm::Event &e, const edm::EventSetup& ES) { + // fill in maps of hits + + LogDebug("PreMixingModule")<<"===============> adding MC signals for "<addSignals(e, ES); + } + + addedPileup_ = false; + } + + void PreMixingModule::pileWorker(const EventPrincipal &ep, int bcr, int eventNr, const edm::EventSetup& ES, edm::ModuleCallingContext const* mcc) { + InternalContext internalContext(ep.id(), mcc); + ParentContext parentContext(&internalContext); + ModuleCallingContext moduleCallingContext(&moduleDescription()); + ModuleContextSentry moduleContextSentry(&moduleCallingContext, parentContext); + + LogDebug("PreMixingModule") <<"\n===============> adding pileups from event "<addPileupInfo(&ep, eventNr, &moduleCallingContext); + addedPileup_ = true; + } + + // fill in maps of hits; same code as addSignals, except now applied to the pileup events + + for(auto& w: workers_) { + w->addPileups(bcr, ep, eventNr, ES, &moduleCallingContext); + } + } + + void PreMixingModule::doPileUp(edm::Event &e, const edm::EventSetup& ES) + { + using namespace std::placeholders; + + std::vector recordEventID; + std::vector PileupList; + TrueNumInteractions_.clear(); + + ModuleCallingContext const* mcc = e.moduleCallingContext(); + + for (int bunchCrossing=minBunch_;bunchCrossing<=maxBunch_;++bunchCrossing) { + for (unsigned int isource=0;isource source = inputSources_[isource]; + if (!source || !(source->doPileUp(bunchCrossing))) + continue; + + if (isource==0) + source->CalculatePileup(minBunch_, maxBunch_, PileupList, TrueNumInteractions_, e.streamID()); + + int NumPU_Events = 0; + if (isource ==0) { + NumPU_Events = PileupList[bunchCrossing - minBunch_]; + } else { + // non-minbias pileup only gets one event for now. Fix later if desired. + NumPU_Events = 1; + } + + for(auto& w: workers_) { + w->initializeBunchCrossing(e, ES, bunchCrossing); + } + + source->readPileUp( + e.id(), + recordEventID, + std::bind(&PreMixingModule::pileWorker, std::ref(*this), + _1, bunchCrossing, _2, std::cref(ES), mcc), + NumPU_Events, + e.streamID() + ); + + for(auto& w: workers_) { + w->finalizeBunchCrossing(e, ES, bunchCrossing); + } + } + } + } + + void PreMixingModule::put(edm::Event &e,const edm::EventSetup& ES) { + // individual workers... + // move pileup first so we have access to the information for the put step + + std::vector ps; + int bunchSpacing=10000; + //PUWorker_->getPileupInfo(ps,bunchSpacing); + //PUWorker_->putPileupInfo(e); + + for(auto& w: workers_) { + w->put(e, ES, ps, bunchSpacing); + } + } + + void PreMixingModule::beginLuminosityBlock(LuminosityBlock const& l1, EventSetup const& c) { + BMixingModule::beginLuminosityBlock(l1, c); + for(auto& w: workers_) { + w->beginLuminosityBlock(l1,c); + } + } + + void PreMixingModule::endLuminosityBlock(LuminosityBlock const& l1, EventSetup const& c) { + // Should this be implemented? + // EcalDigiWorkerProd_->endLuminosityBlock(l1,c); // FIXME Not implemented. + BMixingModule::endLuminosityBlock(l1, c); + } +} + +#include "FWCore/PluginManager/interface/PluginManager.h" +#include "FWCore/Framework/interface/MakerMacros.h" +using edm::PreMixingModule; +DEFINE_FWK_MODULE(PreMixingModule); + + diff --git a/SimGeneral/PreMixingModule/plugins/PreMixingWorker.h b/SimGeneral/PreMixingModule/plugins/PreMixingWorker.h new file mode 100644 index 0000000000000..03ca7e74b2469 --- /dev/null +++ b/SimGeneral/PreMixingModule/plugins/PreMixingWorker.h @@ -0,0 +1,29 @@ +#ifndef SimGeneral_PreMixingModule_PreMixingWorker_h +#define SimGeneral_PreMixingModule_PreMixingWorker_h + +#include "FWCore/Framework/interface/Frameworkfwd.h" + +#include + +namespace edm { + class ModuleCallingContext; +} +class PileupSummaryInfo; + +class PreMixingWorker { +public: + PreMixingWorker() = default; + virtual ~PreMixingWorker() = default; + + virtual void beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) {} + virtual void beginLuminosityBlock(edm::LuminosityBlock const& iLumi, edm::EventSetup const& iSetup) {} + virtual void initializeBunchCrossing(edm::Event const& iEvent, edm::EventSetup const& iSetup, int bunchCrossing) {} + virtual void finalizeBunchCrossing(edm::Event& iEvent, edm::EventSetup const& iSetup, int bunchCrossing) {} + + virtual void initializeEvent(edm::Event const& iEvent, edm::EventSetup const& iSetup) = 0; + virtual void addSignals(edm::Event const& iEvent, edm::EventSetup const& iSetup) = 0; + virtual void addPileups(int bcr, edm::EventPrincipal const& ep, int eventNr, edm::EventSetup const& iSetup, edm::ModuleCallingContext const *mcc) = 0; + virtual void put(edm::Event& iEvent, edm::EventSetup const& iSetup, std::vector& ps, int bunchSpacing) = 0; +}; + +#endif From 60788956b10e7e79f5595f952f42f744e15ad18a Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Thu, 22 Feb 2018 16:24:28 +0100 Subject: [PATCH 023/426] Add PreMixingPileupCopy (originally from DataMixingPileupCopy) --- .../plugins/PreMixingModule.cc | 31 ++----- .../plugins/PreMixingPileupCopy.cc | 92 +++++++++++++++++++ .../plugins/PreMixingPileupCopy.h | 62 +++++++++++++ .../PreMixingModule/plugins/PreMixingWorker.h | 2 +- 4 files changed, 164 insertions(+), 23 deletions(-) create mode 100644 SimGeneral/PreMixingModule/plugins/PreMixingPileupCopy.cc create mode 100644 SimGeneral/PreMixingModule/plugins/PreMixingPileupCopy.h diff --git a/SimGeneral/PreMixingModule/plugins/PreMixingModule.cc b/SimGeneral/PreMixingModule/plugins/PreMixingModule.cc index 1f09970912b83..bb547f5efbebb 100644 --- a/SimGeneral/PreMixingModule/plugins/PreMixingModule.cc +++ b/SimGeneral/PreMixingModule/plugins/PreMixingModule.cc @@ -23,6 +23,7 @@ #include "SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h" #include "PreMixingWorker.h" +#include "PreMixingPileupCopy.h" #include #include @@ -49,29 +50,16 @@ namespace edm { private: void pileWorker(const edm::EventPrincipal&, int bcr, int EventId,const edm::EventSetup& ES, ModuleCallingContext const*); - //DataMixingPileupCopy *PUWorker_; - bool addedPileup_; + PreMixingPileupCopy puWorker_; + bool addedPileup_ = false; std::vector > workers_; }; PreMixingModule::PreMixingModule(const edm::ParameterSet& ps, MixingCache::Config const* globalConf): BMixingModule(ps, globalConf), - addedPileup_(false) + puWorker_(ps.getParameter("workers").getParameter("pileup"), *this, consumesCollector()) { - produces< std::vector >(); - produces< int >("bunchSpacing"); - produces(); - - // TODO: Who produces these? - std::vector GenPUProtonsInputTags; - GenPUProtonsInputTags = ps.getParameter >("GenPUProtonsInputTags"); - for(std::vector::const_iterator it_InputTag = GenPUProtonsInputTags.begin(); - it_InputTag != GenPUProtonsInputTags.end(); ++it_InputTag) - produces< std::vector >( it_InputTag->label() ); - - //PUWorker_ = new DataMixingPileupCopy(ps, consumesCollector()); - // construct workers } @@ -125,7 +113,7 @@ namespace edm { // secondary stream to the output stream // We only have the pileup event here, so pick the first time and store the info if(!addedPileup_) { - //PUWorker_->addPileupInfo(&ep, eventNr, &moduleCallingContext); + puWorker_.addPileupInfo(ep, eventNr, &moduleCallingContext); addedPileup_ = true; } @@ -186,15 +174,14 @@ namespace edm { void PreMixingModule::put(edm::Event &e,const edm::EventSetup& ES) { // individual workers... // move pileup first so we have access to the information for the put step - - std::vector ps; - int bunchSpacing=10000; - //PUWorker_->getPileupInfo(ps,bunchSpacing); - //PUWorker_->putPileupInfo(e); + const auto& ps = puWorker_.getPileupSummaryInfo(); + int bunchSpacing = puWorker_.getBunchSpacing(); for(auto& w: workers_) { w->put(e, ES, ps, bunchSpacing); } + + puWorker_.putPileupInfo(e); } void PreMixingModule::beginLuminosityBlock(LuminosityBlock const& l1, EventSetup const& c) { diff --git a/SimGeneral/PreMixingModule/plugins/PreMixingPileupCopy.cc b/SimGeneral/PreMixingModule/plugins/PreMixingPileupCopy.cc new file mode 100644 index 0000000000000..966c08964ea57 --- /dev/null +++ b/SimGeneral/PreMixingModule/plugins/PreMixingPileupCopy.cc @@ -0,0 +1,92 @@ +#include "PreMixingPileupCopy.h" + +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/Framework/interface/ProducerBase.h" + +#include "DataFormats/HepMCCandidate/interface/GenParticle.h" + +#include + +namespace edm { + PreMixingPileupCopy::PreMixingPileupCopy(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector && iC): + pileupInfoInputTag_(ps.getParameter("PileupInfoInputTag")), + bunchSpacingInputTag_(ps.getParameter("BunchSpacingInputTag")), + cfPlaybackInputTag_(ps.getParameter("CFPlaybackInputTag")), + genPUProtonsInputTags_(ps.getParameter >("GenPUProtonsInputTags")) + { + // apparently, we don't need consumes from Secondary input stream + //iC.consumes>(PileupInfoInputTag_); + //iC.consumes(BunchSpacingInputTag_); + //iC.consumes(CFPlaybackInputTag_); + + producer.produces >(); + producer.produces("bunchSpacing"); + producer.produces(); + + for(const auto& tag: genPUProtonsInputTags_) { + producer.produces >(tag.label()); + } + } + + void PreMixingPileupCopy::addPileupInfo(const EventPrincipal& ep, unsigned int eventNr, ModuleCallingContext const* mcc) { + + LogDebug("PreMixingPileupCopy") <<"\n===============> adding pileup Info from event "< > const> pileupInfoPTR = + getProductByTag>(ep, pileupInfoInputTag_, mcc); + + std::shared_ptr const> bsPTR = + getProductByTag(ep,bunchSpacingInputTag_, mcc); + + if(pileupInfoPTR) { + pileupSummaryStorage_ = *(pileupInfoPTR->product()); + LogDebug("PreMixingPileupCopy") << "PileupInfo Size: " << pileupSummaryStorage_.size(); + } + bsStorage_ = bsPTR ? *(bsPTR->product()) : 10000; + + // Gen. PU protons + std::shared_ptr > const> genPUProtonsPTR; + for(const auto& tag: genPUProtonsInputTags_) { + genPUProtonsPTR = getProductByTag >(ep, tag, mcc); + if(genPUProtonsPTR != nullptr) { + genPUProtons_.push_back(*(genPUProtonsPTR->product())); + genPUProtons_labels_.push_back(tag.label()); + } + else { + edm::LogWarning("PreMixingPileupCopy") << "Missing product with label: " << tag.label(); + } + } + + // Playback + std::shared_ptr const> playbackPTR = + getProductByTag(ep,cfPlaybackInputTag_, mcc); + foundPlayback_ = false; + if(playbackPTR ) { + crossingFramePlaybackStorage_ = *(playbackPTR->product()); + foundPlayback_ = true; + } + } + + void PreMixingPileupCopy::putPileupInfo(edm::Event &e) { + if(foundPlayback_ ) { + e.put(std::make_unique(std::move(crossingFramePlaybackStorage_))); + } + e.put(std::make_unique >(std::move(pileupSummaryStorage_))); + e.put(std::make_unique(bsStorage_), "bunchSpacing"); + + // Gen. PU protons + for(size_t idx = 0; idx < genPUProtons_.size(); ++idx){ + e.put(std::make_unique >(std::move(genPUProtons_[idx])), + genPUProtons_labels_[idx]); + } + + // clear local storage after this event + pileupSummaryStorage_.clear(); + genPUProtons_.clear(); + genPUProtons_labels_.clear(); + } +} //edm diff --git a/SimGeneral/PreMixingModule/plugins/PreMixingPileupCopy.h b/SimGeneral/PreMixingModule/plugins/PreMixingPileupCopy.h new file mode 100644 index 0000000000000..d2f1b32f1adbd --- /dev/null +++ b/SimGeneral/PreMixingModule/plugins/PreMixingPileupCopy.h @@ -0,0 +1,62 @@ +#ifndef SimGeneral_PreMixingModule_PreMixingPileupCopy_h +#define SimGeneral_PreMixingModule_PreMixingPileupCopy_h + +/** \class PreMixingPileupCopy + * + * This class takes care of existing pileup information in the case of pre-mixing + * + * Originally from DataMixingModule, tailored further for premixing. + * + ************************************************************/ + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventPrincipal.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" + +#include "DataFormats/Provenance/interface/ProductID.h" +#include "DataFormats/Common/interface/Handle.h" + +#include "SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h" +#include "SimDataFormats/CrossingFrame/interface/CrossingFramePlaybackInfoNew.h" + +#include +#include + +namespace reco { + class GenParticle; +} + +namespace edm { + class ModuleCallingContext; + + class PreMixingPileupCopy { + public: + PreMixingPileupCopy(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector && iC); + ~PreMixingPileupCopy() = default; + + void addPileupInfo(edm::EventPrincipal const& ep, unsigned int EventId, ModuleCallingContext const* mcc); + const std::vector& getPileupSummaryInfo() const { return pileupSummaryStorage_; } + int getBunchSpacing() const { return bsStorage_; } + void putPileupInfo(edm::Event &e) ; + + private: + edm::InputTag pileupInfoInputTag_ ; // InputTag for PileupSummaryInfo + edm::InputTag bunchSpacingInputTag_ ; // InputTag for bunch spacing int + edm::InputTag cfPlaybackInputTag_ ; // InputTag for CrossingFrame Playback information + + std::vector genPUProtonsInputTags_ ; + + // deliver data from addPileupInfo() to getPileupInfo() and putPileupInfo() + CrossingFramePlaybackInfoNew crossingFramePlaybackStorage_; + std::vector pileupSummaryStorage_; + int bsStorage_; + + std::vector genPUProtons_labels_; + std::vector > genPUProtons_; + + bool foundPlayback_; + }; +}//edm + +#endif diff --git a/SimGeneral/PreMixingModule/plugins/PreMixingWorker.h b/SimGeneral/PreMixingModule/plugins/PreMixingWorker.h index 03ca7e74b2469..7f461b9776dc0 100644 --- a/SimGeneral/PreMixingModule/plugins/PreMixingWorker.h +++ b/SimGeneral/PreMixingModule/plugins/PreMixingWorker.h @@ -23,7 +23,7 @@ class PreMixingWorker { virtual void initializeEvent(edm::Event const& iEvent, edm::EventSetup const& iSetup) = 0; virtual void addSignals(edm::Event const& iEvent, edm::EventSetup const& iSetup) = 0; virtual void addPileups(int bcr, edm::EventPrincipal const& ep, int eventNr, edm::EventSetup const& iSetup, edm::ModuleCallingContext const *mcc) = 0; - virtual void put(edm::Event& iEvent, edm::EventSetup const& iSetup, std::vector& ps, int bunchSpacing) = 0; + virtual void put(edm::Event& iEvent, edm::EventSetup const& iSetup, std::vector const& ps, int bunchSpacing) = 0; }; #endif From 7155a1928e540852b483f137294684b9bea78ebe Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Thu, 22 Feb 2018 21:29:13 +0100 Subject: [PATCH 024/426] Add plugin factory for workers --- .../PreMixingModule/plugins/PreMixingModule.cc | 12 +++++++++++- .../plugins/PreMixingWorkerFactory.cc | 3 +++ .../plugins/PreMixingWorkerFactory.h | 15 +++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 SimGeneral/PreMixingModule/plugins/PreMixingWorkerFactory.cc create mode 100644 SimGeneral/PreMixingModule/plugins/PreMixingWorkerFactory.h diff --git a/SimGeneral/PreMixingModule/plugins/PreMixingModule.cc b/SimGeneral/PreMixingModule/plugins/PreMixingModule.cc index bb547f5efbebb..d67b6bb37b131 100644 --- a/SimGeneral/PreMixingModule/plugins/PreMixingModule.cc +++ b/SimGeneral/PreMixingModule/plugins/PreMixingModule.cc @@ -23,6 +23,7 @@ #include "SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h" #include "PreMixingWorker.h" +#include "PreMixingWorkerFactory.h" #include "PreMixingPileupCopy.h" #include @@ -60,7 +61,16 @@ namespace edm { BMixingModule(ps, globalConf), puWorker_(ps.getParameter("workers").getParameter("pileup"), *this, consumesCollector()) { - // construct workers + const auto& workers = ps.getParameter("workers"); + std::vector names = workers.getParameterNames(); + for(const auto& name: names) { + if(name == "pileup") { + continue; + } + const auto& pset = workers.getParameter(name); + std::string type = pset.getParameter("workerType"); + workers_.emplace_back(PreMixingWorkerFactory::get()->create(type, pset, *this, consumesCollector())); + } } diff --git a/SimGeneral/PreMixingModule/plugins/PreMixingWorkerFactory.cc b/SimGeneral/PreMixingModule/plugins/PreMixingWorkerFactory.cc new file mode 100644 index 0000000000000..76db7a3d2c4fe --- /dev/null +++ b/SimGeneral/PreMixingModule/plugins/PreMixingWorkerFactory.cc @@ -0,0 +1,3 @@ +#include "PreMixingWorkerFactory.h" + +EDM_REGISTER_PLUGINFACTORY(PreMixingWorkerFactory, "PreMixingWorkerFactory"); diff --git a/SimGeneral/PreMixingModule/plugins/PreMixingWorkerFactory.h b/SimGeneral/PreMixingModule/plugins/PreMixingWorkerFactory.h new file mode 100644 index 0000000000000..f22adbfbf70f6 --- /dev/null +++ b/SimGeneral/PreMixingModule/plugins/PreMixingWorkerFactory.h @@ -0,0 +1,15 @@ +#ifndef SimGeneral_PreMixingModule_PreMixingWorkerFactory_h +#define SimGeneral_PreMixingModule_PreMixingWorkerFactory_h + +#include "FWCore/Framework/interface/ProducerBase.h" +#include "FWCore/PluginManager/interface/PluginFactory.h" +#include "PreMixingWorker.h" + +namespace edm { + class ParameterSet; + class ConsumesCollector; +} + +using PreMixingWorkerFactory = edmplugin::PluginFactory< PreMixingWorker* (const edm::ParameterSet&, edm::ProducerBase&, edm::ConsumesCollector&& iC) >; + +#endif From a088c04a52e621ad622cbeffcdd84a48d6268058 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Thu, 22 Feb 2018 22:10:26 +0100 Subject: [PATCH 025/426] Move DataMixingSiPixelMCDigiWorker to PreMixingSiPixelWorker --- .../plugins/DataMixingModule.cc | 18 +- .../plugins/DataMixingModule.h | 2 - .../plugins/DataMixingSiPixelMCDigiWorker.h | 168 --------------- .../PreMixingModule/plugins/BuildFile.xml | 4 + .../plugins/PreMixingSiPixelWorker.cc} | 193 ++++++++++++++---- 5 files changed, 157 insertions(+), 228 deletions(-) delete mode 100644 SimGeneral/DataMixingModule/plugins/DataMixingSiPixelMCDigiWorker.h rename SimGeneral/{DataMixingModule/plugins/DataMixingSiPixelMCDigiWorker.cc => PreMixingModule/plugins/PreMixingSiPixelWorker.cc} (78%) diff --git a/SimGeneral/DataMixingModule/plugins/DataMixingModule.cc b/SimGeneral/DataMixingModule/plugins/DataMixingModule.cc index 95d2c3de73832..004e342fae531 100644 --- a/SimGeneral/DataMixingModule/plugins/DataMixingModule.cc +++ b/SimGeneral/DataMixingModule/plugins/DataMixingModule.cc @@ -213,10 +213,7 @@ namespace edm produces< edm::DetSetVector > (PixelDigiCollectionDM_); - if( addMCDigiNoise_ ) { - SiPixelMCDigiWorker_ = new DataMixingSiPixelMCDigiWorker(ps, consumesCollector()); - } - else { + if( !addMCDigiNoise_ ) { SiPixelWorker_ = new DataMixingSiPixelWorker(ps, consumesCollector()); } @@ -303,7 +300,6 @@ namespace edm if( addMCDigiNoise_ ) { if(MergeTrackerDigis_){ SiStripMCDigiWorker_->initializeEvent( e, ES ); - SiPixelMCDigiWorker_->initializeEvent( e, ES ); } else{ GeneralTrackWorker_->initializeEvent(e,ES); @@ -352,8 +348,7 @@ namespace edm delete SiStripRawWorker_; else if(addMCDigiNoise_ ) delete SiStripMCDigiWorker_; else delete SiStripWorker_; - if(addMCDigiNoise_ ) delete SiPixelMCDigiWorker_; - else delete SiPixelWorker_; + if(!addMCDigiNoise_) delete SiPixelWorker_; } else{ delete GeneralTrackWorker_; @@ -396,8 +391,7 @@ namespace edm else SiStripWorker_->addSiStripSignals(e); // SiPixels - if(addMCDigiNoise_ ) SiPixelMCDigiWorker_->addSiPixelSignals(e); - else SiPixelWorker_->addSiPixelSignals(e); + if(!addMCDigiNoise_ ) SiPixelWorker_->addSiPixelSignals(e); }else{ //GeneralTrackWorker_->addGeneralTrackSignal(e); GeneralTrackWorker_->accumulate(e,ES); @@ -465,8 +459,7 @@ namespace edm // SiPixels //whoops this should be for the MC worker ????? SiPixelWorker_->setPileupInfo(ps,bunchSpacing); - if(addMCDigiNoise_ ) SiPixelMCDigiWorker_->addSiPixelPileups(bcr, &ep, eventNr, &moduleCallingContext); - else SiPixelWorker_->addSiPixelPileups(bcr, &ep, eventNr, &moduleCallingContext); + if(!addMCDigiNoise_ ) SiPixelWorker_->addSiPixelPileups(bcr, &ep, eventNr, &moduleCallingContext); }else{ PileUpEventPrincipal pep(ep,&moduleCallingContext,bcr); GeneralTrackWorker_->accumulate(pep, ES,ep.streamID()); @@ -569,8 +562,7 @@ namespace edm else SiStripWorker_->putSiStrip(e); // SiPixels - if(addMCDigiNoise_ ) SiPixelMCDigiWorker_->putSiPixel(e, ES, ps, bunchSpacing); - else SiPixelWorker_->putSiPixel(e); + if(!addMCDigiNoise_ ) SiPixelWorker_->putSiPixel(e); }else{ GeneralTrackWorker_->finalizeEvent(e,ES); } diff --git a/SimGeneral/DataMixingModule/plugins/DataMixingModule.h b/SimGeneral/DataMixingModule/plugins/DataMixingModule.h index 95393fe6a4b1e..3c05574b30203 100644 --- a/SimGeneral/DataMixingModule/plugins/DataMixingModule.h +++ b/SimGeneral/DataMixingModule/plugins/DataMixingModule.h @@ -34,7 +34,6 @@ #include "SimGeneral/DataMixingModule/plugins/DataMixingSiStripMCDigiWorker.h" #include "SimGeneral/DataMixingModule/plugins/DataMixingSiStripRawWorker.h" #include "SimGeneral/DataMixingModule/plugins/DataMixingSiPixelWorker.h" -#include "SimGeneral/DataMixingModule/plugins/DataMixingSiPixelMCDigiWorker.h" #include "SimGeneral/DataMixingModule/plugins/DataMixingTrackingParticleWorker.h" #include "SimGeneral/DataMixingModule/plugins/DataMixingPileupCopy.h" @@ -179,7 +178,6 @@ namespace edm { // Pixels - DataMixingSiPixelMCDigiWorker *SiPixelMCDigiWorker_ ; DataMixingSiPixelWorker *SiPixelWorker_ ; // Tracks diff --git a/SimGeneral/DataMixingModule/plugins/DataMixingSiPixelMCDigiWorker.h b/SimGeneral/DataMixingModule/plugins/DataMixingSiPixelMCDigiWorker.h deleted file mode 100644 index 94971d8949f8d..0000000000000 --- a/SimGeneral/DataMixingModule/plugins/DataMixingSiPixelMCDigiWorker.h +++ /dev/null @@ -1,168 +0,0 @@ -#ifndef SimDataMixingSiPixelMCDigiWorker_h -#define SimDataMixingSiPixelMCDigiWorker_h - -/** \class DataMixingSiPixelMCDigiWorker - * - * DataMixingModule is the EDProducer subclass - * that overlays rawdata events on top of MC, - * using real data for pileup simulation - * This class takes care of the Si Pixel information - * - * \author Mike Hildreth, University of Notre Dame - * - * \version 1st Version October 2007 - * - ************************************************************/ - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventPrincipal.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/Provenance/interface/ProductID.h" -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/ConsumesCollector.h" -#include "FWCore/Utilities/interface/RandomNumberGenerator.h" - -//Data Formats -#include "DataFormats/Common/interface/DetSetVector.h" -#include "DataFormats/Common/interface/DetSet.h" -#include "DataFormats/SiPixelDigi/interface/PixelDigi.h" -#include "SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h" - -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" -#include "Geometry/CommonDetUnit/interface/GeomDet.h" -#include "Geometry/CommonDetUnit/interface/GeomDetType.h" -#include "SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h" -#include "CondFormats/DataRecord/interface/SiPixelDynamicInefficiencyRcd.h" -#include "CondFormats/SiPixelObjects/interface/SiPixelDynamicInefficiency.h" - - -#include -#include -#include - - -namespace CLHEP { - class HepRandomEngine; -} - -namespace edm -{ - class ModuleCallingContext; - - class DataMixingSiPixelMCDigiWorker - { - public: - - DataMixingSiPixelMCDigiWorker(); - - /** standard constructor*/ - explicit DataMixingSiPixelMCDigiWorker(const edm::ParameterSet& ps, edm::ConsumesCollector && iC); - - /**Default destructor*/ - virtual ~DataMixingSiPixelMCDigiWorker(); - - virtual void initializeEvent(edm::Event const& e, edm::EventSetup const& c); // override? - - void putSiPixel(edm::Event &e, edm::EventSetup const& iSetup, std::vector &ps, int &bs) ; - void addSiPixelSignals(const edm::Event &e); - void addSiPixelPileups(const int bcr, const edm::EventPrincipal*,unsigned int EventId, ModuleCallingContext const*); - - void setPileupInfo(const std::vector &ps, const int &bs); //this sets pu_scale - - void init_DynIneffDB(const edm::EventSetup&, const unsigned int&); - - private: - - // - // PixelEfficiencies struct - // - /** - * Internal use only. - */ - struct PixelEfficiencies { - PixelEfficiencies(const edm::ParameterSet& conf, bool AddPixelInefficiency, int NumberOfBarrelLayers, int NumberOfEndcapDisks); - bool FromConfig; // If true read from Config, otherwise use Database - - double theInstLumiScaleFactor; - std::vector pu_scale; // in config: 0-3 BPix, 4-5 FPix (inner, outer) - std::vector > thePUEfficiency; // Instlumi dependent efficiency - double thePixelEfficiency[20]; // Single pixel effciency - double thePixelColEfficiency[20]; // Column effciency - double thePixelChipEfficiency[20]; // ROC efficiency - std::vector theLadderEfficiency_BPix[20]; // Ladder efficiency - std::vector theModuleEfficiency_BPix[20]; // Module efficiency - //std::vector thePUEfficiency[20]; // Instlumi dependent efficiency - double theInnerEfficiency_FPix[20]; // Fpix inner module efficiency - double theOuterEfficiency_FPix[20]; // Fpix outer module efficiency - unsigned int FPixIndex; // The Efficiency index for FPix Disks - // Read factors from DB and fill containers - std::map PixelGeomFactors; - std::map ColGeomFactors; - std::map ChipGeomFactors; - std::map iPU; - - void init_from_db(const edm::ESHandle&, const edm::ESHandle&); - bool matches(const DetId&, const DetId&, const std::vector&); - - }; - - // Needed by dynamic inefficiency - // 0-3 BPix, 4-5 FPix (inner, outer) - //double _pu_scale[20]; - - // data specifiers - - edm::InputTag pixeldigi_collectionSig_ ; // secondary name given to collection of SiPixel digis - edm::InputTag pixeldigi_collectionPile_ ; // secondary name given to collection of SiPixel digis - std::string PixelDigiCollectionDM_ ; // secondary name to be given to new SiPixel digis - - edm::EDGetTokenT > PixelDigiToken_ ; // Token to retrieve information - edm::EDGetTokenT > PixelDigiPToken_ ; // Token to retrieve information - - edm::ESHandle pDD; - - // Get Dynamic Inefficiency scale factors from DB - edm::ESHandle SiPixelDynamicInefficiency_; - - - // - // Internal typedefs - - typedef int Amplitude; - typedef std::map > signal_map_type; // from Digi.Skel. - typedef signal_map_type::iterator signal_map_iterator; // from Digi.Skel. - typedef signal_map_type::const_iterator signal_map_const_iterator; // from Digi.Skel. - typedef std::map signalMaps; - - // Contains the accumulated hit info. - signalMaps _signal; - - typedef std::multimap OneDetectorMap; // maps by pixel ID for later combination - can have duplicate pixels - typedef std::map SiGlobalIndex; // map to all data for each detector ID - - SiGlobalIndex SiHitStorage_; - - - // unsigned int eventId_; //=0 for signal, from 1-n for pileup events - - std::string label_; - const std::string geometryType_; - - //-- Allow for upgrades - const int NumberOfBarrelLayers; // Default = 3 - const int NumberOfEndcapDisks; // Default = 2 - - //const double theInstLumiScaleFactor; - //const double bunchScaleAt25; - - const bool AddPixelInefficiency; // bool to read in inefficiencies - - PixelEfficiencies pixelEff_; - - bool FirstCall_; - - }; -}//edm - -#endif // SimDataMixingSiPixelMCDigiWorker_h diff --git a/SimGeneral/PreMixingModule/plugins/BuildFile.xml b/SimGeneral/PreMixingModule/plugins/BuildFile.xml index a041b27bef95a..be5f5ef247cca 100644 --- a/SimGeneral/PreMixingModule/plugins/BuildFile.xml +++ b/SimGeneral/PreMixingModule/plugins/BuildFile.xml @@ -1,9 +1,13 @@ + + + + diff --git a/SimGeneral/DataMixingModule/plugins/DataMixingSiPixelMCDigiWorker.cc b/SimGeneral/PreMixingModule/plugins/PreMixingSiPixelWorker.cc similarity index 78% rename from SimGeneral/DataMixingModule/plugins/DataMixingSiPixelMCDigiWorker.cc rename to SimGeneral/PreMixingModule/plugins/PreMixingSiPixelWorker.cc index 4e4d5da5c7a3f..d38672fac787c 100644 --- a/SimGeneral/DataMixingModule/plugins/DataMixingSiPixelMCDigiWorker.cc +++ b/SimGeneral/PreMixingModule/plugins/PreMixingSiPixelWorker.cc @@ -1,20 +1,25 @@ -// File: DataMixingSiPixelWorker.cc -// Description: see DataMixingSiPixelMCDigiWorker.h -// Author: Mike Hildreth, University of Notre Dame -// -//-------------------------------------------- - -#include -#include #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Utilities/interface/EDMException.h" -#include "FWCore/Framework/interface/ConstProductRegistry.h" #include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventPrincipal.h" +#include "FWCore/Framework/interface/ProducerBase.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/Provenance/interface/Provenance.h" -#include "DataFormats/Provenance/interface/BranchDescription.h" -// -// +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Utilities/interface/RandomNumberGenerator.h" + +//Data Formats +#include "DataFormats/Common/interface/DetSetVector.h" +#include "DataFormats/Common/interface/DetSet.h" +#include "DataFormats/SiPixelDigi/interface/PixelDigi.h" +#include "SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h" + +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/CommonDetUnit/interface/GeomDet.h" +#include "Geometry/CommonDetUnit/interface/GeomDetType.h" +#include "CondFormats/DataRecord/interface/SiPixelDynamicInefficiencyRcd.h" +#include "CondFormats/SiPixelObjects/interface/SiPixelDynamicInefficiency.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "Geometry/TrackerGeometryBuilder/interface/PixelGeomDetUnit.h" @@ -26,21 +31,120 @@ #include "CLHEP/Random/RandFlat.h" -#include "DataMixingSiPixelMCDigiWorker.h" +#include "PreMixingWorker.h" + +#include +#include + +namespace edm { + class ModuleCallingContext; + + class PreMixingSiPixelWorker: public PreMixingWorker { + public: + PreMixingSiPixelWorker(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector && iC); + ~PreMixingSiPixelWorker() override = default; + + void initializeEvent(edm::Event const& e, edm::EventSetup const& c) override; + void addSignals(edm::Event const& e, edm::EventSetup const& es) override; + void addPileups(int bcr, edm::EventPrincipal const&, int EventId, edm::EventSetup const& es, ModuleCallingContext const*) override; + void put(edm::Event &e, edm::EventSetup const& iSetup, std::vector const& ps, int bs) override; + + private: + void setPileupInfo(const std::vector &ps, const int &bs); //this sets pu_scale + + void init_DynIneffDB(const edm::EventSetup&, const unsigned int&); + + // + // PixelEfficiencies struct + // + /** + * Internal use only. + */ + struct PixelEfficiencies { + PixelEfficiencies(const edm::ParameterSet& conf, bool AddPixelInefficiency, int NumberOfBarrelLayers, int NumberOfEndcapDisks); + bool FromConfig; // If true read from Config, otherwise use Database + + double theInstLumiScaleFactor; + std::vector pu_scale; // in config: 0-3 BPix, 4-5 FPix (inner, outer) + std::vector > thePUEfficiency; // Instlumi dependent efficiency + double thePixelEfficiency[20]; // Single pixel effciency + double thePixelColEfficiency[20]; // Column effciency + double thePixelChipEfficiency[20]; // ROC efficiency + std::vector theLadderEfficiency_BPix[20]; // Ladder efficiency + std::vector theModuleEfficiency_BPix[20]; // Module efficiency + //std::vector thePUEfficiency[20]; // Instlumi dependent efficiency + double theInnerEfficiency_FPix[20]; // Fpix inner module efficiency + double theOuterEfficiency_FPix[20]; // Fpix outer module efficiency + unsigned int FPixIndex; // The Efficiency index for FPix Disks + // Read factors from DB and fill containers + std::map PixelGeomFactors; + std::map ColGeomFactors; + std::map ChipGeomFactors; + std::map iPU; + + void init_from_db(const edm::ESHandle&, const edm::ESHandle&); + bool matches(const DetId&, const DetId&, const std::vector&); + + }; + + // Needed by dynamic inefficiency + // 0-3 BPix, 4-5 FPix (inner, outer) + //double _pu_scale[20]; + // data specifiers -using namespace std; + edm::InputTag pixeldigi_collectionSig_ ; // secondary name given to collection of SiPixel digis + edm::InputTag pixeldigi_collectionPile_ ; // secondary name given to collection of SiPixel digis + std::string PixelDigiCollectionDM_ ; // secondary name to be given to new SiPixel digis -namespace edm -{ + edm::EDGetTokenT > PixelDigiToken_ ; // Token to retrieve information + edm::EDGetTokenT > PixelDigiPToken_ ; // Token to retrieve information - // Virtual constructor + edm::ESHandle pDD; - // DataMixingSiPixelMCDigiWorker::DataMixingSiPixelMCDigiWorker() { } + // Get Dynamic Inefficiency scale factors from DB + edm::ESHandle SiPixelDynamicInefficiency_; + + + // + // Internal typedefs + + typedef int Amplitude; + typedef std::map > signal_map_type; // from Digi.Skel. + typedef signal_map_type::iterator signal_map_iterator; // from Digi.Skel. + typedef signal_map_type::const_iterator signal_map_const_iterator; // from Digi.Skel. + typedef std::map signalMaps; + + // Contains the accumulated hit info. + signalMaps _signal; + + typedef std::multimap OneDetectorMap; // maps by pixel ID for later combination - can have duplicate pixels + typedef std::map SiGlobalIndex; // map to all data for each detector ID + + SiGlobalIndex SiHitStorage_; + + + // unsigned int eventId_; //=0 for signal, from 1-n for pileup events + + const std::string geometryType_; + + //-- Allow for upgrades + const int NumberOfBarrelLayers; // Default = 3 + const int NumberOfEndcapDisks; // Default = 2 + + //const double theInstLumiScaleFactor; + //const double bunchScaleAt25; + + const bool AddPixelInefficiency; // bool to read in inefficiencies + + PixelEfficiencies pixelEff_; + + bool FirstCall_; + + }; // Constructor - DataMixingSiPixelMCDigiWorker::DataMixingSiPixelMCDigiWorker(const edm::ParameterSet& ps, edm::ConsumesCollector && iC) : - label_(ps.getParameter("Label")), + PreMixingSiPixelWorker::PreMixingSiPixelWorker(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector && iC): geometryType_(ps.getParameter("GeometryType")), // get external parameters: // To account for upgrade geometries do not assume the number @@ -66,22 +170,18 @@ namespace edm PixelDigiToken_ = iC.consumes >(pixeldigi_collectionSig_); PixelDigiPToken_ = iC.consumes >(pixeldigi_collectionPile_); + producer.produces< edm::DetSetVector > (PixelDigiCollectionDM_); + // clear local storage for this event SiHitStorage_.clear(); FirstCall_ = true; } - - - // Virtual destructor needed. - DataMixingSiPixelMCDigiWorker::~DataMixingSiPixelMCDigiWorker() { - } // Need an event initialization - void DataMixingSiPixelMCDigiWorker::initializeEvent(edm::Event const& e, edm::EventSetup const& iSetup) { - + void PreMixingSiPixelWorker::initializeEvent(edm::Event const& e, edm::EventSetup const& iSetup) { iSetup.get().get(geometryType_, pDD); //edm::ESHandle tTopoHand; //iSetup.get().get(tTopoHand); @@ -89,7 +189,7 @@ namespace edm } - DataMixingSiPixelMCDigiWorker::PixelEfficiencies::PixelEfficiencies(const edm::ParameterSet& conf, bool AddPixelInefficiency, int NumberOfBarrelLayers, int NumberOfEndcapDisks) { + PreMixingSiPixelWorker::PixelEfficiencies::PixelEfficiencies(const edm::ParameterSet& conf, bool AddPixelInefficiency, int NumberOfBarrelLayers, int NumberOfEndcapDisks) { // pixel inefficiency // Don't use Hard coded values, read inefficiencies in from DB/python config or don't use any int NumberOfTotLayers = NumberOfBarrelLayers + NumberOfEndcapDisks; @@ -214,7 +314,7 @@ namespace edm } // Read DynIneff Scale factors from DB -void DataMixingSiPixelMCDigiWorker::init_DynIneffDB(const edm::EventSetup& es, const unsigned int& bunchspace){ +void PreMixingSiPixelWorker::init_DynIneffDB(const edm::EventSetup& es, const unsigned int& bunchspace){ if (AddPixelInefficiency&&!pixelEff_.FromConfig) { if (bunchspace == 50) es.get().get("50ns",SiPixelDynamicInefficiency_); else es.get().get(SiPixelDynamicInefficiency_); @@ -222,7 +322,7 @@ void DataMixingSiPixelMCDigiWorker::init_DynIneffDB(const edm::EventSetup& es, c } } -void DataMixingSiPixelMCDigiWorker::PixelEfficiencies::init_from_db(const edm::ESHandle& geom, const edm::ESHandle& SiPixelDynamicInefficiency) { +void PreMixingSiPixelWorker::PixelEfficiencies::init_from_db(const edm::ESHandle& geom, const edm::ESHandle& SiPixelDynamicInefficiency) { theInstLumiScaleFactor = SiPixelDynamicInefficiency->gettheInstLumiScaleFactor(); const std::map& PixelGeomFactorsDB = SiPixelDynamicInefficiency->getPixelGeomFactors(); @@ -265,7 +365,7 @@ void DataMixingSiPixelMCDigiWorker::PixelEfficiencies::init_from_db(const edm::E pu_scale.resize(thePUEfficiency.size()); } -bool DataMixingSiPixelMCDigiWorker::PixelEfficiencies::matches(const DetId& detid, const DetId& db_id, const std::vector& DetIdmasks) { +bool PreMixingSiPixelWorker::PixelEfficiencies::matches(const DetId& detid, const DetId& db_id, const std::vector& DetIdmasks) { if (detid.subdetId() != db_id.subdetId()) return false; for (size_t i=0; i adding MC signals for "< adding MC signals for "< > input; @@ -293,7 +393,7 @@ bool DataMixingSiPixelMCDigiWorker::PixelEfficiencies::matches(const DetId& deti for (; DSViter!=input->end();DSViter++){ #ifdef DEBUG - LogDebug("DataMixingSiPixelMCDigiWorker") << "Processing DetID " << DSViter->id; + LogDebug("PreMixingSiPixelWorker") << "Processing DetID " << DSViter->id; #endif uint32_t detID = DSViter->id; @@ -315,19 +415,19 @@ bool DataMixingSiPixelMCDigiWorker::PixelEfficiencies::matches(const DetId& deti - void DataMixingSiPixelMCDigiWorker::addSiPixelPileups(const int bcr, const EventPrincipal *ep, unsigned int eventNr, - ModuleCallingContext const* mcc) { + void PreMixingSiPixelWorker::addPileups(int bcr, EventPrincipal const& ep, int eventNr, + edm::EventSetup const& es, ModuleCallingContext const* mcc) { - LogDebug("DataMixingSiPixelMCDigiWorker") <<"\n===============> adding pileups from event "<id()<<" for bunchcrossing "< adding pileups from event "< > const> inputPTR = - getProductByTag >(*ep, pixeldigi_collectionPile_, mcc); + getProductByTag >(ep, pixeldigi_collectionPile_, mcc); if(inputPTR ) { - const edm::DetSetVector *input = const_cast< edm::DetSetVector * >(inputPTR->product()); + const edm::DetSetVector *input = inputPTR->product(); @@ -340,7 +440,7 @@ bool DataMixingSiPixelMCDigiWorker::PixelEfficiencies::matches(const DetId& deti for (; DSViter!=input->end();DSViter++){ #ifdef DEBUG - LogDebug("DataMixingSiPixelMCDigiWorker") << "Pileups: Processing DetID " << DSViter->id; + LogDebug("PreMixingSiPixelWorker") << "Pileups: Processing DetID " << DSViter->id; #endif uint32_t detID = DSViter->id; @@ -383,7 +483,7 @@ bool DataMixingSiPixelMCDigiWorker::PixelEfficiencies::matches(const DetId& deti - void DataMixingSiPixelMCDigiWorker::putSiPixel(edm::Event &e, edm::EventSetup const& iSetup, std::vector &ps, int &bs) { + void PreMixingSiPixelWorker::put(edm::Event &e, edm::EventSetup const& iSetup, std::vector const& ps, int bs) { // collection of Digis to put in the event @@ -451,7 +551,7 @@ bool DataMixingSiPixelMCDigiWorker::PixelEfficiencies::matches(const DetId& deti } // end of big loop over all detector IDs // put the collection of digis in the event - LogInfo("DataMixingSiPixelMCDigiWorker") << "total # Merged Pixels: " << _signal.size() ; + LogInfo("PreMixingSiPixelWorker") << "total # Merged Pixels: " << _signal.size() ; // Now, we have to run Lumi-Dependent efficiency calculation on the merged pixels. // This is the only place where we have the PreMixed pileup information so that we can calculate @@ -657,7 +757,7 @@ bool DataMixingSiPixelMCDigiWorker::PixelEfficiencies::matches(const DetId& deti SiHitStorage_.clear(); } -void DataMixingSiPixelMCDigiWorker::setPileupInfo(const std::vector &ps, const int &bunchSpacing) { +void PreMixingSiPixelWorker::setPileupInfo(const std::vector &ps, const int &bunchSpacing) { //double bunchScale=1.0; //if (bunchSpacing==25) bunchScale=bunchScaleAt25; @@ -682,3 +782,6 @@ void DataMixingSiPixelMCDigiWorker::setPileupInfo(const std::vector Date: Thu, 22 Feb 2018 23:12:23 +0100 Subject: [PATCH 026/426] Move DataMixingSiStripMCDigiWorker to PremixingSiStripWorker --- .../plugins/DataMixingModule.cc | 16 +- .../plugins/DataMixingModule.h | 2 - .../plugins/DataMixingSiStripMCDigiWorker.h | 165 --------------- .../PreMixingModule/plugins/BuildFile.xml | 2 + .../plugins/PreMixingSiStripWorker.cc} | 192 ++++++++++++++---- 5 files changed, 154 insertions(+), 223 deletions(-) delete mode 100644 SimGeneral/DataMixingModule/plugins/DataMixingSiStripMCDigiWorker.h rename SimGeneral/{DataMixingModule/plugins/DataMixingSiStripMCDigiWorker.cc => PreMixingModule/plugins/PreMixingSiStripWorker.cc} (74%) diff --git a/SimGeneral/DataMixingModule/plugins/DataMixingModule.cc b/SimGeneral/DataMixingModule/plugins/DataMixingModule.cc index 004e342fae531..dffb05a4cc2ce 100644 --- a/SimGeneral/DataMixingModule/plugins/DataMixingModule.cc +++ b/SimGeneral/DataMixingModule/plugins/DataMixingModule.cc @@ -199,10 +199,7 @@ namespace edm produces< edm::DetSetVector > (SiStripDigiCollectionDM_); - if( addMCDigiNoise_ ) { - SiStripMCDigiWorker_ = new DataMixingSiStripMCDigiWorker(ps, consumesCollector()); - } - else { + if(!addMCDigiNoise_ ) { SiStripWorker_ = new DataMixingSiStripWorker(ps, consumesCollector()); } } @@ -298,10 +295,7 @@ namespace edm void DataMixingModule::initializeEvent(const edm::Event &e, const edm::EventSetup& ES) { if( addMCDigiNoise_ ) { - if(MergeTrackerDigis_){ - SiStripMCDigiWorker_->initializeEvent( e, ES ); - } - else{ + if(!MergeTrackerDigis_){ GeneralTrackWorker_->initializeEvent(e,ES); } EcalDigiWorkerProd_->initializeEvent( e, ES ); @@ -346,8 +340,7 @@ namespace edm if(MergeTrackerDigis_){ if(useSiStripRawDigi_) delete SiStripRawWorker_; - else if(addMCDigiNoise_ ) delete SiStripMCDigiWorker_; - else delete SiStripWorker_; + else if(!addMCDigiNoise_) delete SiStripWorker_; if(!addMCDigiNoise_) delete SiPixelWorker_; } else{ @@ -387,7 +380,6 @@ namespace edm if(MergeTrackerDigis_){ // SiStrips if(useSiStripRawDigi_) SiStripRawWorker_->addSiStripSignals(e); - else if(addMCDigiNoise_ ) SiStripMCDigiWorker_->addSiStripSignals(e); else SiStripWorker_->addSiStripSignals(e); // SiPixels @@ -454,7 +446,6 @@ namespace edm if(MergeTrackerDigis_){ // SiStrips if(useSiStripRawDigi_) SiStripRawWorker_->addSiStripPileups(bcr, &ep, eventNr, &moduleCallingContext); - else if(addMCDigiNoise_ ) SiStripMCDigiWorker_->addSiStripPileups(bcr, &ep, eventNr, &moduleCallingContext); else SiStripWorker_->addSiStripPileups(bcr, &ep, eventNr, &moduleCallingContext); // SiPixels @@ -558,7 +549,6 @@ namespace edm if(MergeTrackerDigis_){ // SiStrips if(useSiStripRawDigi_) SiStripRawWorker_->putSiStrip(e); - else if(addMCDigiNoise_ ) SiStripMCDigiWorker_->putSiStrip(e, ES); else SiStripWorker_->putSiStrip(e); // SiPixels diff --git a/SimGeneral/DataMixingModule/plugins/DataMixingModule.h b/SimGeneral/DataMixingModule/plugins/DataMixingModule.h index 3c05574b30203..4c3101acff982 100644 --- a/SimGeneral/DataMixingModule/plugins/DataMixingModule.h +++ b/SimGeneral/DataMixingModule/plugins/DataMixingModule.h @@ -31,7 +31,6 @@ #include "SimGeneral/DataMixingModule/plugins/DataMixingHcalDigiWorkerProd.h" #include "SimGeneral/DataMixingModule/plugins/DataMixingMuonWorker.h" #include "SimGeneral/DataMixingModule/plugins/DataMixingSiStripWorker.h" -#include "SimGeneral/DataMixingModule/plugins/DataMixingSiStripMCDigiWorker.h" #include "SimGeneral/DataMixingModule/plugins/DataMixingSiStripRawWorker.h" #include "SimGeneral/DataMixingModule/plugins/DataMixingSiPixelWorker.h" #include "SimGeneral/DataMixingModule/plugins/DataMixingTrackingParticleWorker.h" @@ -170,7 +169,6 @@ namespace edm { // Si-Strips DataMixingSiStripWorker *SiStripWorker_ ; - DataMixingSiStripMCDigiWorker *SiStripMCDigiWorker_ ; DataMixingSiStripRawWorker *SiStripRawWorker_ ; bool useSiStripRawDigi_; bool addMCDigiNoise_; diff --git a/SimGeneral/DataMixingModule/plugins/DataMixingSiStripMCDigiWorker.h b/SimGeneral/DataMixingModule/plugins/DataMixingSiStripMCDigiWorker.h deleted file mode 100644 index a4625302aa85f..0000000000000 --- a/SimGeneral/DataMixingModule/plugins/DataMixingSiStripMCDigiWorker.h +++ /dev/null @@ -1,165 +0,0 @@ -#ifndef SimDataMixingSiStripMCDigiWorker_h -#define SimDataMixingSiStripMCDigiWorker_h - -/** \class DataMixingSiStripMCDigiWorker - * - * DataMixingModule is the EDProducer subclass - * that overlays rawdata events on top of MC, - * using real data for pileup simulation - * This class takes care of the SiStrip information - * - * \author Mike Hildreth, University of Notre Dame - * - * \version 1st Version October 2007 - * - ************************************************************/ - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventPrincipal.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "DataFormats/Provenance/interface/ProductID.h" -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Utilities/interface/RandomNumberGenerator.h" - -//Data Formats -#include "DataFormats/Common/interface/DetSetVector.h" -#include "DataFormats/Common/interface/DetSet.h" -#include "DataFormats/SiStripDigi/interface/SiStripDigi.h" - -#include "CondFormats/SiStripObjects/interface/SiStripNoises.h" -#include "CondFormats/SiStripObjects/interface/SiStripPedestals.h" -#include "CondFormats/SiStripObjects/interface/SiStripThreshold.h" -#include "CalibFormats/SiStripObjects/interface/SiStripGain.h" -#include "SimTracker/SiStripDigitizer/interface/SiTrivialDigitalConverter.h" -#include "SimTracker/SiStripDigitizer/interface/SiGaussianTailNoiseAdder.h" -#include "RecoLocalTracker/SiStripZeroSuppression/interface/SiStripFedZeroSuppression.h" - -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" -#include "Geometry/CommonDetUnit/interface/GeomDet.h" -#include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h" -#include "Geometry/CommonTopologies/interface/StripTopology.h" -#include "Geometry/CommonDetUnit/interface/GeomDetType.h" - - -#include -#include -#include - -namespace edm -{ - class ModuleCallingContext; - class ConsumesCollector; - class DataMixingSiStripMCDigiWorker - { - public: - - DataMixingSiStripMCDigiWorker(); - - /** standard constructor*/ - explicit DataMixingSiStripMCDigiWorker(const edm::ParameterSet& ps, edm::ConsumesCollector && iC); - /**Default destructor*/ - virtual ~DataMixingSiStripMCDigiWorker(); - - void putSiStrip(edm::Event &e, edm::EventSetup const& iSetup) ; - void addSiStripSignals(const edm::Event &e); - void addSiStripPileups(const int bcr, const edm::EventPrincipal*,unsigned int EventId, - ModuleCallingContext const*); - - - virtual void initializeEvent(const edm::Event &e, edm::EventSetup const& iSetup); - - void DMinitializeDetUnit(StripGeomDetUnit const * det, const edm::EventSetup& iSetup ); - - private: - // data specifiers - - edm::InputTag SistripLabelSig_ ; // name given to collection of SiStrip digis - edm::InputTag SiStripPileInputTag_ ; // InputTag for pileup strips - std::string SiStripDigiCollectionDM_ ; // secondary name to be given to new SiStrip digis - - edm::InputTag SistripAPVLabelSig_; // where to find vector of dead APVs - edm::InputTag SiStripAPVPileInputTag_; - std::string SistripAPVListDM_; // output tag - - - // - - typedef float Amplitude; - typedef std::pair RawDigi; // Replacement for SiStripDigi with pulse height instead of integer ADC - typedef std::vector OneDetectorMap; // maps by strip ID for later combination - can have duplicate strips - typedef std::vector OneDetectorRawMap; // maps by strip ID for later combination - can have duplicate strips - typedef std::map SiGlobalIndex; // map to all data for each detector ID - typedef std::map SiGlobalRawIndex; // map to all data for each detector ID - - typedef SiDigitalConverter::DigitalVecType DigitalVecType; - - SiGlobalIndex SiHitStorage_; - SiGlobalRawIndex SiRawDigis_; - - // unsigned int eventId_; //=0 for signal, from 1-n for pileup events - - // variables for temporary storage of mixed hits: - - - typedef std::map SignalMapType; - typedef std::map signalMaps; - - const SignalMapType* getSignal(uint32_t detID) const { - auto where = signals_.find(detID); - if(where == signals_.end()) { - return nullptr; - } - return &where->second; - } - - signalMaps signals_; - - // to keep track of dead APVs from HIP interactions - typedef std::multimap< uint32_t, std::bitset<6> > APVMap; - - APVMap theAffectedAPVmap_; - - // for noise adding: - - std::string label_; - - std::string gainLabel; - bool SingleStripNoise; - bool peakMode; - double theThreshold; - double theElectronPerADC; - bool APVSaturationFromHIP_; - int theFedAlgo; - std::string geometryType; - - std::unique_ptr theSiNoiseAdder; - std::unique_ptr theSiZeroSuppress; - std::unique_ptr theSiDigitalConverter; - - edm::ESHandle pDD; - - // bad channels for each detector ID - std::map > allBadChannels; - // channels killed by HIP interactions for each detector ID - std::map > allHIPChannels; - // first and last channel wit signal for each detector ID - std::map firstChannelsWithSignal; - std::map lastChannelsWithSignal; - - //---------------------------- - - class StrictWeakOrdering{ - public: - bool operator() (SiStripDigi i,SiStripDigi j) const {return i.strip() < j.strip();} - }; - - class StrictWeakRawOrdering{ - public: - bool operator() (RawDigi i,RawDigi j) const {return i.first < j.first;} - }; - - }; -}//edm - -#endif // SimDataMixingSiStripMCDigiWorker_h diff --git a/SimGeneral/PreMixingModule/plugins/BuildFile.xml b/SimGeneral/PreMixingModule/plugins/BuildFile.xml index be5f5ef247cca..874d02208fd3d 100644 --- a/SimGeneral/PreMixingModule/plugins/BuildFile.xml +++ b/SimGeneral/PreMixingModule/plugins/BuildFile.xml @@ -1,4 +1,5 @@ + @@ -11,6 +12,7 @@ + diff --git a/SimGeneral/DataMixingModule/plugins/DataMixingSiStripMCDigiWorker.cc b/SimGeneral/PreMixingModule/plugins/PreMixingSiStripWorker.cc similarity index 74% rename from SimGeneral/DataMixingModule/plugins/DataMixingSiStripMCDigiWorker.cc rename to SimGeneral/PreMixingModule/plugins/PreMixingSiStripWorker.cc index 36eee1941cefb..d3afa61a56ef8 100644 --- a/SimGeneral/DataMixingModule/plugins/DataMixingSiStripMCDigiWorker.cc +++ b/SimGeneral/PreMixingModule/plugins/PreMixingSiStripWorker.cc @@ -1,39 +1,147 @@ -// File: DataMixingSiStripMCDigiWorker.cc -// Description: see DataMixingSiStripMCDigiWorker.h -// Author: Mike Hildreth, University of Notre Dame -// -//-------------------------------------------- - -#include -#include -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Utilities/interface/EDMException.h" -#include "FWCore/Framework/interface/ConstProductRegistry.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventPrincipal.h" #include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/ProducerBase.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/Provenance/interface/Provenance.h" -#include "DataFormats/Provenance/interface/BranchDescription.h" #include "CondFormats/SiStripObjects/interface/SiStripBadStrip.h" #include "CalibTracker/Records/interface/SiStripDependentRecords.h" -// + +#include "DataFormats/Common/interface/Handle.h" +#include "FWCore/Utilities/interface/RandomNumberGenerator.h" + +//Data Formats +#include "DataFormats/Common/interface/DetSetVector.h" +#include "DataFormats/Common/interface/DetSet.h" +#include "DataFormats/SiStripDigi/interface/SiStripDigi.h" + +#include "CondFormats/SiStripObjects/interface/SiStripNoises.h" +#include "CondFormats/SiStripObjects/interface/SiStripPedestals.h" +#include "CondFormats/SiStripObjects/interface/SiStripThreshold.h" +#include "CalibFormats/SiStripObjects/interface/SiStripGain.h" +#include "SimTracker/SiStripDigitizer/interface/SiTrivialDigitalConverter.h" +#include "SimTracker/SiStripDigitizer/interface/SiGaussianTailNoiseAdder.h" +#include "RecoLocalTracker/SiStripZeroSuppression/interface/SiStripFedZeroSuppression.h" + +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/CommonDetUnit/interface/GeomDet.h" +#include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h" +#include "Geometry/CommonTopologies/interface/StripTopology.h" +#include "Geometry/CommonDetUnit/interface/GeomDetType.h" + #include "CLHEP/Random/RandFlat.h" -// -#include "DataMixingSiStripMCDigiWorker.h" -using namespace std; +#include "PreMixingWorker.h" + +#include +#include + +class PileupSummaryInfo; + +namespace edm { + class PreMixingSiStripWorker: public PreMixingWorker { + public: + PreMixingSiStripWorker(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector && iC); + ~PreMixingSiStripWorker() override = default; + + void initializeEvent(edm::Event const& e, edm::EventSetup const& c) override; + void addSignals(edm::Event const& e, edm::EventSetup const& es) override; + void addPileups(int bcr, edm::EventPrincipal const& ep, int EventId, edm::EventSetup const& es, ModuleCallingContext const*) override; + void put(edm::Event &e, edm::EventSetup const& iSetup, std::vector const& ps, int bs) override; + + private: + void DMinitializeDetUnit(StripGeomDetUnit const * det, const edm::EventSetup& iSetup ); + + // data specifiers + + edm::InputTag SistripLabelSig_ ; // name given to collection of SiStrip digis + edm::InputTag SiStripPileInputTag_ ; // InputTag for pileup strips + std::string SiStripDigiCollectionDM_ ; // secondary name to be given to new SiStrip digis + + edm::InputTag SistripAPVLabelSig_; // where to find vector of dead APVs + edm::InputTag SiStripAPVPileInputTag_; + std::string SistripAPVListDM_; // output tag + + + // + + typedef float Amplitude; + typedef std::pair RawDigi; // Replacement for SiStripDigi with pulse height instead of integer ADC + typedef std::vector OneDetectorMap; // maps by strip ID for later combination - can have duplicate strips + typedef std::vector OneDetectorRawMap; // maps by strip ID for later combination - can have duplicate strips + typedef std::map SiGlobalIndex; // map to all data for each detector ID + typedef std::map SiGlobalRawIndex; // map to all data for each detector ID -namespace edm -{ + typedef SiDigitalConverter::DigitalVecType DigitalVecType; - // Virtual constructor + SiGlobalIndex SiHitStorage_; + SiGlobalRawIndex SiRawDigis_; - DataMixingSiStripMCDigiWorker::DataMixingSiStripMCDigiWorker() { } + // unsigned int eventId_; //=0 for signal, from 1-n for pileup events - // Constructor - DataMixingSiStripMCDigiWorker::DataMixingSiStripMCDigiWorker(const edm::ParameterSet& ps, - edm::ConsumesCollector && iC) : - label_(ps.getParameter("Label")), + // variables for temporary storage of mixed hits: + + + typedef std::map SignalMapType; + typedef std::map signalMaps; + + const SignalMapType* getSignal(uint32_t detID) const { + auto where = signals_.find(detID); + if(where == signals_.end()) { + return nullptr; + } + return &where->second; + } + + signalMaps signals_; + + // to keep track of dead APVs from HIP interactions + typedef std::multimap< uint32_t, std::bitset<6> > APVMap; + + APVMap theAffectedAPVmap_; + + // for noise adding: + + std::string gainLabel; + bool SingleStripNoise; + bool peakMode; + double theThreshold; + double theElectronPerADC; + bool APVSaturationFromHIP_; + int theFedAlgo; + std::string geometryType; + + std::unique_ptr theSiNoiseAdder; + std::unique_ptr theSiZeroSuppress; + std::unique_ptr theSiDigitalConverter; + + edm::ESHandle pDD; + + // bad channels for each detector ID + std::map > allBadChannels; + // channels killed by HIP interactions for each detector ID + std::map > allHIPChannels; + // first and last channel wit signal for each detector ID + std::map firstChannelsWithSignal; + std::map lastChannelsWithSignal; + + //---------------------------- + + class StrictWeakOrdering{ + public: + bool operator() (SiStripDigi i,SiStripDigi j) const {return i.strip() < j.strip();} + }; + + class StrictWeakRawOrdering{ + public: + bool operator() (RawDigi i,RawDigi j) const {return i.first < j.first;} + }; + + }; + + PreMixingSiStripWorker::PreMixingSiStripWorker(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector && iC): gainLabel(ps.getParameter("Gain")), SingleStripNoise(ps.getParameter("SingleStripNoise")), peakMode(ps.getParameter("APVpeakmode")), @@ -58,6 +166,7 @@ namespace edm SiStripDigiCollectionDM_ = ps.getParameter("SiStripDigiCollectionDM"); SistripAPVListDM_= ps.getParameter("SiStripAPVListDM"); + producer.produces< edm::DetSetVector > (SiStripDigiCollectionDM_); if(APVSaturationFromHIP_) { SistripAPVLabelSig_ = ps.getParameter("SistripAPVLabelSig"); @@ -83,12 +192,7 @@ namespace edm } - - // Virtual destructor needed. - DataMixingSiStripMCDigiWorker::~DataMixingSiStripMCDigiWorker() { - } - - void DataMixingSiStripMCDigiWorker::initializeEvent(const edm::Event &e, edm::EventSetup const& iSetup) { + void PreMixingSiStripWorker::initializeEvent(const edm::Event &e, edm::EventSetup const& iSetup) { // initialize individual detectors so we can copy real digitization code: iSetup.get().get(geometryType,pDD); @@ -110,7 +214,7 @@ namespace edm } - void DataMixingSiStripMCDigiWorker::DMinitializeDetUnit(StripGeomDetUnit const * det, const edm::EventSetup& iSetup ) { + void PreMixingSiStripWorker::DMinitializeDetUnit(StripGeomDetUnit const * det, const edm::EventSetup& iSetup ) { edm::ESHandle deadChannelHandle; iSetup.get().get(deadChannelHandle); @@ -136,7 +240,7 @@ namespace edm } - void DataMixingSiStripMCDigiWorker::addSiStripSignals(const edm::Event &e) { + void PreMixingSiStripWorker::addSignals(const edm::Event &e, edm::EventSetup const& es) { // fill in maps of hits Handle< edm::DetSetVector > input; @@ -149,7 +253,7 @@ namespace edm for (; DSViter!=input->end();DSViter++){ #ifdef DEBUG - LogDebug("DataMixingSiStripMCDigiWorker") << "Processing DetID " << DSViter->id; + LogDebug("PreMixingSiStripWorker") << "Processing DetID " << DSViter->id; #endif LocalMap.clear(); @@ -178,14 +282,13 @@ namespace edm - void DataMixingSiStripMCDigiWorker::addSiStripPileups(const int bcr, const EventPrincipal *ep, unsigned int eventNr, - ModuleCallingContext const* mcc) { - LogDebug("DataMixingSiStripMCDigiWorker") <<"\n===============> adding pileups from event "<id()<<" for bunchcrossing "< adding pileups from event "< > const> inputPTR = - getProductByTag >(*ep, SiStripPileInputTag_, mcc); + getProductByTag >(ep, SiStripPileInputTag_, mcc); if(inputPTR ) { @@ -202,7 +305,7 @@ namespace edm for (; DSViter!=input->end();DSViter++){ #ifdef DEBUG - LogDebug("DataMixingSiStripMCDigiWorker") << "Pileups: Processing DetID " << DSViter->id; + LogDebug("PreMixingSiStripWorker") << "Pileups: Processing DetID " << DSViter->id; #endif // find correct local map (or new one) for this detector ID @@ -217,7 +320,7 @@ namespace edm // fill in local map with extra channels LocalMap.insert(LocalMap.end(),(DSViter->data).begin(),(DSViter->data).end()); - std::stable_sort(LocalMap.begin(),LocalMap.end(),DataMixingSiStripMCDigiWorker::StrictWeakOrdering()); + std::stable_sort(LocalMap.begin(),LocalMap.end(),PreMixingSiStripWorker::StrictWeakOrdering()); SiHitStorage_[DSViter->id]=LocalMap; } @@ -233,7 +336,7 @@ namespace edm if(APVSaturationFromHIP_) { std::shared_ptr> > > const> inputAPVPTR = - getProductByTag< std::vector> > >(*ep, SiStripAPVPileInputTag_, mcc); + getProductByTag< std::vector> > >(ep, SiStripAPVPileInputTag_, mcc); if(inputAPVPTR) { @@ -250,7 +353,7 @@ namespace edm - void DataMixingSiStripMCDigiWorker::putSiStrip(edm::Event &e, edm::EventSetup const& iSetup) { + void PreMixingSiStripWorker::put(edm::Event &e, edm::EventSetup const& iSetup, std::vector const& ps, int bs) { // set up machinery to do proper noise adding: edm::ESHandle gainHandle; @@ -552,7 +655,7 @@ namespace edm } // end of big loop over all detector IDs // put the collection of digis in the event - LogInfo("DataMixingSiStripMCDigiWorker") << "total # Merged strips: " << vSiStripDigi.size() ; + LogInfo("PreMixingSiStripWorker") << "total # Merged strips: " << vSiStripDigi.size() ; // make new digi collection @@ -569,3 +672,6 @@ namespace edm } } //edm + +#include "PreMixingWorkerFactory.h" +DEFINE_EDM_PLUGIN(PreMixingWorkerFactory, edm::PreMixingSiStripWorker, "PreMixingSiStripWorker"); From ce0c8be5316d9ca702013d8e6de5a7458fc2f743 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Fri, 23 Feb 2018 09:54:45 +0100 Subject: [PATCH 027/426] Move DataMixingEcalDigiWorkerProd to PreMixingEcalWorker --- .../plugins/DataMixingEcalDigiWorkerProd.cc | 100 -------------- .../plugins/DataMixingEcalDigiWorkerProd.h | 102 --------------- .../plugins/DataMixingModule.cc | 32 +---- .../plugins/DataMixingModule.h | 5 - .../PreMixingModule/plugins/BuildFile.xml | 3 + .../plugins/PreMixingEcalWorker.cc | 123 ++++++++++++++++++ 6 files changed, 132 insertions(+), 233 deletions(-) delete mode 100644 SimGeneral/DataMixingModule/plugins/DataMixingEcalDigiWorkerProd.cc delete mode 100644 SimGeneral/DataMixingModule/plugins/DataMixingEcalDigiWorkerProd.h create mode 100644 SimGeneral/PreMixingModule/plugins/PreMixingEcalWorker.cc diff --git a/SimGeneral/DataMixingModule/plugins/DataMixingEcalDigiWorkerProd.cc b/SimGeneral/DataMixingModule/plugins/DataMixingEcalDigiWorkerProd.cc deleted file mode 100644 index b306267c774e0..0000000000000 --- a/SimGeneral/DataMixingModule/plugins/DataMixingEcalDigiWorkerProd.cc +++ /dev/null @@ -1,100 +0,0 @@ -// File: DataMixingEcalDigiWorkerProd.cc -// Description: see DataMixingEcalDigiWorkerProd.h -// Author: Mike Hildreth, University of Notre Dame -// -//-------------------------------------------- - -#include "FWCore/Framework/interface/ConsumesCollector.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Utilities/interface/EDMException.h" -#include "DataMixingEcalDigiWorkerProd.h" - - -using namespace std; -namespace edm { - // Constructor - DataMixingEcalDigiWorkerProd::DataMixingEcalDigiWorkerProd(const edm::ParameterSet& ps, edm::ConsumesCollector& iC) : - EBPileInputTag_(ps.getParameter("EBPileInputTag")), - EEPileInputTag_(ps.getParameter("EEPileInputTag")), - ESPileInputTag_(ps.getParameter("ESPileInputTag")), - m_EBs25notCont(ps.getParameter("EBs25notContainment") ) , - m_EEs25notCont(ps.getParameter("EEs25notContainment") ) , - m_peToABarrel(ps.getParameter("photoelectronsToAnalogBarrel") ) , - m_peToAEndcap(ps.getParameter("photoelectronsToAnalogEndcap") ) , - label_(ps.getParameter("Label")) - { - - theEBSignalGenerator = EBSignalGenerator(EBPileInputTag_,tok_eb_, m_EBs25notCont, m_EEs25notCont, m_peToABarrel, m_peToAEndcap); - theEESignalGenerator = EESignalGenerator(EEPileInputTag_,tok_ee_, m_EBs25notCont, m_EEs25notCont, m_peToABarrel, m_peToAEndcap); - theESSignalGenerator = ESSignalGenerator(ESPileInputTag_,tok_es_, m_EBs25notCont, m_EEs25notCont, m_peToABarrel, m_peToAEndcap); - - // get the subdetector names - // this->getSubdetectorNames(); //something like this may be useful to check what we are supposed to do... - - // declare the products to produce - - // Ecal - // Signal inputs now handled by EcalDigitizer - gets pSimHits directly - - EBDigiCollectionDM_ = ps.getParameter("EBDigiCollectionDM"); - EEDigiCollectionDM_ = ps.getParameter("EEDigiCollectionDM"); - ESDigiCollectionDM_ = ps.getParameter("ESDigiCollectionDM"); - - // initialize EcalDigitizer here... - - myEcalDigitizer_ = new EcalDigiProducer( ps , iC); - myEcalDigitizer_->setEBNoiseSignalGenerator( & theEBSignalGenerator ); - myEcalDigitizer_->setEENoiseSignalGenerator( & theEESignalGenerator ); - myEcalDigitizer_->setESNoiseSignalGenerator( & theESSignalGenerator ); - - } - - // Virtual destructor needed. - DataMixingEcalDigiWorkerProd::~DataMixingEcalDigiWorkerProd() { - delete myEcalDigitizer_; - } - - void DataMixingEcalDigiWorkerProd::beginRun(const edm::EventSetup& ES) { - } - - void DataMixingEcalDigiWorkerProd::initializeEvent(const edm::Event &e, const edm::EventSetup& ES) { - myEcalDigitizer_->initializeEvent(e, ES); - } - - void DataMixingEcalDigiWorkerProd::addEcalSignals(const edm::Event &e,const edm::EventSetup& ES) { - - myEcalDigitizer_->accumulate(e, ES); // puts SimHits into Ecal digitizer - - } // end of addEcalSignals - - void DataMixingEcalDigiWorkerProd::addEcalPileups(const int bcr, const EventPrincipal *ep, unsigned int eventNr,const edm::EventSetup& ES, - edm::ModuleCallingContext const* mcc) { - - LogDebug("DataMixingEcalDigiWorkerProd") <<"\n===============> adding pileups from event "<id()<<" for bunchcrossing "<finalizeEvent( e, ES ); - - } - - void DataMixingEcalDigiWorkerProd::beginLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const& setup) { - myEcalDigitizer_->beginLuminosityBlock(lumi,setup); - } - - -} //edm - diff --git a/SimGeneral/DataMixingModule/plugins/DataMixingEcalDigiWorkerProd.h b/SimGeneral/DataMixingModule/plugins/DataMixingEcalDigiWorkerProd.h deleted file mode 100644 index fdfaeaacb98e4..0000000000000 --- a/SimGeneral/DataMixingModule/plugins/DataMixingEcalDigiWorkerProd.h +++ /dev/null @@ -1,102 +0,0 @@ -#ifndef SimDataMixingEcalDigiWorkerProd_h -#define SimDataMixingEcalDigiWorkerProd_h - -/** \class DataMixingEcalDigiWorkerProd - * - * DataMixingModule is the EDProducer subclass - * that overlays rawdata events on top of MC, - * using real data for pileup simulation - * This class takes care of the Ecal information at Digi level - * - * \author Mike Hildreth, University of Notre Dame - * - * \version 1st Version June 2008 - * - ************************************************************/ - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventPrincipal.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "CalibFormats/CaloObjects/interface/CaloSamples.h" -#include "DataFormats/Provenance/interface/ProductID.h" -#include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" -#include "DataFormats/EcalDigi/interface/EBDataFrame.h" -#include "DataFormats/EcalDigi/interface/EEDataFrame.h" -#include "DataFormats/EcalDigi/interface/ESDataFrame.h" -#include "SimCalorimetry/EcalSimProducers/interface/EcalDigiProducer.h" -#include "SimCalorimetry/EcalSimAlgos/interface/EcalSignalGenerator.h" -#include "SimGeneral/DataMixingModule/plugins/EcalNoiseStorage.h" - -#include -#include -#include - - -namespace edm -{ - class ConsumesCollector; - class ModuleCallingContext; - - class DataMixingEcalDigiWorkerProd - { - public: - - /** standard constructor*/ - explicit DataMixingEcalDigiWorkerProd(const edm::ParameterSet& ps, edm::ConsumesCollector& iC); - - /**Default destructor*/ - virtual ~DataMixingEcalDigiWorkerProd(); - - void putEcal(edm::Event &e,const edm::EventSetup& ES); - void addEcalSignals(const edm::Event &e,const edm::EventSetup& ES); - void addEcalPileups(const int bcr, const edm::EventPrincipal*,unsigned int EventId, - const edm::EventSetup& ES, edm::ModuleCallingContext const*); - - // set tokens for data access - void setEBAccess( edm::EDGetTokenT tok) { tok_eb_ = tok; } - void setEEAccess( edm::EDGetTokenT tok) { tok_ee_ = tok; } - void setESAccess( edm::EDGetTokenT tok) { tok_es_ = tok; } - - void beginRun(const edm::EventSetup& ES); - void initializeEvent(const edm::Event &e, const edm::EventSetup& ES); - void beginLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const& setup); - - private: - // data specifiers - - // Ecal - // edm::InputTag EBdigiCollectionSig_; // secondary name given to collection of digis - // edm::InputTag EEdigiCollectionSig_ ; // secondary name given to collection of digis - //edm::InputTag ESdigiCollectionSig_ ; // secondary name given to collection of digis - //edm::InputTag ZDCdigiCollectionSig_ ; // secondary name given to collection of digis - edm::InputTag EBPileInputTag_; // InputTag for Pileup Digis collection - edm::InputTag EEPileInputTag_ ; // InputTag for Pileup Digis collection - edm::InputTag ESPileInputTag_ ; // InputTag for Pileup Digis collection - - std::string EBDigiCollectionDM_; // secondary name to be given to collection of digis - std::string EEDigiCollectionDM_ ; // secondary name to be given to collection of digis - std::string ESDigiCollectionDM_ ; // secondary name to be given to collection of digis - - edm::EDGetTokenT tok_eb_; - edm::EDGetTokenT tok_ee_; - edm::EDGetTokenT tok_es_; - - const double m_EBs25notCont; - const double m_EEs25notCont; - const double m_peToABarrel; - const double m_peToAEndcap; - - EcalDigiProducer* myEcalDigitizer_; - EBSignalGenerator theEBSignalGenerator; - EESignalGenerator theEESignalGenerator; - ESSignalGenerator theESSignalGenerator; - - std::string label_; - - }; -}//edm - -#endif // SimDataMixingEcalDigiWorkerProd_h diff --git a/SimGeneral/DataMixingModule/plugins/DataMixingModule.cc b/SimGeneral/DataMixingModule/plugins/DataMixingModule.cc index dffb05a4cc2ce..b57c712b29514 100644 --- a/SimGeneral/DataMixingModule/plugins/DataMixingModule.cc +++ b/SimGeneral/DataMixingModule/plugins/DataMixingModule.cc @@ -50,12 +50,6 @@ namespace edm QIE11PileInputTag_(ps.getParameter("QIE11PileInputTag")), label_(ps.getParameter("Label")) { - - // prepare for data access in DataMixingEcalDigiWorkerProd - tok_eb_ = consumes(EBPileInputTag_); - tok_ee_ = consumes(EEPileInputTag_); - tok_es_ = consumes(ESPileInputTag_); - // prepare for data access in DataMixingHcalDigiWorkerProd tok_hbhe_ = consumes(HBHEPileInputTag_); tok_ho_ = consumes(HOPileInputTag_); @@ -98,14 +92,9 @@ namespace edm produces< ESDigiCollection >(ESDigiCollectionDM_); - if(addMCDigiNoise_ ) { - edm::ConsumesCollector iC(consumesCollector()); - EcalDigiWorkerProd_ = new DataMixingEcalDigiWorkerProd(ps, iC); - EcalDigiWorkerProd_->setEBAccess(tok_eb_); - EcalDigiWorkerProd_->setEEAccess(tok_ee_); - EcalDigiWorkerProd_->setESAccess(tok_es_); + if(!addMCDigiNoise_ ) { + EMDigiWorker_ = new DataMixingEMDigiWorker(ps, consumesCollector()); } - else { EMDigiWorker_ = new DataMixingEMDigiWorker(ps, consumesCollector()); } } else { // merge RecHits EBRecHitCollectionDM_ = ps.getParameter("EBRecHitCollectionDM"); @@ -298,7 +287,6 @@ namespace edm if(!MergeTrackerDigis_){ GeneralTrackWorker_->initializeEvent(e,ES); } - EcalDigiWorkerProd_->initializeEvent( e, ES ); } if( addMCDigiNoise_ && MergeHcalDigisProd_) { HcalDigiWorkerProd_->initializeEvent( e, ES ); @@ -312,7 +300,6 @@ namespace edm void DataMixingModule::beginRun(edm::Run const& run, const edm::EventSetup& ES) { BMixingModule::beginRun( run, ES); if( addMCDigiNoise_ ) { - EcalDigiWorkerProd_->beginRun( ES ); HcalDigiWorkerProd_->beginRun( run, ES ); } } @@ -320,7 +307,6 @@ namespace edm void DataMixingModule::endRun(edm::Run const& run, const edm::EventSetup& ES) { //if( addMCDigiNoise_ ) { // HcalDigiWorkerProd_->endRun( run, ES ); // FIXME not implemented - // EcalDigiWorkerProd_->endRun( ES ); // FIXME not implemented //} BMixingModule::endRun( run, ES); } @@ -328,8 +314,7 @@ namespace edm // Virtual destructor needed. DataMixingModule::~DataMixingModule() { if(MergeEMDigis_){ - if(addMCDigiNoise_ ) {delete EcalDigiWorkerProd_;} - else {delete EMDigiWorker_;} + if(!addMCDigiNoise_ ) {delete EMDigiWorker_;} } else {delete EMWorker_;} if(MergeHcalDigis_) { @@ -358,8 +343,7 @@ namespace edm // Ecal if(MergeEMDigis_) { - if(addMCDigiNoise_ ){ EcalDigiWorkerProd_->addEcalSignals(e, ES);} - else {EMDigiWorker_->addEMSignals(e, ES); } + if(!addMCDigiNoise_ ){EMDigiWorker_->addEMSignals(e, ES); } } else{ EMWorker_->addEMSignals(e);} @@ -425,8 +409,7 @@ namespace edm // Ecal if(MergeEMDigis_) { - if(addMCDigiNoise_ ) { EcalDigiWorkerProd_->addEcalPileups(bcr, &ep, eventNr, ES, &moduleCallingContext);} - else { EMDigiWorker_->addEMPileups(bcr, &ep, eventNr, ES, &moduleCallingContext);} + if(!addMCDigiNoise_ ) { EMDigiWorker_->addEMPileups(bcr, &ep, eventNr, ES, &moduleCallingContext);} } else {EMWorker_->addEMPileups(bcr, &ep, eventNr, &moduleCallingContext); } @@ -527,8 +510,7 @@ namespace edm // Ecal if(MergeEMDigis_) { - if(addMCDigiNoise_ ) {EcalDigiWorkerProd_->putEcal(e,ES);} - else { EMDigiWorker_->putEM(e,ES);} + if(!addMCDigiNoise_ ) { EMDigiWorker_->putEM(e,ES);} } else {EMWorker_->putEM(e);} @@ -563,11 +545,9 @@ namespace edm void DataMixingModule::beginLuminosityBlock(LuminosityBlock const& l1, EventSetup const& c) { BMixingModule::beginLuminosityBlock(l1, c); - if(addMCDigiNoise_ && EcalDigiWorkerProd_) EcalDigiWorkerProd_->beginLuminosityBlock(l1,c); } void DataMixingModule::endLuminosityBlock(LuminosityBlock const& l1, EventSetup const& c) { - // EcalDigiWorkerProd_->endLuminosityBlock(l1,c); // FIXME Not implemented. BMixingModule::endLuminosityBlock(l1, c); } diff --git a/SimGeneral/DataMixingModule/plugins/DataMixingModule.h b/SimGeneral/DataMixingModule/plugins/DataMixingModule.h index 4c3101acff982..7eccfb6e56ab4 100644 --- a/SimGeneral/DataMixingModule/plugins/DataMixingModule.h +++ b/SimGeneral/DataMixingModule/plugins/DataMixingModule.h @@ -26,7 +26,6 @@ #include "SimGeneral/DataMixingModule/plugins/DataMixingEMWorker.h" #include "SimGeneral/DataMixingModule/plugins/DataMixingHcalWorker.h" #include "SimGeneral/DataMixingModule/plugins/DataMixingEMDigiWorker.h" -#include "SimGeneral/DataMixingModule/plugins/DataMixingEcalDigiWorkerProd.h" #include "SimGeneral/DataMixingModule/plugins/DataMixingHcalDigiWorker.h" #include "SimGeneral/DataMixingModule/plugins/DataMixingHcalDigiWorkerProd.h" #include "SimGeneral/DataMixingModule/plugins/DataMixingMuonWorker.h" @@ -127,7 +126,6 @@ namespace edm { DataMixingEMWorker *EMWorker_ ; DataMixingEMDigiWorker *EMDigiWorker_ ; - DataMixingEcalDigiWorkerProd *EcalDigiWorkerProd_ ; bool MergeEMDigis_; // Hcal @@ -152,9 +150,6 @@ namespace edm { edm::EDGetTokenT tok_zdc_; edm::EDGetTokenT tok_qie10_; edm::EDGetTokenT tok_qie11_; - edm::EDGetTokenT tok_eb_; - edm::EDGetTokenT tok_ee_; - edm::EDGetTokenT tok_es_; bool MergeHcalDigis_; bool MergeHcalDigisProd_; diff --git a/SimGeneral/PreMixingModule/plugins/BuildFile.xml b/SimGeneral/PreMixingModule/plugins/BuildFile.xml index 874d02208fd3d..03bc2cdabae55 100644 --- a/SimGeneral/PreMixingModule/plugins/BuildFile.xml +++ b/SimGeneral/PreMixingModule/plugins/BuildFile.xml @@ -2,6 +2,7 @@ + @@ -13,6 +14,8 @@ + + diff --git a/SimGeneral/PreMixingModule/plugins/PreMixingEcalWorker.cc b/SimGeneral/PreMixingModule/plugins/PreMixingEcalWorker.cc new file mode 100644 index 0000000000000..74872a447e615 --- /dev/null +++ b/SimGeneral/PreMixingModule/plugins/PreMixingEcalWorker.cc @@ -0,0 +1,123 @@ +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventPrincipal.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/ProducerBase.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" +#include "DataFormats/EcalDigi/interface/EBDataFrame.h" +#include "DataFormats/EcalDigi/interface/EEDataFrame.h" +#include "DataFormats/EcalDigi/interface/ESDataFrame.h" +#include "SimCalorimetry/EcalSimProducers/interface/EcalDigiProducer.h" +#include "SimCalorimetry/EcalSimAlgos/interface/EcalSignalGenerator.h" + +#include "PreMixingWorker.h" + +namespace edm { + class PreMixingEcalWorker: public PreMixingWorker { + public: + PreMixingEcalWorker(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector&& iC); + ~PreMixingEcalWorker() override = default; + + PreMixingEcalWorker(const PreMixingEcalWorker&) = delete; + PreMixingEcalWorker& operator=(const PreMixingEcalWorker&) = delete; + + void beginLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const& setup) override; + + void initializeEvent(edm::Event const& e, edm::EventSetup const& ES) override; + void addSignals(edm::Event const& e, edm::EventSetup const& ES) override; + void addPileups(int bcr, edm::EventPrincipal const& ep, int EventId, edm::EventSetup const& es, ModuleCallingContext const*) override; + void put(edm::Event &e, edm::EventSetup const& iSetup, std::vector const& ps, int bs) override; + + private: + edm::InputTag EBPileInputTag_; // InputTag for Pileup Digis collection + edm::InputTag EEPileInputTag_ ; // InputTag for Pileup Digis collection + edm::InputTag ESPileInputTag_ ; // InputTag for Pileup Digis collection + + std::string EBDigiCollectionDM_; // secondary name to be given to collection of digis + std::string EEDigiCollectionDM_ ; // secondary name to be given to collection of digis + std::string ESDigiCollectionDM_ ; // secondary name to be given to collection of digis + + edm::EDGetTokenT tok_eb_; + edm::EDGetTokenT tok_ee_; + edm::EDGetTokenT tok_es_; + + const double m_EBs25notCont; + const double m_EEs25notCont; + const double m_peToABarrel; + const double m_peToAEndcap; + + EBSignalGenerator theEBSignalGenerator; + EESignalGenerator theEESignalGenerator; + ESSignalGenerator theESSignalGenerator; + EcalDigiProducer myEcalDigitizer_; + }; + + + // Constructor + PreMixingEcalWorker::PreMixingEcalWorker(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector&& iC) : + EBPileInputTag_(ps.getParameter("EBPileInputTag")), + EEPileInputTag_(ps.getParameter("EEPileInputTag")), + ESPileInputTag_(ps.getParameter("ESPileInputTag")), + tok_eb_(iC.consumes(EBPileInputTag_)), + tok_ee_(iC.consumes(EEPileInputTag_)), + tok_es_(iC.consumes(ESPileInputTag_)), + m_EBs25notCont(ps.getParameter("EBs25notContainment") ) , + m_EEs25notCont(ps.getParameter("EEs25notContainment") ) , + m_peToABarrel(ps.getParameter("photoelectronsToAnalogBarrel") ) , + m_peToAEndcap(ps.getParameter("photoelectronsToAnalogEndcap") ), + theEBSignalGenerator(EBPileInputTag_,tok_eb_, m_EBs25notCont, m_EEs25notCont, m_peToABarrel, m_peToAEndcap), + theEESignalGenerator(EEPileInputTag_,tok_ee_, m_EBs25notCont, m_EEs25notCont, m_peToABarrel, m_peToAEndcap), + theESSignalGenerator(ESPileInputTag_,tok_es_, m_EBs25notCont, m_EEs25notCont, m_peToABarrel, m_peToAEndcap), + myEcalDigitizer_(ps, iC) + { + EBDigiCollectionDM_ = ps.getParameter("EBDigiCollectionDM"); + EEDigiCollectionDM_ = ps.getParameter("EEDigiCollectionDM"); + ESDigiCollectionDM_ = ps.getParameter("ESDigiCollectionDM"); + + producer.produces< EBDigiCollection >(EBDigiCollectionDM_); + producer.produces< EEDigiCollection >(EEDigiCollectionDM_); + producer.produces< ESDigiCollection >(ESDigiCollectionDM_); + + myEcalDigitizer_.setEBNoiseSignalGenerator( & theEBSignalGenerator ); + myEcalDigitizer_.setEENoiseSignalGenerator( & theEESignalGenerator ); + myEcalDigitizer_.setESNoiseSignalGenerator( & theESSignalGenerator ); + } + + void PreMixingEcalWorker::initializeEvent(const edm::Event &e, const edm::EventSetup& ES) { + myEcalDigitizer_.initializeEvent(e, ES); + } + + void PreMixingEcalWorker::addSignals(const edm::Event &e,const edm::EventSetup& ES) { + myEcalDigitizer_.accumulate(e, ES); + } + + void PreMixingEcalWorker::addPileups(int bcr, const EventPrincipal& ep, int eventNr, const edm::EventSetup& ES, + edm::ModuleCallingContext const* mcc) { + + LogDebug("PreMixingEcalWorker") <<"\n===============> adding pileups from event "< const& ps, int bs) { + myEcalDigitizer_.finalizeEvent( e, ES ); + } + + void PreMixingEcalWorker::beginLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const& setup) { + myEcalDigitizer_.beginLuminosityBlock(lumi,setup); + } +} //edm + +#include "PreMixingWorkerFactory.h" +DEFINE_EDM_PLUGIN(PreMixingWorkerFactory, edm::PreMixingEcalWorker, "PreMixingEcalWorker"); From 9ad44817f7d608368d272b65ce47b6c58cb4c107 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Fri, 23 Feb 2018 11:50:16 +0100 Subject: [PATCH 028/426] Add PreMixingHcalWorker, based on DataMixingHcalDigiWorkerProd --- .../plugins/PreMixingHcalWorker.cc | 158 ++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 SimGeneral/PreMixingModule/plugins/PreMixingHcalWorker.cc diff --git a/SimGeneral/PreMixingModule/plugins/PreMixingHcalWorker.cc b/SimGeneral/PreMixingModule/plugins/PreMixingHcalWorker.cc new file mode 100644 index 0000000000000..8ab48d50f45fd --- /dev/null +++ b/SimGeneral/PreMixingModule/plugins/PreMixingHcalWorker.cc @@ -0,0 +1,158 @@ +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventPrincipal.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/ProducerBase.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" +#include "DataFormats/HcalDigi/interface/HBHEDataFrame.h" +#include "DataFormats/HcalDigi/interface/HODataFrame.h" +#include "DataFormats/HcalDigi/interface/HFDataFrame.h" +#include "DataFormats/HcalDigi/interface/QIE10DataFrame.h" +#include "DataFormats/HcalDigi/interface/QIE11DataFrame.h" +#include "SimCalorimetry/HcalSimProducers/interface/HcalDigiProducer.h" +#include "SimCalorimetry/HcalSimAlgos/interface/HcalSignalGenerator.h" + +#include "PreMixingWorker.h" + +namespace edm { + class PreMixingHcalWorker: public PreMixingWorker { + public: + PreMixingHcalWorker(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector&& iC); + ~PreMixingHcalWorker() override = default; + + PreMixingHcalWorker(const PreMixingHcalWorker&) = delete; + PreMixingHcalWorker& operator=(const PreMixingHcalWorker&) = delete; + + void beginRun(const edm::Run& run, const edm::EventSetup& ES) override; + void initializeEvent(const edm::Event &e, const edm::EventSetup& ES) override; + void addSignals(const edm::Event &e, const edm::EventSetup& ES) override; + void addPileups(int bcr, const edm::EventPrincipal&, int EventId, + const edm::EventSetup& ES, edm::ModuleCallingContext const*) override; + void put(edm::Event &e,const edm::EventSetup& ES, std::vector const& ps, int bs) override; + + + private: + edm::InputTag HBHEPileInputTag_; // InputTag for Pileup Digis collection + edm::InputTag HOPileInputTag_ ; // InputTag for Pileup Digis collection + edm::InputTag HFPileInputTag_ ; // InputTag for Pileup Digis collection + edm::InputTag ZDCPileInputTag_ ; // InputTag for Pileup Digis collection + edm::InputTag QIE10PileInputTag_ ; // InputTag for Pileup Digis collection + edm::InputTag QIE11PileInputTag_ ; // InputTag for Pileup Digis collection + std::string HBHEDigiCollectionDM_; // secondary name to be given to collection of digis + std::string HODigiCollectionDM_ ; // secondary name to be given to collection of digis + std::string HFDigiCollectionDM_ ; // secondary name to be given to collection of digis + std::string ZDCDigiCollectionDM_ ; // secondary name to be given to collection of digis + std::string QIE10DigiCollectionDM_ ; // secondary name to be given to collection of digis + std::string QIE11DigiCollectionDM_ ; // secondary name to be given to collection of digis + + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; + edm::EDGetTokenT tok_zdc_; + edm::EDGetTokenT tok_qie10_; + edm::EDGetTokenT tok_qie11_; + + HcalDigiProducer myHcalDigitizer_; + HBHESignalGenerator theHBHESignalGenerator; + HOSignalGenerator theHOSignalGenerator; + HFSignalGenerator theHFSignalGenerator; + ZDCSignalGenerator theZDCSignalGenerator; + QIE10SignalGenerator theQIE10SignalGenerator; + QIE11SignalGenerator theQIE11SignalGenerator; + }; + + // Constructor + PreMixingHcalWorker::PreMixingHcalWorker(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector&& iC): + HBHEPileInputTag_(ps.getParameter("HBHEPileInputTag")), + HOPileInputTag_(ps.getParameter("HOPileInputTag")), + HFPileInputTag_(ps.getParameter("HFPileInputTag")), + ZDCPileInputTag_(ps.getParameter("ZDCPileInputTag")), + QIE10PileInputTag_(ps.getParameter("QIE10PileInputTag")), + QIE11PileInputTag_(ps.getParameter("QIE11PileInputTag")), + myHcalDigitizer_(ps, iC) + { + tok_hbhe_ = iC.consumes(HBHEPileInputTag_); + tok_ho_ = iC.consumes(HOPileInputTag_); + tok_hf_ = iC.consumes(HFPileInputTag_); + tok_zdc_ = iC.consumes(ZDCPileInputTag_); + tok_qie10_ = iC.consumes(QIE10PileInputTag_); + tok_qie11_ = iC.consumes(QIE11PileInputTag_); + + theHBHESignalGenerator = HBHESignalGenerator(HBHEPileInputTag_,tok_hbhe_); + theHOSignalGenerator = HOSignalGenerator(HOPileInputTag_,tok_ho_); + theHFSignalGenerator = HFSignalGenerator(HFPileInputTag_,tok_hf_); + theZDCSignalGenerator = ZDCSignalGenerator(ZDCPileInputTag_,tok_zdc_); + theQIE10SignalGenerator = QIE10SignalGenerator(QIE10PileInputTag_,tok_qie10_); + theQIE11SignalGenerator = QIE11SignalGenerator(QIE11PileInputTag_,tok_qie11_); + + // Hcal + // Signal inputs now handled by HcalDigitizer - gets pSimHits directly + + HBHEDigiCollectionDM_ = ps.getParameter("HBHEDigiCollectionDM"); + HODigiCollectionDM_ = ps.getParameter("HODigiCollectionDM"); + HFDigiCollectionDM_ = ps.getParameter("HFDigiCollectionDM"); + ZDCDigiCollectionDM_ = ps.getParameter("ZDCDigiCollectionDM"); + QIE10DigiCollectionDM_ = ps.getParameter("QIE10DigiCollectionDM"); + QIE11DigiCollectionDM_ = ps.getParameter("QIE11DigiCollectionDM"); + + producer.produces< HBHEDigiCollection >(); + producer.produces< HODigiCollection >(); + producer.produces< HFDigiCollection >(); + producer.produces< ZDCDigiCollection >(); + + producer.produces("HFQIE10DigiCollection"); + producer.produces("HBHEQIE11DigiCollection"); + + // initialize HcalDigitizer here... + myHcalDigitizer_.setHBHENoiseSignalGenerator( & theHBHESignalGenerator ); + myHcalDigitizer_.setHFNoiseSignalGenerator( & theHFSignalGenerator ); + myHcalDigitizer_.setHONoiseSignalGenerator( & theHOSignalGenerator ); + myHcalDigitizer_.setZDCNoiseSignalGenerator( & theZDCSignalGenerator ); + myHcalDigitizer_.setQIE10NoiseSignalGenerator( & theQIE10SignalGenerator ); + myHcalDigitizer_.setQIE11NoiseSignalGenerator( & theQIE11SignalGenerator ); + + } + + void PreMixingHcalWorker::beginRun(const edm::Run& run, const edm::EventSetup& ES) { + myHcalDigitizer_.beginRun(run, ES); + } + + void PreMixingHcalWorker::initializeEvent(const edm::Event &e, const edm::EventSetup& ES) { + myHcalDigitizer_.initializeEvent(e, ES); + } + + void PreMixingHcalWorker::addSignals(const edm::Event &e,const edm::EventSetup& ES) { + myHcalDigitizer_.accumulate(e, ES); + } + + void PreMixingHcalWorker::addPileups(int bcr, const EventPrincipal& ep, int eventNr,const edm::EventSetup& ES, + edm::ModuleCallingContext const* mcc) { + LogDebug("PreMixingHcalWorker") <<"\n===============> adding pileups from event "< const& ps, int bs) { + myHcalDigitizer_.finalizeEvent( e, ES); + } +} //edm + +#include "PreMixingWorkerFactory.h" +DEFINE_EDM_PLUGIN(PreMixingWorkerFactory, edm::PreMixingHcalWorker, "PreMixingHcalWorker"); From 4daf2e452346653b10f5bfcf2f92b53bbf3fe8e6 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Fri, 23 Feb 2018 14:12:11 +0100 Subject: [PATCH 029/426] Add PreMixing{DT,RPC,CSC}Worker, based on DataMixingMuonWorker --- .../PreMixingModule/plugins/BuildFile.xml | 6 + .../plugins/PreMixingMuonWorkers.cc | 218 ++++++++++++++++++ 2 files changed, 224 insertions(+) create mode 100644 SimGeneral/PreMixingModule/plugins/PreMixingMuonWorkers.cc diff --git a/SimGeneral/PreMixingModule/plugins/BuildFile.xml b/SimGeneral/PreMixingModule/plugins/BuildFile.xml index 03bc2cdabae55..81643e2a24687 100644 --- a/SimGeneral/PreMixingModule/plugins/BuildFile.xml +++ b/SimGeneral/PreMixingModule/plugins/BuildFile.xml @@ -3,6 +3,10 @@ + + + + @@ -16,6 +20,8 @@ + + diff --git a/SimGeneral/PreMixingModule/plugins/PreMixingMuonWorkers.cc b/SimGeneral/PreMixingModule/plugins/PreMixingMuonWorkers.cc new file mode 100644 index 0000000000000..cf9c4398e84c6 --- /dev/null +++ b/SimGeneral/PreMixingModule/plugins/PreMixingMuonWorkers.cc @@ -0,0 +1,218 @@ +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventPrincipal.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/ProducerBase.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include "DataFormats/Common/interface/Handle.h" + +//DT +#include "DataFormats/DTDigi/interface/DTDigiCollection.h" +//RPC +#include "DataFormats/RPCDigi/interface/RPCDigiCollection.h" +//CSC +#include "DataFormats/CSCDigi/interface/CSCStripDigiCollection.h" +#include "DataFormats/CSCDigi/interface/CSCWireDigiCollection.h" +#include "DataFormats/CSCDigi/interface/CSCComparatorDigiCollection.h" + +#include "PreMixingWorker.h" + + +namespace edm { + // Generic + template + class PreMixingMuonWorker: public PreMixingWorker { + public: + PreMixingMuonWorker(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector&& iC): PreMixingMuonWorker(ps, producer, iC) {} + PreMixingMuonWorker(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector& iC); + ~PreMixingMuonWorker() override = default; + + void initializeEvent(edm::Event const& iEvent, edm::EventSetup const& iSetup) override {} + void addSignals(edm::Event const& iEvent, edm::EventSetup const& iSetup) override; + void addPileups(int bcr, edm::EventPrincipal const& ep, int eventNr, edm::EventSetup const& iSetup, edm::ModuleCallingContext const *mcc) override { + addPileups(ep, mcc); + } + void put(edm::Event& iEvent, edm::EventSetup const& iSetup, std::vector const& ps, int bunchSpacing) override { + put(iEvent); + } + + void addPileups(edm::EventPrincipal const& ep, edm::ModuleCallingContext const *mcc); + void put(edm::Event& iEvent); + private: + edm::EDGetTokenT signalToken_; + edm::InputTag pileupTag_; + std::string collectionDM_; // secondary name to be given to new digis + + std::unique_ptr accumulated_; + }; + + template + PreMixingMuonWorker::PreMixingMuonWorker(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector& iC): + signalToken_(iC.consumes(ps.getParameter("digiTagSig"))), + pileupTag_(ps.getParameter("pileInputTag")), + collectionDM_(ps.getParameter("collectionDM")) + { + producer.produces(collectionDM_); + } + + template + void PreMixingMuonWorker::addSignals(edm::Event const& iEvent, edm::EventSetup const& iSetup) { + Handle digis; + iEvent.getByToken(signalToken_, digis); + + accumulated_ = std::make_unique(*digis); // for signal we can just copy + } + + template + void PreMixingMuonWorker::addPileups(edm::EventPrincipal const& ep, edm::ModuleCallingContext const *mcc) { + std::shared_ptr const> digisPTR = getProductByTag(ep, pileupTag_, mcc); + for(const auto& elem: *(digisPTR->product())) { + accumulated_->put(elem.second, elem.first); + } + } + + template + void PreMixingMuonWorker::put(edm::Event& iEvent) { + iEvent.put(std::move(accumulated_), collectionDM_); + } + + // Specialize put for CSC strip + template <> + void PreMixingMuonWorker::put(edm::Event& iEvent) { + auto merged = std::make_unique(); + for(const auto& elem: *accumulated_) { + // The layerId + const CSCDetId& layerId = elem.first; + + // Get the iterators over the digis associated with this LayerId + const CSCStripDigiCollection::Range& range = elem.second; + + std::vector NewDigiList; + + std::vector StripList; + std::vector StripPointer; + + for(CSCStripDigiCollection::const_iterator dtdigi=range.first; dtdigi!=range.second; ++dtdigi){ + //std::cout << "Digi " << (*dtdigi).getStrip() << std::endl; + StripList.push_back( (*dtdigi).getStrip() ); + StripPointer.push_back( dtdigi ); + } + + int PrevStrip = -1; + std::vector DuplicateList; + + std::vector::const_iterator StripPtr = StripPointer.begin(); + + for( std::vector::const_iterator istrip = StripList.begin(); istrip !=StripList.end(); ++istrip) { + + const int CurrentStrip = *(istrip); + + if(CurrentStrip > PrevStrip) { + PrevStrip = CurrentStrip; + + int dupl_count; + dupl_count = std::count(StripList.begin(), StripList.end(), CurrentStrip); + if(dupl_count > 1) { + std::vector::const_iterator duplicate = istrip; + ++duplicate; + std::vector::const_iterator DuplPointer = StripPtr; + ++DuplPointer; + for( ; duplicate!=StripList.end(); ++duplicate) { + if( (*duplicate) == CurrentStrip ) { + + // std::cout << " Duplicate of current " << CurrentStrip << " found at " << (duplicate - StripList.begin()) << std::endl; + + DuplicateList.push_back(CurrentStrip); + + std::vector pileup_adc = (**DuplPointer).getADCCounts(); + std::vector signal_adc = (**StripPtr).getADCCounts(); + + std::vector::const_iterator minplace; + + minplace = std::min_element(pileup_adc.begin(), pileup_adc.end()); + + int minvalue = (*minplace); + + std::vector new_adc; + + std::vector::const_iterator newsig = signal_adc.begin(); + + for(std::vector::const_iterator ibin = pileup_adc.begin(); ibin!=pileup_adc.end(); ++ibin) { + new_adc.push_back((*newsig)+(*ibin)-minvalue); + + ++newsig; + } + + CSCStripDigi newDigi(CurrentStrip, new_adc); + NewDigiList.push_back(newDigi); + } + ++DuplPointer; + } + } + else { NewDigiList.push_back(**StripPtr); } + } // if strips monotonically increasing... Haven't hit duplicates yet + else { // reached end of signal digis, or there was no overlap + PrevStrip = 1000; // now into pileup signals, stop looking forward for duplicates + + // check if this digi was in the duplicate list + int check; + check = std::count(DuplicateList.begin(), DuplicateList.end(), CurrentStrip); + if(check == 0) NewDigiList.push_back(**StripPtr); + } + ++StripPtr; + } + + CSCStripDigiCollection::Range stripRange(NewDigiList.begin(), NewDigiList.end()); + + merged->put(stripRange, layerId); + } + + iEvent.put(std::move(merged), collectionDM_); + accumulated_.reset(); + } + + // CSC has three digi collections + class PreMixingCSCWorker: public PreMixingWorker { + public: + PreMixingCSCWorker(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector&& iC): + stripWorker_(ps.getParameter("strip"), producer, iC), + wireWorker_(ps.getParameter("wire"), producer, iC), + comparatorWorker_(ps.getParameter("comparator"), producer, iC) {} + ~PreMixingCSCWorker() override = default; + + void initializeEvent(edm::Event const& iEvent, edm::EventSetup const& iSetup) override {} + + void addSignals(edm::Event const& iEvent, edm::EventSetup const& iSetup) override { + stripWorker_.addSignals(iEvent, iSetup); + wireWorker_.addSignals(iEvent, iSetup); + comparatorWorker_.addSignals(iEvent, iSetup); + } + + void addPileups(int bcr, edm::EventPrincipal const& ep, int eventNr, edm::EventSetup const& iSetup, edm::ModuleCallingContext const *mcc) override { + stripWorker_.addPileups(ep, mcc); + wireWorker_.addPileups(ep, mcc); + comparatorWorker_.addPileups(ep, mcc); + } + + void put(edm::Event& iEvent, edm::EventSetup const& iSetup, std::vector const& ps, int bunchSpacing) override { + stripWorker_.put(iEvent); + wireWorker_.put(iEvent); + comparatorWorker_.put(iEvent); + } + private: + PreMixingMuonWorker stripWorker_; + PreMixingMuonWorker wireWorker_; + PreMixingMuonWorker comparatorWorker_; + }; + + // the rest are simpler + using PreMixingDTWorker = PreMixingMuonWorker; + using PreMixingRPCWorker = PreMixingMuonWorker; +} + +// register plugins +#include "PreMixingWorkerFactory.h" +DEFINE_EDM_PLUGIN(PreMixingWorkerFactory, edm::PreMixingDTWorker , "PreMixingDTWorker"); +DEFINE_EDM_PLUGIN(PreMixingWorkerFactory, edm::PreMixingCSCWorker, "PreMixingCSCWorker"); +DEFINE_EDM_PLUGIN(PreMixingWorkerFactory, edm::PreMixingRPCWorker, "PreMixingRPCWorker"); From e198f60236b72d37566dbe83df8df76d056d815d Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Fri, 23 Feb 2018 16:22:20 +0100 Subject: [PATCH 030/426] Add PreMixingDigiSimLinkWorker's, adapted from DataMixingTrackingParticleWorker --- .../plugins/PreMixingDigiSimLinkWorkers.cc | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 SimGeneral/PreMixingModule/plugins/PreMixingDigiSimLinkWorkers.cc diff --git a/SimGeneral/PreMixingModule/plugins/PreMixingDigiSimLinkWorkers.cc b/SimGeneral/PreMixingModule/plugins/PreMixingDigiSimLinkWorkers.cc new file mode 100644 index 0000000000000..646f91703433c --- /dev/null +++ b/SimGeneral/PreMixingModule/plugins/PreMixingDigiSimLinkWorkers.cc @@ -0,0 +1,96 @@ +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventPrincipal.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/ProducerBase.h" + +#include "DataFormats/Common/interface/Handle.h" +#include "SimDataFormats/TrackerDigiSimLink/interface/StripDigiSimLink.h" +#include "SimDataFormats/TrackerDigiSimLink/interface/PixelDigiSimLink.h" +#include "SimDataFormats/DigiSimLinks/interface/DTDigiSimLinkCollection.h" +#include "SimDataFormats/RPCDigiSimLink/interface/RPCDigiSimLink.h" +#include "DataFormats/Common/interface/DetSetVector.h" + +#include "PreMixingWorker.h" + +namespace edm { + template + class PreMixingDigiSimLinkWorker: public PreMixingWorker { + public: + PreMixingDigiSimLinkWorker(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector&& iC); + ~PreMixingDigiSimLinkWorker() override = default; + + void initializeEvent(edm::Event const& iEvent, edm::EventSetup const& iSetup) override {} + void addSignals(edm::Event const& iEvent, edm::EventSetup const& iSetup) override; + void addPileups(int bcr, edm::EventPrincipal const& ep, int eventNr, edm::EventSetup const& iSetup, edm::ModuleCallingContext const *mcc) override; + void put(edm::Event& iEvent, edm::EventSetup const& iSetup, std::vector const& ps, int bunchSpacing) override; + + private: + edm::EDGetTokenT signalToken_; + edm::InputTag pileupTag_; + std::string collectionDM_; // secondary name to be given to new digis + + std::unique_ptr merged_; + }; + + template + PreMixingDigiSimLinkWorker::PreMixingDigiSimLinkWorker(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector&& iC): + signalToken_(iC.consumes(ps.getParameter("labelSig"))), + pileupTag_(ps.getParameter("pileInputTag")), + collectionDM_(ps.getParameter("collectionDM")) + { + producer.produces(collectionDM_); + } + + template + void PreMixingDigiSimLinkWorker::addSignals(edm::Event const& iEvent, edm::EventSetup const& iSetup) { + Handle digis; + iEvent.getByToken(signalToken_, digis); + + if(digis.isValid()) { + merged_ = std::make_unique(*digis); // for signal we can just copy + } + else { + merged_ = std::make_unique(); + } + } + + template + void PreMixingDigiSimLinkWorker::addPileups(int bcr, edm::EventPrincipal const& ep, int eventNr, edm::EventSetup const& iSetup, edm::ModuleCallingContext const *mcc) { + std::shared_ptr const> digisPTR = getProductByTag(ep, pileupTag_, mcc); + if(digisPTR) { + for(const auto& detsetSource: *(digisPTR->product())) { + auto& detsetTarget = merged_->find_or_insert(detsetSource.detId()); + std::copy(detsetSource.begin(), detsetSource.end(), std::back_inserter(detsetTarget)); + } + } + } + + template + void PreMixingDigiSimLinkWorker::put(edm::Event& iEvent, edm::EventSetup const& iSetup, std::vector const& ps, int bunchSpacing) { + iEvent.put(std::move(merged_), collectionDM_); + } + + // Specialize for DT + template <> + void PreMixingDigiSimLinkWorker::addPileups(int bcr, edm::EventPrincipal const& ep, int eventNr, edm::EventSetup const& iSetup, edm::ModuleCallingContext const *mcc) { + std::shared_ptr const> digisPTR = getProductByTag(ep, pileupTag_, mcc); + if(digisPTR) { + for(const auto& elem: *(digisPTR->product())) { + merged_->put(elem.second, elem.first); + } + } + } + + using PreMixingPixelDigiSimLinkWorker = PreMixingDigiSimLinkWorker >; + using PreMixingStripDigiSimLinkWorker = PreMixingDigiSimLinkWorker >; + using PreMixingRPCDigiSimLinkWorker = PreMixingDigiSimLinkWorker >; + using PreMixingDTDigiSimLinkWorker = PreMixingDigiSimLinkWorker; +} + +// register plugins +#include "PreMixingWorkerFactory.h" +DEFINE_EDM_PLUGIN(PreMixingWorkerFactory, edm::PreMixingPixelDigiSimLinkWorker , "PreMixingPixelDigiSimLinkWorker"); +DEFINE_EDM_PLUGIN(PreMixingWorkerFactory, edm::PreMixingStripDigiSimLinkWorker , "PreMixingStripDigiSimLinkWorker"); +DEFINE_EDM_PLUGIN(PreMixingWorkerFactory, edm::PreMixingRPCDigiSimLinkWorker , "PreMixingRPCDigiSimLinkWorker"); +DEFINE_EDM_PLUGIN(PreMixingWorkerFactory, edm::PreMixingDTDigiSimLinkWorker , "PreMixingDTDigiSimLinkWorker"); From 181b03250f5d78d868032bff11b8b84a82b8dd8a Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Fri, 23 Feb 2018 15:55:57 +0100 Subject: [PATCH 031/426] Move DataMixingTrackingParticleWorker to PreMixingTrackingParticleWorker --- .../plugins/DataMixingModule.cc | 29 -- .../plugins/DataMixingModule.h | 5 - .../DataMixingTrackingParticleWorker.cc | 401 ------------------ .../DataMixingTrackingParticleWorker.h | 123 ------ .../PreMixingTrackingParticleWorker.cc | 156 +++++++ 5 files changed, 156 insertions(+), 558 deletions(-) delete mode 100644 SimGeneral/DataMixingModule/plugins/DataMixingTrackingParticleWorker.cc delete mode 100644 SimGeneral/DataMixingModule/plugins/DataMixingTrackingParticleWorker.h create mode 100644 SimGeneral/PreMixingModule/plugins/PreMixingTrackingParticleWorker.cc diff --git a/SimGeneral/DataMixingModule/plugins/DataMixingModule.cc b/SimGeneral/DataMixingModule/plugins/DataMixingModule.cc index b57c712b29514..53a4b74d18c36 100644 --- a/SimGeneral/DataMixingModule/plugins/DataMixingModule.cc +++ b/SimGeneral/DataMixingModule/plugins/DataMixingModule.cc @@ -227,21 +227,6 @@ namespace edm PUWorker_ = new DataMixingPileupCopy(ps, consumesCollector()); } - - // Validation - - produces< std::vector >(ps.getParameter("TrackingParticleCollectionDM")); - produces< std::vector >(ps.getParameter("TrackingParticleCollectionDM")); - - produces< edm::DetSetVector >(ps.getParameter("StripDigiSimLinkCollectionDM")); - produces< edm::DetSetVector >(ps.getParameter("PixelDigiSimLinkCollectionDM")); - produces< MuonDigiCollection >(ps.getParameter("DTDigiSimLinkDM")); - produces< edm::DetSetVector >(ps.getParameter("RPCDigiSimLinkDM")); - produces< edm::DetSetVector >(ps.getParameter("CSCStripDigiSimLinkDM")); - produces< edm::DetSetVector >(ps.getParameter("CSCWireDigiSimLinkDM")); - - TrackingParticleWorker_ = new DataMixingTrackingParticleWorker(ps, consumesCollector()); - } void DataMixingModule::getSubdetectorNames() { @@ -291,9 +276,6 @@ namespace edm if( addMCDigiNoise_ && MergeHcalDigisProd_) { HcalDigiWorkerProd_->initializeEvent( e, ES ); } - - TrackingParticleWorker_->initializeEvent( e, ES ); - } @@ -332,8 +314,6 @@ namespace edm delete GeneralTrackWorker_; } if(MergePileup_) { delete PUWorker_;} - - delete TrackingParticleWorker_; } void DataMixingModule::addSignals(const edm::Event &e, const edm::EventSetup& ES) { @@ -373,9 +353,6 @@ namespace edm GeneralTrackWorker_->accumulate(e,ES); } AddedPileup_ = false; - - TrackingParticleWorker_->addTrackingParticleSignals(e); - } // end of addSignals @@ -438,9 +415,6 @@ namespace edm PileUpEventPrincipal pep(ep,&moduleCallingContext,bcr); GeneralTrackWorker_->accumulate(pep, ES,ep.streamID()); } - - TrackingParticleWorker_->addTrackingParticlePileups(bcr, &ep, eventNr, &moduleCallingContext); - } @@ -538,9 +512,6 @@ namespace edm }else{ GeneralTrackWorker_->finalizeEvent(e,ES); } - - TrackingParticleWorker_->putTrackingParticle(e); - } void DataMixingModule::beginLuminosityBlock(LuminosityBlock const& l1, EventSetup const& c) { diff --git a/SimGeneral/DataMixingModule/plugins/DataMixingModule.h b/SimGeneral/DataMixingModule/plugins/DataMixingModule.h index 7eccfb6e56ab4..356bfe2cf40f6 100644 --- a/SimGeneral/DataMixingModule/plugins/DataMixingModule.h +++ b/SimGeneral/DataMixingModule/plugins/DataMixingModule.h @@ -32,7 +32,6 @@ #include "SimGeneral/DataMixingModule/plugins/DataMixingSiStripWorker.h" #include "SimGeneral/DataMixingModule/plugins/DataMixingSiStripRawWorker.h" #include "SimGeneral/DataMixingModule/plugins/DataMixingSiPixelWorker.h" -#include "SimGeneral/DataMixingModule/plugins/DataMixingTrackingParticleWorker.h" #include "SimGeneral/DataMixingModule/plugins/DataMixingPileupCopy.h" #include @@ -178,10 +177,6 @@ namespace edm { DigiAccumulatorMixMod * GeneralTrackWorker_; - // Validation - - DataMixingTrackingParticleWorker * TrackingParticleWorker_ ; - virtual void getSubdetectorNames(); // internally used information : subdetectors present in input diff --git a/SimGeneral/DataMixingModule/plugins/DataMixingTrackingParticleWorker.cc b/SimGeneral/DataMixingModule/plugins/DataMixingTrackingParticleWorker.cc deleted file mode 100644 index d6aa01d54d54c..0000000000000 --- a/SimGeneral/DataMixingModule/plugins/DataMixingTrackingParticleWorker.cc +++ /dev/null @@ -1,401 +0,0 @@ -// File: DataMixingTrackingParticleWorker.cc -// Description: see DataMixingTrackingParticleWorker.h -// Author: Mike Hildreth, University of Notre Dame -// -//-------------------------------------------- - -#include -#include -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Utilities/interface/EDMException.h" -#include "FWCore/Framework/interface/ConstProductRegistry.h" -#include "FWCore/ServiceRegistry/interface/Service.h" - -#include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/Provenance/interface/Provenance.h" -#include "DataFormats/Provenance/interface/BranchDescription.h" -// -// -#include "DataMixingTrackingParticleWorker.h" - -using namespace std; - -namespace { - template - void appendDetSetVector(edm::DetSetVector& target, const edm::DetSetVector& source) { - for(auto& detsetSource: source) { - auto& detsetTarget = target.find_or_insert(detsetSource.detId()); - std::copy(detsetSource.begin(), detsetSource.end(), std::back_inserter(detsetTarget)); - } - } -} - -namespace edm -{ - - // Virtual constructor - - DataMixingTrackingParticleWorker::DataMixingTrackingParticleWorker() { } - - // Constructor - DataMixingTrackingParticleWorker::DataMixingTrackingParticleWorker(const edm::ParameterSet& ps, edm::ConsumesCollector && iC) - { - - // get the subdetector names - // this->getSubdetectorNames(); //something like this may be useful to check what we are supposed to do... - - // declare the products to produce - - TrackingParticleLabelSig_ = ps.getParameter("TrackingParticleLabelSig"); - - TrackingParticlePileInputTag_ = ps.getParameter("TrackingParticlePileInputTag"); - - TrackingParticleCollectionDM_ = ps.getParameter("TrackingParticleCollectionDM"); - - TrackSigToken_ = iC.consumes >(TrackingParticleLabelSig_); - TrackPileToken_ = iC.consumes >(TrackingParticlePileInputTag_); - - VtxSigToken_ = iC.consumes >(TrackingParticleLabelSig_); - VtxPileToken_ = iC.consumes >(TrackingParticlePileInputTag_); - - // Pixel and Strip DigiSimlinks - - StripLinkPileInputTag_ = ps.getParameter("StripDigiSimLinkPileInputTag"); - PixelLinkPileInputTag_ = ps.getParameter("PixelDigiSimLinkPileInputTag"); - StripLinkCollectionDM_ = ps.getParameter("StripDigiSimLinkCollectionDM"); - PixelLinkCollectionDM_ = ps.getParameter("PixelDigiSimLinkCollectionDM"); - - StripLinkSigToken_ = iC.consumes >(ps.getParameter("StripDigiSimLinkLabelSig")); - StripLinkPileToken_ = iC.consumes >(StripLinkPileInputTag_); - PixelLinkSigToken_ = iC.consumes >(ps.getParameter("PixelDigiSimLinkLabelSig")); - PixelLinkPileToken_ = iC.consumes >(PixelLinkPileInputTag_); - - // Muon DigiSimLinks - - DTLinkPileInputTag_ = ps.getParameter("DTDigiSimLinkPileInputTag"); - RPCLinkPileInputTag_ = ps.getParameter("RPCDigiSimLinkPileInputTag"); - CSCWireLinkPileInputTag_ = ps.getParameter("CSCWireDigiSimLinkPileInputTag"); - CSCStripLinkPileInputTag_ = ps.getParameter("CSCStripDigiSimLinkPileInputTag"); - - DTLinkCollectionDM_ = ps.getParameter("DTDigiSimLinkDM"); - RPCLinkCollectionDM_ = ps.getParameter("RPCDigiSimLinkDM"); - CSCWireLinkCollectionDM_ = ps.getParameter("CSCWireDigiSimLinkDM"); - CSCStripLinkCollectionDM_ = ps.getParameter("CSCStripDigiSimLinkDM"); - - CSCWireLinkSigToken_ = iC.consumes >(ps.getParameter("CSCWireDigiSimLinkLabelSig")); - CSCWireLinkPileToken_ = iC.consumes >(CSCWireLinkPileInputTag_); - CSCStripLinkSigToken_ = iC.consumes >(ps.getParameter("CSCStripDigiSimLinkLabelSig")); - CSCStripLinkPileToken_ = iC.consumes >(CSCStripLinkPileInputTag_); - DTLinkSigToken_ = iC.consumes< MuonDigiCollection >(ps.getParameter("DTDigiSimLinkLabelSig")); - DTLinkPileToken_ = iC.consumes< MuonDigiCollection >(DTLinkPileInputTag_); - RPCLinkSigToken_ = iC.consumes >(ps.getParameter("RPCDigiSimLinkLabelSig")); - RPCLinkPileToken_ = iC.consumes >(RPCLinkPileInputTag_); - - } - - - // Virtual destructor needed. - DataMixingTrackingParticleWorker::~DataMixingTrackingParticleWorker() { - } - - // Need an event initialization - - void DataMixingTrackingParticleWorker::initializeEvent(edm::Event const& e, edm::EventSetup const& iSetup) { - - // Create new track/vertex lists, getting references, too, so that we can cross-link everything - - NewTrackList_ = std::unique_ptr>(new std::vector()); - //NewVertexList_ = std::unique_ptr>(new std::vector()); - TempVertexList_ = std::vector(); - - TrackListRef_ =const_cast( e ).getRefBeforePut< std::vector >(TrackingParticleCollectionDM_); - VertexListRef_ =const_cast( e ).getRefBeforePut< std::vector >(TrackingParticleCollectionDM_); - - // tracker - - NewStripLinkList_ = std::make_unique >(); - NewPixelLinkList_ = std::make_unique >(); - - // muons - - NewCSCStripLinkList_ = std::make_unique >(); - NewCSCWireLinkList_ = std::make_unique >(); - NewRPCLinkList_ = std::make_unique >(); - NewDTLinkList_ = std::make_unique< MuonDigiCollection >(); - - } - - - void DataMixingTrackingParticleWorker::addTrackingParticleSignals(const edm::Event &e) { - - // grab Vertices, store copy, preserving indices. Easier to loop over vertices first - fewer links - - edm::Handle> vtxs; - e.getByToken(VtxSigToken_, vtxs); - - const size_t StartingIndexV = TempVertexList_.size(); // should be zero here, but keep for consistency - const size_t StartingIndexT = NewTrackList_->size(); // should be zero here, but keep for consistency - - if (vtxs.isValid()) { - - for (std::vector::const_iterator vtx = vtxs->begin(); vtx != vtxs->end(); ++vtx) { - TempVertexList_.push_back(*vtx); - } - } - - // grab tracks, store copy - - edm::Handle> tracks; - e.getByToken(TrackSigToken_, tracks); - - if (tracks.isValid()) { - for (std::vector::const_iterator track = tracks->begin(); track != tracks->end(); ++track) { - auto oldRef=track->parentVertex(); - auto newRef=TrackingVertexRef( VertexListRef_, oldRef.index()+StartingIndexV ); - NewTrackList_->push_back(*track); - - auto & Ntrack = NewTrackList_->back(); //modify copy - - Ntrack.setParentVertex( newRef ); - Ntrack.clearDecayVertices(); - - // next, loop over daughter vertices, same strategy - - for( auto const& vertexRef : track->decayVertices() ) { - auto newRef=TrackingVertexRef( VertexListRef_, vertexRef.index()+StartingIndexV ); - Ntrack.addDecayVertex(newRef); - } - } - } - - // Now that tracks are handled, go back and put correct Refs in vertices - std::vector sourceTrackIndices; - std::vector daughterTrackIndices; - for (auto & vertex : TempVertexList_ ) { - - // Need to copy the indices before clearing the vectors - sourceTrackIndices.reserve(vertex.sourceTracks().size()); - daughterTrackIndices.reserve(vertex.daughterTracks().size()); - for(auto const& ref: vertex.sourceTracks()) sourceTrackIndices.push_back(ref.index()); - for(auto const& ref: vertex.daughterTracks()) daughterTrackIndices.push_back(ref.index()); - - vertex.clearParentTracks(); - vertex.clearDaughterTracks(); - - for( auto index : sourceTrackIndices ) { - auto newRef=TrackingParticleRef( TrackListRef_, index+StartingIndexT ); - vertex.addParentTrack(newRef); - } - - // next, loop over daughter tracks, same strategy - for( auto index : daughterTrackIndices ) { - auto newRef=TrackingParticleRef( TrackListRef_, index+StartingIndexT ); - vertex.addDaughterTrack(newRef); - } - - sourceTrackIndices.clear(); - daughterTrackIndices.clear(); - } - - // Accumulate DigiSimLinks - edm::Handle > stripLinks; - e.getByToken(StripLinkSigToken_, stripLinks); - if(stripLinks.isValid()) { - appendDetSetVector(*NewStripLinkList_, *stripLinks); - } - - edm::Handle > pixelLinks; - e.getByToken(PixelLinkSigToken_, pixelLinks); - if(pixelLinks.isValid()) { - appendDetSetVector(*NewPixelLinkList_, *pixelLinks); - } - - edm::Handle > CSCstripLinks; - e.getByToken(CSCStripLinkSigToken_, CSCstripLinks); - if(CSCstripLinks.isValid()) { - appendDetSetVector(*NewCSCStripLinkList_, *CSCstripLinks); - } - - edm::Handle > CSCwireLinks; - e.getByToken(CSCWireLinkSigToken_, CSCwireLinks); - if(CSCwireLinks.isValid()) { - appendDetSetVector(*NewCSCWireLinkList_, *CSCwireLinks); - } - - edm::Handle > RPCLinks; - e.getByToken(RPCLinkSigToken_, RPCLinks); - if(RPCLinks.isValid()) { - appendDetSetVector(*NewRPCLinkList_, *RPCLinks); - } - - edm::Handle< DTDigiSimLinkCollection > DTLinks; - e.getByToken(DTLinkSigToken_, DTLinks); - if(DTLinks.isValid()) { - for (DTDigiSimLinkCollection::DigiRangeIterator detUnit=DTLinks->begin(); detUnit !=DTLinks->end(); ++detUnit) { - const DTLayerId& layerid = (*detUnit).first; - const DTDigiSimLinkCollection::Range& range = (*detUnit).second; - NewDTLinkList_->put(range,layerid); - } - } - - } // end of addTrackingParticleSignals - - - - void DataMixingTrackingParticleWorker::addTrackingParticlePileups(const int bcr, const EventPrincipal *ep, unsigned int eventNr, - ModuleCallingContext const* mcc) { - - LogDebug("DataMixingTrackingParticleWorker") <<"\n===============> adding pileups from event "<id()<<" for bunchcrossing "<size(); // keep track of offsets - - std::shared_ptr > const> inputVPTR = - getProductByTag >(*ep, TrackingParticlePileInputTag_, mcc); - - if(inputVPTR ) { - - const std::vector *vtxs = const_cast< std::vector * >(inputVPTR->product()); - - // grab vertices, store copy - - for (std::vector::const_iterator vtx = vtxs->begin(); vtx != vtxs->end(); ++vtx) { - TempVertexList_.push_back(*vtx); - } - } - - - std::shared_ptr > const> inputPTR = - getProductByTag >(*ep, TrackingParticlePileInputTag_, mcc); - - if(inputPTR ) { - - const std::vector *tracks = const_cast< std::vector * >(inputPTR->product()); - - // grab tracks, store copy - for (std::vector::const_iterator track = tracks->begin(); track != tracks->end(); ++track) { - auto oldRef=track->parentVertex(); - auto newRef=TrackingVertexRef( VertexListRef_, oldRef.index()+StartingIndexV ); - NewTrackList_->push_back(*track); - - auto & Ntrack = NewTrackList_->back(); //modify copy - - Ntrack.setParentVertex( newRef ); - Ntrack.clearDecayVertices(); - - // next, loop over daughter vertices, same strategy - - for( auto const& vertexRef : track->decayVertices() ) { - auto newRef=TrackingVertexRef( VertexListRef_, vertexRef.index()+StartingIndexV ); - Ntrack.addDecayVertex(newRef); - } - } - } - - // Now that tracks are handled, go back and put correct Refs in vertices - // Operate only on the added pileup vertices, and leave the already-existing vertices untouched - std::vector sourceTrackIndices; - std::vector daughterTrackIndices; - for(size_t iVertex = StartingIndexV; iVertex != TempVertexList_.size(); ++iVertex) { - auto& vertex = TempVertexList_[iVertex]; - - // Need to copy the indices before clearing the vectors - sourceTrackIndices.reserve(vertex.sourceTracks().size()); - daughterTrackIndices.reserve(vertex.daughterTracks().size()); - for(auto const& ref: vertex.sourceTracks()) sourceTrackIndices.push_back(ref.index()); - for(auto const& ref: vertex.daughterTracks()) daughterTrackIndices.push_back(ref.index()); - - vertex.clearParentTracks(); - vertex.clearDaughterTracks(); - - for( auto index : sourceTrackIndices ) { - auto newRef=TrackingParticleRef( TrackListRef_, index+StartingIndexT ); - vertex.addParentTrack(newRef); - } - - // next, loop over daughter tracks, same strategy - for( auto index : daughterTrackIndices ) { - auto newRef=TrackingParticleRef( TrackListRef_, index+StartingIndexT ); - vertex.addDaughterTrack(newRef); - } - - sourceTrackIndices.clear(); - daughterTrackIndices.clear(); - } - - - // Accumulate DigiSimLinks - std::shared_ptr > const> inputStripPtr = - getProductByTag >(*ep, StripLinkPileInputTag_, mcc); - if(inputStripPtr) { - appendDetSetVector(*NewStripLinkList_, *(inputStripPtr->product())); - } - - std::shared_ptr > const> inputPixelPtr = - getProductByTag >(*ep, PixelLinkPileInputTag_, mcc); - if(inputPixelPtr) { - appendDetSetVector(*NewPixelLinkList_, *(inputPixelPtr->product())); - } - - std::shared_ptr > const> CSCinputStripPtr = - getProductByTag >(*ep, CSCStripLinkPileInputTag_, mcc); - if(CSCinputStripPtr) { - appendDetSetVector(*NewCSCStripLinkList_, *(CSCinputStripPtr->product())); - } - - std::shared_ptr > const> CSCinputWirePtr = - getProductByTag >(*ep, CSCWireLinkPileInputTag_, mcc); - if(CSCinputWirePtr) { - appendDetSetVector(*NewCSCWireLinkList_, *(CSCinputWirePtr->product())); - } - - std::shared_ptr > const> inputRPCPtr = - getProductByTag >(*ep, RPCLinkPileInputTag_, mcc); - if(inputRPCPtr) { - appendDetSetVector(*NewRPCLinkList_, *(inputRPCPtr->product())); - } - - std::shared_ptr const> inputDTPtr = - getProductByTag< DTDigiSimLinkCollection >(*ep, DTLinkPileInputTag_, mcc); - if(inputDTPtr) { - const DTDigiSimLinkCollection* DTLinks = const_cast< DTDigiSimLinkCollection * >(inputDTPtr->product()); - for (DTDigiSimLinkCollection::DigiRangeIterator detUnit=DTLinks->begin(); detUnit !=DTLinks->end(); ++detUnit) { - const DTLayerId& layerid = (*detUnit).first; - const DTDigiSimLinkCollection::Range& range = (*detUnit).second; - NewDTLinkList_->put(range,layerid); - } - } - - } // end of addPileups - - - - void DataMixingTrackingParticleWorker::putTrackingParticle(edm::Event &e) { - - // collection of Vertices to put in the event - - NewVertexList_ = std::unique_ptr>(new std::vector(TempVertexList_)); - - // put the collection of digis in the event - LogInfo("DataMixingTrackingParticleWorker") << "total # Merged Tracks: " << NewTrackList_->size() ; - - // put collections - - e.put(std::move(NewTrackList_), TrackingParticleCollectionDM_ ); - e.put(std::move(NewVertexList_), TrackingParticleCollectionDM_ ); - - e.put(std::move(NewStripLinkList_), StripLinkCollectionDM_ ); - e.put(std::move(NewPixelLinkList_), PixelLinkCollectionDM_ ); - - e.put(std::move(NewCSCStripLinkList_), CSCStripLinkCollectionDM_ ); - e.put(std::move(NewCSCWireLinkList_), CSCWireLinkCollectionDM_ ); - e.put(std::move(NewRPCLinkList_), RPCLinkCollectionDM_ ); - e.put(std::move(NewDTLinkList_), DTLinkCollectionDM_ ); - - - // clear local storage for this event - //NewTrackList_.clear(); - TempVertexList_.clear(); - } - -} //edm diff --git a/SimGeneral/DataMixingModule/plugins/DataMixingTrackingParticleWorker.h b/SimGeneral/DataMixingModule/plugins/DataMixingTrackingParticleWorker.h deleted file mode 100644 index 84f0f5a033e98..0000000000000 --- a/SimGeneral/DataMixingModule/plugins/DataMixingTrackingParticleWorker.h +++ /dev/null @@ -1,123 +0,0 @@ -#ifndef SimDataMixingTrackingParticleWorker_h -#define SimDataMixingTrackingParticleWorker_h - -/** \class DataMixingTrackingParticleWorker - * - * DataMixingModule is the EDProducer subclass - * that overlays rawdata events on top of MC, - * using real data for pileup simulation - * This class takes care of the TrackingParticle information - * - * \author Mike Hildreth, University of Notre Dame - * - * \version 1st Version October 2007 - * - ************************************************************/ - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventPrincipal.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/ConsumesCollector.h" - -#include "DataFormats/Provenance/interface/ProductID.h" -#include "DataFormats/Common/interface/Handle.h" -//Data Formats -#include "SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h" -#include "SimDataFormats/TrackingAnalysis/interface/TrackingVertex.h" -#include "SimDataFormats/TrackerDigiSimLink/interface/StripDigiSimLink.h" -#include "SimDataFormats/TrackerDigiSimLink/interface/PixelDigiSimLink.h" -#include "SimDataFormats/DigiSimLinks/interface/DTDigiSimLinkCollection.h" -#include "SimDataFormats/RPCDigiSimLink/interface/RPCDigiSimLink.h" -#include "DataFormats/Common/interface/DetSetVector.h" - - -#include -#include -#include - - - -namespace edm -{ - class ModuleCallingContext; - - class DataMixingTrackingParticleWorker - { - public: - - DataMixingTrackingParticleWorker(); - - /** standard constructor*/ - explicit DataMixingTrackingParticleWorker(const edm::ParameterSet& ps, edm::ConsumesCollector && iC); - - /**Default destructor*/ - virtual ~DataMixingTrackingParticleWorker(); - - virtual void initializeEvent(edm::Event const& e, edm::EventSetup const& c); // override? - - void putTrackingParticle(edm::Event &e) ; - void addTrackingParticleSignals(const edm::Event &e); - void addTrackingParticlePileups(const int bcr, const edm::EventPrincipal*,unsigned int EventId, - ModuleCallingContext const*); - - private: - // data specifiers - - edm::InputTag TrackingParticlecollectionSig_ ; // primary name given to collection of TrackingParticles - edm::InputTag TrackingParticleLabelSig_ ; // secondary name given to collection of TrackingParticles - edm::InputTag TrackingParticlePileInputTag_ ; // InputTag for pileup tracks - std::string TrackingParticleCollectionDM_ ; // secondary name to be given to new TrackingParticle - - edm::InputTag StripLinkPileInputTag_; - edm::InputTag PixelLinkPileInputTag_; - edm::InputTag DTLinkPileInputTag_; - edm::InputTag RPCLinkPileInputTag_; - edm::InputTag CSCWireLinkPileInputTag_; - edm::InputTag CSCStripLinkPileInputTag_; - - std::string StripLinkCollectionDM_; - std::string PixelLinkCollectionDM_; - std::string DTLinkCollectionDM_; - std::string RPCLinkCollectionDM_; - std::string CSCWireLinkCollectionDM_; - std::string CSCStripLinkCollectionDM_; - - edm::EDGetTokenT >TrackSigToken_ ; // Token to retrieve information - edm::EDGetTokenT >TrackPileToken_ ; // Token to retrieve information - edm::EDGetTokenT >VtxSigToken_ ; // Token to retrieve information - edm::EDGetTokenT >VtxPileToken_ ; // Token to retrieve information - - edm::EDGetTokenT > StripLinkSigToken_; - edm::EDGetTokenT > StripLinkPileToken_; - edm::EDGetTokenT > PixelLinkSigToken_; - edm::EDGetTokenT > PixelLinkPileToken_; - edm::EDGetTokenT > CSCWireLinkSigToken_; - edm::EDGetTokenT > CSCWireLinkPileToken_; - edm::EDGetTokenT > CSCStripLinkSigToken_; - edm::EDGetTokenT > CSCStripLinkPileToken_; - edm::EDGetTokenT< MuonDigiCollection > DTLinkSigToken_; - edm::EDGetTokenT< MuonDigiCollection > DTLinkPileToken_; - edm::EDGetTokenT > RPCLinkSigToken_; - edm::EDGetTokenT > RPCLinkPileToken_; - - // - - std::unique_ptr> NewTrackList_; - std::unique_ptr> NewVertexList_; - std::vector TempVertexList_; - - std::unique_ptr > NewStripLinkList_; - std::unique_ptr > NewPixelLinkList_; - std::unique_ptr< MuonDigiCollection > NewDTLinkList_; - std::unique_ptr< edm::DetSetVector > NewRPCLinkList_; - std::unique_ptr< edm::DetSetVector > NewCSCWireLinkList_; - std::unique_ptr< edm::DetSetVector > NewCSCStripLinkList_; - - TrackingParticleRefProd TrackListRef_ ; - TrackingVertexRefProd VertexListRef_ ; - - - }; -}//edm - -#endif // SimDataMixingTrackingParticleWorker_h diff --git a/SimGeneral/PreMixingModule/plugins/PreMixingTrackingParticleWorker.cc b/SimGeneral/PreMixingModule/plugins/PreMixingTrackingParticleWorker.cc new file mode 100644 index 0000000000000..033d25039c01b --- /dev/null +++ b/SimGeneral/PreMixingModule/plugins/PreMixingTrackingParticleWorker.cc @@ -0,0 +1,156 @@ +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventPrincipal.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/ProducerBase.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include "DataFormats/Common/interface/Handle.h" +#include "SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h" +#include "SimDataFormats/TrackingAnalysis/interface/TrackingVertex.h" + +#include "PreMixingWorker.h" + +namespace edm { + class PreMixingTrackingParticleWorker: public PreMixingWorker { + public: + PreMixingTrackingParticleWorker(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector && iC); + ~PreMixingTrackingParticleWorker() override = default; + + void initializeEvent(edm::Event const& iEvent, edm::EventSetup const& iSetup) override; + void addSignals(edm::Event const& iEvent, edm::EventSetup const& iSetup) override; + void addPileups(int bcr, edm::EventPrincipal const& ep, int eventNr, edm::EventSetup const& iSetup, edm::ModuleCallingContext const *mcc) override; + void put(edm::Event& iEvent, edm::EventSetup const& iSetup, std::vector const& ps, int bunchSpacing) override; + + private: + void add(const std::vector& particles, const std::vector& vertices); + + edm::EDGetTokenT > TrackSigToken_; // Token to retrieve information + edm::EDGetTokenT > VtxSigToken_; // Token to retrieve information + + edm::InputTag TrackingParticlePileInputTag_ ; // InputTag for pileup tracks + + std::string TrackingParticleCollectionDM_; // secondary name to be given to new TrackingParticle + + + std::unique_ptr> NewTrackList_; + std::unique_ptr> NewVertexList_; + TrackingParticleRefProd TrackListRef_; + TrackingVertexRefProd VertexListRef_; + }; + + PreMixingTrackingParticleWorker::PreMixingTrackingParticleWorker(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector && iC): + TrackSigToken_(iC.consumes >(ps.getParameter("labelSig"))), + VtxSigToken_ (iC.consumes >(ps.getParameter("labelSig"))), + TrackingParticlePileInputTag_(ps.getParameter("pileInputTag")), + TrackingParticleCollectionDM_(ps.getParameter("collectionDM")) + { + producer.produces< std::vector >(TrackingParticleCollectionDM_); + producer.produces< std::vector >(TrackingParticleCollectionDM_); + } + + + void PreMixingTrackingParticleWorker::initializeEvent(edm::Event const& iEvent, edm::EventSetup const& iSetup) { + NewTrackList_ = std::make_unique>(); + NewVertexList_ = std::make_unique>(); + + // need RefProds in order to re-key the particle<->vertex refs + // TODO: try to remove const_cast, requires making Event non-const in BMixingModule::initializeEvent + TrackListRef_ = const_cast(iEvent).getRefBeforePut< std::vector >(TrackingParticleCollectionDM_); + VertexListRef_ = const_cast(iEvent).getRefBeforePut< std::vector >(TrackingParticleCollectionDM_); + } + + void PreMixingTrackingParticleWorker::addSignals(edm::Event const& iEvent, edm::EventSetup const& iSetup) { + edm::Handle> tracks; + iEvent.getByToken(TrackSigToken_, tracks); + + edm::Handle> vtxs; + iEvent.getByToken(VtxSigToken_, vtxs); + + if(tracks.isValid() && vtxs.isValid()) { + add(*tracks, *vtxs); + } + } + + void PreMixingTrackingParticleWorker::addPileups(int bcr, edm::EventPrincipal const& ep, int eventNr, edm::EventSetup const& iSetup, edm::ModuleCallingContext const *mcc) { + LogDebug("PreMixingTrackingParticleWorker") <<"\n===============> adding pileups from event "< > const> inputPTR = + getProductByTag >(ep, TrackingParticlePileInputTag_, mcc); + + std::shared_ptr > const> inputVPTR = + getProductByTag >(ep, TrackingParticlePileInputTag_, mcc); + + if(inputPTR && inputVPTR) { + add(*(inputPTR->product()), *(inputVPTR->product())); + } + } + + void PreMixingTrackingParticleWorker::add(const std::vector& particles, const std::vector& vertices) { + const size_t StartingIndexV = NewVertexList_->size(); + const size_t StartingIndexT = NewTrackList_->size(); + + // grab Vertices, store copy, preserving indices. Easier to loop over vertices first - fewer links + for(const auto& vtx: vertices) { + NewVertexList_->push_back(vtx); + } + + // grab tracks, store copy + for(const auto& track: particles) { + auto oldRef=track.parentVertex(); + auto newRef=TrackingVertexRef( VertexListRef_, oldRef.index()+StartingIndexV ); + NewTrackList_->push_back(track); + + auto & Ntrack = NewTrackList_->back(); //modify copy + + Ntrack.setParentVertex( newRef ); + Ntrack.clearDecayVertices(); + + // next, loop over daughter vertices, same strategy + for( auto const& vertexRef : track.decayVertices() ) { + auto newRef=TrackingVertexRef( VertexListRef_, vertexRef.index()+StartingIndexV ); + Ntrack.addDecayVertex(newRef); + } + } + + // Now that tracks are handled, go back and put correct Refs in vertices + // Operate only on the added pileup vertices, and leave the already-existing vertices untouched + std::vector sourceTrackIndices; + std::vector daughterTrackIndices; + for(size_t iVertex = StartingIndexV; iVertex != NewVertexList_->size(); ++iVertex) { + auto& vertex = (*NewVertexList_)[iVertex]; + + // Need to copy the indices before clearing the vectors + sourceTrackIndices.reserve(vertex.sourceTracks().size()); + daughterTrackIndices.reserve(vertex.daughterTracks().size()); + for(auto const& ref: vertex.sourceTracks()) sourceTrackIndices.push_back(ref.index()); + for(auto const& ref: vertex.daughterTracks()) daughterTrackIndices.push_back(ref.index()); + + vertex.clearParentTracks(); + vertex.clearDaughterTracks(); + + for( auto index : sourceTrackIndices ) { + auto newRef=TrackingParticleRef( TrackListRef_, index+StartingIndexT ); + vertex.addParentTrack(newRef); + } + + // next, loop over daughter tracks, same strategy + for( auto index : daughterTrackIndices ) { + auto newRef=TrackingParticleRef( TrackListRef_, index+StartingIndexT ); + vertex.addDaughterTrack(newRef); + } + + sourceTrackIndices.clear(); + daughterTrackIndices.clear(); + } + } + + void PreMixingTrackingParticleWorker::put(edm::Event& iEvent, edm::EventSetup const& iSetup, std::vector const& ps, int bunchSpacing) { + LogInfo("PreMixingTrackingParticleWorker") << "total # Merged Tracks: " << NewTrackList_->size() ; + iEvent.put(std::move(NewTrackList_), TrackingParticleCollectionDM_); + iEvent.put(std::move(NewVertexList_), TrackingParticleCollectionDM_); + } +} + +#include "PreMixingWorkerFactory.h" +DEFINE_EDM_PLUGIN(PreMixingWorkerFactory, edm::PreMixingTrackingParticleWorker, "PreMixingTrackingParticleWorker"); From 3bc043bd0d70a5da75d3a43d8269d62e78ef1848 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Mon, 26 Feb 2018 11:15:17 +0100 Subject: [PATCH 032/426] Add PreMixingDigiAccumulatorWorker as generic wrapper for DigiAccumulatorMixMod-derived classes Needed for FastSim RecoTrackAccumulator (ok, I could have specialized for only that but a generic wrapper is not much different and could be useful for some other cases as well). --- .../plugins/PreMixingDigiAccumulatorWorker.cc | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 SimGeneral/PreMixingModule/plugins/PreMixingDigiAccumulatorWorker.cc diff --git a/SimGeneral/PreMixingModule/plugins/PreMixingDigiAccumulatorWorker.cc b/SimGeneral/PreMixingModule/plugins/PreMixingDigiAccumulatorWorker.cc new file mode 100644 index 0000000000000..1991a33db7e63 --- /dev/null +++ b/SimGeneral/PreMixingModule/plugins/PreMixingDigiAccumulatorWorker.cc @@ -0,0 +1,50 @@ +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventPrincipal.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/ProducerBase.h" + +#include "SimGeneral/MixingModule/interface/DigiAccumulatorMixMod.h" +#include "SimGeneral/MixingModule/interface/DigiAccumulatorMixModFactory.h" +#include "SimGeneral/MixingModule/interface/PileUpEventPrincipal.h" + +#include "PreMixingWorker.h" + +namespace edm { + class PreMixingDigiAccumulatorWorker: public PreMixingWorker { + public: + PreMixingDigiAccumulatorWorker(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector&& iC): + accumulator_(DigiAccumulatorMixModFactory::get()->makeDigiAccumulator(ps.getParameter("accumulator"), producer, iC)) + {} + ~PreMixingDigiAccumulatorWorker() override = default; + + void initializeEvent(const edm::Event &e, const edm::EventSetup& ES) override { + accumulator_->initializeEvent(e, ES); + } + + void initializeBunchCrossing(edm::Event const& e, edm::EventSetup const& ES, int bunchCrossing) override { + accumulator_->initializeBunchCrossing(e, ES, bunchCrossing); + } + void finalizeBunchCrossing(edm::Event& e, edm::EventSetup const& ES, int bunchCrossing) override { + accumulator_->finalizeBunchCrossing(e, ES, bunchCrossing); + } + + void addSignals(const edm::Event &e, const edm::EventSetup& ES) override { + accumulator_->accumulate(e, ES); + } + void addPileups(int bcr, const edm::EventPrincipal& ep, int EventId, + const edm::EventSetup& ES, edm::ModuleCallingContext const *mcc) override { + PileUpEventPrincipal pep(ep, mcc, bcr); + accumulator_->accumulate(pep, ES, ep.streamID()); + } + void put(edm::Event &e,const edm::EventSetup& ES, std::vector const& ps, int bs) override { + accumulator_->finalizeEvent(e, ES); + } + + private: + std::unique_ptr accumulator_; + }; +} + +#include "PreMixingWorkerFactory.h" +DEFINE_EDM_PLUGIN(PreMixingWorkerFactory, edm::PreMixingDigiAccumulatorWorker, "PreMixingDigiAccumulatorWorker"); From 35e60559c6607177990f20ef48fdbe0272958ca2 Mon Sep 17 00:00:00 2001 From: Vincenzo Innocente Date: Thu, 1 Mar 2018 23:16:07 +0100 Subject: [PATCH 033/426] Add `const` accessors to conditions data Backport code changes from GPU-related developments. --- .../interface/SiPixelGainCalibrationServiceBase.h | 2 ++ .../SiPixelObjects/interface/SiPixelGainCalibrationForHLT.h | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CalibTracker/SiPixelESProducers/interface/SiPixelGainCalibrationServiceBase.h b/CalibTracker/SiPixelESProducers/interface/SiPixelGainCalibrationServiceBase.h index 09ae4d2ee3ed0..bcd45dc5e7fbf 100644 --- a/CalibTracker/SiPixelESProducers/interface/SiPixelGainCalibrationServiceBase.h +++ b/CalibTracker/SiPixelESProducers/interface/SiPixelGainCalibrationServiceBase.h @@ -73,6 +73,8 @@ class SiPixelGainCalibrationServicePayloadGetter : public SiPixelGainCalibration void setESObjects(const edm::EventSetup& es ) override; + thePayloadObject const & payload() const { return *ped; } + std::vector getDetIds() override; double getGainLow() override; double getGainHigh() override; diff --git a/CondFormats/SiPixelObjects/interface/SiPixelGainCalibrationForHLT.h b/CondFormats/SiPixelObjects/interface/SiPixelGainCalibrationForHLT.h index c1c9c427eb7f9..8501285fc9748 100644 --- a/CondFormats/SiPixelObjects/interface/SiPixelGainCalibrationForHLT.h +++ b/CondFormats/SiPixelObjects/interface/SiPixelGainCalibrationForHLT.h @@ -73,6 +73,9 @@ class SiPixelGainCalibrationForHLT { float getPedLow() const { return minPed_; } float getPedHigh() const { return maxPed_; } + std::vector const & data() const { return v_pedestals;} + std::vector const & getIndexes() const { return indexes; } + // Set and get public methods void setData(float ped, float gain, std::vector& vped, bool thisColumnIsDead = false, bool thisColumnIsNoisy = false); void setDeadColumn(const int& nRows, std::vector& vped) { setData(0, 0 /*dummy values, not used*/, vped, true, false); } @@ -84,7 +87,7 @@ class SiPixelGainCalibrationForHLT { float getPed (const int& col, const int& row, const Range& range, const int& nCols, bool& isDeadColumn, bool& isNoisyColumn ) const; float getGain (const int& col, const int& row, const Range& range, const int& nCols, bool& isDeadColumn, bool& isNoisyColumn ) const; - private: +private: float encodeGain(const float& gain); float encodePed (const float& ped); From 43690875e371cbd3c85e5d5c56b5f477d4c84f3a Mon Sep 17 00:00:00 2001 From: Vincenzo Innocente Date: Thu, 1 Mar 2018 23:28:16 +0100 Subject: [PATCH 034/426] Add `SOARotation` class and tests Backport code changes from GPU-related developments. --- .../GeometrySurface/interface/SOARotation.h | 158 ++++++++++++++++++ .../GeometrySurface/test/BuildFile.xml | 20 +-- .../test/FrameTransformTest.cpp | 120 ++++++------- 3 files changed, 229 insertions(+), 69 deletions(-) create mode 100644 DataFormats/GeometrySurface/interface/SOARotation.h diff --git a/DataFormats/GeometrySurface/interface/SOARotation.h b/DataFormats/GeometrySurface/interface/SOARotation.h new file mode 100644 index 0000000000000..9978973aa5d3d --- /dev/null +++ b/DataFormats/GeometrySurface/interface/SOARotation.h @@ -0,0 +1,158 @@ +#pragma once +#ifndef DataFormats_GeometrySurface_SOARotation_h +#define DataFormats_GeometrySurface_SOARotation_h + +template class TkRotation; + +// to be moved in an external common library??? + +/** Rotation matrix used by SOA (as in GPU) + */ + +template +class SOARotation { +public: + + constexpr inline + SOARotation(){} + + constexpr inline + explicit SOARotation(T) : + R11(1), R12(0), R13(0), + R21(0), R22(1), R23(0), + R31(0), R32(0), R33(1) {} + + constexpr inline + SOARotation(T xx, T xy, T xz, T yx, T yy, T yz, T zx, T zy, T zz) : + R11(xx), R12(xy), R13(xz), + R21(yx), R22(yy), R23(yz), + R31(zx), R32(zy), R33(zz) {} + + constexpr inline + SOARotation(const T* p) : + R11(p[0]), R12(p[1]), R13(p[2]), + R21(p[3]), R22(p[4]), R23(p[5]), + R31(p[6]), R32(p[7]), R33(p[8]) {} + + + template + constexpr inline + SOARotation(const TkRotation& a) : + R11(a.xx()), R12(a.xy()), R13(a.xz()), + R21(a.yx()), R22(a.yy()), R23(a.yz()), + R31(a.zx()), R32(a.zy()), R33(a.zz()) {} + + constexpr inline + SOARotation transposed() const { + return SOARotation(R11, R21, R31, + R12, R22, R32, + R13, R23, R33); + } + + // if frame this is to local + constexpr inline + void multiply(T const vx, T const vy, T const vz, + T & ux, T & uy, T & uz) const { + ux = R11*vx + R12*vy + R13*vz; + uy = R21*vx + R22*vy + R23*vz; + uz = R31*vx + R32*vy + R33*vz; + } + + // if frame this is to global + constexpr inline + void multiplyInverse (T const vx, T const vy, T const vz, + T & ux, T & uy, T & uz) const { + ux = R11*vx + R21*vy + R31*vz; + uy = R12*vx + R22*vy + R32*vz; + uz = R13*vx + R23*vy + R33*vz; + } + + + // if frame this is to global + constexpr inline + void multiplyInverse (T const vx, T const vy, + T & ux, T & uy, T & uz) const { + ux = R11*vx + R21*vy; + uy = R12*vx + R22*vy; + uz = R13*vx + R23*vy; + } + + + constexpr inline + T const &xx() const { return R11; } + constexpr inline + T const &xy() const { return R12; } + constexpr inline + T const &xz() const { return R13; } + constexpr inline + T const &yx() const { return R21; } + constexpr inline + T const &yy() const { return R22; } + constexpr inline + T const &yz() const { return R23; } + constexpr inline + T const &zx() const { return R31; } + constexpr inline + T const &zy() const { return R32; } + constexpr inline + T const &zz() const { return R33; } + +private: + + T R11, R12, R13; + T R21, R22, R23; + T R31, R32, R33; +}; + + +template +class SOAFrame { +public: + + constexpr inline + SOAFrame(){} + + constexpr inline + SOAFrame(T ix, T iy, T iz, SOARotation const & irot) : + px(ix), py(iy), pz(iz), rot(irot){} + + constexpr inline + SOARotation const & rotation() const { return rot; } + + constexpr inline + void toLocal(T const vx, T const vy, T const vz, + T & ux, T & uy, T & uz) const { + rot.multiply(vx-px, vy-py, vz-pz, ux, uy, uz); + } + + + constexpr inline + void toGlobal(T const vx, T const vy, T const vz, + T & ux, T & uy, T & uz) const { + rot.multiplyInverse(vx, vy, vz, ux, uy, uz); + ux+=px; uy+=py; uz+=pz; + } + + constexpr inline + void toGlobal(T const vx, T const vy, + T & ux, T & uy, T & uz) const { + rot.multiplyInverse(vx, vy, ux, uy, uz); + ux+=px; uy+=py; uz+=pz; + } + + + constexpr inline + T x() const { return px; } + constexpr inline + T y() const { return py; } + constexpr inline + T z() const { return pz; } + +private: + + T px, py, pz; + SOARotation rot; + +}; + +#endif // DataFormats_GeometrySurface_SOARotation_h diff --git a/DataFormats/GeometrySurface/test/BuildFile.xml b/DataFormats/GeometrySurface/test/BuildFile.xml index c02a36305923e..ed732f292ebf1 100644 --- a/DataFormats/GeometrySurface/test/BuildFile.xml +++ b/DataFormats/GeometrySurface/test/BuildFile.xml @@ -1,16 +1,16 @@ - - - - + + + + + - + - - + - + - + - + diff --git a/DataFormats/GeometrySurface/test/FrameTransformTest.cpp b/DataFormats/GeometrySurface/test/FrameTransformTest.cpp index d95ffdd4a2897..690336af16429 100644 --- a/DataFormats/GeometrySurface/test/FrameTransformTest.cpp +++ b/DataFormats/GeometrySurface/test/FrameTransformTest.cpp @@ -1,56 +1,52 @@ +#include #include + +#include "DataFormats/GeometrySurface/interface/SOARotation.h" #include "DataFormats/GeometrySurface/interface/TkRotation.h" #include "DataFormats/GeometrySurface/interface/GloballyPositioned.h" #include "DataFormats/GeometrySurface/interface/BoundPlane.h" -//#include "CommonReco/RKPropagators/interface/FrameChanger.h" #include "DataFormats/GeometrySurface/interface/Cylinder.h" -#include - using namespace std; + template -void go() { +void go() { typedef TkRotation Rotation; + typedef SOARotation SRotation; typedef GloballyPositioned Frame; - typedef typename Frame::PositionType Position; - typedef typename Frame::GlobalVector GlobalVector; - typedef typename Frame::GlobalPoint GlobalPoint; - typedef typename Frame::LocalVector LocalVector; - typedef typename Frame::LocalPoint LocalPoint; - - std::cout << "size of Rot " << sizeof(Rotation) << std::endl; - std::cout << "size of Pos " << sizeof(Position) << std::endl; - std::cout << "size of Point " << sizeof(GlobalPoint) << std::endl; - std::cout << "size of Frame " << sizeof(Frame) << std::endl; + typedef SOAFrame SFrame; + typedef typename Frame::PositionType Position; + typedef typename Frame::GlobalVector GlobalVector; + typedef typename Frame::GlobalPoint GlobalPoint; + typedef typename Frame::LocalVector LocalVector; + typedef typename Frame::LocalPoint LocalPoint; + + std::cout << "size of Rot " << sizeof(Rotation) << std::endl; + std::cout << "size of Pos " << sizeof(Position) << std::endl; + std::cout << "size of Point " << sizeof(GlobalPoint) << std::endl; + std::cout << "size of Frame " << sizeof(Frame) << std::endl; + std::cout << "size of soa Rot " << sizeof(SRotation) << std::endl; + std::cout << "size of soa Frame " << sizeof(SFrame) << std::endl; double a = 0.01; double ca = cos(a); double sa = sin(a); Rotation r1(ca, sa, 0, - -sa, ca, 0, - 0, 0, 1);; - Frame f1(Position(2,3,4), r1); + -sa, ca, 0, + 0, 0, 1);; + Frame f1(Position(2, 3, 4), r1); cout << "f1.position() " << f1.position() << endl; cout << "f1.rotation() " << endl << f1.rotation() << endl; - Rotation r2( GlobalVector( 0, 1 ,0), GlobalVector( 0, 0, 1)); - Frame f2(Position(5,6,7), r2); + Rotation r2( GlobalVector( 0, 1 , 0), GlobalVector( 0, 0, 1)); + Frame f2(Position(5, 6, 7), r2); cout << "f2.position() " << f2.position() << endl; cout << "f2.rotation() " << endl << f2.rotation() << endl; - // transform f2 to f1 so that f1 becomes the "global" frame of f3 - // Rotation r3 = r2.multiplyInverse(r1); - // Rotation r3 = r2*r1; - - // Rotation r3 = r1*r2; - // Rotation r3 = r1*r2.transposed(); - // Rotation r3 = r1.transposed()*r2; - // Rotation r3 = r1.transposed()*r2.transposed(); - // Rotation r3 = r2*r1; Rotation r3 = r2*r1.transposed(); - + SRotation sr3(r3); GlobalPoint pos2(f2.position()); LocalPoint lp3 = f1.toLocal(pos2); @@ -58,8 +54,20 @@ void go() { cout << "f3.position() " << f3.position() << endl; cout << "f3.rotation() " << endl << f3.rotation() << endl; -// test - GlobalPoint gp( 11,22,33); + SFrame sf1(f1.position().x(), + f1.position().y(), + f1.position().z(), + f1.rotation() + ); + + SFrame sf3(f3.position().x(), + f3.position().y(), + f3.position().z(), + sr3 + ); + + // test + GlobalPoint gp(11, 22, 33); LocalPoint p_in1 = f1.toLocal( gp); typename Frame::ToLocal ff1(f1); LocalPoint p_in2 = f2.toLocal( gp); @@ -69,25 +77,19 @@ void go() { cout << "p_in2 " << p_in2 << endl; cout << "p_in3 " << p_in3 << endl; - LocalPoint p_in1_from3( f3.toGlobal(p_in3).basicVector()); - cout << "p_in1_from3 + " << p_in1_from3 << endl; - - BoundPlane plane(f2.position(), f2.rotation()); - -// FrameChanger changer; -// FrameChanger::PlanePtr pp = changer.toFrame( plane, f1); - -/* - FrameChanger changer; - FrameChanger::PlanePtr pp = changer.transformPlane( plane, f1); - - LocalPoint p_in2p = plane.toLocal( gp); - LocalPoint p_in3p = pp->toLocal( GlobalPoint(p_in1.basicVector())); - cout << "p_in2p " << p_in2p << endl; - cout << "p_in3p " << p_in3p << endl; -*/ - - + LocalPoint p_in1_from3(f3.toGlobal(p_in3).basicVector()); + cout << "p_in1_from3 " << p_in1_from3 << endl; + + T xx, yy, zz; + sf1.toLocal(gp.x(), gp.y(), gp.z(), + xx, yy, zz); + cout << "p_in1 soa " << xx<<','<( 1, 1, 1), .3); - Cylinder cyl(5.f, Position(2,-1,3), ll); - Plane t = cyl.fastTangent(LocalPoint(3.,4.,1.)); + Cylinder cyl(5.f, Position(2,-1, 3), ll); + Plane t = cyl.fastTangent(LocalPoint(3., 4., 1.)); std::cout << t.position() << '\n' << t.rotation() << std::endl; std::cout << t.rotation().x()*cyl.rotation().z().cross( (t.position()-cyl.position()).basicVector() ).unit() << std::endl; } - + } int main() { - + go(); cyl(); std::cout << std::endl; From d058306fff45348f36059bfd70c0058c2e929e44 Mon Sep 17 00:00:00 2001 From: Vincenzo Innocente Date: Thu, 1 Mar 2018 23:35:37 +0100 Subject: [PATCH 035/426] Add Phase 1 pixel topology test Backport code changes from GPU-related developments. --- .../interface/phase1PixelTopology.h | 78 ++++++++++ .../TrackerGeometryBuilder/test/BuildFile.xml | 50 +++--- .../test/phase1PixelTopology_t.cpp | 145 ++++++++++++++++++ 3 files changed, 249 insertions(+), 24 deletions(-) create mode 100644 Geometry/TrackerGeometryBuilder/interface/phase1PixelTopology.h create mode 100644 Geometry/TrackerGeometryBuilder/test/phase1PixelTopology_t.cpp diff --git a/Geometry/TrackerGeometryBuilder/interface/phase1PixelTopology.h b/Geometry/TrackerGeometryBuilder/interface/phase1PixelTopology.h new file mode 100644 index 0000000000000..872e0b732ae14 --- /dev/null +++ b/Geometry/TrackerGeometryBuilder/interface/phase1PixelTopology.h @@ -0,0 +1,78 @@ +#pragma once +#ifndef Geometry_TrackerGeometryBuilder_phase1PixelTopology_h +#define Geometry_TrackerGeometryBuilder_phase1PixelTopology_h + +#include + +namespace phase1PixelTopology { + + constexpr uint16_t numRowsInRoc = 80; + constexpr uint16_t numColsInRoc = 52; + constexpr uint16_t lastRowInRoc = numRowsInRoc - 1; + constexpr uint16_t lastColInRoc = numColsInRoc - 1; + + constexpr uint16_t numRowsInModule = 2 * numRowsInRoc; + constexpr uint16_t numColsInModule = 8 * numColsInRoc; + constexpr uint16_t lastRowInModule = numRowsInModule - 1; + constexpr uint16_t lastColInModule = numColsInModule - 1; + + constexpr int16_t xOffset = -81; + constexpr int16_t yOffset = -54*4; + + constexpr uint32_t numPixsInModule = uint32_t(numRowsInModule)* uint32_t(numColsInModule); + + // this is for the ROC n<512 (upgrade 1024) + constexpr inline + uint16_t divu52(uint16_t n) { + n = n>>2; + uint16_t q = (n>>1) + (n>>4); + q = q + (q>>4) + (q>>5); q = q >> 3; + uint16_t r = n - q*13; + return q + ((r + 3) >> 4); + } + + constexpr inline + bool isEdgeX(uint16_t px) { return (px==0) | (px==lastRowInModule);} + constexpr inline + bool isEdgeY(uint16_t py) { return (py==0) | (py==lastColInModule);} + + + constexpr inline + uint16_t toRocX(uint16_t px) { return (pxlastRowInRoc) shift+=1; + if (px>numRowsInRoc) shift+=1; + return px+shift; + } + + constexpr inline + uint16_t localY(uint16_t py) { + auto roc = divu52(py); + auto shift = 2*roc; + auto yInRoc = py - 52*roc; + if (yInRoc>0) shift+=1; + return py+shift; + } + +} + +#endif // Geometry_TrackerGeometryBuilder_phase1PixelTopology_h diff --git a/Geometry/TrackerGeometryBuilder/test/BuildFile.xml b/Geometry/TrackerGeometryBuilder/test/BuildFile.xml index 949f4d81bc9a9..b67f820e5e9de 100644 --- a/Geometry/TrackerGeometryBuilder/test/BuildFile.xml +++ b/Geometry/TrackerGeometryBuilder/test/BuildFile.xml @@ -1,29 +1,31 @@ - - - - - - - - + + + + + + + + - - - - - + + + + + - - - - + + + + - - - - + + + + - - - + + + + + diff --git a/Geometry/TrackerGeometryBuilder/test/phase1PixelTopology_t.cpp b/Geometry/TrackerGeometryBuilder/test/phase1PixelTopology_t.cpp new file mode 100644 index 0000000000000..b9f9a4f3b3487 --- /dev/null +++ b/Geometry/TrackerGeometryBuilder/test/phase1PixelTopology_t.cpp @@ -0,0 +1,145 @@ +#include +#include +#include + +#include "Geometry/TrackerGeometryBuilder/interface/phase1PixelTopology.h" + +namespace { + + // original code from CMSSW_4_4 + + std::tuple localXori(int mpx) { + const float m_pitchx=1.f; + int binoffx = int(mpx); // truncate to int + float local_pitchx = m_pitchx; // defaultpitch + + if (binoffx>80) { // ROC 1 - handles x on edge cluster + binoffx=binoffx+2; + } else if (binoffx==80) { // ROC 1 + binoffx=binoffx+1; + local_pitchx = 2 * m_pitchx; + + } else if (binoffx==79) { // ROC 0 + binoffx=binoffx+0; + local_pitchx = 2 * m_pitchx; + } else if (binoffx>=0) { // ROC 0 + binoffx=binoffx+0; + + } else { // too small + assert("binoffx too small"==0); + } + + return std::make_tuple(binoffx,local_pitchx>m_pitchx); + } + + std::tuple localYori(int mpy) { + const float m_pitchy=1.f; + int binoffy = int(mpy); // truncate to int + float local_pitchy = m_pitchy; // defaultpitch + + if (binoffy>416) { // ROC 8, not real ROC + binoffy=binoffy+17; + } else if (binoffy==416) { // ROC 8 + binoffy=binoffy+16; + local_pitchy = 2 * m_pitchy; + + } else if (binoffy==415) { // ROC 7, last big pixel + binoffy=binoffy+15; + local_pitchy = 2 * m_pitchy; + } else if (binoffy>364) { // ROC 7 + binoffy=binoffy+15; + } else if (binoffy==364) { // ROC 7 + binoffy=binoffy+14; + local_pitchy = 2 * m_pitchy; + + } else if (binoffy==363) { // ROC 6 + binoffy=binoffy+13; + local_pitchy = 2 * m_pitchy; + } else if (binoffy>312) { // ROC 6 + binoffy=binoffy+13; + } else if (binoffy==312) { // ROC 6 + binoffy=binoffy+12; + local_pitchy = 2 * m_pitchy; + + } else if (binoffy==311) { // ROC 5 + binoffy=binoffy+11; + local_pitchy = 2 * m_pitchy; + } else if (binoffy>260) { // ROC 5 + binoffy=binoffy+11; + } else if (binoffy==260) { // ROC 5 + binoffy=binoffy+10; + local_pitchy = 2 * m_pitchy; + + } else if (binoffy==259) { // ROC 4 + binoffy=binoffy+9; + local_pitchy = 2 * m_pitchy; + } else if (binoffy>208) { // ROC 4 + binoffy=binoffy+9; + } else if (binoffy==208) { // ROC 4 + binoffy=binoffy+8; + local_pitchy = 2 * m_pitchy; + + } else if (binoffy==207) { // ROC 3 + binoffy=binoffy+7; + local_pitchy = 2 * m_pitchy; + } else if (binoffy>156) { // ROC 3 + binoffy=binoffy+7; + } else if (binoffy==156) { // ROC 3 + binoffy=binoffy+6; + local_pitchy = 2 * m_pitchy; + + } else if (binoffy==155) { // ROC 2 + binoffy=binoffy+5; + local_pitchy = 2 * m_pitchy; + } else if (binoffy>104) { // ROC 2 + binoffy=binoffy+5; + } else if (binoffy==104) { // ROC 2 + binoffy=binoffy+4; + local_pitchy = 2 * m_pitchy; + + } else if (binoffy==103) { // ROC 1 + binoffy=binoffy+3; + local_pitchy = 2 * m_pitchy; + } else if (binoffy>52) { // ROC 1 + binoffy=binoffy+3; + } else if (binoffy==52) { // ROC 1 + binoffy=binoffy+2; + local_pitchy = 2 * m_pitchy; + + } else if (binoffy==51) { // ROC 0 + binoffy=binoffy+1; + local_pitchy = 2 * m_pitchy; + } else if (binoffy>0) { // ROC 0 + binoffy=binoffy+1; + } else if (binoffy==0) { // ROC 0 + binoffy=binoffy+0; + local_pitchy = 2 * m_pitchy; + } else { + assert("binoffy too small"==0); + } + + return std::make_tuple(binoffy,local_pitchy>m_pitchy); + } + +} + +int main() { + + for (uint16_t ix=0; ix<80*2; ++ix) { + auto ori = localXori(ix); + auto xl = phase1PixelTopology::localX(ix); + auto bp = phase1PixelTopology::isBigPixX(ix); + if (std::get<0>(ori)!=xl) std::cout << "Error " << std::get<0>(ori) << "!=" << xl << std::endl; + assert(std::get<1>(ori)==bp); + } + + for (uint16_t iy=0; iy<52*8; ++iy) { + auto ori = localYori(iy); + auto yl = phase1PixelTopology::localY(iy); + auto bp = phase1PixelTopology::isBigPixY(iy); + if (std::get<0>(ori)!=yl) std::cout << "Error " << std::get<0>(ori) << "!=" << yl << std::endl; + assert(std::get<1>(ori)==bp); + } + + return 0; +} From 42dc926fa8f407675d517fcb1e296a3c0599b00f Mon Sep 17 00:00:00 2001 From: Andrea Bocci Date: Thu, 1 Mar 2018 23:36:47 +0100 Subject: [PATCH 036/426] Clean up Backport code changes from GPU-related developments. --- .../SiPixelClusterizer/test/BuildFile.xml | 60 +++++++++---------- 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/RecoLocalTracker/SiPixelClusterizer/test/BuildFile.xml b/RecoLocalTracker/SiPixelClusterizer/test/BuildFile.xml index 59653fefce5e5..3445783781551 100644 --- a/RecoLocalTracker/SiPixelClusterizer/test/BuildFile.xml +++ b/RecoLocalTracker/SiPixelClusterizer/test/BuildFile.xml @@ -1,35 +1,33 @@ - - - - - - - - - - - - - - -# for tracks - - - - -# for lumi - - -# - - + + + + + + + + + + + + + + + + + + + + + + + - - + + - - + + - - + + From 8319a141f2ff0ec6981cb70d09466763d66fab87 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Fri, 23 Feb 2018 14:36:54 +0100 Subject: [PATCH 037/426] Migrate overlay configuration to PreMixingModule --- .../python/DataMixerPreMix_cff.py | 2 +- .../python/mixOne_simraw_on_sim_cfi.py | 269 ------------------ .../python/mixOne_premix_on_sim_cfi.py | 252 ++++++++++++++++ 3 files changed, 253 insertions(+), 270 deletions(-) delete mode 100644 SimGeneral/DataMixingModule/python/mixOne_simraw_on_sim_cfi.py create mode 100644 SimGeneral/PreMixingModule/python/mixOne_premix_on_sim_cfi.py diff --git a/Configuration/StandardSequences/python/DataMixerPreMix_cff.py b/Configuration/StandardSequences/python/DataMixerPreMix_cff.py index d9b8fc489fce0..32786024a4f13 100644 --- a/Configuration/StandardSequences/python/DataMixerPreMix_cff.py +++ b/Configuration/StandardSequences/python/DataMixerPreMix_cff.py @@ -4,7 +4,7 @@ from SimCalorimetry.Configuration.SimCalorimetry_cff import * -from SimGeneral.DataMixingModule.mixOne_simraw_on_sim_cfi import * +from SimGeneral.PreMixingModule.mixOne_premix_on_sim_cfi import * # Run after the DataMixer only. # diff --git a/SimGeneral/DataMixingModule/python/mixOne_simraw_on_sim_cfi.py b/SimGeneral/DataMixingModule/python/mixOne_simraw_on_sim_cfi.py deleted file mode 100644 index 556f809b0e041..0000000000000 --- a/SimGeneral/DataMixingModule/python/mixOne_simraw_on_sim_cfi.py +++ /dev/null @@ -1,269 +0,0 @@ -# This is the PreMixing config for the DataMixer. Not only does it do a RawToDigi conversion -# to the secondary input source, it also holds its own instances of an EcalDigiProducer and -# an HcalDigitizer. It also replicates the noise adding functions in the SiStripDigitizer. -# - - -import FWCore.ParameterSet.Config as cms -from SimCalorimetry.HcalSimProducers.hcalUnsuppressedDigis_cfi import hcalSimBlock -from SimGeneral.MixingModule.SiStripSimParameters_cfi import SiStripSimBlock -from SimGeneral.MixingModule.SiPixelSimParameters_cfi import SiPixelSimBlock -from SimCalorimetry.EcalSimProducers.ecalDigiParameters_cff import * -from SimCalorimetry.EcalSimProducers.apdSimParameters_cff import * -from SimCalorimetry.EcalSimProducers.ecalSimParameterMap_cff import * -from SimCalorimetry.EcalSimProducers.ecalElectronicsSim_cff import * -from SimCalorimetry.EcalSimProducers.esElectronicsSim_cff import * -from SimCalorimetry.EcalSimProducers.ecalNotContainmentSim_cff import * -from SimCalorimetry.EcalSimProducers.ecalCosmicsSim_cff import * - -import EventFilter.EcalRawToDigi.EcalUnpackerData_cfi -import EventFilter.ESRawToDigi.esRawToDigi_cfi -import EventFilter.HcalRawToDigi.HcalRawToDigi_cfi -import EventFilter.DTRawToDigi.dtunpacker_cfi -import EventFilter.RPCRawToDigi.rpcUnpacker_cfi -import EventFilter.CSCRawToDigi.cscUnpacker_cfi -import EventFilter.SiStripRawToDigi.SiStripDigis_cfi -import EventFilter.SiPixelRawToDigi.SiPixelRawToDigi_cfi - -# content from Configuration/StandardSequences/DigiToRaw_cff.py - -ecalDigis = EventFilter.EcalRawToDigi.EcalUnpackerData_cfi.ecalEBunpacker.clone() - -ecalPreshowerDigis = EventFilter.ESRawToDigi.esRawToDigi_cfi.esRawToDigi.clone() - -hcalDigis = EventFilter.HcalRawToDigi.HcalRawToDigi_cfi.hcalDigis.clone() - -muonCSCDigis = EventFilter.CSCRawToDigi.cscUnpacker_cfi.muonCSCDigis.clone() - -muonDTDigis = EventFilter.DTRawToDigi.dtunpacker_cfi.muonDTDigis.clone() - -#muonRPCDigis = EventFilter.RPCRawToDigi.rpcUnpacker_cfi.rpcunpacker.clone() -#castorDigis = EventFilter.CastorRawToDigi.CastorRawToDigi_cfi.castorDigis.clone( FEDs = cms.untracked.vint32(690,691,692) ) - -siStripDigis = EventFilter.SiStripRawToDigi.SiStripDigis_cfi.siStripDigis.clone() - -siPixelDigis = EventFilter.SiPixelRawToDigi.SiPixelRawToDigi_cfi.siPixelDigis.clone() - -siPixelDigis.InputLabel = 'rawDataCollector' -ecalDigis.InputLabel = 'rawDataCollector' -ecalPreshowerDigis.sourceTag = 'rawDataCollector' -hcalDigis.InputLabel = 'rawDataCollector' -muonCSCDigis.InputObjects = 'rawDataCollector' -muonDTDigis.inputLabel = 'rawDataCollector' -#muonRPCDigis.InputLabel = 'rawDataCollector' -#castorDigis.InputLabel = 'rawDataCollector' - -hcalDigis.FilterDataQuality = cms.bool(False) -hcalSimBlock.HcalPreMixStage2 = cms.bool(True) - -mixData = cms.EDProducer("DataMixingModule", - hcalSimBlock, - SiStripSimBlock, - SiPixelSimBlock, - ecal_digi_parameters, - apd_sim_parameters, - ecal_electronics_sim, - ecal_cosmics_sim, - ecal_sim_parameter_map, - ecal_notCont_sim, - es_electronics_sim, - input = cms.SecSource("EmbeddedRootSource", - producers = cms.VPSet(cms.convertToVPSet( - ecalDigis = ecalDigis, - ecalPreshowerDigis = ecalPreshowerDigis, - hcalDigis = hcalDigis, - muonDTDigis = muonDTDigis, - #muonRPCDigis = muonRPCDigis, - muonCSCDigis = muonCSCDigis, - siStripDigis = siStripDigis, - siPixelDigis = siPixelDigis, - )), - nbPileupEvents = cms.PSet( - averageNumber = cms.double(1.0) - ), - seed = cms.int32(1234567), - type = cms.string('fixed'), - sequential = cms.untracked.bool(False), # set to true for sequential reading of pileup - fileNames = cms.untracked.vstring( - 'file:DMPreProcess_RAW2DIGI.root' - ) - ), - # Mixing Module parameters - Label = cms.string(''), - maxBunch = cms.int32(0), - bunchspace = cms.int32(25), - minBunch = cms.int32(0), - # - mixProdStep1 = cms.bool(False), - mixProdStep2 = cms.bool(False), - TrackerMergeType = cms.string('Digis'), # kludge for fast simulation flag... - # Merge Pileup Info? - MergePileupInfo = cms.bool(True), - # Use digis? - EcalMergeType = cms.string('Digis'), # set to "Digis" to merge digis - HcalMergeType = cms.string('Digis'), - HcalDigiMerge = cms.string('FullProd'), #use sim hits for signal - addMCDigiNoise = cms.untracked.bool(True), - # - # Input Specifications: - # - # - # Tracking particles for validation - # - TrackingParticleLabelSig = cms.InputTag("mix","MergedTrackTruth"), - StripDigiSimLinkLabelSig = cms.InputTag("simSiStripDigis"), - PixelDigiSimLinkLabelSig = cms.InputTag("simSiPixelDigis"), - DTDigiSimLinkLabelSig = cms.InputTag("simMuonDTDigis"), - RPCDigiSimLinkLabelSig = cms.InputTag("simMuonRPCDigis","RPCDigiSimLink"), - CSCStripDigiSimLinkLabelSig = cms.InputTag("simMuonCSCDigis","MuonCSCStripDigiSimLinks"), - CSCWireDigiSimLinkLabelSig = cms.InputTag("simMuonCSCDigis","MuonCSCWireDigiSimLinks"), - - # - PileupInfoInputTag = cms.InputTag("addPileupInfo"), - BunchSpacingInputTag = cms.InputTag("addPileupInfo","bunchSpacing"), - CFPlaybackInputTag = cms.InputTag("mix"), - GenPUProtonsInputTags = cms.VInputTag("genPUProtons"), - # - SistripLabelSig = cms.InputTag("simSiStripDigis","ZeroSuppressed"), - # - pixeldigiCollectionSig = cms.InputTag("simSiPixelDigis"), - # - SiStripPileInputTag = cms.InputTag("siStripDigis","ZeroSuppressed","@MIXING"), - # - pixeldigiCollectionPile = cms.InputTag("siPixelDigis","","@MIXING"), - # - EBProducerSig = cms.InputTag("ecalRecHit","EcalRecHitsEB"), - EEProducerSig = cms.InputTag("ecalRecHit","EcalRecHitsEE"), - ESProducerSig = cms.InputTag("ecalPreshowerRecHit","EcalRecHitsES"), - # - HBHEProducerSig = cms.InputTag("hbhereco"), - HOProducerSig = cms.InputTag("horeco"), - HFProducerSig = cms.InputTag("hfreco"), - ZDCrechitCollectionSig = cms.InputTag("zdcreco"), - # - # - EBPileRecHitInputTag = cms.InputTag("ecalRecHit", "EcalRecHitsEB"), - EEPileRecHitInputTag = cms.InputTag("ecalRecHit", "EcalRecHitsEE"), - ESPileRecHitInputTag = cms.InputTag("ecalPreshowerRecHit", "EcalRecHitsES"), - # - HBHEPileRecHitInputTag = cms.InputTag("hbhereco", ""), - HOPileRecHitInputTag = cms.InputTag("horeco", ""), - HFPileRecHitInputTag = cms.InputTag("hfreco", ""), - ZDCPileRecHitInputTag = cms.InputTag("zdcreco",""), - # - # Calorimeter digis - # - -# EBdigiCollectionSig = cms.InputTag("simEcalUnsuppressedDigis"), -# EEdigiCollectionSig = cms.InputTag("simEcalUnsuppressedDigis"), -# ESdigiCollectionSig = cms.InputTag("simEcalUnsuppressedDigis"), - - EBdigiProducerSig = cms.InputTag("simEcalUnsuppressedDigis"), - EEdigiProducerSig = cms.InputTag("simEcalUnsuppressedDigis"), - ESdigiProducerSig = cms.InputTag("simEcalPreshowerDigis"), - HBHEdigiCollectionSig = cms.InputTag("simHcalUnsuppressedDigis"), - HOdigiCollectionSig = cms.InputTag("simHcalUnsuppressedDigis"), - HFdigiCollectionSig = cms.InputTag("simHcalUnsuppressedDigis"), - QIE10digiCollectionSig = cms.InputTag("simHcalUnsuppressedDigis"), - QIE11digiCollectionSig = cms.InputTag("simHcalUnsuppressedDigis"), - ZDCdigiCollectionSig = cms.InputTag("simHcalUnsuppressedDigis"), - - - # Validation - TrackingParticlePileInputTag = cms.InputTag("mix","MergedTrackTruth"), - StripDigiSimLinkPileInputTag = cms.InputTag("simSiStripDigis"), - PixelDigiSimLinkPileInputTag = cms.InputTag("simSiPixelDigis"), - DTDigiSimLinkPileInputTag = cms.InputTag("simMuonDTDigis"), - RPCDigiSimLinkPileInputTag = cms.InputTag("simMuonRPCDigis","RPCDigiSimLink"), - CSCStripDigiSimLinkPileInputTag = cms.InputTag("simMuonCSCDigis","MuonCSCStripDigiSimLinks"), - CSCWireDigiSimLinkPileInputTag = cms.InputTag("simMuonCSCDigis","MuonCSCWireDigiSimLinks"), - - # Dead APV Vector - SistripAPVPileInputTag = cms.InputTag("mix","AffectedAPVList"), - SistripAPVLabelSig = cms.InputTag("mix","AffectedAPVList"), - - # Note: elements with "@MIXING" in the input tag are generated by - # running Raw2Digi in the input step on the Secondary input stream - EBPileInputTag = cms.InputTag("ecalDigis","ebDigis","@MIXING"), - EEPileInputTag = cms.InputTag("ecalDigis","eeDigis","@MIXING"), - ESPileInputTag = cms.InputTag("ecalPreshowerDigis","","@MIXING"), - #ESPileInputTag = cms.InputTag("esRawToDigi","","@MIXING"), - HBHEPileInputTag = cms.InputTag("hcalDigis","","@MIXING"), - HOPileInputTag = cms.InputTag("hcalDigis","","@MIXING"), - HFPileInputTag = cms.InputTag("hcalDigis","","@MIXING"), - QIE10PileInputTag = cms.InputTag("hcalDigis","","@MIXING"), - QIE11PileInputTag = cms.InputTag("hcalDigis","","@MIXING"), - ZDCPileInputTag = cms.InputTag(""), - - # Signal - # - CSCwiredigiCollectionSig = cms.InputTag("simMuonCSCDigis","MuonCSCWireDigi"), - CSCstripdigiCollectionSig = cms.InputTag("simMuonCSCDigis","MuonCSCStripDigi"), - CSCCompdigiCollectionSig = cms.InputTag("simMuonCSCDigis","MuonCSCComparatorDigi"), - RPCDigiTagSig = cms.InputTag("simMuonRPCDigis"), - RPCdigiCollectionSig = cms.InputTag("simMuonRPCDigis"), - DTDigiTagSig = cms.InputTag("simMuonDTDigis"), - DTdigiCollectionSig = cms.InputTag("simMuonDTDigis"), - # Pileup - # - DTPileInputTag = cms.InputTag("muonDTDigis","","@MIXING"), - RPCPileInputTag = cms.InputTag("simMuonRPCDigis",""), -# RPCPileInputTag = cms.InputTag("muonRPCDigis","","@MIXING"), # use MC digis... - CSCWirePileInputTag = cms.InputTag("muonCSCDigis","MuonCSCWireDigi","@MIXING"), - CSCStripPileInputTag = cms.InputTag("muonCSCDigis","MuonCSCStripDigi","@MIXING"), - CSCCompPileInputTag = cms.InputTag("muonCSCDigis","MuonCSCComparatorDigi","@MIXING"), - # - # - # Outputs - # - SiStripDigiCollectionDM = cms.string('siStripDigisDM'), - PixelDigiCollectionDM = cms.string('siPixelDigisDM'), - EBRecHitCollectionDM = cms.string('EcalRecHitsEBDM'), - EERecHitCollectionDM = cms.string('EcalRecHitsEEDM'), - ESRecHitCollectionDM = cms.string('EcalRecHitsESDM'), - HBHERecHitCollectionDM = cms.string('HBHERecHitCollectionDM'), - HFRecHitCollectionDM = cms.string('HFRecHitCollectionDM'), - HORecHitCollectionDM = cms.string('HORecHitCollectionDM'), - ZDCRecHitCollectionDM = cms.string('ZDCRecHitCollectionDM'), - DTDigiCollectionDM = cms.string('muonDTDigisDM'), - CSCWireDigiCollectionDM = cms.string('MuonCSCWireDigisDM'), - CSCStripDigiCollectionDM = cms.string('MuonCSCStripDigisDM'), - CSCComparatorDigiCollectionDM = cms.string('MuonCSCComparatorDigisDM'), - RPCDigiCollectionDM = cms.string('muonRPCDigisDM'), - TrackingParticleCollectionDM = cms.string('MergedTrackTruth'), - StripDigiSimLinkCollectionDM = cms.string('StripDigiSimLink'), - PixelDigiSimLinkCollectionDM = cms.string('PixelDigiSimLink'), - DTDigiSimLinkDM = cms.string('simMuonDTDigis'), - RPCDigiSimLinkDM = cms.string('RPCDigiSimLink'), - CSCStripDigiSimLinkDM = cms.string('MuonCSCStripDigiSimLinks'), - CSCWireDigiSimLinkDM = cms.string('MuonCSCWireDigiSimLinks'), - SiStripAPVListDM = cms.string('SiStripAPVList'), - - # - # Calorimeter Digis - # - EBDigiCollectionDM = cms.string(''), - EEDigiCollectionDM = cms.string(''), - ESDigiCollectionDM = cms.string(''), - HBHEDigiCollectionDM = cms.string(''), - HODigiCollectionDM = cms.string(''), - HFDigiCollectionDM = cms.string(''), - QIE10DigiCollectionDM = cms.string(''), - QIE11DigiCollectionDM = cms.string(''), - ZDCDigiCollectionDM = cms.string('') -) - -mixData.doEB = cms.bool(True) -mixData.doEE = cms.bool(True) -mixData.doES = cms.bool(True) - -from Configuration.Eras.Modifier_fastSim_cff import fastSim -from FastSimulation.Tracking.recoTrackAccumulator_cfi import recoTrackAccumulator as _recoTrackAccumulator -fastSim.toModify(mixData, - # from signal: mix tracks not strip or pixel digis - TrackerMergeType = "tracks", - tracker = _recoTrackAccumulator.clone( - pileUpTracks = "mix:generalTracks" - ), - hitsProducer = "fastSimProducer" -) diff --git a/SimGeneral/PreMixingModule/python/mixOne_premix_on_sim_cfi.py b/SimGeneral/PreMixingModule/python/mixOne_premix_on_sim_cfi.py new file mode 100644 index 0000000000000..2547d779d3cb1 --- /dev/null +++ b/SimGeneral/PreMixingModule/python/mixOne_premix_on_sim_cfi.py @@ -0,0 +1,252 @@ +# This is the PreMixing config. Not only does it do a RawToDigi +# conversion to the secondary input source, it also holds its own +# instances of an EcalDigiProducer and an HcalDigitizer. It also +# replicates the noise adding functions in the SiStripDigitizer. +# +# Adapted from DataMixingModule + + +import FWCore.ParameterSet.Config as cms +from SimCalorimetry.HcalSimProducers.hcalUnsuppressedDigis_cfi import hcalSimBlock +from SimGeneral.MixingModule.SiStripSimParameters_cfi import SiStripSimBlock +from SimGeneral.MixingModule.SiPixelSimParameters_cfi import SiPixelSimBlock +from SimGeneral.MixingModule.ecalDigitizer_cfi import ecalDigitizer + +import EventFilter.EcalRawToDigi.EcalUnpackerData_cfi +import EventFilter.ESRawToDigi.esRawToDigi_cfi +import EventFilter.HcalRawToDigi.HcalRawToDigi_cfi +import EventFilter.DTRawToDigi.dtunpacker_cfi +import EventFilter.RPCRawToDigi.rpcUnpacker_cfi +import EventFilter.CSCRawToDigi.cscUnpacker_cfi +import EventFilter.SiStripRawToDigi.SiStripDigis_cfi +import EventFilter.SiPixelRawToDigi.SiPixelRawToDigi_cfi + +# content from Configuration/StandardSequences/DigiToRaw_cff.py + +ecalDigis = EventFilter.EcalRawToDigi.EcalUnpackerData_cfi.ecalEBunpacker.clone() + +ecalPreshowerDigis = EventFilter.ESRawToDigi.esRawToDigi_cfi.esRawToDigi.clone() + +hcalDigis = EventFilter.HcalRawToDigi.HcalRawToDigi_cfi.hcalDigis.clone() + +muonCSCDigis = EventFilter.CSCRawToDigi.cscUnpacker_cfi.muonCSCDigis.clone() + +muonDTDigis = EventFilter.DTRawToDigi.dtunpacker_cfi.muonDTDigis.clone() + +siStripDigis = EventFilter.SiStripRawToDigi.SiStripDigis_cfi.siStripDigis.clone() + +siPixelDigis = EventFilter.SiPixelRawToDigi.SiPixelRawToDigi_cfi.siPixelDigis.clone() + +siPixelDigis.InputLabel = 'rawDataCollector' +ecalDigis.InputLabel = 'rawDataCollector' +ecalPreshowerDigis.sourceTag = 'rawDataCollector' +hcalDigis.InputLabel = 'rawDataCollector' +muonCSCDigis.InputObjects = 'rawDataCollector' +muonDTDigis.inputLabel = 'rawDataCollector' + +hcalDigis.FilterDataQuality = cms.bool(False) +hcalSimBlock.HcalPreMixStage2 = cms.bool(True) + +mixData = cms.EDProducer("PreMixingModule", + input = cms.SecSource("EmbeddedRootSource", + producers = cms.VPSet(cms.convertToVPSet( + ecalDigis = ecalDigis, + ecalPreshowerDigis = ecalPreshowerDigis, + hcalDigis = hcalDigis, + muonDTDigis = muonDTDigis, + muonCSCDigis = muonCSCDigis, + siStripDigis = siStripDigis, + siPixelDigis = siPixelDigis, + )), + nbPileupEvents = cms.PSet( + averageNumber = cms.double(1.0) + ), + seed = cms.int32(1234567), + type = cms.string('fixed'), + sequential = cms.untracked.bool(False), # set to true for sequential reading of pileup + fileNames = cms.untracked.vstring('file:DMPreProcess_RAW2DIGI.root') + ), + # Mixing Module parameters + bunchspace = cms.int32(25), + minBunch = cms.int32(0), + maxBunch = cms.int32(0), + mixProdStep1 = cms.bool(False), + mixProdStep2 = cms.bool(False), + # Workers + workers = cms.PSet( + pileup = cms.PSet( + PileupInfoInputTag = cms.InputTag("addPileupInfo"), + BunchSpacingInputTag = cms.InputTag("addPileupInfo","bunchSpacing"), + CFPlaybackInputTag = cms.InputTag("mix"), + GenPUProtonsInputTags = cms.VInputTag("genPUProtons"), + ), + # Note: elements with "@MIXING" in the input tag are generated by + pixel = cms.PSet( + SiPixelSimBlock, + # + workerType = cms.string("PreMixingSiPixelWorker"), + # + pixeldigiCollectionSig = cms.InputTag("simSiPixelDigis"), + pixeldigiCollectionPile = cms.InputTag("siPixelDigis","","@MIXING"), + PixelDigiCollectionDM = cms.string('siPixelDigisDM'), + ), + strip = cms.PSet( + SiStripSimBlock, + # + workerType = cms.string("PreMixingSiStripWorker"), + # + SistripLabelSig = cms.InputTag("simSiStripDigis","ZeroSuppressed"), + SiStripPileInputTag = cms.InputTag("siStripDigis","ZeroSuppressed","@MIXING"), + # Dead APV Vector + SistripAPVPileInputTag = cms.InputTag("mix","AffectedAPVList"), + SistripAPVLabelSig = cms.InputTag("mix","AffectedAPVList"), + # output + SiStripDigiCollectionDM = cms.string('siStripDigisDM'), + SiStripAPVListDM = cms.string('SiStripAPVList'), + ), + ecal = cms.PSet( + ecalDigitizer.clone(accumulatorType = None, makeDigiSimLinks=None), + # + workerType = cms.string("PreMixingEcalWorker"), + # + EBdigiProducerSig = cms.InputTag("simEcalUnsuppressedDigis"), + EEdigiProducerSig = cms.InputTag("simEcalUnsuppressedDigis"), + ESdigiProducerSig = cms.InputTag("simEcalPreshowerDigis"), + # + EBPileInputTag = cms.InputTag("ecalDigis","ebDigis","@MIXING"), + EEPileInputTag = cms.InputTag("ecalDigis","eeDigis","@MIXING"), + ESPileInputTag = cms.InputTag("ecalPreshowerDigis","","@MIXING"), + # + EBDigiCollectionDM = cms.string(''), + EEDigiCollectionDM = cms.string(''), + ESDigiCollectionDM = cms.string(''), + ), + hcal = cms.PSet( + hcalSimBlock, + # + workerType = cms.string("PreMixingHcalWorker"), + # + HBHEdigiCollectionSig = cms.InputTag("simHcalUnsuppressedDigis"), + HOdigiCollectionSig = cms.InputTag("simHcalUnsuppressedDigis"), + HFdigiCollectionSig = cms.InputTag("simHcalUnsuppressedDigis"), + QIE10digiCollectionSig = cms.InputTag("simHcalUnsuppressedDigis"), + QIE11digiCollectionSig = cms.InputTag("simHcalUnsuppressedDigis"), + ZDCdigiCollectionSig = cms.InputTag("simHcalUnsuppressedDigis"), + # + HBHEPileInputTag = cms.InputTag("hcalDigis","","@MIXING"), + HOPileInputTag = cms.InputTag("hcalDigis","","@MIXING"), + HFPileInputTag = cms.InputTag("hcalDigis","","@MIXING"), + QIE10PileInputTag = cms.InputTag("hcalDigis","","@MIXING"), + QIE11PileInputTag = cms.InputTag("hcalDigis","","@MIXING"), + ZDCPileInputTag = cms.InputTag(""), + # + HBHEDigiCollectionDM = cms.string(''), + HODigiCollectionDM = cms.string(''), + HFDigiCollectionDM = cms.string(''), + QIE10DigiCollectionDM = cms.string(''), + QIE11DigiCollectionDM = cms.string(''), + ZDCDigiCollectionDM = cms.string('') + ), + dt = cms.PSet( + workerType = cms.string("PreMixingDTWorker"), + # + digiTagSig = cms.InputTag("simMuonDTDigis"), + pileInputTag = cms.InputTag("muonDTDigis","","@MIXING"), + collectionDM = cms.string(''), + ), + rpc = cms.PSet( + workerType = cms.string("PreMixingRPCWorker"), + # + digiTagSig = cms.InputTag("simMuonRPCDigis"), + pileInputTag = cms.InputTag("simMuonRPCDigis",""), + collectionDM = cms.string(''), + ), + csc = cms.PSet( + workerType = cms.string("PreMixingCSCWorker"), + # + strip = cms.PSet( + digiTagSig = cms.InputTag("simMuonCSCDigis","MuonCSCStripDigi"), + pileInputTag = cms.InputTag("muonCSCDigis","MuonCSCStripDigi","@MIXING"), + collectionDM = cms.string('MuonCSCStripDigisDM'), + ), + wire = cms.PSet( + digiTagSig = cms.InputTag("simMuonCSCDigis","MuonCSCWireDigi"), + pileInputTag = cms.InputTag("muonCSCDigis","MuonCSCWireDigi","@MIXING"), + collectionDM = cms.string('MuonCSCWireDigisDM'), + ), + comparator = cms.PSet( + digiTagSig = cms.InputTag("simMuonCSCDigis","MuonCSCComparatorDigi"), + pileInputTag = cms.InputTag("muonCSCDigis","MuonCSCComparatorDigi","@MIXING"), + collectionDM = cms.string('MuonCSCComparatorDigisDM'), + ), + ), + trackingTruth = cms.PSet( + workerType = cms.string("PreMixingTrackingParticleWorker"), + # + labelSig = cms.InputTag("mix","MergedTrackTruth"), + pileInputTag = cms.InputTag("mix","MergedTrackTruth"), + collectionDM = cms.string('MergedTrackTruth'), + ), + pixelSimLink = cms.PSet( + workerType = cms.string("PreMixingPixelDigiSimLinkWorker"), + # + labelSig = cms.InputTag("simSiPixelDigis"), + pileInputTag = cms.InputTag("simSiPixelDigis"), + collectionDM = cms.string('PixelDigiSimLink'), + ), + stripSimLink = cms.PSet( + workerType = cms.string("PreMixingStripDigiSimLinkWorker"), + # + labelSig = cms.InputTag("simSiStripDigis"), + pileInputTag = cms.InputTag("simSiStripDigis"), + collectionDM = cms.string('StripDigiSimLink'), + ), + dtSimLink = cms.PSet( + workerType = cms.string("PreMixingDTDigiSimLinkWorker"), + # + labelSig = cms.InputTag("simMuonDTDigis"), + pileInputTag = cms.InputTag("simMuonDTDigis"), + collectionDM = cms.string('simMuonDTDigis'), + ), + rpcSimLink = cms.PSet( + workerType = cms.string("PreMixingRPCDigiSimLinkWorker"), + # + labelSig = cms.InputTag("simMuonRPCDigis","RPCDigiSimLink"), + pileInputTag = cms.InputTag("simMuonRPCDigis","RPCDigiSimLink"), + collectionDM = cms.string('RPCDigiSimLink'), + ), + cscStripSimLink = cms.PSet( + workerType = cms.string("PreMixingStripDigiSimLinkWorker"), + # + labelSig = cms.InputTag("simMuonCSCDigis","MuonCSCStripDigiSimLinks"), + pileInputTag = cms.InputTag("simMuonCSCDigis","MuonCSCStripDigiSimLinks"), + collectionDM = cms.string('MuonCSCStripDigiSimLinks'), + ), + cscWireSimLink = cms.PSet( + workerType = cms.string("PreMixingStripDigiSimLinkWorker"), + # + labelSig = cms.InputTag("simMuonCSCDigis","MuonCSCWireDigiSimLinks"), + pileInputTag = cms.InputTag("simMuonCSCDigis","MuonCSCWireDigiSimLinks"), + collectionDM = cms.string('MuonCSCWireDigiSimLinks'), + ), + ), +) + + +from Configuration.Eras.Modifier_fastSim_cff import fastSim +from FastSimulation.Tracking.recoTrackAccumulator_cfi import recoTrackAccumulator as _recoTrackAccumulator +fastSim.toModify(mixData, + # from signal: mix tracks not strip or pixel digis + workers = dict( + pixel = None, + strip = None, + pixelSimLink = None, + stripSimLink = None, + tracks = cms.PSet( + workerType = cms.string("PreMixingDigiAccumulatorWorker"), + accumulator = _recoTrackAccumulator.clone( + pileUpTracks = "mix:generalTracks" + ) + ) + ), +) From 7a4a7e0a0be1825ff0f86a7d8773c2b71dbf830b Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Mon, 26 Feb 2018 14:50:08 +0100 Subject: [PATCH 038/426] The parameter is PixGeometryType in pixel digitizer --- SimGeneral/PreMixingModule/plugins/PreMixingSiPixelWorker.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SimGeneral/PreMixingModule/plugins/PreMixingSiPixelWorker.cc b/SimGeneral/PreMixingModule/plugins/PreMixingSiPixelWorker.cc index d38672fac787c..a61ecbabe907f 100644 --- a/SimGeneral/PreMixingModule/plugins/PreMixingSiPixelWorker.cc +++ b/SimGeneral/PreMixingModule/plugins/PreMixingSiPixelWorker.cc @@ -145,7 +145,7 @@ namespace edm { // Constructor PreMixingSiPixelWorker::PreMixingSiPixelWorker(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector && iC): - geometryType_(ps.getParameter("GeometryType")), + geometryType_(ps.getParameter("PixGeometryType")), // get external parameters: // To account for upgrade geometries do not assume the number // of layers or disks. From 3d126e55108eaa6cfd00a7d55ce93a312878b18a Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Wed, 28 Feb 2018 09:15:05 +0100 Subject: [PATCH 039/426] Remove remaining premixing-specific pieces from DataMixingModule --- .../plugins/DataMixingModule.cc | 166 ++++++------------ .../plugins/DataMixingModule.h | 7 - .../python/mixOne_data_on_data_cfi.py | 1 - .../python/mixOne_data_on_sim_cfi.py | 1 - .../python/mixOne_sim_on_sim_cfi.py | 1 - 5 files changed, 52 insertions(+), 124 deletions(-) diff --git a/SimGeneral/DataMixingModule/plugins/DataMixingModule.cc b/SimGeneral/DataMixingModule/plugins/DataMixingModule.cc index 53a4b74d18c36..07303b9b2dd2d 100644 --- a/SimGeneral/DataMixingModule/plugins/DataMixingModule.cc +++ b/SimGeneral/DataMixingModule/plugins/DataMixingModule.cc @@ -28,9 +28,6 @@ #include "DataMixingModule.h" #include "SimGeneral/MixingModule/interface/PileUpEventPrincipal.h" -#include "SimGeneral/MixingModule/interface/DigiAccumulatorMixMod.h" -#include "SimGeneral/MixingModule/interface/DigiAccumulatorMixModFactory.h" - using namespace std; namespace edm @@ -71,10 +68,6 @@ namespace edm MergeHcalDigis_ = (ps.getParameter("HcalMergeType")) == "Digis"; if(MergeHcalDigis_) MergeHcalDigisProd_ = (ps.getParameter("HcalDigiMerge")=="FullProd"); - addMCDigiNoise_ = false; - - addMCDigiNoise_ = ps.getUntrackedParameter("addMCDigiNoise"); // for Sim on Sim mixing - // Put Fast Sim Sequences here for Simplification: Fewer options! @@ -92,9 +85,7 @@ namespace edm produces< ESDigiCollection >(ESDigiCollectionDM_); - if(!addMCDigiNoise_ ) { - EMDigiWorker_ = new DataMixingEMDigiWorker(ps, consumesCollector()); - } + EMDigiWorker_ = new DataMixingEMDigiWorker(ps, consumesCollector()); } else { // merge RecHits EBRecHitCollectionDM_ = ps.getParameter("EBRecHitCollectionDM"); @@ -169,47 +160,35 @@ namespace edm MuonWorker_ = new DataMixingMuonWorker(ps, consumesCollector()); - if(MergeTrackerDigis_) { + // Si-Strips - // Si-Strips + useSiStripRawDigi_ = ps.exists("SiStripRawDigiSource")? + ps.getParameter("SiStripRawDigiSource")=="PILEUP" || + ps.getParameter("SiStripRawDigiSource")=="SIGNAL" : false; - useSiStripRawDigi_ = ps.exists("SiStripRawDigiSource")? - ps.getParameter("SiStripRawDigiSource")=="PILEUP" || - ps.getParameter("SiStripRawDigiSource")=="SIGNAL" : false; - - SiStripDigiCollectionDM_ = ps.getParameter("SiStripDigiCollectionDM"); - - if(useSiStripRawDigi_) { - - produces< edm::DetSetVector > (SiStripDigiCollectionDM_); - SiStripRawWorker_ = new DataMixingSiStripRawWorker(ps, consumesCollector()); - - } else { - - produces< edm::DetSetVector > (SiStripDigiCollectionDM_); - - if(!addMCDigiNoise_ ) { - SiStripWorker_ = new DataMixingSiStripWorker(ps, consumesCollector()); - } - } - - // Pixels - - PixelDigiCollectionDM_ = ps.getParameter("PixelDigiCollectionDM"); - - produces< edm::DetSetVector > (PixelDigiCollectionDM_); - - if( !addMCDigiNoise_ ) { - SiPixelWorker_ = new DataMixingSiPixelWorker(ps, consumesCollector()); - } + SiStripDigiCollectionDM_ = ps.getParameter("SiStripDigiCollectionDM"); - } - else{ - //Tracks: - edm::ConsumesCollector iC(consumesCollector()); - GeneralTrackWorker_ = DigiAccumulatorMixModFactory::get()->makeDigiAccumulator(ps.getParameterSet("tracker"), *this, iC).release(); + if(useSiStripRawDigi_) { + + produces< edm::DetSetVector > (SiStripDigiCollectionDM_); + SiStripRawWorker_ = new DataMixingSiStripRawWorker(ps, consumesCollector()); + + } else { + + produces< edm::DetSetVector > (SiStripDigiCollectionDM_); + + SiStripWorker_ = new DataMixingSiStripWorker(ps, consumesCollector()); } + // Pixels + + PixelDigiCollectionDM_ = ps.getParameter("PixelDigiCollectionDM"); + + produces< edm::DetSetVector > (PixelDigiCollectionDM_); + + SiPixelWorker_ = new DataMixingSiPixelWorker(ps, consumesCollector()); + + // Pileup Information: if doing pre-mixing, we have to save the pileup information from the Secondary stream MergePileup_ = ps.getParameter("MergePileupInfo"); @@ -267,36 +246,21 @@ namespace edm void DataMixingModule::initializeEvent(const edm::Event &e, const edm::EventSetup& ES) { - - if( addMCDigiNoise_ ) { - if(!MergeTrackerDigis_){ - GeneralTrackWorker_->initializeEvent(e,ES); - } - } - if( addMCDigiNoise_ && MergeHcalDigisProd_) { - HcalDigiWorkerProd_->initializeEvent( e, ES ); - } } void DataMixingModule::beginRun(edm::Run const& run, const edm::EventSetup& ES) { BMixingModule::beginRun( run, ES); - if( addMCDigiNoise_ ) { - HcalDigiWorkerProd_->beginRun( run, ES ); - } } void DataMixingModule::endRun(edm::Run const& run, const edm::EventSetup& ES) { - //if( addMCDigiNoise_ ) { - // HcalDigiWorkerProd_->endRun( run, ES ); // FIXME not implemented - //} BMixingModule::endRun( run, ES); } // Virtual destructor needed. DataMixingModule::~DataMixingModule() { if(MergeEMDigis_){ - if(!addMCDigiNoise_ ) {delete EMDigiWorker_;} + delete EMDigiWorker_; } else {delete EMWorker_;} if(MergeHcalDigis_) { @@ -304,15 +268,10 @@ namespace edm else { delete HcalDigiWorker_; }} else {delete HcalWorker_;} if(MuonWorker_) delete MuonWorker_; - if(MergeTrackerDigis_){ - if(useSiStripRawDigi_) - delete SiStripRawWorker_; - else if(!addMCDigiNoise_) delete SiStripWorker_; - if(!addMCDigiNoise_) delete SiPixelWorker_; - } - else{ - delete GeneralTrackWorker_; - } + if(useSiStripRawDigi_) + delete SiStripRawWorker_; + else delete SiStripWorker_; + delete SiPixelWorker_; if(MergePileup_) { delete PUWorker_;} } @@ -323,7 +282,7 @@ namespace edm // Ecal if(MergeEMDigis_) { - if(!addMCDigiNoise_ ){EMDigiWorker_->addEMSignals(e, ES); } + EMDigiWorker_->addEMSignals(e, ES); } else{ EMWorker_->addEMSignals(e);} @@ -341,17 +300,12 @@ namespace edm // Muon MuonWorker_->addMuonSignals(e); - if(MergeTrackerDigis_){ - // SiStrips - if(useSiStripRawDigi_) SiStripRawWorker_->addSiStripSignals(e); - else SiStripWorker_->addSiStripSignals(e); - - // SiPixels - if(!addMCDigiNoise_ ) SiPixelWorker_->addSiPixelSignals(e); - }else{ - //GeneralTrackWorker_->addGeneralTrackSignal(e); - GeneralTrackWorker_->accumulate(e,ES); - } + // SiStrips + if(useSiStripRawDigi_) SiStripRawWorker_->addSiStripSignals(e); + else SiStripWorker_->addSiStripSignals(e); + + // SiPixels + SiPixelWorker_->addSiPixelSignals(e); AddedPileup_ = false; } // end of addSignals @@ -386,7 +340,7 @@ namespace edm // Ecal if(MergeEMDigis_) { - if(!addMCDigiNoise_ ) { EMDigiWorker_->addEMPileups(bcr, &ep, eventNr, ES, &moduleCallingContext);} + EMDigiWorker_->addEMPileups(bcr, &ep, eventNr, ES, &moduleCallingContext); } else {EMWorker_->addEMPileups(bcr, &ep, eventNr, &moduleCallingContext); } @@ -403,18 +357,13 @@ namespace edm // Muon MuonWorker_->addMuonPileups(bcr, &ep, eventNr, &moduleCallingContext); - if(MergeTrackerDigis_){ - // SiStrips - if(useSiStripRawDigi_) SiStripRawWorker_->addSiStripPileups(bcr, &ep, eventNr, &moduleCallingContext); - else SiStripWorker_->addSiStripPileups(bcr, &ep, eventNr, &moduleCallingContext); - - // SiPixels - //whoops this should be for the MC worker ????? SiPixelWorker_->setPileupInfo(ps,bunchSpacing); - if(!addMCDigiNoise_ ) SiPixelWorker_->addSiPixelPileups(bcr, &ep, eventNr, &moduleCallingContext); - }else{ - PileUpEventPrincipal pep(ep,&moduleCallingContext,bcr); - GeneralTrackWorker_->accumulate(pep, ES,ep.streamID()); - } + // SiStrips + if(useSiStripRawDigi_) SiStripRawWorker_->addSiStripPileups(bcr, &ep, eventNr, &moduleCallingContext); + else SiStripWorker_->addSiStripPileups(bcr, &ep, eventNr, &moduleCallingContext); + + // SiPixels + //whoops this should be for the MC worker ????? SiPixelWorker_->setPileupInfo(ps,bunchSpacing); + SiPixelWorker_->addSiPixelPileups(bcr, &ep, eventNr, &moduleCallingContext); } @@ -447,9 +396,6 @@ namespace edm NumPU_Events = 1; } - if(!MergeTrackerDigis_) - GeneralTrackWorker_->initializeBunchCrossing(e, ES, bunchCrossing); - source->readPileUp( e.id(), recordEventID, @@ -458,10 +404,6 @@ namespace edm NumPU_Events, e.streamID() ); - - if(!MergeTrackerDigis_) - GeneralTrackWorker_->finalizeBunchCrossing(e, ES, bunchCrossing); - } } @@ -484,7 +426,7 @@ namespace edm // Ecal if(MergeEMDigis_) { - if(!addMCDigiNoise_ ) { EMDigiWorker_->putEM(e,ES);} + EMDigiWorker_->putEM(e,ES); } else {EMWorker_->putEM(e);} @@ -502,16 +444,12 @@ namespace edm // Muon MuonWorker_->putMuon(e); - if(MergeTrackerDigis_){ - // SiStrips - if(useSiStripRawDigi_) SiStripRawWorker_->putSiStrip(e); - else SiStripWorker_->putSiStrip(e); - - // SiPixels - if(!addMCDigiNoise_ ) SiPixelWorker_->putSiPixel(e); - }else{ - GeneralTrackWorker_->finalizeEvent(e,ES); - } + // SiStrips + if(useSiStripRawDigi_) SiStripRawWorker_->putSiStrip(e); + else SiStripWorker_->putSiStrip(e); + + // SiPixels + SiPixelWorker_->putSiPixel(e); } void DataMixingModule::beginLuminosityBlock(LuminosityBlock const& l1, EventSetup const& c) { diff --git a/SimGeneral/DataMixingModule/plugins/DataMixingModule.h b/SimGeneral/DataMixingModule/plugins/DataMixingModule.h index 356bfe2cf40f6..46feeb074567a 100644 --- a/SimGeneral/DataMixingModule/plugins/DataMixingModule.h +++ b/SimGeneral/DataMixingModule/plugins/DataMixingModule.h @@ -38,8 +38,6 @@ #include #include -class DigiAccumulatorMixMod; - namespace edm { class ModuleCallingContext; @@ -165,17 +163,12 @@ namespace edm { DataMixingSiStripWorker *SiStripWorker_ ; DataMixingSiStripRawWorker *SiStripRawWorker_ ; bool useSiStripRawDigi_; - bool addMCDigiNoise_; std::string siStripRawDigiSource_; // Pixels DataMixingSiPixelWorker *SiPixelWorker_ ; - // Tracks - - DigiAccumulatorMixMod * GeneralTrackWorker_; - virtual void getSubdetectorNames(); diff --git a/SimGeneral/DataMixingModule/python/mixOne_data_on_data_cfi.py b/SimGeneral/DataMixingModule/python/mixOne_data_on_data_cfi.py index 2d98b6a9fab72..9e95bd805f1e5 100644 --- a/SimGeneral/DataMixingModule/python/mixOne_data_on_data_cfi.py +++ b/SimGeneral/DataMixingModule/python/mixOne_data_on_data_cfi.py @@ -24,7 +24,6 @@ # mixProdStep1 = cms.bool(False), mixProdStep2 = cms.bool(False), - TrackerMergeType = cms.string('Digis'), # kludge for fast simulation flag... # Use digis? EcalMergeType = cms.string('Digis'), # set to "Digis" to merge digis HcalMergeType = cms.string('Digis'), diff --git a/SimGeneral/DataMixingModule/python/mixOne_data_on_sim_cfi.py b/SimGeneral/DataMixingModule/python/mixOne_data_on_sim_cfi.py index a964a04135f64..ad2d418b9227e 100644 --- a/SimGeneral/DataMixingModule/python/mixOne_data_on_sim_cfi.py +++ b/SimGeneral/DataMixingModule/python/mixOne_data_on_sim_cfi.py @@ -33,7 +33,6 @@ mixProdStep1 = cms.bool(False), mixProdStep2 = cms.bool(False), # Use digis? - TrackerMergeType = cms.string("Digis"), EcalMergeType = cms.string('Digis'), # set to "Digis" to merge digis HcalMergeType = cms.string('Digis'), HcalDigiMerge = cms.string('FullProd'), diff --git a/SimGeneral/DataMixingModule/python/mixOne_sim_on_sim_cfi.py b/SimGeneral/DataMixingModule/python/mixOne_sim_on_sim_cfi.py index 8aae886968617..6bfae7bdaacd7 100644 --- a/SimGeneral/DataMixingModule/python/mixOne_sim_on_sim_cfi.py +++ b/SimGeneral/DataMixingModule/python/mixOne_sim_on_sim_cfi.py @@ -25,7 +25,6 @@ # Merge Pileup Info? MergePileupInfo = cms.bool(True), # Use digis? - TrackerMergeType = cms.string("Digis"), EcalMergeType = cms.string('Digis'), # set to "Digis" to merge digis HcalMergeType = cms.string('Digis'), HcalDigiMerge = cms.string('NotProd'), #use sim hits for signal From 9b3f584ab3a536a7213e9167f352956f33d869e4 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Thu, 1 Mar 2018 13:12:53 +0100 Subject: [PATCH 040/426] Hack to preserve random number sequences wrt. old DataMixingModule To be removed after this re-engineering has been merged. --- .../plugins/PreMixingModule.cc | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/SimGeneral/PreMixingModule/plugins/PreMixingModule.cc b/SimGeneral/PreMixingModule/plugins/PreMixingModule.cc index d67b6bb37b131..12121fc5699fb 100644 --- a/SimGeneral/PreMixingModule/plugins/PreMixingModule.cc +++ b/SimGeneral/PreMixingModule/plugins/PreMixingModule.cc @@ -63,6 +63,27 @@ namespace edm { { const auto& workers = ps.getParameter("workers"); std::vector names = workers.getParameterNames(); + + // Hack to keep the random number sequence unchanged for migration + // from DataMixingModule to PreMixingModule. To be removed in a + // subsequent PR doing only that. + { + std::vector tmp; + auto hack = [&](const std::string& name) { + auto i = std::find(names.begin(), names.end(), name); + if(i != names.end()) { + tmp.push_back(*i); + names.erase(i); + } + }; + hack("ecal"); + hack("hcal"); + hack("strip"); + hack("pixel"); + std::copy(names.begin(), names.end(), std::back_inserter(tmp)); + names = std::move(tmp); + } + for(const auto& name: names) { if(name == "pileup") { continue; From 52bef2a5fdd1494d719e8c1ffe8f6963aeb07381 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Fri, 2 Mar 2018 11:41:59 +0100 Subject: [PATCH 041/426] Code checks --- .../PreMixingModule/plugins/PreMixingTrackingParticleWorker.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SimGeneral/PreMixingModule/plugins/PreMixingTrackingParticleWorker.cc b/SimGeneral/PreMixingModule/plugins/PreMixingTrackingParticleWorker.cc index 033d25039c01b..ba1636376c691 100644 --- a/SimGeneral/PreMixingModule/plugins/PreMixingTrackingParticleWorker.cc +++ b/SimGeneral/PreMixingModule/plugins/PreMixingTrackingParticleWorker.cc @@ -97,7 +97,7 @@ namespace edm { // grab tracks, store copy for(const auto& track: particles) { - auto oldRef=track.parentVertex(); + const auto& oldRef=track.parentVertex(); auto newRef=TrackingVertexRef( VertexListRef_, oldRef.index()+StartingIndexV ); NewTrackList_->push_back(track); From ca0635560314488cb1deb2033da9ac558b1eab48 Mon Sep 17 00:00:00 2001 From: Hans Van Haevermaet Date: Fri, 2 Mar 2018 16:30:48 +0100 Subject: [PATCH 042/426] clean up + remove obsolete factor 2 + fix memory leak --- RecoLocalCalo/Castor/src/RecHitCorrector.cc | 30 +++++++-------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/RecoLocalCalo/Castor/src/RecHitCorrector.cc b/RecoLocalCalo/Castor/src/RecHitCorrector.cc index 30b1f5a0653a6..633765e8c10a7 100644 --- a/RecoLocalCalo/Castor/src/RecHitCorrector.cc +++ b/RecoLocalCalo/Castor/src/RecHitCorrector.cc @@ -114,7 +114,7 @@ RecHitCorrector::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) iSetup.get().get(p); CastorChannelQuality* myqual = new CastorChannelQuality(*p.product()); - if (!rechits.isValid()) std::cout << "No valid CastorRecHitCollection found, please check the InputLabel..." << std::endl; + if (!rechits.isValid()) edm::LogWarning("CastorRecHitCorrector") << "No valid CastorRecHitCollection found, please check the InputLabel..."; CastorCalibrations calibrations; @@ -122,10 +122,8 @@ RecHitCorrector::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) for (unsigned int i=0;isize();i++) { CastorRecHit rechit = (*rechits)[i]; - //std::cout << "rechit energy = " << rechit.energy() << std::endl; double fC = factor_*rechit.energy(); double time = rechit.time(); - //std::cout << "rechit energy(fC) = " << fC << " time = " << time << std::endl; // do proper gain calibration reading the latest entries in the condDB const CastorCalibrations& calibrations=conditions->getCastorCalibrations(rechit.id()); @@ -133,40 +131,30 @@ RecHitCorrector::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) double correctedenergy = 0; if (doInterCalib_) { - if (rechit.id().module() <= 2) { - correctedenergy = 0.5*fC*calibrations.gain(capid); - //std::cout << " correctedenergy = " << correctedenergy << " gain = " << calibrations.gain(capid) << std::endl; - } else { - correctedenergy = fC*calibrations.gain(capid); - } + correctedenergy = fC*calibrations.gain(capid); } else { - if (rechit.id().module() <= 2) { - correctedenergy = 0.5*fC; - } else { - correctedenergy = fC; - } + correctedenergy = fC; } // now check the channelquality of this rechit bool ok = true; DetId detcell=(DetId)rechit.id(); std::vector channels = myqual->getAllChannels(); - //std::cout << "number of specified quality flags = " << channels.size() << std::endl; - for (std::vector::iterator channel = channels.begin();channel != channels.end();channel++) { - if (channel->rawId() == detcell.rawId()) { - const CastorChannelStatus* mydigistatus=myqual->getValues(*channel); - //std::cout << "CastorChannelStatus = " << mydigistatus->getValue() << std::endl; + for (auto channel : channels) { + if (channel.rawId() == detcell.rawId()) { + const CastorChannelStatus* mydigistatus=myqual->getValues(channel); if (mydigistatus->getValue() == 2989) ok = false; // 2989 = BAD } } if (ok) { - CastorRecHit *correctedhit = new CastorRecHit(rechit.id(),correctedenergy,time); - rec->push_back(*correctedhit); + rec->emplace_back(rechit.id(),correctedenergy,time); } } iEvent.put(std::move(rec)); + + delete myqual; } From dece384126ef2167bfcda6be8725540540e4bcb2 Mon Sep 17 00:00:00 2001 From: brooks mcmaster Date: Fri, 9 Feb 2018 15:32:15 -0600 Subject: [PATCH 043/426] New CaloTower profiles and histos from Salavat Abdoulline --- .../CaloTowers/src/CaloTowersValidation.cc | 25 +- Validation/CaloTowers/test/macros/SinglePi.C | 229 +++++++++++---- .../macros/html_indices/SinglePiScan.html | 264 ++++++++++-------- 3 files changed, 345 insertions(+), 173 deletions(-) diff --git a/Validation/CaloTowers/src/CaloTowersValidation.cc b/Validation/CaloTowers/src/CaloTowersValidation.cc index d84c63d67dcdb..7d89c06468180 100644 --- a/Validation/CaloTowers/src/CaloTowersValidation.cc +++ b/Validation/CaloTowers/src/CaloTowersValidation.cc @@ -67,15 +67,12 @@ void CaloTowersValidation::bookHistograms(DQMStore::IBooker & ibooker, edm::Run //These the single pion scan histos //------------------------------------------------------------------------------------------- - //The first three are not used - if (useAllHistos_){ - sprintf (histo, "emean_vs_ieta_E" ); - emean_vs_ieta_E = ibooker.bookProfile(histo, histo, 83, -41.5, 41.5, -100., 2000., " "); - sprintf (histo, "emean_vs_ieta_H" ); - emean_vs_ieta_H = ibooker.bookProfile(histo, histo, 83, -41.5, 41.5, -100., 2000., " "); - sprintf (histo, "emean_vs_ieta_EH" ); - emean_vs_ieta_EH = ibooker.bookProfile(histo, histo, 83, -41.5, 41.5, -100., 2000., " "); - } + sprintf (histo, "emean_vs_ieta_E" ); + emean_vs_ieta_E = ibooker.bookProfile(histo, histo, 83, -41.5, 41.5, -100., 2000., " "); + sprintf (histo, "emean_vs_ieta_H" ); + emean_vs_ieta_H = ibooker.bookProfile(histo, histo, 83, -41.5, 41.5, -100., 2000., " "); + sprintf (histo, "emean_vs_ieta_EH" ); + emean_vs_ieta_EH = ibooker.bookProfile(histo, histo, 83, -41.5, 41.5, -100., 2000., " "); //These are drawn sprintf (histo, "emean_vs_ieta_E1" ); emean_vs_ieta_E1 = ibooker.bookProfile(histo, histo, 83, -41.5, 41.5, -100., 2000., " "); @@ -721,12 +718,10 @@ void CaloTowersValidation::analyze(edm::Event const& event, edm::EventSetup cons } // end of Towers cycle - //These are the six single pion histos; only the second set is used - if (useAllHistos_){ - emean_vs_ieta_E -> Fill(double(ieta_MC), Econe); - emean_vs_ieta_H -> Fill(double(ieta_MC), Hcone); - emean_vs_ieta_EH -> Fill(double(ieta_MC), Econe+Hcone); - } + //These are the six single pion histos + emean_vs_ieta_E -> Fill(double(ieta_MC), Econe); + emean_vs_ieta_H -> Fill(double(ieta_MC), Hcone); + emean_vs_ieta_EH -> Fill(double(ieta_MC), Econe+Hcone); emean_vs_ieta_E1 -> Fill(double(ieta_MC), Ee1); emean_vs_ieta_H1 -> Fill(double(ieta_MC), Eh1); emean_vs_ieta_EH1 -> Fill(double(ieta_MC), Ee1+Eh1); diff --git a/Validation/CaloTowers/test/macros/SinglePi.C b/Validation/CaloTowers/test/macros/SinglePi.C index cfae4919ba8c8..b40d5d4027976 100644 --- a/Validation/CaloTowers/test/macros/SinglePi.C +++ b/Validation/CaloTowers/test/macros/SinglePi.C @@ -43,7 +43,7 @@ void SinglePi(const TString ref_vers, const TString val_vers, bool fastsim){ // service variables // //Profiles - const int Nprof = 12; + const int Nprof = 15; TProfile* f1_prof[Nprof]; TProfile* f2_prof[Nprof]; @@ -51,7 +51,7 @@ void SinglePi(const TString ref_vers, const TString val_vers, bool fastsim){ char labelp[Nprof][64]; //1D Histos - const int Nhist1 = 7; + const int Nhist1 = 11; TH1* f1_hist1[Nhist1]; TH1* f2_hist1[Nhist1]; @@ -76,7 +76,9 @@ void SinglePi(const TString ref_vers, const TString val_vers, bool fastsim){ sprintf(labelp[10], "RecHitsTask_timing_vs_energy_profile_HE.gif"); sprintf(labelp[11], "RecHitsTask_timing_vs_energy_profile_HF.gif"); - + sprintf(labelp[12], "CaloTowersTask_emean_vs_ieta_E.gif"); + sprintf(labelp[13], "CaloTowersTask_emean_vs_ieta_H.gif"); + sprintf(labelp[14], "CaloTowersTask_emean_vs_ieta_EH.gif"); //1D Histos sprintf(label1[0], "N_calotowers_HB.gif"); @@ -88,6 +90,13 @@ void SinglePi(const TString ref_vers, const TString val_vers, bool fastsim){ sprintf(label1[5], "RecHits_energy_HO.gif"); sprintf(label1[6], "RecHits_energy_HF.gif"); + sprintf(label1[7], "Ndigis_HB.gif" ); + sprintf(label1[8], "Ndigis_HE.gif" ); + sprintf(label1[9], "Ndigis_HO.gif" ); + sprintf(label1[10], "Ndigis_HF.gif" ); + + // REFERENCE FILE + TDirectory *td = fileDirectory(&f1, "CaloTowersTask"); //f1.cd("DQMData/CaloTowersV/CaloTowersTask"); //gDirectory->pwd(); @@ -96,6 +105,10 @@ void SinglePi(const TString ref_vers, const TString val_vers, bool fastsim){ f1_prof[1] = (TProfile*)td->Get("emean_vs_ieta_H1"); f1_prof[2] = (TProfile*)td->Get("emean_vs_ieta_EH1"); + f1_prof[12] = (TProfile*)td->Get("emean_vs_ieta_E"); + f1_prof[13] = (TProfile*)td->Get("emean_vs_ieta_H"); + f1_prof[14] = (TProfile*)td->Get("emean_vs_ieta_EH"); + f1_hist1[0] = (TH1*)td->Get("CaloTowersTask_number_of_fired_towers_HB"); f1_hist1[1] = (TH1*)td->Get("CaloTowersTask_number_of_fired_towers_HE"); f1_hist1[2] = (TH1*)td->Get("CaloTowersTask_number_of_fired_towers_HF"); @@ -115,6 +128,14 @@ void SinglePi(const TString ref_vers, const TString val_vers, bool fastsim){ f1_hist1[5] = (TH1*)td->Get("HcalRecHitTask_energy_of_rechits_HO"); f1_hist1[6] = (TH1*)td->Get("HcalRecHitTask_energy_of_rechits_HF"); + + td = fileDirectory(&f1, "HcalDigiTask"); + f1_hist1[7] = (TH1*)td->Get("HcalDigiTask_Ndigis_HB"); + f1_hist1[8] = (TH1*)td->Get("HcalDigiTask_Ndigis_HE"); + f1_hist1[9] = (TH1*)td->Get("HcalDigiTask_Ndigis_HO"); + f1_hist1[10] = (TH1*)td->Get("HcalDigiTask_Ndigis_HF"); + + if (!fastsim) { td = fileDirectory(&f1, "HcalSimHitTask"); //f1.cd("DQMData/HcalSimHitsV/HcalSimHitTask"); @@ -123,6 +144,8 @@ void SinglePi(const TString ref_vers, const TString val_vers, bool fastsim){ f1_prof[8] = (TProfile*)td->Get("HcalSimHitTask_En_simhits_cone_profile_vs_ieta_all_depths_EH"); } + // NEW FILE + td = fileDirectory(&f2, "CaloTowersTask"); //f2.cd("DQMData/CaloTowersV/CaloTowersTask"); //gDirectory->pwd(); @@ -131,6 +154,10 @@ void SinglePi(const TString ref_vers, const TString val_vers, bool fastsim){ f2_prof[1] = (TProfile*)td->Get("emean_vs_ieta_H1"); f2_prof[2] = (TProfile*)td->Get("emean_vs_ieta_EH1"); + f2_prof[12] = (TProfile*)td->Get("emean_vs_ieta_E"); + f2_prof[13] = (TProfile*)td->Get("emean_vs_ieta_H"); + f2_prof[14] = (TProfile*)td->Get("emean_vs_ieta_EH"); + f2_hist1[0] = (TH1*)td->Get("CaloTowersTask_number_of_fired_towers_HB"); f2_hist1[1] = (TH1*)td->Get("CaloTowersTask_number_of_fired_towers_HE"); f2_hist1[2] = (TH1*)td->Get("CaloTowersTask_number_of_fired_towers_HF"); @@ -150,6 +177,12 @@ void SinglePi(const TString ref_vers, const TString val_vers, bool fastsim){ f2_hist1[5] = (TH1*)td->Get("HcalRecHitTask_energy_of_rechits_HO"); f2_hist1[6] = (TH1*)td->Get("HcalRecHitTask_energy_of_rechits_HF"); + td = fileDirectory(&f1, "HcalDigiTask"); + f2_hist1[7] = (TH1*)td->Get("HcalDigiTask_Ndigis_HB"); + f2_hist1[8] = (TH1*)td->Get("HcalDigiTask_Ndigis_HE"); + f2_hist1[9] = (TH1*)td->Get("HcalDigiTask_Ndigis_HO"); + f2_hist1[10] = (TH1*)td->Get("HcalDigiTask_Ndigis_HF"); + if (!fastsim) { td = fileDirectory(&f2, "HcalSimHitTask"); //f2.cd("DQMData/HcalSimHitsV/HcalSimHitTask"); @@ -158,24 +191,34 @@ void SinglePi(const TString ref_vers, const TString val_vers, bool fastsim){ f2_prof[8] = (TProfile*)td->Get("HcalSimHitTask_En_simhits_cone_profile_vs_ieta_all_depths_EH"); } - //Profiles + + + //Profiles titles f1_prof[0]->GetXaxis()->SetTitle("CaloTowers eE (GeV) vs ieta 1 Tower"); f1_prof[1]->GetXaxis()->SetTitle("CaloTowers hE (GeV) vs ieta 1 Tower"); f1_prof[2]->GetXaxis()->SetTitle("CaloTowers eE+hE (GeV) vs ieta 1 Tower"); + + f1_prof[3]->GetXaxis()->SetTitle("RecHits eE (GeV) vs ieta R = 0.3 Cone"); f1_prof[4]->GetXaxis()->SetTitle("RecHits hE (GeV) vs ieta R = 0.3 Cone"); f1_prof[5]->GetXaxis()->SetTitle("RecHits eE+hE (GeV) vs ieta R = 0.3 Cone"); + if (!fastsim) { f1_prof[6]->GetXaxis()->SetTitle("SimHits eE (GeV) vs ieta R = 0.3 Cone"); f1_prof[7]->GetXaxis()->SetTitle("SimHits hE (GeV) vs ieta R = 0.3 Cone"); f1_prof[8]->GetXaxis()->SetTitle("SimHits eE+hE (GeV) vs ieta R = 0.3 Cone"); } + f1_prof[9]->GetXaxis()->SetTitle("HB RecHits timing (ns) vs Energy (GeV)"); f1_prof[10]->GetXaxis()->SetTitle("HE RecHits timing (ns) vs Energy (GeV)"); f1_prof[11]->GetXaxis()->SetTitle("HF RecHits timing (ns) vs Energy (GeV)"); + f1_prof[12]->GetXaxis()->SetTitle("CaloTowers eE Rcone sum (GeV) vs ieta"); + f1_prof[13]->GetXaxis()->SetTitle("CaloTowers hE Rcone sumn (GeV) vs ieta"); + f1_prof[14]->GetXaxis()->SetTitle("CaloTowers eE+hE Rcone sum (GeV) vs ieta "); - //1D Histos + + //1D Histos titles f1_hist1[0]->GetXaxis()->SetTitle("Number of HB CaloTowers"); f1_hist1[1]->GetXaxis()->SetTitle("Number of HE CaloTowers"); f1_hist1[2]->GetXaxis()->SetTitle("Number of HF CaloTowers"); @@ -185,53 +228,74 @@ void SinglePi(const TString ref_vers, const TString val_vers, bool fastsim){ f1_hist1[5]->GetXaxis()->SetTitle("HO RecHits energy (GeV)"); f1_hist1[6]->GetXaxis()->SetTitle("HF RecHits energy (GeV)"); + f1_hist1[7]->GetXaxis()->SetTitle("N_HB Digis"); + f1_hist1[8]->GetXaxis()->SetTitle("N_HE Digis"); + f1_hist1[9]->GetXaxis()->SetTitle("N_H0 Digis"); + f1_hist1[10]->GetXaxis()->SetTitle("N_HF Digis"); + + + // - f1_prof[0]->SetMaximum(20.); + f1_prof[0]->SetMaximum(20.); // CaloTowers 1 f1_prof[1]->SetMaximum(40.); f1_prof[2]->SetMaximum(40.); - f1_prof[4]->SetMaximum(50.); - f1_prof[5]->SetMaximum(50.); - - f1_prof[0]->SetMinimum(0.); - f1_prof[1]->SetMinimum(0.); + f1_prof[0]->SetMinimum(0.); // idem + f1_prof[1]->SetMinimum(0.); f1_prof[2]->SetMinimum(0.); + + f1_prof[3]->SetMaximum(30.); // RecHits R==0.3 + f1_prof[4]->SetMaximum(50.); + f1_prof[5]->SetMaximum(60.); f1_prof[3]->SetMinimum(0.); f1_prof[4]->SetMinimum(0.); f1_prof[5]->SetMinimum(0.); - if (!fastsim) { + + if (!fastsim) { // SimHits R=0.3 f1_prof[6]->SetMinimum(0.); f1_prof[7]->SetMinimum(0.); f1_prof[8]->SetMinimum(0.); + f1_prof[6]->SetMaximum(20.); + f1_prof[7]->SetMaximum(80.); + f1_prof[8]->SetMaximum(80.); } + + f1_prof[9]->SetMinimum(-25.); // RecHits Timing + f1_prof[10]->SetMinimum(-25.); + f1_prof[11]->SetMinimum(-25.); + f1_prof[9]->SetMaximum(25.); + f1_prof[10]->SetMaximum(25.); + f1_prof[11]->SetMaximum(25.); + + + f1_prof[12]->SetMaximum(30.); // CaloTowers R=0.3 added + f1_prof[13]->SetMaximum(50.); + f1_prof[14]->SetMaximum(60.); + f1_prof[12]->SetMinimum(0.); + f1_prof[13]->SetMinimum(0.); + f1_prof[14]->SetMinimum(0.); + + f1_prof[9]->GetXaxis()->SetRangeUser(0.,75.); f1_prof[10]->GetXaxis()->SetRangeUser(0.,75.); f1_prof[11]->GetXaxis()->SetRangeUser(0.,75.); - /* - f1_prof[9]->SetMinimum(0.); - f1_prof[10]->SetMinimum(0.); - f1_prof[11]->SetMinimum(0.); - */ - - + + - // f1_hist[2]->GetXaxis()->SetRangeUser(0.,1200.); - // f1_hist[7]->GetXaxis()->SetRangeUser(0.,160.); - // hist1->GetXaxis()->SetNdivisions(-21); - // hist1->GetYaxis()->SetNdivisions(-1003); + // 1D HISTOS - f1_hist1[0]->GetXaxis()->SetRangeUser(0.,100.); - f2_hist1[0]->GetXaxis()->SetRangeUser(0.,100.); + f1_hist1[0]->GetXaxis()->SetRangeUser(0.,200.); // N_CaloTowers + f2_hist1[0]->GetXaxis()->SetRangeUser(0.,200.); f1_hist1[1]->GetXaxis()->SetRangeUser(0.,150.); f2_hist1[1]->GetXaxis()->SetRangeUser(0.,150.); - f1_hist1[2]->GetXaxis()->SetRangeUser(0.,100.); - f2_hist1[2]->GetXaxis()->SetRangeUser(0.,100.); + f1_hist1[2]->GetXaxis()->SetRangeUser(0.,500.); + f2_hist1[2]->GetXaxis()->SetRangeUser(0.,500.); - f1_hist1[3]->GetXaxis()->SetRangeUser(0.,100.); + f1_hist1[3]->GetXaxis()->SetRangeUser(0.,100.); // RecHits spectra f2_hist1[3]->GetXaxis()->SetRangeUser(0.,100.); f1_hist1[4]->GetXaxis()->SetRangeUser(0.,100.); @@ -248,6 +312,20 @@ void SinglePi(const TString ref_vers, const TString val_vers, bool fastsim){ f1_hist1[5]->SetMaximum(1.e8); f1_hist1[6]->SetMaximum(1.e8); + f1_hist1[7]->GetXaxis()->SetRangeUser(0.,1000); // N_Digis + f2_hist1[7]->GetXaxis()->SetRangeUser(0.,1000); + + f1_hist1[8]->GetXaxis()->SetRangeUser(0.,200); + f2_hist1[8]->GetXaxis()->SetRangeUser(0.,200); + + f1_hist1[9]->GetXaxis()->SetRangeUser(0.,100); + f2_hist1[9]->GetXaxis()->SetRangeUser(0.,100); + + f1_hist1[10]->GetXaxis()->SetRangeUser(0.,3500); + f2_hist1[10]->GetXaxis()->SetRangeUser(0.,3500); + + + // gStyle->SetErrorX(0); // 1D-histo @@ -257,7 +335,7 @@ void SinglePi(const TString ref_vers, const TString val_vers, bool fastsim){ TCanvas *myc = new TCanvas("myc","",800,600); gStyle->SetOptStat(1111); - if(i > 2) myc->SetLogy(); + if(i > 2 && i < 7) myc->SetLogy(); f1_hist1[i]->SetStats(kTRUE); // stat box f2_hist1[i]->SetStats(kTRUE); @@ -297,23 +375,27 @@ void SinglePi(const TString ref_vers, const TString val_vers, bool fastsim){ ptstats2->SetParent(f2_hist1[i]->GetListOfFunctions()); f1_hist1[i]->Draw(""); // "stat" - f2_hist1[i]->Draw("histsames"); + f2_hist1[i]->Draw("hist sames"); leg->Draw(); myc->SaveAs(label1[i]); if(myc) delete myc; + + std::cout << "1D histos " << i << " produced" << std::endl; + } + // Profiles for (int i = 0; i < Nprof; i++){ TCanvas *myc = new TCanvas("myc","",800,600); bool skipHisto = false; - if (fastsim && i>=6 && i<=8) skipHisto = true; + if (fastsim && i>=6 && i<=8) skipHisto = true; // SimHits to exclude if (!skipHisto) { f1_prof[i]->SetStats(kFALSE); @@ -337,22 +419,25 @@ void SinglePi(const TString ref_vers, const TString val_vers, bool fastsim){ f2_prof[i]->SetMarkerStyle(20); f2_prof[i]->SetMarkerSize(0.8); - if(i > 8 ) { + if(i > 8 && i < 12) { // Timing f1_prof[i]->SetMarkerSize(0.1); f2_prof[i]->SetMarkerSize(0.3); } myc->SetGrid(); - - if( i <= 8) { - f1_prof[i]->Draw("histpl"); - f2_prof[i]->Draw("histplsame"); // esame + + if( i <= 8 || i >= 12) { // Other than RecHits timing + f1_prof[i]->Draw("histpl "); + f2_prof[i]->Draw("histplsame"); // } else { - f1_prof[i]->Draw("pl"); - f2_prof[i]->Draw("plsame"); // esame + f1_prof[i]->Draw("pl"); // RecHits Timing + f2_prof[i]->Draw("pl same"); // } + f1_prof[i]->GetOption(); + f2_prof[i]->GetOption(); + TLegend *leg = new TLegend(0.40, 0.91, 0.74, 0.99, "","brNDC"); leg->SetBorderSize(2); @@ -365,29 +450,77 @@ void SinglePi(const TString ref_vers, const TString val_vers, bool fastsim){ myc->SaveAs(labelp[i]); } if(myc) delete myc; + + std::cout << "Profile " << i << " produced" << std::endl; + + } - TCanvas *myc = new TCanvas("myc","",800,600); + + + // RATIO CaloTower 1 + + + TCanvas *myc1 = new TCanvas("myc1","",800,600); TProfile* ratio1 = (TProfile*)f2_prof[2]->Clone(); ratio1->Divide(f1_prof[2]); ratio1->SetMaximum(1.2); ratio1->SetMinimum(0.8); - myc->SetGrid(); + myc1->SetGrid(); ratio1->Draw("hist pl"); - TLegend *leg = new TLegend(0.20, 0.91, 0.70, 0.99, "","brNDC"); - leg->SetBorderSize(2); - leg->SetFillStyle(1001); - leg->AddEntry(ratio1,"CaloTowers scale (pi50) ratio "+val_vers+"/"+ref_vers+" vs ieta","pl"); - leg->Draw(""); + TLegend *leg1 = new TLegend(0.20, 0.91, 0.70, 0.99, "","brNDC"); + leg1->SetBorderSize(2); + leg1->SetFillStyle(1001); + leg1->AddEntry(ratio1,"CaloTowers scale (pi50) ratio "+val_vers+"/"+ref_vers+" vs ieta","pl"); + leg1->Draw(""); + + myc1->SaveAs("Ratio.gif"); + + + // RATIO HCAL RecHits in R=0.3 + + TCanvas *myc2 = new TCanvas("myc2","",800,600); + + TProfile* ratio2 = (TProfile*)f2_prof[4]->Clone(); + ratio2->Divide(f1_prof[4]); + ratio2->SetMaximum(1.2); + ratio2->SetMinimum(0.8); + myc2->SetGrid(); + ratio2->Draw("hist pl"); + + TLegend *leg2 = new TLegend(0.10, 0.91, 0.80, 0.99, "","brNDC"); + leg2->SetBorderSize(2); + leg2->SetFillStyle(1001); + leg2->AddEntry(ratio2,"HCAL sum ratio "+val_vers+"/"+ref_vers+" vs ieta","pl"); + leg2->Draw(""); + + myc2->SaveAs("Ratio_Hcone.gif"); + + + // RATIO CaloTowers H sum in R=0.3 + + TCanvas *myc3 = new TCanvas("myc3","",800,600); + + TProfile* ratio3 = (TProfile*)f2_prof[13]->Clone(); + ratio3->Divide(f1_prof[13]); + ratio3->SetMaximum(1.2); + ratio3->SetMinimum(0.8); + myc3->SetGrid(); + ratio3->Draw("hist pl"); + + TLegend *leg3 = new TLegend(0.10, 0.91, 0.80, 0.99, "","brNDC"); + leg3->SetBorderSize(2); + leg3->SetFillStyle(1001); + leg3->AddEntry(ratio3,"CaloTowers HAD in R=0.3 ratio "+val_vers+"/"+ref_vers+" vs ieta","pl"); + leg3->Draw(""); + myc3->SaveAs("Ratio_CaloTowers_Hcone.gif"); - // f1_prof[2]->Draw(); - myc->SaveAs("Ratio.gif"); - // close ROOT files + // close ROOT files =========================================== // f1.Close() ; f2.Close() ; diff --git a/Validation/CaloTowers/test/macros/html_indices/SinglePiScan.html b/Validation/CaloTowers/test/macros/html_indices/SinglePiScan.html index 8eaeed2414fd3..5667a263956e9 100644 --- a/Validation/CaloTowers/test/macros/html_indices/SinglePiScan.html +++ b/Validation/CaloTowers/test/macros/html_indices/SinglePiScan.html @@ -1,110 +1,154 @@ -

- Single pi (e=50GeV) scan of ECAL+HCAL -

- - >>> click on thumbnail to get a full-size plot - -

-


-
-Simulation details:
- - 50k events - - no field
- - no vertex smearing
- - no Triggers
-
-
- -Plotted in this row is the SimHits energy collected in R=0.3 : EM, HAD and EM+HAD without HO
-Plots ====>>> Em component >>> Had component (no HO) >>> Total energy (Em+Had) >>> - -

- - - - - - - - - -


- -Plotted in this row is the HCAL subdetectors RecHits energy (mostly noise with single-pion contributin on the right side
-Plots ====>>> HB >>> HE >>> HO >>> HF - -

- - - - - - - - - - - -


- -Plotted in this row is the RecHits timing vs energy
-Plots ====>>> HB >>> HE >>> HF - -

- - - - - - - - -


- -Plotted in this row is the RecHits energy collected in R=0.3 : EM, HAD and EM+HAD without HO
-Plots ====>>> Em component >>> Had component (no HO) >>> Total energy (Em+Had) >>> - -

- - - - - - - - - -


- -Plotted in the row below is the same quantities as above,
-but for ONE single CaloTower in the event, which is closest to the MC direction of the pion -
-Also added is a plot of the single CaloTower scale ratio (new / previous). -The idea is to avoid any clustering (which masks transition) and to pinpoint each ieta ring in the most simplified and clear way. -

-

-Plots ====>>> Em component >>> Had component (no HO) >>> Total energy (Em+Had) >>> Ratio of total energy
-
- - -

- - - - - - - - -


- -Finally: number of CaloTowers in HB, HE and HF (separately)
- -

- - - - - - -


+

+ Single pi (e=50GeV) scan of ECAL+HCAL +

+ + >>> click on thumbnail to get a full-size plot + +

+


+
+Simulation details:
+ - 50k events + - no field
+ - no vertex smearing
+ - no material in front of Calorimetry
+ - no Triggers
+
+
+ +Plotted in this row is the SimHits energy collected in R=0.3 : EM, HAD and EM+HAD without HO
+Plots ====>>> Em component >>> Had component (no HO) >>> Total energy (Em+Had) >>> + +

+ + + + + + + + + +


+ +
+ +Plotted in this row is the number of Digis per each subdetector
+ +

+ + + + + + + + + + + +


+Plotted in this row is the HCAL subdetectors RecHits energy (mostly noise with single-pion contributin on the right side
+Plots ====>>> HB >>> HE >>> HO >>> HF + +

+ + + + + + + + + + + +


+ +Plotted in this row is the RecHits timing vs energy
+Plots ====>>> HB >>> HE >>> HF + +

+ + + + + + + + +


+ +Plotted in this row is the RecHits energy collected in R=0.3 : EM, HAD and EM+HAD without HO
+Plots ====>>> Em component >>> Had component (no HO) >>> Total energy (Em+Had) >>> Ratio of Had component + +

+ + + + + + + + + + + + +


+ +Plotted in the row below is the same quantities as above,
+but for ONE single CaloTower in the event, which is closest to the MC direction of the pion +
+Also added is a plot of the single CaloTower scale ratio (new / previous). +The idea is to avoid any clustering (which masks transition) and to pinpoint each ieta ring in the most simplified and clear way. +

+

+Plots ====>>> Em component >>> Had component (no HO) >>> Total energy (Em+Had) >>> Ratio of total energy
+
+ + +

+ + + + + + + + +


+ + + +Plotted in the row below is the same quantities as above,
+but for all CaloTowers in the cone R=0.3 around MC direction of the pion +
+Also added is a plot of the HAD cmponent ratio (new / previous). +

+

+Plots ====>>> Em component >>> Had component (no HO) >>> Total energy (Em+Had) >>> Ratio of Had component
+
+

+

+ + + + + + + + +


+ + +Finally: number of CaloTowers in HB, HE and HF (separately)
+ +

+ + + + + + +


From a0a67a7aafc75614c53c1985712fa34eeba13eed Mon Sep 17 00:00:00 2001 From: brooks Date: Mon, 19 Feb 2018 20:50:14 +0100 Subject: [PATCH 044/426] added dynamic scaling factors and more accurate HE thresholds --- Validation/CaloTowers/test/macros/SinglePi.C | 4 ++-- Validation/HcalDigis/src/HcalDigisValidation.cc | 2 +- Validation/HcalHits/interface/HcalSimHitsValidation.h | 3 +++ .../HcalHits/python/HcalSimHitsValidation_cfi.py | 11 ++++++++++- Validation/HcalHits/src/HcalSimHitsValidation.cc | 8 ++++++-- 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Validation/CaloTowers/test/macros/SinglePi.C b/Validation/CaloTowers/test/macros/SinglePi.C index b40d5d4027976..a9ce1ad9c0190 100644 --- a/Validation/CaloTowers/test/macros/SinglePi.C +++ b/Validation/CaloTowers/test/macros/SinglePi.C @@ -256,8 +256,8 @@ void SinglePi(const TString ref_vers, const TString val_vers, bool fastsim){ f1_prof[7]->SetMinimum(0.); f1_prof[8]->SetMinimum(0.); f1_prof[6]->SetMaximum(20.); - f1_prof[7]->SetMaximum(80.); - f1_prof[8]->SetMaximum(80.); + f1_prof[7]->SetMaximum(60.); + f1_prof[8]->SetMaximum(60.); } diff --git a/Validation/HcalDigis/src/HcalDigisValidation.cc b/Validation/HcalDigis/src/HcalDigisValidation.cc index 6d52554756e0c..8fd329fb0e89e 100644 --- a/Validation/HcalDigis/src/HcalDigisValidation.cc +++ b/Validation/HcalDigis/src/HcalDigisValidation.cc @@ -1112,7 +1112,7 @@ template void HcalDigisValidation::reco(const edm::Event& i // fraction 5,6 bins if ampl. is big. //histogram names have not been changed, but it should be understood that bin_5 is soi, and bin_6_7 is latter TS' - if (v_ampl[depth] > 30.) { + if ((v_ampl[depth] > 30. && subdet_ != "HE") || (v_ampl[depth] > 350.)) { double fbinSOI = tool[soi] - calibrations.pedestal((dataFrame)[soi].capid()); double fbinPS = 0; diff --git a/Validation/HcalHits/interface/HcalSimHitsValidation.h b/Validation/HcalHits/interface/HcalSimHitsValidation.h index 3416fe022f1f0..95026a42a3eff 100644 --- a/Validation/HcalHits/interface/HcalSimHitsValidation.h +++ b/Validation/HcalHits/interface/HcalSimHitsValidation.h @@ -109,6 +109,9 @@ class HcalSimHitsValidation : public DQMEDAnalyzer { // counter int nevtot; + // sampling factors + double hf1_; + double hf2_; }; #endif diff --git a/Validation/HcalHits/python/HcalSimHitsValidation_cfi.py b/Validation/HcalHits/python/HcalSimHitsValidation_cfi.py index eb3e435f6e306..4ead49775971c 100644 --- a/Validation/HcalHits/python/HcalSimHitsValidation_cfi.py +++ b/Validation/HcalHits/python/HcalSimHitsValidation_cfi.py @@ -2,7 +2,9 @@ from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer HcalSimHitsAnalyser = DQMEDAnalyzer('HcalSimHitsValidation', - outputFile = cms.untracked.string('') + outputFile = cms.untracked.string(''), + hf1 = cms.double(0.383), + hf2 = cms.double(0.368) ) from Configuration.Eras.Modifier_fastSim_cff import fastSim @@ -10,3 +12,10 @@ from Configuration.Eras.Modifier_run2_HCAL_2017_cff import run2_HCAL_2017 run2_HCAL_2017.toModify( HcalSimHitsAnalyser, TestNumber = cms.untracked.bool(True), EEHitCollection = cms.untracked.string("") ) + +# post-LS1 switch for sampling factors +from Configuration.Eras.Modifier_run2_common_cff import run2_common +run2_common.toModify( HcalSimHitsAnalyser, + hf1 = cms.double(0.67), + hf2 = cms.double(0.67) +) diff --git a/Validation/HcalHits/src/HcalSimHitsValidation.cc b/Validation/HcalHits/src/HcalSimHitsValidation.cc index 2c554cff3569a..4c54a2fa563ed 100644 --- a/Validation/HcalHits/src/HcalSimHitsValidation.cc +++ b/Validation/HcalHits/src/HcalSimHitsValidation.cc @@ -13,6 +13,10 @@ HcalSimHitsValidation::HcalSimHitsValidation(edm::ParameterSet const& conf) { hcalHits_ = conf.getUntrackedParameter("HcalHitCollection","HcalHits"); ebHits_ = conf.getUntrackedParameter("EBHitCollection","EcalHitsEB"); eeHits_ = conf.getUntrackedParameter("EEHitCollection","EcalHitsEE"); + + // import sampling factors + hf1_ = conf.getParameter("hf1"); + hf2_ = conf.getParameter("hf2"); tok_evt_ = consumes(edm::InputTag("generatorSmeared")); tok_hcal_ = consumes(edm::InputTag(g4Label_,hcalHits_)); @@ -289,8 +293,8 @@ void HcalSimHitsValidation::analyze(edm::Event const& ev, edm::EventSetup const& //Approximate calibration constants const float calib_HB = 120.; const float calib_HE = 190.; - const float calib_HF1 = 1.0/0.383; - const float calib_HF2 = 1.0/0.368; + const float calib_HF1 = hf1_;//1.0/0.383; + const float calib_HF2 = hf2_;//1.0/0.368; edm::Handle hcalHits; ev.getByToken(tok_hcal_,hcalHits); From d0160c61c4b4a3ad08ecd25f68c76349c69bb1e5 Mon Sep 17 00:00:00 2001 From: brooks Date: Sat, 3 Mar 2018 00:14:56 +0100 Subject: [PATCH 045/426] updated pedestal threshold --- Validation/HcalDigis/src/HcalDigisValidation.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Validation/HcalDigis/src/HcalDigisValidation.cc b/Validation/HcalDigis/src/HcalDigisValidation.cc index 8fd329fb0e89e..74a3268030582 100644 --- a/Validation/HcalDigis/src/HcalDigisValidation.cc +++ b/Validation/HcalDigis/src/HcalDigisValidation.cc @@ -1112,7 +1112,7 @@ template void HcalDigisValidation::reco(const edm::Event& i // fraction 5,6 bins if ampl. is big. //histogram names have not been changed, but it should be understood that bin_5 is soi, and bin_6_7 is latter TS' - if ((v_ampl[depth] > 30. && subdet_ != "HE") || (v_ampl[depth] > 350.)) { + if ((v_ampl[depth] > 30. && subdet_ != "HE") || (v_ampl[depth] > 300.)) { double fbinSOI = tool[soi] - calibrations.pedestal((dataFrame)[soi].capid()); double fbinPS = 0; From d54df471cb64c164536fcc17f79798234cd6bae0 Mon Sep 17 00:00:00 2001 From: brooks Date: Sat, 3 Mar 2018 01:00:30 +0100 Subject: [PATCH 046/426] updated for future QIE-11 HB cuts --- Validation/HcalDigis/src/HcalDigisValidation.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Validation/HcalDigis/src/HcalDigisValidation.cc b/Validation/HcalDigis/src/HcalDigisValidation.cc index 74a3268030582..d681dc972cb6a 100644 --- a/Validation/HcalDigis/src/HcalDigisValidation.cc +++ b/Validation/HcalDigis/src/HcalDigisValidation.cc @@ -1112,7 +1112,7 @@ template void HcalDigisValidation::reco(const edm::Event& i // fraction 5,6 bins if ampl. is big. //histogram names have not been changed, but it should be understood that bin_5 is soi, and bin_6_7 is latter TS' - if ((v_ampl[depth] > 30. && subdet_ != "HE") || (v_ampl[depth] > 300.)) { + if ((v_ampl[depth] > 30. && (subdet_ != "HE" || subdet_ != "HB")) || (v_ampl[depth] > 300.)) { //300 fC cut for QIE-11 HB & HE double fbinSOI = tool[soi] - calibrations.pedestal((dataFrame)[soi].capid()); double fbinPS = 0; From 3ecf9e6691eed5bde827989fae1d89d33e85b089 Mon Sep 17 00:00:00 2001 From: Petar Date: Sat, 3 Mar 2018 00:34:49 -0600 Subject: [PATCH 047/426] New 2D pixel template reconstruction, with "cluster repair" capability. --- .../Records/interface/TkPixelCPERecord.h | 3 +- .../SiPixelRecHits/interface/PixelCPEBase.h | 3 + .../interface/PixelCPEGenericESProducer.h | 3 +- .../interface/PixelCPETemplateReco.h | 5 + .../PixelCPETemplateRecoESProducer.h | 3 +- .../interface/SiPixelGenError.h | 29 +- .../interface/SiPixelTemplate.h | 17 +- .../interface/SiPixelTemplate2D.h | 181 +- .../interface/SiPixelTemplateDefs.h | 9 +- .../plugins/PixelCPEGenericESProducer.cc | 5 +- .../plugins/PixelCPETemplateRecoESProducer.cc | 6 +- .../SiPixelRecHits/src/PixelCPEBase.cc | 21 +- .../src/PixelCPETemplateReco.cc | 21 +- .../SiPixelRecHits/src/SiPixelGenError.cc | 49 +- .../SiPixelRecHits/src/SiPixelTemplate.cc | 10 +- .../SiPixelRecHits/src/SiPixelTemplate2D.cc | 2299 +++++++++++------ 16 files changed, 1777 insertions(+), 887 deletions(-) diff --git a/RecoLocalTracker/Records/interface/TkPixelCPERecord.h b/RecoLocalTracker/Records/interface/TkPixelCPERecord.h index 484aeba58e0f8..c3b0ce03a356e 100644 --- a/RecoLocalTracker/Records/interface/TkPixelCPERecord.h +++ b/RecoLocalTracker/Records/interface/TkPixelCPERecord.h @@ -10,11 +10,12 @@ //#include "CondFormats/DataRecord/interface/SiPixelCPEGenericErrorParmRcd.h" #include "CondFormats/DataRecord/interface/SiPixelGenErrorDBObjectRcd.h" #include "CalibTracker/Records/interface/SiPixelTemplateDBObjectESProducerRcd.h" +#include "CalibTracker/Records/interface/SiPixel2DTemplateDBObjectESProducerRcd.h" #include "boost/mpl/vector.hpp" class TkPixelCPERecord: public edm::eventsetup::DependentRecordImplementation > {}; + boost::mpl::vector > {}; #endif diff --git a/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEBase.h b/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEBase.h index 8058eb5f4d311..e344824630003 100644 --- a/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEBase.h +++ b/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEBase.h @@ -113,6 +113,9 @@ class PixelCPEBase : public PixelClusterParameterEstimator // ggiurgiu@jhu.edu (10/18/2008) bool with_track_angle; // filled in computeAnglesFrom.... + // More detailed edge information (for CPE ClusterRepair, and elsewhere...) + int edgeTypeX_ = 0; // 0: not on edge, 1: low end on edge, 2: high end + int edgeTypeY_ = 0; // 0: not on edge, 1: low end on edge, 2: high end }; public: diff --git a/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEGenericESProducer.h b/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEGenericESProducer.h index e10ecc700de03..3e1dd6ac171e5 100644 --- a/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEGenericESProducer.h +++ b/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEGenericESProducer.h @@ -11,8 +11,9 @@ class PixelCPEGenericESProducer: public edm::ESProducer{ public: PixelCPEGenericESProducer(const edm::ParameterSet & p); ~PixelCPEGenericESProducer() override; - std::unique_ptr produce(const TkPixelCPERecord &); + std::shared_ptr produce(const TkPixelCPERecord &); private: + std::shared_ptr cpe_; edm::ParameterSet pset_; edm::ESInputTag magname_; bool useLAWidthFromDB_; diff --git a/RecoLocalTracker/SiPixelRecHits/interface/PixelCPETemplateReco.h b/RecoLocalTracker/SiPixelRecHits/interface/PixelCPETemplateReco.h index 70a412ffb617e..f8b2592064cdc 100644 --- a/RecoLocalTracker/SiPixelRecHits/interface/PixelCPETemplateReco.h +++ b/RecoLocalTracker/SiPixelRecHits/interface/PixelCPETemplateReco.h @@ -78,6 +78,11 @@ class PixelCPETemplateReco : public PixelCPEBase int speed_ ; bool UseClusterSplitter_; + + // Template file management (when not getting the templates from the DB) + int barrelTemplateID_ ; + int forwardTemplateID_ ; + std::string templateDir_ ; //bool DoCosmics_; //bool LoadTemplatesFromDB_; diff --git a/RecoLocalTracker/SiPixelRecHits/interface/PixelCPETemplateRecoESProducer.h b/RecoLocalTracker/SiPixelRecHits/interface/PixelCPETemplateRecoESProducer.h index 4a47426f44f23..67e1c081b09f6 100644 --- a/RecoLocalTracker/SiPixelRecHits/interface/PixelCPETemplateRecoESProducer.h +++ b/RecoLocalTracker/SiPixelRecHits/interface/PixelCPETemplateRecoESProducer.h @@ -11,8 +11,9 @@ class PixelCPETemplateRecoESProducer: public edm::ESProducer{ public: PixelCPETemplateRecoESProducer(const edm::ParameterSet & p); ~PixelCPETemplateRecoESProducer() override; - std::unique_ptr produce(const TkPixelCPERecord &); + std::shared_ptr produce(const TkPixelCPERecord &); private: + std::shared_ptr cpe_; edm::ParameterSet pset_; bool DoLorentz_; }; diff --git a/RecoLocalTracker/SiPixelRecHits/interface/SiPixelGenError.h b/RecoLocalTracker/SiPixelRecHits/interface/SiPixelGenError.h index bd4f069a26a51..8be4f20b7ca94 100644 --- a/RecoLocalTracker/SiPixelRecHits/interface/SiPixelGenError.h +++ b/RecoLocalTracker/SiPixelRecHits/interface/SiPixelGenError.h @@ -1,11 +1,17 @@ // -// SiPixelGenError.h (v2.00) +// SiPixelGenError.h (v2.20) // // Object to contain Lorentz drift and error information for the Generic Algorithm // // Created by Morris Swartz on 1/10/2014. // // Update for Phase 1 FPix, M.S. 1/15/17 +// V2.01 - Allow subdetector ID=5 for FPix R2P2, Fix error message +// V2.10 - Update the variable size [SI_PIXEL_TEMPLATE_USE_BOOST] option so that it works with VI's enhancements +// V2.20 - Add directory path selection to the ascii pushfile method + + + // // Build the template storage structure from several pieces @@ -16,6 +22,7 @@ #include #include +#include "boost/multi_array.hpp" #ifndef SI_PIXEL_TEMPLATE_STANDALONE #include "CondFormats/SiPixelObjects/interface/SiPixelGenErrorDBObject.h" @@ -77,11 +84,19 @@ struct SiPixelGenErrorHeader { //!< template header structure struct SiPixelGenErrorStore { //!< template storage structure SiPixelGenErrorHeader head; +#ifndef SI_PIXEL_TEMPLATE_USE_BOOST float cotbetaY[60]; float cotbetaX[5]; float cotalphaX[29]; SiPixelGenErrorEntry enty[60]; //!< 60 Barrel y templates spanning cluster lengths from 0px to +18px [28 entries for fpix] SiPixelGenErrorEntry entx[5][29]; //!< 29 Barrel x templates spanning cluster lengths from -6px (-1.125Rad) to +6px (+1.125Rad) in each of 5 slices [3x29 for fpix] +#else + float* cotbetaY; + float* cotbetaX; + float* cotalphaX; + boost::multi_array enty; //!< use 1d entry to store [60] barrel entries or [28] fpix entries + boost::multi_array entx; //!< use 2d entry to store [5][29] barrel entries or [3][29] fpix entries +#endif } ; @@ -104,9 +119,10 @@ class SiPixelGenError { public: SiPixelGenError(const std::vector< SiPixelGenErrorStore > & thePixelTemp) : thePixelTemp_(thePixelTemp) { id_current_ = -1; index_id_ = -1;} //!< Constructor for cases in which template store already exists - static bool pushfile(int filenum, std::vector< SiPixelGenErrorStore > & thePixelTemp_); // load the private store with info from the - // file with the index (int) filenum - +// Load the private store with info from the file with the index (int) filenum from directory dir: +// ${dir}generror_summary_zp${filenum}.out + static bool pushfile(int filenum, std::vector< SiPixelGenErrorStore > & thePixelTemp_ , std::string dir = ""); + #ifndef SI_PIXEL_TEMPLATE_STANDALONE static bool pushfile(const SiPixelGenErrorDBObject& dbobject, std::vector< SiPixelGenErrorStore > & thePixelTemp_); // load the private store with info from db #endif @@ -119,6 +135,11 @@ class SiPixelGenError { int qbin(int id, float cotalpha, float cotbeta, float locBz, float locBx, float qclus, bool irradiationCorrections, int& pixmx, float& sigmay, float& deltay, float& sigmax, float& deltax, float& sy1, float& dy1, float& sy2, float& dy2, float& sx1, float& dx1, float& sx2, float& dx2); + +// Overload to provide backward compatibility + + int qbin(int id, float cotalpha, float cotbeta, float locBz, float locBx, float qclus, float& pixmx, float& sigmay, float& deltay, float& sigmax, float& deltax, + float& sy1, float& dy1, float& sy2, float& dy2, float& sx1, float& dx1, float& sx2, float& dx2); // Overloaded method to provide only the LA parameters int qbin(int id); diff --git a/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate.h b/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate.h index dd204c34b0909..f3d538e892c72 100755 --- a/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate.h +++ b/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate.h @@ -1,5 +1,5 @@ // -// SiPixelTemplate.h (v10.13) +// SiPixelTemplate.h (v10.20) // // Add goodness-of-fit info and spare entries to templates, version number in template header, more error checking // Add correction for (Q_F-Q_L)/(Q_F+Q_L) bias @@ -76,6 +76,8 @@ // V10.11 - Allow subdetector ID=5 for FPix R2P2 [allows better internal labeling of templates] // V10.12 - Enforce minimum signal size in pixel charge uncertainty calculation // V10.13 - Update the variable size [SI_PIXEL_TEMPLATE_USE_BOOST] option so that it works with VI's enhancements +// V10.20 - Add directory path selection to the ascii pushfile method + @@ -217,9 +219,9 @@ struct SiPixelTemplateStore { //!< template storage structure SiPixelTemplateEntry entx[5][29]; //!< 29 Barrel x templates spanning cluster lengths from -6px (-1.125Rad) to +6px (+1.125Rad) in each of 5 slices [3x29 for fpix] void destroy() {}; #else - float* cotbetaY=nullptr; - float* cotbetaX=nullptr; - float* cotalphaX=nullptr; + float* cotbetaY; + float* cotbetaX; + float* cotalphaX; boost::multi_array enty; //!< use 1d entry to store [60] barrel entries or [28] fpix entries boost::multi_array entx; //!< use 2d entry to store [5][29] barrel entries or [3][29] fpix entries void destroy() { // deletes arrays created by pushfile method of SiPixelTemplate @@ -254,8 +256,11 @@ class SiPixelTemplate { public: SiPixelTemplate(const std::vector< SiPixelTemplateStore > & thePixelTemp) : thePixelTemp_(thePixelTemp) { id_current_ = -1; index_id_ = -1; cota_current_ = 0.; cotb_current_ = 0.; } //!< Constructor for cases in which template store already exists - static bool pushfile(int filenum, std::vector< SiPixelTemplateStore > & thePixelTemp_); // load the private store with info from the - // file with the index (int) filenum + +// Load the private store with info from the file with the index (int) filenum from directory dir: +// ${dir}template_summary_zp${filenum}.out + static bool pushfile(int filenum, std::vector< SiPixelTemplateStore > & thePixelTemp_ , std::string dir = ""); + #ifndef SI_PIXEL_TEMPLATE_STANDALONE static bool pushfile(const SiPixelTemplateDBObject& dbobject, std::vector< SiPixelTemplateStore > & thePixelTemp_); // load the private store with info from db diff --git a/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate2D.h b/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate2D.h index 18c119f7b90f6..f1b67122fe49b 100644 --- a/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate2D.h +++ b/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate2D.h @@ -1,5 +1,5 @@ // -// SiPixelTemplate2D.h (v1.03) +// SiPixelTemplate2D.h (v2.35) // // Full 2-D templates for cluster splitting, simulated cluster reweighting, and improved cluster probability // @@ -7,7 +7,13 @@ // V1.01 - fix qavg_ filling // V1.02 - Add locBz to test if FPix use is out of range // V1.03 - Fix edge checking on final template to increase template size and to properly truncate cluster -// +// v2.00 - Major changes to accommodate 2D reconstruction +// v2.10 - Change chi2 and error scaling information to work with partially reconstructed clusters +// v2.20 - Add cluster charge probability information, side loading for template generation +// v2.21 - Double derivative interval [improves fit convergence] +// v2.25 - Resize template store to accommodate FPix Templates +// v2.30 - Fix bug found by P. Shuetze that compromises sqlite file loading +// v2.35 - Add directory path selection to the ascii pushfile method // // Build the template storage structure from several pieces @@ -15,15 +21,16 @@ #ifndef SiPixelTemplate2D_h #define SiPixelTemplate2D_h 1 -#include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateDefs.h" - #include #include #include "boost/multi_array.hpp" #ifndef SI_PIXEL_TEMPLATE_STANDALONE -#include "CondFormats/SiPixelObjects/interface/SiPixelTemplateDBObject.h" +#include "CondFormats/SiPixelObjects/interface/SiPixel2DTemplateDBObject.h" #include "FWCore/Utilities/interface/Exception.h" +#include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateDefs.h" +#else +#include "SiPixelTemplateDefs.h" #endif struct SiPixelTemplateEntry2D { //!< Basic template entry corresponding to a single set of track angles @@ -41,32 +48,49 @@ struct SiPixelTemplateEntry2D { //!< Basic template entry corresponding to a sin float xypar[2][5]; //!< pixel uncertainty parameterization float lanpar[2][5]; //!< pixel landau distribution parameters float xytemp[7][7][T2YSIZE][T2XSIZE]; //!< templates for y-reconstruction (binned over 1 central pixel) - float chi2avg[4]; //!< average chi^2 in 4 charge bins - float chi2min[4]; //!< minimum of chi^2 in 4 charge bins + float chi2ppix; //!< average chi^2 per pixel + float chi2scale; //!< scale factor for the chi2 distribution float chi2avgone; //!< average y chi^2 for 1 pixel clusters float chi2minone; //!< minimum of y chi^2 for 1 pixel clusters - float spare[20]; + float clsleny; //!< cluster y-length in pixels at signal height symax/2 + float clslenx; //!< cluster x-length in pixels at signal height sxmax/2 + float mpvvav; //!< most probable charge in Vavilov distribution (not actually for larger kappa) + float sigmavav; //!< "sigma" scale fctor for Vavilov distribution + float kappavav; //!< kappa parameter for Vavilov distribution + float scalexavg; //!< average x-error scale factor + float scaleyavg; //!< average y-error scale factor + float delyavg; //!< average length difference between template and cluster + float delysig; //!< rms of length difference between template and cluster + float scalex[4]; //!< x-error scale factor in 4 charge bins + float scaley[4]; //!< y-error scale factor in 4 charge bins + float offsetx[4]; //!< x-offset in 4 charge bins + float offsety[4]; //!< y-offset in 4 charge bins + float spare[3]; } ; struct SiPixelTemplateHeader2D { //!< template header structure - char title[80]; //!< template title int ID; //!< template ID number - int templ_version; //!< Version number of the template to ensure code compatibility - float Bfield; //!< Bfield in Tesla - int NTy; //!< number of Template y entries (= 0 for 2-D templates) + int NTy; //!< number of Template y entries int NTyx; //!< number of Template y-slices of x entries int NTxx; //!< number of Template x-entries in each slice int Dtype; //!< detector type (0=BPix, 1=FPix) + float qscale; //!< Charge scaling to match cmssw and pixelav + float lorywidth; //!< estimate of y-lorentz width for optimal resolution + float lorxwidth; //!< estimate of x-lorentz width for optimal resolution + float lorybias; //!< estimate of y-lorentz bias + float lorxbias; //!< estimate of x-lorentz bias float Vbias; //!< detector bias potential in Volts float temperature; //!< detector temperature in deg K float fluence; //!< radiation fluence in n_eq/cm^2 - float qscale; //!< Charge scaling to match cmssw and pixelav - float s50; //!< 1/2 of the readout threshold in ADC units - float lorywidth; //!< estimate of y-lorentz width from single pixel offset - float lorxwidth; //!< estimate of x-lorentz width from single pixel offset + float s50; //!< 1/2 of the multihit dcol threshold in electrons + float ss50; //!< 1/2 of the single hit dcol threshold in electrons + char title[80]; //!< template title + int templ_version; //!< Version number of the template to ensure code compatibility + float Bfield; //!< Bfield in Tesla + float fbin[3]; //!< The QBin definitions in Q_clus/Q_avg float xsize; //!< pixel size (for future use in upgraded geometry) float ysize; //!< pixel size (for future use in upgraded geometry) float zsize; //!< pixel size (for future use in upgraded geometry) @@ -76,7 +100,11 @@ struct SiPixelTemplateHeader2D { //!< template header structure struct SiPixelTemplateStore2D { //!< template storage structure SiPixelTemplateHeader2D head; - boost::multi_array entry; //!< use 2d entry to store [47][5] barrel entries or [5][9] fpix entries +#ifndef SI_PIXEL_TEMPLATE_USE_BOOST + SiPixelTemplateEntry2D entry[73][7]; //!< use 2d entry to store [47][5] barrel entries or [5][9] fpix +#else + boost::multi_array entry; //!< use 2d entry to store [47][5] barrel entries or [5][9] fpix entries +#endif } ; @@ -105,23 +133,35 @@ struct SiPixelTemplateStore2D { //!< template storage structure class SiPixelTemplate2D { public: SiPixelTemplate2D(const std::vector< SiPixelTemplateStore2D > & thePixelTemp) : thePixelTemp_(thePixelTemp) {id_current_ = -1; index_id_ = -1; cota_current_ = 0.; cotb_current_ = 0.;} //!< Default constructor - static bool pushfile(int filenum, std::vector< SiPixelTemplateStore2D > & thePixelTemp_); // load the private store with info from the - // file with the index (int) filenum + +// load the private store with info from the + // file with the index (int) filenum ${dir}template_summary_zp${filenum}.out + static bool pushfile(int filenum, std::vector< SiPixelTemplateStore2D > & thePixelTemp_, std::string dir = ""); #ifndef SI_PIXEL_TEMPLATE_STANDALONE - static bool pushfile(const SiPixelTemplateDBObject& dbobject, std::vector< SiPixelTemplateStore2D > & thePixelTemp_); // load the private store with info from db + static bool pushfile(const SiPixel2DTemplateDBObject& dbobject, std::vector< SiPixelTemplateStore2D > & thePixelTemp_); // load the private store with info from db #endif + // Initialize things before interpolating + + void sideload(SiPixelTemplateEntry2D* entry, int iDtype, float locBx, float locBz, float lorwdy, float lorwdx, float q50, float fbin[3], float xsize, float ysize, float zsize); + + // Initialize things before interpolating + + bool interpolate(int id, float cotalpha, float cotbeta, float locBz, float locBx); // Interpolate input alpha and beta angles to produce a working template for each individual hit. - bool xytemp(int id, float cotalpha, float cotbeta, float locBz, float xhit, float yhit, std::vector& ydouble, std::vector& xdouble, float template2d[BXM2][BYM2]); + // Works with Phase 0+1 + bool xytemp(float xhit, float yhit, bool ydouble[BYM2], bool xdouble[BXM2], float template2d[BXM2][BYM2], bool dervatives, float dpdx2d[2][BXM2][BYM2], float& QTemplate); - // Overload to allow user to avoid the locBz information + // Overload for backward compatibility - bool xytemp(int id, float cotalpha, float cotbeta, float xhit, float yhit, std::vector& ydouble, std::vector& xdouble, float template2d[BXM2][BYM2]); + bool xytemp(float xhit, float yhit, bool ydouble[BYM2], bool xdouble[BXM2], float template2d[BXM2][BYM2]); - // Get pixel signal uncertainties + // Overload for backward compatibility with re-weighting code + + bool xytemp(int id, float cotalpha, float cotbeta, float xhit, float yhit, std::vector& ydouble, std::vector& xdouble, float template2d[BXM2][BYM2]); void xysigma2(float qpixel, int index, float& xysig2); @@ -134,35 +174,62 @@ class SiPixelTemplate2D { float qscale() {return qscale_;} //!< charge scaling factor float s50() {return s50_;} //!< 1/2 of the pixel threshold signal in adc units float sxymax() {return sxymax_;} //!< max pixel signal for pixel error calculation - float xytemp(int j, int i) { //!< get the 2-d template for pixel j (x), i (y) in BXM2 x BYM2 array (x,y)=(0,0) in lower LH corner of pixel[1][1] + float scalex(int i) { #ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(j < 0 || j > BXM3 || i < 0 || i > BYM3) {throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::xytemp called with illegal indices = " << j << "," << i << std::endl;} + if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::scalex called with illegal index = " << i << std::endl;} #else - assert((j>=0 && j=0 && i=0 && i<4); #endif - return xytemp_[j][i];} //!< current 2-d template - float chi2avg(int i) { + return scalex_[i];} //!< x-error scale factor in 4 charge bins + float scaley(int i) { #ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::chi2yavg called with illegal index = " << i << std::endl;} + if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::scaley called with illegal index = " << i << std::endl;} #else assert(i>=0 && i<4); #endif - return chi2avg_[i];} //!< average chi^2 in 4 charge bins - float chi2min(int i) { + return scaley_[i];} //! 3) {throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::chi2ymin called with illegal index = " << i << std::endl;} + if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::scaley called with illegal index = " << i << std::endl;} #else assert(i>=0 && i<4); #endif - return chi2min_[i];} //!< minimum chi^2 in 4 charge bins - float chi2avgone() {return chi2avgone_;} //!< //!< average y chi^2 for 1 pixel clusters - float chi2minone() {return chi2minone_;} //!< //!< minimum of y chi^2 for 1 pixel clusters - float lorywidth() {return lorywidth_;} //!< signed lorentz y-width (microns) - float lorxwidth() {return lorxwidth_;} //!< signed lorentz x-width (microns) + return offsetx_[i];} //!< x-offset in 4 charge bins + float offsety(int i) { +#ifndef SI_PIXEL_TEMPLATE_STANDALONE + if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::scaley called with illegal index = " << i << std::endl;} +#else + assert(i>=0 && i<4); +#endif + return offsety_[i];} //!< x-offset in 4 charge bins + float fbin(int i) { +#ifndef SI_PIXEL_TEMPLATE_STANDALONE + if(i < 0 || i > 2) {throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::fbin called with illegal index = " << i << std::endl;} +#else + assert(i>=0 && i<3); +#endif + return fbin_[i];} //!< Return lower bound of Qbin definition + float sizex() {return clslenx_;} //!< return x size of template cluster + float sizey() {return clsleny_;} //!< return y size of template cluster + float chi2ppix() {return chi2ppix_;} //!< average chi^2 per struck pixel + float chi2scale() {return chi2scale_;} //!< scale factor for chi^2 distribution + float chi2avgone() {return chi2avgone_;} //!< average y chi^2 for 1 pixel clusters + float chi2minone() {return chi2minone_;} //!< minimum of y chi^2 for 1 pixel clusters + float mpvvav() {return mpvvav_;} //!< most probable Q in Vavilov distribution + float sigmavav() {return sigmavav_;} //!< scale factor in Vavilov distribution + float kappavav() {return kappavav_;} //!< kappa parameter in Vavilov distribution + float lorydrift() {return lorydrift_;} //!< signed lorentz y-width (microns) + float lorxdrift() {return lorxdrift_;} //!< signed lorentz x-width (microns) + float clsleny() {return clsleny_;} //!< cluster y-size + float clslenx() {return clslenx_;} //!< cluster x-size + float scaleyavg() {return scaleyavg_;} //!< y-reco error scaling factor + float scalexavg() {return scalexavg_;} //!< x-reco error scaling factor + float delyavg() {return delyavg_;} //!< average difference between clsleny_ and cluster length [with threshold effects] + float delysig() {return delysig_;} //!< rms difference between clsleny_ and cluster length [with threshold effects] float xsize() {return xsize_;} //!< pixel x-size (microns) float ysize() {return ysize_;} //!< pixel y-size (microns) float zsize() {return zsize_;} //!< pixel z-size or thickness (microns) - int storesize() {return (int)thePixelTemp_.size();} //!< return the size of the template store (the number of stored IDs + int storesize() {return (int)thePixelTemp_.size();} //!< return the size of the template store (the number of stored IDs private: @@ -187,6 +254,12 @@ class SiPixelTemplate2D { int jx0_; //!< index of nearest cot(alpha) bin int jx1_; //!< index of next-nearest cot(alpha) bin float adcota_; //!< fractional pixel distance of cot(alpha) from jx0_ + int imin_; //!< min y index of templated cluster + int imax_; //!< max y index of templated cluster + int jmin_; //!< min x index of templated cluster + int jmax_; //!< max x index of templated cluster + bool flip_y_; //!< flip y sign-sensitive quantities + bool flip_x_; //!< flip x sign-sensitive quantities bool success_; //!< true if cotalpha, cotbeta are inside of the acceptance (dynamically loaded) @@ -197,24 +270,44 @@ class SiPixelTemplate2D { float qscale_; //!< charge scaling factor float s50_; //!< 1/2 of the pixel threshold signal in adc units float sxymax_; //!< average pixel signal for y-projection of cluster - float xytemp_[BXM2][BYM2];//!< templates for y-reconstruction (binned over 5 central pixels) + float xytemp_[BXM2][BYM2];//!< template for xy-reconstruction float xypary0x0_[2][5]; //!< Polynomial error parameterization at ix0,iy0 float xypary1x0_[2][5]; //!< Polynomial error parameterization at ix0,iy1 float xypary0x1_[2][5]; //!< Polynomial error parameterization at ix1,iy0 float lanpar_[2][5]; //!< Interpolated Landau parameters - float chi2avg_[4]; //!< average chi^2 in 4 charge bins - float chi2min_[4]; //!< minimum of chi^2 in 4 charge bins - float chi2avgone_; //!< average chi^2 for 1 pixel clusters - float chi2minone_; //!< minimum of chi^2 for 1 pixel clusters + float chi2ppix_; //!< average chi^2 per struck pixel + float chi2scale_; //!< scale factor for chi2 distribution + float chi2avgone_; //!< average chi^2 for 1 pixel clusters + float chi2minone_; //!< minimum of chi^2 for 1 pixel clusters + float clsleny_; //!< projected y-length of cluster + float clslenx_; //!< projected x-length of cluster + float scalexavg_; //!< average x-error scale factor + float scaleyavg_; //!< average y-error scale factor + float delyavg_; //!< average difference between clsleny_ and cluster length [with threshold effects] + float delysig_; //!< rms of difference between clsleny_ and cluster length [with threshold effects] + float scalex_[4]; //!< x-error scale factor in charge bins + float scaley_[4]; //!< y-error scale factor in charge bins + float offsetx_[4]; //!< x-offset in charge bins + float offsety_[4]; //!< y-offset in charge bins + float mpvvav_; //!< most probable Q in Vavilov distribution + float sigmavav_; //!< scale factor in Vavilov distribution + float kappavav_; //!< kappa parameter in Vavilov distribution float lorywidth_; //!< Lorentz y-width (sign corrected for fpix frame) float lorxwidth_; //!< Lorentz x-width + float lorydrift_; //!< Lorentz y-drift + float lorxdrift_; //!< Lorentz x-drift float xsize_; //!< Pixel x-size float ysize_; //!< Pixel y-size float zsize_; //!< Pixel z-size (thickness) + float fbin_[3]; //!< The QBin definitions in Q_clus/Q_avg + const SiPixelTemplateEntry2D* entry00_; // Pointer to presently interpolated point + const SiPixelTemplateEntry2D* entry10_; // Pointer to presently interpolated point [iy+1] + const SiPixelTemplateEntry2D* entry01_; // Pointer to presently interpolated point [ix+1] // The actual template store is a std::vector container const std::vector< SiPixelTemplateStore2D > & thePixelTemp_; + } ; diff --git a/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateDefs.h b/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateDefs.h index 4e38b80efb5c6..2ff244ac0519c 100644 --- a/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateDefs.h +++ b/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateDefs.h @@ -1,9 +1,11 @@ // -// SiPixelTemplateDefs.h (v1.10) +// SiPixelTemplateDefs.h (v2.00) // // Created by Morris Swartz on 12/01/09. // 2009 __TheJohnsHopkinsUniversity__. // +// V2.00 - Resize the 2D objects to improve angle acceptance +// // // Define template buffer size parameters @@ -33,9 +35,10 @@ #define BXM1 TXSIZE+3 #define BXM2 TXSIZE+2 #define BXM3 TXSIZE+1 -#define T2YSIZE 13 +#define T2YSIZE 21 #define T2XSIZE 7 -#define T2HY 6 // = T2YSIZE/2 +#define T2HY 10 // = T2YSIZE/2 +#define T2HYP1 T2HY+1 // = T2YSIZE/2+1 #define T2HX 3 // = T2XSIZE/2 #endif diff --git a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEGenericESProducer.cc b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEGenericESProducer.cc index 76cb0cab2e302..f5dfeab62a735 100644 --- a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEGenericESProducer.cc +++ b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEGenericESProducer.cc @@ -45,7 +45,7 @@ PixelCPEGenericESProducer::PixelCPEGenericESProducer(const edm::ParameterSet & p PixelCPEGenericESProducer::~PixelCPEGenericESProducer() {} -std::unique_ptr +std::shared_ptr PixelCPEGenericESProducer::produce(const TkPixelCPERecord & iRecord){ ESHandle magfield; @@ -83,11 +83,12 @@ PixelCPEGenericESProducer::produce(const TkPixelCPERecord & iRecord){ //} else { //std::cout<<" pass an empty GenError pointer"<( + cpe_ = std::make_shared( pset_,magfield.product(),*pDD.product(), *hTT.product(),lorentzAngle.product(), genErrorDBObjectProduct,lorentzAngleWidthProduct); + return cpe_; } diff --git a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPETemplateRecoESProducer.cc b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPETemplateRecoESProducer.cc index 3bc2e3ff4bf57..8877d7459c3be 100644 --- a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPETemplateRecoESProducer.cc +++ b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPETemplateRecoESProducer.cc @@ -35,7 +35,7 @@ PixelCPETemplateRecoESProducer::PixelCPETemplateRecoESProducer(const edm::Parame PixelCPETemplateRecoESProducer::~PixelCPETemplateRecoESProducer() {} -std::unique_ptr +std::shared_ptr PixelCPETemplateRecoESProducer::produce(const TkPixelCPERecord & iRecord){ ESHandle magfield; @@ -60,7 +60,9 @@ PixelCPETemplateRecoESProducer::produce(const TkPixelCPERecord & iRecord){ ESHandle templateDBobject; iRecord.getRecord().get(templateDBobject); - return std::make_unique(pset_,magfield.product(),*pDD.product(),*hTT.product(),lorentzAngleProduct,templateDBobject.product() ); + // cpe_ = std::make_shared(pset_,magfield.product(),lorentzAngle.product(),templateDBobject.product() ); + cpe_ = std::make_shared(pset_,magfield.product(),*pDD.product(),*hTT.product(),lorentzAngleProduct,templateDBobject.product() ); + return cpe_; } diff --git a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEBase.cc b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEBase.cc index d16c61b116ff1..81516d1ff0ee5 100644 --- a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEBase.cc +++ b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEBase.cc @@ -239,9 +239,24 @@ PixelCPEBase::setTheClu( DetParam const & theDetParam, ClusterParam & theCluster minInY = theClusterParam.theCluster->minPixelCol(); maxInX = theClusterParam.theCluster->maxPixelRow(); maxInY = theClusterParam.theCluster->maxPixelCol(); - - theClusterParam.isOnEdge_ = theDetParam.theRecTopol->isItEdgePixelInX(minInX) | theDetParam.theRecTopol->isItEdgePixelInX(maxInX) | - theDetParam.theRecTopol->isItEdgePixelInY(minInY) | theDetParam.theRecTopol->isItEdgePixelInY(maxInY) ; + + if ( theDetParam.theRecTopol->isItEdgePixelInX(minInX) ) + theClusterParam.edgeTypeX_ = 1; + else if ( theDetParam.theRecTopol->isItEdgePixelInX(maxInX) ) + theClusterParam.edgeTypeX_ = 2; + else + theClusterParam.edgeTypeX_ = 0; + + if ( theDetParam.theRecTopol->isItEdgePixelInY(minInY) ) + theClusterParam.edgeTypeY_ = 1; + else if ( theDetParam.theRecTopol->isItEdgePixelInY(maxInY) ) + theClusterParam.edgeTypeY_ = 2; + else + theClusterParam.edgeTypeY_ = 0; + + theClusterParam.isOnEdge_ = ( theClusterParam.edgeTypeX_ || theClusterParam.edgeTypeY_ ); + // theClusterParam.isOnEdge_ = theDetParam.theRecTopol->isItEdgePixelInX(minInX) | theDetParam.theRecTopol->isItEdgePixelInX(maxInX) | + // theDetParam.theRecTopol->isItEdgePixelInY(minInY) | theDetParam.theRecTopol->isItEdgePixelInY(maxInY) ; // FOR NOW UNUSED. KEEP IT IN CASE WE WANT TO USE IT IN THE FUTURE // Bad Pixels have their charge set to 0 in the clusterizer diff --git a/RecoLocalTracker/SiPixelRecHits/src/PixelCPETemplateReco.cc b/RecoLocalTracker/SiPixelRecHits/src/PixelCPETemplateReco.cc index f502d6b6f29ab..8e84a413390d7 100644 --- a/RecoLocalTracker/SiPixelRecHits/src/PixelCPETemplateReco.cc +++ b/RecoLocalTracker/SiPixelRecHits/src/PixelCPETemplateReco.cc @@ -73,15 +73,18 @@ PixelCPETemplateReco::PixelCPETemplateReco(edm::ParameterSet const & conf, } else { - //cout << "PixelCPETemplateReco : Loading templates 40 and 41 from ASCII files ------------------------" << endl; - - if ( !SiPixelTemplate::pushfile( 40, thePixelTemp_ ) ) + //cout << "PixelCPETemplateReco : Loading templates for barrel and forward from ASCII files ----------" << endl; + barrelTemplateID_ = conf.getParameter( "barrelTemplateID" ); + forwardTemplateID_ = conf.getParameter( "forwardTemplateID" ); + templateDir_ = conf.getParameter( "directoryWithTemplates" ); + + if ( !SiPixelTemplate::pushfile( barrelTemplateID_ , thePixelTemp_ , templateDir_ ) ) throw cms::Exception("PixelCPETemplateReco") - << "\nERROR: Templates 40 not loaded correctly from text file. Reconstruction will fail.\n\n"; + << "\nERROR: Template ID " << barrelTemplateID_ << " not loaded correctly from text file. Reconstruction will fail.\n\n"; - if ( !SiPixelTemplate::pushfile( 41, thePixelTemp_ ) ) + if ( !SiPixelTemplate::pushfile( forwardTemplateID_ , thePixelTemp_ , templateDir_ ) ) throw cms::Exception("PixelCPETemplateReco") - << "\nERROR: Templates 41 not loaded correctly from text file. Reconstruction will fail.\n\n"; + << "\nERROR: Template ID " << forwardTemplateID_ << " not loaded correctly from text file. Reconstruction will fail.\n\n"; } speed_ = conf.getParameter( "speed"); @@ -131,8 +134,10 @@ PixelCPETemplateReco::localPosition(DetParam const & theDetParam, ClusterParam & ID = theDetParam.detTemplateId; if(ID0!=ID) cout<<" different id"<< ID<<" "< // next, layout the 1-d/2-d structures needed to store GenError info + + theCurrentTemp.cotbetaY = new float[theCurrentTemp.head.NTy]; + theCurrentTemp.cotbetaX = new float[theCurrentTemp.head.NTyx]; + theCurrentTemp.cotalphaX = new float[theCurrentTemp.head.NTxx]; + theCurrentTemp.enty.resize(boost::extents[theCurrentTemp.head.NTy]); theCurrentTemp.entx.resize(boost::extents[theCurrentTemp.head.NTyx][theCurrentTemp.head.NTxx]); @@ -308,6 +319,11 @@ bool SiPixelGenError::pushfile(const SiPixelGenErrorDBObject& dbobject, // next, layout the 1-d/2-d structures needed to store GenError + + theCurrentTemp.cotbetaY = new float[theCurrentTemp.head.NTy]; + theCurrentTemp.cotbetaX = new float[theCurrentTemp.head.NTyx]; + theCurrentTemp.cotalphaX = new float[theCurrentTemp.head.NTxx]; + theCurrentTemp.enty.resize(boost::extents[theCurrentTemp.head.NTy]); theCurrentTemp.entx.resize(boost::extents[theCurrentTemp.head.NTyx][theCurrentTemp.head.NTxx]); @@ -543,6 +559,7 @@ int SiPixelGenError::qbin(int id, float cotalpha, float cotbeta, float locBz, fl case 2: case 3: case 4: + case 5: if(locBx*locBz < 0.f) { cota = -cotalpha; flip_x = true; @@ -556,9 +573,9 @@ int SiPixelGenError::qbin(int id, float cotalpha, float cotbeta, float locBz, fl break; default: #ifndef SI_PIXEL_TEMPLATE_STANDALONE - throw cms::Exception("DataCorrupt") << "SiPixelTemplate::illegal subdetector ID = " << thePixelTemp_[index_id_].head.Dtype << std::endl; + throw cms::Exception("DataCorrupt") << "SiPixelGenError::illegal subdetector ID = " << thePixelTemp_[index_id_].head.Dtype << std::endl; #else - std::cout << "SiPixelTemplate::illegal subdetector ID = " << thePixelTemp_[index_id_].head.Dtype << std::endl; + std::cout << "SiPixelGenError::illegal subdetector ID = " << thePixelTemp_[index_id_].head.Dtype << std::endl; #endif } @@ -657,8 +674,7 @@ int SiPixelGenError::qbin(int id, float cotalpha, float cotbeta, float locBz, fl auto yrmsgen =(1.f - yratio)*thePixelTemp_[index].enty[ilow].yrmsgen[binq] + yratio*thePixelTemp_[index].enty[ihigh].yrmsgen[binq]; sy1 = (1.f - yratio)*thePixelTemp_[index].enty[ilow].syone + yratio*thePixelTemp_[index].enty[ihigh].syone; - sy2 = (1.f - yratio)*thePixelTemp_[index].enty[ilow].sytwo + yratio*thePixelTemp_[index].enty[ihigh].sytwo; - + sy2 = (1.f - yratio)*thePixelTemp_[index].enty[ilow].sytwo + yratio*thePixelTemp_[index].enty[ihigh].sytwo; // next, loop over all x-angle entries, first, find relevant y-slices @@ -738,3 +754,22 @@ int SiPixelGenError::qbin(int id, float cotalpha, float cotbeta, float locBz, fl return binq; } // qbin + +int SiPixelGenError::qbin(int id, float cotalpha, float cotbeta, float locBz, float locBx, float qclus, + float& pixmx, float& sigmay, float& deltay, float& sigmax, float& deltax, + float& sy1, float& dy1, float& sy2, float& dy2, float& sx1, float& dx1, + float& sx2, float& dx2) +{ + // Interpolate for a new set of track angles + + bool irradiationCorrections = true; + int ipixmx, ibin; + + ibin = SiPixelGenError::qbin(id, cotalpha, cotbeta, locBz, locBx, qclus, irradiationCorrections, + ipixmx, sigmay, deltay, sigmax, deltax, sy1, dy1, sy2, dy2, sx1, dx1, sx2, dx2); + + pixmx = (float)ipixmx; + + return ibin; + +} diff --git a/RecoLocalTracker/SiPixelRecHits/src/SiPixelTemplate.cc b/RecoLocalTracker/SiPixelRecHits/src/SiPixelTemplate.cc index 9eb3853c0ad68..0093487ae22a8 100755 --- a/RecoLocalTracker/SiPixelRecHits/src/SiPixelTemplate.cc +++ b/RecoLocalTracker/SiPixelRecHits/src/SiPixelTemplate.cc @@ -1,5 +1,5 @@ // -// SiPixelTemplate.cc Version 10.13 +// SiPixelTemplate.cc Version 10.20 // // Add goodness-of-fit info and spare entries to templates, version number in template header, more error checking // Add correction for (Q_F-Q_L)/(Q_F+Q_L) bias @@ -78,6 +78,7 @@ // V10.11 - Allow subdetector ID=5 for FPix R2P2 [allows better internal labeling of templates] // V10.12 - Enforce minimum signal size in pixel charge uncertainty calculation // V10.13 - Update the variable size [SI_PIXEL_TEMPLATE_USE_BOOST] option so that it works with VI's enhancements +// V10.20 - Add directory path selection to the ascii pushfile method @@ -126,7 +127,7 @@ using namespace edm; //! digits of filenum. //! \param filenum - an integer NNNN used in the filename template_summary_zpNNNN //**************************************************************** -bool SiPixelTemplate::pushfile(int filenum, std::vector< SiPixelTemplateStore > & thePixelTemp_) +bool SiPixelTemplate::pushfile(int filenum, std::vector< SiPixelTemplateStore > & thePixelTemp_ , std::string dir) { // Add template stored in external file numbered filenum to theTemplateStore @@ -147,8 +148,8 @@ bool SiPixelTemplate::pushfile(int filenum, std::vector< SiPixelTemplateStore > // Create different path in CMSSW than standalone #ifndef SI_PIXEL_TEMPLATE_STANDALONE - tout << "CalibTracker/SiPixelESProducers/data/template_summary_zp" - << std::setw(4) << std::setfill('0') << std::right << filenum << ".out" << std::ends; + tout << dir << "template_summary_zp" + << std::setw(4) << std::setfill('0') << std::right << filenum << ".out" << std::ends; std::string tempf = tout.str(); edm::FileInPath file( tempf.c_str() ); tempfile = (file.fullPath()).c_str(); @@ -2573,6 +2574,7 @@ int SiPixelTemplate::qbin(int id, float cotalpha, float cotbeta, float locBz, fl + ilow = ihigh = 0; auto xxratio = 0.f; { diff --git a/RecoLocalTracker/SiPixelRecHits/src/SiPixelTemplate2D.cc b/RecoLocalTracker/SiPixelRecHits/src/SiPixelTemplate2D.cc index dee2e5ead57aa..ec439219439f9 100644 --- a/RecoLocalTracker/SiPixelRecHits/src/SiPixelTemplate2D.cc +++ b/RecoLocalTracker/SiPixelRecHits/src/SiPixelTemplate2D.cc @@ -1,801 +1,1498 @@ -// -// SiPixelTemplate2D.cc Version 1.03 -// -// Full 2-D templates for cluster splitting, simulated cluster reweighting, and improved cluster probability -// -// Created by Morris Swartz on 12/01/09. -// 2009 __TheJohnsHopkinsUniversity__. -// -// V1.01 - fix qavg_ filling -// V1.02 - Add locBz to test if FPix use is out of range -// V1.03 - Fix edge checking on final template to increase template size and to properly truncate cluster -// - -//#include -//#include -#ifndef SI_PIXEL_TEMPLATE_STANDALONE -//#include -#else -#include -#endif -#include -#include -//#include "boost/multi_array.hpp" -#include -#include -#include -#include - - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE -#include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate2D.h" -#include "FWCore/ParameterSet/interface/FileInPath.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#define LOGERROR(x) LogError(x) -#define LOGINFO(x) LogInfo(x) -#define ENDL " " -#include "FWCore/Utilities/interface/Exception.h" -using namespace edm; -#else -#include "SiPixelTemplate2D.h" -#define LOGERROR(x) std::cout << x << ": " -#define LOGINFO(x) std::cout << x << ": " -#define ENDL std::endl -#endif - -//**************************************************************** -//! This routine initializes the global template structures from -//! an external file template_summary_zpNNNN where NNNN are four -//! digits of filenum. -//! \param filenum - an integer NNNN used in the filename template_summary_zpNNNN -//**************************************************************** -bool SiPixelTemplate2D::pushfile(int filenum, std::vector< SiPixelTemplateStore2D > & thePixelTemp_) -{ - // Add template stored in external file numbered filenum to theTemplateStore - - // Local variables - int i, j, k, l, iy, jx; - const char *tempfile; - // char title[80]; remove this - char c; - const int code_version={16}; - - - - // Create a filename for this run - - std::ostringstream tout; - - // Create different path in CMSSW than standalone - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - tout << "CalibTracker/SiPixelESProducers/data/template_summary2D_zp" - << std::setw(4) << std::setfill('0') << std::right << filenum << ".out" << std::ends; - std::string tempf = tout.str(); - edm::FileInPath file( tempf.c_str() ); - tempfile = (file.fullPath()).c_str(); -#else - tout << "template_summary2D_zp" << std::setw(4) << std::setfill('0') << std::right << filenum << ".out" << std::ends; - std::string tempf = tout.str(); - tempfile = tempf.c_str(); -#endif - - // open the template file - - std::ifstream in_file(tempfile, std::ios::in); - - if(in_file.is_open()) { - - // Create a local template storage entry - - SiPixelTemplateStore2D theCurrentTemp; - - // Read-in a header string first and print it - - for (i=0; (c=in_file.get()) != '\n'; ++i) { - if(i < 79) {theCurrentTemp.head.title[i] = c;} - } - if(i > 78) {i=78;} - theCurrentTemp.head.title[i+1] ='\0'; - LOGINFO("SiPixelTemplate2D") << "Loading Pixel Template File - " << theCurrentTemp.head.title << ENDL; - - // next, the header information - - in_file >> theCurrentTemp.head.ID >> theCurrentTemp.head.templ_version >> theCurrentTemp.head.Bfield >> theCurrentTemp.head.NTy >> theCurrentTemp.head.NTyx >> theCurrentTemp.head.NTxx - >> theCurrentTemp.head.Dtype >> theCurrentTemp.head.Vbias >> theCurrentTemp.head.temperature >> theCurrentTemp.head.fluence >> theCurrentTemp.head.qscale - >> theCurrentTemp.head.s50 >> theCurrentTemp.head.lorywidth >> theCurrentTemp.head.lorxwidth >> theCurrentTemp.head.ysize >> theCurrentTemp.head.xsize >> theCurrentTemp.head.zsize; - - if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file, no template load" << ENDL; return false;} - - LOGINFO("SiPixelTemplate2D") << "Template ID = " << theCurrentTemp.head.ID << ", Template Version " << theCurrentTemp.head.templ_version << ", Bfield = " << theCurrentTemp.head.Bfield - << ", NTy = " << theCurrentTemp.head.NTy << ", NTyx = " << theCurrentTemp.head.NTyx<< ", NTxx = " << theCurrentTemp.head.NTxx << ", Dtype = " << theCurrentTemp.head.Dtype - << ", Bias voltage " << theCurrentTemp.head.Vbias << ", temperature " - << theCurrentTemp.head.temperature << ", fluence " << theCurrentTemp.head.fluence << ", Q-scaling factor " << theCurrentTemp.head.qscale - << ", 1/2 threshold " << theCurrentTemp.head.s50 << ", y Lorentz Width " << theCurrentTemp.head.lorywidth << ", x Lorentz width " << theCurrentTemp.head.lorxwidth - << ", pixel x-size " << theCurrentTemp.head.xsize << ", y-size " << theCurrentTemp.head.ysize << ", zsize " << theCurrentTemp.head.zsize << ENDL; - - if(theCurrentTemp.head.templ_version != code_version) {LOGERROR("SiPixelTemplate2D") << "code expects version " << code_version << ", no template load" << ENDL; return false;} - - if(theCurrentTemp.head.NTy != 0) {LOGERROR("SiPixelTemplate2D") << "Trying to load 1-d template info into the 2-d template object, check your DB/global tag!" << ENDL; return false;} - - // next, layout the 2-d structure needed to store template - - theCurrentTemp.entry.resize(boost::extents[theCurrentTemp.head.NTyx][theCurrentTemp.head.NTxx]); - - // Read in the file info - - for (iy=0; iy < theCurrentTemp.head.NTyx; ++iy) { - for(jx=0; jx < theCurrentTemp.head.NTxx; ++jx) { - - in_file >> theCurrentTemp.entry[iy][jx].runnum >> theCurrentTemp.entry[iy][jx].costrk[0] - >> theCurrentTemp.entry[iy][jx].costrk[1] >> theCurrentTemp.entry[iy][jx].costrk[2]; - - if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 1, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} - - // Calculate cot(alpha) and cot(beta) for this entry - - theCurrentTemp.entry[iy][jx].cotalpha = theCurrentTemp.entry[iy][jx].costrk[0]/theCurrentTemp.entry[iy][jx].costrk[2]; - - theCurrentTemp.entry[iy][jx].cotbeta = theCurrentTemp.entry[iy][jx].costrk[1]/theCurrentTemp.entry[iy][jx].costrk[2]; - - in_file >> theCurrentTemp.entry[iy][jx].qavg >> theCurrentTemp.entry[iy][jx].pixmax >> theCurrentTemp.entry[iy][jx].sxymax >> theCurrentTemp.entry[iy][jx].iymin - >> theCurrentTemp.entry[iy][jx].iymax >> theCurrentTemp.entry[iy][jx].jxmin >> theCurrentTemp.entry[iy][jx].jxmax; - - if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 2, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} - - for (k=0; k<2; ++k) { - - in_file >> theCurrentTemp.entry[iy][jx].xypar[k][0] >> theCurrentTemp.entry[iy][jx].xypar[k][1] - >> theCurrentTemp.entry[iy][jx].xypar[k][2] >> theCurrentTemp.entry[iy][jx].xypar[k][3] >> theCurrentTemp.entry[iy][jx].xypar[k][4]; - - if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 3, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} - - } - - for (k=0; k<2; ++k) { - - in_file >> theCurrentTemp.entry[iy][jx].lanpar[k][0] >> theCurrentTemp.entry[iy][jx].lanpar[k][1] - >> theCurrentTemp.entry[iy][jx].lanpar[k][2] >> theCurrentTemp.entry[iy][jx].lanpar[k][3] >> theCurrentTemp.entry[iy][jx].lanpar[k][4]; - - if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 4, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} - - } - - for (l=0; l<7; ++l) { - for (k=0; k<7; ++k) { - for (j=0; j> theCurrentTemp.entry[iy][jx].xytemp[k][l][i][j];} - - if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 5, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} - } - } - } - - - in_file >> theCurrentTemp.entry[iy][jx].chi2minone >> theCurrentTemp.entry[iy][jx].chi2avgone >> theCurrentTemp.entry[iy][jx].chi2min[0] >> theCurrentTemp.entry[iy][jx].chi2avg[0] - >> theCurrentTemp.entry[iy][jx].chi2min[1] >> theCurrentTemp.entry[iy][jx].chi2avg[1]>> theCurrentTemp.entry[iy][jx].chi2min[2] >> theCurrentTemp.entry[iy][jx].chi2avg[2] - >> theCurrentTemp.entry[iy][jx].chi2min[3] >> theCurrentTemp.entry[iy][jx].chi2avg[3]; - - if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 6, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} - - in_file >> theCurrentTemp.entry[iy][jx].spare[0] >> theCurrentTemp.entry[iy][jx].spare[1] >> theCurrentTemp.entry[iy][jx].spare[2] >> theCurrentTemp.entry[iy][jx].spare[3] - >> theCurrentTemp.entry[iy][jx].spare[4] >> theCurrentTemp.entry[iy][jx].spare[5] >> theCurrentTemp.entry[iy][jx].spare[6] >> theCurrentTemp.entry[iy][jx].spare[7] - >> theCurrentTemp.entry[iy][jx].spare[8] >> theCurrentTemp.entry[iy][jx].spare[9]; - - if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 7, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} - - in_file >> theCurrentTemp.entry[iy][jx].spare[10] >> theCurrentTemp.entry[iy][jx].spare[11] >> theCurrentTemp.entry[iy][jx].spare[12] >> theCurrentTemp.entry[iy][jx].spare[13] - >> theCurrentTemp.entry[iy][jx].spare[14] >> theCurrentTemp.entry[iy][jx].spare[15] >> theCurrentTemp.entry[iy][jx].spare[16] >> theCurrentTemp.entry[iy][jx].spare[17] - >> theCurrentTemp.entry[iy][jx].spare[18] >> theCurrentTemp.entry[iy][jx].spare[19]; - - if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 8, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} - } - - } - - - in_file.close(); - - // Add this template to the store - - thePixelTemp_.push_back(theCurrentTemp); - - return true; - - } else { - - // If file didn't open, report this - - LOGERROR("SiPixelTemplate2D") << "Error opening File" << tempfile << ENDL; - return false; - - } - -} // TempInit - - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - -//**************************************************************** -//! This routine initializes the global template structures from an -//! external file template_summary_zpNNNN where NNNN are four digits -//! \param dbobject - db storing multiple template calibrations -//**************************************************************** -bool SiPixelTemplate2D::pushfile(const SiPixelTemplateDBObject& dbobject, std::vector< SiPixelTemplateStore2D > & thePixelTemp_) -{ - // Add template stored in external dbobject to theTemplateStore - - // Local variables - int i, j, k, l, iy, jx; - // const char *tempfile; - const int code_version={16}; - - // We must create a new object because dbobject must be a const and our stream must not be - SiPixelTemplateDBObject db = dbobject; - - // Create a local template storage entry - SiPixelTemplateStore2D theCurrentTemp; - - // Fill the template storage for each template calibration stored in the db - for(int m=0; m> theCurrentTemp.head.ID >> theCurrentTemp.head.templ_version >> theCurrentTemp.head.Bfield >> theCurrentTemp.head.NTy >> theCurrentTemp.head.NTyx >> theCurrentTemp.head.NTxx - >> theCurrentTemp.head.Dtype >> theCurrentTemp.head.Vbias >> theCurrentTemp.head.temperature >> theCurrentTemp.head.fluence >> theCurrentTemp.head.qscale - >> theCurrentTemp.head.s50 >> theCurrentTemp.head.lorywidth >> theCurrentTemp.head.lorxwidth >> theCurrentTemp.head.ysize >> theCurrentTemp.head.xsize >> theCurrentTemp.head.zsize; - - if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file, no template load" << ENDL; return false;} - - LOGINFO("SiPixelTemplate2D") << "Template ID = " << theCurrentTemp.head.ID << ", Template Version " << theCurrentTemp.head.templ_version << ", Bfield = " << theCurrentTemp.head.Bfield - << ", NTy = " << theCurrentTemp.head.NTy << ", NTyx = " << theCurrentTemp.head.NTyx<< ", NTxx = " << theCurrentTemp.head.NTxx << ", Dtype = " << theCurrentTemp.head.Dtype - << ", Bias voltage " << theCurrentTemp.head.Vbias << ", temperature " - << theCurrentTemp.head.temperature << ", fluence " << theCurrentTemp.head.fluence << ", Q-scaling factor " << theCurrentTemp.head.qscale - << ", 1/2 threshold " << theCurrentTemp.head.s50 << ", y Lorentz Width " << theCurrentTemp.head.lorywidth << ", x Lorentz width " << theCurrentTemp.head.lorxwidth - << ", pixel x-size " << theCurrentTemp.head.xsize << ", y-size " << theCurrentTemp.head.ysize << ", zsize " << theCurrentTemp.head.zsize << ENDL; - - if(theCurrentTemp.head.templ_version != code_version) {LOGERROR("SiPixelTemplate2D") << "code expects version " << code_version << ", no template load" << ENDL; return false;} - - if(theCurrentTemp.head.NTy != 0) {LOGERROR("SiPixelTemplate2D") << "Trying to load 1-d template info into the 2-d template object, check your DB/global tag!" << ENDL; return false;} - - // next, layout the 2-d structure needed to store template - - theCurrentTemp.entry.resize(boost::extents[theCurrentTemp.head.NTyx][theCurrentTemp.head.NTxx]); - - // Read in the file info - - for (iy=0; iy < theCurrentTemp.head.NTyx; ++iy) { - for(jx=0; jx < theCurrentTemp.head.NTxx; ++jx) { - - db >> theCurrentTemp.entry[iy][jx].runnum >> theCurrentTemp.entry[iy][jx].costrk[0] - >> theCurrentTemp.entry[iy][jx].costrk[1] >> theCurrentTemp.entry[iy][jx].costrk[2]; - - if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 1, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} - - // Calculate cot(alpha) and cot(beta) for this entry - - theCurrentTemp.entry[iy][jx].cotalpha = theCurrentTemp.entry[iy][jx].costrk[0]/theCurrentTemp.entry[iy][jx].costrk[2]; - - theCurrentTemp.entry[iy][jx].cotbeta = theCurrentTemp.entry[iy][jx].costrk[1]/theCurrentTemp.entry[iy][jx].costrk[2]; - - db >> theCurrentTemp.entry[iy][jx].qavg >> theCurrentTemp.entry[iy][jx].pixmax >> theCurrentTemp.entry[iy][jx].sxymax >> theCurrentTemp.entry[iy][jx].iymin - >> theCurrentTemp.entry[iy][jx].iymax >> theCurrentTemp.entry[iy][jx].jxmin >> theCurrentTemp.entry[iy][jx].jxmax; - - if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 2, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} - - for (k=0; k<2; ++k) { - - db >> theCurrentTemp.entry[iy][jx].xypar[k][0] >> theCurrentTemp.entry[iy][jx].xypar[k][1] - >> theCurrentTemp.entry[iy][jx].xypar[k][2] >> theCurrentTemp.entry[iy][jx].xypar[k][3] >> theCurrentTemp.entry[iy][jx].xypar[k][4]; - - if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 3, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} - - } - - for (k=0; k<2; ++k) { - - db >> theCurrentTemp.entry[iy][jx].lanpar[k][0] >> theCurrentTemp.entry[iy][jx].lanpar[k][1] - >> theCurrentTemp.entry[iy][jx].lanpar[k][2] >> theCurrentTemp.entry[iy][jx].lanpar[k][3] >> theCurrentTemp.entry[iy][jx].lanpar[k][4]; - - if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 4, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} - - } - - for (l=0; l<7; ++l) { - for (k=0; k<7; ++k) { - for (j=0; j> theCurrentTemp.entry[iy][jx].xytemp[k][l][i][j];} - - if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 5, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} - } - } - } - - - db >> theCurrentTemp.entry[iy][jx].chi2minone >> theCurrentTemp.entry[iy][jx].chi2avgone >> theCurrentTemp.entry[iy][jx].chi2min[0] >> theCurrentTemp.entry[iy][jx].chi2avg[0] - >> theCurrentTemp.entry[iy][jx].chi2min[1] >> theCurrentTemp.entry[iy][jx].chi2avg[1]>> theCurrentTemp.entry[iy][jx].chi2min[2] >> theCurrentTemp.entry[iy][jx].chi2avg[2] - >> theCurrentTemp.entry[iy][jx].chi2min[3] >> theCurrentTemp.entry[iy][jx].chi2avg[3]; - - if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 6, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} - - db >> theCurrentTemp.entry[iy][jx].spare[0] >> theCurrentTemp.entry[iy][jx].spare[1] >> theCurrentTemp.entry[iy][jx].spare[2] >> theCurrentTemp.entry[iy][jx].spare[3] - >> theCurrentTemp.entry[iy][jx].spare[4] >> theCurrentTemp.entry[iy][jx].spare[5] >> theCurrentTemp.entry[iy][jx].spare[6] >> theCurrentTemp.entry[iy][jx].spare[7] - >> theCurrentTemp.entry[iy][jx].spare[8] >> theCurrentTemp.entry[iy][jx].spare[9]; - - if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 7, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} - - db >> theCurrentTemp.entry[iy][jx].spare[10] >> theCurrentTemp.entry[iy][jx].spare[11] >> theCurrentTemp.entry[iy][jx].spare[12] >> theCurrentTemp.entry[iy][jx].spare[13] - >> theCurrentTemp.entry[iy][jx].spare[14] >> theCurrentTemp.entry[iy][jx].spare[15] >> theCurrentTemp.entry[iy][jx].spare[16] >> theCurrentTemp.entry[iy][jx].spare[17] - >> theCurrentTemp.entry[iy][jx].spare[18] >> theCurrentTemp.entry[iy][jx].spare[19]; - - if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 8, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} - - } - } - - } - - - // Add this template to the store - - thePixelTemp_.push_back(theCurrentTemp); - - return true; - -} // TempInit - -#endif - - - -// ************************************************************************************************************************************* -//! Interpolate stored 2-D information for input angles and hit position to make a 2-D template -//! \param id - (input) the id of the template -//! \param cotalpha - (input) the cotangent of the alpha track angle (see CMS IN 2004/014) -//! \param cotbeta - (input) the cotangent of the beta track angle (see CMS IN 2004/014) -//! \param locBz - (input) the sign of this quantity is used to determine whether to flip cot(beta)<0 quantities from cot(beta)>0 (FPix only) -//! for FPix IP-related tracks, locBz < 0 for cot(beta) > 0 and locBz > 0 for cot(beta) < 0 -//! \param xhit - (input) x-position of hit relative to the lower left corner of pixel[1][1] (to allow for the "padding" of the two-d clusters in the splitter) -//! \param yhit - (input) y-position of hit relative to the lower left corner of pixel[1][1] -//! \param ydouble - (input) STL vector of 21 element array to flag a double-pixel starting at cluster[1][1] -//! \param xdouble - (input) STL vector of 11 element array to flag a double-pixel starting at cluster[1][1] -//! \param template2d - (output) 2d template of size matched to the cluster. Input must be zeroed since charge is added only. -// ************************************************************************************************************************************* - -bool SiPixelTemplate2D::xytemp(int id, float cotalpha, float cotbeta, float locBz, float xhit, float yhit, std::vector& ydouble, std::vector& xdouble, float template2d[BXM2][BYM2]) -{ - // Interpolate for a new set of track angles - - // Local variables - int i, j; - int pixx, pixy, k0, k1, l0, l1, imidx, deltax, deltay, iflipy, imin, imax, jmin, jmax; - int m, n; - float acotb, dcota, dcotb, dx, dy, ddx, ddy, adx, ady, tmpxy; - bool flip_y; - // std::vector xrms(4), xgsig(4), xrmsc2m(4), xgsigc2m(4); - std::vector chi2xavg(4), chi2xmin(4); - - - // Check to see if interpolation is valid - - if(id != id_current_ || cotalpha != cota_current_ || cotbeta != cotb_current_) { - - cota_current_ = cotalpha; cotb_current_ = cotbeta; success_ = true; - - if(id != id_current_) { - - // Find the index corresponding to id - - index_id_ = -1; - for(i=0; i<(int)thePixelTemp_.size(); ++i) { - - if(id == thePixelTemp_[i].head.ID) { - - index_id_ = i; - id_current_ = id; - - // Copy the charge scaling factor to the private variable - - Dtype_ = thePixelTemp_[index_id_].head.Dtype; - - // Copy the charge scaling factor to the private variable - - qscale_ = thePixelTemp_[index_id_].head.qscale; - - // Copy the pseudopixel signal size to the private variable - - s50_ = thePixelTemp_[index_id_].head.s50; - - // Copy the Lorentz widths to private variables - - lorywidth_ = thePixelTemp_[index_id_].head.lorywidth; - lorxwidth_ = thePixelTemp_[index_id_].head.lorxwidth; - - // Copy the pixel sizes private variables - - xsize_ = thePixelTemp_[index_id_].head.xsize; - ysize_ = thePixelTemp_[index_id_].head.ysize; - zsize_ = thePixelTemp_[index_id_].head.zsize; - - // Determine the size of this template - - Nyx_ = thePixelTemp_[index_id_].head.NTyx; - Nxx_ = thePixelTemp_[index_id_].head.NTxx; -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(Nyx_ < 2 || Nxx_ < 2) { - throw cms::Exception("DataCorrupt") << "template ID = " << id_current_ << "has too few entries: Nyx/Nxx = " << Nyx_ << "/" << Nxx_ << std::endl; - } -#else - assert(Nyx_ > 1 && Nxx_ > 1); -#endif - imidx = Nxx_/2; - - cotalpha0_ = thePixelTemp_[index_id_].entry[0][0].cotalpha; - cotalpha1_ = thePixelTemp_[index_id_].entry[0][Nxx_-1].cotalpha; - deltacota_ = (cotalpha1_-cotalpha0_)/(float)(Nxx_-1); - - cotbeta0_ = thePixelTemp_[index_id_].entry[0][imidx].cotbeta; - cotbeta1_ = thePixelTemp_[index_id_].entry[Nyx_-1][imidx].cotbeta; - deltacotb_ = (cotbeta1_-cotbeta0_)/(float)(Nyx_-1); - - break; - } - } - } - } - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(index_id_ < 0 || index_id_ >= (int)thePixelTemp_.size()) { - throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::interpolate can't find needed template ID = " << id - << ", Are you using the correct global tag?" << std::endl; - } -#else - assert(index_id_ >= 0 && index_id_ < (int)thePixelTemp_.size()); -#endif - - // Check angle limits and et up interpolation parameters - - if(cotalpha < cotalpha0_) { - success_ = false; - jx0_ = 0; - jx1_ = 1; - adcota_ = 0.f; - } else if(cotalpha > cotalpha1_) { - success_ = false; - jx0_ = Nxx_ - 1; - jx1_ = jx0_ - 1; - adcota_ = 0.f; - } else { - jx0_ = (int)((cotalpha-cotalpha0_)/deltacota_+0.5f); - dcota = (cotalpha - (cotalpha0_ + jx0_*deltacota_))/deltacota_; - adcota_ = fabs(dcota); - if(dcota > 0.f) {jx1_ = jx0_ + 1;if(jx1_ > Nxx_-1) jx1_ = jx0_-1;} else {jx1_ = jx0_ - 1; if(jx1_ < 0) jx1_ = jx0_+1;} - } - - // Interpolate the absolute value of cot(beta) - - acotb = std::abs(cotbeta); - - if(acotb < cotbeta0_) { - success_ = false; - iy0_ = 0; - iy1_ = 1; - adcotb_ = 0.f; - } else if(acotb > cotbeta1_) { - success_ = false; - iy0_ = Nyx_ - 1; - iy1_ = iy0_ - 1; - adcotb_ = 0.f; - } else { - iy0_ = (int)((acotb-cotbeta0_)/deltacotb_+0.5f); - dcotb = (acotb - (cotbeta0_ + iy0_*deltacotb_))/deltacotb_; - adcotb_ = fabs(dcotb); - if(dcotb > 0.f) {iy1_ = iy0_ + 1; if(iy1_ > Nyx_-1) iy1_ = iy0_-1;} else {iy1_ = iy0_ - 1; if(iy1_ < 0) iy1_ = iy0_+1;} - } - - // This works only for IP-related tracks - - flip_y = false; - if(cotbeta < 0.f) {flip_y = true;} - - // If Fpix-related track has wrong cotbeta-field correlation, return false to trigger simple template instead - - if(Dtype_ == 1) { - if(cotbeta*locBz > 0.f) success_ = false; - } - - // Interpolate things in cot(alpha)-cot(beta) - - qavg_ = thePixelTemp_[index_id_].entry[iy0_][jx0_].qavg - +adcota_*(thePixelTemp_[index_id_].entry[iy0_][jx1_].qavg - thePixelTemp_[index_id_].entry[iy0_][jx0_].qavg) - +adcotb_*(thePixelTemp_[index_id_].entry[iy1_][jx0_].qavg - thePixelTemp_[index_id_].entry[iy0_][jx0_].qavg); - - pixmax_ = thePixelTemp_[index_id_].entry[iy0_][jx0_].pixmax - +adcota_*(thePixelTemp_[index_id_].entry[iy0_][jx1_].pixmax - thePixelTemp_[index_id_].entry[iy0_][jx0_].pixmax) - +adcotb_*(thePixelTemp_[index_id_].entry[iy1_][jx0_].pixmax - thePixelTemp_[index_id_].entry[iy0_][jx0_].pixmax); - - sxymax_ = thePixelTemp_[index_id_].entry[iy0_][jx0_].sxymax - +adcota_*(thePixelTemp_[index_id_].entry[iy0_][jx1_].sxymax - thePixelTemp_[index_id_].entry[iy0_][jx0_].sxymax) - +adcotb_*(thePixelTemp_[index_id_].entry[iy1_][jx0_].sxymax - thePixelTemp_[index_id_].entry[iy0_][jx0_].sxymax); - - chi2avgone_ = thePixelTemp_[index_id_].entry[iy0_][jx0_].chi2avgone - +adcota_*(thePixelTemp_[index_id_].entry[iy0_][jx1_].chi2avgone - thePixelTemp_[index_id_].entry[iy0_][jx0_].chi2avgone) - +adcotb_*(thePixelTemp_[index_id_].entry[iy1_][jx0_].chi2avgone - thePixelTemp_[index_id_].entry[iy0_][jx0_].chi2avgone); - - chi2minone_ = thePixelTemp_[index_id_].entry[iy0_][jx0_].chi2minone - +adcota_*(thePixelTemp_[index_id_].entry[iy0_][jx1_].chi2minone - thePixelTemp_[index_id_].entry[iy0_][jx0_].chi2minone) - +adcotb_*(thePixelTemp_[index_id_].entry[iy1_][jx0_].chi2minone - thePixelTemp_[index_id_].entry[iy0_][jx0_].chi2minone); - - for(i=0; i<4 ; ++i) { - chi2avg_[i] = thePixelTemp_[index_id_].entry[iy0_][jx0_].chi2avg[i] - +adcota_*(thePixelTemp_[index_id_].entry[iy0_][jx1_].chi2avg[i] - thePixelTemp_[index_id_].entry[iy0_][jx0_].chi2avg[i]) - +adcotb_*(thePixelTemp_[index_id_].entry[iy1_][jx0_].chi2avg[i] - thePixelTemp_[index_id_].entry[iy0_][jx0_].chi2avg[i]); - - chi2min_[i] = thePixelTemp_[index_id_].entry[iy0_][jx0_].chi2min[i] - +adcota_*(thePixelTemp_[index_id_].entry[iy0_][jx1_].chi2min[i] - thePixelTemp_[index_id_].entry[iy0_][jx0_].chi2min[i]) - +adcotb_*(thePixelTemp_[index_id_].entry[iy1_][jx0_].chi2min[i] - thePixelTemp_[index_id_].entry[iy0_][jx0_].chi2min[i]); - } - - for(i=0; i<2 ; ++i) { - for(j=0; j<5 ; ++j) { - // Charge loss switches sides when cot(beta) changes sign - if(flip_y) { - xypary0x0_[1-i][j] = thePixelTemp_[index_id_].entry[iy0_][jx0_].xypar[i][j]; - xypary1x0_[1-i][j] = thePixelTemp_[index_id_].entry[iy1_][jx0_].xypar[i][j]; - xypary0x1_[1-i][j] = thePixelTemp_[index_id_].entry[iy0_][jx1_].xypar[i][j]; - lanpar_[1-i][j] = thePixelTemp_[index_id_].entry[iy0_][jx0_].lanpar[i][j] - +adcota_*(thePixelTemp_[index_id_].entry[iy0_][jx1_].lanpar[i][j] - thePixelTemp_[index_id_].entry[iy0_][jx0_].lanpar[i][j]) - +adcotb_*(thePixelTemp_[index_id_].entry[iy1_][jx0_].lanpar[i][j] - thePixelTemp_[index_id_].entry[iy0_][jx0_].lanpar[i][j]); - } else { - xypary0x0_[i][j] = thePixelTemp_[index_id_].entry[iy0_][jx0_].xypar[i][j]; - xypary1x0_[i][j] = thePixelTemp_[index_id_].entry[iy1_][jx0_].xypar[i][j]; - xypary0x1_[i][j] = thePixelTemp_[index_id_].entry[iy0_][jx1_].xypar[i][j]; - lanpar_[i][j] = thePixelTemp_[index_id_].entry[iy0_][jx0_].lanpar[i][j] - +adcota_*(thePixelTemp_[index_id_].entry[iy0_][jx1_].lanpar[i][j] - thePixelTemp_[index_id_].entry[iy0_][jx0_].lanpar[i][j]) - +adcotb_*(thePixelTemp_[index_id_].entry[iy1_][jx0_].lanpar[i][j] - thePixelTemp_[index_id_].entry[iy0_][jx0_].lanpar[i][j]); - } - } - } - - // next, determine the indices of the closest point in k (y-displacement), l (x-displacement) - // pixy and pixx are the indices of the struck pixel in the (Ty,Tx) system - // k0,k1 are the k-indices of the closest and next closest point - // l0,l1 are the l-indices of the closest and next closest point - - pixy = (int)floorf(yhit/ysize_); - dy = yhit-(pixy+0.5f)*ysize_; - if(flip_y) {dy = -dy;} - k0 = (int)(dy/ysize_*6.f+3.5f); - if(k0 < 0) k0 = 0; - if(k0 > 6) k0 = 6; - ddy = 6.f*dy/ysize_ - (k0-3); - ady = fabs(ddy); - if(ddy > 0.f) {k1 = k0 + 1; if(k1 > 6) k1 = k0-1;} else {k1 = k0 - 1; if(k1 < 0) k1 = k0+1;} - pixx = (int)floorf(xhit/xsize_); - dx = xhit-(pixx+0.5f)*xsize_; - l0 = (int)(dx/xsize_*6.f+3.5f); - if(l0 < 0) l0 = 0; - if(l0 > 6) l0 = 6; - ddx = 6.f*dx/xsize_ - (l0-3); - adx = fabs(ddx); - if(ddx > 0.f) {l1 = l0 + 1; if(l1 > 6) l1 = l0-1;} else {l1 = l0 - 1; if(l1 < 0) l1 = l0+1;} - - // OK, lets do the template interpolation. - - // First find the limits of the indices for non-zero pixels - - imin = std::min(thePixelTemp_[index_id_].entry[iy0_][jx0_].iymin,thePixelTemp_[index_id_].entry[iy1_][jx0_].iymin); - imin = std::min(imin,thePixelTemp_[index_id_].entry[iy0_][jx1_].iymin); - - jmin = std::min(thePixelTemp_[index_id_].entry[iy0_][jx0_].jxmin,thePixelTemp_[index_id_].entry[iy1_][jx0_].jxmin); - jmin = std::min(jmin,thePixelTemp_[index_id_].entry[iy0_][jx1_].jxmin); - - imax = std::max(thePixelTemp_[index_id_].entry[iy0_][jx0_].iymax,thePixelTemp_[index_id_].entry[iy1_][jx0_].iymax); - imax = std::max(imax,thePixelTemp_[index_id_].entry[iy0_][jx1_].iymax); - - jmax = std::max(thePixelTemp_[index_id_].entry[iy0_][jx0_].jxmax,thePixelTemp_[index_id_].entry[iy1_][jx0_].jxmax); - jmax = std::max(jmax,thePixelTemp_[index_id_].entry[iy0_][jx1_].jxmax); - - // Calculate the x and y offsets to make the new template - - // First, shift the struck pixel coordinates to the (Ty+2, Tx+2) system - - ++pixy; ++pixx; - - // In the template store, the struck pixel is always (THy,THx) - - deltax = pixx - T2HX; - deltay = pixy - T2HY; - - // First zero the local 2-d template - - for(j=0; j=0 && m<=BXM3 && n>=0 && n<=BYM3) { - tmpxy = thePixelTemp_[index_id_].entry[iy0_][jx0_].xytemp[k0][l0][i][j] - + adx*(thePixelTemp_[index_id_].entry[iy0_][jx0_].xytemp[k0][l1][i][j] - thePixelTemp_[index_id_].entry[iy0_][jx0_].xytemp[k0][l0][i][j]) - + ady*(thePixelTemp_[index_id_].entry[iy0_][jx0_].xytemp[k1][l0][i][j] - thePixelTemp_[index_id_].entry[iy0_][jx0_].xytemp[k0][l0][i][j]) - + adcota_*(thePixelTemp_[index_id_].entry[iy0_][jx1_].xytemp[k0][l0][i][j] - thePixelTemp_[index_id_].entry[iy0_][jx0_].xytemp[k0][l0][i][j]) - + adcotb_*(thePixelTemp_[index_id_].entry[iy1_][jx0_].xytemp[k0][l0][i][j] - thePixelTemp_[index_id_].entry[iy0_][jx0_].xytemp[k0][l0][i][j]); - if(tmpxy > 0.f) {xytemp_[m][n] = tmpxy;} else {xytemp_[m][n] = 0.f;} - } - } - } - - //combine rows and columns to simulate double pixels - - for(n=1; n 0.f) {template2d[m][n] += xytemp_[m][n];} - } - } - - return success_; -} // xytemp - - - -// ************************************************************************************************************************************* -//! Interpolate stored 2-D information for input angles and hit position to make a 2-D template -//! \param id - (input) the id of the template -//! \param cotalpha - (input) the cotangent of the alpha track angle (see CMS IN 2004/014) -//! \param cotbeta - (input) the cotangent of the beta track angle (see CMS IN 2004/014) -//! \param xhit - (input) x-position of hit relative to the lower left corner of pixel[1][1] (to allow for the "padding" of the two-d clusters in the splitter) -//! \param yhit - (input) y-position of hit relative to the lower left corner of pixel[1][1] -//! \param ydouble - (input) STL vector of 21 element array to flag a double-pixel starting at cluster[1][1] -//! \param xdouble - (input) STL vector of 11 element array to flag a double-pixel starting at cluster[1][1] -//! \param template2d - (output) 2d template of size matched to the cluster. Input must be zeroed since charge is added only. -// ************************************************************************************************************************************* - -bool SiPixelTemplate2D::xytemp(int id, float cotalpha, float cotbeta, float xhit, float yhit, std::vector& ydouble, std::vector& xdouble, float template2d[BXM2][BYM2]) -{ - // Interpolate for a new set of track angles - - // Local variables - float locBz = -1; - if(cotbeta < 0.f) {locBz = -locBz;} - - return SiPixelTemplate2D::xytemp(id, cotalpha, cotbeta, locBz, xhit, yhit, ydouble, xdouble, template2d); - -} // xytemp - - - -// ************************************************************************************************************ -//! Return y error (squared) for an input signal and yindex -//! Add large Q scaling for use in cluster splitting. -//! \param qpixel - (input) pixel charge -//! \param index - (input) y-index index of pixel -//! \param xysig2 - (output) square error -// ************************************************************************************************************ -void SiPixelTemplate2D::xysigma2(float qpixel, int index, float& xysig2) - -{ - // Interpolate using quantities already stored in the private variables - - // Local variables - float sigi, sigi2, sigi3, sigi4, qscale, err2, err00; - - // Make sure that input is OK - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(index < 2 || index >= BYM2) { - throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::ysigma2 called with index = " << index << std::endl; - } -#else - assert(index > 1 && index < BYM2); -#endif - - // Define the maximum signal to use in the parameterization - - // Evaluate pixel-by-pixel uncertainties (weights) for the templ analysis - - if(qpixel < sxymax_) { - sigi = qpixel; - qscale = 1.f; - } else { - sigi = sxymax_; - qscale = qpixel/sxymax_; - } - sigi2 = sigi*sigi; sigi3 = sigi2*sigi; sigi4 = sigi3*sigi; - if(index <= THXP1) { - err00 = xypary0x0_[0][0]+xypary0x0_[0][1]*sigi+xypary0x0_[0][2]*sigi2+xypary0x0_[0][3]*sigi3+xypary0x0_[0][4]*sigi4; - err2 = err00 - +adcota_*(xypary0x1_[0][0]+xypary0x1_[0][1]*sigi+xypary0x1_[0][2]*sigi2+xypary0x1_[0][3]*sigi3+xypary0x1_[0][4]*sigi4 - err00) - +adcotb_*(xypary1x0_[0][0]+xypary1x0_[0][1]*sigi+xypary1x0_[0][2]*sigi2+xypary1x0_[0][3]*sigi3+xypary1x0_[0][4]*sigi4 - err00); - } else { - err00 = xypary0x0_[1][0]+xypary0x0_[1][1]*sigi+xypary0x0_[1][2]*sigi2+xypary0x0_[1][3]*sigi3+xypary0x0_[1][4]*sigi4; - err2 = err00 - +adcota_*(xypary0x1_[1][0]+xypary0x1_[1][1]*sigi+xypary0x1_[1][2]*sigi2+xypary0x1_[1][3]*sigi3+xypary0x1_[1][4]*sigi4 - err00) - +adcotb_*(xypary1x0_[1][0]+xypary1x0_[1][1]*sigi+xypary1x0_[1][2]*sigi2+xypary1x0_[1][3]*sigi3+xypary1x0_[1][4]*sigi4 - err00); - } - xysig2 =qscale*err2; - if(xysig2 <= 0.f) {LOGERROR("SiPixelTemplate2D") << "neg y-error-squared, id = " << id_current_ << ", index = " << index_id_ << - ", cot(alpha) = " << cota_current_ << ", cot(beta) = " << cotb_current_ << ", sigi = " << sigi << ENDL;} - - return; - -} // End xysigma2 - - -// ************************************************************************************************************ -//! Return the Landau probability parameters for this set of cot(alpha, cot(beta) -// ************************************************************************************************************ -void SiPixelTemplate2D::landau_par(float lanpar[2][5]) - -{ - // Interpolate using quantities already stored in the private variables - - // Local variables - int i,j; - for(i=0; i<2; ++i) { - for(j=0; j<5; ++j) { - lanpar[i][j] = lanpar_[i][j]; - } - } - return; - -} // End lan_par - - - +// +// SiPixelTemplate2D.cc Version 2.35 +// +// Full 2-D templates for cluster splitting, simulated cluster reweighting, and improved cluster probability +// +// Created by Morris Swartz on 12/01/09. +// 2009 __TheJohnsHopkinsUniversity__. +// +// V1.01 - fix qavg_ filling +// V1.02 - Add locBz to test if FPix use is out of range +// V1.03 - Fix edge checking on final template to increase template size and to properly truncate cluster +// v2.00 - Major changes to accommodate 2D reconstruction +// v2.10 - Change chi2 and error scaling information to work with partially reconstructed clusters +// v2.20 - Add cluster charge probability information, side loading for template generation +// v2.21 - Double derivative interval [improves fit convergence] +// v2.25 - Resize template store to accommodate FPix Templates +// v2.30 - Fix bug found by P. Shuetze that compromises sqlite file loading +// v2.35 - Add directory path selection to the ascii pushfile method +// +// + +//#include +//#include +#ifndef SI_PIXEL_TEMPLATE_STANDALONE +//#include +#else +#include +#endif +#include +#include +//#include "boost/multi_array.hpp" +#include +#include +#include +#include + + +#ifndef SI_PIXEL_TEMPLATE_STANDALONE +#include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate2D.h" +#include "FWCore/ParameterSet/interface/FileInPath.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#define LOGERROR(x) LogError(x) +#define LOGINFO(x) LogInfo(x) +#define ENDL " " +#include "FWCore/Utilities/interface/Exception.h" +using namespace edm; +#else +#include "SiPixelTemplate2D.h" +#define LOGERROR(x) std::cout << x << ": " +#define LOGINFO(x) std::cout << x << ": " +#define ENDL std::endl +#endif + +//**************************************************************** +//! This routine initializes the global template structures from +//! an external file template_summary_zpNNNN where NNNN are four +//! digits of filenum. +//! \param filenum - an integer NNNN used in the filename template_summary_zpNNNN +//**************************************************************** +bool SiPixelTemplate2D::pushfile(int filenum, std::vector< SiPixelTemplateStore2D > & thePixelTemp_, std::string dir) +{ + // Add template stored in external file numbered filenum to theTemplateStore + + // Local variables + int i, j, k, l, iy, jx; + const char *tempfile; + // char title[80]; remove this + char c; + const int code_version={21}; + + + + // Create a filename for this run + + std::ostringstream tout; + + // Create different path in CMSSW than standalone + +#ifndef SI_PIXEL_TEMPLATE_STANDALONE + tout << dir << "template_summary2D_zp" + << std::setw(4) << std::setfill('0') << std::right << filenum << ".out" << std::ends; + std::string tempf = tout.str(); + edm::FileInPath file( tempf.c_str() ); + tempfile = (file.fullPath()).c_str(); +#else + tout << "template_summary2D_zp" << std::setw(4) << std::setfill('0') << std::right << filenum << ".out" << std::ends; + std::string tempf = tout.str(); + tempfile = tempf.c_str(); +#endif + + // open the template file + + std::ifstream in_file(tempfile, std::ios::in); + + if(in_file.is_open()) { + + // Create a local template storage entry + + SiPixelTemplateStore2D theCurrentTemp; + + // Read-in a header string first and print it + + for (i=0; (c=in_file.get()) != '\n'; ++i) { + if(i < 79) {theCurrentTemp.head.title[i] = c;} + } + if(i > 78) {i=78;} + theCurrentTemp.head.title[i+1] ='\0'; + LOGINFO("SiPixelTemplate2D") << "Loading Pixel Template File - " << theCurrentTemp.head.title << ENDL; + + // next, the header information + in_file >> theCurrentTemp.head.ID >> theCurrentTemp.head.templ_version >> theCurrentTemp.head.Bfield >> theCurrentTemp.head.NTy >> theCurrentTemp.head.NTyx >> theCurrentTemp.head.NTxx + >> theCurrentTemp.head.Dtype >> theCurrentTemp.head.Vbias >> theCurrentTemp.head.temperature >> theCurrentTemp.head.fluence >> theCurrentTemp.head.qscale + >> theCurrentTemp.head.s50 >> theCurrentTemp.head.lorywidth >> theCurrentTemp.head.lorxwidth >> theCurrentTemp.head.ysize >> theCurrentTemp.head.xsize >> theCurrentTemp.head.zsize; + + if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 0A, no template load" << ENDL; return false;} + + if(theCurrentTemp.head.templ_version > 17) { + in_file >> theCurrentTemp.head.ss50 >> theCurrentTemp.head.lorybias + >> theCurrentTemp.head.lorxbias >> theCurrentTemp.head.fbin[0] + >> theCurrentTemp.head.fbin[1] >> theCurrentTemp.head.fbin[2]; + + if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 0B, no template load" + << ENDL; return false;} + } else { + theCurrentTemp.head.ss50 = theCurrentTemp.head.s50; + theCurrentTemp.head.lorybias = theCurrentTemp.head.lorywidth/2.f; + theCurrentTemp.head.lorxbias = theCurrentTemp.head.lorxwidth/2.f; + theCurrentTemp.head.fbin[0] = 1.5f; + theCurrentTemp.head.fbin[1] = 1.00f; + theCurrentTemp.head.fbin[2] = 0.85f; + } + + LOGINFO("SiPixelTemplate2D") << "Template ID = " << theCurrentTemp.head.ID << ", Template Version " << theCurrentTemp.head.templ_version << ", Bfield = " << theCurrentTemp.head.Bfield + << ", NTy = " << theCurrentTemp.head.NTy << ", NTyx = " << theCurrentTemp.head.NTyx<< ", NTxx = " << theCurrentTemp.head.NTxx << ", Dtype = " << theCurrentTemp.head.Dtype + << ", Bias voltage " << theCurrentTemp.head.Vbias << ", temperature " + << theCurrentTemp.head.temperature << ", fluence " << theCurrentTemp.head.fluence << ", Q-scaling factor " << theCurrentTemp.head.qscale + << ", 1/2 multi dcol threshold " << theCurrentTemp.head.s50 << ", 1/2 single dcol threshold " << theCurrentTemp.head.ss50 + << ", y Lorentz Width " << theCurrentTemp.head.lorywidth << ", y Lorentz Bias " << theCurrentTemp.head.lorybias + << ", x Lorentz width " << theCurrentTemp.head.lorxwidth << ", x Lorentz Bias " << theCurrentTemp.head.lorxbias + << ", Q/Q_avg fractions for Qbin defs " << theCurrentTemp.head.fbin[0] << ", " << theCurrentTemp.head.fbin[1] + << ", " << theCurrentTemp.head.fbin[2] + << ", pixel x-size " << theCurrentTemp.head.xsize << ", y-size " << theCurrentTemp.head.ysize << ", zsize " << theCurrentTemp.head.zsize << ENDL; + + if(theCurrentTemp.head.templ_version < code_version) {LOGERROR("SiPixelTemplate2D") << "code expects version " << code_version << ", no template load" << ENDL; return false;} + + if(theCurrentTemp.head.NTy != 0) {LOGERROR("SiPixelTemplate2D") << "Trying to load 1-d template info into the 2-d template object, check your DB/global tag!" << ENDL; return false;} + + +#ifdef SI_PIXEL_TEMPLATE_USE_BOOST + + // next, layout the 2-d structure needed to store template + + theCurrentTemp.entry.resize(boost::extents[theCurrentTemp.head.NTyx][theCurrentTemp.head.NTxx]); + +#endif + + // Read in the file info + + for (iy=0; iy < theCurrentTemp.head.NTyx; ++iy) { + for(jx=0; jx < theCurrentTemp.head.NTxx; ++jx) { + + in_file >> theCurrentTemp.entry[iy][jx].runnum >> theCurrentTemp.entry[iy][jx].costrk[0] + >> theCurrentTemp.entry[iy][jx].costrk[1] >> theCurrentTemp.entry[iy][jx].costrk[2]; + + if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 1, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} + + // Calculate cot(alpha) and cot(beta) for this entry + + theCurrentTemp.entry[iy][jx].cotalpha = theCurrentTemp.entry[iy][jx].costrk[0]/theCurrentTemp.entry[iy][jx].costrk[2]; + + theCurrentTemp.entry[iy][jx].cotbeta = theCurrentTemp.entry[iy][jx].costrk[1]/theCurrentTemp.entry[iy][jx].costrk[2]; + + in_file >> theCurrentTemp.entry[iy][jx].qavg >> theCurrentTemp.entry[iy][jx].pixmax >> theCurrentTemp.entry[iy][jx].sxymax >> theCurrentTemp.entry[iy][jx].iymin + >> theCurrentTemp.entry[iy][jx].iymax >> theCurrentTemp.entry[iy][jx].jxmin >> theCurrentTemp.entry[iy][jx].jxmax; + + if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 2, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} + + for (k=0; k<2; ++k) { + + in_file >> theCurrentTemp.entry[iy][jx].xypar[k][0] >> theCurrentTemp.entry[iy][jx].xypar[k][1] + >> theCurrentTemp.entry[iy][jx].xypar[k][2] >> theCurrentTemp.entry[iy][jx].xypar[k][3] >> theCurrentTemp.entry[iy][jx].xypar[k][4]; + + if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 3, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} + + } + + for (k=0; k<2; ++k) { + + in_file >> theCurrentTemp.entry[iy][jx].lanpar[k][0] >> theCurrentTemp.entry[iy][jx].lanpar[k][1] + >> theCurrentTemp.entry[iy][jx].lanpar[k][2] >> theCurrentTemp.entry[iy][jx].lanpar[k][3] >> theCurrentTemp.entry[iy][jx].lanpar[k][4]; + + if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 4, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} + + } + + for (l=0; l<7; ++l) { + for (k=0; k<7; ++k) { + for (j=0; j> theCurrentTemp.entry[iy][jx].xytemp[k][l][i][j];} + + if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 5, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} + } + } + } + + + in_file >> theCurrentTemp.entry[iy][jx].chi2ppix >> theCurrentTemp.entry[iy][jx].chi2scale >> theCurrentTemp.entry[iy][jx].offsetx[0] >> theCurrentTemp.entry[iy][jx].offsetx[1] + >> theCurrentTemp.entry[iy][jx].offsetx[2] >> theCurrentTemp.entry[iy][jx].offsetx[3]>> theCurrentTemp.entry[iy][jx].offsety[0] >> theCurrentTemp.entry[iy][jx].offsety[1] + >> theCurrentTemp.entry[iy][jx].offsety[2] >> theCurrentTemp.entry[iy][jx].offsety[3]; + + if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 6, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} + + in_file >> theCurrentTemp.entry[iy][jx].clsleny >> theCurrentTemp.entry[iy][jx].clslenx >> theCurrentTemp.entry[iy][jx].mpvvav >> theCurrentTemp.entry[iy][jx].sigmavav + >> theCurrentTemp.entry[iy][jx].kappavav >> theCurrentTemp.entry[iy][jx].scalexavg >> theCurrentTemp.entry[iy][jx].scaleyavg >> theCurrentTemp.entry[iy][jx].delyavg >> theCurrentTemp.entry[iy][jx].delysig >> theCurrentTemp.entry[iy][jx].spare[0]; + + if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 7, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} + + in_file >> theCurrentTemp.entry[iy][jx].scalex[0] >> theCurrentTemp.entry[iy][jx].scalex[1] >> theCurrentTemp.entry[iy][jx].scalex[2] >> theCurrentTemp.entry[iy][jx].scalex[3] + >> theCurrentTemp.entry[iy][jx].scaley[0] >> theCurrentTemp.entry[iy][jx].scaley[1] >> theCurrentTemp.entry[iy][jx].scaley[2] >> theCurrentTemp.entry[iy][jx].scaley[3] + >> theCurrentTemp.entry[iy][jx].spare[1] >> theCurrentTemp.entry[iy][jx].spare[2]; + + if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 8, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} + + } + + } + + + in_file.close(); + + // Add this template to the store + + thePixelTemp_.push_back(theCurrentTemp); + + return true; + + } else { + + // If file didn't open, report this + + LOGERROR("SiPixelTemplate2D") << "Error opening File" << tempfile << ENDL; + return false; + + } + +} // TempInit + + +#ifndef SI_PIXEL_TEMPLATE_STANDALONE + +//**************************************************************** +//! This routine initializes the global template structures from an +//! external file template_summary_zpNNNN where NNNN are four digits +//! \param dbobject - db storing multiple template calibrations +//**************************************************************** +bool SiPixelTemplate2D::pushfile(const SiPixel2DTemplateDBObject& dbobject, std::vector< SiPixelTemplateStore2D > & thePixelTemp_) +{ + // Add template stored in external dbobject to theTemplateStore + + // Local variables + int i, j, k, l, iy, jx; + // const char *tempfile; + const int code_version={21}; + + // We must create a new object because dbobject must be a const and our stream must not be + SiPixel2DTemplateDBObject db = dbobject; + + // Create a local template storage entry + SiPixelTemplateStore2D theCurrentTemp; + + // Fill the template storage for each template calibration stored in the db + for(int m=0; m> theCurrentTemp.head.ID >> theCurrentTemp.head.templ_version >> theCurrentTemp.head.Bfield >> theCurrentTemp.head.NTy >> theCurrentTemp.head.NTyx >> theCurrentTemp.head.NTxx + >> theCurrentTemp.head.Dtype >> theCurrentTemp.head.Vbias >> theCurrentTemp.head.temperature >> theCurrentTemp.head.fluence >> theCurrentTemp.head.qscale + >> theCurrentTemp.head.s50 >> theCurrentTemp.head.lorywidth >> theCurrentTemp.head.lorxwidth >> theCurrentTemp.head.ysize >> theCurrentTemp.head.xsize >> theCurrentTemp.head.zsize; + + if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 0A, no template load" << ENDL; return false;} + + LOGINFO("SiPixelTemplate2D") << "Loading Pixel Template File - " << theCurrentTemp.head.title + <<" code version = "< 17) { + db >> theCurrentTemp.head.ss50 >> theCurrentTemp.head.lorybias >> theCurrentTemp.head.lorxbias >> theCurrentTemp.head.fbin[0] >> theCurrentTemp.head.fbin[1] >> theCurrentTemp.head.fbin[2]; + + if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 0B, no template load" + << ENDL; return false;} + } else { + theCurrentTemp.head.ss50 = theCurrentTemp.head.s50; + theCurrentTemp.head.lorybias = theCurrentTemp.head.lorywidth/2.f; + theCurrentTemp.head.lorxbias = theCurrentTemp.head.lorxwidth/2.f; + theCurrentTemp.head.fbin[0] = 1.50f; + theCurrentTemp.head.fbin[1] = 1.00f; + theCurrentTemp.head.fbin[2] = 0.85f; + //std::cout<<" set fbin "<< theCurrentTemp.head.fbin[0]<<" "<> theCurrentTemp.entry[iy][jx].runnum >> theCurrentTemp.entry[iy][jx].costrk[0] + >> theCurrentTemp.entry[iy][jx].costrk[1] >> theCurrentTemp.entry[iy][jx].costrk[2]; + + if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 1, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} + + // Calculate cot(alpha) and cot(beta) for this entry + + theCurrentTemp.entry[iy][jx].cotalpha = theCurrentTemp.entry[iy][jx].costrk[0]/theCurrentTemp.entry[iy][jx].costrk[2]; + + theCurrentTemp.entry[iy][jx].cotbeta = theCurrentTemp.entry[iy][jx].costrk[1]/theCurrentTemp.entry[iy][jx].costrk[2]; + + db >> theCurrentTemp.entry[iy][jx].qavg >> theCurrentTemp.entry[iy][jx].pixmax >> theCurrentTemp.entry[iy][jx].sxymax >> theCurrentTemp.entry[iy][jx].iymin + >> theCurrentTemp.entry[iy][jx].iymax >> theCurrentTemp.entry[iy][jx].jxmin >> theCurrentTemp.entry[iy][jx].jxmax; + + if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 2, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} + + for (k=0; k<2; ++k) { + + db >> theCurrentTemp.entry[iy][jx].xypar[k][0] >> theCurrentTemp.entry[iy][jx].xypar[k][1] + >> theCurrentTemp.entry[iy][jx].xypar[k][2] >> theCurrentTemp.entry[iy][jx].xypar[k][3] >> theCurrentTemp.entry[iy][jx].xypar[k][4]; + + if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 3, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} + + } + + for (k=0; k<2; ++k) { + + db >> theCurrentTemp.entry[iy][jx].lanpar[k][0] >> theCurrentTemp.entry[iy][jx].lanpar[k][1] + >> theCurrentTemp.entry[iy][jx].lanpar[k][2] >> theCurrentTemp.entry[iy][jx].lanpar[k][3] >> theCurrentTemp.entry[iy][jx].lanpar[k][4]; + + if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 4, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} + + } + + for (l=0; l<7; ++l) { + for (k=0; k<7; ++k) { + for (j=0; j> theCurrentTemp.entry[iy][jx].xytemp[k][l][i][j];} + + if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 5, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} + } + } + } + + db >> theCurrentTemp.entry[iy][jx].chi2ppix >> theCurrentTemp.entry[iy][jx].chi2scale >> theCurrentTemp.entry[iy][jx].offsetx[0] >> theCurrentTemp.entry[iy][jx].offsetx[1] + >> theCurrentTemp.entry[iy][jx].offsetx[2] >> theCurrentTemp.entry[iy][jx].offsetx[3]>> theCurrentTemp.entry[iy][jx].offsety[0] >> theCurrentTemp.entry[iy][jx].offsety[1] + >> theCurrentTemp.entry[iy][jx].offsety[2] >> theCurrentTemp.entry[iy][jx].offsety[3]; + + if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 6, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} + + db >> theCurrentTemp.entry[iy][jx].clsleny >> theCurrentTemp.entry[iy][jx].clslenx >> theCurrentTemp.entry[iy][jx].mpvvav >> theCurrentTemp.entry[iy][jx].sigmavav + >> theCurrentTemp.entry[iy][jx].kappavav >> theCurrentTemp.entry[iy][jx].scalexavg >> theCurrentTemp.entry[iy][jx].scaleyavg >> theCurrentTemp.entry[iy][jx].delyavg >> theCurrentTemp.entry[iy][jx].delysig >> theCurrentTemp.entry[iy][jx].spare[0]; + + if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 7, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} + + db >> theCurrentTemp.entry[iy][jx].scalex[0] >> theCurrentTemp.entry[iy][jx].scalex[1] >> theCurrentTemp.entry[iy][jx].scalex[2] >> theCurrentTemp.entry[iy][jx].scalex[3] + >> theCurrentTemp.entry[iy][jx].scaley[0] >> theCurrentTemp.entry[iy][jx].scaley[1] >> theCurrentTemp.entry[iy][jx].scaley[2] >> theCurrentTemp.entry[iy][jx].scaley[3] + >> theCurrentTemp.entry[iy][jx].spare[1] >> theCurrentTemp.entry[iy][jx].spare[2]; + + if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 8, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} + + + } + } + +// Add this template to the store + + thePixelTemp_.push_back(theCurrentTemp); + + } + + + return true; + +} // TempInit + +#endif + + +// ************************************************************************************************************************************* +//! Interpolate stored 2-D information for input angles +//! \param id - (input) the id of the template +//! \param cotalpha - (input) the cotangent of the alpha track angle (see CMS IN 2004/014) +//! \param cotbeta - (input) the cotangent of the beta track angle (see CMS IN 2004/014) +//! \param locBz - (input) the sign of this quantity is used to determine whether to flip cot(beta)<0 quantities from cot(beta)>0 (FPix only) +//! for Phase 0 FPix IP-related tracks, locBz < 0 for cot(beta) > 0 and locBz > 0 for cot(beta) < 0 +//! for Phase 1 FPix IP-related tracks, see next comment +//! \param locBx - (input) the sign of this quantity is used to determine whether to flip cot(alpha/beta)<0 quantities from cot(alpha/beta)>0 (FPix only) +//! for Phase 1 FPix IP-related tracks, locBx/locBz > 0 for cot(alpha) > 0 and locBx/locBz < 0 for cot(alpha) < 0 +//! for Phase 1 FPix IP-related tracks, locBx > 0 for cot(beta) > 0 and locBx < 0 for cot(beta) < 0 +// ************************************************************************************************************************************* + +bool SiPixelTemplate2D::interpolate(int id, float cotalpha, float cotbeta, float locBz, float locBx) +{ + + + // Interpolate for a new set of track angles + + // Local variables + int i, j, imidx; + // int pixx, pixy, k0, k1, l0, l1, deltax, deltay, iflipy, jflipx, imin, imax, jmin, jmax; + // int m, n; + float acotb, dcota, dcotb; + + // Check to see if interpolation is valid + + if(id != id_current_ || cotalpha != cota_current_ || cotbeta != cotb_current_) { + + cota_current_ = cotalpha; cotb_current_ = cotbeta; success_ = true; + + if(id != id_current_) { + + // Find the index corresponding to id + + index_id_ = -1; + for(i=0; i<(int)thePixelTemp_.size(); ++i) { + + if(id == thePixelTemp_[i].head.ID) { + + index_id_ = i; + id_current_ = id; + + // Copy the charge scaling factor to the private variable + + Dtype_ = thePixelTemp_[index_id_].head.Dtype; + + // Copy the charge scaling factor to the private variable + + qscale_ = thePixelTemp_[index_id_].head.qscale; + + // Copy the pseudopixel signal size to the private variable + + s50_ = thePixelTemp_[index_id_].head.s50; + + // Copy Qbinning info to private variables + + for(j=0; j<3; ++j) {fbin_[j] = thePixelTemp_[index_id_].head.fbin[j];} + + // Copy the Lorentz widths to private variables + + lorywidth_ = thePixelTemp_[index_id_].head.lorywidth; + lorxwidth_ = thePixelTemp_[index_id_].head.lorxwidth; + + // Copy the pixel sizes private variables + + xsize_ = thePixelTemp_[index_id_].head.xsize; + ysize_ = thePixelTemp_[index_id_].head.ysize; + zsize_ = thePixelTemp_[index_id_].head.zsize; + + // Determine the size of this template + + Nyx_ = thePixelTemp_[index_id_].head.NTyx; + Nxx_ = thePixelTemp_[index_id_].head.NTxx; +#ifndef SI_PIXEL_TEMPLATE_STANDALONE + if(Nyx_ < 2 || Nxx_ < 2) { + throw cms::Exception("DataCorrupt") << "template ID = " << id_current_ << "has too few entries: Nyx/Nxx = " << Nyx_ << "/" << Nxx_ << std::endl; + } +#else + assert(Nyx_ > 1 && Nxx_ > 1); +#endif + imidx = Nxx_/2; + + cotalpha0_ = thePixelTemp_[index_id_].entry[0][0].cotalpha; + cotalpha1_ = thePixelTemp_[index_id_].entry[0][Nxx_-1].cotalpha; + deltacota_ = (cotalpha1_-cotalpha0_)/(float)(Nxx_-1); + + cotbeta0_ = thePixelTemp_[index_id_].entry[0][imidx].cotbeta; + cotbeta1_ = thePixelTemp_[index_id_].entry[Nyx_-1][imidx].cotbeta; + deltacotb_ = (cotbeta1_-cotbeta0_)/(float)(Nyx_-1); + + break; + } + } + } + } + +#ifndef SI_PIXEL_TEMPLATE_STANDALONE + if(index_id_ < 0 || index_id_ >= (int)thePixelTemp_.size()) { + throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::interpolate can't find needed template ID = " << id + << ", Are you using the correct global tag?" << std::endl; + } +#else + assert(index_id_ >= 0 && index_id_ < (int)thePixelTemp_.size()); +#endif + + // Check angle limits and et up interpolation parameters + + if(cotalpha < cotalpha0_) { + success_ = false; + jx0_ = 0; + jx1_ = 1; + adcota_ = 0.f; + } else if(cotalpha > cotalpha1_) { + success_ = false; + jx0_ = Nxx_ - 1; + jx1_ = jx0_ - 1; + adcota_ = 0.f; + } else { + jx0_ = (int)((cotalpha-cotalpha0_)/deltacota_+0.5f); + dcota = (cotalpha - (cotalpha0_ + jx0_*deltacota_))/deltacota_; + adcota_ = fabs(dcota); + if(dcota > 0.f) {jx1_ = jx0_ + 1;if(jx1_ > Nxx_-1) jx1_ = jx0_-1;} else {jx1_ = jx0_ - 1; if(jx1_ < 0) jx1_ = jx0_+1;} + } + + // Interpolate the absolute value of cot(beta) + + acotb = std::abs(cotbeta); + + if(acotb < cotbeta0_) { + success_ = false; + iy0_ = 0; + iy1_ = 1; + adcotb_ = 0.f; + } else if(acotb > cotbeta1_) { + success_ = false; + iy0_ = Nyx_ - 1; + iy1_ = iy0_ - 1; + adcotb_ = 0.f; + } else { + iy0_ = (int)((acotb-cotbeta0_)/deltacotb_+0.5f); + dcotb = (acotb - (cotbeta0_ + iy0_*deltacotb_))/deltacotb_; + adcotb_ = fabs(dcotb); + if(dcotb > 0.f) {iy1_ = iy0_ + 1; if(iy1_ > Nyx_-1) iy1_ = iy0_-1;} else {iy1_ = iy0_ - 1; if(iy1_ < 0) iy1_ = iy0_+1;} + } + + // This works only for IP-related tracks + + flip_x_ = false; + flip_y_ = false; + switch(Dtype_) { + case 0: + if(cotbeta < 0.f) {flip_y_ = true;} + break; + case 1: + if(locBz > 0.f) { + flip_y_ = true; + } + break; + case 2: + case 3: + case 4: + case 5: + if(locBx*locBz < 0.f) { + flip_x_ = true; + } + if(locBx < 0.f) { + flip_y_ = true; + } + break; + default: +#ifndef SI_PIXEL_TEMPLATE_STANDALONE + throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::illegal subdetector ID = " << thePixelTemp_[index_id_].head.Dtype << std::endl; +#else + std::cout << "SiPixelTemplate:2D:illegal subdetector ID = " << thePixelTemp_[index_id_].head.Dtype << std::endl; +#endif + } + + // Calculate signed quantities + + lorydrift_ = lorywidth_/2.; + if(flip_y_) lorydrift_ = -lorydrift_; + lorxdrift_ = lorxwidth_/2.; + if(flip_x_) lorxdrift_ = -lorxdrift_; + + // Use pointers to the three angle pairs used in the interpolation + + + entry00_ = &thePixelTemp_[index_id_].entry[iy0_][jx0_]; + entry10_ = &thePixelTemp_[index_id_].entry[iy1_][jx0_]; + entry01_ = &thePixelTemp_[index_id_].entry[iy0_][jx1_]; + + // Interpolate things in cot(alpha)-cot(beta) + + qavg_ = entry00_->qavg + +adcota_*(entry01_->qavg - entry00_->qavg) + +adcotb_*(entry10_->qavg - entry00_->qavg); + + pixmax_ = entry00_->pixmax + +adcota_*(entry01_->pixmax - entry00_->pixmax) + +adcotb_*(entry10_->pixmax - entry00_->pixmax); + + sxymax_ = entry00_->sxymax + +adcota_*(entry01_->sxymax - entry00_->sxymax) + +adcotb_*(entry10_->sxymax - entry00_->sxymax); + + chi2avgone_ = entry00_->chi2avgone + +adcota_*(entry01_->chi2avgone - entry00_->chi2avgone) + +adcotb_*(entry10_->chi2avgone - entry00_->chi2avgone); + + chi2minone_ = entry00_->chi2minone + +adcota_*(entry01_->chi2minone - entry00_->chi2minone) + +adcotb_*(entry10_->chi2minone - entry00_->chi2minone); + + clsleny_ = entry00_->clsleny + +adcota_*(entry01_->clsleny - entry00_->clsleny) + +adcotb_*(entry10_->clsleny - entry00_->clsleny); + + clslenx_ = entry00_->clslenx + +adcota_*(entry01_->clslenx - entry00_->clslenx) + +adcotb_*(entry10_->clslenx - entry00_->clslenx); + + + chi2ppix_ = entry00_->chi2ppix + +adcota_*(entry01_->chi2ppix - entry00_->chi2ppix) + +adcotb_*(entry10_->chi2ppix - entry00_->chi2ppix); + + chi2scale_ = entry00_->chi2scale + +adcota_*(entry01_->chi2scale - entry00_->chi2scale) + +adcotb_*(entry10_->chi2scale - entry00_->chi2scale); + + scaleyavg_ = entry00_->scaleyavg + +adcota_*(entry01_->scaleyavg - entry00_->scaleyavg) + +adcotb_*(entry10_->scaleyavg - entry00_->scaleyavg); + + scalexavg_ = entry00_->scalexavg + +adcota_*(entry01_->scalexavg - entry00_->scalexavg) + +adcotb_*(entry10_->scalexavg - entry00_->scalexavg); + + delyavg_ = entry00_->delyavg + +adcota_*(entry01_->delyavg - entry00_->delyavg) + +adcotb_*(entry10_->delyavg - entry00_->delyavg); + + delysig_ = entry00_->delysig + +adcota_*(entry01_->delysig - entry00_->delysig) + +adcotb_*(entry10_->delysig - entry00_->delysig); + + mpvvav_ = entry00_->mpvvav + +adcota_*(entry01_->mpvvav - entry00_->mpvvav) + +adcotb_*(entry10_->mpvvav - entry00_->mpvvav); + + sigmavav_ = entry00_->sigmavav + +adcota_*(entry01_->sigmavav - entry00_->sigmavav) + +adcotb_*(entry10_->sigmavav - entry00_->sigmavav); + + kappavav_ = entry00_->kappavav + +adcota_*(entry01_->kappavav - entry00_->kappavav) + +adcotb_*(entry10_->kappavav - entry00_->kappavav); + + for(i=0; i<4 ; ++i) { + scalex_[i] = entry00_->scalex[i] + +adcota_*(entry01_->scalex[i] - entry00_->scalex[i]) + +adcotb_*(entry10_->scalex[i] - entry00_->scalex[i]); + + scaley_[i] = entry00_->scaley[i] + +adcota_*(entry01_->scaley[i] - entry00_->scaley[i]) + +adcotb_*(entry10_->scaley[i] - entry00_->scaley[i]); + + offsetx_[i] = entry00_->offsetx[i] + +adcota_*(entry01_->offsetx[i] - entry00_->offsetx[i]) + +adcotb_*(entry10_->offsetx[i] - entry00_->offsetx[i]); + if(flip_x_) offsetx_[i] = -offsetx_[i]; + + offsety_[i] = entry00_->offsety[i] + +adcota_*(entry01_->offsety[i] - entry00_->offsety[i]) + +adcotb_*(entry10_->offsety[i] - entry00_->offsety[i]); + if(flip_y_) offsety_[i] = -offsety_[i]; + } + + for(i=0; i<2 ; ++i) { + for(j=0; j<5 ; ++j) { + // Charge loss switches sides when cot(beta) changes sign + if(flip_y_) { + xypary0x0_[1-i][j] = entry00_->xypar[i][j]; + xypary1x0_[1-i][j] = entry10_->xypar[i][j]; + xypary0x1_[1-i][j] = entry01_->xypar[i][j]; + lanpar_[1-i][j] = entry00_->lanpar[i][j] + +adcota_*(entry01_->lanpar[i][j] - entry00_->lanpar[i][j]) + +adcotb_*(entry10_->lanpar[i][j] - entry00_->lanpar[i][j]); + } else { + xypary0x0_[i][j] = entry00_->xypar[i][j]; + xypary1x0_[i][j] = entry10_->xypar[i][j]; + xypary0x1_[i][j] = entry01_->xypar[i][j]; + lanpar_[i][j] = entry00_->lanpar[i][j] + +adcota_*(entry01_->lanpar[i][j] - entry00_->lanpar[i][j]) + +adcotb_*(entry10_->lanpar[i][j] - entry00_->lanpar[i][j]); + } + } + } + + return success_; +} // interpolate + + +// ************************************************************************************************************************************* +//! Load template info for single angle point to invoke template reco for template generation +//! \param entry - (input) pointer to template entry +//! \param sizex - (input) pixel x-size +//! \param sizey - (input) pixel y-size +//! \param sizez - (input) pixel z-size +// ************************************************************************************************************************************* + +void SiPixelTemplate2D::sideload(SiPixelTemplateEntry2D* entry, int iDtype, float locBx, float locBz, float lorwdy, float lorwdx, float q50, float fbin[3], float xsize, float ysize, float zsize) +{ + + // Set class variables to the input parameters + + entry00_ = entry; + entry01_ = entry; + entry10_ = entry; + Dtype_ = iDtype; + lorywidth_ = lorwdy; + lorxwidth_ = lorwdx; + xsize_ = xsize; + ysize_ = ysize; + zsize_ = zsize; + s50_ = q50; + qscale_ = 1.f; + for(int i=0; i<3; ++i) {fbin_[i] = fbin[i];} + + // Set other class variables + + adcota_ = 0.f; + adcotb_ = 0.f; + + // Interpolate things in cot(alpha)-cot(beta) + + qavg_ = entry00_->qavg; + + pixmax_ = entry00_->pixmax; + + sxymax_ = entry00_->sxymax; + + clsleny_ = entry00_->clsleny; + + clslenx_ = entry00_->clslenx; + + scaleyavg_ = 1.f; + + scalexavg_ = 1.f; + + delyavg_ = 0.f; + + delysig_ = 0.f; + + for(int i=0; i<4 ; ++i) { + scalex_[i] = 1.f; + scaley_[i] = 1.f; + offsetx_[i] = 0.f; + offsety_[i] = 0.f; + } + + // This works only for IP-related tracks + + flip_x_ = false; + flip_y_ = false; + float cotbeta = entry00_->cotbeta; + switch(Dtype_) { + case 0: + if(cotbeta < 0.f) {flip_y_ = true;} + break; + case 1: + if(locBz > 0.f) { + flip_y_ = true; + } + break; + case 2: + case 3: + case 4: + case 5: + if(locBx*locBz < 0.f) { + flip_x_ = true; + } + if(locBx < 0.f) { + flip_y_ = true; + } + break; + default: +#ifndef SI_PIXEL_TEMPLATE_STANDALONE + throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::illegal subdetector ID = " << iDtype << std::endl; +#else + std::cout << "SiPixelTemplate:2D:illegal subdetector ID = " << iDtype << std::endl; +#endif + } + + // Calculate signed quantities + + lorydrift_ = lorywidth_/2.; + if(flip_y_) lorydrift_ = -lorydrift_; + lorxdrift_ = lorxwidth_/2.; + if(flip_x_) lorxdrift_ = -lorxdrift_; + + for(int i=0; i<2 ; ++i) { + for(int j=0; j<5 ; ++j) { + // Charge loss switches sides when cot(beta) changes sign + if(flip_y_) { + xypary0x0_[1-i][j] = entry00_->xypar[i][j]; + xypary1x0_[1-i][j] = entry00_->xypar[i][j]; + xypary0x1_[1-i][j] = entry00_->xypar[i][j]; + lanpar_[1-i][j] = entry00_->lanpar[i][j]; + } else { + xypary0x0_[i][j] = entry00_->xypar[i][j]; + xypary1x0_[i][j] = entry00_->xypar[i][j]; + xypary0x1_[i][j] = entry00_->xypar[i][j]; + lanpar_[i][j] = entry00_->lanpar[i][j]; + } + } + } + return; +} + + +// ************************************************************************************************************************************* +//! \param xhit - (input) x-position of hit relative to the lower left corner of pixel[1][1] (to allow for the "padding" of the two-d clusters in the splitter) +//! \param yhit - (input) y-position of hit relative to the lower left corner of pixel[1][1] +//! \param ydouble - (input) STL vector of 21 element array to flag a double-pixel starting at cluster[1][1] +//! \param xdouble - (input) STL vector of 11 element array to flag a double-pixel starting at cluster[1][1] +//! \param template2d - (output) 2d template of size matched to the cluster. Input must be zeroed since charge is added only. +// ************************************************************************************************************************************* + +bool SiPixelTemplate2D::xytemp(float xhit, float yhit, bool ydouble[BYM2], bool xdouble[BXM2], float template2d[BXM2][BYM2], bool derivatives, float dpdx2d[2][BXM2][BYM2], float& QTemplate) +{ + // Interpolate for a new set of track angles + + // Local variables + int i, j, k; + int pixx, pixy, k0, k1, l0, l1, deltax, deltay, iflipy, jflipx, imin, imax, jmin, jmax; + int m, n; + float dx, dy, ddx, ddy, adx, ady, tmpxy; +// const float deltaxy[2] = {8.33f, 12.5f}; + const float deltaxy[2] = {16.67f, 25.0f}; + + // Check to see if interpolation is valid + + + // next, determine the indices of the closest point in k (y-displacement), l (x-displacement) + // pixy and pixx are the indices of the struck pixel in the (Ty,Tx) system + // k0,k1 are the k-indices of the closest and next closest point + // l0,l1 are the l-indices of the closest and next closest point + + pixy = (int)floorf(yhit/ysize_); + dy = yhit-(pixy+0.5f)*ysize_; + if(flip_y_) {dy = -dy;} + k0 = (int)(dy/ysize_*6.f+3.5f); + if(k0 < 0) k0 = 0; + if(k0 > 6) k0 = 6; + ddy = 6.f*dy/ysize_ - (k0-3); + ady = fabs(ddy); + if(ddy > 0.f) {k1 = k0 + 1; if(k1 > 6) k1 = k0-1;} else {k1 = k0 - 1; if(k1 < 0) k1 = k0+1;} + pixx = (int)floorf(xhit/xsize_); + dx = xhit-(pixx+0.5f)*xsize_; + if(flip_x_) {dx = -dx;} + l0 = (int)(dx/xsize_*6.f+3.5f); + if(l0 < 0) l0 = 0; + if(l0 > 6) l0 = 6; + ddx = 6.f*dx/xsize_ - (l0-3); + adx = fabs(ddx); + if(ddx > 0.f) {l1 = l0 + 1; if(l1 > 6) l1 = l0-1;} else {l1 = l0 - 1; if(l1 < 0) l1 = l0+1;} + + // OK, lets do the template interpolation. + + // First find the limits of the indices for non-zero pixels + + imin = std::min(entry00_->iymin,entry10_->iymin); + imin_ = std::min(imin,entry01_->iymin); + + jmin = std::min(entry00_->jxmin,entry10_->jxmin); + jmin_ = std::min(jmin,entry01_->jxmin); + + imax = std::max(entry00_->iymax,entry10_->iymax); + imax_ = std::max(imax,entry01_->iymax); + + jmax = std::max(entry00_->jxmax,entry10_->jxmax); + jmax_ = std::max(jmax,entry01_->jxmax); + + // Calculate the x and y offsets to make the new template + + // First, shift the struck pixel coordinates to the (Ty+2, Tx+2) system + + ++pixy; ++pixx; + + // In the template store, the struck pixel is always (THy,THx) + + deltax = pixx - T2HX; + deltay = pixy - T2HY; + + // First zero the local 2-d template + + for(j=0; j=0 && m<=BXM3 && n>=0 && n<=BYM3) { + tmpxy = entry00_->xytemp[k0][l0][i][j] + + adx*(entry00_->xytemp[k0][l1][i][j] - entry00_->xytemp[k0][l0][i][j]) + + ady*(entry00_->xytemp[k1][l0][i][j] - entry00_->xytemp[k0][l0][i][j]) + + adcota_*(entry01_->xytemp[k0][l0][i][j] - entry00_->xytemp[k0][l0][i][j]) + + adcotb_*(entry10_->xytemp[k0][l0][i][j] - entry00_->xytemp[k0][l0][i][j]); + if(tmpxy > 0.f) { + xytemp_[m][n] = tmpxy; + } else { + xytemp_[m][n] = 0.f; + } + } + } + } + + //combine rows and columns to simulate double pixels + + for(n=1; n 0.f) {template2d[m][n] += xytemp_[m][n]; qtemptot += xytemp_[m][n];} + } + } + + QTemplate = qtemptot; + + if(derivatives) { + + float dxytempdx[2][BXM2][BYM2], dxytempdy[2][BXM2][BYM2]; + + // First do shifted +x template + + pixx = (int)floorf((xhit+deltaxy[0])/xsize_); + dx = (xhit+deltaxy[0])-(pixx+0.5f)*xsize_; + if(flip_x_) {dx = -dx;} + l0 = (int)(dx/xsize_*6.f+3.5f); + if(l0 < 0) l0 = 0; + if(l0 > 6) l0 = 6; + ddx = 6.f*dx/xsize_ - (l0-3); + adx = fabs(ddx); + if(ddx > 0.f) {l1 = l0 + 1; if(l1 > 6) l1 = l0-1;} else {l1 = l0 - 1; if(l1 < 0) l1 = l0+1;} + + // OK, lets do the template interpolation. + + // Calculate the x and y offsets to make the new template + + // First, shift the struck pixel coordinates to the (Ty+2, Tx+2) system + + ++pixx; + + // In the template store, the struck pixel is always (THy,THx) + + deltax = pixx - T2HX; + + // First zero the local 2-d template + + for(k=0; k<2; ++k) {for(j=0; j=0 && m<=BXM3 && n>=0 && n<=BYM3) { + tmpxy = entry00_->xytemp[k0][l0][i][j] + + adx*(entry00_->xytemp[k0][l1][i][j] - entry00_->xytemp[k0][l0][i][j]) + + ady*(entry00_->xytemp[k1][l0][i][j] - entry00_->xytemp[k0][l0][i][j]) + + adcota_*(entry01_->xytemp[k0][l0][i][j] - entry00_->xytemp[k0][l0][i][j]) + + adcotb_*(entry10_->xytemp[k0][l0][i][j] - entry00_->xytemp[k0][l0][i][j]); + if(tmpxy > 0.f) {dxytempdx[1][m][n] = tmpxy;} else {dxytempdx[1][m][n] = 0.f;} + } + } + } + + //combine rows and columns to simulate double pixels + + for(n=1; n 6) l0 = 6; + ddx = 6.f*dx/xsize_ - (l0-3); + adx = fabs(ddx); + if(ddx > 0.f) {l1 = l0 + 1; if(l1 > 6) l1 = l0-1;} else {l1 = l0 - 1; if(l1 < 0) l1 = l0+1;} + + // OK, lets do the template interpolation. + + // Calculate the x and y offsets to make the new template + + // First, shift the struck pixel coordinates to the (Ty+2, Tx+2) system + + ++pixx; + + // In the template store, the struck pixel is always (THy,THx) + + deltax = pixx - T2HX; + + // Loop over the non-zero part of the template index space and interpolate + + for(j=jmin_; j<=jmax_; ++j) { + // Flip indices as needed + if(flip_x_) {jflipx=T2XSIZE-1-j; m = deltax+jflipx;} else {m = deltax+j;} + for(i=imin_; i<=imax_; ++i) { + if(flip_y_) {iflipy=T2YSIZE-1-i; n = deltay+iflipy;} else {n = deltay+i;} + if(m>=0 && m<=BXM3 && n>=0 && n<=BYM3) { + tmpxy = entry00_->xytemp[k0][l0][i][j] + + adx*(entry00_->xytemp[k0][l1][i][j] - entry00_->xytemp[k0][l0][i][j]) + + ady*(entry00_->xytemp[k1][l0][i][j] - entry00_->xytemp[k0][l0][i][j]) + + adcota_*(entry01_->xytemp[k0][l0][i][j] - entry00_->xytemp[k0][l0][i][j]) + + adcotb_*(entry10_->xytemp[k0][l0][i][j] - entry00_->xytemp[k0][l0][i][j]); + if(tmpxy > 0.f) {dxytempdx[0][m][n] = tmpxy;} else {dxytempdx[0][m][n] = 0.f;} + } + } + } + + //combine rows and columns to simulate double pixels + + for(n=1; n 6) k0 = 6; + ddy = 6.f*dy/ysize_ - (k0-3); + ady = fabs(ddy); + if(ddy > 0.f) {k1 = k0 + 1; if(k1 > 6) k1 = k0-1;} else {k1 = k0 - 1; if(k1 < 0) k1 = k0+1;} + pixx = (int)floorf(xhit/xsize_); + dx = xhit-(pixx+0.5f)*xsize_; + if(flip_x_) {dx = -dx;} + l0 = (int)(dx/xsize_*6.f+3.5f); + if(l0 < 0) l0 = 0; + if(l0 > 6) l0 = 6; + ddx = 6.f*dx/xsize_ - (l0-3); + adx = fabs(ddx); + if(ddx > 0.f) {l1 = l0 + 1; if(l1 > 6) l1 = l0-1;} else {l1 = l0 - 1; if(l1 < 0) l1 = l0+1;} + + // OK, lets do the template interpolation. + + // Calculate the x and y offsets to make the new template + + // First, shift the struck pixel coordinates to the (Ty+2, Tx+2) system + + ++pixy; ++pixx; + + // In the template store, the struck pixel is always (THy,THx) + + deltax = pixx - T2HX; + deltay = pixy - T2HY; + + // First zero the local 2-d template + + for(k=0; k<2; ++k) {for(j=0; j=0 && m<=BXM3 && n>=0 && n<=BYM3) { + tmpxy = entry00_->xytemp[k0][l0][i][j] + + adx*(entry00_->xytemp[k0][l1][i][j] - entry00_->xytemp[k0][l0][i][j]) + + ady*(entry00_->xytemp[k1][l0][i][j] - entry00_->xytemp[k0][l0][i][j]) + + adcota_*(entry01_->xytemp[k0][l0][i][j] - entry00_->xytemp[k0][l0][i][j]) + + adcotb_*(entry10_->xytemp[k0][l0][i][j] - entry00_->xytemp[k0][l0][i][j]); + if(tmpxy > 0.f) {dxytempdy[1][m][n] = tmpxy;} else {dxytempdy[1][m][n] = 0.f;} + } + } + } + + //combine rows and columns to simulate double pixels + + for(n=1; n 6) k0 = 6; + ddy = 6.f*dy/ysize_ - (k0-3); + ady = fabs(ddy); + if(ddy > 0.f) {k1 = k0 + 1; if(k1 > 6) k1 = k0-1;} else {k1 = k0 - 1; if(k1 < 0) k1 = k0+1;} + + // OK, lets do the template interpolation. + + // Calculate the x and y offsets to make the new template + + // First, shift the struck pixel coordinates to the (Ty+2, Tx+2) system + + ++pixy; + + // In the template store, the struck pixel is always (THy,THx) + + deltay = pixy - T2HY; + + // Loop over the non-zero part of the template index space and interpolate + + for(j=jmin_; j<=jmax_; ++j) { + // Flip indices as needed + if(flip_x_) {jflipx=T2XSIZE-1-j; m = deltax+jflipx;} else {m = deltax+j;} + for(i=imin_; i<=imax_; ++i) { + if(flip_y_) {iflipy=T2YSIZE-1-i; n = deltay+iflipy;} else {n = deltay+i;} + if(m>=0 && m<=BXM3 && n>=0 && n<=BYM3) { + tmpxy = entry00_->xytemp[k0][l0][i][j] + + adx*(entry00_->xytemp[k0][l1][i][j] - entry00_->xytemp[k0][l0][i][j]) + + ady*(entry00_->xytemp[k1][l0][i][j] - entry00_->xytemp[k0][l0][i][j]) + + adcota_*(entry01_->xytemp[k0][l0][i][j] - entry00_->xytemp[k0][l0][i][j]) + + adcotb_*(entry10_->xytemp[k0][l0][i][j] - entry00_->xytemp[k0][l0][i][j]); + if(tmpxy > 0.f) {dxytempdy[0][m][n] = tmpxy;} else {dxytempdy[0][m][n] = 0.f;} + } + } + } + + //combine rows and columns to simulate double pixels + + for(n=1; n& ydouble, std::vector& xdouble, float template2d[BXM2][BYM2]) +{ + + // Local variables + + bool derivatives = false; + float dpdx2d[2][BXM2][BYM2]; + float QTemplate; + float locBx = 1.f; + if(cotbeta < 0.f) {locBx = -1.f;} + float locBz = locBx; + if(cotalpha < 0.f) {locBz = -locBx;} + + bool yd[BYM2], xd[BXM2]; + + yd[0] = false; yd[BYM2-1] = false; + for(int i=0; i= BYM2) { + throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::ysigma2 called with index = " << index << std::endl; + } +#else + assert(index > 0 && index < BYM2); +#endif + + // Define the maximum signal to use in the parameterization + + // Evaluate pixel-by-pixel uncertainties (weights) for the templ analysis + + if(qpixel < sxymax_) { + sigi = qpixel; + qscale = 1.f; + } else { + sigi = sxymax_; + qscale = qpixel/sxymax_; + } + sigi2 = sigi*sigi; sigi3 = sigi2*sigi; sigi4 = sigi3*sigi; + if(index <= T2HYP1) { + err00 = xypary0x0_[0][0]+xypary0x0_[0][1]*sigi+xypary0x0_[0][2]*sigi2+xypary0x0_[0][3]*sigi3+xypary0x0_[0][4]*sigi4; + err2 = err00 + +adcota_*(xypary0x1_[0][0]+xypary0x1_[0][1]*sigi+xypary0x1_[0][2]*sigi2+xypary0x1_[0][3]*sigi3+xypary0x1_[0][4]*sigi4 - err00) + +adcotb_*(xypary1x0_[0][0]+xypary1x0_[0][1]*sigi+xypary1x0_[0][2]*sigi2+xypary1x0_[0][3]*sigi3+xypary1x0_[0][4]*sigi4 - err00); + } else { + err00 = xypary0x0_[1][0]+xypary0x0_[1][1]*sigi+xypary0x0_[1][2]*sigi2+xypary0x0_[1][3]*sigi3+xypary0x0_[1][4]*sigi4; + err2 = err00 + +adcota_*(xypary0x1_[1][0]+xypary0x1_[1][1]*sigi+xypary0x1_[1][2]*sigi2+xypary0x1_[1][3]*sigi3+xypary0x1_[1][4]*sigi4 - err00) + +adcotb_*(xypary1x0_[1][0]+xypary1x0_[1][1]*sigi+xypary1x0_[1][2]*sigi2+xypary1x0_[1][3]*sigi3+xypary1x0_[1][4]*sigi4 - err00); + } + xysig2 =qscale*err2; + if(xysig2 <= 0.f) {LOGERROR("SiPixelTemplate2D") << "neg y-error-squared, id = " << id_current_ << ", index = " << index_id_ << + ", cot(alpha) = " << cota_current_ << ", cot(beta) = " << cotb_current_ << ", sigi = " << sigi << ENDL;} + + return; + +} // End xysigma2 + + +// ************************************************************************************************************ +//! Return the Landau probability parameters for this set of cot(alpha, cot(beta) +// ************************************************************************************************************ +void SiPixelTemplate2D::landau_par(float lanpar[2][5]) + +{ + // Interpolate using quantities already stored in the private variables + + // Local variables + int i,j; + for(i=0; i<2; ++i) { + for(j=0; j<5; ++j) { + lanpar[i][j] = lanpar_[i][j]; + } + } + return; + +} // End lan_par + + + From 06607ef9e622b2ccb045171c3c0a54e3fc47e394 Mon Sep 17 00:00:00 2001 From: Petar Date: Sat, 3 Mar 2018 00:36:15 -0600 Subject: [PATCH 048/426] New 2D pixel template reconstruction, with "cluster repair". --- .../interface/PixelCPEClusterRepair.h | 116 ++++ .../PixelCPEClusterRepairESProducer.h | 26 + .../interface/SiPixelTemplateReco2D.h | 56 ++ .../PixelCPEClusterRepairESProducer.cc | 80 +++ .../src/PixelCPEClusterRepair.cc | 628 +++++++++++++++++ .../src/SiPixelTemplateReco2D.cc | 654 ++++++++++++++++++ 6 files changed, 1560 insertions(+) create mode 100644 RecoLocalTracker/SiPixelRecHits/interface/PixelCPEClusterRepair.h create mode 100644 RecoLocalTracker/SiPixelRecHits/interface/PixelCPEClusterRepairESProducer.h create mode 100644 RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateReco2D.h create mode 100644 RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEClusterRepairESProducer.cc create mode 100644 RecoLocalTracker/SiPixelRecHits/src/PixelCPEClusterRepair.cc create mode 100644 RecoLocalTracker/SiPixelRecHits/src/SiPixelTemplateReco2D.cc diff --git a/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEClusterRepair.h b/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEClusterRepair.h new file mode 100644 index 0000000000000..ca34531fa17a7 --- /dev/null +++ b/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEClusterRepair.h @@ -0,0 +1,116 @@ +#ifndef RecoLocalTracker_SiPixelRecHits_PixelCPEClusterRepair_H +#define RecoLocalTracker_SiPixelRecHits_PixelCPEClusterRepair_H + +#include "RecoLocalTracker/SiPixelRecHits/interface/PixelCPEBase.h" + +// Already in the base class +//#include "Geometry/CommonDetUnit/interface/GeomDetType.h" +//#include "Geometry/TrackerGeometryBuilder/interface/PixelGeomDetUnit.h" +//#include "Geometry/TrackerGeometryBuilder/interface/RectangularPixelTopology.h" +//#include "Geometry/CommonDetAlgo/interface/MeasurementPoint.h" +//#include "Geometry/CommonDetAlgo/interface/MeasurementError.h" +//#include "Geometry/Surface/interface/GloballyPositioned.h" +//#include "FWCore/ParameterSet/interface/ParameterSet.h" + +// The template header files +// +#include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateReco.h" +#include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateReco2D.h" +#include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate.h" +#include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate2D.h" +#include "CondFormats/SiPixelObjects/interface/SiPixel2DTemplateDBObject.h" + +#include +#include + + +#if 0 +/** \class PixelCPEClusterRepair + * Perform the position and error evaluation of pixel hits using + * the Det angle to estimate the track impact angle + */ +#endif + +class MagneticField; +class PixelCPEClusterRepair : public PixelCPEBase +{ +public: + struct ClusterParamTemplate : ClusterParam + { + ClusterParamTemplate(const SiPixelCluster & cl) : ClusterParam(cl){} + // The result of PixelTemplateReco2D + float templXrec_ ; + float templYrec_ ; + float templSigmaX_ ; + float templSigmaY_ ; + // Add new information produced by SiPixelTemplateReco::PixelTempReco2D &&& + // These can only be accessed if we change silicon pixel data formats and add them to the rechit + float templProbX_ ; + float templProbY_ ; + float templProbQ_; + int templQbin_ ; + int ierr; + + + // 2D fit stuff. + float templProbXY_ ; + bool recommended3D_ ; + int ierr2; + }; + + // PixelCPEClusterRepair( const DetUnit& det ); + PixelCPEClusterRepair(edm::ParameterSet const& conf, const MagneticField *, const TrackerGeometry&, const TrackerTopology&, + const SiPixelLorentzAngle *, const SiPixelTemplateDBObject *, const SiPixel2DTemplateDBObject * ); + + ~PixelCPEClusterRepair() override; + +private: + ClusterParam * createClusterParam(const SiPixelCluster & cl) const override; + + // Calculate local position. (Calls TemplateReco) + LocalPoint localPosition (DetParam const & theDetParam, ClusterParam & theClusterParam) const override; + // Calculate local error. Note: it MUST be called AFTER localPosition() !!! + LocalError localError (DetParam const & theDetParam, ClusterParam & theClusterParam) const override; + + // Helper functions: + + // Call vanilla template reco, then clean-up + void callTempReco2D( DetParam const & theDetParam, + ClusterParamTemplate & theClusterParam, + SiPixelTemplateReco::ClusMatrix & clusterPayload, + int ID, LocalPoint & lp ) const; + + // Call 2D template reco, then clean-up + void callTempReco3D( DetParam const & theDetParam, + ClusterParamTemplate & theClusterParam, + SiPixelTemplateReco2D::ClusMatrix & clusterPayload, + int ID, LocalPoint & lp ) const; + + + // Template storage + std::vector< SiPixelTemplateStore > thePixelTemp_; + std::vector< SiPixelTemplateStore2D > thePixelTemp2D_; + + int speed_ ; + + bool UseClusterSplitter_; + + // Template file management (when not getting the templates from the DB) + int barrelTemplateID_ ; + int forwardTemplateID_ ; + std::string templateDir_ ; + + // Configure 3D reco. + float minProbY_ ; + int maxSizeMismatchInY_ ; + + //bool DoCosmics_; + //bool LoadTemplatesFromDB_; + +}; + +#endif + + + + diff --git a/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEClusterRepairESProducer.h b/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEClusterRepairESProducer.h new file mode 100644 index 0000000000000..f06ec3b474539 --- /dev/null +++ b/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEClusterRepairESProducer.h @@ -0,0 +1,26 @@ +#ifndef RecoLocaltracker_SiPixelRecHits_PixelCPEClusterRepairESProducer_h +#define RecoLocaltracker_SiPixelRecHits_PixelCPEClusterRepairESProducer_h + +#include "FWCore/Framework/interface/ESProducer.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "RecoLocalTracker/Records/interface/TkPixelCPERecord.h" +#include "RecoLocalTracker/ClusterParameterEstimator/interface/PixelClusterParameterEstimator.h" +#include + +class PixelCPEClusterRepairESProducer: public edm::ESProducer{ + public: + PixelCPEClusterRepairESProducer(const edm::ParameterSet & p); + ~PixelCPEClusterRepairESProducer() override; + std::shared_ptr produce(const TkPixelCPERecord &); + private: + std::shared_ptr cpe_; + edm::ParameterSet pset_; + bool DoLorentz_; +}; + + +#endif + + + + diff --git a/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateReco2D.h b/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateReco2D.h new file mode 100644 index 0000000000000..1d991bee3b6ab --- /dev/null +++ b/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateReco2D.h @@ -0,0 +1,56 @@ +// +// SiPixelTemplateReco2D.cc (Version 2.20) +// Updated to work with the 2D template generation code +// 2.10 - Add y-lorentz drift to estimate starting point [for FPix] +// 2.10 - Remove >1 pixel requirement +// 2.20 - Fix major bug, change chi2 scan to 9x5 [YxX] + + +// +// +// Created by Morris Swartz on 7/13/17. +// +// + +#ifndef SiPixelTemplateReco2D_h +#define SiPixelTemplateReco2D_h 1 + +#ifndef SI_PIXEL_TEMPLATE_STANDALONE +#include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateDefs.h" +#include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate2D.h" +#else +#include "SiPixelTemplateDefs.h" +#include "SiPixelTemplate2D.h" +#endif + +#define NPIXMAX 200 + +#include + +#ifndef SiPixelTemplateClusMatrix2D +#define SiPixelTemplateClusMatrix2D 1 + +namespace SiPixelTemplateReco2D { + + struct ClusMatrix { + float & operator()(int x, int y) { return matrix[mcol*x+y];} + float operator()(int x, int y) const { return matrix[mcol*x+y];} + float * matrix; + bool * xdouble; + bool * ydouble; + int mrow, mcol; + }; +#endif + + int PixelTempReco3D(int id, float cotalpha, float cotbeta, float locBz, float locBx, int edgeflagy, int edgeflagx, + ClusMatrix & cluster, SiPixelTemplate2D& templ, + float& yrec, float& sigmay, float& xrec, float& sigmax, float& probxy, float& probQ, int& qbin, float& deltay, int& npixel); + + int PixelTempReco3D(int id, float cotalpha, float cotbeta, float locBz, float locBx, int edgeflagy, int edgeflagx, + ClusMatrix & cluster, SiPixelTemplate2D& templ, + float& yrec, float& sigmay, float& xrec, float& sigmax, float& probxy, float& probQ, int& qbin, float& deltay); + + +} + +#endif diff --git a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEClusterRepairESProducer.cc b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEClusterRepairESProducer.cc new file mode 100644 index 0000000000000..efde8f4d3c046 --- /dev/null +++ b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEClusterRepairESProducer.cc @@ -0,0 +1,80 @@ +#include "RecoLocalTracker/SiPixelRecHits/interface/PixelCPEClusterRepairESProducer.h" +#include "RecoLocalTracker/SiPixelRecHits/interface/PixelCPEClusterRepair.h" +#include "MagneticField/Engine/interface/MagneticField.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "CalibTracker/Records/interface/SiPixelTemplateDBObjectESProducerRcd.h" +#include "CalibTracker/Records/interface/SiPixel2DTemplateDBObjectESProducerRcd.h" + +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/ModuleFactory.h" +#include "FWCore/Framework/interface/ESProducer.h" + + + +#include +#include + +using namespace edm; + +PixelCPEClusterRepairESProducer::PixelCPEClusterRepairESProducer(const edm::ParameterSet & p) +{ + std::string myname = p.getParameter("ComponentName"); + + //DoLorentz_ = p.getParameter("DoLorentz"); // True when LA from alignment is used + DoLorentz_ = p.existsAs("DoLorentz")?p.getParameter("DoLorentz"):false; + + pset_ = p; + setWhatProduced(this,myname); + + //std::cout<<" from ES Producer Templates "< +PixelCPEClusterRepairESProducer::produce(const TkPixelCPERecord & iRecord){ + + ESHandle magfield; + iRecord.getRecord().get(magfield ); + + edm::ESHandle pDD; + iRecord.getRecord().get( pDD ); + + edm::ESHandle hTT; + iRecord.getRecord().getRecord().get(hTT); + + edm::ESHandle lorentzAngle; + const SiPixelLorentzAngle * lorentzAngleProduct = nullptr; + if(DoLorentz_) { // LA correction from alignment + iRecord.getRecord().get("fromAlignment",lorentzAngle); + lorentzAngleProduct = lorentzAngle.product(); + } else { // Normal, deafult LA actually is NOT needed + //iRecord.getRecord().get(lorentzAngle); + lorentzAngleProduct=nullptr; // null is ok becuse LA is not use by templates in this mode + } + + ESHandle templateDBobject; + iRecord.getRecord().get(templateDBobject); + + ESHandle templateDBobject2D; + iRecord.getRecord().get(templateDBobject2D); + + // cpe_ = std::make_shared(pset_,magfield.product(),lorentzAngle.product(),templateDBobject.product() ); + cpe_ = + std::make_shared(pset_, + magfield.product(), + *pDD.product(), + *hTT.product(), + lorentzAngleProduct, + templateDBobject.product(), + templateDBobject2D.product() ); + return cpe_; +} + + diff --git a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEClusterRepair.cc b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEClusterRepair.cc new file mode 100644 index 0000000000000..6181dfcfd17d9 --- /dev/null +++ b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEClusterRepair.cc @@ -0,0 +1,628 @@ +// Include our own header first +#include "RecoLocalTracker/SiPixelRecHits/interface/PixelCPEClusterRepair.h" + +// Geometry services +#include "Geometry/TrackerGeometryBuilder/interface/PixelGeomDetUnit.h" +#include "Geometry/TrackerGeometryBuilder/interface/RectangularPixelTopology.h" + +//#define DEBUG + +// MessageLogger +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +// Magnetic field +#include "MagneticField/Engine/interface/MagneticField.h" + + +// Commented for now (3/10/17) until we figure out how to resuscitate 2D template splitter +/// #include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateSplit.h" + +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include +#include "boost/multi_array.hpp" + +#include + +using namespace SiPixelTemplateReco; +//using namespace SiPixelTemplateSplit; +using namespace std; + +namespace { + constexpr float micronsToCm = 1.0e-4; + constexpr int cluster_matrix_size_x = 13; + constexpr int cluster_matrix_size_y = 21; +} + +//----------------------------------------------------------------------------- +// Constructor. +// +//----------------------------------------------------------------------------- +PixelCPEClusterRepair::PixelCPEClusterRepair(edm::ParameterSet const & conf, + const MagneticField * mag, + const TrackerGeometry& geom, + const TrackerTopology& ttopo, + const SiPixelLorentzAngle * lorentzAngle, + const SiPixelTemplateDBObject * templateDBobject, + const SiPixel2DTemplateDBObject * templateDBobject2D ) +: PixelCPEBase(conf, mag, geom, ttopo, lorentzAngle, nullptr, templateDBobject, nullptr,1) +{ + //cout << endl; + //cout << "Constructing PixelCPEClusterRepair::PixelCPEClusterRepair(...)................................................." << endl; + //cout << endl; + + // Configurable parameters + //DoCosmics_ = conf.getParameter("DoCosmics"); // Not used in templates + //LoadTemplatesFromDB_ = conf.getParameter("LoadTemplatesFromDB"); // Moved to Base + + //cout << " PixelCPEClusterRepair : (int)LoadTemplatesFromDB_ = " << (int)LoadTemplatesFromDB_ << endl; + //cout << "field_magnitude = " << field_magnitude << endl; + + // configuration parameter to decide between DB or text file template access + + if ( LoadTemplatesFromDB_ ) + { + //cout << "PixelCPEClusterRepair: Loading templates from database (DB) --------- " << endl; + + // Initialize template store to the selected ID [Morris, 6/25/08] + if ( !SiPixelTemplate::pushfile( *templateDBobject_, thePixelTemp_) ) + throw cms::Exception("PixelCPEClusterRepair") + << "\nERROR: Templates not filled correctly. Check the sqlite file. Using SiPixelTemplateDBObject version " + << (*templateDBobject_).version() << "\n\n"; + + // Initialize template store to the selected ID [Morris, 6/25/08] + if ( !SiPixelTemplate2D::pushfile( *templateDBobject2D , thePixelTemp2D_) ) + throw cms::Exception("PixelCPEClusterRepair") + << "\nERROR: Templates not filled correctly. Check the sqlite file. Using SiPixelTemplateDBObject version " + << (*templateDBobject_).version() << "\n\n"; + } + else + { + //cout << "PixelCPEClusterRepair : Loading templates for barrel and forward from ASCII files ----------" << endl; + //--- (Archaic) Get configurable template IDs. This code executes only if we loading pixels from ASCII + // files, and then they are mandatory. + barrelTemplateID_ = conf.getParameter( "barrelTemplateID" ); + forwardTemplateID_ = conf.getParameter( "forwardTemplateID" ); + templateDir_ = conf.getParameter( "directoryWithTemplates" ); + + if ( !SiPixelTemplate::pushfile( barrelTemplateID_ , thePixelTemp_ , templateDir_ ) ) + throw cms::Exception("PixelCPEClusterRepair") + << "\nERROR: Template ID " << barrelTemplateID_ << " not loaded correctly from text file. Reconstruction will fail.\n\n"; + + if ( !SiPixelTemplate::pushfile( forwardTemplateID_ , thePixelTemp_ , templateDir_ ) ) + throw cms::Exception("PixelCPEClusterRepair") + << "\nERROR: Template ID " << forwardTemplateID_ << " not loaded correctly from text file. Reconstruction will fail.\n\n"; + } + + speed_ = conf.getParameter( "speed"); + LogDebug("PixelCPEClusterRepair::PixelCPEClusterRepair:") << + "Template speed = " << speed_ << "\n"; + + UseClusterSplitter_ = conf.getParameter("UseClusterSplitter"); + + + //--- Configure 3D reco. + if ( conf.exists("MinProbY") ) + minProbY_ = conf.getParameter("MinProbY"); + else + minProbY_ = 0.001; // probabilityY < 0.001 + + if ( conf.exists("MaxSizeMismatchInY") ) + maxSizeMismatchInY_ = conf.getParameter("MaxSizeMismatchInY"); + else + maxSizeMismatchInY_ = 1; // ( templ.clsleny() - nypix > 1) + +} + + + +//----------------------------------------------------------------------------- +// Clean up. +//----------------------------------------------------------------------------- +PixelCPEClusterRepair::~PixelCPEClusterRepair() +{ + for(auto x : thePixelTemp_) x.destroy(); + // Note: this is not needed for Template 2D +} + +PixelCPEBase::ClusterParam* PixelCPEClusterRepair::createClusterParam(const SiPixelCluster & cl) const +{ + return new ClusterParamTemplate(cl); +} + + + +//------------------------------------------------------------------ +// Public methods mandated by the base class. +//------------------------------------------------------------------ + +//------------------------------------------------------------------ +// The main call to the template code. +//------------------------------------------------------------------ +LocalPoint +PixelCPEClusterRepair::localPosition(DetParam const & theDetParam, ClusterParam & theClusterParamBase) const +{ + + ClusterParamTemplate & theClusterParam = static_cast(theClusterParamBase); + + if(!GeomDetEnumerators::isTrackerPixel(theDetParam.thePart)) + throw cms::Exception("PixelCPEClusterRepair::localPosition :") + << "A non-pixel detector type in here?"; + + int ID = -9999; + if ( LoadTemplatesFromDB_ ) { + int ID0 = templateDBobject_->getTemplateID(theDetParam.theDet->geographicalId()); // just to comapre + ID = theDetParam.detTemplateId; + if(ID0!=ID) cout<<" different id"<< ID<<" "<localPosition( MeasurementPoint(tmp_x, tmp_y) ); + } + + //--- Compute the size of the matrix which will be passed to TemplateReco. + // We'll later make clustMatrix[ mrow ][ mcol ] + int mrow=0, mcol=0; + for (int i=0 ; i!=theClusterParam.theCluster->size(); ++i ) + { + auto pix = theClusterParam.theCluster->pixel(i); + int irow = int(pix.x); + int icol = int(pix.y); + mrow = std::max(mrow,irow); + mcol = std::max(mcol,icol); + } + mrow -= row_offset; mrow+=1; mrow = std::min(mrow,cluster_matrix_size_x); + mcol -= col_offset; mcol+=1; mcol = std::min(mcol,cluster_matrix_size_y); + assert(mrow>0); assert(mcol>0); + + + //--- Make and fill the bool arrays flagging double pixels + bool xdouble[mrow], ydouble[mcol]; + // x directions (shorter), rows + for (int irow = 0; irow < mrow; ++irow) + xdouble[irow] = theDetParam.theRecTopol->isItBigPixelInX( irow+row_offset ); + // + // y directions (longer), columns + for (int icol = 0; icol < mcol; ++icol) + ydouble[icol] = theDetParam.theRecTopol->isItBigPixelInY( icol+col_offset ); + + //--- C-style matrix. We'll need it in either case. + float clustMatrix[mrow][mcol]; + float clustMatrix2[mrow][mcol]; + + //--- Prepare struct that passes pointers to TemplateReco. It doesn't own anything. + SiPixelTemplateReco::ClusMatrix clusterPayload { &clustMatrix[0][0], xdouble, ydouble, mrow,mcol}; + SiPixelTemplateReco2D::ClusMatrix clusterPayload2d{ &clustMatrix2[0][0], xdouble, ydouble, mrow,mcol}; + + + //--- Copy clust's pixels (calibrated in electrons) into clustMatrix; + memset( clustMatrix, 0, sizeof(float)*mrow*mcol ); // Wipe it clean. + for (int i=0 ; i!=theClusterParam.theCluster->size(); ++i ) + { + auto pix = theClusterParam.theCluster->pixel(i); + int irow = int(pix.x) - row_offset; + int icol = int(pix.y) - col_offset; + // &&& Do we ever get pixels that are out of bounds ??? Need to check. + if ( (irowsize(); ++i ) + // { + // auto pix = theClusterParam.theCluster->pixel(i); + // int irow = int(pix.x) - row_offset; + // int icol = int(pix.y) - col_offset; + // // &&& Do we ever get pixels that are out of bounds ??? Need to check. + // if ( (irow > zeropix; + int nypix =0, nxpix = 0; + // + theClusterParam.ierr = + PixelTempReco2D( ID, theClusterParam.cotalpha, theClusterParam.cotbeta, + locBz, locBx, + clusterPayload, + templ, + theClusterParam.templYrec_, theClusterParam.templSigmaY_, theClusterParam.probabilityY_, + theClusterParam.templXrec_, theClusterParam.templSigmaX_, theClusterParam.probabilityX_, + theClusterParam.qBin_, + speed_, deadpix, zeropix, + theClusterParam.probabilityQ_, nypix, nxpix + ); + // ****************************************************************** + + //--- Check exit status + if unlikely( theClusterParam.ierr != 0 ) + { + LogDebug("PixelCPEClusterRepair::localPosition") << + "reconstruction failed with error " << theClusterParam.ierr << "\n"; + + // Gavril: what do we do in this case ? For now, just return the cluster center of gravity in microns + // In the x case, apply a rough Lorentz drift average correction + // To do: call PixelCPEGeneric whenever PixelTempReco2D fails + float lorentz_drift = -999.9; + if ( ! GeomDetEnumerators::isEndcap(theDetParam.thePart) ) + lorentz_drift = 60.0f; // in microns + else + lorentz_drift = 10.0f; // in microns + // ggiurgiu@jhu.edu, 21/09/2010 : trk angles needed to correct for bows/kinks + if ( theClusterParam.with_track_angle ) + { + theClusterParam.templXrec_ = theDetParam.theTopol->localX( theClusterParam.theCluster->x(), theClusterParam.loc_trk_pred ) - lorentz_drift * micronsToCm; // rough Lorentz drift correction + theClusterParam.templYrec_ = theDetParam.theTopol->localY( theClusterParam.theCluster->y(), theClusterParam.loc_trk_pred ); + } + else + { + edm::LogError("PixelCPEClusterRepair") + << "@SUB = PixelCPEClusterRepair::localPosition" + << "Should never be here. PixelCPEClusterRepair should always be called with track angles. This is a bad error !!! "; + + theClusterParam.templXrec_ = theDetParam.theTopol->localX( theClusterParam.theCluster->x() ) - lorentz_drift * micronsToCm; // rough Lorentz drift correction + theClusterParam.templYrec_ = theDetParam.theTopol->localY( theClusterParam.theCluster->y() ); + } + } + else + { + //--- Template Reco succeeded. The probabilities are filled. + theClusterParam.hasFilledProb_ = true; + + //--- templ.clsleny() is the expected length of the cluster along y axis. + if ( (theClusterParam.probabilityY_ < minProbY_ ) && (templ.clsleny() - nypix > 1) ) { + theClusterParam.recommended3D_ = true; + } + + //--- Go from microns to centimeters + theClusterParam.templXrec_ *= micronsToCm; + theClusterParam.templYrec_ *= micronsToCm; + + //--- Go back to the module coordinate system + theClusterParam.templXrec_ += lp.x(); + theClusterParam.templYrec_ += lp.y(); + + } + return; +} + + + + +//------------------------------------------------------------------ +// Helper function to aggregate call & handling of Template 2D fit +//------------------------------------------------------------------ +void +PixelCPEClusterRepair::callTempReco3D( DetParam const & theDetParam, + ClusterParamTemplate & theClusterParam, + SiPixelTemplateReco2D::ClusMatrix & clusterPayload, + int ID, LocalPoint & lp ) const +{ + SiPixelTemplate2D templ2d(thePixelTemp2D_); + + // Output: + float nonsense = -99999.9f; // nonsense init value + theClusterParam.templXrec_ = theClusterParam.templYrec_ = theClusterParam.templSigmaX_ = theClusterParam.templSigmaY_ = nonsense; + // If the template recontruction fails, we want to return 1.0 for now + theClusterParam.templProbY_ = theClusterParam.templProbX_ = theClusterParam.templProbQ_ = 1.0f; + theClusterParam.templQbin_ = 0; + // We have a boolean denoting whether the reco failed or not + theClusterParam.hasFilledProb_ = false; + + // ****************************************************************** + //--- Call 2D TemplateReco + // + float locBz = theDetParam.bz; + float locBx = theDetParam.bx; + + //--- Input: + // edgeflagy - (input) flag to indicate the present of edges in y: + // 0=none (or interior gap),1=edge at small y, 2=edge at large y, 3=edge at either end + // + // edgeflagx - (input) flag to indicate the present of edges in x: + // 0=none, 1=edge at small x, 2=edge at large x + // + // These two variables are calculated in setTheClu() and stored in edgeTypeX_ and edgeTypeY_ + // + //--- Output: + // deltay - (output) template y-length - cluster length [when > 0, possibly missing end] + // npixels - ??? &&& Ask Morris + + float deltay = 0; + int npixels = 0; + + theClusterParam.ierr2 = + PixelTempReco3D( ID, theClusterParam.cotalpha, theClusterParam.cotbeta, + locBz, locBx, + theClusterParam.edgeTypeY_ , theClusterParam.edgeTypeX_ , + clusterPayload, + templ2d, + theClusterParam.templYrec_, theClusterParam.templSigmaY_, + theClusterParam.templXrec_, theClusterParam.templSigmaX_, + theClusterParam.templProbXY_, + theClusterParam.probabilityQ_, + theClusterParam.qBin_, + deltay, npixels + ); + // ****************************************************************** + + //--- Check exit status + if unlikely( theClusterParam.ierr2 != 0 ) + { + LogDebug("PixelCPEClusterRepair::localPosition") << + "3D reconstruction failed with error " << theClusterParam.ierr2 << "\n"; + + // Gavril: what do we do in this case ? For now, just return the cluster center of gravity in microns + // In the x case, apply a rough Lorentz drift average correction + // To do: call PixelCPEGeneric whenever PixelTempReco2D fails + float lorentz_drift = -999.9; + if ( ! GeomDetEnumerators::isEndcap(theDetParam.thePart) ) + lorentz_drift = 60.0f; // in microns + else + lorentz_drift = 10.0f; // in microns + // ggiurgiu@jhu.edu, 21/09/2010 : trk angles needed to correct for bows/kinks + if ( theClusterParam.with_track_angle ) + { + theClusterParam.templXrec_ = theDetParam.theTopol->localX( theClusterParam.theCluster->x(), theClusterParam.loc_trk_pred ) - lorentz_drift * micronsToCm; // rough Lorentz drift correction + theClusterParam.templYrec_ = theDetParam.theTopol->localY( theClusterParam.theCluster->y(), theClusterParam.loc_trk_pred ); + } + else + { + edm::LogError("PixelCPEClusterRepair") + << "@SUB = PixelCPEClusterRepair::localPosition" + << "Should never be here. PixelCPEClusterRepair should always be called with track angles. This is a bad error !!! "; + + theClusterParam.templXrec_ = theDetParam.theTopol->localX( theClusterParam.theCluster->x() ) - lorentz_drift * micronsToCm; // rough Lorentz drift correction + theClusterParam.templYrec_ = theDetParam.theTopol->localY( theClusterParam.theCluster->y() ); + } + } + else + { + //--- Template Reco succeeded. + theClusterParam.hasFilledProb_ = true; + + //--- Go from microns to centimeters + theClusterParam.templXrec_ *= micronsToCm; + theClusterParam.templYrec_ *= micronsToCm; + + //--- Go back to the module coordinate system + theClusterParam.templXrec_ += lp.x(); + theClusterParam.templYrec_ += lp.y(); + } + return; +} + + + + +//------------------------------------------------------------------ +// localError() relies on localPosition() being called FIRST!!! +//------------------------------------------------------------------ +LocalError +PixelCPEClusterRepair::localError(DetParam const & theDetParam, ClusterParam & theClusterParamBase) const +{ + + ClusterParamTemplate & theClusterParam = static_cast(theClusterParamBase); + + //cout << endl; + //cout << "Set PixelCPETemplate errors .............................................." << endl; + + //cout << "CPETemplate : " << endl; + + //--- Default is the maximum error used for edge clusters. + //--- (never used, in fact: let comment it out, shut up the complains of the static analyzer, and save a few CPU cycles) + // const float sig12 = 1./sqrt(12.0); + // float xerr = theDetParam.thePitchX *sig12; + // float yerr = theDetParam.thePitchY *sig12; + float xerr = 0.0f, yerr = 0.0f; + + // Check if the errors were already set at the clusters splitting level + if ( theClusterParam.theCluster->getSplitClusterErrorX() > 0.0f && theClusterParam.theCluster->getSplitClusterErrorX() < 7777.7f && + theClusterParam.theCluster->getSplitClusterErrorY() > 0.0f && theClusterParam.theCluster->getSplitClusterErrorY() < 7777.7f ) + { + xerr = theClusterParam.theCluster->getSplitClusterErrorX() * micronsToCm; + yerr = theClusterParam.theCluster->getSplitClusterErrorY() * micronsToCm; + + //cout << "Errors set at cluster splitting level : " << endl; + //cout << "xerr = " << xerr << endl; + //cout << "yerr = " << yerr << endl; + } + else + { + // &&& Duplicate from above! Argh! + int maxPixelCol = theClusterParam.theCluster->maxPixelCol(); + int maxPixelRow = theClusterParam.theCluster->maxPixelRow(); + int minPixelCol = theClusterParam.theCluster->minPixelCol(); + int minPixelRow = theClusterParam.theCluster->minPixelRow(); + + //--- Are we near either of the edges? + bool edgex = ( theDetParam.theRecTopol->isItEdgePixelInX( minPixelRow ) || theDetParam.theRecTopol->isItEdgePixelInX( maxPixelRow ) ); + bool edgey = ( theDetParam.theRecTopol->isItEdgePixelInY( minPixelCol ) || theDetParam.theRecTopol->isItEdgePixelInY( maxPixelCol ) ); + + + //--- Check status of both template calls. + if ( (theClusterParam.ierr !=0) || (theClusterParam.ierr2 !=0) ) + { + // If reconstruction fails the hit position is calculated from cluster center of gravity + // corrected in x by average Lorentz drift. Assign huge errors. + //xerr = 10.0 * (float)theClusterParam.theCluster->sizeX() * xerr; + //yerr = 10.0 * (float)theClusterParam.theCluster->sizeX() * yerr; + + if(!GeomDetEnumerators::isTrackerPixel(theDetParam.thePart)) + throw cms::Exception("PixelCPEClusterRepair::localPosition :") + << "A non-pixel detector type in here?"; + + // Assign better errors based on the residuals for failed template cases + if ( GeomDetEnumerators::isBarrel(theDetParam.thePart) ) + { + xerr = 55.0f * micronsToCm; + yerr = 36.0f * micronsToCm; + } + else + { + xerr = 42.0f * micronsToCm; + yerr = 39.0f * micronsToCm; + } + + //cout << "xerr = " << xerr << endl; + //cout << "yerr = " << yerr << endl; + + //return LocalError(xerr*xerr, 0, yerr*yerr); + } + else if ( theClusterParam.edgeTypeX_ || theClusterParam.edgeTypeY_ ) + { + // for edge pixels assign errors according to observed residual RMS + if ( theClusterParam.edgeTypeX_ && !theClusterParam.edgeTypeY_ ) + { + xerr = 23.0f * micronsToCm; + yerr = 39.0f * micronsToCm; + } + else if ( !theClusterParam.edgeTypeX_ && theClusterParam.edgeTypeY_ ) + { + xerr = 24.0f * micronsToCm; + yerr = 96.0f * micronsToCm; + } + else if ( theClusterParam.edgeTypeX_ && theClusterParam.edgeTypeY_ ) + { + xerr = 31.0f * micronsToCm; + yerr = 90.0f * micronsToCm; + } + } + else + { + xerr = theClusterParam.templSigmaX_ * micronsToCm; + yerr = theClusterParam.templSigmaY_ * micronsToCm; + + // &&& should also check ierr (saved as class variable) and return + // &&& nonsense (another class static) if the template fit failed. + } + + //cout << "xerr = " << xerr << endl; + //cout << "yerr = " << yerr << endl; + + if (theVerboseLevel > 9) + { + LogDebug("PixelCPEClusterRepair") << + " Sizex = " << theClusterParam.theCluster->sizeX() << " Sizey = " << theClusterParam.theCluster->sizeY() << " Edgex = " << edgex << " Edgey = " << edgey << + " ErrX = " << xerr << " ErrY = " << yerr; + } + + } // else + + if ( !(xerr > 0.0f) ) + throw cms::Exception("PixelCPEClusterRepair::localError") + << "\nERROR: Negative pixel error xerr = " << xerr << "\n\n"; + + if ( !(yerr > 0.0f) ) + throw cms::Exception("PixelCPEClusterRepair::localError") + << "\nERROR: Negative pixel error yerr = " << yerr << "\n\n"; + + //cout << "Final errors set to: " << endl; + //cout << "xerr = " << xerr << endl; + //cout << "yerr = " << yerr << endl; + //cout << "Out of PixelCPETemplateREco..........................................................................." << endl; + //cout << endl; + + return LocalError(xerr*xerr, 0, yerr*yerr); +} + diff --git a/RecoLocalTracker/SiPixelRecHits/src/SiPixelTemplateReco2D.cc b/RecoLocalTracker/SiPixelRecHits/src/SiPixelTemplateReco2D.cc new file mode 100644 index 0000000000000..baf19659ed361 --- /dev/null +++ b/RecoLocalTracker/SiPixelRecHits/src/SiPixelTemplateReco2D.cc @@ -0,0 +1,654 @@ +// +// SiPixelTemplateReco2D.cc (Version 2.20) +// Updated to work with the 2D template generation code +// Include all bells and whistles for edge clusters +// 2.10 - Add y-lorentz drift to estimate starting point [for FPix] +// 2.10 - Remove >1 pixel requirement +// 2.20 - Fix major bug, change chi2 scan to 9x5 [YxX] + + +// +// +// Created by Morris Swartz on 7/13/17. +// +// + +#ifndef SI_PIXEL_TEMPLATE_STANDALONE +//#include +#else +#include +#endif +#include +#include +#include +#include +// ROOT::Math has a c++ function that does the probability calc, but only in v5.12 and later +#include "TMath.h" +#include "Math/DistFunc.h" +// Use current version of gsl instead of ROOT::Math +//#include + +#ifndef SI_PIXEL_TEMPLATE_STANDALONE +#include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateReco2D.h" +#include "RecoLocalTracker/SiPixelRecHits/interface/VVIObjF.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#define LOGERROR(x) edm::LogError(x) +#define LOGDEBUG(x) LogDebug(x) +static const int theVerboseLevel = 2; +#define ENDL " " +#include "FWCore/Utilities/interface/Exception.h" +#else +#include "SiPixelTemplateReco2D.h" +#include "VVIObjF.h" +//static int theVerboseLevel = {2}; +#define LOGERROR(x) std::cout << x << ": " +#define LOGDEBUG(x) std::cout << x << ": " +#define ENDL std::endl +#endif + +using namespace SiPixelTemplateReco2D; + +// ************************************************************************************************************************************* +//! Reconstruct the best estimate of the hit position for pixel clusters. +//! \param id - (input) identifier of the template to use +//! \param cotalpha - (input) the cotangent of the alpha track angle (see CMS IN 2004/014) +//! \param cotbeta - (input) the cotangent of the beta track angle (see CMS IN 2004/014) +//! \param locBz - (input) the sign of this quantity is used to determine whether to flip cot(beta)<0 quantities from cot(beta)>0 (FPix only) +//! for Phase 0 FPix IP-related tracks, locBz < 0 for cot(beta) > 0 and locBz > 0 for cot(beta) < 0 +//! for Phase 1 FPix IP-related tracks, see next comment +//! \param locBx - (input) the sign of this quantity is used to determine whether to flip cot(alpha/beta)<0 quantities from cot(alpha/beta)>0 (FPix only) +//! for Phase 1 FPix IP-related tracks, locBx/locBz > 0 for cot(alpha) > 0 and locBx/locBz < 0 for cot(alpha) < 0 +//! for Phase 1 FPix IP-related tracks, locBx > 0 for cot(beta) > 0 and locBx < 0 for cot(beta) < 0 +//! \param edgeflagy - (input) flag to indicate the present of edges in y: 0-none (or interior gap), 1-edge at small y, 2-edge at large y, +//! 3-edge at either end +//! \param edgeflagx - (input) flag to indicate the present of edges in x: 0-none, 1-edge at small x, 2-edge at large x +//! \param cluster - (input) pixel array struct with double pixel flags and bounds +//! origin of local coords (0,0) at center of pixel cluster[0][0]. +//! \param templ2D - (input) the 2D template used in the reconstruction +//! \param yrec - (output) best estimate of y-coordinate of hit in microns +//! \param sigmay - (output) best estimate of uncertainty on yrec in microns +//! \param xrec - (output) best estimate of x-coordinate of hit in microns +//! \param sigmax - (output) best estimate of uncertainty on xrec in microns +//! \param probxy - (output) probability describing goodness-of-fit +//! \param probQ - (output) probability describing upper cluster charge tail +//! \param qbin - (output) index (0-4) describing the charge of the cluster +//! qbin = 0 Q/Q_avg > 1.5 [few % of all hits] +//! 1 1.5 > Q/Q_avg > 1.0 [~30% of all hits] +//! 2 1.0 > Q/Q_avg > 0.85 [~30% of all hits] +//! 3 0.85 > Q/Q_avg > min1 [~30% of all hits] +//! \param deltay - (output) template y-length - cluster length [when > 0, possibly missing end] +// ************************************************************************************************************************************* +int SiPixelTemplateReco2D::PixelTempReco3D(int id, float cotalpha, float cotbeta, float locBz, float locBx, int edgeflagy, int edgeflagx, + ClusMatrix & cluster, SiPixelTemplate2D& templ2D,float& yrec, float& sigmay, + float& xrec, float& sigmax, float& probxy, float& probQ, int& qbin, float& deltay, int& npixels) + +{ + // Local variables + int i, j, k; + float template2d[BXM2][BYM2], dpdx2d[2][BXM2][BYM2], fbin[3]; + + // fraction of truncation signal to measure the cluster ends + const float fracpix = 0.45f; + + + // Extract some relevant info from the 2D template + + if(id > 0) {templ2D.interpolate(id, cotalpha, cotbeta, locBz, locBx);} + float xsize = templ2D.xsize(); + float ysize = templ2D.ysize(); + + // Allow Qbin Q/Q_avg fractions to vary to optimize error estimation + + for(i=0; i<3; ++i) {fbin[i] = templ2D.fbin(i);} + + float q50 = templ2D.s50(); + float pseudopix = 0.1f*q50; + float pseudopix2 = q50*q50; + + + // Get charge scaling factor + + float qscale = templ2D.qscale(); + + // Check that the cluster container is (up to) a 7x21 matrix and matches the dimensions of the double pixel flags + + int nclusx = cluster.mrow; + int nclusy = (int)cluster.mcol; + bool * xdouble = cluster.xdouble; + bool * ydouble = cluster.ydouble; + + // First, rescale all pixel charges and compute total charge + float qtotal = 0.f; + for(i=0; i maxpix) { + clusxy[j][i] = maxpix; + } else { + clusxy[j][i] = cluster(j-1,i-1); + } + if(clusxy[j][i] > 0.) { + ysum[i] += clusxy[j][i]; + // xq += (xe + xpitch/2.)*clusxy[j][i]; + if(j < jmin) {jmin = j; xlow0 = xe;} + if(j > jmax) {jmax = j; xhigh0 = xe+xpitch;} + if(i < imin) {imin = i; ylow0 = ye;} + if(i > imax) {imax = i; yhigh0 = ye+ypitch;} + indexxy[0][npixel] = j; + indexxy[1][npixel] = i; + pixel[npixel] = clusxy[j][i]; + ++npixel; + } + xe += xpitch; + } + // qtot += ysum[i]; + ye += ypitch; + } + ysum[nclusy+1] = 0.f; + ypos[nclusy+1] = yhigh0+0.5f*ysize; + + // float xbaryc = xq/qtot; + + // Quit if only one pixel in cluster + + if(npixel < 2 ) { +// LOGDEBUG("SiPixelTemplateReco2D") << "2D fit not possible with single pixel" << ENDL; + return 1; + } + + + // if(jmax-jmin == 0 ) { + // LOGDEBUG("SiPixelTemplateReco2D") << "2D fit not possible with single x-pixel" << ENDL; + // return 1; + // } + + // Quit if only one pixel in cluster + + // if(imax-imin == 0) { + // LOGDEBUG("SiPixelTemplateReco2D") << "2D fit not possible with single y-pixel" << ENDL; + // return 1; + // } + + // Next, calculate the error^2 [need to know which is the middle y pixel of the cluster] + + int ypixoff = T2HYP1 - (imin+imax)/2; + for(k=0; k hmaxpix && ysum[i-1] < hmaxpix && ylow < 0.f) { + ylow = ypos[i-1] + (ypos[i]-ypos[i-1])*(hmaxpix-ysum[i-1])/(ysum[i]-ysum[i-1]); + } + if(ysum[i] < q50) { + if(imisslow < 0) imisslow = i; + imisshigh = i; + } + if(ysum[i] > hmaxpix && ysum[i+1] < hmaxpix) { + yhigh = ypos[i] + (ypos[i+1]-ypos[i])*(ysum[i]-hmaxpix)/(ysum[i]-ysum[i+1]); + } + } + if(ylow < 0.f || yhigh < 0.f) { + ylow = ylow0; + yhigh = yhigh0; + } + + float templeny = templ2D.clsleny(); + deltay = templeny - (yhigh - ylow)/ysize; + + // Calculate the corrected distance from the ylow and yhigh to the cluster center + +// float delycor = templ2D.delyavg(); +// float halfy = 0.5f*(templeny-delycor)*ysize; + +// printf("templeny = %f, deltay = %f, delycor = %f, halfy = %f \n", templeny, deltay, delycor, halfy); + + // x0 and y0 are best guess seeds for the fit + + // float x0 = 0.5f*(xlow0 + xhigh0) + 0.5f*xsize; + float x0 = 0.5f*(xlow0 + xhigh0) - templ2D.lorxdrift(); + float y0 = 0.5f*(ylow + yhigh) - templ2D.lorydrift(); +// float y1 = yhigh - halfy - templ2D.lorydrift(); +// printf("y0 = %f, y1 = %f \n", y0, y1); + // float y0 = 0.5f*(ylow + yhigh); + + // If there are missing edge columns, set up missing column flags and number + // of minimization passes + + int npass = 1; + + switch(edgeflagy) { + case 0: + break; + case 1: +// y0 = yhigh - halfy - templ2D.lorydrift(); + imisshigh = imin-1; + imisslow = -1; + break; + case 2: +// y0 = ylow + halfy - templ2D.lorydrift(); + imisshigh = -1; + imisslow = imax+1; + break; + case 3: +// y0 = yhigh - halfy - templ2D.lorydrift(); + imisshigh = imin-1; + imisslow = -1; + npass = 2; + break; + default: +#ifndef SI_PIXEL_TEMPLATE_STANDALONE + throw cms::Exception("DataCorrupt") << "PixelTemplateReco3D::illegal edgeflagy = " << edgeflagy << std::endl; +#else + std::cout << "PixelTemplate:3D:illegal edgeflagy = " << edgeflagy << std::endl; +#endif + } + + switch(edgeflagx) { + case 0: + break; + case 1: + jmisshigh = jmin-1; + jmisslow = -1; + break; + case 2: + jmisshigh = -1; + jmisslow = jmax+1; + break; + default: +#ifndef SI_PIXEL_TEMPLATE_STANDALONE + throw cms::Exception("DataCorrupt") << "PixelTemplateReco3D::illegal edgeflagx = " << edgeflagx << std::endl; +#else + std::cout << "PixelTemplate:3D:illegal edgeflagx = " << edgeflagx << std::endl; +#endif + } + + // Define quantities to be saved for each pass + + + float chi2min[2], xerr2[2], yerr2[2]; + float x2D0[2], y2D0[2], qtfrac0[2]; + int ipass, niter0[2]; + + for(ipass = 0; ipass < npass; ++ipass) { + + if(ipass == 1) { + + // Now try again if both edges are possible + + // y0 = ylow + halfy - templ2D.lorydrift(); + imisshigh = -1; + imisslow = imax+1; + } + + // Next, add pseudo pixels around the periphery of the cluster + + int tpixel = npixel; + for(k=0; k 0.2 && fabs(ystep) > 0.2))) { + + // Remember the present parameters + x2D0[ipass] = x2D; + y2D0[ipass] = y2D; + qtfrac0[ipass] = qtfrac; + xerr2[ipass] = minv11; + yerr2[ipass] = minv22; + chi2min[ipass] = chi2; + niter0[ipass] = niter; + + // Calculate the initial template which also allows the error calculation for the struck pixels + + for(j=0; j 2.*xsize || fabs(ystep) > 2.*ysize) break; + x2D += xstep; + y2D += ystep; + ++niter; + } + } + + ipass = 0; + if(npass == 1) { + // one pass, require that it have iterated + if(niter0[0] == 0) {return 2;} + } else { + // two passes + if(niter0[0] == 0 && niter0[1] == 0) {return 2;} + if(niter0[0] > 0 && niter0[1] > 0) { + // if both have iterated, take the smaller chi2 + if(chi2min[1] < chi2min[0]) {ipass = 1;} + } else { + // if one has iterated, take it + if(niter0[1] > 0) {ipass = 1;} + } + } + + // printf("niter = %d \n", niter); + + // Correct the charge ratio for missing pixels + + float fq; + if(qtfrac0[ipass] < 0.10f || qtfrac0[ipass] > 1.f) {qtfrac0[ipass] = 1.f;} + fq = fq0/qtfrac0[ipass]; + + // printf("qtfrac0 = %f \n", qtfrac0); + + if(fq > fbin[0]) { + qbin=0; + } else { + if(fq > fbin[1]) { + qbin=1; + } else { + if(fq > fbin[2]) { + qbin=2; + } else { + qbin=3; + } + } + } + + // Get charge related quantities + + float scalex = templ2D.scalex(qbin); + float scaley = templ2D.scaley(qbin); + float offsetx = templ2D.offsetx(qbin); + float offsety = templ2D.offsety(qbin); +// printf("scalex = %f, scaley = %f, offsetx = %f, offsety = %f \n", scalex, scaley, offsetx, offsety); + + // This 2D code has the origin (0,0) at the lower left edge of the input cluster + // That is now pixel [1,1] and the template reco convention is the middle + // of that pixel, so we need to correct + + xrec = x2D0[ipass] - xsize/2. - offsetx; + if(xdouble[0]) xrec -= xsize/2.f; + yrec = y2D0[ipass] - ysize/2. - offsety; + if(ydouble[0]) yrec -= ysize/2.f; + if(xerr2[ipass] > 0.f) { + sigmax = scalex*sqrt(xerr2[ipass]); + if(sigmax < 3.f) sigmax = 3.f; + } else { + sigmax = 10000.f; + } + if(yerr2[ipass] > 0.f) { + sigmay = scaley*sqrt(yerr2[ipass]); + if(sigmay < 3.f) sigmay = 3.f; + } else { + sigmay = 10000.f; + } + if(id > 0) { + // Do chi2 probability calculation + double meanxy = (double)(npixel*templ2D.chi2ppix()); + double chi2scale = (double)templ2D.chi2scale(); + if(meanxy < 0.01) {meanxy = 0.01;} + double hndof = meanxy/2.f; + double hchi2 = chi2scale*chi2min[ipass]/2.f; + probxy = (float)(1. - TMath::Gamma(hndof, hchi2)); + // Do the charge probability + float mpv = templ2D.mpvvav(); + float sigmaQ = templ2D.sigmavav(); + float kappa = templ2D.kappavav(); + float xvav = (qtotal/qtfrac0[ipass]-mpv)/sigmaQ; + float beta2 = 1.f; + // VVIObj is a private port of CERNLIB VVIDIS + VVIObjF vvidist(kappa, beta2, 1); + float prvav = vvidist.fcn(xvav); + probQ = 1.f - prvav; + } else { + probxy = chi2min[ipass]; + npixels = npixel; + probQ = 0.f; + } + + // Now + + // printf("end minimization, errors = %f, %f \n\n", sqrt(xerr2), sqrt(yerr2)); + + // printf("** 2D-template, cotalpha = %f, cotbeta = %f, x2D = %f, y2D = %f **\n", cotalpha, cotbeta, x2D, y2D); + + // for (k=1; k < BXM3; ++k) { + // printf("%5.0f %5.0f %5.0f %5.0f %5.0f %5.0f %5.0f %5.0f %5.0f %5.0f %5.0f %5.0f %5.0f %5.0f %5.0f %5.0f %5.0f %5.0f // %5.0f %5.0f %5.0f \n", + //template2d[k][1],template2d[k][2],template2d[k][3],template2d[k][4],template2d[k][5],template2d[k][6],template2d[k][7],template2d[k][8],template2d[k][9], + //template2d[k][10],template2d[k][11],template2d[k][12],template2d[k][13],template2d[k][14],template2d[k][15],template2d[k][16],template2d[k][17],template2d[k][18], + // template2d[k][19],template2d[k][20],template2d[k][21]); + // } + + + + return 0; +} // PixelTempReco2D + +int SiPixelTemplateReco2D::PixelTempReco3D(int id, float cotalpha, float cotbeta, float locBz, float locBx, int edgeflagy, + int edgeflagx, ClusMatrix & cluster, SiPixelTemplate2D& templ2D,float& yrec, float& sigmay, float& xrec, float& sigmax, + float& probxy, float& probQ, int& qbin, float& deltay) + +{ + // Local variables + int npixels; + return SiPixelTemplateReco2D::PixelTempReco3D(id, cotalpha, cotbeta, locBz, locBx, edgeflagy, edgeflagx, cluster, + templ2D, yrec, sigmay, xrec, sigmax, probxy, probQ, qbin, deltay, npixels); +} // PixelTempReco2D From 04557cd58c05878f698c48b78da232c1a476181b Mon Sep 17 00:00:00 2001 From: brooks Date: Sat, 3 Mar 2018 17:29:08 +0100 Subject: [PATCH 049/426] fixed sampling factors --- Validation/HcalHits/python/HcalSimHitsValidation_cfi.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Validation/HcalHits/python/HcalSimHitsValidation_cfi.py b/Validation/HcalHits/python/HcalSimHitsValidation_cfi.py index 4ead49775971c..d4e75b385d68c 100644 --- a/Validation/HcalHits/python/HcalSimHitsValidation_cfi.py +++ b/Validation/HcalHits/python/HcalSimHitsValidation_cfi.py @@ -3,8 +3,8 @@ from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer HcalSimHitsAnalyser = DQMEDAnalyzer('HcalSimHitsValidation', outputFile = cms.untracked.string(''), - hf1 = cms.double(0.383), - hf2 = cms.double(0.368) + hf1 = cms.double(1/0.383), + hf2 = cms.double(1/0.368) ) from Configuration.Eras.Modifier_fastSim_cff import fastSim @@ -16,6 +16,6 @@ # post-LS1 switch for sampling factors from Configuration.Eras.Modifier_run2_common_cff import run2_common run2_common.toModify( HcalSimHitsAnalyser, - hf1 = cms.double(0.67), - hf2 = cms.double(0.67) + hf1 = cms.double(1/0.67), + hf2 = cms.double(1/0.67) ) From aede2a6e13175ce579188db32e99743e53f659eb Mon Sep 17 00:00:00 2001 From: brooks Date: Sat, 3 Mar 2018 18:30:19 +0100 Subject: [PATCH 050/426] style and formatting fixes --- Validation/HcalHits/interface/HcalSimHitsValidation.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Validation/HcalHits/interface/HcalSimHitsValidation.h b/Validation/HcalHits/interface/HcalSimHitsValidation.h index 95026a42a3eff..fcbde26e4ec43 100644 --- a/Validation/HcalHits/interface/HcalSimHitsValidation.h +++ b/Validation/HcalHits/interface/HcalSimHitsValidation.h @@ -49,7 +49,7 @@ class HcalSimHitsValidation : public DQMEDAnalyzer { void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const & ) override; void analyze(edm::Event const& ev, edm::EventSetup const& c) override; - virtual void endJob() ; + void endJob() override ; private: From b14da5fbc0fe6ee4fa59711c821e6772d4d6ce43 Mon Sep 17 00:00:00 2001 From: brooks Date: Sun, 4 Mar 2018 08:08:05 +0100 Subject: [PATCH 051/426] re-added EEHitCollection to run2_HCAL_2017 --- .../macros/html_indices/SinglePiScan.html | 308 +++++++++--------- .../python/HcalSimHitsValidation_cfi.py | 2 +- 2 files changed, 155 insertions(+), 155 deletions(-) diff --git a/Validation/CaloTowers/test/macros/html_indices/SinglePiScan.html b/Validation/CaloTowers/test/macros/html_indices/SinglePiScan.html index 5667a263956e9..80a1b29512ffb 100644 --- a/Validation/CaloTowers/test/macros/html_indices/SinglePiScan.html +++ b/Validation/CaloTowers/test/macros/html_indices/SinglePiScan.html @@ -1,154 +1,154 @@ -

- Single pi (e=50GeV) scan of ECAL+HCAL -

- - >>> click on thumbnail to get a full-size plot - -

-


-
-Simulation details:
- - 50k events - - no field
- - no vertex smearing
- - no material in front of Calorimetry
- - no Triggers
-
-
- -Plotted in this row is the SimHits energy collected in R=0.3 : EM, HAD and EM+HAD without HO
-Plots ====>>> Em component >>> Had component (no HO) >>> Total energy (Em+Had) >>> - -

- - - - - - - - - -


- -
- -Plotted in this row is the number of Digis per each subdetector
- -

- - - - - - - - - - - -


-Plotted in this row is the HCAL subdetectors RecHits energy (mostly noise with single-pion contributin on the right side
-Plots ====>>> HB >>> HE >>> HO >>> HF - -

- - - - - - - - - - - -


- -Plotted in this row is the RecHits timing vs energy
-Plots ====>>> HB >>> HE >>> HF - -

- - - - - - - - -


- -Plotted in this row is the RecHits energy collected in R=0.3 : EM, HAD and EM+HAD without HO
-Plots ====>>> Em component >>> Had component (no HO) >>> Total energy (Em+Had) >>> Ratio of Had component - -

- - - - - - - - - - - - -


- -Plotted in the row below is the same quantities as above,
-but for ONE single CaloTower in the event, which is closest to the MC direction of the pion -
-Also added is a plot of the single CaloTower scale ratio (new / previous). -The idea is to avoid any clustering (which masks transition) and to pinpoint each ieta ring in the most simplified and clear way. -

-

-Plots ====>>> Em component >>> Had component (no HO) >>> Total energy (Em+Had) >>> Ratio of total energy
-
- - -

- - - - - - - - -


- - - -Plotted in the row below is the same quantities as above,
-but for all CaloTowers in the cone R=0.3 around MC direction of the pion -
-Also added is a plot of the HAD cmponent ratio (new / previous). -

-

-Plots ====>>> Em component >>> Had component (no HO) >>> Total energy (Em+Had) >>> Ratio of Had component
-
-

-

- - - - - - - - -


- - -Finally: number of CaloTowers in HB, HE and HF (separately)
- -

- - - - - - -


+

+ Single pi (e=50GeV) scan of ECAL+HCAL +

+ + >>> click on thumbnail to get a full-size plot + +

+


+
+Simulation details:
+ - 50k events + - no field
+ - no vertex smearing
+ - no material in front of Calorimetry
+ - no Triggers
+
+
+ +Plotted in this row is the SimHits energy collected in R=0.3 : EM, HAD and EM+HAD without HO
+Plots ====>>> Em component >>> Had component (no HO) >>> Total energy (Em+Had) >>> + +

+ + + + + + + + + +


+ +
+ +Plotted in this row is the number of Digis per each subdetector
+ +

+ + + + + + + + + + + +


+Plotted in this row is the HCAL subdetectors RecHits energy (mostly noise with single-pion contributin on the right side
+Plots ====>>> HB >>> HE >>> HO >>> HF + +

+ + + + + + + + + + + +


+ +Plotted in this row is the RecHits timing vs energy
+Plots ====>>> HB >>> HE >>> HF + +

+ + + + + + + + +


+ +Plotted in this row is the RecHits energy collected in R=0.3 : EM, HAD and EM+HAD without HO
+Plots ====>>> Em component >>> Had component (no HO) >>> Total energy (Em+Had) >>> Ratio of Had component + +

+ + + + + + + + + + + + +


+ +Plotted in the row below is the same quantities as above,
+but for ONE single CaloTower in the event, which is closest to the MC direction of the pion +
+Also added is a plot of the single CaloTower scale ratio (new / previous). +The idea is to avoid any clustering (which masks transition) and to pinpoint each ieta ring in the most simplified and clear way. +

+

+Plots ====>>> Em component >>> Had component (no HO) >>> Total energy (Em+Had) >>> Ratio of total energy
+
+ + +

+ + + + + + + + +


+ + + +Plotted in the row below is the same quantities as above,
+but for all CaloTowers in the cone R=0.3 around MC direction of the pion +
+Also added is a plot of the HAD cmponent ratio (new / previous). +

+

+Plots ====>>> Em component >>> Had component (no HO) >>> Total energy (Em+Had) >>> Ratio of Had component
+
+

+

+ + + + + + + + +


+ + +Finally: number of CaloTowers in HB, HE and HF (separately)
+ +

+ + + + + + +


diff --git a/Validation/HcalHits/python/HcalSimHitsValidation_cfi.py b/Validation/HcalHits/python/HcalSimHitsValidation_cfi.py index d4e75b385d68c..e1d32d2920297 100644 --- a/Validation/HcalHits/python/HcalSimHitsValidation_cfi.py +++ b/Validation/HcalHits/python/HcalSimHitsValidation_cfi.py @@ -11,7 +11,7 @@ fastSim.toModify( HcalSimHitsAnalyser, ModuleLabel = cms.untracked.string("fastSimProducer") ) from Configuration.Eras.Modifier_run2_HCAL_2017_cff import run2_HCAL_2017 -run2_HCAL_2017.toModify( HcalSimHitsAnalyser, TestNumber = cms.untracked.bool(True), EEHitCollection = cms.untracked.string("") ) +run2_HCAL_2017.toModify( HcalSimHitsAnalyser, TestNumber = cms.untracked.bool(True), EEHitCollection = cms.untracked.string("HGCHitsEE") ) # post-LS1 switch for sampling factors from Configuration.Eras.Modifier_run2_common_cff import run2_common From 677abe654936868487dc259e06286355738f0724 Mon Sep 17 00:00:00 2001 From: brooks Date: Sun, 4 Mar 2018 08:23:50 +0100 Subject: [PATCH 052/426] further fixes to EEHitCollection --- Validation/HcalHits/python/HcalSimHitsValidation_cfi.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Validation/HcalHits/python/HcalSimHitsValidation_cfi.py b/Validation/HcalHits/python/HcalSimHitsValidation_cfi.py index e1d32d2920297..6e9cfa3350c39 100644 --- a/Validation/HcalHits/python/HcalSimHitsValidation_cfi.py +++ b/Validation/HcalHits/python/HcalSimHitsValidation_cfi.py @@ -11,7 +11,10 @@ fastSim.toModify( HcalSimHitsAnalyser, ModuleLabel = cms.untracked.string("fastSimProducer") ) from Configuration.Eras.Modifier_run2_HCAL_2017_cff import run2_HCAL_2017 -run2_HCAL_2017.toModify( HcalSimHitsAnalyser, TestNumber = cms.untracked.bool(True), EEHitCollection = cms.untracked.string("HGCHitsEE") ) +run2_HCAL_2017.toModify( HcalSimHitsAnalyser, TestNumber = cms.untracked.bool(True) ) + +from Configuration.Eras.Modifier_phase2_hcal_cff import phase2_hcal +phase2_hcal.toModify( HcalSimHitsAnalyser, EEHitCollection = cms.untracked.string("") ) # post-LS1 switch for sampling factors from Configuration.Eras.Modifier_run2_common_cff import run2_common From e0f991305218d3038dafb912caaf4a8e9e5f6fe8 Mon Sep 17 00:00:00 2001 From: nminafra Date: Sun, 4 Mar 2018 14:32:17 +0100 Subject: [PATCH 053/426] Updated test to cope with updated geometry --- DQM/CTPPS/test/diamond_dqm_test_cfg.py | 1 - 1 file changed, 1 deletion(-) diff --git a/DQM/CTPPS/test/diamond_dqm_test_cfg.py b/DQM/CTPPS/test/diamond_dqm_test_cfg.py index 111de62a5ec61..a3b94b7e6ef7f 100644 --- a/DQM/CTPPS/test/diamond_dqm_test_cfg.py +++ b/DQM/CTPPS/test/diamond_dqm_test_cfg.py @@ -49,7 +49,6 @@ process.load("RecoCTPPS.Configuration.recoCTPPS_cff") # rechits production -process.load('Geometry.VeryForwardGeometry.geometryRP_cfi') process.load('RecoCTPPS.TotemRPLocal.ctppsDiamondRecHits_cfi') # local tracks fitter From 4b9b3b5cb5e7ce796b6a9ad9a77030c0acd8e964 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Mon, 5 Mar 2018 09:02:11 +0100 Subject: [PATCH 054/426] Remove unnecessary commented lines --- .../plugins/PreMixingModule.cc | 6 --- .../plugins/PreMixingMuonWorkers.cc | 4 -- .../plugins/PreMixingPileupCopy.cc | 5 --- .../plugins/PreMixingSiPixelWorker.cc | 44 ------------------- .../plugins/PreMixingSiStripWorker.cc | 24 ---------- 5 files changed, 83 deletions(-) diff --git a/SimGeneral/PreMixingModule/plugins/PreMixingModule.cc b/SimGeneral/PreMixingModule/plugins/PreMixingModule.cc index 12121fc5699fb..4c99adc80b8d8 100644 --- a/SimGeneral/PreMixingModule/plugins/PreMixingModule.cc +++ b/SimGeneral/PreMixingModule/plugins/PreMixingModule.cc @@ -110,10 +110,6 @@ namespace edm { } void PreMixingModule::endRun(edm::Run const& run, const edm::EventSetup& ES) { - // Do these have to be implemented? - // HcalDigiWorkerProd_->endRun( run, ES ); // FIXME not implemented - // EcalDigiWorkerProd_->endRun( ES ); // FIXME not implemented - BMixingModule::endRun( run, ES); } @@ -223,8 +219,6 @@ namespace edm { } void PreMixingModule::endLuminosityBlock(LuminosityBlock const& l1, EventSetup const& c) { - // Should this be implemented? - // EcalDigiWorkerProd_->endLuminosityBlock(l1,c); // FIXME Not implemented. BMixingModule::endLuminosityBlock(l1, c); } } diff --git a/SimGeneral/PreMixingModule/plugins/PreMixingMuonWorkers.cc b/SimGeneral/PreMixingModule/plugins/PreMixingMuonWorkers.cc index cf9c4398e84c6..8e881705f2f4f 100644 --- a/SimGeneral/PreMixingModule/plugins/PreMixingMuonWorkers.cc +++ b/SimGeneral/PreMixingModule/plugins/PreMixingMuonWorkers.cc @@ -94,7 +94,6 @@ namespace edm { std::vector StripPointer; for(CSCStripDigiCollection::const_iterator dtdigi=range.first; dtdigi!=range.second; ++dtdigi){ - //std::cout << "Digi " << (*dtdigi).getStrip() << std::endl; StripList.push_back( (*dtdigi).getStrip() ); StripPointer.push_back( dtdigi ); } @@ -120,9 +119,6 @@ namespace edm { ++DuplPointer; for( ; duplicate!=StripList.end(); ++duplicate) { if( (*duplicate) == CurrentStrip ) { - - // std::cout << " Duplicate of current " << CurrentStrip << " found at " << (duplicate - StripList.begin()) << std::endl; - DuplicateList.push_back(CurrentStrip); std::vector pileup_adc = (**DuplPointer).getADCCounts(); diff --git a/SimGeneral/PreMixingModule/plugins/PreMixingPileupCopy.cc b/SimGeneral/PreMixingModule/plugins/PreMixingPileupCopy.cc index 966c08964ea57..0cc54cd95e26d 100644 --- a/SimGeneral/PreMixingModule/plugins/PreMixingPileupCopy.cc +++ b/SimGeneral/PreMixingModule/plugins/PreMixingPileupCopy.cc @@ -14,11 +14,6 @@ namespace edm { cfPlaybackInputTag_(ps.getParameter("CFPlaybackInputTag")), genPUProtonsInputTags_(ps.getParameter >("GenPUProtonsInputTags")) { - // apparently, we don't need consumes from Secondary input stream - //iC.consumes>(PileupInfoInputTag_); - //iC.consumes(BunchSpacingInputTag_); - //iC.consumes(CFPlaybackInputTag_); - producer.produces >(); producer.produces("bunchSpacing"); producer.produces(); diff --git a/SimGeneral/PreMixingModule/plugins/PreMixingSiPixelWorker.cc b/SimGeneral/PreMixingModule/plugins/PreMixingSiPixelWorker.cc index a61ecbabe907f..f0d6249b364e4 100644 --- a/SimGeneral/PreMixingModule/plugins/PreMixingSiPixelWorker.cc +++ b/SimGeneral/PreMixingModule/plugins/PreMixingSiPixelWorker.cc @@ -72,7 +72,6 @@ namespace edm { double thePixelChipEfficiency[20]; // ROC efficiency std::vector theLadderEfficiency_BPix[20]; // Ladder efficiency std::vector theModuleEfficiency_BPix[20]; // Module efficiency - //std::vector thePUEfficiency[20]; // Instlumi dependent efficiency double theInnerEfficiency_FPix[20]; // Fpix inner module efficiency double theOuterEfficiency_FPix[20]; // Fpix outer module efficiency unsigned int FPixIndex; // The Efficiency index for FPix Disks @@ -86,13 +85,6 @@ namespace edm { bool matches(const DetId&, const DetId&, const std::vector&); }; - - // Needed by dynamic inefficiency - // 0-3 BPix, 4-5 FPix (inner, outer) - //double _pu_scale[20]; - - // data specifiers - edm::InputTag pixeldigi_collectionSig_ ; // secondary name given to collection of SiPixel digis edm::InputTag pixeldigi_collectionPile_ ; // secondary name given to collection of SiPixel digis std::string PixelDigiCollectionDM_ ; // secondary name to be given to new SiPixel digis @@ -123,18 +115,12 @@ namespace edm { SiGlobalIndex SiHitStorage_; - - // unsigned int eventId_; //=0 for signal, from 1-n for pileup events - const std::string geometryType_; //-- Allow for upgrades const int NumberOfBarrelLayers; // Default = 3 const int NumberOfEndcapDisks; // Default = 2 - //const double theInstLumiScaleFactor; - //const double bunchScaleAt25; - const bool AddPixelInefficiency; // bool to read in inefficiencies PixelEfficiencies pixelEff_; @@ -151,16 +137,10 @@ namespace edm { // of layers or disks. NumberOfBarrelLayers(ps.exists("NumPixelBarrel")?ps.getParameter("NumPixelBarrel"):3), NumberOfEndcapDisks(ps.exists("NumPixelEndcap")?ps.getParameter("NumPixelEndcap"):2), - //theInstLumiScaleFactor(ps.getParameter("theInstLumiScaleFactor")), //For dynamic inefficiency PU scaling - //bunchScaleAt25(ps.getParameter("bunchScaleAt25")), //For dynamic inefficiency bunchspace scaling // Control the pixel inefficiency AddPixelInefficiency(ps.getParameter("AddPixelInefficiency")), pixelEff_(ps, AddPixelInefficiency,NumberOfBarrelLayers,NumberOfEndcapDisks) { - - // get the subdetector names - // this->getSubdetectorNames(); //something like this may be useful to check what we are supposed to do... - // declare the products to produce pixeldigi_collectionSig_ = ps.getParameter("pixeldigiCollectionSig"); @@ -183,9 +163,6 @@ namespace edm { void PreMixingSiPixelWorker::initializeEvent(edm::Event const& e, edm::EventSetup const& iSetup) { iSetup.get().get(geometryType_, pDD); - //edm::ESHandle tTopoHand; - //iSetup.get().get(tTopoHand); - //const TrackerTopology *tTopo=tTopoHand.product(); } @@ -429,12 +406,6 @@ bool PreMixingSiPixelWorker::PixelEfficiencies::matches(const DetId& detid, cons const edm::DetSetVector *input = inputPTR->product(); - - - // Handle< edm::DetSetVector > input; - - // if( e->getByLabel(pixeldigi_collectionPile_,input) ) { - //loop on all detsets (detectorIDs) inside the input collection edm::DetSetVector::const_iterator DSViter=input->begin(); for (; DSViter!=input->end();DSViter++){ @@ -527,8 +498,6 @@ bool PreMixingSiPixelWorker::PixelEfficiencies::matches(const DetId& detid, cons else if (ADCSum > 253 && ADCSum < 512) ADCSum = 254; Signals.insert( std::make_pair(formerPixel, ADCSum)); - //PixelDigi aHit(formerPixel, ADCSum); - //SPD.push_back( aHit ); } // save pointers for next iteration formerPixel = currentPixel; @@ -540,7 +509,6 @@ bool PreMixingSiPixelWorker::PixelEfficiencies::matches(const DetId& detid, cons if (ADCSum > 511) ADCSum = 255; else if (ADCSum > 253 && ADCSum < 512) ADCSum = 254; Signals.insert( std::make_pair(formerPixel, ADCSum)); - //SPD.push_back( PixelDigi(formerPixel, ADCSum) ); } }// end of loop over one detector @@ -610,7 +578,6 @@ bool PreMixingSiPixelWorker::PixelEfficiencies::matches(const DetId& detid, cons pixelEfficiency = pixelEff_.thePixelEfficiency[layerIndex-1]; columnEfficiency = pixelEff_.thePixelColEfficiency[layerIndex-1]; chipEfficiency = pixelEff_.thePixelChipEfficiency[layerIndex-1]; - //std::cout <<"Using BPix columnEfficiency = "<416) LogWarning ("Pixel Geometry") <<" wrong columns in barrel "<layer(detID)+pixelEff_.FPixIndex; // Use diskIndex-1 later to stay consistent with BPix unsigned int panelIndex=tTopo->pxfPanel(detID); unsigned int moduleIndex=tTopo->pxfModule(detID); - //if (pixelEff_.FPixIndex>diskIndex-1){throw cms::Exception("Configuration") <<"SiPixelDigitizer is using the wrong efficiency value. index = " - // <pxfDisk(detID);} pixelEfficiency = pixelEff_.thePixelEfficiency[diskIndex-1]; columnEfficiency = pixelEff_.thePixelColEfficiency[diskIndex-1]; chipEfficiency = pixelEff_.thePixelChipEfficiency[diskIndex-1]; - //std::cout <<"Using FPix columnEfficiency = "< chipEfficiency ) chips[iter->first]=0; } // Delete some Dcol hits. for ( iter = columns.begin(); iter != columns.end() ; iter++ ) { - //float rand = RandFlat::shoot(); float rand = CLHEP::RandFlat::shoot(engine); if( rand > columnEfficiency ) columns[iter->first]=0; } @@ -714,7 +676,6 @@ bool PreMixingSiPixelWorker::PixelEfficiencies::matches(const DetId& detid, cons // Loop over hit pixels, amplitude in electrons, channel = coded row,col for(signal_map_iterator i = theSignal.begin();i != theSignal.end(); ++i) { - // int chan = i->first; std::pair ip = PixelDigi::channelToPixel(i->first);//get pixel pos int row = ip.first; // X in row int col = ip.second; // Y is in col @@ -724,7 +685,6 @@ bool PreMixingSiPixelWorker::PixelEfficiencies::matches(const DetId& detid, cons //dcol in mod int dColInDet = pIndexConverter->DColumnInModule(dColInChip,chipIndex); - //float rand = RandFlat::shoot(); float rand = CLHEP::RandFlat::shoot(engine); if( chips[chipIndex]==0 || columns[dColInDet]==0 || rand>pixelEfficiency ) { @@ -758,10 +718,6 @@ bool PreMixingSiPixelWorker::PixelEfficiencies::matches(const DetId& detid, cons } void PreMixingSiPixelWorker::setPileupInfo(const std::vector &ps, const int &bunchSpacing) { - - //double bunchScale=1.0; - //if (bunchSpacing==25) bunchScale=bunchScaleAt25; - int p = -1; for ( unsigned int i=0; i SignalMapType; typedef std::map signalMaps; @@ -154,10 +150,6 @@ namespace edm { theSiDigitalConverter(new SiTrivialDigitalConverter(theElectronPerADC, false)) // no premixing { - - // get the subdetector names - // this->getSubdetectorNames(); //something like this may be useful to check what we are supposed to do... - // declare the products to produce SistripLabelSig_ = ps.getParameter("SistripLabelSig"); @@ -186,10 +178,6 @@ namespace edm { } theSiNoiseAdder.reset(new SiGaussianTailNoiseAdder(theThreshold)); - - // theSiZeroSuppress = new SiStripFedZeroSuppression(theFedAlgo); - //theSiDigitalConverter(new SiTrivialDigitalConverter(theElectronPerADC)); - } void PreMixingSiStripWorker::initializeEvent(const edm::Event &e, edm::EventSetup const& iSetup) { @@ -294,10 +282,6 @@ namespace edm { const edm::DetSetVector *input = const_cast< edm::DetSetVector * >(inputPTR->product()); - // Handle< edm::DetSetVector > input; - - // if( e->getByLabel(Sistripdigi_collectionPile_.label(),SistripLabelPile_.label(),input) ) { - OneDetectorMap LocalMap; //loop on all detsets (detectorIDs) inside the input collection @@ -610,7 +594,6 @@ namespace edm { size_t lastChannelWithSignal = numStrips; if(SingleStripNoise){ - // std::cout<<"In SSN, detId="< noiseRMSv; noiseRMSv.clear(); noiseRMSv.insert(noiseRMSv.begin(),numStrips,0.); @@ -618,7 +601,6 @@ namespace edm { if(!badChannels[strip]){ float gainValue = gainHandle->getStripGain(strip, detGainRange); noiseRMSv[strip] = (noiseHandle->getNoise(strip,detNoiseRange))* theElectronPerADC/gainValue; - //std::cout<<": gainValue: "<addNoiseVR(detAmpl, noiseRMSv, engine); @@ -632,7 +614,6 @@ namespace edm { float RefnoiseRMS = noiseHandle->getNoise(RefStrip,detNoiseRange) *theElectronPerADC/RefgainValue; theSiNoiseAdder->addNoise(detAmpl,firstChannelWithSignal,lastChannelWithSignal,numStrips,RefnoiseRMS, engine); - //std::cout<<": RefgainValue: "< 0) { - // std::cout << " Real SiS Mixed Digi: " << detID << " ADC values "; - // for(const auto& iDigi : digis) { std::cout << iDigi.adc() << " " ;} - // std::cout << std::endl; - //} // stick this into the global vector of detector info vSiStripDigi.push_back(SSD); From ba82b94983532fa13e4e7375e9f8a9396847ecec Mon Sep 17 00:00:00 2001 From: nminafra Date: Mon, 5 Mar 2018 16:07:18 +0100 Subject: [PATCH 055/426] fixed problem with pixel geometry, removed all reference to strips --- DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc | 21 ++++++++++--------- DQM/CTPPS/python/ctppsDiamondDQMSource_cfi.py | 1 - 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc b/DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc index e4813af86aaf3..f77bde35b09db 100644 --- a/DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc +++ b/DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc @@ -23,7 +23,6 @@ #include "DataFormats/CTPPSDigi/interface/TotemVFATStatus.h" #include "DataFormats/CTPPSDigi/interface/TotemFEDInfo.h" #include "DataFormats/Common/interface/DetSetVector.h" -#include "DataFormats/CTPPSReco/interface/TotemRPLocalTrack.h" #include "DataFormats/CTPPSDetId/interface/CTPPSDiamondDetId.h" #include "DataFormats/CTPPSDigi/interface/CTPPSDiamondDigi.h" @@ -89,7 +88,6 @@ class CTPPSDiamondDQMSource : public DQMEDAnalyzer static const int CTPPS_FED_ID_56; edm::EDGetTokenT< edm::DetSetVector > tokenStatus_; - edm::EDGetTokenT< edm::DetSetVector > tokenLocalTrack_; edm::EDGetTokenT< edm::DetSetVector > tokenPixelTrack_; edm::EDGetTokenT< edm::DetSetVector > tokenDigi_; edm::EDGetTokenT< edm::DetSetVector > tokenDiamondHit_; @@ -374,7 +372,6 @@ CTPPSDiamondDQMSource::ChannelPlots::ChannelPlots( DQMStore::IBooker& ibooker, u CTPPSDiamondDQMSource::CTPPSDiamondDQMSource( const edm::ParameterSet& ps ) : tokenStatus_ ( consumes< edm::DetSetVector > ( ps.getParameter( "tagStatus" ) ) ), - tokenLocalTrack_ ( consumes< edm::DetSetVector > ( ps.getParameter( "tagLocalTrack" ) ) ), tokenPixelTrack_ ( consumes< edm::DetSetVector > ( ps.getParameter( "tagPixelLocalTracks" ) ) ), tokenDigi_ ( consumes< edm::DetSetVector > ( ps.getParameter( "tagDigi" ) ) ), tokenDiamondHit_ ( consumes< edm::DetSetVector > ( ps.getParameter( "tagDiamondRecHits" ) ) ), @@ -417,8 +414,15 @@ CTPPSDiamondDQMSource::dqmBeginRun( const edm::Run& iRun, const edm::EventSetup& // Rough alignement of pixel detector for diamond thomography const CTPPSPixelDetId pixid(0, CTPPS_PIXEL_STATION_ID, CTPPS_FAR_RP_ID, 0); - det = geom->getSensor( pixid ); - horizontalShiftBwDiamondPixels_ = det->translation().x() - det->params().at( 0 ) - horizontalShiftOfDiamond_ - 3; + try { + det = geom->getSensor( pixid ); + horizontalShiftBwDiamondPixels_ = det->translation().x() - det->params().at( 0 ) - horizontalShiftOfDiamond_ - 3; + } + catch (...) + { + // Pixel not yet installed... tomography will be empty + horizontalShiftBwDiamondPixels_ = 0; + } } @@ -464,9 +468,6 @@ CTPPSDiamondDQMSource::analyze( const edm::Event& event, const edm::EventSetup& // get event data edm::Handle< edm::DetSetVector > diamondVFATStatus; event.getByToken( tokenStatus_, diamondVFATStatus ); - - edm::Handle< edm::DetSetVector > stripTracks; - event.getByToken( tokenLocalTrack_, stripTracks ); edm::Handle< edm::DetSetVector > pixelTracks; event.getByToken( tokenPixelTrack_, pixelTracks ); @@ -512,7 +513,7 @@ CTPPSDiamondDQMSource::analyze( const edm::Event& event, const edm::EventSetup& // Correlation Plots //------------------------------ - for ( const auto& ds1 : *stripTracks ) { + for ( const auto& ds1 : *pixelTracks ) { for ( const auto& tr1 : ds1 ) { if ( ! tr1.isValid() ) continue; @@ -523,7 +524,7 @@ CTPPSDiamondDQMSource::analyze( const edm::Event& event, const edm::EventSetup& if (stNum1 != 0 || ( rpNum1 != 2 && rpNum1 != 3 ) ) continue; unsigned int idx1 = arm1*3 + rpNum1-2; - for ( const auto& ds2 : *stripTracks ) { + for ( const auto& ds2 : *pixelTracks ) { for ( const auto& tr2 : ds2 ) { if ( ! tr2.isValid() ) continue; diff --git a/DQM/CTPPS/python/ctppsDiamondDQMSource_cfi.py b/DQM/CTPPS/python/ctppsDiamondDQMSource_cfi.py index fed435979c19d..989fbcc29a307 100644 --- a/DQM/CTPPS/python/ctppsDiamondDQMSource_cfi.py +++ b/DQM/CTPPS/python/ctppsDiamondDQMSource_cfi.py @@ -7,7 +7,6 @@ tagFEDInfo = cms.InputTag("ctppsDiamondRawToDigi", "TimingDiamond"), tagDiamondRecHits = cms.InputTag("ctppsDiamondRecHits"), tagDiamondLocalTracks = cms.InputTag("ctppsDiamondLocalTracks"), - tagLocalTrack = cms.InputTag("totemRPLocalTrackFitter"), tagPixelLocalTracks = cms.InputTag("ctppsPixelLocalTracks"), excludeMultipleHits = cms.bool(True), From cf6841e916175f1120d7ed5ca60a9746908ea0f1 Mon Sep 17 00:00:00 2001 From: Tatjana Date: Mon, 5 Mar 2018 16:37:08 +0100 Subject: [PATCH 056/426] Implemented pixel inefficiency at ROC level --- .../plugins/SiPixelDigitizerAlgorithm.cc | 74 +++++++++++++++++-- .../plugins/SiPixelDigitizerAlgorithm.h | 2 + 2 files changed, 68 insertions(+), 8 deletions(-) diff --git a/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizerAlgorithm.cc b/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizerAlgorithm.cc index e85b046895181..132188dac15ad 100644 --- a/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizerAlgorithm.cc +++ b/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizerAlgorithm.cc @@ -496,15 +496,15 @@ void SiPixelDigitizerAlgorithm::init_DynIneffDB(const edm::EventSetup& es, const } void SiPixelDigitizerAlgorithm::PixelEfficiencies::init_from_db(const edm::ESHandle& geom, const edm::ESHandle& SiPixelDynamicInefficiency) { - + theInstLumiScaleFactor = SiPixelDynamicInefficiency->gettheInstLumiScaleFactor(); - const std::map& PixelGeomFactorsDB = SiPixelDynamicInefficiency->getPixelGeomFactors(); + const std::map& PixelGeomFactorsDBIn = SiPixelDynamicInefficiency->getPixelGeomFactors(); const std::map& ColGeomFactorsDB = SiPixelDynamicInefficiency->getColGeomFactors(); const std::map& ChipGeomFactorsDB = SiPixelDynamicInefficiency->getChipGeomFactors(); const std::map >& PUFactors = SiPixelDynamicInefficiency->getPUFactors(); std::vector DetIdmasks = SiPixelDynamicInefficiency->getDetIdmasks(); - // Loop on all modules, calculate geometrical scale factors and store in map for easy access + // Loop on all modules, initialize map for easy access for( const auto& it_module : geom->detUnits()) { if( dynamic_cast(it_module)==nullptr) continue; const DetId detid = it_module->geographicalId(); @@ -512,11 +512,46 @@ void SiPixelDigitizerAlgorithm::PixelEfficiencies::init_from_db(const edm::ESHan PixelGeomFactors[rawid] = 1; ColGeomFactors[rawid] = 1; ChipGeomFactors[rawid] = 1; + PixelGeomFactorsROCStdPixels[rawid] = std::vector(16,1); + PixelGeomFactorsROCBigPixels[rawid] = std::vector(16,1); + } + + // Store ROC level scale factors (big and standard pixels separatelly) + std::map PixelGeomFactorsDB; + for (auto db_factor : PixelGeomFactorsDBIn){ + int shift = DetId(db_factor.first).subdetId() == 1? 6 : 3; + unsigned int rocMask = 0x1F << shift; + unsigned int rocId = (((db_factor.first) & rocMask) >> shift); + if (rocId != 0) { + rocId--; + unsigned int rawid = db_factor.first & (~rocMask); + double factor = db_factor.second; + double badFraction = 1 - factor; + double bigPixelFraction = 210./4160.; + double stdPixelFraction = 3950./4160.; + + double badFractionBig = std::min(bigPixelFraction, badFraction); + double badFractionStd = std::max(0., badFraction - badFractionBig); + double badFractionBigReNormalized = badFractionBig/bigPixelFraction; + double badFractionStdReNormalized = badFractionStd/stdPixelFraction; + PixelGeomFactorsROCStdPixels[rawid][rocId] *= (1. - badFractionStdReNormalized); + PixelGeomFactorsROCBigPixels[rawid][rocId] *= (1. - badFractionBigReNormalized); + } + else{ + PixelGeomFactorsDB[db_factor.first] = db_factor.second; + } + } + + // Loop on all modules, store module level geometrical scale factors + for( const auto& it_module : geom->detUnits()) { + if( dynamic_cast(it_module)==nullptr) continue; + const DetId detid = it_module->geographicalId(); + uint32_t rawid = detid.rawId(); for (auto db_factor : PixelGeomFactorsDB) if (matches(detid, DetId(db_factor.first), DetIdmasks)) PixelGeomFactors[rawid] *= db_factor.second; for (auto db_factor : ColGeomFactorsDB) if (matches(detid, DetId(db_factor.first), DetIdmasks)) ColGeomFactors[rawid] *= db_factor.second; for (auto db_factor : ChipGeomFactorsDB) if (matches(detid, DetId(db_factor.first), DetIdmasks)) ChipGeomFactors[rawid] *= db_factor.second; } - + // piluep scale factors are calculated once per event // therefore vector index is stored in a map for each module that matches to a db_id size_t i=0; @@ -1487,6 +1522,8 @@ void SiPixelDigitizerAlgorithm::pixel_inefficiency(const PixelEfficiencies& eff, double pixelEfficiency = 1.0; double columnEfficiency = 1.0; double chipEfficiency = 1.0; + std::vector pixelEfficiencyROCStdPixels(16,1); + std::vector pixelEfficiencyROCBigPixels(16,1); if (eff.FromConfig) { // setup the chip indices conversion @@ -1546,6 +1583,10 @@ void SiPixelDigitizerAlgorithm::pixel_inefficiency(const PixelEfficiencies& eff, pixelEfficiency = eff.PixelGeomFactors.at(detID); columnEfficiency = eff.ColGeomFactors.at(detID)*eff.pu_scale[eff.iPU.at(detID)]; chipEfficiency = eff.ChipGeomFactors.at(detID); + for (int i_roc=0;i_roc<16;++i_roc){ + pixelEfficiencyROCStdPixels[i_roc] = eff.PixelGeomFactorsROCStdPixels.at(detID).at(i_roc); + pixelEfficiencyROCBigPixels[i_roc] = eff.PixelGeomFactorsROCBigPixels.at(detID).at(i_roc); + } } #ifdef TP_DEBUG @@ -1560,7 +1601,7 @@ void SiPixelDigitizerAlgorithm::pixel_inefficiency(const PixelEfficiencies& eff, int chipIndex = 0; int rowROC = 0; int colROC = 0; - std::map >chips, columns; + std::map >chips, columns, pixelStd, pixelBig; std::map >::iterator iter; // Find out the number of columns and rocs hits @@ -1579,6 +1620,10 @@ void SiPixelDigitizerAlgorithm::pixel_inefficiency(const PixelEfficiencies& eff, chips[chipIndex]++; columns[dColInDet]++; + if (row == 79 || row == 80 || col % 52 == 0 || col % 52 == 51) + pixelBig[chipIndex]++; + else + pixelStd[chipIndex]++; } // Delete some ROC hits. @@ -1595,6 +1640,17 @@ void SiPixelDigitizerAlgorithm::pixel_inefficiency(const PixelEfficiencies& eff, if( rand > columnEfficiency ) columns[iter->first]=0; } + // Delete some pixel hits based on DCDC issue damage. + for ( iter = pixelStd.begin(); iter != pixelStd.end() ; iter++ ) { + float rand = CLHEP::RandFlat::shoot(engine); + if( rand > pixelEfficiencyROCStdPixels[iter->first]) pixelStd[iter->first] = 0; + } + + for ( iter = pixelBig.begin(); iter != pixelBig.end() ; iter++ ) { + float rand = CLHEP::RandFlat::shoot(engine); + if( rand > pixelEfficiencyROCBigPixels[iter->first]) pixelBig[iter->first] = 0; + } + // Now loop again over pixels to kill some of them. // Loop over hit pixels, amplitude in electrons, channel = coded row,col for(signal_map_iterator i = theSignal.begin();i != theSignal.end(); ++i) { @@ -1612,9 +1668,11 @@ void SiPixelDigitizerAlgorithm::pixel_inefficiency(const PixelEfficiencies& eff, //float rand = RandFlat::shoot(); float rand = CLHEP::RandFlat::shoot(engine); if( chips[chipIndex]==0 || columns[dColInDet]==0 - || rand>pixelEfficiency ) { + || rand>pixelEfficiency + || (pixelStd.count(chipIndex) && pixelStd[chipIndex] == 0) + || (pixelBig.count(chipIndex) && pixelBig[chipIndex] == 0)) { // make pixel amplitude =0, pixel will be lost at clusterization - i->second.set(0.); // reset amplitude, + i->second.set(0.); // reset amplitude, } // end if } // end pixel loop @@ -1737,7 +1795,7 @@ float SiPixelDigitizerAlgorithm::missCalibrate(uint32_t detID, const TrackerTopo //pp1 = y.p1; //pp2 = y.p2; //pp3 = y.p3; - + // // Use random smearing // Randomize the pixel response diff --git a/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizerAlgorithm.h b/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizerAlgorithm.h index 0fef2619b2f5e..99bcae74ae63c 100644 --- a/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizerAlgorithm.h +++ b/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizerAlgorithm.h @@ -247,6 +247,8 @@ class SiPixelDigitizerAlgorithm { // Read factors from DB and fill containers std::map PixelGeomFactors; + std::map > PixelGeomFactorsROCStdPixels; + std::map > PixelGeomFactorsROCBigPixels; std::map ColGeomFactors; std::map ChipGeomFactors; std::map iPU; From f62be64cec0f58e7dd78ea4ec60823e882ff0b30 Mon Sep 17 00:00:00 2001 From: brooks Date: Mon, 5 Mar 2018 22:03:32 +0100 Subject: [PATCH 057/426] improved digi amplitude binning --- Validation/HcalDigis/src/HcalDigisValidation.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Validation/HcalDigis/src/HcalDigisValidation.cc b/Validation/HcalDigis/src/HcalDigisValidation.cc index d681dc972cb6a..a643c9b19abfc 100644 --- a/Validation/HcalDigis/src/HcalDigisValidation.cc +++ b/Validation/HcalDigis/src/HcalDigisValidation.cc @@ -189,7 +189,7 @@ void HcalDigisValidation::booking(DQMStore::IBooker &ib, const std::string bsubd HistLim sime(200, 0., 1.0); HistLim digiAmp(360, -100., 7100.); - HistLim digiAmpWide(360, -10000., 710000.); + HistLim digiAmpWide(2410, -10000., 710000.); //300 fC binning HistLim ratio(2000, -100., 3900.); HistLim sumAmp(100, -500., 1500.); From 59fb81bdfb4819164bc9ec2faa4e2e13324bc6df Mon Sep 17 00:00:00 2001 From: brooks Date: Mon, 5 Mar 2018 22:57:58 +0100 Subject: [PATCH 058/426] fixed digi amplitude improvements --- Validation/HcalDigis/src/HcalDigisValidation.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Validation/HcalDigis/src/HcalDigisValidation.cc b/Validation/HcalDigis/src/HcalDigisValidation.cc index a643c9b19abfc..88b8a1a8e675c 100644 --- a/Validation/HcalDigis/src/HcalDigisValidation.cc +++ b/Validation/HcalDigis/src/HcalDigisValidation.cc @@ -189,7 +189,7 @@ void HcalDigisValidation::booking(DQMStore::IBooker &ib, const std::string bsubd HistLim sime(200, 0., 1.0); HistLim digiAmp(360, -100., 7100.); - HistLim digiAmpWide(2410, -10000., 710000.); //300 fC binning + HistLim digiAmpWide(2410, -3000., 720000.); //300 fC binning HistLim ratio(2000, -100., 3900.); HistLim sumAmp(100, -500., 1500.); From d68802b12dd3fbf842a44c97c9374071a84982cf Mon Sep 17 00:00:00 2001 From: Petar Date: Mon, 5 Mar 2018 17:59:03 -0600 Subject: [PATCH 059/426] Temporary bug fix: load the template files from local directory in CalibTracker never-neverland. Revert when FastSim for Phase1 kicks in. --- RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate.h b/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate.h index f3d538e892c72..0cf3f602603ce 100755 --- a/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate.h +++ b/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate.h @@ -259,10 +259,10 @@ class SiPixelTemplate { // Load the private store with info from the file with the index (int) filenum from directory dir: // ${dir}template_summary_zp${filenum}.out +#ifdef SI_PIXEL_TEMPLATE_STANDALONE static bool pushfile(int filenum, std::vector< SiPixelTemplateStore > & thePixelTemp_ , std::string dir = ""); - - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE +#else + static bool pushfile(int filenum, std::vector< SiPixelTemplateStore > & thePixelTemp_ , std::string dir = "CalibTracker/SiPixelESProducers/data/"); // *&^%$#@! Different default dir -- remove once FastSim is updated. static bool pushfile(const SiPixelTemplateDBObject& dbobject, std::vector< SiPixelTemplateStore > & thePixelTemp_); // load the private store with info from db #endif From b46e1f2e96f6a31056494f51fa0741dc54066be9 Mon Sep 17 00:00:00 2001 From: Heiner Tholen Date: Tue, 6 Mar 2018 15:38:42 +0100 Subject: [PATCH 060/426] Adding ClassDef's --- PhysicsTools/KinFitter/interface/TFitConstraintEp.h | 1 + PhysicsTools/KinFitter/interface/TFitConstraintM.h | 5 ++++- PhysicsTools/KinFitter/interface/TFitConstraintMGaus.h | 2 ++ PhysicsTools/KinFitter/interface/TFitParticleCart.h | 3 ++- PhysicsTools/KinFitter/interface/TFitParticleECart.h | 3 ++- PhysicsTools/KinFitter/interface/TFitParticleEMomDev.h | 3 ++- PhysicsTools/KinFitter/interface/TFitParticleEScaledMomDev.h | 3 +++ PhysicsTools/KinFitter/interface/TFitParticleESpher.h | 3 ++- PhysicsTools/KinFitter/interface/TFitParticleEtEtaPhi.h | 3 ++- PhysicsTools/KinFitter/interface/TFitParticleEtThetaPhi.h | 3 ++- PhysicsTools/KinFitter/interface/TFitParticleMCCart.h | 4 +++- PhysicsTools/KinFitter/interface/TFitParticleMCMomDev.h | 4 +++- PhysicsTools/KinFitter/interface/TFitParticleMCPInvSpher.h | 4 +++- PhysicsTools/KinFitter/interface/TFitParticleMCSpher.h | 4 +++- PhysicsTools/KinFitter/interface/TFitParticleMomDev.h | 3 ++- PhysicsTools/KinFitter/interface/TFitParticleSpher.h | 3 ++- PhysicsTools/KinFitter/interface/TKinFitter.h | 1 + PhysicsTools/KinFitter/interface/TSLToyGen.h | 1 + 18 files changed, 40 insertions(+), 13 deletions(-) diff --git a/PhysicsTools/KinFitter/interface/TFitConstraintEp.h b/PhysicsTools/KinFitter/interface/TFitConstraintEp.h index 8b979de5d1948..4807fc30be07e 100644 --- a/PhysicsTools/KinFitter/interface/TFitConstraintEp.h +++ b/PhysicsTools/KinFitter/interface/TFitConstraintEp.h @@ -56,6 +56,7 @@ protected : Double_t _constraint; // Value of constraint TFitConstraintEp::component _component; // 4vector component to be constrained + ClassDef(TFitConstraintEp, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitConstraintM.h b/PhysicsTools/KinFitter/interface/TFitConstraintM.h index 778f5e98ac865..14deb068e2757 100644 --- a/PhysicsTools/KinFitter/interface/TFitConstraintM.h +++ b/PhysicsTools/KinFitter/interface/TFitConstraintM.h @@ -50,7 +50,10 @@ protected : std::vector _ParList1; // Vector containing first list of constrained particles ( sum[ m_i ] - sum[ m_j ] == 0 ) std::vector _ParList2; // Vector containing second list of constrained particles ( sum[ m_i ] - sum[ m_j ] == 0 ) Double_t _TheMassConstraint; - + +private : + + ClassDef(TFitConstraintM, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitConstraintMGaus.h b/PhysicsTools/KinFitter/interface/TFitConstraintMGaus.h index 34ad0c61f27a2..fb671da05296c 100644 --- a/PhysicsTools/KinFitter/interface/TFitConstraintMGaus.h +++ b/PhysicsTools/KinFitter/interface/TFitConstraintMGaus.h @@ -37,7 +37,9 @@ protected : void init(); +private : + ClassDef(TFitConstraintMGaus, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitParticleCart.h b/PhysicsTools/KinFitter/interface/TFitParticleCart.h index 0bf9af349169b..ec8876a25598c 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleCart.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleCart.h @@ -34,7 +34,8 @@ protected : private: - + + ClassDef(TFitParticleCart, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitParticleECart.h b/PhysicsTools/KinFitter/interface/TFitParticleECart.h index b5828a7407983..1c6d29a849132 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleECart.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleECart.h @@ -34,7 +34,8 @@ protected : private: - + + ClassDef(TFitParticleECart, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitParticleEMomDev.h b/PhysicsTools/KinFitter/interface/TFitParticleEMomDev.h index 4a43902a93d03..f81c4f59b258e 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleEMomDev.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleEMomDev.h @@ -36,7 +36,8 @@ protected : private: - + + ClassDef(TFitParticleEMomDev, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitParticleEScaledMomDev.h b/PhysicsTools/KinFitter/interface/TFitParticleEScaledMomDev.h index dcea16e8deb46..f9bf19d69be25 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleEScaledMomDev.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleEScaledMomDev.h @@ -30,6 +30,9 @@ protected : void init(TLorentzVector* pini, const TMatrixD* theCovMatrix); +private : + + ClassDef(TFitParticleEScaledMomDev, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitParticleESpher.h b/PhysicsTools/KinFitter/interface/TFitParticleESpher.h index f3698f9b664d7..e4ebfc814aee3 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleESpher.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleESpher.h @@ -34,7 +34,8 @@ protected : private: - + + ClassDef(TFitParticleESpher, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitParticleEtEtaPhi.h b/PhysicsTools/KinFitter/interface/TFitParticleEtEtaPhi.h index a9d0c14f90b46..1f5f6127749f2 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleEtEtaPhi.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleEtEtaPhi.h @@ -34,7 +34,8 @@ protected : private: - + + ClassDef(TFitParticleEtEtaPhi, 0) }; diff --git a/PhysicsTools/KinFitter/interface/TFitParticleEtThetaPhi.h b/PhysicsTools/KinFitter/interface/TFitParticleEtThetaPhi.h index 5916d985c81ac..aedb5713de333 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleEtThetaPhi.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleEtThetaPhi.h @@ -34,7 +34,8 @@ protected : private: - + + ClassDef(TFitParticleEtThetaPhi, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitParticleMCCart.h b/PhysicsTools/KinFitter/interface/TFitParticleMCCart.h index 1a82db060d51a..dcba36e7def52 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleMCCart.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleMCCart.h @@ -31,8 +31,10 @@ protected : void init(TVector3* p, Double_t M, const TMatrixD* theCovMatrix); - + private: + + ClassDef(TFitParticleMCCart, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitParticleMCMomDev.h b/PhysicsTools/KinFitter/interface/TFitParticleMCMomDev.h index 30c5a6682b1e3..5331849e3b9d1 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleMCMomDev.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleMCMomDev.h @@ -32,8 +32,10 @@ protected : void init(TVector3* p, Double_t M, const TMatrixD* theCovMatrix); - + private: + + ClassDef(TFitParticleMCMomDev, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitParticleMCPInvSpher.h b/PhysicsTools/KinFitter/interface/TFitParticleMCPInvSpher.h index d7bba8bfd8586..c28832f79789a 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleMCPInvSpher.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleMCPInvSpher.h @@ -31,8 +31,10 @@ protected : void init(TVector3* p, Double_t M, const TMatrixD* theCovMatrix); - + private: + + ClassDef(TFitParticleMCPInvSpher, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitParticleMCSpher.h b/PhysicsTools/KinFitter/interface/TFitParticleMCSpher.h index 76edadaf2a99a..52be1e2e823a7 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleMCSpher.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleMCSpher.h @@ -31,8 +31,10 @@ protected : void init(TVector3* p, Double_t M, const TMatrixD* theCovMatrix); - + private: + + ClassDef(TFitParticleMCSpher, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitParticleMomDev.h b/PhysicsTools/KinFitter/interface/TFitParticleMomDev.h index ef43442a64e9d..09e04a86fe3db 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleMomDev.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleMomDev.h @@ -36,7 +36,8 @@ protected : private: - + + ClassDef(TFitParticleMomDev, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitParticleSpher.h b/PhysicsTools/KinFitter/interface/TFitParticleSpher.h index 2f9b2110ba22e..b6ccf1f5f06fd 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleSpher.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleSpher.h @@ -34,7 +34,8 @@ protected : private: - + + ClassDef(TFitParticleSpher, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TKinFitter.h b/PhysicsTools/KinFitter/interface/TKinFitter.h index 7d12c74df9f13..fc13925ea32e6 100644 --- a/PhysicsTools/KinFitter/interface/TKinFitter.h +++ b/PhysicsTools/KinFitter/interface/TKinFitter.h @@ -148,6 +148,7 @@ private : Int_t _status; // Status of the last fit;_ Int_t _nbIter; // number of iteration performed in the fit + ClassDef(TKinFitter, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TSLToyGen.h b/PhysicsTools/KinFitter/interface/TSLToyGen.h index f1dbbc582946a..8b2f290ca2d07 100644 --- a/PhysicsTools/KinFitter/interface/TSLToyGen.h +++ b/PhysicsTools/KinFitter/interface/TSLToyGen.h @@ -92,6 +92,7 @@ private : Bool_t _withMPDGCons; Bool_t _doCheckConstraintsTruth; + ClassDef(TSLToyGen, 0) }; #endif From 698709eaeb2726a9b401ef09367d7917959b6316 Mon Sep 17 00:00:00 2001 From: Heiner Tholen Date: Tue, 6 Mar 2018 15:41:15 +0100 Subject: [PATCH 061/426] adding classes.h and classes_def.xml --- PhysicsTools/KinFitter/src/classes.h | 47 ++++++++++++++++++++++ PhysicsTools/KinFitter/src/classes_def.xml | 20 +++++++++ 2 files changed, 67 insertions(+) create mode 100644 PhysicsTools/KinFitter/src/classes.h create mode 100644 PhysicsTools/KinFitter/src/classes_def.xml diff --git a/PhysicsTools/KinFitter/src/classes.h b/PhysicsTools/KinFitter/src/classes.h new file mode 100644 index 0000000000000..6a7477b2d3a03 --- /dev/null +++ b/PhysicsTools/KinFitter/src/classes.h @@ -0,0 +1,47 @@ +#include "PhysicsTools/KinFitter/interface/TAbsFitConstraint.h" +#include "PhysicsTools/KinFitter/interface/TAbsFitParticle.h" +#include "PhysicsTools/KinFitter/interface/TFitConstraintEp.h" +#include "PhysicsTools/KinFitter/interface/TFitConstraintM.h" +#include "PhysicsTools/KinFitter/interface/TFitConstraintMGaus.h" +#include "PhysicsTools/KinFitter/interface/TFitParticleCart.h" +#include "PhysicsTools/KinFitter/interface/TFitParticleECart.h" +#include "PhysicsTools/KinFitter/interface/TFitParticleEMomDev.h" +#include "PhysicsTools/KinFitter/interface/TFitParticleEScaledMomDev.h" +#include "PhysicsTools/KinFitter/interface/TFitParticleESpher.h" +#include "PhysicsTools/KinFitter/interface/TFitParticleEtEtaPhi.h" +#include "PhysicsTools/KinFitter/interface/TFitParticleEtThetaPhi.h" +#include "PhysicsTools/KinFitter/interface/TFitParticleMCCart.h" +#include "PhysicsTools/KinFitter/interface/TFitParticleMCMomDev.h" +#include "PhysicsTools/KinFitter/interface/TFitParticleMCPInvSpher.h" +#include "PhysicsTools/KinFitter/interface/TFitParticleMCSpher.h" +#include "PhysicsTools/KinFitter/interface/TFitParticleMomDev.h" +#include "PhysicsTools/KinFitter/interface/TFitParticleSpher.h" +#include "PhysicsTools/KinFitter/interface/TKinFitter.h" +#include "PhysicsTools/KinFitter/interface/TSLToyGen.h" + + +namespace PhysicsTools_KinFitter { + struct dictionary { + +// TFitConstraintEp fce; +// TFitConstraintEp::component fce_c; +// TFitConstraintM fcm; +// TFitConstraintMGaus fcmg; +// TFitParticleCart fpc; +// TFitParticleECart fpec; +// TFitParticleEMomDev fpemd; +// TFitParticleEScaledMomDev fpesmd; +// TFitParticleESpher fpes; +// TFitParticleEtEtaPhi fpeep; +// TFitParticleEtThetaPhi fpetp; +// TFitParticleMCCart fpmcc; +// TFitParticleMCMomDev fmmccd; +// TFitParticleMCPInvSpher fpmcpis; +// TFitParticleMCSpher fpmcs; +// TFitParticleMomDev fpmd; +// TFitParticleSpher fps; +// TKinFitter kf; +// TSLToyGen sltg; + + }; +} \ No newline at end of file diff --git a/PhysicsTools/KinFitter/src/classes_def.xml b/PhysicsTools/KinFitter/src/classes_def.xml new file mode 100644 index 0000000000000..7ef2f3cb674fc --- /dev/null +++ b/PhysicsTools/KinFitter/src/classes_def.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + From 1e36b5e6d6864f0ca4c53b78afead4a26f9e825b Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Tue, 6 Mar 2018 21:42:07 +0100 Subject: [PATCH 062/426] TopQuarkAnalysis packages: clean up clang warnings: TopQuarkAnalysis/TopPairBSM/src/BoostedTopProducer.h:89:20: warning: 'BoostedTopProducer::beginJob' hides overloaded virtual function [-Woverloaded-virtual] virtual void beginJob(const edm::EventSetup&) ; ^ --- TopQuarkAnalysis/TopPairBSM/src/BoostedTopProducer.cc | 11 ----------- TopQuarkAnalysis/TopPairBSM/src/BoostedTopProducer.h | 2 -- 2 files changed, 13 deletions(-) diff --git a/TopQuarkAnalysis/TopPairBSM/src/BoostedTopProducer.cc b/TopQuarkAnalysis/TopPairBSM/src/BoostedTopProducer.cc index 957c9ca1c98fe..fd3688b0535f8 100644 --- a/TopQuarkAnalysis/TopPairBSM/src/BoostedTopProducer.cc +++ b/TopQuarkAnalysis/TopPairBSM/src/BoostedTopProducer.cc @@ -370,17 +370,6 @@ BoostedTopProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) } -// ------------ method called once each job just before starting event loop ------------ -void -BoostedTopProducer::beginJob(const edm::EventSetup&) -{ -} - -// ------------ method called once each job just after ending the event loop ------------ -void -BoostedTopProducer::endJob() { -} - double BoostedTopProducer::Psi(const TLorentzVector& p1, const TLorentzVector& p2, double mass) { diff --git a/TopQuarkAnalysis/TopPairBSM/src/BoostedTopProducer.h b/TopQuarkAnalysis/TopPairBSM/src/BoostedTopProducer.h index 6333f0f98a2e9..c1b18b0c4aa5f 100644 --- a/TopQuarkAnalysis/TopPairBSM/src/BoostedTopProducer.h +++ b/TopQuarkAnalysis/TopPairBSM/src/BoostedTopProducer.h @@ -86,9 +86,7 @@ class BoostedTopProducer : public edm::EDProducer { ~BoostedTopProducer() override; private: - virtual void beginJob(const edm::EventSetup&) ; void produce(edm::Event&, const edm::EventSetup&) override; - void endJob() override ; // ----------member data --------------------------- From 3f9269df206298f55cd4c9ceadf707c3810e98e0 Mon Sep 17 00:00:00 2001 From: Tatjana Date: Wed, 7 Mar 2018 02:33:11 +0100 Subject: [PATCH 063/426] added check for Phase1, fixed magic numbers --- .../plugins/SiPixelDigitizerAlgorithm.cc | 107 +++++++++++------- .../plugins/SiPixelDigitizerAlgorithm.h | 5 +- 2 files changed, 70 insertions(+), 42 deletions(-) diff --git a/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizerAlgorithm.cc b/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizerAlgorithm.cc index 132188dac15ad..af6c0a19d5991 100644 --- a/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizerAlgorithm.cc +++ b/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizerAlgorithm.cc @@ -516,30 +516,42 @@ void SiPixelDigitizerAlgorithm::PixelEfficiencies::init_from_db(const edm::ESHan PixelGeomFactorsROCBigPixels[rawid] = std::vector(16,1); } - // Store ROC level scale factors (big and standard pixels separatelly) + // ROC level inefficiency for phase 1 (disentangle scale factors for big and std size pixels) std::map PixelGeomFactorsDB; - for (auto db_factor : PixelGeomFactorsDBIn){ - int shift = DetId(db_factor.first).subdetId() == 1? 6 : 3; - unsigned int rocMask = 0x1F << shift; - unsigned int rocId = (((db_factor.first) & rocMask) >> shift); - if (rocId != 0) { - rocId--; - unsigned int rawid = db_factor.first & (~rocMask); - double factor = db_factor.second; - double badFraction = 1 - factor; - double bigPixelFraction = 210./4160.; - double stdPixelFraction = 3950./4160.; - - double badFractionBig = std::min(bigPixelFraction, badFraction); - double badFractionStd = std::max(0., badFraction - badFractionBig); - double badFractionBigReNormalized = badFractionBig/bigPixelFraction; - double badFractionStdReNormalized = badFractionStd/stdPixelFraction; - PixelGeomFactorsROCStdPixels[rawid][rocId] *= (1. - badFractionStdReNormalized); - PixelGeomFactorsROCBigPixels[rawid][rocId] *= (1. - badFractionBigReNormalized); - } - else{ - PixelGeomFactorsDB[db_factor.first] = db_factor.second; - } + + if (geom->isThere(GeomDetEnumerators::P1PXB) + || geom->isThere(GeomDetEnumerators::P1PXEC)){ + for (auto db_factor : PixelGeomFactorsDBIn){ + int shift = DetId(db_factor.first).subdetId() == + static_cast(PixelSubdetector::PixelBarrel) ? BPixRocIdShift:FPixRocIdShift; + unsigned int rocMask = rocIdMaskBits << shift; + unsigned int rocId = (((db_factor.first) & rocMask) >> shift); + if (rocId != 0) { + rocId--; + unsigned int rawid = db_factor.first & (~rocMask); + const PixelGeomDetUnit * theGeomDet = dynamic_cast (geom->idToDet(rawid)); + PixelTopology const * topology = &(theGeomDet->specificTopology()); + const int nPixelsInROC = topology->rowsperroc()*topology->colsperroc(); + const int nBigPixelsInROC = 2*topology->rowsperroc()+topology->colsperroc()-2; + double factor = db_factor.second; + double badFraction = 1 - factor; + double bigPixelFraction = static_cast (nBigPixelsInROC)/nPixelsInROC; + double stdPixelFraction = 1. - bigPixelFraction; + + double badFractionBig = std::min(bigPixelFraction, badFraction); + double badFractionStd = std::max(0., badFraction - badFractionBig); + double badFractionBigReNormalized = badFractionBig/bigPixelFraction; + double badFractionStdReNormalized = badFractionStd/stdPixelFraction; + PixelGeomFactorsROCStdPixels[rawid][rocId] *= (1. - badFractionStdReNormalized); + PixelGeomFactorsROCBigPixels[rawid][rocId] *= (1. - badFractionBigReNormalized); + } + else{ + PixelGeomFactorsDB[db_factor.first] = db_factor.second; + } + } + } // is Phase 1 geometry + else{ + PixelGeomFactorsDB = PixelGeomFactorsDBIn; } // Loop on all modules, store module level geometrical scale factors @@ -1517,7 +1529,8 @@ void SiPixelDigitizerAlgorithm::pixel_inefficiency(const PixelEfficiencies& eff, const PixelTopology* topol=&pixdet->specificTopology(); int numColumns = topol->ncolumns(); // det module number of cols&rows int numRows = topol->nrows(); - + bool isPhase1 = pixdet->subDetector()==GeomDetEnumerators::SubDetector::P1PXB + || pixdet->subDetector()==GeomDetEnumerators::SubDetector::P1PXEC; // Predefined efficiencies double pixelEfficiency = 1.0; double columnEfficiency = 1.0; @@ -1583,10 +1596,12 @@ void SiPixelDigitizerAlgorithm::pixel_inefficiency(const PixelEfficiencies& eff, pixelEfficiency = eff.PixelGeomFactors.at(detID); columnEfficiency = eff.ColGeomFactors.at(detID)*eff.pu_scale[eff.iPU.at(detID)]; chipEfficiency = eff.ChipGeomFactors.at(detID); - for (int i_roc=0;i_roc<16;++i_roc){ - pixelEfficiencyROCStdPixels[i_roc] = eff.PixelGeomFactorsROCStdPixels.at(detID).at(i_roc); - pixelEfficiencyROCBigPixels[i_roc] = eff.PixelGeomFactorsROCBigPixels.at(detID).at(i_roc); - } + if (isPhase1){ + for (unsigned int i_roc=0; i_rocisItBigPixelInX(row) || topol->isItBigPixelInY(col)) + pixelBig[chipIndex]++; + else + pixelStd[chipIndex]++; + } } // Delete some ROC hits. @@ -1641,16 +1658,18 @@ void SiPixelDigitizerAlgorithm::pixel_inefficiency(const PixelEfficiencies& eff, } // Delete some pixel hits based on DCDC issue damage. - for ( iter = pixelStd.begin(); iter != pixelStd.end() ; iter++ ) { - float rand = CLHEP::RandFlat::shoot(engine); - if( rand > pixelEfficiencyROCStdPixels[iter->first]) pixelStd[iter->first] = 0; + if (isPhase1){ + for ( iter = pixelStd.begin(); iter != pixelStd.end() ; iter++ ) { + float rand = CLHEP::RandFlat::shoot(engine); + if( rand > pixelEfficiencyROCStdPixels[iter->first]) pixelStd[iter->first] = 0; + } + + for ( iter = pixelBig.begin(); iter != pixelBig.end() ; iter++ ) { + float rand = CLHEP::RandFlat::shoot(engine); + if( rand > pixelEfficiencyROCBigPixels[iter->first]) pixelBig[iter->first] = 0; + } } - for ( iter = pixelBig.begin(); iter != pixelBig.end() ; iter++ ) { - float rand = CLHEP::RandFlat::shoot(engine); - if( rand > pixelEfficiencyROCBigPixels[iter->first]) pixelBig[iter->first] = 0; - } - // Now loop again over pixels to kill some of them. // Loop over hit pixels, amplitude in electrons, channel = coded row,col for(signal_map_iterator i = theSignal.begin();i != theSignal.end(); ++i) { @@ -1674,7 +1693,13 @@ void SiPixelDigitizerAlgorithm::pixel_inefficiency(const PixelEfficiencies& eff, // make pixel amplitude =0, pixel will be lost at clusterization i->second.set(0.); // reset amplitude, } // end if - + if (isPhase1){ + if((pixelStd.count(chipIndex) && pixelStd[chipIndex] == 0) + || (pixelBig.count(chipIndex) && pixelBig[chipIndex] == 0)) { + // make pixel amplitude =0, pixel will be lost at clusterization + i->second.set(0.); // reset amplitude, + } // end if + } // is Phase 1 } // end pixel loop } // end pixel_indefficiency diff --git a/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizerAlgorithm.h b/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizerAlgorithm.h index 99bcae74ae63c..b226a13e103d2 100644 --- a/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizerAlgorithm.h +++ b/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizerAlgorithm.h @@ -252,7 +252,10 @@ class SiPixelDigitizerAlgorithm { std::map ColGeomFactors; std::map ChipGeomFactors; std::map iPU; - + + // constants for ROC level simulation for Phase1 + enum shiftEnumerator {FPixRocIdShift = 3, BPixRocIdShift = 6}; + static const int rocIdMaskBits = 0x1F; void init_from_db(const edm::ESHandle&, const edm::ESHandle&); bool matches(const DetId&, const DetId&, const std::vector&); }; From 7c6acb31fc848ae9c92abca92a19f34abd00b350 Mon Sep 17 00:00:00 2001 From: Hans Van Haevermaet Date: Thu, 8 Mar 2018 10:40:17 +0100 Subject: [PATCH 064/426] CASTOR noise fix in digitisation --- .../CastorSim/src/CastorAmplifier.cc | 6 ++-- .../CastorSim/src/CastorSimParameters.cc | 32 ++++--------------- .../CastorSim/src/CastorSimParameters.h | 18 ++--------- .../python/castorDigitizer_cfi.py | 2 +- 4 files changed, 13 insertions(+), 45 deletions(-) diff --git a/SimCalorimetry/CastorSim/src/CastorAmplifier.cc b/SimCalorimetry/CastorSim/src/CastorAmplifier.cc index 88c30e51fb640..ea3717932b5af 100644 --- a/SimCalorimetry/CastorSim/src/CastorAmplifier.cc +++ b/SimCalorimetry/CastorSim/src/CastorAmplifier.cc @@ -37,6 +37,7 @@ void CastorAmplifier::amplify(CaloSamples & frame, CLHEP::HepRandomEngine* engin double gauss [32]; //big enough double noise [32]; //big enough double fCperPE = parameters.photoelectronsToAnalog(frame.id()); + double nominalfCperPE = parameters.getNominalfCperPE(); for (int i = 0; i < frame.size(); i++) { gauss[i] = CLHEP::RandGaussQ::shoot(engine, 0., 1.); } if(addNoise_) { @@ -44,9 +45,9 @@ void CastorAmplifier::amplify(CaloSamples & frame, CLHEP::HepRandomEngine* engin } for(int tbin = 0; tbin < frame.size(); ++tbin) { int capId = (theStartingCapId + tbin)%4; - double pedestal = peds->getValue (capId); + double pedestal = peds->getValue(capId); if(addNoise_) { - pedestal += noise [tbin]; + pedestal += noise [tbin]*(fCperPE/nominalfCperPE); } frame[tbin] *= fCperPE; frame[tbin] += pedestal; @@ -54,4 +55,3 @@ void CastorAmplifier::amplify(CaloSamples & frame, CLHEP::HepRandomEngine* engin } LogDebug("CastorAmplifier") << frame; } - diff --git a/SimCalorimetry/CastorSim/src/CastorSimParameters.cc b/SimCalorimetry/CastorSim/src/CastorSimParameters.cc index c14c9c96eef93..fe37f19607e09 100644 --- a/SimCalorimetry/CastorSim/src/CastorSimParameters.cc +++ b/SimCalorimetry/CastorSim/src/CastorSimParameters.cc @@ -11,7 +11,8 @@ CastorSimParameters::CastorSimParameters(double simHitToPhotoelectrons, double photoelectronsToAnalog,double samplingFactor, double timePhase, bool syncPhase) : CaloSimParameters(simHitToPhotoelectrons, photoelectronsToAnalog, samplingFactor, timePhase, 6, 4, false, syncPhase), theDbService(nullptr), - theSamplingFactor( samplingFactor ) + theSamplingFactor( samplingFactor ), + nominalfCperPE( 1) { } @@ -19,29 +20,20 @@ CastorSimParameters::CastorSimParameters(double simHitToPhotoelectrons, double p CastorSimParameters::CastorSimParameters(const edm::ParameterSet & p) : CaloSimParameters(p), theDbService(nullptr), - theSamplingFactor( p.getParameter("samplingFactor") ) + theSamplingFactor( p.getParameter("samplingFactor") ), + nominalfCperPE( p.getParameter("photoelectronsToAnalog") ) { } -/* -double CastorSimParameters::simHitToPhotoelectrons(const DetId & detId) const +double CastorSimParameters::getNominalfCperPE() const { - // the gain is in units of GeV/fC. We want a constant with pe/dGeV - // pe/dGeV = (GeV/dGeV) / (GeV/fC) / (fC/pe) - double result = CaloSimParameters::simHitToPhotoelectrons(detId); - if(HcalGenericDetId(detId).genericSubdet() != HcalGenericDetId::HcalGenForward - || HcalGenericDetId(detId).genericSubdet() != HcalGenericDetId::HcalGenCastor) - { - result = samplingFactor(detId) / fCtoGeV(detId) / photoelectronsToAnalog(); - } - return result; + // return the nominal PMT gain value of CASTOR from the config file. + return nominalfCperPE; } -*/ double CastorSimParameters::photoelectronsToAnalog(const DetId & detId) const { // calculate factor (PMT gain) using sampling factor value & available electron gain - //std::cout << " sampling factor = " << theSamplingFactor << " fCtoGeV = " << fCtoGeV(detId) << " and photoelectronsToAnalog = " << theSamplingFactor/fCtoGeV(detId) << std::endl; return theSamplingFactor/fCtoGeV(detId); } @@ -62,16 +54,6 @@ double CastorSimParameters::fCtoGeV(const DetId & detId) const { // only one gain will be recorded per channel, so just use capID 0 for now result = gains->getValue(0); - // if(doNoise_) - /// { - // result += CLHEP::RandGaussQ::shoot(0., gwidths->getValue(0)); - // } } return result; } -/* -double CastorSimParameters::samplingFactor(const DetId & detId) const { -HcalDetId hcalDetId(detId); -return theSamplingFactors[hcalDetId.ietaAbs()-theFirstRing]; -} -*/ diff --git a/SimCalorimetry/CastorSim/src/CastorSimParameters.h b/SimCalorimetry/CastorSim/src/CastorSimParameters.h index da138e3c5d862..e668ea0b5f6ba 100644 --- a/SimCalorimetry/CastorSim/src/CastorSimParameters.h +++ b/SimCalorimetry/CastorSim/src/CastorSimParameters.h @@ -12,35 +12,21 @@ class CastorSimParameters : public CaloSimParameters CastorSimParameters(double simHitToPhotoelectrons, double photoelectronsToAnalog, double samplingFactor, double timePhase, bool syncPhase); CastorSimParameters(const edm::ParameterSet & p); - /* - CastorSimParameters(double simHitToPhotoelectrons, double photoelectronsToAnalog, - double samplingFactor, double timePhase, - int readoutFrameSize, int binOfMaximum, - bool doPhotostatistics, bool syncPhase, - int firstRing, const std::vector & samplingFactors); - CastorSimParameters(const edm::ParameterSet & p); - */ - ~CastorSimParameters() override {} void setDbService(const CastorDbService * service) {theDbService = service;} -//virtual double simHitToPhotoelectrons(const DetId & detId) const; +double getNominalfCperPE() const; double photoelectronsToAnalog(const DetId & detId) const override; double fCtoGeV(const DetId & detId) const; - /// the ratio of actual incident energy to deposited energy - /// in the SimHit -// virtual double samplingFactor(const DetId & detId) const; - private: const CastorDbService * theDbService; double theSamplingFactor; -//std::vector theSamplingFactors; +double nominalfCperPE; }; #endif - diff --git a/SimGeneral/MixingModule/python/castorDigitizer_cfi.py b/SimGeneral/MixingModule/python/castorDigitizer_cfi.py index 0a3fc0ddedeb4..06ef707c0380a 100644 --- a/SimGeneral/MixingModule/python/castorDigitizer_cfi.py +++ b/SimGeneral/MixingModule/python/castorDigitizer_cfi.py @@ -12,7 +12,7 @@ samplingFactor = cms.double(0.062577), ## GeV/pe doPhotoStatistics = cms.bool(True), - photoelectronsToAnalog = cms.double(4.009), + photoelectronsToAnalog = cms.double(4.1718), simHitToPhotoelectrons = cms.double(1000.0), syncPhase = cms.bool(True), timePhase = cms.double(-4.0) From 68ca198c0586b3f9878b7bd0f0b8912a55dfce14 Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Fri, 9 Mar 2018 15:04:38 +0100 Subject: [PATCH 065/426] new RPix mapping for 2018 --- .../xml/rpix_mapping_2018.xml | 196 ++++++++++++++++++ 1 file changed, 196 insertions(+) create mode 100644 CondFormats/CTPPSReadoutObjects/xml/rpix_mapping_2018.xml diff --git a/CondFormats/CTPPSReadoutObjects/xml/rpix_mapping_2018.xml b/CondFormats/CTPPSReadoutObjects/xml/rpix_mapping_2018.xml new file mode 100644 index 0000000000000..87129483f93e7 --- /dev/null +++ b/CondFormats/CTPPSReadoutObjects/xml/rpix_mapping_2018.xml @@ -0,0 +1,196 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From d918925b33c34500f38f74a5986eef5e830f942a Mon Sep 17 00:00:00 2001 From: Felice Date: Fri, 9 Mar 2018 15:05:54 +0100 Subject: [PATCH 066/426] preparing for parallelization --- .../interface/HGCalImagingAlgo.h | 2 +- .../HGCalRecAlgos/src/HGCalImagingAlgo.cc | 46 +++++++++++-------- 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/RecoLocalCalo/HGCalRecAlgos/interface/HGCalImagingAlgo.h b/RecoLocalCalo/HGCalRecAlgos/interface/HGCalImagingAlgo.h index 45368bb28af8d..2f846aa97abcc 100644 --- a/RecoLocalCalo/HGCalRecAlgos/interface/HGCalImagingAlgo.h +++ b/RecoLocalCalo/HGCalRecAlgos/interface/HGCalImagingAlgo.h @@ -291,7 +291,7 @@ inline double distance(const Hexel &pt1, const Hexel &pt2) { //2-d distance on } double calculateLocalDensity(std::vector &, KDTree &, const unsigned int); //return max density double calculateDistanceToHigher(std::vector &); -int findAndAssignClusters(std::vector &, KDTree &, double, KDTreeBox &, const unsigned int); +int findAndAssignClusters(std::vector &, KDTree &, double, KDTreeBox &, const unsigned int, std::vector >&); math::XYZPoint calculatePosition(std::vector &); // attempt to find subclusters within a given set of hexels diff --git a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc index 3c1cf8e4ade54..cb76d05deda09 100644 --- a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc +++ b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc @@ -68,25 +68,37 @@ void HGCalImagingAlgo::populate(const HGCRecHitCollection& hits){ // with different input (reset should be called between events) void HGCalImagingAlgo::makeClusters() { - - // used for speedy search - std::vector hit_kdtree(2*(maxlayer+1)); - + std::vector > > layerClustersPerLayer(2*(maxlayer+1)); + // tbb::tick_count t0 = tbb::tick_count::now(); //assign all hits in each layer to a cluster core or halo - for (unsigned int i = 0; i <= 2*maxlayer+1; ++i) { + // tbb::parallel_for(size_t(0), size_t(2*maxlayer+1), [&](size_t i) { + for (unsigned int i = 0; i <= 2*maxlayer+1; ++i) { KDTreeBox bounds(minpos[i][0],maxpos[i][0], minpos[i][1],maxpos[i][1]); - - hit_kdtree[i].build(points[i],bounds); + KDTree hit_kdtree; + hit_kdtree.build(points[i], bounds); unsigned int actualLayer = i > maxlayer ? (i-(maxlayer+1)) : i; // maps back from index used for KD trees to actual layer - double maxdensity = calculateLocalDensity(points[i],hit_kdtree[i], actualLayer); // also stores rho (energy density) for each point (node) + double maxdensity = calculateLocalDensity(points[i],hit_kdtree, actualLayer); // also stores rho (energy density) for each point (node) // calculate distance to nearest point with higher density storing distance (delta) and point's index calculateDistanceToHigher(points[i]); - findAndAssignClusters(points[i],hit_kdtree[i],maxdensity,bounds,actualLayer); - } + std::cout << i << std::endl; + findAndAssignClusters(points[i],hit_kdtree,maxdensity,bounds,actualLayer, layerClustersPerLayer[i]); +} +// }); //make the cluster vector + + for(auto& layer: layerClustersPerLayer) + { + for(auto& cluster: layer) + { + current_v.push_back(cluster); + } + } + + // tbb::tick_count t1 = tbb::tick_count::now(); + // printf("work took %g seconds, found clusters %lu \n",(t1-t0).seconds(), current_v.size()); } std::vector HGCalImagingAlgo::getClusters(bool doSharing){ @@ -282,8 +294,7 @@ double HGCalImagingAlgo::calculateDistanceToHigher(std::vector &nd){ } return maxdensity; } - -int HGCalImagingAlgo::findAndAssignClusters(std::vector &nd,KDTree &lp, double maxdensity, KDTreeBox &bounds, const unsigned int layer){ +int HGCalImagingAlgo::findAndAssignClusters(std::vector &nd, KDTree &lp, double maxdensity, KDTreeBox &bounds, const unsigned int layer, std::vector >& clustersOnLayer) { //this is called once per layer and endcap... //so when filling the cluster temporary vector of Hexels we resize each time by the number @@ -315,7 +326,7 @@ int HGCalImagingAlgo::findAndAssignClusters(std::vector &nd,KDTree &lp, nd[ds[i]].data.clusterIndex = clusterIndex; if (verbosity < pINFO) { - std::cout << "Adding new cluster with index " << clusterIndex+cluster_offset << std::endl; + std::cout << "Adding new cluster with index " << clusterIndex << std::endl; std::cout << "Cluster center is hit " << ds[i] << std::endl; } clusterIndex++; @@ -341,7 +352,7 @@ int HGCalImagingAlgo::findAndAssignClusters(std::vector &nd,KDTree &lp, { std::cout << "resizing cluster vector by "<< clusterIndex << std::endl; } - current_v.resize(cluster_offset+clusterIndex); + clustersOnLayer.resize(clusterIndex); //assign points closer than dc to other clusters to border region //and find critical border density @@ -389,11 +400,10 @@ int HGCalImagingAlgo::findAndAssignClusters(std::vector &nd,KDTree &lp, int ci = nd[i].data.clusterIndex; if(ci!=-1) { if (nd[i].data.rho <= rho_b[ci]) nd[i].data.isHalo = true; - current_v[ci+cluster_offset].push_back(nd[i]); + clustersOnLayer[ci].push_back(nd[i]); if (verbosity < pINFO) { - std::cout << "Pushing hit " << i << " into cluster with index " << ci+cluster_offset << std::endl; - std::cout << "Size now " << current_v[ci+cluster_offset].size() << std::endl; + std::cout << "Pushing hit " << i << " into cluster with index " << ci << std::endl; } } } @@ -403,10 +413,10 @@ int HGCalImagingAlgo::findAndAssignClusters(std::vector &nd,KDTree &lp, { std::cout << "moving cluster offset by " << clusterIndex << std::endl; } - cluster_offset += clusterIndex; return clusterIndex; } + // find local maxima within delta_c, marking the indices in the cluster std::vector HGCalImagingAlgo::findLocalMaximaInCluster(const std::vector& cluster) { std::vector result; From 91572be57469d68f5ec5d691aea3f622bb39fc41 Mon Sep 17 00:00:00 2001 From: Felice Date: Fri, 9 Mar 2018 15:15:56 +0100 Subject: [PATCH 067/426] parallelization! --- RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc index cb76d05deda09..51247fb8c5d59 100644 --- a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc +++ b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc @@ -9,7 +9,7 @@ #include "RecoEcal/EgammaCoreTools/interface/PositionCalc.h" // #include "DataFormats/CaloRecHit/interface/CaloID.h" - +#include "tbb/tbb.h" void HGCalImagingAlgo::populate(const HGCRecHitCollection& hits){ //loop over all hits and create the Hexel structure, skip energies below ecut @@ -71,8 +71,8 @@ void HGCalImagingAlgo::makeClusters() std::vector > > layerClustersPerLayer(2*(maxlayer+1)); // tbb::tick_count t0 = tbb::tick_count::now(); //assign all hits in each layer to a cluster core or halo - // tbb::parallel_for(size_t(0), size_t(2*maxlayer+1), [&](size_t i) { - for (unsigned int i = 0; i <= 2*maxlayer+1; ++i) { + tbb::parallel_for(size_t(0), size_t(2*maxlayer+2), [&](size_t i) { + // for (unsigned int i = 0; i <= 2*maxlayer+1; ++i) { KDTreeBox bounds(minpos[i][0],maxpos[i][0], minpos[i][1],maxpos[i][1]); KDTree hit_kdtree; @@ -85,8 +85,8 @@ void HGCalImagingAlgo::makeClusters() calculateDistanceToHigher(points[i]); std::cout << i << std::endl; findAndAssignClusters(points[i],hit_kdtree,maxdensity,bounds,actualLayer, layerClustersPerLayer[i]); -} -// }); +// } +}); //make the cluster vector for(auto& layer: layerClustersPerLayer) From 7357b0fc51c03e7c7e81418824ef3343a398d96b Mon Sep 17 00:00:00 2001 From: Felice Pantaleo Date: Fri, 9 Mar 2018 18:08:51 +0100 Subject: [PATCH 068/426] using the edm::SerialTaskQueue for concurrent push of clusters in the final vector --- .../HGCalRecAlgos/src/HGCalImagingAlgo.cc | 34 ++++++++++++------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc index 51247fb8c5d59..959274bc1b6c7 100644 --- a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc +++ b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc @@ -9,6 +9,8 @@ #include "RecoEcal/EgammaCoreTools/interface/PositionCalc.h" // #include "DataFormats/CaloRecHit/interface/CaloID.h" +#include "FWCore/Concurrency/interface/SerialTaskQueue.h" + #include "tbb/tbb.h" void HGCalImagingAlgo::populate(const HGCRecHitCollection& hits){ //loop over all hits and create the Hexel structure, skip energies below ecut @@ -68,8 +70,10 @@ void HGCalImagingAlgo::populate(const HGCRecHitCollection& hits){ // with different input (reset should be called between events) void HGCalImagingAlgo::makeClusters() { - std::vector > > layerClustersPerLayer(2*(maxlayer+1)); - // tbb::tick_count t0 = tbb::tick_count::now(); + std::vector > > layerClustersPerLayer(2*(maxlayer+2)); + edm::SerialTaskQueue layersQueue; + tbb::tick_count t0 = tbb::tick_count::now(); + //assign all hits in each layer to a cluster core or halo tbb::parallel_for(size_t(0), size_t(2*maxlayer+2), [&](size_t i) { // for (unsigned int i = 0; i <= 2*maxlayer+1; ++i) { @@ -83,22 +87,28 @@ void HGCalImagingAlgo::makeClusters() double maxdensity = calculateLocalDensity(points[i],hit_kdtree, actualLayer); // also stores rho (energy density) for each point (node) // calculate distance to nearest point with higher density storing distance (delta) and point's index calculateDistanceToHigher(points[i]); - std::cout << i << std::endl; findAndAssignClusters(points[i],hit_kdtree,maxdensity,bounds,actualLayer, layerClustersPerLayer[i]); + size_t nClusters = layerClustersPerLayer[i].size(); + for(size_t j=0; j HGCalImagingAlgo::getClusters(bool doSharing){ From 18b8dfe1197835baacb8f7400bb73b13b2a2000f Mon Sep 17 00:00:00 2001 From: Felice Date: Fri, 9 Mar 2018 18:12:47 +0100 Subject: [PATCH 069/426] cleanup --- .../HGCalRecAlgos/src/HGCalImagingAlgo.cc | 52 +++++++------------ 1 file changed, 19 insertions(+), 33 deletions(-) diff --git a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc index 959274bc1b6c7..7b21a6a58e613 100644 --- a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc +++ b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc @@ -76,39 +76,25 @@ void HGCalImagingAlgo::makeClusters() //assign all hits in each layer to a cluster core or halo tbb::parallel_for(size_t(0), size_t(2*maxlayer+2), [&](size_t i) { - // for (unsigned int i = 0; i <= 2*maxlayer+1; ++i) { - KDTreeBox bounds(minpos[i][0],maxpos[i][0], - minpos[i][1],maxpos[i][1]); - KDTree hit_kdtree; - hit_kdtree.build(points[i], bounds); - - unsigned int actualLayer = i > maxlayer ? (i-(maxlayer+1)) : i; // maps back from index used for KD trees to actual layer - - double maxdensity = calculateLocalDensity(points[i],hit_kdtree, actualLayer); // also stores rho (energy density) for each point (node) - // calculate distance to nearest point with higher density storing distance (delta) and point's index - calculateDistanceToHigher(points[i]); - findAndAssignClusters(points[i],hit_kdtree,maxdensity,bounds,actualLayer, layerClustersPerLayer[i]); - size_t nClusters = layerClustersPerLayer[i].size(); - for(size_t j=0; j maxlayer ? (i-(maxlayer+1)) : i; // maps back from index used for KD trees to actual layer + + double maxdensity = calculateLocalDensity(points[i],hit_kdtree, actualLayer); // also stores rho (energy density) for each point (node) + // calculate distance to nearest point with higher density storing distance (delta) and point's index + calculateDistanceToHigher(points[i]); + findAndAssignClusters(points[i],hit_kdtree,maxdensity,bounds,actualLayer, layerClustersPerLayer[i]); + size_t nClusters = layerClustersPerLayer[i].size(); + for(size_t j=0; j HGCalImagingAlgo::getClusters(bool doSharing){ From 74625f77eba5dd89169b79fb53518f92a07c4129 Mon Sep 17 00:00:00 2001 From: Mircho Rodozov Date: Sat, 10 Mar 2018 00:55:25 +0100 Subject: [PATCH 070/426] Update dqmservices for protobuf changes --- DQMServices/Core/src/ROOTFilePB.pb.cc | 404 +++++++------------------- DQMServices/Core/src/ROOTFilePB.pb.h | 76 ++--- 2 files changed, 140 insertions(+), 340 deletions(-) diff --git a/DQMServices/Core/src/ROOTFilePB.pb.cc b/DQMServices/Core/src/ROOTFilePB.pb.cc index e282e1ec99feb..8d7c472546dbe 100644 --- a/DQMServices/Core/src/ROOTFilePB.pb.cc +++ b/DQMServices/Core/src/ROOTFilePB.pb.cc @@ -1,7 +1,6 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: DQMServices/Core/src/ROOTFilePB.proto -#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION #include "DQMServices/Core/src/ROOTFilePB.pb.h" #include @@ -15,84 +14,107 @@ #include #include #include +// This is a temporary google only hack +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS +#include "third_party/protobuf/version.h" +#endif // @@protoc_insertion_point(includes) - namespace dqmstorepb { class ROOTFilePB_HistoDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed + _instance; } _ROOTFilePB_Histo_default_instance_; class ROOTFilePBDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed + _instance; } _ROOTFilePB_default_instance_; - +} // namespace dqmstorepb namespace protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto { +void InitDefaultsROOTFilePB_HistoImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + { + void* ptr = &::dqmstorepb::_ROOTFilePB_Histo_default_instance_; + new (ptr) ::dqmstorepb::ROOTFilePB_Histo(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::dqmstorepb::ROOTFilePB_Histo::InitAsDefaultInstance(); +} -namespace { +void InitDefaultsROOTFilePB_Histo() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsROOTFilePB_HistoImpl); +} -::google::protobuf::Metadata file_level_metadata[2]; +void InitDefaultsROOTFilePBImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; -} // namespace +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::InitDefaultsROOTFilePB_Histo(); + { + void* ptr = &::dqmstorepb::_ROOTFilePB_default_instance_; + new (ptr) ::dqmstorepb::ROOTFilePB(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::dqmstorepb::ROOTFilePB::InitAsDefaultInstance(); +} -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTableField - const TableStruct::entries[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - {0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0}, -}; +void InitDefaultsROOTFilePB() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsROOTFilePBImpl); +} -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField - const TableStruct::aux[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - ::google::protobuf::internal::AuxillaryParseTableField(), -}; -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const - TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { nullptr, nullptr, 0, -1, -1, -1, -1, nullptr, false }, - { nullptr, nullptr, 0, -1, -1, -1, -1, nullptr, false }, -}; +::google::protobuf::Metadata file_level_metadata[2]; -const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ROOTFilePB_Histo, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ROOTFilePB_Histo, _internal_metadata_), +const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::dqmstorepb::ROOTFilePB_Histo, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::dqmstorepb::ROOTFilePB_Histo, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ROOTFilePB_Histo, full_pathname_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ROOTFilePB_Histo, size_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ROOTFilePB_Histo, streamed_histo_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ROOTFilePB_Histo, flags_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::dqmstorepb::ROOTFilePB_Histo, full_pathname_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::dqmstorepb::ROOTFilePB_Histo, size_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::dqmstorepb::ROOTFilePB_Histo, streamed_histo_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::dqmstorepb::ROOTFilePB_Histo, flags_), 0, 2, 1, 3, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ROOTFilePB, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ROOTFilePB, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::dqmstorepb::ROOTFilePB, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::dqmstorepb::ROOTFilePB, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ROOTFilePB, histo_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::dqmstorepb::ROOTFilePB, histo_), ~0u, }; -static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { 0, 9, sizeof(ROOTFilePB_Histo)}, - { 13, 19, sizeof(ROOTFilePB)}, +static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + { 0, 9, sizeof(::dqmstorepb::ROOTFilePB_Histo)}, + { 13, 19, sizeof(::dqmstorepb::ROOTFilePB)}, }; static ::google::protobuf::Message const * const file_default_instances[] = { - reinterpret_cast(&_ROOTFilePB_Histo_default_instance_), - reinterpret_cast(&_ROOTFilePB_default_instance_), + reinterpret_cast(&::dqmstorepb::_ROOTFilePB_Histo_default_instance_), + reinterpret_cast(&::dqmstorepb::_ROOTFilePB_default_instance_), }; -namespace { - void protobuf_AssignDescriptors() { AddDescriptors(); - ::google::protobuf::MessageFactory* factory = nullptr; + ::google::protobuf::MessageFactory* factory = NULL; AssignDescriptors( "DQMServices/Core/src/ROOTFilePB.proto", schemas, file_default_instances, TableStruct::offsets, factory, - file_level_metadata, nullptr, nullptr); + file_level_metadata, NULL, NULL); } void protobuf_AssignDescriptorsOnce() { @@ -100,31 +122,15 @@ void protobuf_AssignDescriptorsOnce() { ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors); } -void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD; +void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD; void protobuf_RegisterTypes(const ::std::string&) { protobuf_AssignDescriptorsOnce(); ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 2); } -} // namespace -void TableStruct::InitDefaultsImpl() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - ::google::protobuf::internal::InitProtobufDefaults(); - _ROOTFilePB_Histo_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_ROOTFilePB_Histo_default_instance_);_ROOTFilePB_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_ROOTFilePB_default_instance_);} - -void InitDefaults() { - static GOOGLE_PROTOBUF_DECLARE_ONCE(once); - ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl); -} -namespace { void AddDescriptorsImpl() { InitDefaults(); - static const char descriptor[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { "\n%DQMServices/Core/src/ROOTFilePB.proto\022" "\ndqmstorepb\"\216\001\n\nROOTFilePB\022+\n\005histo\030\001 \003(" "\0132\034.dqmstorepb.ROOTFilePB.Histo\032S\n\005Histo" @@ -136,7 +142,6 @@ void AddDescriptorsImpl() { ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "DQMServices/Core/src/ROOTFilePB.proto", &protobuf_RegisterTypes); } -} // anonymous namespace void AddDescriptors() { static GOOGLE_PROTOBUF_DECLARE_ONCE(once); @@ -148,12 +153,13 @@ struct StaticDescriptorInitializer { AddDescriptors(); } } static_descriptor_initializer; - } // namespace protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto - +namespace dqmstorepb { // =================================================================== +void ROOTFilePB_Histo::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int ROOTFilePB_Histo::kFullPathnameFieldNumber; const int ROOTFilePB_Histo::kSizeFieldNumber; @@ -162,16 +168,16 @@ const int ROOTFilePB_Histo::kFlagsFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 ROOTFilePB_Histo::ROOTFilePB_Histo() - : ::google::protobuf::Message(), _internal_metadata_(nullptr) { + : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::InitDefaults(); + ::protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::InitDefaultsROOTFilePB_Histo(); } SharedCtor(); // @@protoc_insertion_point(constructor:dqmstorepb.ROOTFilePB.Histo) } ROOTFilePB_Histo::ROOTFilePB_Histo(const ROOTFilePB_Histo& from) : ::google::protobuf::Message(), - _internal_metadata_(nullptr), + _internal_metadata_(NULL), _has_bits_(from._has_bits_), _cached_size_(0) { _internal_metadata_.MergeFrom(from._internal_metadata_); @@ -214,18 +220,18 @@ void ROOTFilePB_Histo::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* ROOTFilePB_Histo::descriptor() { - protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const ROOTFilePB_Histo& ROOTFilePB_Histo::default_instance() { - protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::InitDefaults(); + ::protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::InitDefaultsROOTFilePB_Histo(); return *internal_default_instance(); } ROOTFilePB_Histo* ROOTFilePB_Histo::New(::google::protobuf::Arena* arena) const { - auto* n = new ROOTFilePB_Histo; - if (arena != nullptr) { + ROOTFilePB_Histo* n = new ROOTFilePB_Histo; + if (arena != NULL) { arena->Own(n); } return n; @@ -504,10 +510,10 @@ size_t ROOTFilePB_Histo::ByteSizeLong() const { void ROOTFilePB_Histo::MergeFrom(const ::google::protobuf::Message& from) { // @@protoc_insertion_point(generalized_merge_from_start:dqmstorepb.ROOTFilePB.Histo) GOOGLE_DCHECK_NE(&from, this); - const auto* source = + const ROOTFilePB_Histo* source = ::google::protobuf::internal::DynamicCastToGenerated( &from); - if (source == nullptr) { + if (source == NULL) { // @@protoc_insertion_point(generalized_merge_from_cast_fail:dqmstorepb.ROOTFilePB.Histo) ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { @@ -579,205 +585,29 @@ void ROOTFilePB_Histo::InternalSwap(ROOTFilePB_Histo* other) { ::google::protobuf::Metadata ROOTFilePB_Histo::GetMetadata() const { protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// ROOTFilePB_Histo - -// required string full_pathname = 1; -bool ROOTFilePB_Histo::has_full_pathname() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -void ROOTFilePB_Histo::set_has_full_pathname() { - _has_bits_[0] |= 0x00000001u; -} -void ROOTFilePB_Histo::clear_has_full_pathname() { - _has_bits_[0] &= ~0x00000001u; -} -void ROOTFilePB_Histo::clear_full_pathname() { - full_pathname_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_full_pathname(); -} -const ::std::string& ROOTFilePB_Histo::full_pathname() const { - // @@protoc_insertion_point(field_get:dqmstorepb.ROOTFilePB.Histo.full_pathname) - return full_pathname_.GetNoArena(); -} -void ROOTFilePB_Histo::set_full_pathname(const ::std::string& value) { - set_has_full_pathname(); - full_pathname_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:dqmstorepb.ROOTFilePB.Histo.full_pathname) -} -#if LANG_CXX11 -void ROOTFilePB_Histo::set_full_pathname(::std::string&& value) { - set_has_full_pathname(); - full_pathname_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:dqmstorepb.ROOTFilePB.Histo.full_pathname) -} -#endif -void ROOTFilePB_Histo::set_full_pathname(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_full_pathname(); - full_pathname_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:dqmstorepb.ROOTFilePB.Histo.full_pathname) -} -void ROOTFilePB_Histo::set_full_pathname(const char* value, size_t size) { - set_has_full_pathname(); - full_pathname_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:dqmstorepb.ROOTFilePB.Histo.full_pathname) -} -::std::string* ROOTFilePB_Histo::mutable_full_pathname() { - set_has_full_pathname(); - // @@protoc_insertion_point(field_mutable:dqmstorepb.ROOTFilePB.Histo.full_pathname) - return full_pathname_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* ROOTFilePB_Histo::release_full_pathname() { - // @@protoc_insertion_point(field_release:dqmstorepb.ROOTFilePB.Histo.full_pathname) - clear_has_full_pathname(); - return full_pathname_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void ROOTFilePB_Histo::set_allocated_full_pathname(::std::string* full_pathname) { - if (full_pathname != NULL) { - set_has_full_pathname(); - } else { - clear_has_full_pathname(); - } - full_pathname_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), full_pathname); - // @@protoc_insertion_point(field_set_allocated:dqmstorepb.ROOTFilePB.Histo.full_pathname) -} - -// required uint32 size = 2; -bool ROOTFilePB_Histo::has_size() const { - return (_has_bits_[0] & 0x00000004u) != 0; -} -void ROOTFilePB_Histo::set_has_size() { - _has_bits_[0] |= 0x00000004u; -} -void ROOTFilePB_Histo::clear_has_size() { - _has_bits_[0] &= ~0x00000004u; -} -void ROOTFilePB_Histo::clear_size() { - size_ = 0u; - clear_has_size(); -} -::google::protobuf::uint32 ROOTFilePB_Histo::size() const { - // @@protoc_insertion_point(field_get:dqmstorepb.ROOTFilePB.Histo.size) - return size_; -} -void ROOTFilePB_Histo::set_size(::google::protobuf::uint32 value) { - set_has_size(); - size_ = value; - // @@protoc_insertion_point(field_set:dqmstorepb.ROOTFilePB.Histo.size) -} - -// required bytes streamed_histo = 3; -bool ROOTFilePB_Histo::has_streamed_histo() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -void ROOTFilePB_Histo::set_has_streamed_histo() { - _has_bits_[0] |= 0x00000002u; -} -void ROOTFilePB_Histo::clear_has_streamed_histo() { - _has_bits_[0] &= ~0x00000002u; -} -void ROOTFilePB_Histo::clear_streamed_histo() { - streamed_histo_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_streamed_histo(); -} -const ::std::string& ROOTFilePB_Histo::streamed_histo() const { - // @@protoc_insertion_point(field_get:dqmstorepb.ROOTFilePB.Histo.streamed_histo) - return streamed_histo_.GetNoArena(); -} -void ROOTFilePB_Histo::set_streamed_histo(const ::std::string& value) { - set_has_streamed_histo(); - streamed_histo_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:dqmstorepb.ROOTFilePB.Histo.streamed_histo) -} -#if LANG_CXX11 -void ROOTFilePB_Histo::set_streamed_histo(::std::string&& value) { - set_has_streamed_histo(); - streamed_histo_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:dqmstorepb.ROOTFilePB.Histo.streamed_histo) -} -#endif -void ROOTFilePB_Histo::set_streamed_histo(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_streamed_histo(); - streamed_histo_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:dqmstorepb.ROOTFilePB.Histo.streamed_histo) -} -void ROOTFilePB_Histo::set_streamed_histo(const void* value, size_t size) { - set_has_streamed_histo(); - streamed_histo_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:dqmstorepb.ROOTFilePB.Histo.streamed_histo) -} -::std::string* ROOTFilePB_Histo::mutable_streamed_histo() { - set_has_streamed_histo(); - // @@protoc_insertion_point(field_mutable:dqmstorepb.ROOTFilePB.Histo.streamed_histo) - return streamed_histo_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* ROOTFilePB_Histo::release_streamed_histo() { - // @@protoc_insertion_point(field_release:dqmstorepb.ROOTFilePB.Histo.streamed_histo) - clear_has_streamed_histo(); - return streamed_histo_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void ROOTFilePB_Histo::set_allocated_streamed_histo(::std::string* streamed_histo) { - if (streamed_histo != NULL) { - set_has_streamed_histo(); - } else { - clear_has_streamed_histo(); - } - streamed_histo_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), streamed_histo); - // @@protoc_insertion_point(field_set_allocated:dqmstorepb.ROOTFilePB.Histo.streamed_histo) -} - -// required uint32 flags = 4; -bool ROOTFilePB_Histo::has_flags() const { - return (_has_bits_[0] & 0x00000008u) != 0; -} -void ROOTFilePB_Histo::set_has_flags() { - _has_bits_[0] |= 0x00000008u; -} -void ROOTFilePB_Histo::clear_has_flags() { - _has_bits_[0] &= ~0x00000008u; -} -void ROOTFilePB_Histo::clear_flags() { - flags_ = 0u; - clear_has_flags(); -} -::google::protobuf::uint32 ROOTFilePB_Histo::flags() const { - // @@protoc_insertion_point(field_get:dqmstorepb.ROOTFilePB.Histo.flags) - return flags_; -} -void ROOTFilePB_Histo::set_flags(::google::protobuf::uint32 value) { - set_has_flags(); - flags_ = value; - // @@protoc_insertion_point(field_set:dqmstorepb.ROOTFilePB.Histo.flags) -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +void ROOTFilePB::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int ROOTFilePB::kHistoFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 ROOTFilePB::ROOTFilePB() - : ::google::protobuf::Message(), _internal_metadata_(nullptr) { + : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::InitDefaults(); + ::protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::InitDefaultsROOTFilePB(); } SharedCtor(); // @@protoc_insertion_point(constructor:dqmstorepb.ROOTFilePB) } ROOTFilePB::ROOTFilePB(const ROOTFilePB& from) : ::google::protobuf::Message(), - _internal_metadata_(nullptr), + _internal_metadata_(NULL), _has_bits_(from._has_bits_), _cached_size_(0), histo_(from.histo_) { @@ -803,18 +633,18 @@ void ROOTFilePB::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* ROOTFilePB::descriptor() { - protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const ROOTFilePB& ROOTFilePB::default_instance() { - protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::InitDefaults(); + ::protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::InitDefaultsROOTFilePB(); return *internal_default_instance(); } ROOTFilePB* ROOTFilePB::New(::google::protobuf::Arena* arena) const { - auto* n = new ROOTFilePB; - if (arena != nullptr) { + ROOTFilePB* n = new ROOTFilePB; + if (arena != NULL) { arena->Own(n); } return n; @@ -845,8 +675,7 @@ bool ROOTFilePB::MergePartialFromCodedStream( case 1: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_histo())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_histo())); } else { goto handle_unusual; } @@ -904,7 +733,7 @@ ::google::protobuf::uint8* ROOTFilePB::InternalSerializeWithCachedSizesToArray( for (unsigned int i = 0, n = static_cast(this->histo_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 1, this->histo(static_cast(i)), deterministic, target); } @@ -927,11 +756,11 @@ size_t ROOTFilePB::ByteSizeLong() const { } // repeated .dqmstorepb.ROOTFilePB.Histo histo = 1; { - auto count = static_cast(this->histo_size()); + unsigned int count = static_cast(this->histo_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->histo(static_cast(i))); } } @@ -946,10 +775,10 @@ size_t ROOTFilePB::ByteSizeLong() const { void ROOTFilePB::MergeFrom(const ::google::protobuf::Message& from) { // @@protoc_insertion_point(generalized_merge_from_start:dqmstorepb.ROOTFilePB) GOOGLE_DCHECK_NE(&from, this); - const auto* source = + const ROOTFilePB* source = ::google::protobuf::internal::DynamicCastToGenerated( &from); - if (source == nullptr) { + if (source == NULL) { // @@protoc_insertion_point(generalized_merge_from_cast_fail:dqmstorepb.ROOTFilePB) ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { @@ -1001,46 +830,11 @@ void ROOTFilePB::InternalSwap(ROOTFilePB* other) { ::google::protobuf::Metadata ROOTFilePB::GetMetadata() const { protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// ROOTFilePB - -// repeated .dqmstorepb.ROOTFilePB.Histo histo = 1; -int ROOTFilePB::histo_size() const { - return histo_.size(); -} -void ROOTFilePB::clear_histo() { - histo_.Clear(); -} -const ::dqmstorepb::ROOTFilePB_Histo& ROOTFilePB::histo(int index) const { - // @@protoc_insertion_point(field_get:dqmstorepb.ROOTFilePB.histo) - return histo_.Get(index); -} -::dqmstorepb::ROOTFilePB_Histo* ROOTFilePB::mutable_histo(int index) { - // @@protoc_insertion_point(field_mutable:dqmstorepb.ROOTFilePB.histo) - return histo_.Mutable(index); -} -::dqmstorepb::ROOTFilePB_Histo* ROOTFilePB::add_histo() { - // @@protoc_insertion_point(field_add:dqmstorepb.ROOTFilePB.histo) - return histo_.Add(); -} -::google::protobuf::RepeatedPtrField< ::dqmstorepb::ROOTFilePB_Histo >* -ROOTFilePB::mutable_histo() { - // @@protoc_insertion_point(field_mutable_list:dqmstorepb.ROOTFilePB.histo) - return &histo_; -} -const ::google::protobuf::RepeatedPtrField< ::dqmstorepb::ROOTFilePB_Histo >& -ROOTFilePB::histo() const { - // @@protoc_insertion_point(field_list:dqmstorepb.ROOTFilePB.histo) - return histo_; -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // @@protoc_insertion_point(namespace_scope) - } // namespace dqmstorepb // @@protoc_insertion_point(global_scope) diff --git a/DQMServices/Core/src/ROOTFilePB.pb.h b/DQMServices/Core/src/ROOTFilePB.pb.h index e13eaeb5b27fc..596fb7655fb2e 100644 --- a/DQMServices/Core/src/ROOTFilePB.pb.h +++ b/DQMServices/Core/src/ROOTFilePB.pb.h @@ -8,12 +8,12 @@ #include -#if GOOGLE_PROTOBUF_VERSION < 3004000 +#if GOOGLE_PROTOBUF_VERSION < 3005000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3004000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#if 3005001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. @@ -30,38 +30,43 @@ #include // IWYU pragma: export #include // @@protoc_insertion_point(includes) -namespace dqmstorepb { -class ROOTFilePB; -class ROOTFilePBDefaultTypeInternal; -extern ROOTFilePBDefaultTypeInternal _ROOTFilePB_default_instance_; -class ROOTFilePB_Histo; -class ROOTFilePB_HistoDefaultTypeInternal; -extern ROOTFilePB_HistoDefaultTypeInternal _ROOTFilePB_Histo_default_instance_; -} // namespace dqmstorepb - -namespace dqmstorepb { namespace protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto { -// Internal implementation detail -- do not call these. +// Internal implementation detail -- do not use these members. struct TableStruct { static const ::google::protobuf::internal::ParseTableField entries[]; static const ::google::protobuf::internal::AuxillaryParseTableField aux[]; - static const ::google::protobuf::internal::ParseTable schema[]; - static const ::google::protobuf::uint32 offsets[]; + static const ::google::protobuf::internal::ParseTable schema[2]; static const ::google::protobuf::internal::FieldMetadata field_metadata[]; static const ::google::protobuf::internal::SerializationTable serialization_table[]; - static void InitDefaultsImpl(); + static const ::google::protobuf::uint32 offsets[]; }; void AddDescriptors(); -void InitDefaults(); +void InitDefaultsROOTFilePB_HistoImpl(); +void InitDefaultsROOTFilePB_Histo(); +void InitDefaultsROOTFilePBImpl(); +void InitDefaultsROOTFilePB(); +inline void InitDefaults() { + InitDefaultsROOTFilePB_Histo(); + InitDefaultsROOTFilePB(); +} } // namespace protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto +namespace dqmstorepb { +class ROOTFilePB; +class ROOTFilePBDefaultTypeInternal; +extern ROOTFilePBDefaultTypeInternal _ROOTFilePB_default_instance_; +class ROOTFilePB_Histo; +class ROOTFilePB_HistoDefaultTypeInternal; +extern ROOTFilePB_HistoDefaultTypeInternal _ROOTFilePB_Histo_default_instance_; +} // namespace dqmstorepb +namespace dqmstorepb { // =================================================================== class ROOTFilePB_Histo : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:dqmstorepb.ROOTFilePB.Histo) */ { public: ROOTFilePB_Histo(); - ~ROOTFilePB_Histo() override; + virtual ~ROOTFilePB_Histo(); ROOTFilePB_Histo(const ROOTFilePB_Histo& from); @@ -94,6 +99,7 @@ class ROOTFilePB_Histo : public ::google::protobuf::Message /* @@protoc_insertio static const ::google::protobuf::Descriptor* descriptor(); static const ROOTFilePB_Histo& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const ROOTFilePB_Histo* internal_default_instance() { return reinterpret_cast( &_ROOTFilePB_Histo_default_instance_); @@ -108,7 +114,7 @@ class ROOTFilePB_Histo : public ::google::protobuf::Message /* @@protoc_insertio // implements Message ---------------------------------------------- - inline ROOTFilePB_Histo* New() const PROTOBUF_FINAL { return New(nullptr); } + inline ROOTFilePB_Histo* New() const PROTOBUF_FINAL { return New(NULL); } ROOTFilePB_Histo* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL; void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; @@ -133,10 +139,10 @@ class ROOTFilePB_Histo : public ::google::protobuf::Message /* @@protoc_insertio void InternalSwap(ROOTFilePB_Histo* other); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return nullptr; + return NULL; } inline void* MaybeArenaPtr() const { - return nullptr; + return NULL; } public: @@ -211,14 +217,15 @@ class ROOTFilePB_Histo : public ::google::protobuf::Message /* @@protoc_insertio ::google::protobuf::internal::ArenaStringPtr streamed_histo_; ::google::protobuf::uint32 size_; ::google::protobuf::uint32 flags_; - friend struct protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::TableStruct; + friend struct ::protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::TableStruct; + friend void ::protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::InitDefaultsROOTFilePB_HistoImpl(); }; // ------------------------------------------------------------------- class ROOTFilePB : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:dqmstorepb.ROOTFilePB) */ { public: ROOTFilePB(); - ~ROOTFilePB() override; + virtual ~ROOTFilePB(); ROOTFilePB(const ROOTFilePB& from); @@ -251,6 +258,7 @@ class ROOTFilePB : public ::google::protobuf::Message /* @@protoc_insertion_poin static const ::google::protobuf::Descriptor* descriptor(); static const ROOTFilePB& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const ROOTFilePB* internal_default_instance() { return reinterpret_cast( &_ROOTFilePB_default_instance_); @@ -265,7 +273,7 @@ class ROOTFilePB : public ::google::protobuf::Message /* @@protoc_insertion_poin // implements Message ---------------------------------------------- - inline ROOTFilePB* New() const PROTOBUF_FINAL { return New(nullptr); } + inline ROOTFilePB* New() const PROTOBUF_FINAL { return New(NULL); } ROOTFilePB* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL; void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; @@ -290,10 +298,10 @@ class ROOTFilePB : public ::google::protobuf::Message /* @@protoc_insertion_poin void InternalSwap(ROOTFilePB* other); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return nullptr; + return NULL; } inline void* MaybeArenaPtr() const { - return nullptr; + return NULL; } public: @@ -301,7 +309,7 @@ class ROOTFilePB : public ::google::protobuf::Message /* @@protoc_insertion_poin // nested types ---------------------------------------------------- - using Histo = dqmstorepb::ROOTFilePB_Histo; + typedef ROOTFilePB_Histo Histo; // accessors ------------------------------------------------------- @@ -324,14 +332,14 @@ class ROOTFilePB : public ::google::protobuf::Message /* @@protoc_insertion_poin ::google::protobuf::internal::HasBits<1> _has_bits_; mutable int _cached_size_; ::google::protobuf::RepeatedPtrField< ::dqmstorepb::ROOTFilePB_Histo > histo_; - friend struct protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::TableStruct; + friend struct ::protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::TableStruct; + friend void ::protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::InitDefaultsROOTFilePBImpl(); }; // =================================================================== // =================================================================== -#if !PROTOBUF_INLINE_NOT_IN_HEADERS #ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstrict-aliasing" @@ -370,7 +378,7 @@ inline void ROOTFilePB_Histo::set_full_pathname(::std::string&& value) { } #endif inline void ROOTFilePB_Histo::set_full_pathname(const char* value) { - GOOGLE_DCHECK(value != nullptr); + GOOGLE_DCHECK(value != NULL); set_has_full_pathname(); full_pathname_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); // @@protoc_insertion_point(field_set_char:dqmstorepb.ROOTFilePB.Histo.full_pathname) @@ -392,7 +400,7 @@ inline ::std::string* ROOTFilePB_Histo::release_full_pathname() { return full_pathname_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline void ROOTFilePB_Histo::set_allocated_full_pathname(::std::string* full_pathname) { - if (full_pathname != nullptr) { + if (full_pathname != NULL) { set_has_full_pathname(); } else { clear_has_full_pathname(); @@ -457,7 +465,7 @@ inline void ROOTFilePB_Histo::set_streamed_histo(::std::string&& value) { } #endif inline void ROOTFilePB_Histo::set_streamed_histo(const char* value) { - GOOGLE_DCHECK(value != nullptr); + GOOGLE_DCHECK(value != NULL); set_has_streamed_histo(); streamed_histo_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); // @@protoc_insertion_point(field_set_char:dqmstorepb.ROOTFilePB.Histo.streamed_histo) @@ -479,7 +487,7 @@ inline ::std::string* ROOTFilePB_Histo::release_streamed_histo() { return streamed_histo_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline void ROOTFilePB_Histo::set_allocated_streamed_histo(::std::string* streamed_histo) { - if (streamed_histo != nullptr) { + if (streamed_histo != NULL) { set_has_streamed_histo(); } else { clear_has_streamed_histo(); @@ -549,13 +557,11 @@ ROOTFilePB::histo() const { #ifdef __GNUC__ #pragma GCC diagnostic pop #endif // __GNUC__ -#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS // ------------------------------------------------------------------- // @@protoc_insertion_point(namespace_scope) - } // namespace dqmstorepb // @@protoc_insertion_point(global_scope) From fa9ca452fcf01d7fab8417d44b41e0a207beeab6 Mon Sep 17 00:00:00 2001 From: Mircho Rodozov Date: Sat, 10 Mar 2018 01:04:50 +0100 Subject: [PATCH 071/426] Fix code checks --- DQMServices/Core/src/ROOTFilePB.pb.cc | 18 +++++++++--------- DQMServices/Core/src/ROOTFilePB.pb.h | 24 ++++++++++++------------ 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/DQMServices/Core/src/ROOTFilePB.pb.cc b/DQMServices/Core/src/ROOTFilePB.pb.cc index 8d7c472546dbe..3fb274d424079 100644 --- a/DQMServices/Core/src/ROOTFilePB.pb.cc +++ b/DQMServices/Core/src/ROOTFilePB.pb.cc @@ -111,7 +111,7 @@ static ::google::protobuf::Message const * const file_default_instances[] = { void protobuf_AssignDescriptors() { AddDescriptors(); - ::google::protobuf::MessageFactory* factory = NULL; + ::google::protobuf::MessageFactory* factory = nullptr; AssignDescriptors( "DQMServices/Core/src/ROOTFilePB.proto", schemas, file_default_instances, TableStruct::offsets, factory, file_level_metadata, NULL, NULL); @@ -168,7 +168,7 @@ const int ROOTFilePB_Histo::kFlagsFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 ROOTFilePB_Histo::ROOTFilePB_Histo() - : ::google::protobuf::Message(), _internal_metadata_(NULL) { + : ::google::protobuf::Message(), _internal_metadata_(nullptr) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { ::protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::InitDefaultsROOTFilePB_Histo(); } @@ -177,7 +177,7 @@ ROOTFilePB_Histo::ROOTFilePB_Histo() } ROOTFilePB_Histo::ROOTFilePB_Histo(const ROOTFilePB_Histo& from) : ::google::protobuf::Message(), - _internal_metadata_(NULL), + _internal_metadata_(nullptr), _has_bits_(from._has_bits_), _cached_size_(0) { _internal_metadata_.MergeFrom(from._internal_metadata_); @@ -231,7 +231,7 @@ const ROOTFilePB_Histo& ROOTFilePB_Histo::default_instance() { ROOTFilePB_Histo* ROOTFilePB_Histo::New(::google::protobuf::Arena* arena) const { ROOTFilePB_Histo* n = new ROOTFilePB_Histo; - if (arena != NULL) { + if (arena != nullptr) { arena->Own(n); } return n; @@ -513,7 +513,7 @@ void ROOTFilePB_Histo::MergeFrom(const ::google::protobuf::Message& from) { const ROOTFilePB_Histo* source = ::google::protobuf::internal::DynamicCastToGenerated( &from); - if (source == NULL) { + if (source == nullptr) { // @@protoc_insertion_point(generalized_merge_from_cast_fail:dqmstorepb.ROOTFilePB.Histo) ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { @@ -598,7 +598,7 @@ const int ROOTFilePB::kHistoFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 ROOTFilePB::ROOTFilePB() - : ::google::protobuf::Message(), _internal_metadata_(NULL) { + : ::google::protobuf::Message(), _internal_metadata_(nullptr) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { ::protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::InitDefaultsROOTFilePB(); } @@ -607,7 +607,7 @@ ROOTFilePB::ROOTFilePB() } ROOTFilePB::ROOTFilePB(const ROOTFilePB& from) : ::google::protobuf::Message(), - _internal_metadata_(NULL), + _internal_metadata_(nullptr), _has_bits_(from._has_bits_), _cached_size_(0), histo_(from.histo_) { @@ -644,7 +644,7 @@ const ROOTFilePB& ROOTFilePB::default_instance() { ROOTFilePB* ROOTFilePB::New(::google::protobuf::Arena* arena) const { ROOTFilePB* n = new ROOTFilePB; - if (arena != NULL) { + if (arena != nullptr) { arena->Own(n); } return n; @@ -778,7 +778,7 @@ void ROOTFilePB::MergeFrom(const ::google::protobuf::Message& from) { const ROOTFilePB* source = ::google::protobuf::internal::DynamicCastToGenerated( &from); - if (source == NULL) { + if (source == nullptr) { // @@protoc_insertion_point(generalized_merge_from_cast_fail:dqmstorepb.ROOTFilePB) ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { diff --git a/DQMServices/Core/src/ROOTFilePB.pb.h b/DQMServices/Core/src/ROOTFilePB.pb.h index 596fb7655fb2e..2099ad08d85f8 100644 --- a/DQMServices/Core/src/ROOTFilePB.pb.h +++ b/DQMServices/Core/src/ROOTFilePB.pb.h @@ -66,7 +66,7 @@ namespace dqmstorepb { class ROOTFilePB_Histo : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:dqmstorepb.ROOTFilePB.Histo) */ { public: ROOTFilePB_Histo(); - virtual ~ROOTFilePB_Histo(); + ~ROOTFilePB_Histo() override; ROOTFilePB_Histo(const ROOTFilePB_Histo& from); @@ -114,7 +114,7 @@ class ROOTFilePB_Histo : public ::google::protobuf::Message /* @@protoc_insertio // implements Message ---------------------------------------------- - inline ROOTFilePB_Histo* New() const PROTOBUF_FINAL { return New(NULL); } + inline ROOTFilePB_Histo* New() const PROTOBUF_FINAL { return New(nullptr); } ROOTFilePB_Histo* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL; void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; @@ -139,10 +139,10 @@ class ROOTFilePB_Histo : public ::google::protobuf::Message /* @@protoc_insertio void InternalSwap(ROOTFilePB_Histo* other); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return NULL; + return nullptr; } inline void* MaybeArenaPtr() const { - return NULL; + return nullptr; } public: @@ -225,7 +225,7 @@ class ROOTFilePB_Histo : public ::google::protobuf::Message /* @@protoc_insertio class ROOTFilePB : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:dqmstorepb.ROOTFilePB) */ { public: ROOTFilePB(); - virtual ~ROOTFilePB(); + ~ROOTFilePB() override; ROOTFilePB(const ROOTFilePB& from); @@ -273,7 +273,7 @@ class ROOTFilePB : public ::google::protobuf::Message /* @@protoc_insertion_poin // implements Message ---------------------------------------------- - inline ROOTFilePB* New() const PROTOBUF_FINAL { return New(NULL); } + inline ROOTFilePB* New() const PROTOBUF_FINAL { return New(nullptr); } ROOTFilePB* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL; void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; @@ -298,10 +298,10 @@ class ROOTFilePB : public ::google::protobuf::Message /* @@protoc_insertion_poin void InternalSwap(ROOTFilePB* other); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return NULL; + return nullptr; } inline void* MaybeArenaPtr() const { - return NULL; + return nullptr; } public: @@ -378,7 +378,7 @@ inline void ROOTFilePB_Histo::set_full_pathname(::std::string&& value) { } #endif inline void ROOTFilePB_Histo::set_full_pathname(const char* value) { - GOOGLE_DCHECK(value != NULL); + GOOGLE_DCHECK(value != nullptr); set_has_full_pathname(); full_pathname_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); // @@protoc_insertion_point(field_set_char:dqmstorepb.ROOTFilePB.Histo.full_pathname) @@ -400,7 +400,7 @@ inline ::std::string* ROOTFilePB_Histo::release_full_pathname() { return full_pathname_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline void ROOTFilePB_Histo::set_allocated_full_pathname(::std::string* full_pathname) { - if (full_pathname != NULL) { + if (full_pathname != nullptr) { set_has_full_pathname(); } else { clear_has_full_pathname(); @@ -465,7 +465,7 @@ inline void ROOTFilePB_Histo::set_streamed_histo(::std::string&& value) { } #endif inline void ROOTFilePB_Histo::set_streamed_histo(const char* value) { - GOOGLE_DCHECK(value != NULL); + GOOGLE_DCHECK(value != nullptr); set_has_streamed_histo(); streamed_histo_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); // @@protoc_insertion_point(field_set_char:dqmstorepb.ROOTFilePB.Histo.streamed_histo) @@ -487,7 +487,7 @@ inline ::std::string* ROOTFilePB_Histo::release_streamed_histo() { return streamed_histo_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline void ROOTFilePB_Histo::set_allocated_streamed_histo(::std::string* streamed_histo) { - if (streamed_histo != NULL) { + if (streamed_histo != nullptr) { set_has_streamed_histo(); } else { clear_has_streamed_histo(); From 49b5b7368e6fda22bd63fbec3cbe14e8bf0187a8 Mon Sep 17 00:00:00 2001 From: Emily Date: Sat, 10 Mar 2018 13:19:46 -0600 Subject: [PATCH 072/426] Removed unnecessary cout statements --- .../src/SiPixelPhase1TrackClusters.cc | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/DQM/SiPixelPhase1TrackClusters/src/SiPixelPhase1TrackClusters.cc b/DQM/SiPixelPhase1TrackClusters/src/SiPixelPhase1TrackClusters.cc index 17fc50f9d5671..6cb8dbcb10159 100644 --- a/DQM/SiPixelPhase1TrackClusters/src/SiPixelPhase1TrackClusters.cc +++ b/DQM/SiPixelPhase1TrackClusters/src/SiPixelPhase1TrackClusters.cc @@ -1,4 +1,4 @@ -// -*- C++ -*- +0;95;0c// -*- C++ -*- // // Package: SiPixelPhase1TrackClusters // Class : SiPixelPhase1TrackClusters @@ -198,14 +198,11 @@ void SiPixelPhase1TrackClusters::analyze(const edm::Event& iEvent, const edm::Ev float pixel_charge = pixelsVec[i].adc; if (bigInX==true || bigInY==true) { - std::cout<<"Failure here 1?"< Date: Sat, 10 Mar 2018 18:42:46 -0600 Subject: [PATCH 073/426] Add missing files for CPE ClusterRepair, plus a lot of comment clean-up as requested by Andrea --- .../SiPixelRecHits/plugins/SealModules.cc | 2 + .../python/PixelCPEClusterRepair_cfi.py | 28 +++++ .../SiPixelRecHits/src/PixelCPEBase.cc | 101 ++++++++---------- .../src/PixelCPEClusterRepair.cc | 94 +++++----------- .../SiPixelRecHits/src/SealModules.cc | 1 + .../SiPixelRecHits/src/SiPixelTemplate.cc | 8 +- .../python/TTRHBuilderWithTemplate_cfi.py | 3 + .../python/TTRHBuilders_cff.py | 1 + 8 files changed, 110 insertions(+), 128 deletions(-) create mode 100644 RecoLocalTracker/SiPixelRecHits/python/PixelCPEClusterRepair_cfi.py diff --git a/RecoLocalTracker/SiPixelRecHits/plugins/SealModules.cc b/RecoLocalTracker/SiPixelRecHits/plugins/SealModules.cc index b6e5bd2075d14..3b67968d4c4b7 100644 --- a/RecoLocalTracker/SiPixelRecHits/plugins/SealModules.cc +++ b/RecoLocalTracker/SiPixelRecHits/plugins/SealModules.cc @@ -7,6 +7,7 @@ //--- The CPE ES Producers #include "RecoLocalTracker/SiPixelRecHits/interface/PixelCPEGenericESProducer.h" #include "RecoLocalTracker/SiPixelRecHits/interface/PixelCPETemplateRecoESProducer.h" +#include "RecoLocalTracker/SiPixelRecHits/interface/PixelCPEClusterRepairESProducer.h" //---- The RecHit ED producer #include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelRecHitConverter.h" //--- The header files for the Framework infrastructure (macros etc): @@ -23,4 +24,5 @@ using cms::SiPixelRecHitConverter; DEFINE_FWK_MODULE(SiPixelRecHitConverter); DEFINE_FWK_EVENTSETUP_MODULE(PixelCPEGenericESProducer); DEFINE_FWK_EVENTSETUP_MODULE(PixelCPETemplateRecoESProducer); +DEFINE_FWK_EVENTSETUP_MODULE(PixelCPEClusterRepairESProducer); diff --git a/RecoLocalTracker/SiPixelRecHits/python/PixelCPEClusterRepair_cfi.py b/RecoLocalTracker/SiPixelRecHits/python/PixelCPEClusterRepair_cfi.py new file mode 100644 index 0000000000000..6bac9d960117b --- /dev/null +++ b/RecoLocalTracker/SiPixelRecHits/python/PixelCPEClusterRepair_cfi.py @@ -0,0 +1,28 @@ +import FWCore.ParameterSet.Config as cms + +templates = cms.ESProducer("PixelCPEClusterRepairESProducer", + ComponentName = cms.string('PixelCPEClusterRepair'), + speed = cms.int32(-2), + #PixelErrorParametrization = cms.string('NOTcmsim'), + Alpha2Order = cms.bool(True), + UseClusterSplitter = cms.bool(False), + + # petar, for clusterProbability() from TTRHs + ClusterProbComputationFlag = cms.int32(0), + # gavril + DoCosmics = cms.bool(False), + # The flag to regulate if the LA offset is taken from Alignment + # True in Run II for offline RECO + DoLorentz = cms.bool(True), + + LoadTemplatesFromDB = cms.bool(True) + +) + +# This customization will be removed once we get the templates for phase2 pixel +from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker +phase2_tracker.toModify(templates, + LoadTemplatesFromDB = False, + DoLorentz = False, +) + diff --git a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEBase.cc b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEBase.cc index 81516d1ff0ee5..da7f2bbf1065d 100644 --- a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEBase.cc +++ b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEBase.cc @@ -55,7 +55,6 @@ magfield_(mag), geom_(geom), ttopo_(ttopo) //-- GenError Calibration Object (different from SiPixelCPEGenericErrorParm) from DB genErrorDBObject_ = genErrorDBObject; - //cout<<" new errors "<("LoadTemplatesFromDB"); - //cout<<" use generros/templaets "<("useLAWidthFromDB"):false; // Use Alignment LA-offset in generic + // (Experimental; leave commented out) //useLAAlignmentOffsets_ = conf.existsAs("useLAAlignmentOffsets")? //conf.getParameter("useLAAlignmentOffsets"):false; @@ -104,9 +103,11 @@ magfield_(mag), geom_(geom), ttopo_(ttopo) conf.getParameter("lAWidthFPix"):0.0; // Use LA-offset from config, for testing only - if(lAOffset_>0.0) useLAOffsetFromConfig_ = true; + if (lAOffset_>0.0) + useLAOffsetFromConfig_ = true; // Use LA-width from config, split into fpix & bpix, for testing only - if(lAWidthBPix_>0.0 || lAWidthFPix_>0.0) useLAWidthFromConfig_ = true; + if (lAWidthBPix_>0.0 || lAWidthFPix_>0.0) + useLAWidthFromConfig_ = true; // For Templates only @@ -114,24 +115,23 @@ magfield_(mag), geom_(geom), ttopo_(ttopo) DoLorentz_ = conf.existsAs("DoLorentz")?conf.getParameter("DoLorentz"):false; LogDebug("PixelCPEBase") <<" LA constants - " - <(dus[i]); @@ -157,7 +157,6 @@ void PixelCPEBase::fillDetParams() //--- p.theDet->type() returns a GeomDetType, which implements subDetector() p.thePart = p.theDet->type().subDetector(); - //cout<<" in PixelCPEBase - in det "<surface(), but @@ -179,6 +178,7 @@ void PixelCPEBase::fillDetParams() p.detTemplateId = templateDBobject_->getTemplateID(p.theDet->geographicalId()); } + // &&& PM: I'm not sure what this does. Ask around. // just for testing //int i1 = 0; //if(theFlag_==0) i1 = genErrorDBObject_->getGenErrorID(p.theDet->geographicalId().rawId()); @@ -194,28 +194,28 @@ void PixelCPEBase::fillDetParams() else p.theRecTopol = dynamic_cast(p.theTopol); assert(p.theRecTopol); - //---- The geometrical description of one module/plaquette - //p.theNumOfRow = p.theRecTopol->nrows(); // rows in x //Not used, AH - //p.theNumOfCol = p.theRecTopol->ncolumns(); // cols in y //Not used, AH + //--- The geometrical description of one module/plaquette + //p.theNumOfRow = p.theRecTopol->nrows(); // rows in x //Not used, AH. PM: leave commented out. + //p.theNumOfCol = p.theRecTopol->ncolumns(); // cols in y //Not used, AH. PM: leave commented out. std::pair pitchxy = p.theRecTopol->pitch(); p.thePitchX = pitchxy.first; // pitch along x p.thePitchY = pitchxy.second; // pitch along y - //p.theSign = isFlipped(&p) ? -1 : 1; //Not used, AH + //p.theSign = isFlipped(&p) ? -1 : 1; //Not used, AH. PM: leave commented out. LocalVector Bfield = p.theDet->surface().toLocal(magfield_->inTesla(p.theDet->surface().position())); p.bz = Bfield.z(); p.bx = Bfield.x(); - // Compute the Lorentz shifts for this detector element + //--- Compute the Lorentz shifts for this detector element if ( (theFlag_==0) || DoLorentz_ ) { // do always for generic and if(DOLorentz) for templates p.driftDirection = driftDirection(p, Bfield ); computeLorentzShifts(p); } - LogDebug("PixelCPEBase") << "***** PIXEL LAYOUT *****" + LogDebug("PixelCPEBase::fillDetParams()") << "***** PIXEL LAYOUT *****" << " thePart = " << p.thePart << " theThickness = " << p.theThickness << " thePitchX = " << p.thePitchX @@ -255,10 +255,8 @@ PixelCPEBase::setTheClu( DetParam const & theDetParam, ClusterParam & theCluster theClusterParam.edgeTypeY_ = 0; theClusterParam.isOnEdge_ = ( theClusterParam.edgeTypeX_ || theClusterParam.edgeTypeY_ ); - // theClusterParam.isOnEdge_ = theDetParam.theRecTopol->isItEdgePixelInX(minInX) | theDetParam.theRecTopol->isItEdgePixelInX(maxInX) | - // theDetParam.theRecTopol->isItEdgePixelInY(minInY) | theDetParam.theRecTopol->isItEdgePixelInY(maxInY) ; - // FOR NOW UNUSED. KEEP IT IN CASE WE WANT TO USE IT IN THE FUTURE + // &&& FOR NOW UNUSED. KEEP IT IN CASE WE WANT TO USE IT IN THE FUTURE // Bad Pixels have their charge set to 0 in the clusterizer //hasBadPixels_ = false; //for(unsigned int i=0; ipixelADC().size(); ++i) { @@ -279,6 +277,7 @@ void PixelCPEBase:: computeAnglesFromTrajectory( DetParam const & theDetParam, ClusterParam & theClusterParam, const LocalTrajectoryParameters & ltp) const { + // &&& PM: this comment is a candidate for deletion, but ask around first. //cout<<" in PixelCPEBase:computeAnglesFromTrajectory - "<surface().toGlobal(Local3DPoint(0.,0.,0.)).perp2(); float tmp2 = theDetParam.theDet->surface().toGlobal(Local3DPoint(0.,0.,1.)).perp2(); - //cout << " 1: " << tmp1 << " 2: " << tmp2 << endl; - if ( tmp2surface().position(), theDetParam.theDet->surface().rotation()); LocalVector Bfield = detFrame.toLocal(bfield); return driftDirection(theDetParam,Bfield); - } + LocalVector -PixelCPEBase::driftDirection(DetParam & theDetParam, LocalVector Bfield ) const { - const bool LocalPrint = false; - +PixelCPEBase::driftDirection(DetParam & theDetParam, LocalVector Bfield ) const +{ // Use LA from DB or from config float langle = 0.; if( !useLAOffsetFromConfig_ ) { // get it from DB if(lorentzAngle_ != nullptr) { // a real LA object langle = lorentzAngle_->getLorentzAngle(theDetParam.theDet->geographicalId().rawId()); - //cout<<" la "<geographicalId().rawId() <geographicalId().rawId() <getLorentzAngle(theDetParam.theDet->geographicalId().rawId()); if(langleWidth!=0.0) theDetParam.widthLAFractionX = std::abs(langleWidth/langle); @@ -524,9 +522,7 @@ PixelCPEBase::driftDirection(DetParam & theDetParam, LocalVector Bfield ) const } // if flag - - if(LocalPrint) cout<<" in PixelCPEBase:driftDirection - "<("DoCosmics"); // Not used in templates - //LoadTemplatesFromDB_ = conf.getParameter("LoadTemplatesFromDB"); // Moved to Base - - //cout << " PixelCPEClusterRepair : (int)LoadTemplatesFromDB_ = " << (int)LoadTemplatesFromDB_ << endl; - //cout << "field_magnitude = " << field_magnitude << endl; - - // configuration parameter to decide between DB or text file template access - + LogDebug("PixelCPEClusterRepair::(constructor)") << endl; + + //--- Parameter to decide between DB or text file template access if ( LoadTemplatesFromDB_ ) { - //cout << "PixelCPEClusterRepair: Loading templates from database (DB) --------- " << endl; - // Initialize template store to the selected ID [Morris, 6/25/08] if ( !SiPixelTemplate::pushfile( *templateDBobject_, thePixelTemp_) ) throw cms::Exception("PixelCPEClusterRepair") @@ -78,7 +64,7 @@ PixelCPEClusterRepair::PixelCPEClusterRepair(edm::ParameterSet const & conf, } else { - //cout << "PixelCPEClusterRepair : Loading templates for barrel and forward from ASCII files ----------" << endl; + LogDebug("PixelCPEClusterRepair") << "Loading templates for barrel and forward from ASCII files." << endl; //--- (Archaic) Get configurable template IDs. This code executes only if we loading pixels from ASCII // files, and then they are mandatory. barrelTemplateID_ = conf.getParameter( "barrelTemplateID" ); @@ -239,7 +225,7 @@ PixelCPEClusterRepair::localPosition(DetParam const & theDetParam, ClusterParam // &&& Do we ever get pixels that are out of bounds ??? Need to check. if ( (irowlocalX( theClusterParam.theCluster->x(), theClusterParam.loc_trk_pred ) - lorentz_drift * micronsToCm; // rough Lorentz drift correction @@ -428,13 +414,21 @@ PixelCPEClusterRepair::callTempReco3D( DetParam const & theDetParam, // deltay - (output) template y-length - cluster length [when > 0, possibly missing end] // npixels - ??? &&& Ask Morris - float deltay = 0; - int npixels = 0; + float edgeTypeY = theClusterParam.edgeTypeY_ ; // the default, from PixelCPEBase + if ( theClusterParam.recommended3D_ ) { + // Cluster is not on edge, but instead the normal TemplateReco discovered that it is + // shorter than expected. So let the 3D algorithm try extending it on both sides, in case + // there is a dead double-column on either side. (We don't know which.) + edgeTypeY = 3; + } + + float deltay = 0; // return param + int npixels = 0; // return param theClusterParam.ierr2 = PixelTempReco3D( ID, theClusterParam.cotalpha, theClusterParam.cotbeta, locBz, locBx, - theClusterParam.edgeTypeY_ , theClusterParam.edgeTypeX_ , + edgeTypeY , theClusterParam.edgeTypeX_ , clusterPayload, templ2d, theClusterParam.templYrec_, theClusterParam.templSigmaY_, @@ -452,7 +446,7 @@ PixelCPEClusterRepair::callTempReco3D( DetParam const & theDetParam, LogDebug("PixelCPEClusterRepair::localPosition") << "3D reconstruction failed with error " << theClusterParam.ierr2 << "\n"; - // Gavril: what do we do in this case ? For now, just return the cluster center of gravity in microns + // GG: what do we do in this case? For now, just return the cluster center of gravity in microns // In the x case, apply a rough Lorentz drift average correction // To do: call PixelCPEGeneric whenever PixelTempReco2D fails float lorentz_drift = -999.9; @@ -460,7 +454,7 @@ PixelCPEClusterRepair::callTempReco3D( DetParam const & theDetParam, lorentz_drift = 60.0f; // in microns else lorentz_drift = 10.0f; // in microns - // ggiurgiu@jhu.edu, 21/09/2010 : trk angles needed to correct for bows/kinks + // GG: trk angles needed to correct for bows/kinks if ( theClusterParam.with_track_angle ) { theClusterParam.templXrec_ = theDetParam.theTopol->localX( theClusterParam.theCluster->x(), theClusterParam.loc_trk_pred ) - lorentz_drift * micronsToCm; // rough Lorentz drift correction @@ -504,16 +498,8 @@ PixelCPEClusterRepair::localError(DetParam const & theDetParam, ClusterParam & ClusterParamTemplate & theClusterParam = static_cast(theClusterParamBase); - //cout << endl; - //cout << "Set PixelCPETemplate errors .............................................." << endl; - - //cout << "CPETemplate : " << endl; - //--- Default is the maximum error used for edge clusters. //--- (never used, in fact: let comment it out, shut up the complains of the static analyzer, and save a few CPU cycles) - // const float sig12 = 1./sqrt(12.0); - // float xerr = theDetParam.thePitchX *sig12; - // float yerr = theDetParam.thePitchY *sig12; float xerr = 0.0f, yerr = 0.0f; // Check if the errors were already set at the clusters splitting level @@ -522,32 +508,15 @@ PixelCPEClusterRepair::localError(DetParam const & theDetParam, ClusterParam & { xerr = theClusterParam.theCluster->getSplitClusterErrorX() * micronsToCm; yerr = theClusterParam.theCluster->getSplitClusterErrorY() * micronsToCm; - - //cout << "Errors set at cluster splitting level : " << endl; - //cout << "xerr = " << xerr << endl; - //cout << "yerr = " << yerr << endl; } else { - // &&& Duplicate from above! Argh! - int maxPixelCol = theClusterParam.theCluster->maxPixelCol(); - int maxPixelRow = theClusterParam.theCluster->maxPixelRow(); - int minPixelCol = theClusterParam.theCluster->minPixelCol(); - int minPixelRow = theClusterParam.theCluster->minPixelRow(); - - //--- Are we near either of the edges? - bool edgex = ( theDetParam.theRecTopol->isItEdgePixelInX( minPixelRow ) || theDetParam.theRecTopol->isItEdgePixelInX( maxPixelRow ) ); - bool edgey = ( theDetParam.theRecTopol->isItEdgePixelInY( minPixelCol ) || theDetParam.theRecTopol->isItEdgePixelInY( maxPixelCol ) ); - - //--- Check status of both template calls. if ( (theClusterParam.ierr !=0) || (theClusterParam.ierr2 !=0) ) { // If reconstruction fails the hit position is calculated from cluster center of gravity // corrected in x by average Lorentz drift. Assign huge errors. - //xerr = 10.0 * (float)theClusterParam.theCluster->sizeX() * xerr; - //yerr = 10.0 * (float)theClusterParam.theCluster->sizeX() * yerr; - + // if(!GeomDetEnumerators::isTrackerPixel(theDetParam.thePart)) throw cms::Exception("PixelCPEClusterRepair::localPosition :") << "A non-pixel detector type in here?"; @@ -563,11 +532,6 @@ PixelCPEClusterRepair::localError(DetParam const & theDetParam, ClusterParam & xerr = 42.0f * micronsToCm; yerr = 39.0f * micronsToCm; } - - //cout << "xerr = " << xerr << endl; - //cout << "yerr = " << yerr << endl; - - //return LocalError(xerr*xerr, 0, yerr*yerr); } else if ( theClusterParam.edgeTypeX_ || theClusterParam.edgeTypeY_ ) { @@ -597,14 +561,14 @@ PixelCPEClusterRepair::localError(DetParam const & theDetParam, ClusterParam & // &&& nonsense (another class static) if the template fit failed. } - //cout << "xerr = " << xerr << endl; - //cout << "yerr = " << yerr << endl; - if (theVerboseLevel > 9) { - LogDebug("PixelCPEClusterRepair") << - " Sizex = " << theClusterParam.theCluster->sizeX() << " Sizey = " << theClusterParam.theCluster->sizeY() << " Edgex = " << edgex << " Edgey = " << edgey << - " ErrX = " << xerr << " ErrY = " << yerr; + LogDebug("PixelCPEClusterRepair") + << " Sizex = " << theClusterParam.theCluster->sizeX() + << " Sizey = " << theClusterParam.theCluster->sizeY() + << " Edgex = " << theClusterParam.edgeTypeX_ + << " Edgey = " << theClusterParam.edgeTypeY_ + << " ErrX = " << xerr << " ErrY = " << yerr; } } // else @@ -617,12 +581,6 @@ PixelCPEClusterRepair::localError(DetParam const & theDetParam, ClusterParam & throw cms::Exception("PixelCPEClusterRepair::localError") << "\nERROR: Negative pixel error yerr = " << yerr << "\n\n"; - //cout << "Final errors set to: " << endl; - //cout << "xerr = " << xerr << endl; - //cout << "yerr = " << yerr << endl; - //cout << "Out of PixelCPETemplateREco..........................................................................." << endl; - //cout << endl; - return LocalError(xerr*xerr, 0, yerr*yerr); } diff --git a/RecoLocalTracker/SiPixelRecHits/src/SealModules.cc b/RecoLocalTracker/SiPixelRecHits/src/SealModules.cc index 1b5cca57b9cc5..011ae0a1448be 100644 --- a/RecoLocalTracker/SiPixelRecHits/src/SealModules.cc +++ b/RecoLocalTracker/SiPixelRecHits/src/SealModules.cc @@ -8,6 +8,7 @@ //--- The CPE ES Producers #include "RecoLocalTracker/SiPixelRecHits/interface/PixelCPEGenericESProducer.h" #include "RecoLocalTracker/SiPixelRecHits/interface/PixelCPETemplateRecoESProducer.h" +#include "RecoLocalTracker/SiPixelRecHits/interface/PixelCPEClusterRepairESProducer.h" //---- The RecHit ED producer #include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelRecHitConverter.h" //--- The header files for the Framework infrastructure (macros etc): diff --git a/RecoLocalTracker/SiPixelRecHits/src/SiPixelTemplate.cc b/RecoLocalTracker/SiPixelRecHits/src/SiPixelTemplate.cc index 0093487ae22a8..f3250de59c184 100755 --- a/RecoLocalTracker/SiPixelRecHits/src/SiPixelTemplate.cc +++ b/RecoLocalTracker/SiPixelRecHits/src/SiPixelTemplate.cc @@ -1497,10 +1497,9 @@ bool SiPixelTemplate::interpolate(int id, float cotalpha, float cotbeta) // Interpolate for a new set of track angles // Local variables - float locBx, locBz; - locBx = 1.f; + float locBx = 1.f; if(cotbeta < 0.f) {locBx = -1.f;} - locBz = locBx; + float locBz = locBx; if(cotalpha < 0.f) {locBz = -locBx;} return SiPixelTemplate::interpolate(id, cotalpha, cotbeta, locBz, locBx); } @@ -1519,8 +1518,7 @@ bool SiPixelTemplate::interpolate(int id, float cotalpha, float cotbeta, float l // Interpolate for a new set of track angles // Local variables - float locBx; - locBx = 1.f; + float locBx = 1.f; return SiPixelTemplate::interpolate(id, cotalpha, cotbeta, locBz, locBx); } diff --git a/RecoTracker/TransientTrackingRecHit/python/TTRHBuilderWithTemplate_cfi.py b/RecoTracker/TransientTrackingRecHit/python/TTRHBuilderWithTemplate_cfi.py index e1a8a101b1172..279da559a27e4 100644 --- a/RecoTracker/TransientTrackingRecHit/python/TTRHBuilderWithTemplate_cfi.py +++ b/RecoTracker/TransientTrackingRecHit/python/TTRHBuilderWithTemplate_cfi.py @@ -11,3 +11,6 @@ from Configuration.Eras.Modifier_trackingPhase2PU140_cff import trackingPhase2PU140 trackingPhase2PU140.toModify(TTRHBuilderAngleAndTemplate, Phase2StripCPE = cms.string('Phase2StripCPE')) +from Configuration.Eras.Modifier_phase1Pixel_cff import phase1Pixel +phase1Pixel.toModify(TTRHBuilderAngleAndTemplate, PixelCPE = cms.string('PixelCPEClusterRepair')) + diff --git a/RecoTracker/TransientTrackingRecHit/python/TTRHBuilders_cff.py b/RecoTracker/TransientTrackingRecHit/python/TTRHBuilders_cff.py index 3bbbf9556f0e0..a25ae463c7bbf 100644 --- a/RecoTracker/TransientTrackingRecHit/python/TTRHBuilders_cff.py +++ b/RecoTracker/TransientTrackingRecHit/python/TTRHBuilders_cff.py @@ -8,5 +8,6 @@ from RecoTracker.TkSeedingLayers.TTRHBuilderWithoutAngle4PixelTriplets_cfi import * #TransientTRH builder with template from RecoLocalTracker.SiPixelRecHits.PixelCPETemplateReco_cfi import * +from RecoLocalTracker.SiPixelRecHits.PixelCPEClusterRepair_cfi import * from RecoTracker.TransientTrackingRecHit.TTRHBuilderWithTemplate_cfi import * From ffa536bd664bce7017727932878cc1d07adb1719 Mon Sep 17 00:00:00 2001 From: Pieter David Date: Fri, 9 Mar 2018 13:55:35 +0100 Subject: [PATCH 074/426] Remove StripCPEfromTemplate --- .../interface/SiStripTemplate.h | 409 ---- .../interface/SiStripTemplateDefs.h | 31 - .../interface/SiStripTemplateReco.h | 40 - .../interface/SiStripTemplateSplit.h | 47 - .../interface/StripCPEfromTemplate.h | 53 - .../plugins/StripCPEESProducer.cc | 6 - .../plugins/StripCPEESProducer.h | 2 +- .../python/StripCPEfromTemplate_cfi.py | 13 - .../src/SiStripTemplate.cc | 1763 ---------------- .../src/SiStripTemplateReco.cc | 514 ----- .../src/SiStripTemplateSplit.cc | 447 ---- .../src/StripCPEfromTemplate.cc | 234 --- .../src/TrackClusterSplitter.cc | 1858 ----------------- .../test/run_simsplit.py | 181 -- .../test/run_simsplit_runI.py | 215 -- .../SubCollectionProducers/test/run_split.py | 193 -- .../test/run_split_runI.py | 222 -- 17 files changed, 1 insertion(+), 6227 deletions(-) delete mode 100644 RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplate.h delete mode 100644 RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplateDefs.h delete mode 100644 RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplateReco.h delete mode 100644 RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplateSplit.h delete mode 100644 RecoLocalTracker/SiStripRecHitConverter/interface/StripCPEfromTemplate.h delete mode 100644 RecoLocalTracker/SiStripRecHitConverter/python/StripCPEfromTemplate_cfi.py delete mode 100644 RecoLocalTracker/SiStripRecHitConverter/src/SiStripTemplate.cc delete mode 100644 RecoLocalTracker/SiStripRecHitConverter/src/SiStripTemplateReco.cc delete mode 100644 RecoLocalTracker/SiStripRecHitConverter/src/SiStripTemplateSplit.cc delete mode 100644 RecoLocalTracker/SiStripRecHitConverter/src/StripCPEfromTemplate.cc delete mode 100644 RecoLocalTracker/SubCollectionProducers/src/TrackClusterSplitter.cc delete mode 100644 RecoLocalTracker/SubCollectionProducers/test/run_simsplit.py delete mode 100644 RecoLocalTracker/SubCollectionProducers/test/run_simsplit_runI.py delete mode 100644 RecoLocalTracker/SubCollectionProducers/test/run_split.py delete mode 100644 RecoLocalTracker/SubCollectionProducers/test/run_split_runI.py diff --git a/RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplate.h b/RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplate.h deleted file mode 100644 index da6544f752075..0000000000000 --- a/RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplate.h +++ /dev/null @@ -1,409 +0,0 @@ -// -// SiStripTemplate.h (v2.10) [v1.0 based on SiPixelTemplate v8.20] -// -// V1.05 - add VI optimizations from pixel template object -// V1.06 - increase angular acceptance (and structure size) -// V2.00 - add barycenter interpolation and getters, fix calculation for charge deposition to accommodate cota-offsets in the central cotb entries. -// V2.01 - fix problem with number of spare entries -// V2.10 - modify methods for cluster splitting to improve speed -// -// Created by Morris Swartz on 10/11/10. -// -// - -// Build the template storage structure from several pieces - -#ifndef SiStripTemplate_h -#define SiStripTemplate_h 1 - -#include "SiStripTemplateDefs.h" - -#include -#include -#include "boost/multi_array.hpp" - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE -#include "CondFormats/SiPixelObjects/interface/SiPixelTemplateDBObject.h" -#include "FWCore/Utilities/interface/Exception.h" -#endif - -struct SiStripTemplateEntry { //!< Basic template entry corresponding to a single set of track angles - int runnum; //!< number of stripav run used to generate this entry - float alpha; //!< alpha track angle (defined in CMS CMS IN 2004/014) - float cotalpha; //!< cot(alpha) is proportional to cluster length in x and is basis of interpolation - float beta; //!< beta track angle (defined in CMS CMS IN 2004/014) - float cotbeta; //!< cot(beta) is proportional to cluster length in y and is basis of interpolation - float costrk[3]; //!< direction cosines of tracks used to generate this entry - float qavg; //!< average cluster charge for this set of track angles (now includes threshold effects) - float sxmax; //!< average strip signal for x-projection of cluster - float dxone; //!< mean offset/correction for one strip x-clusters - float sxone; //!< rms for one strip x-clusters - float qmin; //!< minimum cluster charge for valid hit (keeps 99.9% of simulated hits) - float qmin2; //!< tighter minimum cluster charge for valid hit (keeps 99.8% of simulated hits) - float clslenx; //!< cluster x-length in strips at signal height sxmax/2 - float mpvvav; //!< most probable charge in Vavilov distribution (not actually for larger kappa) - float sigmavav; //!< "sigma" scale fctor for Vavilov distribution - float kappavav; //!< kappa parameter for Vavilov distribution - float mpvvav2; //!< most probable charge in Vavilov distribution for 2 merged clusters (not actually for larger kappa) - float sigmavav2; //!< "sigma" scale fctor for Vavilov distribution for 2 merged clusters - float kappavav2; //!< kappa parameter for Vavilov distribution for 2 merged clusters - float xpar[2][5]; //!< projected x-strip uncertainty parameterization - float xtemp[9][TSXSIZE]; //!< templates for x-reconstruction (binned over 1 central strip) - float xavg[4]; //!< average x-bias of reconstruction binned in 4 charge bins - float xrms[4]; //!< average x-rms of reconstruction binned in 4 charge bins - float xgx0[4]; //!< average x0 from Gaussian fit binned in 4 charge bins - float xgsig[4]; //!< average sigma_x from Gaussian fit binned in 4 charge bins - float xflpar[4][6]; //!< Aqfl-parameterized x-correction in 4 charge bins - float chi2xavg[4]; //!< average x chi^2 in 4 charge bins - float chi2xmin[4]; //!< minimum of x chi^2 in 4 charge bins - float chi2xavgone; //!< average x chi^2 for 1 strip clusters - float chi2xminone; //!< minimum of x chi^2 for 1 strip clusters - float xavgc2m[4]; //!< 1st pass chi2 min search: average x-bias of reconstruction binned in 4 charge bins - float xrmsc2m[4]; //!< 1st pass chi2 min search: average x-rms of reconstruction binned in 4 charge bins - float xgx0c2m[4]; //!< 1st pass chi2 min search: average x0 from Gaussian fit binned in 4 charge bins - float xgsigc2m[4]; //!< 1st pass chi2 min search: average sigma_x from Gaussian fit binned in 4 charge bins - float chi2xavgc2m[4]; //!< 1st pass chi2 min search: average x chi^2 in 4 charge bins (merged clusters) - float chi2xminc2m[4]; //!< 1st pass chi2 min search: minimum of x chi^2 in 4 charge bins (merged clusters) - float xavggen[4]; //!< generic algorithm: average x-bias of reconstruction binned in 4 charge bins - float xrmsgen[4]; //!< generic algorithm: average x-rms of reconstruction binned in 4 charge bins - float xgx0gen[4]; //!< generic algorithm: average x0 from Gaussian fit binned in 4 charge bins - float xgsiggen[4]; //!< generic algorithm: average sigma_x from Gaussian fit binned in 4 charge bins - float xavgbcn[4]; //!< barycenter: average x-bias of reconstruction binned in 4 charge bins - float xrmsbcn[4]; //!< barycenter: average x-rms of reconstruction binned in 4 charge bins - float xgx0bcn[4]; //!< barycenter: average x0 from Gaussian fit binned in 4 charge bins - float xgsigbcn[4]; //!< barycenter: average sigma_x from Gaussian fit binned in 4 charge bins - float qbfrac[3]; //!< fraction of sample in qbin = 0-2 (>=3 is the complement) - float fracxone; //!< fraction of sample with xsize = 1 - float qavg_avg; //!< average cluster charge of clusters that are less than qavg (normalize 2-D simple templates) - float qavg_spare; //!< spare cluster charge - float spare[7]; -} ; - - - - -struct SiStripTemplateHeader { //!< template header structure - char title[80]; //!< template title - int ID; //!< template ID number - int templ_version; //!< Version number of the template to ensure code compatibility - float Bfield; //!< Bfield in Tesla - int NTy; //!< number of Template y entries - int NTyx; //!< number of Template y-slices of x entries - int NTxx; //!< number of Template x-entries in each slice - int Dtype; //!< detector type (0=BPix, 1=FPix) - float Vbias; //!< detector bias potential in Volts - float temperature; //!< detector temperature in deg K - float fluence; //!< radiation fluence in n_eq/cm^2 - float qscale; //!< Charge scaling to match cmssw and stripav - float s50; //!< 1/2 of the readout threshold in ADC units - float lorywidth; //!< estimate of y-lorentz width from single strip offset - float lorxwidth; //!< estimate of x-lorentz width from single strip offset - float xsize; //!< strip size (for future use in upgraded geometry) - float ysize; //!< strip size (for future use in upgraded geometry) - float zsize; //!< strip size (for future use in upgraded geometry) -} ; - - - -struct SiStripTemplateStore { //!< template storage structure - SiStripTemplateHeader head; -#ifndef SI_STRIP_TEMPLATE_USE_BOOST - SiStripTemplateEntry enty[31]; //!< 60 Barrel y templates spanning cluster lengths from 0px to +18px [28 entries for fstrp] - SiStripTemplateEntry entx[5][73]; //!< 29 Barrel x templates spanning cluster lengths from -6px (-1.125Rad) to +6px (+1.125Rad) in each of 5 slices [3x29 for fstrp] -#else - boost::multi_array enty; //!< use 1d entry to store [60] barrel entries or [28] fstrp entries - boost::multi_array entx; //!< use 2d entry to store [5][29] barrel entries or [3][29] fstrp entries -#endif -} ; - - -// ****************************************************************************************** -//! \class SiStripTemplate -//! -//! A template management class. SiStripTemplate contains theStripTemp -//! (a std::vector of SiStripTemplateStore, each of which is a collection of many -//! SiStripTemplateEntries). Each SiStripTemplateStore corresponds to a given detector -//! condition, and is valid for a range of runs. We allow more than one Store since the -//! may change over time. -//! -//! This class reads templates from files via pushfile() method. -//! -//! The main functionality of SiStripTemplate is interpolate(), which produces a template -//! on the fly, given a specific track's alpha and beta. The results are kept in data -//! members and accessed via inline getters. -//! -//! The resulting template is then used by StripTempReco2D() (a global function) which -//! get the reference for SiStripTemplate & templ and uses the current template to -//! reconstruct the SiStripRecHit. -// ****************************************************************************************** -class SiStripTemplate { - public: - SiStripTemplate(const std::vector< SiStripTemplateStore > & theStripTemp) : theStripTemp_(theStripTemp) {id_current_ = -1; index_id_ = -1; cota_current_ = 0.; cotb_current_ = 0.;} //!< Default constructor - static bool pushfile(int filenum, std::vector< SiStripTemplateStore > & theStripTemp_); // load the private store with info from the - // file with the index (int) filenum - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - static bool pushfile(const SiPixelTemplateDBObject& dbobject, std::vector< SiStripTemplateStore > & theStripTemp_); // load the private store with info from db -#endif - - -// Interpolate input alpha and beta angles to produce a working template for each individual hit. - bool interpolate(int id, float cotalpha, float cotbeta, float locBy); - -// overload for compatibility. - bool interpolate(int id, float cotalpha, float cotbeta); - -// retreive interpolated templates. - void xtemp(int fxbin, int lxbin, float xtemplate[41][BSXSIZE]); - -// interpolate a scaled cluster shape. - void sxtemp(float xhit, std::vector& cluster); - -//Method to estimate the central strip of the interpolated x-template - int cxtemp(); - -// new methods to build templates from two interpolated clusters (for splitting) - void xtemp3d_int(int nxpix, int& nxbins); - - void xtemp3d(int j, int k, std::vector& xtemplate); - -// Convert vector of projected signals into uncertainties for fitting. - void xsigma2(int fxstrp, int lxstrp, float sxthr, float xsum[BSXSIZE], float xsig2[BSXSIZE]); - -// Interpolate qfl correction in x. - float xflcorr(int binq, float qflx); - -// Interpolate input beta angle to estimate the average charge. return qbin flag for input cluster charge. - int qbin(int id, float cotalpha, float cotbeta, float qclus); - -//Method to interpolate Vavilov distribution parameters - void vavilov_pars(double& mpv, double& sigma, double& kappa); - -//Method to interpolate Vavilov distribution parameters for merged clusters - void vavilov2_pars(double& mpv, double& sigma, double& kappa); - - - float qavg() {return qavg_;} //!< average cluster charge for this set of track angles - float qscale() {return qscale_;} //!< charge scaling factor - float s50() {return s50_;} //!< 1/2 of the strip threshold signal in electrons - float sxmax() {return sxmax_;} //!< average strip signal for x-projection of cluster - float dxone() {return dxone_;} //!< mean offset/correction for one strip x-clusters - float sxone() {return sxone_;} //!< rms for one strip x-clusters - float qmin() {return qmin_;} //!< minimum cluster charge for valid hit (keeps 99.9% of simulated hits) - float qmin(int i) { -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 1) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::qmin called with illegal index = " << i << std::endl;} -#else - assert(i>=0 && i<2); -#endif - if(i==0){return qmin_;}else{return qmin2_;}} //!< minimum cluster charge for valid hit (keeps 99.9% or 99.8% of simulated hits) - float clslenx() {return clslenx_;} //!< x-size of smaller interpolated template in strips - float yratio() {return yratio_;} //!< fractional distance in y between cotbeta templates - float yxratio() {return yxratio_;} //!< fractional distance in y between cotalpha templates slices - float xxratio() {return xxratio_;} //!< fractional distance in x between cotalpha templates - float xavg(int i) { -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xavg called with illegal index = " << i << std::endl;} -#else - assert(i>=0 && i<4); -#endif - return xavg_[i];} //!< average x-bias of reconstruction binned in 4 charge bins - float xrms(int i) { -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xrms called with illegal index = " << i << std::endl;} -#else - assert(i>=0 && i<4); -#endif - return xrms_[i];} //!< average x-rms of reconstruction binned in 4 charge bins - float xgx0(int i) { -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xgx0 called with illegal index = " << i << std::endl;} -#else - assert(i>=0 && i<4); -#endif - return xgx0_[i];} //!< average x0 from Gaussian fit binned in 4 charge bins - float xgsig(int i) { -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xgsig called with illegal index = " << i << std::endl;} -#else - assert(i>=0 && i<4); -#endif - return xgsig_[i];} //!< average sigma_x from Gaussian fit binned in 4 charge bins - float chi2xavg(int i) { -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::chi2xavg called with illegal index = " << i << std::endl;} -#else - assert(i>=0 && i<4); -#endif - return chi2xavg_[i];} //!< averaage x chi^2 in 4 charge bins - float chi2xmin(int i) { -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::chi2xmin called with illegal index = " << i << std::endl;} -#else - assert(i>=0 && i<4); -#endif - return chi2xmin_[i];} //!< minimum y chi^2 in 4 charge bins - float xavgc2m(int i) { -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xavgc2m called with illegal index = " << i << std::endl;} -#else - assert(i>=0 && i<4); -#endif - return xavgc2m_[i];} //!< 1st pass chi2 min search: average x-bias of reconstruction binned in 4 charge bins - float xrmsc2m(int i) { -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xrmsc2m called with illegal index = " << i << std::endl;} -#else - assert(i>=0 && i<4); -#endif - return xrmsc2m_[i];} //!< 1st pass chi2 min search: average x-rms of reconstruction binned in 4 charge bins - float xgx0c2m(int i) { -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xgx0cm2 called with illegal index = " << i << std::endl;} -#else - assert(i>=0 && i<4); -#endif - return xgx0c2m_[i];} //!< 1st pass chi2 min search: average x0 from Gaussian fit binned in 4 charge bins - float xgsigc2m(int i) { -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xgsigc2m called with illegal index = " << i << std::endl;} -#else - assert(i>=0 && i<4); -#endif - return xgsigc2m_[i];} //!< 1st pass chi2 min search: average sigma_x from Gaussian fit binned in 4 charge bins - float chi2xavgc2m(int i) { -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiPixelTemplate::chi2xavgc2m called with illegal index = " << i << std::endl;} -#else - assert(i>=0 && i<4); -#endif - return chi2xavgc2m_[i];} //!< 1st pass chi2 min search: average x-chisq for merged clusters - float chi2xminc2m(int i) { -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiPixelTemplate::chi2xminc2m called with illegal index = " << i << std::endl;} -#else - assert(i>=0 && i<4); -#endif - return chi2xminc2m_[i];} //!< 1st pass chi2 min search: minimum x-chisq for merged clusters - float xavgbcn(int i) { -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xavgbcn called with illegal index = " << i << std::endl;} -#else - assert(i>=0 && i<4); -#endif - return xavgbcn_[i];} //!< 1st pass chi2 min search: average x-bias of reconstruction binned in 4 charge bins - float xrmsbcn(int i) { -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xrmsbcn called with illegal index = " << i << std::endl;} -#else - assert(i>=0 && i<4); -#endif - return xrmsbcn_[i];} //!< 1st pass chi2 min search: average x-rms of reconstruction binned in 4 charge bins - float xgx0bcn(int i) { -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xgx0cm2 called with illegal index = " << i << std::endl;} -#else - assert(i>=0 && i<4); -#endif - return xgx0bcn_[i];} //!< 1st pass chi2 min search: average x0 from Gaussian fit binned in 4 charge bins - float xgsigbcn(int i) { -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xgsigbcn called with illegal index = " << i << std::endl;} -#else - assert(i>=0 && i<4); -#endif - return xgsigbcn_[i];} //!< 1st pass chi2 min search: average sigma_x from Gaussian fit binned in 4 charge bins - float chi2xavgone() {return chi2xavgone_;} //!< //!< average x chi^2 for 1 strip clusters - float chi2xminone() {return chi2xminone_;} //!< //!< minimum of x chi^2 for 1 strip clusters - float lorxwidth() {return lorxwidth_;} //!< signed lorentz x-width (microns) - float mpvvav() {return mpvvav_;} //!< most probable charge in Vavilov distribution (not actually for larger kappa) - float sigmavav() {return sigmavav_;} //!< "sigma" scale fctor for Vavilov distribution - float kappavav() {return kappavav_;} //!< kappa parameter for Vavilov distribution - float xsize() {return xsize_;} //!< strip x-size (microns) - float ysize() {return ysize_;} //!< strip y-size (microns) - float zsize() {return zsize_;} //!< strip z-size or thickness (microns) -// float yspare(int i) {assert(i>=0 && i<5); return pyspare[i];} //!< vector of 5 spares interpolated in beta only -// float xspare(int i) {assert(i>=0 && i<10); return pxspare[i];} //!< vector of 10 spares interpolated in alpha and beta - - - private: - - // Keep current template interpolaion parameters - - int id_current_; //!< current id - int index_id_; //!< current index - float cota_current_; //!< current cot alpha - float cotb_current_; //!< current cot beta - float abs_cotb_; //!< absolute value of cot beta - bool success_; //!< true if cotalpha, cotbeta are inside of the acceptance (dynamically loaded) - - - // Keep results of last interpolation to return through member functions - - float qavg_; //!< average cluster charge for this set of track angles - float pixmax_; //!< maximum strip charge - float qscale_; //!< charge scaling factor - float s50_; //!< 1/2 of the strip threshold signal in adc units - float sxmax_; //!< average strip signal for x-projection of cluster - float sxparmax_; //!< maximum strip signal for parameterization of x uncertainties - float syparmax_; //!< maximum strip signal for parameterization of y-slice x uncertainties - float dxone_; //!< mean offset/correction for one strip x-clusters - float sxone_; //!< rms for one strip x-clusters - float dxtwo_; //!< mean offset/correction for one double-strip x-clusters - float sxtwo_; //!< rms for one double-strip x-clusters - float qmin_; //!< minimum cluster charge for valid hit (keeps 99.9% of simulated hits) - float clslenx_; //!< x-cluster length of smaller interpolated template in strips - float xparly0_[2][5]; //!< projected x-strip uncertainty parameterization for smaller cotbeta (central alpha) - float xparhy0_[2][5]; //!< projected x-strip uncertainty parameterization for larger cotbeta (central alpha) - float yratio_; //!< fractional distance in y between y-slices of cotbeta templates - float yxratio_; //!< fractional distance in y between x-slices of cotalpha templates - float xxratio_; //!< fractional distance in x between cotalpha templates - float xpar0_[2][5]; //!< projected x-strip uncertainty parameterization for central cotalpha - float xparl_[2][5]; //!< projected x-strip uncertainty parameterization for smaller cotalpha - float xparh_[2][5]; //!< projected x-strip uncertainty parameterization for larger cotalpha - float xtemp_[9][BSXSIZE]; //!< templates for x-reconstruction (binned over 5 central strips) - float xavg_[4]; //!< average x-bias of reconstruction binned in 4 charge bins - float xrms_[4]; //!< average x-rms of reconstruction binned in 4 charge bins - float xgx0_[4]; //!< average x0 from Gaussian fit binned in 4 charge bins - float xgsig_[4]; //!< sigma from Gaussian fit binned in 4 charge bins - float xflparll_[4][6]; //!< Aqfl-parameterized x-correction in 4 charge bins for smaller cotbeta, cotalpha - float xflparlh_[4][6]; //!< Aqfl-parameterized x-correction in 4 charge bins for smaller cotbeta, larger cotalpha - float xflparhl_[4][6]; //!< Aqfl-parameterized x-correction in 4 charge bins for larger cotbeta, smaller cotalpha - float xflparhh_[4][6]; //!< Aqfl-parameterized x-correction in 4 charge bins for larger cotbeta, cotalpha - float xavgc2m_[4]; //!< 1st pass chi2 min search: average x-bias of reconstruction binned in 4 charge bins - float xrmsc2m_[4]; //!< 1st pass chi2 min search: average x-rms of reconstruction binned in 4 charge bins - float xgx0c2m_[4]; //!< 1st pass chi2 min search: average x-bias of reconstruction binned in 4 charge bins - float xgsigc2m_[4]; //!< 1st pass chi2 min search: average x-rms of reconstruction binned in 4 charge bins - float chi2xavg_[4]; //!< average x chi^2 in 4 charge bins - float chi2xmin_[4]; //!< minimum of x chi^2 in 4 charge bins - float chi2xavgc2m_[4]; //!< 1st pass chi2 min search: average x-chisq for merged clusters - float chi2xminc2m_[4]; //!< 1st pass chi2 min search: minimum x-chisq for merged clusters - float xavgbcn_[4]; //!< barycenter: average x-bias of reconstruction binned in 4 charge bins - float xrmsbcn_[4]; //!< barycenter: average x-rms of reconstruction binned in 4 charge bins - float xgx0bcn_[4]; //!< barycenter: average x-bias of reconstruction binned in 4 charge bins - float xgsigbcn_[4]; //!< barycenter: average x-rms of reconstruction binned in 4 charge bins - float chi2xavgone_; //!< average x chi^2 for 1 strip clusters - float chi2xminone_; //!< minimum of x chi^2 for 1 strip clusters - float qmin2_; //!< tighter minimum cluster charge for valid hit (keeps 99.8% of simulated hits) - float mpvvav_; //!< most probable charge in Vavilov distribution (not actually for larger kappa) - float sigmavav_; //!< "sigma" scale fctor for Vavilov distribution - float kappavav_; //!< kappa parameter for Vavilov distribution - float mpvvav2_; //!< most probable charge in 2-cluster Vavilov distribution (not actually for larger kappa) - float sigmavav2_; //!< "sigma" scale fctor for 2-cluster Vavilov distribution - float kappavav2_; //!< kappa parameter for 2-cluster Vavilov distribution - float lorxwidth_; //!< Lorentz x-width - float xsize_; //!< Pixel x-size - float ysize_; //!< Pixel y-size - float zsize_; //!< Pixel z-size (thickness) - float qavg_avg_; //!< average of cluster charge less than qavg - float nxbins_; //!< number of bins in each dimension of the x-splitting template - boost::multi_array temp2dx_; //!< 2d-primitive for spltting 3-d template - - - // The actual template store is a std::vector container - - const std::vector< SiStripTemplateStore > & theStripTemp_; -} ; - - -#endif diff --git a/RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplateDefs.h b/RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplateDefs.h deleted file mode 100644 index eaaa60e523d4d..0000000000000 --- a/RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplateDefs.h +++ /dev/null @@ -1,31 +0,0 @@ -// -// SiStripTemplateDefs.h (v2.1) -// -// V2.0 - Expand the x dimensions to accommodate strip clusters to size 10.8 -// V2.1 - Change to strip specific names and remove un-necessary definitions -// -// Created by Morris Swartz on 10/11/10. -// 2010 __TheJohnsHopkinsUniversity__. -// -// - -// Define template buffer size parameters - -#ifndef SiStripTemplateDefs_h -#define SiStripTemplateDefs_h 1 - -// Switch to use boost multiarrays to store the template entries (instead of plain c arrays). -// It adds real time re-sizing and bounds checking at a cost in time (10%?). - -//#define SI_STRIP_TEMPLATE_USE_BOOST 1 - -#define TSXSIZE 17 -#define TSHX 8 // = TSXSIZE/2 -#define TSHXP1 TSHX+1 -#define BSXSIZE TSXSIZE+4 -#define BSHX 10 // = BSXSIZE/2 -#define BSXM1 TSXSIZE+3 -#define BSXM2 TSXSIZE+2 -#define BSXM3 TSXSIZE+1 - -#endif diff --git a/RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplateReco.h b/RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplateReco.h deleted file mode 100644 index 335ee14792772..0000000000000 --- a/RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplateReco.h +++ /dev/null @@ -1,40 +0,0 @@ -// -// SiStripTemplateReco.h Version 2.01 (V1.00 based on SiPixelTemplateReco Version 8.20) -// -// V1.05 - add VI optimizations from pixel reco -// V1.07 - Improve cluster centering -// V2.00 - Change to chi2min estimator and choose barycenter when errors/bias are large -// - Increase buffer size to avoid truncation -// - Change pseudo-strip weighting to accommodate asymmetric clusters (deco mode) -// - Remove obsolete sorting of signal for weighting (truncation makes it worthless) -// V2.01 - Add barycenter bias correction -// -// -// -// Created by Morris Swartz on 10/27/06. -// -// - -#ifndef SiStripTemplateReco_h -#define SiStripTemplateReco_h 1 - -#include "SiStripTemplateDefs.h" - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE -#include "RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplate.h" -#else -#include "SiStripTemplate.h" -#endif - -#include - - -namespace SiStripTemplateReco - { - - int StripTempReco1D(int id, float cotalpha, float cotbeta, float locBy, std::vector& cluster, - SiStripTemplate& templ, float& xrec, float& sigmax, float& probx, int& qbin, int speed, float& probQ); - - } - -#endif diff --git a/RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplateSplit.h b/RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplateSplit.h deleted file mode 100644 index 8d956e01d0a01..0000000000000 --- a/RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplateSplit.h +++ /dev/null @@ -1,47 +0,0 @@ -// -// SiStripTemplateSplit.h -// -// Procedure to fit two templates (same angle hypotheses) to a single cluster -// -// Version 1.00 [based on SiPixelTemplateSplit.cc Version 2.30] -// Version 1.01 [improve error estimation for qbin=3 events] -// Version 1.05 [Incorporate VI-like speed improvements] -// Version 1.06 Clean-up irrelevant (since truncation) sorting -// Version 2.10 Clone speed improvements from the pixels (eliminate 3-d multi-arays, improve seach algorithm) -// -// Created by Morris Swartz on 04/10/08. -// -// - -#ifndef SiStripTemplateSplit_h -#define SiStripTemplateSplit_h 1 - -#include "SiStripTemplateDefs.h" - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE -#include "RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplate.h" -#else -#include "SiStripTemplate.h" -#endif - -#include -#include "boost/multi_array.hpp" - - - -namespace SiStripTemplateSplit - { - - - int StripTempSplit(int id, float cotalpha, float cotbeta, float locBy, int speed, std::vector& cluster, - SiStripTemplate& templ, - float& xrec1, float& xrec2, float& sigmax, float& prob2x, int& q2bin, float& prob2Q); - - - int StripTempSplit(int id, float cotalpha, float cotbeta, float locBy, std::vector& cluster, - SiStripTemplate& templ, - float& xrec1, float& xrec2, float& sigmax, float& prob2x, int& q2bin, float& prob2Q); - -} - -#endif diff --git a/RecoLocalTracker/SiStripRecHitConverter/interface/StripCPEfromTemplate.h b/RecoLocalTracker/SiStripRecHitConverter/interface/StripCPEfromTemplate.h deleted file mode 100644 index d1c6a577f877d..0000000000000 --- a/RecoLocalTracker/SiStripRecHitConverter/interface/StripCPEfromTemplate.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef RecoLocalTracker_SiStripRecHitConverter_StripCPEfromTemplate_H -#define RecoLocalTracker_SiStripRecHitConverter_StripCPEfromTemplate_H - -#include "RecoLocalTracker/SiStripRecHitConverter/interface/StripCPE.h" - -#include "RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplate.h" -#include "RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplateReco.h" - - -class StripCPEfromTemplate : public StripCPE -{ - - public: - - using StripCPE::localParameters; - - StripClusterParameterEstimator::LocalValues - localParameters( const SiStripCluster&, const GeomDetUnit&, const LocalTrajectoryParameters&) const override; - - StripCPEfromTemplate( edm::ParameterSet & conf, - const MagneticField& mag, - const TrackerGeometry& geom, - const SiStripLorentzAngle& lorentz, - const SiStripBackPlaneCorrection& backplaneCorrections, - const SiStripConfObject& confObj, - const SiStripLatency& latency) - : StripCPE(conf, mag, geom, lorentz, backplaneCorrections, confObj, latency ), - use_template_reco( conf.getParameter("UseTemplateReco") ), - template_reco_speed( conf.getParameter("TemplateRecoSpeed") ), - use_strip_split_cluster_errors( conf.getParameter("UseStripSplitClusterErrors") ) - { - SiStripTemplate::pushfile( 11, theStripTemp_ ); - SiStripTemplate::pushfile( 12, theStripTemp_ ); - SiStripTemplate::pushfile( 13, theStripTemp_ ); - SiStripTemplate::pushfile( 14, theStripTemp_ ); - SiStripTemplate::pushfile( 15, theStripTemp_ ); - SiStripTemplate::pushfile( 16, theStripTemp_ ); - - //cout << "STRIPS: (int)use_template_reco = " << (int)use_template_reco << endl; - //cout << "template_reco_speed = " << template_reco_speed << endl; - //cout << "(int)use_strip_split_cluster_errors = " << (int)use_strip_split_cluster_errors << endl; - } - - private: - - std::vector< SiStripTemplateStore > theStripTemp_; - - bool use_template_reco; - int template_reco_speed; - bool use_strip_split_cluster_errors; - -}; -#endif diff --git a/RecoLocalTracker/SiStripRecHitConverter/plugins/StripCPEESProducer.cc b/RecoLocalTracker/SiStripRecHitConverter/plugins/StripCPEESProducer.cc index 3a375659fb928..fc14cda7becc8 100644 --- a/RecoLocalTracker/SiStripRecHitConverter/plugins/StripCPEESProducer.cc +++ b/RecoLocalTracker/SiStripRecHitConverter/plugins/StripCPEESProducer.cc @@ -1,7 +1,6 @@ #include "RecoLocalTracker/SiStripRecHitConverter/plugins/StripCPEESProducer.h" #include "RecoLocalTracker/SiStripRecHitConverter/interface/StripCPE.h" #include "RecoLocalTracker/SiStripRecHitConverter/interface/StripCPEfromTrackAngle.h" -#include "RecoLocalTracker/SiStripRecHitConverter/interface/StripCPEfromTemplate.h" #include "RecoLocalTracker/SiStripRecHitConverter/interface/StripCPEgeometric.h" #include "CondFormats/SiStripObjects/interface/SiStripBackPlaneCorrection.h" #include "CondFormats/SiStripObjects/interface/SiStripConfObject.h" @@ -23,7 +22,6 @@ StripCPEESProducer::StripCPEESProducer(const edm::ParameterSet & p) enumMap[std::string("SimpleStripCPE")]=SIMPLE; enumMap[std::string("StripCPEfromTrackAngle")]=TRACKANGLE; enumMap[std::string("StripCPEgeometric")]=GEOMETRIC; - enumMap[std::string("StripCPEfromTemplate")]=TEMPLATE; if(enumMap.find(type)==enumMap.end()) throw cms::Exception("Unknown StripCPE type") << type; @@ -61,10 +59,6 @@ produce(const TkStripCPERecord & iRecord) cpe = std::make_unique(parametersPSet, *magfield, *pDD, *lorentzAngle, *backPlaneCorrection, *confObj, *latency ); break; - case TEMPLATE: - cpe = std::make_unique( parametersPSet, *magfield, *pDD, *lorentzAngle, *backPlaneCorrection, *confObj, *latency ); - break; - } return cpe; diff --git a/RecoLocalTracker/SiStripRecHitConverter/plugins/StripCPEESProducer.h b/RecoLocalTracker/SiStripRecHitConverter/plugins/StripCPEESProducer.h index 7934ae0ad5169..7ab3a0a9e8b4f 100644 --- a/RecoLocalTracker/SiStripRecHitConverter/plugins/StripCPEESProducer.h +++ b/RecoLocalTracker/SiStripRecHitConverter/plugins/StripCPEESProducer.h @@ -20,7 +20,7 @@ class StripCPEESProducer: public edm::ESProducer { private: - enum CPE_t { SIMPLE, TRACKANGLE, GEOMETRIC, TEMPLATE}; + enum CPE_t { SIMPLE, TRACKANGLE, GEOMETRIC }; std::map enumMap; CPE_t cpeNum; diff --git a/RecoLocalTracker/SiStripRecHitConverter/python/StripCPEfromTemplate_cfi.py b/RecoLocalTracker/SiStripRecHitConverter/python/StripCPEfromTemplate_cfi.py deleted file mode 100644 index c53a9f3e5f83a..0000000000000 --- a/RecoLocalTracker/SiStripRecHitConverter/python/StripCPEfromTemplate_cfi.py +++ /dev/null @@ -1,13 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from RecoLocalTracker.SiStripRecHitConverter.StripCPEESProducer_cfi import * -StripCPEfromTemplateESProducer = stripCPEESProducer.clone() -StripCPEfromTemplateESProducerComponentName = cms.string('StripCPEfromTemplate') -StripCPEfromTemplateESProducer.ComponentType = cms.string('StripCPEfromTemplate') -StripCPEfromTemplateESProducer.parameters = cms.PSet( - UseTemplateReco = cms.bool(False), - TemplateRecoSpeed = cms.int32(0), - UseStripSplitClusterErrors = cms.bool(False) -) - - diff --git a/RecoLocalTracker/SiStripRecHitConverter/src/SiStripTemplate.cc b/RecoLocalTracker/SiStripRecHitConverter/src/SiStripTemplate.cc deleted file mode 100644 index 2b9bc6c65af62..0000000000000 --- a/RecoLocalTracker/SiStripRecHitConverter/src/SiStripTemplate.cc +++ /dev/null @@ -1,1763 +0,0 @@ -// -// SiStripTemplate.cc Version 1.00 (based on SiPixelTemplate v8.20) -// -// V1.05 - add VI optimizations from pixel template object -// V1.06 - increase angular acceptance (and structure size) -// V2.00 - add barycenter interpolation and getters, fix calculation for charge deposition to accommodate cota-offsets in the central cotb entries. -// V2.01 - fix problem with number of spare entries -// - -// Created by Morris Swartz on 2/2/11. -// -// - -//#include -//#include -#ifndef SI_PIXEL_TEMPLATE_STANDALONE -//#include -#else -#include -#endif -#include -#include -//#include "boost/multi_array.hpp" -#include -#include -#include -#include -#include - - - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE -#include "RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplate.h" -#include "FWCore/ParameterSet/interface/FileInPath.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#define LOGERROR(x) LogError(x) -#define LOGINFO(x) LogInfo(x) -#define ENDL " " -#include "FWCore/Utilities/interface/Exception.h" -using namespace edm; -#else -#include "SiStripTemplate.h" -#define LOGERROR(x) std::cout << x << ": " -#define LOGINFO(x) std::cout << x << ": " -#define ENDL std::endl -#endif - -//**************************************************************** -//! This routine initializes the global template structures from -//! an external file template_summary_zpNNNN where NNNN are four -//! digits of filenum. -//! \param filenum - an integer NNNN used in the filename template_summary_zpNNNN -//**************************************************************** -bool SiStripTemplate::pushfile(int filenum, std::vector< SiStripTemplateStore > & theStripTemp_) -{ - // Add template stored in external file numbered filenum to theTemplateStore - - // Local variables - int i, j, k, l; - float qavg_avg; - const char *tempfile; - // char title[80]; remove this - char c; - const int code_version={18}; - - - - // Create a filename for this run - - std::ostringstream tout; - - // Create different path in CMSSW than standalone - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - tout << "CalibTracker/SiPixelESProducers/data/stemplate_summary_p" << std::setw(4) << std::setfill('0') << std::right << filenum << ".out" << std::ends; - std::string tempf = tout.str(); - edm::FileInPath file( tempf.c_str() ); - tempfile = (file.fullPath()).c_str(); -#else - tout << "stemplate_summary_p" << std::setw(4) << std::setfill('0') << std::right << filenum << ".out" << std::ends; - std::string tempf = tout.str(); - tempfile = tempf.c_str(); -#endif - - // open the template file - - std::ifstream in_file(tempfile, std::ios::in); - - if(in_file.is_open()) { - - // Create a local template storage entry - - SiStripTemplateStore theCurrentTemp; - - // Read-in a header string first and print it - - for (i=0; (c=in_file.get()) != '\n'; ++i) { - if(i < 79) {theCurrentTemp.head.title[i] = c;} - } - if(i > 78) {i=78;} - theCurrentTemp.head.title[i+1] ='\0'; - LOGINFO("SiStripTemplate") << "Loading Strip Template File - " << theCurrentTemp.head.title << ENDL; - - // next, the header information - - in_file >> theCurrentTemp.head.ID >> theCurrentTemp.head.templ_version >> theCurrentTemp.head.Bfield >> theCurrentTemp.head.NTy >> theCurrentTemp.head.NTyx >> theCurrentTemp.head.NTxx - >> theCurrentTemp.head.Dtype >> theCurrentTemp.head.Vbias >> theCurrentTemp.head.temperature >> theCurrentTemp.head.fluence >> theCurrentTemp.head.qscale - >> theCurrentTemp.head.s50 >> theCurrentTemp.head.lorywidth >> theCurrentTemp.head.lorxwidth >> theCurrentTemp.head.ysize >> theCurrentTemp.head.xsize >> theCurrentTemp.head.zsize; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file, no template load" << ENDL; return false;} - - LOGINFO("SiStripTemplate") << "Template ID = " << theCurrentTemp.head.ID << ", Template Version " << theCurrentTemp.head.templ_version << ", Bfield = " << theCurrentTemp.head.Bfield - << ", NTy = " << theCurrentTemp.head.NTy << ", NTyx = " << theCurrentTemp.head.NTyx<< ", NTxx = " << theCurrentTemp.head.NTxx << ", Dtype = " << theCurrentTemp.head.Dtype - << ", Bias voltage " << theCurrentTemp.head.Vbias << ", temperature " - << theCurrentTemp.head.temperature << ", fluence " << theCurrentTemp.head.fluence << ", Q-scaling factor " << theCurrentTemp.head.qscale - << ", 1/2 threshold " << theCurrentTemp.head.s50 << ", y Lorentz Width " << theCurrentTemp.head.lorywidth << ", x Lorentz width " << theCurrentTemp.head.lorxwidth - << ", pixel x-size " << theCurrentTemp.head.xsize << ", y-size " << theCurrentTemp.head.ysize << ", zsize " << theCurrentTemp.head.zsize << ENDL; - - if(theCurrentTemp.head.templ_version < code_version) {LOGERROR("SiStripTemplate") << "code expects version " << code_version << ", no template load" << ENDL; return false;} - -#ifdef SI_STRIP_TEMPLATE_USE_BOOST - -// next, layout the 1-d/2-d structures needed to store template - - theCurrentTemp.enty.resize(boost::extents[theCurrentTemp.head.NTy]); - - theCurrentTemp.entx.resize(boost::extents[theCurrentTemp.head.NTyx][theCurrentTemp.head.NTxx]); - -#endif - -// next, loop over all y-angle entries - - for (i=0; i < theCurrentTemp.head.NTy; ++i) { - - in_file >> theCurrentTemp.enty[i].runnum >> theCurrentTemp.enty[i].costrk[0] - >> theCurrentTemp.enty[i].costrk[1] >> theCurrentTemp.enty[i].costrk[2]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 1, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - - // Calculate the alpha, beta, and cot(beta) for this entry - - theCurrentTemp.enty[i].alpha = static_cast(atan2((double)theCurrentTemp.enty[i].costrk[2], (double)theCurrentTemp.enty[i].costrk[0])); - - theCurrentTemp.enty[i].cotalpha = theCurrentTemp.enty[i].costrk[0]/theCurrentTemp.enty[i].costrk[2]; - - theCurrentTemp.enty[i].beta = static_cast(atan2((double)theCurrentTemp.enty[i].costrk[2], (double)theCurrentTemp.enty[i].costrk[1])); - - theCurrentTemp.enty[i].cotbeta = theCurrentTemp.enty[i].costrk[1]/theCurrentTemp.enty[i].costrk[2]; - - in_file >> theCurrentTemp.enty[i].qavg >> theCurrentTemp.enty[i].sxmax >> theCurrentTemp.enty[i].dxone >> theCurrentTemp.enty[i].sxone >> theCurrentTemp.enty[i].qmin >> theCurrentTemp.enty[i].clslenx; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 2, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - for (j=0; j<2; ++j) { - - in_file >> theCurrentTemp.enty[i].xpar[j][0] >> theCurrentTemp.enty[i].xpar[j][1] - >> theCurrentTemp.enty[i].xpar[j][2] >> theCurrentTemp.enty[i].xpar[j][3] >> theCurrentTemp.enty[i].xpar[j][4]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 6, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - - } - - qavg_avg = 0.f; - for (j=0; j<9; ++j) { - - for (k=0; k> theCurrentTemp.enty[i].xtemp[j][k]; qavg_avg += theCurrentTemp.enty[i].xtemp[j][k];} - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 7, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - } - theCurrentTemp.enty[i].qavg_avg = qavg_avg/9.; - - for (j=0; j<4; ++j) { - - in_file >> theCurrentTemp.enty[i].xavg[j] >> theCurrentTemp.enty[i].xrms[j] >> theCurrentTemp.enty[i].xgx0[j] >> theCurrentTemp.enty[i].xgsig[j]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 10, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - in_file >> theCurrentTemp.enty[i].xflpar[j][0] >> theCurrentTemp.enty[i].xflpar[j][1] >> theCurrentTemp.enty[i].xflpar[j][2] - >> theCurrentTemp.enty[i].xflpar[j][3] >> theCurrentTemp.enty[i].xflpar[j][4] >> theCurrentTemp.enty[i].xflpar[j][5]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 11, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - in_file >> theCurrentTemp.enty[i].chi2xavg[j] >> theCurrentTemp.enty[i].chi2xmin[j] >> theCurrentTemp.enty[i].chi2xavgc2m[j] >> theCurrentTemp.enty[i].chi2xminc2m[j]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 12, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - in_file >> theCurrentTemp.enty[i].xavgc2m[j] >> theCurrentTemp.enty[i].xrmsc2m[j] >> theCurrentTemp.enty[i].xgx0c2m[j] >> theCurrentTemp.enty[i].xgsigc2m[j]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 14, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - in_file >> theCurrentTemp.enty[i].xavggen[j] >> theCurrentTemp.enty[i].xrmsgen[j] >> theCurrentTemp.enty[i].xgx0gen[j] >> theCurrentTemp.enty[i].xgsiggen[j]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 14b, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - in_file >> theCurrentTemp.enty[i].xavgbcn[j] >> theCurrentTemp.enty[i].xrmsbcn[j] >> theCurrentTemp.enty[i].xgx0bcn[j] >> theCurrentTemp.enty[i].xgsigbcn[j]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 14c, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - } - - in_file >> theCurrentTemp.enty[i].chi2xavgone >> theCurrentTemp.enty[i].chi2xminone >> theCurrentTemp.enty[i].qmin2 - >> theCurrentTemp.enty[i].mpvvav >> theCurrentTemp.enty[i].sigmavav >> theCurrentTemp.enty[i].kappavav - >> theCurrentTemp.enty[i].mpvvav2 >> theCurrentTemp.enty[i].sigmavav2 >> theCurrentTemp.enty[i].kappavav2 >> theCurrentTemp.enty[i].spare[0]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 15, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - - in_file >> theCurrentTemp.enty[i].qbfrac[0] >> theCurrentTemp.enty[i].qbfrac[1] >> theCurrentTemp.enty[i].qbfrac[2] >> theCurrentTemp.enty[i].fracxone - >> theCurrentTemp.enty[i].spare[1] >> theCurrentTemp.enty[i].spare[2] >> theCurrentTemp.enty[i].spare[3] >> theCurrentTemp.enty[i].spare[4] - >> theCurrentTemp.enty[i].spare[5] >> theCurrentTemp.enty[i].spare[6]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 16, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - - } - - // next, loop over all barrel x-angle entries - - for (k=0; k < theCurrentTemp.head.NTyx; ++k) { - - for (i=0; i < theCurrentTemp.head.NTxx; ++i) { - - in_file >> theCurrentTemp.entx[k][i].runnum >> theCurrentTemp.entx[k][i].costrk[0] - >> theCurrentTemp.entx[k][i].costrk[1] >> theCurrentTemp.entx[k][i].costrk[2]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 17, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - - // Calculate the alpha, beta, and cot(beta) for this entry - - theCurrentTemp.entx[k][i].alpha = static_cast(atan2((double)theCurrentTemp.entx[k][i].costrk[2], (double)theCurrentTemp.entx[k][i].costrk[0])); - - theCurrentTemp.entx[k][i].cotalpha = theCurrentTemp.entx[k][i].costrk[0]/theCurrentTemp.entx[k][i].costrk[2]; - - theCurrentTemp.entx[k][i].beta = static_cast(atan2((double)theCurrentTemp.entx[k][i].costrk[2], (double)theCurrentTemp.entx[k][i].costrk[1])); - - theCurrentTemp.entx[k][i].cotbeta = theCurrentTemp.entx[k][i].costrk[1]/theCurrentTemp.entx[k][i].costrk[2]; - - in_file >> theCurrentTemp.entx[k][i].qavg >> theCurrentTemp.entx[k][i].sxmax >> theCurrentTemp.entx[k][i].dxone >> theCurrentTemp.entx[k][i].sxone >> theCurrentTemp.entx[k][i].qmin >> theCurrentTemp.entx[k][i].clslenx; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 18, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - - for (j=0; j<2; ++j) { - - in_file >> theCurrentTemp.entx[k][i].xpar[j][0] >> theCurrentTemp.entx[k][i].xpar[j][1] - >> theCurrentTemp.entx[k][i].xpar[j][2] >> theCurrentTemp.entx[k][i].xpar[j][3] >> theCurrentTemp.entx[k][i].xpar[j][4]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 19, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - - } - - qavg_avg = 0.f; - for (j=0; j<9; ++j) { - - for (l=0; l> theCurrentTemp.entx[k][i].xtemp[j][l]; qavg_avg += theCurrentTemp.entx[k][i].xtemp[j][l];} - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 20, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - } - theCurrentTemp.entx[k][i].qavg_avg = qavg_avg/9.; - - for (j=0; j<4; ++j) { - - in_file >> theCurrentTemp.entx[k][i].xavg[j] >> theCurrentTemp.entx[k][i].xrms[j] >> theCurrentTemp.entx[k][i].xgx0[j] >> theCurrentTemp.entx[k][i].xgsig[j]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 21, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - in_file >> theCurrentTemp.entx[k][i].xflpar[j][0] >> theCurrentTemp.entx[k][i].xflpar[j][1] >> theCurrentTemp.entx[k][i].xflpar[j][2] - >> theCurrentTemp.entx[k][i].xflpar[j][3] >> theCurrentTemp.entx[k][i].xflpar[j][4] >> theCurrentTemp.entx[k][i].xflpar[j][5]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 22, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - in_file >> theCurrentTemp.entx[k][i].chi2xavg[j] >> theCurrentTemp.entx[k][i].chi2xmin[j] >> theCurrentTemp.entx[k][i].chi2xavgc2m[j] >> theCurrentTemp.entx[k][i].chi2xminc2m[j]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 23, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - in_file >> theCurrentTemp.entx[k][i].xavgc2m[j] >> theCurrentTemp.entx[k][i].xrmsc2m[j] >> theCurrentTemp.entx[k][i].xgx0c2m[j] >> theCurrentTemp.entx[k][i].xgsigc2m[j]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 24, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - in_file >> theCurrentTemp.entx[k][i].xavggen[j] >> theCurrentTemp.entx[k][i].xrmsgen[j] >> theCurrentTemp.entx[k][i].xgx0gen[j] >> theCurrentTemp.entx[k][i].xgsiggen[j]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 25, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - in_file >> theCurrentTemp.entx[k][i].xavgbcn[j] >> theCurrentTemp.entx[k][i].xrmsbcn[j] >> theCurrentTemp.entx[k][i].xgx0bcn[j] >> theCurrentTemp.entx[k][i].xgsigbcn[j]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 26, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - } - - in_file >> theCurrentTemp.entx[k][i].chi2xavgone >> theCurrentTemp.entx[k][i].chi2xminone >> theCurrentTemp.entx[k][i].qmin2 - >> theCurrentTemp.entx[k][i].mpvvav >> theCurrentTemp.entx[k][i].sigmavav >> theCurrentTemp.entx[k][i].kappavav - >> theCurrentTemp.entx[k][i].mpvvav2 >> theCurrentTemp.entx[k][i].sigmavav2 >> theCurrentTemp.entx[k][i].kappavav2 >> theCurrentTemp.entx[k][i].spare[0]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 27, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - - in_file >> theCurrentTemp.entx[k][i].qbfrac[0] >> theCurrentTemp.entx[k][i].qbfrac[1] >> theCurrentTemp.entx[k][i].qbfrac[2] >> theCurrentTemp.entx[k][i].fracxone - >> theCurrentTemp.entx[k][i].spare[1] >> theCurrentTemp.entx[k][i].spare[2] >> theCurrentTemp.entx[k][i].spare[3] >> theCurrentTemp.entx[k][i].spare[4] - >> theCurrentTemp.entx[k][i].spare[5] >> theCurrentTemp.entx[k][i].spare[6]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 28, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - - - } - } - - - in_file.close(); - - // Add this template to the store - - theStripTemp_.push_back(theCurrentTemp); - - return true; - - } else { - - // If file didn't open, report this - - LOGERROR("SiStripTemplate") << "Error opening File " << tempfile << ENDL; - return false; - - } - -} // TempInit - - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - -//**************************************************************** -//! This routine initializes the global template structures from an -//! external file template_summary_zpNNNN where NNNN are four digits -//! \param dbobject - db storing multiple template calibrations -//**************************************************************** -bool SiStripTemplate::pushfile(const SiPixelTemplateDBObject& dbobject, std::vector< SiStripTemplateStore > & theStripTemp_) -{ - // Add template stored in external dbobject to theTemplateStore - - // Local variables - int i, j, k, l; - float qavg_avg; - // const char *tempfile; - const int code_version={17}; - - // We must create a new object because dbobject must be a const and our stream must not be - SiPixelTemplateDBObject db = dbobject; - - // Create a local template storage entry - SiStripTemplateStore theCurrentTemp; - - // Fill the template storage for each template calibration stored in the db - for(int m=0; m> theCurrentTemp.head.ID >> theCurrentTemp.head.templ_version >> theCurrentTemp.head.Bfield >> theCurrentTemp.head.NTy >> theCurrentTemp.head.NTyx >> theCurrentTemp.head.NTxx - >> theCurrentTemp.head.Dtype >> theCurrentTemp.head.Vbias >> theCurrentTemp.head.temperature >> theCurrentTemp.head.fluence >> theCurrentTemp.head.qscale - >> theCurrentTemp.head.s50 >> theCurrentTemp.head.lorywidth >> theCurrentTemp.head.lorxwidth >> theCurrentTemp.head.ysize >> theCurrentTemp.head.xsize >> theCurrentTemp.head.zsize; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file, no template load" << ENDL; return false;} - - LOGINFO("SiStripTemplate") << "Template ID = " << theCurrentTemp.head.ID << ", Template Version " << theCurrentTemp.head.templ_version << ", Bfield = " << theCurrentTemp.head.Bfield - << ", NTy = " << theCurrentTemp.head.NTy << ", NTyx = " << theCurrentTemp.head.NTyx<< ", NTxx = " << theCurrentTemp.head.NTxx << ", Dtype = " << theCurrentTemp.head.Dtype - << ", Bias voltage " << theCurrentTemp.head.Vbias << ", temperature " - << theCurrentTemp.head.temperature << ", fluence " << theCurrentTemp.head.fluence << ", Q-scaling factor " << theCurrentTemp.head.qscale - << ", 1/2 threshold " << theCurrentTemp.head.s50 << ", y Lorentz Width " << theCurrentTemp.head.lorywidth << ", x Lorentz width " << theCurrentTemp.head.lorxwidth - << ", pixel x-size " << theCurrentTemp.head.xsize << ", y-size " << theCurrentTemp.head.ysize << ", zsize " << theCurrentTemp.head.zsize << ENDL; - - if(theCurrentTemp.head.templ_version < code_version) {LOGERROR("SiStripTemplate") << "code expects version " << code_version << ", no template load" << ENDL; return false;} - - -#ifdef SI_PIXEL_TEMPLATE_USE_BOOST - -// next, layout the 1-d/2-d structures needed to store template - - theCurrentTemp.enty.resize(boost::extents[theCurrentTemp.head.NTy]); - - theCurrentTemp.entx.resize(boost::extents[theCurrentTemp.head.NTyx][theCurrentTemp.head.NTxx]); - -#endif - - // next, loop over all y-angle entries - - for (i=0; i < theCurrentTemp.head.NTy; ++i) { - - db >> theCurrentTemp.enty[i].runnum >> theCurrentTemp.enty[i].costrk[0] - >> theCurrentTemp.enty[i].costrk[1] >> theCurrentTemp.enty[i].costrk[2]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 1, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - - // Calculate the alpha, beta, and cot(beta) for this entry - - theCurrentTemp.enty[i].alpha = static_cast(atan2((double)theCurrentTemp.enty[i].costrk[2], (double)theCurrentTemp.enty[i].costrk[0])); - - theCurrentTemp.enty[i].cotalpha = theCurrentTemp.enty[i].costrk[0]/theCurrentTemp.enty[i].costrk[2]; - - theCurrentTemp.enty[i].beta = static_cast(atan2((double)theCurrentTemp.enty[i].costrk[2], (double)theCurrentTemp.enty[i].costrk[1])); - - theCurrentTemp.enty[i].cotbeta = theCurrentTemp.enty[i].costrk[1]/theCurrentTemp.enty[i].costrk[2]; - - db >> theCurrentTemp.enty[i].qavg >> theCurrentTemp.enty[i].sxmax >> theCurrentTemp.enty[i].dxone >> theCurrentTemp.enty[i].sxone >> theCurrentTemp.enty[i].qmin >> theCurrentTemp.enty[i].clslenx; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 2, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - - for (j=0; j<2; ++j) { - - db >> theCurrentTemp.enty[i].xpar[j][0] >> theCurrentTemp.enty[i].xpar[j][1] - >> theCurrentTemp.enty[i].xpar[j][2] >> theCurrentTemp.enty[i].xpar[j][3] >> theCurrentTemp.enty[i].xpar[j][4]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 6, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - - } - - qavg_avg = 0.f; - for (j=0; j<9; ++j) { - - for (k=0; k> theCurrentTemp.enty[i].xtemp[j][k]; qavg_avg += theCurrentTemp.enty[i].xtemp[j][k];} - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 7, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - } - theCurrentTemp.enty[i].qavg_avg = qavg_avg/9.; - - for (j=0; j<4; ++j) { - - db >> theCurrentTemp.enty[i].xavg[j] >> theCurrentTemp.enty[i].xrms[j] >> theCurrentTemp.enty[i].xgx0[j] >> theCurrentTemp.enty[i].xgsig[j]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 10, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - db >> theCurrentTemp.enty[i].xflpar[j][0] >> theCurrentTemp.enty[i].xflpar[j][1] >> theCurrentTemp.enty[i].xflpar[j][2] - >> theCurrentTemp.enty[i].xflpar[j][3] >> theCurrentTemp.enty[i].xflpar[j][4] >> theCurrentTemp.enty[i].xflpar[j][5]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 11, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - db >> theCurrentTemp.enty[i].chi2xavg[j] >> theCurrentTemp.enty[i].chi2xmin[j] >> theCurrentTemp.enty[i].chi2xavgc2m[j] >> theCurrentTemp.enty[i].chi2xminc2m[j]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 12, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - db >> theCurrentTemp.enty[i].xavgc2m[j] >> theCurrentTemp.enty[i].xrmsc2m[j] >> theCurrentTemp.enty[i].xgx0c2m[j] >> theCurrentTemp.enty[i].xgsigc2m[j]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 14, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - db >> theCurrentTemp.enty[i].xavggen[j] >> theCurrentTemp.enty[i].xrmsgen[j] >> theCurrentTemp.enty[i].xgx0gen[j] >> theCurrentTemp.enty[i].xgsiggen[j]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 14b, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - db >> theCurrentTemp.enty[i].xavgbcn[j] >> theCurrentTemp.enty[i].xrmsbcn[j] >> theCurrentTemp.enty[i].xgx0bcn[j] >> theCurrentTemp.enty[i].xgsigbcn[j]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 14c, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - } - - db >> theCurrentTemp.enty[i].chi2xavgone >> theCurrentTemp.enty[i].chi2xminone >> theCurrentTemp.enty[i].qmin2 - >> theCurrentTemp.enty[i].mpvvav >> theCurrentTemp.enty[i].sigmavav >> theCurrentTemp.enty[i].kappavav - >> theCurrentTemp.enty[i].mpvvav2 >> theCurrentTemp.enty[i].sigmavav2 >> theCurrentTemp.enty[i].kappavav2 >> theCurrentTemp.enty[i].spare[0]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 15, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - - db >> theCurrentTemp.enty[i].qbfrac[0] >> theCurrentTemp.enty[i].qbfrac[1] >> theCurrentTemp.enty[i].qbfrac[2] >> theCurrentTemp.enty[i].fracxone - >> theCurrentTemp.enty[i].spare[1] >> theCurrentTemp.enty[i].spare[2] >> theCurrentTemp.enty[i].spare[3] >> theCurrentTemp.enty[i].spare[4] - >> theCurrentTemp.enty[i].spare[5] >> theCurrentTemp.enty[i].spare[6]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 16, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - - } - - // next, loop over all barrel x-angle entries - - for (k=0; k < theCurrentTemp.head.NTyx; ++k) { - - for (i=0; i < theCurrentTemp.head.NTxx; ++i) { - - db >> theCurrentTemp.entx[k][i].runnum >> theCurrentTemp.entx[k][i].costrk[0] - >> theCurrentTemp.entx[k][i].costrk[1] >> theCurrentTemp.entx[k][i].costrk[2]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 17, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - - // Calculate the alpha, beta, and cot(beta) for this entry - - theCurrentTemp.entx[k][i].alpha = static_cast(atan2((double)theCurrentTemp.entx[k][i].costrk[2], (double)theCurrentTemp.entx[k][i].costrk[0])); - - theCurrentTemp.entx[k][i].cotalpha = theCurrentTemp.entx[k][i].costrk[0]/theCurrentTemp.entx[k][i].costrk[2]; - - theCurrentTemp.entx[k][i].beta = static_cast(atan2((double)theCurrentTemp.entx[k][i].costrk[2], (double)theCurrentTemp.entx[k][i].costrk[1])); - - theCurrentTemp.entx[k][i].cotbeta = theCurrentTemp.entx[k][i].costrk[1]/theCurrentTemp.entx[k][i].costrk[2]; - - db >> theCurrentTemp.entx[k][i].qavg >> theCurrentTemp.entx[k][i].sxmax >> theCurrentTemp.entx[k][i].dxone >> theCurrentTemp.entx[k][i].sxone >> theCurrentTemp.entx[k][i].qmin >> theCurrentTemp.entx[k][i].clslenx; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 18, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - - for (j=0; j<2; ++j) { - - db >> theCurrentTemp.entx[k][i].xpar[j][0] >> theCurrentTemp.entx[k][i].xpar[j][1] - >> theCurrentTemp.entx[k][i].xpar[j][2] >> theCurrentTemp.entx[k][i].xpar[j][3] >> theCurrentTemp.entx[k][i].xpar[j][4]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 19, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - - } - - qavg_avg = 0.f; - for (j=0; j<9; ++j) { - - for (l=0; l> theCurrentTemp.entx[k][i].xtemp[j][l]; qavg_avg += theCurrentTemp.entx[k][i].xtemp[j][l];} - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 20, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - } - theCurrentTemp.entx[k][i].qavg_avg = qavg_avg/9.; - - for (j=0; j<4; ++j) { - - db >> theCurrentTemp.entx[k][i].xavg[j] >> theCurrentTemp.entx[k][i].xrms[j] >> theCurrentTemp.entx[k][i].xgx0[j] >> theCurrentTemp.entx[k][i].xgsig[j]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 21, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - db >> theCurrentTemp.entx[k][i].xflpar[j][0] >> theCurrentTemp.entx[k][i].xflpar[j][1] >> theCurrentTemp.entx[k][i].xflpar[j][2] - >> theCurrentTemp.entx[k][i].xflpar[j][3] >> theCurrentTemp.entx[k][i].xflpar[j][4] >> theCurrentTemp.entx[k][i].xflpar[j][5]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 22, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - db >> theCurrentTemp.entx[k][i].chi2xavg[j] >> theCurrentTemp.entx[k][i].chi2xmin[j] >> theCurrentTemp.entx[k][i].chi2xavgc2m[j] >> theCurrentTemp.entx[k][i].chi2xminc2m[j]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 23, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - db >> theCurrentTemp.entx[k][i].xavgc2m[j] >> theCurrentTemp.entx[k][i].xrmsc2m[j] >> theCurrentTemp.entx[k][i].xgx0c2m[j] >> theCurrentTemp.entx[k][i].xgsigc2m[j]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 24, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - db >> theCurrentTemp.entx[k][i].xavggen[j] >> theCurrentTemp.entx[k][i].xrmsgen[j] >> theCurrentTemp.entx[k][i].xgx0gen[j] >> theCurrentTemp.entx[k][i].xgsiggen[j]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 25, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - db >> theCurrentTemp.entx[k][i].xavgbcn[j] >> theCurrentTemp.entx[k][i].xrmsbcn[j] >> theCurrentTemp.entx[k][i].xgx0bcn[j] >> theCurrentTemp.entx[k][i].xgsigbcn[j]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 26, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - } - - db >> theCurrentTemp.entx[k][i].chi2xavgone >> theCurrentTemp.entx[k][i].chi2xminone >> theCurrentTemp.entx[k][i].qmin2 - >> theCurrentTemp.entx[k][i].mpvvav >> theCurrentTemp.entx[k][i].sigmavav >> theCurrentTemp.entx[k][i].kappavav - >> theCurrentTemp.entx[k][i].mpvvav2 >> theCurrentTemp.entx[k][i].sigmavav2 >> theCurrentTemp.entx[k][i].kappavav2 >> theCurrentTemp.entx[k][i].spare[0]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 27, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - - db >> theCurrentTemp.entx[k][i].qbfrac[0] >> theCurrentTemp.entx[k][i].qbfrac[1] >> theCurrentTemp.entx[k][i].qbfrac[2] >> theCurrentTemp.entx[k][i].fracxone - >> theCurrentTemp.entx[k][i].spare[1] >> theCurrentTemp.entx[k][i].spare[2] >> theCurrentTemp.entx[k][i].spare[3] >> theCurrentTemp.entx[k][i].spare[4] - >> theCurrentTemp.entx[k][i].spare[5] >> theCurrentTemp.entx[k][i].spare[6]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 28, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - - - - } - } - - - // Add this template to the store - - theStripTemp_.push_back(theCurrentTemp); - - } - return true; - -} // TempInit - -#endif - - -// ************************************************************************************************************ -//! Interpolate input alpha and beta angles to produce a working template for each individual hit. -//! \param id - (input) index of the template to use -//! \param cotalpha - (input) the cotangent of the alpha track angle (see CMS IN 2004/014) -//! \param cotbeta - (input) the cotangent of the beta track angle (see CMS IN 2004/014) -//! \param locBy - (input) the sign of the y-component of the local magnetic field (if positive, flip things) -// ************************************************************************************************************ -bool SiStripTemplate::interpolate(int id, float cotalpha, float cotbeta, float locBy) -{ - // Interpolate for a new set of track angles - - // Local variables - int i, j; - int ilow, ihigh, iylow, iyhigh, Ny, Nxx, Nyx, imidy, imaxx; - float yratio, yxratio, xxratio, sxmax, qcorrect, qxtempcor, chi2xavgone, chi2xminone, cota, cotb, cotalpha0, cotbeta0; - bool flip_x; -// std::vector xrms(4), xgsig(4), xrmsc2m(4), xgsigc2m(4); - std::vector chi2xavg(4), chi2xmin(4), chi2xavgc2m(4), chi2xminc2m(4); - - -// Check to see if interpolation is valid - -if(id != id_current_ || cotalpha != cota_current_ || cotbeta != cotb_current_) { - - cota_current_ = cotalpha; cotb_current_ = cotbeta; success_ = true; - - if(id != id_current_) { - -// Find the index corresponding to id - - index_id_ = -1; - for(i=0; i<(int)theStripTemp_.size(); ++i) { - - if(id == theStripTemp_[i].head.ID) { - - index_id_ = i; - id_current_ = id; - -// Copy the charge scaling factor to the private variable - - qscale_ = theStripTemp_[index_id_].head.qscale; - -// Copy the pseudopixel signal size to the private variable - - s50_ = theStripTemp_[index_id_].head.s50; - -// Pixel sizes to the private variables - - xsize_ = theStripTemp_[index_id_].head.xsize; - ysize_ = theStripTemp_[index_id_].head.ysize; - zsize_ = theStripTemp_[index_id_].head.zsize; - - break; - } - } - } - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(index_id_ < 0 || index_id_ >= (int)theStripTemp_.size()) { - throw cms::Exception("DataCorrupt") << "SiStripTemplate::interpolate can't find needed template ID = " << id << std::endl; - } -#else - assert(index_id_ >= 0 && index_id_ < (int)theStripTemp_.size()); -#endif - -// Interpolate the absolute value of cot(beta) - - abs_cotb_ = std::abs(cotbeta); - cotb = abs_cotb_; - -// qcorrect corrects the cot(alpha)=0 cluster charge for non-zero cot(alpha) - - cotalpha0 = theStripTemp_[index_id_].enty[0].cotalpha; - qcorrect=std::sqrt((1.f+cotbeta*cotbeta+cotalpha*cotalpha)/(1.f+cotbeta*cotbeta+cotalpha0*cotalpha0)); -// flip quantities when the magnetic field in in the positive y local direction - if(locBy > 0.f) { - flip_x = true; - } else { - flip_x = false; - } - - Ny = theStripTemp_[index_id_].head.NTy; - Nyx = theStripTemp_[index_id_].head.NTyx; - Nxx = theStripTemp_[index_id_].head.NTxx; - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(Ny < 2 || Nyx < 1 || Nxx < 2) { - throw cms::Exception("DataCorrupt") << "template ID = " << id_current_ << "has too few entries: Ny/Nyx/Nxx = " << Ny << "/" << Nyx << "/" << Nxx << std::endl; - } -#else - assert(Ny > 1 && Nyx > 0 && Nxx > 1); -#endif - imaxx = Nyx - 1; - imidy = Nxx/2; - -// next, loop over all y-angle entries - - ilow = 0; - yratio = 0.f; - - if(cotb >= theStripTemp_[index_id_].enty[Ny-1].cotbeta) { - - ilow = Ny-2; - yratio = 1.f; - success_ = false; - - } else { - - if(cotb >= theStripTemp_[index_id_].enty[0].cotbeta) { - - for (i=0; i= theStripTemp_[index_id_].entx[Nyx-1][0].cotbeta) { - - iylow = Nyx-2; - yxratio = 1.f; - - } else if(abs_cotb_ >= theStripTemp_[index_id_].entx[0][0].cotbeta) { - - for (i=0; i= theStripTemp_[index_id_].entx[0][Nxx-1].cotalpha) { - - ilow = Nxx-2; - xxratio = 1.f; - success_ = false; - - } else { - - if(cota >= theStripTemp_[index_id_].entx[0][0].cotalpha) { - - for (i=0; i 0.f) {lorxwidth_ = -lorxwidth_;} - - } - - return success_; -} // interpolate - - - -// ************************************************************************************************************ -//! Return vector of x errors (squared) for an input vector of projected signals -//! Add large Q scaling for use in cluster splitting. -//! \param fxpix - (input) index of the first real pixel in the projected cluster (doesn't include pseudopixels) -//! \param lxpix - (input) index of the last real pixel in the projected cluster (doesn't include pseudopixels) -//! \param sxthr - (input) maximum signal before de-weighting -//! \param xsum - (input) 11-element vector of pixel signals -//! \param xsig2 - (output) 11-element vector of x errors (squared) -// ************************************************************************************************************ - void SiStripTemplate::xsigma2(int fxpix, int lxpix, float sxthr, float xsum[11], float xsig2[11]) - -{ - // Interpolate using quantities already stored in the private variables - - // Local variables - int i; - float sigi, sigi2, sigi3, sigi4, yint, sxmax, x0, qscale; - float sigiy, sigiy2, sigiy3, sigiy4; - - // Make sure that input is OK - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(fxpix < 2 || fxpix >= BSXM2) { - throw cms::Exception("DataCorrupt") << "SiStripTemplate::xsigma2 called with fxpix = " << fxpix << std::endl; - } -#else - assert(fxpix > 1 && fxpix < BSXM2); -#endif -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(lxpix < fxpix || lxpix >= BSXM2) { - throw cms::Exception("DataCorrupt") << "SiStripTemplate::xsigma2 called with lxpix/fxpix = " << lxpix << "/" << fxpix << std::endl; - } -#else - assert(lxpix >= fxpix && lxpix < BSXM2); -#endif - -// Define the maximum signal to use in the parameterization - - sxmax = sxmax_; - if(sxmax_ > sxparmax_) {sxmax = sxparmax_;} - -// Evaluate pixel-by-pixel uncertainties (weights) for the templ analysis - - for(i=fxpix-2; i<=lxpix+2; ++i) { - if(i < fxpix || i > lxpix) { - -// Nearest pseudopixels have uncertainties of 50% of threshold, next-nearest have 10% of threshold - - xsig2[i] = s50_*s50_; - } else { - if(xsum[i] < sxmax) { - sigi = xsum[i]; - qscale = 1.f; - } else { - sigi = sxmax; - qscale = xsum[i]/sxmax; - } - sigi2 = sigi*sigi; sigi3 = sigi2*sigi; sigi4 = sigi3*sigi; - - if(xsum[i] < syparmax_) { - sigiy = xsum[i]; - } else { - sigiy = syparmax_; - } - sigiy2 = sigiy*sigiy; sigiy3 = sigiy2*sigiy; sigiy4 = sigiy3*sigiy; - -// First, do the cotbeta interpolation - - if(i <= BSHX) { - yint = (1.f-yratio_)* - (xparly0_[0][0]+xparly0_[0][1]*sigiy+xparly0_[0][2]*sigiy2+xparly0_[0][3]*sigiy3+xparly0_[0][4]*sigiy4) - + yratio_* - (xparhy0_[0][0]+xparhy0_[0][1]*sigiy+xparhy0_[0][2]*sigiy2+xparhy0_[0][3]*sigiy3+xparhy0_[0][4]*sigiy4); - } else { - yint = (1.f-yratio_)* - (xparly0_[1][0]+xparly0_[1][1]*sigiy+xparly0_[1][2]*sigiy2+xparly0_[1][3]*sigiy3+xparly0_[1][4]*sigiy4) - + yratio_* - (xparhy0_[1][0]+xparhy0_[1][1]*sigiy+xparhy0_[1][2]*sigiy2+xparhy0_[1][3]*sigiy3+xparhy0_[1][4]*sigiy4); - } - -// Next, do the cotalpha interpolation - - if(i <= BSHX) { - xsig2[i] = (1.f-xxratio_)* - (xparl_[0][0]+xparl_[0][1]*sigi+xparl_[0][2]*sigi2+xparl_[0][3]*sigi3+xparl_[0][4]*sigi4) - + xxratio_* - (xparh_[0][0]+xparh_[0][1]*sigi+xparh_[0][2]*sigi2+xparh_[0][3]*sigi3+xparh_[0][4]*sigi4); - } else { - xsig2[i] = (1.f-xxratio_)* - (xparl_[1][0]+xparl_[1][1]*sigi+xparl_[1][2]*sigi2+xparl_[1][3]*sigi3+xparl_[1][4]*sigi4) - + xxratio_* - (xparh_[1][0]+xparh_[1][1]*sigi+xparh_[1][2]*sigi2+xparh_[1][3]*sigi3+xparh_[1][4]*sigi4); - } - -// Finally, get the mid-point value of the cotalpha function - - if(i <= BSHX) { - x0 = xpar0_[0][0]+xpar0_[0][1]*sigi+xpar0_[0][2]*sigi2+xpar0_[0][3]*sigi3+xpar0_[0][4]*sigi4; - } else { - x0 = xpar0_[1][0]+xpar0_[1][1]*sigi+xpar0_[1][2]*sigi2+xpar0_[1][3]*sigi3+xpar0_[1][4]*sigi4; - } - -// Finally, rescale the yint value for cotalpha variation - - if(x0 != 0.f) {xsig2[i] = xsig2[i]/x0 * yint;} - xsig2[i] *=qscale; - if(xsum[i] > sxthr) {xsig2[i] = 1.e8f;} - if(xsig2[i] <= 0.f) {LOGERROR("SiStripTemplate") << "neg x-error-squared = " << xsig2[i] << ", id = " << id_current_ << ", index = " << index_id_ << - ", cot(alpha) = " << cota_current_ << ", cot(beta) = " << cotb_current_ << ", sigi = " << sigi << ", sxparmax = " << sxparmax_ << ", sxmax = " << sxmax_ << ENDL;} - } - } - - return; - -} // End xsigma2 - - - - -// ************************************************************************************************************ -//! Return interpolated x-correction for input charge bin and qflx -//! \param binq - (input) charge bin [0-3] -//! \param qflx - (input) (Q_f-Q_l)/(Q_f+Q_l) for this cluster -// ************************************************************************************************************ - float SiStripTemplate::xflcorr(int binq, float qflx) - -{ - // Interpolate using quantities already stored in the private variables - - // Local variables - float qfl, qfl2, qfl3, qfl4, qfl5, dx; - - // Make sure that input is OK - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(binq < 0 || binq > 3) { - throw cms::Exception("DataCorrupt") << "SiStripTemplate::xflcorr called with binq = " << binq << std::endl; - } -#else - assert(binq >= 0 && binq < 4); -#endif -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(fabs((double)qflx) > 1.) { - throw cms::Exception("DataCorrupt") << "SiStripTemplate::xflcorr called with qflx = " << qflx << std::endl; - } -#else - assert(fabs((double)qflx) <= 1.); -#endif - -// Define the maximum signal to allow before de-weighting a pixel - - qfl = qflx; - - if(qfl < -0.9f) {qfl = -0.9f;} - if(qfl > 0.9f) {qfl = 0.9f;} - -// Interpolate between the two polynomials - - qfl2 = qfl*qfl; qfl3 = qfl2*qfl; qfl4 = qfl3*qfl; qfl5 = qfl4*qfl; - dx = (1.f - yxratio_)*((1.f-xxratio_)*(xflparll_[binq][0]+xflparll_[binq][1]*qfl+xflparll_[binq][2]*qfl2+xflparll_[binq][3]*qfl3+xflparll_[binq][4]*qfl4+xflparll_[binq][5]*qfl5) - + xxratio_*(xflparlh_[binq][0]+xflparlh_[binq][1]*qfl+xflparlh_[binq][2]*qfl2+xflparlh_[binq][3]*qfl3+xflparlh_[binq][4]*qfl4+xflparlh_[binq][5]*qfl5)) - + yxratio_*((1.f-xxratio_)*(xflparhl_[binq][0]+xflparhl_[binq][1]*qfl+xflparhl_[binq][2]*qfl2+xflparhl_[binq][3]*qfl3+xflparhl_[binq][4]*qfl4+xflparhl_[binq][5]*qfl5) - + xxratio_*(xflparhh_[binq][0]+xflparhh_[binq][1]*qfl+xflparhh_[binq][2]*qfl2+xflparhh_[binq][3]*qfl3+xflparhh_[binq][4]*qfl4+xflparhh_[binq][5]*qfl5)); - - return dx; - -} // End xflcorr - - -// ************************************************************************************************************ -//! Return interpolated y-template in single call -//! \param fxbin - (input) index of first bin (0-40) to fill -//! \param fxbin - (input) index of last bin (0-40) to fill -//! \param xtemplate - (output) a 41x11 output buffer -// ************************************************************************************************************ - void SiStripTemplate::xtemp(int fxbin, int lxbin, float xtemplate[41][BSXSIZE]) - -{ - // Retrieve already interpolated quantities - - // Local variables - int i, j; - - // Verify that input parameters are in valid range - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(fxbin < 0 || fxbin > 40) { - throw cms::Exception("DataCorrupt") << "SiStripTemplate::xtemp called with fxbin = " << fxbin << std::endl; - } -#else - assert(fxbin >= 0 && fxbin < 41); -#endif -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(lxbin < 0 || lxbin > 40) { - throw cms::Exception("DataCorrupt") << "SiStripTemplate::xtemp called with lxbin = " << lxbin << std::endl; - } -#else - assert(lxbin >= 0 && lxbin < 41); -#endif - -// Build the x-template, the central 25 bins are here in all cases - - for(i=0; i<9; ++i) { - for(j=0; j 32) { - for(i=1; i<9; ++i) { - xtemplate[i+32][0] = 0.f; - xtemplate[i+32][1] = 0.f; - for(j=0; j& cluster) - -{ - // Retrieve already interpolated quantities - - // Local variables - int i, j; - - // Extract x template based upon the hit position - - float xpix = xhit/xsize_ + 0.5f; -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(xpix < 0.f) { - throw cms::Exception("DataCorrupt") << "SiStripTemplate::2xtemp called with xhit = " << xhit << std::endl; - } -#else - assert(xpix >= 0.f); -#endif - -// cpix is struck pixel(strip) of the cluster - - int cpix = (int)xpix; - int shift = BSHX - cpix; - -// xbin the floating bin number and cbin is the bin number (between 0 and 7) of the interpolated template - - float xbin = 8.*(xpix-(float)cpix); - int cbin = (int)xbin; - - float xfrac = xbin-(float)cbin; - - int sizex = std::min((int)cluster.size(), BSXSIZE); - -// shift and interpolate the correct cluster shape - - for(i=0; i sizex-1) {cluster[i] = 0.f;} else { - cluster[i]=(1.f-xfrac)*xtemp_[cbin][j]+xfrac*xtemp_[cbin+1][j]; - if(cluster[i] < s50_) cluster[i] = 0.f; - } - -// Return cluster in same charge units - - cluster[i] /= qscale_; - } - - - return; - -} // End sxtemp - -// ************************************************************************************************************ -//! Return central pixel of x-template pixels above readout threshold -// ************************************************************************************************************ -int SiStripTemplate::cxtemp() - -{ - // Retrieve already interpolated quantities - - // Local variables - int j; - - // Analyze only pixels along the central entry - // First, find the maximum signal and then work out to the edges - - float sigmax = 0.f; - int jmax = -1; - - for(j=0; j sigmax) { - sigmax = xtemp_[4][j]; - jmax = j; - } - } - if(sigmax < 2.*s50_ || jmax<1 || jmax>BSXM2) {return -1;} - - // Now search forward and backward - - int jend = jmax; - - for(j=jmax+1; j0; --j) { - if(xtemp_[4][j] < 2.*s50_) break; - jbeg = j; - } - - return (jbeg+jend)/2; - -} // End cxtemp - - -// ************************************************************************************************************ -//! Make interpolated 3d x-template (stored as class variables) -//! \param nxpix - (input) number of pixels in cluster (needed to size template) -//! \param nxbins - (output) number of bins needed for each template projection -// ************************************************************************************************************ -void SiStripTemplate::xtemp3d_int(int nxpix, int& nxbins) - -{ - // Retrieve already interpolated quantities - - // Local variables - int i, j, k; - int ioff0, ioffp, ioffm; - - // Verify that input parameters are in valid range - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(nxpix < 1 || nxpix >= BSXM3) { - throw cms::Exception("DataCorrupt") << "SiPixelTemplate::xtemp3d called with nxpix = " << nxpix << std::endl; - } -#else - assert(nxpix > 0 && nxpix < BSXM3); -#endif - - // Calculate the size of the shift in pixels needed to span the entire cluster - - float diff = fabsf(nxpix - clslenx_)/2. + 1.f; - int nshift = (int)diff; - if((diff - nshift) > 0.5f) {++nshift;} - - // Calculate the number of bins needed to specify each hit range - - nxbins_ = 9 + 16*nshift; - - // Create a 2-d working template with the correct size - - temp2dx_.resize(boost::extents[nxbins_][BSXSIZE]); - - // The 9 central bins are copied from the interpolated private store - - ioff0 = 8*nshift; - - for(i=0; i<9; ++i) { - for(j=0; j& xtemplate) - -{ - // Sum two 2-d templates to make the 3-d template - if(i >= 0 && i < nxbins_ && j <= i) { - for(int k=0; k= (int)theStripTemp_.size()) { - throw cms::Exception("DataCorrupt") << "SiStripTemplate::qbin can't find needed template ID = " << id << std::endl; - } -#else - assert(index >= 0 && index < (int)theStripTemp_.size()); -#endif - -// - -// Interpolate the absolute value of cot(beta) - - acotb = fabs((double)cotbeta); - -// qcorrect corrects the cot(alpha)=0 cluster charge for non-zero cot(alpha) - - // qcorrect corrects the cot(alpha)=0 cluster charge for non-zero cot(alpha) - - cotalpha0 = theStripTemp_[index].enty[0].cotalpha; - qcorrect=std::sqrt((1.f+cotbeta*cotbeta+cotalpha*cotalpha)/(1.f+cotbeta*cotbeta+cotalpha0*cotalpha0)); - - // Copy the charge scaling factor to the private variable - - qscale = theStripTemp_[index].head.qscale; - - Ny = theStripTemp_[index].head.NTy; - Nyx = theStripTemp_[index].head.NTyx; - Nxx = theStripTemp_[index].head.NTxx; - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(Ny < 2 || Nyx < 1 || Nxx < 2) { - throw cms::Exception("DataCorrupt") << "template ID = " << id_current_ << "has too few entries: Ny/Nyx/Nxx = " << Ny << "/" << Nyx << "/" << Nxx << std::endl; - } -#else - assert(Ny > 1 && Nyx > 0 && Nxx > 1); -#endif - -// next, loop over all y-angle entries - - ilow = 0; - yratio = 0.f; - - if(acotb >= theStripTemp_[index].enty[Ny-1].cotbeta) { - - ilow = Ny-2; - yratio = 1.f; - - } else { - - if(acotb >= theStripTemp_[index].enty[0].cotbeta) { - - for (i=0; i 0.f && qmin > 0.f); -#endif - -// Scale the input charge to account for differences between pixelav and CMSSW simulation or data - - qtotal = qscale*qclus; - -// uncertainty and final corrections depend upon total charge bin - - fq = qtotal/qavg; - if(fq > 1.5f) { - binq=0; - } else { - if(fq > 1.0f) { - binq=1; - } else { - if(fq > 0.85f) { - binq=2; - } else { - binq=3; - } - } - } - -// If the charge is too small (then flag it) - - if(qtotal < 0.95f*qmin) {binq = 5;} else {if(qtotal < 0.95f*qmin2) {binq = 4;}} - - return binq; - -} // qbin - - -// ************************************************************************************************************ -//! Interpolate beta/alpha angles to produce Vavilov parameters for the charge distribution -//! \param mpv - (output) the Vavilov most probable charge (well, not really the most probable esp at large kappa) -//! \param sigma - (output) the Vavilov sigma parameter -//! \param kappa - (output) the Vavilov kappa parameter [0.01 (Landau-like) < kappa < 10 (Gaussian-like) -// ************************************************************************************************************ -void SiStripTemplate::vavilov_pars(double& mpv, double& sigma, double& kappa) - -{ - // Local variables - int i; - int ilow, ihigh, Ny; - float yratio, cotb, cotalpha0, arg; - -// Interpolate in cotbeta only for the correct total path length (converts cotalpha, cotbeta into an effective cotbeta) - - cotalpha0 = theStripTemp_[index_id_].enty[0].cotalpha; - arg = cotb_current_*cotb_current_ + cota_current_*cota_current_ - cotalpha0*cotalpha0; - if(arg < 0.f) arg = 0.f; - cotb = std::sqrt(arg); - -// Copy the charge scaling factor to the private variable - - Ny = theStripTemp_[index_id_].head.NTy; - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(Ny < 2) { - throw cms::Exception("DataCorrupt") << "template ID = " << id_current_ << "has too few entries: Ny = " << Ny << std::endl; - } -#else - assert(Ny > 1); -#endif - -// next, loop over all y-angle entries - - ilow = 0; - yratio = 0.f; - - if(cotb >= theStripTemp_[index_id_].enty[Ny-1].cotbeta) { - - ilow = Ny-2; - yratio = 1.f; - - } else { - - if(cotb >= theStripTemp_[index_id_].enty[0].cotbeta) { - - for (i=0; i - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE -#include "RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplateReco.h" -#include "RecoLocalTracker/SiStripRecHitConverter/interface/VVIObj.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#define LOGERROR(x) edm::LogError(x) -#define LOGDEBUG(x) LogDebug(x) -constexpr int theVerboseLevel = 2; -#define ENDL " " -#include "FWCore/Utilities/interface/Exception.h" -#else -#include "SiStripTemplateReco.h" -#include "VVIObj.h" -//static int theVerboseLevel = {2}; -#define LOGERROR(x) std::cout << x << ": " -#define LOGDEBUG(x) std::cout << x << ": " -#define ENDL std::endl -#endif - -using namespace SiStripTemplateReco; - -// ************************************************************************************************************************************* -//! Reconstruct the best estimate of the hit position for strip clusters, -//! includes autoswitching to barycenter when that technique is more accurate. -//! \param id - (input) identifier of the template to use -//! \param cotalpha - (input) the cotangent of the alpha track angle (see CMS IN 2004/014) -//! \param cotbeta - (input) the cotangent of the beta track angle (see CMS IN 2004/014) -//! \param locBy - (input) the sign of the local B_y field to specify the Lorentz drift direction -//! \param cluster - (input) boost multi_array container array of 13 pixel signals, -//! origin of local coords (0,0) at center of pixel cluster[0]. -//! \param templ - (input) the template used in the reconstruction -//! \param xrec - (output) best estimate of x-coordinate of hit in microns -//! \param sigmax - (output) best estimate of uncertainty on xrec in microns -//! \param probx - (output) probability describing goodness-of-fit for x-reco -//! \param qbin - (output) index (0-4) describing the charge of the cluster -//! qbin = 0 Q/Q_avg > 1.5 [few % of all hits] -//! 1 1.5 > Q/Q_avg > 1.0 [~30% of all hits] -//! 2 1.0 > Q/Q_avg > 0.85 [~30% of all hits] -//! 3 0.85 > Q/Q_avg > min1 [~30% of all hits] -//! 4 min1 > Q/Q_avg > min2 [~0.1% of all hits] -//! 5 min2 > Q/Q_avg [~0.1% of all hits] -//! \param speed - (input) switch (-2->5) trading speed vs robustness -//! -2 totally bombproof, searches the entire 41 bin range at full density (equiv to V2_4), -//! calculates Q probability w/ VVIObj (better but slower) -//! -1 totally bombproof, searches the entire 41 bin range at full density (equiv to V2_4), -//! calculates Q probability w/ TMath::VavilovI (poorer but faster) -//! 0 totally bombproof, searches the entire 41 bin range at full density (equiv to V2_4) -//! 1 faster, searches reduced 25 bin range (no big pix) + 33 bins (big pix at ends) at full density -//! 2 faster yet, searches same range as 1 but at 1/2 density -//! 3 fastest, searches same range as 1 but at 1/4 density (no big pix) and 1/2 density (big pix in cluster) -//! 4 fastest w/ Q prob, searches same range as 1 but at 1/4 density (no big pix) and 1/2 density (big pix in cluster), -//! calculates Q probability w/ VVIObj (better but slower) -//! 5 fastest w/ Q prob, searches same range as 1 but at 1/4 density (no big pix) and 1/2 density (big pix in cluster), -//! calculates Q probability w/ TMath::VavilovI (poorer but faster) -//! \param probQ - (output) the Vavilov-distribution-based cluster charge probability -// ************************************************************************************************************************************* -int SiStripTemplateReco::StripTempReco1D(int id, float cotalpha, float cotbeta, float locBy, std::vector& cluster, - SiStripTemplate& templ, - float& xrec, float& sigmax, float& probx, int& qbin, int speed, float& probQ) - -{ - // Local variables - int i, j, minbin, binl, binh, binq, midpix; - int fxpix, nxpix, lxpix, logxpx, shiftx, ftpix, ltpix; - int nclusx; - int deltaj, jmin, jmax, fxbin, lxbin, djx; - float sxthr, rnorm, delta, sigma, pseudopix, qscale, q50, q100; - float ss2, ssa, sa2, ssba, saba, sba2, rat, fq, qtotal, barycenter, sigmaxbcn; - float originx, qfx, qlx, bias, biasbcn, maxpix; - double chi2x, meanx, chi2xmin, chi21max; - double hchi2, hndof, prvav, mpv, sigmaQ, kappa, xvav, beta2; - float xtemp[41][BSXSIZE], xsum[BSXSIZE]; - float chi2xbin[41], xsig2[BSXSIZE]; - float xw2[BSXSIZE], xsw[BSXSIZE]; - bool calc_probQ, use_VVIObj; - float xsize; - const float probmin={1.110223e-16}; - const float probQmin={1.e-5}; - -// The minimum chi2 for a valid one pixel cluster = pseudopixel contribution only - - const double mean1pix={0.100}, chi21min={0.160}; - -// First, interpolate the template needed to analyze this cluster -// check to see of the track direction is in the physical range of the loaded template - - if(!templ.interpolate(id, cotalpha, cotbeta, locBy)) { - if (theVerboseLevel > 2) {LOGDEBUG("SiStripTemplateReco") << "input cluster direction cot(alpha) = " << cotalpha << ", cot(beta) = " << cotbeta << ", local B_y = " << locBy << ", template ID = " << id << ", no reconstruction performed" << ENDL;} - return 20; - } - -// Check to see if Q probability is selected - - calc_probQ = false; - use_VVIObj = false; - if(speed < 0) { - calc_probQ = true; - if(speed < -1) use_VVIObj = true; - speed = 0; - } - - if(speed > 3) { - calc_probQ = true; - if(speed < 5) use_VVIObj = true; - speed = 3; - } - -// Get pixel dimensions from the template (to allow multiple detectors in the future) - - xsize = templ.xsize(); - -// Define size of pseudopixel - - q50 = templ.s50(); - q100 = 2.f * q50; - pseudopix = q50; - -// Get charge scaling factor - - qscale = templ.qscale(); - -// enforce maximum size - - nclusx = (int)cluster.size(); - - if(nclusx > TSXSIZE) {nclusx = TSXSIZE;} - -// First, rescale all strip charges, sum them and trunate the strip charges - - qtotal = 0.; - for(i=0; i maxpix) {xsum[j] = maxpix;} - } - - barycenter = barycenter/qtotal - 0.5f*templ.lorxwidth(); - -// next, identify the x-cluster ends, count total pixels, nxpix, and logical pixels, logxpx - - fxpix = -1; - ftpix = -1; - nxpix=0; - lxpix=0; - ltpix=0; - logxpx=0; - for(i=0; i 0.f) { - if(fxpix == -1) {fxpix = i;} - ++logxpx; - ++nxpix; - lxpix = i; - if(xsum[i] > q100) { - if(ftpix == -1) {ftpix = i;} - ltpix = i; - } - } - } - - -// dlengthx = (float)nxpix - templ.clslenx(); - -// Make sure cluster is continuous - - if((lxpix-fxpix+1) != nxpix) { - - LOGDEBUG("SiStripTemplateReco") << "x-length of pixel cluster doesn't agree with number of pixels above threshold" << ENDL; - if (theVerboseLevel > 2) { - LOGDEBUG("SiStripTemplateReco") << "xsum[] = "; - for(i=0; i TSXSIZE) { - - LOGDEBUG("SiStripTemplateReco") << "x-length of pixel cluster is larger than maximum template size" << ENDL; - if (theVerboseLevel > 2) { - LOGDEBUG("SiStripTemplateReco") << "xsum[] = "; - for(i=0; i 0) { - for(i=lxpix; i>=fxpix; --i) { - xsum[i+shiftx] = xsum[i]; - xsum[i] = 0.f; - } - } else if (shiftx < 0) { - for(i=fxpix; i<=lxpix; ++i) { - xsum[i+shiftx] = xsum[i]; - xsum[i] = 0.f; - } - } - lxpix +=shiftx; - fxpix +=shiftx; - -// If the cluster boundaries are OK, add pesudopixels, otherwise quit - - if(fxpix > 1 && fxpix < BSXM2) { - xsum[fxpix-1] = pseudopix; - xsum[fxpix-2] = 0.2f*pseudopix; - } else {return 9;} - if(lxpix > 1 && lxpix < BSXM2) { - xsum[lxpix+1] = pseudopix; - xsum[lxpix+2] = 0.2f*pseudopix; - } else {return 9;} - -// finally, determine if pixel[0] is a double pixel and make an origin correction if it is - - originx = 0.f; - -// uncertainty and final corrections depend upon total charge bin - - fq = qtotal/templ.qavg(); - if(fq > 1.5f) { - binq=0; - } else { - if(fq > 1.0f) { - binq=1; - } else { - if(fq > 0.85f) { - binq=2; - } else { - binq=3; - } - } - } - -// Return the charge bin via the parameter list unless the charge is too small (then flag it) - - qbin = binq; - if(qtotal < 0.95f*templ.qmin()) {qbin = 5;} else { - if(qtotal < 0.95f*templ.qmin(1)) {qbin = 4;} - } - if (theVerboseLevel > 9) { - LOGDEBUG("SiStripTemplateReco") << - "ID = " << id << - " cot(alpha) = " << cotalpha << " cot(beta) = " << cotbeta << - " nclusx = " << nclusx << ENDL; - } - - -// Next, copy the y- and x-templates to local arrays - -// First, decide on chi^2 min search parameters - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(speed < 0 || speed > 3) { - throw cms::Exception("DataCorrupt") << "SiStripTemplateReco::StripTempReco2D called with illegal speed = " << speed << std::endl; - } -#else - assert(speed >= 0 && speed < 4); -#endif - fxbin = 2; lxbin = 38; djx = 1; - if(speed > 0) { - fxbin = 8; lxbin = 32; - } - - if(speed > 1) { - djx = 2; - if(speed > 2) { - djx = 4; - } - } - - if (theVerboseLevel > 9) { - LOGDEBUG("SiStripTemplateReco") << - "fxpix " << fxpix << " lxpix = " << lxpix << - " fxbin = " << fxbin << " lxbin = " << lxbin << - " djx = " << djx << " logxpx = " << logxpx << ENDL; - } - -// Now do the copies - - templ.xtemp(fxbin, lxbin, xtemp); - -// Do the x-reconstruction next - -// Apply the first-pass template algorithm to all clusters - -// Modify the template if double pixels are present - -// Define the maximum signal to allow before de-weighting a pixel - - sxthr = 1.1f*maxpix; - -// Evaluate pixel-by-pixel uncertainties (weights) for the templ analysis - -// for(i=0; i 0) { - for(j=jmin; j<=jmax; j+=deltaj) { - if(chi2xbin[j] < -100.f) { - ssa = 0.f; - sa2 = 0.f; - for(i=fxpix-2; i<=lxpix+2; ++i) { - ssa += xsw[i]*xtemp[j][i]; - sa2 += xtemp[j][i]*xtemp[j][i]*xw2[i]; - } - rat=ssa/ss2; - if(rat <= 0.f) {LOGERROR("SiStripTemplateReco") << "illegal chi2xmin normalization (1) = " << rat << ENDL; rat = 1.;} - chi2xbin[j]=ss2-2.*ssa/rat+sa2/(rat*rat); - } - if(chi2xbin[j] < chi2xmin) { - chi2xmin = chi2xbin[j]; - minbin = j; - } - } - deltaj /= 2; - if(minbin > fxbin) {jmin = minbin - deltaj;} else {jmin = fxbin;} - if(minbin < lxbin) {jmax = minbin + deltaj;} else {jmax = lxbin;} - } - - if (theVerboseLevel > 9) { - LOGDEBUG("SiStripTemplateReco") << - "minbin " << minbin << " chi2xmin = " << chi2xmin << ENDL; - } - -// Do not apply final template pass to 1-pixel clusters (use calibrated offset) - - if(nxpix == 1) { - - delta = templ.dxone(); - sigma = templ.sxone(); - xrec = 0.5f*(fxpix+lxpix-2*shiftx+2.f*originx)*xsize-delta; - if(sigma <= 0.f) { - sigmax = 28.9f; - } else { - sigmax = sigma; - } - -// Do probability calculation for one-pixel clusters - - chi21max = fmax(chi21min, (double)templ.chi2xminone()); - chi2xmin -=chi21max; - if(chi2xmin < 0.) {chi2xmin = 0.;} - meanx = fmax(mean1pix, (double)templ.chi2xavgone()); - hchi2 = chi2xmin/2.; hndof = meanx/2.; - probx = 1. - TMath::Gamma(hndof, hchi2); - - } else { - -// Now make the second, interpolating pass with the templates - - binl = minbin - 1; - binh = binl + 2; - if(binl < fxbin) { binl = fxbin;} - if(binh > lxbin) { binh = lxbin;} - ssa = 0.; - sa2 = 0.; - ssba = 0.; - saba = 0.; - sba2 = 0.; - for(i=fxpix-2; i<=lxpix+2; ++i) { - ssa += xsw[i]*xtemp[binl][i]; - sa2 += xtemp[binl][i]*xtemp[binl][i]*xw2[i]; - ssba += xsw[i]*(xtemp[binh][i] - xtemp[binl][i]); - saba += xtemp[binl][i]*(xtemp[binh][i] - xtemp[binl][i])*xw2[i]; - sba2 += (xtemp[binh][i] - xtemp[binl][i])*(xtemp[binh][i] - xtemp[binl][i])*xw2[i]; - } - -// rat is the fraction of the "distance" from template a to template b - - rat=(ssba*ssa-ss2*saba)/(ss2*sba2-ssba*ssba); - if(rat < 0.f) {rat=0.f;} - if(rat > 1.f) {rat=1.0f;} - rnorm = (ssa+rat*ssba)/ss2; - -// Calculate the charges in the first and last pixels - - qfx = xsum[fxpix]; - if(logxpx > 1) { - qlx=xsum[lxpix]; - } else { - qlx = qfx; - } - -// Now calculate the mean bias correction and uncertainties - - float qxfrac = (qfx-qlx)/(qfx+qlx); - bias = templ.xflcorr(binq,qxfrac)+templ.xavg(binq); - -// uncertainty and final correction depend upon charge bin - - xrec = (0.125f*binl+BSHX-2.5f+rat*(binh-binl)*0.125f-(float)shiftx+originx)*xsize - bias; - sigmax = templ.xrms(binq); - -// Do goodness of fit test in x - - if(rnorm <= 0.f) {LOGERROR("SiStripTemplateReco") << "illegal chi2x normalization (2) = " << rnorm << ENDL; rnorm = 1.;} - chi2x=ss2-2.f/rnorm*ssa-2.f/rnorm*rat*ssba+(sa2+2.f*rat*saba+rat*rat*sba2)/(rnorm*rnorm)-templ.chi2xmin(binq); - if(chi2x < 0.0) {chi2x = 0.0;} - meanx = templ.chi2xavg(binq); - if(meanx < 0.01) {meanx = 0.01;} - // gsl function that calculates the chi^2 tail prob for non-integral dof - // probx = gsl_cdf_chisq_Q(chi2x, meanx); - // probx = ROOT::Math::chisquared_cdf_c(chi2x, meanx, trx0); - hchi2 = chi2x/2.; hndof = meanx/2.; - probx = 1. - TMath::Gamma(hndof, hchi2); - -// Now choose the better result - - bias = templ.xavg(binq); - biasbcn = templ.xavgbcn(binq); - sigmaxbcn = templ.xrmsbcn(binq); - - if((bias*bias+sigmax*sigmax) > (biasbcn*biasbcn+sigmaxbcn*sigmaxbcn)) { - - xrec = barycenter - biasbcn; - sigmax = sigmaxbcn; - - } - - } - -// Don't return exact zeros for the probability - - if(probx < probmin) {probx = probmin;} - -// Decide whether to generate a cluster charge probability - - if(calc_probQ) { - -// Calculate the Vavilov probability that the cluster charge is OK - - templ.vavilov_pars(mpv, sigmaQ, kappa); -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if((sigmaQ <=0.) || (mpv <= 0.) || (kappa < 0.01) || (kappa > 9.9)) { - throw cms::Exception("DataCorrupt") << "SiStripTemplateReco::Vavilov parameters mpv/sigmaQ/kappa = " << mpv << "/" << sigmaQ << "/" << kappa << std::endl; - } -#else - assert((sigmaQ > 0.) && (mpv > 0.) && (kappa > 0.01) && (kappa < 10.)); -#endif - xvav = ((double)qtotal-mpv)/sigmaQ; - beta2 = 1.; - if(use_VVIObj) { -// VVIObj is a private port of CERNLIB VVIDIS - sistripvvi::VVIObj vvidist(kappa, beta2, 1); - prvav = vvidist.fcn(xvav); - } else { -// Use faster but less accurate TMath Vavilov distribution function - prvav = TMath::VavilovI(xvav, kappa, beta2); - } -// Change to upper tail probability -// if(prvav > 0.5) prvav = 1. - prvav; -// probQ = (float)(2.*prvav); - probQ = 1. - prvav; - if(probQ < probQmin) {probQ = probQmin;} - } else { - probQ = -1; - } - - return 0; -} // StripTempReco2D - diff --git a/RecoLocalTracker/SiStripRecHitConverter/src/SiStripTemplateSplit.cc b/RecoLocalTracker/SiStripRecHitConverter/src/SiStripTemplateSplit.cc deleted file mode 100644 index 79f860b3ff442..0000000000000 --- a/RecoLocalTracker/SiStripRecHitConverter/src/SiStripTemplateSplit.cc +++ /dev/null @@ -1,447 +0,0 @@ -// -// SiStripTemplateSplit.cc -// -// Procedure to fit two templates (same angle hypotheses) to a single cluster -// -// Version 1.00 [based on SiPixelTemplateSplit.cc Version 2.30] -// Version 1.01 [improve error estimation for qbin=3 events] -// Version 1.05 [Incorporate VI-like speed improvements] -// Version 1.06 Clean-up irrelevant (since truncation) sorting -// Version 2.10 Clone speed improvements from the pixels (eliminate 3-d multi-arays, improve seach algorithm) -// -// Created by Morris Swartz on 04/10/08. -// -// - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE -//#include -#else -#include -#endif -#include -#include -#include -#include -// ROOT::Math has a c++ function that does the probability calc, but only in v5.12 and later -#include "Math/DistFunc.h" -#include "TMath.h" -// Use current version of gsl instead of ROOT::Math -//#include - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE -#include "RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplateSplit.h" -#include "RecoLocalTracker/SiStripRecHitConverter/interface/VVIObj.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#define LOGERROR(x) edm::LogError(x) -#define LOGDEBUG(x) LogDebug(x) -constexpr int theVerboseLevel = 2; -#define ENDL " " -#else -#include "SiStripTemplateSplit.h" -#include "VVIObj.h" -//#include "SiStripTemplate2D.h" -//#include "SimpleTemplate2D.h" -//static int theVerboseLevel = {2}; -#define LOGERROR(x) std::cout << x << ": " -#define LOGDEBUG(x) std::cout << x << ": " -#define ENDL std::endl -#endif - -using namespace SiStripTemplateSplit; - -// ************************************************************************************************************************************* -//! Reconstruct the best estimate of the hit positions for pixel clusters. -//! \param id - (input) identifier of the template to use -//! \param cotalpha - (input) the cotangent of the alpha track angle (see CMS IN 2004/014) -//! \param cotbeta - (input) the cotangent of the beta track angle (see CMS IN 2004/014) -//! \param locBy - (input) the sign of the local B_y field to specify the Lorentz drift direction -//! \param speed - (input) switch (-1->2) trading speed vs robustness -//! -1 totally bombproof, searches the entire ranges of template bins, -//! calculates Q probability w/ VVIObj -//! 0 totally bombproof, searches the entire template bin range at full density (no Qprob) -//! 1 faster, searches same range as 0 but at 1/2 density -//! 2 fastest, searches same range as 1 but at 1/4 density (no big pix) and 1/2 density (big pix in cluster) -//! \param cluster - (input) boost multi_array container of 7x21 array of pixel signals, -//! origin of local coords (0,0) at center of pixel cluster[0][0]. -//! \param templ - (input) the template used in the reconstruction -//! \param xrec1 - (output) best estimate of first x-coordinate of hit in microns -//! \param xrec2 - (output) best estimate of second x-coordinate of hit in microns -//! \param sigmax - (output) best estimate of uncertainty on xrec1 and xrec2 in microns -//! \param prob2x - (output) probability describing goodness-of-fit to a merged cluster hypothesis for x-reco -//! \param q2bin - (output) index (0-4) describing the charge of the cluster assuming a merged 2-hit cluster hypothesis -//! [0: 1.5& cluster, - SiStripTemplate& templ, - float& xrec1, float& xrec2, float& sigmax, float& prob2x, int& q2bin, float& prob2Q) - -{ - // Local variables - int i, j, k, binq, binqerr, midpix; - int fxpix, nxpix, lxpix, logxpx, shiftx; - int nclusx; - int nxbin, xcbin, minbinj, minbink; - int deltaj, jmin, jmax, kmin, kmax, km, fxbin, lxbin, djx; - float sxthr, delta, sigma, pseudopix, xsize, qscale; - float ss2, ssa, sa2, rat, fq, qtotal, qavg; - float originx, bias, maxpix; - double chi2x, meanx, chi2xmin, chi21max; - double hchi2, hndof; - double prvav, mpv, sigmaQ, kappa, xvav, beta2; - float xsum[BSXSIZE]; - float xsig2[BSXSIZE]; - float xw2[BSXSIZE], xsw[BSXSIZE]; - const float sqrt2x={2.00000}; - const float sqrt12={3.4641}; - const float probmin={1.110223e-16}; - const float prob2Qmin={1.e-5}; - -// bool SiStripTemplateSplit::SimpleTemplate2D(float cotalpha, float cotbeta, float xhit, float yhit, float thick, float lorxwidth, float lorywidth, -// float qavg, std::vector ydouble, std::vector xdouble, float template2d[BSXM2][BYM2]); - -// The minimum chi2 for a valid one pixel cluster = pseudopixel contribution only - - const double mean1pix={0.100}, chi21min={0.160}; - -// First, interpolate the template needed to analyze this cluster -// check to see of the track direction is in the physical range of the loaded template - - if(!templ.interpolate(id, cotalpha, cotbeta, locBy)) { - LOGDEBUG("SiStripTemplateReco") << "input cluster direction cot(alpha) = " << cotalpha << ", cot(beta) = " << cotbeta - << " is not within the acceptance of template ID = " << id << ", no reconstruction performed" << ENDL; - return 20; - } - - // Get pixel dimensions from the template (to allow multiple detectors in the future) - - xsize = templ.xsize(); - - // Define size of pseudopixel - - pseudopix = templ.s50(); - - // Get charge scaling factor - - qscale = templ.qscale(); - - // enforce maximum size - - nclusx = (int)cluster.size(); - - if(nclusx > TSXSIZE) {nclusx = TSXSIZE;} - - // First, rescale all strip charges, sum them and trunate the strip charges - - qtotal = 0.f; - for(i=0; i maxpix) {xsum[j] = maxpix;} - } - - // next, identify the x-cluster ends, count total pixels, nxpix, and logical pixels, logxpx - - fxpix = -1; - nxpix=0; - lxpix=0; - logxpx=0; - for(i=0; i 0.f) { - if(fxpix == -1) {fxpix = i;} - ++logxpx; - ++nxpix; - lxpix = i; - } - } - - - // dlengthx = (float)nxpix - templ.clslenx(); - - // Make sure cluster is continuous - - if((lxpix-fxpix+1) != nxpix) { - - LOGDEBUG("SiStripTemplateReco") << "x-length of pixel cluster doesn't agree with number of pixels above threshold" << ENDL; - if (theVerboseLevel > 2) { - LOGDEBUG("SiStripTemplateReco") << "xsum[] = "; - for(i=0; i TSXSIZE) { - - LOGDEBUG("SiStripTemplateReco") << "x-length of pixel cluster is larger than maximum template size" << ENDL; - if (theVerboseLevel > 2) { - LOGDEBUG("SiStripTemplateReco") << "xsum[] = "; - for(i=0; i 0) { - for(i=lxpix; i>=fxpix; --i) { - xsum[i+shiftx] = xsum[i]; - xsum[i] = 0.f; - } - } else if (shiftx < 0) { - for(i=fxpix; i<=lxpix; ++i) { - xsum[i+shiftx] = xsum[i]; - xsum[i] = 0.f; - } - } - lxpix +=shiftx; - fxpix +=shiftx; - - // If the cluster boundaries are OK, add pesudopixels, otherwise quit - - if(fxpix > 1 && fxpix 1 && lxpix < BSXM2) { - xsum[lxpix+1] = pseudopix; - xsum[lxpix+2] = 0.2f*pseudopix; - } else {return 9;} - - // finally, determine if pixel[0] is a double pixel and make an origin correction if it is - - originx = 0.f; - -// uncertainty and final corrections depend upon total charge bin - - qavg = templ.qavg(); - fq = qtotal/qavg; - if(fq > 3.0f) { - binq=0; - } else { - if(fq > 2.0f) { - binq=1; - } else { - if(fq > 1.70f) { - binq=2; - } else { - binq=3; - } - } - } - - // Return the charge bin via the parameter list unless the charge is too small (then flag it) - - q2bin = binq; - if(qtotal < 1.9f*templ.qmin()) {q2bin = 5;} else { - if(qtotal < 1.9f*templ.qmin(1)) {q2bin = 4;} - } - if (theVerboseLevel > 9) { - LOGDEBUG("SiStripTemplateReco") << - "ID = " << id << - " cot(alpha) = " << cotalpha << " cot(beta) = " << cotbeta << - " nclusx = " << nclusx << ENDL; - } - -// binqerr is the charge bin for error estimation - - binqerr = binq; - if(binqerr > 2) binqerr = 2; - -// Calculate the Vavilov probability that the cluster charge is consistent with a merged cluster - - if(speed < 0) { - templ.vavilov2_pars(mpv, sigmaQ, kappa); -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if((sigmaQ <=0.) || (mpv <= 0.) || (kappa < 0.01) || (kappa > 9.9)) { - throw cms::Exception("DataCorrupt") << "SiStripTemplateSplit::Vavilov parameters mpv/sigmaQ/kappa = " << mpv << "/" << sigmaQ << "/" << kappa << std::endl; - } -#else - assert((sigmaQ > 0.) && (mpv > 0.) && (kappa > 0.01) && (kappa < 10.)); -#endif - xvav = ((double)qtotal-mpv)/sigmaQ; - beta2 = 1.; -// VVIObj is a private port of CERNLIB VVIDIS - sistripvvi::VVIObj vvidist(kappa, beta2, 1); - prvav = vvidist.fcn(xvav); - prob2Q = 1. - prvav; - if(prob2Q < prob2Qmin) {prob2Q = prob2Qmin;} - } else { - prob2Q = -1.f; - } - - -// Next, generate the 3d x-template - - templ.xtemp3d_int(nxpix, nxbin); - -// retrieve the number of x-bins - - xcbin = nxbin/2; - -// Next, decide on chi^2 min search parameters - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(speed < -1 || speed > 2) { - throw cms::Exception("DataCorrupt") << "SiStripTemplateReco::PixelTempReco2D called with illegal speed = " << speed << std::endl; - } -#else - assert(speed >= -1 && speed < 3); -#endif - fxbin = 0; lxbin = nxbin-1; djx = 1; - if(speed > 0) { - djx = 2; - if(speed > 1) {djx = 4;} - } - -// Define the maximum signal to allow before de-weighting a pixel - - sxthr = 1.1f*maxpix; - -// Evaluate pixel-by-pixel uncertainties (weights) for the templ analysis - -// for(i=0; i xtemp(BSXSIZE); - while(deltaj > 0) { - for(j=jmin; j - -namespace { - inline - float stripErrorSquared(const unsigned N, const float uProj) { - if( (float(N)-uProj) > 3.5f ) - return float(N*N)/12.f; - else { - const float P1=-0.339f; - const float P2=0.90f; - const float P3=0.279f; - const float uerr = P1*uProj*std::exp(-uProj*P2)+P3; - return uerr*uerr; - } - } -} - -StripClusterParameterEstimator::LocalValues -StripCPEfromTemplate::localParameters( const SiStripCluster& cluster, - const GeomDetUnit& det, - const LocalTrajectoryParameters& ltp) const -{ - StripClusterParameterEstimator::LocalValues final_lv; - - LocalPoint final_lp; - LocalError final_le; - - // Default reconstruction (needed if template reco fails) - - StripCPE::Param const& p = param( det ); - - LocalVector track = ltp.momentum(); - track *= - ( track.z()<0 ) ? fabs( p.thickness/track.z() ) : - ( track.z()>0 ) ? -fabs( p.thickness/track.z() ) : - p.maxLength/track.mag() ; - - const unsigned N = cluster.amplitudes().size(); - - const float fullProjection = p.coveredStrips( track+p.drift, ltp.position()); - - const float strip = cluster.barycenter() - 0.5f*(1.f-p.backplanecorrection) * fullProjection - + 0.5f*p.coveredStrips(track, ltp.position()); - - LocalPoint default_lp = p.topology->localPosition( strip, ltp.vector() ); - - - - - - // Get the error of the split cluster. - // If the cluster is not split, then the error is -99999.9. - // The split cluster error is in microns and it has to be transformed into centimeteres and then in measurement units - - float uerr2 = -99999.9; - float split_cluster_error = cluster.getSplitClusterError(); - - float local_pitch = p.topology->localPitch( default_lp ); - - if ( split_cluster_error > 0.0 && use_strip_split_cluster_errors ) - { - //cout << endl; - //cout << "Assign split rechit errors" << endl; - // go from microns to cm and then to strip units... - - uerr2 = - (split_cluster_error/10000.0 / local_pitch ) * - (split_cluster_error/10000.0 / local_pitch ); - } - else - { - //cout << endl; - //cout << "Assign default rechit errors" << endl; - uerr2 = stripErrorSquared( N, fabs(fullProjection) ); - } - - - LocalError default_le = p.topology->localError( strip, uerr2, ltp.vector() ); - - - - // Template reconstruction - - int ierr = 9999999; // failed template reco ( if ierr = 0, then, template reco was successful ) - float template_x_pos = -9999999.9; - float template_x_err = -9999999.9; - - // int cluster_size = (int)cluster.amplitudes().size(); - - // do not use template reco for huge clusters - if ( use_template_reco ) - { - - int id = -9999999; - - SiStripDetId ssdid = SiStripDetId( det.geographicalId() ); - - int is_stereo = (int)( ssdid.stereo() ); - - if ( p.moduleGeom == 1 ) // IB1 - { - if ( !is_stereo ) - id = 11; - else - id = 12; - } - else if ( p.moduleGeom == 2 ) // IB2 - { - id = 13; - } - else if ( p.moduleGeom == 3 ) // OB1 - { - id = 16; - } - else if ( p.moduleGeom == 4 ) // OB2 - { - if ( !is_stereo ) - id = 14; - else - id = 15; - } - //else - //cout << "Do not use templates for strip modules other than IB1, IB2, OB1 and OB2" << endl; - - const StripGeomDetUnit* stripdet = (const StripGeomDetUnit*)(&det); - - if ( (id > -9999999) && !(stripdet == nullptr) ) - { - // Variables needed by template reco - float cotalpha = -9999999.9; - float cotbeta = -9999999.9; - float locBy = -9999999.9; - std::vector vec_cluster_charge; - - // Variables returned by template reco - float xrec = -9999999.9; - float sigmax = -9999999.9; - float probx = -9999999.9; - int qbin = -9999999 ; - int speed = template_reco_speed ; - float probQ = -9999999.9; - - - LocalVector lbfield = ( stripdet->surface() ).toLocal( magfield_.inTesla( stripdet->surface().position() ) ); - locBy = lbfield.y(); - - - LocalVector localDir = ltp.momentum()/ltp.momentum().mag(); - float locx = localDir.x(); - float locy = localDir.y(); - float locz = localDir.z(); - cotalpha = locx/locz; - cotbeta = locy/locz; - - - int cluster_size = (int)( (cluster.amplitudes()).size() ); - for (int i=0; ilocalPosition( measurement_position_first_strip_center, ltp.vector() ); - - - SiStripTemplate templ(theStripTemp_); - ierr = SiStripTemplateReco::StripTempReco1D( id, - cotalpha, - cotbeta, - locBy, - vec_cluster_charge, - templ, - xrec, - sigmax, - probx, - qbin, - speed, - probQ ); - - - - // stripCPEtemplateProbability_ = probQ; - // stripCPEtemplateQbin_ = qbin; - - - template_x_pos = xrec / 10000.0 + local_position_first_strip_center.x(); - - if ( split_cluster_error > 0.0 && use_strip_split_cluster_errors ) - { - template_x_err = split_cluster_error/10000.0; - } - else - { - template_x_err = sigmax/10000.0; - } - - - } // if ( id > -9999999 && !stripdet == 0 ) - - } // if ( use_template_reco ) - - - if ( use_template_reco && ierr == 0 ) - { - //cout << "Use template reco " << ierr << endl; - - LocalPoint template_lp( template_x_pos , default_lp.y() , default_lp.z() ); - LocalError template_le( template_x_err*template_x_err, default_le.xy(), default_le.yy() ); - - - final_lv = std::make_pair( template_lp, template_le ); - - } - else - { - //cout << "Use default reco " << ierr << endl; - - final_lv = std::make_pair( default_lp, default_le ); - } - - return final_lv; - - -} - - - diff --git a/RecoLocalTracker/SubCollectionProducers/src/TrackClusterSplitter.cc b/RecoLocalTracker/SubCollectionProducers/src/TrackClusterSplitter.cc deleted file mode 100644 index dd24a1a8fbefd..0000000000000 --- a/RecoLocalTracker/SubCollectionProducers/src/TrackClusterSplitter.cc +++ /dev/null @@ -1,1858 +0,0 @@ -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/InputTag.h" - -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "DataFormats/SiStripCluster/interface/SiStripCluster.h" -#include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" -#include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h" -#include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit1D.h" -#include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h" -#include "DataFormats/Common/interface/DetSetVectorNew.h" - -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/VertexReco/interface/Vertex.h" - -#include "TrackingTools/PatternTools/interface/Trajectory.h" -#include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h" -#include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h" -#include "TrackingTools/GeomPropagators/interface/Propagator.h" -#include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h" -#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" -#include "MagneticField/Engine/interface/MagneticField.h" -#include "TrackingTools/Records/interface/TrackingComponentsRecord.h" -#include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h" -#include "Geometry/Records/interface/GlobalTrackingGeometryRecord.h" - -//added for my stuff H.S. -#include "SimDataFormats/TrackerDigiSimLink/interface/PixelDigiSimLink.h" -#include "DataFormats/SiPixelDigi/interface/PixelDigi.h" -#include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" - -// gavril: the template header files -#include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate.h" -#include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate2D.h" -#include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateSplit.h" -#include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateDefs.h" -#include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateReco.h" - -#include "RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplate.h" -#include "RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplateSplit.h" -#include "RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplateDefs.h" -#include "RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplateReco.h" - -#include "Geometry/TrackerGeometryBuilder/interface/RectangularPixelTopology.h" -#include "Geometry/TrackerGeometryBuilder/interface/PixelGeomDetUnit.h" -#include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h" -#include "DataFormats/SiStripDetId/interface/SiStripDetId.h" - -// for strip sim splitting -#include "SimDataFormats/TrackerDigiSimLink/interface/StripDigiSimLink.h" -#include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h" - -#include -#include -#include "boost/multi_array.hpp" - -#include -#include -using namespace std; - -class TrackClusterSplitter : public edm::stream::EDProducer<> -{ - -public: - TrackClusterSplitter(const edm::ParameterSet& iConfig) ; - ~TrackClusterSplitter() override ; - void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override ; - -private: - edm::EDGetTokenT > pixelClusters_; - edm::EDGetTokenT > stripClusters_; - - bool simSplitPixel_; - bool simSplitStrip_; - bool tmpSplitPixel_; - bool tmpSplitStrip_; - - // Template splitting needs to know the track direction. - // We can use either straight tracks, pixel tracks of fully reconstructed track. - // Straight tracks go from the first pixel verterx in the pixel vertex collection - // to the cluster center of charge (we use pixel vertices because track vertices are - // are not available at this point) - // If we set useStraightTracks_ = True, then straight tracks are used - bool useStraightTracks_; - - // If straight track approximation is not used (useStraightTracks_ = False), then, one can use either fully - // reconstructed tracks (useTrajectories_ = True) or pixel tracks ((useTrajectories_ = False). - // The use of either straight or fully reconstructed tracks give very similar performance. Use straight tracks - // by default because it's faster and less involved. Pixel tracks DO NOT work. - bool useTrajectories_; - - // These are either "generalTracks", if useTrajectories_ = True, or "pixelTracks" if useTrajectories_ = False - edm::EDGetTokenT trajTrackAssociations_; - edm::EDGetTokenT > tracks_; - - // This is the pixel primary vertex collection - edm::EDGetTokenT > vertices_; - - edm::EDGetTokenT< edm::DetSetVector > pixeldigisimlinkToken; - edm::EDGetTokenT< edm::DetSetVector > stripdigisimlinkToken; - - // gavril : what is this for ? - std::string propagatorName_; - edm::ESHandle magfield_; - edm::ESHandle propagator_; - edm::ESHandle geometry_; - - // This is needed if we want to to sim/truth pixel splitting - edm::Handle< edm::DetSetVector > pixeldigisimlink; - - // This is needed if we want to to sim/truth strip splitting - edm::Handle< edm::DetSetVector > stripdigisimlink; - - - // Template declarations - // Pixel templates - std::vector< SiPixelTemplateStore > thePixelTemp_; - std::vector< SiPixelTemplateStore2D > thePixelTemp2D_; - // Strip template - std::vector< SiStripTemplateStore > theStripTemp_; - - // A pointer to a track and a state on the detector - struct TrackAndState - { - TrackAndState(const reco::Track *aTrack, TrajectoryStateOnSurface aState) : - track(aTrack), state(aState) {} - const reco::Track* track; - TrajectoryStateOnSurface state; - }; - - // A pointer to a cluster and a list of tracks on it - template - struct ClusterWithTracks - { - ClusterWithTracks(const Cluster &c) : cluster(&c) {} - const Cluster* cluster; - std::vector tracks; - }; - - typedef ClusterWithTracks SiPixelClusterWithTracks; - typedef ClusterWithTracks SiStripClusterWithTracks; - - - // a subset of a vector, but with vector-like interface. - typedef boost::sub_range > SiPixelClustersWithTracks; - typedef boost::sub_range > SiStripClustersWithTracks; - - - // sim strip split - typedef std::pair SimHitIdpr; - TrackerHitAssociator::Config trackerHitAssociatorConfig_; - std::unique_ptr hitAssociator; - - template - static const C* getCluster(const TrackingRecHit* hit) ; - - template - static const C* equalClusters(const C &c1, const C &c2) - { - return nullptr; - } - - // Find a rechit in a vector of ClusterWithTrack - template class FindCluster - { - - public: - - FindCluster(const TrackingRecHit* hit) : toFind_( getCluster(hit) ) { } - - bool operator()(const ClusterWithTracks &test) const - { - assert(test.cluster); // make sure this is not 0 - return test.cluster == toFind_ || equalClusters(*test.cluster, *toFind_); - } - - private: - - const Cluster* toFind_; - - }; - - // Attach tracks to cluster ?!?! - template - void markClusters(std::map > > >& map, - const TrackingRecHit* hit, - const reco::Track* track, - const TrajectoryStateOnSurface& tsos) const ; - - template - std::unique_ptr > - splitClusters(const std::map > > > &input, - const reco::Vertex &vtx) const ; - - template - void splitCluster(const ClusterWithTracks &cluster, - const GlobalVector &dir, - typename edmNew::DetSetVector::FastFiller &output, - DetId detId) const ; - - /// working data - std::vector allSiPixelClusters; - std::map siPixelDetsWithClusters; - - std::vector allSiStripClusters; - std::map siStripDetsWithClusters; - - -}; - -template<> const SiPixelCluster * TrackClusterSplitter::getCluster(const TrackingRecHit *hit) ; - -template<> -void TrackClusterSplitter::splitCluster (const SiPixelClusterWithTracks &cluster, - const GlobalVector &dir, - edmNew::DetSetVector::FastFiller &output, - DetId detId - ) const ; - -template<> const SiStripCluster * TrackClusterSplitter::getCluster(const TrackingRecHit *hit) ; - -template<> -void TrackClusterSplitter::splitCluster (const SiStripClusterWithTracks &cluster, - const GlobalVector &dir, - edmNew::DetSetVector::FastFiller &output, - DetId detId - ) const ; - - -#define foreach BOOST_FOREACH - -TrackClusterSplitter::TrackClusterSplitter(const edm::ParameterSet& iConfig): - useTrajectories_(iConfig.getParameter("useTrajectories")), - trackerHitAssociatorConfig_(consumesCollector()) -{ - if (useTrajectories_) { - trajTrackAssociations_ = consumes(iConfig.getParameter("trajTrackAssociations")); - } else { - propagatorName_ = iConfig.getParameter("propagator"); - tracks_ = consumes >(iConfig.getParameter("tracks")); - } - - pixelClusters_ = consumes >(iConfig.getParameter("pixelClusters")); - stripClusters_ = consumes >(iConfig.getParameter("stripClusters")); - vertices_ = consumes >(iConfig.getParameter("vertices")); - - produces< edmNew::DetSetVector >(); - - produces< edmNew::DetSetVector >(); - - simSplitPixel_ = (iConfig.getParameter("simSplitPixel")); - simSplitStrip_ = (iConfig.getParameter("simSplitStrip")); - tmpSplitPixel_ = (iConfig.getParameter("tmpSplitPixel")); // not so nice... you don't want two bool but some switch - tmpSplitStrip_ = (iConfig.getParameter("tmpSplitStrip")); - - useStraightTracks_ = (iConfig.getParameter("useStraightTracks")); - - - if ( simSplitPixel_ ) pixeldigisimlinkToken = consumes< edm::DetSetVector >(edm::InputTag("simSiPixelDigis")); - if ( simSplitStrip_ ) stripdigisimlinkToken = consumes< edm::DetSetVector >(edm::InputTag("simSiStripDigis")); - - - - /* - cout << "TrackClusterSplitter : " << endl; - cout << endl << endl << endl; - cout << "(int)simSplitPixel_ = " << (int)simSplitPixel_ << endl; - cout << "(int)simSplitStrip_ = " << (int)simSplitStrip_ << endl; - cout << "(int)tmpSplitPixel_ = " << (int)tmpSplitPixel_ << endl; - cout << "(int)tmpSplitStrip_ = " << (int)tmpSplitStrip_ << endl; - cout << "stripClusters_ = " << stripClusters_ << endl; - cout << "pixelClusters_ = " << pixelClusters_ << endl; - cout << "(int)useTrajectories_ = " << (int)useTrajectories_ << endl; - cout << "trajectories_ = " << trajectories_ << endl; - cout << "propagatorName_ = " << propagatorName_ << endl; - cout << "vertices_ = " << vertices_ << endl; - cout << "useStraightTracks_ = " << useStraightTracks_ << endl; - cout << endl << endl << endl; - */ - - // Load template; 40 for barrel and 41 for endcaps - SiPixelTemplate::pushfile( 40, thePixelTemp_ ); - SiPixelTemplate::pushfile( 41, thePixelTemp_ ); - SiPixelTemplate2D::pushfile( 40, thePixelTemp2D_ ); - SiPixelTemplate2D::pushfile( 41, thePixelTemp2D_ ); - - // Load strip templates - SiStripTemplate::pushfile( 11, theStripTemp_ ); - SiStripTemplate::pushfile( 12, theStripTemp_ ); - SiStripTemplate::pushfile( 13, theStripTemp_ ); - SiStripTemplate::pushfile( 14, theStripTemp_ ); - SiStripTemplate::pushfile( 15, theStripTemp_ ); - SiStripTemplate::pushfile( 16, theStripTemp_ ); - -} - - -template<> -const SiStripCluster* -TrackClusterSplitter::getCluster(const TrackingRecHit* hit) -{ - if ( typeid(*hit) == typeid(SiStripRecHit2D) ) - { - return (static_cast(*hit)).cluster().get(); - } - else if ( typeid(*hit) == typeid(SiStripRecHit1D) ) - { - return (static_cast(*hit)).cluster().get(); - } - else - throw cms::Exception("Unsupported") << "Detid of type " << typeid(*hit).name() << " not supported.\n"; -} - -template<> -const SiPixelCluster* -TrackClusterSplitter::getCluster(const TrackingRecHit* hit) -{ - if ( typeid(*hit) == typeid(SiPixelRecHit) ) - { - return (static_cast(*hit)).cluster().get(); - } - else - throw cms::Exception("Unsupported") << "Detid of type " << typeid(*hit).name() << " not supported.\n"; -} - -TrackClusterSplitter::~TrackClusterSplitter() -{ -} - -void -TrackClusterSplitter::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) -{ - using namespace edm; - - iSetup.get().get(geometry_); - - if ( !useTrajectories_ ) - { - iSetup.get().get( magfield_ ); - iSetup.get().get( "AnalyticalPropagator", propagator_ ); - } - - Handle > inputPixelClusters; - Handle > inputStripClusters; - - iEvent.getByToken(pixelClusters_, inputPixelClusters); - - iEvent.getByToken(stripClusters_, inputStripClusters); - - if(simSplitStrip_) - hitAssociator.reset(new TrackerHitAssociator(iEvent, trackerHitAssociatorConfig_)); - - - allSiPixelClusters.clear(); siPixelDetsWithClusters.clear(); - allSiStripClusters.clear(); siStripDetsWithClusters.clear(); - - - allSiPixelClusters.reserve(inputPixelClusters->dataSize()); // this is important, otherwise push_back invalidates the iterators - allSiStripClusters.reserve(inputStripClusters->dataSize()); // this is important, otherwise push_back invalidates the iterators - - - // fill in the list of all tracks - foreach(const edmNew::DetSet &ds, *inputPixelClusters) - { - std::vector::iterator start = allSiPixelClusters.end(); - allSiPixelClusters.insert(start, ds.begin(), ds.end()); - - std::vector::iterator end = allSiPixelClusters.end(); - siPixelDetsWithClusters[ds.detId()] = SiPixelClustersWithTracks(start,end); - } - - foreach(const edmNew::DetSet &ds, *inputStripClusters) - { - std::vector::iterator start = allSiStripClusters.end(); - allSiStripClusters.insert(start, ds.begin(), ds.end()); - - std::vector::iterator end = allSiStripClusters.end(); - siStripDetsWithClusters[ds.detId()] = SiStripClustersWithTracks(start,end); - } - - if ( useTrajectories_ ) - { - // Here use the fully reconstructed tracks to get the track angle - - Handle trajectories; - iEvent.getByToken(trajTrackAssociations_, trajectories); - for ( TrajTrackAssociationCollection::const_iterator it = trajectories->begin(), - ed = trajectories->end(); it != ed; ++it ) - { - const Trajectory & traj = *it->key; - const reco::Track * tk = &*it->val; - - if ( traj.measurements().size() != tk->recHitsSize() ) - throw cms::Exception("Aargh") << "Sizes don't match: traj " << traj.measurements().size() - << ", tk " << tk->recHitsSize() << "\n"; - - trackingRecHit_iterator it_hit = tk->recHitsBegin(), ed_hit = tk->recHitsEnd(); - - const Trajectory::DataContainer & tms = traj.measurements(); - - size_t i_hit = 0, last_hit = tms.size()-1; - - bool first = true, reversed = false; - - for (; it_hit != ed_hit; ++it_hit, ++i_hit) - { - // ignore hits with no detid - - if ((*it_hit)->geographicalId().rawId() == 0) - { - //cout << "It should never happen that a trackingRecHit has no detector ID !!!!!!!!!!!!!!!!! " << endl; - continue; - } - - // if it's the first hit, check the ordering of track vs trajectory - if (first) - { - - if ((*it_hit)->geographicalId() == tms[i_hit].recHit()->hit()->geographicalId()) - { - reversed = false; - } - else if ((*it_hit)->geographicalId() == tms[last_hit-i_hit].recHit()->hit()->geographicalId()) - { - reversed = true; - } - else - { - throw cms::Exception("Aargh") << "DetIDs don't match either way :-( \n"; - } - } - - const TrackingRecHit *hit = *it_hit; - if ( hit == nullptr || !hit->isValid() ) - continue; - - int subdet = hit->geographicalId().subdetId(); - - if (subdet >= 3) - { // strip - markClusters(siStripDetsWithClusters, hit, tk, tms[reversed ? last_hit-i_hit : i_hit].updatedState()); - } - else if (subdet >= 1) - { // pixel - markClusters(siPixelDetsWithClusters, hit, tk, tms[reversed ? last_hit-i_hit : i_hit].updatedState()); - } - else - { - edm::LogWarning("HitNotFound") << "Hit of type " << typeid(*hit).name() << ", detid " - << hit->geographicalId().rawId() << ", subdet " << subdet; - } - } - } - } - else - { - // Here use the pixel tracks to get the track angles - - Handle > tracks; - iEvent.getByToken(tracks_, tracks); - //TrajectoryStateTransform transform; - foreach (const reco::Track &track, *tracks) - { - FreeTrajectoryState atVtx = trajectoryStateTransform::innerFreeState(track, &*magfield_); - trackingRecHit_iterator it_hit = track.recHitsBegin(), ed_hit = track.recHitsEnd(); - for (; it_hit != ed_hit; ++it_hit) - { - const TrackingRecHit *hit = *it_hit; - if ( hit == nullptr || !hit->isValid() ) - continue; - - int subdet = hit->geographicalId().subdetId(); - - if ( subdet == 0 ) - continue; - - const GeomDet *det = geometry_->idToDet( hit->geographicalId() ); - - if ( det == nullptr ) - { - edm::LogError("MissingDetId") << "DetIDs " << (int)(hit->geographicalId()) << " is not in geometry.\n"; - continue; - } - - TrajectoryStateOnSurface prop = propagator_->propagate(atVtx, det->surface()); - if ( subdet >= 3 ) - { // strip - markClusters(siStripDetsWithClusters, hit, &track, prop); - } - else if (subdet >= 1) - { // pixel - markClusters(siPixelDetsWithClusters, hit, &track, prop); - } - else - { - edm::LogWarning("HitNotFound") << "Hit of type " << typeid(*hit).name() << ", detid " - << hit->geographicalId().rawId() << ", subdet " << subdet; - } - } - } - } - - Handle > vertices; - iEvent.getByToken(vertices_, vertices); - - // Needed in case of simsplit - if ( simSplitPixel_ ) - iEvent.getByToken(pixeldigisimlinkToken, pixeldigisimlink); - - // Needed in case of strip simsplit - if ( simSplitStrip_ ) - iEvent.getByToken(stripdigisimlinkToken, stripdigisimlink); - - // gavril : to do: choose the best vertex here instead of just choosing the first one ? - std::unique_ptr > newPixelClusters( splitClusters( siPixelDetsWithClusters, vertices->front() ) ); - std::unique_ptr > newStripClusters( splitClusters( siStripDetsWithClusters, vertices->front() ) ); - - iEvent.put(std::move(newPixelClusters)); - iEvent.put(std::move(newStripClusters)); - - allSiPixelClusters.clear(); siPixelDetsWithClusters.clear(); - allSiStripClusters.clear(); siStripDetsWithClusters.clear(); - -} - -template -void TrackClusterSplitter::markClusters( std::map > > >& map, - const TrackingRecHit* hit, - const reco::Track* track, - const TrajectoryStateOnSurface& tsos) const -{ - boost::sub_range > >& range = map[hit->geographicalId().rawId()]; - - typedef typename std::vector >::iterator IT; - IT match = std::find_if(range.begin(), range.end(), FindCluster(hit)); - - if ( match != range.end() ) - { - match->tracks.push_back( TrackAndState(track,tsos) ); - } - else - { - edm::LogWarning("ClusterNotFound") << "Cluster of type " << typeid(Cluster).name() << " on detid " - << hit->geographicalId().rawId() << " from hit of type " << typeid(*hit).name(); - } -} - -template -std::unique_ptr > -TrackClusterSplitter::splitClusters(const std::map > > > &input, - const reco::Vertex &vtx) const -{ - auto output = std::make_unique>(); - typedef std::pair > > > pair; - - foreach(const pair &p, input) - { - const GeomDet* det = geometry_->idToDet( DetId(p.first) ); - - if ( det == nullptr ) - { - edm::LogError("MissingDetId") << "DetIDs " << p.first << " is not in geometry.\n"; - continue; - } - - // gavril: Pass the PV instead of direction - // GlobalVector dir(det->position().x() - vtx.x(), det->position().y() - vtx.y(), det->position().z() - vtx.z()); - GlobalVector primary_vtx( vtx.x(), vtx.y(), vtx.z() ); - - // Create output collection - typename edmNew::DetSetVector::FastFiller detset(*output, p.first); - - // fill it - foreach(const ClusterWithTracks &c, p.second) - { - splitCluster(c, primary_vtx, detset, DetId(p.first) ); - } - } - - return output; -} - -template -void TrackClusterSplitter::splitCluster(const ClusterWithTracks &cluster, - const GlobalVector &dir, - typename edmNew::DetSetVector::FastFiller &output, - DetId detId) const -{ - //cout << "Should never be here: TrackClusterSplitter, TrackClusterSplitter::splitCluster(...) !!!!!!!!!!!!!!!!!!!!!!!!!!!!! " << endl; - throw cms::Exception("LogicError", "This should not be called"); -} - -template<> -void TrackClusterSplitter::splitCluster (const SiStripClusterWithTracks& c, - const GlobalVector &vtx, - edmNew::DetSetVector::FastFiller &output, - DetId detId - ) const -{ - if ( simSplitStrip_ ) - { - bool cluster_was_successfully_split = false; - - const SiStripCluster* clust = static_cast(c.cluster); - - std::vector associatedIdpr; - - hitAssociator->associateSimpleRecHitCluster(clust, detId, associatedIdpr); - - size_t splittableClusterSize = 0; - splittableClusterSize = associatedIdpr.size(); - auto const & amp = clust->amplitudes(); - int clusiz = amp.size(); - associatedIdpr.clear(); - - SiStripDetId ssdid( detId ); - - // gavril : sim splitting can be applied to the forward detectors as well... - - if ( ( splittableClusterSize > 1 && amp.size() > 2 ) && - ( (int)ssdid.moduleGeometry() == 1 || - (int)ssdid.moduleGeometry() == 2 || - (int)ssdid.moduleGeometry() == 3 || - (int)ssdid.moduleGeometry() == 4 ) ) - { - - edm::DetSetVector::const_iterator isearch = stripdigisimlink->find(detId); - - int first = clust->firstStrip(); - int last = first + clusiz; - uint16_t rawAmpl = 0, currentAmpl = 0; - - std::vector tmp1, tmp2; - - std::vector firstStrip; - std::vector trackInStrip; - std::vector trackID; - std::vector trackFraction; - std::vector< std::vector > trackAmp; - unsigned int currentChannel( 9999 ); - unsigned int thisTrackID = 0; - - if ( isearch != stripdigisimlink->end() ) - { - edm::DetSet link_detset = (*isearch); - - for ( edm::DetSet::const_iterator linkiter = link_detset.data.begin(); - linkiter != link_detset.data.end(); linkiter++) - { - if ( (int)(linkiter->channel()) >= first && (int)(linkiter->channel()) < last ) - { - int stripIdx = (int)linkiter->channel()-first; - rawAmpl = (uint16_t)(amp[stripIdx]); - - // DigiSimLinks are ordered first by channel; there can be > 1 track, and > 1 simHit for each track - - if ( linkiter->channel() != currentChannel ) - { - // New strip; store amplitudes for the previous one - uint16_t thisAmpl; - - for (size_t i=0; ichannel(); - } - - // Now deal with this new DigiSimLink - thisTrackID = linkiter->SimTrackId(); - - // Have we seen this track yet? - bool newTrack = true; - int thisTrackIdx = 9999; - - for (size_t i=0; i ampTmp; - trackAmp.push_back(ampTmp); - trackFraction.push_back(0); - thisTrackIdx = trackID.size()-1; - } - - trackInStrip[thisTrackIdx] = true; - trackFraction[thisTrackIdx] += linkiter->fraction(); - currentAmpl = rawAmpl; - - } - - }// end of loop over DigiSimLinks - - // we want to continue here!!!! - - std::vector newCluster; - // Fill amplitudes for the last strip and create a cluster for each track - uint16_t thisAmpl; - - for (size_t i=0; i < trackID.size(); ++i) - { - if ( trackInStrip[i] ) - { - if ( ( thisAmpl=rawAmpl ) < 254 ) - thisAmpl = min(uint16_t(253), max(uint16_t(0), (uint16_t)(rawAmpl*trackFraction[i]+0.5))); - - if ( thisAmpl > 0 ) - trackAmp[i].push_back( thisAmpl ); - //else - //cout << "thisAmpl = " << (int)thisAmpl << endl; - } - - newCluster.push_back( SiStripCluster( - firstStrip[i], - trackAmp[i].begin(), - trackAmp[i].end() ) ); - - } - - - for ( size_t i=0; i 0.0 && firstStrip[i] != 9999 && !trackAmp[i].empty() ) - { - // gavril : I think this should work - output.push_back( newCluster[i] ); - - //cout << endl << endl << endl; - //cout << "(int)(newCluster[i].amplitudes().size()) = " << (int)(newCluster[i].amplitudes().size()) << endl; - //for ( int j=0; j<(int)(newCluster[i].amplitudes().size()); ++j ) - //cout << "(newCluster[i].amplitudes())[j] = " << (int)(newCluster[i].amplitudes())[j] << endl; - - cluster_was_successfully_split = true; - } - else - { - //std::cout << "\t\t Rejecting new cluster" << std::endl; - - // gavril : I think this pointer should be deleted above - //delete newCluster[i]; - } - } - - } // if ( isearch != stripdigisimlink->end() ) ... - else - { - // Do nothing... - } - } - - - if ( !cluster_was_successfully_split ) - output.push_back( *c.cluster ); - - } // end of if ( strip_simSplit_ )... - - else if ( tmpSplitStrip_ ) - { - bool cluster_was_successfully_split = false; - - const SiStripCluster* theStripCluster = static_cast(c.cluster); - - if ( theStripCluster ) - { - //SiStripDetId ssdid( theStripCluster->geographicalId() ); - SiStripDetId ssdid( detId.rawId() ); - - // Do not attempt to split clusters of size less than or equal to one. - // Only split clusters in IB1, IB2, OB1, OB2 (TIB and TOB). - - if ( (int)theStripCluster->amplitudes().size() <= 1 || - ( (int)ssdid.moduleGeometry() != 1 && - (int)ssdid.moduleGeometry() != 2 && - (int)ssdid.moduleGeometry() != 3 && - (int)ssdid.moduleGeometry() != 4 ) ) - { - // Do nothing. - //cout << endl; - //cout << "Will NOT attempt to split this clusters: " << endl; - //cout << "(int)theStripCluster->amplitudes().size() = " << (int)theStripCluster->amplitudes().size() << endl; - //cout << "(int)ssdid.moduleGeometry() = " << (int)ssdid.moduleGeometry() << endl; - - } - else // if ( (int)theStripCluster->amplitudes().size() <= 1 ) - { - - //cout << endl; - //cout << "Will attempt to split this clusters: " << endl; - - int ID = -99999; - - int is_stereo = (int)( ssdid.stereo() ); - - if ( ssdid.moduleGeometry() == 1 ) // IB1 - { - if ( !is_stereo ) - ID = 11; - else - ID = 12; - } - else if ( ssdid.moduleGeometry() == 2 ) // IB2 - { - ID = 13; - } - else if ( ssdid.moduleGeometry() == 3 ) // OB1 - { - ID = 16; - } - else if ( ssdid.moduleGeometry() == 4 ) // OB2 - { - if ( !is_stereo ) - ID = 14; - else - ID = 15; - } - else - { - throw cms::Exception("TrackClusterSplitter::splitCluster") - << "\nERROR: Wrong strip teplate ID. Should only use templates for IB1, IB2, OB1 and OB2 !!!" << "\n\n"; - } - - - - - // Begin: determine incident angles ============================================================ - - float cotalpha_ = -99999.9; - float cotbeta_ = -99999.9; - - // First, determine track angles from straight track approximation - - // Find crude cluster center - // gavril : This is in local coordinates ? - float xcenter = theStripCluster->barycenter(); - - const GeomDetUnit* theDet = geometry_->idToDetUnit( detId ); - const StripGeomDetUnit* stripDet = dynamic_cast( theDet ); - - if ( !stripDet ) - { - throw cms::Exception("TrackClusterSplitter : ") - << "\nERROR: Wrong stripDet !!! " << "\n\n"; - } - - - const StripTopology* theTopol = &( stripDet->specificTopology() ); - - // Transform from measurement to local coordinates (in cm) - // gavril: may have to differently if kicks/bows are introduced. However, at this point there are no tracks...: - // LocalPoint lp = theTopol->localPosition( xcenter, /*const Topology::LocalTrackPred & */ trkPred ); - - // gavril : What is lp.y() for strips ? It is zero, but is that the strip center or one of the ends ? - LocalPoint lp = theTopol->localPosition( xcenter ); - - // Transform from local to global coordinates - GlobalPoint gp0 = theDet->surface().toGlobal( lp ); - - // Make a vector pointing from the PV to the cluster center - GlobalPoint gp(gp0.x()-vtx.x(), gp0.y()-vtx.y(), gp0.z()-vtx.z() ); - - // Make gp a unit vector, gv, pointing from the PV to the cluster center - float gp_mod = sqrt( gp.x()*gp.x() + gp.y()*gp.y() + gp.z()*gp.z() ); - float gpx = gp.x()/gp_mod; - float gpy = gp.y()/gp_mod; - float gpz = gp.z()/gp_mod; - GlobalVector gv(gpx, gpy, gpz); - - // Make unit vectors in local coordinates and then transform them in global coordinates - const Local3DVector lvx(1.0, 0.0, 0.0); - GlobalVector gvx = theDet->surface().toGlobal( lvx ); - const Local3DVector lvy(0.0, 1.0, 0.0); - GlobalVector gvy = theDet->surface().toGlobal( lvy ); - const Local3DVector lvz(0.0, 0.0, 1.0); - GlobalVector gvz = theDet->surface().toGlobal( lvz ); - - // Calculate angles alpha and beta - float gv_dot_gvx = gv.x()*gvx.x() + gv.y()*gvx.y() + gv.z()*gvx.z(); - float gv_dot_gvy = gv.x()*gvy.x() + gv.y()*gvy.y() + gv.z()*gvy.z(); - float gv_dot_gvz = gv.x()*gvz.x() + gv.y()*gvz.y() + gv.z()*gvz.z(); - - // gavril : check beta !!!!!!!!!!!! - //float alpha_ = atan2( gv_dot_gvz, gv_dot_gvx ); - //float beta_ = atan2( gv_dot_gvz, gv_dot_gvy ); - - cotalpha_ = gv_dot_gvx / gv_dot_gvz; - cotbeta_ = gv_dot_gvy / gv_dot_gvz; - - // Attempt to get a better angle from tracks (either pixel tracks or full tracks) - if ( !useStraightTracks_ ) - { - //cout << "TrackClusterSplitter.cc : " << endl; - //cout << "Should not be here for now !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! " << endl; - - // Use either pixel tracks (useTrajectories_ = False) or fully reconstructed tracks (useTrajectories_ = True) - // When pixel/full tracks are not associated with the current cluster, will use angles from straight tracks - - // These are the tracks associated with this cluster - std::vector vec_tracks_states = c.tracks; - - if ( (int)vec_tracks_states.size() > 0 ) - { - //cout << "There is at least one track associated with this cluster. Pick the one with largest Pt." << endl; - //cout << "(int)vec_tracks_states.size() = " << (int)vec_tracks_states.size() << endl; - - int index_max_pt = -99999; // index of the track with the highest Pt - float max_pt = -99999.9; - - for (int i=0; i<(int)vec_tracks_states.size(); ++i ) - { - const reco::Track* one_track = vec_tracks_states[i].track; - - if ( one_track->pt() > max_pt ) - { - index_max_pt = i; - max_pt = one_track->pt(); - } - } - - // Pick the tsos from the track with highest Pt - // gavril: Should we use highest Pt or best Chi2 ? - TrajectoryStateOnSurface one_tsos = vec_tracks_states[index_max_pt].state; - - LocalTrajectoryParameters ltp = one_tsos.localParameters(); - - LocalVector localDir = ltp.momentum()/ltp.momentum().mag(); - - float locx = localDir.x(); - float locy = localDir.y(); - float locz = localDir.z(); - - //alpha_ = atan2( locz, locx ); - //beta_ = atan2( locz, locy ); - - cotalpha_ = locx/locz; - cotbeta_ = locy/locz; - - } // if ( (int)vec_tracks_states.size() > 0 ) - - } // if ( !useStraightTracks_ ) - - - // End: determine incident angles ============================================================ - - - // Calculate strip cluster charge and store amplitudes in vector for later use - - //cout << endl; - //cout << "Calculate strip cluster charge and store amplitudes in vector for later use" << endl; - - float strip_cluster_charge = 0.0; - std::vector vec_cluster_charge; - vec_cluster_charge.clear(); - int cluster_size = (int)( (theStripCluster->amplitudes()).size() ); - - int cluster_charge = 0; - for (int i=0; iamplitudes())[i] ); - - strip_cluster_charge += current_strip_charge; - vec_cluster_charge.push_back( current_strip_charge ); - - cluster_charge +=current_strip_charge; - } - - - //cout << endl; - //cout << "Calling strip qbin to see if the strip cluster has to be split..." << endl; - SiStripTemplate strip_templ_(theStripTemp_); - int strip_templQbin_ = strip_templ_.qbin( ID, cotalpha_, cotbeta_, strip_cluster_charge ); - - if ( strip_templQbin_ < 0 || strip_templQbin_ > 5 ) - { - // Do nothing... - // cout << "Wrong strip strip_templQbin_ = " << strip_templQbin_ << endl; - } // if ( strip_templQbin_ < 0 || strip_templQbin_ > 5 ) - else // if ( strip_templQbin_ < 0 || strip_templQbin_ > 5 ) {...} else - { - if ( strip_templQbin_ != 0 ) - { - // Do not split this cluster. Do nothing. - //cout << endl; - //cout << "Do NOT split this cluster" << endl; - - } // if ( strip_templQbin_ != 0 ) - else // if ( templQbin_ != 0 ) {...} else - { - //cout << endl; - //cout << "Split this cluster" << endl; - - // gavril : Is this OK ? - uint16_t first_strip = theStripCluster->firstStrip(); - - LocalVector lbfield = ( stripDet->surface() ).toLocal( magfield_->inTesla( stripDet->surface().position() ) ); - float locBy = lbfield.y(); - - // Initialize values coming back from SiStripTemplateSplit::StripTempSplit - float stripTemplXrec1_ = -99999.9; - float stripTemplXrec2_ = -99999.9; - float stripTemplSigmaX_ = -99999.9; - float stripTemplProbX_ = -99999.9; - int stripTemplQbin_ = -99999; - float stripTemplProbQ_ = -99999.9; - - - /* - cout << endl; - cout << "About to call SiStripTemplateSplit::StripTempSplit(...)" << endl; - - cout << endl; - cout << "ID = " << ID << endl; - cout << "cotalpha_ = " << cotalpha_ << endl; - cout << "cotbeta_ = " << cotbeta_ << endl; - cout << "locBy = " << locBy << endl; - cout << "Amplitudes: "; - for (int i=0; i<(int)vec_cluster_charge.size(); ++i) - cout << vec_cluster_charge[i] << ", "; - cout << endl; - */ - - int ierr = - SiStripTemplateSplit::StripTempSplit(ID, - cotalpha_, cotbeta_, - locBy, - vec_cluster_charge, - strip_templ_, - stripTemplXrec1_, - stripTemplXrec2_, - stripTemplSigmaX_, - stripTemplProbX_, - stripTemplQbin_, - stripTemplProbQ_ ); - - - - stripTemplXrec1_ += 2*strip_templ_.xsize(); - stripTemplXrec2_ += 2*strip_templ_.xsize(); - - - - if ( ierr != 0 ) - { - //cout << endl; - //cout << "Strip cluster splitting failed: ierr = " << ierr << endl; - } - else // if ( ierr != 0 ) - { - // Cluster was successfully split. - // Make the two split clusters and put them in the split cluster collection - - //cout << endl; - //cout << "Cluster was successfully split" << endl; - - cluster_was_successfully_split = true; - - std::vector strip_cluster1; - std::vector strip_cluster2; - - strip_cluster1.clear(); - strip_cluster2.clear(); - - // gavril : Is this OK ?!?!?!?! - for (int i=0; i vecSiStripDigi1; - vecSiStripDigi1.clear(); - int strip_cluster1_size = (int)strip_cluster1.size(); - for (int i=2; i 0.0 ) - { - SiStripDigi current_digi1( first_strip + i-2, strip_cluster1[i] ); - - vecSiStripDigi1.push_back( current_digi1 ); - } - } - - - - vector vecSiStripDigi2; - vecSiStripDigi2.clear(); - int strip_cluster2_size = (int)strip_cluster2.size(); - for (int i=2; i 0.0 ) - { - SiStripDigi current_digi2( first_strip + i-2, strip_cluster2[i] ); - - vecSiStripDigi2.push_back( current_digi2 ); - } - } - - - - - std::vector::const_iterator SiStripDigiIterBegin1 = vecSiStripDigi1.begin(); - std::vector::const_iterator SiStripDigiIterEnd1 = vecSiStripDigi1.end(); - std::pair::const_iterator, - std::vector::const_iterator> SiStripDigiRange1 - = make_pair(SiStripDigiIterBegin1, SiStripDigiIterEnd1); - - //if ( SiStripDigiIterBegin1 == SiStripDigiIterEnd1 ) - //{ - // throw cms::Exception("TrackClusterSplitter : ") - //<< "\nERROR: SiStripDigiIterBegin1 = SiStripDigiIterEnd1 !!!" << "\n\n"; - //} - - std::vector::const_iterator SiStripDigiIterBegin2 = vecSiStripDigi2.begin(); - std::vector::const_iterator SiStripDigiIterEnd2 = vecSiStripDigi2.end(); - std::pair::const_iterator, - std::vector::const_iterator> SiStripDigiRange2 - = make_pair(SiStripDigiIterBegin2, SiStripDigiIterEnd2); - - // Sanity check... - //if ( SiStripDigiIterBegin2 == SiStripDigiIterEnd2 ) - //{ - // cout << endl; - // cout << "SiStripDigiIterBegin2 = SiStripDigiIterEnd2 !!!!!!!!!!!!!!!" << endl; - //} - - - // Save the split clusters - - if ( SiStripDigiIterBegin1 != SiStripDigiIterEnd1 ) - { - // gavril : Raw id ? - SiStripCluster cl1( SiStripDigiRange1 ); - - cl1.setSplitClusterError( stripTemplSigmaX_ ); - - output.push_back( cl1 ); - - if ( (int)cl1.amplitudes().size() <= 0 ) - { - throw cms::Exception("TrackClusterSplitter : ") - << "\nERROR: (1) Wrong split cluster of size = " << (int)cl1.amplitudes().size() << "\n\n"; - } - - } // if ( SiStripDigiIterBegin1 != SiStripDigiIterEnd1 ) - - if ( SiStripDigiIterBegin2 != SiStripDigiIterEnd2 ) - { - // gavril : Raw id ? - SiStripCluster cl2( SiStripDigiRange2 ); - cl2.setSplitClusterError( stripTemplSigmaX_ ); - output.push_back( cl2 ); - - if ( (int)cl2.amplitudes().size() <= 0 ) - { - throw cms::Exception("TrackClusterSplitter : ") - << "\nERROR: (2) Wrong split cluster of size = " << (int)cl2.amplitudes().size() << "\n\n"; - } - - } // if ( SiStripDigiIterBegin2 != SiStripDigiIterEnd2 ) - - - - } // else // if ( ierr != 0 ) - - } // else // if ( strip_templQbin_ != 0 ) {...} else - - } // else // if ( strip_templQbin_ < 0 || strip_templQbin_ > 5 ) {...} else - - } // else // if ( (int)theStripCluster->amplitudes().size() <= 1 ) - - - if ( !cluster_was_successfully_split ) - output.push_back( *c.cluster ); - - } // if ( theStripCluster ) - else - { - throw cms::Exception("TrackClusterSplitter : ") - << "\nERROR: This is not a SiStripCluster !!!" << "\n\n"; - } - - } // else if ( strip_tmpSplit_ ) - else - { - // gavril : Neither sim nor template splitter. Just add the cluster as it was. - output.push_back( *c.cluster ); - } -} - -template<> -void TrackClusterSplitter::splitCluster (const SiPixelClusterWithTracks &c, - const GlobalVector &vtx, - edmNew::DetSetVector::FastFiller &output, - DetId detId - ) const -{ - // The sim splitter: - if ( simSplitPixel_ ) - { - // cout << "Cluster splitting using simhits " << endl; - - int minPixelRow = (*c.cluster).minPixelRow(); - int maxPixelRow = (*c.cluster).maxPixelRow(); - int minPixelCol = (*c.cluster).minPixelCol(); - int maxPixelCol = (*c.cluster).maxPixelCol(); - int dsl = 0; // number of digisimlinks - - edm::DetSetVector::const_iterator isearch = pixeldigisimlink->find(output.id()); - if (isearch != pixeldigisimlink->end()){ - edm::DetSet digiLink = (*isearch); - - edm::DetSet::const_iterator linkiter = digiLink.data.begin(); - //create a vector for the track ids in the digisimlinks - std::vector simTrackIdV; - simTrackIdV.clear(); - //create a vector for the new splittedClusters - std::vector splittedCluster; - splittedCluster.clear(); - - for ( ; linkiter != digiLink.data.end(); linkiter++) - { // loop over all digisimlinks - dsl++; - std::pair pixel_coord = PixelDigi::channelToPixel(linkiter->channel()); - - // is the digisimlink inside the cluster boundaries? - if ( pixel_coord.first <= maxPixelRow && - pixel_coord.first >= minPixelRow && - pixel_coord.second <= maxPixelCol && - pixel_coord.second >= minPixelCol ) - { - bool inStock(false); // did we see this simTrackId before? - - SiPixelCluster::PixelPos newPixelPos(pixel_coord.first, pixel_coord.second); // coordinates to the pixel - - //loop over the pixels from the cluster to get the charge in this pixel - int newPixelCharge(0); //fraction times charge in the original cluster pixel - - const std::vector& pixvector = (*c.cluster).pixels(); - - for(std::vector::const_iterator itPix = pixvector.begin(); itPix != pixvector.end(); itPix++) - { - if (((int) itPix->x) == ((int) pixel_coord.first)&&(((int) itPix->y) == ((int) pixel_coord.second))) - { - newPixelCharge = (int) (linkiter->fraction()*itPix->adc); - } - } - - if ( newPixelCharge < 2500 ) - continue; - - //add the pixel to an already existing cluster if the charge is above the threshold - int clusVecPos = 0; - std::vector::const_iterator sTIter = simTrackIdV.begin(); - - for ( ; sTIter < simTrackIdV.end(); sTIter++) - { - if (((*sTIter)== (int) linkiter->SimTrackId())) - { - inStock=true; // now we saw this id before - // // std::cout << " adding a pixel to the cluster " << (int) (clusVecPos) <SimTrackId()); // add the track id to the vector - splittedCluster.push_back(SiPixelCluster(newPixelPos,newPixelCharge)); // add the cluster to the vector - } - } - } - - // std::cout << "will add clusters : simTrackIdV.size() " << simTrackIdV.size() << std::endl; - - if ( ( ( (int)simTrackIdV.size() ) == 1 ) || ( *c.cluster).size()==1 ) - { - // cout << "putting in this cluster" << endl; - output.push_back(*c.cluster ); - // std::cout << "cluster added " << output.size() << std::endl; - } - else - { - for (std::vector::const_iterator cIter = splittedCluster.begin(); cIter != splittedCluster.end(); cIter++ ) - { - output.push_back( (*cIter) ); - } - } - - simTrackIdV.clear(); - splittedCluster.clear(); - }//if (isearch != pixeldigisimlink->end()) - } - else if ( tmpSplitPixel_ ) - { - bool cluster_was_successfully_split = false; - - const SiPixelCluster* thePixelCluster = static_cast(c.cluster); - - if ( thePixelCluster ) - { - // Do not attempt to split clusters of size one - if ( (int)thePixelCluster->size() <= 1 ) - { - // Do nothing. - //cout << "Will not attempt to split this clusters: " << endl; - //cout << "(int)thePixelCluster->size() = " << (int)thePixelCluster->size() << endl; - } - else - { - // For barrel use template id 40 and for endcaps use template id 41 - int ID = -99999; - if ( (int)detId.subdetId() == (int)PixelSubdetector::PixelBarrel ) - { - // cout << "We are in the barrel : " << (int)PixelSubdetector::PixelBarrel << endl; - ID = 40; - } - else if ( (int)detId.subdetId() == (int)PixelSubdetector::PixelEndcap ) - { - // cout << "We are in the endcap : " << (int)PixelSubdetector::PixelEndcap << endl; - ID = 41; - } - else - { - // cout << "Not a pixel detector !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! " << endl; - } - - - // Begin: determine incident angles ============================================================ - - float cotalpha_ = -99999.9; - float cotbeta_ = -99999.9; - - // First, determine track angles from straight track approximation - - // Find crude cluster center. - float xcenter = thePixelCluster->x(); - float ycenter = thePixelCluster->y(); - - const GeomDetUnit* theDet = geometry_->idToDetUnit( detId ); - const PixelGeomDetUnit* pixDet = dynamic_cast( theDet ); - - const PixelTopology* theTopol = (&(pixDet->specificTopology())); - - // Transform from measurement to local coordinates (in cm) - LocalPoint lp = theTopol->localPosition( MeasurementPoint(xcenter, ycenter) ); - - // Transform from local to global coordinates - GlobalPoint gp0 = theDet->surface().toGlobal( lp ); - - // Make a vector pointing from the PV to the cluster center - GlobalPoint gp(gp0.x()-vtx.x(), gp0.y()-vtx.y(), gp0.z()-vtx.z() ); - - // Make gp a unit vector, gv, pointing from the PV to the cluster center - float gp_mod = sqrt( gp.x()*gp.x() + gp.y()*gp.y() + gp.z()*gp.z() ); - float gpx = gp.x()/gp_mod; - float gpy = gp.y()/gp_mod; - float gpz = gp.z()/gp_mod; - GlobalVector gv(gpx, gpy, gpz); - - // Make unit vectors in local coordinates and then transform them in global coordinates - const Local3DVector lvx(1.0, 0.0, 0.0); - GlobalVector gvx = theDet->surface().toGlobal( lvx ); - const Local3DVector lvy(0.0, 1.0, 0.0); - GlobalVector gvy = theDet->surface().toGlobal( lvy ); - const Local3DVector lvz(0.0, 0.0, 1.0); - GlobalVector gvz = theDet->surface().toGlobal( lvz ); - - // Calculate angles alpha and beta - float gv_dot_gvx = gv.x()*gvx.x() + gv.y()*gvx.y() + gv.z()*gvx.z(); - float gv_dot_gvy = gv.x()*gvy.x() + gv.y()*gvy.y() + gv.z()*gvy.z(); - float gv_dot_gvz = gv.x()*gvz.x() + gv.y()*gvz.y() + gv.z()*gvz.z(); - - //float alpha_ = atan2( gv_dot_gvz, gv_dot_gvx ); - //float beta_ = atan2( gv_dot_gvz, gv_dot_gvy ); - - cotalpha_ = gv_dot_gvx / gv_dot_gvz; - cotbeta_ = gv_dot_gvy / gv_dot_gvz; - - - - - // Attempt to get a better angle from tracks (either pixel tracks or full tracks) - if ( !useStraightTracks_ ) - { - // Use either pixel tracks (useTrajectories_ = False) or fully reconstructed tracks (useTrajectories_ = True) - // When pixel/full tracks are not associated with the current cluster, will use angles from straight tracks - - // These are the tracks associated with this cluster - std::vector vec_tracks_states = c.tracks; - - - - if ( (int)vec_tracks_states.size() > 0 ) - { - //cout << "There is at least one track associated with this cluster. Pick the one with largest Pt." << endl; - //cout << "(int)vec_tracks_states.size() = " << (int)vec_tracks_states.size() << endl; - - int index_max_pt = -99999; // index of the track with the highest Pt - float max_pt = -99999.9; - - for (int i=0; i<(int)vec_tracks_states.size(); ++i ) - { - const reco::Track* one_track = vec_tracks_states[i].track; - - if ( one_track->pt() > max_pt ) - { - index_max_pt = i; - max_pt = one_track->pt(); - } - } - - // Pick the tsos from the track with highest Pt - // gavril: Should we use highest Pt or best Chi2 ? - TrajectoryStateOnSurface one_tsos = vec_tracks_states[index_max_pt].state; - - LocalTrajectoryParameters ltp = one_tsos.localParameters(); - - LocalVector localDir = ltp.momentum()/ltp.momentum().mag(); - - float locx = localDir.x(); - float locy = localDir.y(); - float locz = localDir.z(); - - //alpha_ = atan2( locz, locx ); - //beta_ = atan2( locz, locy ); - - cotalpha_ = locx/locz; - cotbeta_ = locy/locz; - - - - } // if ( (int)vec_tracks_states.size() > 0 ) - - } // if ( !useStraightTracks_ ) - - // End: determine incident angles ============================================================ - - - - //cout << "Calling qbin to see if the cluster has to be split..." << endl; - SiPixelTemplate templ_(thePixelTemp_); - SiPixelTemplate2D templ2D_(thePixelTemp2D_); - int templQbin_ = templ_.qbin( ID, cotalpha_, cotbeta_, thePixelCluster->charge() ); - - if ( templQbin_ < 0 || templQbin_ > 5 ) - { - // gavril : check this.... - // cout << "Template call failed. Cannot decide if cluster should be split !!!!!!! " << endl; - // cout << "Do nothing." << endl; - } - else // if ( templQbin_ < 0 || templQbin_ > 5 ) {...} else - { - //cout << " Returned OK from PixelTempReco2D..." << endl; - - // Check for split clusters: we split the clusters with larger than expected charge: templQbin_ == 0 - if ( templQbin_ != 0 ) - { - // gavril: do not split this cluster - //cout << "TEMPLATE SPLITTER SAYS : NO SPLIT " << endl; - //cout << "This cluster will note be split !!!!!!!!!! " << endl; - } - else // if ( templQbin_ != 0 ) {...} else - { - //cout << "TEMPLATE SPLITTER SAYS : SPLIT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; - //cout << "Found a cluster that has to be split. templQbin_ = " << templQbin_ << endl; - - // gavril: Call the template splitter - //cout << "Calling the splitter..." << endl; - - // Put the pixels of this clusters in a 2x2 array to be used by the template splitter - - const std::vector & pixVec = thePixelCluster->pixels(); - std::vector::const_iterator pixIter = pixVec.begin(), pixEnd = pixVec.end(); - - const int cluster_matrix_size_x = 13; - const int cluster_matrix_size_y = 21; - - boost::multi_array clust_array_2d(boost::extents[cluster_matrix_size_x][cluster_matrix_size_y]); - - int row_offset = thePixelCluster->minPixelRow(); - int col_offset = thePixelCluster->minPixelCol(); - - // Copy clust's pixels (calibrated in electrons) into clust_array_2d; - - for ( ; pixIter != pixEnd; ++pixIter ) - { - int irow = int(pixIter->x) - row_offset; // do we need +0.5 ??? - int icol = int(pixIter->y) - col_offset; // do we need +0.5 ??? - - if ( irowadc; - } - } - - // Make and fill the bool arrays flagging double pixels - std::vector ydouble(cluster_matrix_size_y), xdouble(cluster_matrix_size_x); - - // x directions (shorter), rows - for (int irow = 0; irow < cluster_matrix_size_x; ++irow) - { - xdouble[irow] = theTopol->isItBigPixelInX( irow+row_offset ); - } - - // y directions (longer), columns - for (int icol = 0; icol < cluster_matrix_size_y; ++icol) - { - ydouble[icol] = theTopol->isItBigPixelInY( icol+col_offset ); - } - - // gavril: Initialize values coming back from SiPixelTemplateSplit::PixelTempSplit - float templYrec1_ = -99999.9; - float templYrec2_ = -99999.9; - float templSigmaY_ = -99999.9; - float templProbY_ = -99999.9; - float templXrec1_ = -99999.9; - float templXrec2_ = -99999.9; - float templSigmaX_ = -99999.9; - float templProbX_ = -99999.9; - float dchisq = -99999.9; - float templProbQ_ = -99999.9; - - int ierr = - SiPixelTemplateSplit::PixelTempSplit( ID, - cotalpha_, cotbeta_, - clust_array_2d, - ydouble, xdouble, - templ_, - templYrec1_, templYrec2_, templSigmaY_, templProbY_, - templXrec1_, templXrec2_, templSigmaX_, templProbX_, - templQbin_, - templProbQ_, - true, - dchisq, - templ2D_ ); - - if ( ierr != 0 ) - { - // cout << "Cluster splitting failed: ierr = " << ierr << endl; - } - else - { - // gavril: Cluster was successfully split. - // gavril: Make the two split clusters and put them in the split cluster collection - //cout << "Cluster splitting OK: ierr = " << ierr << endl; - - // 2D templates have origin at the lower left corner of template2d[1][1] which is - // also 2 pixels larger than the cluster container - - float xsize = templ_.xsize(); // this is the pixel x-size in microns - float ysize = templ_.ysize(); // this is the pixel y-size in microns - - // Shift the coordinates to the 2-D template system - float yrecp1 = -99999.9; - float yrecp2 = -99999.9; - float xrecp1 = -99999.9; - float xrecp2 = -99999.9; - - if ( ydouble[0] ) - { - yrecp1 = templYrec1_ + ysize; - yrecp2 = templYrec2_ + ysize; - } - else - { - yrecp1 = templYrec1_ + ysize/2.0; - yrecp2 = templYrec2_ + ysize/2.0; - } - - if ( xdouble[0] ) - { - xrecp1 = templXrec1_ + xsize; - xrecp2 = templXrec2_ + xsize; - } - else - { - xrecp1 = templXrec1_ + xsize/2.0; - xrecp2 = templXrec2_ + xsize/2.0; - } - - // The xytemp method adds charge to a zeroed buffer - - float template2d1[BXM2][BYM2]; - float template2d2[BXM2][BYM2]; - - for ( int j=0; j 5 ) {...} else - - } // if ( (int)thePixelCluster->size() <= 1 ) {... } else - - if ( !cluster_was_successfully_split ) - output.push_back(*c.cluster); - - } // if ( theSiPixelCluster ) - else - { - throw cms::Exception("TrackClusterSplitter :") - << "This is not a SiPixelCluster !!! " << "\n"; - } - } - else - { - // gavril : Neither sim nor template splitter. Just add the cluster as it was. - // original from G.P. - output.push_back( *c.cluster ); - } -} - -#include "FWCore/PluginManager/interface/ModuleDef.h" -#include "FWCore/Framework/interface/MakerMacros.h" -DEFINE_FWK_MODULE(TrackClusterSplitter); diff --git a/RecoLocalTracker/SubCollectionProducers/test/run_simsplit.py b/RecoLocalTracker/SubCollectionProducers/test/run_simsplit.py deleted file mode 100644 index a3acc7e973150..0000000000000 --- a/RecoLocalTracker/SubCollectionProducers/test/run_simsplit.py +++ /dev/null @@ -1,181 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -process = cms.Process('SPLIT') -# import of standard configurations -process.load('Configuration.StandardSequences.Services_cff') -process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') -process.load('FWCore.MessageService.MessageLogger_cfi') -process.load('Configuration.StandardSequences.Services_cff') -process.load('Configuration.EventContent.EventContent_cff') -process.load('Configuration.StandardSequences.GeometryDB_cff') -process.load('Configuration.StandardSequences.MagneticField_38T_cff') -process.load('Configuration.StandardSequences.RawToDigi_cff') -process.load('Configuration.StandardSequences.Reconstruction_cff') -process.load('Configuration.StandardSequences.EndOfProcess_cff') -process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') -process.load("SimGeneral.MixingModule.mixNoPU_cfi") -process.load('Configuration/StandardSequences/Simulation_cff') -process.load('Configuration/StandardSequences/SimL1Emulator_cff') -process.load('Configuration/StandardSequences/DigiToRaw_cff') -process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') - -process.maxEvents = cms.untracked.PSet( - input = cms.untracked.int32(100) -) -process.MessageLogger.cerr.FwkReport.reportEvery = 10 -# Input source -process.source = cms.Source("PoolSource", - secondaryFileNames = cms.untracked.vstring(), - fileNames = cms.untracked.vstring( - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTT_1500_8TeV_Tauola_cfi_py_GEN_SIM_DIGI_L1_DIGI2RAW_HLT.root' -), -) - -# from Jean-Roch -process.load("RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTemplate_cfi") -process.StripCPEfromTrackAngleESProducer = process.StripCPEfromTemplateESProducer.clone(ComponentName='StripCPEfromTrackAngle') - -process.load("RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTemplate_cfi") -process.StripCPEfromTemplateESProducer.UseTemplateReco = True - -# Include the latest pixel templates, which are not in DB. -# These are to be used for pixel splitting. -process.load('RecoLocalTracker.SiPixelRecHits.PixelCPETemplateReco_cfi') -process.templates.LoadTemplatesFromDB = False - -# This is the default speed. Recommended. -process.StripCPEfromTrackAngleESProducer.TemplateRecoSpeed = 0; - -# Split clusters have larger errors. Appropriate errors can be -# assigned by turning UseStripSplitClusterErrors = True. The strip hit pull -# distributons improve considerably, but it does not help with b-tagging, -# so leave it False by default -process.StripCPEfromTrackAngleESProducer.UseStripSplitClusterErrors = True - -# Turn OFF track hit sharing -process.load("TrackingTools.TrajectoryCleaning.TrajectoryCleanerBySharedHits_cfi") -process.trajectoryCleanerBySharedHits.fractionShared = 0.0 -process.trajectoryCleanerBySharedHits.allowSharedFirstHit = False -process.load("RecoTracker.FinalTrackSelectors.simpleTrackListMerger_cfi") -process.load("RecoTracker.FinalTrackSelectors.trackAlgoPriorityOrder_cfi") -process.simpleTrackListMerger.ShareFrac = 0.0 -process.simpleTrackListMerger.allowFirstHitShare = False - -# The second step is to split merged clusters. -process.splitClusters = cms.EDProducer( - "TrackClusterSplitter", - stripClusters = cms.InputTag("siStripClusters::SPLIT"), - pixelClusters = cms.InputTag("siPixelClusters::SPLIT"), - useTrajectories = cms.bool(False), - trajTrackAssociations = cms.InputTag('generalTracks::SPLIT'), - tracks = cms.InputTag('pixelTracks::SPLIT'), - propagator = cms.string('AnalyticalPropagator'), - vertices = cms.InputTag('pixelVertices::SPLIT'), - simSplitPixel = cms.bool(True), # ideal pixel splitting turned OFF - simSplitStrip = cms.bool(True), # ideal strip splitting turned OFF - tmpSplitPixel = cms.bool(False), # template pixel spliting - tmpSplitStrip = cms.bool(False), # template strip splitting - useStraightTracks = cms.bool(True), - test = cms.bool(True) - ) - -process.mySiPixelRecHits = process.siPixelRecHits.clone(src = cms.InputTag("splitClusters")) -process.mySiStripRecHits = process.siStripMatchedRecHits.clone( - src = cms.InputTag("splitClusters"), ClusterProducer = cms.InputTag("splitClusters") - ) - -############################## inserted new stuff - -# from Jean-Roch -process.load("RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTemplate_cfi") -process.StripCPEfromTrackAngleESProducer = process.StripCPEfromTemplateESProducer.clone(ComponentName='StripCPEfromTrackAngle') - -process.load("RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTemplate_cfi") -process.StripCPEfromTemplateESProducer.UseTemplateReco = True - -# Include the latest pixel templates, which are not in DB. -# These are to be used for pixel splitting. -process.load('RecoLocalTracker.SiPixelRecHits.PixelCPETemplateReco_cfi') -process.templates.LoadTemplatesFromDB = False - -# This is the default speed. Recommended. -process.StripCPEfromTrackAngleESProducer.TemplateRecoSpeed = 0; - -############################## inserted new stuff - -process.newrechits = cms.Sequence(process.mySiPixelRecHits*process.mySiStripRecHits) - -######## track to vertex assoc ##################3 -## from CommonTools.RecoUtils.pf_pu_assomap_cfi import AssociationMaps -## process.Vertex2TracksDefault = AssociationMaps.clone( -## AssociationType = cms.InputTag("VertexToTracks"), -## MaxNumberOfAssociations = cms.int32(1) -## ) - -# The commands included in splitter_tracking_setup_cff.py instruct -# the tracking machinery to use the clusters and rechits generated after -# cluster splitting (instead of the default clusters and rechits) -#process.load('RecoLocalTracker.SubCollectionProducers.splitter_tracking_setup2_cff') - -process.fullreco = cms.Sequence(process.globalreco*process.highlevelreco) -process.options = cms.untracked.PSet( - -) -from RecoLocalTracker.SubCollectionProducers.splitter_tracking_setup_cff import customizeTracking -customizeTracking('splitClusters', 'splitClusters', 'mySiPixelRecHits', 'mySiStripRecHits') - -process.load("RecoTracker.TrackProducer.TrackRefitters_cff") - -# Output definition - - -process.RECOoutput = cms.OutputModule("PoolOutputModule", - outputCommands = process.FEVTDEBUGEventContent.outputCommands, - fileName = cms.untracked.string('ZpTauTau8TeV_simsplit_71X.root'), - dataset = cms.untracked.PSet( - #filterName = cms.untracked.string(''), - dataTier = cms.untracked.string('RECO') - ) -) -## process.RECOoutput.outputCommands.append( 'keep TrackingParticles_mergedtruth_MergedTrackTruth_*') -## process.RECOoutput.outputCommands.append( 'keep TrackingVertexs_mergedtruth_MergedTrackTruth_*') - -# Additional output definition -process.dump = cms.EDAnalyzer("EventContentAnalyzer") -# Other statements - -process.GlobalTag.globaltag = 'MC_71_V1::All' - -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsPixelBarrelHighTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsPixelBarrelLowTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsPixelEndcapHighTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsPixelEndcapLowTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsTECHighTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsTECLowTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsTIBHighTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsTIBLowTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsTIDHighTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsTIDLowTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsTOBHighTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsTOBLowTof') - - -from RecoLocalCalo.HcalRecProducers.HBHEIsolatedNoiseReflagger_cfi import * -process.hbhereco.hbheInput= cms.InputTag("hbheprereco::SPLIT") - -# Path and EndPath definitions -process.pre_init = cms.Path(cms.Sequence(process.pdigi*process.SimL1Emulator*process.DigiToRaw)) -process.init_step = cms.Path(cms.Sequence(process.RawToDigi*process.localreco*process.offlineBeamSpot+process.recopixelvertexing)) -process.rechits_step=cms.Path(process.siPixelRecHits) -process.dump_step = cms.Path(process.dump) -process.splitClusters_step=cms.Path(process.mix+process.splitClusters) -process.newrechits_step=cms.Path(process.newrechits) -process.fullreco_step=cms.Path(process.fullreco) -process.endjob_step = cms.EndPath(process.endOfProcess) -process.RECOoutput_step = cms.EndPath(process.RECOoutput) -#process.pixeltree_tempsplit =cms.Path(process.PixelTreeSplit) -#process.vertex_assoc = cms.Path(process.Vertex2TracksDefault) - - -# Schedule definition -process.schedule = cms.Schedule(process.init_step,process.splitClusters_step,process.newrechits_step, process.fullreco_step, process.RECOoutput_step) diff --git a/RecoLocalTracker/SubCollectionProducers/test/run_simsplit_runI.py b/RecoLocalTracker/SubCollectionProducers/test/run_simsplit_runI.py deleted file mode 100644 index 8c0b4faf3a9f6..0000000000000 --- a/RecoLocalTracker/SubCollectionProducers/test/run_simsplit_runI.py +++ /dev/null @@ -1,215 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -process = cms.Process('SPLIT') -# import of standard configurations -process.load('Configuration.StandardSequences.Services_cff') -process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') -process.load('FWCore.MessageService.MessageLogger_cfi') -process.load('Configuration.StandardSequences.Services_cff') -process.load('Configuration.EventContent.EventContent_cff') -process.load('Configuration.StandardSequences.GeometryDB_cff') -process.load('Configuration.StandardSequences.MagneticField_38T_cff') -process.load('Configuration.StandardSequences.RawToDigi_cff') -process.load('Configuration.StandardSequences.Reconstruction_cff') -process.load('Configuration.StandardSequences.EndOfProcess_cff') -process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') -process.load("SimGeneral.MixingModule.mixNoPU_cfi") -process.load('Configuration/StandardSequences/Simulation_cff') -process.load('Configuration/StandardSequences/SimL1Emulator_cff') -process.load('Configuration/StandardSequences/DigiToRaw_cff') -process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') - -process.maxEvents = cms.untracked.PSet( - input = cms.untracked.int32(10) -) -#process.MessageLogger.cerr.FwkReport.reportEvery = 100 -# Input source -process.source = cms.Source("PoolSource", - secondaryFileNames = cms.untracked.vstring(), - fileNames = cms.untracked.vstring( - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_0.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_1.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_2.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_3.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_4.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_5.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_6.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_7.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_8.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_9.root' - -), -) - -# from Jean-Roch -process.load("RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTemplate_cfi") -process.StripCPEfromTrackAngleESProducer = process.StripCPEfromTemplateESProducer.clone(ComponentName='StripCPEfromTrackAngle') - -process.load("RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTemplate_cfi") -process.StripCPEfromTemplateESProducer.UseTemplateReco = True - -# Include the latest pixel templates, which are not in DB. -# These are to be used for pixel splitting. -process.load('RecoLocalTracker.SiPixelRecHits.PixelCPETemplateReco_cfi') -process.templates.LoadTemplatesFromDB = False - -# This is the default speed. Recommended. -process.StripCPEfromTrackAngleESProducer.TemplateRecoSpeed = 0; - -# Split clusters have larger errors. Appropriate errors can be -# assigned by turning UseStripSplitClusterErrors = True. The strip hit pull -# distributons improve considerably, but it does not help with b-tagging, -# so leave it False by default -process.StripCPEfromTrackAngleESProducer.UseStripSplitClusterErrors = True - -# Turn OFF track hit sharing -process.load("TrackingTools.TrajectoryCleaning.TrajectoryCleanerBySharedHits_cfi") -process.trajectoryCleanerBySharedHits.fractionShared = 0.0 -process.trajectoryCleanerBySharedHits.allowSharedFirstHit = False -process.load("RecoTracker.FinalTrackSelectors.simpleTrackListMerger_cfi") -process.load("RecoTracker.FinalTrackSelectors.trackAlgoPriorityOrder_cfi") -process.simpleTrackListMerger.ShareFrac = 0.0 -process.simpleTrackListMerger.allowFirstHitShare = False - -# The second step is to split merged clusters. -process.splitClusters = cms.EDProducer( - "TrackClusterSplitter", - stripClusters = cms.InputTag("siStripClusters::SPLIT"), - pixelClusters = cms.InputTag("siPixelClusters::SPLIT"), - useTrajectories = cms.bool(False), - trajTrackAssociations = cms.InputTag('generalTracks::SPLIT'), - tracks = cms.InputTag('pixelTracks::SPLIT'), - propagator = cms.string('AnalyticalPropagator'), - vertices = cms.InputTag('pixelVertices::SPLIT'), - simSplitPixel = cms.bool(True), # ideal pixel splitting turned OFF - simSplitStrip = cms.bool(True), # ideal strip splitting turned OFF - tmpSplitPixel = cms.bool(False), # template pixel spliting - tmpSplitStrip = cms.bool(False), # template strip splitting - useStraightTracks = cms.bool(True), - test = cms.bool(True) - ) - -process.mySiPixelRecHits = process.siPixelRecHits.clone(src = cms.InputTag("splitClusters")) -process.mySiStripRecHits = process.siStripMatchedRecHits.clone( - src = cms.InputTag("splitClusters"), ClusterProducer = cms.InputTag("splitClusters") - ) - -############################## inserted new stuff - -# from Jean-Roch -process.load("RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTemplate_cfi") -process.StripCPEfromTrackAngleESProducer = process.StripCPEfromTemplateESProducer.clone(ComponentName='StripCPEfromTrackAngle') - -process.load("RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTemplate_cfi") -process.StripCPEfromTemplateESProducer.UseTemplateReco = True - -# Include the latest pixel templates, which are not in DB. -# These are to be used for pixel splitting. -process.load('RecoLocalTracker.SiPixelRecHits.PixelCPETemplateReco_cfi') -process.templates.LoadTemplatesFromDB = False - -# This is the default speed. Recommended. -process.StripCPEfromTrackAngleESProducer.TemplateRecoSpeed = 0; -tgrIndex = process.globalreco.index(process.trackingGlobalReco) -tgrIndexFromReco = process.reconstruction_fromRECO.index(process.trackingGlobalReco) -process.globalreco.remove(process.trackingGlobalReco) -process.reconstruction_fromRECO.remove(process.trackingGlobalReco) -del process.trackingGlobalReco -del process.ckftracks -del process.ckftracks_wodEdX -del process.ckftracks_plus_pixelless -del process.ckftracks_woBH -del process.iterTracking -del process.InitialStep -del process.LowPtTripletStep -del process.PixelPairStep -del process.DetachedTripletStep -del process.MixedTripletStep -del process.PixelLessStep -del process.TobTecStep - -# Load the new Iterative Tracking configuration -raise Exception("Please migrate to use Run2_2016_trackingLowPU era (or otherwise use trackingLowPU sub-era)") - -process.globalreco.insert(tgrIndex, process.trackingGlobalReco) -process.reconstruction_fromRECO.insert(tgrIndexFromReco, process.trackingGlobalReco) - -############################## inserted new stuff - -process.newrechits = cms.Sequence(process.mySiPixelRecHits*process.mySiStripRecHits) - -######## track to vertex assoc ##################3 -## from CommonTools.RecoUtils.pf_pu_assomap_cfi import AssociationMaps -## process.Vertex2TracksDefault = AssociationMaps.clone( -## AssociationType = cms.InputTag("VertexToTracks"), -## MaxNumberOfAssociations = cms.int32(1) -## ) - -# The commands included in splitter_tracking_setup_cff.py instruct -# the tracking machinery to use the clusters and rechits generated after -# cluster splitting (instead of the default clusters and rechits) - -from RecoLocalTracker.SubCollectionProducers.splitter_RunI_tracking_setup_cff import customizeTracking -customizeTracking('splitClusters', 'splitClusters', 'mySiPixelRecHits', 'mySiStripRecHits') - -process.fullreco = cms.Sequence(process.globalreco*process.highlevelreco) -process.options = cms.untracked.PSet( - -) - -#process.load("RecoTracker.TrackProducer.TrackRefitters_cff") - -# Output definition - - -process.RECOoutput = cms.OutputModule("PoolOutputModule", - outputCommands = process.FEVTDEBUGEventContent.outputCommands, - fileName = cms.untracked.string('ZpTauTau8TeV_simsplit_runI.root'), - dataset = cms.untracked.PSet( - #filterName = cms.untracked.string(''), - dataTier = cms.untracked.string('RECO') - ) -) -process.RECOoutput.outputCommands.append( 'keep TrackingParticles_mergedtruth_MergedTrackTruth_*') -process.RECOoutput.outputCommands.append( 'keep TrackingVertexs_mergedtruth_MergedTrackTruth_*') - -# Additional output definition -process.dump = cms.EDAnalyzer("EventContentAnalyzer") -# Other statement -from Configuration.AlCa.GlobalTag import GlobalTag -process.GlobalTag = GlobalTag(process.GlobalTag, 'START70_V5::All', '') - -process.GlobalTag.globaltag = 'START70_V5::All' -from RecoLocalCalo.HcalRecProducers.HBHEIsolatedNoiseReflagger_cfi import * -process.hbhereco.hbheInput= cms.InputTag("hbheprereco::SPLIT") - -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsPixelBarrelHighTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsPixelBarrelLowTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsPixelEndcapHighTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsPixelEndcapLowTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsTECHighTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsTECLowTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsTIBHighTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsTIBLowTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsTIDHighTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsTIDLowTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsTOBHighTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsTOBLowTof') - -process.mix.mixObjects.mixHepMC.makeCrossingFrame = True - -# Path and EndPath definitions -process.pre_init = cms.Path(cms.Sequence(process.pdigi*process.SimL1Emulator*process.DigiToRaw)) -process.init_step = cms.Path(cms.Sequence(process.RawToDigi*process.localreco*process.offlineBeamSpot+process.recopixelvertexing)) -process.rechits_step=cms.Path(process.siPixelRecHits) -process.dump_step = cms.Path(process.dump) -process.splitClusters_step=cms.Path(process.mix+process.splitClusters) -process.newrechits_step=cms.Path(process.newrechits) -process.fullreco_step=cms.Path(process.fullreco) -process.endjob_step = cms.EndPath(process.endOfProcess) -process.RECOoutput_step = cms.EndPath(process.RECOoutput) -#process.pixeltree_tempsplit =cms.Path(process.PixelTreeSplit) -#process.vertex_assoc = cms.Path(process.Vertex2TracksDefault) - -#Schedule definition -process.schedule = cms.Schedule(process.init_step,process.splitClusters_step,process.newrechits_step,process.fullreco_step, process.RECOoutput_step) diff --git a/RecoLocalTracker/SubCollectionProducers/test/run_split.py b/RecoLocalTracker/SubCollectionProducers/test/run_split.py deleted file mode 100644 index 27f529c5915df..0000000000000 --- a/RecoLocalTracker/SubCollectionProducers/test/run_split.py +++ /dev/null @@ -1,193 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -process = cms.Process('SPLIT') - -# import of standard configurations -process.load('Configuration.StandardSequences.Services_cff') -process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') -process.load('FWCore.MessageService.MessageLogger_cfi') -process.load('Configuration.StandardSequences.Services_cff') -process.load('Configuration.EventContent.EventContent_cff') -process.load('Configuration.StandardSequences.GeometryDB_cff') -process.load('Configuration.StandardSequences.MagneticField_38T_cff') -process.load('Configuration.StandardSequences.RawToDigi_cff') -process.load('Configuration.StandardSequences.Reconstruction_cff') -process.load('Configuration.StandardSequences.EndOfProcess_cff') -process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') - -process.maxEvents = cms.untracked.PSet( - input = cms.untracked.int32(10) -) -process.MessageLogger.cerr.FwkReport.reportEvery = 10 -# Input source -process.source = cms.Source("PoolSource", - secondaryFileNames = cms.untracked.vstring(), - fileNames = cms.untracked.vstring( - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTT_1500_8TeV_Tauola_cfi_py_GEN_SIM_DIGI_L1_DIGI2RAW_HLT.root' -# 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_0.root', -# 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_1.root', -# 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_2.root', -# 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_3.root', -# 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_4.root', -# 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_5.root', -# 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_6.root', -# 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_7.root', -# 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_8.root', -# 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_9.root' -# 'file:/afs/cern.ch/work/t/taroni/private/ClusterSplitting/CMSSW_7_1_X_2014-03-18-0200/src/ZpTT_1500_8TeV_Tauola_cfi_py_GEN_SIM_DIGI_L1_DIGI2RAW_HLT.root' - ), - -) - -# from Jean-Roch -process.load("RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTemplate_cfi") -process.StripCPEfromTrackAngleESProducer = process.StripCPEfromTemplateESProducer.clone(ComponentName='StripCPEfromTrackAngle') - -process.load("RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTemplate_cfi") -process.StripCPEfromTemplateESProducer.UseTemplateReco = True - -# Include the latest pixel templates, which are not in DB. -# These are to be used for pixel splitting. -process.load('RecoLocalTracker.SiPixelRecHits.PixelCPETemplateReco_cfi') -process.templates.LoadTemplatesFromDB = False - -# This is the default speed. Recommended. -process.StripCPEfromTrackAngleESProducer.TemplateRecoSpeed = 0; - -# Split clusters have larger errors. Appropriate errors can be -# assigned by turning UseStripSplitClusterErrors = True. The strip hit pull -# distributons improve considerably, but it does not help with b-tagging, -# so leave it False by default -process.StripCPEfromTrackAngleESProducer.UseStripSplitClusterErrors = True - -# Turn OFF track hit sharing -process.load("TrackingTools.TrajectoryCleaning.TrajectoryCleanerBySharedHits_cfi") -process.trajectoryCleanerBySharedHits.fractionShared = 0.0 -process.trajectoryCleanerBySharedHits.allowSharedFirstHit = False -process.load("RecoTracker.FinalTrackSelectors.simpleTrackListMerger_cfi") -process.load("RecoTracker.FinalTrackSelectors.trackAlgoPriorityOrder_cfi") -process.simpleTrackListMerger.ShareFrac = 0.0 -process.simpleTrackListMerger.allowFirstHitShare = False - -# The second step is to split merged clusters. -process.splitClusters = cms.EDProducer( - "TrackClusterSplitter", - stripClusters = cms.InputTag("siStripClusters::SPLIT"), - pixelClusters = cms.InputTag("siPixelClusters::SPLIT"), - useTrajectories = cms.bool(False), - trajTrackAssociations = cms.InputTag('generalTracks::SPLIT'), - tracks = cms.InputTag('pixelTracks::SPLIT'), - propagator = cms.string('AnalyticalPropagator'), - vertices = cms.InputTag('pixelVertices::SPLIT'), - simSplitPixel = cms.bool(False), # ideal pixel splitting turned OFF - simSplitStrip = cms.bool(False), # ideal strip splitting turned OFF - tmpSplitPixel = cms.bool(True), # template pixel spliting - tmpSplitStrip = cms.bool(True), # template strip splitting - useStraightTracks = cms.bool(True), - test = cms.bool(True) - ) - -process.mySiPixelRecHits = process.siPixelRecHits.clone(src = cms.InputTag("splitClusters")) -process.mySiStripRecHits = process.siStripMatchedRecHits.clone( - src = cms.InputTag("splitClusters"), ClusterProducer = cms.InputTag("splitClusters") - ) - -############################## inserted new stuff - -# from Jean-Roch -process.load("RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTemplate_cfi") -process.StripCPEfromTrackAngleESProducer = process.StripCPEfromTemplateESProducer.clone(ComponentName='StripCPEfromTrackAngle') - -process.load("RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTemplate_cfi") -process.StripCPEfromTemplateESProducer.UseTemplateReco = True - -# Include the latest pixel templates, which are not in DB. -# These are to be used for pixel splitting. -process.load('RecoLocalTracker.SiPixelRecHits.PixelCPETemplateReco_cfi') -process.templates.LoadTemplatesFromDB = False - -# This is the default speed. Recommended. -process.StripCPEfromTrackAngleESProducer.TemplateRecoSpeed = 0; - -############################## inserted new stuff - -process.newrechits = cms.Sequence(process.mySiPixelRecHits*process.mySiStripRecHits) - -######## track to vertex assoc ##################3 -from CommonTools.RecoUtils.pf_pu_assomap_cfi import AssociationMaps -process.Vertex2TracksDefault = AssociationMaps.clone( - AssociationType = cms.InputTag("VertexToTracks"), - MaxNumberOfAssociations = cms.int32(1) -) - -# The commands included in splitter_tracking_setup_cff.py instruct -# the tracking machinery to use the clusters and rechits generated after -# cluster splitting (instead of the default clusters and rechits) -#process.load('RecoLocalTracker.SubCollectionProducers.splitter_tracking_setup2_cff') -from RecoLocalTracker.SubCollectionProducers.splitter_tracking_setup_cff import customizeTracking -customizeTracking('splitClusters', 'splitClusters', 'mySiPixelRecHits', 'mySiStripRecHits') - -process.fullreco = cms.Sequence(process.globalreco*process.highlevelreco) -process.Globalreco = cms.Sequence(process.globalreco) -process.Highlevelreco = cms.Sequence(process.highlevelreco) - -process.options = cms.untracked.PSet( - -) - -process.load("RecoTracker.TrackProducer.TrackRefitters_cff") - -# Output definition -process.PixelTreeSplit = cms.EDAnalyzer( - "PixelAnalysisTree", - verbose = cms.untracked.int32(0), - rootFileName = cms.untracked.string('pixelTrees_TS_DATA.root'), - treeName = cms.untracked.string('treeTmpSplit'), - dumpAllEvents = cms.untracked.int32(1), - globalTag = cms.string("GR_R_53::All"), - muonCollectionLabel = cms.untracked.InputTag('muons'), -# trajectoryInputLabel = cms.untracked.InputTag('TrackRefitter'), - trajectoryInputLabel = cms.untracked.InputTag('generalTracks::SPLIT'), - trackCollectionLabel = cms.untracked.InputTag('generalTracks::SPLIT'), - pixelClusterLabel = cms.untracked.InputTag('splitClusters'), - pixelRecHitLabel = cms.untracked.InputTag('mySiPixelRecHits'), - L1GTReadoutRecordLabel = cms.untracked.InputTag("gtDigis"), - hltL1GtObjectMap = cms.untracked.InputTag("hltL1GtObjectMap"), - HLTResultsLabel = cms.untracked.InputTag("TriggerResults::HLT"), - HLTProcessName = cms.untracked.string("HLT"), - mapTrack2Vertex = cms.untracked.bool(True) - ) - - -process.RECOoutput = cms.OutputModule("PoolOutputModule", - outputCommands = process.FEVTDEBUGEventContent.outputCommands, - fileName = cms.untracked.string('ZpTauTau8TeV_split_71X_10.root'), - dataset = cms.untracked.PSet( - dataTier = cms.untracked.string('GEN-SIM-RECO') - ) -) -## process.RECOoutput.outputCommands.append( 'keep TrackingParticles_mergedtruth_MergedTrackTruth_*') -## process.RECOoutput.outputCommands.append( 'keep TrackingVertexs_mergedtruth_MergedTrackTruth_*') - -# Additional output definition -process.dump = cms.EDAnalyzer("EventContentAnalyzer") -# Other statements - -process.GlobalTag.globaltag = 'MC_71_V1::All' - - - -# Path and EndPath definitions -process.init_step = cms.Path(cms.Sequence(process.RawToDigi*process.localreco*process.offlineBeamSpot+process.recopixelvertexing)) -process.dump_step = cms.Path(process.dump) -process.splitClusters_step=cms.Path(process.splitClusters) -process.newrechits_step=cms.Path(process.newrechits) -process.fullreco_step=cms.Path(process.fullreco) -process.endjob_step = cms.EndPath(process.endOfProcess) -process.RECOoutput_step = cms.EndPath(process.RECOoutput) -#process.pixeltree_tempsplit =cms.Path(process.PixelTreeSplit) -#process.vertex_assoc = cms.Path(process.Vertex2TracksDefault) - -# Schedule definition - -process.schedule = cms.Schedule(process.init_step,process.splitClusters_step,process.newrechits_step,process.fullreco_step,process.RECOoutput_step) diff --git a/RecoLocalTracker/SubCollectionProducers/test/run_split_runI.py b/RecoLocalTracker/SubCollectionProducers/test/run_split_runI.py deleted file mode 100644 index d1cf822d8086e..0000000000000 --- a/RecoLocalTracker/SubCollectionProducers/test/run_split_runI.py +++ /dev/null @@ -1,222 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -process = cms.Process('SPLIT') -# import of standard configurations -process.load('Configuration.StandardSequences.Services_cff') -process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') -process.load('FWCore.MessageService.MessageLogger_cfi') -process.load('Configuration.StandardSequences.Services_cff') -process.load('Configuration.EventContent.EventContent_cff') -process.load('SimGeneral.MixingModule.mixNoPU_cfi') -process.load('Configuration.StandardSequences.Geometry_cff') -process.load('Configuration.StandardSequences.MagneticField_38T_cff') -process.load('Configuration.StandardSequences.RawToDigi_cff') -process.load('Configuration.StandardSequences.Reconstruction_cff') -process.load('Configuration.StandardSequences.EndOfProcess_cff') -process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') - - - -process.maxEvents = cms.untracked.PSet( - input = cms.untracked.int32(10) -) -#process.MessageLogger.cerr.FwkReport.reportEvery = 100 -# Input source -process.source = cms.Source("PoolSource", - secondaryFileNames = cms.untracked.vstring(), - fileNames = cms.untracked.vstring( -# 'file:ZpTT_1500_8TeV_Tauola_cfi_py_GEN_SIM_DIGI_L1_DIGI2RAW_HLT.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_0.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_1.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_2.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_3.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_4.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_5.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_6.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_7.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_8.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_9.root' -), - -) - -# from Jean-Roch -process.load("RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTemplate_cfi") -process.StripCPEfromTrackAngleESProducer = process.StripCPEfromTemplateESProducer.clone(ComponentName='StripCPEfromTrackAngle') - -process.load("RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTemplate_cfi") -process.StripCPEfromTemplateESProducer.UseTemplateReco = True - -# Include the latest pixel templates, which are not in DB. -# These are to be used for pixel splitting. -process.load('RecoLocalTracker.SiPixelRecHits.PixelCPETemplateReco_cfi') -process.templates.LoadTemplatesFromDB = False - -# This is the default speed. Recommended. -process.StripCPEfromTrackAngleESProducer.TemplateRecoSpeed = 0; - -# Split clusters have larger errors. Appropriate errors can be -# assigned by turning UseStripSplitClusterErrors = True. The strip hit pull -# distributons improve considerably, but it does not help with b-tagging, -# so leave it False by default -process.StripCPEfromTrackAngleESProducer.UseStripSplitClusterErrors = True - -# Turn OFF track hit sharing -process.load("TrackingTools.TrajectoryCleaning.TrajectoryCleanerBySharedHits_cfi") -process.trajectoryCleanerBySharedHits.fractionShared = 0.0 -process.trajectoryCleanerBySharedHits.allowSharedFirstHit = False -process.load("RecoTracker.FinalTrackSelectors.simpleTrackListMerger_cfi") -process.load("RecoTracker.FinalTrackSelectors.trackAlgoPriorityOrder_cfi") -process.simpleTrackListMerger.ShareFrac = 0.0 -process.simpleTrackListMerger.allowFirstHitShare = False - -# The second step is to split merged clusters. -process.splitClusters = cms.EDProducer( - "TrackClusterSplitter", - stripClusters = cms.InputTag("siStripClusters::SPLIT"), - pixelClusters = cms.InputTag("siPixelClusters::SPLIT"), - useTrajectories = cms.bool(False), - trajTrackAssociations = cms.InputTag('generalTracks::SPLIT'), - tracks = cms.InputTag('pixelTracks::SPLIT'), - propagator = cms.string('AnalyticalPropagator'), - vertices = cms.InputTag('pixelVertices::SPLIT'), - simSplitPixel = cms.bool(False), # ideal pixel splitting turned OFF - simSplitStrip = cms.bool(False), # ideal strip splitting turned OFF - tmpSplitPixel = cms.bool(True), # template pixel spliting - tmpSplitStrip = cms.bool(True), # template strip splitting - useStraightTracks = cms.bool(True), - test = cms.bool(True) - ) - -process.mySiPixelRecHits = process.siPixelRecHits.clone(src = cms.InputTag("splitClusters")) -process.mySiStripRecHits = process.siStripMatchedRecHits.clone( - src = cms.InputTag("splitClusters"), ClusterProducer = cms.InputTag("splitClusters") - ) - -############################## inserted new stuff - -# from Jean-Roch -process.load("RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTemplate_cfi") -process.StripCPEfromTrackAngleESProducer = process.StripCPEfromTemplateESProducer.clone(ComponentName='StripCPEfromTrackAngle') - -process.load("RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTemplate_cfi") -process.StripCPEfromTemplateESProducer.UseTemplateReco = True - -# Include the latest pixel templates, which are not in DB. -# These are to be used for pixel splitting. -process.load('RecoLocalTracker.SiPixelRecHits.PixelCPETemplateReco_cfi') -process.templates.LoadTemplatesFromDB = False - -# This is the default speed. Recommended. -process.StripCPEfromTrackAngleESProducer.TemplateRecoSpeed = 0; - -############################## inserted new stuff - -process.newrechits = cms.Sequence(process.mySiPixelRecHits*process.mySiStripRecHits) - -######## track to vertex assoc ##################3 -from CommonTools.RecoUtils.pf_pu_assomap_cfi import AssociationMaps -process.Vertex2TracksDefault = AssociationMaps.clone( - AssociationType = cms.InputTag("VertexToTracks"), - MaxNumberOfAssociations = cms.int32(1) -) - - -tgrIndex = process.globalreco.index(process.trackingGlobalReco) -tgrIndexFromReco = process.reconstruction_fromRECO.index(process.trackingGlobalReco) -process.globalreco.remove(process.trackingGlobalReco) -process.reconstruction_fromRECO.remove(process.trackingGlobalReco) -del process.trackingGlobalReco -del process.ckftracks -del process.ckftracks_wodEdX -del process.ckftracks_plus_pixelless -del process.ckftracks_woBH -del process.iterTracking -del process.InitialStep -del process.LowPtTripletStep -del process.PixelPairStep -del process.DetachedTripletStep -del process.MixedTripletStep -del process.PixelLessStep -del process.TobTecStep - -# Load the new Iterative Tracking configuration -raise Exception("Please migrate to use Run2_2016_trackingLowPU era (or otherwise use trackingLowPU sub-era)") - -process.globalreco.insert(tgrIndex, process.trackingGlobalReco) -process.reconstruction_fromRECO.insert(tgrIndexFromReco, process.trackingGlobalReco) - -# The commands included in splitter_tracking_setup_cff.py instruct -# the tracking machinery to use the clusters and rechits generated after -# cluster splitting (instead of the default clusters and rechits) -from RecoLocalTracker.SubCollectionProducers.splitter_tracking_RunI_setup_cff import customizeTracking -customizeTracking('splitClusters', 'splitClusters', 'mySiPixelRecHits', 'mySiStripRecHits') - - -process.fullreco = cms.Sequence(process.globalreco*process.highlevelreco) -## process.Globalreco = cms.Sequence(process.globalreco) -## process.Highlevelreco = cms.Sequence(process.highlevelreco) - -process.options = cms.untracked.PSet( - -) - -#process.load("RecoTracker.TrackProducer.TrackRefitters_cff") - -# Output definition -process.PixelTreeSplit = cms.EDAnalyzer( - "PixelAnalysisTree", - verbose = cms.untracked.int32(0), - rootFileName = cms.untracked.string('pixelTrees_TS_DATA.root'), - treeName = cms.untracked.string('treeTmpSplit'), - dumpAllEvents = cms.untracked.int32(1), - globalTag = cms.string("GR_R_53::All"), - muonCollectionLabel = cms.untracked.InputTag('muons'), -# trajectoryInputLabel = cms.untracked.InputTag('TrackRefitter'), - trajectoryInputLabel = cms.untracked.InputTag('generalTracks::SPLIT'), - trackCollectionLabel = cms.untracked.InputTag('generalTracks::SPLIT'), - pixelClusterLabel = cms.untracked.InputTag('splitClusters'), - pixelRecHitLabel = cms.untracked.InputTag('mySiPixelRecHits'), - L1GTReadoutRecordLabel = cms.untracked.InputTag("gtDigis"), - hltL1GtObjectMap = cms.untracked.InputTag("hltL1GtObjectMap"), - HLTResultsLabel = cms.untracked.InputTag("TriggerResults::HLT"), - HLTProcessName = cms.untracked.string("HLT"), - mapTrack2Vertex = cms.untracked.bool(True) - ) - - -process.RECOoutput = cms.OutputModule("PoolOutputModule", - outputCommands = process.RECOSIMEventContent.outputCommands, - fileName = cms.untracked.string('ZpTauTau8TeV_split.root'), - dataset = cms.untracked.PSet( - dataTier = cms.untracked.string('RECO') - ) -) -## process.RECOoutput.outputCommands.append( 'keep TrackingParticles_mergedtruth_MergedTrackTruth_*') -## process.RECOoutput.outputCommands.append( 'keep TrackingVertexs_mergedtruth_MergedTrackTruth_*') - -# Additional output definition -process.dump = cms.EDAnalyzer("EventContentAnalyzer") -# Other statements -from Configuration.AlCa.GlobalTag import GlobalTag -process.GlobalTag = GlobalTag(process.GlobalTag, 'START70_V5::All', '') - -process.GlobalTag.globaltag = 'START70_V5::All' -#process.GlobalTag.globaltag = 'GR_R_52_V7::All' -from RecoLocalCalo.HcalRecProducers.HBHEIsolatedNoiseReflagger_cfi import * -process.hbhereco.hbheInput= cms.InputTag("hbheprereco::SPLIT") -# Path and EndPath definitions -process.init_step = cms.Path(cms.Sequence(process.RawToDigi*process.localreco*process.offlineBeamSpot+process.recopixelvertexing)) -process.dump_step = cms.Path(process.dump) -process.splitClusters_step=cms.Path(process.splitClusters) -process.newrechits_step=cms.Path(process.newrechits) -process.fullreco_step=cms.Path(process.fullreco) - -process.endjob_step = cms.EndPath(process.endOfProcess) -process.RECOoutput_step = cms.EndPath(process.RECOoutput) -#process.pixeltree_tempsplit =cms.Path(process.PixelTreeSplit) -#process.vertex_assoc = cms.Path(process.Vertex2TracksDefault) - -# Schedule definition - -process.schedule = cms.Schedule(process.init_step,process.splitClusters_step,process.newrechits_step,process.fullreco_step,process.RECOoutput_step) From 4e618aa2d0f2414dd2cb3c4bfe25ea7c71d6172a Mon Sep 17 00:00:00 2001 From: Petar Date: Sun, 11 Mar 2018 11:43:36 -0500 Subject: [PATCH 075/426] Avoid conflict in python config files between CPEs TemplateReco and ClusterRepair. (In the later, we switched templates -> templates2.) Note: I HATE python. --- .../SiPixelRecHits/python/PixelCPEClusterRepair_cfi.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RecoLocalTracker/SiPixelRecHits/python/PixelCPEClusterRepair_cfi.py b/RecoLocalTracker/SiPixelRecHits/python/PixelCPEClusterRepair_cfi.py index 6bac9d960117b..08199f72442e9 100644 --- a/RecoLocalTracker/SiPixelRecHits/python/PixelCPEClusterRepair_cfi.py +++ b/RecoLocalTracker/SiPixelRecHits/python/PixelCPEClusterRepair_cfi.py @@ -1,6 +1,6 @@ import FWCore.ParameterSet.Config as cms -templates = cms.ESProducer("PixelCPEClusterRepairESProducer", +templates2 = cms.ESProducer("PixelCPEClusterRepairESProducer", ComponentName = cms.string('PixelCPEClusterRepair'), speed = cms.int32(-2), #PixelErrorParametrization = cms.string('NOTcmsim'), @@ -21,7 +21,7 @@ # This customization will be removed once we get the templates for phase2 pixel from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker -phase2_tracker.toModify(templates, +phase2_tracker.toModify(templates2, LoadTemplatesFromDB = False, DoLorentz = False, ) From 2f0a738bb7977594c37684b481c73be077648e89 Mon Sep 17 00:00:00 2001 From: Petar Date: Sun, 11 Mar 2018 21:41:13 -0500 Subject: [PATCH 076/426] Commented out the era-dependent modification that would replace PixelCPETemplateReco with PixelCPEClusterRepair. This should be temporary, but at the moment it interferes with the tests. --- .../python/TTRHBuilderWithTemplate_cfi.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RecoTracker/TransientTrackingRecHit/python/TTRHBuilderWithTemplate_cfi.py b/RecoTracker/TransientTrackingRecHit/python/TTRHBuilderWithTemplate_cfi.py index 279da559a27e4..e2d534f9d2bb8 100644 --- a/RecoTracker/TransientTrackingRecHit/python/TTRHBuilderWithTemplate_cfi.py +++ b/RecoTracker/TransientTrackingRecHit/python/TTRHBuilderWithTemplate_cfi.py @@ -11,6 +11,6 @@ from Configuration.Eras.Modifier_trackingPhase2PU140_cff import trackingPhase2PU140 trackingPhase2PU140.toModify(TTRHBuilderAngleAndTemplate, Phase2StripCPE = cms.string('Phase2StripCPE')) -from Configuration.Eras.Modifier_phase1Pixel_cff import phase1Pixel -phase1Pixel.toModify(TTRHBuilderAngleAndTemplate, PixelCPE = cms.string('PixelCPEClusterRepair')) +# from Configuration.Eras.Modifier_phase1Pixel_cff import phase1Pixel +# phase1Pixel.toModify(TTRHBuilderAngleAndTemplate, PixelCPE = cms.string('PixelCPEClusterRepair')) From 89b9db0bab7402c854723c9386e2909d3b306b20 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Tue, 20 Feb 2018 14:46:17 +0100 Subject: [PATCH 077/426] Have to treat getByLabel() similarly to consumes() --- .../EcalSimProducers/src/EcalDigiProducer.cc | 36 ++++++++++++------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer.cc b/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer.cc index 397e64bdc6a85..300af8bf6e2e6 100644 --- a/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer.cc +++ b/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer.cc @@ -552,17 +552,23 @@ EcalDigiProducer::accumulateCaloHits(HitsHandle const& ebHandle, HitsHandle cons void EcalDigiProducer::accumulate(edm::Event const& e, edm::EventSetup const& eventSetup) { // Step A: Get Inputs - edm::InputTag ebTag(m_hitsProducerTag, "EcalHitsEB"); edm::Handle > ebHandle; - e.getByLabel(ebTag, ebHandle); + if(m_doEB) { + edm::InputTag ebTag(m_hitsProducerTag, "EcalHitsEB"); + e.getByLabel(ebTag, ebHandle); + } - edm::InputTag eeTag(m_hitsProducerTag, "EcalHitsEE"); edm::Handle > eeHandle; - e.getByLabel(eeTag, eeHandle); + if(m_doEE) { + edm::InputTag eeTag(m_hitsProducerTag, "EcalHitsEE"); + e.getByLabel(eeTag, eeHandle); + } - edm::InputTag esTag(m_hitsProducerTag, "EcalHitsES"); edm::Handle > esHandle; - e.getByLabel(esTag, esHandle); + if(m_doES) { + edm::InputTag esTag(m_hitsProducerTag, "EcalHitsES"); + e.getByLabel(esTag, esHandle); + } accumulateCaloHits(ebHandle, eeHandle, esHandle, 0, randomEngine(e.streamID())); } @@ -570,17 +576,23 @@ EcalDigiProducer::accumulate(edm::Event const& e, edm::EventSetup const& eventSe void EcalDigiProducer::accumulate(PileUpEventPrincipal const& e, edm::EventSetup const& eventSetup, edm::StreamID const& streamID) { // Step A: Get Inputs - edm::InputTag ebTag(m_hitsProducerTag, "EcalHitsEB"); edm::Handle > ebHandle; - e.getByLabel(ebTag, ebHandle); + if(m_doEB) { + edm::InputTag ebTag(m_hitsProducerTag, "EcalHitsEB"); + e.getByLabel(ebTag, ebHandle); + } - edm::InputTag eeTag(m_hitsProducerTag, "EcalHitsEE"); edm::Handle > eeHandle; - e.getByLabel(eeTag, eeHandle); + if(m_doEE) { + edm::InputTag eeTag(m_hitsProducerTag, "EcalHitsEE"); + e.getByLabel(eeTag, eeHandle); + } - edm::InputTag esTag(m_hitsProducerTag, "EcalHitsES"); edm::Handle > esHandle; - e.getByLabel(esTag, esHandle); + if(m_doES) { + edm::InputTag esTag(m_hitsProducerTag, "EcalHitsES"); + e.getByLabel(esTag, esHandle); + } accumulateCaloHits(ebHandle, eeHandle, esHandle, e.bunchCrossing(), randomEngine(streamID)); } From b5e8e5944b2fc3435da22e9332a73ab6048aeca3 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Mon, 12 Mar 2018 10:25:07 +0100 Subject: [PATCH 078/426] Reduce code duplication and fix a bug for m_apdSeparateDigi=true in premixing --- .../EcalSimProducers/src/EcalDigiProducer.cc | 219 +----------------- 1 file changed, 3 insertions(+), 216 deletions(-) diff --git a/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer.cc b/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer.cc index 300af8bf6e2e6..1b7651d82efac 100644 --- a/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer.cc +++ b/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer.cc @@ -55,230 +55,16 @@ EcalDigiProducer::EcalDigiProducer( const edm::ParameterSet& params, edm::ProducerBase& mixMod, edm::ConsumesCollector& iC) : - DigiAccumulatorMixMod(), - m_APDShape ( params.getParameter( "apdShapeTstart" ) , - params.getParameter( "apdShapeTau" ) ) , - m_EBShape ( ) , - m_EEShape ( ) , - m_ESShape ( ) , - m_EBdigiCollection ( params.getParameter("EBdigiCollection") ) , - m_EEdigiCollection ( params.getParameter("EEdigiCollection") ) , - m_ESdigiCollection ( params.getParameter("ESdigiCollection") ) , - m_hitsProducerTag ( params.getParameter("hitsProducer" ) ) , - m_useLCcorrection ( params.getUntrackedParameter("UseLCcorrection") ) , - m_apdSeparateDigi ( params.getParameter ("apdSeparateDigi") ) , - - m_EBs25notCont ( params.getParameter ("EBs25notContainment") ) , - m_EEs25notCont ( params.getParameter ("EEs25notContainment") ) , - - m_readoutFrameSize ( params.getParameter ("readoutFrameSize") ) , - m_ParameterMap ( new EcalSimParameterMap( - params.getParameter ("simHitToPhotoelectronsBarrel") , - params.getParameter ("simHitToPhotoelectronsEndcap") , - params.getParameter ("photoelectronsToAnalogBarrel") , - params.getParameter ("photoelectronsToAnalogEndcap") , - params.getParameter ("samplingFactor") , - params.getParameter ("timePhase") , - m_readoutFrameSize , - params.getParameter ("binOfMaximum") , - params.getParameter ("doPhotostatistics") , - params.getParameter ("syncPhase") ) ) , - - m_apdDigiTag ( params.getParameter ("apdDigiTag" ) ) , - m_apdParameters ( new APDSimParameters( - params.getParameter ("apdAddToBarrel" ) , - m_apdSeparateDigi , - params.getParameter ("apdSimToPELow" ) , - params.getParameter ("apdSimToPEHigh" ) , - params.getParameter ("apdTimeOffset" ) , - params.getParameter ("apdTimeOffWidth" ) , - params.getParameter ("apdDoPEStats" ) , - m_apdDigiTag , - params.getParameter > ( "apdNonlParms" ) ) ) , - - m_APDResponse ( !m_apdSeparateDigi ? nullptr : - new EBHitResponse( m_ParameterMap.get() , - &m_EBShape , - true , - m_apdParameters.get() , - &m_APDShape ) ) , - - m_EBResponse ( new EBHitResponse( m_ParameterMap.get() , - &m_EBShape , - false , // barrel - m_apdParameters.get() , - &m_APDShape ) ) , - - m_EEResponse ( new EEHitResponse( m_ParameterMap.get(), - &m_EEShape ) ) , - m_ESResponse ( new ESHitResponse( m_ParameterMap.get(), &m_ESShape ) ) , - m_ESOldResponse ( new CaloHitResponse( m_ParameterMap.get(), &m_ESShape ) ) , - - m_addESNoise ( params.getParameter ("doESNoise") ) , - m_PreMix1 ( params.getParameter ("EcalPreMixStage1") ) , - m_PreMix2 ( params.getParameter ("EcalPreMixStage2") ) , - - m_doFastES ( params.getParameter ("doFast" ) ) , - - m_doEB ( params.getParameter ("doEB" ) ) , - m_doEE ( params.getParameter ("doEE" ) ) , - m_doES ( params.getParameter ("doES" ) ) , - - m_ESElectronicsSim ( m_doFastES ? nullptr : - new ESElectronicsSim( m_addESNoise ) ) , - - m_ESOldDigitizer ( m_doFastES ? nullptr : - new ESOldDigitizer( m_ESOldResponse.get() , - m_ESElectronicsSim.get() , - m_addESNoise ) ) , - - m_ESElectronicsSimFast ( !m_doFastES ? nullptr : - new ESElectronicsSimFast( m_addESNoise , - m_PreMix1) ) , - - m_ESDigitizer ( !m_doFastES ? nullptr : - new ESDigitizer( m_ESResponse.get() , - m_ESElectronicsSimFast.get() , - m_addESNoise ) ) , - - m_APDDigitizer ( nullptr ) , - m_BarrelDigitizer ( nullptr ) , - m_EndcapDigitizer ( nullptr ) , - m_ElectronicsSim ( nullptr ) , - m_Coder ( nullptr ) , - m_APDElectronicsSim ( nullptr ) , - m_APDCoder ( nullptr ) , - m_Geometry ( nullptr ) , - m_EBCorrNoise ( { {nullptr, nullptr, nullptr} } ) , - m_EECorrNoise ( { {nullptr, nullptr, nullptr} } ) + EcalDigiProducer(params, iC) { if(m_apdSeparateDigi) mixMod.produces(m_apdDigiTag); mixMod.produces(m_EBdigiCollection); mixMod.produces(m_EEdigiCollection); mixMod.produces(m_ESdigiCollection); - - if( m_doEB ) iC.consumes >(edm::InputTag(m_hitsProducerTag, "EcalHitsEB")); - if( m_doEE ) iC.consumes >(edm::InputTag(m_hitsProducerTag, "EcalHitsEE")); - if( m_doES ) iC.consumes >(edm::InputTag(m_hitsProducerTag, "EcalHitsES")); - - const std::vector ebCorMatG12 = params.getParameter< std::vector >("EBCorrNoiseMatrixG12"); - const std::vector eeCorMatG12 = params.getParameter< std::vector >("EECorrNoiseMatrixG12"); - const std::vector ebCorMatG06 = params.getParameter< std::vector >("EBCorrNoiseMatrixG06"); - const std::vector eeCorMatG06 = params.getParameter< std::vector >("EECorrNoiseMatrixG06"); - const std::vector ebCorMatG01 = params.getParameter< std::vector >("EBCorrNoiseMatrixG01"); - const std::vector eeCorMatG01 = params.getParameter< std::vector >("EECorrNoiseMatrixG01"); - - const bool applyConstantTerm = params.getParameter ("applyConstantTerm"); - const double rmsConstantTerm = params.getParameter ("ConstantTerm"); - - const bool addNoise = params.getParameter ("doENoise"); - const bool cosmicsPhase = params.getParameter ("cosmicsPhase"); - const double cosmicsShift = params.getParameter ("cosmicsShift"); - -//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - - // further phase for cosmics studies - if( cosmicsPhase ) - { - if( m_doEB ) m_EBResponse->setPhaseShift( 1. + cosmicsShift ) ; - if( m_doEE ) m_EEResponse->setPhaseShift( 1. + cosmicsShift ) ; - } - - EcalCorrMatrix ebMatrix[ 3 ] ; - EcalCorrMatrix eeMatrix[ 3 ] ; - - assert( ebCorMatG12.size() == m_readoutFrameSize ) ; - assert( eeCorMatG12.size() == m_readoutFrameSize ) ; - assert( ebCorMatG06.size() == m_readoutFrameSize ) ; - assert( eeCorMatG06.size() == m_readoutFrameSize ) ; - assert( ebCorMatG01.size() == m_readoutFrameSize ) ; - assert( eeCorMatG01.size() == m_readoutFrameSize ) ; - - assert( 1.e-7 > fabs( ebCorMatG12[0] - 1.0 ) ) ; - assert( 1.e-7 > fabs( ebCorMatG06[0] - 1.0 ) ) ; - assert( 1.e-7 > fabs( ebCorMatG01[0] - 1.0 ) ) ; - assert( 1.e-7 > fabs( eeCorMatG12[0] - 1.0 ) ) ; - assert( 1.e-7 > fabs( eeCorMatG06[0] - 1.0 ) ) ; - assert( 1.e-7 > fabs( eeCorMatG01[0] - 1.0 ) ) ; - - for ( unsigned int row ( 0 ) ; row != m_readoutFrameSize ; ++row ) - { - assert( 0 == row || 1. >= ebCorMatG12[row] ) ; - assert( 0 == row || 1. >= ebCorMatG06[row] ) ; - assert( 0 == row || 1. >= ebCorMatG01[row] ) ; - assert( 0 == row || 1. >= eeCorMatG12[row] ) ; - assert( 0 == row || 1. >= eeCorMatG06[row] ) ; - assert( 0 == row || 1. >= eeCorMatG01[row] ) ; - for ( unsigned int column ( 0 ) ; column <= row ; ++column ) - { - const unsigned int index ( row - column ) ; - ebMatrix[0]( row, column ) = ebCorMatG12[ index ] ; - eeMatrix[0]( row, column ) = eeCorMatG12[ index ] ; - ebMatrix[1]( row, column ) = ebCorMatG06[ index ] ; - eeMatrix[1]( row, column ) = eeCorMatG06[ index ] ; - ebMatrix[2]( row, column ) = ebCorMatG01[ index ] ; - eeMatrix[2]( row, column ) = eeCorMatG01[ index ] ; - } - } - - m_EBCorrNoise[0].reset( new CorrelatedNoisifier( ebMatrix[0] ) ); - m_EECorrNoise[0].reset( new CorrelatedNoisifier( eeMatrix[0] ) ); - m_EBCorrNoise[1].reset( new CorrelatedNoisifier( ebMatrix[1] ) ); - m_EECorrNoise[1].reset( new CorrelatedNoisifier( eeMatrix[1] ) ); - m_EBCorrNoise[2].reset( new CorrelatedNoisifier( ebMatrix[2] ) ); - m_EECorrNoise[2].reset( new CorrelatedNoisifier( eeMatrix[2] ) ); - - m_Coder.reset( new EcalCoder( addNoise , - m_PreMix1 , - m_EBCorrNoise[0].get() , - m_EECorrNoise[0].get() , - m_EBCorrNoise[1].get() , - m_EECorrNoise[1].get() , - m_EBCorrNoise[2].get() , - m_EECorrNoise[2].get() ) ); - - m_ElectronicsSim.reset( new EcalElectronicsSim( m_ParameterMap.get() , - m_Coder.get() , - applyConstantTerm , - rmsConstantTerm ) ); - - if( m_apdSeparateDigi ) - { - m_APDCoder.reset( new EcalCoder( false , - m_PreMix1 , - m_EBCorrNoise[0].get() , - m_EECorrNoise[0].get() , - m_EBCorrNoise[1].get() , - m_EECorrNoise[1].get() , - m_EBCorrNoise[2].get() , - m_EECorrNoise[2].get() ) ); - - m_APDElectronicsSim.reset( new EcalElectronicsSim( m_ParameterMap.get() , - m_APDCoder.get() , - applyConstantTerm , - rmsConstantTerm ) ); - - m_APDDigitizer.reset( new EBDigitizer( m_APDResponse.get() , - m_APDElectronicsSim.get() , - false ) ); - } - - if( m_doEB ) { - m_BarrelDigitizer.reset( new EBDigitizer( m_EBResponse.get() , - m_ElectronicsSim.get() , - addNoise ) ); - } - - if ( m_doEE ) { - m_EndcapDigitizer.reset( new EEDigitizer( m_EEResponse.get() , - m_ElectronicsSim.get() , - addNoise ) ); - } } - -// duplicate version for Pre-Mixing, for use outside of MixingModule +// version for Pre-Mixing, for use outside of MixingModule EcalDigiProducer::EcalDigiProducer( const edm::ParameterSet& params, edm::ConsumesCollector& iC) : DigiAccumulatorMixMod(), m_APDShape ( params.getParameter( "apdShapeTstart" ) , @@ -470,6 +256,7 @@ EcalDigiProducer::EcalDigiProducer( const edm::ParameterSet& params, edm::Consu if( m_apdSeparateDigi ) { m_APDCoder.reset( new EcalCoder( false , + m_PreMix1 , m_EBCorrNoise[0].get() , m_EECorrNoise[0].get() , m_EBCorrNoise[1].get() , From 182843097323cd6af1ea61e668f37d49fab9dd23 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Fri, 9 Mar 2018 11:43:25 +0100 Subject: [PATCH 079/426] Reduce copy-paste --- SimMuon/MCTruth/python/MuonAssociatorByHits_cfi.py | 12 +++++++----- .../muonAssociatorByHitsNoSimHitsHelper_cfi.py | 6 ------ 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/SimMuon/MCTruth/python/MuonAssociatorByHits_cfi.py b/SimMuon/MCTruth/python/MuonAssociatorByHits_cfi.py index b5cd7398ff53c..be42e93976c5d 100644 --- a/SimMuon/MCTruth/python/MuonAssociatorByHits_cfi.py +++ b/SimMuon/MCTruth/python/MuonAssociatorByHits_cfi.py @@ -94,6 +94,13 @@ inputCSCSegmentCollection = cms.InputTag("cscSegments"), ) +from Configuration.Eras.Modifier_run3_GEM_cff import run3_GEM +from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker +run3_GEM.toModify(muonAssociatorByHitsCommonParameters, useGEMs = True) +phase2_tracker.toModify(muonAssociatorByHitsCommonParameters, + usePhase2Tracker = True, + pixelSimLinkSrc = "simSiPixelDigis:Pixel", +) from Configuration.Eras.Modifier_fastSim_cff import fastSim fastSim.toModify(muonAssociatorByHitsCommonParameters, @@ -139,8 +146,3 @@ ignoreMissingTrackCollection = cms.untracked.bool(False), ) -from Configuration.Eras.Modifier_run3_GEM_cff import run3_GEM -run3_GEM.toModify( muonAssociatorByHits, useGEMs = cms.bool(True) ) -from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker -phase2_tracker.toModify( muonAssociatorByHits, usePhase2Tracker = cms.bool(True) ) -phase2_tracker.toModify( muonAssociatorByHits, pixelSimLinkSrc = "simSiPixelDigis:Pixel" ) diff --git a/SimMuon/MCTruth/python/muonAssociatorByHitsNoSimHitsHelper_cfi.py b/SimMuon/MCTruth/python/muonAssociatorByHitsNoSimHitsHelper_cfi.py index 4cae09c4d5d7c..ccc8a9c1e2e2a 100644 --- a/SimMuon/MCTruth/python/muonAssociatorByHitsNoSimHitsHelper_cfi.py +++ b/SimMuon/MCTruth/python/muonAssociatorByHitsNoSimHitsHelper_cfi.py @@ -24,9 +24,3 @@ # use only muon system muonAssociatorByHitsNoSimHitsHelper.UseTracker = False - -from Configuration.Eras.Modifier_run3_GEM_cff import run3_GEM -run3_GEM.toModify( muonAssociatorByHitsNoSimHitsHelper, useGEMs = cms.bool(True) ) -from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker -phase2_tracker.toModify( muonAssociatorByHitsNoSimHitsHelper, usePhase2Tracker = cms.bool(True) ) -phase2_tracker.toModify( muonAssociatorByHitsNoSimHitsHelper, pixelSimLinkSrc = "simSiPixelDigis:Pixel" ) From b594aecc36cbf560abcc08fa28d34eace4cf780b Mon Sep 17 00:00:00 2001 From: David Date: Mon, 12 Mar 2018 15:24:00 +0100 Subject: [PATCH 080/426] Move digi size reference to python and update for 2018 --- DQM/HcalTasks/interface/DigiRunSummary.h | 3 +++ DQM/HcalTasks/interface/DigiTask.h | 2 ++ DQM/HcalTasks/plugins/DigiTask.cc | 15 +++++++++++---- DQM/HcalTasks/python/DigiTask.py | 8 ++++++++ DQM/HcalTasks/src/DigiRunSummary.cc | 8 +++++++- 5 files changed, 31 insertions(+), 5 deletions(-) diff --git a/DQM/HcalTasks/interface/DigiRunSummary.h b/DQM/HcalTasks/interface/DigiRunSummary.h index 4b4e599e21697..aeba451fab92c 100644 --- a/DQM/HcalTasks/interface/DigiRunSummary.h +++ b/DQM/HcalTasks/interface/DigiRunSummary.h @@ -3,6 +3,7 @@ #include "DQM/HcalCommon/interface/DQClient.h" #include "DQM/HcalCommon/interface/ElectronicsMap.h" +#include "DataFormats/HcalDetId/interface/HcalSubdetector.h" namespace hcaldqm { @@ -38,6 +39,8 @@ namespace hcaldqm ContainerXXX _xDead, _xDigiSize, _xUniHF, _xUni, _xNChs, _xNChsNominal; + std::map _refDigiSize; + // flag enum enum DigiLSFlag { diff --git a/DQM/HcalTasks/interface/DigiTask.h b/DQM/HcalTasks/interface/DigiTask.h index 4a4fb019eb33e..a3ca5002c6993 100644 --- a/DQM/HcalTasks/interface/DigiTask.h +++ b/DQM/HcalTasks/interface/DigiTask.h @@ -69,6 +69,8 @@ class DigiTask : public hcaldqm::DQTask // hashes/FED vectors std::vector _vhashFEDs; + std::map _refDigiSize; + // emap hcaldqm::electronicsmap::ElectronicsMap _ehashmap; // online only hcaldqm::electronicsmap::ElectronicsMap _dhashmap; diff --git a/DQM/HcalTasks/plugins/DigiTask.cc b/DQM/HcalTasks/plugins/DigiTask.cc index 4e7d1e9a82638..e7ca5855988da 100644 --- a/DQM/HcalTasks/plugins/DigiTask.cc +++ b/DQM/HcalTasks/plugins/DigiTask.cc @@ -34,6 +34,13 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): _vflags[fUnknownIds]=hcaldqm::flag::Flag("UnknownIds"); _qie10InConditions = ps.getUntrackedParameter("qie10InConditions", true); + + // Get reference digi sizes. Convert from unsigned to signed int, because ::size()/samples() return ints for some reason. + std::vector vrefDigiSize = ps.getUntrackedParameter>("refDigiSize"); + _refDigiSize[HcalBarrel] = (int)vrefDigiSize[0]; + _refDigiSize[HcalEndcap] = (int)vrefDigiSize[1]; + _refDigiSize[HcalOuter] = (int)vrefDigiSize[2]; + _refDigiSize[HcalForward] = (int)vrefDigiSize[3]; } /* virtual */ void DigiTask::bookHistograms(DQMStore::IBooker& ib, @@ -645,7 +652,7 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): if (_ptype==fOnline) { _cDigiSizevsLS_FED.fill(eid, _currentLS, it->size()); - it->size()!=constants::DIGISIZE[did.subdet()-1]? + it->size()!=_refDigiSize[did.subdet()]? _xDigiSize.get(eid)++:_xDigiSize.get(eid)+=0; _cOccupancyvsiphi_SubdetPM.fill(did); _cOccupancyvsieta_Subdet.fill(did); @@ -768,7 +775,7 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): if (_ptype==fOnline) { _cDigiSizevsLS_FED.fill(eid, _currentLS, digi.samples()); - digi.samples()!=constants::DIGISIZE[did.subdet()-1]? + digi.samples()!=_refDigiSize[did.subdet()]? _xDigiSize.get(eid)++:_xDigiSize.get(eid)+=0; _cOccupancyvsiphi_SubdetPM.fill(did); _cOccupancyvsieta_Subdet.fill(did); @@ -895,7 +902,7 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): if (_ptype==fOnline) { _cDigiSizevsLS_FED.fill(eid, _currentLS, it->size()); - it->size()!=constants::DIGISIZE[did.subdet()-1]? + it->size()!=_refDigiSize[did.subdet()]? _xDigiSize.get(eid)++:_xDigiSize.get(eid)+=0; _cOccupancyvsiphi_SubdetPM.fill(did); _cOccupancyvsieta_Subdet.fill(did); @@ -1039,7 +1046,7 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): { _xNChs.get(eid)++; _cDigiSizevsLS_FED.fill(eid, _currentLS, digi.samples()); - digi.samples()!=constants::DIGISIZE[did.subdet()-1]? + digi.samples()!=_refDigiSize[did.subdet()]? _xDigiSize.get(eid)++:_xDigiSize.get(eid)+=0; _cOccupancyvsiphi_SubdetPM.fill(did); _cOccupancyvsieta_Subdet.fill(did); diff --git a/DQM/HcalTasks/python/DigiTask.py b/DQM/HcalTasks/python/DigiTask.py index 965295135be1e..5520cf44c2e72 100644 --- a/DQM/HcalTasks/python/DigiTask.py +++ b/DQM/HcalTasks/python/DigiTask.py @@ -27,7 +27,15 @@ thresh_unifh = cms.untracked.double(0.2), qie10InConditions = cms.untracked.bool(False), + + # Reference digi sizes + refDigiSize = cms.untracked.vint32(10, 10, 10, 4), # HB, HE, HF, HO ) from Configuration.Eras.Modifier_run2_HF_2017_cff import run2_HF_2017 run2_HF_2017.toModify(digiTask, qie10InConditions=cms.untracked.bool(True)) +run2_HF_2017.toModify(digiTask, refDigiSize=cms.untracked.vint32(10, 10, 10, 3)) + +from Configuration.StandardSequences.Eras import eras +eras.Run2_2018.toModify(digiTask, qie10InConditions=cms.untracked.bool(True)) +eras.Run2_2018.toModify(digiTask, refDigiSize=cms.untracked.vint32(8, 8, 10, 3)) diff --git a/DQM/HcalTasks/src/DigiRunSummary.cc b/DQM/HcalTasks/src/DigiRunSummary.cc index 16032b0b025eb..6d1bd7639138f 100644 --- a/DQM/HcalTasks/src/DigiRunSummary.cc +++ b/DQM/HcalTasks/src/DigiRunSummary.cc @@ -8,6 +8,12 @@ namespace hcaldqm { _thresh_unihf = ps.getUntrackedParameter("thresh_unihf", 0.2); + + std::vector vrefDigiSize = ps.getUntrackedParameter>("refDigiSize"); + _refDigiSize[HcalBarrel] = vrefDigiSize[0]; + _refDigiSize[HcalEndcap] = vrefDigiSize[1]; + _refDigiSize[HcalOuter] = vrefDigiSize[2]; + _refDigiSize[HcalForward] = vrefDigiSize[3]; } /* virtual */ void DigiRunSummary::beginRun(edm::Run const& r, @@ -140,7 +146,7 @@ namespace hcaldqm _cOccupancy_depth.fill(did, cOccupancy_depth.getBinContent(did)); // digi size cDigiSize_Crate.getMean(eid)!= - constants::DIGISIZE[did.subdet()-1]? + _refDigiSize[did.subdet()]? _xDigiSize.get(eid)++:_xDigiSize.get(eid)+=0; cDigiSize_Crate.getRMS(eid)!=0? _xDigiSize.get(eid)++:_xDigiSize.get(eid)+=0; From 945cb413cb2ddb52ab281eb2fdfed88af14346a0 Mon Sep 17 00:00:00 2001 From: David Date: Mon, 12 Mar 2018 15:26:11 +0100 Subject: [PATCH 081/426] Move digi size reference to python and update for 2018 --- DQM/HcalCommon/interface/Constants.h | 1 - 1 file changed, 1 deletion(-) diff --git a/DQM/HcalCommon/interface/Constants.h b/DQM/HcalCommon/interface/Constants.h index 88d5a3618f707..21cea096a99a0 100644 --- a/DQM/HcalCommon/interface/Constants.h +++ b/DQM/HcalCommon/interface/Constants.h @@ -180,7 +180,6 @@ namespace hcaldqm int const HF = 4; int const SUBDET_NUM = 4; int const TPSUBDET_NUM = 2; - int const DIGISIZE[SUBDET_NUM] = {10, 10, 10, 3}; std::string const SUBDET_NAME[SUBDET_NUM]={"HB", "HE", "HO", "HF"}; std::string const SUBDETPM_NAME[2*SUBDET_NUM] = { "HBM", "HBP", "HEM", "HEP", "HOM", "HOP", "HFM", "HFP"}; From 9e27fc7639f3c69d9d482957340d071989148e04 Mon Sep 17 00:00:00 2001 From: David Date: Mon, 12 Mar 2018 16:24:27 +0100 Subject: [PATCH 082/426] Fix 2018 modifier --- DQM/HcalTasks/python/DigiTask.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DQM/HcalTasks/python/DigiTask.py b/DQM/HcalTasks/python/DigiTask.py index 5520cf44c2e72..37e970a524c2f 100644 --- a/DQM/HcalTasks/python/DigiTask.py +++ b/DQM/HcalTasks/python/DigiTask.py @@ -36,6 +36,6 @@ run2_HF_2017.toModify(digiTask, qie10InConditions=cms.untracked.bool(True)) run2_HF_2017.toModify(digiTask, refDigiSize=cms.untracked.vint32(10, 10, 10, 3)) -from Configuration.StandardSequences.Eras import eras -eras.Run2_2018.toModify(digiTask, qie10InConditions=cms.untracked.bool(True)) -eras.Run2_2018.toModify(digiTask, refDigiSize=cms.untracked.vint32(8, 8, 10, 3)) +from Configuration.Eras.Modifier_run2_HCAL_2018_cff import run2_HCAL_2018 +run2_HCAL_2018.toModify(digiTask, qie10InConditions=cms.untracked.bool(True)) +run2_HCAL_2018.toModify(digiTask, refDigiSize=cms.untracked.vint32(8, 8, 10, 3)) From 5138d91a076b052007e243c4ae31f3f9af9e5320 Mon Sep 17 00:00:00 2001 From: David Date: Mon, 12 Mar 2018 16:26:36 +0100 Subject: [PATCH 083/426] Digi sized unsigned int --- DQM/HcalTasks/python/DigiTask.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DQM/HcalTasks/python/DigiTask.py b/DQM/HcalTasks/python/DigiTask.py index 37e970a524c2f..9005382ad6585 100644 --- a/DQM/HcalTasks/python/DigiTask.py +++ b/DQM/HcalTasks/python/DigiTask.py @@ -29,13 +29,13 @@ qie10InConditions = cms.untracked.bool(False), # Reference digi sizes - refDigiSize = cms.untracked.vint32(10, 10, 10, 4), # HB, HE, HF, HO + refDigiSize = cms.untracked.vuint32(10, 10, 10, 4), # HB, HE, HF, HO ) from Configuration.Eras.Modifier_run2_HF_2017_cff import run2_HF_2017 run2_HF_2017.toModify(digiTask, qie10InConditions=cms.untracked.bool(True)) -run2_HF_2017.toModify(digiTask, refDigiSize=cms.untracked.vint32(10, 10, 10, 3)) +run2_HF_2017.toModify(digiTask, refDigiSize=cms.untracked.vuint32(10, 10, 10, 3)) from Configuration.Eras.Modifier_run2_HCAL_2018_cff import run2_HCAL_2018 run2_HCAL_2018.toModify(digiTask, qie10InConditions=cms.untracked.bool(True)) -run2_HCAL_2018.toModify(digiTask, refDigiSize=cms.untracked.vint32(8, 8, 10, 3)) +run2_HCAL_2018.toModify(digiTask, refDigiSize=cms.untracked.vuint32(8, 8, 10, 3)) From 138b43deb6a47534823be72b3fc40c5fa731f428 Mon Sep 17 00:00:00 2001 From: Emily Date: Mon, 12 Mar 2018 10:29:04 -0500 Subject: [PATCH 084/426] Fixed typo that caused build to fail --- .../src/SiPixelPhase1TrackClusters.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DQM/SiPixelPhase1TrackClusters/src/SiPixelPhase1TrackClusters.cc b/DQM/SiPixelPhase1TrackClusters/src/SiPixelPhase1TrackClusters.cc index 6cb8dbcb10159..dc61faa933835 100644 --- a/DQM/SiPixelPhase1TrackClusters/src/SiPixelPhase1TrackClusters.cc +++ b/DQM/SiPixelPhase1TrackClusters/src/SiPixelPhase1TrackClusters.cc @@ -1,4 +1,4 @@ -0;95;0c// -*- C++ -*- +// -*- C++ -*- // // Package: SiPixelPhase1TrackClusters // Class : SiPixelPhase1TrackClusters @@ -202,7 +202,7 @@ void SiPixelPhase1TrackClusters::analyze(const edm::Event& iEvent, const edm::Ev } else { histo[ON_TRACK_NOTBIGPIXELCHARGE].fill(pixel_charge, id, &iEvent); - + } } // End loop over pixels auto const & ltp = trajParams[h]; From 85b9abecb66435da6276bd2cbaeccc05881eba1e Mon Sep 17 00:00:00 2001 From: David Date: Mon, 12 Mar 2018 16:39:28 +0100 Subject: [PATCH 085/426] Try sharing refDigiSize between DigiTask and HcalOnlineHarvesting --- DQM/HcalTasks/python/HcalOnlineHarvesting.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/DQM/HcalTasks/python/HcalOnlineHarvesting.py b/DQM/HcalTasks/python/HcalOnlineHarvesting.py index 58b217ee8f9cd..5929bc4acb4ab 100644 --- a/DQM/HcalTasks/python/HcalOnlineHarvesting.py +++ b/DQM/HcalTasks/python/HcalOnlineHarvesting.py @@ -1,5 +1,6 @@ import FWCore.ParameterSet.Config as cms from DQMServices.Core.DQMEDHarvester import DQMEDHarvester +from DQM.HcalTasks.DigiTask import DigiTask hcalOnlineHarvesting = DQMEDHarvester( "HcalOnlineHarvesting", @@ -11,4 +12,5 @@ ptype = cms.untracked.int32(0), mtype = cms.untracked.bool(True), subsystem = cms.untracked.string("Hcal"), + refDigiSize = DigiTask.refDigiSize, ) From 7d539897a1a3454eeb5797486793eb26d63c2a89 Mon Sep 17 00:00:00 2001 From: David Date: Mon, 12 Mar 2018 16:40:44 +0100 Subject: [PATCH 086/426] Try sharing refDigiSize between DigiTask and HcalOnlineHarvesting --- DQM/HcalTasks/python/HcalOnlineHarvesting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DQM/HcalTasks/python/HcalOnlineHarvesting.py b/DQM/HcalTasks/python/HcalOnlineHarvesting.py index 5929bc4acb4ab..249eb74403803 100644 --- a/DQM/HcalTasks/python/HcalOnlineHarvesting.py +++ b/DQM/HcalTasks/python/HcalOnlineHarvesting.py @@ -1,6 +1,6 @@ import FWCore.ParameterSet.Config as cms from DQMServices.Core.DQMEDHarvester import DQMEDHarvester -from DQM.HcalTasks.DigiTask import DigiTask +from DQM.HcalTasks.DigiTask import digiTask hcalOnlineHarvesting = DQMEDHarvester( "HcalOnlineHarvesting", From 58c92b1b6b43aec6825a4cdbeab66e5aa2646183 Mon Sep 17 00:00:00 2001 From: David Date: Mon, 12 Mar 2018 16:41:58 +0100 Subject: [PATCH 087/426] Try sharing refDigiSize between DigiTask and HcalOnlineHarvesting --- DQM/HcalTasks/python/HcalOnlineHarvesting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DQM/HcalTasks/python/HcalOnlineHarvesting.py b/DQM/HcalTasks/python/HcalOnlineHarvesting.py index 249eb74403803..a2f0c6b56ecfb 100644 --- a/DQM/HcalTasks/python/HcalOnlineHarvesting.py +++ b/DQM/HcalTasks/python/HcalOnlineHarvesting.py @@ -12,5 +12,5 @@ ptype = cms.untracked.int32(0), mtype = cms.untracked.bool(True), subsystem = cms.untracked.string("Hcal"), - refDigiSize = DigiTask.refDigiSize, + refDigiSize = digiTask.refDigiSize, ) From 0d87ba1df7d229d8e72949e8dec3a3ea6becb395 Mon Sep 17 00:00:00 2001 From: David Date: Tue, 13 Mar 2018 14:04:57 +0100 Subject: [PATCH 088/426] Digi size reference for offline harvesting too --- DQM/HcalTasks/python/HcalOfflineHarvesting.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/DQM/HcalTasks/python/HcalOfflineHarvesting.py b/DQM/HcalTasks/python/HcalOfflineHarvesting.py index 71acca2d1dd0a..089b59d70bcd9 100644 --- a/DQM/HcalTasks/python/HcalOfflineHarvesting.py +++ b/DQM/HcalTasks/python/HcalOfflineHarvesting.py @@ -1,5 +1,6 @@ import FWCore.ParameterSet.Config as cms from DQMServices.Core.DQMEDHarvester import DQMEDHarvester +from DQM.HcalTasks.DigiTask import digiTask hcalOfflineHarvesting = DQMEDHarvester( "HcalOfflineHarvesting", @@ -17,5 +18,6 @@ thresh_FGMsmRate_high = cms.untracked.double(0.2), thresh_FGMsmRate_low = cms.untracked.double(0.1), thresh_unihf = cms.untracked.double(0.2), - thresh_tcds = cms.untracked.double(1.5) + thresh_tcds = cms.untracked.double(1.5), + refDigiSize = digiTask.refDigiSize, ) From 8a1ec7ead3ab12f2a24d1d9ad47771f21a0b9284 Mon Sep 17 00:00:00 2001 From: Marco Rovere Date: Fri, 24 Nov 2017 00:26:48 +0100 Subject: [PATCH 089/426] Add CaloParticle Debug package Actually the debug package contains also a complete reimplementation of the CaloParticle logic fully based on the BGL that greatly simplify the extremely complex logic of the currently used CaloTruthAccumulator. The implementation is not yet final but gives already identical results if compared with the regularly produced CaloParticles. --- SimGeneral/Debugging/plugins/BuildFile.xml | 14 + SimGeneral/Debugging/plugins/Debugging.cc | 405 ++++++++++++++++++++ SimGeneral/Debugging/python/CfiFile_cfi.py | 4 + SimGeneral/Debugging/python/ConfFile_cfg.py | 33 ++ 4 files changed, 456 insertions(+) create mode 100644 SimGeneral/Debugging/plugins/BuildFile.xml create mode 100644 SimGeneral/Debugging/plugins/Debugging.cc create mode 100644 SimGeneral/Debugging/python/CfiFile_cfi.py create mode 100644 SimGeneral/Debugging/python/ConfFile_cfg.py diff --git a/SimGeneral/Debugging/plugins/BuildFile.xml b/SimGeneral/Debugging/plugins/BuildFile.xml new file mode 100644 index 0000000000000..1eb4529ca8ff7 --- /dev/null +++ b/SimGeneral/Debugging/plugins/BuildFile.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/SimGeneral/Debugging/plugins/Debugging.cc b/SimGeneral/Debugging/plugins/Debugging.cc new file mode 100644 index 0000000000000..8d203f535b725 --- /dev/null +++ b/SimGeneral/Debugging/plugins/Debugging.cc @@ -0,0 +1,405 @@ +// +// Original Author: Marco Rovere +// Created: Fri, 10 Nov 2017 14:39:18 GMT +// +// + +// system include files +#include +#include +#include + +// user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "DataFormats/ForwardDetId/interface/HGCalDetId.h" +#include "SimDataFormats/Track/interface/SimTrack.h" +#include "SimDataFormats/Vertex/interface/SimVertex.h" +#include "SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h" +#include "DataFormats/HepMCCandidate/interface/GenParticle.h" +#include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" +#include "SimDataFormats/CaloHit/interface/PCaloHit.h" + +#include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" +#include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" +#include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" +#include "SimDataFormats/CaloTest/interface/HGCalTestNumbering.h" +#include "Geometry/CaloTopology/interface/HGCalTopology.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "Geometry/HcalCommonData/interface/HcalHitRelabeller.h" + +#include +#include +#include + +using namespace boost; +// Graph Definitions +// The graph is meant to represent the full decay chain. +// The parent-child relationship is the natural one, following "time". +// Each edge has a property (edge_weight_t) that holds a const pointer to the SimTrack that connects the 2 vertices of the edge. +// Each vertex has a property (vertex_name_t) that holds a const pointer to the SimTrack that originated that vertex. +// Stable particles are recovered/added in a second iterations and are linked to ghost vertices with a reasonably high offset(1E6). +struct EdgeProperty { + EdgeProperty(const SimTrack* t, int h, float e) : simTrack(t), simHits(h), energy(e) {}; + const SimTrack* simTrack; + int simHits; + float energy; +}; + +typedef property EdgeParticleProperty; +typedef property EdgeParticleClustersProperty; +typedef property VertexMotherParticleProperty; +typedef adjacency_list< listS, vecS, directedS, + VertexMotherParticleProperty, EdgeParticleClustersProperty> DecayChain; + +namespace { + template < typename Edge, typename Graph> + void print_edge( Edge &e, const Graph & g) { + auto const edge_property = get(edge_weight, g, e); + std::cout << "Examining edges " << e + << " --> particle " << edge_property.simTrack->type() + << "(" << edge_property.simTrack->trackId() << ")" + << " with SimClusters: " << edge_property.simHits + << " and total Energy: " << edge_property.energy << std::endl; + } + template < typename Vertex, typename Graph > + void print_vertex (Vertex &u, const Graph & g) { + auto const sim_track = get(vertex_name, g, u); + std::cout << "At " << u; + // The Mother of all vertices has **no** SimTrack associated. + if (sim_track) + std::cout << "[" << sim_track->type() << "]" + << "(" << sim_track->trackId() << ")"; + std::cout << std::endl; + } + class Custom_dfs_visitor : public boost::default_dfs_visitor + { + public: + template < typename Vertex, typename Graph > + void examine_vertex(Vertex u, const Graph & g) const { + print_vertex(u, g); + } + template < typename Edge, typename Graph > + void examine_edge(Edge e, const Graph& g) const { + print_edge(e, g); + } + }; + class Custom_bfs_visitor : public boost::default_bfs_visitor + { + public: + template < typename Vertex, typename Graph > + void examine_vertex(Vertex u, const Graph & g) const { + print_vertex(u, g); + } + template < typename Edge, typename Graph > + void examine_edge(Edge e, const Graph& g) const { + print_edge(e, g); + } + }; +} + +// +// class declaration +// + +class Debugging : public edm::one::EDAnalyzer<> { + public: + explicit Debugging(const edm::ParameterSet&); + ~Debugging(); + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + + private: + virtual void beginJob() override; + virtual void analyze(const edm::Event&, const edm::EventSetup&) override; + virtual void endJob() override; + void fillSimHits(std::vector >&, + std::map > &, + std::map &, + const edm::Event& , const edm::EventSetup &); + edm::InputTag simTracks_; + edm::InputTag genParticles_; + edm::InputTag simVertices_; + edm::InputTag trackingParticles_; + edm::InputTag caloParticles_; + std::vector collectionTags_; + edm::EDGetTokenT > simTracksToken_; + edm::EDGetTokenT > genParticlesToken_; + edm::EDGetTokenT > simVerticesToken_; + edm::EDGetTokenT > trackingParticlesToken_; + edm::EDGetTokenT > caloParticlesToken_; + std::vector > > collectionTagsToken_; + // ----------member data --------------------------- +}; + +// +// constants, enums and typedefs +// + +// +// static data member definitions +// + +// +// constructors and destructor +// +Debugging::Debugging(const edm::ParameterSet& iConfig) + : simTracks_(iConfig.getParameter("simTracks")), + genParticles_(iConfig.getParameter("genParticles")), + simVertices_(iConfig.getParameter("simVertices")), + trackingParticles_(iConfig.getParameter("trackingParticles")), + caloParticles_(iConfig.getParameter("caloParticles")), + collectionTags_(iConfig.getParameter >("collectionTags")) +{ + edm::ConsumesCollector&& iC = consumesCollector(); + simTracksToken_ = iC.consumes >(simTracks_); + genParticlesToken_ = iC.consumes > (genParticles_); + simVerticesToken_ = iC.consumes >(simVertices_); + trackingParticlesToken_ = iC.consumes >(trackingParticles_); + caloParticlesToken_ = iC.consumes >(caloParticles_); + for( const auto& collectionTag : collectionTags_ ) { + collectionTagsToken_.push_back(iC.consumes >(collectionTag)); + } +} + +Debugging::~Debugging() +{ +} + + +// +// member functions +// + +// ------------ method called for each event ------------ +void +Debugging::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) +{ + using namespace edm; + + edm::Handle > simTracksH; + edm::Handle > genParticlesH; + edm::Handle > simVerticesH; + edm::Handle > trackingParticlesH; + edm::Handle > caloParticlesH; + + iEvent.getByToken(simTracksToken_, simTracksH); + auto const & tracks = *simTracksH.product(); + + iEvent.getByToken(genParticlesToken_, genParticlesH); + auto const & genParticles = *genParticlesH.product(); + + iEvent.getByToken(simVerticesToken_, simVerticesH); + auto const & vertices = *simVerticesH.product(); + + iEvent.getByToken(trackingParticlesToken_, trackingParticlesH); + auto const & trackingpart = *trackingParticlesH.product(); + + iEvent.getByToken(caloParticlesToken_, caloParticlesH); + auto const & calopart = *caloParticlesH.product(); + + // Let's first fill in hits information + std::vector > simHitPointers; + std::map > simTrackDetIdEnergyMap; + std::map detIdToTotalSimEnergy; + fillSimHits(simHitPointers, simTrackDetIdEnergyMap, detIdToTotalSimEnergy, iEvent, iSetup); + + int idx = 0; + + std::map trackid_to_track_index; + std::cout << "Printing SimTracks information" << std::endl; + std::cout << "IDX\tTrackId\tPDGID\tMOMENTUM(x,y,z,E)\tVertexIdx\tGenPartIdx" << std::endl; + for (auto const & t : tracks) { + std::cout << idx << "\t" << t.trackId() << "\t" << t << std::endl; + trackid_to_track_index[t.trackId()] = idx; + idx++; + } + + std::cout << "Printing GenParticles information" << std::endl; + std::cout << "IDX\tPDGID\tMOMENTUM(x,y,z)\tVertex(x,y,z)" << std::endl; + idx = 0; + for (auto const & gp : genParticles) + std::cout << idx++ + << "\t" << gp.pdgId() + << "\t" << gp.momentum() + << "\t" << gp.vertex() << std::endl; + + std::cout << "Printing SimVertex information" << std::endl; + std::cout << "IDX\tPOSITION(x,y,z)\tPARENT_INDEX\tVERTEX_ID" << std::endl; + DecayChain decay; + idx = 0; + // Build the main decay graph and assign the SimTrack to each edge. The graph + // built here will only contain the particles that have a decay vertex + // associated to them. In order to recover also the particles that will not + // decay, we need to keep track of the SimTrack used here and add, + // a-posteriori, the ones not used, associating a ghost vertex (starting from + // 1E6), in order to build the edge and identify them immediately as + // stable (i.e. not decayed). + std::vector used_sim_tracks(tracks.size(), false); + for (auto const & v: vertices) { + std::cout << idx++ << "\t" << v << std::endl; + if (v.parentIndex() != -1) { + add_edge(tracks.at(trackid_to_track_index[v.parentIndex()]).vertIndex(), + v.vertexId(), + EdgeProperty(&tracks.at(trackid_to_track_index[v.parentIndex()]), + simTrackDetIdEnergyMap[trackid_to_track_index[v.parentIndex()]].size(), + std::accumulate(simTrackDetIdEnergyMap[trackid_to_track_index[v.parentIndex()]].begin(), + simTrackDetIdEnergyMap[trackid_to_track_index[v.parentIndex()]].end(), 0., + [&](float partial, std::pair current) { + return partial + current.second/detIdToTotalSimEnergy[current.first]; })), + decay); + used_sim_tracks[trackid_to_track_index[v.parentIndex()]] = true; + } + } + // Now recover the particles that did not decay. + int offset = 1000000; + for (size_t i = 0; i < tracks.size(); ++i) { + if (!used_sim_tracks[i]) + add_edge(tracks.at(i).vertIndex(), offset++, + EdgeProperty(&tracks.at(i), + simTrackDetIdEnergyMap[tracks.at(i).trackId()].size(), + std::accumulate(simTrackDetIdEnergyMap[tracks.at(i).trackId()].begin(), + simTrackDetIdEnergyMap[tracks.at(i).trackId()].end(), 0., + [&](float partial, std::pair current) { + return partial + current.second/detIdToTotalSimEnergy[current.first]; + })), decay); + } + // Now assign the motherParticle property to each vertex + auto const & vertexMothersProp = get(vertex_name, decay); + for (auto const & v: vertices) { + if (v.parentIndex() != -1) { + put(vertexMothersProp, v.vertexId(), &tracks.at(trackid_to_track_index[v.parentIndex()])); + } + } + +#define DFS +#ifdef DFS + Custom_dfs_visitor vis; + depth_first_search(decay, visitor(vis)); +#else + Custom_bfs_visitor vis; + breadth_first_search(decay, 0, visitor(vis)); +#endif + + std::cout << "Printing TrackingParticles information" << std::endl; + idx = 0; + for (auto const & tp : trackingpart) + std::cout << idx++ << "\t" << tp << std::endl; + + std::cout << "Printing CaloParticles information" << std::endl; + idx = 0; + for (auto const & cp : calopart) + std::cout << idx++ << " |Eta|: " << std::abs(cp.momentum().eta()) + << "\tEnergy: " << cp.energy() << "\t" << cp << std::endl; +} + + +// ------------ method called once each job just before starting event loop ------------ +void +Debugging::beginJob() +{ +} + +// ------------ method called once each job just after ending the event loop ------------ +void +Debugging::endJob() +{ +} + +void Debugging::fillSimHits( + std::vector >& returnValue, + std::map > & simTrackDetIdEnergyMap, + std::map & detIdToTotalSimEnergy, + const edm::Event& iEvent, const edm::EventSetup& iSetup ) { + // Taken needed quantities from the EventSetup + edm::ESHandle geom; + iSetup.get().get(geom); + const HGCalGeometry *eegeom, *fhgeom; + const HcalGeometry *bhgeom; + const HGCalDDDConstants* hgddd[2]; + const HGCalTopology* hgtopo[2]; + const HcalDDDRecConstants* hcddd; + + eegeom = dynamic_cast(geom->getSubdetectorGeometry(DetId::Forward,HGCEE)); + fhgeom = dynamic_cast(geom->getSubdetectorGeometry(DetId::Forward,HGCHEF)); + bhgeom = dynamic_cast(geom->getSubdetectorGeometry(DetId::Hcal,HcalEndcap)); + + hgtopo[0] = &(eegeom->topology()); + hgtopo[1] = &(fhgeom->topology()); + + for( unsigned i = 0; i < 2; ++i ) { + hgddd[i] = &(hgtopo[i]->dddConstants()); + } + + hcddd = bhgeom->topology().dddConstants(); + + // loop over the collections + int token = 0; + for( const auto& collectionTag : collectionTags_ ) { + edm::Handle< std::vector > hSimHits; + std::cout << collectionTag.instance() << std::endl; + const bool isHcal = ( collectionTag.instance().find("HcalHits") != std::string::npos ); + iEvent.getByToken(collectionTagsToken_[token++], hSimHits); + for( const auto& simHit : *hSimHits ) { + DetId id(0); + const uint32_t simId = simHit.id(); + if( isHcal ) { + HcalDetId hid = HcalHitRelabeller::relabel(simId, hcddd); + if(hid.subdet()==HcalEndcap) id = hid; + } else { + int subdet, layer, cell, sec, subsec, zp; + HGCalTestNumbering::unpackHexagonIndex(simId, subdet, zp, layer, sec, subsec, cell); + const HGCalDDDConstants* ddd = hgddd[subdet-3]; + std::pair recoLayerCell = ddd->simToReco(cell,layer,sec, + hgtopo[subdet-3]->detectorType()); + cell = recoLayerCell.first; + layer = recoLayerCell.second; + // skip simhits with bad barcodes or non-existant layers + if( layer == -1 || simHit.geantTrackId() == 0 ) continue; + id = HGCalDetId((ForwardSubdetector)subdet,zp,layer,subsec,sec,cell); + } + + if( DetId(0) == id ) continue; + + returnValue.emplace_back(id, &simHit); + if ( simTrackDetIdEnergyMap.count(simHit.geantTrackId()) + && simTrackDetIdEnergyMap[simHit.geantTrackId()].count(id.rawId())) + simTrackDetIdEnergyMap[simHit.geantTrackId()][id.rawId()] += simHit.energy(); + else + simTrackDetIdEnergyMap[simHit.geantTrackId()][id.rawId()] = simHit.energy(); + if( detIdToTotalSimEnergy.count(id.rawId()) ) detIdToTotalSimEnergy[id.rawId()] += simHit.energy(); + else detIdToTotalSimEnergy[id.rawId()] = simHit.energy(); + } + } // end of loop over InputTags +} + +// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ +void +Debugging::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + //The following says we do not know what parameters are allowed so do no validation + // Please change this to state exactly what you do use, even if it is no parameters + edm::ParameterSetDescription desc; + desc.add("simTracks", edm::InputTag("g4SimHits")); + desc.add("genParticles", edm::InputTag("genParticles")); + desc.add("simVertices", edm::InputTag("g4SimHits")); + desc.add("trackingParticles", edm::InputTag("mix", "MergedTrackTruth")); + desc.add("caloParticles", edm::InputTag("mix", "MergedCaloTruth")); + desc.add >("collectionTags", {edm::InputTag("g4SimHits","HGCHitsEE"), + edm::InputTag("g4SimHits","HGCHitsHEfront"), + edm::InputTag("g4SimHits","HcalHits")}); + descriptions.addDefault(desc); +} + +//define this as a plug-in +DEFINE_FWK_MODULE(Debugging); diff --git a/SimGeneral/Debugging/python/CfiFile_cfi.py b/SimGeneral/Debugging/python/CfiFile_cfi.py new file mode 100644 index 0000000000000..7f93db48d22b0 --- /dev/null +++ b/SimGeneral/Debugging/python/CfiFile_cfi.py @@ -0,0 +1,4 @@ +import FWCore.ParameterSet.Config as cms + +demo = cms.EDAnalyzer('Debugging' +) diff --git a/SimGeneral/Debugging/python/ConfFile_cfg.py b/SimGeneral/Debugging/python/ConfFile_cfg.py new file mode 100644 index 0000000000000..46877b34d32b2 --- /dev/null +++ b/SimGeneral/Debugging/python/ConfFile_cfg.py @@ -0,0 +1,33 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("Demo") + +process.load("FWCore.MessageService.MessageLogger_cfi") +process.load('Configuration.Geometry.GeometryExtended2023D17Reco_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic', '') + +process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) ) + +process.source = cms.Source("PoolSource", + inputCommands = cms.untracked.vstring(['keep *', + 'drop l1tEMTFHit2016Extras_simEmtfDigis_CSC_HLT', + 'drop l1tEMTFHit2016Extras_simEmtfDigis_RPC_HLT', + 'drop l1tEMTFHit2016s_simEmtfDigis__HLT', + 'drop l1tEMTFTrack2016Extras_simEmtfDigis__HLT', + 'drop l1tEMTFTrack2016s_simEmtfDigis__HLT']), + # replace 'myfile.root' with the source file you want to use + fileNames = cms.untracked.vstring( +# 'file:/data/rovere/HGCAL/study/CMSSW_9_4_0/src/SimGeneral/Debugging/test/20800.0_FourMuPt1_200+FourMuPt_1_200_pythia8_2023D20_GenSimHLBeamSpotFull+DigiFull_2023D20+RecoFullGlobal_2023D20+HARVESTFullGlobal_2023D20/step2.root' +# 'file:/data/rovere/HGCAL/study/CMSSW_9_4_0/src/SimGeneral/Debugging/test/20824.0_TTbar_13+TTbar_13TeV_TuneCUETP8M1_2023D20_GenSimHLBeamSpotFull+DigiFull_2023D20+RecoFullGlobal_2023D20+HARVESTFullGlobal_2023D20/step2.root' +# 'file:/data/rovere/HGCAL/study/CMSSW_9_4_0/src/SimGeneral/Debugging/test/20002.0_SingleElectronPt35+SingleElectronPt35_pythia8_2023D17_GenSimHLBeamSpotFull+DigiFullTrigger_2023D17+RecoFullGlobal_2023D17+HARVESTFullGlobal_2023D17/step2.root' + 'file:/data/rovere/HGCAL/study/CMSSW_9_4_0/src/SimGeneral/Debugging/test/20016.0_SingleGammaPt35Extended+DoubleGammaPt35Extended_pythia8_2023D17_GenSimHLBeamSpotFull+DigiFullTrigger_2023D17+RecoFullGlobal_2023D17+HARVESTFullGlobal_2023D17/step2.root' + ) +) + +process.demo = cms.EDAnalyzer('Debugging' +) + + +process.p = cms.Path(process.demo) From d263af2e04c5e79f0e30b714452b91203885170d Mon Sep 17 00:00:00 2001 From: Marco Rovere Date: Fri, 24 Nov 2017 15:48:34 +0100 Subject: [PATCH 090/426] Minor stylistic changes Full recursion and creation of CaloParticles. --- SimGeneral/Debugging/plugins/Debugging.cc | 202 ++++++++++++++-------- 1 file changed, 132 insertions(+), 70 deletions(-) diff --git a/SimGeneral/Debugging/plugins/Debugging.cc b/SimGeneral/Debugging/plugins/Debugging.cc index 8d203f535b725..4a629908ab3e9 100644 --- a/SimGeneral/Debugging/plugins/Debugging.cc +++ b/SimGeneral/Debugging/plugins/Debugging.cc @@ -4,6 +4,11 @@ // // +// BOOST GRAPH LIBRARY +#include +#include +#include +// // system include files #include #include @@ -38,72 +43,121 @@ #include "Geometry/Records/interface/CaloGeometryRecord.h" #include "Geometry/HcalCommonData/interface/HcalHitRelabeller.h" -#include -#include -#include using namespace boost; -// Graph Definitions -// The graph is meant to represent the full decay chain. -// The parent-child relationship is the natural one, following "time". -// Each edge has a property (edge_weight_t) that holds a const pointer to the SimTrack that connects the 2 vertices of the edge. -// Each vertex has a property (vertex_name_t) that holds a const pointer to the SimTrack that originated that vertex. -// Stable particles are recovered/added in a second iterations and are linked to ghost vertices with a reasonably high offset(1E6). + +/* GRAPH DEFINITIONS + + The graph represents the full decay chain. + + The parent-child relationship is the natural one, following "time". + + Each edge has a property (edge_weight_t) that holds a const pointer to the + SimTrack that connects the 2 vertices of the edge, the number of simHits + associated to that simTrack, the overall energy deposited in the + associated simHits and the cumulative number of simHits of itself and of all + its children. + + Each vertex has a property (vertex_name_t) that holds a const pointer to the + SimTrack that originated that vertex and the cumulative number of simHits of + all its outgoing edges. + + Stable particles are recovered/added in a second iterations and are linked + to ghost vertices with an offset starting from the highest generated vertex. +*/ struct EdgeProperty { - EdgeProperty(const SimTrack* t, int h, float e) : simTrack(t), simHits(h), energy(e) {}; + EdgeProperty(const SimTrack* t, + int h, + int c, + float e) + : simTrack(t), simHits(h), cumulative_simHits(c), energy(e) {} const SimTrack* simTrack; int simHits; + int cumulative_simHits; float energy; }; -typedef property EdgeParticleProperty; +struct VertexProperty { + VertexProperty() : simTrack(nullptr), cumulative_simHits(0) {} + VertexProperty(const SimTrack* t, int c) : simTrack(t), cumulative_simHits(c) {} + VertexProperty(const VertexProperty& other) : simTrack(other.simTrack), cumulative_simHits(other.cumulative_simHits) {} + const SimTrack * simTrack; + int cumulative_simHits; +}; + typedef property EdgeParticleClustersProperty; -typedef property VertexMotherParticleProperty; +typedef property VertexMotherParticleProperty; typedef adjacency_list< listS, vecS, directedS, VertexMotherParticleProperty, EdgeParticleClustersProperty> DecayChain; namespace { - template < typename Edge, typename Graph> - void print_edge( Edge &e, const Graph & g) { + template < typename Edge, typename Graph, typename Visitor> + void print_edge(Edge &e, const Graph & g, Visitor * v) { auto const edge_property = get(edge_weight, g, e); + v->total_simHits += edge_property.simHits; std::cout << "Examining edges " << e << " --> particle " << edge_property.simTrack->type() << "(" << edge_property.simTrack->trackId() << ")" << " with SimClusters: " << edge_property.simHits - << " and total Energy: " << edge_property.energy << std::endl; + << " and total Energy: " << edge_property.energy + << " Accumulated SimClusters: " << v->total_simHits << std::endl; } template < typename Vertex, typename Graph > - void print_vertex (Vertex &u, const Graph & g) { - auto const sim_track = get(vertex_name, g, u); + void print_vertex(Vertex &u, const Graph & g) { + auto const vertex_property = get(vertex_name, g, u); std::cout << "At " << u; // The Mother of all vertices has **no** SimTrack associated. - if (sim_track) - std::cout << "[" << sim_track->type() << "]" - << "(" << sim_track->trackId() << ")"; + if (vertex_property.simTrack) + std::cout << "[" << vertex_property.simTrack->type() << "]" + << "(" << vertex_property.simTrack->trackId() << ")"; std::cout << std::endl; } - class Custom_dfs_visitor : public boost::default_dfs_visitor - { + class Custom_dfs_visitor : public boost::default_dfs_visitor { public: + int total_simHits = 0; template < typename Vertex, typename Graph > - void examine_vertex(Vertex u, const Graph & g) const { - print_vertex(u, g); + void finish_vertex(Vertex u, const Graph & g) { +// print_vertex(u, g); } template < typename Edge, typename Graph > - void examine_edge(Edge e, const Graph& g) const { - print_edge(e, g); + void examine_edge(Edge e, const Graph& g) { + print_edge(e, g, this); } + template < typename Edge, typename Graph > + void finish_edge(Edge e, const Graph & g) { + auto const edge_property = get(edge_weight, g, e); + auto src = source(e, g); + auto trg = target(e, g); + auto cumulative = edge_property.simHits + + get(vertex_name, g, trg).cumulative_simHits + + (get(vertex_name, g, src).simTrack ? get(vertex_name, g, src).cumulative_simHits : 0); // when we hit the root vertex we have to stop adding back its contribution. + auto const src_vertex_property = get(vertex_name, g, src); + put(get(vertex_name, const_cast(g)), + src, + VertexProperty(src_vertex_property.simTrack, cumulative)); + put(get(edge_weight, const_cast(g)), e, + EdgeProperty(edge_property.simTrack, + edge_property.simHits, + cumulative, + edge_property.energy)); + std::cout << "Finished edge: " << e + << " Track id: " << get(edge_weight, g, e).simTrack->trackId() + << " has cumulated " << cumulative + << " hits" << std::endl; + std::cout << " SrcVtx: " << src << "\t" << get(vertex_name, g, src).simTrack << "\t" << get(vertex_name, g, src).cumulative_simHits << std::endl; + std::cout << " TrgVtx: " << trg << "\t" << get(vertex_name, g, trg).simTrack << "\t" << get(vertex_name, g, trg).cumulative_simHits << std::endl; + } }; - class Custom_bfs_visitor : public boost::default_bfs_visitor - { + class Custom_bfs_visitor : public boost::default_bfs_visitor { public: + int total_simHits = 0; template < typename Vertex, typename Graph > - void examine_vertex(Vertex u, const Graph & g) const { + void examine_vertex(Vertex u, const Graph & g) { print_vertex(u, g); } template < typename Edge, typename Graph > - void examine_edge(Edge e, const Graph& g) const { - print_edge(e, g); + void examine_edge(Edge e, const Graph& g) { + print_edge(e, g, this); } }; } @@ -160,22 +214,19 @@ Debugging::Debugging(const edm::ParameterSet& iConfig) simVertices_(iConfig.getParameter("simVertices")), trackingParticles_(iConfig.getParameter("trackingParticles")), caloParticles_(iConfig.getParameter("caloParticles")), - collectionTags_(iConfig.getParameter >("collectionTags")) -{ + collectionTags_(iConfig.getParameter >("collectionTags")) { edm::ConsumesCollector&& iC = consumesCollector(); simTracksToken_ = iC.consumes >(simTracks_); genParticlesToken_ = iC.consumes > (genParticles_); simVerticesToken_ = iC.consumes >(simVertices_); trackingParticlesToken_ = iC.consumes >(trackingParticles_); caloParticlesToken_ = iC.consumes >(caloParticles_); - for( const auto& collectionTag : collectionTags_ ) { + for (auto const & collectionTag : collectionTags_) { collectionTagsToken_.push_back(iC.consumes >(collectionTag)); } } -Debugging::~Debugging() -{ -} +Debugging::~Debugging() {} // @@ -184,8 +235,7 @@ Debugging::~Debugging() // ------------ method called for each event ------------ void -Debugging::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) -{ +Debugging::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { using namespace edm; edm::Handle > simTracksH; @@ -210,7 +260,7 @@ Debugging::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) auto const & calopart = *caloParticlesH.product(); // Let's first fill in hits information - std::vector > simHitPointers; + std::vector > simHitPointers; std::map > simTrackDetIdEnergyMap; std::map detIdToTotalSimEnergy; fillSimHits(simHitPointers, simTrackDetIdEnergyMap, detIdToTotalSimEnergy, iEvent, iSetup); @@ -254,6 +304,7 @@ Debugging::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) v.vertexId(), EdgeProperty(&tracks.at(trackid_to_track_index[v.parentIndex()]), simTrackDetIdEnergyMap[trackid_to_track_index[v.parentIndex()]].size(), + 0, std::accumulate(simTrackDetIdEnergyMap[trackid_to_track_index[v.parentIndex()]].begin(), simTrackDetIdEnergyMap[trackid_to_track_index[v.parentIndex()]].end(), 0., [&](float partial, std::pair current) { @@ -262,13 +313,15 @@ Debugging::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) used_sim_tracks[trackid_to_track_index[v.parentIndex()]] = true; } } - // Now recover the particles that did not decay. - int offset = 1000000; + // Now recover the particles that did not decay. Append them with an index + // bigger than the size of the generated vertices. + int offset = vertices.size() + 1; for (size_t i = 0; i < tracks.size(); ++i) { if (!used_sim_tracks[i]) add_edge(tracks.at(i).vertIndex(), offset++, EdgeProperty(&tracks.at(i), simTrackDetIdEnergyMap[tracks.at(i).trackId()].size(), + 0, std::accumulate(simTrackDetIdEnergyMap[tracks.at(i).trackId()].begin(), simTrackDetIdEnergyMap[tracks.at(i).trackId()].end(), 0., [&](float partial, std::pair current) { @@ -279,14 +332,24 @@ Debugging::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) auto const & vertexMothersProp = get(vertex_name, decay); for (auto const & v: vertices) { if (v.parentIndex() != -1) { - put(vertexMothersProp, v.vertexId(), &tracks.at(trackid_to_track_index[v.parentIndex()])); + put(vertexMothersProp, v.vertexId(), VertexProperty(&tracks.at(trackid_to_track_index[v.parentIndex()]), 0)); } } - #define DFS #ifdef DFS Custom_dfs_visitor vis; depth_first_search(decay, visitor(vis)); + auto const first_generation = out_edges(0, decay); + for (auto edge = first_generation.first; edge != first_generation.second; ++edge) { + auto const edge_property = get(edge_weight, decay, *edge); + Custom_bfs_visitor bfs; + std::cout << "Creating CaloParticle particle: " + << edge_property.simTrack->type() + << "(" << edge_property.simTrack->trackId() << ")" + << " with total SimClusters: " << get(edge_weight, decay, *edge).cumulative_simHits + << " and total Energy: " << edge_property.energy + << std::endl; + } #else Custom_bfs_visitor vis; breadth_first_search(decay, 0, visitor(vis)); @@ -307,15 +370,11 @@ Debugging::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) // ------------ method called once each job just before starting event loop ------------ void -Debugging::beginJob() -{ -} +Debugging::beginJob() {} // ------------ method called once each job just after ending the event loop ------------ void -Debugging::endJob() -{ -} +Debugging::endJob() {} void Debugging::fillSimHits( std::vector >& returnValue, @@ -331,14 +390,14 @@ void Debugging::fillSimHits( const HGCalTopology* hgtopo[2]; const HcalDDDRecConstants* hcddd; - eegeom = dynamic_cast(geom->getSubdetectorGeometry(DetId::Forward,HGCEE)); - fhgeom = dynamic_cast(geom->getSubdetectorGeometry(DetId::Forward,HGCHEF)); - bhgeom = dynamic_cast(geom->getSubdetectorGeometry(DetId::Hcal,HcalEndcap)); + eegeom = dynamic_cast(geom->getSubdetectorGeometry(DetId::Forward, HGCEE)); + fhgeom = dynamic_cast(geom->getSubdetectorGeometry(DetId::Forward, HGCHEF)); + bhgeom = dynamic_cast(geom->getSubdetectorGeometry(DetId::Hcal, HcalEndcap)); hgtopo[0] = &(eegeom->topology()); hgtopo[1] = &(fhgeom->topology()); - for( unsigned i = 0; i < 2; ++i ) { + for (unsigned i = 0; i < 2; ++i) { hgddd[i] = &(hgtopo[i]->dddConstants()); } @@ -346,40 +405,42 @@ void Debugging::fillSimHits( // loop over the collections int token = 0; - for( const auto& collectionTag : collectionTags_ ) { + for (auto const& collectionTag : collectionTags_) { edm::Handle< std::vector > hSimHits; std::cout << collectionTag.instance() << std::endl; const bool isHcal = ( collectionTag.instance().find("HcalHits") != std::string::npos ); iEvent.getByToken(collectionTagsToken_[token++], hSimHits); - for( const auto& simHit : *hSimHits ) { + for (auto const& simHit : *hSimHits) { DetId id(0); const uint32_t simId = simHit.id(); - if( isHcal ) { + if (isHcal) { HcalDetId hid = HcalHitRelabeller::relabel(simId, hcddd); - if(hid.subdet()==HcalEndcap) id = hid; + if (hid.subdet() == HcalEndcap) id = hid; } else { int subdet, layer, cell, sec, subsec, zp; HGCalTestNumbering::unpackHexagonIndex(simId, subdet, zp, layer, sec, subsec, cell); const HGCalDDDConstants* ddd = hgddd[subdet-3]; - std::pair recoLayerCell = ddd->simToReco(cell,layer,sec, + std::pair recoLayerCell = ddd->simToReco(cell, layer, sec, hgtopo[subdet-3]->detectorType()); cell = recoLayerCell.first; layer = recoLayerCell.second; // skip simhits with bad barcodes or non-existant layers - if( layer == -1 || simHit.geantTrackId() == 0 ) continue; - id = HGCalDetId((ForwardSubdetector)subdet,zp,layer,subsec,sec,cell); + if (layer == -1 || simHit.geantTrackId() == 0) continue; + id = HGCalDetId((ForwardSubdetector)subdet, zp, layer, subsec, sec, cell); } - if( DetId(0) == id ) continue; + if (DetId(0) == id) continue; returnValue.emplace_back(id, &simHit); - if ( simTrackDetIdEnergyMap.count(simHit.geantTrackId()) + if (simTrackDetIdEnergyMap.count(simHit.geantTrackId()) && simTrackDetIdEnergyMap[simHit.geantTrackId()].count(id.rawId())) simTrackDetIdEnergyMap[simHit.geantTrackId()][id.rawId()] += simHit.energy(); else simTrackDetIdEnergyMap[simHit.geantTrackId()][id.rawId()] = simHit.energy(); - if( detIdToTotalSimEnergy.count(id.rawId()) ) detIdToTotalSimEnergy[id.rawId()] += simHit.energy(); - else detIdToTotalSimEnergy[id.rawId()] = simHit.energy(); + if (detIdToTotalSimEnergy.count(id.rawId())) + detIdToTotalSimEnergy[id.rawId()] += simHit.energy(); + else + detIdToTotalSimEnergy[id.rawId()] = simHit.energy(); } } // end of loop over InputTags } @@ -387,7 +448,7 @@ void Debugging::fillSimHits( // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ void Debugging::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - //The following says we do not know what parameters are allowed so do no validation + // The following says we do not know what parameters are allowed so do no validation // Please change this to state exactly what you do use, even if it is no parameters edm::ParameterSetDescription desc; desc.add("simTracks", edm::InputTag("g4SimHits")); @@ -395,11 +456,12 @@ Debugging::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { desc.add("simVertices", edm::InputTag("g4SimHits")); desc.add("trackingParticles", edm::InputTag("mix", "MergedTrackTruth")); desc.add("caloParticles", edm::InputTag("mix", "MergedCaloTruth")); - desc.add >("collectionTags", {edm::InputTag("g4SimHits","HGCHitsEE"), - edm::InputTag("g4SimHits","HGCHitsHEfront"), - edm::InputTag("g4SimHits","HcalHits")}); + desc.add >("collectionTags", + { edm::InputTag("g4SimHits", "HGCHitsEE"), + edm::InputTag("g4SimHits", "HGCHitsHEfront"), + edm::InputTag("g4SimHits", "HcalHits")}); descriptions.addDefault(desc); } -//define this as a plug-in +// define this as a plug-in DEFINE_FWK_MODULE(Debugging); From 6c5f05e2a1c4069b820d053e037f5f3a55d018d1 Mon Sep 17 00:00:00 2001 From: Marco Rovere Date: Tue, 5 Dec 2017 00:08:40 +0100 Subject: [PATCH 091/426] First working implementation of CaloP with Graphs. --- .../plugins/CaloTruthAccumulatorWithGraph.cc | 671 ++++++++++++++++++ .../plugins/CaloTruthAccumulatorWithGraph.h | 229 ++++++ SimGeneral/Debugging/plugins/Debugging.cc | 3 +- SimGeneral/Debugging/python/ConfFile_cfg.py | 7 +- 4 files changed, 906 insertions(+), 4 deletions(-) create mode 100644 SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc create mode 100644 SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.h diff --git a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc new file mode 100644 index 0000000000000..49087679d6cad --- /dev/null +++ b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc @@ -0,0 +1,671 @@ +#include "SimGeneral/MixingModule/interface/DigiAccumulatorMixModFactory.h" +#include "SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.h" + +#include "DataFormats/ForwardDetId/interface/HGCalDetId.h" +#include "DataFormats/HcalDetId/interface/HcalDetId.h" +#include "SimDataFormats/CaloTest/interface/HGCalTestNumbering.h" +#include "DataFormats/HcalDetId/interface/HcalTestNumbering.h" +#include "SimDataFormats/Vertex/interface/SimVertex.h" + +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "SimGeneral/MixingModule/interface/PileUpEventPrincipal.h" +#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" + +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "SimGeneral/TrackingAnalysis/interface/EncodedTruthId.h" +#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" +#include "SimDataFormats/CaloHit/interface/PCaloHit.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" +#include "DataFormats/SiStripDetId/interface/StripSubdetector.h" +#include "DataFormats/HepMCCandidate/interface/GenParticle.h" +#include "FWCore/Framework/interface/ESHandle.h" + +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "Geometry/HcalCommonData/interface/HcalHitRelabeller.h" + +#include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" +#include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" + +#include +#include // for std::accumulate + +#define DEBUG std::cout << __FILE__ << ":" << __LINE__ << "\t" + +/* Graph utility functions */ + +using namespace boost; +namespace { + template < typename Edge, typename Graph, typename Visitor> + void print_edge(Edge &e, const Graph & g, Visitor * v) { + auto const edge_property = get(edge_weight, g, e); + v->total_simHits += edge_property.simHits; + std::cout << "Examining edges " << e + << " --> particle " << edge_property.simTrack->type() + << "(" << edge_property.simTrack->trackId() << ")" + << " with SimClusters: " << edge_property.simHits + << " and total Energy: " << edge_property.energy + << " Accumulated SimClusters: " << v->total_simHits << std::endl; + } + template < typename Vertex, typename Graph > + void print_vertex(Vertex &u, const Graph & g) { + auto const vertex_property = get(vertex_name, g, u); + std::cout << "At " << u; + // The Mother of all vertices has **no** SimTrack associated. + if (vertex_property.simTrack) + std::cout << "[" << vertex_property.simTrack->type() << "]" + << "(" << vertex_property.simTrack->trackId() << ")"; + std::cout << std::endl; + } + class Custom_dfs_visitor : public boost::default_dfs_visitor { + public: + int total_simHits = 0; + template < typename Edge, typename Graph > + void examine_edge(Edge e, const Graph& g) { + print_edge(e, g, this); + } + template < typename Edge, typename Graph > + void finish_edge(Edge e, const Graph & g) { + auto const edge_property = get(edge_weight, g, e); + auto src = source(e, g); + auto trg = target(e, g); + auto cumulative = edge_property.simHits + + get(vertex_name, g, trg).cumulative_simHits + + (get(vertex_name, g, src).simTrack ? get(vertex_name, g, src).cumulative_simHits : 0); // when we hit the root vertex we have to stop adding back its contribution. + auto const src_vertex_property = get(vertex_name, g, src); + put(get(vertex_name, const_cast(g)), + src, + VertexProperty(src_vertex_property.simTrack, cumulative)); + put(get(edge_weight, const_cast(g)), e, + EdgeProperty(edge_property.simTrack, + edge_property.simHits, + cumulative, + edge_property.energy)); + std::cout << "Finished edge: " << e + << " Track id: " << get(edge_weight, g, e).simTrack->trackId() + << " has cumulated " << cumulative + << " hits" << std::endl; + std::cout << " SrcVtx: " << src << "\t" + << get(vertex_name, g, src).simTrack << "\t" + << get(vertex_name, g, src).cumulative_simHits << std::endl; + std::cout << " TrgVtx: " << trg << "\t" + << get(vertex_name, g, trg).simTrack << "\t" + << get(vertex_name, g, trg).cumulative_simHits << std::endl; + } + }; + class CaloParticle_dfs_visitor : public boost::default_dfs_visitor { + public: + int total_simHits = 0; + CaloParticle_dfs_visitor(CaloTruthAccumulatorWithGraph::OutputCollections & output, + std::unordered_multimap & simHitBarcodeToIndex, + std::map > & simTrackDetIdEnergyMap) + : output_(output), + simHitBarcodeToIndex_(simHitBarcodeToIndex), + simTrackDetIdEnergyMap_(simTrackDetIdEnergyMap){} + template < typename Vertex, typename Graph > + void discover_vertex(Vertex u, const Graph & g) { + print_vertex(u, g); + auto const vertex_property = get(vertex_name, g, u); + if (!vertex_property.simTrack) + return; + auto trackIdx = vertex_property.simTrack->trackId(); + std::cout << "Found " << simHitBarcodeToIndex_.count(trackIdx) + << " associated simHits" << std::endl; + if (simHitBarcodeToIndex_.count(trackIdx)) { + output_.pSimClusters->emplace_back(*vertex_property.simTrack); + auto& simcluster = output_.pSimClusters->back(); + std::unordered_map acc_energy; + for( const auto& hit_and_energy : simTrackDetIdEnergyMap_[trackIdx]) { + const uint32_t id = hit_and_energy.first; + if( acc_energy.count(id) ) acc_energy[id] += hit_and_energy.second; + else acc_energy[id] = hit_and_energy.second; + } + + for( const auto& hit_and_energy : acc_energy ) { + simcluster.addRecHitAndFraction(hit_and_energy.first,hit_and_energy.second); + } + } + } + template < typename Edge, typename Graph > + void examine_edge(Edge e, const Graph& g) { + print_edge(e, g, this); + } + private: + CaloTruthAccumulatorWithGraph::OutputCollections & output_; + std::unordered_multimap & simHitBarcodeToIndex_; + std::map > & simTrackDetIdEnergyMap_; + }; +} + +CaloTruthAccumulatorWithGraph::CaloTruthAccumulatorWithGraph( const edm::ParameterSet & config, edm::stream::EDProducerBase& mixMod, edm::ConsumesCollector& iC) : + messageCategory_("CaloTruthAccumulatorWithGraph"), + maximumPreviousBunchCrossing_( config.getParameter("maximumPreviousBunchCrossing") ), + maximumSubsequentBunchCrossing_( config.getParameter("maximumSubsequentBunchCrossing") ), + simTrackLabel_( config.getParameter("simTrackCollection") ), + simVertexLabel_( config.getParameter("simVertexCollection") ), + collectionTags_( ), + genParticleLabel_( config.getParameter("genParticleCollection") ), + hepMCproductLabel_( config.getParameter("HepMCProductLabel") ), + minEnergy_( config.getParameter("MinEnergy") ), + maxPseudoRapidity_( config.getParameter("MaxPseudoRapidity") ) +{ + barcodeLogicWarningAlready_ = false; + + mixMod.produces("MergedCaloTruth"); + mixMod.produces("MergedCaloTruth"); + + iC.consumes >(simTrackLabel_); + iC.consumes >(simVertexLabel_); + iC.consumes >(genParticleLabel_); + iC.consumes >(genParticleLabel_); + iC.consumes >(hepMCproductLabel_); + + // Fill the collection tags + const edm::ParameterSet& simHitCollectionConfig=config.getParameterSet("simHitCollections"); + std::vector parameterNames=simHitCollectionConfig.getParameterNames(); + + for( const auto& parameterName : parameterNames ) + { + std::vector tags=simHitCollectionConfig.getParameter >(parameterName); + collectionTags_.insert(collectionTags_.end(), tags.begin(), tags.end()); + } + + for( const auto& collectionTag : collectionTags_ ) { + iC.consumes >(collectionTag); + } +} + +void CaloTruthAccumulatorWithGraph::beginLuminosityBlock( edm::LuminosityBlock const& iLumiBlock, const edm::EventSetup& iSetup ) { + edm::ESHandle geom; + iSetup.get().get(geom); + const HGCalGeometry *eegeom, *fhgeom; + const HcalGeometry *bhgeom; + + eegeom = dynamic_cast(geom->getSubdetectorGeometry(DetId::Forward,HGCEE)); + fhgeom = dynamic_cast(geom->getSubdetectorGeometry(DetId::Forward,HGCHEF)); + bhgeom = dynamic_cast(geom->getSubdetectorGeometry(DetId::Hcal,HcalEndcap)); + + hgtopo_[0] = &(eegeom->topology()); + hgtopo_[1] = &(fhgeom->topology()); + + for( unsigned i = 0; i < 2; ++i ) { + hgddd_[i] = &(hgtopo_[i]->dddConstants()); + } + + hcddd_ = bhgeom->topology().dddConstants(); + + caloStartZ = hgddd_[0]->waferZ(1,false)*10.0; // get the location of the first plane of silicon, put in mm +} + +void CaloTruthAccumulatorWithGraph::initializeEvent( edm::Event const& event, edm::EventSetup const& setup ) { + output_.pSimClusters.reset( new SimClusterCollection() ); + output_.pCaloParticles.reset( new CaloParticleCollection() ); + + m_detIdToCluster.clear(); + m_detIdToTotalSimEnergy.clear(); +} + +/// create handle to edm::HepMCProduct here because event.getByLabel with edm::HepMCProduct only works for edm::Event +/// but not for PileUpEventPrincipal; PileUpEventPrincipal::getByLabel tries to call T::value_type and T::iterator +/// (where T is the type of the object one wants to get a handle to) which is only implemented for container-like objects +/// like std::vector but not for edm::HepMCProduct! + +void CaloTruthAccumulatorWithGraph::accumulate( edm::Event const& event, edm::EventSetup const& setup ) { + // Call the templated version that does the same for both signal and pileup events + + edm::Handle< edm::HepMCProduct > hepmc; + event.getByLabel(hepMCproductLabel_, hepmc); + + edm::LogInfo(messageCategory_) << " CaloTruthAccumulatorWithGraph::accumulate (signal)"; + accumulateEvent( event, setup, hepmc ); +} + +void CaloTruthAccumulatorWithGraph::accumulate( PileUpEventPrincipal const& event, edm::EventSetup const& setup, edm::StreamID const& ) { + // If this bunch crossing is outside the user configured limit, don't do anything. + if( event.bunchCrossing()>=-static_cast(maximumPreviousBunchCrossing_) && event.bunchCrossing()<=static_cast(maximumSubsequentBunchCrossing_) ) + { + //edm::LogInfo(messageCategory_) << "Analysing pileup event for bunch crossing " << event.bunchCrossing(); + + //simply create empty handle as we do not have a HepMCProduct in PU anyway + edm::Handle< edm::HepMCProduct > hepmc; + edm::LogInfo(messageCategory_) << " CaloTruthAccumulatorWithGraph::accumulate (pileup) bunchCrossing=" << event.bunchCrossing(); + accumulateEvent( event, setup, hepmc ); + } + else edm::LogInfo(messageCategory_) << "Skipping pileup event for bunch crossing " << event.bunchCrossing(); +} + +void CaloTruthAccumulatorWithGraph::finalizeEvent( edm::Event& event, edm::EventSetup const& setup ) { + edm::LogInfo("CaloTruthAccumulatorWithGraph") << "Adding " << output_.pSimClusters->size() + << " SimParticles and " << output_.pCaloParticles->size() + << " CaloParticles to the event."; + + // now we need to normalize the hits and energies into hits and fractions + // (since we have looped over all pileup events) + + for( auto& sc : *(output_.pSimClusters) ) { + auto hitsAndEnergies = sc.hits_and_fractions(); + sc.clearHitsAndFractions(); + for( auto& hAndE : hitsAndEnergies ) { + const float totalenergy = m_detIdToTotalSimEnergy[hAndE.first]; + float fraction = 0.; + if(totalenergy>0) fraction = hAndE.second/totalenergy; + else edm::LogWarning("CaloTruthAccumulatorWithGraph") << "TotalSimEnergy for hit " << hAndE.first << " is 0! The fraction for this hit cannot be computed."; + sc.addRecHitAndFraction(hAndE.first,fraction); + } + } + + // save the SimCluster orphan handle so we can fill the calo particles + auto scHandle = event.put( std::move(output_.pSimClusters), "MergedCaloTruth" ); + + // now fill the calo particles + for( unsigned i = 0; i < output_.pCaloParticles->size(); ++i ) { + auto& cp = (*output_.pCaloParticles)[i]; + for( unsigned j = m_caloParticles.sc_start_[i]; j < m_caloParticles.sc_stop_[i]; ++j ) { + edm::Ref ref(scHandle,j); + cp.addSimCluster(ref); + } + } + + event.put( std::move(output_.pCaloParticles), "MergedCaloTruth" ); + + calo_particles().swap(m_caloParticles); + + std::unordered_map().swap(m_detIdToTotalSimEnergy); + + std::unordered_map().swap(m_genParticleBarcodeToIndex); + std::unordered_map().swap(m_simTrackBarcodeToIndex); + std::unordered_map().swap(m_genBarcodeToSimTrackIndex); + std::unordered_map().swap(m_simVertexBarcodeToIndex); + + std::unordered_multimap().swap(m_detIdToCluster); + std::unordered_multimap().swap(m_simHitBarcodeToIndex); + std::unordered_multimap().swap(m_simVertexBarcodeToSimTrackBarcode); + std::unordered_map().swap(m_simTrackBarcodeToSimVertexParentBarcode); + std::unordered_multimap().swap(m_simTrackToSimVertex); + std::unordered_multimap().swap(m_simVertexToSimTrackParent); + std::vector().swap(m_simVertexBarcodes); + std::unordered_map().swap(m_detIdToTotalSimEnergy); +} + +template +void CaloTruthAccumulatorWithGraph::accumulateEvent( const T& event, + const edm::EventSetup& setup, + const edm::Handle< edm::HepMCProduct >& hepMCproduct) { + // + // Get the collections + // + + edm::Handle< std::vector > hGenParticles; + edm::Handle< std::vector > hGenParticleIndices; + + event.getByLabel( simTrackLabel_, hSimTracks ); + event.getByLabel( simVertexLabel_, hSimVertices ); + + event.getByLabel( genParticleLabel_, hGenParticles ); + event.getByLabel( genParticleLabel_, hGenParticleIndices ); + + std::vector > simHitPointers; + std::map > simTrackDetIdEnergyMap; + fillSimHits( simHitPointers, simTrackDetIdEnergyMap, event, setup ); + + // Clear maps from previous event fill them for this one + m_simHitBarcodeToIndex.clear(); + m_simTracksConsideredForSimClusters.clear(); + for (unsigned int i = 0 ; i < simHitPointers.size(); ++i) { + m_simHitBarcodeToIndex.emplace(simHitPointers[i].second->geantTrackId(),i); + } + m_genParticleBarcodeToIndex.clear(); + if( hGenParticles.isValid() && hGenParticleIndices.isValid() ) { + for (unsigned int i = 0 ; i < hGenParticles->size() ; ++i) { + m_genParticleBarcodeToIndex.emplace(hGenParticleIndices->at(i),i); + } + } + m_genBarcodeToSimTrackIndex.clear(); + m_simVertexBarcodeToSimTrackBarcode.clear(); + m_simTrackBarcodeToSimVertexParentBarcode.clear(); + m_simTrackBarcodeToIndex.clear(); + for (unsigned int i = 0 ; i < hSimTracks->size() ; i++) { + if( !hSimTracks->at(i).noGenpart() ) { + m_genBarcodeToSimTrackIndex.emplace(hSimTracks->at(i).genpartIndex(), i); + } + if( !hSimTracks->at(i).noVertex() ) { + m_simVertexBarcodeToSimTrackBarcode.emplace(hSimTracks->at(i).vertIndex(), hSimTracks->at(i).trackId()); + m_simTrackBarcodeToSimVertexParentBarcode.emplace(hSimTracks->at(i).trackId(), hSimTracks->at(i).vertIndex()); + } + m_simTrackBarcodeToIndex.emplace(hSimTracks->at(i).trackId(), i); + } + m_simVertexBarcodes.clear(); + m_simVertexBarcodeToIndex.clear(); + m_simTrackToSimVertex.clear(); + m_simVertexToSimTrackParent.clear(); + for (unsigned int i = 0 ; i < hSimVertices->size() ; i++) { + m_simVertexBarcodes.push_back(i); + m_simVertexBarcodeToIndex.emplace(hSimVertices->at(i).vertexId(), i); + if (!hSimVertices->at(i).noParent()) { + m_simTrackToSimVertex.emplace(hSimVertices->at(i).parentIndex(), i); + m_simVertexToSimTrackParent.emplace( hSimVertices->at(i).vertexId(), hSimVertices->at(i).parentIndex() ); + } + } + + const auto& tracks = *hSimTracks; + const auto& vertices = *hSimVertices; + std::map trackid_to_track_index; + DecayChain decay; + int idx = 0; + // Build the main decay graph and assign the SimTrack to each edge. The graph + // built here will only contain the particles that have a decay vertex + // associated to them. In order to recover also the particles that will not + // decay, we need to keep track of the SimTrack used here and add, + // a-posteriori, the ones not used, associating a ghost vertex (starting from + // the highest simulated vertex number +1), in order to build the edge and + // identify them immediately as stable (i.e. not decayed). + std::cout << "TRACKS" << std::endl; + for (auto const & t : tracks) { + std::cout << idx << "\t" << t.trackId() << "\t" << t << std::endl; + trackid_to_track_index[t.trackId()] = idx; + idx++; + } + idx = 0; + std::vector used_sim_tracks(tracks.size(), false); + std::cout << "VERTICES" << std::endl; + for (auto const & v: vertices) { + std::cout << idx++ << "\t" << v << std::endl; + if (v.parentIndex() != -1) { + add_edge(tracks.at(trackid_to_track_index[v.parentIndex()]).vertIndex(), + v.vertexId(), + EdgeProperty(&tracks.at(trackid_to_track_index[v.parentIndex()]), + simTrackDetIdEnergyMap[trackid_to_track_index[v.parentIndex()]].size(), + 0, + std::accumulate(simTrackDetIdEnergyMap[trackid_to_track_index[v.parentIndex()]].begin(), + simTrackDetIdEnergyMap[trackid_to_track_index[v.parentIndex()]].end(), 0., + [&](float partial, std::pair current) { + return partial + current.second/m_detIdToTotalSimEnergy[current.first]; })), + decay); + used_sim_tracks[trackid_to_track_index[v.parentIndex()]] = true; + } + } + // Assign the motherParticle property to each vertex + auto const & vertexMothersProp = get(vertex_name, decay); + // Now recover the particles that did not decay. Append them with an index + // bigger than the size of the generated vertices. + int offset = vertices.size() + 1; + for (size_t i = 0; i < tracks.size(); ++i) { + if (!used_sim_tracks[i]) { + add_edge(tracks.at(i).vertIndex(), offset, + EdgeProperty(&tracks.at(i), + simTrackDetIdEnergyMap[tracks.at(i).trackId()].size(), + 0, + std::accumulate(simTrackDetIdEnergyMap[tracks.at(i).trackId()].begin(), + simTrackDetIdEnergyMap[tracks.at(i).trackId()].end(), 0., + [&](float partial, std::pair current) { + return partial + current.second/m_detIdToTotalSimEnergy[current.first]; + })), decay); + // The properties for "fake" vertices associated to stable particles have + // to be set inside this loop, since they do not belong to the vertices + // collection and would be skipped by that loop (coming next) + put(vertexMothersProp, offset, VertexProperty(&tracks.at(i), 0)); + offset++; + } + } + for (auto const & v: vertices) { + if (v.parentIndex() != -1) { + put(vertexMothersProp, v.vertexId(), VertexProperty(&tracks.at(trackid_to_track_index[v.parentIndex()]), 0)); + } + } +#define DFS +#ifdef DFS + Custom_dfs_visitor vis; + depth_first_search(decay, visitor(vis)); + auto const first_generation = out_edges(0, decay); + for (auto edge = first_generation.first; edge != first_generation.second; ++edge) { + auto const edge_property = get(edge_weight, decay, *edge); + // Apply selection on SimTracks in order to promote them to be CaloParticles. + if (edge_property.cumulative_simHits == 0 + or edge_property.simTrack->noGenpart() + or edge_property.simTrack->momentum().E() < minEnergy_ + or std::abs(edge_property.simTrack->momentum().Eta()) >= maxPseudoRapidity_) + continue; + output_.pCaloParticles->emplace_back(*(edge_property.simTrack)); + m_caloParticles.sc_start_.push_back(output_.pSimClusters->size()); + CaloParticle_dfs_visitor caloParticleCreator(output_, + m_simHitBarcodeToIndex, + simTrackDetIdEnergyMap); + depth_first_search(decay, visitor(caloParticleCreator).root_vertex(target(*edge, decay))); + m_caloParticles.sc_stop_.push_back(output_.pSimClusters->size()); + std::cout << "Creating CaloParticle particle: " + << edge_property.simTrack->type() + << "(" << edge_property.simTrack->trackId() << ")" + << " with total SimClusters: " << edge_property.cumulative_simHits + << " and total Energy: " << edge_property.energy + << std::endl; + } +#else + Custom_bfs_visitor vis; + breadth_first_search(decay, 0, visitor(vis)); +#endif + + const auto& simTracks = *hSimTracks; + // loop over + for (unsigned int i = 0 ; i < simTracks.size() ; ++i) { + if ( simTracks[i].momentum().E() < minEnergy_ || std::abs(simTracks[i].momentum().Eta()) >= maxPseudoRapidity_ ) continue; + if ( simTracks[i].noGenpart() ) continue; + DEBUG << "INIT Analysing simTrack: " << i << "\t" << simTracks[i] << std::endl; + auto temp = CaloTruthAccumulatorWithGraph::descendantSimClusters( simTracks[i].trackId(),simHitPointers ); + std::cout << "Return size from descendantSimClusters for track: " << i << " is " << temp.size() << std::endl; + for (auto const & v : temp) { + std::cout << "Adding a simTrack: " << v << std::endl; + } + if( !temp.empty() ) { + output_.pCaloParticles->emplace_back(simTracks[i]); + m_caloParticles.sc_start_.push_back(output_.pSimClusters->size()); + auto mbegin = std::make_move_iterator(temp.begin()); + auto mend = std::make_move_iterator(temp.end()); + output_.pSimClusters->insert(output_.pSimClusters->end(), mbegin, mend); + m_caloParticles.sc_stop_.push_back(output_.pSimClusters->size()); + } + } +} + + +SimClusterCollection CaloTruthAccumulatorWithGraph::descendantSimClusters( Barcode_t barcode, const std::vector >& hits ) { + DEBUG << __FUNCTION__ << std::endl; + SimClusterCollection result; + const auto& simTracks = *hSimTracks; + if ( CaloTruthAccumulatorWithGraph::consideredBarcode( barcode ) ) { + DEBUG << "SCZ DEBUG Ignoring descendantSimClusters call because this particle is already marked used: " << barcode << std::endl; + //return result; + } + + std::unique_ptr hit_info = std::move(CaloTruthAccumulatorWithGraph::attachedSimHitInfo(barcode,hits, true, false, false)); + //std::unique_ptr inclusive_hit_info = std::move(CaloTruthAccumulatorWithGraph::allAttachedSimHitInfo(barcode,hits, false) ); + + const auto& simTrack = simTracks[m_simTrackBarcodeToIndex[barcode]]; + Barcode_t vtxBarcode = m_simTrackBarcodeToSimVertexParentBarcode[barcode]; + const auto& vtx = hSimVertices->at(m_simVertexBarcodeToIndex[vtxBarcode]); + const bool isInCalo = (std::abs(vtx.position().z()) > caloStartZ*0.1 - 30.0); // add a buffer region in front of the calo face + DEBUG << "Vertex Z-position: " << std::abs(vtx.position().z()) + << " caloStartZ[cm]: " << caloStartZ*0.1 + << " isInCalo: " << isInCalo << std::endl; + + if (!hit_info->empty()) { + // define the sim cluster starting from the earliest particle that has hits in the calorimeter + // grab everything that descends from it + std::unique_ptr marked_hit_info; + + + if( isInCalo ) { + marked_hit_info = std::move( CaloTruthAccumulatorWithGraph::allAttachedSimHitInfo(barcode,hits,true) ); + } else { + marked_hit_info = std::move( CaloTruthAccumulatorWithGraph::attachedSimHitInfo(barcode,hits,true,false,true) ); + } + + if( !marked_hit_info->empty() ) { + result.emplace_back(simTrack); + auto& simcluster = result.back(); + + std::unordered_map acc_energy; + + for( const auto& hit_and_energy : *marked_hit_info ) { + const uint32_t id = hit_and_energy.first.rawId(); + if( acc_energy.count(id) ) acc_energy[id] += hit_and_energy.second; + else acc_energy[id] = hit_and_energy.second; + } + + for( const auto& hit_and_energy : acc_energy ) { + DEBUG << "Barcode: " << barcode + << " adding DetId: " << hit_and_energy.first + << "\twith energy: " << hit_and_energy.second << std::endl; + simcluster.addRecHitAndFraction(hit_and_energy.first,hit_and_energy.second); + } + } + } + + if ( m_simTrackToSimVertex.count(barcode) ) { + auto vertex_range = m_simTrackToSimVertex.equal_range(barcode); + for ( auto vertex_iter = vertex_range.first ; vertex_iter != vertex_range.second ; vertex_iter++ ) { + Index_t decayVertexIndex = vertex_iter->second; + Barcode_t decayVertexBarcode = m_simVertexBarcodes[decayVertexIndex]; + auto track_range = m_simVertexBarcodeToSimTrackBarcode.equal_range( decayVertexBarcode ); + for ( auto track_iter = track_range.first ; track_iter != track_range.second ; track_iter++ ) { + + auto daughter_result = CaloTruthAccumulatorWithGraph::descendantSimClusters(track_iter->second,hits); + result.insert(result.end(),daughter_result.begin(),daughter_result.end()); + } + } + } + + return result; +} + +std::unique_ptr CaloTruthAccumulatorWithGraph::attachedSimHitInfo( Barcode_t barcode , const std::vector >& hits, + bool includeOwn , bool includeOther, bool markUsed ) { + DEBUG << __FUNCTION__ << std::endl; + const auto& simTracks = *hSimTracks; + std::unique_ptr result(new SimHitInfoPerSimTrack_t); + + const auto& simTrack = simTracks[m_simTrackBarcodeToIndex[barcode]]; + DEBUG << "Track with barcode: " << barcode + << " is used: " << markUsed + << " includeOwn: " << includeOwn + << " includeOther: " << includeOther + << std::endl; + + if ( markUsed ) { + if ( CaloTruthAccumulatorWithGraph::consideredBarcode( barcode ) ) { + return result; + } + CaloTruthAccumulatorWithGraph::setConsideredBarcode( barcode ); + } + if (includeOwn) { + DEBUG << "Adding self hits for track with barcode: " << barcode << std::endl; + auto range = m_simHitBarcodeToIndex.equal_range( barcode ); + unsigned n = 0; + for ( auto iter = range.first ; iter != range.second ; iter++ ) { + const auto& the_hit = hits[iter->second]; + DEBUG << "Adding self " << the_hit.first.rawId() + << " for track with barcode " << barcode + << " with energy: " << the_hit.second->energy() << std::endl; + result->emplace_back(the_hit.first,the_hit.second->energy()); + ++n; + } + } + + // need to sim to the next sim track if we explicitly ask or + // if we are in the calorimeter next (no interaction) + // or if this is a continuation of the same particle + DEBUG << "Track with barcode: " << barcode << " has decayed: " << m_simTrackToSimVertex.count(barcode) + << std::endl; + if (m_simTrackToSimVertex.count(barcode)) { + auto vertex_range = m_simTrackToSimVertex.equal_range(barcode); + for ( auto vertex_iter = vertex_range.first ; vertex_iter != vertex_range.second ; vertex_iter++ ) { + Index_t decayVertexIndex = vertex_iter->second; + DEBUG << "Considering vertex number: " << decayVertexIndex << std::endl; + const auto& nextVtx = (*hSimVertices)[decayVertexIndex]; + const bool nextInCalo = (std::abs(nextVtx.position().z()) > caloStartZ*0.1 - 30.0); // add a buffer region in front of the calo face + DEBUG << "The vertex is nextInCalo: " << nextInCalo << std::endl; + + Barcode_t decayVertexBarcode = m_simVertexBarcodes[decayVertexIndex]; + auto track_range = m_simVertexBarcodeToSimTrackBarcode.equal_range( decayVertexBarcode ); + for ( auto track_iter = track_range.first ; track_iter != track_range.second ; track_iter++ ) { + if( !barcodeLogicWarningAlready_ && track_iter->second < barcode ) { + barcodeLogicWarningAlready_ = true; + DEBUG << " Daughter particle has a lower barcode than parent. This may screw up the logic!" << std::endl; + } + DEBUG << "Considering daugther with barcode: " << track_iter->second << std::endl; + const auto& daughter = simTracks[m_simTrackBarcodeToIndex[track_iter->second]]; + + if( includeOther || nextInCalo ) { + std::unique_ptr daughter_result = std::move(CaloTruthAccumulatorWithGraph::allAttachedSimHitInfo(track_iter->second,hits,markUsed)); + result->insert(result->end(),daughter_result->begin(),daughter_result->end()); + } else if ( daughter.type() == simTrack.type() ) { + std::unique_ptr daughter_result = std::move(CaloTruthAccumulatorWithGraph::attachedSimHitInfo(track_iter->second,hits,includeOwn, includeOther, markUsed)); + result->insert(result->end(),daughter_result->begin(),daughter_result->end()); + } + } + } + } + return result; +} + + +std::unique_ptr +CaloTruthAccumulatorWithGraph::allAttachedSimHitInfo( Barcode_t barcode, + const std::vector >& hits, + bool markUsed ) { + DEBUG << "allAttachedSimHitInfo for track with barcode: " << barcode << std::endl; + return CaloTruthAccumulatorWithGraph::attachedSimHitInfo(barcode,hits,true,true,markUsed); +} + +template void CaloTruthAccumulatorWithGraph::fillSimHits( + std::vector >& returnValue, + std::map > & simTrackDetIdEnergyMap, + const T& event, + const edm::EventSetup& setup ) { + // loop over the collections + for( const auto& collectionTag : collectionTags_ ) { + edm::Handle< std::vector > hSimHits; + const bool isHcal = ( collectionTag.instance().find("HcalHits") != std::string::npos ); + event.getByLabel( collectionTag, hSimHits ); + for( const auto& simHit : *hSimHits ) { + DetId id(0); + const uint32_t simId = simHit.id(); + if( isHcal ) { + HcalDetId hid = HcalHitRelabeller::relabel(simId, hcddd_); + if(hid.subdet()==HcalEndcap) id = hid; + } else { + int subdet, layer, cell, sec, subsec, zp; + HGCalTestNumbering::unpackHexagonIndex(simId, subdet, zp, layer, sec, subsec, cell); + const HGCalDDDConstants* ddd = hgddd_[subdet-3]; + std::pair recoLayerCell = ddd->simToReco(cell,layer,sec, + hgtopo_[subdet-3]->detectorType()); + cell = recoLayerCell.first; + layer = recoLayerCell.second; + // skip simhits with bad barcodes or non-existant layers + if( layer == -1 || simHit.geantTrackId() == 0 ) continue; + id = HGCalDetId((ForwardSubdetector)subdet,zp,layer,subsec,sec,cell); + } + + if( DetId(0) == id ) continue; + + uint32_t detId = id.rawId(); + returnValue.emplace_back(id, &simHit); + if (simTrackDetIdEnergyMap.count(simHit.geantTrackId()) + && simTrackDetIdEnergyMap[simHit.geantTrackId()].count(id.rawId())) + simTrackDetIdEnergyMap[simHit.geantTrackId()][id.rawId()] += simHit.energy(); + else + simTrackDetIdEnergyMap[simHit.geantTrackId()][id.rawId()] = simHit.energy(); + + if( m_detIdToTotalSimEnergy.count(detId) ) m_detIdToTotalSimEnergy[detId] += simHit.energy(); + else m_detIdToTotalSimEnergy[detId] = simHit.energy(); + } + } // end of loop over InputTags +} + +// Register with the framework +DEFINE_DIGI_ACCUMULATOR (CaloTruthAccumulatorWithGraph); diff --git a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.h b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.h new file mode 100644 index 0000000000000..ee92dbbf5fcff --- /dev/null +++ b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.h @@ -0,0 +1,229 @@ +#ifndef CaloAnalysis_CaloTruthAccumulatorWithGraph_h +#define CaloAnalysis_CaloTruthAccumulatorWithGraph_h + +#include "SimGeneral/MixingModule/interface/DigiAccumulatorMixMod.h" +// BOOST GRAPH LIBRARY +#include +#include +#include + +#include // required for std::auto_ptr +#include "SimDataFormats/CaloAnalysis/interface/CaloParticleFwd.h" +#include "SimDataFormats/CaloAnalysis/interface/SimClusterFwd.h" +#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" + +#include +#include "DataFormats/ForwardDetId/interface/HGCalDetId.h" +#include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" +#include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" +#include "FWCore/Framework/interface/ESHandle.h" + +typedef unsigned Index_t; +typedef int Barcode_t; +typedef std::pair IndexPair_t; +typedef std::pair SimHitInfo_t; +typedef std::pair BarcodeIndexPair_t; +typedef std::pair BarcodePair_t; +typedef std::pair SimHitInfoPerRecoDetId_t; +typedef std::vector SimHitInfoPerSimTrack_t; + + +// typedef uint32_t RecoDetId_t; + +// Forward declarations +namespace edm { + class ParameterSet; + class ConsumesCollector; + namespace stream { + class EDProducerBase; + } + class Event; + class EventSetup; + class StreamID; +} +class PileUpEventPrincipal; +class PCaloHit; +class SimTrack; +class SimVertex; + +using namespace boost; + +/* GRAPH DEFINITIONS + + The graph represents the full decay chain. + + The parent-child relationship is the natural one, following "time". + + Each edge has a property (edge_weight_t) that holds a const pointer to the + SimTrack that connects the 2 vertices of the edge, the number of simHits + associated to that simTrack, the overall energy deposited in the + associated simHits and the cumulative number of simHits of itself and of all + its children. Only simHits within the HGCAL detector are taken into account. + + Each vertex has a property (vertex_name_t) that holds a const pointer to the + SimTrack that originated that vertex and the cumulative number of simHits of + all its outgoing edges. The cumulative property is filled during the dfs + exploration of the graph: if not explored the number is 0. + + Stable particles are recovered/added in a second iterations and are linked + to ghost vertices with an offset starting from the highest generated vertex. +*/ +struct EdgeProperty { + EdgeProperty(const SimTrack* t, + int h, + int c, + float e) + : simTrack(t), simHits(h), cumulative_simHits(c), energy(e) {} + const SimTrack* simTrack; + int simHits; + int cumulative_simHits; + float energy; +}; + +struct VertexProperty { + VertexProperty() : simTrack(nullptr), cumulative_simHits(0) {} + VertexProperty(const SimTrack* t, int c) : simTrack(t), cumulative_simHits(c) {} + VertexProperty(const VertexProperty& other) : simTrack(other.simTrack), cumulative_simHits(other.cumulative_simHits) {} + const SimTrack * simTrack; + int cumulative_simHits; +}; + +typedef property EdgeParticleClustersProperty; +typedef property VertexMotherParticleProperty; +typedef adjacency_list< listS, vecS, directedS, + VertexMotherParticleProperty, EdgeParticleClustersProperty> DecayChain; + +class CaloTruthAccumulatorWithGraph : public DigiAccumulatorMixMod { + public: + explicit CaloTruthAccumulatorWithGraph( const edm::ParameterSet& config, edm::stream::EDProducerBase& mixMod, edm::ConsumesCollector& iC); + private: + void initializeEvent( const edm::Event& event, const edm::EventSetup& setup ) override; + void accumulate( const edm::Event& event, const edm::EventSetup& setup ) override; + void accumulate( const PileUpEventPrincipal& event, const edm::EventSetup& setup, edm::StreamID const& ) override; + void finalizeEvent( edm::Event& event, const edm::EventSetup& setup ) override; + void beginLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const& setup) override; + + /** @brief Both forms of accumulate() delegate to this templated method. */ + template void accumulateEvent( const T& event, const edm::EventSetup& setup, const edm::Handle< edm::HepMCProduct >& hepMCproduct ); + + /** @brief Fills the supplied vector with pointers to the SimHits, checking for bad modules if required */ + template void fillSimHits( + std::vector > & returnValue, + std::map > & simTrackDetIdEnergyMap, + const T& event, + const edm::EventSetup& setup ); + + std::unique_ptr attachedSimHitInfo( Barcode_t st, const std::vector > & hits, + bool includeOwn = true, bool includeOther = false, bool markUsed = false); + std::unique_ptr allAttachedSimHitInfo( Barcode_t st, const std::vector > & hits, bool markUsed = false); + + SimClusterCollection descendantSimClusters( Barcode_t barcode, const std::vector > & hits ); + std::set m_simTracksConsideredForSimClusters; + void setConsideredBarcode( Barcode_t barcode ) { m_simTracksConsideredForSimClusters.insert( barcode ); } + bool consideredBarcode( Barcode_t barcode ) { + // return (std::find(m_simTracksConsideredForSimClusters.begin(), m_simTracksConsideredForSimClusters.end(), barcode) != m_simTracksConsideredForSimClusters.end()); + return m_simTracksConsideredForSimClusters.count( barcode ); + } + + const std::string messageCategory_; ///< The message category used to send messages to MessageLogger + + struct calo_particles { + std::vector sc_start_; + std::vector sc_stop_; + + void swap(calo_particles& oth) { + sc_start_.swap(oth.sc_start_); + sc_stop_.swap(oth.sc_stop_); + } + + void clear() { + sc_start_.clear(); + sc_stop_.clear(); + } + }; + + calo_particles m_caloParticles; + double caloStartZ; + + std::unordered_map m_detIdToTotalSimEnergy; // keep track of cell normalizations + std::unordered_map m_genParticleBarcodeToIndex; + std::unordered_map m_simTrackBarcodeToIndex; + std::unordered_map m_genBarcodeToSimTrackIndex; + std::unordered_map m_simVertexBarcodeToIndex; + std::unordered_multimap m_detIdToCluster; + std::unordered_multimap m_simHitBarcodeToIndex; + std::unordered_multimap m_simVertexBarcodeToSimTrackBarcode; + std::unordered_map m_simTrackBarcodeToSimVertexParentBarcode; + std::unordered_multimap m_simTrackToSimVertex; + std::unordered_multimap m_simVertexToSimTrackParent; + // std::unordered_multimap m_recoDetIdToSimHits; + + std::vector m_simVertexBarcodes; + + // const double volumeRadius_; + // const double volumeZ_; + /// maximum distance for HepMC::GenVertex to be added to SimVertex + // const double vertexDistanceCut_; + // const bool ignoreTracksOutsideVolume_; + + /** The maximum bunch crossing BEFORE the signal crossing to create TrackinParticles for. Use positive values. If set to zero no + * previous bunches are added and only in-time, signal and after bunches (defined by maximumSubsequentBunchCrossing_) are used.*/ + const unsigned int maximumPreviousBunchCrossing_; + /** The maximum bunch crossing AFTER the signal crossing to create TrackinParticles for. E.g. if set to zero only + * uses the signal and in time pileup (and previous bunches defined by the maximumPreviousBunchCrossing_ parameter). */ + const unsigned int maximumSubsequentBunchCrossing_; + /// If bremsstrahlung merging, whether to also add the unmerged collection to the event or not. + // const bool createUnmergedCollection_; + // const bool createMergedCollection_; + /// Whether or not to create a separate collection for just the initial interaction vertices + // const bool createInitialVertexCollection_; + /// Whether or not to add the full parentage of any TrackingParticle that is inserted in the collection. + // const bool addAncestors_; + + const edm::InputTag simTrackLabel_; + const edm::InputTag simVertexLabel_; + edm::Handle > hSimTracks; + edm::Handle > hSimVertices; + + std::vector collectionTags_; + edm::InputTag genParticleLabel_; + /// Needed to add HepMC::GenVertex to SimVertex + edm::InputTag hepMCproductLabel_; + + const double minEnergy_, maxPseudoRapidity_; + + bool selectorFlag_; + /// Uses the same config as selector_, but can be used to drop out early since selector_ requires the TrackingParticle to be created first. + bool chargedOnly_; + /// Uses the same config as selector_, but can be used to drop out early since selector_ requires the TrackingParticle to be created first. + bool signalOnly_; + + bool barcodeLogicWarningAlready_; + + /** @brief When counting hits, allows hits in different detectors to have a different process type. + * + * Fast sim PCaloHits seem to have a peculiarity where the process type (as reported by PCaloHit::processType()) is + * different for the tracker than the muons. When counting how many hits there are, the code usually only counts + * the number of hits that have the same process type as the first hit. Setting this to true will also count hits + * that have the same process type as the first hit in the second detector.
+ */ + // bool allowDifferentProcessTypeForDifferentDetectors_; + public: + // These always go hand in hand, and I need to pass them around in the internal + // functions, so I might as well package them up in a struct. + struct OutputCollections + { + std::unique_ptr pSimClusters; + std::unique_ptr pCaloParticles; + // std::auto_ptr pTrackingVertices; + // TrackingParticleRefProd refTrackingParticles; + // TrackingVertexRefProd refTrackingVertexes; + }; + private: + const HGCalTopology* hgtopo_[2]; + const HGCalDDDConstants* hgddd_[2]; + const HcalDDDRecConstants* hcddd_; + OutputCollections output_; +}; + +#endif // end of "#ifndef CaloAnalysis_CaloTruthAccumulatorWithGraph_h" diff --git a/SimGeneral/Debugging/plugins/Debugging.cc b/SimGeneral/Debugging/plugins/Debugging.cc index 4a629908ab3e9..ed32a8ee6df14 100644 --- a/SimGeneral/Debugging/plugins/Debugging.cc +++ b/SimGeneral/Debugging/plugins/Debugging.cc @@ -60,7 +60,8 @@ using namespace boost; Each vertex has a property (vertex_name_t) that holds a const pointer to the SimTrack that originated that vertex and the cumulative number of simHits of - all its outgoing edges. + all its outgoing edges. The cumulative property is filled during the dfs + exploration of the graph: if not explored the number is 0. Stable particles are recovered/added in a second iterations and are linked to ghost vertices with an offset starting from the highest generated vertex. diff --git a/SimGeneral/Debugging/python/ConfFile_cfg.py b/SimGeneral/Debugging/python/ConfFile_cfg.py index 46877b34d32b2..a03d0bc429b96 100644 --- a/SimGeneral/Debugging/python/ConfFile_cfg.py +++ b/SimGeneral/Debugging/python/ConfFile_cfg.py @@ -19,10 +19,11 @@ 'drop l1tEMTFTrack2016s_simEmtfDigis__HLT']), # replace 'myfile.root' with the source file you want to use fileNames = cms.untracked.vstring( -# 'file:/data/rovere/HGCAL/study/CMSSW_9_4_0/src/SimGeneral/Debugging/test/20800.0_FourMuPt1_200+FourMuPt_1_200_pythia8_2023D20_GenSimHLBeamSpotFull+DigiFull_2023D20+RecoFullGlobal_2023D20+HARVESTFullGlobal_2023D20/step2.root' +# 'file:/data/rovere/HGCAL/study/CMSSW_9_4_0/src/SimGeneral/Debugging/test/20800.0_FourMuPt1_200+FourMuPt_1_200_pythia8_2023D20_GenSimHLBeamSpotFull+DigiFull_2023D20+RecoFullGlobal_2023D20+HARVESTFullGlobal_2023D20/step2.root' # 'file:/data/rovere/HGCAL/study/CMSSW_9_4_0/src/SimGeneral/Debugging/test/20824.0_TTbar_13+TTbar_13TeV_TuneCUETP8M1_2023D20_GenSimHLBeamSpotFull+DigiFull_2023D20+RecoFullGlobal_2023D20+HARVESTFullGlobal_2023D20/step2.root' -# 'file:/data/rovere/HGCAL/study/CMSSW_9_4_0/src/SimGeneral/Debugging/test/20002.0_SingleElectronPt35+SingleElectronPt35_pythia8_2023D17_GenSimHLBeamSpotFull+DigiFullTrigger_2023D17+RecoFullGlobal_2023D17+HARVESTFullGlobal_2023D17/step2.root' - 'file:/data/rovere/HGCAL/study/CMSSW_9_4_0/src/SimGeneral/Debugging/test/20016.0_SingleGammaPt35Extended+DoubleGammaPt35Extended_pythia8_2023D17_GenSimHLBeamSpotFull+DigiFullTrigger_2023D17+RecoFullGlobal_2023D17+HARVESTFullGlobal_2023D17/step2.root' + 'file:/data/rovere/HGCAL/study/CMSSW_9_4_0/src/SimGeneral/Debugging/test/20002.0_SingleElectronPt35+SingleElectronPt35_pythia8_2023D17_GenSimHLBeamSpotFull+DigiFullTrigger_2023D17+RecoFullGlobal_2023D17+HARVESTFullGlobal_2023D17/step2.root' +# 'file:/data/rovere/HGCAL/study/CMSSW_9_4_0/src/SimGeneral/Debugging/test/20016.0_SingleGammaPt35Extended+DoubleGammaPt35Extended_pythia8_2023D17_GenSimHLBeamSpotFull+DigiFullTrigger_2023D17+RecoFullGlobal_2023D17+HARVESTFullGlobal_2023D17/step2.root' +# 'file:/data/rovere/HGCAL/study/CMSSW_9_4_0/src/SimGeneral/Debugging/test/20088.0_SinglePiPt25Eta1p7_2p7+SinglePiPt25Eta1p7_2p7_2023D17_GenSimHLBeamSpotFull+DigiFullTrigger_2023D17+RecoFullGlobal_2023D17+HARVESTFullGlobal_2023D17/step2.root' ) ) From d2e1c22a367a108f4460500a181a7d7f68c9be3e Mon Sep 17 00:00:00 2001 From: Marco Rovere Date: Tue, 5 Dec 2017 00:24:28 +0100 Subject: [PATCH 092/426] Cleanup unused structures --- .../plugins/CaloTruthAccumulatorWithGraph.cc | 223 ------------------ .../plugins/CaloTruthAccumulatorWithGraph.h | 11 - 2 files changed, 234 deletions(-) diff --git a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc index 49087679d6cad..feaf8bd5eaa6b 100644 --- a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc +++ b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc @@ -207,7 +207,6 @@ void CaloTruthAccumulatorWithGraph::initializeEvent( edm::Event const& event, ed output_.pSimClusters.reset( new SimClusterCollection() ); output_.pCaloParticles.reset( new CaloParticleCollection() ); - m_detIdToCluster.clear(); m_detIdToTotalSimEnergy.clear(); } @@ -277,20 +276,7 @@ void CaloTruthAccumulatorWithGraph::finalizeEvent( edm::Event& event, edm::Event calo_particles().swap(m_caloParticles); std::unordered_map().swap(m_detIdToTotalSimEnergy); - - std::unordered_map().swap(m_genParticleBarcodeToIndex); - std::unordered_map().swap(m_simTrackBarcodeToIndex); - std::unordered_map().swap(m_genBarcodeToSimTrackIndex); - std::unordered_map().swap(m_simVertexBarcodeToIndex); - - std::unordered_multimap().swap(m_detIdToCluster); std::unordered_multimap().swap(m_simHitBarcodeToIndex); - std::unordered_multimap().swap(m_simVertexBarcodeToSimTrackBarcode); - std::unordered_map().swap(m_simTrackBarcodeToSimVertexParentBarcode); - std::unordered_multimap().swap(m_simTrackToSimVertex); - std::unordered_multimap().swap(m_simVertexToSimTrackParent); - std::vector().swap(m_simVertexBarcodes); - std::unordered_map().swap(m_detIdToTotalSimEnergy); } template @@ -320,38 +306,6 @@ void CaloTruthAccumulatorWithGraph::accumulateEvent( const T& event, for (unsigned int i = 0 ; i < simHitPointers.size(); ++i) { m_simHitBarcodeToIndex.emplace(simHitPointers[i].second->geantTrackId(),i); } - m_genParticleBarcodeToIndex.clear(); - if( hGenParticles.isValid() && hGenParticleIndices.isValid() ) { - for (unsigned int i = 0 ; i < hGenParticles->size() ; ++i) { - m_genParticleBarcodeToIndex.emplace(hGenParticleIndices->at(i),i); - } - } - m_genBarcodeToSimTrackIndex.clear(); - m_simVertexBarcodeToSimTrackBarcode.clear(); - m_simTrackBarcodeToSimVertexParentBarcode.clear(); - m_simTrackBarcodeToIndex.clear(); - for (unsigned int i = 0 ; i < hSimTracks->size() ; i++) { - if( !hSimTracks->at(i).noGenpart() ) { - m_genBarcodeToSimTrackIndex.emplace(hSimTracks->at(i).genpartIndex(), i); - } - if( !hSimTracks->at(i).noVertex() ) { - m_simVertexBarcodeToSimTrackBarcode.emplace(hSimTracks->at(i).vertIndex(), hSimTracks->at(i).trackId()); - m_simTrackBarcodeToSimVertexParentBarcode.emplace(hSimTracks->at(i).trackId(), hSimTracks->at(i).vertIndex()); - } - m_simTrackBarcodeToIndex.emplace(hSimTracks->at(i).trackId(), i); - } - m_simVertexBarcodes.clear(); - m_simVertexBarcodeToIndex.clear(); - m_simTrackToSimVertex.clear(); - m_simVertexToSimTrackParent.clear(); - for (unsigned int i = 0 ; i < hSimVertices->size() ; i++) { - m_simVertexBarcodes.push_back(i); - m_simVertexBarcodeToIndex.emplace(hSimVertices->at(i).vertexId(), i); - if (!hSimVertices->at(i).noParent()) { - m_simTrackToSimVertex.emplace(hSimVertices->at(i).parentIndex(), i); - m_simVertexToSimTrackParent.emplace( hSimVertices->at(i).vertexId(), hSimVertices->at(i).parentIndex() ); - } - } const auto& tracks = *hSimTracks; const auto& vertices = *hSimVertices; @@ -418,8 +372,6 @@ void CaloTruthAccumulatorWithGraph::accumulateEvent( const T& event, put(vertexMothersProp, v.vertexId(), VertexProperty(&tracks.at(trackid_to_track_index[v.parentIndex()]), 0)); } } -#define DFS -#ifdef DFS Custom_dfs_visitor vis; depth_first_search(decay, visitor(vis)); auto const first_generation = out_edges(0, decay); @@ -445,181 +397,6 @@ void CaloTruthAccumulatorWithGraph::accumulateEvent( const T& event, << " and total Energy: " << edge_property.energy << std::endl; } -#else - Custom_bfs_visitor vis; - breadth_first_search(decay, 0, visitor(vis)); -#endif - - const auto& simTracks = *hSimTracks; - // loop over - for (unsigned int i = 0 ; i < simTracks.size() ; ++i) { - if ( simTracks[i].momentum().E() < minEnergy_ || std::abs(simTracks[i].momentum().Eta()) >= maxPseudoRapidity_ ) continue; - if ( simTracks[i].noGenpart() ) continue; - DEBUG << "INIT Analysing simTrack: " << i << "\t" << simTracks[i] << std::endl; - auto temp = CaloTruthAccumulatorWithGraph::descendantSimClusters( simTracks[i].trackId(),simHitPointers ); - std::cout << "Return size from descendantSimClusters for track: " << i << " is " << temp.size() << std::endl; - for (auto const & v : temp) { - std::cout << "Adding a simTrack: " << v << std::endl; - } - if( !temp.empty() ) { - output_.pCaloParticles->emplace_back(simTracks[i]); - m_caloParticles.sc_start_.push_back(output_.pSimClusters->size()); - auto mbegin = std::make_move_iterator(temp.begin()); - auto mend = std::make_move_iterator(temp.end()); - output_.pSimClusters->insert(output_.pSimClusters->end(), mbegin, mend); - m_caloParticles.sc_stop_.push_back(output_.pSimClusters->size()); - } - } -} - - -SimClusterCollection CaloTruthAccumulatorWithGraph::descendantSimClusters( Barcode_t barcode, const std::vector >& hits ) { - DEBUG << __FUNCTION__ << std::endl; - SimClusterCollection result; - const auto& simTracks = *hSimTracks; - if ( CaloTruthAccumulatorWithGraph::consideredBarcode( barcode ) ) { - DEBUG << "SCZ DEBUG Ignoring descendantSimClusters call because this particle is already marked used: " << barcode << std::endl; - //return result; - } - - std::unique_ptr hit_info = std::move(CaloTruthAccumulatorWithGraph::attachedSimHitInfo(barcode,hits, true, false, false)); - //std::unique_ptr inclusive_hit_info = std::move(CaloTruthAccumulatorWithGraph::allAttachedSimHitInfo(barcode,hits, false) ); - - const auto& simTrack = simTracks[m_simTrackBarcodeToIndex[barcode]]; - Barcode_t vtxBarcode = m_simTrackBarcodeToSimVertexParentBarcode[barcode]; - const auto& vtx = hSimVertices->at(m_simVertexBarcodeToIndex[vtxBarcode]); - const bool isInCalo = (std::abs(vtx.position().z()) > caloStartZ*0.1 - 30.0); // add a buffer region in front of the calo face - DEBUG << "Vertex Z-position: " << std::abs(vtx.position().z()) - << " caloStartZ[cm]: " << caloStartZ*0.1 - << " isInCalo: " << isInCalo << std::endl; - - if (!hit_info->empty()) { - // define the sim cluster starting from the earliest particle that has hits in the calorimeter - // grab everything that descends from it - std::unique_ptr marked_hit_info; - - - if( isInCalo ) { - marked_hit_info = std::move( CaloTruthAccumulatorWithGraph::allAttachedSimHitInfo(barcode,hits,true) ); - } else { - marked_hit_info = std::move( CaloTruthAccumulatorWithGraph::attachedSimHitInfo(barcode,hits,true,false,true) ); - } - - if( !marked_hit_info->empty() ) { - result.emplace_back(simTrack); - auto& simcluster = result.back(); - - std::unordered_map acc_energy; - - for( const auto& hit_and_energy : *marked_hit_info ) { - const uint32_t id = hit_and_energy.first.rawId(); - if( acc_energy.count(id) ) acc_energy[id] += hit_and_energy.second; - else acc_energy[id] = hit_and_energy.second; - } - - for( const auto& hit_and_energy : acc_energy ) { - DEBUG << "Barcode: " << barcode - << " adding DetId: " << hit_and_energy.first - << "\twith energy: " << hit_and_energy.second << std::endl; - simcluster.addRecHitAndFraction(hit_and_energy.first,hit_and_energy.second); - } - } - } - - if ( m_simTrackToSimVertex.count(barcode) ) { - auto vertex_range = m_simTrackToSimVertex.equal_range(barcode); - for ( auto vertex_iter = vertex_range.first ; vertex_iter != vertex_range.second ; vertex_iter++ ) { - Index_t decayVertexIndex = vertex_iter->second; - Barcode_t decayVertexBarcode = m_simVertexBarcodes[decayVertexIndex]; - auto track_range = m_simVertexBarcodeToSimTrackBarcode.equal_range( decayVertexBarcode ); - for ( auto track_iter = track_range.first ; track_iter != track_range.second ; track_iter++ ) { - - auto daughter_result = CaloTruthAccumulatorWithGraph::descendantSimClusters(track_iter->second,hits); - result.insert(result.end(),daughter_result.begin(),daughter_result.end()); - } - } - } - - return result; -} - -std::unique_ptr CaloTruthAccumulatorWithGraph::attachedSimHitInfo( Barcode_t barcode , const std::vector >& hits, - bool includeOwn , bool includeOther, bool markUsed ) { - DEBUG << __FUNCTION__ << std::endl; - const auto& simTracks = *hSimTracks; - std::unique_ptr result(new SimHitInfoPerSimTrack_t); - - const auto& simTrack = simTracks[m_simTrackBarcodeToIndex[barcode]]; - DEBUG << "Track with barcode: " << barcode - << " is used: " << markUsed - << " includeOwn: " << includeOwn - << " includeOther: " << includeOther - << std::endl; - - if ( markUsed ) { - if ( CaloTruthAccumulatorWithGraph::consideredBarcode( barcode ) ) { - return result; - } - CaloTruthAccumulatorWithGraph::setConsideredBarcode( barcode ); - } - if (includeOwn) { - DEBUG << "Adding self hits for track with barcode: " << barcode << std::endl; - auto range = m_simHitBarcodeToIndex.equal_range( barcode ); - unsigned n = 0; - for ( auto iter = range.first ; iter != range.second ; iter++ ) { - const auto& the_hit = hits[iter->second]; - DEBUG << "Adding self " << the_hit.first.rawId() - << " for track with barcode " << barcode - << " with energy: " << the_hit.second->energy() << std::endl; - result->emplace_back(the_hit.first,the_hit.second->energy()); - ++n; - } - } - - // need to sim to the next sim track if we explicitly ask or - // if we are in the calorimeter next (no interaction) - // or if this is a continuation of the same particle - DEBUG << "Track with barcode: " << barcode << " has decayed: " << m_simTrackToSimVertex.count(barcode) - << std::endl; - if (m_simTrackToSimVertex.count(barcode)) { - auto vertex_range = m_simTrackToSimVertex.equal_range(barcode); - for ( auto vertex_iter = vertex_range.first ; vertex_iter != vertex_range.second ; vertex_iter++ ) { - Index_t decayVertexIndex = vertex_iter->second; - DEBUG << "Considering vertex number: " << decayVertexIndex << std::endl; - const auto& nextVtx = (*hSimVertices)[decayVertexIndex]; - const bool nextInCalo = (std::abs(nextVtx.position().z()) > caloStartZ*0.1 - 30.0); // add a buffer region in front of the calo face - DEBUG << "The vertex is nextInCalo: " << nextInCalo << std::endl; - - Barcode_t decayVertexBarcode = m_simVertexBarcodes[decayVertexIndex]; - auto track_range = m_simVertexBarcodeToSimTrackBarcode.equal_range( decayVertexBarcode ); - for ( auto track_iter = track_range.first ; track_iter != track_range.second ; track_iter++ ) { - if( !barcodeLogicWarningAlready_ && track_iter->second < barcode ) { - barcodeLogicWarningAlready_ = true; - DEBUG << " Daughter particle has a lower barcode than parent. This may screw up the logic!" << std::endl; - } - DEBUG << "Considering daugther with barcode: " << track_iter->second << std::endl; - const auto& daughter = simTracks[m_simTrackBarcodeToIndex[track_iter->second]]; - - if( includeOther || nextInCalo ) { - std::unique_ptr daughter_result = std::move(CaloTruthAccumulatorWithGraph::allAttachedSimHitInfo(track_iter->second,hits,markUsed)); - result->insert(result->end(),daughter_result->begin(),daughter_result->end()); - } else if ( daughter.type() == simTrack.type() ) { - std::unique_ptr daughter_result = std::move(CaloTruthAccumulatorWithGraph::attachedSimHitInfo(track_iter->second,hits,includeOwn, includeOther, markUsed)); - result->insert(result->end(),daughter_result->begin(),daughter_result->end()); - } - } - } - } - return result; -} - - -std::unique_ptr -CaloTruthAccumulatorWithGraph::allAttachedSimHitInfo( Barcode_t barcode, - const std::vector >& hits, - bool markUsed ) { - DEBUG << "allAttachedSimHitInfo for track with barcode: " << barcode << std::endl; - return CaloTruthAccumulatorWithGraph::attachedSimHitInfo(barcode,hits,true,true,markUsed); } template void CaloTruthAccumulatorWithGraph::fillSimHits( diff --git a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.h b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.h index ee92dbbf5fcff..f6087403a2248 100644 --- a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.h +++ b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.h @@ -146,20 +146,9 @@ class CaloTruthAccumulatorWithGraph : public DigiAccumulatorMixMod { double caloStartZ; std::unordered_map m_detIdToTotalSimEnergy; // keep track of cell normalizations - std::unordered_map m_genParticleBarcodeToIndex; - std::unordered_map m_simTrackBarcodeToIndex; - std::unordered_map m_genBarcodeToSimTrackIndex; - std::unordered_map m_simVertexBarcodeToIndex; - std::unordered_multimap m_detIdToCluster; std::unordered_multimap m_simHitBarcodeToIndex; - std::unordered_multimap m_simVertexBarcodeToSimTrackBarcode; - std::unordered_map m_simTrackBarcodeToSimVertexParentBarcode; - std::unordered_multimap m_simTrackToSimVertex; - std::unordered_multimap m_simVertexToSimTrackParent; // std::unordered_multimap m_recoDetIdToSimHits; - std::vector m_simVertexBarcodes; - // const double volumeRadius_; // const double volumeZ_; /// maximum distance for HepMC::GenVertex to be added to SimVertex From 66b57e8bda635874d379500c9354111c336b05dc Mon Sep 17 00:00:00 2001 From: Marco Rovere Date: Tue, 5 Dec 2017 00:29:36 +0100 Subject: [PATCH 093/426] More code cleanup --- .../plugins/CaloTruthAccumulatorWithGraph.cc | 32 +++++++++---------- .../plugins/CaloTruthAccumulatorWithGraph.h | 30 ----------------- 2 files changed, 16 insertions(+), 46 deletions(-) diff --git a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc index feaf8bd5eaa6b..9453ce6d97653 100644 --- a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc +++ b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc @@ -36,8 +36,7 @@ #include #include // for std::accumulate -#define DEBUG std::cout << __FILE__ << ":" << __LINE__ << "\t" - +#define DEBUG false /* Graph utility functions */ using namespace boost; @@ -46,7 +45,7 @@ namespace { void print_edge(Edge &e, const Graph & g, Visitor * v) { auto const edge_property = get(edge_weight, g, e); v->total_simHits += edge_property.simHits; - std::cout << "Examining edges " << e + IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << " Examining edges " << e << " --> particle " << edge_property.simTrack->type() << "(" << edge_property.simTrack->trackId() << ")" << " with SimClusters: " << edge_property.simHits @@ -56,12 +55,12 @@ namespace { template < typename Vertex, typename Graph > void print_vertex(Vertex &u, const Graph & g) { auto const vertex_property = get(vertex_name, g, u); - std::cout << "At " << u; + IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << " At " << u; // The Mother of all vertices has **no** SimTrack associated. if (vertex_property.simTrack) - std::cout << "[" << vertex_property.simTrack->type() << "]" + IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << " [" << vertex_property.simTrack->type() << "]" << "(" << vertex_property.simTrack->trackId() << ")"; - std::cout << std::endl; + IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << std::endl; } class Custom_dfs_visitor : public boost::default_dfs_visitor { public: @@ -87,14 +86,14 @@ namespace { edge_property.simHits, cumulative, edge_property.energy)); - std::cout << "Finished edge: " << e + IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << " Finished edge: " << e << " Track id: " << get(edge_weight, g, e).simTrack->trackId() << " has cumulated " << cumulative << " hits" << std::endl; - std::cout << " SrcVtx: " << src << "\t" + IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << " SrcVtx: " << src << "\t" << get(vertex_name, g, src).simTrack << "\t" << get(vertex_name, g, src).cumulative_simHits << std::endl; - std::cout << " TrgVtx: " << trg << "\t" + IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << " TrgVtx: " << trg << "\t" << get(vertex_name, g, trg).simTrack << "\t" << get(vertex_name, g, trg).cumulative_simHits << std::endl; } @@ -115,7 +114,7 @@ namespace { if (!vertex_property.simTrack) return; auto trackIdx = vertex_property.simTrack->trackId(); - std::cout << "Found " << simHitBarcodeToIndex_.count(trackIdx) + IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << " Found " << simHitBarcodeToIndex_.count(trackIdx) << " associated simHits" << std::endl; if (simHitBarcodeToIndex_.count(trackIdx)) { output_.pSimClusters->emplace_back(*vertex_property.simTrack); @@ -302,7 +301,6 @@ void CaloTruthAccumulatorWithGraph::accumulateEvent( const T& event, // Clear maps from previous event fill them for this one m_simHitBarcodeToIndex.clear(); - m_simTracksConsideredForSimClusters.clear(); for (unsigned int i = 0 ; i < simHitPointers.size(); ++i) { m_simHitBarcodeToIndex.emplace(simHitPointers[i].second->geantTrackId(),i); } @@ -319,17 +317,19 @@ void CaloTruthAccumulatorWithGraph::accumulateEvent( const T& event, // a-posteriori, the ones not used, associating a ghost vertex (starting from // the highest simulated vertex number +1), in order to build the edge and // identify them immediately as stable (i.e. not decayed). - std::cout << "TRACKS" << std::endl; + IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << " TRACKS" << std::endl; for (auto const & t : tracks) { - std::cout << idx << "\t" << t.trackId() << "\t" << t << std::endl; + IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << " " + << idx << "\t" << t.trackId() << "\t" << t << std::endl; trackid_to_track_index[t.trackId()] = idx; idx++; } idx = 0; std::vector used_sim_tracks(tracks.size(), false); - std::cout << "VERTICES" << std::endl; + IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << " VERTICES" << std::endl; for (auto const & v: vertices) { - std::cout << idx++ << "\t" << v << std::endl; + IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << " " + << idx++ << "\t" << v << std::endl; if (v.parentIndex() != -1) { add_edge(tracks.at(trackid_to_track_index[v.parentIndex()]).vertIndex(), v.vertexId(), @@ -390,7 +390,7 @@ void CaloTruthAccumulatorWithGraph::accumulateEvent( const T& event, simTrackDetIdEnergyMap); depth_first_search(decay, visitor(caloParticleCreator).root_vertex(target(*edge, decay))); m_caloParticles.sc_stop_.push_back(output_.pSimClusters->size()); - std::cout << "Creating CaloParticle particle: " + IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << " Creating CaloParticle particle: " << edge_property.simTrack->type() << "(" << edge_property.simTrack->trackId() << ")" << " with total SimClusters: " << edge_property.cumulative_simHits diff --git a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.h b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.h index f6087403a2248..723f83daa02b6 100644 --- a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.h +++ b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.h @@ -24,12 +24,8 @@ typedef std::pair IndexPair_t; typedef std::pair SimHitInfo_t; typedef std::pair BarcodeIndexPair_t; typedef std::pair BarcodePair_t; -typedef std::pair SimHitInfoPerRecoDetId_t; -typedef std::vector SimHitInfoPerSimTrack_t; -// typedef uint32_t RecoDetId_t; - // Forward declarations namespace edm { class ParameterSet; @@ -113,18 +109,6 @@ class CaloTruthAccumulatorWithGraph : public DigiAccumulatorMixMod { const T& event, const edm::EventSetup& setup ); - std::unique_ptr attachedSimHitInfo( Barcode_t st, const std::vector > & hits, - bool includeOwn = true, bool includeOther = false, bool markUsed = false); - std::unique_ptr allAttachedSimHitInfo( Barcode_t st, const std::vector > & hits, bool markUsed = false); - - SimClusterCollection descendantSimClusters( Barcode_t barcode, const std::vector > & hits ); - std::set m_simTracksConsideredForSimClusters; - void setConsideredBarcode( Barcode_t barcode ) { m_simTracksConsideredForSimClusters.insert( barcode ); } - bool consideredBarcode( Barcode_t barcode ) { - // return (std::find(m_simTracksConsideredForSimClusters.begin(), m_simTracksConsideredForSimClusters.end(), barcode) != m_simTracksConsideredForSimClusters.end()); - return m_simTracksConsideredForSimClusters.count( barcode ); - } - const std::string messageCategory_; ///< The message category used to send messages to MessageLogger struct calo_particles { @@ -147,13 +131,6 @@ class CaloTruthAccumulatorWithGraph : public DigiAccumulatorMixMod { std::unordered_map m_detIdToTotalSimEnergy; // keep track of cell normalizations std::unordered_multimap m_simHitBarcodeToIndex; - // std::unordered_multimap m_recoDetIdToSimHits; - - // const double volumeRadius_; - // const double volumeZ_; - /// maximum distance for HepMC::GenVertex to be added to SimVertex - // const double vertexDistanceCut_; - // const bool ignoreTracksOutsideVolume_; /** The maximum bunch crossing BEFORE the signal crossing to create TrackinParticles for. Use positive values. If set to zero no * previous bunches are added and only in-time, signal and after bunches (defined by maximumSubsequentBunchCrossing_) are used.*/ @@ -161,13 +138,6 @@ class CaloTruthAccumulatorWithGraph : public DigiAccumulatorMixMod { /** The maximum bunch crossing AFTER the signal crossing to create TrackinParticles for. E.g. if set to zero only * uses the signal and in time pileup (and previous bunches defined by the maximumPreviousBunchCrossing_ parameter). */ const unsigned int maximumSubsequentBunchCrossing_; - /// If bremsstrahlung merging, whether to also add the unmerged collection to the event or not. - // const bool createUnmergedCollection_; - // const bool createMergedCollection_; - /// Whether or not to create a separate collection for just the initial interaction vertices - // const bool createInitialVertexCollection_; - /// Whether or not to add the full parentage of any TrackingParticle that is inserted in the collection. - // const bool addAncestors_; const edm::InputTag simTrackLabel_; const edm::InputTag simVertexLabel_; From fbdd6bf55052840aeb2c6e4b954edc91c2504667 Mon Sep 17 00:00:00 2001 From: Marco Rovere Date: Tue, 5 Dec 2017 14:13:21 +0100 Subject: [PATCH 094/426] Code reformatting with clang --- .../plugins/CaloTruthAccumulatorWithGraph.cc | 535 +++++++++--------- .../plugins/CaloTruthAccumulatorWithGraph.h | 132 +++-- 2 files changed, 351 insertions(+), 316 deletions(-) diff --git a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc index 9453ce6d97653..130a3eef58268 100644 --- a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc +++ b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc @@ -1,159 +1,157 @@ -#include "SimGeneral/MixingModule/interface/DigiAccumulatorMixModFactory.h" #include "SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.h" +#include "SimGeneral/MixingModule/interface/DigiAccumulatorMixModFactory.h" #include "DataFormats/ForwardDetId/interface/HGCalDetId.h" #include "DataFormats/HcalDetId/interface/HcalDetId.h" -#include "SimDataFormats/CaloTest/interface/HGCalTestNumbering.h" #include "DataFormats/HcalDetId/interface/HcalTestNumbering.h" +#include "SimDataFormats/CaloTest/interface/HGCalTestNumbering.h" #include "SimDataFormats/Vertex/interface/SimVertex.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "SimGeneral/MixingModule/interface/PileUpEventPrincipal.h" #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" +#include "SimGeneral/MixingModule/interface/PileUpEventPrincipal.h" #include "FWCore/Framework/interface/stream/EDProducer.h" -#include "SimGeneral/TrackingAnalysis/interface/EncodedTruthId.h" -#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" -#include "SimDataFormats/CaloHit/interface/PCaloHit.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "SimDataFormats/CaloHit/interface/PCaloHit.h" +#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" +#include "SimGeneral/TrackingAnalysis/interface/EncodedTruthId.h" +#include "DataFormats/HepMCCandidate/interface/GenParticle.h" #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" #include "DataFormats/SiStripDetId/interface/StripSubdetector.h" -#include "DataFormats/HepMCCandidate/interface/GenParticle.h" #include "FWCore/Framework/interface/ESHandle.h" #include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" #include "Geometry/HcalCommonData/interface/HcalHitRelabeller.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" #include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" #include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" #include -#include // for std::accumulate +#include // for std::accumulate #define DEBUG false + /* Graph utility functions */ using namespace boost; namespace { - template < typename Edge, typename Graph, typename Visitor> - void print_edge(Edge &e, const Graph & g, Visitor * v) { - auto const edge_property = get(edge_weight, g, e); - v->total_simHits += edge_property.simHits; - IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << " Examining edges " << e - << " --> particle " << edge_property.simTrack->type() - << "(" << edge_property.simTrack->trackId() << ")" - << " with SimClusters: " << edge_property.simHits - << " and total Energy: " << edge_property.energy - << " Accumulated SimClusters: " << v->total_simHits << std::endl; - } - template < typename Vertex, typename Graph > - void print_vertex(Vertex &u, const Graph & g) { - auto const vertex_property = get(vertex_name, g, u); - IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << " At " << u; - // The Mother of all vertices has **no** SimTrack associated. - if (vertex_property.simTrack) - IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << " [" << vertex_property.simTrack->type() << "]" - << "(" << vertex_property.simTrack->trackId() << ")"; - IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << std::endl; - } - class Custom_dfs_visitor : public boost::default_dfs_visitor { - public: - int total_simHits = 0; - template < typename Edge, typename Graph > - void examine_edge(Edge e, const Graph& g) { - print_edge(e, g, this); - } - template < typename Edge, typename Graph > - void finish_edge(Edge e, const Graph & g) { - auto const edge_property = get(edge_weight, g, e); - auto src = source(e, g); - auto trg = target(e, g); - auto cumulative = edge_property.simHits - + get(vertex_name, g, trg).cumulative_simHits - + (get(vertex_name, g, src).simTrack ? get(vertex_name, g, src).cumulative_simHits : 0); // when we hit the root vertex we have to stop adding back its contribution. - auto const src_vertex_property = get(vertex_name, g, src); - put(get(vertex_name, const_cast(g)), - src, - VertexProperty(src_vertex_property.simTrack, cumulative)); - put(get(edge_weight, const_cast(g)), e, - EdgeProperty(edge_property.simTrack, - edge_property.simHits, - cumulative, - edge_property.energy)); - IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << " Finished edge: " << e - << " Track id: " << get(edge_weight, g, e).simTrack->trackId() - << " has cumulated " << cumulative - << " hits" << std::endl; - IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << " SrcVtx: " << src << "\t" - << get(vertex_name, g, src).simTrack << "\t" - << get(vertex_name, g, src).cumulative_simHits << std::endl; - IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << " TrgVtx: " << trg << "\t" - << get(vertex_name, g, trg).simTrack << "\t" - << get(vertex_name, g, trg).cumulative_simHits << std::endl; - } - }; - class CaloParticle_dfs_visitor : public boost::default_dfs_visitor { - public: - int total_simHits = 0; - CaloParticle_dfs_visitor(CaloTruthAccumulatorWithGraph::OutputCollections & output, - std::unordered_multimap & simHitBarcodeToIndex, - std::map > & simTrackDetIdEnergyMap) - : output_(output), +template +void accumulateSimHits_edge(Edge& e, const Graph& g, Visitor* v) { + auto const edge_property = get(edge_weight, g, e); + v->total_simHits += edge_property.simHits; + IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") + << " Examining edges " << e << " --> particle " << edge_property.simTrack->type() << "(" + << edge_property.simTrack->trackId() << ")" + << " with SimClusters: " << edge_property.simHits + << " and total Energy: " << edge_property.energy + << " Accumulated SimClusters: " << v->total_simHits << std::endl; +} +template +void print_vertex(Vertex& u, const Graph& g) { + auto const vertex_property = get(vertex_name, g, u); + IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << " At " << u; + // The Mother of all vertices has **no** SimTrack associated. + if (vertex_property.simTrack) + IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") + << " [" << vertex_property.simTrack->type() << "]" + << "(" << vertex_property.simTrack->trackId() << ")"; + IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << std::endl; +} +class SimHitsAccumulator_dfs_visitor : public boost::default_dfs_visitor { + public: + int total_simHits = 0; + template + void examine_edge(Edge e, const Graph& g) { + accumulateSimHits_edge(e, g, this); + } + template + void finish_edge(Edge e, const Graph& g) { + auto const edge_property = get(edge_weight, g, e); + auto src = source(e, g); + auto trg = target(e, g); + auto cumulative = + edge_property.simHits + get(vertex_name, g, trg).cumulative_simHits + + (get(vertex_name, g, src).simTrack + ? get(vertex_name, g, src).cumulative_simHits + : 0); // when we hit the root vertex we have to stop adding back its contribution. + auto const src_vertex_property = get(vertex_name, g, src); + put(get(vertex_name, const_cast(g)), src, + VertexProperty(src_vertex_property.simTrack, cumulative)); + put(get(edge_weight, const_cast(g)), e, + EdgeProperty(edge_property.simTrack, edge_property.simHits, cumulative, + edge_property.energy)); + IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") + << " Finished edge: " << e << " Track id: " << get(edge_weight, g, e).simTrack->trackId() + << " has cumulated " << cumulative << " hits" << std::endl; + IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") + << " SrcVtx: " << src << "\t" << get(vertex_name, g, src).simTrack << "\t" + << get(vertex_name, g, src).cumulative_simHits << std::endl; + IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") + << " TrgVtx: " << trg << "\t" << get(vertex_name, g, trg).simTrack << "\t" + << get(vertex_name, g, trg).cumulative_simHits << std::endl; + } +}; +class CaloParticle_dfs_visitor : public boost::default_dfs_visitor { + public: + CaloParticle_dfs_visitor(CaloTruthAccumulatorWithGraph::OutputCollections& output, + std::unordered_multimap& simHitBarcodeToIndex, + std::map >& simTrackDetIdEnergyMap) + : output_(output), simHitBarcodeToIndex_(simHitBarcodeToIndex), - simTrackDetIdEnergyMap_(simTrackDetIdEnergyMap){} - template < typename Vertex, typename Graph > - void discover_vertex(Vertex u, const Graph & g) { - print_vertex(u, g); - auto const vertex_property = get(vertex_name, g, u); - if (!vertex_property.simTrack) - return; - auto trackIdx = vertex_property.simTrack->trackId(); - IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << " Found " << simHitBarcodeToIndex_.count(trackIdx) - << " associated simHits" << std::endl; - if (simHitBarcodeToIndex_.count(trackIdx)) { - output_.pSimClusters->emplace_back(*vertex_property.simTrack); - auto& simcluster = output_.pSimClusters->back(); - std::unordered_map acc_energy; - for( const auto& hit_and_energy : simTrackDetIdEnergyMap_[trackIdx]) { - const uint32_t id = hit_and_energy.first; - if( acc_energy.count(id) ) acc_energy[id] += hit_and_energy.second; - else acc_energy[id] = hit_and_energy.second; - } - - for( const auto& hit_and_energy : acc_energy ) { - simcluster.addRecHitAndFraction(hit_and_energy.first,hit_and_energy.second); - } - } - } - template < typename Edge, typename Graph > - void examine_edge(Edge e, const Graph& g) { - print_edge(e, g, this); - } - private: - CaloTruthAccumulatorWithGraph::OutputCollections & output_; - std::unordered_multimap & simHitBarcodeToIndex_; - std::map > & simTrackDetIdEnergyMap_; - }; + simTrackDetIdEnergyMap_(simTrackDetIdEnergyMap) {} + template + void discover_vertex(Vertex u, const Graph& g) { + print_vertex(u, g); + auto const vertex_property = get(vertex_name, g, u); + if (!vertex_property.simTrack) return; + auto trackIdx = vertex_property.simTrack->trackId(); + IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") + << " Found " << simHitBarcodeToIndex_.count(trackIdx) << " associated simHits" << std::endl; + if (simHitBarcodeToIndex_.count(trackIdx)) { + output_.pSimClusters->emplace_back(*vertex_property.simTrack); + auto& simcluster = output_.pSimClusters->back(); + std::unordered_map acc_energy; + for (const auto& hit_and_energy : simTrackDetIdEnergyMap_[trackIdx]) { + const uint32_t id = hit_and_energy.first; + if (acc_energy.count(id)) + acc_energy[id] += hit_and_energy.second; + else + acc_energy[id] = hit_and_energy.second; + } + for (const auto& hit_and_energy : acc_energy) { + simcluster.addRecHitAndFraction(hit_and_energy.first, hit_and_energy.second); + } + } + } + private: + CaloTruthAccumulatorWithGraph::OutputCollections& output_; + std::unordered_multimap& simHitBarcodeToIndex_; + std::map >& simTrackDetIdEnergyMap_; +}; } -CaloTruthAccumulatorWithGraph::CaloTruthAccumulatorWithGraph( const edm::ParameterSet & config, edm::stream::EDProducerBase& mixMod, edm::ConsumesCollector& iC) : - messageCategory_("CaloTruthAccumulatorWithGraph"), - maximumPreviousBunchCrossing_( config.getParameter("maximumPreviousBunchCrossing") ), - maximumSubsequentBunchCrossing_( config.getParameter("maximumSubsequentBunchCrossing") ), - simTrackLabel_( config.getParameter("simTrackCollection") ), - simVertexLabel_( config.getParameter("simVertexCollection") ), - collectionTags_( ), - genParticleLabel_( config.getParameter("genParticleCollection") ), - hepMCproductLabel_( config.getParameter("HepMCProductLabel") ), - minEnergy_( config.getParameter("MinEnergy") ), - maxPseudoRapidity_( config.getParameter("MaxPseudoRapidity") ) -{ +CaloTruthAccumulatorWithGraph::CaloTruthAccumulatorWithGraph(const edm::ParameterSet& config, + edm::stream::EDProducerBase& mixMod, + edm::ConsumesCollector& iC) + : messageCategory_("CaloTruthAccumulatorWithGraph"), + maximumPreviousBunchCrossing_( + config.getParameter("maximumPreviousBunchCrossing")), + maximumSubsequentBunchCrossing_( + config.getParameter("maximumSubsequentBunchCrossing")), + simTrackLabel_(config.getParameter("simTrackCollection")), + simVertexLabel_(config.getParameter("simVertexCollection")), + collectionTags_(), + genParticleLabel_(config.getParameter("genParticleCollection")), + hepMCproductLabel_(config.getParameter("HepMCProductLabel")), + minEnergy_(config.getParameter("MinEnergy")), + maxPseudoRapidity_(config.getParameter("MaxPseudoRapidity")) { barcodeLogicWarningAlready_ = false; mixMod.produces("MergedCaloTruth"); @@ -166,143 +164,159 @@ CaloTruthAccumulatorWithGraph::CaloTruthAccumulatorWithGraph( const edm::Paramet iC.consumes >(hepMCproductLabel_); // Fill the collection tags - const edm::ParameterSet& simHitCollectionConfig=config.getParameterSet("simHitCollections"); - std::vector parameterNames=simHitCollectionConfig.getParameterNames(); + const edm::ParameterSet& simHitCollectionConfig = config.getParameterSet("simHitCollections"); + std::vector parameterNames = simHitCollectionConfig.getParameterNames(); - for( const auto& parameterName : parameterNames ) - { - std::vector tags=simHitCollectionConfig.getParameter >(parameterName); - collectionTags_.insert(collectionTags_.end(), tags.begin(), tags.end()); - } + for (const auto& parameterName : parameterNames) { + std::vector tags = + simHitCollectionConfig.getParameter >(parameterName); + collectionTags_.insert(collectionTags_.end(), tags.begin(), tags.end()); + } - for( const auto& collectionTag : collectionTags_ ) { + for (const auto& collectionTag : collectionTags_) { iC.consumes >(collectionTag); } } -void CaloTruthAccumulatorWithGraph::beginLuminosityBlock( edm::LuminosityBlock const& iLumiBlock, const edm::EventSetup& iSetup ) { +void CaloTruthAccumulatorWithGraph::beginLuminosityBlock(edm::LuminosityBlock const& iLumiBlock, + const edm::EventSetup& iSetup) { edm::ESHandle geom; iSetup.get().get(geom); const HGCalGeometry *eegeom, *fhgeom; - const HcalGeometry *bhgeom; + const HcalGeometry* bhgeom; - eegeom = dynamic_cast(geom->getSubdetectorGeometry(DetId::Forward,HGCEE)); - fhgeom = dynamic_cast(geom->getSubdetectorGeometry(DetId::Forward,HGCHEF)); - bhgeom = dynamic_cast(geom->getSubdetectorGeometry(DetId::Hcal,HcalEndcap)); + eegeom = dynamic_cast(geom->getSubdetectorGeometry(DetId::Forward, HGCEE)); + fhgeom = dynamic_cast(geom->getSubdetectorGeometry(DetId::Forward, HGCHEF)); + bhgeom = dynamic_cast(geom->getSubdetectorGeometry(DetId::Hcal, HcalEndcap)); hgtopo_[0] = &(eegeom->topology()); hgtopo_[1] = &(fhgeom->topology()); - for( unsigned i = 0; i < 2; ++i ) { + for (unsigned i = 0; i < 2; ++i) { hgddd_[i] = &(hgtopo_[i]->dddConstants()); } - hcddd_ = bhgeom->topology().dddConstants(); + hcddd_ = bhgeom->topology().dddConstants(); - caloStartZ = hgddd_[0]->waferZ(1,false)*10.0; // get the location of the first plane of silicon, put in mm + caloStartZ = hgddd_[0]->waferZ(1, false) * + 10.0; // get the location of the first plane of silicon, put in mm } -void CaloTruthAccumulatorWithGraph::initializeEvent( edm::Event const& event, edm::EventSetup const& setup ) { - output_.pSimClusters.reset( new SimClusterCollection() ); - output_.pCaloParticles.reset( new CaloParticleCollection() ); +void CaloTruthAccumulatorWithGraph::initializeEvent(edm::Event const& event, + edm::EventSetup const& setup) { + output_.pSimClusters.reset(new SimClusterCollection()); + output_.pCaloParticles.reset(new CaloParticleCollection()); m_detIdToTotalSimEnergy.clear(); } -/// create handle to edm::HepMCProduct here because event.getByLabel with edm::HepMCProduct only works for edm::Event -/// but not for PileUpEventPrincipal; PileUpEventPrincipal::getByLabel tries to call T::value_type and T::iterator -/// (where T is the type of the object one wants to get a handle to) which is only implemented for container-like objects +/// create handle to edm::HepMCProduct here because event.getByLabel with edm::HepMCProduct only +/// works for edm::Event +/// but not for PileUpEventPrincipal; PileUpEventPrincipal::getByLabel tries to call T::value_type +/// and T::iterator +/// (where T is the type of the object one wants to get a handle to) which is only implemented for +/// container-like objects /// like std::vector but not for edm::HepMCProduct! -void CaloTruthAccumulatorWithGraph::accumulate( edm::Event const& event, edm::EventSetup const& setup ) { +void CaloTruthAccumulatorWithGraph::accumulate(edm::Event const& event, + edm::EventSetup const& setup) { // Call the templated version that does the same for both signal and pileup events - edm::Handle< edm::HepMCProduct > hepmc; + edm::Handle hepmc; event.getByLabel(hepMCproductLabel_, hepmc); edm::LogInfo(messageCategory_) << " CaloTruthAccumulatorWithGraph::accumulate (signal)"; - accumulateEvent( event, setup, hepmc ); + accumulateEvent(event, setup, hepmc); } -void CaloTruthAccumulatorWithGraph::accumulate( PileUpEventPrincipal const& event, edm::EventSetup const& setup, edm::StreamID const& ) { +void CaloTruthAccumulatorWithGraph::accumulate(PileUpEventPrincipal const& event, + edm::EventSetup const& setup, edm::StreamID const&) { // If this bunch crossing is outside the user configured limit, don't do anything. - if( event.bunchCrossing()>=-static_cast(maximumPreviousBunchCrossing_) && event.bunchCrossing()<=static_cast(maximumSubsequentBunchCrossing_) ) - { - //edm::LogInfo(messageCategory_) << "Analysing pileup event for bunch crossing " << event.bunchCrossing(); - - //simply create empty handle as we do not have a HepMCProduct in PU anyway - edm::Handle< edm::HepMCProduct > hepmc; - edm::LogInfo(messageCategory_) << " CaloTruthAccumulatorWithGraph::accumulate (pileup) bunchCrossing=" << event.bunchCrossing(); - accumulateEvent( event, setup, hepmc ); - } - else edm::LogInfo(messageCategory_) << "Skipping pileup event for bunch crossing " << event.bunchCrossing(); + if (event.bunchCrossing() >= -static_cast(maximumPreviousBunchCrossing_) && + event.bunchCrossing() <= static_cast(maximumSubsequentBunchCrossing_)) { + // edm::LogInfo(messageCategory_) << "Analysing pileup event for bunch crossing " << + // event.bunchCrossing(); + + // simply create empty handle as we do not have a HepMCProduct in PU anyway + edm::Handle hepmc; + edm::LogInfo(messageCategory_) + << " CaloTruthAccumulatorWithGraph::accumulate (pileup) bunchCrossing=" + << event.bunchCrossing(); + accumulateEvent(event, setup, hepmc); + } else + edm::LogInfo(messageCategory_) + << "Skipping pileup event for bunch crossing " << event.bunchCrossing(); } -void CaloTruthAccumulatorWithGraph::finalizeEvent( edm::Event& event, edm::EventSetup const& setup ) { - edm::LogInfo("CaloTruthAccumulatorWithGraph") << "Adding " << output_.pSimClusters->size() - << " SimParticles and " << output_.pCaloParticles->size() - << " CaloParticles to the event."; +void CaloTruthAccumulatorWithGraph::finalizeEvent(edm::Event& event, edm::EventSetup const& setup) { + edm::LogInfo("CaloTruthAccumulatorWithGraph") + << "Adding " << output_.pSimClusters->size() << " SimParticles and " + << output_.pCaloParticles->size() << " CaloParticles to the event."; // now we need to normalize the hits and energies into hits and fractions // (since we have looped over all pileup events) - for( auto& sc : *(output_.pSimClusters) ) { + for (auto& sc : *(output_.pSimClusters)) { auto hitsAndEnergies = sc.hits_and_fractions(); sc.clearHitsAndFractions(); - for( auto& hAndE : hitsAndEnergies ) { + for (auto& hAndE : hitsAndEnergies) { const float totalenergy = m_detIdToTotalSimEnergy[hAndE.first]; float fraction = 0.; - if(totalenergy>0) fraction = hAndE.second/totalenergy; - else edm::LogWarning("CaloTruthAccumulatorWithGraph") << "TotalSimEnergy for hit " << hAndE.first << " is 0! The fraction for this hit cannot be computed."; - sc.addRecHitAndFraction(hAndE.first,fraction); + if (totalenergy > 0) + fraction = hAndE.second / totalenergy; + else + edm::LogWarning("CaloTruthAccumulatorWithGraph") + << "TotalSimEnergy for hit " << hAndE.first + << " is 0! The fraction for this hit cannot be computed."; + sc.addRecHitAndFraction(hAndE.first, fraction); } } // save the SimCluster orphan handle so we can fill the calo particles - auto scHandle = event.put( std::move(output_.pSimClusters), "MergedCaloTruth" ); + auto scHandle = event.put(std::move(output_.pSimClusters), "MergedCaloTruth"); // now fill the calo particles - for( unsigned i = 0; i < output_.pCaloParticles->size(); ++i ) { + for (unsigned i = 0; i < output_.pCaloParticles->size(); ++i) { auto& cp = (*output_.pCaloParticles)[i]; - for( unsigned j = m_caloParticles.sc_start_[i]; j < m_caloParticles.sc_stop_[i]; ++j ) { - edm::Ref ref(scHandle,j); + for (unsigned j = m_caloParticles.sc_start_[i]; j < m_caloParticles.sc_stop_[i]; ++j) { + edm::Ref ref(scHandle, j); cp.addSimCluster(ref); } } - event.put( std::move(output_.pCaloParticles), "MergedCaloTruth" ); + event.put(std::move(output_.pCaloParticles), "MergedCaloTruth"); calo_particles().swap(m_caloParticles); - std::unordered_map().swap(m_detIdToTotalSimEnergy); - std::unordered_multimap().swap(m_simHitBarcodeToIndex); + std::unordered_map().swap(m_detIdToTotalSimEnergy); + std::unordered_multimap().swap(m_simHitBarcodeToIndex); } -template -void CaloTruthAccumulatorWithGraph::accumulateEvent( const T& event, - const edm::EventSetup& setup, - const edm::Handle< edm::HepMCProduct >& hepMCproduct) { +template +void CaloTruthAccumulatorWithGraph::accumulateEvent( + const T& event, const edm::EventSetup& setup, + const edm::Handle& hepMCproduct) { // // Get the collections // - edm::Handle< std::vector > hGenParticles; - edm::Handle< std::vector > hGenParticleIndices; + edm::Handle > hGenParticles; + edm::Handle > hGenParticleIndices; - event.getByLabel( simTrackLabel_, hSimTracks ); - event.getByLabel( simVertexLabel_, hSimVertices ); + event.getByLabel(simTrackLabel_, hSimTracks); + event.getByLabel(simVertexLabel_, hSimVertices); - event.getByLabel( genParticleLabel_, hGenParticles ); - event.getByLabel( genParticleLabel_, hGenParticleIndices ); + event.getByLabel(genParticleLabel_, hGenParticles); + event.getByLabel(genParticleLabel_, hGenParticleIndices); - std::vector > simHitPointers; + std::vector > simHitPointers; std::map > simTrackDetIdEnergyMap; - fillSimHits( simHitPointers, simTrackDetIdEnergyMap, event, setup ); + fillSimHits(simHitPointers, simTrackDetIdEnergyMap, event, setup); // Clear maps from previous event fill them for this one m_simHitBarcodeToIndex.clear(); - for (unsigned int i = 0 ; i < simHitPointers.size(); ++i) { - m_simHitBarcodeToIndex.emplace(simHitPointers[i].second->geantTrackId(),i); + for (unsigned int i = 0; i < simHitPointers.size(); ++i) { + m_simHitBarcodeToIndex.emplace(simHitPointers[i].second->geantTrackId(), i); } const auto& tracks = *hSimTracks; @@ -310,6 +324,15 @@ void CaloTruthAccumulatorWithGraph::accumulateEvent( const T& event, std::map trackid_to_track_index; DecayChain decay; int idx = 0; + + IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << " TRACKS" << std::endl; + for (auto const& t : tracks) { + IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") + << " " << idx << "\t" << t.trackId() << "\t" << t << std::endl; + trackid_to_track_index[t.trackId()] = idx; + idx++; + } + // Build the main decay graph and assign the SimTrack to each edge. The graph // built here will only contain the particles that have a decay vertex // associated to them. In order to recover also the particles that will not @@ -317,49 +340,43 @@ void CaloTruthAccumulatorWithGraph::accumulateEvent( const T& event, // a-posteriori, the ones not used, associating a ghost vertex (starting from // the highest simulated vertex number +1), in order to build the edge and // identify them immediately as stable (i.e. not decayed). - IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << " TRACKS" << std::endl; - for (auto const & t : tracks) { - IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << " " - << idx << "\t" << t.trackId() << "\t" << t << std::endl; - trackid_to_track_index[t.trackId()] = idx; - idx++; - } - idx = 0; + idx = 0; std::vector used_sim_tracks(tracks.size(), false); IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << " VERTICES" << std::endl; - for (auto const & v: vertices) { - IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << " " - << idx++ << "\t" << v << std::endl; + for (auto const& v : vertices) { + IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << " " << idx++ << "\t" << v << std::endl; if (v.parentIndex() != -1) { - add_edge(tracks.at(trackid_to_track_index[v.parentIndex()]).vertIndex(), - v.vertexId(), - EdgeProperty(&tracks.at(trackid_to_track_index[v.parentIndex()]), - simTrackDetIdEnergyMap[trackid_to_track_index[v.parentIndex()]].size(), - 0, - std::accumulate(simTrackDetIdEnergyMap[trackid_to_track_index[v.parentIndex()]].begin(), - simTrackDetIdEnergyMap[trackid_to_track_index[v.parentIndex()]].end(), 0., - [&](float partial, std::pair current) { - return partial + current.second/m_detIdToTotalSimEnergy[current.first]; })), - decay); + add_edge(tracks.at(trackid_to_track_index[v.parentIndex()]).vertIndex(), v.vertexId(), + EdgeProperty( + &tracks.at(trackid_to_track_index[v.parentIndex()]), + simTrackDetIdEnergyMap[trackid_to_track_index[v.parentIndex()]].size(), 0, + std::accumulate( + simTrackDetIdEnergyMap[trackid_to_track_index[v.parentIndex()]].begin(), + simTrackDetIdEnergyMap[trackid_to_track_index[v.parentIndex()]].end(), 0., + [&](float partial, std::pair current) { + return partial + current.second / m_detIdToTotalSimEnergy[current.first]; + })), + decay); used_sim_tracks[trackid_to_track_index[v.parentIndex()]] = true; } } // Assign the motherParticle property to each vertex - auto const & vertexMothersProp = get(vertex_name, decay); + auto const& vertexMothersProp = get(vertex_name, decay); // Now recover the particles that did not decay. Append them with an index // bigger than the size of the generated vertices. int offset = vertices.size() + 1; for (size_t i = 0; i < tracks.size(); ++i) { if (!used_sim_tracks[i]) { add_edge(tracks.at(i).vertIndex(), offset, - EdgeProperty(&tracks.at(i), - simTrackDetIdEnergyMap[tracks.at(i).trackId()].size(), - 0, - std::accumulate(simTrackDetIdEnergyMap[tracks.at(i).trackId()].begin(), - simTrackDetIdEnergyMap[tracks.at(i).trackId()].end(), 0., - [&](float partial, std::pair current) { - return partial + current.second/m_detIdToTotalSimEnergy[current.first]; - })), decay); + EdgeProperty( + &tracks.at(i), simTrackDetIdEnergyMap[tracks.at(i).trackId()].size(), 0, + std::accumulate(simTrackDetIdEnergyMap[tracks.at(i).trackId()].begin(), + simTrackDetIdEnergyMap[tracks.at(i).trackId()].end(), 0., + [&](float partial, std::pair current) { + return partial + + current.second / m_detIdToTotalSimEnergy[current.first]; + })), + decay); // The properties for "fake" vertices associated to stable particles have // to be set inside this loop, since they do not belong to the vertices // collection and would be skipped by that loop (coming next) @@ -367,82 +384,82 @@ void CaloTruthAccumulatorWithGraph::accumulateEvent( const T& event, offset++; } } - for (auto const & v: vertices) { + for (auto const& v : vertices) { if (v.parentIndex() != -1) { - put(vertexMothersProp, v.vertexId(), VertexProperty(&tracks.at(trackid_to_track_index[v.parentIndex()]), 0)); + put(vertexMothersProp, v.vertexId(), + VertexProperty(&tracks.at(trackid_to_track_index[v.parentIndex()]), 0)); } } - Custom_dfs_visitor vis; + SimHitsAccumulator_dfs_visitor vis; depth_first_search(decay, visitor(vis)); auto const first_generation = out_edges(0, decay); for (auto edge = first_generation.first; edge != first_generation.second; ++edge) { auto const edge_property = get(edge_weight, decay, *edge); // Apply selection on SimTracks in order to promote them to be CaloParticles. - if (edge_property.cumulative_simHits == 0 - or edge_property.simTrack->noGenpart() - or edge_property.simTrack->momentum().E() < minEnergy_ - or std::abs(edge_property.simTrack->momentum().Eta()) >= maxPseudoRapidity_) + if (edge_property.cumulative_simHits == 0 or edge_property.simTrack->noGenpart() or + edge_property.simTrack->momentum().E() < minEnergy_ or + std::abs(edge_property.simTrack->momentum().Eta()) >= maxPseudoRapidity_) continue; output_.pCaloParticles->emplace_back(*(edge_property.simTrack)); m_caloParticles.sc_start_.push_back(output_.pSimClusters->size()); - CaloParticle_dfs_visitor caloParticleCreator(output_, - m_simHitBarcodeToIndex, + CaloParticle_dfs_visitor caloParticleCreator(output_, m_simHitBarcodeToIndex, simTrackDetIdEnergyMap); depth_first_search(decay, visitor(caloParticleCreator).root_vertex(target(*edge, decay))); m_caloParticles.sc_stop_.push_back(output_.pSimClusters->size()); - IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << " Creating CaloParticle particle: " - << edge_property.simTrack->type() - << "(" << edge_property.simTrack->trackId() << ")" - << " with total SimClusters: " << edge_property.cumulative_simHits - << " and total Energy: " << edge_property.energy - << std::endl; + IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") + << " Creating CaloParticle particle: " << edge_property.simTrack->type() << "(" + << edge_property.simTrack->trackId() << ")" + << " with total SimClusters: " << edge_property.cumulative_simHits + << " and total Energy: " << edge_property.energy << std::endl; } } -template void CaloTruthAccumulatorWithGraph::fillSimHits( +template +void CaloTruthAccumulatorWithGraph::fillSimHits( std::vector >& returnValue, - std::map > & simTrackDetIdEnergyMap, - const T& event, - const edm::EventSetup& setup ) { + std::map >& simTrackDetIdEnergyMap, const T& event, + const edm::EventSetup& setup) { // loop over the collections - for( const auto& collectionTag : collectionTags_ ) { - edm::Handle< std::vector > hSimHits; - const bool isHcal = ( collectionTag.instance().find("HcalHits") != std::string::npos ); - event.getByLabel( collectionTag, hSimHits ); - for( const auto& simHit : *hSimHits ) { + for (const auto& collectionTag : collectionTags_) { + edm::Handle > hSimHits; + const bool isHcal = (collectionTag.instance().find("HcalHits") != std::string::npos); + event.getByLabel(collectionTag, hSimHits); + for (const auto& simHit : *hSimHits) { DetId id(0); const uint32_t simId = simHit.id(); - if( isHcal ) { + if (isHcal) { HcalDetId hid = HcalHitRelabeller::relabel(simId, hcddd_); - if(hid.subdet()==HcalEndcap) id = hid; + if (hid.subdet() == HcalEndcap) id = hid; } else { - int subdet, layer, cell, sec, subsec, zp; - HGCalTestNumbering::unpackHexagonIndex(simId, subdet, zp, layer, sec, subsec, cell); - const HGCalDDDConstants* ddd = hgddd_[subdet-3]; - std::pair recoLayerCell = ddd->simToReco(cell,layer,sec, - hgtopo_[subdet-3]->detectorType()); - cell = recoLayerCell.first; - layer = recoLayerCell.second; - // skip simhits with bad barcodes or non-existant layers - if( layer == -1 || simHit.geantTrackId() == 0 ) continue; - id = HGCalDetId((ForwardSubdetector)subdet,zp,layer,subsec,sec,cell); + int subdet, layer, cell, sec, subsec, zp; + HGCalTestNumbering::unpackHexagonIndex(simId, subdet, zp, layer, sec, subsec, cell); + const HGCalDDDConstants* ddd = hgddd_[subdet - 3]; + std::pair recoLayerCell = + ddd->simToReco(cell, layer, sec, hgtopo_[subdet - 3]->detectorType()); + cell = recoLayerCell.first; + layer = recoLayerCell.second; + // skip simhits with bad barcodes or non-existant layers + if (layer == -1 || simHit.geantTrackId() == 0) continue; + id = HGCalDetId((ForwardSubdetector)subdet, zp, layer, subsec, sec, cell); } - if( DetId(0) == id ) continue; + if (DetId(0) == id) continue; uint32_t detId = id.rawId(); returnValue.emplace_back(id, &simHit); - if (simTrackDetIdEnergyMap.count(simHit.geantTrackId()) - && simTrackDetIdEnergyMap[simHit.geantTrackId()].count(id.rawId())) + if (simTrackDetIdEnergyMap.count(simHit.geantTrackId()) && + simTrackDetIdEnergyMap[simHit.geantTrackId()].count(id.rawId())) simTrackDetIdEnergyMap[simHit.geantTrackId()][id.rawId()] += simHit.energy(); else simTrackDetIdEnergyMap[simHit.geantTrackId()][id.rawId()] = simHit.energy(); - if( m_detIdToTotalSimEnergy.count(detId) ) m_detIdToTotalSimEnergy[detId] += simHit.energy(); - else m_detIdToTotalSimEnergy[detId] = simHit.energy(); + if (m_detIdToTotalSimEnergy.count(detId)) + m_detIdToTotalSimEnergy[detId] += simHit.energy(); + else + m_detIdToTotalSimEnergy[detId] = simHit.energy(); } - } // end of loop over InputTags + } // end of loop over InputTags } // Register with the framework -DEFINE_DIGI_ACCUMULATOR (CaloTruthAccumulatorWithGraph); +DEFINE_DIGI_ACCUMULATOR(CaloTruthAccumulatorWithGraph); diff --git a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.h b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.h index 723f83daa02b6..8394cc998f648 100644 --- a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.h +++ b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.h @@ -4,38 +4,38 @@ #include "SimGeneral/MixingModule/interface/DigiAccumulatorMixMod.h" // BOOST GRAPH LIBRARY #include -#include #include +#include -#include // required for std::auto_ptr +#include // required for std::auto_ptr +#include #include "SimDataFormats/CaloAnalysis/interface/CaloParticleFwd.h" #include "SimDataFormats/CaloAnalysis/interface/SimClusterFwd.h" #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" -#include #include "DataFormats/ForwardDetId/interface/HGCalDetId.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Utilities/interface/InputTag.h" #include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" #include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" -#include "FWCore/Framework/interface/ESHandle.h" typedef unsigned Index_t; typedef int Barcode_t; -typedef std::pair IndexPair_t; -typedef std::pair SimHitInfo_t; -typedef std::pair BarcodeIndexPair_t; -typedef std::pair BarcodePair_t; - +typedef std::pair IndexPair_t; +typedef std::pair SimHitInfo_t; +typedef std::pair BarcodeIndexPair_t; +typedef std::pair BarcodePair_t; // Forward declarations namespace edm { - class ParameterSet; - class ConsumesCollector; - namespace stream { - class EDProducerBase; - } - class Event; - class EventSetup; - class StreamID; +class ParameterSet; +class ConsumesCollector; +namespace stream { +class EDProducerBase; +} +class Event; +class EventSetup; +class StreamID; } class PileUpEventPrincipal; class PCaloHit; @@ -54,7 +54,8 @@ using namespace boost; SimTrack that connects the 2 vertices of the edge, the number of simHits associated to that simTrack, the overall energy deposited in the associated simHits and the cumulative number of simHits of itself and of all - its children. Only simHits within the HGCAL detector are taken into account. + its children. Only simHits within the selected detectors are taken into + account. Each vertex has a property (vertex_name_t) that holds a const pointer to the SimTrack that originated that vertex and the cumulative number of simHits of @@ -65,11 +66,8 @@ using namespace boost; to ghost vertices with an offset starting from the highest generated vertex. */ struct EdgeProperty { - EdgeProperty(const SimTrack* t, - int h, - int c, - float e) - : simTrack(t), simHits(h), cumulative_simHits(c), energy(e) {} + EdgeProperty(const SimTrack* t, int h, int c, float e) + : simTrack(t), simHits(h), cumulative_simHits(c), energy(e) {} const SimTrack* simTrack; int simHits; int cumulative_simHits; @@ -79,37 +77,47 @@ struct EdgeProperty { struct VertexProperty { VertexProperty() : simTrack(nullptr), cumulative_simHits(0) {} VertexProperty(const SimTrack* t, int c) : simTrack(t), cumulative_simHits(c) {} - VertexProperty(const VertexProperty& other) : simTrack(other.simTrack), cumulative_simHits(other.cumulative_simHits) {} - const SimTrack * simTrack; + VertexProperty(const VertexProperty& other) + : simTrack(other.simTrack), cumulative_simHits(other.cumulative_simHits) {} + const SimTrack* simTrack; int cumulative_simHits; }; typedef property EdgeParticleClustersProperty; typedef property VertexMotherParticleProperty; -typedef adjacency_list< listS, vecS, directedS, - VertexMotherParticleProperty, EdgeParticleClustersProperty> DecayChain; +typedef adjacency_list + DecayChain; class CaloTruthAccumulatorWithGraph : public DigiAccumulatorMixMod { public: - explicit CaloTruthAccumulatorWithGraph( const edm::ParameterSet& config, edm::stream::EDProducerBase& mixMod, edm::ConsumesCollector& iC); + explicit CaloTruthAccumulatorWithGraph(const edm::ParameterSet& config, + edm::stream::EDProducerBase& mixMod, + edm::ConsumesCollector& iC); + private: - void initializeEvent( const edm::Event& event, const edm::EventSetup& setup ) override; - void accumulate( const edm::Event& event, const edm::EventSetup& setup ) override; - void accumulate( const PileUpEventPrincipal& event, const edm::EventSetup& setup, edm::StreamID const& ) override; - void finalizeEvent( edm::Event& event, const edm::EventSetup& setup ) override; - void beginLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const& setup) override; + void initializeEvent(const edm::Event& event, const edm::EventSetup& setup) override; + void accumulate(const edm::Event& event, const edm::EventSetup& setup) override; + void accumulate(const PileUpEventPrincipal& event, const edm::EventSetup& setup, + edm::StreamID const&) override; + void finalizeEvent(edm::Event& event, const edm::EventSetup& setup) override; + void beginLuminosityBlock(edm::LuminosityBlock const& lumi, + edm::EventSetup const& setup) override; /** @brief Both forms of accumulate() delegate to this templated method. */ - template void accumulateEvent( const T& event, const edm::EventSetup& setup, const edm::Handle< edm::HepMCProduct >& hepMCproduct ); + template + void accumulateEvent(const T& event, const edm::EventSetup& setup, + const edm::Handle& hepMCproduct); - /** @brief Fills the supplied vector with pointers to the SimHits, checking for bad modules if required */ - template void fillSimHits( - std::vector > & returnValue, - std::map > & simTrackDetIdEnergyMap, - const T& event, - const edm::EventSetup& setup ); + /** @brief Fills the supplied vector with pointers to the SimHits, checking for bad modules if + * required */ + template + void fillSimHits(std::vector >& returnValue, + std::map >& simTrackDetIdEnergyMap, const T& event, + const edm::EventSetup& setup); - const std::string messageCategory_; ///< The message category used to send messages to MessageLogger + const std::string + messageCategory_; ///< The message category used to send messages to MessageLogger struct calo_particles { std::vector sc_start_; @@ -129,14 +137,18 @@ class CaloTruthAccumulatorWithGraph : public DigiAccumulatorMixMod { calo_particles m_caloParticles; double caloStartZ; - std::unordered_map m_detIdToTotalSimEnergy; // keep track of cell normalizations - std::unordered_multimap m_simHitBarcodeToIndex; + std::unordered_map m_detIdToTotalSimEnergy; // keep track of cell normalizations + std::unordered_multimap m_simHitBarcodeToIndex; - /** The maximum bunch crossing BEFORE the signal crossing to create TrackinParticles for. Use positive values. If set to zero no - * previous bunches are added and only in-time, signal and after bunches (defined by maximumSubsequentBunchCrossing_) are used.*/ + /** The maximum bunch crossing BEFORE the signal crossing to create TrackinParticles for. Use + * positive values. If set to zero no + * previous bunches are added and only in-time, signal and after bunches (defined by + * maximumSubsequentBunchCrossing_) are used.*/ const unsigned int maximumPreviousBunchCrossing_; - /** The maximum bunch crossing AFTER the signal crossing to create TrackinParticles for. E.g. if set to zero only - * uses the signal and in time pileup (and previous bunches defined by the maximumPreviousBunchCrossing_ parameter). */ + /** The maximum bunch crossing AFTER the signal crossing to create TrackinParticles for. E.g. if + * set to zero only + * uses the signal and in time pileup (and previous bunches defined by the + * maximumPreviousBunchCrossing_ parameter). */ const unsigned int maximumSubsequentBunchCrossing_; const edm::InputTag simTrackLabel_; @@ -152,37 +164,43 @@ class CaloTruthAccumulatorWithGraph : public DigiAccumulatorMixMod { const double minEnergy_, maxPseudoRapidity_; bool selectorFlag_; - /// Uses the same config as selector_, but can be used to drop out early since selector_ requires the TrackingParticle to be created first. + /// Uses the same config as selector_, but can be used to drop out early since selector_ requires + /// the TrackingParticle to be created first. bool chargedOnly_; - /// Uses the same config as selector_, but can be used to drop out early since selector_ requires the TrackingParticle to be created first. + /// Uses the same config as selector_, but can be used to drop out early since selector_ requires + /// the TrackingParticle to be created first. bool signalOnly_; bool barcodeLogicWarningAlready_; - /** @brief When counting hits, allows hits in different detectors to have a different process type. + /** @brief When counting hits, allows hits in different detectors to have a different process + * type. * - * Fast sim PCaloHits seem to have a peculiarity where the process type (as reported by PCaloHit::processType()) is - * different for the tracker than the muons. When counting how many hits there are, the code usually only counts - * the number of hits that have the same process type as the first hit. Setting this to true will also count hits + * Fast sim PCaloHits seem to have a peculiarity where the process type (as reported by + * PCaloHit::processType()) is + * different for the tracker than the muons. When counting how many hits there are, the code + * usually only counts + * the number of hits that have the same process type as the first hit. Setting this to true will + * also count hits * that have the same process type as the first hit in the second detector.
*/ // bool allowDifferentProcessTypeForDifferentDetectors_; public: // These always go hand in hand, and I need to pass them around in the internal // functions, so I might as well package them up in a struct. - struct OutputCollections - { + struct OutputCollections { std::unique_ptr pSimClusters; std::unique_ptr pCaloParticles; // std::auto_ptr pTrackingVertices; // TrackingParticleRefProd refTrackingParticles; // TrackingVertexRefProd refTrackingVertexes; }; + private: - const HGCalTopology* hgtopo_[2]; + const HGCalTopology* hgtopo_[2]; const HGCalDDDConstants* hgddd_[2]; const HcalDDDRecConstants* hcddd_; OutputCollections output_; }; -#endif // end of "#ifndef CaloAnalysis_CaloTruthAccumulatorWithGraph_h" +#endif // end of "#ifndef CaloAnalysis_CaloTruthAccumulatorWithGraph_h" From b97765b3d21223f393fc87a73dbe72d9cf1c86be Mon Sep 17 00:00:00 2001 From: Marco Rovere Date: Tue, 5 Dec 2017 14:33:14 +0100 Subject: [PATCH 095/426] Remove energy from the edge properties --- .../plugins/CaloTruthAccumulatorWithGraph.cc | 22 ++++--------------- .../plugins/CaloTruthAccumulatorWithGraph.h | 12 +++++----- 2 files changed, 9 insertions(+), 25 deletions(-) diff --git a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc index 130a3eef58268..1aefcde3996b9 100644 --- a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc +++ b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc @@ -50,7 +50,6 @@ void accumulateSimHits_edge(Edge& e, const Graph& g, Visitor* v) { << " Examining edges " << e << " --> particle " << edge_property.simTrack->type() << "(" << edge_property.simTrack->trackId() << ")" << " with SimClusters: " << edge_property.simHits - << " and total Energy: " << edge_property.energy << " Accumulated SimClusters: " << v->total_simHits << std::endl; } template @@ -85,8 +84,7 @@ class SimHitsAccumulator_dfs_visitor : public boost::default_dfs_visitor { put(get(vertex_name, const_cast(g)), src, VertexProperty(src_vertex_property.simTrack, cumulative)); put(get(edge_weight, const_cast(g)), e, - EdgeProperty(edge_property.simTrack, edge_property.simHits, cumulative, - edge_property.energy)); + EdgeProperty(edge_property.simTrack, edge_property.simHits, cumulative)); IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << " Finished edge: " << e << " Track id: " << get(edge_weight, g, e).simTrack->trackId() << " has cumulated " << cumulative << " hits" << std::endl; @@ -349,13 +347,7 @@ void CaloTruthAccumulatorWithGraph::accumulateEvent( add_edge(tracks.at(trackid_to_track_index[v.parentIndex()]).vertIndex(), v.vertexId(), EdgeProperty( &tracks.at(trackid_to_track_index[v.parentIndex()]), - simTrackDetIdEnergyMap[trackid_to_track_index[v.parentIndex()]].size(), 0, - std::accumulate( - simTrackDetIdEnergyMap[trackid_to_track_index[v.parentIndex()]].begin(), - simTrackDetIdEnergyMap[trackid_to_track_index[v.parentIndex()]].end(), 0., - [&](float partial, std::pair current) { - return partial + current.second / m_detIdToTotalSimEnergy[current.first]; - })), + simTrackDetIdEnergyMap[trackid_to_track_index[v.parentIndex()]].size(), 0), decay); used_sim_tracks[trackid_to_track_index[v.parentIndex()]] = true; } @@ -369,13 +361,7 @@ void CaloTruthAccumulatorWithGraph::accumulateEvent( if (!used_sim_tracks[i]) { add_edge(tracks.at(i).vertIndex(), offset, EdgeProperty( - &tracks.at(i), simTrackDetIdEnergyMap[tracks.at(i).trackId()].size(), 0, - std::accumulate(simTrackDetIdEnergyMap[tracks.at(i).trackId()].begin(), - simTrackDetIdEnergyMap[tracks.at(i).trackId()].end(), 0., - [&](float partial, std::pair current) { - return partial + - current.second / m_detIdToTotalSimEnergy[current.first]; - })), + &tracks.at(i), simTrackDetIdEnergyMap[tracks.at(i).trackId()].size(), 0), decay); // The properties for "fake" vertices associated to stable particles have // to be set inside this loop, since they do not belong to the vertices @@ -410,7 +396,7 @@ void CaloTruthAccumulatorWithGraph::accumulateEvent( << " Creating CaloParticle particle: " << edge_property.simTrack->type() << "(" << edge_property.simTrack->trackId() << ")" << " with total SimClusters: " << edge_property.cumulative_simHits - << " and total Energy: " << edge_property.energy << std::endl; + << std::endl; } } diff --git a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.h b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.h index 8394cc998f648..d0d0f59c8fe99 100644 --- a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.h +++ b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.h @@ -52,10 +52,9 @@ using namespace boost; Each edge has a property (edge_weight_t) that holds a const pointer to the SimTrack that connects the 2 vertices of the edge, the number of simHits - associated to that simTrack, the overall energy deposited in the - associated simHits and the cumulative number of simHits of itself and of all - its children. Only simHits within the selected detectors are taken into - account. + associated to that simTrack and the cumulative number of simHits of itself + and of all its children. Only simHits within the selected detectors are + taken into account. Each vertex has a property (vertex_name_t) that holds a const pointer to the SimTrack that originated that vertex and the cumulative number of simHits of @@ -66,12 +65,11 @@ using namespace boost; to ghost vertices with an offset starting from the highest generated vertex. */ struct EdgeProperty { - EdgeProperty(const SimTrack* t, int h, int c, float e) - : simTrack(t), simHits(h), cumulative_simHits(c), energy(e) {} + EdgeProperty(const SimTrack* t, int h, int c) + : simTrack(t), simHits(h), cumulative_simHits(c) {} const SimTrack* simTrack; int simHits; int cumulative_simHits; - float energy; }; struct VertexProperty { From 73b88691dcd20fdc88f94f81770d84e53823ff2b Mon Sep 17 00:00:00 2001 From: Marco Rovere Date: Thu, 7 Dec 2017 16:38:38 +0100 Subject: [PATCH 096/426] Final version --- .../plugins/CaloTruthAccumulatorWithGraph.cc | 184 +++++++++++++----- .../plugins/CaloTruthAccumulatorWithGraph.h | 54 +++-- 2 files changed, 166 insertions(+), 72 deletions(-) diff --git a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc index 1aefcde3996b9..4925414632be9 100644 --- a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc +++ b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc @@ -63,6 +63,28 @@ void print_vertex(Vertex& u, const Graph& g) { << "(" << vertex_property.simTrack->trackId() << ")"; IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << std::endl; } + +// Graphviz output functions will only be generated in DEBUG mode +#if DEBUG +std::string graphviz_vertex(const VertexProperty & v) { + std::ostringstream oss; + oss << "{id: " << (v.simTrack ? v.simTrack->trackId() : 0) + << ", type: " << (v.simTrack ? v.simTrack->type() : 0) + << ", chits: " << v.cumulative_simHits + << "}"; + return oss.str(); +} + +std::string graphviz_edge(const EdgeProperty & e) { + std::ostringstream oss; + oss << "[" << (e.simTrack ? e.simTrack->trackId() : 0) + << "," << (e.simTrack ? e.simTrack->type() : 0) + << "," << e.simHits + << "]"; + return oss.str(); +} +#endif + class SimHitsAccumulator_dfs_visitor : public boost::default_dfs_visitor { public: int total_simHits = 0; @@ -96,16 +118,27 @@ class SimHitsAccumulator_dfs_visitor : public boost::default_dfs_visitor { << get(vertex_name, g, trg).cumulative_simHits << std::endl; } }; + +typedef std::function Selector; + class CaloParticle_dfs_visitor : public boost::default_dfs_visitor { public: CaloParticle_dfs_visitor(CaloTruthAccumulatorWithGraph::OutputCollections& output, + CaloTruthAccumulatorWithGraph::calo_particles & caloParticles, std::unordered_multimap& simHitBarcodeToIndex, - std::map >& simTrackDetIdEnergyMap) + std::unordered_map >& simTrackDetIdEnergyMap, + Selector selector) : output_(output), + caloParticles_(caloParticles), simHitBarcodeToIndex_(simHitBarcodeToIndex), - simTrackDetIdEnergyMap_(simTrackDetIdEnergyMap) {} + simTrackDetIdEnergyMap_(simTrackDetIdEnergyMap), + selector_(selector) {} template void discover_vertex(Vertex u, const Graph& g) { + // If we reach the vertex 0, it means that we are backtracking with respect + // to the first generation of stable particles: simply return; + if (u == 0) + return; print_vertex(u, g); auto const vertex_property = get(vertex_name, g, u); if (!vertex_property.simTrack) return; @@ -117,21 +150,41 @@ class CaloParticle_dfs_visitor : public boost::default_dfs_visitor { auto& simcluster = output_.pSimClusters->back(); std::unordered_map acc_energy; for (const auto& hit_and_energy : simTrackDetIdEnergyMap_[trackIdx]) { - const uint32_t id = hit_and_energy.first; - if (acc_energy.count(id)) - acc_energy[id] += hit_and_energy.second; - else - acc_energy[id] = hit_and_energy.second; + acc_energy[hit_and_energy.first] += hit_and_energy.second; } for (const auto& hit_and_energy : acc_energy) { simcluster.addRecHitAndFraction(hit_and_energy.first, hit_and_energy.second); } } } + template + void examine_edge(Edge e, const Graph &g) { + auto src = source(e, g); + if (src == 0) { + auto edge_property = get(edge_weight, g, e); + if (selector_(edge_property)) { + output_.pCaloParticles->emplace_back(*(edge_property.simTrack)); + caloParticles_.sc_start_.push_back(output_.pSimClusters->size()); + } + } + } + + template + void finish_edge(Edge e, const Graph & g) { + auto src = source(e, g); + if (src == 0) { + auto edge_property = get(edge_weight, g, e); + if (selector_(edge_property)) { + caloParticles_.sc_stop_.push_back(output_.pSimClusters->size()); + } + } + } private: CaloTruthAccumulatorWithGraph::OutputCollections& output_; + CaloTruthAccumulatorWithGraph::calo_particles & caloParticles_; std::unordered_multimap& simHitBarcodeToIndex_; - std::map >& simTrackDetIdEnergyMap_; + std::unordered_map >& simTrackDetIdEnergyMap_; + Selector selector_; }; } @@ -308,7 +361,7 @@ void CaloTruthAccumulatorWithGraph::accumulateEvent( event.getByLabel(genParticleLabel_, hGenParticleIndices); std::vector > simHitPointers; - std::map > simTrackDetIdEnergyMap; + std::unordered_map > simTrackDetIdEnergyMap; fillSimHits(simHitPointers, simTrackDetIdEnergyMap, event, setup); // Clear maps from previous event fill them for this one @@ -319,7 +372,7 @@ void CaloTruthAccumulatorWithGraph::accumulateEvent( const auto& tracks = *hSimTracks; const auto& vertices = *hSimVertices; - std::map trackid_to_track_index; + std::unordered_map trackid_to_track_index; DecayChain decay; int idx = 0; @@ -338,72 +391,108 @@ void CaloTruthAccumulatorWithGraph::accumulateEvent( // a-posteriori, the ones not used, associating a ghost vertex (starting from // the highest simulated vertex number +1), in order to build the edge and // identify them immediately as stable (i.e. not decayed). - idx = 0; - std::vector used_sim_tracks(tracks.size(), false); + // To take into account the multi-bremsstrahlung effects in which a single + // particle is emitting photons in different vertices **keeping the same + // track index**, we also collapsed those vertices into 1 unique vertex. The + // other approach of fully representing the decay chain keeping the same + // track index would have the problem of over-counting the contributions of + // that track, especially in terms of hits. + // The 2 vectors are structured as follow: + // 1. used_sim_tracks is a vector that has the same size as the overall + // number of simulated tracks. The associated integer is the vertexId of + // the **decaying vertex for that track**. + // 2. collapsed_vertices is a vector that has the same size as the overall + // number of simulated vertices. The vector's index is the vertexId + // itself, the associated value is the vertexId of the vertex on which + // this should collapse. + idx = 0; + std::vector used_sim_tracks(tracks.size(), 0); + std::vector collapsed_vertices(vertices.size(), 0); IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << " VERTICES" << std::endl; for (auto const& v : vertices) { IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << " " << idx++ << "\t" << v << std::endl; if (v.parentIndex() != -1) { - add_edge(tracks.at(trackid_to_track_index[v.parentIndex()]).vertIndex(), v.vertexId(), + auto trk_idx = trackid_to_track_index[v.parentIndex()]; + auto origin_vtx = tracks[trk_idx].vertIndex(); + if (used_sim_tracks[trk_idx]) { + // collapse the vertex into the original first vertex we saw associated + // to this track. Omit adding the edge in order to avoid double + // counting of the very same particles and its associated hits. + collapsed_vertices[v.vertexId()] = used_sim_tracks[trk_idx]; + continue; + } + // Perform the actual vertex collapsing, if needed. + if (collapsed_vertices[origin_vtx]) + origin_vtx = collapsed_vertices[origin_vtx]; + add_edge(origin_vtx, v.vertexId(), EdgeProperty( - &tracks.at(trackid_to_track_index[v.parentIndex()]), - simTrackDetIdEnergyMap[trackid_to_track_index[v.parentIndex()]].size(), 0), + &tracks[trk_idx], + simTrackDetIdEnergyMap[v.parentIndex()].size(), 0), decay); - used_sim_tracks[trackid_to_track_index[v.parentIndex()]] = true; + used_sim_tracks[trk_idx] = v.vertexId(); } } - // Assign the motherParticle property to each vertex + // Build the motherParticle property to each vertex auto const& vertexMothersProp = get(vertex_name, decay); // Now recover the particles that did not decay. Append them with an index // bigger than the size of the generated vertices. int offset = vertices.size() + 1; for (size_t i = 0; i < tracks.size(); ++i) { if (!used_sim_tracks[i]) { - add_edge(tracks.at(i).vertIndex(), offset, + auto origin_vtx = tracks[i].vertIndex(); + // Perform the actual vertex collapsing, if needed. + if (collapsed_vertices[origin_vtx]) + origin_vtx = collapsed_vertices[origin_vtx]; + add_edge(origin_vtx, offset, EdgeProperty( - &tracks.at(i), simTrackDetIdEnergyMap[tracks.at(i).trackId()].size(), 0), + &tracks[i], simTrackDetIdEnergyMap[tracks[i].trackId()].size(), 0), decay); // The properties for "fake" vertices associated to stable particles have // to be set inside this loop, since they do not belong to the vertices // collection and would be skipped by that loop (coming next) - put(vertexMothersProp, offset, VertexProperty(&tracks.at(i), 0)); + put(vertexMothersProp, offset, VertexProperty(&tracks[i], 0)); offset++; } } for (auto const& v : vertices) { if (v.parentIndex() != -1) { + // Skip collapsed_vertices + if (collapsed_vertices[v.vertexId()]) + continue; put(vertexMothersProp, v.vertexId(), - VertexProperty(&tracks.at(trackid_to_track_index[v.parentIndex()]), 0)); + VertexProperty(&tracks[trackid_to_track_index[v.parentIndex()]], 0)); } } SimHitsAccumulator_dfs_visitor vis; depth_first_search(decay, visitor(vis)); - auto const first_generation = out_edges(0, decay); - for (auto edge = first_generation.first; edge != first_generation.second; ++edge) { - auto const edge_property = get(edge_weight, decay, *edge); - // Apply selection on SimTracks in order to promote them to be CaloParticles. - if (edge_property.cumulative_simHits == 0 or edge_property.simTrack->noGenpart() or - edge_property.simTrack->momentum().E() < minEnergy_ or - std::abs(edge_property.simTrack->momentum().Eta()) >= maxPseudoRapidity_) - continue; - output_.pCaloParticles->emplace_back(*(edge_property.simTrack)); - m_caloParticles.sc_start_.push_back(output_.pSimClusters->size()); - CaloParticle_dfs_visitor caloParticleCreator(output_, m_simHitBarcodeToIndex, - simTrackDetIdEnergyMap); - depth_first_search(decay, visitor(caloParticleCreator).root_vertex(target(*edge, decay))); - m_caloParticles.sc_stop_.push_back(output_.pSimClusters->size()); - IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") - << " Creating CaloParticle particle: " << edge_property.simTrack->type() << "(" - << edge_property.simTrack->trackId() << ")" - << " with total SimClusters: " << edge_property.cumulative_simHits - << std::endl; - } + CaloParticle_dfs_visitor caloParticleCreator(output_, + m_caloParticles, + m_simHitBarcodeToIndex, + simTrackDetIdEnergyMap, + [&](EdgeProperty & edge_property) -> bool { + // Apply selection on SimTracks in order to promote them to be CaloParticles. + // The function returns TRUE if the particle satisfies the selection, FALSE otherwise. + // Therefore the correct logic to select the particle is to ask for TRUE as return value. + return (edge_property.cumulative_simHits != 0 + and ! edge_property.simTrack->noGenpart() + and edge_property.simTrack->momentum().E() > minEnergy_ + and std::abs(edge_property.simTrack->momentum().Eta()) < maxPseudoRapidity_); + }); + depth_first_search(decay, visitor(caloParticleCreator)); + +#if DEBUG + boost::write_graphviz(std::cout, decay, + make_label_writer( + make_transform_value_property_map(&graphviz_vertex, get(vertex_name, decay))), + make_label_writer( + make_transform_value_property_map(&graphviz_edge, get(edge_weight, decay)))); +#endif } template void CaloTruthAccumulatorWithGraph::fillSimHits( std::vector >& returnValue, - std::map >& simTrackDetIdEnergyMap, const T& event, + std::unordered_map >& simTrackDetIdEnergyMap, const T& event, const edm::EventSetup& setup) { // loop over the collections for (const auto& collectionTag : collectionTags_) { @@ -433,16 +522,9 @@ void CaloTruthAccumulatorWithGraph::fillSimHits( uint32_t detId = id.rawId(); returnValue.emplace_back(id, &simHit); - if (simTrackDetIdEnergyMap.count(simHit.geantTrackId()) && - simTrackDetIdEnergyMap[simHit.geantTrackId()].count(id.rawId())) - simTrackDetIdEnergyMap[simHit.geantTrackId()][id.rawId()] += simHit.energy(); - else - simTrackDetIdEnergyMap[simHit.geantTrackId()][id.rawId()] = simHit.energy(); + simTrackDetIdEnergyMap[simHit.geantTrackId()][id.rawId()] += simHit.energy(); - if (m_detIdToTotalSimEnergy.count(detId)) - m_detIdToTotalSimEnergy[detId] += simHit.energy(); - else - m_detIdToTotalSimEnergy[detId] = simHit.energy(); + m_detIdToTotalSimEnergy[detId] += simHit.energy(); } } // end of loop over InputTags } diff --git a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.h b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.h index d0d0f59c8fe99..c0c063467dc2c 100644 --- a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.h +++ b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.h @@ -3,9 +3,14 @@ #include "SimGeneral/MixingModule/interface/DigiAccumulatorMixMod.h" // BOOST GRAPH LIBRARY +// boost optional (used by boost graph) results in some false positives with -Wmaybe-uninitialized +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #include #include #include +#include +#pragma GCC diagnostic pop #include // required for std::auto_ptr #include @@ -42,7 +47,16 @@ class PCaloHit; class SimTrack; class SimVertex; -using namespace boost; +using boost::property; +using boost::edge; +using boost::edge_weight_t; +using boost::vertex; +using boost::vertex_name_t; +using boost::adjacency_list; +using boost::directedS; +using boost::listS; +using boost::vecS; +using boost::add_edge; /* GRAPH DEFINITIONS @@ -111,28 +125,12 @@ class CaloTruthAccumulatorWithGraph : public DigiAccumulatorMixMod { * required */ template void fillSimHits(std::vector >& returnValue, - std::map >& simTrackDetIdEnergyMap, const T& event, + std::unordered_map >& simTrackDetIdEnergyMap, const T& event, const edm::EventSetup& setup); const std::string messageCategory_; ///< The message category used to send messages to MessageLogger - struct calo_particles { - std::vector sc_start_; - std::vector sc_stop_; - - void swap(calo_particles& oth) { - sc_start_.swap(oth.sc_start_); - sc_stop_.swap(oth.sc_stop_); - } - - void clear() { - sc_start_.clear(); - sc_stop_.clear(); - } - }; - - calo_particles m_caloParticles; double caloStartZ; std::unordered_map m_detIdToTotalSimEnergy; // keep track of cell normalizations @@ -189,16 +187,30 @@ class CaloTruthAccumulatorWithGraph : public DigiAccumulatorMixMod { struct OutputCollections { std::unique_ptr pSimClusters; std::unique_ptr pCaloParticles; - // std::auto_ptr pTrackingVertices; - // TrackingParticleRefProd refTrackingParticles; - // TrackingVertexRefProd refTrackingVertexes; }; + struct calo_particles { + std::vector sc_start_; + std::vector sc_stop_; + + void swap(calo_particles& oth) { + sc_start_.swap(oth.sc_start_); + sc_stop_.swap(oth.sc_stop_); + } + + void clear() { + sc_start_.clear(); + sc_stop_.clear(); + } + }; + + private: const HGCalTopology* hgtopo_[2]; const HGCalDDDConstants* hgddd_[2]; const HcalDDDRecConstants* hcddd_; OutputCollections output_; + calo_particles m_caloParticles; }; #endif // end of "#ifndef CaloAnalysis_CaloTruthAccumulatorWithGraph_h" From f8db9577facf9cd18b15670571b05f9c83ef8199 Mon Sep 17 00:00:00 2001 From: Marco Rovere Date: Mon, 11 Dec 2017 17:56:25 +0100 Subject: [PATCH 097/426] Remove gap in vertex numbering in the final graph --- .../CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc index 4925414632be9..0442c89790f5a 100644 --- a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc +++ b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc @@ -436,7 +436,7 @@ void CaloTruthAccumulatorWithGraph::accumulateEvent( auto const& vertexMothersProp = get(vertex_name, decay); // Now recover the particles that did not decay. Append them with an index // bigger than the size of the generated vertices. - int offset = vertices.size() + 1; + int offset = vertices.size(); for (size_t i = 0; i < tracks.size(); ++i) { if (!used_sim_tracks[i]) { auto origin_vtx = tracks[i].vertIndex(); From d2950d3e09c4349ee6003bb52ad65941833ba96b Mon Sep 17 00:00:00 2001 From: Marco Rovere Date: Wed, 13 Dec 2017 10:11:26 +0100 Subject: [PATCH 098/426] Merge header into cc file --- .../plugins/CaloTruthAccumulatorWithGraph.cc | 426 ++++++++++++------ .../plugins/CaloTruthAccumulatorWithGraph.h | 216 --------- 2 files changed, 283 insertions(+), 359 deletions(-) delete mode 100644 SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.h diff --git a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc index 0442c89790f5a..a48cac5cdcb88 100644 --- a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc +++ b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc @@ -1,52 +1,217 @@ -#include "SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.h" -#include "SimGeneral/MixingModule/interface/DigiAccumulatorMixModFactory.h" +// BOOST GRAPH LIBRARY +#include +#include +#include +#define DEBUG false -#include "DataFormats/ForwardDetId/interface/HGCalDetId.h" -#include "DataFormats/HcalDetId/interface/HcalDetId.h" -#include "DataFormats/HcalDetId/interface/HcalTestNumbering.h" -#include "SimDataFormats/CaloTest/interface/HGCalTestNumbering.h" -#include "SimDataFormats/Vertex/interface/SimVertex.h" +#if DEBUG +// boost optional (used by boost graph) results in some false positives with -Wmaybe-uninitialized +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#include +#pragma GCC diagnostic pop +#endif + +#include +#include // required for std::auto_ptr +#include // for std::accumulate +#include #include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" -#include "SimGeneral/MixingModule/interface/PileUpEventPrincipal.h" - #include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "SimDataFormats/CaloHit/interface/PCaloHit.h" -#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" -#include "SimGeneral/TrackingAnalysis/interface/EncodedTruthId.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include "DataFormats/ForwardDetId/interface/HGCalDetId.h" +#include "DataFormats/HcalDetId/interface/HcalDetId.h" +#include "DataFormats/HcalDetId/interface/HcalTestNumbering.h" #include "DataFormats/HepMCCandidate/interface/GenParticle.h" #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" #include "DataFormats/SiStripDetId/interface/StripSubdetector.h" -#include "FWCore/Framework/interface/ESHandle.h" + +#include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" +#include "SimDataFormats/CaloAnalysis/interface/CaloParticleFwd.h" +#include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" +#include "SimDataFormats/CaloAnalysis/interface/SimClusterFwd.h" +#include "SimDataFormats/CaloHit/interface/PCaloHit.h" +#include "SimDataFormats/CaloTest/interface/HGCalTestNumbering.h" +#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" +#include "SimDataFormats/Vertex/interface/SimVertex.h" + +#include "SimGeneral/MixingModule/interface/DigiAccumulatorMixMod.h" +#include "SimGeneral/MixingModule/interface/DigiAccumulatorMixModFactory.h" +#include "SimGeneral/MixingModule/interface/PileUpEventPrincipal.h" +#include "SimGeneral/TrackingAnalysis/interface/EncodedTruthId.h" #include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" #include "Geometry/HcalCommonData/interface/HcalHitRelabeller.h" +#include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" #include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" -#include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" +namespace { +using Index_t = unsigned; +using Barcode_t = int; +} -#include -#include // for std::accumulate +using boost::adjacency_list; +using boost::directedS; +using boost::listS; +using boost::vecS; +using boost::property; +using boost::edge; +using boost::edge_weight_t; +using boost::edge_weight; +using boost::add_edge; +using boost::vertex; +using boost::vertex_name_t; +using boost::vertex_name; + +/* GRAPH DEFINITIONS + + The graph represents the full decay chain. + + The parent-child relationship is the natural one, following "time". + + Each edge has a property (edge_weight_t) that holds a const pointer to the + SimTrack that connects the 2 vertices of the edge, the number of simHits + associated to that simTrack and the cumulative number of simHits of itself + and of all its children. Only simHits within the selected detectors are + taken into account. The cumulative property is filled during the dfs + exploration of the graph: if not explored the number is 0. + + Each vertex has a property (vertex_name_t) that holds a const pointer to the + SimTrack that originated that vertex and the cumulative number of simHits of + all its outgoing edges. The cumulative property is filled during the dfs + exploration of the graph: if not explored the number is 0. + + Stable particles are recovered/added in a second iterations and are linked + to ghost vertices with an offset starting from the highest generated vertex. + + Multiple decays of a single particle that retains its original trackId are + merged into one unique vertex (the first encountered) in order to avoid + multiple counting of its associated simHits (if any). + +*/ +struct EdgeProperty { + EdgeProperty(const SimTrack* t, int h, int c) : simTrack(t), simHits(h), cumulative_simHits(c) {} + const SimTrack* simTrack; + int simHits; + int cumulative_simHits; +}; -#define DEBUG false +struct VertexProperty { + VertexProperty() : simTrack(nullptr), cumulative_simHits(0) {} + VertexProperty(const SimTrack* t, int c) : simTrack(t), cumulative_simHits(c) {} + VertexProperty(const VertexProperty& other) + : simTrack(other.simTrack), cumulative_simHits(other.cumulative_simHits) {} + const SimTrack* simTrack; + int cumulative_simHits; +}; + +using EdgeParticleClustersProperty = property; +using VertexMotherParticleProperty = property; +using DecayChain = adjacency_list; + +class CaloTruthAccumulatorWithGraph : public DigiAccumulatorMixMod { + public: + explicit CaloTruthAccumulatorWithGraph(const edm::ParameterSet& config, + edm::stream::EDProducerBase& mixMod, + edm::ConsumesCollector& iC); + + private: + void initializeEvent(const edm::Event& event, const edm::EventSetup& setup) override; + void accumulate(const edm::Event& event, const edm::EventSetup& setup) override; + void accumulate(const PileUpEventPrincipal& event, const edm::EventSetup& setup, + edm::StreamID const&) override; + void finalizeEvent(edm::Event& event, const edm::EventSetup& setup) override; + void beginLuminosityBlock(edm::LuminosityBlock const& lumi, + edm::EventSetup const& setup) override; + + /** @brief Both forms of accumulate() delegate to this templated method. */ + template + void accumulateEvent(const T& event, const edm::EventSetup& setup, + const edm::Handle& hepMCproduct); + + /** @brief Fills the supplied vector with pointers to the SimHits, checking for bad modules if + * required */ + template + void fillSimHits(std::vector >& returnValue, + std::unordered_map >& simTrackDetIdEnergyMap, + const T& event, const edm::EventSetup& setup); + + const std::string messageCategory_; + + std::unordered_map m_detIdToTotalSimEnergy; // keep track of cell normalizations + std::unordered_multimap m_simHitBarcodeToIndex; + + /** The maximum bunch crossing BEFORE the signal crossing to create + TrackinParticles for. Use positive values. If set to zero no + previous bunches are added and only in-time, signal and after bunches + (defined by maximumSubsequentBunchCrossing_) are used. + */ + const unsigned int maximumPreviousBunchCrossing_; + /** The maximum bunch crossing AFTER the signal crossing to create + TrackinParticles for. E.g. if set to zero only + uses the signal and in time pileup (and previous bunches defined by the + maximumPreviousBunchCrossing_ parameter). + */ + const unsigned int maximumSubsequentBunchCrossing_; + + const edm::InputTag simTrackLabel_; + const edm::InputTag simVertexLabel_; + edm::Handle > hSimTracks; + edm::Handle > hSimVertices; + + std::vector collectionTags_; + edm::InputTag genParticleLabel_; + /// Needed to add HepMC::GenVertex to SimVertex + edm::InputTag hepMCproductLabel_; + + const double minEnergy_, maxPseudoRapidity_; + + public: + struct OutputCollections { + std::unique_ptr pSimClusters; + std::unique_ptr pCaloParticles; + }; + + struct calo_particles { + std::vector sc_start_; + std::vector sc_stop_; + + void swap(calo_particles& oth) { + sc_start_.swap(oth.sc_start_); + sc_stop_.swap(oth.sc_stop_); + } + + void clear() { + sc_start_.clear(); + sc_stop_.clear(); + } + }; + + private: + const HGCalTopology* hgtopo_[2]; + const HGCalDDDConstants* hgddd_[2]; + const HcalDDDRecConstants* hcddd_; + OutputCollections output_; + calo_particles m_caloParticles; +}; /* Graph utility functions */ -using namespace boost; namespace { template void accumulateSimHits_edge(Edge& e, const Graph& g, Visitor* v) { auto const edge_property = get(edge_weight, g, e); v->total_simHits += edge_property.simHits; - IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") + IfLogDebug(DEBUG, messageCategory_) << " Examining edges " << e << " --> particle " << edge_property.simTrack->type() << "(" << edge_property.simTrack->trackId() << ")" << " with SimClusters: " << edge_property.simHits @@ -55,32 +220,28 @@ void accumulateSimHits_edge(Edge& e, const Graph& g, Visitor* v) { template void print_vertex(Vertex& u, const Graph& g) { auto const vertex_property = get(vertex_name, g, u); - IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << " At " << u; + IfLogDebug(DEBUG, messageCategory_) << " At " << u; // The Mother of all vertices has **no** SimTrack associated. if (vertex_property.simTrack) - IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") - << " [" << vertex_property.simTrack->type() << "]" - << "(" << vertex_property.simTrack->trackId() << ")"; - IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << std::endl; + IfLogDebug(DEBUG, messageCategory_) << " [" << vertex_property.simTrack->type() << "]" + << "(" << vertex_property.simTrack->trackId() << ")"; + IfLogDebug(DEBUG, messageCategory_) << std::endl; } // Graphviz output functions will only be generated in DEBUG mode #if DEBUG -std::string graphviz_vertex(const VertexProperty & v) { +std::string graphviz_vertex(const VertexProperty& v) { std::ostringstream oss; oss << "{id: " << (v.simTrack ? v.simTrack->trackId() : 0) - << ", type: " << (v.simTrack ? v.simTrack->type() : 0) - << ", chits: " << v.cumulative_simHits - << "}"; + << ", type: " << (v.simTrack ? v.simTrack->type() : 0) << ", chits: " << v.cumulative_simHits + << "}"; return oss.str(); } -std::string graphviz_edge(const EdgeProperty & e) { +std::string graphviz_edge(const EdgeProperty& e) { std::ostringstream oss; - oss << "[" << (e.simTrack ? e.simTrack->trackId() : 0) - << "," << (e.simTrack ? e.simTrack->type() : 0) - << "," << e.simHits - << "]"; + oss << "[" << (e.simTrack ? e.simTrack->trackId() : 0) << "," + << (e.simTrack ? e.simTrack->type() : 0) << "," << e.simHits << "]"; return oss.str(); } #endif @@ -107,13 +268,13 @@ class SimHitsAccumulator_dfs_visitor : public boost::default_dfs_visitor { VertexProperty(src_vertex_property.simTrack, cumulative)); put(get(edge_weight, const_cast(g)), e, EdgeProperty(edge_property.simTrack, edge_property.simHits, cumulative)); - IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") + IfLogDebug(DEBUG, messageCategory_) << " Finished edge: " << e << " Track id: " << get(edge_weight, g, e).simTrack->trackId() << " has cumulated " << cumulative << " hits" << std::endl; - IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") + IfLogDebug(DEBUG, messageCategory_) << " SrcVtx: " << src << "\t" << get(vertex_name, g, src).simTrack << "\t" << get(vertex_name, g, src).cumulative_simHits << std::endl; - IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") + IfLogDebug(DEBUG, messageCategory_) << " TrgVtx: " << trg << "\t" << get(vertex_name, g, trg).simTrack << "\t" << get(vertex_name, g, trg).cumulative_simHits << std::endl; } @@ -124,7 +285,7 @@ typedef std::function Selector; class CaloParticle_dfs_visitor : public boost::default_dfs_visitor { public: CaloParticle_dfs_visitor(CaloTruthAccumulatorWithGraph::OutputCollections& output, - CaloTruthAccumulatorWithGraph::calo_particles & caloParticles, + CaloTruthAccumulatorWithGraph::calo_particles& caloParticles, std::unordered_multimap& simHitBarcodeToIndex, std::unordered_map >& simTrackDetIdEnergyMap, Selector selector) @@ -137,28 +298,27 @@ class CaloParticle_dfs_visitor : public boost::default_dfs_visitor { void discover_vertex(Vertex u, const Graph& g) { // If we reach the vertex 0, it means that we are backtracking with respect // to the first generation of stable particles: simply return; - if (u == 0) - return; + if (u == 0) return; print_vertex(u, g); auto const vertex_property = get(vertex_name, g, u); if (!vertex_property.simTrack) return; auto trackIdx = vertex_property.simTrack->trackId(); - IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") + IfLogDebug(DEBUG, messageCategory_) << " Found " << simHitBarcodeToIndex_.count(trackIdx) << " associated simHits" << std::endl; if (simHitBarcodeToIndex_.count(trackIdx)) { output_.pSimClusters->emplace_back(*vertex_property.simTrack); auto& simcluster = output_.pSimClusters->back(); std::unordered_map acc_energy; - for (const auto& hit_and_energy : simTrackDetIdEnergyMap_[trackIdx]) { + for (auto const& hit_and_energy : simTrackDetIdEnergyMap_[trackIdx]) { acc_energy[hit_and_energy.first] += hit_and_energy.second; } - for (const auto& hit_and_energy : acc_energy) { + for (auto const& hit_and_energy : acc_energy) { simcluster.addRecHitAndFraction(hit_and_energy.first, hit_and_energy.second); } } } template - void examine_edge(Edge e, const Graph &g) { + void examine_edge(Edge e, const Graph& g) { auto src = source(e, g); if (src == 0) { auto edge_property = get(edge_weight, g, e); @@ -170,7 +330,7 @@ class CaloParticle_dfs_visitor : public boost::default_dfs_visitor { } template - void finish_edge(Edge e, const Graph & g) { + void finish_edge(Edge e, const Graph& g) { auto src = source(e, g); if (src == 0) { auto edge_property = get(edge_weight, g, e); @@ -179,9 +339,10 @@ class CaloParticle_dfs_visitor : public boost::default_dfs_visitor { } } } + private: CaloTruthAccumulatorWithGraph::OutputCollections& output_; - CaloTruthAccumulatorWithGraph::calo_particles & caloParticles_; + CaloTruthAccumulatorWithGraph::calo_particles& caloParticles_; std::unordered_multimap& simHitBarcodeToIndex_; std::unordered_map >& simTrackDetIdEnergyMap_; Selector selector_; @@ -203,8 +364,6 @@ CaloTruthAccumulatorWithGraph::CaloTruthAccumulatorWithGraph(const edm::Paramete hepMCproductLabel_(config.getParameter("HepMCProductLabel")), minEnergy_(config.getParameter("MinEnergy")), maxPseudoRapidity_(config.getParameter("MaxPseudoRapidity")) { - barcodeLogicWarningAlready_ = false; - mixMod.produces("MergedCaloTruth"); mixMod.produces("MergedCaloTruth"); @@ -218,13 +377,13 @@ CaloTruthAccumulatorWithGraph::CaloTruthAccumulatorWithGraph(const edm::Paramete const edm::ParameterSet& simHitCollectionConfig = config.getParameterSet("simHitCollections"); std::vector parameterNames = simHitCollectionConfig.getParameterNames(); - for (const auto& parameterName : parameterNames) { + for (auto const& parameterName : parameterNames) { std::vector tags = simHitCollectionConfig.getParameter >(parameterName); collectionTags_.insert(collectionTags_.end(), tags.begin(), tags.end()); } - for (const auto& collectionTag : collectionTags_) { + for (auto const& collectionTag : collectionTags_) { iC.consumes >(collectionTag); } } @@ -236,9 +395,9 @@ void CaloTruthAccumulatorWithGraph::beginLuminosityBlock(edm::LuminosityBlock co const HGCalGeometry *eegeom, *fhgeom; const HcalGeometry* bhgeom; - eegeom = dynamic_cast(geom->getSubdetectorGeometry(DetId::Forward, HGCEE)); - fhgeom = dynamic_cast(geom->getSubdetectorGeometry(DetId::Forward, HGCHEF)); - bhgeom = dynamic_cast(geom->getSubdetectorGeometry(DetId::Hcal, HcalEndcap)); + eegeom = static_cast(geom->getSubdetectorGeometry(DetId::Forward, HGCEE)); + fhgeom = static_cast(geom->getSubdetectorGeometry(DetId::Forward, HGCHEF)); + bhgeom = static_cast(geom->getSubdetectorGeometry(DetId::Hcal, HcalEndcap)); hgtopo_[0] = &(eegeom->topology()); hgtopo_[1] = &(fhgeom->topology()); @@ -248,9 +407,6 @@ void CaloTruthAccumulatorWithGraph::beginLuminosityBlock(edm::LuminosityBlock co } hcddd_ = bhgeom->topology().dddConstants(); - - caloStartZ = hgddd_[0]->waferZ(1, false) * - 10.0; // get the location of the first plane of silicon, put in mm } void CaloTruthAccumulatorWithGraph::initializeEvent(edm::Event const& event, @@ -261,18 +417,15 @@ void CaloTruthAccumulatorWithGraph::initializeEvent(edm::Event const& event, m_detIdToTotalSimEnergy.clear(); } -/// create handle to edm::HepMCProduct here because event.getByLabel with edm::HepMCProduct only -/// works for edm::Event -/// but not for PileUpEventPrincipal; PileUpEventPrincipal::getByLabel tries to call T::value_type -/// and T::iterator -/// (where T is the type of the object one wants to get a handle to) which is only implemented for -/// container-like objects -/// like std::vector but not for edm::HepMCProduct! - +/** Create handle to edm::HepMCProduct here because event.getByLabel with + edm::HepMCProduct only works for edm::Event but not for + PileUpEventPrincipal; PileUpEventPrincipal::getByLabel tries to call + T::value_type and T::iterator (where T is the type of the object one wants + to get a handle to) which is only implemented for container-like objects + like std::vector but not for edm::HepMCProduct! +*/ void CaloTruthAccumulatorWithGraph::accumulate(edm::Event const& event, edm::EventSetup const& setup) { - // Call the templated version that does the same for both signal and pileup events - edm::Handle hepmc; event.getByLabel(hepMCproductLabel_, hepmc); @@ -282,30 +435,27 @@ void CaloTruthAccumulatorWithGraph::accumulate(edm::Event const& event, void CaloTruthAccumulatorWithGraph::accumulate(PileUpEventPrincipal const& event, edm::EventSetup const& setup, edm::StreamID const&) { - // If this bunch crossing is outside the user configured limit, don't do anything. if (event.bunchCrossing() >= -static_cast(maximumPreviousBunchCrossing_) && event.bunchCrossing() <= static_cast(maximumSubsequentBunchCrossing_)) { - // edm::LogInfo(messageCategory_) << "Analysing pileup event for bunch crossing " << - // event.bunchCrossing(); - // simply create empty handle as we do not have a HepMCProduct in PU anyway edm::Handle hepmc; edm::LogInfo(messageCategory_) << " CaloTruthAccumulatorWithGraph::accumulate (pileup) bunchCrossing=" << event.bunchCrossing(); accumulateEvent(event, setup, hepmc); - } else + } else { edm::LogInfo(messageCategory_) << "Skipping pileup event for bunch crossing " << event.bunchCrossing(); + } } void CaloTruthAccumulatorWithGraph::finalizeEvent(edm::Event& event, edm::EventSetup const& setup) { - edm::LogInfo("CaloTruthAccumulatorWithGraph") - << "Adding " << output_.pSimClusters->size() << " SimParticles and " - << output_.pCaloParticles->size() << " CaloParticles to the event."; + edm::LogInfo(messageCategory_) << "Adding " << output_.pSimClusters->size() + << " SimParticles and " << output_.pCaloParticles->size() + << " CaloParticles to the event."; - // now we need to normalize the hits and energies into hits and fractions - // (since we have looped over all pileup events) + // We need to normalize the hits and energies into hits and fractions (since + // we have looped over all pileup events) for (auto& sc : *(output_.pSimClusters)) { auto hitsAndEnergies = sc.hits_and_fractions(); @@ -316,9 +466,8 @@ void CaloTruthAccumulatorWithGraph::finalizeEvent(edm::Event& event, edm::EventS if (totalenergy > 0) fraction = hAndE.second / totalenergy; else - edm::LogWarning("CaloTruthAccumulatorWithGraph") - << "TotalSimEnergy for hit " << hAndE.first - << " is 0! The fraction for this hit cannot be computed."; + edm::LogWarning(messageCategory_) << "TotalSimEnergy for hit " << hAndE.first + << " is 0! The fraction for this hit cannot be computed."; sc.addRecHitAndFraction(hAndE.first, fraction); } } @@ -347,9 +496,6 @@ template void CaloTruthAccumulatorWithGraph::accumulateEvent( const T& event, const edm::EventSetup& setup, const edm::Handle& hepMCproduct) { - // - // Get the collections - // edm::Handle > hGenParticles; edm::Handle > hGenParticleIndices; @@ -370,47 +516,52 @@ void CaloTruthAccumulatorWithGraph::accumulateEvent( m_simHitBarcodeToIndex.emplace(simHitPointers[i].second->geantTrackId(), i); } - const auto& tracks = *hSimTracks; - const auto& vertices = *hSimVertices; + auto const& tracks = *hSimTracks; + auto const& vertices = *hSimVertices; std::unordered_map trackid_to_track_index; DecayChain decay; int idx = 0; - IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << " TRACKS" << std::endl; + IfLogDebug(DEBUG, messageCategory_) << " TRACKS" << std::endl; for (auto const& t : tracks) { - IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") + IfLogDebug(DEBUG, messageCategory_) << " " << idx << "\t" << t.trackId() << "\t" << t << std::endl; trackid_to_track_index[t.trackId()] = idx; idx++; } - // Build the main decay graph and assign the SimTrack to each edge. The graph - // built here will only contain the particles that have a decay vertex - // associated to them. In order to recover also the particles that will not - // decay, we need to keep track of the SimTrack used here and add, - // a-posteriori, the ones not used, associating a ghost vertex (starting from - // the highest simulated vertex number +1), in order to build the edge and - // identify them immediately as stable (i.e. not decayed). - // To take into account the multi-bremsstrahlung effects in which a single - // particle is emitting photons in different vertices **keeping the same - // track index**, we also collapsed those vertices into 1 unique vertex. The - // other approach of fully representing the decay chain keeping the same - // track index would have the problem of over-counting the contributions of - // that track, especially in terms of hits. - // The 2 vectors are structured as follow: - // 1. used_sim_tracks is a vector that has the same size as the overall - // number of simulated tracks. The associated integer is the vertexId of - // the **decaying vertex for that track**. - // 2. collapsed_vertices is a vector that has the same size as the overall - // number of simulated vertices. The vector's index is the vertexId - // itself, the associated value is the vertexId of the vertex on which - // this should collapse. + /** + Build the main decay graph and assign the SimTrack to each edge. The graph + built here will only contain the particles that have a decay vertex + associated to them. In order to recover also the particles that will not + decay, we need to keep track of the SimTrack used here and add, a-posteriori, + the ones not used, associating a ghost vertex (starting from the highest + simulated vertex number), in order to build the edge and identify them + immediately as stable (i.e. not decayed). + + To take into account the multi-bremsstrahlung effects in which a single + particle is emitting photons in different vertices **keeping the same + track index**, we also collapsed those vertices into 1 unique vertex. The + other approach of fully representing the decay chain keeping the same + track index would have the problem of over-counting the contributions of + that track, especially in terms of hits. + + The 2 auxiliary vectors are structured as follow: + + 1. used_sim_tracks is a vector that has the same size as the overall + number of simulated tracks. The associated integer is the vertexId of + the **decaying vertex for that track**. + 2. collapsed_vertices is a vector that has the same size as the overall + number of simulated vertices. The vector's index is the vertexId + itself, the associated value is the vertexId of the vertex on which + this should collapse. + */ idx = 0; std::vector used_sim_tracks(tracks.size(), 0); std::vector collapsed_vertices(vertices.size(), 0); - IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << " VERTICES" << std::endl; + IfLogDebug(DEBUG, messageCategory_) << " VERTICES" << std::endl; for (auto const& v : vertices) { - IfLogDebug(DEBUG, "CaloTruthAccumulatorWithGraph") << " " << idx++ << "\t" << v << std::endl; + IfLogDebug(DEBUG, messageCategory_) << " " << idx++ << "\t" << v << std::endl; if (v.parentIndex() != -1) { auto trk_idx = trackid_to_track_index[v.parentIndex()]; auto origin_vtx = tracks[trk_idx].vertIndex(); @@ -422,12 +573,9 @@ void CaloTruthAccumulatorWithGraph::accumulateEvent( continue; } // Perform the actual vertex collapsing, if needed. - if (collapsed_vertices[origin_vtx]) - origin_vtx = collapsed_vertices[origin_vtx]; + if (collapsed_vertices[origin_vtx]) origin_vtx = collapsed_vertices[origin_vtx]; add_edge(origin_vtx, v.vertexId(), - EdgeProperty( - &tracks[trk_idx], - simTrackDetIdEnergyMap[v.parentIndex()].size(), 0), + EdgeProperty(&tracks[trk_idx], simTrackDetIdEnergyMap[v.parentIndex()].size(), 0), decay); used_sim_tracks[trk_idx] = v.vertexId(); } @@ -441,11 +589,9 @@ void CaloTruthAccumulatorWithGraph::accumulateEvent( if (!used_sim_tracks[i]) { auto origin_vtx = tracks[i].vertIndex(); // Perform the actual vertex collapsing, if needed. - if (collapsed_vertices[origin_vtx]) - origin_vtx = collapsed_vertices[origin_vtx]; + if (collapsed_vertices[origin_vtx]) origin_vtx = collapsed_vertices[origin_vtx]; add_edge(origin_vtx, offset, - EdgeProperty( - &tracks[i], simTrackDetIdEnergyMap[tracks[i].trackId()].size(), 0), + EdgeProperty(&tracks[i], simTrackDetIdEnergyMap[tracks[i].trackId()].size(), 0), decay); // The properties for "fake" vertices associated to stable particles have // to be set inside this loop, since they do not belong to the vertices @@ -457,35 +603,30 @@ void CaloTruthAccumulatorWithGraph::accumulateEvent( for (auto const& v : vertices) { if (v.parentIndex() != -1) { // Skip collapsed_vertices - if (collapsed_vertices[v.vertexId()]) - continue; + if (collapsed_vertices[v.vertexId()]) continue; put(vertexMothersProp, v.vertexId(), VertexProperty(&tracks[trackid_to_track_index[v.parentIndex()]], 0)); } } SimHitsAccumulator_dfs_visitor vis; depth_first_search(decay, visitor(vis)); - CaloParticle_dfs_visitor caloParticleCreator(output_, - m_caloParticles, - m_simHitBarcodeToIndex, - simTrackDetIdEnergyMap, - [&](EdgeProperty & edge_property) -> bool { - // Apply selection on SimTracks in order to promote them to be CaloParticles. - // The function returns TRUE if the particle satisfies the selection, FALSE otherwise. - // Therefore the correct logic to select the particle is to ask for TRUE as return value. - return (edge_property.cumulative_simHits != 0 - and ! edge_property.simTrack->noGenpart() - and edge_property.simTrack->momentum().E() > minEnergy_ - and std::abs(edge_property.simTrack->momentum().Eta()) < maxPseudoRapidity_); + CaloParticle_dfs_visitor caloParticleCreator( + output_, m_caloParticles, m_simHitBarcodeToIndex, simTrackDetIdEnergyMap, + [&](EdgeProperty& edge_property) -> bool { + // Apply selection on SimTracks in order to promote them to be CaloParticles. + // The function returns TRUE if the particle satisfies the selection, FALSE otherwise. + // Therefore the correct logic to select the particle is to ask for TRUE as return value. + return (edge_property.cumulative_simHits != 0 and !edge_property.simTrack->noGenpart() and + edge_property.simTrack->momentum().E() > minEnergy_ and + std::abs(edge_property.simTrack->momentum().Eta()) < maxPseudoRapidity_); }); depth_first_search(decay, visitor(caloParticleCreator)); #if DEBUG - boost::write_graphviz(std::cout, decay, - make_label_writer( - make_transform_value_property_map(&graphviz_vertex, get(vertex_name, decay))), - make_label_writer( - make_transform_value_property_map(&graphviz_edge, get(edge_weight, decay)))); + boost::write_graphviz(std::cout, decay, make_label_writer(make_transform_value_property_map( + &graphviz_vertex, get(vertex_name, decay))), + make_label_writer(make_transform_value_property_map( + &graphviz_edge, get(edge_weight, decay)))); #endif } @@ -494,12 +635,11 @@ void CaloTruthAccumulatorWithGraph::fillSimHits( std::vector >& returnValue, std::unordered_map >& simTrackDetIdEnergyMap, const T& event, const edm::EventSetup& setup) { - // loop over the collections - for (const auto& collectionTag : collectionTags_) { + for (auto const& collectionTag : collectionTags_) { edm::Handle > hSimHits; const bool isHcal = (collectionTag.instance().find("HcalHits") != std::string::npos); event.getByLabel(collectionTag, hSimHits); - for (const auto& simHit : *hSimHits) { + for (auto const& simHit : *hSimHits) { DetId id(0); const uint32_t simId = simHit.id(); if (isHcal) { diff --git a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.h b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.h deleted file mode 100644 index c0c063467dc2c..0000000000000 --- a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.h +++ /dev/null @@ -1,216 +0,0 @@ -#ifndef CaloAnalysis_CaloTruthAccumulatorWithGraph_h -#define CaloAnalysis_CaloTruthAccumulatorWithGraph_h - -#include "SimGeneral/MixingModule/interface/DigiAccumulatorMixMod.h" -// BOOST GRAPH LIBRARY -// boost optional (used by boost graph) results in some false positives with -Wmaybe-uninitialized -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" -#include -#include -#include -#include -#pragma GCC diagnostic pop - -#include // required for std::auto_ptr -#include -#include "SimDataFormats/CaloAnalysis/interface/CaloParticleFwd.h" -#include "SimDataFormats/CaloAnalysis/interface/SimClusterFwd.h" -#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" - -#include "DataFormats/ForwardDetId/interface/HGCalDetId.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Utilities/interface/InputTag.h" -#include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" -#include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" - -typedef unsigned Index_t; -typedef int Barcode_t; -typedef std::pair IndexPair_t; -typedef std::pair SimHitInfo_t; -typedef std::pair BarcodeIndexPair_t; -typedef std::pair BarcodePair_t; - -// Forward declarations -namespace edm { -class ParameterSet; -class ConsumesCollector; -namespace stream { -class EDProducerBase; -} -class Event; -class EventSetup; -class StreamID; -} -class PileUpEventPrincipal; -class PCaloHit; -class SimTrack; -class SimVertex; - -using boost::property; -using boost::edge; -using boost::edge_weight_t; -using boost::vertex; -using boost::vertex_name_t; -using boost::adjacency_list; -using boost::directedS; -using boost::listS; -using boost::vecS; -using boost::add_edge; - -/* GRAPH DEFINITIONS - - The graph represents the full decay chain. - - The parent-child relationship is the natural one, following "time". - - Each edge has a property (edge_weight_t) that holds a const pointer to the - SimTrack that connects the 2 vertices of the edge, the number of simHits - associated to that simTrack and the cumulative number of simHits of itself - and of all its children. Only simHits within the selected detectors are - taken into account. - - Each vertex has a property (vertex_name_t) that holds a const pointer to the - SimTrack that originated that vertex and the cumulative number of simHits of - all its outgoing edges. The cumulative property is filled during the dfs - exploration of the graph: if not explored the number is 0. - - Stable particles are recovered/added in a second iterations and are linked - to ghost vertices with an offset starting from the highest generated vertex. -*/ -struct EdgeProperty { - EdgeProperty(const SimTrack* t, int h, int c) - : simTrack(t), simHits(h), cumulative_simHits(c) {} - const SimTrack* simTrack; - int simHits; - int cumulative_simHits; -}; - -struct VertexProperty { - VertexProperty() : simTrack(nullptr), cumulative_simHits(0) {} - VertexProperty(const SimTrack* t, int c) : simTrack(t), cumulative_simHits(c) {} - VertexProperty(const VertexProperty& other) - : simTrack(other.simTrack), cumulative_simHits(other.cumulative_simHits) {} - const SimTrack* simTrack; - int cumulative_simHits; -}; - -typedef property EdgeParticleClustersProperty; -typedef property VertexMotherParticleProperty; -typedef adjacency_list - DecayChain; - -class CaloTruthAccumulatorWithGraph : public DigiAccumulatorMixMod { - public: - explicit CaloTruthAccumulatorWithGraph(const edm::ParameterSet& config, - edm::stream::EDProducerBase& mixMod, - edm::ConsumesCollector& iC); - - private: - void initializeEvent(const edm::Event& event, const edm::EventSetup& setup) override; - void accumulate(const edm::Event& event, const edm::EventSetup& setup) override; - void accumulate(const PileUpEventPrincipal& event, const edm::EventSetup& setup, - edm::StreamID const&) override; - void finalizeEvent(edm::Event& event, const edm::EventSetup& setup) override; - void beginLuminosityBlock(edm::LuminosityBlock const& lumi, - edm::EventSetup const& setup) override; - - /** @brief Both forms of accumulate() delegate to this templated method. */ - template - void accumulateEvent(const T& event, const edm::EventSetup& setup, - const edm::Handle& hepMCproduct); - - /** @brief Fills the supplied vector with pointers to the SimHits, checking for bad modules if - * required */ - template - void fillSimHits(std::vector >& returnValue, - std::unordered_map >& simTrackDetIdEnergyMap, const T& event, - const edm::EventSetup& setup); - - const std::string - messageCategory_; ///< The message category used to send messages to MessageLogger - - double caloStartZ; - - std::unordered_map m_detIdToTotalSimEnergy; // keep track of cell normalizations - std::unordered_multimap m_simHitBarcodeToIndex; - - /** The maximum bunch crossing BEFORE the signal crossing to create TrackinParticles for. Use - * positive values. If set to zero no - * previous bunches are added and only in-time, signal and after bunches (defined by - * maximumSubsequentBunchCrossing_) are used.*/ - const unsigned int maximumPreviousBunchCrossing_; - /** The maximum bunch crossing AFTER the signal crossing to create TrackinParticles for. E.g. if - * set to zero only - * uses the signal and in time pileup (and previous bunches defined by the - * maximumPreviousBunchCrossing_ parameter). */ - const unsigned int maximumSubsequentBunchCrossing_; - - const edm::InputTag simTrackLabel_; - const edm::InputTag simVertexLabel_; - edm::Handle > hSimTracks; - edm::Handle > hSimVertices; - - std::vector collectionTags_; - edm::InputTag genParticleLabel_; - /// Needed to add HepMC::GenVertex to SimVertex - edm::InputTag hepMCproductLabel_; - - const double minEnergy_, maxPseudoRapidity_; - - bool selectorFlag_; - /// Uses the same config as selector_, but can be used to drop out early since selector_ requires - /// the TrackingParticle to be created first. - bool chargedOnly_; - /// Uses the same config as selector_, but can be used to drop out early since selector_ requires - /// the TrackingParticle to be created first. - bool signalOnly_; - - bool barcodeLogicWarningAlready_; - - /** @brief When counting hits, allows hits in different detectors to have a different process - * type. - * - * Fast sim PCaloHits seem to have a peculiarity where the process type (as reported by - * PCaloHit::processType()) is - * different for the tracker than the muons. When counting how many hits there are, the code - * usually only counts - * the number of hits that have the same process type as the first hit. Setting this to true will - * also count hits - * that have the same process type as the first hit in the second detector.
- */ - // bool allowDifferentProcessTypeForDifferentDetectors_; - public: - // These always go hand in hand, and I need to pass them around in the internal - // functions, so I might as well package them up in a struct. - struct OutputCollections { - std::unique_ptr pSimClusters; - std::unique_ptr pCaloParticles; - }; - - struct calo_particles { - std::vector sc_start_; - std::vector sc_stop_; - - void swap(calo_particles& oth) { - sc_start_.swap(oth.sc_start_); - sc_stop_.swap(oth.sc_stop_); - } - - void clear() { - sc_start_.clear(); - sc_stop_.clear(); - } - }; - - - private: - const HGCalTopology* hgtopo_[2]; - const HGCalDDDConstants* hgddd_[2]; - const HcalDDDRecConstants* hcddd_; - OutputCollections output_; - calo_particles m_caloParticles; -}; - -#endif // end of "#ifndef CaloAnalysis_CaloTruthAccumulatorWithGraph_h" From 77836a5ee9bf5340ed9ff9ded72c37bf081fa7b0 Mon Sep 17 00:00:00 2001 From: Marco Rovere Date: Wed, 13 Dec 2017 10:38:00 +0100 Subject: [PATCH 099/426] Simplify the Debugging plugin --- SimGeneral/Debugging/plugins/Debugging.cc | 235 ++------------------ SimGeneral/Debugging/python/ConfFile_cfg.py | 4 +- 2 files changed, 24 insertions(+), 215 deletions(-) diff --git a/SimGeneral/Debugging/plugins/Debugging.cc b/SimGeneral/Debugging/plugins/Debugging.cc index ed32a8ee6df14..725444c6c6217 100644 --- a/SimGeneral/Debugging/plugins/Debugging.cc +++ b/SimGeneral/Debugging/plugins/Debugging.cc @@ -3,11 +3,6 @@ // Created: Fri, 10 Nov 2017 14:39:18 GMT // // - -// BOOST GRAPH LIBRARY -#include -#include -#include // // system include files #include @@ -33,6 +28,7 @@ #include "DataFormats/HepMCCandidate/interface/GenParticle.h" #include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" #include "SimDataFormats/CaloHit/interface/PCaloHit.h" +#include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" #include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" #include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" @@ -44,125 +40,6 @@ #include "Geometry/HcalCommonData/interface/HcalHitRelabeller.h" -using namespace boost; - -/* GRAPH DEFINITIONS - - The graph represents the full decay chain. - - The parent-child relationship is the natural one, following "time". - - Each edge has a property (edge_weight_t) that holds a const pointer to the - SimTrack that connects the 2 vertices of the edge, the number of simHits - associated to that simTrack, the overall energy deposited in the - associated simHits and the cumulative number of simHits of itself and of all - its children. - - Each vertex has a property (vertex_name_t) that holds a const pointer to the - SimTrack that originated that vertex and the cumulative number of simHits of - all its outgoing edges. The cumulative property is filled during the dfs - exploration of the graph: if not explored the number is 0. - - Stable particles are recovered/added in a second iterations and are linked - to ghost vertices with an offset starting from the highest generated vertex. -*/ -struct EdgeProperty { - EdgeProperty(const SimTrack* t, - int h, - int c, - float e) - : simTrack(t), simHits(h), cumulative_simHits(c), energy(e) {} - const SimTrack* simTrack; - int simHits; - int cumulative_simHits; - float energy; -}; - -struct VertexProperty { - VertexProperty() : simTrack(nullptr), cumulative_simHits(0) {} - VertexProperty(const SimTrack* t, int c) : simTrack(t), cumulative_simHits(c) {} - VertexProperty(const VertexProperty& other) : simTrack(other.simTrack), cumulative_simHits(other.cumulative_simHits) {} - const SimTrack * simTrack; - int cumulative_simHits; -}; - -typedef property EdgeParticleClustersProperty; -typedef property VertexMotherParticleProperty; -typedef adjacency_list< listS, vecS, directedS, - VertexMotherParticleProperty, EdgeParticleClustersProperty> DecayChain; - -namespace { - template < typename Edge, typename Graph, typename Visitor> - void print_edge(Edge &e, const Graph & g, Visitor * v) { - auto const edge_property = get(edge_weight, g, e); - v->total_simHits += edge_property.simHits; - std::cout << "Examining edges " << e - << " --> particle " << edge_property.simTrack->type() - << "(" << edge_property.simTrack->trackId() << ")" - << " with SimClusters: " << edge_property.simHits - << " and total Energy: " << edge_property.energy - << " Accumulated SimClusters: " << v->total_simHits << std::endl; - } - template < typename Vertex, typename Graph > - void print_vertex(Vertex &u, const Graph & g) { - auto const vertex_property = get(vertex_name, g, u); - std::cout << "At " << u; - // The Mother of all vertices has **no** SimTrack associated. - if (vertex_property.simTrack) - std::cout << "[" << vertex_property.simTrack->type() << "]" - << "(" << vertex_property.simTrack->trackId() << ")"; - std::cout << std::endl; - } - class Custom_dfs_visitor : public boost::default_dfs_visitor { - public: - int total_simHits = 0; - template < typename Vertex, typename Graph > - void finish_vertex(Vertex u, const Graph & g) { -// print_vertex(u, g); - } - template < typename Edge, typename Graph > - void examine_edge(Edge e, const Graph& g) { - print_edge(e, g, this); - } - template < typename Edge, typename Graph > - void finish_edge(Edge e, const Graph & g) { - auto const edge_property = get(edge_weight, g, e); - auto src = source(e, g); - auto trg = target(e, g); - auto cumulative = edge_property.simHits - + get(vertex_name, g, trg).cumulative_simHits - + (get(vertex_name, g, src).simTrack ? get(vertex_name, g, src).cumulative_simHits : 0); // when we hit the root vertex we have to stop adding back its contribution. - auto const src_vertex_property = get(vertex_name, g, src); - put(get(vertex_name, const_cast(g)), - src, - VertexProperty(src_vertex_property.simTrack, cumulative)); - put(get(edge_weight, const_cast(g)), e, - EdgeProperty(edge_property.simTrack, - edge_property.simHits, - cumulative, - edge_property.energy)); - std::cout << "Finished edge: " << e - << " Track id: " << get(edge_weight, g, e).simTrack->trackId() - << " has cumulated " << cumulative - << " hits" << std::endl; - std::cout << " SrcVtx: " << src << "\t" << get(vertex_name, g, src).simTrack << "\t" << get(vertex_name, g, src).cumulative_simHits << std::endl; - std::cout << " TrgVtx: " << trg << "\t" << get(vertex_name, g, trg).simTrack << "\t" << get(vertex_name, g, trg).cumulative_simHits << std::endl; - } - }; - class Custom_bfs_visitor : public boost::default_bfs_visitor { - public: - int total_simHits = 0; - template < typename Vertex, typename Graph > - void examine_vertex(Vertex u, const Graph & g) { - print_vertex(u, g); - } - template < typename Edge, typename Graph > - void examine_edge(Edge e, const Graph& g) { - print_edge(e, g, this); - } - }; -} - // // class declaration // @@ -170,18 +47,16 @@ namespace { class Debugging : public edm::one::EDAnalyzer<> { public: explicit Debugging(const edm::ParameterSet&); - ~Debugging(); + ~Debugging() override; static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: - virtual void beginJob() override; - virtual void analyze(const edm::Event&, const edm::EventSetup&) override; - virtual void endJob() override; - void fillSimHits(std::vector >&, - std::map > &, - std::map &, + void beginJob() override; + void analyze(const edm::Event&, const edm::EventSetup&) override; + void endJob() override; + void fillSimHits(std::map &, const edm::Event& , const edm::EventSetup &); edm::InputTag simTracks_; edm::InputTag genParticles_; @@ -261,10 +136,8 @@ Debugging::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { auto const & calopart = *caloParticlesH.product(); // Let's first fill in hits information - std::vector > simHitPointers; - std::map > simTrackDetIdEnergyMap; std::map detIdToTotalSimEnergy; - fillSimHits(simHitPointers, simTrackDetIdEnergyMap, detIdToTotalSimEnergy, iEvent, iSetup); + fillSimHits(detIdToTotalSimEnergy, iEvent, iSetup); int idx = 0; @@ -288,74 +161,10 @@ Debugging::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { std::cout << "Printing SimVertex information" << std::endl; std::cout << "IDX\tPOSITION(x,y,z)\tPARENT_INDEX\tVERTEX_ID" << std::endl; - DecayChain decay; idx = 0; - // Build the main decay graph and assign the SimTrack to each edge. The graph - // built here will only contain the particles that have a decay vertex - // associated to them. In order to recover also the particles that will not - // decay, we need to keep track of the SimTrack used here and add, - // a-posteriori, the ones not used, associating a ghost vertex (starting from - // 1E6), in order to build the edge and identify them immediately as - // stable (i.e. not decayed). - std::vector used_sim_tracks(tracks.size(), false); for (auto const & v: vertices) { - std::cout << idx++ << "\t" << v << std::endl; - if (v.parentIndex() != -1) { - add_edge(tracks.at(trackid_to_track_index[v.parentIndex()]).vertIndex(), - v.vertexId(), - EdgeProperty(&tracks.at(trackid_to_track_index[v.parentIndex()]), - simTrackDetIdEnergyMap[trackid_to_track_index[v.parentIndex()]].size(), - 0, - std::accumulate(simTrackDetIdEnergyMap[trackid_to_track_index[v.parentIndex()]].begin(), - simTrackDetIdEnergyMap[trackid_to_track_index[v.parentIndex()]].end(), 0., - [&](float partial, std::pair current) { - return partial + current.second/detIdToTotalSimEnergy[current.first]; })), - decay); - used_sim_tracks[trackid_to_track_index[v.parentIndex()]] = true; - } + std::cout << idx++ << "\t" << v << std::endl; } - // Now recover the particles that did not decay. Append them with an index - // bigger than the size of the generated vertices. - int offset = vertices.size() + 1; - for (size_t i = 0; i < tracks.size(); ++i) { - if (!used_sim_tracks[i]) - add_edge(tracks.at(i).vertIndex(), offset++, - EdgeProperty(&tracks.at(i), - simTrackDetIdEnergyMap[tracks.at(i).trackId()].size(), - 0, - std::accumulate(simTrackDetIdEnergyMap[tracks.at(i).trackId()].begin(), - simTrackDetIdEnergyMap[tracks.at(i).trackId()].end(), 0., - [&](float partial, std::pair current) { - return partial + current.second/detIdToTotalSimEnergy[current.first]; - })), decay); - } - // Now assign the motherParticle property to each vertex - auto const & vertexMothersProp = get(vertex_name, decay); - for (auto const & v: vertices) { - if (v.parentIndex() != -1) { - put(vertexMothersProp, v.vertexId(), VertexProperty(&tracks.at(trackid_to_track_index[v.parentIndex()]), 0)); - } - } -#define DFS -#ifdef DFS - Custom_dfs_visitor vis; - depth_first_search(decay, visitor(vis)); - auto const first_generation = out_edges(0, decay); - for (auto edge = first_generation.first; edge != first_generation.second; ++edge) { - auto const edge_property = get(edge_weight, decay, *edge); - Custom_bfs_visitor bfs; - std::cout << "Creating CaloParticle particle: " - << edge_property.simTrack->type() - << "(" << edge_property.simTrack->trackId() << ")" - << " with total SimClusters: " << get(edge_weight, decay, *edge).cumulative_simHits - << " and total Energy: " << edge_property.energy - << std::endl; - } -#else - Custom_bfs_visitor vis; - breadth_first_search(decay, 0, visitor(vis)); -#endif - std::cout << "Printing TrackingParticles information" << std::endl; idx = 0; for (auto const & tp : trackingpart) @@ -363,9 +172,21 @@ Debugging::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { std::cout << "Printing CaloParticles information" << std::endl; idx = 0; - for (auto const & cp : calopart) + for (auto const & cp : calopart) { std::cout << idx++ << " |Eta|: " << std::abs(cp.momentum().eta()) << "\tEnergy: " << cp.energy() << "\t" << cp << std::endl; + double total_sim_energy = 0.; + double total_cp_energy = 0.; + std::cout << "--> Overall simclusters's size: " << cp.simClusters().size() << std::endl; + for (auto const & sc : cp.simClusters()) { + for (auto const & cl : sc->hits_and_fractions()) { + total_sim_energy += detIdToTotalSimEnergy[cl.first]*cl.second; + total_cp_energy += cp.energy()*cl.second; + } + } + std::cout << "--> Overall SC energy (sum using sim energies): " << total_sim_energy << std::endl; + std::cout << "--> Overall SC energy (sum using CaloP energies): " << total_cp_energy << std::endl; + } } @@ -378,8 +199,6 @@ void Debugging::endJob() {} void Debugging::fillSimHits( - std::vector >& returnValue, - std::map > & simTrackDetIdEnergyMap, std::map & detIdToTotalSimEnergy, const edm::Event& iEvent, const edm::EventSetup& iSetup ) { // Taken needed quantities from the EventSetup @@ -408,7 +227,6 @@ void Debugging::fillSimHits( int token = 0; for (auto const& collectionTag : collectionTags_) { edm::Handle< std::vector > hSimHits; - std::cout << collectionTag.instance() << std::endl; const bool isHcal = ( collectionTag.instance().find("HcalHits") != std::string::npos ); iEvent.getByToken(collectionTagsToken_[token++], hSimHits); for (auto const& simHit : *hSimHits) { @@ -432,16 +250,7 @@ void Debugging::fillSimHits( if (DetId(0) == id) continue; - returnValue.emplace_back(id, &simHit); - if (simTrackDetIdEnergyMap.count(simHit.geantTrackId()) - && simTrackDetIdEnergyMap[simHit.geantTrackId()].count(id.rawId())) - simTrackDetIdEnergyMap[simHit.geantTrackId()][id.rawId()] += simHit.energy(); - else - simTrackDetIdEnergyMap[simHit.geantTrackId()][id.rawId()] = simHit.energy(); - if (detIdToTotalSimEnergy.count(id.rawId())) - detIdToTotalSimEnergy[id.rawId()] += simHit.energy(); - else - detIdToTotalSimEnergy[id.rawId()] = simHit.energy(); + detIdToTotalSimEnergy[id.rawId()] += simHit.energy(); } } // end of loop over InputTags } diff --git a/SimGeneral/Debugging/python/ConfFile_cfg.py b/SimGeneral/Debugging/python/ConfFile_cfg.py index a03d0bc429b96..9b8c5517cf6f4 100644 --- a/SimGeneral/Debugging/python/ConfFile_cfg.py +++ b/SimGeneral/Debugging/python/ConfFile_cfg.py @@ -21,9 +21,9 @@ fileNames = cms.untracked.vstring( # 'file:/data/rovere/HGCAL/study/CMSSW_9_4_0/src/SimGeneral/Debugging/test/20800.0_FourMuPt1_200+FourMuPt_1_200_pythia8_2023D20_GenSimHLBeamSpotFull+DigiFull_2023D20+RecoFullGlobal_2023D20+HARVESTFullGlobal_2023D20/step2.root' # 'file:/data/rovere/HGCAL/study/CMSSW_9_4_0/src/SimGeneral/Debugging/test/20824.0_TTbar_13+TTbar_13TeV_TuneCUETP8M1_2023D20_GenSimHLBeamSpotFull+DigiFull_2023D20+RecoFullGlobal_2023D20+HARVESTFullGlobal_2023D20/step2.root' - 'file:/data/rovere/HGCAL/study/CMSSW_9_4_0/src/SimGeneral/Debugging/test/20002.0_SingleElectronPt35+SingleElectronPt35_pythia8_2023D17_GenSimHLBeamSpotFull+DigiFullTrigger_2023D17+RecoFullGlobal_2023D17+HARVESTFullGlobal_2023D17/step2.root' +# 'file:/data/rovere/HGCAL/study/CMSSW_9_4_0/src/SimGeneral/Debugging/test/20002.0_SingleElectronPt35+SingleElectronPt35_pythia8_2023D17_GenSimHLBeamSpotFull+DigiFullTrigger_2023D17+RecoFullGlobal_2023D17+HARVESTFullGlobal_2023D17/step2.root' # 'file:/data/rovere/HGCAL/study/CMSSW_9_4_0/src/SimGeneral/Debugging/test/20016.0_SingleGammaPt35Extended+DoubleGammaPt35Extended_pythia8_2023D17_GenSimHLBeamSpotFull+DigiFullTrigger_2023D17+RecoFullGlobal_2023D17+HARVESTFullGlobal_2023D17/step2.root' -# 'file:/data/rovere/HGCAL/study/CMSSW_9_4_0/src/SimGeneral/Debugging/test/20088.0_SinglePiPt25Eta1p7_2p7+SinglePiPt25Eta1p7_2p7_2023D17_GenSimHLBeamSpotFull+DigiFullTrigger_2023D17+RecoFullGlobal_2023D17+HARVESTFullGlobal_2023D17/step2.root' + 'file:/data/rovere/HGCAL/study/CMSSW_9_4_0/src/SimGeneral/Debugging/test/20088.0_SinglePiPt25Eta1p7_2p7+SinglePiPt25Eta1p7_2p7_2023D17_GenSimHLBeamSpotFull+DigiFullTrigger_2023D17+RecoFullGlobal_2023D17+HARVESTFullGlobal_2023D17/step2.root' ) ) From 6a80062b20d5e0dd762c04745025355d7d4bf945 Mon Sep 17 00:00:00 2001 From: Marco Rovere Date: Wed, 13 Dec 2017 10:50:51 +0100 Subject: [PATCH 100/426] Actually use the CaloTruthAccumulator with Graph --- .../plugins/CaloTruthAccumulator.cc | 942 +++++++++++------- .../plugins/CaloTruthAccumulator.h | 174 ---- .../plugins/CaloTruthAccumulatorWithGraph.cc | 673 ------------- 3 files changed, 577 insertions(+), 1212 deletions(-) delete mode 100644 SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.h delete mode 100644 SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc diff --git a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc index f0c9ed8b9e865..92a81bd899680 100644 --- a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc +++ b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc @@ -1,461 +1,673 @@ -// S Zenz/L Gray, May 2016 -// Loosely based on TrackingTruthAccumulator (M Grimes) +// BOOST GRAPH LIBRARY +#include +#include +#include +#define DEBUG false + +#if DEBUG +// boost optional (used by boost graph) results in some false positives with -Wmaybe-uninitialized +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#include +#pragma GCC diagnostic pop +#endif -#include "SimGeneral/MixingModule/interface/DigiAccumulatorMixModFactory.h" -#include "SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.h" - -#include "DataFormats/ForwardDetId/interface/HGCalDetId.h" -#include "DataFormats/HcalDetId/interface/HcalDetId.h" -#include "SimDataFormats/CaloTest/interface/HGCalTestNumbering.h" -#include "DataFormats/HcalDetId/interface/HcalTestNumbering.h" -#include "SimDataFormats/Vertex/interface/SimVertex.h" +#include +#include // required for std::auto_ptr +#include // for std::accumulate +#include -#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "SimGeneral/MixingModule/interface/PileUpEventPrincipal.h" -#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" - -#include "FWCore/Framework/interface/ProducerBase.h" -#include "SimGeneral/TrackingAnalysis/interface/EncodedTruthId.h" -#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" -#include "SimDataFormats/CaloHit/interface/PCaloHit.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include "DataFormats/ForwardDetId/interface/HGCalDetId.h" +#include "DataFormats/HcalDetId/interface/HcalDetId.h" +#include "DataFormats/HcalDetId/interface/HcalTestNumbering.h" +#include "DataFormats/HepMCCandidate/interface/GenParticle.h" #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" #include "DataFormats/SiStripDetId/interface/StripSubdetector.h" -#include "DataFormats/HepMCCandidate/interface/GenParticle.h" -#include "FWCore/Framework/interface/ESHandle.h" + +#include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" +#include "SimDataFormats/CaloAnalysis/interface/CaloParticleFwd.h" +#include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" +#include "SimDataFormats/CaloAnalysis/interface/SimClusterFwd.h" +#include "SimDataFormats/CaloHit/interface/PCaloHit.h" +#include "SimDataFormats/CaloTest/interface/HGCalTestNumbering.h" +#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" +#include "SimDataFormats/Vertex/interface/SimVertex.h" + +#include "SimGeneral/MixingModule/interface/DigiAccumulatorMixMod.h" +#include "SimGeneral/MixingModule/interface/DigiAccumulatorMixModFactory.h" +#include "SimGeneral/MixingModule/interface/PileUpEventPrincipal.h" +#include "SimGeneral/TrackingAnalysis/interface/EncodedTruthId.h" #include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" #include "Geometry/HcalCommonData/interface/HcalHitRelabeller.h" +#include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" -#include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" +namespace { +using Index_t = unsigned; +using Barcode_t = int; +} -#include +using boost::adjacency_list; +using boost::directedS; +using boost::listS; +using boost::vecS; +using boost::property; +using boost::edge; +using boost::edge_weight_t; +using boost::edge_weight; +using boost::add_edge; +using boost::vertex; +using boost::vertex_name_t; +using boost::vertex_name; + +/* GRAPH DEFINITIONS + + The graph represents the full decay chain. + + The parent-child relationship is the natural one, following "time". + + Each edge has a property (edge_weight_t) that holds a const pointer to the + SimTrack that connects the 2 vertices of the edge, the number of simHits + associated to that simTrack and the cumulative number of simHits of itself + and of all its children. Only simHits within the selected detectors are + taken into account. The cumulative property is filled during the dfs + exploration of the graph: if not explored the number is 0. + + Each vertex has a property (vertex_name_t) that holds a const pointer to the + SimTrack that originated that vertex and the cumulative number of simHits of + all its outgoing edges. The cumulative property is filled during the dfs + exploration of the graph: if not explored the number is 0. + + Stable particles are recovered/added in a second iterations and are linked + to ghost vertices with an offset starting from the highest generated vertex. + + Multiple decays of a single particle that retains its original trackId are + merged into one unique vertex (the first encountered) in order to avoid + multiple counting of its associated simHits (if any). + +*/ +struct EdgeProperty { + EdgeProperty(const SimTrack* t, int h, int c) : simTrack(t), simHits(h), cumulative_simHits(c) {} + const SimTrack* simTrack; + int simHits; + int cumulative_simHits; +}; + +struct VertexProperty { + VertexProperty() : simTrack(nullptr), cumulative_simHits(0) {} + VertexProperty(const SimTrack* t, int c) : simTrack(t), cumulative_simHits(c) {} + VertexProperty(const VertexProperty& other) + : simTrack(other.simTrack), cumulative_simHits(other.cumulative_simHits) {} + const SimTrack* simTrack; + int cumulative_simHits; +}; + +using EdgeParticleClustersProperty = property; +using VertexMotherParticleProperty = property; +using DecayChain = adjacency_list; + +class CaloTruthAccumulator : public DigiAccumulatorMixMod { + public: + explicit CaloTruthAccumulator(const edm::ParameterSet& config, + edm::stream::EDProducerBase& mixMod, + edm::ConsumesCollector& iC); + + private: + void initializeEvent(const edm::Event& event, const edm::EventSetup& setup) override; + void accumulate(const edm::Event& event, const edm::EventSetup& setup) override; + void accumulate(const PileUpEventPrincipal& event, const edm::EventSetup& setup, + edm::StreamID const&) override; + void finalizeEvent(edm::Event& event, const edm::EventSetup& setup) override; + void beginLuminosityBlock(edm::LuminosityBlock const& lumi, + edm::EventSetup const& setup) override; + + /** @brief Both forms of accumulate() delegate to this templated method. */ + template + void accumulateEvent(const T& event, const edm::EventSetup& setup, + const edm::Handle& hepMCproduct); + + /** @brief Fills the supplied vector with pointers to the SimHits, checking for bad modules if + * required */ + template + void fillSimHits(std::vector >& returnValue, + std::unordered_map >& simTrackDetIdEnergyMap, + const T& event, const edm::EventSetup& setup); + + const std::string messageCategory_; + + std::unordered_map m_detIdToTotalSimEnergy; // keep track of cell normalizations + std::unordered_multimap m_simHitBarcodeToIndex; + + /** The maximum bunch crossing BEFORE the signal crossing to create + TrackinParticles for. Use positive values. If set to zero no + previous bunches are added and only in-time, signal and after bunches + (defined by maximumSubsequentBunchCrossing_) are used. + */ + const unsigned int maximumPreviousBunchCrossing_; + /** The maximum bunch crossing AFTER the signal crossing to create + TrackinParticles for. E.g. if set to zero only + uses the signal and in time pileup (and previous bunches defined by the + maximumPreviousBunchCrossing_ parameter). + */ + const unsigned int maximumSubsequentBunchCrossing_; + + const edm::InputTag simTrackLabel_; + const edm::InputTag simVertexLabel_; + edm::Handle > hSimTracks; + edm::Handle > hSimVertices; + + std::vector collectionTags_; + edm::InputTag genParticleLabel_; + /// Needed to add HepMC::GenVertex to SimVertex + edm::InputTag hepMCproductLabel_; + + const double minEnergy_, maxPseudoRapidity_; + + public: + struct OutputCollections { + std::unique_ptr pSimClusters; + std::unique_ptr pCaloParticles; + }; + + struct calo_particles { + std::vector sc_start_; + std::vector sc_stop_; + + void swap(calo_particles& oth) { + sc_start_.swap(oth.sc_start_); + sc_stop_.swap(oth.sc_stop_); + } + + void clear() { + sc_start_.clear(); + sc_stop_.clear(); + } + }; + + private: + const HGCalTopology* hgtopo_[2]; + const HGCalDDDConstants* hgddd_[2]; + const HcalDDDRecConstants* hcddd_; + OutputCollections output_; + calo_particles m_caloParticles; +}; + +/* Graph utility functions */ + +namespace { +template +void accumulateSimHits_edge(Edge& e, const Graph& g, Visitor* v) { + auto const edge_property = get(edge_weight, g, e); + v->total_simHits += edge_property.simHits; + IfLogDebug(DEBUG, messageCategory_) + << " Examining edges " << e << " --> particle " << edge_property.simTrack->type() << "(" + << edge_property.simTrack->trackId() << ")" + << " with SimClusters: " << edge_property.simHits + << " Accumulated SimClusters: " << v->total_simHits << std::endl; +} +template +void print_vertex(Vertex& u, const Graph& g) { + auto const vertex_property = get(vertex_name, g, u); + IfLogDebug(DEBUG, messageCategory_) << " At " << u; + // The Mother of all vertices has **no** SimTrack associated. + if (vertex_property.simTrack) + IfLogDebug(DEBUG, messageCategory_) << " [" << vertex_property.simTrack->type() << "]" + << "(" << vertex_property.simTrack->trackId() << ")"; + IfLogDebug(DEBUG, messageCategory_) << std::endl; +} + +// Graphviz output functions will only be generated in DEBUG mode +#if DEBUG +std::string graphviz_vertex(const VertexProperty& v) { + std::ostringstream oss; + oss << "{id: " << (v.simTrack ? v.simTrack->trackId() : 0) + << ", type: " << (v.simTrack ? v.simTrack->type() : 0) << ", chits: " << v.cumulative_simHits + << "}"; + return oss.str(); +} + +std::string graphviz_edge(const EdgeProperty& e) { + std::ostringstream oss; + oss << "[" << (e.simTrack ? e.simTrack->trackId() : 0) << "," + << (e.simTrack ? e.simTrack->type() : 0) << "," << e.simHits << "]"; + return oss.str(); +} +#endif + +class SimHitsAccumulator_dfs_visitor : public boost::default_dfs_visitor { + public: + int total_simHits = 0; + template + void examine_edge(Edge e, const Graph& g) { + accumulateSimHits_edge(e, g, this); + } + template + void finish_edge(Edge e, const Graph& g) { + auto const edge_property = get(edge_weight, g, e); + auto src = source(e, g); + auto trg = target(e, g); + auto cumulative = + edge_property.simHits + get(vertex_name, g, trg).cumulative_simHits + + (get(vertex_name, g, src).simTrack + ? get(vertex_name, g, src).cumulative_simHits + : 0); // when we hit the root vertex we have to stop adding back its contribution. + auto const src_vertex_property = get(vertex_name, g, src); + put(get(vertex_name, const_cast(g)), src, + VertexProperty(src_vertex_property.simTrack, cumulative)); + put(get(edge_weight, const_cast(g)), e, + EdgeProperty(edge_property.simTrack, edge_property.simHits, cumulative)); + IfLogDebug(DEBUG, messageCategory_) + << " Finished edge: " << e << " Track id: " << get(edge_weight, g, e).simTrack->trackId() + << " has cumulated " << cumulative << " hits" << std::endl; + IfLogDebug(DEBUG, messageCategory_) + << " SrcVtx: " << src << "\t" << get(vertex_name, g, src).simTrack << "\t" + << get(vertex_name, g, src).cumulative_simHits << std::endl; + IfLogDebug(DEBUG, messageCategory_) + << " TrgVtx: " << trg << "\t" << get(vertex_name, g, trg).simTrack << "\t" + << get(vertex_name, g, trg).cumulative_simHits << std::endl; + } +}; + +typedef std::function Selector; + +class CaloParticle_dfs_visitor : public boost::default_dfs_visitor { + public: + CaloParticle_dfs_visitor(CaloTruthAccumulator::OutputCollections& output, + CaloTruthAccumulator::calo_particles& caloParticles, + std::unordered_multimap& simHitBarcodeToIndex, + std::unordered_map >& simTrackDetIdEnergyMap, + Selector selector) + : output_(output), + caloParticles_(caloParticles), + simHitBarcodeToIndex_(simHitBarcodeToIndex), + simTrackDetIdEnergyMap_(simTrackDetIdEnergyMap), + selector_(selector) {} + template + void discover_vertex(Vertex u, const Graph& g) { + // If we reach the vertex 0, it means that we are backtracking with respect + // to the first generation of stable particles: simply return; + if (u == 0) return; + print_vertex(u, g); + auto const vertex_property = get(vertex_name, g, u); + if (!vertex_property.simTrack) return; + auto trackIdx = vertex_property.simTrack->trackId(); + IfLogDebug(DEBUG, messageCategory_) + << " Found " << simHitBarcodeToIndex_.count(trackIdx) << " associated simHits" << std::endl; + if (simHitBarcodeToIndex_.count(trackIdx)) { + output_.pSimClusters->emplace_back(*vertex_property.simTrack); + auto& simcluster = output_.pSimClusters->back(); + std::unordered_map acc_energy; + for (auto const& hit_and_energy : simTrackDetIdEnergyMap_[trackIdx]) { + acc_energy[hit_and_energy.first] += hit_and_energy.second; + } + for (auto const& hit_and_energy : acc_energy) { + simcluster.addRecHitAndFraction(hit_and_energy.first, hit_and_energy.second); + } + } + } + template + void examine_edge(Edge e, const Graph& g) { + auto src = source(e, g); + if (src == 0) { + auto edge_property = get(edge_weight, g, e); + if (selector_(edge_property)) { + output_.pCaloParticles->emplace_back(*(edge_property.simTrack)); + caloParticles_.sc_start_.push_back(output_.pSimClusters->size()); + } + } + } + + template + void finish_edge(Edge e, const Graph& g) { + auto src = source(e, g); + if (src == 0) { + auto edge_property = get(edge_weight, g, e); + if (selector_(edge_property)) { + caloParticles_.sc_stop_.push_back(output_.pSimClusters->size()); + } + } + } -CaloTruthAccumulator::CaloTruthAccumulator( const edm::ParameterSet & config, edm::ProducerBase& mixMod, edm::ConsumesCollector& iC) : - messageCategory_("CaloTruthAccumulator"), - maximumPreviousBunchCrossing_( config.getParameter("maximumPreviousBunchCrossing") ), - maximumSubsequentBunchCrossing_( config.getParameter("maximumSubsequentBunchCrossing") ), - simTrackLabel_( config.getParameter("simTrackCollection") ), - simVertexLabel_( config.getParameter("simVertexCollection") ), - collectionTags_( ), - genParticleLabel_( config.getParameter("genParticleCollection") ), - hepMCproductLabel_( config.getParameter("HepMCProductLabel") ), - minEnergy_( config.getParameter("MinEnergy") ), - maxPseudoRapidity_( config.getParameter("MaxPseudoRapidity") ) -{ - barcodeLogicWarningAlready_ = false; + private: + CaloTruthAccumulator::OutputCollections& output_; + CaloTruthAccumulator::calo_particles& caloParticles_; + std::unordered_multimap& simHitBarcodeToIndex_; + std::unordered_map >& simTrackDetIdEnergyMap_; + Selector selector_; +}; +} +CaloTruthAccumulator::CaloTruthAccumulator(const edm::ParameterSet& config, + edm::stream::EDProducerBase& mixMod, + edm::ConsumesCollector& iC) + : messageCategory_("CaloTruthAccumulator"), + maximumPreviousBunchCrossing_( + config.getParameter("maximumPreviousBunchCrossing")), + maximumSubsequentBunchCrossing_( + config.getParameter("maximumSubsequentBunchCrossing")), + simTrackLabel_(config.getParameter("simTrackCollection")), + simVertexLabel_(config.getParameter("simVertexCollection")), + collectionTags_(), + genParticleLabel_(config.getParameter("genParticleCollection")), + hepMCproductLabel_(config.getParameter("HepMCProductLabel")), + minEnergy_(config.getParameter("MinEnergy")), + maxPseudoRapidity_(config.getParameter("MaxPseudoRapidity")) { mixMod.produces("MergedCaloTruth"); mixMod.produces("MergedCaloTruth"); - + iC.consumes >(simTrackLabel_); iC.consumes >(simVertexLabel_); iC.consumes >(genParticleLabel_); iC.consumes >(genParticleLabel_); iC.consumes >(hepMCproductLabel_); - + // Fill the collection tags - const edm::ParameterSet& simHitCollectionConfig=config.getParameterSet("simHitCollections"); - std::vector parameterNames=simHitCollectionConfig.getParameterNames(); - - for( const auto& parameterName : parameterNames ) - { - std::vector tags=simHitCollectionConfig.getParameter >(parameterName); - collectionTags_.insert(collectionTags_.end(), tags.begin(), tags.end()); - } - - for( const auto& collectionTag : collectionTags_ ) { + const edm::ParameterSet& simHitCollectionConfig = config.getParameterSet("simHitCollections"); + std::vector parameterNames = simHitCollectionConfig.getParameterNames(); + + for (auto const& parameterName : parameterNames) { + std::vector tags = + simHitCollectionConfig.getParameter >(parameterName); + collectionTags_.insert(collectionTags_.end(), tags.begin(), tags.end()); + } + + for (auto const& collectionTag : collectionTags_) { iC.consumes >(collectionTag); } } -void CaloTruthAccumulator::beginLuminosityBlock( edm::LuminosityBlock const& iLumiBlock, const edm::EventSetup& iSetup ) { +void CaloTruthAccumulator::beginLuminosityBlock(edm::LuminosityBlock const& iLumiBlock, + const edm::EventSetup& iSetup) { edm::ESHandle geom; iSetup.get().get(geom); const HGCalGeometry *eegeom, *fhgeom; - const HcalGeometry *bhgeom; + const HcalGeometry* bhgeom; - eegeom = dynamic_cast(geom->getSubdetectorGeometry(DetId::Forward,HGCEE)); - fhgeom = dynamic_cast(geom->getSubdetectorGeometry(DetId::Forward,HGCHEF)); - bhgeom = dynamic_cast(geom->getSubdetectorGeometry(DetId::Hcal,HcalEndcap)); + eegeom = static_cast(geom->getSubdetectorGeometry(DetId::Forward, HGCEE)); + fhgeom = static_cast(geom->getSubdetectorGeometry(DetId::Forward, HGCHEF)); + bhgeom = static_cast(geom->getSubdetectorGeometry(DetId::Hcal, HcalEndcap)); hgtopo_[0] = &(eegeom->topology()); hgtopo_[1] = &(fhgeom->topology()); - for( unsigned i = 0; i < 2; ++i ) { + for (unsigned i = 0; i < 2; ++i) { hgddd_[i] = &(hgtopo_[i]->dddConstants()); } - - hcddd_ = bhgeom->topology().dddConstants(); - caloStartZ = hgddd_[0]->waferZ(1,false)*10.0; // get the location of the first plane of silicon, put in mm + hcddd_ = bhgeom->topology().dddConstants(); } -void CaloTruthAccumulator::initializeEvent( edm::Event const& event, edm::EventSetup const& setup ) -{ - output_.pSimClusters.reset( new SimClusterCollection() ); - output_.pCaloParticles.reset( new CaloParticleCollection() ); +void CaloTruthAccumulator::initializeEvent(edm::Event const& event, + edm::EventSetup const& setup) { + output_.pSimClusters.reset(new SimClusterCollection()); + output_.pCaloParticles.reset(new CaloParticleCollection()); - m_detIdToCluster.clear(); m_detIdToTotalSimEnergy.clear(); } -/// create handle to edm::HepMCProduct here because event.getByLabel with edm::HepMCProduct only works for edm::Event -/// but not for PileUpEventPrincipal; PileUpEventPrincipal::getByLabel tries to call T::value_type and T::iterator -/// (where T is the type of the object one wants to get a handle to) which is only implemented for container-like objects -/// like std::vector but not for edm::HepMCProduct! - -void CaloTruthAccumulator::accumulate( edm::Event const& event, edm::EventSetup const& setup ) { - // Call the templated version that does the same for both signal and pileup events - - edm::Handle< edm::HepMCProduct > hepmc; +/** Create handle to edm::HepMCProduct here because event.getByLabel with + edm::HepMCProduct only works for edm::Event but not for + PileUpEventPrincipal; PileUpEventPrincipal::getByLabel tries to call + T::value_type and T::iterator (where T is the type of the object one wants + to get a handle to) which is only implemented for container-like objects + like std::vector but not for edm::HepMCProduct! +*/ +void CaloTruthAccumulator::accumulate(edm::Event const& event, + edm::EventSetup const& setup) { + edm::Handle hepmc; event.getByLabel(hepMCproductLabel_, hepmc); - + edm::LogInfo(messageCategory_) << " CaloTruthAccumulator::accumulate (signal)"; - accumulateEvent( event, setup, hepmc ); + accumulateEvent(event, setup, hepmc); } -void CaloTruthAccumulator::accumulate( PileUpEventPrincipal const& event, edm::EventSetup const& setup, edm::StreamID const& ) { - // If this bunch crossing is outside the user configured limit, don't do anything. - if( event.bunchCrossing()>=-static_cast(maximumPreviousBunchCrossing_) && event.bunchCrossing()<=static_cast(maximumSubsequentBunchCrossing_) ) - { - //edm::LogInfo(messageCategory_) << "Analysing pileup event for bunch crossing " << event.bunchCrossing(); - - //simply create empty handle as we do not have a HepMCProduct in PU anyway - edm::Handle< edm::HepMCProduct > hepmc; - edm::LogInfo(messageCategory_) << " CaloTruthAccumulator::accumulate (pileup) bunchCrossing=" << event.bunchCrossing(); - accumulateEvent( event, setup, hepmc ); - } - else edm::LogInfo(messageCategory_) << "Skipping pileup event for bunch crossing " << event.bunchCrossing(); +void CaloTruthAccumulator::accumulate(PileUpEventPrincipal const& event, + edm::EventSetup const& setup, edm::StreamID const&) { + if (event.bunchCrossing() >= -static_cast(maximumPreviousBunchCrossing_) && + event.bunchCrossing() <= static_cast(maximumSubsequentBunchCrossing_)) { + // simply create empty handle as we do not have a HepMCProduct in PU anyway + edm::Handle hepmc; + edm::LogInfo(messageCategory_) + << " CaloTruthAccumulator::accumulate (pileup) bunchCrossing=" + << event.bunchCrossing(); + accumulateEvent(event, setup, hepmc); + } else { + edm::LogInfo(messageCategory_) + << "Skipping pileup event for bunch crossing " << event.bunchCrossing(); + } } -void CaloTruthAccumulator::finalizeEvent( edm::Event& event, edm::EventSetup const& setup ) { - edm::LogInfo("CaloTruthAccumulator") << "Adding " << output_.pSimClusters->size() - << " SimParticles and " << output_.pCaloParticles->size() - << " CaloParticles to the event."; +void CaloTruthAccumulator::finalizeEvent(edm::Event& event, edm::EventSetup const& setup) { + edm::LogInfo(messageCategory_) << "Adding " << output_.pSimClusters->size() + << " SimParticles and " << output_.pCaloParticles->size() + << " CaloParticles to the event."; - // now we need to normalize the hits and energies into hits and fractions - // (since we have looped over all pileup events) + // We need to normalize the hits and energies into hits and fractions (since + // we have looped over all pileup events) - for( auto& sc : *(output_.pSimClusters) ) { + for (auto& sc : *(output_.pSimClusters)) { auto hitsAndEnergies = sc.hits_and_fractions(); sc.clearHitsAndFractions(); - for( auto& hAndE : hitsAndEnergies ) { + for (auto& hAndE : hitsAndEnergies) { const float totalenergy = m_detIdToTotalSimEnergy[hAndE.first]; float fraction = 0.; - if(totalenergy>0) fraction = hAndE.second/totalenergy; - else edm::LogWarning("CaloTruthAccumulator") << "TotalSimEnergy for hit " << hAndE.first << " is 0! The fraction for this hit cannot be computed."; - sc.addRecHitAndFraction(hAndE.first,fraction); + if (totalenergy > 0) + fraction = hAndE.second / totalenergy; + else + edm::LogWarning(messageCategory_) << "TotalSimEnergy for hit " << hAndE.first + << " is 0! The fraction for this hit cannot be computed."; + sc.addRecHitAndFraction(hAndE.first, fraction); } } - + // save the SimCluster orphan handle so we can fill the calo particles - auto scHandle = event.put( std::move(output_.pSimClusters), "MergedCaloTruth" ); - + auto scHandle = event.put(std::move(output_.pSimClusters), "MergedCaloTruth"); + // now fill the calo particles - for( unsigned i = 0; i < output_.pCaloParticles->size(); ++i ) { + for (unsigned i = 0; i < output_.pCaloParticles->size(); ++i) { auto& cp = (*output_.pCaloParticles)[i]; - for( unsigned j = m_caloParticles.sc_start_[i]; j < m_caloParticles.sc_stop_[i]; ++j ) { - edm::Ref ref(scHandle,j); + for (unsigned j = m_caloParticles.sc_start_[i]; j < m_caloParticles.sc_stop_[i]; ++j) { + edm::Ref ref(scHandle, j); cp.addSimCluster(ref); } - } + } - event.put( std::move(output_.pCaloParticles), "MergedCaloTruth" ); + event.put(std::move(output_.pCaloParticles), "MergedCaloTruth"); calo_particles().swap(m_caloParticles); - std::unordered_map().swap(m_detIdToTotalSimEnergy); - - std::unordered_map().swap(m_genParticleBarcodeToIndex); - std::unordered_map().swap(m_simTrackBarcodeToIndex); - std::unordered_map().swap(m_genBarcodeToSimTrackIndex); - std::unordered_map().swap(m_simVertexBarcodeToIndex); - - std::unordered_multimap().swap(m_detIdToCluster); - std::unordered_multimap().swap(m_simHitBarcodeToIndex); - std::unordered_multimap().swap(m_simVertexBarcodeToSimTrackBarcode); - std::unordered_map().swap(m_simTrackBarcodeToSimVertexParentBarcode); - std::unordered_multimap().swap(m_simTrackToSimVertex); - std::unordered_multimap().swap(m_simVertexToSimTrackParent); - std::vector().swap(m_simVertexBarcodes); - std::unordered_map().swap(m_detIdToTotalSimEnergy); + std::unordered_map().swap(m_detIdToTotalSimEnergy); + std::unordered_multimap().swap(m_simHitBarcodeToIndex); } -template -void CaloTruthAccumulator::accumulateEvent( const T& event, - const edm::EventSetup& setup, - const edm::Handle< edm::HepMCProduct >& hepMCproduct) { - // - // Get the collections - // - - edm::Handle< std::vector > hGenParticles; - edm::Handle< std::vector > hGenParticleIndices; - - event.getByLabel( simTrackLabel_, hSimTracks ); - event.getByLabel( simVertexLabel_, hSimVertices ); - - event.getByLabel( genParticleLabel_, hGenParticles ); - event.getByLabel( genParticleLabel_, hGenParticleIndices ); - - std::vector > simHitPointers; - fillSimHits( simHitPointers, event, setup ); - +template +void CaloTruthAccumulator::accumulateEvent( + const T& event, const edm::EventSetup& setup, + const edm::Handle& hepMCproduct) { + + edm::Handle > hGenParticles; + edm::Handle > hGenParticleIndices; + + event.getByLabel(simTrackLabel_, hSimTracks); + event.getByLabel(simVertexLabel_, hSimVertices); + + event.getByLabel(genParticleLabel_, hGenParticles); + event.getByLabel(genParticleLabel_, hGenParticleIndices); + + std::vector > simHitPointers; + std::unordered_map > simTrackDetIdEnergyMap; + fillSimHits(simHitPointers, simTrackDetIdEnergyMap, event, setup); + // Clear maps from previous event fill them for this one m_simHitBarcodeToIndex.clear(); - m_simTracksConsideredForSimClusters.clear(); - for (unsigned int i = 0 ; i < simHitPointers.size(); ++i) { - m_simHitBarcodeToIndex.emplace(simHitPointers[i].second->geantTrackId(),i); - } - m_genParticleBarcodeToIndex.clear(); - if( hGenParticles.isValid() && hGenParticleIndices.isValid() ) { - for (unsigned int i = 0 ; i < hGenParticles->size() ; ++i) { - m_genParticleBarcodeToIndex.emplace(hGenParticleIndices->at(i),i); - } - } - m_genBarcodeToSimTrackIndex.clear(); - m_simVertexBarcodeToSimTrackBarcode.clear(); - m_simTrackBarcodeToSimVertexParentBarcode.clear(); - m_simTrackBarcodeToIndex.clear(); - for (unsigned int i = 0 ; i < hSimTracks->size() ; i++) { - if( !hSimTracks->at(i).noGenpart() ) { - m_genBarcodeToSimTrackIndex.emplace(hSimTracks->at(i).genpartIndex(), i); - } - if( !hSimTracks->at(i).noVertex() ) { - m_simVertexBarcodeToSimTrackBarcode.emplace(hSimTracks->at(i).vertIndex(), hSimTracks->at(i).trackId()); - m_simTrackBarcodeToSimVertexParentBarcode.emplace(hSimTracks->at(i).trackId(), hSimTracks->at(i).vertIndex()); - } - m_simTrackBarcodeToIndex.emplace(hSimTracks->at(i).trackId(), i); - } - m_simVertexBarcodes.clear(); - m_simVertexBarcodeToIndex.clear(); - m_simTrackToSimVertex.clear(); - m_simVertexToSimTrackParent.clear(); - for (unsigned int i = 0 ; i < hSimVertices->size() ; i++) { - m_simVertexBarcodes.push_back(i); - m_simVertexBarcodeToIndex.emplace(hSimVertices->at(i).vertexId(), i); - if (!hSimVertices->at(i).noParent()) { - m_simTrackToSimVertex.emplace(hSimVertices->at(i).parentIndex(), i); - m_simVertexToSimTrackParent.emplace( hSimVertices->at(i).vertexId(), hSimVertices->at(i).parentIndex() ); - } - } - - std::vector tracksToBecomeClustersInitial; - std::vector descendantTracks; - SimClusterCollection simClustersForGenParts; - std::vector > hitInfoList; - std::vector > simClusterPrimitives; - std::unordered_multimap genPartsToSimClusters; - const auto& simTracks = *hSimTracks; - // loop over - for (unsigned int i = 0 ; i < simTracks.size() ; ++i) { - if ( simTracks[i].momentum().E() < minEnergy_ || std::abs(simTracks[i].momentum().Eta()) >= maxPseudoRapidity_ ) continue; - if ( simTracks[i].noGenpart() ) continue; - auto temp = CaloTruthAccumulator::descendantSimClusters( simTracks[i].trackId(),simHitPointers ); - if( !temp.empty() ) { - output_.pCaloParticles->emplace_back(simTracks[i]); - m_caloParticles.sc_start_.push_back(output_.pSimClusters->size()); - auto mbegin = std::make_move_iterator(temp.begin()); - auto mend = std::make_move_iterator(temp.end()); - output_.pSimClusters->insert(output_.pSimClusters->end(), mbegin, mend); - m_caloParticles.sc_stop_.push_back(output_.pSimClusters->size()); - } - } -} - -std::vector CaloTruthAccumulator::descendantTrackBarcodes( Barcode_t barcode ) { - std::vector result; - if (m_simTrackToSimVertex.count(barcode)) { - auto vertex_range = m_simTrackToSimVertex.equal_range(barcode); - for ( auto vertex_iter = vertex_range.first ; vertex_iter != vertex_range.second ; vertex_iter++ ) { - Index_t decayVertexIndex = vertex_iter->second; - Barcode_t decayVertexBarcode = m_simVertexBarcodes[decayVertexIndex]; - auto track_range = m_simVertexBarcodeToSimTrackBarcode.equal_range( decayVertexBarcode ); - for ( auto track_iter = track_range.first ; track_iter != track_range.second ; track_iter++ ) { - result.push_back( track_iter->second ); - std::vector daughter_result = CaloTruthAccumulator::descendantTrackBarcodes( track_iter->second ); - result.insert(result.end(),daughter_result.begin(),daughter_result.end()); - } - } + for (unsigned int i = 0; i < simHitPointers.size(); ++i) { + m_simHitBarcodeToIndex.emplace(simHitPointers[i].second->geantTrackId(), i); } - return result; -} -SimClusterCollection CaloTruthAccumulator::descendantSimClusters( Barcode_t barcode, const std::vector >& hits ) { - SimClusterCollection result; - const auto& simTracks = *hSimTracks; - if ( CaloTruthAccumulator::consideredBarcode( barcode ) ) { - LogDebug("CaloParticles") << "SCZ DEBUG Ignoring descendantSimClusters call because this particle is already marked used: " << barcode << std::endl; - //return result; + auto const& tracks = *hSimTracks; + auto const& vertices = *hSimVertices; + std::unordered_map trackid_to_track_index; + DecayChain decay; + int idx = 0; + + IfLogDebug(DEBUG, messageCategory_) << " TRACKS" << std::endl; + for (auto const& t : tracks) { + IfLogDebug(DEBUG, messageCategory_) + << " " << idx << "\t" << t.trackId() << "\t" << t << std::endl; + trackid_to_track_index[t.trackId()] = idx; + idx++; } - std::unique_ptr hit_info = CaloTruthAccumulator::attachedSimHitInfo(barcode,hits, true, false, false); - //std::unique_ptr inclusive_hit_info = std::move(CaloTruthAccumulator::allAttachedSimHitInfo(barcode,hits, false) ); - - const auto& simTrack = simTracks[m_simTrackBarcodeToIndex[barcode]]; - Barcode_t vtxBarcode = m_simTrackBarcodeToSimVertexParentBarcode[barcode]; - const auto& vtx = hSimVertices->at(m_simVertexBarcodeToIndex[vtxBarcode]); - const bool isInCalo = (std::abs(vtx.position().z()) > caloStartZ - 30.0); // add a buffer region in front of the calo face - - if (!hit_info->empty()) { - // define the sim cluster starting from the earliest particle that has hits in the calorimeter - // grab everything that descends from it - std::unique_ptr marked_hit_info; - - - if( isInCalo ) { - marked_hit_info = CaloTruthAccumulator::allAttachedSimHitInfo(barcode,hits,true) ; - } else { - marked_hit_info = CaloTruthAccumulator::attachedSimHitInfo(barcode,hits,true,false,true) ; - } - - if( !marked_hit_info->empty() ) { - result.emplace_back(simTrack); - auto& simcluster = result.back(); - - std::unordered_map acc_energy; - - for( const auto& hit_and_energy : *marked_hit_info ) { - const uint32_t id = hit_and_energy.first.rawId(); - if( acc_energy.count(id) ) acc_energy[id] += hit_and_energy.second; - else acc_energy[id] = hit_and_energy.second; - } - - for( const auto& hit_and_energy : acc_energy ) { - simcluster.addRecHitAndFraction(hit_and_energy.first,hit_and_energy.second); - } - } - } - - if ( m_simTrackToSimVertex.count(barcode) ) { - auto vertex_range = m_simTrackToSimVertex.equal_range(barcode); - for ( auto vertex_iter = vertex_range.first ; vertex_iter != vertex_range.second ; vertex_iter++ ) { - Index_t decayVertexIndex = vertex_iter->second; - Barcode_t decayVertexBarcode = m_simVertexBarcodes[decayVertexIndex]; - auto track_range = m_simVertexBarcodeToSimTrackBarcode.equal_range( decayVertexBarcode ); - for ( auto track_iter = track_range.first ; track_iter != track_range.second ; track_iter++ ) { - - auto daughter_result = CaloTruthAccumulator::descendantSimClusters(track_iter->second,hits); - result.insert(result.end(),daughter_result.begin(),daughter_result.end()); + /** + Build the main decay graph and assign the SimTrack to each edge. The graph + built here will only contain the particles that have a decay vertex + associated to them. In order to recover also the particles that will not + decay, we need to keep track of the SimTrack used here and add, a-posteriori, + the ones not used, associating a ghost vertex (starting from the highest + simulated vertex number), in order to build the edge and identify them + immediately as stable (i.e. not decayed). + + To take into account the multi-bremsstrahlung effects in which a single + particle is emitting photons in different vertices **keeping the same + track index**, we also collapsed those vertices into 1 unique vertex. The + other approach of fully representing the decay chain keeping the same + track index would have the problem of over-counting the contributions of + that track, especially in terms of hits. + + The 2 auxiliary vectors are structured as follow: + + 1. used_sim_tracks is a vector that has the same size as the overall + number of simulated tracks. The associated integer is the vertexId of + the **decaying vertex for that track**. + 2. collapsed_vertices is a vector that has the same size as the overall + number of simulated vertices. The vector's index is the vertexId + itself, the associated value is the vertexId of the vertex on which + this should collapse. + */ + idx = 0; + std::vector used_sim_tracks(tracks.size(), 0); + std::vector collapsed_vertices(vertices.size(), 0); + IfLogDebug(DEBUG, messageCategory_) << " VERTICES" << std::endl; + for (auto const& v : vertices) { + IfLogDebug(DEBUG, messageCategory_) << " " << idx++ << "\t" << v << std::endl; + if (v.parentIndex() != -1) { + auto trk_idx = trackid_to_track_index[v.parentIndex()]; + auto origin_vtx = tracks[trk_idx].vertIndex(); + if (used_sim_tracks[trk_idx]) { + // collapse the vertex into the original first vertex we saw associated + // to this track. Omit adding the edge in order to avoid double + // counting of the very same particles and its associated hits. + collapsed_vertices[v.vertexId()] = used_sim_tracks[trk_idx]; + continue; } + // Perform the actual vertex collapsing, if needed. + if (collapsed_vertices[origin_vtx]) origin_vtx = collapsed_vertices[origin_vtx]; + add_edge(origin_vtx, v.vertexId(), + EdgeProperty(&tracks[trk_idx], simTrackDetIdEnergyMap[v.parentIndex()].size(), 0), + decay); + used_sim_tracks[trk_idx] = v.vertexId(); } } - - return result; -} - -std::unique_ptr CaloTruthAccumulator::attachedSimHitInfo( Barcode_t barcode , const std::vector >& hits, - bool includeOwn , bool includeOther, bool markUsed ) { - const auto& simTracks = *hSimTracks; - std::unique_ptr result(new SimHitInfoPerSimTrack_t); - - const auto& simTrack = simTracks[m_simTrackBarcodeToIndex[barcode]]; - - if ( markUsed ) { - if ( CaloTruthAccumulator::consideredBarcode( barcode ) ) { - return result; + // Build the motherParticle property to each vertex + auto const& vertexMothersProp = get(vertex_name, decay); + // Now recover the particles that did not decay. Append them with an index + // bigger than the size of the generated vertices. + int offset = vertices.size(); + for (size_t i = 0; i < tracks.size(); ++i) { + if (!used_sim_tracks[i]) { + auto origin_vtx = tracks[i].vertIndex(); + // Perform the actual vertex collapsing, if needed. + if (collapsed_vertices[origin_vtx]) origin_vtx = collapsed_vertices[origin_vtx]; + add_edge(origin_vtx, offset, + EdgeProperty(&tracks[i], simTrackDetIdEnergyMap[tracks[i].trackId()].size(), 0), + decay); + // The properties for "fake" vertices associated to stable particles have + // to be set inside this loop, since they do not belong to the vertices + // collection and would be skipped by that loop (coming next) + put(vertexMothersProp, offset, VertexProperty(&tracks[i], 0)); + offset++; } - CaloTruthAccumulator::setConsideredBarcode( barcode ); } - if (includeOwn) { - auto range = m_simHitBarcodeToIndex.equal_range( barcode ); - unsigned n = 0; - for ( auto iter = range.first ; iter != range.second ; iter++ ) { - const auto& the_hit = hits[iter->second]; - result->emplace_back(the_hit.first,the_hit.second->energy()); - ++n; - } - } - - // need to sim to the next sim track if we explicitly ask or - // if we are in the calorimeter next (no interaction) - // or if this is a continuation of the same particle - if (m_simTrackToSimVertex.count(barcode)) { - auto vertex_range = m_simTrackToSimVertex.equal_range(barcode); - for ( auto vertex_iter = vertex_range.first ; vertex_iter != vertex_range.second ; vertex_iter++ ) { - Index_t decayVertexIndex = vertex_iter->second; - const auto& nextVtx = (*hSimVertices)[decayVertexIndex]; - const bool nextInCalo = (std::abs(nextVtx.position().z()) > caloStartZ*0.1 - 20.0); // add a buffer region in front of the calo face - - Barcode_t decayVertexBarcode = m_simVertexBarcodes[decayVertexIndex]; - auto track_range = m_simVertexBarcodeToSimTrackBarcode.equal_range( decayVertexBarcode ); - for ( auto track_iter = track_range.first ; track_iter != track_range.second ; track_iter++ ) { - if( !barcodeLogicWarningAlready_ && track_iter->second < barcode ) { - barcodeLogicWarningAlready_ = true; - edm::LogWarning(messageCategory_) << " Daughter particle has a lower barcode than parent. This may screw up the logic!" << std::endl; - } - const auto& daughter = simTracks[m_simTrackBarcodeToIndex[track_iter->second]]; - - if( includeOther || nextInCalo ) { - std::unique_ptr daughter_result = CaloTruthAccumulator::allAttachedSimHitInfo(track_iter->second,hits,markUsed); - result->insert(result->end(),daughter_result->begin(),daughter_result->end()); - } else if ( daughter.type() == simTrack.type() ) { - std::unique_ptr daughter_result = CaloTruthAccumulator::attachedSimHitInfo(track_iter->second,hits,includeOwn, includeOther, markUsed); - result->insert(result->end(),daughter_result->begin(),daughter_result->end()); - } - } - } + for (auto const& v : vertices) { + if (v.parentIndex() != -1) { + // Skip collapsed_vertices + if (collapsed_vertices[v.vertexId()]) continue; + put(vertexMothersProp, v.vertexId(), + VertexProperty(&tracks[trackid_to_track_index[v.parentIndex()]], 0)); } - return result; -} - -std::unique_ptr -CaloTruthAccumulator::descendantOnlySimHitInfo( Barcode_t barcode, - const std::vector >& hits, - bool markUsed) { - return CaloTruthAccumulator::attachedSimHitInfo(barcode,hits,false,true,markUsed); -} - -std::unique_ptr -CaloTruthAccumulator::allAttachedSimHitInfo( Barcode_t barcode, - const std::vector >& hits, - bool markUsed ) { - return CaloTruthAccumulator::attachedSimHitInfo(barcode,hits,true,true,markUsed); + } + SimHitsAccumulator_dfs_visitor vis; + depth_first_search(decay, visitor(vis)); + CaloParticle_dfs_visitor caloParticleCreator( + output_, m_caloParticles, m_simHitBarcodeToIndex, simTrackDetIdEnergyMap, + [&](EdgeProperty& edge_property) -> bool { + // Apply selection on SimTracks in order to promote them to be CaloParticles. + // The function returns TRUE if the particle satisfies the selection, FALSE otherwise. + // Therefore the correct logic to select the particle is to ask for TRUE as return value. + return (edge_property.cumulative_simHits != 0 and !edge_property.simTrack->noGenpart() and + edge_property.simTrack->momentum().E() > minEnergy_ and + std::abs(edge_property.simTrack->momentum().Eta()) < maxPseudoRapidity_); + }); + depth_first_search(decay, visitor(caloParticleCreator)); + +#if DEBUG + boost::write_graphviz(std::cout, decay, make_label_writer(make_transform_value_property_map( + &graphviz_vertex, get(vertex_name, decay))), + make_label_writer(make_transform_value_property_map( + &graphviz_edge, get(edge_weight, decay)))); +#endif } -template void CaloTruthAccumulator::fillSimHits( std::vector >& returnValue, const T& event, const edm::EventSetup& setup ) { - // loop over the collections - for( const auto& collectionTag : collectionTags_ ) { - edm::Handle< std::vector > hSimHits; - const bool isHcal = ( collectionTag.instance().find("HcalHits") != std::string::npos ); - event.getByLabel( collectionTag, hSimHits ); - for( const auto& simHit : *hSimHits ) { +template +void CaloTruthAccumulator::fillSimHits( + std::vector >& returnValue, + std::unordered_map >& simTrackDetIdEnergyMap, const T& event, + const edm::EventSetup& setup) { + for (auto const& collectionTag : collectionTags_) { + edm::Handle > hSimHits; + const bool isHcal = (collectionTag.instance().find("HcalHits") != std::string::npos); + event.getByLabel(collectionTag, hSimHits); + for (auto const& simHit : *hSimHits) { DetId id(0); const uint32_t simId = simHit.id(); - if( isHcal ) { + if (isHcal) { HcalDetId hid = HcalHitRelabeller::relabel(simId, hcddd_); - if(hid.subdet()==HcalEndcap) id = hid; + if (hid.subdet() == HcalEndcap) id = hid; } else { - int subdet, layer, cell, sec, subsec, zp; - HGCalTestNumbering::unpackHexagonIndex(simId, subdet, zp, layer, sec, subsec, cell); - const HGCalDDDConstants* ddd = hgddd_[subdet-3]; - std::pair recoLayerCell = ddd->simToReco(cell,layer,sec, - hgtopo_[subdet-3]->detectorType()); - cell = recoLayerCell.first; - layer = recoLayerCell.second; - // skip simhits with bad barcodes or non-existant layers - if( layer == -1 || simHit.geantTrackId() == 0 ) continue; - id = HGCalDetId((ForwardSubdetector)subdet,zp,layer,subsec,sec,cell); + int subdet, layer, cell, sec, subsec, zp; + HGCalTestNumbering::unpackHexagonIndex(simId, subdet, zp, layer, sec, subsec, cell); + const HGCalDDDConstants* ddd = hgddd_[subdet - 3]; + std::pair recoLayerCell = + ddd->simToReco(cell, layer, sec, hgtopo_[subdet - 3]->detectorType()); + cell = recoLayerCell.first; + layer = recoLayerCell.second; + // skip simhits with bad barcodes or non-existant layers + if (layer == -1 || simHit.geantTrackId() == 0) continue; + id = HGCalDetId((ForwardSubdetector)subdet, zp, layer, subsec, sec, cell); } - if( DetId(0) == id ) continue; - + if (DetId(0) == id) continue; + uint32_t detId = id.rawId(); returnValue.emplace_back(id, &simHit); - - if( m_detIdToTotalSimEnergy.count(detId) ) m_detIdToTotalSimEnergy[detId] += simHit.energy(); - else m_detIdToTotalSimEnergy[detId] = simHit.energy(); + simTrackDetIdEnergyMap[simHit.geantTrackId()][id.rawId()] += simHit.energy(); + + m_detIdToTotalSimEnergy[detId] += simHit.energy(); } - } // end of loop over InputTags + } // end of loop over InputTags } // Register with the framework -DEFINE_DIGI_ACCUMULATOR (CaloTruthAccumulator); +DEFINE_DIGI_ACCUMULATOR(CaloTruthAccumulator); diff --git a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.h b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.h deleted file mode 100644 index 300f809cdd1c3..0000000000000 --- a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.h +++ /dev/null @@ -1,174 +0,0 @@ -#ifndef CaloAnalysis_CaloTruthAccumulator_h -#define CaloAnalysis_CaloTruthAccumulator_h - -#include "SimGeneral/MixingModule/interface/DigiAccumulatorMixMod.h" -#include // required for std::auto_ptr -#include "SimDataFormats/CaloAnalysis/interface/CaloParticleFwd.h" -#include "SimDataFormats/CaloAnalysis/interface/SimClusterFwd.h" -#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" - -#include -#include "DataFormats/ForwardDetId/interface/HGCalDetId.h" -#include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" -#include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Utilities/interface/InputTag.h" - -typedef unsigned Index_t; -typedef int Barcode_t; -typedef std::pair IndexPair_t; -typedef std::pair SimHitInfo_t; -typedef std::pair BarcodeIndexPair_t; -typedef std::pair BarcodePair_t; -typedef std::pair SimHitInfoPerRecoDetId_t; -typedef std::vector SimHitInfoPerSimTrack_t; - - -// typedef uint32_t RecoDetId_t; - -// Forward declarations -namespace edm { - class ParameterSet; - class ConsumesCollector; - class ProducerBase; - class Event; - class EventSetup; - class StreamID; -} -class PileUpEventPrincipal; -class PCaloHit; -class SimTrack; -class SimVertex; - -class CaloTruthAccumulator : public DigiAccumulatorMixMod { - public: - explicit CaloTruthAccumulator( const edm::ParameterSet& config, edm::ProducerBase& mixMod, edm::ConsumesCollector& iC); - private: - void initializeEvent( const edm::Event& event, const edm::EventSetup& setup ) override; - void accumulate( const edm::Event& event, const edm::EventSetup& setup ) override; - void accumulate( const PileUpEventPrincipal& event, const edm::EventSetup& setup, edm::StreamID const& ) override; - void finalizeEvent( edm::Event& event, const edm::EventSetup& setup ) override; - void beginLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const& setup) override; - - /** @brief Both forms of accumulate() delegate to this templated method. */ - template void accumulateEvent( const T& event, const edm::EventSetup& setup, const edm::Handle< edm::HepMCProduct >& hepMCproduct ); - - /** @brief Fills the supplied vector with pointers to the SimHits, checking for bad modules if required */ - template void fillSimHits( std::vector > & returnValue, const T& event, const edm::EventSetup& setup ); - - std::vector descendantTrackBarcodes( Barcode_t barcode ); - std::unique_ptr attachedSimHitInfo( Barcode_t st, const std::vector > & hits, - bool includeOwn = true, bool includeOther = false, bool markUsed = false); - std::unique_ptr descendantOnlySimHitInfo( Barcode_t st, const std::vector > & hits, bool markUsed = false); - std::unique_ptr allAttachedSimHitInfo( Barcode_t st, const std::vector > & hits, bool markUsed = false); - - SimClusterCollection descendantSimClusters( Barcode_t barcode, const std::vector > & hits ); - std::set m_simTracksConsideredForSimClusters; - void setConsideredBarcode( Barcode_t barcode ) { m_simTracksConsideredForSimClusters.insert( barcode ); } - bool consideredBarcode( Barcode_t barcode ) { - // return (std::find(m_simTracksConsideredForSimClusters.begin(), m_simTracksConsideredForSimClusters.end(), barcode) != m_simTracksConsideredForSimClusters.end()); - return m_simTracksConsideredForSimClusters.count( barcode ); - } - - const std::string messageCategory_; ///< The message category used to send messages to MessageLogger - - struct calo_particles { - std::vector sc_start_; - std::vector sc_stop_; - - void swap(calo_particles& oth) { - sc_start_.swap(oth.sc_start_); - sc_stop_.swap(oth.sc_stop_); - } - - void clear() { - sc_start_.clear(); - sc_stop_.clear(); - } - }; - - calo_particles m_caloParticles; - double caloStartZ; - - std::unordered_map m_detIdToTotalSimEnergy; // keep track of cell normalizations - std::unordered_map m_genParticleBarcodeToIndex; - std::unordered_map m_simTrackBarcodeToIndex; - std::unordered_map m_genBarcodeToSimTrackIndex; - std::unordered_map m_simVertexBarcodeToIndex; - std::unordered_multimap m_detIdToCluster; - std::unordered_multimap m_simHitBarcodeToIndex; - std::unordered_multimap m_simVertexBarcodeToSimTrackBarcode; - std::unordered_map m_simTrackBarcodeToSimVertexParentBarcode; - std::unordered_multimap m_simTrackToSimVertex; - std::unordered_multimap m_simVertexToSimTrackParent; - // std::unordered_multimap m_recoDetIdToSimHits; - - std::vector m_simVertexBarcodes; - - // const double volumeRadius_; - // const double volumeZ_; - /// maximum distance for HepMC::GenVertex to be added to SimVertex - // const double vertexDistanceCut_; - // const bool ignoreTracksOutsideVolume_; - - /** The maximum bunch crossing BEFORE the signal crossing to create TrackinParticles for. Use positive values. If set to zero no - * previous bunches are added and only in-time, signal and after bunches (defined by maximumSubsequentBunchCrossing_) are used.*/ - const unsigned int maximumPreviousBunchCrossing_; - /** The maximum bunch crossing AFTER the signal crossing to create TrackinParticles for. E.g. if set to zero only - * uses the signal and in time pileup (and previous bunches defined by the maximumPreviousBunchCrossing_ parameter). */ - const unsigned int maximumSubsequentBunchCrossing_; - /// If bremsstrahlung merging, whether to also add the unmerged collection to the event or not. - // const bool createUnmergedCollection_; - // const bool createMergedCollection_; - /// Whether or not to create a separate collection for just the initial interaction vertices - // const bool createInitialVertexCollection_; - /// Whether or not to add the full parentage of any TrackingParticle that is inserted in the collection. - // const bool addAncestors_; - - const edm::InputTag simTrackLabel_; - const edm::InputTag simVertexLabel_; - edm::Handle > hSimTracks; - edm::Handle > hSimVertices; - - std::vector collectionTags_; - edm::InputTag genParticleLabel_; - /// Needed to add HepMC::GenVertex to SimVertex - edm::InputTag hepMCproductLabel_; - - const double minEnergy_, maxPseudoRapidity_; - - bool selectorFlag_; - /// Uses the same config as selector_, but can be used to drop out early since selector_ requires the TrackingParticle to be created first. - bool chargedOnly_; - /// Uses the same config as selector_, but can be used to drop out early since selector_ requires the TrackingParticle to be created first. - bool signalOnly_; - - bool barcodeLogicWarningAlready_; - - /** @brief When counting hits, allows hits in different detectors to have a different process type. - * - * Fast sim PCaloHits seem to have a peculiarity where the process type (as reported by PCaloHit::processType()) is - * different for the tracker than the muons. When counting how many hits there are, the code usually only counts - * the number of hits that have the same process type as the first hit. Setting this to true will also count hits - * that have the same process type as the first hit in the second detector.
- */ - // bool allowDifferentProcessTypeForDifferentDetectors_; - public: - // These always go hand in hand, and I need to pass them around in the internal - // functions, so I might as well package them up in a struct. - struct OutputCollections - { - std::unique_ptr pSimClusters; - std::unique_ptr pCaloParticles; - // std::auto_ptr pTrackingVertices; - // TrackingParticleRefProd refTrackingParticles; - // TrackingVertexRefProd refTrackingVertexes; - }; - private: - const HGCalTopology* hgtopo_[2]; - const HGCalDDDConstants* hgddd_[2]; - const HcalDDDRecConstants* hcddd_; - OutputCollections output_; -}; - -#endif // end of "#ifndef CaloAnalysis_CaloTruthAccumulator_h" diff --git a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc deleted file mode 100644 index a48cac5cdcb88..0000000000000 --- a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulatorWithGraph.cc +++ /dev/null @@ -1,673 +0,0 @@ -// BOOST GRAPH LIBRARY -#include -#include -#include -#define DEBUG false - -#if DEBUG -// boost optional (used by boost graph) results in some false positives with -Wmaybe-uninitialized -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" -#include -#pragma GCC diagnostic pop -#endif - -#include -#include // required for std::auto_ptr -#include // for std::accumulate -#include - -#include "FWCore/Framework/interface/ConsumesCollector.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/InputTag.h" - -#include "DataFormats/ForwardDetId/interface/HGCalDetId.h" -#include "DataFormats/HcalDetId/interface/HcalDetId.h" -#include "DataFormats/HcalDetId/interface/HcalTestNumbering.h" -#include "DataFormats/HepMCCandidate/interface/GenParticle.h" -#include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" -#include "DataFormats/SiStripDetId/interface/StripSubdetector.h" - -#include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" -#include "SimDataFormats/CaloAnalysis/interface/CaloParticleFwd.h" -#include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" -#include "SimDataFormats/CaloAnalysis/interface/SimClusterFwd.h" -#include "SimDataFormats/CaloHit/interface/PCaloHit.h" -#include "SimDataFormats/CaloTest/interface/HGCalTestNumbering.h" -#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" -#include "SimDataFormats/Vertex/interface/SimVertex.h" - -#include "SimGeneral/MixingModule/interface/DigiAccumulatorMixMod.h" -#include "SimGeneral/MixingModule/interface/DigiAccumulatorMixModFactory.h" -#include "SimGeneral/MixingModule/interface/PileUpEventPrincipal.h" -#include "SimGeneral/TrackingAnalysis/interface/EncodedTruthId.h" - -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" -#include "Geometry/HcalCommonData/interface/HcalHitRelabeller.h" -#include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" - -namespace { -using Index_t = unsigned; -using Barcode_t = int; -} - -using boost::adjacency_list; -using boost::directedS; -using boost::listS; -using boost::vecS; -using boost::property; -using boost::edge; -using boost::edge_weight_t; -using boost::edge_weight; -using boost::add_edge; -using boost::vertex; -using boost::vertex_name_t; -using boost::vertex_name; - -/* GRAPH DEFINITIONS - - The graph represents the full decay chain. - - The parent-child relationship is the natural one, following "time". - - Each edge has a property (edge_weight_t) that holds a const pointer to the - SimTrack that connects the 2 vertices of the edge, the number of simHits - associated to that simTrack and the cumulative number of simHits of itself - and of all its children. Only simHits within the selected detectors are - taken into account. The cumulative property is filled during the dfs - exploration of the graph: if not explored the number is 0. - - Each vertex has a property (vertex_name_t) that holds a const pointer to the - SimTrack that originated that vertex and the cumulative number of simHits of - all its outgoing edges. The cumulative property is filled during the dfs - exploration of the graph: if not explored the number is 0. - - Stable particles are recovered/added in a second iterations and are linked - to ghost vertices with an offset starting from the highest generated vertex. - - Multiple decays of a single particle that retains its original trackId are - merged into one unique vertex (the first encountered) in order to avoid - multiple counting of its associated simHits (if any). - -*/ -struct EdgeProperty { - EdgeProperty(const SimTrack* t, int h, int c) : simTrack(t), simHits(h), cumulative_simHits(c) {} - const SimTrack* simTrack; - int simHits; - int cumulative_simHits; -}; - -struct VertexProperty { - VertexProperty() : simTrack(nullptr), cumulative_simHits(0) {} - VertexProperty(const SimTrack* t, int c) : simTrack(t), cumulative_simHits(c) {} - VertexProperty(const VertexProperty& other) - : simTrack(other.simTrack), cumulative_simHits(other.cumulative_simHits) {} - const SimTrack* simTrack; - int cumulative_simHits; -}; - -using EdgeParticleClustersProperty = property; -using VertexMotherParticleProperty = property; -using DecayChain = adjacency_list; - -class CaloTruthAccumulatorWithGraph : public DigiAccumulatorMixMod { - public: - explicit CaloTruthAccumulatorWithGraph(const edm::ParameterSet& config, - edm::stream::EDProducerBase& mixMod, - edm::ConsumesCollector& iC); - - private: - void initializeEvent(const edm::Event& event, const edm::EventSetup& setup) override; - void accumulate(const edm::Event& event, const edm::EventSetup& setup) override; - void accumulate(const PileUpEventPrincipal& event, const edm::EventSetup& setup, - edm::StreamID const&) override; - void finalizeEvent(edm::Event& event, const edm::EventSetup& setup) override; - void beginLuminosityBlock(edm::LuminosityBlock const& lumi, - edm::EventSetup const& setup) override; - - /** @brief Both forms of accumulate() delegate to this templated method. */ - template - void accumulateEvent(const T& event, const edm::EventSetup& setup, - const edm::Handle& hepMCproduct); - - /** @brief Fills the supplied vector with pointers to the SimHits, checking for bad modules if - * required */ - template - void fillSimHits(std::vector >& returnValue, - std::unordered_map >& simTrackDetIdEnergyMap, - const T& event, const edm::EventSetup& setup); - - const std::string messageCategory_; - - std::unordered_map m_detIdToTotalSimEnergy; // keep track of cell normalizations - std::unordered_multimap m_simHitBarcodeToIndex; - - /** The maximum bunch crossing BEFORE the signal crossing to create - TrackinParticles for. Use positive values. If set to zero no - previous bunches are added and only in-time, signal and after bunches - (defined by maximumSubsequentBunchCrossing_) are used. - */ - const unsigned int maximumPreviousBunchCrossing_; - /** The maximum bunch crossing AFTER the signal crossing to create - TrackinParticles for. E.g. if set to zero only - uses the signal and in time pileup (and previous bunches defined by the - maximumPreviousBunchCrossing_ parameter). - */ - const unsigned int maximumSubsequentBunchCrossing_; - - const edm::InputTag simTrackLabel_; - const edm::InputTag simVertexLabel_; - edm::Handle > hSimTracks; - edm::Handle > hSimVertices; - - std::vector collectionTags_; - edm::InputTag genParticleLabel_; - /// Needed to add HepMC::GenVertex to SimVertex - edm::InputTag hepMCproductLabel_; - - const double minEnergy_, maxPseudoRapidity_; - - public: - struct OutputCollections { - std::unique_ptr pSimClusters; - std::unique_ptr pCaloParticles; - }; - - struct calo_particles { - std::vector sc_start_; - std::vector sc_stop_; - - void swap(calo_particles& oth) { - sc_start_.swap(oth.sc_start_); - sc_stop_.swap(oth.sc_stop_); - } - - void clear() { - sc_start_.clear(); - sc_stop_.clear(); - } - }; - - private: - const HGCalTopology* hgtopo_[2]; - const HGCalDDDConstants* hgddd_[2]; - const HcalDDDRecConstants* hcddd_; - OutputCollections output_; - calo_particles m_caloParticles; -}; - -/* Graph utility functions */ - -namespace { -template -void accumulateSimHits_edge(Edge& e, const Graph& g, Visitor* v) { - auto const edge_property = get(edge_weight, g, e); - v->total_simHits += edge_property.simHits; - IfLogDebug(DEBUG, messageCategory_) - << " Examining edges " << e << " --> particle " << edge_property.simTrack->type() << "(" - << edge_property.simTrack->trackId() << ")" - << " with SimClusters: " << edge_property.simHits - << " Accumulated SimClusters: " << v->total_simHits << std::endl; -} -template -void print_vertex(Vertex& u, const Graph& g) { - auto const vertex_property = get(vertex_name, g, u); - IfLogDebug(DEBUG, messageCategory_) << " At " << u; - // The Mother of all vertices has **no** SimTrack associated. - if (vertex_property.simTrack) - IfLogDebug(DEBUG, messageCategory_) << " [" << vertex_property.simTrack->type() << "]" - << "(" << vertex_property.simTrack->trackId() << ")"; - IfLogDebug(DEBUG, messageCategory_) << std::endl; -} - -// Graphviz output functions will only be generated in DEBUG mode -#if DEBUG -std::string graphviz_vertex(const VertexProperty& v) { - std::ostringstream oss; - oss << "{id: " << (v.simTrack ? v.simTrack->trackId() : 0) - << ", type: " << (v.simTrack ? v.simTrack->type() : 0) << ", chits: " << v.cumulative_simHits - << "}"; - return oss.str(); -} - -std::string graphviz_edge(const EdgeProperty& e) { - std::ostringstream oss; - oss << "[" << (e.simTrack ? e.simTrack->trackId() : 0) << "," - << (e.simTrack ? e.simTrack->type() : 0) << "," << e.simHits << "]"; - return oss.str(); -} -#endif - -class SimHitsAccumulator_dfs_visitor : public boost::default_dfs_visitor { - public: - int total_simHits = 0; - template - void examine_edge(Edge e, const Graph& g) { - accumulateSimHits_edge(e, g, this); - } - template - void finish_edge(Edge e, const Graph& g) { - auto const edge_property = get(edge_weight, g, e); - auto src = source(e, g); - auto trg = target(e, g); - auto cumulative = - edge_property.simHits + get(vertex_name, g, trg).cumulative_simHits + - (get(vertex_name, g, src).simTrack - ? get(vertex_name, g, src).cumulative_simHits - : 0); // when we hit the root vertex we have to stop adding back its contribution. - auto const src_vertex_property = get(vertex_name, g, src); - put(get(vertex_name, const_cast(g)), src, - VertexProperty(src_vertex_property.simTrack, cumulative)); - put(get(edge_weight, const_cast(g)), e, - EdgeProperty(edge_property.simTrack, edge_property.simHits, cumulative)); - IfLogDebug(DEBUG, messageCategory_) - << " Finished edge: " << e << " Track id: " << get(edge_weight, g, e).simTrack->trackId() - << " has cumulated " << cumulative << " hits" << std::endl; - IfLogDebug(DEBUG, messageCategory_) - << " SrcVtx: " << src << "\t" << get(vertex_name, g, src).simTrack << "\t" - << get(vertex_name, g, src).cumulative_simHits << std::endl; - IfLogDebug(DEBUG, messageCategory_) - << " TrgVtx: " << trg << "\t" << get(vertex_name, g, trg).simTrack << "\t" - << get(vertex_name, g, trg).cumulative_simHits << std::endl; - } -}; - -typedef std::function Selector; - -class CaloParticle_dfs_visitor : public boost::default_dfs_visitor { - public: - CaloParticle_dfs_visitor(CaloTruthAccumulatorWithGraph::OutputCollections& output, - CaloTruthAccumulatorWithGraph::calo_particles& caloParticles, - std::unordered_multimap& simHitBarcodeToIndex, - std::unordered_map >& simTrackDetIdEnergyMap, - Selector selector) - : output_(output), - caloParticles_(caloParticles), - simHitBarcodeToIndex_(simHitBarcodeToIndex), - simTrackDetIdEnergyMap_(simTrackDetIdEnergyMap), - selector_(selector) {} - template - void discover_vertex(Vertex u, const Graph& g) { - // If we reach the vertex 0, it means that we are backtracking with respect - // to the first generation of stable particles: simply return; - if (u == 0) return; - print_vertex(u, g); - auto const vertex_property = get(vertex_name, g, u); - if (!vertex_property.simTrack) return; - auto trackIdx = vertex_property.simTrack->trackId(); - IfLogDebug(DEBUG, messageCategory_) - << " Found " << simHitBarcodeToIndex_.count(trackIdx) << " associated simHits" << std::endl; - if (simHitBarcodeToIndex_.count(trackIdx)) { - output_.pSimClusters->emplace_back(*vertex_property.simTrack); - auto& simcluster = output_.pSimClusters->back(); - std::unordered_map acc_energy; - for (auto const& hit_and_energy : simTrackDetIdEnergyMap_[trackIdx]) { - acc_energy[hit_and_energy.first] += hit_and_energy.second; - } - for (auto const& hit_and_energy : acc_energy) { - simcluster.addRecHitAndFraction(hit_and_energy.first, hit_and_energy.second); - } - } - } - template - void examine_edge(Edge e, const Graph& g) { - auto src = source(e, g); - if (src == 0) { - auto edge_property = get(edge_weight, g, e); - if (selector_(edge_property)) { - output_.pCaloParticles->emplace_back(*(edge_property.simTrack)); - caloParticles_.sc_start_.push_back(output_.pSimClusters->size()); - } - } - } - - template - void finish_edge(Edge e, const Graph& g) { - auto src = source(e, g); - if (src == 0) { - auto edge_property = get(edge_weight, g, e); - if (selector_(edge_property)) { - caloParticles_.sc_stop_.push_back(output_.pSimClusters->size()); - } - } - } - - private: - CaloTruthAccumulatorWithGraph::OutputCollections& output_; - CaloTruthAccumulatorWithGraph::calo_particles& caloParticles_; - std::unordered_multimap& simHitBarcodeToIndex_; - std::unordered_map >& simTrackDetIdEnergyMap_; - Selector selector_; -}; -} - -CaloTruthAccumulatorWithGraph::CaloTruthAccumulatorWithGraph(const edm::ParameterSet& config, - edm::stream::EDProducerBase& mixMod, - edm::ConsumesCollector& iC) - : messageCategory_("CaloTruthAccumulatorWithGraph"), - maximumPreviousBunchCrossing_( - config.getParameter("maximumPreviousBunchCrossing")), - maximumSubsequentBunchCrossing_( - config.getParameter("maximumSubsequentBunchCrossing")), - simTrackLabel_(config.getParameter("simTrackCollection")), - simVertexLabel_(config.getParameter("simVertexCollection")), - collectionTags_(), - genParticleLabel_(config.getParameter("genParticleCollection")), - hepMCproductLabel_(config.getParameter("HepMCProductLabel")), - minEnergy_(config.getParameter("MinEnergy")), - maxPseudoRapidity_(config.getParameter("MaxPseudoRapidity")) { - mixMod.produces("MergedCaloTruth"); - mixMod.produces("MergedCaloTruth"); - - iC.consumes >(simTrackLabel_); - iC.consumes >(simVertexLabel_); - iC.consumes >(genParticleLabel_); - iC.consumes >(genParticleLabel_); - iC.consumes >(hepMCproductLabel_); - - // Fill the collection tags - const edm::ParameterSet& simHitCollectionConfig = config.getParameterSet("simHitCollections"); - std::vector parameterNames = simHitCollectionConfig.getParameterNames(); - - for (auto const& parameterName : parameterNames) { - std::vector tags = - simHitCollectionConfig.getParameter >(parameterName); - collectionTags_.insert(collectionTags_.end(), tags.begin(), tags.end()); - } - - for (auto const& collectionTag : collectionTags_) { - iC.consumes >(collectionTag); - } -} - -void CaloTruthAccumulatorWithGraph::beginLuminosityBlock(edm::LuminosityBlock const& iLumiBlock, - const edm::EventSetup& iSetup) { - edm::ESHandle geom; - iSetup.get().get(geom); - const HGCalGeometry *eegeom, *fhgeom; - const HcalGeometry* bhgeom; - - eegeom = static_cast(geom->getSubdetectorGeometry(DetId::Forward, HGCEE)); - fhgeom = static_cast(geom->getSubdetectorGeometry(DetId::Forward, HGCHEF)); - bhgeom = static_cast(geom->getSubdetectorGeometry(DetId::Hcal, HcalEndcap)); - - hgtopo_[0] = &(eegeom->topology()); - hgtopo_[1] = &(fhgeom->topology()); - - for (unsigned i = 0; i < 2; ++i) { - hgddd_[i] = &(hgtopo_[i]->dddConstants()); - } - - hcddd_ = bhgeom->topology().dddConstants(); -} - -void CaloTruthAccumulatorWithGraph::initializeEvent(edm::Event const& event, - edm::EventSetup const& setup) { - output_.pSimClusters.reset(new SimClusterCollection()); - output_.pCaloParticles.reset(new CaloParticleCollection()); - - m_detIdToTotalSimEnergy.clear(); -} - -/** Create handle to edm::HepMCProduct here because event.getByLabel with - edm::HepMCProduct only works for edm::Event but not for - PileUpEventPrincipal; PileUpEventPrincipal::getByLabel tries to call - T::value_type and T::iterator (where T is the type of the object one wants - to get a handle to) which is only implemented for container-like objects - like std::vector but not for edm::HepMCProduct! -*/ -void CaloTruthAccumulatorWithGraph::accumulate(edm::Event const& event, - edm::EventSetup const& setup) { - edm::Handle hepmc; - event.getByLabel(hepMCproductLabel_, hepmc); - - edm::LogInfo(messageCategory_) << " CaloTruthAccumulatorWithGraph::accumulate (signal)"; - accumulateEvent(event, setup, hepmc); -} - -void CaloTruthAccumulatorWithGraph::accumulate(PileUpEventPrincipal const& event, - edm::EventSetup const& setup, edm::StreamID const&) { - if (event.bunchCrossing() >= -static_cast(maximumPreviousBunchCrossing_) && - event.bunchCrossing() <= static_cast(maximumSubsequentBunchCrossing_)) { - // simply create empty handle as we do not have a HepMCProduct in PU anyway - edm::Handle hepmc; - edm::LogInfo(messageCategory_) - << " CaloTruthAccumulatorWithGraph::accumulate (pileup) bunchCrossing=" - << event.bunchCrossing(); - accumulateEvent(event, setup, hepmc); - } else { - edm::LogInfo(messageCategory_) - << "Skipping pileup event for bunch crossing " << event.bunchCrossing(); - } -} - -void CaloTruthAccumulatorWithGraph::finalizeEvent(edm::Event& event, edm::EventSetup const& setup) { - edm::LogInfo(messageCategory_) << "Adding " << output_.pSimClusters->size() - << " SimParticles and " << output_.pCaloParticles->size() - << " CaloParticles to the event."; - - // We need to normalize the hits and energies into hits and fractions (since - // we have looped over all pileup events) - - for (auto& sc : *(output_.pSimClusters)) { - auto hitsAndEnergies = sc.hits_and_fractions(); - sc.clearHitsAndFractions(); - for (auto& hAndE : hitsAndEnergies) { - const float totalenergy = m_detIdToTotalSimEnergy[hAndE.first]; - float fraction = 0.; - if (totalenergy > 0) - fraction = hAndE.second / totalenergy; - else - edm::LogWarning(messageCategory_) << "TotalSimEnergy for hit " << hAndE.first - << " is 0! The fraction for this hit cannot be computed."; - sc.addRecHitAndFraction(hAndE.first, fraction); - } - } - - // save the SimCluster orphan handle so we can fill the calo particles - auto scHandle = event.put(std::move(output_.pSimClusters), "MergedCaloTruth"); - - // now fill the calo particles - for (unsigned i = 0; i < output_.pCaloParticles->size(); ++i) { - auto& cp = (*output_.pCaloParticles)[i]; - for (unsigned j = m_caloParticles.sc_start_[i]; j < m_caloParticles.sc_stop_[i]; ++j) { - edm::Ref ref(scHandle, j); - cp.addSimCluster(ref); - } - } - - event.put(std::move(output_.pCaloParticles), "MergedCaloTruth"); - - calo_particles().swap(m_caloParticles); - - std::unordered_map().swap(m_detIdToTotalSimEnergy); - std::unordered_multimap().swap(m_simHitBarcodeToIndex); -} - -template -void CaloTruthAccumulatorWithGraph::accumulateEvent( - const T& event, const edm::EventSetup& setup, - const edm::Handle& hepMCproduct) { - - edm::Handle > hGenParticles; - edm::Handle > hGenParticleIndices; - - event.getByLabel(simTrackLabel_, hSimTracks); - event.getByLabel(simVertexLabel_, hSimVertices); - - event.getByLabel(genParticleLabel_, hGenParticles); - event.getByLabel(genParticleLabel_, hGenParticleIndices); - - std::vector > simHitPointers; - std::unordered_map > simTrackDetIdEnergyMap; - fillSimHits(simHitPointers, simTrackDetIdEnergyMap, event, setup); - - // Clear maps from previous event fill them for this one - m_simHitBarcodeToIndex.clear(); - for (unsigned int i = 0; i < simHitPointers.size(); ++i) { - m_simHitBarcodeToIndex.emplace(simHitPointers[i].second->geantTrackId(), i); - } - - auto const& tracks = *hSimTracks; - auto const& vertices = *hSimVertices; - std::unordered_map trackid_to_track_index; - DecayChain decay; - int idx = 0; - - IfLogDebug(DEBUG, messageCategory_) << " TRACKS" << std::endl; - for (auto const& t : tracks) { - IfLogDebug(DEBUG, messageCategory_) - << " " << idx << "\t" << t.trackId() << "\t" << t << std::endl; - trackid_to_track_index[t.trackId()] = idx; - idx++; - } - - /** - Build the main decay graph and assign the SimTrack to each edge. The graph - built here will only contain the particles that have a decay vertex - associated to them. In order to recover also the particles that will not - decay, we need to keep track of the SimTrack used here and add, a-posteriori, - the ones not used, associating a ghost vertex (starting from the highest - simulated vertex number), in order to build the edge and identify them - immediately as stable (i.e. not decayed). - - To take into account the multi-bremsstrahlung effects in which a single - particle is emitting photons in different vertices **keeping the same - track index**, we also collapsed those vertices into 1 unique vertex. The - other approach of fully representing the decay chain keeping the same - track index would have the problem of over-counting the contributions of - that track, especially in terms of hits. - - The 2 auxiliary vectors are structured as follow: - - 1. used_sim_tracks is a vector that has the same size as the overall - number of simulated tracks. The associated integer is the vertexId of - the **decaying vertex for that track**. - 2. collapsed_vertices is a vector that has the same size as the overall - number of simulated vertices. The vector's index is the vertexId - itself, the associated value is the vertexId of the vertex on which - this should collapse. - */ - idx = 0; - std::vector used_sim_tracks(tracks.size(), 0); - std::vector collapsed_vertices(vertices.size(), 0); - IfLogDebug(DEBUG, messageCategory_) << " VERTICES" << std::endl; - for (auto const& v : vertices) { - IfLogDebug(DEBUG, messageCategory_) << " " << idx++ << "\t" << v << std::endl; - if (v.parentIndex() != -1) { - auto trk_idx = trackid_to_track_index[v.parentIndex()]; - auto origin_vtx = tracks[trk_idx].vertIndex(); - if (used_sim_tracks[trk_idx]) { - // collapse the vertex into the original first vertex we saw associated - // to this track. Omit adding the edge in order to avoid double - // counting of the very same particles and its associated hits. - collapsed_vertices[v.vertexId()] = used_sim_tracks[trk_idx]; - continue; - } - // Perform the actual vertex collapsing, if needed. - if (collapsed_vertices[origin_vtx]) origin_vtx = collapsed_vertices[origin_vtx]; - add_edge(origin_vtx, v.vertexId(), - EdgeProperty(&tracks[trk_idx], simTrackDetIdEnergyMap[v.parentIndex()].size(), 0), - decay); - used_sim_tracks[trk_idx] = v.vertexId(); - } - } - // Build the motherParticle property to each vertex - auto const& vertexMothersProp = get(vertex_name, decay); - // Now recover the particles that did not decay. Append them with an index - // bigger than the size of the generated vertices. - int offset = vertices.size(); - for (size_t i = 0; i < tracks.size(); ++i) { - if (!used_sim_tracks[i]) { - auto origin_vtx = tracks[i].vertIndex(); - // Perform the actual vertex collapsing, if needed. - if (collapsed_vertices[origin_vtx]) origin_vtx = collapsed_vertices[origin_vtx]; - add_edge(origin_vtx, offset, - EdgeProperty(&tracks[i], simTrackDetIdEnergyMap[tracks[i].trackId()].size(), 0), - decay); - // The properties for "fake" vertices associated to stable particles have - // to be set inside this loop, since they do not belong to the vertices - // collection and would be skipped by that loop (coming next) - put(vertexMothersProp, offset, VertexProperty(&tracks[i], 0)); - offset++; - } - } - for (auto const& v : vertices) { - if (v.parentIndex() != -1) { - // Skip collapsed_vertices - if (collapsed_vertices[v.vertexId()]) continue; - put(vertexMothersProp, v.vertexId(), - VertexProperty(&tracks[trackid_to_track_index[v.parentIndex()]], 0)); - } - } - SimHitsAccumulator_dfs_visitor vis; - depth_first_search(decay, visitor(vis)); - CaloParticle_dfs_visitor caloParticleCreator( - output_, m_caloParticles, m_simHitBarcodeToIndex, simTrackDetIdEnergyMap, - [&](EdgeProperty& edge_property) -> bool { - // Apply selection on SimTracks in order to promote them to be CaloParticles. - // The function returns TRUE if the particle satisfies the selection, FALSE otherwise. - // Therefore the correct logic to select the particle is to ask for TRUE as return value. - return (edge_property.cumulative_simHits != 0 and !edge_property.simTrack->noGenpart() and - edge_property.simTrack->momentum().E() > minEnergy_ and - std::abs(edge_property.simTrack->momentum().Eta()) < maxPseudoRapidity_); - }); - depth_first_search(decay, visitor(caloParticleCreator)); - -#if DEBUG - boost::write_graphviz(std::cout, decay, make_label_writer(make_transform_value_property_map( - &graphviz_vertex, get(vertex_name, decay))), - make_label_writer(make_transform_value_property_map( - &graphviz_edge, get(edge_weight, decay)))); -#endif -} - -template -void CaloTruthAccumulatorWithGraph::fillSimHits( - std::vector >& returnValue, - std::unordered_map >& simTrackDetIdEnergyMap, const T& event, - const edm::EventSetup& setup) { - for (auto const& collectionTag : collectionTags_) { - edm::Handle > hSimHits; - const bool isHcal = (collectionTag.instance().find("HcalHits") != std::string::npos); - event.getByLabel(collectionTag, hSimHits); - for (auto const& simHit : *hSimHits) { - DetId id(0); - const uint32_t simId = simHit.id(); - if (isHcal) { - HcalDetId hid = HcalHitRelabeller::relabel(simId, hcddd_); - if (hid.subdet() == HcalEndcap) id = hid; - } else { - int subdet, layer, cell, sec, subsec, zp; - HGCalTestNumbering::unpackHexagonIndex(simId, subdet, zp, layer, sec, subsec, cell); - const HGCalDDDConstants* ddd = hgddd_[subdet - 3]; - std::pair recoLayerCell = - ddd->simToReco(cell, layer, sec, hgtopo_[subdet - 3]->detectorType()); - cell = recoLayerCell.first; - layer = recoLayerCell.second; - // skip simhits with bad barcodes or non-existant layers - if (layer == -1 || simHit.geantTrackId() == 0) continue; - id = HGCalDetId((ForwardSubdetector)subdet, zp, layer, subsec, sec, cell); - } - - if (DetId(0) == id) continue; - - uint32_t detId = id.rawId(); - returnValue.emplace_back(id, &simHit); - simTrackDetIdEnergyMap[simHit.geantTrackId()][id.rawId()] += simHit.energy(); - - m_detIdToTotalSimEnergy[detId] += simHit.energy(); - } - } // end of loop over InputTags -} - -// Register with the framework -DEFINE_DIGI_ACCUMULATOR(CaloTruthAccumulatorWithGraph); From b5738030fd0875736169a58783b479bf9f047945 Mon Sep 17 00:00:00 2001 From: Marco Rovere Date: Fri, 15 Dec 2017 10:17:16 +0100 Subject: [PATCH 101/426] Remove unnecessary cfi file --- SimGeneral/Debugging/python/CfiFile_cfi.py | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 SimGeneral/Debugging/python/CfiFile_cfi.py diff --git a/SimGeneral/Debugging/python/CfiFile_cfi.py b/SimGeneral/Debugging/python/CfiFile_cfi.py deleted file mode 100644 index 7f93db48d22b0..0000000000000 --- a/SimGeneral/Debugging/python/CfiFile_cfi.py +++ /dev/null @@ -1,4 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -demo = cms.EDAnalyzer('Debugging' -) From 13a77cfd610a29283a71c8d2e01ddcf1d1e44941 Mon Sep 17 00:00:00 2001 From: Marco Rovere Date: Fri, 15 Dec 2017 10:45:20 +0100 Subject: [PATCH 102/426] Use meaningful filenames --- .../{Debugging.cc => CaloParticleDebugger.cc} | 32 +++++++++---------- ...ile_cfg.py => caloParticleDebugger_cfg.py} | 6 ++-- 2 files changed, 17 insertions(+), 21 deletions(-) rename SimGeneral/Debugging/plugins/{Debugging.cc => CaloParticleDebugger.cc} (90%) rename SimGeneral/Debugging/python/{ConfFile_cfg.py => caloParticleDebugger_cfg.py} (95%) diff --git a/SimGeneral/Debugging/plugins/Debugging.cc b/SimGeneral/Debugging/plugins/CaloParticleDebugger.cc similarity index 90% rename from SimGeneral/Debugging/plugins/Debugging.cc rename to SimGeneral/Debugging/plugins/CaloParticleDebugger.cc index 725444c6c6217..45b36c1343b95 100644 --- a/SimGeneral/Debugging/plugins/Debugging.cc +++ b/SimGeneral/Debugging/plugins/CaloParticleDebugger.cc @@ -44,10 +44,10 @@ // class declaration // -class Debugging : public edm::one::EDAnalyzer<> { +class CaloParticleDebugger : public edm::one::EDAnalyzer<> { public: - explicit Debugging(const edm::ParameterSet&); - ~Debugging() override; + explicit CaloParticleDebugger(const edm::ParameterSet&); + ~CaloParticleDebugger() override; static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); @@ -84,7 +84,7 @@ class Debugging : public edm::one::EDAnalyzer<> { // // constructors and destructor // -Debugging::Debugging(const edm::ParameterSet& iConfig) +CaloParticleDebugger::CaloParticleDebugger(const edm::ParameterSet& iConfig) : simTracks_(iConfig.getParameter("simTracks")), genParticles_(iConfig.getParameter("genParticles")), simVertices_(iConfig.getParameter("simVertices")), @@ -102,7 +102,7 @@ Debugging::Debugging(const edm::ParameterSet& iConfig) } } -Debugging::~Debugging() {} +CaloParticleDebugger::~CaloParticleDebugger() {} // @@ -111,7 +111,7 @@ Debugging::~Debugging() {} // ------------ method called for each event ------------ void -Debugging::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { +CaloParticleDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { using namespace edm; edm::Handle > simTracksH; @@ -192,13 +192,13 @@ Debugging::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { // ------------ method called once each job just before starting event loop ------------ void -Debugging::beginJob() {} +CaloParticleDebugger::beginJob() {} // ------------ method called once each job just after ending the event loop ------------ void -Debugging::endJob() {} +CaloParticleDebugger::endJob() {} -void Debugging::fillSimHits( +void CaloParticleDebugger::fillSimHits( std::map & detIdToTotalSimEnergy, const edm::Event& iEvent, const edm::EventSetup& iSetup ) { // Taken needed quantities from the EventSetup @@ -210,9 +210,9 @@ void Debugging::fillSimHits( const HGCalTopology* hgtopo[2]; const HcalDDDRecConstants* hcddd; - eegeom = dynamic_cast(geom->getSubdetectorGeometry(DetId::Forward, HGCEE)); - fhgeom = dynamic_cast(geom->getSubdetectorGeometry(DetId::Forward, HGCHEF)); - bhgeom = dynamic_cast(geom->getSubdetectorGeometry(DetId::Hcal, HcalEndcap)); + eegeom = static_cast(geom->getSubdetectorGeometry(DetId::Forward, HGCEE)); + fhgeom = static_cast(geom->getSubdetectorGeometry(DetId::Forward, HGCHEF)); + bhgeom = static_cast(geom->getSubdetectorGeometry(DetId::Hcal, HcalEndcap)); hgtopo[0] = &(eegeom->topology()); hgtopo[1] = &(fhgeom->topology()); @@ -257,9 +257,7 @@ void Debugging::fillSimHits( // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ void -Debugging::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - // The following says we do not know what parameters are allowed so do no validation - // Please change this to state exactly what you do use, even if it is no parameters +CaloParticleDebugger::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.add("simTracks", edm::InputTag("g4SimHits")); desc.add("genParticles", edm::InputTag("genParticles")); @@ -270,8 +268,8 @@ Debugging::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { { edm::InputTag("g4SimHits", "HGCHitsEE"), edm::InputTag("g4SimHits", "HGCHitsHEfront"), edm::InputTag("g4SimHits", "HcalHits")}); - descriptions.addDefault(desc); + descriptions.add("caloParticleDebugger", desc); } // define this as a plug-in -DEFINE_FWK_MODULE(Debugging); +DEFINE_FWK_MODULE(CaloParticleDebugger); diff --git a/SimGeneral/Debugging/python/ConfFile_cfg.py b/SimGeneral/Debugging/python/caloParticleDebugger_cfg.py similarity index 95% rename from SimGeneral/Debugging/python/ConfFile_cfg.py rename to SimGeneral/Debugging/python/caloParticleDebugger_cfg.py index 9b8c5517cf6f4..2f5a38c6cb903 100644 --- a/SimGeneral/Debugging/python/ConfFile_cfg.py +++ b/SimGeneral/Debugging/python/caloParticleDebugger_cfg.py @@ -27,8 +27,6 @@ ) ) -process.demo = cms.EDAnalyzer('Debugging' -) - +process.load("SimGeneral.Debugging.caloParticleDebugger_cfi") -process.p = cms.Path(process.demo) +process.p = cms.Path(process.caloParticleDebugger) From b91785a45b7609750feb2e37cd0a00787a94d66e Mon Sep 17 00:00:00 2001 From: Marco Rovere Date: Fri, 15 Dec 2017 10:46:44 +0100 Subject: [PATCH 103/426] Address some review comments --- SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc index 92a81bd899680..0353d1ee27f1c 100644 --- a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc +++ b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc @@ -13,7 +13,6 @@ #endif #include -#include // required for std::auto_ptr #include // for std::accumulate #include @@ -121,8 +120,8 @@ using DecayChain = adjacency_listtrackId() - << " has cumulated " << cumulative << " hits" << std::endl; + << " has accumulated " << cumulative << " hits" << std::endl; IfLogDebug(DEBUG, messageCategory_) << " SrcVtx: " << src << "\t" << get(vertex_name, g, src).simTrack << "\t" << get(vertex_name, g, src).cumulative_simHits << std::endl; From 59e3314e0e3bb4ca6167f5ef0e0fc24d43cfcab6 Mon Sep 17 00:00:00 2001 From: Marco Rovere Date: Fri, 15 Dec 2017 16:40:38 +0100 Subject: [PATCH 104/426] Better format for Graphviz output --- SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc index 0353d1ee27f1c..f1f5d3f1d047f 100644 --- a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc +++ b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc @@ -232,7 +232,7 @@ void print_vertex(Vertex& u, const Graph& g) { std::string graphviz_vertex(const VertexProperty& v) { std::ostringstream oss; oss << "{id: " << (v.simTrack ? v.simTrack->trackId() : 0) - << ", type: " << (v.simTrack ? v.simTrack->type() : 0) << ", chits: " << v.cumulative_simHits + << ",\ntype: " << (v.simTrack ? v.simTrack->type() : 0) << ",\nchits: " << v.cumulative_simHits << "}"; return oss.str(); } From 0e15c13b61c633835eccb2310bca32cf5c614a30 Mon Sep 17 00:00:00 2001 From: Marco Rovere Date: Tue, 19 Dec 2017 10:26:15 +0100 Subject: [PATCH 105/426] Fix GCC flags and dot output --- .../CaloAnalysis/plugins/CaloTruthAccumulator.cc | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc index f1f5d3f1d047f..c5b40c96a73a0 100644 --- a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc +++ b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc @@ -1,14 +1,17 @@ -// BOOST GRAPH LIBRARY -#include -#include -#include #define DEBUG false - #if DEBUG // boost optional (used by boost graph) results in some false positives with -Wmaybe-uninitialized #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif + +// BOOST GRAPH LIBRARY +#include +#include +#include #include + +#if DEBUG #pragma GCC diagnostic pop #endif @@ -232,7 +235,7 @@ void print_vertex(Vertex& u, const Graph& g) { std::string graphviz_vertex(const VertexProperty& v) { std::ostringstream oss; oss << "{id: " << (v.simTrack ? v.simTrack->trackId() : 0) - << ",\ntype: " << (v.simTrack ? v.simTrack->type() : 0) << ",\nchits: " << v.cumulative_simHits + << ",\\ntype: " << (v.simTrack ? v.simTrack->type() : 0) << ",\\nchits: " << v.cumulative_simHits << "}"; return oss.str(); } From 89857cb7b39c1f1bc239e124f4e0baeebe2b8cf5 Mon Sep 17 00:00:00 2001 From: Marco Rovere Date: Tue, 19 Dec 2017 10:42:23 +0100 Subject: [PATCH 106/426] Add cumulative hits to edges in dot-graphs --- SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc index c5b40c96a73a0..e9c9f9e9a2418 100644 --- a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc +++ b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc @@ -243,7 +243,9 @@ std::string graphviz_vertex(const VertexProperty& v) { std::string graphviz_edge(const EdgeProperty& e) { std::ostringstream oss; oss << "[" << (e.simTrack ? e.simTrack->trackId() : 0) << "," - << (e.simTrack ? e.simTrack->type() : 0) << "," << e.simHits << "]"; + << (e.simTrack ? e.simTrack->type() : 0) + << "," << e.simHits + << "," << e.cumulative_simHits << "]"; return oss.str(); } #endif From 5b394a82af650e63dfbce7319a4cf3a57363130a Mon Sep 17 00:00:00 2001 From: Marco Rovere Date: Fri, 9 Feb 2018 10:40:14 +0100 Subject: [PATCH 107/426] Monitor the difference between {,self}Energy --- .../plugins/CaloParticleValidation.cc | 208 ++++++++++++++++++ 1 file changed, 208 insertions(+) create mode 100644 Validation/HGCalValidation/plugins/CaloParticleValidation.cc diff --git a/Validation/HGCalValidation/plugins/CaloParticleValidation.cc b/Validation/HGCalValidation/plugins/CaloParticleValidation.cc new file mode 100644 index 0000000000000..998c6af486452 --- /dev/null +++ b/Validation/HGCalValidation/plugins/CaloParticleValidation.cc @@ -0,0 +1,208 @@ +// -*- C++ -*- +// +// Class: CaloParticleValidation +// Original Author: Marco Rovere +// Created: Thu, 18 Jan 2018 15:54:55 GMT +// +// + +#include +#include + +// user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "DQMServices/Core/interface/DQMGlobalEDAnalyzer.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" +#include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" +#include "DataFormats/HGCRecHit/interface/HGCRecHitCollections.h" +#include "SimDataFormats/Vertex/interface/SimVertex.h" + +// +// class declaration +// + +struct Histogram_CaloParticleSingle { + ConcurrentMonitorElement eta_; + ConcurrentMonitorElement pt_; + ConcurrentMonitorElement energy_; + ConcurrentMonitorElement nSimClusters_; + ConcurrentMonitorElement nHitInSimClusters_; + ConcurrentMonitorElement selfEnergy_; // this is the sum of the energy associated to all recHits linked to all SimClusters + ConcurrentMonitorElement energyDifference_; // This contains (energy-selfEnergy)/energy + ConcurrentMonitorElement eta_Zorigin_map_; +}; + +using Histograms_CaloParticleValidation = std::unordered_map; + +class CaloParticleValidation : public DQMGlobalEDAnalyzer { + public: + explicit CaloParticleValidation(const edm::ParameterSet&); + ~CaloParticleValidation(); + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + + private: + virtual void bookHistograms(DQMStore::ConcurrentBooker &, + edm::Run const&, + edm::EventSetup const&, + Histograms_CaloParticleValidation&) const override; + + virtual void dqmAnalyze(edm::Event const&, + edm::EventSetup const&, + Histograms_CaloParticleValidation const&) const override; + + // ----------member data --------------------------- + std::string folder_; + std::vector particles_to_monitor_; + + edm::EDGetTokenT > simVertices_; + edm::EDGetTokenT > caloParticles_; + edm::EDGetTokenT recHitsEE_; + edm::EDGetTokenT recHitsFH_; + edm::EDGetTokenT recHitsBH_; +}; + +// +// constants, enums and typedefs +// + +// +// static data member definitions +// + +// +// constructors and destructor +// +CaloParticleValidation::CaloParticleValidation(const edm::ParameterSet& iConfig) + : folder_(iConfig.getParameter("folder")), + particles_to_monitor_(iConfig.getParameter >("particles_to_monitor")), + simVertices_(consumes>(iConfig.getParameter("simVertices"))), + caloParticles_(consumes >(iConfig.getParameter("caloParticles"))), + recHitsEE_(consumes(iConfig.getParameter("recHitsEE"))), + recHitsFH_(consumes(iConfig.getParameter("recHitsFH"))), + recHitsBH_(consumes(iConfig.getParameter("recHitsBH"))) +{ + //now do what ever initialization is needed +} + + +CaloParticleValidation::~CaloParticleValidation() +{ + // do anything here that needs to be done at desctruction time + // (e.g. close files, deallocate resources etc.) +} + + +// +// member functions +// + +// ------------ method called for each event ------------ + +void +CaloParticleValidation::dqmAnalyze(edm::Event const& iEvent, edm::EventSetup const& iSetup, + Histograms_CaloParticleValidation const & histos) const +{ + using namespace edm; + + Handle recHitHandleEE; + Handle recHitHandleFH; + Handle recHitHandleBH; + // make a map detid-rechit + + iEvent.getByToken(recHitsEE_, recHitHandleEE); + iEvent.getByToken(recHitsFH_, recHitHandleFH); + iEvent.getByToken(recHitsBH_, recHitHandleBH); + const auto& rechitsEE = *recHitHandleEE; + const auto& rechitsFH = *recHitHandleFH; + const auto& rechitsBH = *recHitHandleBH; + std::map hitmap; + for (unsigned int i = 0; i < rechitsEE.size(); ++i) { + hitmap[rechitsEE[i].detid()] = &rechitsEE[i]; + } + for (unsigned int i = 0; i < rechitsFH.size(); ++i) { + hitmap[rechitsFH[i].detid()] = &rechitsFH[i]; + } + for (unsigned int i = 0; i < rechitsBH.size(); ++i) { + hitmap[rechitsBH[i].detid()] = &rechitsBH[i]; + } + + Handle> simVerticesHandle; + iEvent.getByToken(simVertices_, simVerticesHandle); + std::vector const & simVertices = *simVerticesHandle; + + Handle > caloParticleHandle; + iEvent.getByToken(caloParticles_, caloParticleHandle); + std::vector const & caloParticles = *caloParticleHandle; + + for (auto const caloParticle : caloParticles) { + int id = caloParticle.pdgId(); + if (histos.count(id)) { + histos.at(id).eta_.fill(caloParticle.eta()); + histos.at(id).pt_.fill(caloParticle.pt()); + histos.at(id).energy_.fill(caloParticle.energy()); + histos.at(id).nSimClusters_.fill(caloParticle.simClusters().size()); + // Find the corresponding vertex. + histos.at(id).eta_Zorigin_map_.fill( + simVertices.at(caloParticle.g4Tracks()[0].vertIndex()).position().z(), caloParticle.eta()); + int simHits = 0; + float energy = 0.; + for (auto const sc : caloParticle.simClusters()) { + simHits += sc->hits_and_fractions().size(); + for (auto const h_and_f : sc->hits_and_fractions()) { + if (hitmap.count(h_and_f.first)) + energy += hitmap[h_and_f.first]->energy() * h_and_f.second; + } + } + histos.at(id).nHitInSimClusters_.fill((float)simHits); + histos.at(id).selfEnergy_.fill(energy); + histos.at(id).energyDifference_.fill(1.- energy/caloParticle.energy()); + } + } +} + + +void +CaloParticleValidation::bookHistograms(DQMStore::ConcurrentBooker & ibook, + edm::Run const & run, + edm::EventSetup const & iSetup, + Histograms_CaloParticleValidation & histos) const +{ + for (auto const particle : particles_to_monitor_) { + ibook.setCurrentFolder(folder_ + std::to_string(particle)); + histos[particle].eta_ = ibook.book1D("Eta", "Eta", 80, -4., 4.); + histos[particle].energy_ = ibook.book1D("Energy", "Energy", 250, 0., 500.); + histos[particle].pt_ = ibook.book1D("Pt", "Pt", 100, 0., 100.); + histos[particle].nSimClusters_ = ibook.book1D("NSimClusters", "NSimClusters", 100, 0., 100.); + histos[particle].nHitInSimClusters_ = ibook.book1D("NHitInSimClusters", "NHitInSimClusters", 100, 0., 100.); + histos[particle].selfEnergy_ = ibook.book1D("SelfEnergy", "SelfEnergy", 250, 0., 500.); + histos[particle].energyDifference_ = ibook.book1D("EnergyDifference", "(Energy-SelfEnergy)/Energy", 300, -5., 1.); + histos[particle].eta_Zorigin_map_ = ibook.book2D("Eta vs Zorigin", "Eta vs Zorigin", 80, -4., 4., 1100, -550., 550.); + } +} + +// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ +void +CaloParticleValidation::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + //The following says we do not know what parameters are allowed so do no validation + // Please change this to state exactly what you do use, even if it is no parameters + edm::ParameterSetDescription desc; + desc.add("folder", "HGCAL/"); // Please keep the trailing '/' + desc.add > ("particles_to_monitor", {11, -11, 13, 22, 111, 211, -211}); + desc.add("simVertices", edm::InputTag("g4SimHits")); + desc.add("caloParticles", edm::InputTag("mix", "MergedCaloTruth")); + desc.add("recHitsEE", edm::InputTag("HGCalRecHit","HGCEERecHits")); + desc.add("recHitsFH", edm::InputTag("HGCalRecHit","HGCHEFRecHits")); + desc.add("recHitsBH", edm::InputTag("HGCalRecHit","HGCHEBRecHits")); + descriptions.add("caloparticlevalidation", desc); +} + +//define this as a plug-in +DEFINE_FWK_MODULE(CaloParticleValidation); From 5c9cf9d0f86b0a49cef3fc4c71a63b08548d10ba Mon Sep 17 00:00:00 2001 From: Marco Rovere Date: Fri, 9 Feb 2018 22:44:42 +0100 Subject: [PATCH 108/426] Order collection while debugging --- .../Debugging/plugins/CaloParticleDebugger.cc | 64 +++++++++++++++---- 1 file changed, 52 insertions(+), 12 deletions(-) diff --git a/SimGeneral/Debugging/plugins/CaloParticleDebugger.cc b/SimGeneral/Debugging/plugins/CaloParticleDebugger.cc index 45b36c1343b95..3a0f290700c2e 100644 --- a/SimGeneral/Debugging/plugins/CaloParticleDebugger.cc +++ b/SimGeneral/Debugging/plugins/CaloParticleDebugger.cc @@ -8,6 +8,7 @@ #include #include #include +#include // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" @@ -113,6 +114,10 @@ CaloParticleDebugger::~CaloParticleDebugger() {} void CaloParticleDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { using namespace edm; + using std::begin; + using std::end; + using std::sort; + using std::iota; edm::Handle > simTracksH; edm::Handle > genParticlesH; @@ -122,18 +127,48 @@ CaloParticleDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& i iEvent.getByToken(simTracksToken_, simTracksH); auto const & tracks = *simTracksH.product(); + std::vector sorted_tracks_idx(tracks.size()); + iota(begin(sorted_tracks_idx), end(sorted_tracks_idx), 0); + sort(begin(sorted_tracks_idx), + end(sorted_tracks_idx), + [&tracks] (int i, int j) { + return tracks.at(i).momentum().eta() < tracks.at(j).momentum().eta(); + }); iEvent.getByToken(genParticlesToken_, genParticlesH); auto const & genParticles = *genParticlesH.product(); + std::vector sorted_genParticles_idx(genParticles.size()); + iota(begin(sorted_genParticles_idx), end(sorted_genParticles_idx), 0); + sort(begin(sorted_genParticles_idx), + end(sorted_genParticles_idx), [&genParticles](int i, int j) { + return genParticles.at(i).momentum().eta() < genParticles.at(j).momentum().eta();}); iEvent.getByToken(simVerticesToken_, simVerticesH); auto const & vertices = *simVerticesH.product(); + std::vector sorted_vertices_idx(vertices.size()); + iota(begin(sorted_vertices_idx), end(sorted_vertices_idx), 0); + sort(begin(sorted_vertices_idx), + end(sorted_vertices_idx), [&vertices](int i, int j){ + return vertices.at(i).vertexId() < vertices.at(j).vertexId(); + }); iEvent.getByToken(trackingParticlesToken_, trackingParticlesH); auto const & trackingpart = *trackingParticlesH.product(); + std::vector sorted_tp_idx(trackingpart.size()); + iota(begin(sorted_tp_idx), end(sorted_tp_idx), 0); + sort(begin(sorted_tp_idx), + end(sorted_tp_idx), [&trackingpart] (int i, int j){ + return trackingpart.at(i).eta() < trackingpart.at(j).eta(); + }); iEvent.getByToken(caloParticlesToken_, caloParticlesH); auto const & calopart = *caloParticlesH.product(); + std::vector sorted_cp_idx(calopart.size()); + iota(begin(sorted_cp_idx), + end(sorted_cp_idx), 0); + sort(begin(sorted_cp_idx), + end(sorted_cp_idx), [&calopart](int i, int j){ + return calopart.at(i).eta() < calopart.at(j).eta();}); // Let's first fill in hits information std::map detIdToTotalSimEnergy; @@ -144,7 +179,8 @@ CaloParticleDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& i std::map trackid_to_track_index; std::cout << "Printing SimTracks information" << std::endl; std::cout << "IDX\tTrackId\tPDGID\tMOMENTUM(x,y,z,E)\tVertexIdx\tGenPartIdx" << std::endl; - for (auto const & t : tracks) { + for (auto i : sorted_tracks_idx) { + auto const & t = tracks.at(i); std::cout << idx << "\t" << t.trackId() << "\t" << t << std::endl; trackid_to_track_index[t.trackId()] = idx; idx++; @@ -152,29 +188,33 @@ CaloParticleDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& i std::cout << "Printing GenParticles information" << std::endl; std::cout << "IDX\tPDGID\tMOMENTUM(x,y,z)\tVertex(x,y,z)" << std::endl; - idx = 0; - for (auto const & gp : genParticles) - std::cout << idx++ + for (auto i : sorted_genParticles_idx) { + auto const & gp = genParticles.at(i); + std::cout << i << "\t" << gp.pdgId() << "\t" << gp.momentum() << "\t" << gp.vertex() << std::endl; + } std::cout << "Printing SimVertex information" << std::endl; std::cout << "IDX\tPOSITION(x,y,z)\tPARENT_INDEX\tVERTEX_ID" << std::endl; - idx = 0; - for (auto const & v: vertices) { - std::cout << idx++ << "\t" << v << std::endl; + for (auto i : sorted_vertices_idx) { + auto const & v = vertices.at(i); + std::cout << i << "\t" << v << std::endl; } std::cout << "Printing TrackingParticles information" << std::endl; - idx = 0; - for (auto const & tp : trackingpart) - std::cout << idx++ << "\t" << tp << std::endl; + for (auto i : sorted_tp_idx) { + auto const & tp = trackingpart.at(i); + std::cout << i << "\t" << tp << std::endl; + } std::cout << "Printing CaloParticles information" << std::endl; idx = 0; - for (auto const & cp : calopart) { + for (auto i : sorted_cp_idx) { + auto const & cp = calopart.at(i); std::cout << idx++ << " |Eta|: " << std::abs(cp.momentum().eta()) - << "\tEnergy: " << cp.energy() << "\t" << cp << std::endl; + << "\tType: " << cp.pdgId() + << "\tEnergy: " << cp.energy() << "\t" << std::endl; // << cp << std::endl; double total_sim_energy = 0.; double total_cp_energy = 0.; std::cout << "--> Overall simclusters's size: " << cp.simClusters().size() << std::endl; From c853c2ac0c2d9bc300bcae0e810d60b429a9026c Mon Sep 17 00:00:00 2001 From: Marco Rovere Date: Mon, 19 Feb 2018 17:20:34 +0100 Subject: [PATCH 109/426] Debug also SimClusters --- .../Debugging/plugins/CaloParticleDebugger.cc | 50 ++++++++++++++++++- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/SimGeneral/Debugging/plugins/CaloParticleDebugger.cc b/SimGeneral/Debugging/plugins/CaloParticleDebugger.cc index 3a0f290700c2e..e1192eba24393 100644 --- a/SimGeneral/Debugging/plugins/CaloParticleDebugger.cc +++ b/SimGeneral/Debugging/plugins/CaloParticleDebugger.cc @@ -64,12 +64,14 @@ class CaloParticleDebugger : public edm::one::EDAnalyzer<> { edm::InputTag simVertices_; edm::InputTag trackingParticles_; edm::InputTag caloParticles_; + edm::InputTag simClusters_; std::vector collectionTags_; edm::EDGetTokenT > simTracksToken_; edm::EDGetTokenT > genParticlesToken_; edm::EDGetTokenT > simVerticesToken_; edm::EDGetTokenT > trackingParticlesToken_; edm::EDGetTokenT > caloParticlesToken_; + edm::EDGetTokenT> simClustersToken_; std::vector > > collectionTagsToken_; // ----------member data --------------------------- }; @@ -91,6 +93,7 @@ CaloParticleDebugger::CaloParticleDebugger(const edm::ParameterSet& iConfig) simVertices_(iConfig.getParameter("simVertices")), trackingParticles_(iConfig.getParameter("trackingParticles")), caloParticles_(iConfig.getParameter("caloParticles")), + simClusters_(iConfig.getParameter("simClusters")), collectionTags_(iConfig.getParameter >("collectionTags")) { edm::ConsumesCollector&& iC = consumesCollector(); simTracksToken_ = iC.consumes >(simTracks_); @@ -98,6 +101,7 @@ CaloParticleDebugger::CaloParticleDebugger(const edm::ParameterSet& iConfig) simVerticesToken_ = iC.consumes >(simVertices_); trackingParticlesToken_ = iC.consumes >(trackingParticles_); caloParticlesToken_ = iC.consumes >(caloParticles_); + simClustersToken_ = iC.consumes >(simClusters_); for (auto const & collectionTag : collectionTags_) { collectionTagsToken_.push_back(iC.consumes >(collectionTag)); } @@ -124,6 +128,7 @@ CaloParticleDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& i edm::Handle > simVerticesH; edm::Handle > trackingParticlesH; edm::Handle > caloParticlesH; + edm::Handle > simClustersH; iEvent.getByToken(simTracksToken_, simTracksH); auto const & tracks = *simTracksH.product(); @@ -170,6 +175,15 @@ CaloParticleDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& i end(sorted_cp_idx), [&calopart](int i, int j){ return calopart.at(i).eta() < calopart.at(j).eta();}); + iEvent.getByToken(simClustersToken_, simClustersH); + auto const & simclusters = *simClustersH.product(); + std::vector sorted_simcl_idx(simclusters.size()); + iota(begin(sorted_simcl_idx), + end(sorted_simcl_idx), 0); + sort(begin(sorted_simcl_idx), + end(sorted_simcl_idx), [&simclusters](int i, int j){ + return simclusters.at(i).eta() < simclusters.at(j).eta();}); + // Let's first fill in hits information std::map detIdToTotalSimEnergy; fillSimHits(detIdToTotalSimEnergy, iEvent, iSetup); @@ -212,12 +226,26 @@ CaloParticleDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& i idx = 0; for (auto i : sorted_cp_idx) { auto const & cp = calopart.at(i); - std::cout << idx++ << " |Eta|: " << std::abs(cp.momentum().eta()) + std::cout << "\n\n" << idx++ << " |Eta|: " << std::abs(cp.momentum().eta()) << "\tType: " << cp.pdgId() - << "\tEnergy: " << cp.energy() << "\t" << std::endl; // << cp << std::endl; + << "\tEnergy: " << cp.energy() + << "\tIdx: " << cp.g4Tracks()[0].trackId() << std::endl; // << cp << std::endl; double total_sim_energy = 0.; double total_cp_energy = 0.; std::cout << "--> Overall simclusters's size: " << cp.simClusters().size() << std::endl; + // All the next mess just to print the simClusters ordered + auto const & simcs = cp.simClusters(); + std::vector sorted_sc_idx(simcs.size()); + iota(begin(sorted_sc_idx), end(sorted_sc_idx), 0); + sort(begin(sorted_sc_idx), + end(sorted_sc_idx), + [&simcs] (int i, int j) { + return simcs.at(i)->momentum().eta() < simcs.at(j)->momentum().eta(); + }); + for (auto i : sorted_sc_idx) { + std::cout << *(simcs.at(i)); + } + for (auto const & sc : cp.simClusters()) { for (auto const & cl : sc->hits_and_fractions()) { total_sim_energy += detIdToTotalSimEnergy[cl.first]*cl.second; @@ -227,6 +255,23 @@ CaloParticleDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& i std::cout << "--> Overall SC energy (sum using sim energies): " << total_sim_energy << std::endl; std::cout << "--> Overall SC energy (sum using CaloP energies): " << total_cp_energy << std::endl; } + + idx = 0; + std::cout << "Printing SimClusters information" << std::endl; + for (auto i : sorted_simcl_idx) { + auto const & simcl = simclusters.at(i); + std::cout << "\n\n" << idx++ << " |Eta|: " << std::abs(simcl.momentum().eta()) + << "\tType: " << simcl.pdgId() + << "\tEnergy: " << simcl.energy() + << "\tKey: " << i << std::endl; // << simcl << std::endl; + double total_sim_energy = 0.; + std::cout << "--> Overall simclusters's size: " << simcl.numberOfRecHits() << std::endl; + for (auto const & cl : simcl.hits_and_fractions()) { + total_sim_energy += detIdToTotalSimEnergy[cl.first]*cl.second; + } + std::cout << simcl << std::endl; + std::cout << "--> Overall SimCluster energy (sum using sim energies): " << total_sim_energy << std::endl; + } } @@ -304,6 +349,7 @@ CaloParticleDebugger::fillDescriptions(edm::ConfigurationDescriptions& descripti desc.add("simVertices", edm::InputTag("g4SimHits")); desc.add("trackingParticles", edm::InputTag("mix", "MergedTrackTruth")); desc.add("caloParticles", edm::InputTag("mix", "MergedCaloTruth")); + desc.add("simClusters", edm::InputTag("mix", "MergedCaloTruth")); desc.add >("collectionTags", { edm::InputTag("g4SimHits", "HGCHitsEE"), edm::InputTag("g4SimHits", "HGCHitsHEfront"), From 2e157bcd01460d03397ddf86ee4304c2a9761542 Mon Sep 17 00:00:00 2001 From: Marco Rovere Date: Tue, 13 Mar 2018 11:39:49 +0100 Subject: [PATCH 110/426] Improve CaloParticle Validation Add more histograms to monitor CaloParticles and monitor more kind of particles based on their pdgId. --- .../HGCalValidation/plugins/BuildFile.xml | 1 + .../plugins/CaloParticleValidation.cc | 63 ++++++++++++++++++- .../python/hgcalHitValidation_cfi.py | 3 +- 3 files changed, 64 insertions(+), 3 deletions(-) diff --git a/Validation/HGCalValidation/plugins/BuildFile.xml b/Validation/HGCalValidation/plugins/BuildFile.xml index f86a4cd44a910..36cc014ac26a6 100644 --- a/Validation/HGCalValidation/plugins/BuildFile.xml +++ b/Validation/HGCalValidation/plugins/BuildFile.xml @@ -3,6 +3,7 @@ + diff --git a/Validation/HGCalValidation/plugins/CaloParticleValidation.cc b/Validation/HGCalValidation/plugins/CaloParticleValidation.cc index 998c6af486452..7bc317a60cb58 100644 --- a/Validation/HGCalValidation/plugins/CaloParticleValidation.cc +++ b/Validation/HGCalValidation/plugins/CaloParticleValidation.cc @@ -20,8 +20,11 @@ #include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" #include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" +#include "DataFormats/EgammaReco/interface/SuperCluster.h" #include "DataFormats/HGCRecHit/interface/HGCRecHitCollections.h" #include "SimDataFormats/Vertex/interface/SimVertex.h" +#include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" +#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" // // class declaration @@ -36,8 +39,17 @@ struct Histogram_CaloParticleSingle { ConcurrentMonitorElement selfEnergy_; // this is the sum of the energy associated to all recHits linked to all SimClusters ConcurrentMonitorElement energyDifference_; // This contains (energy-selfEnergy)/energy ConcurrentMonitorElement eta_Zorigin_map_; + ConcurrentMonitorElement simPFSuperClusterSize_; + ConcurrentMonitorElement simPFSuperClusterEnergy_; + ConcurrentMonitorElement pfcandidateType_; + ConcurrentMonitorElement pfcandidateEnergy_; + ConcurrentMonitorElement pfcandidatePt_; + ConcurrentMonitorElement pfcandidateEta_; + ConcurrentMonitorElement pfcandidatePhi_; + ConcurrentMonitorElement pfcandidateElementsInBlocks_; }; + using Histograms_CaloParticleValidation = std::unordered_map; class CaloParticleValidation : public DQMGlobalEDAnalyzer { @@ -64,6 +76,8 @@ class CaloParticleValidation : public DQMGlobalEDAnalyzer > simVertices_; edm::EDGetTokenT > caloParticles_; + edm::EDGetTokenT> simPFClusters_; + edm::EDGetTokenT simPFCandidates_; edm::EDGetTokenT recHitsEE_; edm::EDGetTokenT recHitsFH_; edm::EDGetTokenT recHitsBH_; @@ -85,6 +99,8 @@ CaloParticleValidation::CaloParticleValidation(const edm::ParameterSet& iConfig) particles_to_monitor_(iConfig.getParameter >("particles_to_monitor")), simVertices_(consumes>(iConfig.getParameter("simVertices"))), caloParticles_(consumes >(iConfig.getParameter("caloParticles"))), + simPFClusters_(consumes>(iConfig.getParameter("simPFClusters"))), + simPFCandidates_(consumes(iConfig.getParameter("simPFCandidates"))), recHitsEE_(consumes(iConfig.getParameter("recHitsEE"))), recHitsFH_(consumes(iConfig.getParameter("recHitsFH"))), recHitsBH_(consumes(iConfig.getParameter("recHitsBH"))) @@ -142,6 +158,14 @@ CaloParticleValidation::dqmAnalyze(edm::Event const& iEvent, edm::EventSetup con iEvent.getByToken(caloParticles_, caloParticleHandle); std::vector const & caloParticles = *caloParticleHandle; + Handle> simPFClustersHandle; + iEvent.getByToken(simPFClusters_, simPFClustersHandle); + std::vector const & simPFClusters = *simPFClustersHandle; + + Handle simPFCandidatesHandle; + iEvent.getByToken(simPFCandidates_, simPFCandidatesHandle); + reco::PFCandidateCollection const & simPFCandidates = *simPFCandidatesHandle; + for (auto const caloParticle : caloParticles) { int id = caloParticle.pdgId(); if (histos.count(id)) { @@ -166,6 +190,24 @@ CaloParticleValidation::dqmAnalyze(edm::Event const& iEvent, edm::EventSetup con histos.at(id).energyDifference_.fill(1.- energy/caloParticle.energy()); } } + + // simPFSuperClusters + for (auto const sc : simPFClusters) { + histos.at(0).simPFSuperClusterSize_.fill((float)sc.clustersSize()); + histos.at(0).simPFSuperClusterEnergy_.fill(sc.rawEnergy()); + } + + // simPFCandidates + int offset = 100000; + for (auto const pfc : simPFCandidates) { + size_t type = offset + pfc.particleId(); + histos.at(offset).pfcandidateType_.fill(type - offset); + histos.at(type).pfcandidateEnergy_.fill(pfc.energy()); + histos.at(type).pfcandidatePt_.fill(pfc.pt()); + histos.at(type).pfcandidateEta_.fill(pfc.eta()); + histos.at(type).pfcandidatePhi_.fill(pfc.phi()); + histos.at(type).pfcandidateElementsInBlocks_.fill(pfc.elementsInBlocks().size()); + } } @@ -176,7 +218,7 @@ CaloParticleValidation::bookHistograms(DQMStore::ConcurrentBooker & ibook, Histograms_CaloParticleValidation & histos) const { for (auto const particle : particles_to_monitor_) { - ibook.setCurrentFolder(folder_ + std::to_string(particle)); + ibook.setCurrentFolder(folder_ + "CaloParticles/" + std::to_string(particle)); histos[particle].eta_ = ibook.book1D("Eta", "Eta", 80, -4., 4.); histos[particle].energy_ = ibook.book1D("Energy", "Energy", 250, 0., 500.); histos[particle].pt_ = ibook.book1D("Pt", "Pt", 100, 0., 100.); @@ -186,6 +228,21 @@ CaloParticleValidation::bookHistograms(DQMStore::ConcurrentBooker & ibook, histos[particle].energyDifference_ = ibook.book1D("EnergyDifference", "(Energy-SelfEnergy)/Energy", 300, -5., 1.); histos[particle].eta_Zorigin_map_ = ibook.book2D("Eta vs Zorigin", "Eta vs Zorigin", 80, -4., 4., 1100, -550., 550.); } + int offset = 100000; + ibook.setCurrentFolder(folder_ + "PFCandidates"); + histos[offset].pfcandidateType_ = ibook.book1D("PFCandidateType", "PFCandidateType", 10, 0, 10); + for (size_t type = reco::PFCandidate::h; type <= reco::PFCandidate::egamma_HF; type++) { + ibook.setCurrentFolder(folder_ + "PFCandidates/" + std::to_string(type)); + histos[offset + type].pfcandidateEnergy_ = ibook.book1D("PFCandidateEnergy", "PFCandidateEnergy", 250, 0., 250.); + histos[offset + type].pfcandidatePt_ = ibook.book1D("PFCandidatePt", "PFCandidatePt", 250, 0., 250.); + histos[offset + type].pfcandidateEta_ = ibook.book1D("PFCandidateEta", "PFCandidateEta", 100, -5., 5.); + histos[offset + type].pfcandidatePhi_ = ibook.book1D("PFCandidatePhi", "PFCandidatePhi", 100, -4., 4.); + histos[offset + type].pfcandidateElementsInBlocks_ = ibook.book1D("PFCandidateElements", "PFCandidateElements", 20, 0., 20.); + } + // Folder '0' is meant to be cumulative, with no connection to pdgId + ibook.setCurrentFolder(folder_ + std::to_string(0)); + histos[0].simPFSuperClusterSize_ = ibook.book1D("SimPFSuperClusterSize", "SimPFSuperClusterSize", 40, 0., 40.); + histos[0].simPFSuperClusterEnergy_ = ibook.book1D("SimPFSuperClusterEnergy", "SimPFSuperClusterEnergy", 250, 0., 500.); } // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ @@ -195,9 +252,11 @@ CaloParticleValidation::fillDescriptions(edm::ConfigurationDescriptions& descrip // Please change this to state exactly what you do use, even if it is no parameters edm::ParameterSetDescription desc; desc.add("folder", "HGCAL/"); // Please keep the trailing '/' - desc.add > ("particles_to_monitor", {11, -11, 13, 22, 111, 211, -211}); + desc.add > ("particles_to_monitor", {11, -11, 13, 22, 111, 211, -211, 321, -321}); desc.add("simVertices", edm::InputTag("g4SimHits")); desc.add("caloParticles", edm::InputTag("mix", "MergedCaloTruth")); + desc.add("simPFClusters", edm::InputTag("simPFProducer", "perfect")); + desc.add("simPFCandidates", edm::InputTag("simPFProducer")); desc.add("recHitsEE", edm::InputTag("HGCalRecHit","HGCEERecHits")); desc.add("recHitsFH", edm::InputTag("HGCalRecHit","HGCHEFRecHits")); desc.add("recHitsBH", edm::InputTag("HGCalRecHit","HGCHEBRecHits")); diff --git a/Validation/HGCalValidation/python/hgcalHitValidation_cfi.py b/Validation/HGCalValidation/python/hgcalHitValidation_cfi.py index a6ad02ab42580..7763c2c6ec891 100644 --- a/Validation/HGCalValidation/python/hgcalHitValidation_cfi.py +++ b/Validation/HGCalValidation/python/hgcalHitValidation_cfi.py @@ -17,5 +17,6 @@ ) from Validation.HGCalValidation.hgcalHitCalibration_cfi import hgcalHitCalibration +from Validation.HGCalValidation.caloparticlevalidation_cfi import caloparticlevalidation -hgcalHitValidationSequence = cms.Sequence(hgcalHitValidation+hgcalHitCalibration) +hgcalHitValidationSequence = cms.Sequence(hgcalHitValidation+hgcalHitCalibration+caloparticlevalidation) From fd504b2505111cc39083be3556a02a7f6638aa89 Mon Sep 17 00:00:00 2001 From: Marco Rovere Date: Tue, 13 Mar 2018 11:28:45 +0100 Subject: [PATCH 111/426] Add more CaloParticles Few particles are linked still to vertex 0 but are separate from the main vertex graph. This will recover them and promote them to be CaloParticles if them or any of their children leave hits in the configured calorimeters. --- .../plugins/CaloTruthAccumulator.cc | 33 +++++++++++-------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc index e9c9f9e9a2418..d5b320edafd84 100644 --- a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc +++ b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc @@ -58,6 +58,7 @@ namespace { using Index_t = unsigned; using Barcode_t = int; +const std::string messageCategoryGraph_("CaloTruthAccumulatorGraphProducer"); } using boost::adjacency_list; @@ -75,7 +76,7 @@ using boost::vertex_name; /* GRAPH DEFINITIONS - The graph represents the full decay chain. + The graphs represent the full decay chain. The parent-child relationship is the natural one, following "time". @@ -213,7 +214,7 @@ template void accumulateSimHits_edge(Edge& e, const Graph& g, Visitor* v) { auto const edge_property = get(edge_weight, g, e); v->total_simHits += edge_property.simHits; - IfLogDebug(DEBUG, messageCategory_) + IfLogDebug(DEBUG, messageCategoryGraph_) << " Examining edges " << e << " --> particle " << edge_property.simTrack->type() << "(" << edge_property.simTrack->trackId() << ")" << " with SimClusters: " << edge_property.simHits @@ -222,12 +223,12 @@ void accumulateSimHits_edge(Edge& e, const Graph& g, Visitor* v) { template void print_vertex(Vertex& u, const Graph& g) { auto const vertex_property = get(vertex_name, g, u); - IfLogDebug(DEBUG, messageCategory_) << " At " << u; + IfLogDebug(DEBUG, messageCategoryGraph_) << " At " << u; // The Mother of all vertices has **no** SimTrack associated. if (vertex_property.simTrack) - IfLogDebug(DEBUG, messageCategory_) << " [" << vertex_property.simTrack->type() << "]" + IfLogDebug(DEBUG, messageCategoryGraph_) << " [" << vertex_property.simTrack->type() << "]" << "(" << vertex_property.simTrack->trackId() << ")"; - IfLogDebug(DEBUG, messageCategory_) << std::endl; + IfLogDebug(DEBUG, messageCategoryGraph_) << std::endl; } // Graphviz output functions will only be generated in DEBUG mode @@ -272,19 +273,19 @@ class SimHitsAccumulator_dfs_visitor : public boost::default_dfs_visitor { VertexProperty(src_vertex_property.simTrack, cumulative)); put(get(edge_weight, const_cast(g)), e, EdgeProperty(edge_property.simTrack, edge_property.simHits, cumulative)); - IfLogDebug(DEBUG, messageCategory_) + IfLogDebug(DEBUG, messageCategoryGraph_) << " Finished edge: " << e << " Track id: " << get(edge_weight, g, e).simTrack->trackId() << " has accumulated " << cumulative << " hits" << std::endl; - IfLogDebug(DEBUG, messageCategory_) + IfLogDebug(DEBUG, messageCategoryGraph_) << " SrcVtx: " << src << "\t" << get(vertex_name, g, src).simTrack << "\t" << get(vertex_name, g, src).cumulative_simHits << std::endl; - IfLogDebug(DEBUG, messageCategory_) + IfLogDebug(DEBUG, messageCategoryGraph_) << " TrgVtx: " << trg << "\t" << get(vertex_name, g, trg).simTrack << "\t" << get(vertex_name, g, trg).cumulative_simHits << std::endl; } }; -typedef std::function Selector; +using Selector = std::function; class CaloParticle_dfs_visitor : public boost::default_dfs_visitor { public: @@ -302,12 +303,12 @@ class CaloParticle_dfs_visitor : public boost::default_dfs_visitor { void discover_vertex(Vertex u, const Graph& g) { // If we reach the vertex 0, it means that we are backtracking with respect // to the first generation of stable particles: simply return; - if (u == 0) return; + // if (u == 0) return; print_vertex(u, g); auto const vertex_property = get(vertex_name, g, u); if (!vertex_property.simTrack) return; auto trackIdx = vertex_property.simTrack->trackId(); - IfLogDebug(DEBUG, messageCategory_) + IfLogDebug(DEBUG, messageCategoryGraph_) << " Found " << simHitBarcodeToIndex_.count(trackIdx) << " associated simHits" << std::endl; if (simHitBarcodeToIndex_.count(trackIdx)) { output_.pSimClusters->emplace_back(*vertex_property.simTrack); @@ -324,9 +325,14 @@ class CaloParticle_dfs_visitor : public boost::default_dfs_visitor { template void examine_edge(Edge e, const Graph& g) { auto src = source(e, g); - if (src == 0) { + auto vertex_property = get(vertex_name, g, src); + if (src == 0 or (vertex_property.simTrack == nullptr)) { auto edge_property = get(edge_weight, g, e); + IfLogDebug(DEBUG, messageCategoryGraph_) + << "Considering CaloParticle: " << edge_property.simTrack->trackId(); if (selector_(edge_property)) { + IfLogDebug(DEBUG, messageCategoryGraph_) + << "Adding CaloParticle: " << edge_property.simTrack->trackId(); output_.pCaloParticles->emplace_back(*(edge_property.simTrack)); caloParticles_.sc_start_.push_back(output_.pSimClusters->size()); } @@ -336,7 +342,8 @@ class CaloParticle_dfs_visitor : public boost::default_dfs_visitor { template void finish_edge(Edge e, const Graph& g) { auto src = source(e, g); - if (src == 0) { + auto vertex_property = get(vertex_name, g, src); + if (src == 0 or (vertex_property.simTrack == nullptr)) { auto edge_property = get(edge_weight, g, e); if (selector_(edge_property)) { caloParticles_.sc_stop_.push_back(output_.pSimClusters->size()); From d759937311477928ec27954dbc166f81c44fd568 Mon Sep 17 00:00:00 2001 From: Marco Rovere Date: Mon, 12 Mar 2018 11:47:08 +0100 Subject: [PATCH 112/426] Recover CaloParticle into SimPFProducer Every CaloParticle is linked to the first stable particle originating the cascade of particles that left hits in the calorimeters: that stable particle is not included as a simCluster (unless it itself left hits in the calorimiters). Additional code has been added to find a matching track based on the trackId linked to the CaloParticle itself, not to the associated simClusters. The most important clients affected by this change are electrons. --- .../PFSimProducer/plugins/BuildFile.xml | 1 + .../PFSimProducer/plugins/SimPFProducer.cc | 82 +++++++++++-------- 2 files changed, 49 insertions(+), 34 deletions(-) diff --git a/RecoParticleFlow/PFSimProducer/plugins/BuildFile.xml b/RecoParticleFlow/PFSimProducer/plugins/BuildFile.xml index 6de7d3b7135ad..024456f287afd 100644 --- a/RecoParticleFlow/PFSimProducer/plugins/BuildFile.xml +++ b/RecoParticleFlow/PFSimProducer/plugins/BuildFile.xml @@ -29,6 +29,7 @@ +
diff --git a/RecoParticleFlow/PFSimProducer/plugins/SimPFProducer.cc b/RecoParticleFlow/PFSimProducer/plugins/SimPFProducer.cc index 89f8a955a4f09..234f45014589c 100644 --- a/RecoParticleFlow/PFSimProducer/plugins/SimPFProducer.cc +++ b/RecoParticleFlow/PFSimProducer/plugins/SimPFProducer.cc @@ -56,22 +56,22 @@ #include "FWCore/Utilities/interface/transform.h" class SimPFProducer : public edm::global::EDProducer<> { -public: +public: SimPFProducer(const edm::ParameterSet&); ~SimPFProducer() override { } - + void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; - -private: + +private: // parameters const double superClusterThreshold_, neutralEMThreshold_, neutralHADThreshold_; const bool useTiming_; - + // inputs const edm::EDGetTokenT > pfRecTracks_; const edm::EDGetTokenT > tracks_; const edm::EDGetTokenT > gsfTracks_; - const edm::EDGetTokenT muons_; + const edm::EDGetTokenT muons_; const edm::EDGetTokenT> srcTrackTime_, srcTrackTimeError_; const edm::EDGetTokenT> srcGsfTrackTime_, srcGsfTrackTimeError_; const edm::EDGetTokenT trackingParticles_; @@ -86,7 +86,7 @@ class SimPFProducer : public edm::global::EDProducer<> { DEFINE_FWK_MODULE(SimPFProducer); namespace { - + template uint64_t hashSimInfo(const T& simTruth,size_t i = 0) { uint64_t evtid = simTruth.eventId().rawId(); @@ -119,7 +119,7 @@ SimPFProducer::SimPFProducer(const edm::ParameterSet& conf) : produces(); } -void SimPFProducer::produce(edm::StreamID, edm::Event& evt, const edm::EventSetup& es) const { +void SimPFProducer::produce(edm::StreamID, edm::Event& evt, const edm::EventSetup& es) const { //get associators std::vector > associators; for( const auto& token : associators_ ) { @@ -127,7 +127,7 @@ void SimPFProducer::produce(edm::StreamID, edm::Event& evt, const edm::EventSetu auto& back = associators.back(); evt.getByToken(token,back); } - + //get PFRecTrack edm::Handle > PFTrackCollectionH; evt.getByToken(pfRecTracks_,PFTrackCollectionH); @@ -137,7 +137,7 @@ void SimPFProducer::produce(edm::StreamID, edm::Event& evt, const edm::EventSetu const auto ptr = PFTrackCollection.ptrAt(i); PFTrackToGeneralTrack.insert(ptr->trackRef().key()); } - + //get track collections edm::Handle > TrackCollectionH; evt.getByToken(tracks_, TrackCollectionH); @@ -160,7 +160,7 @@ void SimPFProducer::produce(edm::StreamID, edm::Event& evt, const edm::EventSetu evt.getByToken(srcGsfTrackTime_, gsfTrackTimeH); evt.getByToken(srcGsfTrackTimeError_, gsfTrackTimeErrH); } - + //get tracking particle collections edm::Handle TPCollectionH; evt.getByToken(trackingParticles_, TPCollectionH); @@ -179,7 +179,7 @@ void SimPFProducer::produce(edm::StreamID, edm::Event& evt, const edm::EventSetu evt.getByToken(simClusters_,SimClustersH); const std::vector& SimClusters = *SimClustersH; - std::unordered_map hashToSimCluster; + std::unordered_map hashToSimCluster; for( unsigned i = 0; i < SimClustersTruth.size(); ++i ) { const auto& simTruth = SimClustersTruth[i]; @@ -187,7 +187,7 @@ void SimPFProducer::produce(edm::StreamID, edm::Event& evt, const edm::EventSetu } // associate the reco tracks / gsf Tracks - std::vector associatedTracks, associatedTracksGsf; + std::vector associatedTracks, associatedTracksGsf; for( auto associator : associators ) { associatedTracks.emplace_back(associator->associateRecoToSim(TrackCollectionH, TPCollectionH)); //associatedTracksGsf.emplace_back(associator->associateRecoToSim(GsfTrackCollectionH, TPCollectionH)); @@ -213,18 +213,18 @@ void SimPFProducer::produce(edm::StreamID, edm::Event& evt, const edm::EventSetu auto pdgId = std::abs(simc->pdgId()); edm::Ref > clusterRef(SimClustersH,simc.key()); if( ( (pdgId == 22 || pdgId == 11) && clusterRef->energy() > neutralEMThreshold_) || - clusterRef->energy() > neutralHADThreshold_ ) { + clusterRef->energy() > neutralHADThreshold_ ) { good_simclusters.push_back(isc); etot += clusterRef->energy(); - pttot += clusterRef->pt(); + pttot += clusterRef->pt(); auto bec = std::make_unique(clusterRef,reco::PFBlockElement::HGCAL); block.addElement(bec.get()); simCluster2Block[simc.key()] = icp; simCluster2BlockIndex[simc.key()] = bec->index(); - caloParticle2SimCluster.emplace(icp,simc.key()); + caloParticle2SimCluster.emplace(CaloParticles[icp].g4Tracks()[0].trackId(), simc.key()); } } - + auto pdgId = std::abs(CaloParticles[icp].pdgId()); caloParticle2SuperCluster.push_back(-1); @@ -245,12 +245,13 @@ void SimPFProducer::produce(edm::StreamID, edm::Event& evt, const edm::EventSetu superclusters->emplace_back(etot,seedpos,seed,clusters); } } + auto blocksHandle = evt.put(std::move(blocks)); auto superClustersHandle = evt.put(std::move(superclusters),"perfect"); - + // list tracks so we can mark them as used and/or fight over them - std::vector usedTrack(TrackCollection.size(),false), - //usedGsfTrack(GsfTrackCollection.size(),false), + std::vector usedTrack(TrackCollection.size(),false), + //usedGsfTrack(GsfTrackCollection.size(),false), usedSimCluster(SimClusters.size(),false); auto candidates = std::make_unique(); @@ -267,14 +268,14 @@ void SimPFProducer::produce(edm::StreamID, edm::Event& evt, const edm::EventSetu if( assoc_tps == associatedTracks.back().end() ) continue; // assured now that we are matched to a set of tracks const auto& matches = assoc_tps->val; - + const auto absPdgId = std::abs(matches[0].first->pdgId()); const auto charge = tkRef->charge(); const auto three_mom = tkRef->momentum(); constexpr double mpion2 = 0.13957*0.13957; double energy = std::sqrt(three_mom.mag2() + mpion2); math::XYZTLorentzVector trk_p4(three_mom.x(),three_mom.y(),three_mom.z(),energy); - + reco::PFCandidate::ParticleType part_type; switch( absPdgId ) { @@ -287,22 +288,22 @@ void SimPFProducer::produce(edm::StreamID, edm::Event& evt, const edm::EventSetu default: part_type = reco::PFCandidate::h; } - + candidates->emplace_back(charge, trk_p4, part_type); auto& candidate = candidates->back(); candidate.setTrackRef(tkRef.castTo()); - + if (useTiming_) candidate.setTime( (*trackTimeH)[tkRef], (*trackTimeErrH)[tkRef] ); - + // bind to cluster if there is one and try to gather conversions, etc - for( const auto& match : matches ) { + for( const auto& match : matches ) { uint64_t hash = hashSimInfo(*(match.first)); - if( hashToSimCluster.count(hash) ) { + if( hashToSimCluster.count(hash) ) { auto simcHash = hashToSimCluster[hash]; - - if( !usedSimCluster[simcHash] ) { - if( simCluster2Block.count(simcHash) && + + if( !usedSimCluster[simcHash] ) { + if( simCluster2Block.count(simcHash) && simCluster2BlockIndex.count(simcHash) ) { size_t block = simCluster2Block.find(simcHash)->second; size_t blockIdx = simCluster2BlockIndex.find(simcHash)->second; @@ -324,21 +325,34 @@ void SimPFProducer::produce(edm::StreamID, edm::Event& evt, const edm::EventSetu usedSimCluster[ref.key()] = true; } } - + //*TODO* cluster time is not reliable at the moment, so just keep time from the track if available } } } } + // Now try to include also electrons that have been reconstructed using the GraphCaloParticles + else if (caloParticle2SimCluster.count(match.first->g4Tracks()[0].trackId())) { + auto range = caloParticle2SimCluster.equal_range(match.first->g4Tracks()[0].trackId()); + for (auto it = range.first; it != range.second; ++it) { + if (!usedSimCluster[it->second]) { + usedSimCluster[it->second] = true; + size_t block = simCluster2Block.find(it->second)->second; + size_t blockIdx = simCluster2BlockIndex.find(it->second)->second; + edm::Ref blockRef(blocksHandle,block); + candidate.addElementInBlock(blockRef,blockIdx); + } + } + } } - usedTrack[tkRef.key()] = true; + usedTrack[tkRef.key()] = true; // remove tracks already used by muons if( MuonTrackToGeneralTrack.count(itk) || absPdgId == 13) candidates->pop_back(); } - // now loop over the non-collected clusters in blocks + // now loop over the non-collected clusters in blocks // and turn them into neutral hadrons or photons const auto& theblocks = *blocksHandle; for( unsigned ibl = 0; ibl < theblocks.size(); ++ibl ) { @@ -367,6 +381,6 @@ void SimPFProducer::produce(edm::StreamID, edm::Event& evt, const edm::EventSetu } } } - + evt.put(std::move(candidates)); } From 506b3a4e127567ba979feb29c4fe158a0653b0c2 Mon Sep 17 00:00:00 2001 From: Marco Rovere Date: Mon, 12 Mar 2018 13:43:57 +0100 Subject: [PATCH 113/426] Actually implement changes of 4f139f44cb515c3cad7137fa6ca22c38ce96f772 --- SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc index d5b320edafd84..9900ea722f696 100644 --- a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc +++ b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc @@ -23,7 +23,7 @@ #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/Framework/interface/ProducerBase.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/InputTag.h" @@ -124,7 +124,7 @@ using DecayChain = adjacency_list Date: Tue, 13 Mar 2018 14:55:50 +0100 Subject: [PATCH 114/426] Apply code-checks --- .../HGCalValidation/plugins/CaloParticleValidation.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Validation/HGCalValidation/plugins/CaloParticleValidation.cc b/Validation/HGCalValidation/plugins/CaloParticleValidation.cc index 7bc317a60cb58..dd0020d41b2ed 100644 --- a/Validation/HGCalValidation/plugins/CaloParticleValidation.cc +++ b/Validation/HGCalValidation/plugins/CaloParticleValidation.cc @@ -55,18 +55,18 @@ using Histograms_CaloParticleValidation = std::unordered_map { public: explicit CaloParticleValidation(const edm::ParameterSet&); - ~CaloParticleValidation(); + ~CaloParticleValidation() override; static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: - virtual void bookHistograms(DQMStore::ConcurrentBooker &, + void bookHistograms(DQMStore::ConcurrentBooker &, edm::Run const&, edm::EventSetup const&, Histograms_CaloParticleValidation&) const override; - virtual void dqmAnalyze(edm::Event const&, + void dqmAnalyze(edm::Event const&, edm::EventSetup const&, Histograms_CaloParticleValidation const&) const override; From 1bd7e492c5740a74308acff3a9fc2a917ce3421b Mon Sep 17 00:00:00 2001 From: Marco Rovere Date: Tue, 13 Mar 2018 15:24:33 +0100 Subject: [PATCH 115/426] Remove unused dependency --- RecoParticleFlow/PFSimProducer/plugins/BuildFile.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/RecoParticleFlow/PFSimProducer/plugins/BuildFile.xml b/RecoParticleFlow/PFSimProducer/plugins/BuildFile.xml index 024456f287afd..6de7d3b7135ad 100644 --- a/RecoParticleFlow/PFSimProducer/plugins/BuildFile.xml +++ b/RecoParticleFlow/PFSimProducer/plugins/BuildFile.xml @@ -29,7 +29,6 @@ - From 6bc5b9403885d91e9b5660f05ce05a7988384017 Mon Sep 17 00:00:00 2001 From: Raffaele Date: Tue, 13 Mar 2018 17:51:43 +0100 Subject: [PATCH 116/426] updates for CalibrationRun/CalibrationScan analysis task --- .../interface/CalibrationAnalysis.h | 38 +++- .../SiStripObjects/src/CalibrationAnalysis.cc | 64 ++++++ .../interface/CalibrationAlgorithm.h | 3 +- .../interface/SiStripPulseShape.h | 24 +- .../src/CalibrationAlgorithm.cc | 205 ++++++++++++------ .../src/SiStripPulseShape.cc | 130 +++++++++-- .../data/summary.xml | 19 ++ .../src/CalibrationHistosUsingDb.cc | 1 - .../src/CalibrationScanTask.cc | 4 +- .../src/CalibrationTask.cc | 6 +- .../src/CalibrationSummaryFactory.cc | 146 ++++++++++++- .../interface/ConstantsForMonitorable.h | 36 ++- .../src/SiStripEnumsAndStrings.cc | 35 ++- 13 files changed, 591 insertions(+), 120 deletions(-) diff --git a/CondFormats/SiStripObjects/interface/CalibrationAnalysis.h b/CondFormats/SiStripObjects/interface/CalibrationAnalysis.h index 467a3bb122d55..73d481f048944 100644 --- a/CondFormats/SiStripObjects/interface/CalibrationAnalysis.h +++ b/CondFormats/SiStripObjects/interface/CalibrationAnalysis.h @@ -33,6 +33,10 @@ class CalibrationAnalysis : public CommissioningAnalysis { inline const VVFloat& tail() const { return tail_; } inline const VVFloat& riseTime() const { return riseTime_; } inline const VVFloat& timeConstant() const { return timeConstant_; } + inline const VVFloat& turnOn() const { return turnOn_; } + inline const VVFloat& maximum() const { return maximum_; } + inline const VVFloat& undershoot() const { return undershoot_; } + inline const VVFloat& baseline() const { return baseline_; } inline const VVFloat& smearing() const { return smearing_; } inline const VVFloat& chi2() const { return chi2_; } @@ -42,6 +46,10 @@ class CalibrationAnalysis : public CommissioningAnalysis { inline const VFloat& riseTimeMean() const { return mean_riseTime_; } inline const VFloat& timeConstantMean() const { return mean_timeConstant_; } inline const VFloat& smearingMean() const { return mean_smearing_; } + inline const VFloat& turnOnMean() const { return mean_turnOn_; } + inline const VFloat& maximumMean() const { return mean_maximum_; } + inline const VFloat& undershootMean() const { return mean_undershoot_; } + inline const VFloat& baselineMean() const { return mean_baseline_; } inline const VFloat& chi2Mean() const { return mean_chi2_; } // spread, min and max @@ -65,6 +73,22 @@ class CalibrationAnalysis : public CommissioningAnalysis { inline const VFloat& smearingMin() const { return min_smearing_; } inline const VFloat& smearingMax() const { return max_smearing_; } + inline const VFloat& turnOnSpread() const { return spread_turnOn_; } + inline const VFloat& turnOnMin() const { return min_turnOn_; } + inline const VFloat& turnOnMax() const { return max_turnOn_; } + + inline const VFloat& maximumSpread() const { return spread_maximum_; } + inline const VFloat& maximumMin() const { return min_maximum_; } + inline const VFloat& maximumMax() const { return max_maximum_; } + + inline const VFloat& undershootSpread() const { return spread_undershoot_; } + inline const VFloat& undershootMin() const { return min_undershoot_; } + inline const VFloat& undershootMax() const { return max_undershoot_; } + + inline const VFloat& baselineSpread() const { return spread_baseline_; } + inline const VFloat& baselineMin() const { return min_baseline_; } + inline const VFloat& baselineMax() const { return max_baseline_; } + inline const VFloat& chi2Spread() const { return spread_chi2_; } inline const VFloat& chi2Min() const { return min_chi2_; } inline const VFloat& chi2Max() const { return max_chi2_; } @@ -79,15 +103,11 @@ class CalibrationAnalysis : public CommissioningAnalysis { private: /** Parameters extracted from the fit of pulse shape */ - VVFloat amplitude_, tail_, riseTime_, timeConstant_, smearing_, chi2_; - - VFloat mean_amplitude_,mean_tail_,mean_riseTime_,mean_timeConstant_,mean_smearing_,mean_chi2_; - - VFloat min_amplitude_,min_tail_,min_riseTime_,min_timeConstant_,min_smearing_,min_chi2_; - - VFloat max_amplitude_,max_tail_,max_riseTime_,max_timeConstant_,max_smearing_,max_chi2_; - - VFloat spread_amplitude_,spread_tail_,spread_riseTime_,spread_timeConstant_,spread_smearing_,spread_chi2_; + VVFloat amplitude_, tail_, riseTime_, timeConstant_, turnOn_, maximum_, undershoot_, baseline_, smearing_, chi2_; + VFloat mean_amplitude_,mean_tail_,mean_riseTime_,mean_timeConstant_, mean_turnOn_, mean_maximum_, mean_undershoot_, mean_baseline_, mean_smearing_,mean_chi2_; + VFloat min_amplitude_,min_tail_,min_riseTime_,min_timeConstant_, min_turnOn_, min_maximum_, min_undershoot_, min_baseline_, min_smearing_,min_chi2_; + VFloat max_amplitude_,max_tail_,max_riseTime_,max_timeConstant_, max_turnOn_, max_maximum_, max_undershoot_, max_baseline_, max_smearing_,max_chi2_; + VFloat spread_amplitude_,spread_tail_,spread_riseTime_,spread_timeConstant_, spread_turnOn_, spread_maximum_, spread_undershoot_, spread_baseline_, spread_smearing_,spread_chi2_; /** fit mode: deconv or not ? */ bool deconv_; diff --git a/CondFormats/SiStripObjects/src/CalibrationAnalysis.cc b/CondFormats/SiStripObjects/src/CalibrationAnalysis.cc index 0606fbeca84a7..f9d3f900b31fd 100644 --- a/CondFormats/SiStripObjects/src/CalibrationAnalysis.cc +++ b/CondFormats/SiStripObjects/src/CalibrationAnalysis.cc @@ -17,30 +17,50 @@ CalibrationAnalysis::CalibrationAnalysis( const uint32_t& key, const bool& decon tail_(2,VFloat(128,sistrip::invalid_)), riseTime_(2,VFloat(128,sistrip::invalid_)), timeConstant_(2,VFloat(128,sistrip::invalid_)), + turnOn_(2,VFloat(128,sistrip::invalid_)), + maximum_(2,VFloat(128,sistrip::invalid_)), + undershoot_(2,VFloat(128,sistrip::invalid_)), + baseline_(2,VFloat(128,sistrip::invalid_)), smearing_(2,VFloat(128,sistrip::invalid_)), chi2_(2,VFloat(128,sistrip::invalid_)), mean_amplitude_(2,sistrip::invalid_), mean_tail_(2,sistrip::invalid_), mean_riseTime_(2,sistrip::invalid_), mean_timeConstant_(2,sistrip::invalid_), + mean_turnOn_(2,sistrip::invalid_), + mean_maximum_(2,sistrip::invalid_), + mean_undershoot_(2,sistrip::invalid_), + mean_baseline_(2,sistrip::invalid_), mean_smearing_(2,sistrip::invalid_), mean_chi2_(2,sistrip::invalid_), min_amplitude_(2,sistrip::invalid_), min_tail_(2,sistrip::invalid_), min_riseTime_(2,sistrip::invalid_), min_timeConstant_(2,sistrip::invalid_), + min_turnOn_(2,sistrip::invalid_), + min_maximum_(2,sistrip::invalid_), + min_undershoot_(2,sistrip::invalid_), + min_baseline_(2,sistrip::invalid_), min_smearing_(2,sistrip::invalid_), min_chi2_(2,sistrip::invalid_), max_amplitude_(2,sistrip::invalid_), max_tail_(2,sistrip::invalid_), max_riseTime_(2,sistrip::invalid_), max_timeConstant_(2,sistrip::invalid_), + max_turnOn_(2,sistrip::invalid_), + max_maximum_(2,sistrip::invalid_), + max_undershoot_(2,sistrip::invalid_), + max_baseline_(2,sistrip::invalid_), max_smearing_(2,sistrip::invalid_), max_chi2_(2,sistrip::invalid_), spread_amplitude_(2,sistrip::invalid_), spread_tail_(2,sistrip::invalid_), spread_riseTime_(2,sistrip::invalid_), spread_timeConstant_(2,sistrip::invalid_), + spread_turnOn_(2,sistrip::invalid_), + spread_maximum_(2,sistrip::invalid_), + spread_undershoot_(2,sistrip::invalid_), + spread_baseline_(2,sistrip::invalid_), spread_smearing_(2,sistrip::invalid_), spread_chi2_(2,sistrip::invalid_), deconv_(deconv), @@ -56,30 +76,50 @@ CalibrationAnalysis::CalibrationAnalysis(const bool& deconv, int calchan) tail_(2,VFloat(128,sistrip::invalid_)), riseTime_(2,VFloat(128,sistrip::invalid_)), timeConstant_(2,VFloat(128,sistrip::invalid_)), + turnOn_(2,VFloat(128,sistrip::invalid_)), + maximum_(2,VFloat(128,sistrip::invalid_)), + undershoot_(2,VFloat(128,sistrip::invalid_)), + baseline_(2,VFloat(128,sistrip::invalid_)), smearing_(2,VFloat(128,sistrip::invalid_)), chi2_(2,VFloat(128,sistrip::invalid_)), mean_amplitude_(2,sistrip::invalid_), mean_tail_(2,sistrip::invalid_), mean_riseTime_(2,sistrip::invalid_), mean_timeConstant_(2,sistrip::invalid_), + mean_turnOn_(2,sistrip::invalid_), + mean_maximum_(2,sistrip::invalid_), + mean_undershoot_(2,sistrip::invalid_), + mean_baseline_(2,sistrip::invalid_), mean_smearing_(2,sistrip::invalid_), mean_chi2_(2,sistrip::invalid_), min_amplitude_(2,sistrip::invalid_), min_tail_(2,sistrip::invalid_), min_riseTime_(2,sistrip::invalid_), min_timeConstant_(2,sistrip::invalid_), + min_turnOn_(2,sistrip::invalid_), + min_maximum_(2,sistrip::invalid_), + min_undershoot_(2,sistrip::invalid_), + min_baseline_(2,sistrip::invalid_), min_smearing_(2,sistrip::invalid_), min_chi2_(2,sistrip::invalid_), max_amplitude_(2,sistrip::invalid_), max_tail_(2,sistrip::invalid_), max_riseTime_(2,sistrip::invalid_), max_timeConstant_(2,sistrip::invalid_), + max_turnOn_(2,sistrip::invalid_), + max_maximum_(2,sistrip::invalid_), + max_undershoot_(2,sistrip::invalid_), + max_baseline_(2,sistrip::invalid_), max_smearing_(2,sistrip::invalid_), max_chi2_(2,sistrip::invalid_), spread_amplitude_(2,sistrip::invalid_), spread_tail_(2,sistrip::invalid_), spread_riseTime_(2,sistrip::invalid_), spread_timeConstant_(2,sistrip::invalid_), + spread_turnOn_(2,sistrip::invalid_), + spread_maximum_(2,sistrip::invalid_), + spread_undershoot_(2,sistrip::invalid_), + spread_baseline_(2,sistrip::invalid_), spread_smearing_(2,sistrip::invalid_), spread_chi2_(2,sistrip::invalid_), deconv_(deconv), @@ -94,30 +134,50 @@ void CalibrationAnalysis::reset() { tail_ = VVFloat(2,VFloat(128,sistrip::invalid_)); riseTime_ = VVFloat(2,VFloat(128,sistrip::invalid_)); timeConstant_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + turnOn_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + maximum_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + undershoot_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + baseline_ = VVFloat(2,VFloat(128,sistrip::invalid_)); smearing_ = VVFloat(2,VFloat(128,sistrip::invalid_)); chi2_ = VVFloat(2,VFloat(128,sistrip::invalid_)); mean_amplitude_ = VFloat(2,sistrip::invalid_); mean_tail_ = VFloat(2,sistrip::invalid_); mean_riseTime_ = VFloat(2,sistrip::invalid_); mean_timeConstant_ = VFloat(2,sistrip::invalid_); + mean_turnOn_ = VFloat(2,sistrip::invalid_); + mean_maximum_ = VFloat(2,sistrip::invalid_); + mean_undershoot_ = VFloat(2,sistrip::invalid_); + mean_baseline_ = VFloat(2,sistrip::invalid_); mean_smearing_ = VFloat(2,sistrip::invalid_); mean_chi2_ = VFloat(2,sistrip::invalid_); min_amplitude_ = VFloat(2,sistrip::invalid_); min_tail_ = VFloat(2,sistrip::invalid_); min_riseTime_ = VFloat(2,sistrip::invalid_); min_timeConstant_ = VFloat(2,sistrip::invalid_); + min_turnOn_ = VFloat(2,sistrip::invalid_); + min_maximum_ = VFloat(2,sistrip::invalid_); + min_undershoot_ = VFloat(2,sistrip::invalid_); + min_baseline_ = VFloat(2,sistrip::invalid_); min_smearing_ = VFloat(2,sistrip::invalid_); min_chi2_ = VFloat(2,sistrip::invalid_); max_amplitude_ = VFloat(2,sistrip::invalid_); max_tail_ = VFloat(2,sistrip::invalid_); max_riseTime_ = VFloat(2,sistrip::invalid_); max_timeConstant_ = VFloat(2,sistrip::invalid_); + max_turnOn_ = VFloat(2,sistrip::invalid_); + max_maximum_ = VFloat(2,sistrip::invalid_); + max_undershoot_ = VFloat(2,sistrip::invalid_); + max_baseline_ = VFloat(2,sistrip::invalid_); max_smearing_ = VFloat(2,sistrip::invalid_); max_chi2_ = VFloat(2,sistrip::invalid_); spread_amplitude_ = VFloat(2,sistrip::invalid_); spread_tail_ = VFloat(2,sistrip::invalid_); spread_riseTime_ = VFloat(2,sistrip::invalid_); spread_timeConstant_ = VFloat(2,sistrip::invalid_); + spread_turnOn_ = VFloat(2,sistrip::invalid_); + spread_maximum_ = VFloat(2,sistrip::invalid_); + spread_undershoot_ = VFloat(2,sistrip::invalid_); + spread_baseline_ = VFloat(2,sistrip::invalid_); spread_smearing_ = VFloat(2,sistrip::invalid_); spread_chi2_ = VFloat(2,sistrip::invalid_); } @@ -134,6 +194,10 @@ void CalibrationAnalysis::print( std::stringstream& ss, uint32_t iapv ) { << " Mean Tail amplitude after 150ns : " << mean_tail_[iapv] << std::endl << " Mean Rise time : " << mean_riseTime_[iapv] << std::endl << " Mean Time constant : " << mean_timeConstant_[iapv] << std::endl + << " Mean Turn on time : " << mean_turnOn_[iapv] << std::endl + << " Mean peak time : " << mean_maximum_[iapv] << std::endl + << " Mean undershoot amplitude : " << mean_undershoot_[iapv] << std::endl + << " Mean baseline amplitude : " << mean_baseline_[iapv] << std::endl << " Mean Smearing parameter : " << mean_smearing_[iapv] << std::endl << " Mean Chi2 of the fit : " << mean_chi2_[iapv] << std::endl; if(deconvMode()) { diff --git a/DQM/SiStripCommissioningAnalysis/interface/CalibrationAlgorithm.h b/DQM/SiStripCommissioningAnalysis/interface/CalibrationAlgorithm.h index 6c53bffae0d2a..1aa5af5ed00b5 100644 --- a/DQM/SiStripCommissioningAnalysis/interface/CalibrationAlgorithm.h +++ b/DQM/SiStripCommissioningAnalysis/interface/CalibrationAlgorithm.h @@ -41,7 +41,7 @@ class CalibrationAlgorithm : public CommissioningAlgorithm { float maximum( TH1* ); - float turnOn( TH1* ); + float turnOn( TF1* ); private: @@ -51,7 +51,6 @@ class CalibrationAlgorithm : public CommissioningAlgorithm { /** Fitter in deconvolution mode */ TF1* deconv_fitter_; /** Fitter in peak mode */ - TF1* peak_fitter_; CalibrationAnalysis* cal_; diff --git a/DQM/SiStripCommissioningAnalysis/interface/SiStripPulseShape.h b/DQM/SiStripCommissioningAnalysis/interface/SiStripPulseShape.h index 8e15bdbcb7645..35ec0222d89f6 100644 --- a/DQM/SiStripCommissioningAnalysis/interface/SiStripPulseShape.h +++ b/DQM/SiStripCommissioningAnalysis/interface/SiStripPulseShape.h @@ -11,7 +11,10 @@ // // Original Author: Christophe Delaere // Created: Thu Nov 5 17:02:15 CEST 2006 -// +// Revision Author: Georg Auzinger +// Created: Thu Nov 5 17:02:15 CEST 2006 +// Updated: Fri Jun 2 16:00:00 CEST 2017 + // #ifndef SiStripPulseShape_h_ @@ -25,6 +28,19 @@ double fpeak_convoluted(double *x, double *par); double fdeconv_convoluted(double *x, double *par); +double pulse_raw(double x, double y, double z, double t); + +double pulse_x0(double y, double z, double t); + +double pulse_yz(double x, double z, double t); + +double pulse_x0_yz(double z, double t); + +double pulse(double x, double y, double z, double t); + +double get_compensation(double x); + + class SiStripPulseShape { public: @@ -40,15 +56,15 @@ class SiStripPulseShape switch(mode_) { case peak: { - return fpeak_convoluted(&time,parameters); + return fpeak(&time,parameters); } case deconvolution: { - return fdeconv_convoluted(&time,parameters); + return fdeconv(&time,parameters); } } } - + private: mode mode_; }; diff --git a/DQM/SiStripCommissioningAnalysis/src/CalibrationAlgorithm.cc b/DQM/SiStripCommissioningAnalysis/src/CalibrationAlgorithm.cc index 1bd50cc265731..42ca35e86fd72 100644 --- a/DQM/SiStripCommissioningAnalysis/src/CalibrationAlgorithm.cc +++ b/DQM/SiStripCommissioningAnalysis/src/CalibrationAlgorithm.cc @@ -8,6 +8,7 @@ #include "TF1.h" #include "TH1.h" #include "TVirtualFitter.h" +#include "TFitResultPtr.h" #include #include #include @@ -23,22 +24,17 @@ CalibrationAlgorithm::CalibrationAlgorithm( const edm::ParameterSet & pset, Cali peak_fitter_(nullptr), cal_(nullptr) { - deconv_fitter_ = new TF1("deconv_fitter",fdeconv_convoluted,-50,50,5); - deconv_fitter_->FixParameter(0,0); - deconv_fitter_->SetParLimits(1,-100,0); - deconv_fitter_->SetParLimits(2,0,200); - deconv_fitter_->SetParLimits(3,5,100); - deconv_fitter_->FixParameter(3,50); - deconv_fitter_->SetParLimits(4,0,50); - deconv_fitter_->SetParameters(0.,-10,0.96,50,20); - peak_fitter_ = new TF1("peak_fitter",fpeak_convoluted,-50,50,5); - peak_fitter_->FixParameter(0,0); - peak_fitter_->SetParLimits(1,-100,0); - peak_fitter_->SetParLimits(2,0,400); - peak_fitter_->SetParLimits(3,5,100); - peak_fitter_->FixParameter(3,50); - peak_fitter_->SetParLimits(4,0,50); - peak_fitter_->SetParameters(0.,-10,0.96,50,20); + + deconv_fitter_ = new TF1("deconv_fitter",fdeconv,0,200,6); + deconv_fitter_->SetParLimits(0,1,70); //x + deconv_fitter_->SetParLimits(1,0,40); //z = tau + deconv_fitter_->SetParLimits(4,35,55); // turn-on-time t_0 + deconv_fitter_->SetParameters(1,25,0.8000,50,0.8); + peak_fitter_ = new TF1("peak_fitter",fpeak,0,200,5); + peak_fitter_->SetParLimits(0,1,70); //x + peak_fitter_->SetParLimits(1,20,70);//z = tau + peak_fitter_->SetParLimits(4,20,35); //turn-on-time t_0 + peak_fitter_->SetParameters(17,50,0,5000,20); } // ---------------------------------------------------------------------------- @@ -131,6 +127,26 @@ void CalibrationAlgorithm::analyse() { float Kmin[2] = {2000000.,2000000.}; float Kmax[2] = {0.,0.}; float Kspread[2] = {0.,0.}; + // turnOn + float Omean[2] = {0.,0.}; + float Omin[2] = {2000.,2000.}; + float Omax[2] = {0.,0.}; + float Ospread[2] = {0.,0.}; + // maximum + float Mmean[2] = {0.,0.}; + float Mmin[2] = {2000.,2000.}; + float Mmax[2] = {0.,0.}; + float Mspread[2] = {0.,0.}; + // undershoot + float Umean[2] = {0.,0.}; + float Umin[2] = {2000.,2000.}; + float Umax[2] = {0.,0.}; + float Uspread[2] = {0.,0.}; + // baseline + float Bmean[2] = {0.,0.}; + float Bmin[2] = {2000.,2000.}; + float Bmax[2] = {0.,0.}; + float Bspread[2] = {0.,0.}; unsigned int upperLimit = cal_->isScan_ ? 2 : 32; float nStrips = cal_->isScan_ ? 1. : 16.; @@ -163,84 +179,140 @@ void CalibrationAlgorithm::analyse() { // rescale the plot correctDistribution(histo_[i].first); - - // amplitude - cal_->amplitude_[apv][strip] = histo_[i].first->GetMaximum(); - + + /// make the fit + TF1* fit = fitPulse(histo_[i].first); + float maximum_ampl = fit->GetMaximum(); + float baseline = fit->Eval(10); + cal_->amplitude_[apv][strip] = maximum_ampl - baseline; + // rise time - cal_->riseTime_[apv][strip] = maximum(histo_[i].first) - turnOn(histo_[i].first); + float peak_time = fit->GetMaximumX(); + float turn_on_time = turnOn(fit); + float rise_time = peak_time - turn_on_time; + cal_->riseTime_[apv][strip] = rise_time; + + //turn-on + cal_->turnOn_[apv][strip] = turn_on_time; + + //maximum + cal_->maximum_[apv][strip] = peak_time; + + //undershoot + if (cal_->deconv_) + cal_->undershoot_[apv][strip] = 100*(fit->GetMinimum()-baseline)/(maximum_ampl - baseline); + else + cal_->undershoot_[apv][strip] = 0; + + //baseline + cal_->baseline_[apv][strip] = 100 * baseline/(maximum_ampl - baseline); + // tail 125 ns after the maximum - int lastBin = histo_[i].first->FindBin(histo_[i].first->GetBinCenter(histo_[i].first->GetMaximumBin())+125); + int lastBin = histo_[i].first->FindBin(peak_time + 125); if(lastBin>histo_[i].first->GetNbinsX()-4) lastBin = histo_[i].first->GetNbinsX()-4; - if(histo_[i].first->GetMaximum()!=0) - cal_->tail_[apv][strip] = 100*histo_[i].first->GetBinContent(lastBin)/histo_[i].first->GetMaximum(); - else - cal_->tail_[apv][strip] = 100; - - // perform the fit for the next quantities - TF1* fit = fitPulse(histo_[i].first); + if(histo_[i].first->GetMaximum()!=0) + cal_->tail_[apv][strip] = 100*(histo_[i].first->GetBinContent(lastBin)-baseline) / (maximum_ampl - baseline); + else + cal_->tail_[apv][strip] = 100; - // time constant - cal_->timeConstant_[apv][strip] = fit->GetParameter(3); - - // smearing - cal_->smearing_[apv][strip] = fit->GetParameter(4); - - // chi2 + cal_->timeConstant_[apv][strip] = fit->GetParameter(1); + cal_->smearing_[apv][strip] = 0; cal_->chi2_[apv][strip] = fit->GetChisquare(); + //compute mean, max, min, spread Amean[apv] += cal_->amplitude_[apv][strip]/nStrips; Amin[apv] = Amin[apv]amplitude_[apv][strip] ? Amin[apv] : cal_->amplitude_[apv][strip]; Amax[apv] = Amax[apv]>cal_->amplitude_[apv][strip] ? Amax[apv] : cal_->amplitude_[apv][strip]; Aspread[apv] += cal_->amplitude_[apv][strip]*cal_->amplitude_[apv][strip]/nStrips; + Tmean[apv] += cal_->tail_[apv][strip]/nStrips; Tmin[apv] = Tmin[apv]tail_[apv][strip] ? Tmin[apv] : cal_->tail_[apv][strip]; Tmax[apv] = Tmax[apv]>cal_->tail_[apv][strip] ? Tmax[apv] : cal_->tail_[apv][strip]; Tspread[apv] += cal_->tail_[apv][strip]*cal_->tail_[apv][strip]/nStrips; + Rmean[apv] += cal_->riseTime_[apv][strip]/nStrips; Rmin[apv] = Rmin[apv]riseTime_[apv][strip] ? Rmin[apv] : cal_->riseTime_[apv][strip]; Rmax[apv] = Rmax[apv]>cal_->riseTime_[apv][strip] ? Rmax[apv] : cal_->riseTime_[apv][strip]; Rspread[apv] += cal_->riseTime_[apv][strip]*cal_->riseTime_[apv][strip]/nStrips; + Cmean[apv] += cal_->timeConstant_[apv][strip]/nStrips; Cmin[apv] = Cmin[apv]timeConstant_[apv][strip] ? Cmin[apv] : cal_->timeConstant_[apv][strip]; Cmax[apv] = Cmax[apv]>cal_->timeConstant_[apv][strip] ? Cmax[apv] : cal_->timeConstant_[apv][strip]; Cspread[apv] += cal_->timeConstant_[apv][strip]*cal_->timeConstant_[apv][strip]/nStrips; + Smean[apv] += cal_->smearing_[apv][strip]/nStrips; Smin[apv] = Smin[apv]smearing_[apv][strip] ? Smin[apv] : cal_->smearing_[apv][strip]; Smax[apv] = Smax[apv]>cal_->smearing_[apv][strip] ? Smax[apv] : cal_->smearing_[apv][strip]; Sspread[apv] += cal_->smearing_[apv][strip]*cal_->smearing_[apv][strip]/nStrips; + Kmean[apv] += cal_->chi2_[apv][strip]/nStrips; Kmin[apv] = Kmin[apv]chi2_[apv][strip] ? Kmin[apv] : cal_->chi2_[apv][strip]; Kmax[apv] = Kmax[apv]>cal_->chi2_[apv][strip] ? Kmax[apv] : cal_->chi2_[apv][strip]; Kspread[apv] += cal_->chi2_[apv][strip]*cal_->chi2_[apv][strip]/nStrips; + + Omean[apv] += cal_->turnOn_[apv][strip]/nStrips; + Omin[apv] = Omin[apv]turnOn_[apv][strip] ? Omin[apv] : cal_->turnOn_[apv][strip]; + Omax[apv] = Omax[apv]>cal_->turnOn_[apv][strip] ? Omax[apv] : cal_->turnOn_[apv][strip]; + Ospread[apv] += cal_->turnOn_[apv][strip]*cal_->turnOn_[apv][strip]/nStrips; + + Mmean[apv] += cal_->maximum_[apv][strip]/nStrips; + Mmin[apv] = Mmin[apv]maximum_[apv][strip] ? Mmin[apv] : cal_->maximum_[apv][strip]; + Mmax[apv] = Mmax[apv]>cal_->maximum_[apv][strip] ? Mmax[apv] : cal_->maximum_[apv][strip]; + Mspread[apv] += cal_->maximum_[apv][strip]*cal_->maximum_[apv][strip]/nStrips; + + Umean[apv] += cal_->undershoot_[apv][strip]/nStrips; + Umin[apv] = Umin[apv]undershoot_[apv][strip] ? Umin[apv] : cal_->undershoot_[apv][strip]; + Umax[apv] = Umax[apv]>cal_->undershoot_[apv][strip] ? Umax[apv] : cal_->undershoot_[apv][strip]; + Uspread[apv] += cal_->undershoot_[apv][strip]*cal_->undershoot_[apv][strip]/nStrips; + + Bmean[apv] += cal_->baseline_[apv][strip]/nStrips; + Bmin[apv] = Bmin[apv]baseline_[apv][strip] ? Bmin[apv] : cal_->baseline_[apv][strip]; + Bmax[apv] = Bmax[apv]>cal_->baseline_[apv][strip] ? Bmax[apv] : cal_->baseline_[apv][strip]; + Bspread[apv] += cal_->baseline_[apv][strip]*cal_->baseline_[apv][strip]/nStrips; } - + // fill the mean, max, min, spread, ... histograms. for(int i=0;i<2;++i) { cal_->mean_amplitude_[i] = Amean[i]; cal_->mean_tail_[i] = Tmean[i]; cal_->mean_riseTime_[i] = Rmean[i]; cal_->mean_timeConstant_[i] = Cmean[i]; + cal_->mean_turnOn_[i] = Omean[i]; + cal_->mean_maximum_[i] = Mmean[i]; + cal_->mean_undershoot_[i] = Umean[i]; + cal_->mean_baseline_[i] = Bmean[i]; cal_->mean_smearing_[i] = Smean[i]; cal_->mean_chi2_[i] = Kmean[i]; cal_->min_amplitude_[i] = Amin[i]; cal_->min_tail_[i] = Tmin[i]; cal_->min_riseTime_[i] = Rmin[i]; cal_->min_timeConstant_[i] = Cmin[i]; + cal_->min_turnOn_[i] = Omin[i]; + cal_->min_maximum_[i] = Mmin[i]; + cal_->min_undershoot_[i] = Umin[i]; + cal_->min_baseline_[i] = Bmin[i]; cal_->min_smearing_[i] = Smin[i]; cal_->min_chi2_[i] = Kmin[i]; cal_->max_amplitude_[i] = Amax[i]; cal_->max_tail_[i] = Tmax[i]; cal_->max_riseTime_[i] = Rmax[i]; cal_->max_timeConstant_[i] = Cmax[i]; + cal_->max_turnOn_[i] = Omax[i]; + cal_->max_maximum_[i] = Mmax[i]; + cal_->max_undershoot_[i] = Umax[i]; + cal_->max_baseline_[i] = Bmax[i]; cal_->max_smearing_[i] = Smax[i]; cal_->max_chi2_[i] = Kmax[i]; cal_->spread_amplitude_[i] = sqrt(fabs(Aspread[i]-Amean[i]*Amean[i])); cal_->spread_tail_[i] = sqrt(fabs(Tspread[i]-Tmean[i]*Tmean[i])); cal_->spread_riseTime_[i] = sqrt(fabs(Rspread[i]-Rmean[i]*Rmean[i])); cal_->spread_timeConstant_[i] = sqrt(fabs(Cspread[i]-Cmean[i]*Cmean[i])); + cal_->spread_turnOn_[i] = sqrt(fabs(Ospread[i]-Omean[i]*Omean[i])); + cal_->spread_maximum_[i] = sqrt(fabs(Mspread[i]-Mmean[i]*Mmean[i])); + cal_->spread_undershoot_[i] = sqrt(fabs(Uspread[i]-Umean[i]*Umean[i])); + cal_->spread_baseline_[i] = sqrt(fabs(Bspread[i]-Bmean[i]*Bmean[i])); cal_->spread_smearing_[i] = sqrt(fabs(Sspread[i]-Smean[i]*Smean[i])); cal_->spread_chi2_[i] = sqrt(fabs(Kspread[i]-Kmean[i]*Kmean[i])); } @@ -252,7 +324,13 @@ void CalibrationAlgorithm::correctDistribution( TH1* histo ) const { // return the curve histo->Scale(-1); - if ( cal_ ) { if( cal_->isScan_ ) histo->Scale(1/16.); } + if ( cal_ ) { + if( cal_->isScan_ ){ + histo->Scale(1/16.); + edm::LogWarning(mlCommissioning_) + << "CalibrationAlgorithm::correctDistribution: isScan_ == true!!! "; + } + } } // ---------------------------------------------------------------------------- @@ -266,21 +344,33 @@ TF1* CalibrationAlgorithm::fitPulse( TH1* histo, float noise = 4.; float N = round(histo->GetMaximum()/125.); float error = sqrt(2*N)*noise; - //float error = sqrt(2)*noise*N; // ????????? + for(int i=1;i<=histo->GetNbinsX();++i) { histo->SetBinError(i,error); } + + // let's help our fit with a bit of parameter guessing + float maximum = histo->GetMaximum(); + float turn_on = histo->GetBinCenter((histo->FindFirstBinAbove(0.1 * maximum) - 2)); + if (cal_->deconv_) { + + deconv_fitter_->SetParameter(4, turn_on); + if(rangeLow>rangeHigh) - histo->Fit(deconv_fitter_,"Q"); + histo->Fit(deconv_fitter_,"QMR"); else - histo->Fit(deconv_fitter_,"0Q","",rangeLow,rangeHigh); + histo->Fit(deconv_fitter_,"0QMR","",rangeLow,rangeHigh); + return deconv_fitter_; - } else { + + } + else { + peak_fitter_->SetParameter(4, turn_on); if(rangeLow>rangeHigh) - histo->Fit(peak_fitter_,"Q"); + histo->Fit(peak_fitter_,"MRQ"); else - histo->Fit(peak_fitter_,"0Q","",rangeLow,rangeHigh); + histo->Fit(peak_fitter_,"0QMR","",rangeLow,rangeHigh); return peak_fitter_; } } @@ -296,25 +386,10 @@ float CalibrationAlgorithm::maximum( TH1* h ) { // ---------------------------------------------------------------------------- // -float CalibrationAlgorithm::turnOn( TH1* h ) { - // localize the rising edge - int bin=1; - float amplitude = h->GetMaximum(); - for(; bin<= h->GetNbinsX() && h->GetBinContent(bin)<0.4*amplitude; ++bin) {} - float end = h->GetBinLowEdge(bin); - // fit the rising edge with a sigmoid - TF1* sigmoid = new TF1("sigmoid","[0]/(1+exp(-[1]*(x-[2])))+[3]",0,end); - sigmoid->SetParLimits(0,amplitude/10.,amplitude); - sigmoid->SetParLimits(1,0.05,0.5); - sigmoid->SetParLimits(2,end-10,end+10); - sigmoid->SetParLimits(3,-amplitude/10.,amplitude/10.); - sigmoid->SetParameters(amplitude/2.,0.1,end,0.); - h->Fit(sigmoid,"0QR"); - // return the point where the fit = 3% signal. - float time = 0.; - float base = sigmoid->GetMinimum(0,end); - for(;timeEval(time)-base)<0.03*(amplitude-base);time += 0.1) {} - delete sigmoid; - return time-0.05; +float CalibrationAlgorithm::turnOn(TF1* f){ + float max_amplitude = f->GetMaximum(); + float time = 5.; + float base = f->GetMinimum(0,50); + for( ; time < 50 && (f->Eval(time) - base) < 0.01 * (max_amplitude - base); time += 0.1) {} + return time - 0.05; } - diff --git a/DQM/SiStripCommissioningAnalysis/src/SiStripPulseShape.cc b/DQM/SiStripCommissioningAnalysis/src/SiStripPulseShape.cc index c26b6a06d6168..b6ca37a74fac5 100644 --- a/DQM/SiStripCommissioningAnalysis/src/SiStripPulseShape.cc +++ b/DQM/SiStripCommissioningAnalysis/src/SiStripPulseShape.cc @@ -2,31 +2,121 @@ #include #include -double fpeak(double *x, double *par) +/* New Pulse Shape Fit by G. Auzinger June 2017 +following methods are used to describe a pulse shape for a 3 stage CR-CR-RC pre-amplifier (CR) ++ shaper (CR + RC) with time constants x, y, z respectively +some special cases (x=0. y=z, x=0 && y=z) are considered (divergence of equation) and +the shaper CR y is approximated via a pol(6) of x which gives a resonable respresentation and +reduces the number of free parameters -- this shape is derived from first principle and can +be used to fit peak mode signals and deconvolution mode signals +following parameters are added in addition to the time constants x, z: +a_0 ... baseline offset amplitude +s ... scale parameter +t_0 ... turn_on time of the pulse +par[5] ... scale parameter for the time slices in deco mode +*/ + + +double pulse_raw(double x, double y, double z, double t) +{ + double result1, result2, result3; + + result1 = z * y * exp(-t / y); + result1/= pow(y,2) - (x + z) * y + z * x; + + result2 = z * x * exp(-t / x); + result2/= pow(x,2) - (x - z) * y - z * x; + + result3 = pow(z,2) * exp(-t / z); + result3/= pow(z,2) + (x - z) * y - z * x; + + return result1 + result2 + result3; +} + +double pulse_x0(double y, double z, double t) +{ + return z / (y - z) * (exp(-t / y) - exp(-t / z)); +} + +double pulse_yz(double x, double z, double t) +{ + double result1, result2; + + result1 = exp(-t / x) - exp(-t / z); + result1*= z * x / (z - x); + + result2 = t * exp(-t / z); + + return (result1 + result2) / (z - x); +} + +double pulse_x0_yz(double z, double t) +{ + return t / z * exp(-t / z); +} + +double pulse(double x, double y, double z, double t) +{ + if(x > y) { - if(x[0]+par[1]<0) return par[0]; - return par[0]+par[2]*(x[0]+par[1])*TMath::Exp(-(x[0]+par[1])/par[3]); + double pivot = x; + x = y; + y = pivot; } + if((x == 0) && (y == z)) return pulse_x0_yz(z, t); + + else if(x == 0) return pulse_x0(y, z, t); + + else if(y == z) return pulse_yz(x, z, t); + + else return pulse_raw(x, y, z, t); +} + +double get_compensation(double x) +{ + return 49.9581 + - 1.7941 * x + - 0.110089 * pow(x,2) + + 0.0113809 * pow(x,3) + - 0.000388111 * pow(x,4) + + 5.9761e-6 * pow(x,5) + - 3.51805e-8 * pow(x,6); +} + +double fpeak(double *x, double *par) +{ + double xx = par[0]; + double z = par[1]; + double a_0 = par[2]; + double s = par[3]; + double t_0 = par[4]; + double t = x[0] - t_0; + + double y = get_compensation(xx); + + if(x[0] < t_0) return a_0; + return a_0 + s * pulse(xx, y, z, t); +} + double fdeconv(double *x, double *par) - { - double xm = par[4]*(x[0]-25); - double xp = par[4]*(x[0]+25); - double xz = par[4]*x[0]; - return 1.2131*fpeak(&xp,par)-1.4715*fpeak(&xz,par)+0.4463*fpeak(&xm,par); - } +{ + double xm = par[5]*(x[0]-25); + double xp = par[5]*(x[0]+25); + double xz = par[5]*x[0]; + return 1.2131 * fpeak(&xp,par) - 1.4715 * fpeak(&xz,par) + 0.4463 * fpeak(&xm,par); +} double fpeak_convoluted(double *x, double *par) - { - TF1 f("peak_convoluted",fpeak,0,200,4); - return f.IntegralError(x[0]-par[4]/2.,x[0]+par[4]/2.,par,nullptr,1.)/(par[4]); - } +{ + TF1 f("peak_convoluted",fpeak,0,200,4); + return f.IntegralError(x[0]-par[4]/2.,x[0]+par[4]/2.,par,nullptr,1.)/(par[4]); +} double fdeconv_convoluted(double *x, double *par) - { - double xm = (x[0]-25); - double xp = (x[0]+25); - double xz = x[0]; - return 1.2131*fpeak_convoluted(&xp,par)-1.4715*fpeak_convoluted(&xz,par)+0.4463*fpeak_convoluted(&xm,par); - } - +{ + double xm = (x[0]-25); + double xp = (x[0]+25); + double xz = x[0]; + return 1.2131*fpeak_convoluted(&xp,par)-1.4715*fpeak_convoluted(&xz,par)+0.4463*fpeak_convoluted(&xm,par); +} diff --git a/DQM/SiStripCommissioningClients/data/summary.xml b/DQM/SiStripCommissioningClients/data/summary.xml index 83b4f7ca326f1..e5f8600cf70de 100644 --- a/DQM/SiStripCommissioningClients/data/summary.xml +++ b/DQM/SiStripCommissioningClients/data/summary.xml @@ -142,6 +142,9 @@ + + + @@ -149,6 +152,9 @@ + + + @@ -161,6 +167,10 @@ + + + + @@ -168,6 +178,10 @@ + + + + @@ -178,6 +192,11 @@ + + + + + diff --git a/DQM/SiStripCommissioningDbClients/src/CalibrationHistosUsingDb.cc b/DQM/SiStripCommissioningDbClients/src/CalibrationHistosUsingDb.cc index 2265b4ace746c..1f7fd5351330f 100644 --- a/DQM/SiStripCommissioningDbClients/src/CalibrationHistosUsingDb.cc +++ b/DQM/SiStripCommissioningDbClients/src/CalibrationHistosUsingDb.cc @@ -1,4 +1,3 @@ - #include "DQM/SiStripCommissioningDbClients/interface/CalibrationHistosUsingDb.h" #include "CondFormats/SiStripObjects/interface/CalibrationAnalysis.h" #include "DataFormats/SiStripCommon/interface/SiStripConstants.h" diff --git a/DQM/SiStripCommissioningSources/src/CalibrationScanTask.cc b/DQM/SiStripCommissioningSources/src/CalibrationScanTask.cc index 65478f4743080..c334a885d33f8 100644 --- a/DQM/SiStripCommissioningSources/src/CalibrationScanTask.cc +++ b/DQM/SiStripCommissioningSources/src/CalibrationScanTask.cc @@ -108,8 +108,8 @@ void CalibrationScanTask::book() { // void CalibrationScanTask::fill( const SiStripEventSummary& summary, const edm::DetSet& digis ) { -// LogDebug("Commissioning") << "[CalibrationScanTask::fill]: isha/vfs = " << summary.isha() << "/" << summary.vfs(); - // Check if ISHA/VFS changed. In that case, save, reset histo, change title, and continue + //LogDebug("Commissioning") << "[CalibrationScanTask::fill]: isha/vfs = " << summary.isha() << "/" << summary.vfs(); + //Check if ISHA/VFS changed. In that case, save, reset histo, change title, and continue checkAndSave(summary.isha(),summary.vfs()); // retrieve the delay from the EventSummary int bin = (100-summary.latency())*8+(7-summary.calSel()); diff --git a/DQM/SiStripCommissioningSources/src/CalibrationTask.cc b/DQM/SiStripCommissioningSources/src/CalibrationTask.cc index 03425623d6d5d..897816df2d794 100644 --- a/DQM/SiStripCommissioningSources/src/CalibrationTask.cc +++ b/DQM/SiStripCommissioningSources/src/CalibrationTask.cc @@ -101,7 +101,11 @@ void CalibrationTask::fill( const SiStripEventSummary& summary, isub = ical<4 ? ical+4 : ical-4; checkAndSave(ical); // retrieve the delay from the EventSummary - int bin = (100-summary.latency())*8+(7-summary.calSel()); + int bin = 0; + if(runType_ == sistrip::CALIBRATION) + bin = (100-summary.latency())*8+(7-summary.calSel()); + else if(runType_ == sistrip::CALIBRATION_DECO) + bin = (102-summary.latency())*8+(7-summary.calSel()); // Fill the histograms. // data-ped -(data-ped)_isub // the second term corresponds to the common mode substraction, looking at a strip far away. diff --git a/DQM/SiStripCommissioningSummary/src/CalibrationSummaryFactory.cc b/DQM/SiStripCommissioningSummary/src/CalibrationSummaryFactory.cc index f7c34039feb32..e0f6f7e54b77e 100644 --- a/DQM/SiStripCommissioningSummary/src/CalibrationSummaryFactory.cc +++ b/DQM/SiStripCommissioningSummary/src/CalibrationSummaryFactory.cc @@ -21,6 +21,10 @@ void CalibrationSummaryFactory::extract( Iterator iter ) { std::vector< std::vector > tail( 2, temp ); std::vector< std::vector > riseTime( 2, temp ); std::vector< std::vector > timeConstant( 2, temp ); + std::vector< std::vector > turnOn( 2, temp ); + std::vector< std::vector > maximum( 2, temp ); + std::vector< std::vector > undershoot( 2, temp ); + std::vector< std::vector > baseline( 2, temp ); std::vector< std::vector > smearing( 2, temp ); std::vector< std::vector > chi2( 2, temp ); amplitude[0] = anal->amplitude()[0]; @@ -31,6 +35,14 @@ void CalibrationSummaryFactory::extract( Iterator iter ) { riseTime[1] = anal->riseTime()[1]; timeConstant[0] = anal->timeConstant()[0]; timeConstant[1] = anal->timeConstant()[1]; + turnOn[0] = anal->turnOn()[0]; + turnOn[1] = anal->turnOn()[1]; + maximum[0] = anal->maximum()[0]; + maximum[1] = anal->maximum()[1]; + undershoot[0] = anal->undershoot()[0]; + undershoot[1] = anal->undershoot()[1]; + baseline[0] = anal->baseline()[0]; + baseline[1] = anal->baseline()[1]; smearing[0] = anal->smearing()[0]; smearing[1] = anal->smearing()[1]; chi2[0] = anal->chi2()[0]; @@ -54,6 +66,8 @@ void CalibrationSummaryFactory::extract( Iterator iter ) { bool all_strips = false; bool with_error = false; + + // Amplitude if ( mon_ == sistrip::CALIBRATION_AMPLITUDE_ALLSTRIPS) { all_strips = true; uint16_t bins = amplitude[amplitude[0].size() < amplitude[1].size() ? 1 : 0].size(); @@ -73,7 +87,9 @@ void CalibrationSummaryFactory::extract( Iterator iter ) { } else if ( mon_ == sistrip::CALIBRATION_AMPLITUDE_MAX) { value[0][0] = anal->amplitudeMax()[0]/10.; value[1][0] = anal->amplitudeMax()[1]/10.; - } else if ( mon_ == sistrip::CALIBRATION_TAIL_ALLSTRIPS) { + } + // Tail parameter + else if ( mon_ == sistrip::CALIBRATION_TAIL_ALLSTRIPS) { all_strips = true; uint16_t bins = tail[tail[0].size() < tail[1].size() ? 1 : 0].size(); for ( uint16_t i = 0; i < bins; i++ ) { @@ -92,7 +108,9 @@ void CalibrationSummaryFactory::extract( Iterator iter ) { } else if ( mon_ == sistrip::CALIBRATION_TAIL_MAX) { value[0][0] = anal->tailMax()[0]; value[1][0] = anal->tailMax()[1]; - } else if ( mon_ == sistrip::CALIBRATION_RISETIME_ALLSTRIPS) { + } + // Risetime parameter + else if ( mon_ == sistrip::CALIBRATION_RISETIME_ALLSTRIPS) { all_strips = true; uint16_t bins = riseTime[riseTime[0].size() < riseTime[1].size() ? 1 : 0].size(); for ( uint16_t i = 0; i < bins; i++ ) { @@ -111,7 +129,9 @@ void CalibrationSummaryFactory::extract( Iterator iter ) { } else if ( mon_ == sistrip::CALIBRATION_RISETIME_MAX) { value[0][0] = anal->riseTimeMax()[0]; value[1][0] = anal->riseTimeMax()[1]; - } else if ( mon_ == sistrip::CALIBRATION_TIMECONSTANT_ALLSTRIPS) { + } + // TimeConstant + else if ( mon_ == sistrip::CALIBRATION_TIMECONSTANT_ALLSTRIPS) { all_strips = true; uint16_t bins = timeConstant[timeConstant[0].size() < timeConstant[1].size() ? 1 : 0].size(); for ( uint16_t i = 0; i < bins; i++ ) { @@ -130,14 +150,105 @@ void CalibrationSummaryFactory::extract( Iterator iter ) { } else if ( mon_ == sistrip::CALIBRATION_TIMECONSTANT_MAX) { value[0][0] = anal->timeConstantMax()[0]; value[1][0] = anal->timeConstantMax()[1]; - } else if ( mon_ == sistrip::CALIBRATION_SMEARING_ALLSTRIPS) { + } + // Turn-on + else if ( mon_ == sistrip::CALIBRATION_TURNON_ALLSTRIPS) { + all_strips = true; + uint16_t bins = turnOn[turnOn[0].size() < turnOn[1].size() ? 1 : 0].size(); + for ( uint16_t i = 0; i < bins; i++ ) { + value[0][i] = turnOn[0][i]; + value[1][i] = turnOn[1][i]; + } + } else if ( mon_ == sistrip::CALIBRATION_TURNON) { + with_error = true; + value[0][0] = anal->turnOnMean()[0]; + value[1][0] = anal->turnOnMean()[1]; + error[0][0] = anal->turnOnSpread()[0]; + error[1][0] = anal->turnOnSpread()[1]; + } else if ( mon_ == sistrip::CALIBRATION_TURNON_MIN) { + value[0][0] = anal->turnOnMin()[0]; + value[1][0] = anal->turnOnMin()[1]; + } else if ( mon_ == sistrip::CALIBRATION_TURNON_MAX) { + value[0][0] = anal->turnOnMax()[0]; + value[1][0] = anal->turnOnMax()[1]; + + } + // Maximum + else if ( mon_ == sistrip::CALIBRATION_MAXIMUM_ALLSTRIPS) { + all_strips = true; + uint16_t bins = maximum[maximum[0].size() < maximum[1].size() ? 1 : 0].size(); + for ( uint16_t i = 0; i < bins; i++ ) { + value[0][i] = maximum[0][i]; + value[1][i] = maximum[1][i]; + } + } else if ( mon_ == sistrip::CALIBRATION_MAXIMUM) { + with_error = true; + value[0][0] = anal->maximumMean()[0]; + value[1][0] = anal->maximumMean()[1]; + error[0][0] = anal->maximumSpread()[0]; + error[1][0] = anal->maximumSpread()[1]; + } else if ( mon_ == sistrip::CALIBRATION_MAXIMUM_MIN) { + value[0][0] = anal->maximumMin()[0]; + value[1][0] = anal->maximumMin()[1]; + } else if ( mon_ == sistrip::CALIBRATION_MAXIMUM_MAX) { + value[0][0] = anal->maximumMax()[0]; + value[1][0] = anal->maximumMax()[1]; + + } + // Undershoot + else if ( mon_ == sistrip::CALIBRATION_UNDERSHOOT_ALLSTRIPS) { + all_strips = true; + uint16_t bins = undershoot[undershoot[0].size() < undershoot[1].size() ? 1 : 0].size(); + for ( uint16_t i = 0; i < bins; i++ ) { + value[0][i] = undershoot[0][i]; + value[1][i] = undershoot[1][i]; + } + } else if ( mon_ == sistrip::CALIBRATION_UNDERSHOOT) { + with_error = true; + value[0][0] = anal->undershootMean()[0]; + value[1][0] = anal->undershootMean()[1]; + error[0][0] = anal->undershootSpread()[0]; + error[1][0] = anal->undershootSpread()[1]; + } else if ( mon_ == sistrip::CALIBRATION_UNDERSHOOT_MIN) { + value[0][0] = anal->undershootMin()[0]; + value[1][0] = anal->undershootMin()[1]; + } else if ( mon_ == sistrip::CALIBRATION_UNDERSHOOT_MAX) { + value[0][0] = anal->undershootMax()[0]; + value[1][0] = anal->undershootMax()[1]; + + } + // Baseline + else if ( mon_ == sistrip::CALIBRATION_BASELINE_ALLSTRIPS) { + all_strips = true; + uint16_t bins = baseline[baseline[0].size() < baseline[1].size() ? 1 : 0].size(); + for ( uint16_t i = 0; i < bins; i++ ) { + value[0][i] = baseline[0][i]; + value[1][i] = baseline[1][i]; + } + } else if ( mon_ == sistrip::CALIBRATION_BASELINE) { + with_error = true; + value[0][0] = anal->baselineMean()[0]; + value[1][0] = anal->baselineMean()[1]; + error[0][0] = anal->baselineSpread()[0]; + error[1][0] = anal->baselineSpread()[1]; + } else if ( mon_ == sistrip::CALIBRATION_BASELINE_MIN) { + value[0][0] = anal->baselineMin()[0]; + value[1][0] = anal->baselineMin()[1]; + } else if ( mon_ == sistrip::CALIBRATION_BASELINE_MAX) { + value[0][0] = anal->baselineMax()[0]; + value[1][0] = anal->baselineMax()[1]; + } + + // Smearing + else if ( mon_ == sistrip::CALIBRATION_SMEARING_ALLSTRIPS) { all_strips = true; uint16_t bins = smearing[smearing[0].size() < smearing[1].size() ? 1 : 0].size(); for ( uint16_t i = 0; i < bins; i++ ) { value[0][i] = smearing[0][i]; value[1][i] = smearing[1][i]; } - } else if ( mon_ == sistrip::CALIBRATION_SMEARING) { + } + else if ( mon_ == sistrip::CALIBRATION_SMEARING) { with_error = true; value[0][0] = anal->smearingMean()[0]; value[1][0] = anal->smearingMean()[1]; @@ -149,14 +260,17 @@ void CalibrationSummaryFactory::extract( Iterator iter ) { } else if ( mon_ == sistrip::CALIBRATION_SMEARING_MAX) { value[0][0] = anal->smearingMax()[0]; value[1][0] = anal->smearingMax()[1]; - } else if ( mon_ == sistrip::CALIBRATION_CHI2_ALLSTRIPS) { + } + // Fit chi2 + else if ( mon_ == sistrip::CALIBRATION_CHI2_ALLSTRIPS) { all_strips = true; uint16_t bins = chi2[chi2[0].size() < chi2[1].size() ? 1 : 0].size(); for ( uint16_t i = 0; i < bins; i++ ) { value[0][i] = chi2[0][i]; value[1][i] = chi2[1][i]; } - } else if ( mon_ == sistrip::CALIBRATION_CHI2) { + } + else if ( mon_ == sistrip::CALIBRATION_CHI2) { with_error = true; value[0][0] = anal->chi2Mean()[0]/100.; value[1][0] = anal->chi2Mean()[1]/100.; @@ -222,6 +336,7 @@ void CalibrationSummaryFactory::extract( Iterator iter ) { // void CalibrationSummaryFactory::format() { + // Histogram formatting // Histogram formatting if ( mon_ == sistrip::CALIBRATION_AMPLITUDE ) { generator_->axisLabel( "Amplitude (ADC*Nevt/10.)" ); @@ -231,16 +346,23 @@ void CalibrationSummaryFactory::format() { generator_->axisLabel( "Rise time (ns)" ); } else if ( mon_ == sistrip::CALIBRATION_TIMECONSTANT ) { generator_->axisLabel( "Time constant (ns)" ); + } else if ( mon_ == sistrip::CALIBRATION_TURNON ) { + generator_->axisLabel( "TrunOn (ns)" ); + } else if ( mon_ == sistrip::CALIBRATION_MAXIMUM ) { + generator_->axisLabel( "Maximum time (ns)" ); + } else if ( mon_ == sistrip::CALIBRATION_UNDERSHOOT ) { + generator_->axisLabel( "Undershoot (ADC*Nevt/10.)" ); + } else if ( mon_ == sistrip::CALIBRATION_BASELINE ) { + generator_->axisLabel( "Baseline Amplitude (ADC*Nevt/10.)" ); } else if ( mon_ == sistrip::CALIBRATION_SMEARING ) { generator_->axisLabel( "Smearing (ns)" ); } else if ( mon_ == sistrip::CALIBRATION_CHI2 ) { generator_->axisLabel( "Chi2/100." ); } else { edm::LogWarning(mlSummaryPlots_) - << "[SummaryPlotFactory::" << __func__ << "]" - << " Unexpected SummaryHisto value:" - << SiStripEnumsAndStrings::monitorable( SummaryPlotFactoryBase::mon_ ) ; - } - + << "[SummaryPlotFactory::" << __func__ << "]" + << " Unexpected SummaryHisto value:" + << SiStripEnumsAndStrings::monitorable( SummaryPlotFactoryBase::mon_ ) ; + } } diff --git a/DataFormats/SiStripCommon/interface/ConstantsForMonitorable.h b/DataFormats/SiStripCommon/interface/ConstantsForMonitorable.h index b492ed440a75f..8bc95f3898890 100644 --- a/DataFormats/SiStripCommon/interface/ConstantsForMonitorable.h +++ b/DataFormats/SiStripCommon/interface/ConstantsForMonitorable.h @@ -1,4 +1,3 @@ - #ifndef DataFormats_SiStripCommon_ConstantsForMonitorable_H #define DataFormats_SiStripCommon_ConstantsForMonitorable_H @@ -103,27 +102,44 @@ namespace sistrip { static const char calibrationTail_[] = "CalibrationTail"; static const char calibrationRiseTime_[] = "CalibrationRiseTime"; static const char calibrationTimeConstant_[] = "CalibrationTimeConstant"; + static const char calibrationTurnOn_[] = "CalibrationTurnOn"; + static const char calibrationMaximum_[] = "CalibrationMaximum"; + static const char calibrationUndershoot_[] = "CalibrationUndershoot"; + static const char calibrationBaseline_[] = "CalibrationBaseline"; static const char calibrationSmearing_[] = "CalibrationSmearing"; static const char calibrationChi2_[] = "CalibrationChi2"; static const char calibrationAmplitudeAS_[] = "StripCalibrationAmplitude"; static const char calibrationTailAS_[] = "StripCalibrationTail"; static const char calibrationRiseTimeAS_[] = "StripCalibrationRiseTime"; static const char calibrationTimeConstantAS_[] = "StripCalibrationTimeConstant"; + static const char calibrationTurnOnAS_[] = "StripCalibrationTurnOn"; + static const char calibrationMaximumAS_[] = "StripCalibrationMaximum"; + static const char calibrationUndershootAS_[] = "StripCalibrationUndershoot"; + static const char calibrationBaselineAS_[] = "StripCalibrationBaseline"; static const char calibrationSmearingAS_[] = "StripCalibrationSmearing"; static const char calibrationChi2AS_[] = "StripCalibrationChi2"; static const char calibrationAmplitudeMin_[] = "MinCalibrationAmplitude"; static const char calibrationTailMin_[] = "MinCalibrationTail"; static const char calibrationRiseTimeMin_[] = "MinCalibrationRiseTime"; static const char calibrationTimeConstantMin_[] = "MinCalibrationTimeConstant"; + static const char calibrationTurnOnMin_[] = "MinCalibrationTurnOn"; + static const char calibrationMaximumMin_[] = "MinCalibrationMaximum"; + static const char calibrationUndershootMin_[] = "MinCalibrationUndershoot"; + static const char calibrationBaselineMin_[] = "MinCalibrationBaseline"; static const char calibrationSmearingMin_[] = "MinCalibrationSmearing"; static const char calibrationChi2Min_[] = "MinCalibrationChi2"; static const char calibrationAmplitudeMax_[] = "MaxCalibrationAmplitude"; static const char calibrationTailMax_[] = "MaxCalibrationTail"; static const char calibrationRiseTimeMax_[] = "MaxCalibrationRiseTime"; static const char calibrationTimeConstantMax_[] = "MaxCalibrationTimeConstant"; + static const char calibrationTurnOnMax_[] = "MaxCalibrationTurnOn"; + static const char calibrationMaximumMax_[] = "MaxCalibrationMaximum"; + static const char calibrationUndershootMax_[] = "MaxCalibrationUndershoot"; + static const char calibrationBaselineMax_[] = "MaxCalibrationBaseline"; static const char calibrationSmearingMax_[] = "MaxCalibrationSmearing"; static const char calibrationChi2Max_[] = "MaxCalibrationChi2"; + // daq scope mode static const char daqScopeModeMeanSignal_[] = "DaqScopeMode_MeanSignal"; @@ -196,7 +212,7 @@ namespace sistrip { NOISE_BIN_84_ALL_STRIPS= 217, NOISE_CHI2_ALL_STRIPS = 218, NOISE_SIGNIF_ALL_STRIPS= 219, - NOISE_RMS_ALL_STRIPS = 220, + NOISE_RMS_ALL_STRIPS = 220, FINE_DELAY_POS = 601, FINE_DELAY_ERROR = 602, @@ -224,6 +240,22 @@ namespace sistrip { CALIBRATION_TIMECONSTANT_MAX = 722, CALIBRATION_SMEARING_MAX = 723, CALIBRATION_CHI2_MAX = 724, + CALIBRATION_TURNON = 725, + CALIBRATION_MAXIMUM = 726, + CALIBRATION_UNDERSHOOT = 727, + CALIBRATION_BASELINE = 728, + CALIBRATION_TURNON_ALLSTRIPS = 729, + CALIBRATION_MAXIMUM_ALLSTRIPS = 730, + CALIBRATION_UNDERSHOOT_ALLSTRIPS = 731, + CALIBRATION_BASELINE_ALLSTRIPS = 732, + CALIBRATION_TURNON_MIN = 733, + CALIBRATION_MAXIMUM_MIN = 734, + CALIBRATION_UNDERSHOOT_MIN = 735, + CALIBRATION_BASELINE_MIN = 736, + CALIBRATION_TURNON_MAX = 737, + CALIBRATION_MAXIMUM_MAX = 738, + CALIBRATION_UNDERSHOOT_MAX = 739, + CALIBRATION_BASELINE_MAX = 740, DAQ_SCOPE_MODE_MEAN_SIGNAL = 1501 }; diff --git a/DataFormats/SiStripCommon/src/SiStripEnumsAndStrings.cc b/DataFormats/SiStripCommon/src/SiStripEnumsAndStrings.cc index b2b7f3831de0b..addde87a59e8c 100644 --- a/DataFormats/SiStripCommon/src/SiStripEnumsAndStrings.cc +++ b/DataFormats/SiStripCommon/src/SiStripEnumsAndStrings.cc @@ -1,4 +1,3 @@ - #include "DataFormats/SiStripCommon/interface/SiStripEnumsAndStrings.h" // ----------------------------------------------------------------------------- @@ -387,27 +386,43 @@ std::string SiStripEnumsAndStrings::monitorable( const sistrip::Monitorable& mon else if ( mon == sistrip::CALIBRATION_TAIL) { return sistrip::calibrationTail_; } else if ( mon == sistrip::CALIBRATION_RISETIME) { return sistrip::calibrationRiseTime_; } else if ( mon == sistrip::CALIBRATION_TIMECONSTANT) { return sistrip::calibrationTimeConstant_; } + else if ( mon == sistrip::CALIBRATION_TURNON) { return sistrip::calibrationTurnOn_; } + else if ( mon == sistrip::CALIBRATION_MAXIMUM) { return sistrip::calibrationMaximum_; } + else if ( mon == sistrip::CALIBRATION_UNDERSHOOT) { return sistrip::calibrationUndershoot_; } + else if ( mon == sistrip::CALIBRATION_BASELINE) { return sistrip::calibrationBaseline_; } else if ( mon == sistrip::CALIBRATION_SMEARING) { return sistrip::calibrationSmearing_; } else if ( mon == sistrip::CALIBRATION_CHI2) { return sistrip::calibrationChi2_; } else if ( mon == sistrip::CALIBRATION_AMPLITUDE_ALLSTRIPS) { return sistrip::calibrationAmplitudeAS_; } else if ( mon == sistrip::CALIBRATION_TAIL_ALLSTRIPS) { return sistrip::calibrationTailAS_; } else if ( mon == sistrip::CALIBRATION_RISETIME_ALLSTRIPS) { return sistrip::calibrationRiseTimeAS_; } else if ( mon == sistrip::CALIBRATION_TIMECONSTANT_ALLSTRIPS) { return sistrip::calibrationTimeConstantAS_; } + else if ( mon == sistrip::CALIBRATION_TURNON_ALLSTRIPS) { return sistrip::calibrationTurnOnAS_; } + else if ( mon == sistrip::CALIBRATION_MAXIMUM_ALLSTRIPS) { return sistrip::calibrationMaximumAS_; } + else if ( mon == sistrip::CALIBRATION_UNDERSHOOT_ALLSTRIPS) { return sistrip::calibrationUndershootAS_; } + else if ( mon == sistrip::CALIBRATION_BASELINE_ALLSTRIPS) { return sistrip::calibrationBaselineAS_; } else if ( mon == sistrip::CALIBRATION_SMEARING_ALLSTRIPS) { return sistrip::calibrationSmearingAS_; } else if ( mon == sistrip::CALIBRATION_CHI2_ALLSTRIPS) { return sistrip::calibrationChi2AS_; } else if ( mon == sistrip::CALIBRATION_AMPLITUDE_MIN) { return sistrip::calibrationAmplitudeMin_; } else if ( mon == sistrip::CALIBRATION_TAIL_MIN) { return sistrip::calibrationTailMin_; } else if ( mon == sistrip::CALIBRATION_RISETIME_MIN) { return sistrip::calibrationRiseTimeMin_; } else if ( mon == sistrip::CALIBRATION_TIMECONSTANT_MIN) { return sistrip::calibrationTimeConstantMin_; } + else if ( mon == sistrip::CALIBRATION_TURNON_MIN) { return sistrip::calibrationTurnOnMin_; } + else if ( mon == sistrip::CALIBRATION_MAXIMUM_MIN) { return sistrip::calibrationMaximumMin_; } + else if ( mon == sistrip::CALIBRATION_UNDERSHOOT_MIN) { return sistrip::calibrationUndershootMin_; } + else if ( mon == sistrip::CALIBRATION_BASELINE_MIN) { return sistrip::calibrationBaselineMin_; } else if ( mon == sistrip::CALIBRATION_SMEARING_MIN) { return sistrip::calibrationSmearingMin_; } else if ( mon == sistrip::CALIBRATION_CHI2_MIN) { return sistrip::calibrationChi2Min_; } else if ( mon == sistrip::CALIBRATION_AMPLITUDE_MAX) { return sistrip::calibrationAmplitudeMax_; } else if ( mon == sistrip::CALIBRATION_TAIL_MAX) { return sistrip::calibrationTailMax_; } else if ( mon == sistrip::CALIBRATION_RISETIME_MAX) { return sistrip::calibrationRiseTimeMax_; } else if ( mon == sistrip::CALIBRATION_TIMECONSTANT_MAX) { return sistrip::calibrationTimeConstantMax_; } + else if ( mon == sistrip::CALIBRATION_TURNON_MAX) { return sistrip::calibrationTurnOnMax_; } + else if ( mon == sistrip::CALIBRATION_MAXIMUM_MAX) { return sistrip::calibrationMaximumMax_; } + else if ( mon == sistrip::CALIBRATION_UNDERSHOOT_MAX) { return sistrip::calibrationUndershootMax_; } + else if ( mon == sistrip::CALIBRATION_BASELINE_MAX) { return sistrip::calibrationBaselineMax_; } else if ( mon == sistrip::CALIBRATION_SMEARING_MAX) { return sistrip::calibrationSmearingMax_; } else if ( mon == sistrip::CALIBRATION_CHI2_MAX) { return sistrip::calibrationChi2Max_; } - + // scope mode else if ( mon == sistrip::DAQ_SCOPE_MODE_MEAN_SIGNAL ) { return sistrip::daqScopeModeMeanSignal_; } @@ -504,24 +519,40 @@ sistrip::Monitorable SiStripEnumsAndStrings::monitorable( const std::string& mon else if ( mon.find( sistrip::calibrationTailAS_ ) != std::string::npos ) { return sistrip::CALIBRATION_TAIL_ALLSTRIPS; } else if ( mon.find( sistrip::calibrationRiseTimeAS_ ) != std::string::npos ) { return sistrip::CALIBRATION_RISETIME_ALLSTRIPS; } else if ( mon.find( sistrip::calibrationTimeConstantAS_ ) != std::string::npos ) { return sistrip::CALIBRATION_TIMECONSTANT_ALLSTRIPS; } + else if ( mon.find( sistrip::calibrationTurnOnAS_ ) != std::string::npos ) { return sistrip::CALIBRATION_TURNON_ALLSTRIPS; } + else if ( mon.find( sistrip::calibrationMaximumAS_ ) != std::string::npos ) { return sistrip::CALIBRATION_MAXIMUM_ALLSTRIPS; } + else if ( mon.find( sistrip::calibrationUndershootAS_ ) != std::string::npos ) { return sistrip::CALIBRATION_UNDERSHOOT_ALLSTRIPS; } + else if ( mon.find( sistrip::calibrationBaselineAS_ ) != std::string::npos ) { return sistrip::CALIBRATION_BASELINE_ALLSTRIPS; } else if ( mon.find( sistrip::calibrationSmearingAS_ ) != std::string::npos ) { return sistrip::CALIBRATION_SMEARING_ALLSTRIPS; } else if ( mon.find( sistrip::calibrationChi2AS_ ) != std::string::npos ) { return sistrip::CALIBRATION_CHI2_ALLSTRIPS; } else if ( mon.find( sistrip::calibrationAmplitudeMin_ ) != std::string::npos ) { return sistrip::CALIBRATION_AMPLITUDE_MIN; } else if ( mon.find( sistrip::calibrationTailMin_ ) != std::string::npos ) { return sistrip::CALIBRATION_TAIL_MIN; } else if ( mon.find( sistrip::calibrationRiseTimeMin_ ) != std::string::npos ) { return sistrip::CALIBRATION_RISETIME_MIN; } else if ( mon.find( sistrip::calibrationTimeConstantMin_ ) != std::string::npos ) { return sistrip::CALIBRATION_TIMECONSTANT_MIN; } + else if ( mon.find( sistrip::calibrationTurnOnMin_ ) != std::string::npos ) { return sistrip::CALIBRATION_TURNON_MIN; } + else if ( mon.find( sistrip::calibrationMaximumMin_ ) != std::string::npos ) { return sistrip::CALIBRATION_MAXIMUM_MIN; } + else if ( mon.find( sistrip::calibrationUndershootMin_ ) != std::string::npos ) { return sistrip::CALIBRATION_UNDERSHOOT_MIN; } + else if ( mon.find( sistrip::calibrationBaselineMin_ ) != std::string::npos ) { return sistrip::CALIBRATION_BASELINE_MIN; } else if ( mon.find( sistrip::calibrationSmearingMin_ ) != std::string::npos ) { return sistrip::CALIBRATION_SMEARING_MIN; } else if ( mon.find( sistrip::calibrationChi2Min_ ) != std::string::npos ) { return sistrip::CALIBRATION_CHI2_MIN; } else if ( mon.find( sistrip::calibrationAmplitudeMax_ ) != std::string::npos ) { return sistrip::CALIBRATION_AMPLITUDE_MAX; } else if ( mon.find( sistrip::calibrationTailMax_ ) != std::string::npos ) { return sistrip::CALIBRATION_TAIL_MAX; } else if ( mon.find( sistrip::calibrationRiseTimeMax_ ) != std::string::npos ) { return sistrip::CALIBRATION_RISETIME_MAX; } else if ( mon.find( sistrip::calibrationTimeConstantMax_ ) != std::string::npos ) { return sistrip::CALIBRATION_TIMECONSTANT_MAX; } + else if ( mon.find( sistrip::calibrationTurnOnMax_ ) != std::string::npos ) { return sistrip::CALIBRATION_TURNON_MAX; } + else if ( mon.find( sistrip::calibrationMaximumMax_ ) != std::string::npos ) { return sistrip::CALIBRATION_MAXIMUM_MAX; } + else if ( mon.find( sistrip::calibrationUndershootMax_ ) != std::string::npos ) { return sistrip::CALIBRATION_UNDERSHOOT_MAX; } + else if ( mon.find( sistrip::calibrationBaselineMax_ ) != std::string::npos ) { return sistrip::CALIBRATION_BASELINE_MAX; } else if ( mon.find( sistrip::calibrationSmearingMax_ ) != std::string::npos ) { return sistrip::CALIBRATION_SMEARING_MAX; } else if ( mon.find( sistrip::calibrationChi2Max_ ) != std::string::npos ) { return sistrip::CALIBRATION_CHI2_MAX; } else if ( mon.find( sistrip::calibrationAmplitude_ ) != std::string::npos ) { return sistrip::CALIBRATION_AMPLITUDE; } else if ( mon.find( sistrip::calibrationTail_ ) != std::string::npos ) { return sistrip::CALIBRATION_TAIL; } else if ( mon.find( sistrip::calibrationRiseTime_ ) != std::string::npos ) { return sistrip::CALIBRATION_RISETIME; } else if ( mon.find( sistrip::calibrationTimeConstant_ ) != std::string::npos ) { return sistrip::CALIBRATION_TIMECONSTANT; } + else if ( mon.find( sistrip::calibrationTurnOn_ ) != std::string::npos ) { return sistrip::CALIBRATION_TURNON; } + else if ( mon.find( sistrip::calibrationMaximum_ ) != std::string::npos ) { return sistrip::CALIBRATION_MAXIMUM; } + else if ( mon.find( sistrip::calibrationUndershoot_ ) != std::string::npos ) { return sistrip::CALIBRATION_UNDERSHOOT; } + else if ( mon.find( sistrip::calibrationBaseline_ ) != std::string::npos ) { return sistrip::CALIBRATION_BASELINE; } else if ( mon.find( sistrip::calibrationSmearing_ ) != std::string::npos ) { return sistrip::CALIBRATION_SMEARING; } else if ( mon.find( sistrip::calibrationChi2_ ) != std::string::npos ) { return sistrip::CALIBRATION_CHI2; } From 3d7de1c3fb754d6aabb5cda67c9d79ff0bb3958d Mon Sep 17 00:00:00 2001 From: Raffaele Date: Tue, 13 Mar 2018 18:13:13 +0100 Subject: [PATCH 117/426] added selective upload --- .../interface/CommissioningHistograms.h | 14 ++++- .../src/CommissioningHistograms.cc | 54 +++++++++++++++++-- .../interface/ApvTimingHistosUsingDb.h | 3 +- .../interface/OptoScanHistosUsingDb.h | 2 + .../interface/PedestalsHistosUsingDb.h | 2 + .../interface/PedsFullNoiseHistosUsingDb.h | 3 ++ .../interface/VpspScanHistosUsingDb.h | 3 ++ .../src/ApvTimingHistosUsingDb.cc | 15 ++++-- .../src/OptoScanHistosUsingDb.cc | 11 +++- .../src/PedestalsHistosUsingDb.cc | 42 +++++++++++++-- .../src/PedsFullNoiseHistosUsingDb.cc | 9 +++- .../src/VpspScanHistosUsingDb.cc | 12 +++-- 12 files changed, 148 insertions(+), 22 deletions(-) diff --git a/DQM/SiStripCommissioningClients/interface/CommissioningHistograms.h b/DQM/SiStripCommissioningClients/interface/CommissioningHistograms.h index ff8283e51492b..6c18e147d82a0 100644 --- a/DQM/SiStripCommissioningClients/interface/CommissioningHistograms.h +++ b/DQM/SiStripCommissioningClients/interface/CommissioningHistograms.h @@ -113,7 +113,7 @@ class CommissioningHistograms { inline DQMStore* const bei() const; - inline Analyses& data(); + Analyses& data(bool getMaskedData = false); inline Factory* const factory(); @@ -154,6 +154,17 @@ class CommissioningHistograms { FedToFecMap mapping_; edm::ParameterSet pset_; + + bool mask_; + std::vector fedMaskVector_; + std::vector fecMaskVector_; + std::vector ringVector_; + std::vector ccuVector_; + std::vector i2cChanVector_; + std::vector lldChanVector_; + + Analyses dataWithMask_; + bool dataWithMaskCached_; }; @@ -161,7 +172,6 @@ class CommissioningHistograms { const sistrip::RunType& CommissioningHistograms::task() const { return task_; } DQMStore* const CommissioningHistograms::bei() const { return bei_; } -CommissioningHistograms::Analyses& CommissioningHistograms::data() { return data_; } CommissioningHistograms::Factory* const CommissioningHistograms::factory() { return factory_.get(); } const CommissioningHistograms::HistosMap& CommissioningHistograms::histos() const { return histos_; } const CommissioningHistograms::FedToFecMap& CommissioningHistograms::mapping() const { return mapping_; } diff --git a/DQM/SiStripCommissioningClients/src/CommissioningHistograms.cc b/DQM/SiStripCommissioningClients/src/CommissioningHistograms.cc index f51797da6a47f..943cabf16e4e5 100644 --- a/DQM/SiStripCommissioningClients/src/CommissioningHistograms.cc +++ b/DQM/SiStripCommissioningClients/src/CommissioningHistograms.cc @@ -22,7 +22,16 @@ CommissioningHistograms::CommissioningHistograms( const edm::ParameterSet& pset, bei_(bei), data_(), histos_(), - pset_(pset) + pset_(pset), + mask_(pset.existsAs("vetoModules")?pset.getParameter("vetoModules"):true), + fedMaskVector_(pset.existsAs >("fedMaskVector")?pset.getParameter >("fedMaskVector"):std::vector()), + fecMaskVector_(pset.existsAs >("fecMaskVector")?pset.getParameter >("fecMaskVector"):std::vector()), + ringVector_(pset.existsAs >("ringVector")?pset.getParameter >("ringVector"):std::vector()), + ccuVector_(pset.existsAs >("ccuVector")?pset.getParameter >("ccuVector"):std::vector()), + i2cChanVector_(pset.existsAs >("i2cChanVector")?pset.getParameter >("i2cChanVector"):std::vector()), + lldChanVector_(pset.existsAs >("lldChanVector")?pset.getParameter >("lldChanVector"):std::vector()), + dataWithMask_(), + dataWithMaskCached_(false) { LogTrace(mlDqmClient_) << "[" << __PRETTY_FUNCTION__ << "]" @@ -45,8 +54,11 @@ CommissioningHistograms::CommissioningHistograms() task_(sistrip::UNDEFINED_RUN_TYPE), bei_(nullptr), data_(), - histos_() -{ + histos_(), + mask_(true), + dataWithMask_(), + dataWithMaskCached_(false){ + LogTrace(mlDqmClient_) << "[" << __PRETTY_FUNCTION__ << "]" << " Constructing object..."; @@ -797,3 +809,39 @@ TH1* CommissioningHistograms::histogram( const sistrip::Monitorable& mon, } +CommissioningHistograms::Analyses& CommissioningHistograms::data(bool getMaskedData) { + if (!getMaskedData) return data_; + else { + if (dataWithMaskCached_) return dataWithMask_; + else { + Analyses::iterator ianal = data_.begin(); + Analyses::iterator janal = data_.end(); + for ( ; ianal != janal; ++ianal ) { + CommissioningAnalysis* anal = ianal->second; + SiStripFedKey fedkey = anal->fedKey(); + SiStripFecKey feckey = anal->fecKey(); + bool maskThisAnal_ = false; + for (std::size_t i = 0; i < fedMaskVector_.size(); i++) { + if (fedkey.fedId() == fedMaskVector_[i]) maskThisAnal_ = true; + } + for (std::size_t i = 0; i < fecMaskVector_.size(); i++) { + if (fecMaskVector_.size() != ringVector_.size() || fecMaskVector_.size() != ccuVector_.size() || fecMaskVector_.size() != i2cChanVector_.size() || fecMaskVector_.size() != lldChanVector_.size()) { + continue; + } + if (feckey.fecSlot() == fecMaskVector_[i] && + feckey.fecRing() == ringVector_[i] && + feckey.ccuAddr() == ccuVector_[i] && + feckey.ccuChan() == i2cChanVector_[i] && + feckey.lldChan() == lldChanVector_[i]) { + maskThisAnal_ = true; + } + } + if (mask_ && !maskThisAnal_) dataWithMask_[ianal->first] = ianal->second; + else if (!mask_ && maskThisAnal_) dataWithMask_[ianal->first] = ianal->second; + } + dataWithMaskCached_ = true; + return dataWithMask_; + } + } +} + diff --git a/DQM/SiStripCommissioningDbClients/interface/ApvTimingHistosUsingDb.h b/DQM/SiStripCommissioningDbClients/interface/ApvTimingHistosUsingDb.h index e67c58cecb0c2..72cc1e0173963 100644 --- a/DQM/SiStripCommissioningDbClients/interface/ApvTimingHistosUsingDb.h +++ b/DQM/SiStripCommissioningDbClients/interface/ApvTimingHistosUsingDb.h @@ -29,7 +29,8 @@ class ApvTimingHistosUsingDb : public CommissioningHistosUsingDb, public ApvTimi bool skipFecUpdate_; // switch for uploading the frame finding thresholds bool skipFedUpdate_; - + // Perform a selective upload either for or excluding a certain set of FEDs + bool allowSelectiveUpload_; }; diff --git a/DQM/SiStripCommissioningDbClients/interface/OptoScanHistosUsingDb.h b/DQM/SiStripCommissioningDbClients/interface/OptoScanHistosUsingDb.h index 55c277c32f610..e56d53072ee53 100644 --- a/DQM/SiStripCommissioningDbClients/interface/OptoScanHistosUsingDb.h +++ b/DQM/SiStripCommissioningDbClients/interface/OptoScanHistosUsingDb.h @@ -25,6 +25,8 @@ class OptoScanHistosUsingDb : public CommissioningHistosUsingDb, public OptoScan // parameters bool skipGainUpdate_; + // Perform a selective upload either for or excluding a certain set of FEDs + bool allowSelectiveUpload_; }; diff --git a/DQM/SiStripCommissioningDbClients/interface/PedestalsHistosUsingDb.h b/DQM/SiStripCommissioningDbClients/interface/PedestalsHistosUsingDb.h index 3808cc096ee20..2b72e26735ec5 100644 --- a/DQM/SiStripCommissioningDbClients/interface/PedestalsHistosUsingDb.h +++ b/DQM/SiStripCommissioningDbClients/interface/PedestalsHistosUsingDb.h @@ -28,6 +28,8 @@ class PedestalsHistosUsingDb : public CommissioningHistosUsingDb, public Pedesta float lowThreshold_; bool disableBadStrips_; bool keepStripsDisabled_; + // Perform a selective upload either for or excluding a certain set of FEDs + bool allowSelectiveUpload_; }; diff --git a/DQM/SiStripCommissioningDbClients/interface/PedsFullNoiseHistosUsingDb.h b/DQM/SiStripCommissioningDbClients/interface/PedsFullNoiseHistosUsingDb.h index cb75cc4e705a4..5628cb23ab3d5 100644 --- a/DQM/SiStripCommissioningDbClients/interface/PedsFullNoiseHistosUsingDb.h +++ b/DQM/SiStripCommissioningDbClients/interface/PedsFullNoiseHistosUsingDb.h @@ -30,6 +30,9 @@ class PedsFullNoiseHistosUsingDb : public CommissioningHistosUsingDb, public Ped bool keepStripsDisabled_; bool addBadStrips_; + // Perform a selective upload either for or excluding a certain set of FEDs + bool allowSelectiveUpload_; + }; #endif // DQM_SiStripCommissioningClients_PedsFullNoiseHistosUsingDb_H diff --git a/DQM/SiStripCommissioningDbClients/interface/VpspScanHistosUsingDb.h b/DQM/SiStripCommissioningDbClients/interface/VpspScanHistosUsingDb.h index 580a57a7a400f..1d3c3390ef0bf 100644 --- a/DQM/SiStripCommissioningDbClients/interface/VpspScanHistosUsingDb.h +++ b/DQM/SiStripCommissioningDbClients/interface/VpspScanHistosUsingDb.h @@ -22,6 +22,9 @@ class VpspScanHistosUsingDb : public CommissioningHistosUsingDb, public VpspScan void update( SiStripConfigDb::DeviceDescriptionsRange ); void create( SiStripConfigDb::AnalysisDescriptionsV&, Analysis ) override; + + // Perform a selective upload either for or excluding a certain set of FEDs + bool allowSelectiveUpload_; }; diff --git a/DQM/SiStripCommissioningDbClients/src/ApvTimingHistosUsingDb.cc b/DQM/SiStripCommissioningDbClients/src/ApvTimingHistosUsingDb.cc index 4ad8d018c6949..96cc8b296df76 100644 --- a/DQM/SiStripCommissioningDbClients/src/ApvTimingHistosUsingDb.cc +++ b/DQM/SiStripCommissioningDbClients/src/ApvTimingHistosUsingDb.cc @@ -35,6 +35,13 @@ ApvTimingHistosUsingDb::ApvTimingHistosUsingDb( const edm::ParameterSet & pset, LogTrace(mlDqmClient_) << "[ApvTimingHistosUsingDb::" << __func__ << "]" << " Skipping update of FED parameters."; + + allowSelectiveUpload_ = this->pset().existsAs("doSelectiveUpload")?this->pset().getParameter("doSelectiveUpload"):false; + if (allowSelectiveUpload_) + LogTrace(mlDqmClient_) + << "[ApvTimingHistosUsingDb::" << __func__ << "]" + << " Enabling selective update of FED parameters."; + } // ----------------------------------------------------------------------------- @@ -163,8 +170,8 @@ bool ApvTimingHistosUsingDb::update( SiStripConfigDb::DeviceDescriptionsRange de fec_path = fec_key; // Locate appropriate analysis object - Analyses::const_iterator iter = data().find( fec_key.key() ); - if ( iter != data().end() ) { + Analyses::const_iterator iter = data(allowSelectiveUpload_).find( fec_key.key() ); + if ( iter != data(allowSelectiveUpload_).end() ) { ApvTimingAnalysis* anal = dynamic_cast( iter->second ); if ( !anal ) { @@ -314,8 +321,8 @@ void ApvTimingHistosUsingDb::update( SiStripConfigDb::FedDescriptionsRange feds conn.lldChannel() ); // Locate appropriate analysis object - Analyses::const_iterator iter = data().find( fec_key.key() ); - if ( iter != data().end() ) { + Analyses::const_iterator iter = data(allowSelectiveUpload_).find( fec_key.key() ); + if ( iter != data(allowSelectiveUpload_).end() ) { ApvTimingAnalysis* anal = dynamic_cast( iter->second ); if ( !anal ) { diff --git a/DQM/SiStripCommissioningDbClients/src/OptoScanHistosUsingDb.cc b/DQM/SiStripCommissioningDbClients/src/OptoScanHistosUsingDb.cc index 7a805b53d12cd..72b91373afd7b 100644 --- a/DQM/SiStripCommissioningDbClients/src/OptoScanHistosUsingDb.cc +++ b/DQM/SiStripCommissioningDbClients/src/OptoScanHistosUsingDb.cc @@ -29,6 +29,13 @@ OptoScanHistosUsingDb::OptoScanHistosUsingDb( const edm::ParameterSet & pset, LogTrace(mlDqmClient_) << "[OptoScanHistosUsingDb::" << __func__ << "]" << " Skipping db update of gain parameters."; + + allowSelectiveUpload_ = this->pset().existsAs("doSelectiveUpload")?this->pset().getParameter("doSelectiveUpload"):false; + if (allowSelectiveUpload_) + LogTrace(mlDqmClient_) + << "[OptoScanHistosUsingDb::" << __func__ << "]" + << " Enabling selective upload of gain parameters"; + } // ----------------------------------------------------------------------------- @@ -102,8 +109,8 @@ void OptoScanHistosUsingDb::update( SiStripConfigDb::DeviceDescriptionsRange dev ichan+1 ); // Iterate through all channels and extract LLD settings - Analyses::const_iterator iter = data().find( fec_key.key() ); - if ( iter != data().end() ) { + Analyses::const_iterator iter = data(allowSelectiveUpload_).find( fec_key.key() ); + if ( iter != data(allowSelectiveUpload_).end() ) { OptoScanAnalysis* anal = dynamic_cast( iter->second ); if ( !anal ) { diff --git a/DQM/SiStripCommissioningDbClients/src/PedestalsHistosUsingDb.cc b/DQM/SiStripCommissioningDbClients/src/PedestalsHistosUsingDb.cc index 3827255d879cd..d090cb91dad62 100644 --- a/DQM/SiStripCommissioningDbClients/src/PedestalsHistosUsingDb.cc +++ b/DQM/SiStripCommissioningDbClients/src/PedestalsHistosUsingDb.cc @@ -37,6 +37,11 @@ PedestalsHistosUsingDb::PedestalsHistosUsingDb( const edm::ParameterSet & pset, << "[PedestalsHistosUsingDb::" << __func__ << "]" << " Disabling strips: " << disableBadStrips_ << " ; keeping previously disabled strips: " << keepStripsDisabled_; + + allowSelectiveUpload_ = this->pset().existsAs("doSelectiveUpload")?this->pset().getParameter("doSelectiveUpload"):false; + LogTrace(mlDqmClient_) + << "[PedestalsHistosUsingDb::" << __func__ << "]" + << " Selective upload of modules set to : " << allowSelectiveUpload_; } // ----------------------------------------------------------------------------- @@ -111,9 +116,14 @@ void PedestalsHistosUsingDb::update( SiStripConfigDb::FedDescriptionsRange feds conn.lldChannel() ); // Locate appropriate analysis object - Analyses::const_iterator iter = data().find( fec_key.key() ); - if ( iter != data().end() ) { - + Analyses::const_iterator iter = data(allowSelectiveUpload_).find( fec_key.key() ); + if ( iter != data(allowSelectiveUpload_).end() ) { + + // Check if analysis is valid + if ( !iter->second->isValid() ) { + continue; + } + PedestalsAnalysis* anal = dynamic_cast( iter->second ); if ( !anal ) { edm::LogError(mlDqmClient_) @@ -127,8 +137,12 @@ void PedestalsHistosUsingDb::update( SiStripConfigDb::FedDescriptionsRange feds for ( uint16_t iapv = 0; iapv < sistrip::APVS_PER_FEDCH; iapv++ ) { uint32_t pedmin = (uint32_t) anal->pedsMin()[iapv]; pedshift = pedmin < pedshift ? pedmin : pedshift; - } - + std::stringstream ss; + ss << "iapv: " << iapv << " pedsMin()[iapv]: " << anal->pedsMin()[iapv] << " pedmin: " << pedmin << " pedshift: " << pedshift; + edm::LogWarning(mlDqmClient_) << ss.str(); + } + + // Iterate through APVs and strips for ( uint16_t iapv = 0; iapv < sistrip::APVS_PER_FEDCH; iapv++ ) { for ( uint16_t istr = 0; istr < anal->peds()[iapv].size(); istr++ ) { @@ -137,6 +151,24 @@ void PedestalsHistosUsingDb::update( SiStripConfigDb::FedDescriptionsRange feds Fed9U::Fed9UAddress addr( ichan, iapv, istr ); Fed9U::Fed9UStripDescription temp = (*ifed)->getFedStrips().getStrip( addr ); + + if ( anal->peds()[iapv][istr] < 1.e-6 ) { //@@ ie, zero + edm::LogWarning(mlDqmClient_) + << "[PedestalsHistosUsingDb::" << __func__ << "]" + << " Skipping ZERO pedestal value (ie, NO UPLOAD TO DB!) for FedKey/Id/Ch: " + << hex << setw(8) << setfill('0') << fed_key.key() << dec << "/" + << (*ifed)->getFedId() << "/" + << ichan + << " and device with FEC/slot/ring/CCU/LLD " + << fec_key.fecCrate() << "/" + << fec_key.fecSlot() << "/" + << fec_key.fecRing() << "/" + << fec_key.ccuAddr() << "/" + << fec_key.ccuChan() << "/" + << fec_key.channel(); + continue; //@@ do not upload + } + // determine whether we need to disable the strip bool disableStrip = false; if ( keepStripsDisabled_ ) { diff --git a/DQM/SiStripCommissioningDbClients/src/PedsFullNoiseHistosUsingDb.cc b/DQM/SiStripCommissioningDbClients/src/PedsFullNoiseHistosUsingDb.cc index b318d3f2c56d9..254c54170cdaa 100644 --- a/DQM/SiStripCommissioningDbClients/src/PedsFullNoiseHistosUsingDb.cc +++ b/DQM/SiStripCommissioningDbClients/src/PedsFullNoiseHistosUsingDb.cc @@ -38,6 +38,11 @@ PedsFullNoiseHistosUsingDb::PedsFullNoiseHistosUsingDb( const edm::ParameterSet << "[PedestalsHistosUsingDb::" << __func__ << "]" << " Disabling strips: " << disableBadStrips_ << " ; keeping previously disabled strips: " << keepStripsDisabled_; + allowSelectiveUpload_ = this->pset().existsAs("doSelectiveUpload")?this->pset().getParameter("doSelectiveUpload"):false; + LogTrace(mlDqmClient_) + << "[PedestalsHistosUsingDb::" << __func__ << "]" + << " Selective upload of modules set to : " << allowSelectiveUpload_; + } // ----------------------------------------------------------------------------- @@ -113,8 +118,8 @@ void PedsFullNoiseHistosUsingDb::update( SiStripConfigDb::FedDescriptionsRange f conn.lldChannel() ); // Locate appropriate analysis object - Analyses::const_iterator iter = data().find( fec_key.key() ); - if ( iter != data().end() ) { + Analyses::const_iterator iter = data(allowSelectiveUpload_).find( fec_key.key() ); + if ( iter != data(allowSelectiveUpload_).end() ) { PedsFullNoiseAnalysis* anal = dynamic_cast( iter->second ); if ( !anal ) { diff --git a/DQM/SiStripCommissioningDbClients/src/VpspScanHistosUsingDb.cc b/DQM/SiStripCommissioningDbClients/src/VpspScanHistosUsingDb.cc index 483ba7f6d31f6..c32e0b1fb65f6 100644 --- a/DQM/SiStripCommissioningDbClients/src/VpspScanHistosUsingDb.cc +++ b/DQM/SiStripCommissioningDbClients/src/VpspScanHistosUsingDb.cc @@ -24,6 +24,12 @@ VpspScanHistosUsingDb::VpspScanHistosUsingDb( const edm::ParameterSet & pset, LogTrace(mlDqmClient_) << "[VpspScanHistosUsingDb::" << __func__ << "]" << " Constructing object..."; + + allowSelectiveUpload_ = this->pset().existsAs("doSelectiveUpload")?this->pset().getParameter("doSelectiveUpload"):false; + LogTrace(mlDqmClient_) + << "[PedestalsHistosUsingDb::" << __func__ << "]" + << " Selective upload of modules set to : " << allowSelectiveUpload_; + } // ----------------------------------------------------------------------------- @@ -101,9 +107,9 @@ void VpspScanHistosUsingDb::update( SiStripConfigDb::DeviceDescriptionsRange dev ichan+1 ); // Iterate through all channels and extract LLD settings - Analyses::const_iterator iter = data().find( fec_key.key() ); - if ( iter != data().end() ) { - + Analyses::const_iterator iter = data(allowSelectiveUpload_).find( fec_key.key() ); + if ( iter != data(allowSelectiveUpload_).end() ) { + VpspScanAnalysis* anal = dynamic_cast( iter->second ); if ( !anal ) { edm::LogError(mlDqmClient_) From 0717b3748e8799ccb5a9ed4b65bdc22abc99549c Mon Sep 17 00:00:00 2001 From: Raffaele Date: Tue, 13 Mar 2018 19:32:39 +0100 Subject: [PATCH 118/426] Bad strip analysis updates --- .../interface/PedsFullNoiseAnalysis.h | 178 +++-- .../src/PedsFullNoiseAnalysis.cc | 242 ++++-- .../interface/PedsFullNoiseAlgorithm.h | 33 +- .../src/PedsFullNoiseAlgorithm.cc | 751 ++++++++++++------ .../data/summary.xml | 76 +- .../src/PedsFullNoiseHistograms.cc | 43 +- .../src/SiStripCommissioningOfflineClient.cc | 2 + .../interface/PedsFullNoiseHistosUsingDb.h | 15 +- .../src/PedsFullNoiseHistosUsingDb.cc | 360 +++++---- .../test/analysis_test_cfg.py | 38 + .../test/source_test_cfg.py | 41 + .../src/PedsFullNoiseSummaryFactory.cc | 503 +++++++++--- .../interface/ConstantsForMonitorable.h | 88 +- .../src/SiStripEnumsAndStrings.cc | 72 +- .../interface/SiStripPartition.h | 5 + .../SiStripConfigDb/src/SiStripPartition.cc | 41 +- 16 files changed, 1748 insertions(+), 740 deletions(-) create mode 100644 DQM/SiStripCommissioningDbClients/test/analysis_test_cfg.py create mode 100644 DQM/SiStripCommissioningDbClients/test/source_test_cfg.py diff --git a/CondFormats/SiStripObjects/interface/PedsFullNoiseAnalysis.h b/CondFormats/SiStripObjects/interface/PedsFullNoiseAnalysis.h index 1c32ceef786a3..21fae3520ef58 100644 --- a/CondFormats/SiStripObjects/interface/PedsFullNoiseAnalysis.h +++ b/CondFormats/SiStripObjects/interface/PedsFullNoiseAnalysis.h @@ -12,6 +12,7 @@ @author M. Wingham, R.Bainbridge @brief Histogram-based analysis for pedestal run. */ + class PedsFullNoiseAnalysis : public CommissioningAnalysis { public: @@ -28,30 +29,47 @@ class PedsFullNoiseAnalysis : public CommissioningAnalysis { friend class PedsFullNoiseAlgorithm; // ---------- public interface ---------- + + /** Identifies if analysis is valid or not. */ + bool isValid() const override; - /** Identifies if analysis is valid or not. */ - bool isValid() const override; - - // Pedestal, noise and raw noise (128-strip vector per APV) - inline const VVFloat& peds() const; + // Pedestal, noise and raw noise (128-strip vector per APV) + inline const VVFloat& peds() const; inline const VVFloat& noise() const; inline const VVFloat& raw() const; - // KS Probability for each strip - inline const VVFloat& ksProb() const; - // KS Probability for each strip - inline const VVFloat& chi2Prob() const; - // Noise value calculated by a gaussian fit instead of RMS. - inline const VVFloat& noiseGaus() const; - // Noise value calculated by a gaussian fit instead of RMS. - inline const VVFloat& noiseBin84() const; - // Noise value calculated by RMS of ADC values. - inline const VVFloat& noiseRMS() const; - // The significance of noise of each strip compared to the apv - inline const VVFloat& noiseSignif() const; - - // Dead and noisy strips (vector per APV) - inline const VVInt& dead() const; - inline const VVInt& noisy() const; + + // test statistics for each APV (128-strip vector per APV) + inline const VVFloat& adProbab() const; + inline const VVFloat& ksProbab() const; + inline const VVFloat& jbProbab() const; + inline const VVFloat& chi2Probab() const; + + // Per strip values + inline const VVFloat& residualRMS() const; // RMS + inline const VVFloat& residualSigmaGaus() const; // from gaus fit + inline const VVFloat& noiseSignificance() const; // noise significance + inline const VVFloat& residualMean() const; + inline const VVFloat& residualSkewness() const; + inline const VVFloat& residualKurtosis() const; + inline const VVFloat& residualIntegralNsigma() const; + inline const VVFloat& residualIntegral() const; + + // status for different class of bad or problematic strips + inline const VVInt& deadStrip() const; + inline const VVInt& badStrip() const; + inline const VVInt& badStripBit() const; + inline const VVInt& deadStripBit() const; + inline const VVInt& shiftedStrip() const; + inline const VVInt& lowNoiseStrip() const; + inline const VVInt& largeNoiseStrip() const; + inline const VVInt& largeNoiseSignificance() const; + inline const VVInt& badFitStatus() const; + inline const VVInt& badADProbab() const; + inline const VVInt& badKSProbab() const; + inline const VVInt& badJBProbab() const; + inline const VVInt& badChi2Probab() const; + inline const VVInt& badTailStrip() const; + inline const VVInt& badDoublePeakStrip() const; // Mean and rms spread (value per APV) inline const VFloat& pedsMean() const; @@ -84,70 +102,56 @@ class PedsFullNoiseAnalysis : public CommissioningAnalysis { private: - // VVFloats means: 1 vector per APV, 1 value per strip. - /** Peds values. */ + /// Quantitles that are always filled for every strip VVFloat peds_; - - /** Noise values. */ VVFloat noise_; - - /** Raw noise values. */ VVFloat raw_; - - VVFloat ksProb_; - VVFloat chi2Prob_; - VVFloat noiseGaus_; - VVFloat noiseBin84_; - VVFloat noiseRMS_; - VVFloat noiseSignif_; - // VVInts means: 1 vector per APV, values are strip numbers. - - /** Dead strips. */ - VVInt dead_; - - /** Noisy strips. */ - VVInt noisy_; + VVFloat adProbab_; + VVFloat ksProbab_; + VVFloat jbProbab_; + VVFloat chi2Probab_; + VVFloat residualRMS_; + VVFloat residualSigmaGaus_; + VVFloat noiseSignificance_; + VVFloat residualMean_; + VVFloat residualSkewness_; + VVFloat residualKurtosis_; + VVFloat residualIntegralNsigma_; + VVFloat residualIntegral_; + VVInt badStripBit_; + VVInt deadStripBit_; + + /// Quantities filled only for bad strips i.e. vectors of strip-id + VVInt deadStrip_; + VVInt badStrip_; + VVInt shiftedStrip_; + VVInt lowNoiseStrip_; + VVInt largeNoiseStrip_; + VVInt largeNoiseSignificance_; + VVInt badFitStatus_; + VVInt badADProbab_; + VVInt badKSProbab_; + VVInt badJBProbab_; + VVInt badChi2Probab_; + VVInt badTailStrip_; + VVInt badDoublePeakStrip_; // VFloat: 1 value per APV - - /** Mean peds value. */ VFloat pedsMean_; - - /** Rms spread in peds. */ VFloat pedsSpread_; - - /** Mean noise value. */ VFloat noiseMean_; - - /** Rms spread in noise. */ VFloat noiseSpread_; - - /** Mean raw noise value. */ VFloat rawMean_; - - /** Rms spread in raw noise. */ VFloat rawSpread_; - - /** Max peds value. */ VFloat pedsMax_; - - /** Min peds value. */ VFloat pedsMin_; - - /** Max noise value. */ VFloat noiseMax_; - - /** Min noise value. */ VFloat noiseMin_; - - /** Max raw noise value. */ VFloat rawMax_; - - /** Min raw noise value. */ VFloat rawMin_; - + // true if legacy histogram naming is used bool legacy_; }; @@ -157,16 +161,37 @@ class PedsFullNoiseAnalysis : public CommissioningAnalysis { const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::peds() const { return peds_; } const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::noise() const { return noise_; } const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::raw() const { return raw_; } -const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::ksProb() const { return ksProb_; } -const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::chi2Prob() const { return chi2Prob_; } -const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::noiseGaus() const { return noiseGaus_; } -const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::noiseBin84() const { return noiseBin84_; } -const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::noiseRMS() const { return noiseRMS_; } -const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::noiseSignif() const { return noiseSignif_; } - -const PedsFullNoiseAnalysis::VVInt& PedsFullNoiseAnalysis::dead() const { return dead_; } -const PedsFullNoiseAnalysis::VVInt& PedsFullNoiseAnalysis::noisy() const { return noisy_; } +const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::adProbab() const { return adProbab_;} +const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::ksProbab() const { return ksProbab_;} +const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::jbProbab() const { return jbProbab_;} +const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::chi2Probab() const { return chi2Probab_;} + +const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::residualRMS() const { return residualRMS_;} +const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::residualSigmaGaus() const { return residualSigmaGaus_;} +const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::noiseSignificance() const { return noiseSignificance_;} +const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::residualMean() const { return residualMean_;} +const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::residualSkewness() const { return residualSkewness_;} +const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::residualKurtosis() const { return residualKurtosis_;} +const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::residualIntegralNsigma() const { return residualIntegralNsigma_;} +const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::residualIntegral() const { return residualIntegral_;} + +const PedsFullNoiseAnalysis::VVInt& PedsFullNoiseAnalysis::deadStrip() const { return deadStrip_;} +const PedsFullNoiseAnalysis::VVInt& PedsFullNoiseAnalysis::badStrip() const { return badStrip_;} +const PedsFullNoiseAnalysis::VVInt& PedsFullNoiseAnalysis::badStripBit() const { return badStripBit_;} +const PedsFullNoiseAnalysis::VVInt& PedsFullNoiseAnalysis::deadStripBit() const { return deadStripBit_;} +const PedsFullNoiseAnalysis::VVInt& PedsFullNoiseAnalysis::shiftedStrip() const { return shiftedStrip_;} +const PedsFullNoiseAnalysis::VVInt& PedsFullNoiseAnalysis::lowNoiseStrip() const { return lowNoiseStrip_;} +const PedsFullNoiseAnalysis::VVInt& PedsFullNoiseAnalysis::largeNoiseStrip() const { return largeNoiseStrip_;} +const PedsFullNoiseAnalysis::VVInt& PedsFullNoiseAnalysis::largeNoiseSignificance() const { return largeNoiseSignificance_;} +const PedsFullNoiseAnalysis::VVInt& PedsFullNoiseAnalysis::badFitStatus() const { return badFitStatus_;} +const PedsFullNoiseAnalysis::VVInt& PedsFullNoiseAnalysis::badADProbab() const { return badADProbab_;} +const PedsFullNoiseAnalysis::VVInt& PedsFullNoiseAnalysis::badKSProbab() const { return badKSProbab_;} +const PedsFullNoiseAnalysis::VVInt& PedsFullNoiseAnalysis::badJBProbab() const { return badJBProbab_;} +const PedsFullNoiseAnalysis::VVInt& PedsFullNoiseAnalysis::badChi2Probab() const { return badChi2Probab_;} +const PedsFullNoiseAnalysis::VVInt& PedsFullNoiseAnalysis::badTailStrip() const { return badTailStrip_;} +const PedsFullNoiseAnalysis::VVInt& PedsFullNoiseAnalysis::badDoublePeakStrip() const { return badDoublePeakStrip_;} + const PedsFullNoiseAnalysis::VFloat& PedsFullNoiseAnalysis::pedsMean() const { return pedsMean_; } const PedsFullNoiseAnalysis::VFloat& PedsFullNoiseAnalysis::pedsSpread() const { return pedsSpread_; } const PedsFullNoiseAnalysis::VFloat& PedsFullNoiseAnalysis::noiseMean() const { return noiseMean_; } @@ -180,4 +205,7 @@ const PedsFullNoiseAnalysis::VFloat& PedsFullNoiseAnalysis::noiseMax() const { r const PedsFullNoiseAnalysis::VFloat& PedsFullNoiseAnalysis::noiseMin() const { return noiseMin_; } const PedsFullNoiseAnalysis::VFloat& PedsFullNoiseAnalysis::rawMax() const { return rawMax_; } const PedsFullNoiseAnalysis::VFloat& PedsFullNoiseAnalysis::rawMin() const { return rawMin_; } + #endif // CondFormats_SiStripObjects_PedsFullNoiseAnalysis_H + + diff --git a/CondFormats/SiStripObjects/src/PedsFullNoiseAnalysis.cc b/CondFormats/SiStripObjects/src/PedsFullNoiseAnalysis.cc index 3723d2d96a99d..9055a61040366 100644 --- a/CondFormats/SiStripObjects/src/PedsFullNoiseAnalysis.cc +++ b/CondFormats/SiStripObjects/src/PedsFullNoiseAnalysis.cc @@ -8,6 +8,7 @@ using namespace sistrip; + // ---------------------------------------------------------------------------- // PedsFullNoiseAnalysis::PedsFullNoiseAnalysis( const uint32_t& key ) @@ -15,14 +16,33 @@ PedsFullNoiseAnalysis::PedsFullNoiseAnalysis( const uint32_t& key ) peds_(2,VFloat(128,sistrip::invalid_)), noise_(2,VFloat(128,sistrip::invalid_)), raw_(2,VFloat(128,sistrip::invalid_)), - ksProb_(2,VFloat(0,sistrip::invalid_)), - chi2Prob_(2,VFloat(0,sistrip::invalid_)), - noiseGaus_(2,VFloat(0,sistrip::invalid_)), - noiseBin84_(2,VFloat(0,sistrip::invalid_)), - noiseRMS_(2,VFloat(0,sistrip::invalid_)), - noiseSignif_(2,VFloat(0,sistrip::invalid_)), - dead_(2,VInt(0,sistrip::invalid_)), - noisy_(2,VInt(0,sistrip::invalid_)), + adProbab_(2,VFloat(128,sistrip::invalid_)), + ksProbab_(2,VFloat(128,sistrip::invalid_)), + jbProbab_(2,VFloat(128,sistrip::invalid_)), + chi2Probab_(2,VFloat(128,sistrip::invalid_)), + residualRMS_(2,VFloat(128,sistrip::invalid_)), + residualSigmaGaus_(2,VFloat(128,sistrip::invalid_)), + noiseSignificance_(2,VFloat(128,sistrip::invalid_)), + residualMean_(2,VFloat(128,sistrip::invalid_)), + residualSkewness_(2,VFloat(128,sistrip::invalid_)), + residualKurtosis_(2,VFloat(128,sistrip::invalid_)), + residualIntegralNsigma_(2,VFloat(128,sistrip::invalid_)), + residualIntegral_(2,VFloat(128,sistrip::invalid_)), + badStripBit_(2,VInt(128,sistrip::invalid_)), + deadStripBit_(2,VInt(128,sistrip::invalid_)), + deadStrip_(2,VInt(0,sistrip::invalid_)), + badStrip_(2,VInt(0,sistrip::invalid_)), + shiftedStrip_(2,VInt(0,sistrip::invalid_)), + lowNoiseStrip_(2,VInt(0,sistrip::invalid_)), + largeNoiseStrip_(2,VInt(0,sistrip::invalid_)), + largeNoiseSignificance_(2,VInt(0,sistrip::invalid_)), + badFitStatus_(2,VInt(0,sistrip::invalid_)), + badADProbab_(2,VInt(0,sistrip::invalid_)), + badKSProbab_(2,VInt(0,sistrip::invalid_)), + badJBProbab_(2,VInt(0,sistrip::invalid_)), + badChi2Probab_(2,VInt(0,sistrip::invalid_)), + badTailStrip_(2,VInt(0,sistrip::invalid_)), + badDoublePeakStrip_(2,VInt(0,sistrip::invalid_)), pedsMean_(2,sistrip::invalid_), pedsSpread_(2,sistrip::invalid_), noiseMean_(2,sistrip::invalid_), @@ -37,14 +57,33 @@ PedsFullNoiseAnalysis::PedsFullNoiseAnalysis( const uint32_t& key ) rawMin_(2,sistrip::invalid_), legacy_(false) { - dead_[0].reserve(128); dead_[1].reserve(128); - noisy_[0].reserve(128); noisy_[1].reserve(128); - ksProb_[0].reserve(128); ksProb_[1].reserve(128); - chi2Prob_[0].reserve(128); chi2Prob_[1].reserve(128); - noiseGaus_[0].reserve(128); noiseGaus_[1].reserve(128); - noiseBin84_[0].reserve(128); noiseBin84_[1].reserve(128); - noiseRMS_[0].reserve(128); noiseRMS_[1].reserve(128); - noiseSignif_[0].reserve(128); noiseSignif_[1].reserve(128); + // for flag bits one reserve at max 128 positions since will be filled with strip id only if the strip is bad + for(auto iapv : deadStrip_) + iapv.reserve(128); + for(auto iapv : badStrip_) + iapv.reserve(128); + for(auto iapv : shiftedStrip_) + iapv.reserve(128); + for(auto iapv : lowNoiseStrip_) + iapv.reserve(128); + for(auto iapv : largeNoiseStrip_) + iapv.reserve(128); + for(auto iapv : largeNoiseSignificance_) + iapv.reserve(128); + for(auto iapv : badFitStatus_) + iapv.reserve(128); + for(auto iapv : badADProbab_) + iapv.reserve(128); + for(auto iapv : badKSProbab_) + iapv.reserve(128); + for(auto iapv : badJBProbab_) + iapv.reserve(128); + for(auto iapv : badChi2Probab_) + iapv.reserve(128); + for(auto iapv : badTailStrip_) + iapv.reserve(128); + for(auto iapv : badDoublePeakStrip_) + iapv.reserve(128); } // ---------------------------------------------------------------------------- @@ -54,14 +93,33 @@ PedsFullNoiseAnalysis::PedsFullNoiseAnalysis() peds_(2,VFloat(128,sistrip::invalid_)), noise_(2,VFloat(128,sistrip::invalid_)), raw_(2,VFloat(128,sistrip::invalid_)), - ksProb_(2,VFloat(0,sistrip::invalid_)), - chi2Prob_(2,VFloat(0,sistrip::invalid_)), - noiseGaus_(2,VFloat(0,sistrip::invalid_)), - noiseBin84_(2,VFloat(0,sistrip::invalid_)), - noiseRMS_(2,VFloat(0,sistrip::invalid_)), - noiseSignif_(2,VFloat(0,sistrip::invalid_)), - dead_(2,VInt(0,sistrip::invalid_)), - noisy_(2,VInt(0,sistrip::invalid_)), + adProbab_(2,VFloat(128,sistrip::invalid_)), + ksProbab_(2,VFloat(128,sistrip::invalid_)), + jbProbab_(2,VFloat(128,sistrip::invalid_)), + chi2Probab_(2,VFloat(128,sistrip::invalid_)), + residualRMS_(2,VFloat(128,sistrip::invalid_)), + residualSigmaGaus_(2,VFloat(128,sistrip::invalid_)), + noiseSignificance_(2,VFloat(128,sistrip::invalid_)), + residualMean_(2,VFloat(128,sistrip::invalid_)), + residualSkewness_(2,VFloat(128,sistrip::invalid_)), + residualKurtosis_(2,VFloat(128,sistrip::invalid_)), + residualIntegralNsigma_(2,VFloat(128,sistrip::invalid_)), + residualIntegral_(2,VFloat(128,sistrip::invalid_)), + badStripBit_(2,VInt(128,sistrip::invalid_)), + deadStripBit_(2,VInt(128,sistrip::invalid_)), + deadStrip_(2,VInt(0,sistrip::invalid_)), + badStrip_(2,VInt(0,sistrip::invalid_)), + shiftedStrip_(2,VInt(0,sistrip::invalid_)), + lowNoiseStrip_(2,VInt(0,sistrip::invalid_)), + largeNoiseStrip_(2,VInt(0,sistrip::invalid_)), + largeNoiseSignificance_(2,VInt(0,sistrip::invalid_)), + badFitStatus_(2,VInt(0,sistrip::invalid_)), + badADProbab_(2,VInt(0,sistrip::invalid_)), + badKSProbab_(2,VInt(0,sistrip::invalid_)), + badJBProbab_(2,VInt(0,sistrip::invalid_)), + badChi2Probab_(2,VInt(0,sistrip::invalid_)), + badTailStrip_(2,VInt(0,sistrip::invalid_)), + badDoublePeakStrip_(2,VInt(128,sistrip::invalid_)), pedsMean_(2,sistrip::invalid_), pedsSpread_(2,sistrip::invalid_), noiseMean_(2,sistrip::invalid_), @@ -76,30 +134,99 @@ PedsFullNoiseAnalysis::PedsFullNoiseAnalysis() rawMin_(2,sistrip::invalid_), legacy_(false) { - dead_[0].reserve(128); dead_[1].reserve(128); - noisy_[0].reserve(128); noisy_[1].reserve(128); - ksProb_[0].reserve(128); ksProb_[1].reserve(128); - chi2Prob_[0].reserve(128); chi2Prob_[1].reserve(128); - noiseGaus_[0].reserve(128); noiseGaus_[1].reserve(128); - noiseBin84_[0].reserve(128); noiseBin84_[1].reserve(128); - noiseRMS_[0].reserve(128); noiseRMS_[1].reserve(128); - noiseSignif_[0].reserve(128); noiseSignif_[1].reserve(128); + // for flag bits one reserve at max 128 positions since will be filled with strip id only if the strip is bad + for(auto iapv : deadStrip_) + iapv.reserve(128); + for(auto iapv : badStrip_) + iapv.reserve(128); + for(auto iapv : shiftedStrip_) + iapv.reserve(128); + for(auto iapv : lowNoiseStrip_) + iapv.reserve(128); + for(auto iapv : largeNoiseStrip_) + iapv.reserve(128); + for(auto iapv : largeNoiseSignificance_) + iapv.reserve(128); + for(auto iapv : badFitStatus_) + iapv.reserve(128); + for(auto iapv : badADProbab_) + iapv.reserve(128); + for(auto iapv : badKSProbab_) + iapv.reserve(128); + for(auto iapv : badJBProbab_) + iapv.reserve(128); + for(auto iapv : badChi2Probab_) + iapv.reserve(128); + for(auto iapv : badTailStrip_) + iapv.reserve(128); + for(auto iapv : badDoublePeakStrip_) + iapv.reserve(128); } // ---------------------------------------------------------------------------- // void PedsFullNoiseAnalysis::reset() { - peds_ = VVFloat(2,VFloat(128,sistrip::invalid_)); - noise_ = VVFloat(2,VFloat(128,sistrip::invalid_)); - raw_ = VVFloat(2,VFloat(128,sistrip::invalid_)); - ksProb_ = VVFloat(2,VFloat(0,sistrip::invalid_)); - chi2Prob_ = VVFloat(2,VFloat(0,sistrip::invalid_)); - noiseGaus_ = VVFloat(2,VFloat(0,sistrip::invalid_)); - noiseBin84_ = VVFloat(2,VFloat(0,sistrip::invalid_)); - noiseRMS_ = VVFloat(2,VFloat(0,sistrip::invalid_)); - noiseSignif_ = VVFloat(2,VFloat(0,sistrip::invalid_)); - dead_ = VVInt(2,VInt(0,sistrip::invalid_)); - noisy_ = VVInt(2,VInt(0,sistrip::invalid_)); + + peds_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + noise_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + raw_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + adProbab_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + ksProbab_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + jbProbab_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + chi2Probab_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + residualRMS_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + residualSigmaGaus_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + noiseSignificance_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + residualMean_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + residualSkewness_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + residualKurtosis_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + residualIntegralNsigma_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + residualIntegral_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + + deadStrip_ = VVInt(2,VInt(0,sistrip::invalid_)); + badStrip_ = VVInt(2,VInt(0,sistrip::invalid_)); + badStripBit_ = VVInt(2,VInt(128,sistrip::invalid_)); + deadStripBit_ = VVInt(2,VInt(128,sistrip::invalid_)); + shiftedStrip_ = VVInt(2,VInt(0,sistrip::invalid_)); + lowNoiseStrip_ = VVInt(2,VInt(0,sistrip::invalid_)); + largeNoiseStrip_ = VVInt(2,VInt(0,sistrip::invalid_)); + largeNoiseSignificance_ = VVInt(2,VInt(0,sistrip::invalid_)); + badFitStatus_ = VVInt(2,VInt(0,sistrip::invalid_)); + badADProbab_ = VVInt(2,VInt(0,sistrip::invalid_)); + badKSProbab_ = VVInt(2,VInt(0,sistrip::invalid_)); + badJBProbab_ = VVInt(2,VInt(0,sistrip::invalid_)); + badChi2Probab_ = VVInt(2,VInt(0,sistrip::invalid_)); + badTailStrip_ = VVInt(2,VInt(0,sistrip::invalid_)); + badDoublePeakStrip_ = VVInt(2,VInt(0,sistrip::invalid_)); + + // for flag bits one reserve at max 128 positions since will be filled with strip id only if the strip is bad + for(auto iapv : deadStrip_) + iapv.reserve(128); + for(auto iapv : badStrip_) + iapv.reserve(128); + for(auto iapv : shiftedStrip_) + iapv.reserve(128); + for(auto iapv : lowNoiseStrip_) + iapv.reserve(128); + for(auto iapv : largeNoiseStrip_) + iapv.reserve(128); + for(auto iapv : largeNoiseSignificance_) + iapv.reserve(128); + for(auto iapv : badFitStatus_) + iapv.reserve(128); + for(auto iapv : badADProbab_) + iapv.reserve(128); + for(auto iapv : badKSProbab_) + iapv.reserve(128); + for(auto iapv : badJBProbab_) + iapv.reserve(128); + for(auto iapv : badChi2Probab_) + iapv.reserve(128); + for(auto iapv : badTailStrip_) + iapv.reserve(128); + for(auto iapv : badDoublePeakStrip_) + iapv.reserve(128); + pedsMean_ = VFloat(2,sistrip::invalid_); pedsSpread_ = VFloat(2,sistrip::invalid_); noiseMean_ = VFloat(2,sistrip::invalid_); @@ -112,14 +239,7 @@ void PedsFullNoiseAnalysis::reset() { noiseMin_ = VFloat(2,sistrip::invalid_); rawMax_ = VFloat(2,sistrip::invalid_); rawMin_ = VFloat(2,sistrip::invalid_); - dead_[0].reserve(128); dead_[1].reserve(128); - noisy_[0].reserve(128); noisy_[1].reserve(128); - ksProb_[0].reserve(128); ksProb_[1].reserve(128); - chi2Prob_[0].reserve(128); chi2Prob_[1].reserve(128); - noiseGaus_[0].reserve(128); noiseGaus_[1].reserve(128); - noiseBin84_[0].reserve(128); noiseBin84_[1].reserve(128); - noiseRMS_[0].reserve(128); noiseRMS_[1].reserve(128); - noiseSignif_[0].reserve(128); noiseSignif_[1].reserve(128); + legacy_ = false; } @@ -151,8 +271,6 @@ bool PedsFullNoiseAnalysis::isValid() const { rawMin_[0] < sistrip::maximum_ && rawMin_[1] < sistrip::maximum_ && getErrorCodes().empty() ); - //noiseMean_[0] <= rawMean_[0] && //@@ temp - //noiseMean_[1] <= rawMean_[1] ); //@@ temp } // ---------------------------------------------------------------------------- @@ -236,9 +354,10 @@ void PedsFullNoiseAnalysis::print( std::stringstream& ss, uint32_t iapv ) { if ( iapv == 1 || iapv == 2 ) { iapv--; } else { iapv = 0; } - if ( peds_[iapv].size() < 128 || + if ( peds_[iapv].size() < 128 || noise_[iapv].size() < 128 || - raw_[iapv].size() < 128 ) { + raw_[iapv].size() < 128 ) { + edm::LogWarning(mlCommissioning_) << "[" << myName() << "::" << __func__ << "]" << " Unexpected number of pedestal/noise values: " @@ -271,14 +390,15 @@ void PedsFullNoiseAnalysis::print( std::stringstream& ss, uint32_t iapv ) { << std::setw(6) << raw_[iapv][31] << ", " << std::setw(6) << raw_[iapv][63] << ", " << std::setw(6) << raw_[iapv][127] << std::endl - << " Dead strips (<5s) [strip] : (" << dead_[iapv].size() << " in total) "; - for ( uint16_t ii = 0; ii < dead_[iapv].size(); ii++ ) { - ss << dead_[iapv][ii] << " "; } + << " Dead strips (<5s) [strip] : (" << deadStrip_[iapv].size() << " in total) "; + + for ( uint16_t ii = 0; ii < deadStrip_[iapv].size(); ii++ ) { + ss << deadStrip_[iapv][ii] << " "; } ss << std::endl; - ss << " Noisy strips (>5s) [strip] : (" << noisy_[iapv].size() << " in total) "; - for ( uint16_t ii = 0; ii < noisy_[iapv].size(); ii++ ) { - ss << noisy_[iapv][ii] << " "; + ss << " Bad strips (>5s) [strip] : (" << badStrip_[iapv].size() << " in total) "; + for ( uint16_t ii = 0; ii < badStrip_[iapv].size(); ii++ ) { + ss << badStrip_[iapv][ii] << " "; } ss << std::endl; ss << " Mean peds +/- spread [ADC] : " << pedsMean_[iapv] << " +/- " << pedsSpread_[iapv] << std::endl diff --git a/DQM/SiStripCommissioningAnalysis/interface/PedsFullNoiseAlgorithm.h b/DQM/SiStripCommissioningAnalysis/interface/PedsFullNoiseAlgorithm.h index 242dd1168284f..621598eabfb11 100644 --- a/DQM/SiStripCommissioningAnalysis/interface/PedsFullNoiseAlgorithm.h +++ b/DQM/SiStripCommissioningAnalysis/interface/PedsFullNoiseAlgorithm.h @@ -13,6 +13,7 @@ class TH1; @author M. Wingham, R.Bainbridge @brief Histogram-based analysis for pedestal run. */ + class PedsFullNoiseAlgorithm : public CommissioningAlgorithm { public: @@ -22,10 +23,9 @@ class PedsFullNoiseAlgorithm : public CommissioningAlgorithm { ~PedsFullNoiseAlgorithm() override {;} inline const Histo& hPeds() const; - inline const Histo& hNoise() const; + inline const Histo& hNoise2D() const; - inline const Histo& hNoise1D() const; private: @@ -37,24 +37,37 @@ class PedsFullNoiseAlgorithm : public CommissioningAlgorithm { /** Performs histogram anaysis. */ void analyse() override; + /** reset vector */ + void reset(PedsFullNoiseAnalysis*); + private: /** Pedestals and raw noise */ Histo hPeds_; - - /** Residuals and noise */ + /** Noise and residuals */ Histo hNoise_; - Histo hNoise1D_; + Histo hNoise2D_; /** Analysis parameters */ - float deadStripMax_; - float noisyStripMin_; - std::string noiseDef_; - float ksProbCut_; + float maxDriftResidualCut_; + float minStripNoiseCut_; + float maxStripNoiseCut_; + float maxStripNoiseSignificanceCut_; + float adProbabCut_; + float ksProbabCut_; + bool generateRandomHisto_; + float jbProbabCut_; + float chi2ProbabCut_; + float kurtosisCut_; + float integralTailCut_; + int integralNsigma_; + float ashmanDistance_; + float amplitudeRatio_; + }; const PedsFullNoiseAlgorithm::Histo& PedsFullNoiseAlgorithm::hPeds() const { return hPeds_; } - +const PedsFullNoiseAlgorithm::Histo& PedsFullNoiseAlgorithm::hNoise2D() const { return hNoise2D_; } const PedsFullNoiseAlgorithm::Histo& PedsFullNoiseAlgorithm::hNoise() const { return hNoise_; } #endif // DQM_SiStripCommissioningAnalysis_PedsFullNoiseAlgorithm_H diff --git a/DQM/SiStripCommissioningAnalysis/src/PedsFullNoiseAlgorithm.cc b/DQM/SiStripCommissioningAnalysis/src/PedsFullNoiseAlgorithm.cc index b6bfa11c73d09..d340f5f263d3d 100644 --- a/DQM/SiStripCommissioningAnalysis/src/PedsFullNoiseAlgorithm.cc +++ b/DQM/SiStripCommissioningAnalysis/src/PedsFullNoiseAlgorithm.cc @@ -3,41 +3,66 @@ #include "DataFormats/SiStripCommon/interface/SiStripHistoTitle.h" #include "DataFormats/SiStripCommon/interface/SiStripEnumsAndStrings.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" + #include "TProfile.h" #include "TH1.h" #include "TH2.h" #include "TF1.h" +#include "TFitResult.h" +#include "TMath.h" +#include "Math/DistFunc.h" +#include "Math/ProbFuncMathCore.h" +#include "Fit/BinData.h" +#include "HFitInterface.h" +#include "Math/GoFTest.h" #include #include #include using namespace sistrip; - +using namespace std; // ---------------------------------------------------------------------------- // -PedsFullNoiseAlgorithm::PedsFullNoiseAlgorithm( const edm::ParameterSet & pset, PedsFullNoiseAnalysis* const anal ) - : CommissioningAlgorithm(anal), - hPeds_(nullptr,""), - hNoise_(nullptr,""), - hNoise1D_(nullptr,""), - deadStripMax_(pset.getParameter("DeadStripMax")), - noisyStripMin_(pset.getParameter("NoisyStripMin")), - noiseDef_(pset.getParameter("NoiseDefinition")), - ksProbCut_(pset.getParameter("KsProbCut")) +PedsFullNoiseAlgorithm::PedsFullNoiseAlgorithm( const edm::ParameterSet & pset, PedsFullNoiseAnalysis* const anal ): + CommissioningAlgorithm(anal), + hPeds_(nullptr,""), + hNoise_(nullptr,""), + hNoise2D_(nullptr,""), + maxDriftResidualCut_(pset.getParameter("MaxDriftResidualCut")), + minStripNoiseCut_(pset.getParameter("MinStripNoiseCut")), + maxStripNoiseCut_(pset.getParameter("MaxStripNoiseCut")), + maxStripNoiseSignificanceCut_(pset.getParameter("MaxStripNoiseSignificanceCut")), + adProbabCut_(pset.getParameter("AdProbabCut")), + ksProbabCut_(pset.getParameter("KsProbabCut")), + generateRandomHisto_(pset.getParameter("GenerateRandomHisto")), + jbProbabCut_(pset.getParameter("JbProbabCut")), + chi2ProbabCut_(pset.getParameter("Chi2ProbabCut")), + kurtosisCut_(pset.getParameter("KurtosisCut")), + integralTailCut_(pset.getParameter("IntegralTailCut")), + integralNsigma_(pset.getParameter("IntegralNsigma")), + ashmanDistance_(pset.getParameter("AshmanDistance")), + amplitudeRatio_(pset.getParameter("AmplitudeRatio")) { - //LogDebug(mlCommissioning_) - // << "[PedsFullNoiseAlgorithm::" << __func__ << "]" - // << " Set maximum noise deviation for dead strip determination to: " << deadStripMax_; - // LogDebug(mlCommissioning_) - // << "[PedsFullNoiseAlgorithm::" << __func__ << "]" - // << " Set minimal noise deviation for noise strip determination to: " << noisyStripMin_; + LogDebug(mlCommissioning_) + << "[PedsFullNoiseAlgorithm::" << __func__ << "]" + << " Set maximum drift of the mean value to: " << maxDriftResidualCut_ + << " Set minimum noise value to: " << minStripNoiseCut_ + << " Set maximum noise value to: " << maxStripNoiseCut_ + << " Set maximum noise significance value to: " << maxStripNoiseSignificanceCut_ + << " Set minimum Anderson-Darling p-value to: " << adProbabCut_ + << " Set minimum Kolmogorov-Smirnov p-value to: " << ksProbabCut_ + << " Set minimum Jacque-Bera p-value to: " << jbProbabCut_ + << " Set minimum Chi2 p-value to: " << chi2ProbabCut_ + << " Set N-sigma for the integral to : " << integralNsigma_ + << " Set maximum integral tail at N-sigma to : " << integralTailCut_ + << " Set maximum Kurtosis to : " << kurtosisCut_; } - + // ---------------------------------------------------------------------------- // void PedsFullNoiseAlgorithm::extract( const std::vector& histos ) { - + if ( !anal() ) { edm::LogWarning(mlCommissioning_) << "[PedsFullNoiseAlgorithm::" << __func__ << "]" @@ -45,12 +70,12 @@ void PedsFullNoiseAlgorithm::extract( const std::vector& histos ) { return; } - // Check number of histograms + // Check number of histograms --> Pedestal, noise and noise2D if ( histos.size() != 3 ) { anal()->addErrorCode(sistrip::numberOfHistos_); } - // Extract FED key from histo title + // Extract FED key from histo title --> i.e. APV pairs or LLD channel if ( !histos.empty() ) { anal()->fedKey( extractFedKey( histos.front() ) ); } @@ -62,49 +87,93 @@ void PedsFullNoiseAlgorithm::extract( const std::vector& histos ) { // Check for NULL pointer if ( !(*ihis) ) { continue; } -// TO BE UPDATED!!! - // Check run type SiStripHistoTitle title( (*ihis)->GetName() ); -/* if ( title.runType() != sistrip::PEDS_FULL_NOISE ) { + if ( title.runType() != sistrip::PEDS_FULL_NOISE ) { anal()->addErrorCode(sistrip::unexpectedTask_); continue; } -*/ + // Extract peds histos if ( title.extraInfo().find(sistrip::extrainfo::roughPedestals_) != std::string::npos ) { //@@ something here for rough peds? - } else if ( title.extraInfo().find(sistrip::extrainfo::pedestals_) != std::string::npos ) { + } + else if ( title.extraInfo().find(sistrip::extrainfo::pedestals_) != std::string::npos ) { hPeds_.first = *ihis; hPeds_.second = (*ihis)->GetName(); - } else if ( title.extraInfo().find(sistrip::extrainfo::commonMode_) != std::string::npos ) { + } + else if ( title.extraInfo().find(sistrip::extrainfo::commonMode_) != std::string::npos ) { //@@ something here for CM plots? - } else if ( title.extraInfo().find(sistrip::extrainfo::noiseProfile_) != std::string::npos ) { + } + else if ( title.extraInfo().find(sistrip::extrainfo::noiseProfile_) != std::string::npos ) { //@@ something here for noise profile plot? - hNoise1D_.first = *ihis; - hNoise1D_.second = (*ihis)->GetName(); - } else if ( title.extraInfo().find(sistrip::extrainfo::noise2D_) != std::string::npos ) { hNoise_.first = *ihis; hNoise_.second = (*ihis)->GetName(); - } else { + } + else if ( title.extraInfo().find(sistrip::extrainfo::noise2D_) != std::string::npos ) { + hNoise2D_.first = *ihis; + hNoise2D_.second = (*ihis)->GetName(); + } + else { anal()->addErrorCode(sistrip::unexpectedExtraInfo_); } - } + } +} + +// resetting vectors +void PedsFullNoiseAlgorithm::reset(PedsFullNoiseAnalysis* ana){ + for(size_t iapv = 0 ; iapv < ana->peds_.size(); iapv++){ + ana->pedsMean_[iapv] = 0.; + ana->rawMean_[iapv] = 0.; + ana->noiseMean_[iapv] = 0.; + ana->pedsSpread_[iapv] = 0.; + ana->noiseSpread_[iapv] = 0.; + ana->rawSpread_[iapv] = 0.; + ana->pedsMax_[iapv] = 0.; + ana->pedsMin_[iapv] = 0.; + ana->rawMax_[iapv] = 0.; + ana->rawMin_[iapv] = 0.; + ana->noiseMax_[iapv] = 0.; + ana->noiseMin_[iapv] = 0.; + + for(size_t istrip = 0; istrip < ana->peds_[iapv].size(); istrip++){ + ana->peds_[iapv][istrip] = 0.; + ana->noise_[iapv][istrip] = 0.; + ana->raw_[iapv][istrip] = 0.; + ana->adProbab_[iapv][istrip] = 0.; + ana->ksProbab_[iapv][istrip] = 0.; + ana->jbProbab_[iapv][istrip] = 0.; + ana->chi2Probab_[iapv][istrip] = 0.; + ana->residualRMS_[iapv][istrip] = 0.; + ana->residualSigmaGaus_[iapv][istrip] = 0.; + ana->noiseSignificance_[iapv][istrip] = 0.; + ana->residualMean_[iapv][istrip] = 0.; + ana->residualSkewness_[iapv][istrip] = 0.; + ana->residualKurtosis_[iapv][istrip] = 0.; + ana->residualIntegralNsigma_[iapv][istrip] = 0.; + ana->residualIntegral_[iapv][istrip] = 0.; + ana->deadStripBit_[iapv][istrip] = 0; + ana->badStripBit_[iapv][istrip] = 0; + } + } } // ----------------------------------------------------------------------------- // void PedsFullNoiseAlgorithm::analyse() { + // check base analysis object if ( !anal() ) { edm::LogWarning(mlCommissioning_) << "[PedsFullNoiseAlgorithm::" << __func__ << "]" << " NULL pointer to base Analysis object!"; return; } - - CommissioningAnalysis* tmp = const_cast( anal() ); + + CommissioningAnalysis* tmp = const_cast( anal() ); PedsFullNoiseAnalysis* ana = dynamic_cast( tmp ); + + // check PedsFullNoiseAnalysis object if ( !ana ) { edm::LogWarning(mlCommissioning_) << "[PedsFullNoiseAlgorithm::" << __func__ << "]" @@ -112,244 +181,442 @@ void PedsFullNoiseAlgorithm::analyse() { return; } - if ( !hPeds_.first ) { + + // check if the histograms exists + if ( !hPeds_.first) { ana->addErrorCode(sistrip::nullPtr_); return; } - + if ( !hNoise_.first ) { ana->addErrorCode(sistrip::nullPtr_); return; } - - TProfile * peds_histo = dynamic_cast(hPeds_.first); - TH2S * noise_histo = dynamic_cast(hNoise_.first); - if ( !peds_histo ) { + + if ( !hNoise2D_.first ) { + ana->addErrorCode(sistrip::nullPtr_); + return; + } + + // take the histograms + TProfile *histoPeds = dynamic_cast(hPeds_.first); + TProfile *histoNoiseMean = dynamic_cast(hNoise_.first); + TH2S * histoNoise = dynamic_cast(hNoise2D_.first); + + // Make sanity checks about pointers + if (not histoPeds) { + ana->addErrorCode(sistrip::nullPtr_); + return; + } + + if (not histoNoiseMean) { ana->addErrorCode(sistrip::nullPtr_); return; } - if ( !noise_histo ) { + if (not histoNoise) { ana->addErrorCode(sistrip::nullPtr_); return; } - if ( peds_histo->GetNbinsX() != 256 ) { + // check the binning --> each x-axis bin is 1 strip -> 2APV per lldChannel -> 256 strips + if (histoPeds->GetNbinsX() != 256 ) { ana->addErrorCode(sistrip::numberOfBins_); return; } - if ( noise_histo->GetNbinsY() != 256 ) { // X range is configurable + //check the binning --> each x-axis bin is 1 strip -> 2APV per lldChannel -> 256 strips + if (histoNoiseMean->GetNbinsX() != 256 ) { ana->addErrorCode(sistrip::numberOfBins_); return; } + + //check the binning --> each y-axis bin is 1 strip -> 2APV per lldChannel -> 256 strips + if (histoNoise->GetNbinsY() != 256 ) { + ana->addErrorCode(sistrip::numberOfBins_); + return; + } + + //Reset values + reset(ana); - // Iterate through APVs - for ( uint16_t iapv = 0; iapv < 2; iapv++ ) { - - // Used to calc mean and rms for peds and noise - float p_sum = 0., p_sum2 = 0., p_max = -1.*sistrip::invalid_, p_min = sistrip::invalid_; - float n_sum = 0., n_sum2 = 0., n_max = -1.*sistrip::invalid_, n_min = sistrip::invalid_; - float r_sum = 0., r_sum2 = 0., r_max = -1.*sistrip::invalid_, r_min = sistrip::invalid_; - // Iterate through strips of APV - - //Need our own copy for thread safety - TF1 mygaus("mygaus","gaus"); - for ( uint16_t istr = 0; istr < 128; istr++ ) { - - ana->ksProb_[iapv].push_back(0); - ana->noiseGaus_[iapv].push_back(0); - ana->noiseBin84_[iapv].push_back(0); - ana->noiseRMS_[iapv].push_back(0); - ana->noiseSignif_[iapv].push_back(0); + + // loop on each strip + uint32_t apvID = -1; + + // Save basic information at strip / APV level + vector ped_max; + vector ped_min; + vector raw_max; + vector raw_min; + vector noise_max; + vector noise_min; + + // loop on each strip in the lldChannel + for(int iStrip = 0; iStrip < histoPeds->GetNbinsX(); iStrip++){ + + if(iStrip < histoPeds->GetNbinsX()/2) apvID = 0; + else apvID = 1; - // pedestals and raw noise - if ( peds_histo ) { - if ( peds_histo->GetBinEntries(iapv*128 + istr + 1) ) { - ana->peds_[iapv][istr] = peds_histo->GetBinContent(iapv*128 + istr + 1); - p_sum += ana->peds_[iapv][istr]; - p_sum2 += (ana->peds_[iapv][istr] * ana->peds_[iapv][istr]); - if ( ana->peds_[iapv][istr] > p_max ) { p_max = ana->peds_[iapv][istr];} - if ( ana->peds_[iapv][istr] < p_min ) { p_min = ana->peds_[iapv][istr];} - ana->raw_[iapv][istr] = peds_histo->GetBinError(iapv*128 + istr + 1); - r_sum += ana->raw_[iapv][istr]; - r_sum2 += (ana->raw_[iapv][istr] * ana->raw_[iapv][istr]); - if ( ana->raw_[iapv][istr] > r_max ) { r_max = ana->raw_[iapv][istr]; } - if ( ana->raw_[iapv][istr] < r_min ) { r_min = ana->raw_[iapv][istr]; } - } - } - // Noise from Full Distribution - if ( noise_histo ) { - // Fit the ADC Distribution from TH2S by projecting it out and fitting. - - TH1S * noisehist = new TH1S("noisehist","",noise_histo->GetNbinsX(), - -noise_histo->GetNbinsX()/2,noise_histo->GetNbinsX()/2); - - - for(int i=0;i<=noise_histo->GetNbinsX()+1;i++){ - noisehist->SetBinContent(i,noise_histo->GetBinContent(i,iapv*128 + istr + 1)); - } - // If the histogram is valid. - if(noisehist->Integral() > 0){ - ana->noiseRMS_[iapv][istr] = noisehist->GetRMS(); - noisehist->Fit(&mygaus,"Q"); - ana->noiseGaus_[iapv][istr] = mygaus.GetParameter(2); - - // new Bin84 method - std::vector integralFrac; - integralFrac.push_back(1.*noisehist->GetBinContent(0)/noisehist->Integral(0,noisehist->GetNbinsX())); - // Calculate the integral of distro as a function of bins. - for(int i = 1; i < noisehist->GetNbinsX();i++){ - integralFrac.push_back(float(noisehist->GetBinContent(i))/ - noisehist->Integral(0,noisehist->GetNbinsX())+integralFrac[i-1]); - //Take the two bins next to 84% and solve for x in 0.84 = mx+b - if (integralFrac[i] >= 0.84135 && integralFrac[i-1] < 0.84135) { - // my quadratic noise calculation - double w = noisehist->GetBinWidth(i); - double a = noisehist->GetBinContent(i-1); - double b = noisehist->GetBinContent(i); - double f = w*(0.84135 -integralFrac[i-1])/(integralFrac[i]-integralFrac[i-1]); - double x = 0; - if (a==b) { - x = f; - } else { - double aa = (b-a)/(2*w); - double bb = (b+a)/2; - double cc = -b*f; - double dd = bb*bb-4*aa*cc; //if (dd<0) dd=0; - x = (-bb+sqrt(dd))/(2*aa); - } - ana->noiseBin84_[iapv][istr] = noisehist->GetBinLowEdge(i) + x; - } - } - // Compare shape of ADC to a histogram made of Gaus Fit for KSProb, Chi2Prob, Etc... - TH1D * FitHisto = new TH1D("FitHisto","FitHisto",noisehist->GetNbinsX(), - -noisehist->GetNbinsX()/2,noisehist->GetNbinsX()/2); - FitHisto->Add(&mygaus); - FitHisto->Sumw2(); - noisehist->Sumw2(); - - if(FitHisto->Integral() > 0){ - // This is stored as a float but will be plotted as an int at the summary histos. - // This forces the histo to draw 10000 bins instead of 1. - ana->ksProb_[iapv][istr] = noisehist->KolmogorovTest(FitHisto)*10000; - } - delete FitHisto; - } - delete noisehist; - } - // Assigning the actual noise values used for Upload!!!!!!!!!!!!!!!!!!!! - if (noiseDef_ == "Bin84") { - if (ana->noiseBin84_[iapv][istr] > 0) { - ana->noise_[iapv][istr] = ana->noiseBin84_[iapv][istr]; - } else { - ana->noise_[iapv][istr] = ana->noiseRMS_[iapv][istr]; - } - } else if (noiseDef_ == "RMS") { - ana->noise_[iapv][istr] = ana->noiseRMS_[iapv][istr]; - } else edm::LogWarning(mlCommissioning_)<< "[PedsFullNoiseAlgorithm::" - << __func__ << "]"<< " Unknown noise definition!!!"; + int stripBin = 0; + if(iStrip >= 128) stripBin = iStrip-128; + else stripBin = iStrip; - // Setting Sum of RMS and RMS^2 for Dead/Noisy Strip calculations - n_sum += ana->noise_[iapv][istr]; - n_sum2 += (ana->noise_[iapv][istr] * ana->noise_[iapv][istr]); - if ( ana->noise_[iapv][istr] > n_max ) { n_max = ana->noise_[iapv][istr]; } - if ( ana->noise_[iapv][istr] < n_min ) { n_min = ana->noise_[iapv][istr]; } + ana->peds_[apvID][stripBin] = histoPeds->GetBinContent(iStrip+1); // pedestal value + ana->noise_[apvID][stripBin] = histoNoiseMean->GetBinContent(iStrip+1); // noise value + ana->raw_[apvID][stripBin] = histoPeds->GetBinError(iStrip+1); // raw noise value + + ana->pedsMean_[apvID] += ana->peds_[apvID][stripBin]; // mean pedestal + ana->rawMean_[apvID] += ana->raw_[apvID][stripBin]; // mean raw noise + ana->noiseMean_[apvID] += ana->noise_[apvID][stripBin]; // mean noise + + // max pedestal + if(ped_max.size() < apvID+1) + ped_max.push_back(ana->peds_[apvID][stripBin]); + else{ + if(ana->peds_[apvID][stripBin] > ped_max.at(apvID)) + ped_max.at(apvID) = ana->peds_[apvID][stripBin]; + } + + // min pedestal + if(ped_min.size() < apvID+1) + ped_min.push_back(ana->peds_[apvID][stripBin]); + else{ + if(ana->peds_[apvID][stripBin] < ped_min.at(apvID)) + ped_min.at(apvID) = ana->peds_[apvID][stripBin]; // min pedestal + } + + // max noise + if(noise_max.size() < apvID+1) + noise_max.push_back(ana->noise_[apvID][stripBin]); + else{ + if(ana->noise_[apvID][stripBin] > noise_max.at(apvID)) + noise_max.at(apvID) = ana->noise_[apvID][stripBin]; + } + + // min noise + if(noise_min.size() < apvID+1) + noise_min.push_back(ana->noise_[apvID][stripBin]); + else{ + if(ana->noise_[apvID][stripBin] < noise_min.at(apvID)) + noise_min.at(apvID) = ana->noise_[apvID][stripBin]; + } + + // max raw + if(raw_max.size() < apvID+1) + raw_max.push_back(ana->raw_[apvID][stripBin]); + else{ + if(ana->raw_[apvID][stripBin] > raw_max.at(apvID)) + raw_max.at(apvID) = ana->raw_[apvID][stripBin]; + } + + // min raw + if(raw_min.size() < apvID+1) + raw_min.push_back(ana->raw_[apvID][stripBin]); + else{ + if(ana->raw_[apvID][stripBin] < raw_min.at(apvID)) + raw_min.at(apvID) = ana->raw_[apvID][stripBin]; + } + } + + // Mean values + for(unsigned int iApv = 0; iApv < ana->pedsMean_.size(); iApv++){ + ana->pedsMean_.at(iApv) /= (ana->peds_[iApv].size()); // calculate mean pedestal per APV + ana->rawMean_.at(iApv) /= (ana->raw_[iApv].size()); // calculate mean raw noise per APV + ana->noiseMean_.at(iApv) /= (ana->noise_[iApv].size()); // calculate mean noise per APV + } + + // Min and Max + for(unsigned int iApv = 0; iApv < ped_max.size(); iApv++){ + if(ped_max.at(iApv) > sistrip::maximum_) + ana->pedsMax_.at(iApv) = sistrip::maximum_; + else if(ped_max.at(iApv) < -1.*sistrip::maximum_) + ana->pedsMax_.at(iApv) = -1.*sistrip::maximum_; + else + ana->pedsMax_.at(iApv) = ped_max.at(iApv); + + if(ped_min.at(iApv) > sistrip::maximum_) + ana->pedsMin_.at(iApv) = sistrip::maximum_; + else if(ped_min.at(iApv) < -1.*sistrip::maximum_) + ana->pedsMin_.at(iApv) = -1.*sistrip::maximum_; + else + ana->pedsMin_.at(iApv) = ped_min.at(iApv); + + if(noise_max.at(iApv) > sistrip::maximum_) + ana->noiseMax_.at(iApv) = sistrip::maximum_; + else if(noise_max.at(iApv) < -1.*sistrip::maximum_) + ana->noiseMax_.at(iApv) = -1.*sistrip::maximum_; + else + ana->noiseMax_.at(iApv) = noise_max.at(iApv); + + if(noise_min.at(iApv) > sistrip::maximum_) + ana->noiseMin_.at(iApv) = sistrip::maximum_; + else if(noise_min.at(iApv) < -1.*sistrip::maximum_) + ana->noiseMin_.at(iApv) = -1.*sistrip::maximum_; + else + ana->noiseMin_.at(iApv) = noise_min.at(iApv); + + if(raw_max.at(iApv) > sistrip::maximum_) + ana->rawMax_.at(iApv) = sistrip::maximum_; + else if(raw_max.at(iApv) < -1.*sistrip::maximum_) + ana->rawMax_.at(iApv) = -1.*sistrip::maximum_; + else + ana->rawMax_.at(iApv) = raw_max.at(iApv); + + if(raw_min.at(iApv) > sistrip::maximum_) + ana->rawMin_.at(iApv) = sistrip::maximum_; + else if(raw_min.at(iApv) < -1.*sistrip::maximum_) + ana->rawMin_.at(iApv) = -1.*sistrip::maximum_; + else + ana->rawMin_.at(iApv) = raw_min.at(iApv); + + } + + // Calculate the spread for noise and pedestal + apvID = -1; + + for(int iStrip = 0; iStrip < histoNoiseMean->GetNbinsX(); iStrip++){ + if(iStrip < histoNoiseMean->GetNbinsX()/2) apvID = 0; + else apvID = 1; + ana->pedsSpread_[apvID] += pow(histoPeds->GetBinContent(iStrip+1)-ana->pedsMean_.at(apvID),2); + ana->noiseSpread_[apvID] += pow(histoNoiseMean->GetBinContent(iStrip+1)-ana->noiseMean_.at(apvID),2); + ana->rawSpread_[apvID] += pow(histoPeds->GetBinError(iStrip+1)-ana->rawMean_.at(apvID),2); + } + + for(unsigned int iApv = 0; iApv < ana->pedsSpread_.size(); iApv++){ + ana->pedsSpread_[iApv] = sqrt(ana->pedsSpread_[iApv])/sqrt(ana->peds_[iApv].size() -1); + ana->noiseSpread_[iApv] = sqrt(ana->noiseSpread_[iApv])/sqrt(ana->noise_[iApv].size()-1); + ana->rawSpread_[iApv] = sqrt(ana->rawSpread_[iApv])/sqrt(ana->raw_[iApv].size() -1); + } + + // loop on each strip in the lldChannel + apvID = 0; + TH1S* histoResidualStrip = new TH1S("histoResidualStrip","",histoNoise->GetNbinsX(),histoNoise->GetXaxis()->GetXmin(),histoNoise->GetXaxis()->GetXmax()); + histoResidualStrip->Sumw2(); + histoResidualStrip->SetDirectory(0); + TF1* fitFunc = new TF1 ("fitFunc","gaus(0)",histoNoise->GetXaxis()->GetXmin(),histoNoise->GetXaxis()->GetXmax()); + TF1* fit2Gaus = nullptr; + TH1F* randomHisto = nullptr; + TFitResultPtr result; + + for(int iStrip = 0; iStrip < histoNoise->GetNbinsY(); iStrip++){ + // tell which APV + if(iStrip < histoNoise->GetNbinsY()/2) apvID = 0; + else apvID = 1; + histoResidualStrip->Reset(); + + int stripBin = 0; + if(iStrip >= 128) stripBin = iStrip-128; + else stripBin = iStrip; + + for(int iBinX = 0; iBinX < histoNoise->GetNbinsX(); iBinX++){ + histoResidualStrip->SetBinContent(iBinX+1,histoNoise->GetBinContent(iBinX+1,iStrip+1)); + histoResidualStrip->SetBinError(iBinX+1,histoNoise->GetBinError(iBinX+1,iStrip+1)); + } + + if(histoResidualStrip->Integral() == 0){ // dead strip --> i.e. no data - } // strip loop - - // Calc mean and rms for peds - if ( !ana->peds_[iapv].empty() ) { - p_sum /= static_cast( ana->peds_[iapv].size() ); - p_sum2 /= static_cast( ana->peds_[iapv].size() ); - ana->pedsMean_[iapv] = p_sum; - ana->pedsSpread_[iapv] = sqrt( fabs(p_sum2 - p_sum*p_sum) ); + // set default values + ana->adProbab_[apvID][stripBin] = 0; + ana->ksProbab_[apvID][stripBin] = 0; + ana->jbProbab_[apvID][stripBin] = 0; + ana->chi2Probab_[apvID][stripBin] = 0; + ana->noiseSignificance_[apvID][stripBin] = 0; + ana->residualMean_[apvID][stripBin] = 0; + ana->residualRMS_[apvID][stripBin] = 0; + ana->residualSigmaGaus_[apvID][stripBin] = 0; + ana->residualSkewness_[apvID][stripBin] = 0; + ana->residualKurtosis_[apvID][stripBin] = 0; + ana->residualIntegralNsigma_[apvID][stripBin] = 0; + ana->residualIntegral_[apvID][stripBin] = 0; + ana->deadStrip_[apvID].push_back(stripBin); + ana->deadStripBit_[apvID][stripBin] = 1; + ana->badStripBit_[apvID][stripBin] = 0; + + SiStripFecKey fec_key(ana->fecKey()); + LogTrace(mlDqmClient_)<<"DeadStrip: fecCrate " + <<" "<residualMean_[apvID][stripBin] = histoResidualStrip->GetMean(); + ana->residualRMS_[apvID][stripBin] = histoResidualStrip->GetRMS(); + ana->residualSkewness_[apvID][stripBin] = histoResidualStrip->GetSkewness(); + ana->residualKurtosis_[apvID][stripBin] = histoResidualStrip->GetKurtosis(); + ana->noiseSignificance_[apvID][stripBin] = (ana->noise_[apvID][stripBin]-ana->noiseMean_[apvID])/ana->noiseSpread_[apvID]; + ana->residualIntegral_[apvID][stripBin] = histoResidualStrip->Integral(); + ana->residualIntegralNsigma_[apvID][stripBin] = + (histoResidualStrip->Integral(histoResidualStrip->FindBin(ana->residualMean_[apvID][stripBin]+ana->residualRMS_[apvID][stripBin]*integralNsigma_),histoResidualStrip->GetNbinsX()+1) + + histoResidualStrip->Integral(0,histoResidualStrip->FindBin(ana->residualMean_[apvID][stripBin]-ana->residualRMS_[apvID][stripBin]*integralNsigma_)))/ana->residualIntegral_[apvID][stripBin]; + + // performing a Gaussian fit of the residual distribution + fitFunc->SetRange(histoNoise->GetXaxis()->GetXmin(),histoNoise->GetXaxis()->GetXmax()); + fitFunc->SetParameters(ana->residualIntegral_[apvID][stripBin],ana->residualMean_[apvID][stripBin],ana->residualRMS_[apvID][stripBin]); + result = histoResidualStrip->Fit(fitFunc,"QSRN"); + + // Good gaussian fit + if(result.Get()){ + + ana->residualSigmaGaus_[apvID][stripBin] = fitFunc->GetParameter(2); + ana->chi2Probab_[apvID][stripBin] = result->Prob(); + + // jacque bera probability + float jbVal = (ana->residualIntegral_[apvID][stripBin]/6)*(pow(ana->residualSkewness_[apvID][stripBin],2)+pow(ana->residualKurtosis_[apvID][stripBin],2)/4); + ana->jbProbab_[apvID][stripBin] = ROOT::Math::chisquared_cdf_c(jbVal,2); + + //Kolmogorov Smirnov and Anderson Darlong + if(randomHisto == nullptr) + randomHisto = (TH1F*) histoResidualStrip->Clone("randomHisto"); + randomHisto->Reset(); + randomHisto->SetDirectory(0); + + if(generateRandomHisto_){/// + randomHisto->FillRandom("fitFunc",histoResidualStrip->Integral()); + if(randomHisto->Integral() != 0){ + ana->ksProbab_[apvID][stripBin] = histoResidualStrip->KolmogorovTest(randomHisto,"N"); + ana->adProbab_[apvID][stripBin] = histoResidualStrip->AndersonDarlingTest(randomHisto); + } + else{ + ana->ksProbab_[apvID][stripBin] = 0; + ana->adProbab_[apvID][stripBin] = 0; + } + + } + else{ + randomHisto->Add(fitFunc); + if(randomHisto->Integral() != 0){ + ana->ksProbab_[apvID][stripBin] = histoResidualStrip->KolmogorovTest(randomHisto,"N"); + ROOT::Fit::BinData data1; + ROOT::Fit::BinData data2; + ROOT::Fit::FillData(data1,histoResidualStrip,0); + data2.Initialize(randomHisto->GetNbinsX()+1,1); + for(int ibin = 0; ibin < randomHisto->GetNbinsX(); ibin++){ + if(histoResidualStrip->GetBinContent(ibin+1) != 0 or randomHisto->GetBinContent(ibin+1) >= 1) + data2.Add(randomHisto->GetBinCenter(ibin+1),randomHisto->GetBinContent(ibin+1),randomHisto->GetBinError(ibin+1)); + } + + double probab, value; + ROOT::Math::GoFTest::AndersonDarling2SamplesTest(data1,data2,probab,value); + ana->adProbab_[apvID][stripBin] = probab; + } + else{ + ana->ksProbab_[apvID][stripBin] = 0; + ana->adProbab_[apvID][stripBin] = 0; + } + } } - // Calc mean and rms for noise using noiseRMS. - if ( !ana->noise_[iapv].empty() ) { - n_sum /= static_cast( ana->noise_[iapv].size() ); - n_sum2 /= static_cast( ana->noise_[iapv].size() ); - ana->noiseMean_[iapv] = n_sum; - ana->noiseSpread_[iapv] = sqrt( fabs(n_sum2 - n_sum*n_sum) ); + // start applying selections storing output + bool badStripFlag = false; + ana->deadStripBit_[apvID][stripBin] = 0; // is not dead if the strip has data + + if(fabs(ana->residualMean_[apvID][stripBin]) > maxDriftResidualCut_ and not badStripFlag) {//mean value + ana->shiftedStrip_[apvID].push_back(stripBin); + badStripFlag = true; + } + + if(ana->residualRMS_[apvID][stripBin] < minStripNoiseCut_ and not badStripFlag){ // low noise + ana->lowNoiseStrip_[apvID].push_back(stripBin); + badStripFlag = true; } - // Calc mean and rms for raw noise - if ( !ana->raw_[iapv].empty() ) { - r_sum /= static_cast( ana->raw_[iapv].size() ); - r_sum2 /= static_cast( ana->raw_[iapv].size() ); - ana->rawMean_[iapv] = r_sum; - ana->rawSpread_[iapv] = sqrt( fabs(r_sum2 - r_sum*r_sum) ); + if(ana->residualRMS_[apvID][stripBin] > maxStripNoiseCut_ and not badStripFlag){ // large noise + ana->largeNoiseStrip_[apvID].push_back(stripBin); + badStripFlag = true; } + + if(fabs(ana->noiseSignificance_[apvID][stripBin]) > maxStripNoiseSignificanceCut_ and not badStripFlag){ // large noise significance + ana->largeNoiseSignificance_[apvID].push_back(stripBin); + badStripFlag = true; + } + + if(result.Get() and result->Status() != 0) // bad fit status + ana->badFitStatus_[apvID].push_back(stripBin); + + if(ana->adProbab_[apvID][stripBin] < adProbabCut_ and not badStripFlag) // bad AD p-value --> store the strip-id + ana->badADProbab_[apvID].push_back(stripBin); + + if(ana->ksProbab_[apvID][stripBin] < ksProbabCut_ and not badStripFlag) // bad KS p-value --> store the strip-id + ana->badKSProbab_[apvID].push_back(stripBin); + + if(ana->jbProbab_[apvID][stripBin] < jbProbabCut_ and not badStripFlag) // bad JB p-value --> store the strip-id + ana->badJBProbab_[apvID].push_back(stripBin); + + if(ana->chi2Probab_[apvID][stripBin] < chi2ProbabCut_ and not badStripFlag) // bad CHI2 p-value --> store the strip-id + ana->badChi2Probab_[apvID].push_back(stripBin); + + if(ana->adProbab_[apvID][stripBin] < adProbabCut_ and ana->ksProbab_[apvID][stripBin] < ksProbabCut_ and + ana->jbProbab_[apvID][stripBin] < jbProbabCut_ and ana->chi2Probab_[apvID][stripBin] < chi2ProbabCut_) + badStripFlag = true; // bad strip is flagged as bad by all the methods + + if(ana->residualKurtosis_[apvID][stripBin] > kurtosisCut_ and ana->residualIntegralNsigma_[apvID][stripBin] > integralTailCut_ and not badStripFlag){ // bad tails + ana->badTailStrip_[apvID].push_back(stripBin); + badStripFlag = true; + } + + if(badStripFlag){ // loop for double peaked - // Set max and min values for peds, noise and raw noise - if ( p_max > -1.*sistrip::maximum_ ) { ana->pedsMax_[iapv] = p_max; } - if ( p_min < 1.*sistrip::maximum_ ) { ana->pedsMin_[iapv] = p_min; } - if ( n_max > -1.*sistrip::maximum_ ) { ana->noiseMax_[iapv] = n_max; } - if ( n_min < 1.*sistrip::maximum_ ) { ana->noiseMin_[iapv] = n_min; } - if ( r_max > -1.*sistrip::maximum_ ) { ana->rawMax_[iapv] = r_max; } - if ( r_min < 1.*sistrip::maximum_ ) { ana->rawMin_[iapv] = r_min; } - - // Set dead and noisy strips - for ( uint16_t istr = 0; istr < 128; istr++ ) { // strip loop - // Set the significance of the noise of each strip also compared to apv avg. - ana->noiseSignif_[iapv][istr] = (ana->noise_[iapv][istr]-ana->noiseMean_[iapv])/ana->noiseSpread_[iapv]; - if ( ana->noiseMin_[iapv] > sistrip::maximum_ || ana->noiseMax_[iapv] > sistrip::maximum_ ) { - continue; - } - // Strip Masking for Dead Strips - if(ana->noiseSignif_[iapv][istr] < -deadStripMax_){ - ana->dead_[iapv].push_back(istr); - SiStripFecKey fec_key(ana->fecKey()); - LogTrace(mlDqmClient_)<<"DeadSignif "<noiseSignif_[iapv][istr] - <<" "<noiseMax_[iapv]/ana->noiseMean_[iapv] > 3 || ana->noiseSpread_[iapv] > 3) - && ana->noiseSignif_[iapv][istr] > 1){ - ana->noisy_[iapv].push_back(istr); - SiStripFecKey fec_key(ana->fecKey()); - LogTrace(mlDqmClient_)<<"NoisyLM "<noiseMax_[iapv]/ana->noiseMean_[iapv] - <<" "<ksProb_[iapv][istr] < ksProbCut_){ - ana->noisy_[iapv].push_back(istr); - SiStripFecKey fec_key(ana->fecKey()); - LogTrace(mlDqmClient_)<<"NoisyKS "<ksProb_[iapv][istr] - <<" "<noiseSignif_[iapv][istr] > noisyStripMin_){ - ana->noisy_[iapv].push_back(istr); - SiStripFecKey fec_key(ana->fecKey()); - LogTrace(mlDqmClient_)<<"NoisySignif "<noiseSignif_[iapv][istr] - <<" "<GetXaxis()->GetXmin(),histoNoise->GetXaxis()->GetXmax()); + fit2Gaus->SetParameter(0,fitFunc->GetParameter(0)/2); + fit2Gaus->SetParameter(3,fitFunc->GetParameter(0)/2); + fit2Gaus->SetParameter(1,1.); + fit2Gaus->SetParameter(4,-1.); + fit2Gaus->SetParameter(2,fitFunc->GetParameter(2)); + fit2Gaus->SetParameter(5,fitFunc->GetParameter(2)); + fit2Gaus->SetParLimits(1,0.,histoNoise->GetXaxis()->GetXmax()); + fit2Gaus->SetParLimits(4,histoNoise->GetXaxis()->GetXmin(),0); + result = histoResidualStrip->Fit(fit2Gaus,"QSR"); + + // ashman distance + float ashman = TMath::Power(2,0.5)*abs(fit2Gaus->GetParameter(1)-fit2Gaus->GetParameter(4))/(sqrt(pow(fit2Gaus->GetParameter(2),2)+pow(fit2Gaus->GetParameter(5),2))); + // amplitude + float amplitudeRatio = std::min(fit2Gaus->GetParameter(0),fit2Gaus->GetParameter(3))/std::max(fit2Gaus->GetParameter(0),fit2Gaus->GetParameter(3)); + + if(ashman > ashmanDistance_ and amplitudeRatio > amplitudeRatio_) + ana->badDoublePeakStrip_[apvID].push_back(stripBin); + } + + if(badStripFlag){ // save the final bit + + ana->badStrip_[apvID].push_back(stripBin); + ana->badStripBit_[apvID][stripBin] = 1; + + SiStripFecKey fec_key(ana->fecKey()); + LogTrace(mlDqmClient_)<<"BadStrip: fecCrate " + <<" "<badStripBit_[apvID][stripBin] = 0; + } + + + ped_max.clear(); + ped_min.clear(); + raw_max.clear(); + raw_min.clear(); + noise_max.clear(); + noise_min.clear(); + if(histoResidualStrip) delete histoResidualStrip; + if(fitFunc) delete fitFunc; + if(randomHisto) delete randomHisto; + if(fit2Gaus) delete fit2Gaus; + } diff --git a/DQM/SiStripCommissioningClients/data/summary.xml b/DQM/SiStripCommissioningClients/data/summary.xml index e5f8600cf70de..2640d069a1e4d 100644 --- a/DQM/SiStripCommissioningClients/data/summary.xml +++ b/DQM/SiStripCommissioningClients/data/summary.xml @@ -95,27 +95,52 @@ - + + + + + + + + + - - - - - - - - + + + + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -142,9 +167,6 @@ - - - @@ -152,9 +174,6 @@ - - - @@ -167,10 +186,6 @@ - - - - @@ -178,10 +193,6 @@ - - - - @@ -192,11 +203,6 @@ - - - - - diff --git a/DQM/SiStripCommissioningClients/src/PedsFullNoiseHistograms.cc b/DQM/SiStripCommissioningClients/src/PedsFullNoiseHistograms.cc index f2a94860983c6..ca33f18677613 100644 --- a/DQM/SiStripCommissioningClients/src/PedsFullNoiseHistograms.cc +++ b/DQM/SiStripCommissioningClients/src/PedsFullNoiseHistograms.cc @@ -21,6 +21,7 @@ PedsFullNoiseHistograms::PedsFullNoiseHistograms( const edm::ParameterSet& pset, bei, sistrip::PEDS_FULL_NOISE ) { + factory_ = auto_ptr( new PedsFullNoiseSummaryFactory ); LogTrace(mlDqmClient_) << "[PedsFullNoiseHistograms::" << __func__ << "]" @@ -38,6 +39,7 @@ PedsFullNoiseHistograms::~PedsFullNoiseHistograms() { // ----------------------------------------------------------------------------- /** */ void PedsFullNoiseHistograms::histoAnalysis( bool debug ) { + LogTrace(mlDqmClient_) << "[PedsFullNoiseHistograms::" << __func__ << "]"; @@ -52,11 +54,17 @@ void PedsFullNoiseHistograms::histoAnalysis( bool debug ) { if ( ianal->second ) { delete ianal->second; } } data().clear(); - + // Iterate through map containing histograms + long int total = histos().size(); + long int iChannel = 0; for ( iter = histos().begin(); iter != histos().end(); iter++ ) { - + + std::cout.flush(); + if(iChannel %10 == 0) std::cout<<"\r"<<"PedsFullNoiseHistograms::histoAnalysis: strip analyzed "<<100*double(iChannel)/(total)<<" % "; + iChannel++; + // Check vector of histos is not empty if ( iter->second.empty() ) { edm::LogWarning(mlDqmClient_) @@ -68,30 +76,31 @@ void PedsFullNoiseHistograms::histoAnalysis( bool debug ) { // Retrieve pointers to peds and noise histos std::vector hists; Histos::const_iterator ihis = iter->second.begin(); + for ( ; ihis != iter->second.end(); ihis++ ) { - // pedestal profiles + // pedestal and noise 1D profiles TProfile* prof = ExtractTObject().extract( (*ihis)->me_ ); - if ( prof ) { hists.push_back(prof); } - //@@ Common mode histos?... - //TH1F* his = ExtractTObject().extract( (*ihis)->me_ ); - //if ( his ) { profs.push_back(his); } - // noise 2D histos + if ( prof ) { hists.push_back(prof); + } + // 2D noise histograms TH2S * his2D = ExtractTObject().extract( (*ihis)->me_ ); - if ( his2D ) { hists.push_back(his2D); } + if ( his2D ) { + hists.push_back(his2D); } } // Perform histo analysis PedsFullNoiseAnalysis * anal = new PedsFullNoiseAnalysis( iter->first ); - PedsFullNoiseAlgorithm algo( this->pset(), anal ); + PedsFullNoiseAlgorithm algo( this->pset(), anal ); algo.analysis( hists ); + data()[iter->first] = anal; - if ( anal->isValid() ) { valid++; } - if ( !anal->getErrorCodes().empty() ) { + if (anal->isValid() ) { valid++; } + if (!anal->getErrorCodes().empty() ) { errors[anal->getErrorCodes()[0]]++; - } + } } - + if ( !histos().empty() ) { edm::LogVerbatim(mlDqmClient_) << "[PedsFullNoiseHistograms::" << __func__ << "]" @@ -118,10 +127,10 @@ void PedsFullNoiseHistograms::histoAnalysis( bool debug ) { edm::LogWarning(mlDqmClient_) << "[PedsFullNoiseHistograms::" << __func__ << "]" << " No histograms to analyze!"; - } - + } + } - + // ----------------------------------------------------------------------------- /** */ void PedsFullNoiseHistograms::printAnalyses() { diff --git a/DQM/SiStripCommissioningClients/src/SiStripCommissioningOfflineClient.cc b/DQM/SiStripCommissioningClients/src/SiStripCommissioningOfflineClient.cc index b9736210b719e..12fc888f0f99d 100644 --- a/DQM/SiStripCommissioningClients/src/SiStripCommissioningOfflineClient.cc +++ b/DQM/SiStripCommissioningClients/src/SiStripCommissioningOfflineClient.cc @@ -10,6 +10,7 @@ #include "DQM/SiStripCommissioningClients/interface/VpspScanHistograms.h" #include "DQM/SiStripCommissioningClients/interface/PedestalsHistograms.h" #include "DQM/SiStripCommissioningClients/interface/PedsOnlyHistograms.h" +#include "DQM/SiStripCommissioningClients/interface/PedsFullNoiseHistograms.h" #include "DQM/SiStripCommissioningClients/interface/NoiseHistograms.h" #include "DQM/SiStripCommissioningClients/interface/SamplingHistograms.h" #include "DQM/SiStripCommissioningClients/interface/CalibrationHistograms.h" @@ -401,6 +402,7 @@ void SiStripCommissioningOfflineClient::createHistos( const edm::ParameterSet& p else if ( runType_ == sistrip::OPTO_SCAN ) { histos_ = new OptoScanHistograms( pset, bei_ ); } else if ( runType_ == sistrip::VPSP_SCAN ) { histos_ = new VpspScanHistograms( pset, bei_ ); } else if ( runType_ == sistrip::PEDESTALS ) { histos_ = new PedestalsHistograms( pset, bei_ ); } + else if ( runType_ == sistrip::PEDS_FULL_NOISE ) { histos_ = new PedsFullNoiseHistograms( pset, bei_ ); } else if ( runType_ == sistrip::PEDS_ONLY ) { histos_ = new PedsOnlyHistograms( pset, bei_ ); } else if ( runType_ == sistrip::NOISE ) { histos_ = new NoiseHistograms( pset, bei_ ); } else if ( runType_ == sistrip::APV_LATENCY || diff --git a/DQM/SiStripCommissioningDbClients/interface/PedsFullNoiseHistosUsingDb.h b/DQM/SiStripCommissioningDbClients/interface/PedsFullNoiseHistosUsingDb.h index 5628cb23ab3d5..8d139fe23194b 100644 --- a/DQM/SiStripCommissioningDbClients/interface/PedsFullNoiseHistosUsingDb.h +++ b/DQM/SiStripCommissioningDbClients/interface/PedsFullNoiseHistosUsingDb.h @@ -15,7 +15,7 @@ class PedsFullNoiseHistosUsingDb : public CommissioningHistosUsingDb, public Ped ~PedsFullNoiseHistosUsingDb() override; - void uploadConfigurations() override; + virtual void uploadConfigurations() override; private: @@ -24,15 +24,18 @@ class PedsFullNoiseHistosUsingDb : public CommissioningHistosUsingDb, public Ped void create( SiStripConfigDb::AnalysisDescriptionsV&, Analysis ) override; // parameters - float highThreshold_; - float lowThreshold_; - bool disableBadStrips_; - bool keepStripsDisabled_; - bool addBadStrips_; + float highThreshold_; // higher threshold for the zero suppression + float lowThreshold_; // lower threshold for the zero suppression + bool disableBadStrips_; // to disable bad strips flagged by the analysis in the upload + bool keepStripsDisabled_; // keep bad strips from previous runs as bad + bool skipEmptyStrips_; // skip empty strips i.e. don't flag as bad + bool uploadOnlyStripBadChannelBit_; // Perform a selective upload either for or excluding a certain set of FEDs bool allowSelectiveUpload_; + /////// + bool uploadPedsFullNoiseDBTable_; }; #endif // DQM_SiStripCommissioningClients_PedsFullNoiseHistosUsingDb_H diff --git a/DQM/SiStripCommissioningDbClients/src/PedsFullNoiseHistosUsingDb.cc b/DQM/SiStripCommissioningDbClients/src/PedsFullNoiseHistosUsingDb.cc index 254c54170cdaa..468f3909b77c3 100644 --- a/DQM/SiStripCommissioningDbClients/src/PedsFullNoiseHistosUsingDb.cc +++ b/DQM/SiStripCommissioningDbClients/src/PedsFullNoiseHistosUsingDb.cc @@ -14,35 +14,40 @@ using namespace sistrip; PedsFullNoiseHistosUsingDb::PedsFullNoiseHistosUsingDb( const edm::ParameterSet & pset, DQMStore* bei, SiStripConfigDb* const db ) - : CommissioningHistograms( pset.getParameter("PedsFullNoiseParameters"), - bei, - sistrip::PEDS_FULL_NOISE ), - CommissioningHistosUsingDb( db, - sistrip::PEDS_FULL_NOISE ), - PedsFullNoiseHistograms( pset.getParameter("PedsFullNoiseParameters"), - bei ) + : CommissioningHistograms(pset.getParameter("PedsFullNoiseParameters"),bei,sistrip::PEDS_FULL_NOISE ), + CommissioningHistosUsingDb(db,sistrip::PEDS_FULL_NOISE ), + PedsFullNoiseHistograms( pset.getParameter("PedsFullNoiseParameters"),bei ) { - LogTrace(mlDqmClient_) + + LogTrace(mlDqmClient_) << "[PedsFullNoiseHistosUsingDb::" << __func__ << "]" << " Constructing object..."; + highThreshold_ = this->pset().getParameter("HighThreshold"); - lowThreshold_ = this->pset().getParameter("LowThreshold"); + lowThreshold_ = this->pset().getParameter("LowThreshold"); + LogTrace(mlDqmClient_) << "[PedsFullNoiseHistosUsingDb::" << __func__ << "]" << " Set FED zero suppression high/low threshold to " << highThreshold_ << "/" << lowThreshold_; - disableBadStrips_ = this->pset().getParameter("DisableBadStrips"); + + disableBadStrips_ = this->pset().getParameter("DisableBadStrips"); keepStripsDisabled_ = this->pset().getParameter("KeepStripsDisabled"); - addBadStrips_ = this->pset().getParameter("AddBadStrips"); + skipEmptyStrips_ = this->pset().getParameter("SkipEmptyStrips"); + uploadOnlyStripBadChannelBit_ = this->pset().getParameter("UploadOnlyStripBadChannelBit"); + uploadPedsFullNoiseDBTable_ = this->pset().getParameter("UploadPedsFullNoiseDBTable"); + LogTrace(mlDqmClient_) << "[PedestalsHistosUsingDb::" << __func__ << "]" << " Disabling strips: " << disableBadStrips_ - << " ; keeping previously disabled strips: " << keepStripsDisabled_; + << " ; keeping previously disabled strips: " << keepStripsDisabled_ + << " ; skip strips with no data: " << skipEmptyStrips_ + << " ; upload only bad channel bit: " << uploadOnlyStripBadChannelBit_; + allowSelectiveUpload_ = this->pset().existsAs("doSelectiveUpload")?this->pset().getParameter("doSelectiveUpload"):false; LogTrace(mlDqmClient_) << "[PedestalsHistosUsingDb::" << __func__ << "]" - << " Selective upload of modules set to : " << allowSelectiveUpload_; - + << " Selective upload of modules set to : " << allowSelectiveUpload_; } // ----------------------------------------------------------------------------- @@ -56,6 +61,7 @@ PedsFullNoiseHistosUsingDb::~PedsFullNoiseHistosUsingDb() { // ----------------------------------------------------------------------------- /** */ void PedsFullNoiseHistosUsingDb::uploadConfigurations() { + LogTrace(mlDqmClient_) << "[PedsFullNoiseHistosUsingDb::" << __func__ << "]"; @@ -70,21 +76,24 @@ void PedsFullNoiseHistosUsingDb::uploadConfigurations() { // Update FED descriptions with new peds/noise values SiStripConfigDb::FedDescriptionsRange feds = db()->getFedDescriptions(); update( feds ); - if ( doUploadConf() ) { + if (doUploadConf()) { // check whether the upload HD config is set to true + edm::LogVerbatim(mlDqmClient_) << "[PedsFullNoiseHistosUsingDb::" << __func__ << "]" << " Uploading pedestals/noise to DB..."; - db()->uploadFedDescriptions(); + + db()->uploadFedDescriptions(); // change the FED version + edm::LogVerbatim(mlDqmClient_) << "[PedsFullNoiseHistosUsingDb::" << __func__ << "]" << " Completed database upload of " << feds.size() << " FED descriptions!"; - } else { + } + else { edm::LogWarning(mlDqmClient_) << "[PedsFullNoiseHistosUsingDb::" << __func__ << "]" << " TEST! No pedestals/noise values will be uploaded to DB..."; - } - + } } // ----------------------------------------------------------------------------- @@ -93,23 +102,27 @@ void PedsFullNoiseHistosUsingDb::update( SiStripConfigDb::FedDescriptionsRange f // Iterate through feds and update fed descriptions uint16_t updated = 0; + long int nstrips = 0; SiStripConfigDb::FedDescriptionsV::const_iterator ifed; - for ( ifed = feds.begin(); ifed != feds.end(); ifed++ ) { - - for ( uint16_t ichan = 0; ichan < sistrip::FEDCH_PER_FED; ichan++ ) { - // Build FED and FEC keys + for ( ifed = feds.begin(); ifed != feds.end(); ifed++ ) { // Loop on the FED for this partition + + for ( uint16_t ichan = 0; ichan < sistrip::FEDCH_PER_FED; ichan++ ) { + // Build FED and FEC keys from the cabling object i.e. checking if there is a connection const FedChannelConnection& conn = cabling()->fedConnection( (*ifed)->getFedId(), ichan ); - if ( conn.fecCrate()== sistrip::invalid_ || - conn.fecSlot() == sistrip::invalid_ || - conn.fecRing() == sistrip::invalid_ || - conn.ccuAddr() == sistrip::invalid_ || - conn.ccuChan() == sistrip::invalid_ || - conn.lldChannel() == sistrip::invalid_ ) { continue; } - + if ( conn.fecCrate() == sistrip::invalid_ || + conn.fecSlot() == sistrip::invalid_ || + conn.fecRing() == sistrip::invalid_ || + conn.ccuAddr() == sistrip::invalid_ || + conn.ccuChan() == sistrip::invalid_ || + conn.lldChannel() == sistrip::invalid_ ) + continue; + + // build the FED and FEC key from the connection object SiStripFedKey fed_key( conn.fedId(), SiStripFedKey::feUnit( conn.fedCh() ), SiStripFedKey::feChan( conn.fedCh() ) ); + SiStripFecKey fec_key( conn.fecCrate(), conn.fecSlot(), conn.fecRing(), @@ -117,11 +130,12 @@ void PedsFullNoiseHistosUsingDb::update( SiStripConfigDb::FedDescriptionsRange f conn.ccuChan(), conn.lldChannel() ); - // Locate appropriate analysis object + // Locate appropriate analysis object --> based on FEC keys cause they are per lldChannel Analyses::const_iterator iter = data(allowSelectiveUpload_).find( fec_key.key() ); if ( iter != data(allowSelectiveUpload_).end() ) { - + PedsFullNoiseAnalysis* anal = dynamic_cast( iter->second ); + if ( !anal ) { edm::LogError(mlDqmClient_) << "[PedsFullNoiseHistosUsingDb::" << __func__ << "]" @@ -129,7 +143,7 @@ void PedsFullNoiseHistosUsingDb::update( SiStripConfigDb::FedDescriptionsRange f continue; } - // Determine the pedestal shift to apply + // Determine the pedestal shift to apply --> this is standard in the pedestal paylaod to avoid loss of signal from common-mode subtraction uint32_t pedshift = 127; for ( uint16_t iapv = 0; iapv < sistrip::APVS_PER_FEDCH; iapv++ ) { uint32_t pedmin = (uint32_t) anal->pedsMin()[iapv]; @@ -138,81 +152,84 @@ void PedsFullNoiseHistosUsingDb::update( SiStripConfigDb::FedDescriptionsRange f // Iterate through APVs and strips for ( uint16_t iapv = 0; iapv < sistrip::APVS_PER_FEDCH; iapv++ ) { - for ( uint16_t istr = 0; istr < anal->peds()[iapv].size(); istr++ ) { + for ( uint16_t istr = 0; istr < anal->peds()[iapv].size(); istr++ ) { // Loop on the pedestal for each APV + nstrips++; // get the information on the strip as it was on the db Fed9U::Fed9UAddress addr( ichan, iapv, istr ); Fed9U::Fed9UStripDescription temp = (*ifed)->getFedStrips().getStrip( addr ); - if(temp.getDisable()) { - std::cout<<"Already Disabled: "<fedKey()); - if(!disableStrip){ - PedsFullNoiseAnalysis::VInt dead = anal->dead()[iapv]; - if ( find( dead.begin(), dead.end(), istr ) != dead.end() ) { - disableStrip = true; - std::cout<<"Disabling Dead: "<noisy()[iapv]; - if ( find( noisy.begin(), noisy.end(), istr ) != noisy.end() ) { - disableStrip = true; - std::cout<<"Disabling Noisy: "<dead()[iapv]; - if ( find( dead.begin(), dead.end(), istr ) != dead.end() ) { - disableStrip = true; - std::cout<<"Disabling Dead: "<noisy()[iapv]; - if ( find( noisy.begin(), noisy.end(), istr ) != noisy.end() ) { - disableStrip = true; - std::cout<<"Disabling Noisy: "<( anal->peds()[iapv][istr]-pedshift ), - highThreshold_, - lowThreshold_, - anal->noise()[iapv][istr], - disableStrip ); + // to disable new strips + if(disableBadStrips_){ + SiStripFedKey fed_key(anal->fedKey()); + PedsFullNoiseAnalysis::VInt dead = anal->deadStrip()[iapv]; + if (not skipEmptyStrips_ and // if one don't want to skip dead strips + find( dead.begin(), dead.end(), istr ) != dead.end() ) { + disableStrip = true; + ss_disable<<"Disabling Dead Strip: "<badStrip()[iapv]; // new feature --> this is the sample of the whole bad strips from the analysis + if(not disableStrip){ + if ( find( badcChan.begin(), badcChan.end(), istr ) != badcChan.end() ) { + disableStrip = true; + ss_disable<<"Disabling Bad strip: "<(anal->peds()[iapv][istr]-pedshift); + noiseVal = static_cast(anal->noise()[iapv][istr]); + lowThr = lowThreshold_; + highThr = highThreshold_; + } + + ////// + Fed9U::Fed9UStripDescription data(pedestalVal,highThr,lowThr,noiseVal,disableStrip); std::stringstream ss; if ( data.getDisable() && edm::isDebugEnabled() ) { @@ -236,7 +253,9 @@ void PedsFullNoiseHistosUsingDb::update( SiStripConfigDb::FedDescriptionsRange f << static_cast( temp.getNoise() ) << "/" << static_cast( temp.getDisable() ) << std::endl; } + (*ifed)->getFedStrips().setStrip( addr, data ); + if ( data.getDisable() && edm::isDebugEnabled() ) { ss << " to ped/noise/high/low/disable : " << static_cast( data.getPedestal() ) << "/" @@ -245,13 +264,12 @@ void PedsFullNoiseHistosUsingDb::update( SiStripConfigDb::FedDescriptionsRange f << static_cast( data.getNoise() ) << "/" << static_cast( data.getDisable() ) << std::endl; LogTrace(mlDqmClient_) << ss.str(); - } - + } } // end loop on strips } // end loop on apvs updated++; - - } else { + } + else { // device not found in the analysis if ( deviceIsPresent(fec_key) ) { edm::LogWarning(mlDqmClient_) << "[PedsFullNoiseHistosUsingDb::" << __func__ << "]" @@ -275,6 +293,7 @@ void PedsFullNoiseHistosUsingDb::update( SiStripConfigDb::FedDescriptionsRange f << "[PedsFullNoiseHistosUsingDb::" << __func__ << "]" << " Updated FED pedestals/noise for " << updated << " channels"; + } // ----------------------------------------------------------------------------- @@ -283,57 +302,112 @@ void PedsFullNoiseHistosUsingDb::create( SiStripConfigDb::AnalysisDescriptionsV& Analysis analysis ) { PedsFullNoiseAnalysis* anal = dynamic_cast( analysis->second ); + if ( !anal ) { return; } SiStripFecKey fec_key( anal->fecKey() ); SiStripFedKey fed_key( anal->fedKey() ); for ( uint16_t iapv = 0; iapv < 2; ++iapv ) { - - // Create description - PedestalsAnalysisDescription* tmp; - tmp = new PedestalsAnalysisDescription( - anal->dead()[iapv], - anal->noisy()[iapv], - anal->pedsMean()[iapv], - anal->pedsSpread()[iapv], - anal->noiseMean()[iapv], - anal->noiseSpread()[iapv], - anal->rawMean()[iapv], - anal->rawSpread()[iapv], - anal->pedsMax()[iapv], - anal->pedsMin()[iapv], - anal->noiseMax()[iapv], - anal->noiseMin()[iapv], - anal->rawMax()[iapv], - anal->rawMin()[iapv], - fec_key.fecCrate(), - fec_key.fecSlot(), - fec_key.fecRing(), - fec_key.ccuAddr(), - fec_key.ccuChan(), - SiStripFecKey::i2cAddr( fec_key.lldChan(), !iapv ), - db()->dbParams().partitions().begin()->second.partitionName(), - db()->dbParams().partitions().begin()->second.runNumber(), - anal->isValid(), - "", - fed_key.fedId(), - fed_key.feUnit(), - fed_key.feChan(), - fed_key.fedApv() - ); - - // Add comments + + // Create a description for the standard pedestal analysis + PedestalsAnalysisDescription* pedestalDescription; + pedestalDescription = new PedestalsAnalysisDescription( + anal->deadStripBit()[iapv], + anal->badStripBit()[iapv], + anal->pedsMean()[iapv], + anal->pedsSpread()[iapv], + anal->noiseMean()[iapv], + anal->noiseSpread()[iapv], + anal->rawMean()[iapv], + anal->rawSpread()[iapv], + anal->pedsMax()[iapv], + anal->pedsMin()[iapv], + anal->noiseMax()[iapv], + anal->noiseMin()[iapv], + anal->rawMax()[iapv], + anal->rawMin()[iapv], + fec_key.fecCrate(), + fec_key.fecSlot(), + fec_key.fecRing(), + fec_key.ccuAddr(), + fec_key.ccuChan(), + SiStripFecKey::i2cAddr( fec_key.lldChan(), !iapv ), + db()->dbParams().partitions().begin()->second.partitionName(), + db()->dbParams().partitions().begin()->second.runNumber(), + anal->isValid(), + "", + fed_key.fedId(), + fed_key.feUnit(), + fed_key.feChan(), + fed_key.fedApv() + ); + + // Add comments typedef std::vector Strings; Strings errors = anal->getErrorCodes(); Strings::const_iterator istr = errors.begin(); Strings::const_iterator jstr = errors.end(); - for ( ; istr != jstr; ++istr ) { tmp->addComments( *istr ); } + for ( ; istr != jstr; ++istr ) {pedestalDescription->addComments( *istr ); } + + // Store description + desc.push_back(pedestalDescription); - // Store description - desc.push_back( tmp ); + // Create description + if(uploadPedsFullNoiseDBTable_){ + PedsFullNoiseAnalysisDescription* pedsFullNoiseDescription; + pedsFullNoiseDescription = new PedsFullNoiseAnalysisDescription( + anal->deadStrip()[iapv], + anal->badStrip()[iapv], + anal->shiftedStrip()[iapv], // bad strip-id within an APV due to offset + anal->lowNoiseStrip()[iapv], // bad strip-id within an APV due to noise + anal->largeNoiseStrip()[iapv], // bad strip-id within an APV due to noise + anal->largeNoiseSignificance()[iapv], // bad strip-id within an APV due to noise significance + anal->badFitStatus()[iapv], // bad strip-id within an APV due to fit status + anal->badADProbab()[iapv], // bad strip-id within an APV due to AD probab + anal->badKSProbab()[iapv], // bad strip-id within an APV due to KS probab + anal->badJBProbab()[iapv], // bad strip-id within an APV due to JB probab + anal->badChi2Probab()[iapv], // bad strip-id within an APV due to Chi2 probab + anal->badTailStrip()[iapv], // bad strip-id within an APV due to tail + anal->badDoublePeakStrip()[iapv], // bad strip-id within an APV due to Double peaks + ////// + anal->adProbab()[iapv], // one value oer strip + anal->ksProbab()[iapv], // one value oer strip + anal->jbProbab()[iapv], // one value oer strip + anal->chi2Probab()[iapv], // one value oer strip + //// --> Per strip quantities + anal->residualRMS()[iapv], + anal->residualSigmaGaus()[iapv], + anal->noiseSignificance()[iapv], + anal->residualSkewness()[iapv], + anal->residualKurtosis()[iapv], + anal->residualIntegralNsigma()[iapv], + anal->residualIntegral()[iapv], + //// + fec_key.fecCrate(), + fec_key.fecSlot(), + fec_key.fecRing(), + fec_key.ccuAddr(), + fec_key.ccuChan(), + SiStripFecKey::i2cAddr( fec_key.lldChan(), !iapv ), + db()->dbParams().partitions().begin()->second.partitionName(), + db()->dbParams().partitions().begin()->second.runNumber(), + anal->isValid(), + "", + fed_key.fedId(), + fed_key.feUnit(), + fed_key.feChan(), + fed_key.fedApv() + ); + istr = errors.begin(); + jstr = errors.end(); + for ( ; istr != jstr; ++istr ) { + pedsFullNoiseDescription->addComments( *istr ); + } + // Store description + desc.push_back(pedsFullNoiseDescription); + } } - } diff --git a/DQM/SiStripCommissioningDbClients/test/analysis_test_cfg.py b/DQM/SiStripCommissioningDbClients/test/analysis_test_cfg.py new file mode 100644 index 0000000000000..2b172a7724fec --- /dev/null +++ b/DQM/SiStripCommissioningDbClients/test/analysis_test_cfg.py @@ -0,0 +1,38 @@ +import FWCore.ParameterSet.Config as cms +process = cms.Process("SiStripCommissioningOfflineDbClient") +process.load("DQM.SiStripCommon.MessageLogger_cfi") +process.load("DQM.SiStripCommon.DaqMonitorROOTBackEnd_cfi") + +process.load("OnlineDB.SiStripConfigDb.SiStripConfigDb_cfi") +process.SiStripConfigDb.UsingDb = True ### cause we don't have access to the db +process.SiStripConfigDb.ConfDb = 'overwritten/by@confdb' +process.SiStripConfigDb.Partitions.PrimaryPartition.PartitionName = 'CR_14-JUL-2017_1' +process.SiStripConfigDb.Partitions.PrimaryPartition.RunNumber = 299055 +process.SiStripConfigDb.TNS_ADMIN = '/home/xdaqtk/' + +process.source = cms.Source("EmptySource") +process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(2) ) + +process.load("DQM.SiStripCommissioningDbClients.OfflineDbClient_cff") +process.db_client.FilePath = cms.untracked.string('./') +process.db_client.RunNumber = cms.untracked.uint32(299055) +process.db_client.UseClientFile = cms.untracked.bool(False) +process.db_client.DisableDevices = cms.untracked.bool(False) +process.db_client.UploadHwConfig = cms.untracked.bool(False) +process.db_client.UploadAnalyses = cms.untracked.bool(False) +process.db_client.SaveClientFile = cms.untracked.bool(True) +### Bad strip analysis options +process.db_client.PedsFullNoiseParameters.DisableBadStrips = cms.bool(True) +process.db_client.PedsFullNoiseParameters.KeepStripsDisabled = cms.bool(False) +process.db_client.PedsFullNoiseParameters.UploadOnlyStripBadChannelBit = cms.bool(False) +process.db_client.PedsFullNoiseParameters.SkipEmptyStrips = cms.bool(True) +process.db_client.PedsFullNoiseParameters.UploadPedsFullNoiseDBTable = cms.bool(False) + +process.db_client.OutputRootFile = cms.untracked.string("SiStripCommissioningClient_CRACK") + +process.p = cms.Path(process.db_client) + + +processDumpFile = open('processDump.py', 'w') +print >> processDumpFile, process.dumpPython() + diff --git a/DQM/SiStripCommissioningDbClients/test/source_test_cfg.py b/DQM/SiStripCommissioningDbClients/test/source_test_cfg.py new file mode 100644 index 0000000000000..acc6977b4a5e4 --- /dev/null +++ b/DQM/SiStripCommissioningDbClients/test/source_test_cfg.py @@ -0,0 +1,41 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("Source") + +process.load("DQM.SiStripCommon.MessageLogger_cfi") + +process.load("DQM.SiStripCommon.DaqMonitorROOTBackEnd_cfi") + +process.load("OnlineDB.SiStripConfigDb.SiStripConfigDb_cfi") +process.SiStripConfigDb.UsingDb = True # should be true! +process.SiStripConfigDb.ConfDb = 'user/password@account' # taken from $CONFDB +process.SiStripConfigDb.Partitions.PrimaryPartition.PartitionName = 'CR_14-JUL-2017_1' +process.SiStripConfigDb.Partitions.PrimaryPartition.RunNumber = 299055 + +process.SiStripCondObjBuilderFromDb = cms.Service("SiStripCondObjBuilderFromDb") +process.FedCablingFromConfigDb = cms.ESSource("SiStripFedCablingBuilderFromDb", + CablingSource = cms.untracked.string('UNDEFINED') ## <-- this should be replaced by "DEVICES" for a connection run! +) +process.SiStripDetInfoFileReader = cms.Service("SiStripDetInfoFileReader") +process.PedestalsFromConfigDb = cms.ESSource("SiStripPedestalsBuilderFromDb") +process.NoiseFromConfigDb = cms.ESSource("SiStripNoiseBuilderFromDb") +# produce SiStripFecCabling and SiStripDetCabling out of SiStripFedCabling +process.sistripconn = cms.ESProducer("SiStripConnectivity") + +process.source = cms.Source("NewEventStreamFileReader", + fileNames = cms.untracked.vstring() +) +process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) ) + +process.load("EventFilter.SiStripRawToDigi.FedChannelDigis_cfi") +process.FedChannelDigis.UnpackBadChannels = cms.bool(False) + +process.load("DQM.SiStripCommissioningSources.CommissioningHistos_cfi") +process.CommissioningHistos.CommissioningTask = 'PEDS_FULL_NOISE' # <-- run type taken from event data, but can be overriden +process.CommissioningHistos.PedsFullNoiseParameters.NrEvToSkipAtStart = 100 +process.CommissioningHistos.PedsFullNoiseParameters.NrEvForPeds = 1000 +process.CommissioningHistos.PedsFullNoiseParameters.FillNoiseProfile = True + +process.p = cms.Path(process.FedChannelDigis*process.CommissioningHistos) + +process.source.fileNames.extend(cms.untracked.vstring('file:/exports/Data/closed/USC.00299055.0001.A.storageManager.00.0000.dat')) diff --git a/DQM/SiStripCommissioningSummary/src/PedsFullNoiseSummaryFactory.cc b/DQM/SiStripCommissioningSummary/src/PedsFullNoiseSummaryFactory.cc index 390114cc1f7ca..53b581b080f4e 100644 --- a/DQM/SiStripCommissioningSummary/src/PedsFullNoiseSummaryFactory.cc +++ b/DQM/SiStripCommissioningSummary/src/PedsFullNoiseSummaryFactory.cc @@ -10,58 +10,99 @@ using namespace sistrip; // ----------------------------------------------------------------------------- // void PedsFullNoiseSummaryFactory::extract( Iterator iter ) { - + PedsFullNoiseAnalysis* anal = dynamic_cast( iter->second ); if ( !anal ) { return; } - - std::vector< float > temp(128, 1. * sistrip::invalid_ ); - std::vector< std::vector > value( 2, temp ); - std::vector< std::vector > peds( 2, temp ); - std::vector< std::vector > noise( 2, temp ); - std::vector< std::vector > ks( 2, temp ); - std::vector< std::vector > noiseG( 2, temp ); - std::vector< std::vector > bin84( 2, temp ); - std::vector< std::vector > chi2( 2, temp ); - std::vector< std::vector > signif( 2, temp ); - std::vector< std::vector > rms( 2, temp ); + + std::vector< float > temp(128, 1. * sistrip::invalid_ ); + std::vector< uint16_t > temp2(128, sistrip::invalid_); + + std::vector< std::vector > value (2, temp); + std::vector< std::vector > peds (2, temp); + std::vector< std::vector > noise(2, temp); + std::vector< std::vector > adProbab(2, temp); + std::vector< std::vector > ksProbab(2, temp); + std::vector< std::vector > jbProbab(2, temp); + std::vector< std::vector > chi2Probab(2, temp); + std::vector< std::vector > residualRMS(2, temp); + std::vector< std::vector > residualGaus(2, temp); + std::vector< std::vector > noiseSignificance(2, temp); + std::vector< std::vector > residualMean(2, temp); + std::vector< std::vector > residualSkewness(2, temp); + std::vector< std::vector > residualKurtosis(2, temp); + std::vector< std::vector > residualIntegralNsigma(2, temp); + std::vector< std::vector > residualIntegral(2, temp); + std::vector< std::vector > badStripBit(2, temp2); + std::vector< std::vector > deadStripBit(2, temp2); + + // pedestal values peds[0] = anal->peds()[0]; peds[1] = anal->peds()[1]; + // noise values noise[0] = anal->noise()[0]; noise[1] = anal->noise()[1]; - ks[0] = anal->ksProb()[0]; // dummy values //replaced with ksProb now, wing - ks[1] = anal->ksProb()[1]; // dummy values - noiseG[0] = anal->noiseGaus()[0]; - noiseG[1] = anal->noiseGaus()[1]; - bin84[0] = anal->noiseBin84()[0]; - bin84[1] = anal->noiseBin84()[1]; - rms[0] = anal->noiseRMS()[0]; - rms[1] = anal->noiseRMS()[1]; - chi2[0] = anal->chi2Prob()[0]; - chi2[1] = anal->chi2Prob()[1]; - signif[0] = anal->noiseSignif()[0]; - signif[1] = anal->noiseSignif()[1]; + // AD probab + adProbab[0] = anal->adProbab()[0]; + adProbab[1] = anal->adProbab()[1]; + // KS probab + ksProbab[0] = anal->ksProbab()[0]; + ksProbab[1] = anal->ksProbab()[1]; + // JB probab + jbProbab[0] = anal->jbProbab()[0]; + jbProbab[1] = anal->jbProbab()[1]; + // CHI2 probab + chi2Probab[0] = anal->chi2Probab()[0]; + chi2Probab[1] = anal->chi2Probab()[1]; + // noise RMS + chi2Probab[0] = anal->chi2Probab()[0]; + chi2Probab[1] = anal->chi2Probab()[1]; + // residual RMS + residualRMS[0] = anal->residualRMS()[0]; + residualRMS[1] = anal->residualRMS()[1]; + // residual Sigma + residualGaus[0] = anal->residualSigmaGaus()[0]; + residualGaus[1] = anal->residualSigmaGaus()[1]; + // noise Significance + noiseSignificance[0] = anal->noiseSignificance()[0]; + noiseSignificance[1] = anal->noiseSignificance()[1]; + // residual mean + residualMean[0] = anal->residualMean()[0]; + residualMean[1] = anal->residualMean()[1]; + // noise Skweness + residualSkewness[0] = anal->residualSkewness()[0]; + residualSkewness[1] = anal->residualSkewness()[1]; + // noise Kurtosis + residualKurtosis[0] = anal->residualKurtosis()[0]; + residualKurtosis[1] = anal->residualKurtosis()[1]; + // noise integral N sigma + residualIntegralNsigma[0] = anal->residualIntegralNsigma()[0]; + residualIntegralNsigma[1] = anal->residualIntegralNsigma()[1]; + // noise integral N sigma + residualIntegral[0] = anal->residualIntegral()[0]; + residualIntegral[1] = anal->residualIntegral()[1]; + // bit to indicate if a strip is flagged as bad or not + residualIntegral[0] = anal->residualIntegral()[0]; + residualIntegral[1] = anal->residualIntegral()[1]; + // bit to indicate if a strip is bad (1) or not (0) + badStripBit[0] = anal->badStripBit()[0]; + badStripBit[1] = anal->badStripBit()[1]; + // bit to indicate if a strip is dead (1) or not (0) + deadStripBit[0] = anal->deadStripBit()[0]; + deadStripBit[1] = anal->deadStripBit()[1]; + bool all_strips = false; - if ( mon_ == sistrip::PEDESTALS_ALL_STRIPS ) { + // Monitor pedestals value for each strip + if (mon_ == sistrip::PEDESTALS_ALL_STRIPS ) { all_strips = true; uint16_t bins = peds[0].size(); - if ( peds[0].size() < peds[1].size() ) { bins = peds[1].size(); } - for ( uint16_t iped = 0; iped < bins; iped++ ) { + if (peds[0].size() < peds[1].size() ) { bins = peds[1].size(); } + for( uint16_t iped = 0; iped < bins; iped++ ) { value[0][iped] = peds[0][iped]; value[1][iped] = peds[1][iped]; } - } else if ( mon_ == sistrip::PEDESTALS_MEAN ) { - value[0][0] = anal->pedsMean()[0]; - value[1][0] = anal->pedsMean()[1]; - } else if ( mon_ == sistrip::PEDESTALS_SPREAD ) { - value[0][0] = anal->pedsSpread()[0]; - value[1][0] = anal->pedsSpread()[1]; - } else if ( mon_ == sistrip::PEDESTALS_MAX ) { - value[0][0] = anal->pedsMax()[0]; - value[1][0] = anal->pedsMax()[1]; - } else if ( mon_ == sistrip::PEDESTALS_MIN ) { - value[0][0] = anal->pedsMin()[0]; - value[1][0] = anal->pedsMin()[1]; - } else if ( mon_ == sistrip::NOISE_ALL_STRIPS ) { + } + // Monitor noise value for each strip + else if ( mon_ == sistrip::NOISE_ALL_STRIPS ) { all_strips = true; uint16_t bins = noise[0].size(); if ( noise[0].size() < noise[1].size() ) { bins = noise[1].size(); } @@ -69,82 +110,257 @@ void PedsFullNoiseSummaryFactory::extract( Iterator iter ) { value[0][inoise] = noise[0][inoise]; value[1][inoise] = noise[1][inoise]; } - } else if ( mon_ == sistrip::NOISE_KS_ALL_STRIPS ) { + } + // Monitor pedestals aD probability for each strip + else if ( mon_ == sistrip::AD_PROBAB_ALL_STRIPS ) { all_strips = true; - uint16_t bins = ks[0].size(); - if ( ks[0].size() < ks[1].size() ) { bins = ks[1].size(); } + uint16_t bins = adProbab[0].size(); + if ( adProbab[0].size() < adProbab[1].size() ) { bins = adProbab[1].size(); } + for ( uint16_t iad = 0; iad < bins; iad++ ) { + value[0][iad] = adProbab[0][iad]; + value[1][iad] = adProbab[1][iad]; + } + } + // Monitor pedestals KS probability for each strip + else if ( mon_ == sistrip::KS_PROBAB_ALL_STRIPS ) { + all_strips = true; + uint16_t bins = ksProbab[0].size(); + if ( ksProbab[0].size() < ksProbab[1].size() ) { bins = ksProbab[1].size(); } for ( uint16_t iks = 0; iks < bins; iks++ ) { - value[0][iks] = ks[0][iks]; - value[1][iks] = ks[1][iks]; + value[0][iks] = ksProbab[0][iks]; + value[1][iks] = ksProbab[1][iks]; } - } else if ( mon_ == sistrip::NOISE_CHI2_ALL_STRIPS ) { + } + // Monitor pedestals JB probability for each strip + else if ( mon_ == sistrip::JB_PROBAB_ALL_STRIPS ) { all_strips = true; - uint16_t bins = chi2[0].size(); - if ( ks[0].size() < chi2[1].size() ) { bins = chi2[1].size(); } + uint16_t bins = jbProbab[0].size(); + if ( jbProbab[0].size() < jbProbab[1].size() ) { bins = jbProbab[1].size(); } for ( uint16_t iks = 0; iks < bins; iks++ ) { - value[0][iks] = chi2[0][iks]; - value[1][iks] = chi2[1][iks]; + value[0][iks] = jbProbab[0][iks]; + value[1][iks] = jbProbab[1][iks]; } - } else if ( mon_ == sistrip::NOISE_GAUS_ALL_STRIPS ) { + } + // Monitor pedestals Chi2 probability for each strip + else if ( mon_ == sistrip::CHI2_PROBAB_ALL_STRIPS ) { all_strips = true; - uint16_t bins = noiseG[0].size(); - if ( noiseG[0].size() < noiseG[1].size() ) { bins = noiseG[1].size(); } + uint16_t bins = chi2Probab[0].size(); + if ( chi2Probab[0].size() < chi2Probab[1].size() ) { bins = chi2Probab[1].size(); } for ( uint16_t iks = 0; iks < bins; iks++ ) { - value[0][iks] = noiseG[0][iks]; - value[1][iks] = noiseG[1][iks]; - } - } else if ( mon_ == sistrip::NOISE_BIN_84_ALL_STRIPS ) { + value[0][iks] = chi2Probab[0][iks]; + value[1][iks] = chi2Probab[1][iks]; + } + } + // Monitor pedestals RMS residual for each strip + else if ( mon_ == sistrip::RESIDUAL_RMS_ALL_STRIPS) { all_strips = true; - uint16_t bins = bin84[0].size(); - if ( bin84[0].size() < bin84[1].size() ) { bins = bin84[1].size(); } + uint16_t bins = residualRMS[0].size(); + if ( residualRMS[0].size() < residualRMS[1].size() ) { bins = residualRMS[1].size(); } for ( uint16_t iks = 0; iks < bins; iks++ ) { - value[0][iks] = bin84[0][iks]; - value[1][iks] = bin84[1][iks]; - } - } else if ( mon_ == sistrip::NOISE_RMS_ALL_STRIPS ) { + value[0][iks] = residualRMS[0][iks]; + value[1][iks] = residualRMS[1][iks]; + } + } + // Monitor pedestals sigma from gaussian firt for each strip + else if ( mon_ == sistrip::RESIDUAL_GAUS_ALL_STRIPS) { + all_strips = true; + uint16_t bins = residualGaus[0].size(); + if ( residualGaus[0].size() < residualGaus[1].size() ) { bins = residualGaus[1].size(); } + for ( uint16_t iks = 0; iks < bins; iks++ ) { + value[0][iks] = residualGaus[0][iks]; + value[1][iks] = residualGaus[1][iks]; + } + } + // Monitor pedestals noise significance for each strip + else if ( mon_ == sistrip::NOISE_SIGNIFICANCE_ALL_STRIPS) { all_strips = true; - uint16_t bins = rms[0].size(); - if ( rms[0].size() < rms[1].size() ) { bins = rms[1].size(); } + uint16_t bins = noiseSignificance[0].size(); + if (noiseSignificance[0].size() < noiseSignificance[1].size() ) { bins = noiseSignificance[1].size(); } + for (uint16_t iks = 0; iks < bins; iks++ ) { + value[0][iks] = noiseSignificance[0][iks]; + value[1][iks] = noiseSignificance[1][iks]; + } + } + // Monitor mean residual for each strip + else if ( mon_ == sistrip::RESIDUAL_MEAN_ALL_STRIPS) { + all_strips = true; + uint16_t bins = residualMean[0].size(); + if ( residualMean[0].size() < residualMean[1].size() ) { bins = residualMean[1].size(); } for ( uint16_t iks = 0; iks < bins; iks++ ) { - value[0][iks] = rms[0][iks]; - value[1][iks] = rms[1][iks]; - } - } else if ( mon_ == sistrip::NOISE_SIGNIF_ALL_STRIPS ) { + value[0][iks] = residualMean[0][iks]; + value[1][iks] = residualMean[1][iks]; + } + } + // Monitor skweness for each strip + else if ( mon_ == sistrip::RESIDUAL_SKEWNESS_ALL_STRIPS) { all_strips = true; - uint16_t bins = signif[0].size(); - if ( signif[0].size() < signif[1].size() ) { bins = signif[1].size(); } + uint16_t bins = residualSkewness[0].size(); + if ( residualSkewness[0].size() < residualSkewness[1].size() ) { bins = residualSkewness[1].size(); } for ( uint16_t iks = 0; iks < bins; iks++ ) { - value[0][iks] = signif[0][iks]; - value[1][iks] = signif[1][iks]; - } - } else if ( mon_ == sistrip::NOISE_MEAN ) { + value[0][iks] = residualSkewness[0][iks]; + value[1][iks] = residualSkewness[1][iks]; + } + } + // Monitor Kurtosis for each strip + else if ( mon_ == sistrip::RESIDUAL_KURTOSIS_ALL_STRIPS) { + all_strips = true; + uint16_t bins = residualKurtosis[0].size(); + if ( residualKurtosis[0].size() < residualKurtosis[1].size() ) { bins = residualKurtosis[1].size(); } + for ( uint16_t iks = 0; iks < bins; iks++ ) { + value[0][iks] = residualKurtosis[0][iks]; + value[1][iks] = residualKurtosis[1][iks]; + } + } + // Monitor Integral above N sigma for each strip + else if ( mon_ == sistrip::RESIDUAL_INTEGRALNSIGMA_ALL_STRIPS) { + all_strips = true; + uint16_t bins = residualIntegralNsigma[0].size(); + if ( residualIntegralNsigma[0].size() < residualIntegralNsigma[1].size() ) { bins = residualIntegralNsigma[1].size(); } + for ( uint16_t iks = 0; iks < bins; iks++ ) { + value[0][iks] = residualIntegralNsigma[0][iks]; + value[1][iks] = residualIntegralNsigma[1][iks]; + } + } + // Monitor integral for each strip + else if ( mon_ == sistrip::RESIDUAL_INTEGRAL_ALL_STRIPS) { + all_strips = true; + uint16_t bins = residualIntegral[0].size(); + if ( residualIntegral[0].size() < residualIntegral[1].size() ) { bins = residualIntegral[1].size(); } + for ( uint16_t iks = 0; iks < bins; iks++ ) { + value[0][iks] = residualIntegral[0][iks]; + value[1][iks] = residualIntegral[1][iks]; + } + } + + // Monitor BadStrip bit + else if ( mon_ == sistrip::BAD_STRIP_BIT_ALL_STRIPS) { + all_strips = true; + uint16_t bins = badStripBit[0].size(); + if ( badStripBit[0].size() < badStripBit[1].size() ) { bins = badStripBit[1].size(); } + for ( uint16_t iks = 0; iks < bins; iks++ ) { + value[0][iks] = 1.*badStripBit[0][iks]; + value[1][iks] = 1.*badStripBit[1][iks]; + } + } + // Dead strip bit + else if ( mon_ == sistrip::DEAD_STRIP_BIT_ALL_STRIPS) { + all_strips = true; + uint16_t bins = deadStripBit[0].size(); + if ( deadStripBit[0].size() < deadStripBit[1].size() ) { bins = deadStripBit[1].size(); } + for ( uint16_t iks = 0; iks < bins; iks++ ) { + value[0][iks] = 1.*deadStripBit[0][iks]; + value[1][iks] = 1.*deadStripBit[1][iks]; + } + } + + // Per APV information: pedsMean + else if ( mon_ == sistrip::PEDESTALS_MEAN ) { + value[0][0] = anal->pedsMean()[0]; + value[1][0] = anal->pedsMean()[1]; + } + + // Per APV information: pedsSpread + else if ( mon_ == sistrip::PEDESTALS_SPREAD ) { + value[0][0] = anal->pedsSpread()[0]; + value[1][0] = anal->pedsSpread()[1]; + } + + // Per APV information: pedsMax + else if ( mon_ == sistrip::PEDESTALS_MAX ) { + value[0][0] = anal->pedsMax()[0]; + value[1][0] = anal->pedsMax()[1]; + } + + // Per APV information: pedsMin + else if ( mon_ == sistrip::PEDESTALS_MIN ) { + value[0][0] = anal->pedsMin()[0]; + value[1][0] = anal->pedsMin()[1]; + } + + // Per APV information: noiseMean + else if ( mon_ == sistrip::NOISE_MEAN ) { value[0][0] = anal->noiseMean()[0]; value[1][0] = anal->noiseMean()[1]; - } else if ( mon_ == sistrip::NOISE_SPREAD ) { + } + // Per APV information: noiseSpread + else if ( mon_ == sistrip::NOISE_SPREAD ) { value[0][0] = anal->noiseSpread()[0]; value[1][0] = anal->noiseSpread()[1]; - } else if ( mon_ == sistrip::NOISE_MAX ) { + } + // Per APV information: noiseMax + else if ( mon_ == sistrip::NOISE_MAX ) { value[0][0] = anal->noiseMax()[0]; value[1][0] = anal->noiseMax()[1]; - } else if ( mon_ == sistrip::NOISE_MIN ) { + } + // Per APV information: noiseMin + else if ( mon_ == sistrip::NOISE_MIN ) { value[0][0] = anal->noiseMin()[0]; value[1][0] = anal->noiseMin()[1]; - } else if ( mon_ == sistrip::NUM_OF_DEAD ) { - value[0][0] = 1. * anal->dead()[0].size(); - value[1][0] = 1. * anal->dead()[1].size(); - } else if ( mon_ == sistrip::NUM_OF_NOISY ) { - value[0][0] = 1. * anal->noisy()[0].size(); - value[1][0] = 1. * anal->noisy()[1].size(); - } else { + } + + // BAD channels per APV + else if ( mon_ == sistrip::NUM_OF_DEAD ) { + value[0][0] = 1. * anal->deadStrip()[0].size(); + value[1][0] = 1. * anal->deadStrip()[1].size(); + } + else if ( mon_ == sistrip::NUM_OF_BAD ) { + value[0][0] = 1. * anal->badStrip()[0].size(); + value[1][0] = 1. * anal->badStrip()[1].size(); + } + else if ( mon_ == sistrip::NUM_OF_BAD_SHIFTED) { + value[0][0] = 1. * anal->shiftedStrip()[0].size(); + value[1][0] = 1. * anal->shiftedStrip()[1].size(); + } + else if ( mon_ == sistrip::NUM_OF_BAD_LOW_NOISE) { + value[0][0] = 1. * anal->lowNoiseStrip()[0].size(); + value[1][0] = 1. * anal->lowNoiseStrip()[1].size(); + } + else if ( mon_ == sistrip::NUM_OF_BAD_LARGE_NOISE) { + value[0][0] = 1. * anal->largeNoiseStrip()[0].size(); + value[1][0] = 1. * anal->largeNoiseStrip()[1].size(); + } + else if ( mon_ == sistrip::NUM_OF_BAD_LARGE_SIGNIF) { + value[0][0] = 1. * anal->largeNoiseSignificance()[0].size(); + value[1][0] = 1. * anal->largeNoiseSignificance()[1].size(); + } + else if ( mon_ == sistrip::NUM_OF_BAD_FIT_STATUS) { + value[0][0] = 1. * anal->badFitStatus()[0].size(); + value[1][0] = 1. * anal->badFitStatus()[1].size(); + } + else if ( mon_ == sistrip::NUM_OF_BAD_AD_PROBAB) { + value[0][0] = 1. * anal->badADProbab()[0].size(); + value[1][0] = 1. * anal->badADProbab()[1].size(); + } + else if ( mon_ == sistrip::NUM_OF_BAD_KS_PROBAB) { + value[0][0] = 1. * anal->badKSProbab()[0].size(); + value[1][0] = 1. * anal->badKSProbab()[1].size(); + } + else if ( mon_ == sistrip::NUM_OF_BAD_JB_PROBAB) { + value[0][0] = 1. * anal->badJBProbab()[0].size(); + value[1][0] = 1. * anal->badJBProbab()[1].size(); + } + else if ( mon_ == sistrip::NUM_OF_BAD_CHI2_PROBAB) { + value[0][0] = 1. * anal->badChi2Probab()[0].size(); + value[1][0] = 1. * anal->badChi2Probab()[1].size(); + } + else if ( mon_ == sistrip::NUM_OF_BAD_TAIL) { + value[0][0] = 1. * anal->badTailStrip()[0].size(); + value[1][0] = 1. * anal->badTailStrip()[1].size(); + } + else if ( mon_ == sistrip::NUM_OF_BAD_DOUBLE_PEAK) { + value[0][0] = 1. * anal->badDoublePeakStrip()[0].size(); + value[1][0] = 1. * anal->badDoublePeakStrip()[1].size(); + } + else { edm::LogWarning(mlSummaryPlots_) << "[SummaryPlotFactory::" << __func__ << "]" << " Unexpected monitorable: " << SiStripEnumsAndStrings::monitorable( SummaryPlotFactoryBase::mon_ ); return; } - + if ( !all_strips ) { - + SummaryPlotFactoryBase::generator_->fillMap( SummaryPlotFactoryBase::level_, SummaryPlotFactoryBase::gran_, iter->first, @@ -163,8 +379,8 @@ void PedsFullNoiseSummaryFactory::extract( Iterator iter ) { SummaryPlotFactoryBase::gran_, iter->first, value[0][istr] ); - } - + } + for ( uint16_t istr = 0; istr < value[1].size(); istr++ ) { SummaryPlotFactoryBase::generator_->fillMap( SummaryPlotFactoryBase::level_, SummaryPlotFactoryBase::gran_, @@ -180,29 +396,94 @@ void PedsFullNoiseSummaryFactory::format() { if ( mon_ == sistrip::PEDESTALS_ALL_STRIPS ) { generator_->axisLabel( "Pedestal value [adc]" ); - } else if ( mon_ == sistrip::PEDESTALS_MEAN ) { - } else if ( mon_ == sistrip::PEDESTALS_SPREAD ) { - } else if ( mon_ == sistrip::PEDESTALS_MAX ) { - } else if ( mon_ == sistrip::PEDESTALS_MIN ) { - } else if ( mon_ == sistrip::NOISE_ALL_STRIPS ) { + } + else if ( mon_ == sistrip::PEDESTALS_MEAN ) { + } + else if ( mon_ == sistrip::PEDESTALS_SPREAD ) { + } + else if ( mon_ == sistrip::PEDESTALS_MAX ) { + } + else if ( mon_ == sistrip::PEDESTALS_MIN ) { + } + else if ( mon_ == sistrip::NOISE_ALL_STRIPS ) { generator_->axisLabel( "Noise [adc]" ); - } else if ( mon_ == sistrip::NOISE_MEAN ) { - } else if ( mon_ == sistrip::NOISE_SPREAD ) { - } else if ( mon_ == sistrip::NOISE_MAX ) { - } else if ( mon_ == sistrip::NOISE_MIN ) { - } else if ( mon_ == sistrip::NUM_OF_DEAD ) { - } else if ( mon_ == sistrip::NUM_OF_NOISY ) { - } else if ( mon_ == sistrip::NOISE_KS_ALL_STRIPS ) { - generator_->axisLabel( "KS Prob." ); - } else if ( mon_ == sistrip::NOISE_GAUS_ALL_STRIPS ) { - generator_->axisLabel( "Noise Gaus." ); - } else if ( mon_ == sistrip::NOISE_BIN_84_ALL_STRIPS ) { - generator_->axisLabel( "Noise Bin 84." ); - } else if ( mon_ == sistrip::NOISE_RMS_ALL_STRIPS ) { - generator_->axisLabel( "Noise RMS." ); - } else if ( mon_ == sistrip::NOISE_CHI2_ALL_STRIPS ) { - generator_->axisLabel( "Chi2 Prob." ); - } else { + } + else if ( mon_ == sistrip::NOISE_MEAN ) { + } + else if ( mon_ == sistrip::NOISE_SPREAD ) { + } + else if ( mon_ == sistrip::NOISE_MAX ) { + } + else if ( mon_ == sistrip::NOISE_MIN ) { + } + else if( mon_ == sistrip::AD_PROBAB_ALL_STRIPS) { + generator_->axisLabel("Anderson-Darling p-value" ); + } + else if( mon_ == sistrip::KS_PROBAB_ALL_STRIPS) { + generator_->axisLabel("Kolmogorov-Smirnov p-value" ); + } + else if( mon_ == sistrip::JB_PROBAB_ALL_STRIPS) { + generator_->axisLabel("Jacque-Bera p-value" ); + } + else if( mon_ == sistrip::CHI2_PROBAB_ALL_STRIPS) { + generator_->axisLabel("Chi2 p-value" ); + } + else if( mon_ == sistrip::RESIDUAL_RMS_ALL_STRIPS) { + generator_->axisLabel("Residual RMS [adc]" ); + } + else if( mon_ == sistrip::RESIDUAL_GAUS_ALL_STRIPS) { + generator_->axisLabel("Residual Gaus [adc]" ); + } + else if( mon_ == sistrip::NOISE_SIGNIFICANCE_ALL_STRIPS) { + generator_->axisLabel("Noise Significance" ); + } + else if( mon_ == sistrip::RESIDUAL_MEAN_ALL_STRIPS) { + generator_->axisLabel("Residual Mean [adc]" ); + } + else if( mon_ == sistrip::RESIDUAL_SKEWNESS_ALL_STRIPS) { + generator_->axisLabel("Residual Skewness [adc]" ); + } + else if( mon_ == sistrip::RESIDUAL_KURTOSIS_ALL_STRIPS) { + generator_->axisLabel("Residual Kurtosis [adc]" ); + } + else if( mon_ == sistrip::RESIDUAL_INTEGRALNSIGMA_ALL_STRIPS) { + generator_->axisLabel("Residual Integral at N sigma" ); + } + else if( mon_ == sistrip::RESIDUAL_INTEGRAL_ALL_STRIPS) { + generator_->axisLabel("Residual Integral" ); + } + else if( mon_ == sistrip::BAD_STRIP_BIT_ALL_STRIPS) { + generator_->axisLabel("Bad Strip Bit" ); + } + else if( mon_ == sistrip::DEAD_STRIP_BIT_ALL_STRIPS) { + generator_->axisLabel("Dead Strip Bit" ); + } + else if( mon_ == sistrip::NUM_OF_DEAD) { + } + else if( mon_ == sistrip::NUM_OF_BAD) { + } + else if( mon_ == sistrip::NUM_OF_BAD_SHIFTED) { + } + else if( mon_ == sistrip::NUM_OF_BAD_LOW_NOISE) { + } + else if( mon_ == sistrip::NUM_OF_BAD_LARGE_SIGNIF) { + } + else if( mon_ == sistrip::NUM_OF_BAD_FIT_STATUS) { + } + else if( mon_ == sistrip::NUM_OF_BAD_AD_PROBAB) { + } + else if( mon_ == sistrip::NUM_OF_BAD_KS_PROBAB) { + } + else if( mon_ == sistrip::NUM_OF_BAD_JB_PROBAB) { + } + else if( mon_ == sistrip::NUM_OF_BAD_CHI2_PROBAB) { + } + else if( mon_ == sistrip::NUM_OF_BAD_TAIL) { + } + else if( mon_ == sistrip::NUM_OF_BAD_DOUBLE_PEAK) { + } + + else { edm::LogWarning(mlSummaryPlots_) << "[SummaryPlotFactory::" << __func__ << "]" << " Unexpected SummaryHisto value:" diff --git a/DataFormats/SiStripCommon/interface/ConstantsForMonitorable.h b/DataFormats/SiStripCommon/interface/ConstantsForMonitorable.h index 8bc95f3898890..8bf14b8cddf9f 100644 --- a/DataFormats/SiStripCommon/interface/ConstantsForMonitorable.h +++ b/DataFormats/SiStripCommon/interface/ConstantsForMonitorable.h @@ -79,20 +79,42 @@ namespace sistrip { static const char pedestalsMin_[] = "PedestalMin"; // noise - static const char noiseAllStrips_[] = "StripNoise"; - static const char noiseMean_[] = "NoiseMean"; - static const char noiseSpread_[] = "NoiseRmsSpread"; - static const char noiseMax_[] = "NoiseMax"; - static const char noiseMin_[] = "NoiseMin"; - static const char numOfDead_[] = "NumOfDeadStrips"; - static const char numOfNoisy_[] = "NumOfNoisyStrips"; - static const char noiseKSAllStrips_[] = "StripNoiseKS"; - static const char noiseChi2AllStrips_[] = "StripNoiseChi2"; - static const char noiseGausAllStrips_[] = "StripNoiseGaus"; - static const char noiseBin84AllStrips_[] = "StripNoiseBin84"; - static const char noiseRMSAllStrips_[] = "StripNoiseRMS"; - static const char noiseSignif_[] = "StripNoiseSignif"; + static const char noiseAllStrips_[] = "StripNoise"; + static const char noiseMean_[] = "NoiseMean"; + static const char noiseSpread_[] = "NoiseRmsSpread"; + static const char noiseMax_[] = "NoiseMax"; + static const char noiseMin_[] = "NoiseMin"; + static const char numOfDeadStrips_[] = "NumOfDeadStrips"; + static const char numOfNoisy_[] = "NumOfNoisyStrips"; + static const char numOfBadStrips_[] = "NumOfBadStrips"; + static const char numOfBadADProbabStrips_[] = "NumOfBadADProbabStrips"; + static const char numOfBadKSProbabStrips_[] = "NumOfBadKSProbabStrips"; + static const char numOfBadJBProbabStrips_[] = "NumOfBadJBProbabStrips"; + static const char numOfBadChi2ProbabStrips_[] = "NumOfBadChi2ProbabStrips"; + static const char numOfBadShiftedStrips_[] = "NumOfBadShfitedStrips"; + static const char numOfBadLowNoiseStrips_[] = "NumOfBadLowNoiseStrips"; + static const char numOfBadLargeNoiseStrips_[] = "NumOfBadLargeNoiseStrips"; + static const char numOfBadLargeNoiseSignificanceStrips_[] = "NumOfBadLargeNoiseSignificanceStrips"; + static const char numOfBadTailStrips_[] = "NumOfBadTailStrips"; + static const char numOfBadFitStatusStrips_[] = "NumOfBadFitStatusStrips"; + static const char numOfBadDoublePeakStrips_[] = "NumOfBadDoublePeakStrips"; + + static const char badStripBit_[] = "badStripBit"; + static const char deadStripBit_[] = "deadStripBit"; + static const char adProbabAllStrips_[] = "adProbabStrips"; + static const char ksProbabAllStrips_[] = "ksProbabStrips"; + static const char jbProbabAllStrips_[] = "jbProbabStrips"; + static const char chi2ProbabAllStrips_[] = "chi2ProbabStrips"; + static const char residualRMSAllStrips_[] = "residualRMSStrips"; + static const char residualSigmaGausAllStrips_[] = "residualSigmaGausStrips"; + static const char noiseSignificanceAllStrips_[] = "noiseSignificanceStrips"; + static const char residualMeanAllStrips_[] = "residualMeanStrips"; + static const char residualSkewnessAllStrips_[] = "residualSkewnessStrips"; + static const char residualKurtosisAllStrips_[] = "residualKurtosisStrips"; + static const char residualIntegralNsigmaAllStrips_[] = "residualIntegralNsigmaStrips"; + static const char residualIntegralAllStrips_[] = "residualIntegralStrips"; + // Fine Delay static const char fineDelayPos_[] = "FineDelayPosition"; static const char fineDelayErr_[] = "FineDelayError"; @@ -204,15 +226,39 @@ namespace sistrip { NOISE_MEAN = 207, NOISE_SPREAD = 208, NOISE_MAX = 209, - NOISE_MIN = 210, + NOISE_MIN = 210, + + /// Bad strip NUM_OF_DEAD = 211, - NUM_OF_NOISY = 212, - NOISE_KS_ALL_STRIPS = 215, - NOISE_GAUS_ALL_STRIPS = 216, - NOISE_BIN_84_ALL_STRIPS= 217, - NOISE_CHI2_ALL_STRIPS = 218, - NOISE_SIGNIF_ALL_STRIPS= 219, - NOISE_RMS_ALL_STRIPS = 220, + NUM_OF_BAD = 212, + NUM_OF_NOISY = 213, + NUM_OF_BAD_SHIFTED = 214, + NUM_OF_BAD_LOW_NOISE = 215, + NUM_OF_BAD_LARGE_NOISE = 216, + NUM_OF_BAD_LARGE_SIGNIF = 217, + NUM_OF_BAD_FIT_STATUS = 218, + NUM_OF_BAD_AD_PROBAB = 219, + NUM_OF_BAD_KS_PROBAB = 220, + NUM_OF_BAD_JB_PROBAB = 221, + NUM_OF_BAD_CHI2_PROBAB = 222, + NUM_OF_BAD_TAIL = 223, + NUM_OF_BAD_DOUBLE_PEAK = 224, + // + BAD_STRIP_BIT_ALL_STRIPS = 225, + DEAD_STRIP_BIT_ALL_STRIPS = 226, + AD_PROBAB_ALL_STRIPS = 227, + KS_PROBAB_ALL_STRIPS = 228, + JB_PROBAB_ALL_STRIPS = 229, + CHI2_PROBAB_ALL_STRIPS = 230, + RESIDUAL_RMS_ALL_STRIPS = 231, + RESIDUAL_GAUS_ALL_STRIPS = 232, + NOISE_SIGNIFICANCE_ALL_STRIPS= 233, + RESIDUAL_MEAN_ALL_STRIPS = 234, + RESIDUAL_SKEWNESS_ALL_STRIPS = 235, + RESIDUAL_KURTOSIS_ALL_STRIPS = 236, + RESIDUAL_INTEGRALNSIGMA_ALL_STRIPS = 237, + RESIDUAL_INTEGRAL_ALL_STRIPS = 238, + FINE_DELAY_POS = 601, FINE_DELAY_ERROR = 602, diff --git a/DataFormats/SiStripCommon/src/SiStripEnumsAndStrings.cc b/DataFormats/SiStripCommon/src/SiStripEnumsAndStrings.cc index addde87a59e8c..eb86e4eaf46f5 100644 --- a/DataFormats/SiStripCommon/src/SiStripEnumsAndStrings.cc +++ b/DataFormats/SiStripCommon/src/SiStripEnumsAndStrings.cc @@ -368,14 +368,35 @@ std::string SiStripEnumsAndStrings::monitorable( const sistrip::Monitorable& mon else if ( mon == sistrip::NOISE_SPREAD ) { return sistrip::noiseSpread_; } else if ( mon == sistrip::NOISE_MAX ) { return sistrip::noiseMax_; } else if ( mon == sistrip::NOISE_MIN ) { return sistrip::noiseMin_; } - else if ( mon == sistrip::NUM_OF_DEAD ) { return sistrip::numOfDead_; } + else if ( mon == sistrip::NUM_OF_DEAD ) { return sistrip::numOfDeadStrips_; } else if ( mon == sistrip::NUM_OF_NOISY ) { return sistrip::numOfNoisy_; } - else if ( mon == sistrip::NOISE_GAUS_ALL_STRIPS ) { return sistrip::noiseGausAllStrips_; } - else if ( mon == sistrip::NOISE_KS_ALL_STRIPS ) { return sistrip::noiseKSAllStrips_; } - else if ( mon == sistrip::NOISE_CHI2_ALL_STRIPS ) { return sistrip::noiseChi2AllStrips_; } - else if ( mon == sistrip::NOISE_BIN_84_ALL_STRIPS) { return sistrip::noiseBin84AllStrips_; } - else if ( mon == sistrip::NOISE_RMS_ALL_STRIPS) { return sistrip::noiseRMSAllStrips_; } - else if ( mon == sistrip::NOISE_SIGNIF_ALL_STRIPS ) { return sistrip::noiseSignif_; } + else if ( mon == sistrip::NUM_OF_BAD ) { return sistrip::numOfBadStrips_; } + else if ( mon == sistrip::NUM_OF_BAD_SHIFTED ) { return sistrip::numOfBadShiftedStrips_; } + else if ( mon == sistrip::NUM_OF_BAD_LOW_NOISE ) { return sistrip::numOfBadLowNoiseStrips_; } + else if ( mon == sistrip::NUM_OF_BAD_LARGE_NOISE ) { return sistrip::numOfBadLargeNoiseStrips_; } + else if ( mon == sistrip::NUM_OF_BAD_LARGE_SIGNIF ) { return sistrip::numOfBadLargeNoiseSignificanceStrips_; } + else if ( mon == sistrip::NUM_OF_BAD_FIT_STATUS ) { return sistrip::numOfBadFitStatusStrips_; } + else if ( mon == sistrip::NUM_OF_BAD_AD_PROBAB ) { return sistrip::numOfBadADProbabStrips_; } + else if ( mon == sistrip::NUM_OF_BAD_KS_PROBAB ) { return sistrip::numOfBadKSProbabStrips_; } + else if ( mon == sistrip::NUM_OF_BAD_JB_PROBAB ) { return sistrip::numOfBadJBProbabStrips_; } + else if ( mon == sistrip::NUM_OF_BAD_CHI2_PROBAB ) { return sistrip::numOfBadChi2ProbabStrips_; } + else if ( mon == sistrip::NUM_OF_BAD_TAIL ) { return sistrip::numOfBadTailStrips_; } + else if ( mon == sistrip::NUM_OF_BAD_DOUBLE_PEAK ) { return sistrip::numOfBadDoublePeakStrips_; } + + else if ( mon == sistrip::BAD_STRIP_BIT_ALL_STRIPS ) { return sistrip::badStripBit_; } + else if ( mon == sistrip::DEAD_STRIP_BIT_ALL_STRIPS ) { return sistrip::deadStripBit_; } + else if ( mon == sistrip::AD_PROBAB_ALL_STRIPS ) { return sistrip::adProbabAllStrips_; } + else if ( mon == sistrip::KS_PROBAB_ALL_STRIPS ) { return sistrip::ksProbabAllStrips_; } + else if ( mon == sistrip::JB_PROBAB_ALL_STRIPS ) { return sistrip::jbProbabAllStrips_; } + else if ( mon == sistrip::CHI2_PROBAB_ALL_STRIPS ) { return sistrip::chi2ProbabAllStrips_; } + else if ( mon == sistrip::RESIDUAL_RMS_ALL_STRIPS ) { return sistrip::residualRMSAllStrips_; } + else if ( mon == sistrip::RESIDUAL_GAUS_ALL_STRIPS ) { return sistrip::residualSigmaGausAllStrips_; } + else if ( mon == sistrip::NOISE_SIGNIFICANCE_ALL_STRIPS ) { return sistrip::noiseSignificanceAllStrips_; } + else if ( mon == sistrip::RESIDUAL_MEAN_ALL_STRIPS ) { return sistrip::residualMeanAllStrips_; } + else if ( mon == sistrip::RESIDUAL_SKEWNESS_ALL_STRIPS ) { return sistrip::residualSkewnessAllStrips_; } + else if ( mon == sistrip::RESIDUAL_KURTOSIS_ALL_STRIPS ) { return sistrip::residualKurtosisAllStrips_; } + else if ( mon == sistrip::RESIDUAL_INTEGRALNSIGMA_ALL_STRIPS ) { return sistrip::residualIntegralNsigmaAllStrips_; } + else if ( mon == sistrip::RESIDUAL_INTEGRAL_ALL_STRIPS ) { return sistrip::residualIntegralAllStrips_; } // fine delay else if ( mon == sistrip::FINE_DELAY_POS) { return sistrip::fineDelayPos_; } @@ -496,20 +517,41 @@ sistrip::Monitorable SiStripEnumsAndStrings::monitorable( const std::string& mon else if ( mon.find( sistrip::pedestalsMin_ ) != std::string::npos ) { return sistrip::PEDESTALS_MIN; } // noiseKS must come before the more general noiseAllStrips, since it contains that string - else if ( mon.find( sistrip::noiseGausAllStrips_ ) != std::string::npos ) { return sistrip::NOISE_GAUS_ALL_STRIPS; } - else if ( mon.find( sistrip::noiseKSAllStrips_ ) != std::string::npos ) { return sistrip::NOISE_KS_ALL_STRIPS; } - else if ( mon.find( sistrip::noiseChi2AllStrips_ ) != std::string::npos ) { return sistrip::NOISE_CHI2_ALL_STRIPS; } - else if ( mon.find( sistrip::noiseBin84AllStrips_ ) != std::string::npos ) { return sistrip::NOISE_BIN_84_ALL_STRIPS;} - else if ( mon.find( sistrip::noiseRMSAllStrips_ ) != std::string::npos ) { return sistrip::NOISE_RMS_ALL_STRIPS;} - else if ( mon.find( sistrip::noiseSignif_ ) != std::string::npos ) { return sistrip::NOISE_SIGNIF_ALL_STRIPS; } else if ( mon.find( sistrip::noiseAllStrips_ ) != std::string::npos ) { return sistrip::NOISE_ALL_STRIPS; } else if ( mon.find( sistrip::noiseMean_ ) != std::string::npos ) { return sistrip::NOISE_MEAN; } else if ( mon.find( sistrip::noiseSpread_ ) != std::string::npos ) { return sistrip::NOISE_SPREAD; } else if ( mon.find( sistrip::noiseMax_ ) != std::string::npos ) { return sistrip::NOISE_MAX; } else if ( mon.find( sistrip::noiseMin_ ) != std::string::npos ) { return sistrip::NOISE_MIN; } - else if ( mon.find( sistrip::numOfDead_ ) != std::string::npos ) { return sistrip::NUM_OF_DEAD; } + else if ( mon.find( sistrip::numOfDeadStrips_ ) != std::string::npos ) { return sistrip::NUM_OF_DEAD; } else if ( mon.find( sistrip::numOfNoisy_ ) != std::string::npos ) { return sistrip::NUM_OF_NOISY; } - + else if ( mon.find( sistrip::numOfBadStrips_ ) != std::string::npos ) { return sistrip::NUM_OF_BAD; } + else if ( mon.find( sistrip::numOfBadShiftedStrips_ ) != std::string::npos ) { return sistrip::NUM_OF_BAD_SHIFTED; } + else if ( mon.find( sistrip::numOfBadLowNoiseStrips_ ) != std::string::npos ) { return sistrip::NUM_OF_BAD_LOW_NOISE; } + else if ( mon.find( sistrip::numOfBadLargeNoiseStrips_ ) != std::string::npos ) { return sistrip::NUM_OF_BAD_LARGE_NOISE; } + else if ( mon.find( sistrip::numOfBadLargeNoiseSignificanceStrips_ ) != std::string::npos ) { return sistrip::NUM_OF_BAD_LARGE_SIGNIF; } + else if ( mon.find( sistrip::numOfBadFitStatusStrips_ ) != std::string::npos ) { return sistrip::NUM_OF_BAD_FIT_STATUS; } + else if ( mon.find( sistrip::numOfBadADProbabStrips_ ) != std::string::npos ) { return sistrip::NUM_OF_BAD_AD_PROBAB; } + else if ( mon.find( sistrip::numOfBadKSProbabStrips_ ) != std::string::npos ) { return sistrip::NUM_OF_BAD_KS_PROBAB; } + else if ( mon.find( sistrip::numOfBadJBProbabStrips_ ) != std::string::npos ) { return sistrip::NUM_OF_BAD_JB_PROBAB; } + else if ( mon.find( sistrip::numOfBadChi2ProbabStrips_ ) != std::string::npos ) { return sistrip::NUM_OF_BAD_CHI2_PROBAB; } + else if ( mon.find( sistrip::numOfBadTailStrips_ ) != std::string::npos ) { return sistrip::NUM_OF_BAD_TAIL; } + else if ( mon.find( sistrip::numOfBadDoublePeakStrips_ ) != std::string::npos ) { return sistrip::NUM_OF_BAD_DOUBLE_PEAK; } + + else if ( mon.find( sistrip::badStripBit_ ) != std::string::npos ) { return sistrip::BAD_STRIP_BIT_ALL_STRIPS; } + else if ( mon.find( sistrip::deadStripBit_ ) != std::string::npos ) { return sistrip::DEAD_STRIP_BIT_ALL_STRIPS; } + else if ( mon.find( sistrip::adProbabAllStrips_ ) != std::string::npos ) { return sistrip::AD_PROBAB_ALL_STRIPS; } + else if ( mon.find( sistrip::ksProbabAllStrips_ ) != std::string::npos ) { return sistrip::KS_PROBAB_ALL_STRIPS; } + else if ( mon.find( sistrip::jbProbabAllStrips_ ) != std::string::npos ) { return sistrip::JB_PROBAB_ALL_STRIPS; } + else if ( mon.find( sistrip::chi2ProbabAllStrips_ ) != std::string::npos ) { return sistrip::CHI2_PROBAB_ALL_STRIPS; } + else if ( mon.find( sistrip::residualRMSAllStrips_ ) != std::string::npos ) { return sistrip::RESIDUAL_RMS_ALL_STRIPS; } + else if ( mon.find( sistrip::residualSigmaGausAllStrips_ ) != std::string::npos ) { return sistrip::RESIDUAL_GAUS_ALL_STRIPS; } + else if ( mon.find( sistrip::noiseSignificanceAllStrips_ ) != std::string::npos ) { return sistrip::NOISE_SIGNIFICANCE_ALL_STRIPS; } + else if ( mon.find( sistrip::residualMeanAllStrips_ ) != std::string::npos ) { return sistrip::RESIDUAL_MEAN_ALL_STRIPS; } + else if ( mon.find( sistrip::residualSkewnessAllStrips_ ) != std::string::npos ) { return sistrip::RESIDUAL_SKEWNESS_ALL_STRIPS; } + else if ( mon.find( sistrip::residualKurtosisAllStrips_ ) != std::string::npos ) { return sistrip::RESIDUAL_KURTOSIS_ALL_STRIPS; } + else if ( mon.find( sistrip::residualIntegralNsigmaAllStrips_ ) != std::string::npos ) { return sistrip::RESIDUAL_INTEGRALNSIGMA_ALL_STRIPS; } + else if ( mon.find( sistrip::residualIntegralAllStrips_ ) != std::string::npos ) { return sistrip::RESIDUAL_INTEGRAL_ALL_STRIPS; } + // fine delay else if ( mon.find( sistrip::fineDelayPos_ ) != std::string::npos ) { return sistrip::FINE_DELAY_POS; } else if ( mon.find( sistrip::fineDelayErr_ ) != std::string::npos ) { return sistrip::FINE_DELAY_ERROR; } diff --git a/OnlineDB/SiStripConfigDb/interface/SiStripPartition.h b/OnlineDB/SiStripConfigDb/interface/SiStripPartition.h index 310d040b0c054..cfdb1527f6d9f 100644 --- a/OnlineDB/SiStripConfigDb/interface/SiStripPartition.h +++ b/OnlineDB/SiStripConfigDb/interface/SiStripPartition.h @@ -95,6 +95,8 @@ class SiStripPartition { Versions pedestalsVersion() const; + Versions pedsFullNoiseVersion() const; + Versions apvLatencyVersion() const; Versions fineDelayVersion() const; @@ -169,6 +171,8 @@ class SiStripPartition { Versions pedestalsV_; + Versions pedsFullNoiseV_; + Versions apvLatencyV_; Versions fineDelayV_; @@ -210,6 +214,7 @@ inline SiStripPartition::Versions SiStripPartition::optoScanVersion() const { re inline SiStripPartition::Versions SiStripPartition::vpspScanVersion() const { return vpspScanV_; } inline SiStripPartition::Versions SiStripPartition::apvCalibVersion() const { return apvCalibV_; } inline SiStripPartition::Versions SiStripPartition::pedestalsVersion() const { return pedestalsV_; } +inline SiStripPartition::Versions SiStripPartition::pedsFullNoiseVersion() const { return pedsFullNoiseV_; } inline SiStripPartition::Versions SiStripPartition::apvLatencyVersion() const { return apvLatencyV_; } inline SiStripPartition::Versions SiStripPartition::fineDelayVersion() const { return fineDelayV_; } diff --git a/OnlineDB/SiStripConfigDb/src/SiStripPartition.cc b/OnlineDB/SiStripConfigDb/src/SiStripPartition.cc index 43ac013035d05..40a84087ecfbe 100644 --- a/OnlineDB/SiStripConfigDb/src/SiStripPartition.cc +++ b/OnlineDB/SiStripConfigDb/src/SiStripPartition.cc @@ -36,6 +36,7 @@ SiStripPartition::SiStripPartition() : vpspScanV_(0,0), apvCalibV_(0,0), pedestalsV_(0,0), + pedsFullNoiseV_(0,0), apvLatencyV_(0,0), fineDelayV_(0,0), inputModuleXml_(""), @@ -68,6 +69,7 @@ SiStripPartition::SiStripPartition( std::string partition ) : vpspScanV_(0,0), apvCalibV_(0,0), pedestalsV_(0,0), + pedsFullNoiseV_(0,0), apvLatencyV_(0,0), fineDelayV_(0,0), inputModuleXml_(""), @@ -102,6 +104,7 @@ SiStripPartition::SiStripPartition( const SiStripPartition& input ) : vpspScanV_( input.vpspScanVersion() ), apvCalibV_( input.apvCalibVersion() ), pedestalsV_( input.pedestalsVersion() ), + pedsFullNoiseV_( input.pedsFullNoiseVersion() ), apvLatencyV_( input.apvLatencyVersion() ), fineDelayV_( input.fineDelayVersion() ), inputModuleXml_( input.inputModuleXml() ), @@ -135,6 +138,7 @@ SiStripPartition& SiStripPartition::operator= ( const SiStripPartition& input ){ vpspScanV_ = input.vpspScanVersion(); apvCalibV_ = input.apvCalibVersion(); pedestalsV_ = input.pedestalsVersion(); + pedsFullNoiseV_ = input.pedsFullNoiseVersion(); apvLatencyV_ = input.apvLatencyVersion(); fineDelayV_ = input.fineDelayVersion(); inputModuleXml_ = input.inputModuleXml(); @@ -168,6 +172,7 @@ bool SiStripPartition::operator== ( const SiStripPartition& input ) const { vpspScanV_ == input.vpspScanVersion() && apvCalibV_ == input.apvCalibVersion() && pedestalsV_ == input.pedestalsVersion() && + pedsFullNoiseV_ == input.pedsFullNoiseVersion() && apvLatencyV_ == input.apvLatencyVersion() && fineDelayV_ == input.fineDelayVersion() && inputModuleXml_ == input.inputModuleXml() && @@ -215,6 +220,7 @@ void SiStripPartition::reset() { vpspScanV_ = std::make_pair(0,0); apvCalibV_ = std::make_pair(0,0); pedestalsV_ = std::make_pair(0,0); + pedsFullNoiseV_ = std::make_pair(0,0); apvLatencyV_ = std::make_pair(0,0); fineDelayV_ = std::make_pair(0,0); @@ -251,6 +257,7 @@ void SiStripPartition::pset( const edm::ParameterSet& pset ) { vpspScanV_ = versions( pset.getUntrackedParameter< std::vector >( "VpspScanVersion", tmp2 ) ); apvCalibV_ = versions( pset.getUntrackedParameter< std::vector >( "ApvCalibVersion", tmp2 ) ); pedestalsV_ = versions( pset.getUntrackedParameter< std::vector >( "PedestalsVersion", tmp2 ) ); + pedsFullNoiseV_ = versions( pset.getUntrackedParameter< std::vector >( "PedsFullNoiseVersion", tmp2 ) ); apvLatencyV_ = versions( pset.getUntrackedParameter< std::vector >( "ApvLatencyVersion", tmp2 ) ); fineDelayV_ = versions( pset.getUntrackedParameter< std::vector >( "FineDelayVersion", tmp2 ) ); @@ -350,7 +357,7 @@ void SiStripPartition::update( const SiStripConfigDb* const db ) { maskVersion_.second = (*istate)->getMaskVersionMinorId(); } //#endif - + // Retrieve global and local versions if ( forceCurrentState_ || globalAnalysisV_ ) { // use global version (or current state) @@ -382,6 +389,9 @@ void SiStripPartition::update( const SiStripConfigDb* const db ) { } else if ( ivers->first == CommissioningAnalysisDescription::T_ANALYSIS_PEDESTALS ) { pedestalsV_.first = ivers->second.first; pedestalsV_.second = ivers->second.second; + } else if ( ivers->first == CommissioningAnalysisDescription::T_ANALYSIS_PEDSFULLNOISE ) { + pedsFullNoiseV_.first = ivers->second.first; + pedsFullNoiseV_.second = ivers->second.second; } else if ( ivers->first == CommissioningAnalysisDescription::T_ANALYSIS_APVLATENCY ) { apvLatencyV_.first = ivers->second.first; apvLatencyV_.second = ivers->second.second; @@ -443,6 +453,11 @@ void SiStripPartition::update( const SiStripConfigDb* const db ) { pedestalsV_.first = ivers->second.first; pedestalsV_.second = ivers->second.second; } + } else if ( ivers->first == CommissioningAnalysisDescription::T_ANALYSIS_PEDSFULLNOISE ) { + if ( !pedsFullNoiseV_.first && !pedsFullNoiseV_.second ) { + pedsFullNoiseV_.first = ivers->second.first; + pedsFullNoiseV_.second = ivers->second.second; + } } else if ( ivers->first == CommissioningAnalysisDescription::T_ANALYSIS_APVLATENCY ) { if ( !apvLatencyV_.first && !apvLatencyV_.second ) { apvLatencyV_.first = ivers->second.first; @@ -481,10 +496,10 @@ void SiStripPartition::update( const SiStripConfigDb* const db ) { } else { // ---------- USE RUN NUMBER ---------- // Retrieve TkRun object for given run (0 means "latest run") - TkRun* run = nullptr; + TkRun* run = 0; if ( !runNumber_ ) { run = df->getLastRun( partitionName_ ); } else { run = df->getRun( partitionName_, runNumber_ ); } - + // Retrieve versioning for given TkRun object if ( run ) { @@ -570,6 +585,9 @@ void SiStripPartition::update( const SiStripConfigDb* const db ) { } else if ( ivers->first == CommissioningAnalysisDescription::T_ANALYSIS_PEDESTALS ) { pedestalsV_.first = ivers->second.first; pedestalsV_.second = ivers->second.second; + } else if ( ivers->first == CommissioningAnalysisDescription::T_ANALYSIS_PEDSFULLNOISE ) { + pedsFullNoiseV_.first = ivers->second.first; + pedsFullNoiseV_.second = ivers->second.second; } else if ( ivers->first == CommissioningAnalysisDescription::T_ANALYSIS_APVLATENCY ) { apvLatencyV_.first = ivers->second.first; apvLatencyV_.second = ivers->second.second; @@ -604,6 +622,7 @@ void SiStripPartition::update( const SiStripConfigDb* const db ) { else if ( runType_ == sistrip::VPSP_SCAN ) { type = CommissioningAnalysisDescription::T_ANALYSIS_VPSPSCAN; } else if ( runType_ == sistrip::CALIBRATION ) { type = CommissioningAnalysisDescription::T_ANALYSIS_CALIBRATION; } else if ( runType_ == sistrip::PEDESTALS ) { type = CommissioningAnalysisDescription::T_ANALYSIS_PEDESTALS; } + else if ( runType_ == sistrip::PEDS_FULL_NOISE) { type = CommissioningAnalysisDescription::T_ANALYSIS_PEDSFULLNOISE; } else if ( runType_ == sistrip::APV_LATENCY ) { type = CommissioningAnalysisDescription::T_ANALYSIS_APVLATENCY; } else if ( runType_ == sistrip::FINE_DELAY_TTC ) { type = CommissioningAnalysisDescription::T_ANALYSIS_FINEDELAY; } @@ -644,6 +663,10 @@ void SiStripPartition::update( const SiStripConfigDb* const db ) { runTableVersion_ = pedestalsV_; pedestalsV_.first = ivers->second.back().first; pedestalsV_.second = ivers->second.back().second; + } else if ( type == CommissioningAnalysisDescription::T_ANALYSIS_PEDSFULLNOISE ) { + runTableVersion_ = pedsFullNoiseV_; + pedsFullNoiseV_.first = ivers->second.back().first; + pedsFullNoiseV_.second = ivers->second.back().second; } else if ( type == CommissioningAnalysisDescription::T_ANALYSIS_APVLATENCY ) { runTableVersion_ = apvLatencyV_; apvLatencyV_.first = ivers->second.back().first; @@ -752,6 +775,7 @@ void SiStripPartition::print( std::stringstream& ss, bool using_db ) const { ss << " VPSP scan maj/min vers : " << vpspScanV_.first << "." << vpspScanV_.second << std::endl; ss << " APV calib maj/min vers : " << apvCalibV_.first << "." << apvCalibV_.second << std::endl; ss << " Pedestals maj/min vers : " << pedestalsV_.first << "." << pedestalsV_.second << std::endl; + ss << " PedsFullNoise maj/min vers : " << pedsFullNoiseV_.first << "." << pedsFullNoiseV_.second << std::endl; ss << " APV latency maj/min vers : " << apvLatencyV_.first << "." << apvLatencyV_.second << std::endl; ss << " Fine delay maj/min vers : " << fineDelayV_.first << "." << fineDelayV_.second << std::endl; @@ -765,7 +789,7 @@ void SiStripPartition::print( std::stringstream& ss, bool using_db ) const { << fastCablingV_.first << "." << fastCablingV_.second << " for this FED cabling run!" << std::endl; } - + if ( runType_ != sistrip::APV_TIMING ) { ss << " APV timing maj/min vers : " << apvTimingV_.first << "." << apvTimingV_.second << std::endl; } else { @@ -811,6 +835,15 @@ void SiStripPartition::print( std::stringstream& ss, bool using_db ) const { << " for this pedestals run!" << std::endl; } + if ( runType_ != sistrip::PEDS_FULL_NOISE ) { + ss << " PedsFullNoise maj/min vers : " << pedsFullNoiseV_.first << "." << pedsFullNoiseV_.second << std::endl; + } else { + ss << " Pedestals maj/min vers : " << runTableVersion_.first << "." << runTableVersion_.second + << " <= This \"state\" version overriden by \"history\" version " + << pedsFullNoiseV_.first << "." << pedsFullNoiseV_.second + << " for this pedestals run!" << std::endl; + } + if ( runType_ != sistrip::APV_LATENCY ) { ss << " APV latency maj/min vers : " << apvLatencyV_.first << "." << apvLatencyV_.second << std::endl; } else { From bfc31ba10c6d551ca76b1b1510b98b630ddb43de Mon Sep 17 00:00:00 2001 From: vladimir Date: Tue, 13 Mar 2018 20:53:29 +0100 Subject: [PATCH 119/426] ctpps dqm update --- DQM/CTPPS/plugins/CTPPSPixelDQMSource.cc | 68 +++++++++++++-------- DQM/CTPPS/python/ctppsPixelDQMSource_cfi.py | 3 +- 2 files changed, 46 insertions(+), 25 deletions(-) diff --git a/DQM/CTPPS/plugins/CTPPSPixelDQMSource.cc b/DQM/CTPPS/plugins/CTPPSPixelDQMSource.cc index 642b327d1fdbf..334c52b552e25 100644 --- a/DQM/CTPPS/plugins/CTPPSPixelDQMSource.cc +++ b/DQM/CTPPS/plugins/CTPPSPixelDQMSource.cc @@ -11,8 +11,6 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/Run.h" -#include "FWCore/Framework/interface/LuminosityBlock.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/InputTag.h" @@ -67,7 +65,7 @@ class CTPPSPixelDQMSource: public DQMEDAnalyzer static constexpr int NRPotBinsInStation = RPn_last-RPn_first; static constexpr int NPlaneBins = NplaneMAX*NRPotBinsInStation; - MonitorElement *hBX, *hBXshort; + MonitorElement *hBX, *hBXshort, *h2AllPlanesActive; MonitorElement *hp2HitsOcc[NArms][NStationMAX]; MonitorElement *h2HitsMultipl[NArms][NStationMAX]; @@ -95,7 +93,7 @@ class CTPPSPixelDQMSource: public DQMEDAnalyzer int ClusMultPlane[RPotsTotalNumber][NplaneMAX]; - unsigned int rpStatusWord = 0x8000; // 220 fr_hr (stn2rp3) + unsigned int rpStatusWord = 0x8008; //220_fr_hr(stn2rp3)+ 210_fr_hr int RPstatus[NStationMAX][NRPotsMAX]; // symmetric in both arms int StationStatus[NStationMAX]; // symmetric in both arms const int IndexNotValid = 0; @@ -114,6 +112,15 @@ class CTPPSPixelDQMSource: public DQMEDAnalyzer return(rc*NplaneMAX + plane); } + int getRPInStationBin(int rp) { return(rp - RPn_first +1); } + + + static constexpr int NRPglobalBins = 4; //2 arms w. 2 stations w. 1 RP + int getRPglobalBin(int arm, int stn) { + static constexpr int stationBinOrder[NStationMAX] = {0, 4, 1}; + return( arm*2 + stationBinOrder[stn] +1 ); + } + int prIndex(int rp, int plane) // plane index in station {return((rp - RPn_first)*NplaneMAX + plane);} int getDet(int id) @@ -135,7 +142,7 @@ using namespace edm; CTPPSPixelDQMSource::CTPPSPixelDQMSource(const edm::ParameterSet& ps) : verbosity(ps.getUntrackedParameter("verbosity", 0)), - rpStatusWord(ps.getUntrackedParameter("RPStatusWord",0x8000)) + rpStatusWord(ps.getUntrackedParameter("RPStatusWord",0x8008)) { tokenDigi = consumes >(ps.getParameter("tagRPixDigi")); tokenCluster=consumes>(ps.getParameter("tagRPixCluster")); @@ -183,24 +190,34 @@ edm::EventSetup const &) ibooker.cd(); ibooker.setCurrentFolder("CTPPS/TrackingPixel"); char s[50]; + string armTitleShort, stnTitleShort; hBX = ibooker.book1D("events per BX", "ctpps_pixel;Event.BX", 4002, -1.5, 4000. +0.5); hBXshort = ibooker.book1D("events per BX(short)", "ctpps_pixel;Event.BX", 102, -1.5, 100. + 0.5); + string str1st = "Pixel planes activity"; + h2AllPlanesActive = ibooker.book2DD(str1st,str1st+";Plane #", + NplaneMAX,0,NplaneMAX, NRPglobalBins, 0.5, NRPglobalBins+0.5); + TH2D *h1st = h2AllPlanesActive->getTH2D(); + h1st->SetOption("colz"); + TAxis *yah1st = h1st->GetYaxis(); + for(int arm=0; arm<2; arm++) { CTPPSDetId ID(CTPPSDetId::sdTrackingPixel,arm,0); string sd, armTitle; ID.armName(sd, CTPPSDetId::nPath); ID.armName(armTitle, CTPPSDetId::nFull); + ID.armName(armTitleShort, CTPPSDetId::nShort); ibooker.setCurrentFolder(sd); - for(int stn=2; stngetTH2D(); h->SetOption("colz"); TAxis *yah = h->GetYaxis(); @@ -252,8 +269,10 @@ edm::EventSetup const &) ID.setRP(rp); string rpd, rpTitle; CTPPSDetId(ID.getRPId()).rpName(rpTitle, CTPPSDetId::nShort); - yah->SetBinLabel(rp - RPn_first +1, rpTitle.c_str()); // h - yah2->SetBinLabel(rp - RPn_first +1, rpTitle.c_str()); //h2 + yah->SetBinLabel(getRPInStationBin(rp), rpTitle.c_str()); // h + yah2->SetBinLabel(getRPInStationBin(rp), rpTitle.c_str()); //h2 + string rpBinName = armTitleShort + "_" + stnTitleShort+"_"+rpTitle; + yah1st->SetBinLabel(getRPglobalBin(arm,stn), rpBinName.c_str()); if(RPstatus[stn][rp]==0) continue; int indexP = getRPindex(arm,stn,rp); @@ -361,21 +380,20 @@ void CTPPSPixelDQMSource::analyze(edm::Event const& event, edm::EventSetup const int lumiId = event.getLuminosityBlock().id().luminosityBlock(); if(lumiId<0) lumiId=0; - int RPactivity[NArms][NRPotsMAX], digiSize[NArms][NRPotsMAX]; - for(int arm = 0; arm <2; arm++) { - for(int rp=0; rp > pixDigi; @@ -409,14 +427,16 @@ void CTPPSPixelDQMSource::analyze(edm::Event const& event, edm::EventSetup const int arm = theId.arm()&0x1; int station = theId.station()&0x3; int rpot = theId.rp()&0x7; - RPactivity[arm][rpot] = 1; - ++digiSize[arm][rpot]; + int rpInd = getRPindex(arm,station,rpot); + RPactivity[rpInd] = 1; + ++RPdigiSize[rpInd]; if(StationStatus[station] && RPstatus[station][rpot]) { hp2HitsOcc[arm][station]->Fill(plane,rpot,(int)ds_digi.data.size()); h2HitsMultipl[arm][station]->Fill(prIndex(rpot,plane),ds_digi.data.size()); - h2PlaneActive[arm][station]->Fill(plane,rpot); + h2PlaneActive[arm][station]->Fill(plane,getRPInStationBin(rpot)); + h2AllPlanesActive->Fill(plane,getRPglobalBin(arm,station)); int index = getRPindex(arm,station,rpot); HitsMultPlane[index][plane] += ds_digi.data.size(); @@ -495,7 +515,7 @@ void CTPPSPixelDQMSource::analyze(edm::Event const& event, edm::EventSetup const for(int rp=0; rpFill(prIndex(rp,p),ClusMultPlane[index][p]); @@ -507,7 +527,7 @@ void CTPPSPixelDQMSource::analyze(edm::Event const& event, edm::EventSetup const else hRPotActivPlanes[index]->Fill(p,0.); } if(np>5) hRPotActivBX[index]->Fill(event.bunchCrossing()); - hRPotActivBXall[index]->Fill(event.bunchCrossing(),float(digiSize[arm][rp])); + hRPotActivBXall[index]->Fill(event.bunchCrossing(),float(RPdigiSize[index])); int rocf[NplaneMAX]; for(int r=0; r Date: Wed, 14 Mar 2018 10:36:41 +0100 Subject: [PATCH 120/426] Update NTSession and TBBSession for TF 1.6. --- PhysicsTools/TensorFlow/src/NTSession.cc | 24 ++++++++++++------- PhysicsTools/TensorFlow/src/NTSession.h | 29 ++++++++++++++++------- PhysicsTools/TensorFlow/src/TBBSession.cc | 24 ++++++++++++------- PhysicsTools/TensorFlow/src/TBBSession.h | 29 ++++++++++++++++------- 4 files changed, 70 insertions(+), 36 deletions(-) diff --git a/PhysicsTools/TensorFlow/src/NTSession.cc b/PhysicsTools/TensorFlow/src/NTSession.cc index 1af023f500d9b..c4a137e0365d2 100644 --- a/PhysicsTools/TensorFlow/src/NTSession.cc +++ b/PhysicsTools/TensorFlow/src/NTSession.cc @@ -18,7 +18,7 @@ limitations under the License. /* This file is an adaptation of the original direct_session.cc file located at -https://github.com/tensorflow/tensorflow/blob/v1.5.0/tensorflow/core/common_runtime/direct_session.cc +https://github.com/tensorflow/tensorflow/blob/v1.6.0/tensorflow/core/common_runtime/direct_session.cc to meet the demands of the software environment developed and used by the CMS collaboration. Changes with respect to the original code are documented in the NTSession.h header file. @@ -77,7 +77,6 @@ Changes with respect to the original code are documented in the NTSession.h head #include "tensorflow/core/util/device_name_utils.h" #include "tensorflow/core/util/env_var.h" - namespace tensorflow { namespace { @@ -248,6 +247,10 @@ NTSession::~NTSession() { for (auto d : device_mgr_->ListDevices()) { d->op_segment()->RemoveHold(session_handle_); } + for (auto d : device_mgr_->ListDevices()) { + d->ClearResourceMgr(); + } + functions_.clear(); delete cancellation_manager_; execution_state_.reset(nullptr); @@ -384,8 +387,9 @@ Status NTSession::Run(const RunOptions& run_options, args.step_id = step_id_counter_.fetch_add(1); TF_RETURN_IF_ERROR( - GetOrCreateExecutors(input_tensor_names, output_names, target_nodes, - &executors_and_keys, &run_state_args)); + GetOrCreateExecutors(input_tensor_names, output_names, + target_nodes, &executors_and_keys, + &run_state_args)); const int64 executor_step_count = executors_and_keys->step_count.fetch_add(1); std::unique_ptr debugger_state; @@ -1053,12 +1057,13 @@ Status NTSession::GetOrCreateExecutors( options.debug_options = run_state_args->debug_options; } + std::unique_ptr func_info(new FunctionInfo); std::shared_ptr ek(new ExecutorsAndKeys); // The executor_lock_ is intentionally released while executor is // being created. std::unordered_map> graphs; - TF_RETURN_IF_ERROR(CreateGraphs(options, &graphs, &ek->flib_def, + TF_RETURN_IF_ERROR(CreateGraphs(options, &graphs, &func_info->flib_def, run_state_args, &ek->input_types, &ek->output_types)); @@ -1089,9 +1094,9 @@ Status NTSession::GetOrCreateExecutors( graph_def_version = execution_state_->original_graph_def().versions().producer(); } - ek->proc_flr.reset(new ProcessFunctionLibraryRuntime( - device_mgr_.get(), options_.env, graph_def_version, ek->flib_def.get(), - optimizer_opts)); + func_info->proc_flr.reset(new ProcessFunctionLibraryRuntime( + device_mgr_.get(), options_.env, graph_def_version, + func_info->flib_def.get(), optimizer_opts)); GraphOptimizer optimizer(optimizer_opts); for (auto iter = graphs.begin(); iter != graphs.end(); ++iter) { @@ -1103,7 +1108,7 @@ Status NTSession::GetOrCreateExecutors( ek->items.resize(ek->items.size() + 1); auto* item = &(ek->items.back()); - auto lib = ek->proc_flr->GetFLR(partition_name); + auto lib = func_info->proc_flr->GetFLR(partition_name); if (lib == nullptr) { return errors::Internal("Could not find device: ", partition_name); } @@ -1199,6 +1204,7 @@ Status NTSession::GetOrCreateExecutors( // Reacquire the lock, try to insert into the map. mutex_lock l(executor_lock_); + functions_.push_back(std::move(func_info)); // Another thread may have created the entry before us, in which case we will // reuse the already created one. diff --git a/PhysicsTools/TensorFlow/src/NTSession.h b/PhysicsTools/TensorFlow/src/NTSession.h index 32e033d00e7bc..2d8329a9bea22 100644 --- a/PhysicsTools/TensorFlow/src/NTSession.h +++ b/PhysicsTools/TensorFlow/src/NTSession.h @@ -15,7 +15,7 @@ limitations under the License. /* This file is an adaptation of the original direct_session.h file located at -https://github.com/tensorflow/tensorflow/blob/v1.5.0/tensorflow/core/common_runtime/direct_session.h +https://github.com/tensorflow/tensorflow/blob/v1.6.0/tensorflow/core/common_runtime/direct_session.h to meet the demands of the software environment developed and used by the CMS collaboration. Changes: @@ -142,20 +142,12 @@ class NTSession : public Session { // a partition of the graph bundled with its dependent library runtime. // 'input_keys' are the rendezvous keys for the feeds and 'output_keys' // are rendezvous keys for the fetches. - // 'flib_def' is the function library used by graphs in 'items'. - // 'proc_flr' is the collection of FunctionLibraryRuntime objects, one per - // device. - // TODO(phawkins): currently partitions always share the same function - // library. Consider giving each partition its own function library to enable - // per-partition rewrites. struct ExecutorsAndKeys { ExecutorsAndKeys() : step_count(0) {} std::atomic_int_fast64_t step_count; std::unique_ptr graph; NameNodeMap name_to_node; - std::unique_ptr flib_def; - std::unique_ptr proc_flr; std::vector items; std::unordered_map input_name_to_index; std::unordered_map input_name_to_rendezvous_key; @@ -166,6 +158,22 @@ class NTSession : public Session { DataTypeVector output_types; }; + // A FunctionInfo object is created for every unique set of feeds/fetches. + // This info could be folded into the ExecutorsAndKeys object but we would + // like to maintain a deletion order in which the OpKernels (owned by the + // executor) should be destroyed first, followed by the resources in the + // device and then followed by the function stuff. + // TODO(rohanj): Consolidate function library definitions so that we can + // instantiate only one ProcFLR and lib_def and make this just a member + // variable and not a vector. + // 'flib_def' is the function library used. + // 'proc_flr' is the collection of FunctionLibraryRuntime objects, one per + // device. + struct FunctionInfo { + std::unique_ptr flib_def; + std::unique_ptr proc_flr; + }; + // For each live partial execution, the session maintains a RunState. // 'status' is the current status of this partial execution. 'executor_done' // is "notified" when all executors are done. 'pending_inputs' are the set @@ -295,6 +303,9 @@ class NTSession : public Session { bool sync_on_finish_ = true; void SchedClosure(std::function c); + std::vector> functions_ + GUARDED_BY(executor_lock_); + mutex executor_lock_; // protects executors_ // Holds mappings from signature to the executors that process // it. The reason for a level of indirection around mapped_type is diff --git a/PhysicsTools/TensorFlow/src/TBBSession.cc b/PhysicsTools/TensorFlow/src/TBBSession.cc index 71350c19c536e..3deb6164bebd2 100644 --- a/PhysicsTools/TensorFlow/src/TBBSession.cc +++ b/PhysicsTools/TensorFlow/src/TBBSession.cc @@ -18,7 +18,7 @@ limitations under the License. /* This file is an adaptation of the original direct_session.cc file located at -https://github.com/tensorflow/tensorflow/blob/v1.5.0/tensorflow/core/common_runtime/direct_session.cc +https://github.com/tensorflow/tensorflow/blob/v1.6.0/tensorflow/core/common_runtime/direct_session.cc to meet the demands of the software environment developed and used by the CMS collaboration. Changes with respect to the original code are documented in the TBBSession.h header file. @@ -79,7 +79,6 @@ Changes with respect to the original code are documented in the TBBSession.h hea #include "tensorflow/core/util/device_name_utils.h" #include "tensorflow/core/util/env_var.h" - namespace tensorflow { namespace { @@ -249,6 +248,10 @@ TBBSession::~TBBSession() { for (auto d : device_mgr_->ListDevices()) { d->op_segment()->RemoveHold(session_handle_); } + for (auto d : device_mgr_->ListDevices()) { + d->ClearResourceMgr(); + } + functions_.clear(); delete cancellation_manager_; execution_state_.reset(nullptr); @@ -385,8 +388,9 @@ Status TBBSession::Run(const RunOptions& run_options, args.step_id = step_id_counter_.fetch_add(1); TF_RETURN_IF_ERROR( - GetOrCreateExecutors(input_tensor_names, output_names, target_nodes, - &executors_and_keys, &run_state_args)); + GetOrCreateExecutors(input_tensor_names, output_names, + target_nodes, &executors_and_keys, + &run_state_args)); const int64 executor_step_count = executors_and_keys->step_count.fetch_add(1); std::unique_ptr debugger_state; @@ -741,12 +745,13 @@ Status TBBSession::GetOrCreateExecutors( options.debug_options = run_state_args->debug_options; } + std::unique_ptr func_info(new FunctionInfo); std::shared_ptr ek(new ExecutorsAndKeys); // The executor_lock_ is intentionally released while executor is // being created. std::unordered_map> graphs; - TF_RETURN_IF_ERROR(CreateGraphs(options, &graphs, &ek->flib_def, + TF_RETURN_IF_ERROR(CreateGraphs(options, &graphs, &func_info->flib_def, run_state_args, &ek->input_types, &ek->output_types)); @@ -777,9 +782,9 @@ Status TBBSession::GetOrCreateExecutors( graph_def_version = execution_state_->original_graph_def().versions().producer(); } - ek->proc_flr.reset(new ProcessFunctionLibraryRuntime( - device_mgr_.get(), options_.env, graph_def_version, ek->flib_def.get(), - optimizer_opts)); + func_info->proc_flr.reset(new ProcessFunctionLibraryRuntime( + device_mgr_.get(), options_.env, graph_def_version, + func_info->flib_def.get(), optimizer_opts)); GraphOptimizer optimizer(optimizer_opts); for (auto iter = graphs.begin(); iter != graphs.end(); ++iter) { @@ -791,7 +796,7 @@ Status TBBSession::GetOrCreateExecutors( ek->items.resize(ek->items.size() + 1); auto* item = &(ek->items.back()); - auto lib = ek->proc_flr->GetFLR(partition_name); + auto lib = func_info->proc_flr->GetFLR(partition_name); if (lib == nullptr) { return errors::Internal("Could not find device: ", partition_name); } @@ -887,6 +892,7 @@ Status TBBSession::GetOrCreateExecutors( // Reacquire the lock, try to insert into the map. mutex_lock l(executor_lock_); + functions_.push_back(std::move(func_info)); // Another thread may have created the entry before us, in which case we will // reuse the already created one. diff --git a/PhysicsTools/TensorFlow/src/TBBSession.h b/PhysicsTools/TensorFlow/src/TBBSession.h index e009c7daa073e..5329663287643 100644 --- a/PhysicsTools/TensorFlow/src/TBBSession.h +++ b/PhysicsTools/TensorFlow/src/TBBSession.h @@ -15,7 +15,7 @@ limitations under the License. /* This file is an adaptation of the original direct_session.h file located at -https://github.com/tensorflow/tensorflow/blob/v1.5.0/tensorflow/core/common_runtime/direct_session.h +https://github.com/tensorflow/tensorflow/blob/v1.6.0/tensorflow/core/common_runtime/direct_session.h to meet the demands of the software environment developed and used by the CMS collaboration. Changes: @@ -142,20 +142,12 @@ class TBBSession : public Session { // a partition of the graph bundled with its dependent library runtime. // 'input_keys' are the rendezvous keys for the feeds and 'output_keys' // are rendezvous keys for the fetches. - // 'flib_def' is the function library used by graphs in 'items'. - // 'proc_flr' is the collection of FunctionLibraryRuntime objects, one per - // device. - // TODO(phawkins): currently partitions always share the same function - // library. Consider giving each partition its own function library to enable - // per-partition rewrites. struct ExecutorsAndKeys { ExecutorsAndKeys() : step_count(0) {} std::atomic_int_fast64_t step_count; std::unique_ptr graph; NameNodeMap name_to_node; - std::unique_ptr flib_def; - std::unique_ptr proc_flr; std::vector items; std::unordered_map input_name_to_index; std::unordered_map input_name_to_rendezvous_key; @@ -166,6 +158,22 @@ class TBBSession : public Session { DataTypeVector output_types; }; + // A FunctionInfo object is created for every unique set of feeds/fetches. + // This info could be folded into the ExecutorsAndKeys object but we would + // like to maintain a deletion order in which the OpKernels (owned by the + // executor) should be destroyed first, followed by the resources in the + // device and then followed by the function stuff. + // TODO(rohanj): Consolidate function library definitions so that we can + // instantiate only one ProcFLR and lib_def and make this just a member + // variable and not a vector. + // 'flib_def' is the function library used. + // 'proc_flr' is the collection of FunctionLibraryRuntime objects, one per + // device. + struct FunctionInfo { + std::unique_ptr flib_def; + std::unique_ptr proc_flr; + }; + // For each live partial execution, the session maintains a RunState. // 'status' is the current status of this partial execution. 'executor_done' // is "notified" when all executors are done. 'pending_inputs' are the set @@ -275,6 +283,9 @@ class TBBSession : public Session { bool sync_on_finish_ = true; void SchedClosure(tbb::task_arena& arena, tbb::task_group& g, std::function c); + std::vector> functions_ + GUARDED_BY(executor_lock_); + mutex executor_lock_; // protects executors_ // Holds mappings from signature to the executors that process // it. The reason for a level of indirection around mapped_type is From c02a24b294ae24e298e734b6805e29084d3ddbad Mon Sep 17 00:00:00 2001 From: David Date: Wed, 14 Mar 2018 13:50:23 +0100 Subject: [PATCH 121/426] Fix order of subdets in comment --- DQM/HcalTasks/python/DigiTask.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DQM/HcalTasks/python/DigiTask.py b/DQM/HcalTasks/python/DigiTask.py index 9005382ad6585..64da293db57bc 100644 --- a/DQM/HcalTasks/python/DigiTask.py +++ b/DQM/HcalTasks/python/DigiTask.py @@ -29,7 +29,7 @@ qie10InConditions = cms.untracked.bool(False), # Reference digi sizes - refDigiSize = cms.untracked.vuint32(10, 10, 10, 4), # HB, HE, HF, HO + refDigiSize = cms.untracked.vuint32(10, 10, 10, 4), # HB, HE, HO, HF ) from Configuration.Eras.Modifier_run2_HF_2017_cff import run2_HF_2017 From 8b0ab5c5e70c53386c5496a25f9f7e6335743e8a Mon Sep 17 00:00:00 2001 From: Marco Rovere Date: Wed, 14 Mar 2018 16:25:29 +0100 Subject: [PATCH 122/426] Implement Review comments 1 --- .../Debugging/plugins/CaloParticleDebugger.cc | 28 +++++----- .../plugins/CaloParticleValidation.cc | 56 ++++++++++--------- 2 files changed, 44 insertions(+), 40 deletions(-) diff --git a/SimGeneral/Debugging/plugins/CaloParticleDebugger.cc b/SimGeneral/Debugging/plugins/CaloParticleDebugger.cc index e1192eba24393..5e970a1070e3b 100644 --- a/SimGeneral/Debugging/plugins/CaloParticleDebugger.cc +++ b/SimGeneral/Debugging/plugins/CaloParticleDebugger.cc @@ -137,7 +137,7 @@ CaloParticleDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& i sort(begin(sorted_tracks_idx), end(sorted_tracks_idx), [&tracks] (int i, int j) { - return tracks.at(i).momentum().eta() < tracks.at(j).momentum().eta(); + return tracks[i].momentum().eta() < tracks[j].momentum().eta(); }); iEvent.getByToken(genParticlesToken_, genParticlesH); @@ -146,7 +146,7 @@ CaloParticleDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& i iota(begin(sorted_genParticles_idx), end(sorted_genParticles_idx), 0); sort(begin(sorted_genParticles_idx), end(sorted_genParticles_idx), [&genParticles](int i, int j) { - return genParticles.at(i).momentum().eta() < genParticles.at(j).momentum().eta();}); + return genParticles[i].momentum().eta() < genParticles[j].momentum().eta();}); iEvent.getByToken(simVerticesToken_, simVerticesH); auto const & vertices = *simVerticesH.product(); @@ -154,7 +154,7 @@ CaloParticleDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& i iota(begin(sorted_vertices_idx), end(sorted_vertices_idx), 0); sort(begin(sorted_vertices_idx), end(sorted_vertices_idx), [&vertices](int i, int j){ - return vertices.at(i).vertexId() < vertices.at(j).vertexId(); + return vertices[i].vertexId() < vertices[j].vertexId(); }); iEvent.getByToken(trackingParticlesToken_, trackingParticlesH); @@ -163,7 +163,7 @@ CaloParticleDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& i iota(begin(sorted_tp_idx), end(sorted_tp_idx), 0); sort(begin(sorted_tp_idx), end(sorted_tp_idx), [&trackingpart] (int i, int j){ - return trackingpart.at(i).eta() < trackingpart.at(j).eta(); + return trackingpart[i].eta() < trackingpart[j].eta(); }); iEvent.getByToken(caloParticlesToken_, caloParticlesH); @@ -173,7 +173,7 @@ CaloParticleDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& i end(sorted_cp_idx), 0); sort(begin(sorted_cp_idx), end(sorted_cp_idx), [&calopart](int i, int j){ - return calopart.at(i).eta() < calopart.at(j).eta();}); + return calopart[i].eta() < calopart[j].eta();}); iEvent.getByToken(simClustersToken_, simClustersH); auto const & simclusters = *simClustersH.product(); @@ -182,7 +182,7 @@ CaloParticleDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& i end(sorted_simcl_idx), 0); sort(begin(sorted_simcl_idx), end(sorted_simcl_idx), [&simclusters](int i, int j){ - return simclusters.at(i).eta() < simclusters.at(j).eta();}); + return simclusters[i].eta() < simclusters[j].eta();}); // Let's first fill in hits information std::map detIdToTotalSimEnergy; @@ -194,7 +194,7 @@ CaloParticleDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& i std::cout << "Printing SimTracks information" << std::endl; std::cout << "IDX\tTrackId\tPDGID\tMOMENTUM(x,y,z,E)\tVertexIdx\tGenPartIdx" << std::endl; for (auto i : sorted_tracks_idx) { - auto const & t = tracks.at(i); + auto const & t = tracks[i]; std::cout << idx << "\t" << t.trackId() << "\t" << t << std::endl; trackid_to_track_index[t.trackId()] = idx; idx++; @@ -203,7 +203,7 @@ CaloParticleDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& i std::cout << "Printing GenParticles information" << std::endl; std::cout << "IDX\tPDGID\tMOMENTUM(x,y,z)\tVertex(x,y,z)" << std::endl; for (auto i : sorted_genParticles_idx) { - auto const & gp = genParticles.at(i); + auto const & gp = genParticles[i]; std::cout << i << "\t" << gp.pdgId() << "\t" << gp.momentum() @@ -213,19 +213,19 @@ CaloParticleDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& i std::cout << "Printing SimVertex information" << std::endl; std::cout << "IDX\tPOSITION(x,y,z)\tPARENT_INDEX\tVERTEX_ID" << std::endl; for (auto i : sorted_vertices_idx) { - auto const & v = vertices.at(i); + auto const & v = vertices[i]; std::cout << i << "\t" << v << std::endl; } std::cout << "Printing TrackingParticles information" << std::endl; for (auto i : sorted_tp_idx) { - auto const & tp = trackingpart.at(i); + auto const & tp = trackingpart[i]; std::cout << i << "\t" << tp << std::endl; } std::cout << "Printing CaloParticles information" << std::endl; idx = 0; for (auto i : sorted_cp_idx) { - auto const & cp = calopart.at(i); + auto const & cp = calopart[i]; std::cout << "\n\n" << idx++ << " |Eta|: " << std::abs(cp.momentum().eta()) << "\tType: " << cp.pdgId() << "\tEnergy: " << cp.energy() @@ -240,10 +240,10 @@ CaloParticleDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& i sort(begin(sorted_sc_idx), end(sorted_sc_idx), [&simcs] (int i, int j) { - return simcs.at(i)->momentum().eta() < simcs.at(j)->momentum().eta(); + return simcs[i]->momentum().eta() < simcs[j]->momentum().eta(); }); for (auto i : sorted_sc_idx) { - std::cout << *(simcs.at(i)); + std::cout << *(simcs[i]); } for (auto const & sc : cp.simClusters()) { @@ -259,7 +259,7 @@ CaloParticleDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& i idx = 0; std::cout << "Printing SimClusters information" << std::endl; for (auto i : sorted_simcl_idx) { - auto const & simcl = simclusters.at(i); + auto const & simcl = simclusters[i]; std::cout << "\n\n" << idx++ << " |Eta|: " << std::abs(simcl.momentum().eta()) << "\tType: " << simcl.pdgId() << "\tEnergy: " << simcl.energy() diff --git a/Validation/HGCalValidation/plugins/CaloParticleValidation.cc b/Validation/HGCalValidation/plugins/CaloParticleValidation.cc index dd0020d41b2ed..e7e83e614884f 100644 --- a/Validation/HGCalValidation/plugins/CaloParticleValidation.cc +++ b/Validation/HGCalValidation/plugins/CaloParticleValidation.cc @@ -169,12 +169,13 @@ CaloParticleValidation::dqmAnalyze(edm::Event const& iEvent, edm::EventSetup con for (auto const caloParticle : caloParticles) { int id = caloParticle.pdgId(); if (histos.count(id)) { - histos.at(id).eta_.fill(caloParticle.eta()); - histos.at(id).pt_.fill(caloParticle.pt()); - histos.at(id).energy_.fill(caloParticle.energy()); - histos.at(id).nSimClusters_.fill(caloParticle.simClusters().size()); + auto & histo = histos.at(id); + histo.eta_.fill(caloParticle.eta()); + histo.pt_.fill(caloParticle.pt()); + histo.energy_.fill(caloParticle.energy()); + histo.nSimClusters_.fill(caloParticle.simClusters().size()); // Find the corresponding vertex. - histos.at(id).eta_Zorigin_map_.fill( + histo.eta_Zorigin_map_.fill( simVertices.at(caloParticle.g4Tracks()[0].vertIndex()).position().z(), caloParticle.eta()); int simHits = 0; float energy = 0.; @@ -185,9 +186,9 @@ CaloParticleValidation::dqmAnalyze(edm::Event const& iEvent, edm::EventSetup con energy += hitmap[h_and_f.first]->energy() * h_and_f.second; } } - histos.at(id).nHitInSimClusters_.fill((float)simHits); - histos.at(id).selfEnergy_.fill(energy); - histos.at(id).energyDifference_.fill(1.- energy/caloParticle.energy()); + histo.nHitInSimClusters_.fill((float)simHits); + histo.selfEnergy_.fill(energy); + histo.energyDifference_.fill(1.- energy/caloParticle.energy()); } } @@ -202,11 +203,12 @@ CaloParticleValidation::dqmAnalyze(edm::Event const& iEvent, edm::EventSetup con for (auto const pfc : simPFCandidates) { size_t type = offset + pfc.particleId(); histos.at(offset).pfcandidateType_.fill(type - offset); - histos.at(type).pfcandidateEnergy_.fill(pfc.energy()); - histos.at(type).pfcandidatePt_.fill(pfc.pt()); - histos.at(type).pfcandidateEta_.fill(pfc.eta()); - histos.at(type).pfcandidatePhi_.fill(pfc.phi()); - histos.at(type).pfcandidateElementsInBlocks_.fill(pfc.elementsInBlocks().size()); + auto & histo = histos.at(type); + histo.pfcandidateEnergy_.fill(pfc.energy()); + histo.pfcandidatePt_.fill(pfc.pt()); + histo.pfcandidateEta_.fill(pfc.eta()); + histo.pfcandidatePhi_.fill(pfc.phi()); + histo.pfcandidateElementsInBlocks_.fill(pfc.elementsInBlocks().size()); } } @@ -219,25 +221,27 @@ CaloParticleValidation::bookHistograms(DQMStore::ConcurrentBooker & ibook, { for (auto const particle : particles_to_monitor_) { ibook.setCurrentFolder(folder_ + "CaloParticles/" + std::to_string(particle)); - histos[particle].eta_ = ibook.book1D("Eta", "Eta", 80, -4., 4.); - histos[particle].energy_ = ibook.book1D("Energy", "Energy", 250, 0., 500.); - histos[particle].pt_ = ibook.book1D("Pt", "Pt", 100, 0., 100.); - histos[particle].nSimClusters_ = ibook.book1D("NSimClusters", "NSimClusters", 100, 0., 100.); - histos[particle].nHitInSimClusters_ = ibook.book1D("NHitInSimClusters", "NHitInSimClusters", 100, 0., 100.); - histos[particle].selfEnergy_ = ibook.book1D("SelfEnergy", "SelfEnergy", 250, 0., 500.); - histos[particle].energyDifference_ = ibook.book1D("EnergyDifference", "(Energy-SelfEnergy)/Energy", 300, -5., 1.); - histos[particle].eta_Zorigin_map_ = ibook.book2D("Eta vs Zorigin", "Eta vs Zorigin", 80, -4., 4., 1100, -550., 550.); + auto & histo = histos[particle]; + histo.eta_ = ibook.book1D("Eta", "Eta", 80, -4., 4.); + histo.energy_ = ibook.book1D("Energy", "Energy", 250, 0., 500.); + histo.pt_ = ibook.book1D("Pt", "Pt", 100, 0., 100.); + histo.nSimClusters_ = ibook.book1D("NSimClusters", "NSimClusters", 100, 0., 100.); + histo.nHitInSimClusters_ = ibook.book1D("NHitInSimClusters", "NHitInSimClusters", 100, 0., 100.); + histo.selfEnergy_ = ibook.book1D("SelfEnergy", "SelfEnergy", 250, 0., 500.); + histo.energyDifference_ = ibook.book1D("EnergyDifference", "(Energy-SelfEnergy)/Energy", 300, -5., 1.); + histo.eta_Zorigin_map_ = ibook.book2D("Eta vs Zorigin", "Eta vs Zorigin", 80, -4., 4., 1100, -550., 550.); } int offset = 100000; ibook.setCurrentFolder(folder_ + "PFCandidates"); histos[offset].pfcandidateType_ = ibook.book1D("PFCandidateType", "PFCandidateType", 10, 0, 10); for (size_t type = reco::PFCandidate::h; type <= reco::PFCandidate::egamma_HF; type++) { ibook.setCurrentFolder(folder_ + "PFCandidates/" + std::to_string(type)); - histos[offset + type].pfcandidateEnergy_ = ibook.book1D("PFCandidateEnergy", "PFCandidateEnergy", 250, 0., 250.); - histos[offset + type].pfcandidatePt_ = ibook.book1D("PFCandidatePt", "PFCandidatePt", 250, 0., 250.); - histos[offset + type].pfcandidateEta_ = ibook.book1D("PFCandidateEta", "PFCandidateEta", 100, -5., 5.); - histos[offset + type].pfcandidatePhi_ = ibook.book1D("PFCandidatePhi", "PFCandidatePhi", 100, -4., 4.); - histos[offset + type].pfcandidateElementsInBlocks_ = ibook.book1D("PFCandidateElements", "PFCandidateElements", 20, 0., 20.); + auto & histo = histos[offset + type]; + histo.pfcandidateEnergy_ = ibook.book1D("PFCandidateEnergy", "PFCandidateEnergy", 250, 0., 250.); + histo.pfcandidatePt_ = ibook.book1D("PFCandidatePt", "PFCandidatePt", 250, 0., 250.); + histo.pfcandidateEta_ = ibook.book1D("PFCandidateEta", "PFCandidateEta", 100, -5., 5.); + histo.pfcandidatePhi_ = ibook.book1D("PFCandidatePhi", "PFCandidatePhi", 100, -4., 4.); + histo.pfcandidateElementsInBlocks_ = ibook.book1D("PFCandidateElements", "PFCandidateElements", 20, 0., 20.); } // Folder '0' is meant to be cumulative, with no connection to pdgId ibook.setCurrentFolder(folder_ + std::to_string(0)); From 795f49825b7cb26557cb861443c0dcfb16239dd2 Mon Sep 17 00:00:00 2001 From: Kyle Knoepfel Date: Wed, 14 Mar 2018 09:55:07 -0500 Subject: [PATCH 123/426] C++ cleanups. - Use default-value initialization; changing to this pattern exposed an uninitialized data member (forceResetOnBeginLumi_) in one of the constructors. - Use range-based for loops. - More use of auto type deduction. - Switch to use of anonymous namespace instead of statically declared variables and functions. - Delete copy c'tor/assignment operator instead of declaring them as private. - Replace unnecessary post-increments with more efficient pre-increments. --- DQMServices/Core/interface/DQMStore.h | 30 +-- DQMServices/Core/src/DQMStore.cc | 302 +++++++++++--------------- 2 files changed, 145 insertions(+), 187 deletions(-) diff --git a/DQMServices/Core/interface/DQMStore.h b/DQMServices/Core/interface/DQMStore.h index 021ccc4a30275..611b6cca8b003 100644 --- a/DQMServices/Core/interface/DQMStore.h +++ b/DQMServices/Core/interface/DQMStore.h @@ -791,8 +791,8 @@ class DQMStore void print_trace(const std::string &dir, const std::string &name); // ----------------------- Unavailable --------------------------------------- - DQMStore(const DQMStore&); - const DQMStore& operator=(const DQMStore&); + DQMStore(DQMStore const&) = delete; + DQMStore& operator=(DQMStore const&) = delete; //------------------------------------------------------------------------------- //------------------------------------------------------------------------------- @@ -828,20 +828,20 @@ class DQMStore TFile & file, unsigned int & counter); - unsigned verbose_; - unsigned verboseQT_; - bool reset_; + unsigned verbose_{1}; + unsigned verboseQT_{1}; + bool reset_{false}; double scaleFlag_; - bool collateHistograms_; - bool enableMultiThread_; + bool collateHistograms_{false}; + bool enableMultiThread_{false}; bool LSbasedMode_; - bool forceResetOnBeginLumi_; - std::string readSelectedDirectory_; - uint32_t run_; - uint32_t moduleId_; - std::ofstream * stream_; + bool forceResetOnBeginLumi_{false}; + std::string readSelectedDirectory_{}; + uint32_t run_{}; + uint32_t moduleId_{}; + std::ofstream * stream_{nullptr}; - std::string pwd_; + std::string pwd_{}; MEMap data_; std::set dirs_; @@ -850,8 +850,8 @@ class DQMStore QTestSpecs qtestspecs_; std::mutex book_mutex_; - IBooker * ibooker_; - IGetter * igetter_; + IBooker * ibooker_{nullptr}; + IGetter * igetter_{nullptr}; friend class edm::DQMHttpSource; friend class DQMService; diff --git a/DQMServices/Core/src/DQMStore.cc b/DQMServices/Core/src/DQMStore.cc index 3c874633cdbaf..1974ab63e3ed4 100644 --- a/DQMServices/Core/src/DQMStore.cc +++ b/DQMServices/Core/src/DQMStore.cc @@ -52,83 +52,86 @@ DQMOldReceiver::runQualityTests. */ /** @var DQMStore::qalgos_ Set of all the available quality test algorithms. */ -////////////////////////////////////////////////////////////////////// -/// name of global monitoring folder (containing all sources subdirectories) -static const std::string s_monitorDirName = "DQMData"; -static const std::string s_referenceDirName = "Reference"; -static const std::string s_collateDirName = "Collate"; -static const std::string s_safe = "/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+=_()# "; - -static const lat::Regexp s_rxmeval ("^<(.*)>(i|f|s|e|t|qr)=(.*)$"); -static const lat::Regexp s_rxmeqr1 ("^st:(\\d+):([-+e.\\d]+):([^:]*):(.*)$"); -static const lat::Regexp s_rxmeqr2 ("^st\\.(\\d+)\\.(.*)$"); -static const lat::Regexp s_rxtrace ("(.*)\\((.*)\\+0x.*\\).*"); -static const lat::Regexp s_rxself ("^[^()]*DQMStore::.*"); -static const lat::Regexp s_rxpbfile (".*\\.pb$"); - -////////////////////////////////////////////////////////////////////// -/// Check whether the @a path is a subdirectory of @a ofdir. Returns -/// true both for an exact match and any nested subdirectory. -static bool -isSubdirectory(const std::string &ofdir, const std::string &path) -{ - return (ofdir.empty() - || (path.size() >= ofdir.size() - && path.compare(0, ofdir.size(), ofdir) == 0 - && (path.size() == ofdir.size() - || path[ofdir.size()] == '/'))); -} - -static void -cleanTrailingSlashes(const std::string &path, std::string &clean, const std::string *&cleaned) -{ - clean.clear(); - cleaned = &path; +namespace { + + ////////////////////////////////////////////////////////////////////// + /// name of global monitoring folder (containing all sources subdirectories) + const std::string s_monitorDirName = "DQMData"; + const std::string s_referenceDirName = "Reference"; + const std::string s_collateDirName = "Collate"; + const std::string s_safe = "/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+=_()# "; + + const lat::Regexp s_rxmeval ("^<(.*)>(i|f|s|e|t|qr)=(.*)$"); + const lat::Regexp s_rxmeqr1 ("^st:(\\d+):([-+e.\\d]+):([^:]*):(.*)$"); + const lat::Regexp s_rxmeqr2 ("^st\\.(\\d+)\\.(.*)$"); + const lat::Regexp s_rxtrace ("(.*)\\((.*)\\+0x.*\\).*"); + const lat::Regexp s_rxself ("^[^()]*DQMStore::.*"); + const lat::Regexp s_rxpbfile (".*\\.pb$"); + + ////////////////////////////////////////////////////////////////////// + /// Check whether the @a path is a subdirectory of @a ofdir. Returns + /// true both for an exact match and any nested subdirectory. + bool + isSubdirectory(const std::string &ofdir, const std::string &path) + { + return (ofdir.empty() + || (path.size() >= ofdir.size() + && path.compare(0, ofdir.size(), ofdir) == 0 + && (path.size() == ofdir.size() + || path[ofdir.size()] == '/'))); + } + + void + cleanTrailingSlashes(const std::string &path, std::string &clean, const std::string *&cleaned) + { + clean.clear(); + cleaned = &path; + + size_t len = path.size(); + for ( ; len > 0 && path[len-1] == '/'; --len) + ; - size_t len = path.size(); - for ( ; len > 0 && path[len-1] == '/'; --len) - ; + if (len != path.size()) + { + clean = path.substr(0, len); + cleaned = &clean; + } + } - if (len != path.size()) + void + splitPath(std::string &dir, std::string &name, const std::string &path) { - clean = path.substr(0, len); - cleaned = &clean; + size_t slash = path.rfind('/'); + if (slash != std::string::npos) + { + dir.append(path, 0, slash); + name.append(path, slash+1, std::string::npos); + } + else + name = path; } -} -static void -splitPath(std::string &dir, std::string &name, const std::string &path) -{ - size_t slash = path.rfind('/'); - if (slash != std::string::npos) + void + mergePath(std::string &path, const std::string &dir, const std::string &name) { - dir.append(path, 0, slash); - name.append(path, slash+1, std::string::npos); + path.reserve(dir.size() + name.size() + 2); + path += dir; + if (! path.empty()) + path += '/'; + path += name; } - else - name = path; -} -static void -mergePath(std::string &path, const std::string &dir, const std::string &name) -{ - path.reserve(dir.size() + name.size() + 2); - path += dir; - if (! path.empty()) - path += '/'; - path += name; -} + template + QCriterion * + makeQCriterion(const std::string &qtname) + { return new T(qtname); } -template -QCriterion * -makeQCriterion(const std::string &qtname) -{ return new T(qtname); } - -template -void -initQCriterion(std::map &m) -{ m[T::getAlgoName()] = &makeQCriterion; } + template + void + initQCriterion(std::map &m) + { m[T::getAlgoName()] = &makeQCriterion; } +} // anonymous namespace ///////////////////////////////////////////////////////////// fastmatch::fastmatch (std::string _fastString) : @@ -155,7 +158,7 @@ fastmatch::fastmatch (std::string _fastString) : pos = fastString_.find('*', pos + 1 ); if ((size_t)pos == std::string::npos) break; - starCount ++; + ++starCount; } // investigate for heuristics @@ -216,10 +219,10 @@ bool fastmatch::compare_strings_reverse(std::string const& pattern, // compare the two strings character by character for equalness: // this does not create uneeded copies of std::string. The // boost::algorithm implementation does - std::string::const_reverse_iterator rit_pattern = pattern.rbegin(); - std::string::const_reverse_iterator rit_input = input.rbegin(); + auto rit_pattern = pattern.crbegin(); + auto rit_input = input.crbegin(); - for (; rit_pattern < pattern.rend(); rit_pattern++, rit_input++) + for (; rit_pattern < pattern.rend(); ++rit_pattern, ++rit_input) { if (*rit_pattern != *rit_input) // found a difference, fail @@ -237,10 +240,10 @@ bool fastmatch::compare_strings(std::string const& pattern, // compare the two strings character by character for equalness: // this does not create uneeded copies of std::string. The // boost::algorithm implementation does. - std::string::const_iterator rit_pattern = pattern.begin(); - std::string::const_iterator rit_input = input.begin(); + auto rit_pattern = pattern.cbegin(); + auto rit_input = input.cbegin(); - for (; rit_pattern < pattern.end(); rit_pattern++, rit_input++) + for (; rit_pattern < pattern.end(); ++rit_pattern, ++rit_input) { if (*rit_pattern != *rit_input) // found a difference, fail @@ -299,8 +302,8 @@ void DQMStore::IBooker::tagContents(const std::string &path, unsigned int myTag) //IGetter methods std::vector DQMStore::IGetter::getAllContents(const std::string &path, - uint32_t run /* = 0 */, - uint32_t lumi /* = 0 */) { + uint32_t run /* = 0 */, + uint32_t lumi /* = 0 */) { return owner_->getAllContents(path, run, lumi); } @@ -352,19 +355,6 @@ void DQMStore::IGetter::setCurrentFolder(const std::string &fullpath) { ////////////////////////////////////////////////////////////////////// DQMStore::DQMStore(const edm::ParameterSet &pset, edm::ActivityRegistry& ar) - : verbose_ (1), - verboseQT_ (1), - reset_ (false), - collateHistograms_ (false), - enableMultiThread_(false), - forceResetOnBeginLumi_(false), - readSelectedDirectory_ (""), - run_(0), - moduleId_(0), - stream_(nullptr), - pwd_ (""), - ibooker_(nullptr), - igetter_(nullptr) { if (!ibooker_) ibooker_ = new DQMStore::IBooker(this); @@ -374,7 +364,7 @@ DQMStore::DQMStore(const edm::ParameterSet &pset, edm::ActivityRegistry& ar) ar.preallocateSignal_.connect([this](edm::service::SystemBounds const& iBounds) { if(iBounds.maxNumberOfStreams() > 1 ) { - enableMultiThread_ = true; + enableMultiThread_ = true; } }); if(pset.getUntrackedParameter("forceResetOnBeginRun",false)) { @@ -388,18 +378,6 @@ DQMStore::DQMStore(const edm::ParameterSet &pset, edm::ActivityRegistry& ar) } DQMStore::DQMStore(const edm::ParameterSet &pset) - : verbose_ (1), - verboseQT_ (1), - reset_ (false), - collateHistograms_ (false), - enableMultiThread_(false), - readSelectedDirectory_ (""), - run_(0), - moduleId_(0), - stream_(nullptr), - pwd_ (""), - ibooker_(nullptr), - igetter_(nullptr) { if (!ibooker_) ibooker_ = new DQMStore::IBooker(this); @@ -504,7 +482,7 @@ DQMStore::print_trace (const std::string &dir, const std::string &name) size_t level = 1; char * demangled = nullptr; - for (; level < size; level++) { + for (; level < size; ++level) { if (!s_rxtrace.match(strings[level], 0, 0, &m)) continue; demangled = abi::__cxa_demangle(m.matchString(strings[level], 2).c_str(), nullptr, nullptr, &r); if (!demangled) continue; @@ -531,7 +509,7 @@ DQMStore::print_trace (const std::string &dir, const std::string &name) size_t i; m.reset(); - for (i = 0; i < size; i++) + for (i = 0; i < size; ++i) if (s_rxtrace.match(strings[i], 0, 0, &m)) { char * demangled = abi::__cxa_demangle(m.matchString(strings[i], 2).c_str(), nullptr, nullptr, &r); @@ -702,12 +680,10 @@ DQMStore::book_(const std::string &dir, const std::string &name, .initialise((MonitorElement::Kind)kind, h); // Initialise quality test information. - auto qi = qtestspecs_.begin(); - auto qe = qtestspecs_.end(); - for ( ; qi != qe; ++qi) + for (auto const& q : qtestspecs_) { - if ( qi->first->match(path) ) - me->addQReport(qi->second); + if (q.first->match(path)) + me->addQReport(q.second); } // If we just booked a (plain) MonitorElement, and there is a reference @@ -1455,10 +1431,10 @@ DQMStore::checkBinningMatches(MonitorElement *me, TH1 *h, unsigned verbose) { if(verbose > 0) std::cout << "*** DQMStore: WARNING:" - << "checkBinningMatches: different binning - cannot add object '" - << h->GetName() << "' of type " - << h->IsA()->GetName() << " to existing ME: '" - << me->getFullname() << "'\n"; + << "checkBinningMatches: different binning - cannot add object '" + << h->GetName() << "' of type " + << h->IsA()->GetName() << " to existing ME: '" + << me->getFullname() << "'\n"; return false; } return true; @@ -1729,17 +1705,15 @@ DQMStore::getContents(std::vector &into, bool showContents /* = tru into.reserve(dirs_.size()); auto me = data_.end(); - auto di = dirs_.begin(); - auto de = dirs_.end(); - for ( ; di != de; ++di) + for (auto const& dir : dirs_) { - MonitorElement proto(&*di, std::string()); + MonitorElement proto(&dir, std::string()); auto mi = data_.lower_bound(proto); auto m = mi; - size_t sz = di->size() + 2; + size_t sz = dir.size() + 2; size_t nfound = 0; - for ( ; m != me && isSubdirectory(*di, *m->data_.dirname); ++m) - if (*di == *m->data_.dirname) + for ( ; m != me && isSubdirectory(dir, *m->data_.dirname); ++m) + if (dir == *m->data_.dirname) { sz += m->data_.objname.size() + 1; ++nfound; @@ -1755,11 +1729,11 @@ DQMStore::getContents(std::vector &into, bool showContents /* = tru { istr->reserve(sz); - *istr += *di; + *istr += dir; *istr += ':'; for (sz = 0; mi != m; ++mi) { - if (*di != *mi->data_.dirname) + if (dir != *mi->data_.dirname) continue; if (sz > 0) @@ -1771,8 +1745,8 @@ DQMStore::getContents(std::vector &into, bool showContents /* = tru } else { - istr->reserve(di->size() + 2); - *istr += *di; + istr->reserve(dir.size() + 2); + *istr += dir; *istr += ':'; } } @@ -1872,14 +1846,12 @@ DQMStore::getMatchingContents(const std::string &pattern, lat::Regexp::Syntax sy std::string path; std::vector result; - auto i = data_.begin(); - auto e = data_.end(); - for ( ; i != e; ++i) + for (auto const& me : data_) { path.clear(); - mergePath(path, *i->data_.dirname, i->data_.objname); + mergePath(path, *me.data_.dirname, me.data_.objname); if (rx.match(path)) - result.push_back(const_cast(&*i)); + result.push_back(const_cast(&me)); } return result; @@ -1894,12 +1866,10 @@ DQMStore::getMatchingContents(const std::string &pattern, lat::Regexp::Syntax sy void DQMStore::reset() { - auto mi = data_.begin(); - auto me = data_.end(); - for ( ; mi != me; ++mi) + for (auto const& m : data_) { - auto &me = const_cast(*mi); - if (mi->wasUpdated()) + auto &me = const_cast(m); + if (me.wasUpdated()) { if (me.resetMe()) me.Reset(); @@ -1918,13 +1888,11 @@ DQMStore::reset() void DQMStore::forceReset() { - auto mi = data_.begin(); - auto me = data_.end(); - for ( ; mi != me; ++mi) + for (auto const& m : data_) { - if (forceResetOnBeginLumi_ && ((*mi).getLumiFlag() == false)) + if (forceResetOnBeginLumi_ && (m.getLumiFlag() == false)) continue; - auto &me = const_cast(*mi); + auto &me = const_cast(m); me.Reset(); me.resetUpdate(); } @@ -2523,8 +2491,8 @@ DQMStore::saveMonitorElementRangeToROOT( std::string mname(me.getFullname(), s_referenceDirName.size()+1, std::string::npos); MonitorElement *master = get(mname); if (master) - for (size_t i = 0, e = master->data_.qreports.size(); i != e; ++i) - status = std::max(status, master->data_.qreports[i].code); + for (auto const& qreport : master->data_.qreports) + status = std::max(status, qreport.code); if (not master or status < minStatus) { @@ -3062,10 +3030,8 @@ DQMStore::readFile(const std::string &filename, unsigned n = readDirectory(f.get(), overwrite, onlypath, prepend, "", stripdirs); f->Close(); - auto mi = data_.begin(); - auto me = data_.end(); - for ( ; mi != me; ++mi) - const_cast(*mi).updateQReportStats(); + for (auto const& me : data_) + const_cast(me).updateQReportStats(); if (verbose_) { @@ -3113,11 +3079,11 @@ void DQMStore::get_info(const dqmstorepb::ROOTFilePB::Histo &h, bool DQMStore::readFilePB(const std::string &filename, - bool overwrite /* = false */, - const std::string &onlypath /* ="" */, - const std::string &prepend /* ="" */, - OpenRunDirs stripdirs /* =StripRunDirs */, - bool fileMustExist /* =true */) + bool overwrite /* = false */, + const std::string &onlypath /* ="" */, + const std::string &prepend /* ="" */, + OpenRunDirs stripdirs /* =StripRunDirs */, + bool fileMustExist /* =true */) { using google::protobuf::io::FileInputStream; using google::protobuf::io::FileOutputStream; @@ -3150,7 +3116,7 @@ DQMStore::readFilePB(const std::string &filename, } ::close(filedescriptor); - for (int i = 0; i < dqmstore_message.histo_size(); i++) { + for (int i = 0; i < dqmstore_message.histo_size(); ++i) { std::string path; std::string objname; @@ -3325,18 +3291,16 @@ DQMStore::useQTestByMatch(const std::string &pattern, const std::string &qtname) qtestspecs_.push_back(qts); // Apply the quality test. - auto mi = data_.begin(); - auto me = data_.end(); std::string path; int cases = 0; - for ( ; mi != me; ++mi) + for (auto const& me : data_) { path.clear(); - mergePath(path, *mi->data_.dirname, mi->data_.objname); + mergePath(path, *me.data_.dirname, me.data_.objname); if (fm->match(path)) { ++cases; - const_cast(*mi).addQReport(qts.second); + const_cast(me).addQReport(qts.second); } } @@ -3354,11 +3318,9 @@ DQMStore::runQTests() << ( reset_ ? "true" : "false" ) << std::endl; // Apply quality tests to each monitor element, skipping references. - auto mi = data_.begin(); - auto me = data_.end(); - for ( ; mi != me; ++mi) - if (! isSubdirectory(s_referenceDirName, *mi->data_.dirname)) - const_cast(*mi).runQTests(); + for (auto const& me : data_) + if (! isSubdirectory(s_referenceDirName, *me.data_.dirname)) + const_cast(me).runQTests(); reset_ = false; } @@ -3374,19 +3336,17 @@ DQMStore::getStatus(const std::string &path /* = "" */) const cleanTrailingSlashes(path, clean, cleaned); int status = dqm::qstatus::STATUS_OK; - auto mi = data_.begin(); - auto me = data_.end(); - for ( ; mi != me; ++mi) + for (auto const& me : data_) { - if (! cleaned->empty() && ! isSubdirectory(*cleaned, *mi->data_.dirname)) + if (! cleaned->empty() && ! isSubdirectory(*cleaned, *me.data_.dirname)) continue; - if (mi->hasError()) + if (me.hasError()) return dqm::qstatus::ERROR; - else if (mi->hasWarning()) + else if (me.hasWarning()) status = dqm::qstatus::WARNING; else if (status < dqm::qstatus::WARNING - && mi->hasOtherReport()) + && me.hasOtherReport()) status = dqm::qstatus::OTHER; } return status; @@ -3479,11 +3439,9 @@ DQMStore::scaleElements() } factor = factor/(events*1.0); - auto mi = data_.begin(); - auto me = data_.end(); - for ( ; mi != me; ++mi) + for (auto const& m : data_) { - auto &me = const_cast(*mi); + auto &me = const_cast(m); switch (me.kind()) { case MonitorElement::DQM_KIND_TH1F: From 3838b5e4588312880ecda8e1c0504962825bf5c2 Mon Sep 17 00:00:00 2001 From: Kyle Knoepfel Date: Wed, 14 Mar 2018 10:49:27 -0500 Subject: [PATCH 124/426] Remove global IBooker/IGetter members in preparation for concurrent booking. --- DQMServices/Core/interface/DQMStore.h | 9 +++++---- DQMServices/Core/src/DQMStore.cc | 11 +---------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/DQMServices/Core/interface/DQMStore.h b/DQMServices/Core/interface/DQMStore.h index 611b6cca8b003..e32d665ef1031 100644 --- a/DQMServices/Core/interface/DQMStore.h +++ b/DQMServices/Core/interface/DQMStore.h @@ -359,7 +359,8 @@ class DQMStore run_ = run; moduleId_ = moduleId; } - f(*ibooker_); + IBooker booker{this}; + f(booker); /* Reset the run number and module id only if multithreading is enabled */ if (enableMultiThread_) { @@ -393,7 +394,9 @@ class DQMStore // is not needed. template void meBookerGetter(iFunc f) { - f(*ibooker_, *igetter_); + IBooker booker{this}; + IGetter getter{this}; + f(booker, getter); } //------------------------------------------------------------------------- @@ -850,8 +853,6 @@ class DQMStore QTestSpecs qtestspecs_; std::mutex book_mutex_; - IBooker * ibooker_{nullptr}; - IGetter * igetter_{nullptr}; friend class edm::DQMHttpSource; friend class DQMService; diff --git a/DQMServices/Core/src/DQMStore.cc b/DQMServices/Core/src/DQMStore.cc index 1974ab63e3ed4..f83b5eb1d4f65 100644 --- a/DQMServices/Core/src/DQMStore.cc +++ b/DQMServices/Core/src/DQMStore.cc @@ -355,13 +355,8 @@ void DQMStore::IGetter::setCurrentFolder(const std::string &fullpath) { ////////////////////////////////////////////////////////////////////// DQMStore::DQMStore(const edm::ParameterSet &pset, edm::ActivityRegistry& ar) + : DQMStore{pset} { - if (!ibooker_) - ibooker_ = new DQMStore::IBooker(this); - if (!igetter_) - igetter_ = new DQMStore::IGetter(this); - initializeFrom(pset); - ar.preallocateSignal_.connect([this](edm::service::SystemBounds const& iBounds) { if(iBounds.maxNumberOfStreams() > 1 ) { enableMultiThread_ = true; @@ -379,10 +374,6 @@ DQMStore::DQMStore(const edm::ParameterSet &pset, edm::ActivityRegistry& ar) DQMStore::DQMStore(const edm::ParameterSet &pset) { - if (!ibooker_) - ibooker_ = new DQMStore::IBooker(this); - if (!igetter_) - igetter_ = new DQMStore::IGetter(this); initializeFrom(pset); } From 1ebda91f061a87f37645b259a192734d00bea8fe Mon Sep 17 00:00:00 2001 From: Sunanda Date: Wed, 14 Mar 2018 16:50:20 +0100 Subject: [PATCH 125/426] Update codes for SPR studies --- .../IsolatedParticles/macros/PlotTracks.C | 84 +++++++++++++++---- .../IsolatedParticles/plugins/StudyHLT.cc | 70 ++++++++++++++-- 2 files changed, 135 insertions(+), 19 deletions(-) diff --git a/Calibration/IsolatedParticles/macros/PlotTracks.C b/Calibration/IsolatedParticles/macros/PlotTracks.C index e492c84fd525c..fd7eeae3fcebf 100644 --- a/Calibration/IsolatedParticles/macros/PlotTracks.C +++ b/Calibration/IsolatedParticles/macros/PlotTracks.C @@ -39,7 +39,7 @@ // savePlot= Plot to be saved: no (-1), eps (0), gif (1), pdf (2) [-1] // // void plotEMeanAll(int data, int models, bool ratio, bool approve, -// int savePlot) +// std::string postfix, int savePlot) // // Plots mean energy response as a function of track momentum or the ratio // @@ -48,11 +48,12 @@ // ratio = flag to say if raw mean will be shown or ratio [false] // wrt a reference // approve= If meant for approval talks [true] +// postfix= String to be added in the name of saved file [""] // savePlot= Plot to be saved: no (-1), eps (0), gif (1), pdf (2) [-1] // // void plotEMean(std::string fname, std::string hlt, int models, int var, // int eta, int pv, int data, bool ratio, bool approve, -// int savePlot) +// std::string postfix, int savePlot) // // Plots mean energy response as a function of track momentum or the ratio // MC/Data @@ -70,6 +71,7 @@ // ratio = flag to say if raw mean will be shown or ratio wrt [false] // a reference // approve= If meant for approval talks [true] +// postfix= String to be added in the name of saved file [""] // savePlot= Plot to be saved: no (-1), eps (0), gif (1), pdf (2) [-1] // // void plotEnergy(std::string fname, std::string HLT, int var, int ien, @@ -188,9 +190,9 @@ #include //const int nmodelm=15, nmodelx=16, nmodels=2; -//const int nmodelm=3, nmodelx=4, nmodels=2; +const int nmodelm=3, nmodelx=4, nmodels=2; //const int nmodelm=4, nmodelx=5, nmodels=2; -const int nmodelm=2, nmodelx=3, nmodels=2; +//const int nmodelm=2, nmodelx=3, nmodels=2; int styles[7] = {20, 21, 24, 22, 23, 33, 25}; int colors[7] = {1, 2, 4, 6, 7, 38, 3}; std::string names[7] = {"All", "Quality", "okEcal", "EcalCharIso", @@ -295,12 +297,28 @@ std::string typem[nmodelm]={"10.2.p02 FTFP_BERT_EMM", "10.4 VecGeom FTFP_BERT_EMM", "10.4 VecGeom+CLHEP FTFP_BERT_EMM"}; */ - +/* std::string filem[nmodelm]={"pikp/FBE4cMixStudyHLT10.root", "pikp/FBE4vcMixStudyHLT10.root"}; std::string typem[nmodelm]={"10.4 CLHEP FTFP_BERT_EMM", "10.4 VecGeom+CLHEP FTFP_BERT_EMM"}; - +*/ +/* +std::string filem[nmodelm]={"pikp/FBE3r9MixStudyHLT.root", + "pikp/FBE4r00MixStudyHLT.root", + "pikp/FBE4r01MixStudyHLT.root"}; +std::string typem[nmodelm]={"10.3.ref09 FTFP_BERT_EMM", + "10.4.ref00 FTFP_BERT_EMM", + "10.4.ref01 FTFP_BERT_EMM"}; +*/ +/* +std::string filem[nmodelm]={"pikp/QFB3r9MixStudyHLT.root", + "pikp/QFB4r00MixStudyHLT.root", + "pikp/QFB4r01MixStudyHLT.root"}; +std::string typem[nmodelm]={"10.3.ref09 QGSP_FTFP_BERT_EML", + "10.4.ref00 QGSP_FTFP_BERT_EML", + "10.4.ref01 QGSP_FTFP_BERT_EML"}; +*/ /* std::string filem[nmodelm]={"pikp/FBE2p2StudyHLT.root", "pikp/FBE4r00MixStudyHLT.root", @@ -317,6 +335,12 @@ std::string typem[nmodelm]={"10.3.ref06 FTFP_BERT_EMM (Native)", "10.3.ref06 FTFP_BERT_EMM (VecGeom 4)", "10.3.ref06 FTFP_BERT_EMM (VecGeom Corr)"}; */ +std::string filem[nmodelm]={"pikp/FBE4r00vMixStudyHLT.root", + "pikp/FBE4r01MixStudyHLT.root", + "pikp/FBE4r01vMixStudyHLT.root"}; +std::string typem[nmodelm]={"10.4 VecGeom FTFP_BERT_EMM", + "10.4.ref01 FTFP_BERT_EMM", + "10.4.ref01 VecGeom FTFP_BERT_EMM"}; /* std::string filex[nmodelx]={"AllDataStudyHLT.root", "pikp/FBE2p2StudyHLT.root", @@ -363,14 +387,34 @@ std::string typex[nmodelx]={"Data (2016B)", "10.4 VecGeom FTFP_BERT_EMM", "10.4 VecGeom+CLHEP FTFP_BERT_EMM"}; */ - +/* std::string filex[nmodelx]={"AllDataStudyHLT.root", "pikp/FBE4cMixStudyHLT10.root", "pikp/FBE4vcMixStudyHLT10.root"}; std::string typex[nmodelx]={"Data (2016B)", "10.4 CLHEP FTFP_BERT_EMM", "10.4 VecGeom+CLHEP FTFP_BERT_EMM"}; - +*/ +/* +std::string filex[nmodelx]={"AllDataStudyHLT.root", + "pikp/FBE3r9MixStudyHLT.root", + "pikp/FBE4r00MixStudyHLT.root", + "pikp/FBE4r01MixStudyHLT.root"}; +std::string typex[nmodelx]={"Data (2016B)", + "10.3.ref09 FTFP_BERT_EMM", + "10.4.ref00 FTFP_BERT_EMM", + "10.4.ref01 FTFP_BERT_EMM"}; +*/ +/* +std::string filex[nmodelx]={"AllDataStudyHLT.root", + "pikp/QFB3r9MixStudyHLT.root", + "pikp/QFB4r00MixStudyHLT.root", + "pikp/QFB4r01MixStudyHLT.root"}; +std::string typex[nmodelx]={"Data (2016B)", + "10.3.ref09 QGSP_FTFP_BERT_EML", + "10.4.ref00 QGSP_FTFP_BERT_EML", + "10.4.ref01 QGSP_FTFP_BERT_EML"}; +*/ /* std::string filex[nmodelx]={"AllDataStudyHLT.root", "pikp/FBE2p2StudyHLT.root", @@ -391,6 +435,14 @@ std::string typex[nmodelx]={"Data (2016B)", "10.3.ref06 FTFP_BERT_EMM (VecGeom 4)", "10.3.ref06 FTFP_BERT_EMM (VecGeom Corr)"}; */ +std::string filex[nmodelx]={"AllDataStudyHLT.root", + "pikp/FBE4r00vMixStudyHLT.root", + "pikp/FBE4r01MixStudyHLT.root", + "pikp/FBE4r01vMixStudyHLT.root"}; +std::string typex[nmodelx]={"Data (2016B)", + "10.4 VecGeom FTFP_BERT_EMM", + "10.4.ref01 FTFP_BERT_EMM", + "10.4.ref01 VecGeom FTFP_BERT_EMM"}; /* std::string files[nmodelx]={"StudyHLT_ZeroBias_1PV.root","StudyHLT_PixelTrack_1PV.root","StudyHLT_1PV.root"}; std::string types[nmodels]={"Zero Bias HLT","Pixel Track HLT","All HLTs"}; @@ -404,8 +456,8 @@ std::string typex[nmodelx]={"Data (2016B)", void plotAll(std::string fname="hlt.root", std::string HLT="All HLTs", int var=-1, int ien=-1, int eta=-1, bool varbin=false, int rebin=1, bool approve=true, bool logy=true, int pos=0, bool pv=false, int savePlot=-1); void plotEnergyAll(std::string fname="", std::string hlt="All HLTs", int models=15, int pv=0, int data=4, bool varbin=false, int rebin=5, bool approve=true, bool logy=true, int pos=0, int var=-1, int ene=-1, int eta=-1, int savePlot=-1); -void plotEMeanAll(int data=4, int models=15, bool ratio=false, bool approve=true, int savePlot=-1); -void plotEMean(std::string fname="", std::string hlt="All HLTs", int models=15, int var=0, int eta=0, int pv=0, int dataMC=1, bool raio=false, bool approve=true, int savePlot=-1); +void plotEMeanAll(int data=4, int models=15, bool ratio=false, bool approve=true, std::string postfix="", int savePlot=-1); +void plotEMean(std::string fname="", std::string hlt="All HLTs", int models=15, int var=0, int eta=0, int pv=0, int dataMC=1, bool raio=false, bool approve=true, std::string postfix="",int savePlot=-1); TCanvas* plotEMeanDraw(std::vector fnames, std::vector hlts, int var, int eta, int pv=0, bool approve=false, std::string dtype="Data", int coloff=0); TCanvas* plotEMeanRatioDraw(std::vector fnames, std::vector hlts, int var, int eta, int pv=0, bool approve=false, std::string dtype="Data", int coloff=0); TCanvas* plotEnergies(std::vector fnames, std::vector hlts, int var=0, int ien=0, int eta=0, int pv=0, bool varbin=false, int rebin=1, bool approve=false, std::string dtype="Data", bool logy=true, int pos=0, int coloff=0); @@ -508,21 +560,24 @@ void plotEnergyAll(std::string fname, std::string hlt, int models, int pv, } } -void plotEMeanAll(int data, int models, bool ratio, bool approve, int savePlot){ +void plotEMeanAll(int data, int models, bool ratio, bool approve, + std::string postfix, int savePlot){ int varmin(0), varmax(5), pvmin(0), pvmax(0), etamin(0), etamax(3); // std::cout << "Var " << varmin << ":" << varmax << " PV " << pvmin << ":" // << pvmax << " Eta " << etamin << ":" << etamax << std::endl; for (int var=varmin; var<=varmax; ++var) { for (int eta=etamin; eta<=etamax; ++eta) { for (int pv=pvmin; pv<=pvmax; ++pv) { - plotEMean("", "", models, var, eta, pv, data, ratio, approve, savePlot); + plotEMean("", "", models, var, eta, pv, data, ratio, approve, postfix, + savePlot); } } } } void plotEMean(std::string fname, std::string hlt, int models, int var, int eta, - int pv, int data, bool ratio, bool approve, int savePlot) { + int pv, int data, bool ratio, bool approve, std::string postfix, + int savePlot) { std::vector fnames, hlts; std::string dtype = (data == 1) ? "Data" : "MC"; @@ -579,7 +634,8 @@ void plotEMean(std::string fname, std::string hlt, int models, int var, int eta, if (c != 0 && savePlot >= 0 && savePlot < 3) { std::string ext[3] = {"eps", "gif", "pdf"}; char name[200]; - sprintf (name, "%s.%s", c->GetName(), ext[savePlot].c_str()); + sprintf (name, "%s%s.%s", c->GetName(), postfix.c_str(), + ext[savePlot].c_str()); c->Print(name); } } diff --git a/Calibration/IsolatedParticles/plugins/StudyHLT.cc b/Calibration/IsolatedParticles/plugins/StudyHLT.cc index 027ce346d8a8a..d84940fcd9dde 100644 --- a/Calibration/IsolatedParticles/plugins/StudyHLT.cc +++ b/Calibration/IsolatedParticles/plugins/StudyHLT.cc @@ -104,7 +104,7 @@ class StudyHLT : public edm::one::EDAnalyzer&); // ----------member data --------------------------- - static const int nPBin_=10, nEtaBin_=4, nPVBin_=4; + static const int nPBin_=15, nEtaBin_=4, nPVBin_=4; static const int nGen_=(nPVBin_+12); HLTConfigProvider hltConfig_; edm::Service fs_; @@ -135,8 +135,8 @@ class StudyHLT : public edm::one::EDAnalyzer h_HLTAccepts; - TH1D *h_p[nGen_+2], *h_pt[nGen_+2]; - TH1D *h_eta[nGen_+2], *h_phi[nGen_+2]; + TH1D *h_p[nGen_+2], *h_pt[nGen_+2], *h_counter[8]; + TH1D *h_eta[nGen_+2], *h_phi[nGen_+2], *h_h_pNew[8]; TH1I *h_ntrk[2]; TH1D *h_maxNearP[2], *h_ene1[2], *h_ene2[2], *h_ediff[2]; TH1D *h_energy[nPVBin_+8][nPBin_][nEtaBin_][6]; @@ -223,7 +223,8 @@ StudyHLT::StudyHLT(const edm::ParameterSet& iConfig) : << " tMinH_ " << tMinH_ << " tMaxH_ " << tMaxH_ << " isItAOD " << isItAOD_ << " doTree " << doTree_; - double pBins[nPBin_+1] = {1.0,2.0,3.0,4.0,5.0,6.0,7.0,9.0,11.0,15.0,20.0}; + double pBins[nPBin_+1] = {1.0,2.0,3.0,4.0,5.0,6.0,7.0,9.0,11.0,15.0,20.0, + 25.0,30.0,40.0,60.0,100.0}; int etaBins[nEtaBin_+1] = {1, 7, 13, 17, 23}; int pvBins[nPVBin_+1] = {1, 2, 3, 5, 100}; for (int i=0; i<=nPBin_; ++i) pBin_[i] = pBins[i]; @@ -269,6 +270,14 @@ void StudyHLT::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { void StudyHLT::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) { clear(); + int counter0[1000] = {0}; + int counter1[1000] = {0}; + int counter2[1000] = {0}; + int counter3[1000] = {0}; + int counter4[1000] = {0}; + int counter5[1000] = {0}; + int counter6[1000] = {0}; + int counter7[1000] = {0}; if (verbosity_ > 0) edm::LogInfo("IsoTrack") << "Event starts===================================="; int RunNo = iEvent.id().run(); @@ -470,6 +479,10 @@ void StudyHLT::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) bool quality = pTrack->quality(selectionParameters_.minQuality); fillTrack(0, pt1,p1,eta1,phi1); if (quality) fillTrack(1, pt1,p1,eta1,phi1); + if (p1<1000) { + h_h_pNew[0]->Fill(p1); + ++counter0[(int)(p1)]; + } } h_ntrk[0]->Fill(ntrk,tr_eventWeight); @@ -568,15 +581,53 @@ void StudyHLT::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) fillTrack(nPVBin_+trackID+7, pt1,p1,eta1,phi1); fillEnergy(nPVBin_+trackID+3,ieta,p1,e7x7P.first,h3x3,e11x11P.first,h5x5); } + if (p1<1000) { + h_h_pNew[7]->Fill(p1); + ++counter7[(int)(p1)]; + } + } + if (p1<1000) { + h_h_pNew[6]->Fill(p1); + ++counter6[(int)(p1)]; } } + if (p1<1000) { + h_h_pNew[5]->Fill(p1); + ++counter5[(int)(p1)]; + } + } + if (p1<1000) { + h_h_pNew[4]->Fill(p1); + ++counter4[(int)(p1)]; } } + if (p1<1000) { + h_h_pNew[3]->Fill(p1); + ++counter3[(int)(p1)]; + } } + if (p1<1000) { + h_h_pNew[2]->Fill(p1); + ++counter2[(int)(p1)]; + } + } + if (p1<1000) { + h_h_pNew[1]->Fill(p1); + ++counter1[(int)(p1)]; } } h_ntrk[1]->Fill(ntrk,tr_eventWeight); if ((!tr_TrkPt.empty()) && doTree_) tree_->Fill(); + for (int i=0; i <1000; ++i) { + if (counter0[i]) h_counter[0]->Fill(i, counter0[i]); + if (counter1[i]) h_counter[1]->Fill(i, counter1[i]); + if (counter2[i]) h_counter[2]->Fill(i, counter2[i]); + if (counter3[i]) h_counter[3]->Fill(i, counter3[i]); + if (counter4[i]) h_counter[4]->Fill(i, counter4[i]); + if (counter5[i]) h_counter[5]->Fill(i, counter5[i]); + if (counter6[i]) h_counter[6]->Fill(i, counter6[i]); + if (counter7[i]) h_counter[7]->Fill(i, counter7[i]); + } } firstEvent_ = false; } @@ -709,13 +760,22 @@ void StudyHLT::beginJob() { (etaBin_[ie+1]-1), particle[i-4-nPVBin_].c_str(), TrkNames[7].c_str()); } - h_energy[i][ip][ie][j] = fs_->make(hname, htit, 500, -0.1, 4.9); + h_energy[i][ip][ie][j] = fs_->make(hname, htit, 5000,-0.1,49.9); h_energy[i][ip][ie][j]->Sumw2(); } } } } + for (int i=0; i<8; ++i) { + sprintf(hname,"counter%d",i); + sprintf(htit,"Counter with cut %d",i); + h_counter[i] = fs_->make(hname, htit, 1000, 0, 1000); + sprintf(hname,"h_pTNew%d",i); + sprintf(htit,"Track momentum with cut %d",i); + h_h_pNew[i] = fs_->make(hname, htit, 1000, 0, 1000); + } + // Now the tree if (doTree_) { tree_ = fs_->make("testTree", "new HLT Tree"); From 0b173514f7d5800730bcec7a31008b063365522d Mon Sep 17 00:00:00 2001 From: Kyle Knoepfel Date: Wed, 14 Mar 2018 10:57:56 -0500 Subject: [PATCH 126/426] Improve RAII use (and thus exception safety). --- DQMServices/Core/interface/DQMStore.h | 6 +++--- DQMServices/Core/src/DQMStore.cc | 16 ++-------------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/DQMServices/Core/interface/DQMStore.h b/DQMServices/Core/interface/DQMStore.h index e32d665ef1031..83beeac5848e5 100644 --- a/DQMServices/Core/interface/DQMStore.h +++ b/DQMServices/Core/interface/DQMStore.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -58,7 +59,6 @@ class fastmatch public: fastmatch (std::string _fastString); - ~fastmatch(); bool match (std::string const& s) const; @@ -70,7 +70,7 @@ class fastmatch bool compare_strings (std::string const& pattern, std::string const& input) const; - lat::Regexp * regexp_; + std::unique_ptr regexp_{nullptr}; std::string fastString_; MatchingHeuristicEnum matching_; }; @@ -842,7 +842,7 @@ class DQMStore std::string readSelectedDirectory_{}; uint32_t run_{}; uint32_t moduleId_{}; - std::ofstream * stream_{nullptr}; + std::unique_ptr stream_{nullptr}; std::string pwd_{}; MEMap data_; diff --git a/DQMServices/Core/src/DQMStore.cc b/DQMServices/Core/src/DQMStore.cc index f83b5eb1d4f65..d41376a57d10d 100644 --- a/DQMServices/Core/src/DQMStore.cc +++ b/DQMServices/Core/src/DQMStore.cc @@ -139,13 +139,11 @@ fastmatch::fastmatch (std::string _fastString) : { try { - regexp_ = nullptr; - regexp_ = new lat::Regexp(fastString_, 0, lat::Regexp::Wildcard); + regexp_ = std::make_unique(fastString_, 0, lat::Regexp::Wildcard); regexp_->study(); } catch (lat::Error &e) { - delete regexp_; raiseDQMError("DQMStore", "Invalid wildcard pattern '%s' in quality" " test specification", fastString_.c_str()); } @@ -204,12 +202,6 @@ fastmatch::fastmatch (std::string _fastString) : } } -fastmatch::~fastmatch() -{ - if (regexp_ != nullptr) - delete regexp_; -} - bool fastmatch::compare_strings_reverse(std::string const& pattern, std::string const& input) const { @@ -384,10 +376,6 @@ DQMStore::~DQMStore() for (auto & qtestspec : qtestspecs_) delete qtestspec.first; - - if (stream_) - stream_->close(); - delete stream_; } void @@ -459,7 +447,7 @@ DQMStore::print_trace (const std::string &dir, const std::string &name) // concurrency problems because the print_trace method is always called behind // a lock (see bookTransaction). if (!stream_) - stream_ = new std::ofstream("histogramBookingBT.log"); + stream_ = std::make_unique("histogramBookingBT.log"); void *array[10]; size_t size; From 42d0a42f32c7a734ea8e1ffecb59e18b61080ba7 Mon Sep 17 00:00:00 2001 From: Felice Date: Wed, 14 Mar 2018 18:05:53 +0100 Subject: [PATCH 127/426] remove cluster offset --- RecoLocalCalo/HGCalRecAlgos/interface/HGCalImagingAlgo.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/RecoLocalCalo/HGCalRecAlgos/interface/HGCalImagingAlgo.h b/RecoLocalCalo/HGCalRecAlgos/interface/HGCalImagingAlgo.h index 2f846aa97abcc..71e96b69e311a 100644 --- a/RecoLocalCalo/HGCalRecAlgos/interface/HGCalImagingAlgo.h +++ b/RecoLocalCalo/HGCalRecAlgos/interface/HGCalImagingAlgo.h @@ -49,7 +49,7 @@ class HGCalImagingAlgo enum VerbosityLevel { pDEBUG = 0, pWARNING = 1, pINFO = 2, pERROR = 3 }; -HGCalImagingAlgo() : vecDeltas(), kappa(1.), ecut(0.), cluster_offset(0), +HGCalImagingAlgo() : vecDeltas(), kappa(1.), ecut(0.), sigma2(1.0), algoId(reco::CaloCluster::undefined), verbosity(pERROR),initialized(false){ @@ -67,7 +67,6 @@ HGCalImagingAlgo(const std::vector& vecDeltas_in, double kappa_in, doubl VerbosityLevel the_verbosity = pERROR) : vecDeltas(vecDeltas_in), kappa(kappa_in), ecut(ecut_in), - cluster_offset(0), sigma2(1.0), algoId(algoId_in), dependSensor(dependSensor_in), @@ -99,7 +98,6 @@ HGCalImagingAlgo(const std::vector& vecDeltas_in, double kappa_in, doubl double noiseMip_in, VerbosityLevel the_verbosity = pERROR) : vecDeltas(vecDeltas_in), kappa(kappa_in), ecut(ecut_in), - cluster_offset(0), sigma2(std::pow(showerSigma,2.0)), algoId(algoId_in), dependSensor(dependSensor_in), @@ -142,7 +140,6 @@ void getEventSetup(const edm::EventSetup& es){ void reset(){ current_v.clear(); clusters_v.clear(); - cluster_offset = 0; for( auto& it: points) { it.clear(); @@ -177,9 +174,6 @@ double kappa; // The hit energy cutoff double ecut; -// The current offset into the temporary cluster structure -unsigned int cluster_offset; - // for energy sharing double sigma2; // transverse shower size From 93d462da5035db3e2b5fd074013d6868a22a3883 Mon Sep 17 00:00:00 2001 From: Felice Date: Wed, 14 Mar 2018 18:06:58 +0100 Subject: [PATCH 128/426] OCD --- RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc index 7b21a6a58e613..9f1c2dc073d70 100644 --- a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc +++ b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc @@ -26,9 +26,9 @@ void HGCalImagingAlgo::populate(const HGCRecHitCollection& hits){ const HGCRecHit& hgrh = hits[i]; DetId detid = hgrh.detid(); unsigned int layer = rhtools_.getLayerWithOffset(detid); - float thickness = 0.; + float thickness = 0.f; // set sigmaNoise default value 1 to use kappa value directly in case of sensor-independent thresholds - float sigmaNoise = 1.; + float sigmaNoise = 1.f; if(dependSensor){ if (layer<= lastLayerFH) // only EE and FH have silicon sensors thickness = rhtools_.getSiThickness(detid); @@ -72,8 +72,6 @@ void HGCalImagingAlgo::makeClusters() { std::vector > > layerClustersPerLayer(2*(maxlayer+2)); edm::SerialTaskQueue layersQueue; - tbb::tick_count t0 = tbb::tick_count::now(); - //assign all hits in each layer to a cluster core or halo tbb::parallel_for(size_t(0), size_t(2*maxlayer+2), [&](size_t i) { KDTreeBox bounds(minpos[i][0],maxpos[i][0], From 3878713c7c5acc4cc0b797d1a4488128cdb9590e Mon Sep 17 00:00:00 2001 From: Vladimir Date: Wed, 14 Mar 2018 18:07:14 +0100 Subject: [PATCH 129/426] cleanup custom physics --- .../interface/CustomPhysicsList.h | 3 - .../python/Exotica_HSCP_SIM_cfi.py | 2 +- .../src/CustomParticleFactory.cc | 98 ++++++++++++------- SimG4Core/CustomPhysics/src/CustomPhysics.cc | 2 +- 4 files changed, 62 insertions(+), 43 deletions(-) diff --git a/SimG4Core/CustomPhysics/interface/CustomPhysicsList.h b/SimG4Core/CustomPhysics/interface/CustomPhysicsList.h index cd8faf09ffb87..100de584b72c1 100644 --- a/SimG4Core/CustomPhysics/interface/CustomPhysicsList.h +++ b/SimG4Core/CustomPhysics/interface/CustomPhysicsList.h @@ -7,7 +7,6 @@ #include class G4ProcessHelper; -class G4Decay; class CustomParticleFactory; class CustomPhysicsList : public G4VPhysicsConstructor @@ -21,9 +20,7 @@ class CustomPhysicsList : public G4VPhysicsConstructor private: - static G4ThreadLocal std::unique_ptr fDecayProcess; static G4ThreadLocal std::unique_ptr myHelper; - std::unique_ptr fParticleFactory; bool fHadronicInteraction; diff --git a/SimG4Core/CustomPhysics/python/Exotica_HSCP_SIM_cfi.py b/SimG4Core/CustomPhysics/python/Exotica_HSCP_SIM_cfi.py index 8ff2dc85635e2..81989dd294737 100644 --- a/SimG4Core/CustomPhysics/python/Exotica_HSCP_SIM_cfi.py +++ b/SimG4Core/CustomPhysics/python/Exotica_HSCP_SIM_cfi.py @@ -4,7 +4,7 @@ def customise(process): FLAVOR = process.generator.hscpFlavor.value() MASS_POINT = process.generator.massPoint.value() - SLHA_FILE = process.generator.slhaFile.value() + SLHA_FILE = process.generator.SLHAFileForPythia8.value() PROCESS_FILE = process.generator.processFile.value() PARTICLE_FILE = process.generator.particleFile.value() USE_REGGE = process.generator.useregge.value() diff --git a/SimG4Core/CustomPhysics/src/CustomParticleFactory.cc b/SimG4Core/CustomPhysics/src/CustomParticleFactory.cc index c53c0558a1acb..5a219de551f47 100644 --- a/SimG4Core/CustomPhysics/src/CustomParticleFactory.cc +++ b/SimG4Core/CustomPhysics/src/CustomParticleFactory.cc @@ -66,13 +66,13 @@ void CustomParticleFactory::loadCustomParticles(const std::string & filePath){ edm::LogInfo("SimG4CoreCustomPhysics") <<"CustomParticleFactory: entry to G4DecayTable: pdgID, width " << pdgId << ", " << width; + G4ParticleDefinition *aParticle = theParticleTable->FindParticle(pdgId); + if (!aParticle || width == 0.0) { continue; } G4DecayTable* aDecayTable = getDecayTable(&configFile, pdgId); - G4ParticleDefinition *aParticle = theParticleTable->FindParticle(pdgId); - G4ParticleDefinition *aAntiParticle = theParticleTable->FindAntiParticle(pdgId); - if (!aParticle) { continue; } aParticle->SetDecayTable(aDecayTable); aParticle->SetPDGStable(false); aParticle->SetPDGLifeTime(1.0/(width*CLHEP::GeV)*6.582122e-22*CLHEP::MeV*CLHEP::s); + G4ParticleDefinition *aAntiParticle = theParticleTable->FindAntiParticle(pdgId); if(aAntiParticle && aAntiParticle->GetPDGEncoding() != pdgId){ aAntiParticle->SetDecayTable(getAntiDecayTable(pdgId,aDecayTable)); aAntiParticle->SetPDGStable(false); @@ -228,6 +228,8 @@ void CustomParticleFactory::getMassTable(std::ifstream *configFile) { double mass; std::string name, tmp; std::string line; + G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable(); + // This should be compatible IMO to SLHA while (getline(*configFile,line)) { line.erase(0, line.find_first_not_of(" \t")); // remove leading whitespace @@ -241,22 +243,24 @@ void CustomParticleFactory::getMassTable(std::ifstream *configFile) { sstr >> pdgId >> mass >> tmp >> name; // Assume SLHA format, e.g.: 1000001 5.68441109E+02 # ~d_L mass = std::max(mass, 0.0); + if(theParticleTable->FindParticle(pdgId)) { continue; } edm::LogInfo("SimG4CoreCustomPhysics") <<"CustomParticleFactory: Calling addCustomParticle for pdgId: " << pdgId - << ", mass " << mass << " GeV, name " << name; + << ", mass " << mass << " GeV " << name + << ", isRHadron: " << CustomPDGParser::s_isRHadron(pdgId) + << ", isstopHadron: " << CustomPDGParser::s_isstopHadron(pdgId); addCustomParticle(pdgId, mass, name); + ////Find SM particle partner and check for the antiparticle. int pdgIdPartner = pdgId%100; - G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable(); G4ParticleDefinition *aParticle = theParticleTable->FindParticle(pdgIdPartner); //Add antiparticles for SUSY particles only, not for rHadrons. - edm::LogInfo("SimG4CoreCustomPhysics") - <<"CustomParticleFactory: Found aParticle = " << aParticle - << ", pdgId = " << pdgId - << ", pdgIdPartner = " << pdgIdPartner - << ", CustomPDGParser::s_isRHadron(pdgId) = " << CustomPDGParser::s_isRHadron(pdgId) - << ", CustomPDGParser::s_isstopHadron(pdgId) = " << CustomPDGParser::s_isstopHadron(pdgId); + if(aParticle) { + edm::LogInfo("SimG4CoreCustomPhysics") + <<"CustomParticleFactory: Found partner particle for " << " pdgId= " << pdgId + << ", pdgIdPartner= " << pdgIdPartner << " " << aParticle->GetParticleName(); + } if (aParticle && !CustomPDGParser::s_isRHadron(pdgId) && @@ -269,22 +273,26 @@ void CustomParticleFactory::getMassTable(std::ifstream *configFile) { pdgId!=37){ int sign = aParticle->GetAntiPDGEncoding()/pdgIdPartner; edm::LogInfo("SimG4CoreCustomPhysics") - <<"CustomParticleFactory: Found sign = " << sign - << ", aParticle->GetAntiPDGEncoding() " << aParticle->GetAntiPDGEncoding() - << ", pdgIdPartner = " << pdgIdPartner; + <<"CustomParticleFactory: For " << aParticle->GetParticleName() + <<" pdg= " << pdgIdPartner + << ", GetAntiPDGEncoding() " << aParticle->GetAntiPDGEncoding() + << " sign= " << sign; + if(std::abs(sign)!=1) { edm::LogInfo("SimG4CoreCustomPhysics") - <<"CustomParticleFactory: sgn= "<GetAntiPDGEncoding()<<" b "<GetAntiPDGEncoding()<<" b: "<DumpTable(); } if(sign==-1 && pdgId!=25 && pdgId!=35 && pdgId!=36 && pdgId!=37 && pdgId!=1000039){ tmp = "anti_"+name; - edm::LogInfo("SimG4CoreCustomPhysics") - <<"CustomParticleFactory: Calling addCustomParticle for antiparticle with pdgId: " - << -pdgId << ", mass " << mass << " GeV, name " << tmp; - addCustomParticle(-pdgId, mass, tmp); - theParticleTable->FindParticle(pdgId)->SetAntiPDGEncoding(-pdgId); + if(!theParticleTable->FindParticle(-pdgId)) { + edm::LogInfo("SimG4CoreCustomPhysics") + <<"CustomParticleFactory: Calling addCustomParticle for antiparticle with pdgId: " + << -pdgId << ", mass " << mass << " GeV, name " << tmp; + addCustomParticle(-pdgId, mass, tmp); + theParticleTable->FindParticle(pdgId)->SetAntiPDGEncoding(-pdgId); + } } else theParticleTable->FindParticle(pdgId)->SetAntiPDGEncoding(pdgId); } @@ -292,11 +300,13 @@ void CustomParticleFactory::getMassTable(std::ifstream *configFile) { if(pdgId==1000039) theParticleTable->FindParticle(pdgId)->SetAntiPDGEncoding(pdgId); // gravitino if(pdgId==1000024 || pdgId==1000037 || pdgId==37) { tmp = "anti_"+name; - edm::LogInfo("SimG4CoreCustomPhysics") - <<"CustomParticleFactory: Calling addCustomParticle for antiparticle (2) with pdgId: " - << -pdgId << ", mass " << mass << " GeV, name " << tmp; - addCustomParticle(-pdgId, mass, tmp); - theParticleTable->FindParticle(pdgId)->SetAntiPDGEncoding(-pdgId); + if(!theParticleTable->FindParticle(-pdgId)) { + edm::LogInfo("SimG4CoreCustomPhysics") + <<"CustomParticleFactory: Calling addCustomParticle for antiparticle (2) with pdgId: " + << -pdgId << ", mass " << mass << " GeV, name " << tmp; + addCustomParticle(-pdgId, mass, tmp); + theParticleTable->FindParticle(pdgId)->SetAntiPDGEncoding(-pdgId); + } } } } @@ -305,9 +315,8 @@ G4DecayTable* CustomParticleFactory::getDecayTable(std::ifstream *configFile, i double br; int nDaughters; - std::vector pdg(4); + int pdg[4] = {0}; std::string line; - std::vector name(4); G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable(); @@ -321,17 +330,14 @@ G4DecayTable* CustomParticleFactory::getDecayTable(std::ifstream *configFile, i if (line.at(0) == '#' && ToLower(line).find("br") < line.npos && ToLower(line).find("nda") < line.npos) continue; // skip a comment of the form: # BR NDA ID1 ID2 - if (line.at(0) == '#') { // other comments signal the end of the decay block + if (line.at(0) == '#' || ToLower(line).find("block") < line.npos) { edm::LogInfo("SimG4CoreCustomPhysics") <<"CustomParticleFactory: Finished the Decay Table "; break; } - - pdg.clear(); - name.clear(); std::stringstream sstr(line); sstr >> br >> nDaughters; // assume SLHA format, e.g.: 1.49435135E-01 2 -15 16 # BR(H+ -> tau+ nu_tau) - edm::LogInfo("SimG4CoreCustomPhysics") + LogDebug("SimG4CoreCustomPhysics") <<"CustomParticleFactory: Branching Ratio: " << br << ", Number of Daughters: " << nDaughters; if (nDaughters > 4) { edm::LogError("SimG4CoreCustomPhysics") @@ -339,9 +345,16 @@ G4DecayTable* CustomParticleFactory::getDecayTable(std::ifstream *configFile, i << " for pdgId: " << pdgId; break; } - for(int i=0; i> pdg[i]; - edm::LogInfo("SimG4CoreCustomPhysics") <<"CustomParticleFactory: Daughter ID " << pdg[i]; + LogDebug("SimG4CoreCustomPhysics") <<"CustomParticleFactory: Daughter ID " << pdg[i]; const G4ParticleDefinition* part = theParticleTable->FindParticle(pdg[i]); if (!part) { edm::LogWarning("SimG4CoreCustomPhysics") @@ -352,21 +365,25 @@ G4DecayTable* CustomParticleFactory::getDecayTable(std::ifstream *configFile, i } ////Set the G4 decay G4PhaseSpaceDecayChannel *aDecayChannel = new G4PhaseSpaceDecayChannel(parentName, br, nDaughters, - name[0],name[1],name[2],name[3]); + name[0],name[1],name[2],name[3]); decaytable->Insert(aDecayChannel); + edm::LogInfo("SimG4CoreCustomPhysics") <<"CustomParticleFactory: inserted decay channel " + <<" for pdgID= " << pdgId << " " << parentName + <<" BR= " << br << " Daughters: " << name[0] + <<" " << name[1]<< " " << name[2]<< " " << name[3]; } return decaytable; } G4DecayTable* CustomParticleFactory::getAntiDecayTable(int pdgId, G4DecayTable *theDecayTable) { - std::vector name(4); + std::string name[4] = {""}; G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable(); std::string parentName = theParticleTable->FindParticle(-pdgId)->GetParticleName(); G4DecayTable *decaytable= new G4DecayTable(); - for(int i=0;ientries();i++){ + for(int i=0;ientries(); ++i){ G4VDecayChannel *theDecayChannel = theDecayTable->GetDecayChannel(i); int nd = std::min(4, theDecayChannel->GetNumberOfDaughters()); for(int j=0; jGetBR(), nd, name[0],name[1],name[2],name[3]); decaytable->Insert(aDecayChannel); + edm::LogInfo("SimG4CoreCustomPhysics") <<"CustomParticleFactory: inserted decay channel " + <<" for pdgID= " << -pdgId << " " << parentName + <<" BR= " << theDecayChannel->GetBR() + << " Daughters: " << name[0] + <<" " << name[1]<< " " << name[2]<< " " << name[3]; } return decaytable; } diff --git a/SimG4Core/CustomPhysics/src/CustomPhysics.cc b/SimG4Core/CustomPhysics/src/CustomPhysics.cc index 7ae44ee5975b5..14f97face621a 100644 --- a/SimG4Core/CustomPhysics/src/CustomPhysics.cc +++ b/SimG4Core/CustomPhysics/src/CustomPhysics.cc @@ -27,7 +27,7 @@ CustomPhysics::CustomPhysics(G4LogicalVolumeToDDLogicalPartMap& map, bool ssPhys = p.getUntrackedParameter("ExoticaPhysicsSS",false); double timeLimit = p.getParameter("MaxTrackTime")*ns; edm::LogInfo("PhysicsList") << "You are using the simulation engine: " - << "QGSP_FTFP_BERT_EML for regular particles \n" + << "FTFP_BERT_EMM for regular particles \n" << "CustomPhysicsList " << ssPhys << " for exotics; " << " tracking cut " << tracking << " t(ns)= " << timeLimit/ns; // EM Physics From 706eb3960a37edb8df928961d5ccc7b764227005 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Wed, 14 Mar 2018 18:07:44 +0100 Subject: [PATCH 130/426] cleanup custom physics --- SimG4Core/CustomPhysics/src/CustomPhysicsList.cc | 7 ------- 1 file changed, 7 deletions(-) diff --git a/SimG4Core/CustomPhysics/src/CustomPhysicsList.cc b/SimG4Core/CustomPhysics/src/CustomPhysicsList.cc index e9959d75c2053..fd52e28dc8ecb 100644 --- a/SimG4Core/CustomPhysics/src/CustomPhysicsList.cc +++ b/SimG4Core/CustomPhysics/src/CustomPhysicsList.cc @@ -9,7 +9,6 @@ #include "FWCore/ParameterSet/interface/FileInPath.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "G4Decay.hh" #include "G4hMultipleScattering.hh" #include "G4hIonisation.hh" #include "G4ProcessManager.hh" @@ -19,7 +18,6 @@ using namespace CLHEP; -G4ThreadLocal std::unique_ptr CustomPhysicsList::fDecayProcess; G4ThreadLocal std::unique_ptr CustomPhysicsList::myHelper; CustomPhysicsList::CustomPhysicsList(const std::string& name, const edm::ParameterSet & p) @@ -33,7 +31,6 @@ CustomPhysicsList::CustomPhysicsList(const std::string& name, const edm::Paramet particleDefFilePath = fp.fullPath(); fParticleFactory.reset(new CustomParticleFactory()); - fDecayProcess.reset(nullptr); myHelper.reset(nullptr); edm::LogInfo("SimG4CoreCustomPhysics") @@ -56,7 +53,6 @@ void CustomPhysicsList::ConstructProcess() { <<"CustomPhysicsList: adding CustomPhysics processes " << "for the list of particles"; - fDecayProcess.reset(new G4Decay()); G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper(); for(auto particle : fParticleFactory.get()->GetCustomParticles()) { @@ -72,9 +68,6 @@ void CustomPhysicsList::ConstructProcess() { ph->RegisterProcess(new G4hMultipleScattering, particle); ph->RegisterProcess(new G4hIonisation, particle); } - if(fDecayProcess.get()->IsApplicable(*particle)) { - ph->RegisterProcess(fDecayProcess.get(), particle); - } if(cp->GetCloud() && fHadronicInteraction && CustomPDGParser::s_isRHadron(particle->GetPDGEncoding())) { edm::LogInfo("SimG4CoreCustomPhysics") From 8c6a2eef805634f9cffbbb1a5befeb03b5b7160f Mon Sep 17 00:00:00 2001 From: Felice Date: Wed, 14 Mar 2018 18:10:25 +0100 Subject: [PATCH 131/426] some consts and simplificiations --- RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc index 9f1c2dc073d70..ec48ade7afaca 100644 --- a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc +++ b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc @@ -212,7 +212,7 @@ math::XYZPoint HGCalImagingAlgo::calculatePosition(std::vector &v){ return math::XYZPoint(0, 0, 0); } -double HGCalImagingAlgo::calculateLocalDensity(std::vector &nd, KDTree &lp, const unsigned int layer){ +double HGCalImagingAlgo::calculateLocalDensity(std::vector &nd, KDTree &lp, const unsigned int layer) const{ double maxdensity = 0.; float delta_c; // maximum search distance (critical distance) for local density calculation @@ -238,7 +238,7 @@ double HGCalImagingAlgo::calculateLocalDensity(std::vector &nd, KDTree & return maxdensity; } -double HGCalImagingAlgo::calculateDistanceToHigher(std::vector &nd){ +double HGCalImagingAlgo::calculateDistanceToHigher(std::vector &nd) const { //sort vector of Hexels by decreasing local density @@ -288,7 +288,7 @@ double HGCalImagingAlgo::calculateDistanceToHigher(std::vector &nd){ } return maxdensity; } -int HGCalImagingAlgo::findAndAssignClusters(std::vector &nd, KDTree &lp, double maxdensity, KDTreeBox &bounds, const unsigned int layer, std::vector >& clustersOnLayer) { +int HGCalImagingAlgo::findAndAssignClusters(std::vector &nd, KDTree &lp, double maxdensity, KDTreeBox &bounds, const unsigned int layer, std::vector >& clustersOnLayer) const { //this is called once per layer and endcap... //so when filling the cluster temporary vector of Hexels we resize each time by the number @@ -451,8 +451,7 @@ math::XYZPoint HGCalImagingAlgo::calculatePositionWithFraction(const std::vector z += weight*hits[i].data.z; } math::XYZPoint result(x,y,z); - double norm_inv = 1.0/norm; - result *= norm_inv; + result /= norm; return result; } From 3cde54e2d6c2fbad70586483ef3efbcb56d27f1f Mon Sep 17 00:00:00 2001 From: Felice Date: Wed, 14 Mar 2018 18:12:06 +0100 Subject: [PATCH 132/426] some consts and simplificiations --- .../HGCalRecAlgos/src/HGCalImagingAlgo.cc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc index ec48ade7afaca..308f61cc328d5 100644 --- a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc +++ b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc @@ -169,11 +169,11 @@ std::vector HGCalImagingAlgo::getClusters(bool doSharing){ return clusters_v; } -math::XYZPoint HGCalImagingAlgo::calculatePosition(std::vector &v){ - float total_weight = 0.; - float x = 0.; - float y = 0.; - float z = 0.; +math::XYZPoint HGCalImagingAlgo::calculatePosition(std::vector &v) const { + float total_weight = 0.f; + float x = 0.f; + float y = 0.f; + float z = 0.f; unsigned int v_size = v.size(); unsigned int maxEnergyIndex = 0; float maxEnergyValue = 0; @@ -200,9 +200,10 @@ math::XYZPoint HGCalImagingAlgo::calculatePosition(std::vector &v){ if (!haloOnlyCluster) { if (total_weight != 0) { - return math::XYZPoint( x/total_weight, - y/total_weight, - z/total_weight ); + auto inv_tot_weight = 1./total_weight; + return math::XYZPoint( x*inv_tot_weight, + y*inv_tot_weight, + z*inv_tot_weight); } } else if (v_size > 0) { From 6f1323a6da47c77fdbe56028354fe1641e801eb2 Mon Sep 17 00:00:00 2001 From: Felice Date: Wed, 14 Mar 2018 18:17:50 +0100 Subject: [PATCH 133/426] some consts and simplificiations --- .../HGCalRecAlgos/interface/HGCalImagingAlgo.h | 14 +++++++------- .../HGCalRecAlgos/src/HGCalImagingAlgo.cc | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/RecoLocalCalo/HGCalRecAlgos/interface/HGCalImagingAlgo.h b/RecoLocalCalo/HGCalRecAlgos/interface/HGCalImagingAlgo.h index 71e96b69e311a..05bac9771daab 100644 --- a/RecoLocalCalo/HGCalRecAlgos/interface/HGCalImagingAlgo.h +++ b/RecoLocalCalo/HGCalRecAlgos/interface/HGCalImagingAlgo.h @@ -257,7 +257,7 @@ typedef KDTreeNodeInfoT KDNode; // A vector of vectors of KDNodes holding an Hexel in the clusters - to be used to build CaloClusters of DetIds std::vector< std::vector > current_v; -std::vector sort_by_delta(const std::vector &v){ +std::vector sort_by_delta(const std::vector &v) const { std::vector idx(v.size()); std::iota (std::begin(idx), std::end(idx), 0); sort(idx.begin(), idx.end(), @@ -275,18 +275,18 @@ std::vector > maxpos; //these functions should be in a helper class. -inline double distance2(const Hexel &pt1, const Hexel &pt2) { //distance squared +inline double distance2(const Hexel &pt1, const Hexel &pt2) const{ //distance squared const double dx = pt1.x - pt2.x; const double dy = pt1.y - pt2.y; return (dx*dx + dy*dy); } //distance squaredq -inline double distance(const Hexel &pt1, const Hexel &pt2) { //2-d distance on the layer (x-y) +inline double distance(const Hexel &pt1, const Hexel &pt2) const{ //2-d distance on the layer (x-y) return std::sqrt(distance2(pt1,pt2)); } -double calculateLocalDensity(std::vector &, KDTree &, const unsigned int); //return max density -double calculateDistanceToHigher(std::vector &); -int findAndAssignClusters(std::vector &, KDTree &, double, KDTreeBox &, const unsigned int, std::vector >&); -math::XYZPoint calculatePosition(std::vector &); +double calculateLocalDensity(std::vector &, KDTree &, const unsigned int) const; //return max density +double calculateDistanceToHigher(std::vector &) const; +int findAndAssignClusters(std::vector &, KDTree &, double, KDTreeBox &, const unsigned int, std::vector >&) const; +math::XYZPoint calculatePosition(std::vector &) const; // attempt to find subclusters within a given set of hexels std::vector findLocalMaximaInCluster(const std::vector&); diff --git a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc index 308f61cc328d5..d8c08302881e7 100644 --- a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc +++ b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc @@ -232,7 +232,7 @@ double HGCalImagingAlgo::calculateLocalDensity(std::vector &nd, KDTree & for(unsigned int j = 0; j < found_size; j++){ if(distance(nd[i].data,found[j].data) < delta_c){ nd[i].data.rho += found[j].data.weight; - if(nd[i].data.rho > maxdensity) maxdensity = nd[i].data.rho; + maxdensity = std::max(maxdensity, nd[i].data.rho); } } // end loop found } // end loop nodes From 7164401b6f1c7e85f7af95cbbf42cdc6d5156cdc Mon Sep 17 00:00:00 2001 From: Felice Date: Wed, 14 Mar 2018 18:20:16 +0100 Subject: [PATCH 134/426] replacing push with emplace --- RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc index d8c08302881e7..e7a83e2f6ccc4 100644 --- a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc +++ b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc @@ -161,8 +161,7 @@ std::vector HGCalImagingAlgo::getClusters(bool doSharing){ std::cout << " Eta = " << position.eta() << std::endl; std::cout << "*****************************" << std::endl; } - clusters_v.push_back(reco::BasicCluster(energy, position, caloID, thisCluster, - algoId)); + clusters_v.emplace_back(energy, position, caloID, thisCluster, algoId); thisCluster.clear(); } } From 3bd93ffa2cb218f8d4530e2da4cadefd81ad5865 Mon Sep 17 00:00:00 2001 From: Felice Date: Wed, 14 Mar 2018 18:20:51 +0100 Subject: [PATCH 135/426] OCD --- RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc index e7a83e2f6ccc4..d1de7866a2fb4 100644 --- a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc +++ b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc @@ -149,7 +149,7 @@ std::vector HGCalImagingAlgo::getClusters(bool doSharing){ { energy += it.data.isHalo ? 0. : it.data.weight; // use fraction to store whether this is a Halo hit or not - thisCluster.emplace_back(std::pair(it.data.detid,(it.data.isHalo?0.:1.))); + thisCluster.emplace_back(std::pair(it.data.detid,(it.data.isHalo?0.f:1.f))); }; if (verbosity < pINFO) { From 06765d7c82698f911f2ca01a47c526e846abbb8e Mon Sep 17 00:00:00 2001 From: Felice Date: Wed, 14 Mar 2018 18:22:40 +0100 Subject: [PATCH 136/426] replacing push with emplace --- RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc index d1de7866a2fb4..21b0734e26385 100644 --- a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc +++ b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc @@ -149,7 +149,7 @@ std::vector HGCalImagingAlgo::getClusters(bool doSharing){ { energy += it.data.isHalo ? 0. : it.data.weight; // use fraction to store whether this is a Halo hit or not - thisCluster.emplace_back(std::pair(it.data.detid,(it.data.isHalo?0.f:1.f))); + thisCluster.emplace_back(it.data.detid,(it.data.isHalo ? 0.f : 1.f)); }; if (verbosity < pINFO) { From 51ea7dde868d403d6e3a62ca040e5789df3af36b Mon Sep 17 00:00:00 2001 From: Felice Date: Wed, 14 Mar 2018 18:23:43 +0100 Subject: [PATCH 137/426] replacing push with emplace --- RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc index 21b0734e26385..b7868a6a30a8d 100644 --- a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc +++ b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc @@ -138,8 +138,7 @@ std::vector HGCalImagingAlgo::getClusters(bool doSharing){ std::cout << "\t Eta = " << position.eta() << std::endl; std::cout << "\t*****************************" << std::endl; } - clusters_v.push_back(reco::BasicCluster(energy, position, caloID, thisCluster, - algoId)); + clusters_v.emplace_back(energy, position, caloID, thisCluster,algoId); thisCluster.clear(); } }else{ From 775ad74c2cbc893e189193677eb47d2aeca24bb7 Mon Sep 17 00:00:00 2001 From: Felice Date: Wed, 14 Mar 2018 18:27:48 +0100 Subject: [PATCH 138/426] reversing if predicates, less expensive first --- RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc index b7868a6a30a8d..7febb0c858b18 100644 --- a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc +++ b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc @@ -418,7 +418,7 @@ std::vector HGCalImagingAlgo::findLocalMaximaInCluster(const std::vect for( unsigned i = 0; i < cluster.size(); ++i ) { for( unsigned j = 0; j < cluster.size(); ++j ) { - if( distance(cluster[i].data,cluster[j].data) < delta_c && i != j) { + if( i != j and distance(cluster[i].data,cluster[j].data) < delta_c ) { if( cluster[i].data.weight < cluster[j].data.weight ) { seed[i] = false; break; From f35ef9d8612367aeb62a1e7fa8326fd06cb3aea8 Mon Sep 17 00:00:00 2001 From: Felice Date: Wed, 14 Mar 2018 18:37:23 +0100 Subject: [PATCH 139/426] this is wrong on so many levels --- RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc index 7febb0c858b18..3e2d1eea0cb44 100644 --- a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc +++ b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc @@ -506,7 +506,7 @@ void HGCalImagingAlgo::shareEnergy(const std::vector& incluster, const unsigned iterMax = 50; double diff = std::numeric_limits::max(); const double stoppingTolerance = 1e-8; - const double toleranceScaling = std::pow(std::max(1.0,seeds.size()-1.0),2.0); + auto toleranceScaling = seeds.size() > 2 ? (seeds.size()-1)*(seeds.size()-1) : 1; std::vector prevCentroids; std::vector frac(seeds.size()), dist2(seeds.size()); while( iter++ < iterMax && diff > stoppingTolerance*toleranceScaling ) { From 7d199012dc2bdda6db671772aa98f4ebbe289edc Mon Sep 17 00:00:00 2001 From: Felice Date: Wed, 14 Mar 2018 18:58:41 +0100 Subject: [PATCH 140/426] some improvements --- .../HGCalRecAlgos/src/HGCalImagingAlgo.cc | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc index 3e2d1eea0cb44..e35068fb56e7f 100644 --- a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc +++ b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc @@ -506,14 +506,15 @@ void HGCalImagingAlgo::shareEnergy(const std::vector& incluster, const unsigned iterMax = 50; double diff = std::numeric_limits::max(); const double stoppingTolerance = 1e-8; - auto toleranceScaling = seeds.size() > 2 ? (seeds.size()-1)*(seeds.size()-1) : 1; + const auto numberOfSeeds = seeds.size(); + auto toleranceScaling = numberOfSeeds > 2 ? (numberOfSeeds-1)*(numberOfSeeds-1) : 1; std::vector prevCentroids; - std::vector frac(seeds.size()), dist2(seeds.size()); + std::vector frac(numberOfSeeds), dist2(numberOfSeeds); while( iter++ < iterMax && diff > stoppingTolerance*toleranceScaling ) { for( unsigned i = 0; i < incluster.size(); ++i ) { const Hexel& ihit = incluster[i].data; double fracTot(0.0); - for( unsigned j = 0; j < seeds.size(); ++j ) { + for( unsigned j = 0; j < numberOfSeeds; ++j ) { double fraction = 0.0; double d2 = ( std::pow(ihit.x - centroids[j].x(),2.0) + std::pow(ihit.y - centroids[j].y(),2.0) + @@ -532,7 +533,7 @@ void HGCalImagingAlgo::shareEnergy(const std::vector& incluster, } // now that we have calculated all fractions for all hits // assign the new fractions - for( unsigned j = 0; j < seeds.size(); ++j ) { + for( unsigned j = 0; j < numberOfSeeds; ++j ) { if( fracTot > minFracTot || ( i == seeds[j] && fracTot > 0.0 ) ) { outclusters[j][i] = frac[j]/fracTot; @@ -545,14 +546,14 @@ void HGCalImagingAlgo::shareEnergy(const std::vector& incluster, // save previous centroids prevCentroids = std::move(centroids); // finally update the position of the centroids from the last iteration - centroids.resize(seeds.size()); + centroids.resize(numberOfSeeds); double diff2 = 0.0; - for( unsigned i = 0; i < seeds.size(); ++i ) { + for( unsigned i = 0; i < numberOfSeeds; ++i ) { centroids[i] = calculatePositionWithFraction(incluster,outclusters[i]); energies[i] = calculateEnergyWithFraction(incluster,outclusters[i]); // calculate convergence parameters const double delta2 = (prevCentroids[i]-centroids[i]).perp2(); - if( delta2 > diff2 ) diff2 = delta2; + diff2 = std::max(delta2, diff2); } //update convergance parameter outside loop diff = std::sqrt(diff2); @@ -589,7 +590,7 @@ void HGCalImagingAlgo::computeThreshold() { else if( thickness>199. && thickness<201. ) thickIndex=1; else if( thickness>299. && thickness<301. ) thickIndex=2; else assert( thickIndex>0 && "ERROR - silicon thickness has a nonsensical value" ); - float sigmaNoise = 0.001 * fcPerEle * nonAgedNoises[thickIndex] * dEdXweights[layer] / (fcPerMip[thickIndex] * thicknessCorrection[thickIndex]); + float sigmaNoise = 0.001f * fcPerEle * nonAgedNoises[thickIndex] * dEdXweights[layer] / (fcPerMip[thickIndex] * thicknessCorrection[thickIndex]); thresholds[layer-1][wafer]=sigmaNoise*ecut; v_sigmaNoise[layer-1][wafer] = sigmaNoise; } @@ -598,7 +599,7 @@ void HGCalImagingAlgo::computeThreshold() { // now BH, much faster for ( unsigned ilayer=lastLayerFH+1;ilayer<=maxlayer;++ilayer) { - float sigmaNoise = 0.001 * noiseMip * dEdXweights[ilayer]; + float sigmaNoise = 0.001f * noiseMip * dEdXweights[ilayer]; std::vector bhDummy_thresholds; std::vector bhDummy_sigmaNoise; bhDummy_thresholds.push_back(sigmaNoise*ecut); From 946c5158bbe3b95e55837ff657ca5e5feb1bcfe0 Mon Sep 17 00:00:00 2001 From: Felice Date: Wed, 14 Mar 2018 20:59:44 +0100 Subject: [PATCH 141/426] applying clang tidy --- RecoLocalCalo/HGCalRecAlgos/interface/HGCalImagingAlgo.h | 2 +- RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/RecoLocalCalo/HGCalRecAlgos/interface/HGCalImagingAlgo.h b/RecoLocalCalo/HGCalRecAlgos/interface/HGCalImagingAlgo.h index 05bac9771daab..2e12faa4afc47 100644 --- a/RecoLocalCalo/HGCalRecAlgos/interface/HGCalImagingAlgo.h +++ b/RecoLocalCalo/HGCalRecAlgos/interface/HGCalImagingAlgo.h @@ -228,7 +228,7 @@ struct Hexel { clusterIndex(-1), sigmaNoise(sigmaNoise_in), thickness(thickness_in), tools(tools_in) { - const GlobalPoint position( std::move( tools->getPosition( detid ) ) ); + const GlobalPoint position( tools->getPosition( detid ) ); weight = hit.energy(); x = position.x(); y = position.y(); diff --git a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc index e35068fb56e7f..61634ba46abd2 100644 --- a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc +++ b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc @@ -45,7 +45,7 @@ void HGCalImagingAlgo::populate(const HGCRecHitCollection& hits){ // determine whether this is a half-hexagon bool isHalf = rhtools_.isHalfCell(detid); - const GlobalPoint position( std::move( rhtools_.getPosition( detid ) ) ); + const GlobalPoint position( rhtools_.getPosition( detid ) ); //here's were the KDNode is passed its dims arguments - note that these are *copied* from the Hexel points[layer].emplace_back(Hexel(hgrh,detid,isHalf,sigmaNoise,thickness,&rhtools_),position.x(),position.y()); From 6b5c199f31b38bf7d296c19ac3c32e09ad883bbf Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Wed, 14 Mar 2018 16:20:36 -0500 Subject: [PATCH 142/426] Make Timing Service work with SubProcess --- FWCore/Services/plugins/Timing.cc | 127 +++++++++++++++++++++++++----- 1 file changed, 106 insertions(+), 21 deletions(-) diff --git a/FWCore/Services/plugins/Timing.cc b/FWCore/Services/plugins/Timing.cc index d95ac557d6aaa..894be2a4140ce 100644 --- a/FWCore/Services/plugins/Timing.cc +++ b/FWCore/Services/plugins/Timing.cc @@ -18,9 +18,11 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/ServiceRegistry/interface/ActivityRegistry.h" +#include "FWCore/ServiceRegistry/interface/GlobalContext.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/ServiceRegistry/interface/StreamContext.h" #include "FWCore/ServiceRegistry/interface/ModuleCallingContext.h" +#include "FWCore/ServiceRegistry/interface/ProcessContext.h" #include "FWCore/ServiceRegistry/interface/SystemBounds.h" #include "FWCore/Utilities/interface/Exception.h" @@ -52,11 +54,13 @@ namespace edm { private: + void preBeginJob(PathsAndConsumesOfModulesBase const&, ProcessContext const&); void postBeginJob(); void postEndJob(); void preEvent(StreamContext const&); void postEvent(StreamContext const&); + void lastPostEvent(double curr_event_time, unsigned int index, StreamContext const& iStream); void postModuleEvent(StreamContext const&, ModuleCallingContext const&); @@ -137,6 +141,12 @@ namespace edm { std::atomic countAndTimeForGet_; double accumulatedTimeForGet_; + + std::vector>> countSubProcessesPreEvent_; + std::vector>> countSubProcessesPostEvent_; + + bool configuredInTopLevelProcess_; + unsigned int nSubProcesses_; }; } } @@ -202,7 +212,10 @@ namespace edm { } static - void pushStack() { + void pushStack(bool configuredInTopLevelProcess) { + if (!configuredInTopLevelProcess) { + return; + } auto& modStack = moduleTimeStack(); modStack.push_back(getTime()); } @@ -226,8 +239,11 @@ namespace edm { countAndTimeForLock_{&countAndTimeZero_}, accumulatedTimeForLock_{0.0}, countAndTimeForGet_{&countAndTimeZero_}, - accumulatedTimeForGet_{0.0} { + accumulatedTimeForGet_{0.0}, + configuredInTopLevelProcess_{false}, + nSubProcesses_{0} { + iRegistry.watchPreBeginJob(this, &Timing::preBeginJob); iRegistry.watchPostBeginJob(this, &Timing::postBeginJob); iRegistry.watchPostEndJob(this, &Timing::postEndJob); @@ -308,9 +324,12 @@ namespace edm { sum_events_time_.resize(nStreams_,0.); max_events_time_.resize(nStreams_,0.); min_events_time_.resize(nStreams_,1.E6); - + for (unsigned int i = 0; i < nStreams_; ++i) { + countSubProcessesPreEvent_.emplace_back(std::make_unique>(0)); + countSubProcessesPostEvent_.emplace_back(std::make_unique>(0)); + } }); - + iRegistry.postGlobalEndRunSignal_.connect([this](edm::GlobalContext const&) { last_run_time_ = getTime(); last_run_cpu_ = getCPU(); @@ -343,7 +362,18 @@ namespace edm { "This service reports the time it takes to run each module in a job."); } + void Timing::preBeginJob(PathsAndConsumesOfModulesBase const& pathsAndConsumes, ProcessContext const& pc) { + if (pc.isSubProcess()) { + ++nSubProcesses_; + } else { + configuredInTopLevelProcess_ = true; + } + } + void Timing::postBeginJob() { + if (!configuredInTopLevelProcess_) { + return; + } curr_job_time_ = getTime(); curr_job_cpu_ = getCPU(); @@ -359,6 +389,14 @@ namespace edm { } void Timing::postEndJob() { + + if (!configuredInTopLevelProcess_) { + LogImportant("TimeReport") << "\nTimeReport> This instance of the Timing Service will be disabled because it is configured in a SubProcess.\n" + << "If multiple instances of the TimingService were configured only the one in the top level process will function.\n" + << "The other instance(s) will simply print this message and do nothing.\n\n"; + return; + } + const double job_end_time =getTime(); const double job_end_cpu =getCPU(); double total_job_time = job_end_time - jobStartTime(); @@ -453,23 +491,48 @@ namespace edm { } void Timing::preEvent(StreamContext const& iStream) { + if (!configuredInTopLevelProcess_) { + return; + } auto index = iStream.streamID().value(); - curr_events_time_[index] = getTime(); + if (nSubProcesses_ == 0u) { + curr_events_time_[index] = getTime(); + } else { + unsigned int count = ++(*countSubProcessesPreEvent_[index]); + if (count == 1) { + curr_events_time_[index] = getTime(); + } else if (count == (nSubProcesses_ + 1)) { + *countSubProcessesPreEvent_[index] = 0; + } + } } void Timing::postEvent(StreamContext const& iStream) { + if (!configuredInTopLevelProcess_) { + return; + } auto index = iStream.streamID().value(); + if (nSubProcesses_ == 0u) { + lastPostEvent(getTime() - curr_events_time_[index], index, iStream); + } else { + unsigned int count = ++(*countSubProcessesPostEvent_[index]); + if (count == (nSubProcesses_ + 1)) { + lastPostEvent(getTime() - curr_events_time_[index], index, iStream); + *countSubProcessesPostEvent_[index] = 0; + } + } + } - double curr_event_time = getTime() - curr_events_time_[index]; + void Timing::lastPostEvent(double curr_event_time, unsigned int index, StreamContext const& iStream) { sum_events_time_[index] +=curr_event_time; if(not summary_only_) { auto const & eventID = iStream.eventID(); LogPrint("TimeEvent") - << "TimeEvent> " - << eventID.event() << " " - << eventID.run() << " " - << curr_event_time ; + << "TimeEvent> " + << eventID.event() << " " + << eventID.run() << " " + << curr_event_time ; } if(curr_event_time > max_events_time_[index]) max_events_time_[index] = curr_event_time; if(curr_event_time < min_events_time_[index]) min_events_time_[index] = curr_event_time; @@ -477,6 +540,9 @@ namespace edm { } void Timing::postModuleEvent(StreamContext const& iStream, ModuleCallingContext const& iModule) { + if (!configuredInTopLevelProcess_) { + return; + } auto const & eventID = iStream.eventID(); auto const & desc = *(iModule.moduleDescription()); double t = postCommon(); @@ -491,7 +557,7 @@ namespace edm { } void Timing::preSourceEvent(StreamID sid) { - pushStack(); + pushStack(configuredInTopLevelProcess_); } void Timing::postSourceEvent(StreamID sid) { @@ -499,7 +565,7 @@ namespace edm { } void Timing::preSourceLumi(LuminosityBlockIndex index) { - pushStack(); + pushStack(configuredInTopLevelProcess_); } void Timing::postSourceLumi(LuminosityBlockIndex index) { @@ -507,7 +573,7 @@ namespace edm { } void Timing::preSourceRun(RunIndex index) { - pushStack(); + pushStack(configuredInTopLevelProcess_); } void Timing::postSourceRun(RunIndex index) { @@ -515,7 +581,7 @@ namespace edm { } void Timing::preOpenFile(std::string const& lfn, bool b) { - pushStack(); + pushStack(configuredInTopLevelProcess_); } void Timing::postOpenFile(std::string const& lfn, bool b) { @@ -524,7 +590,7 @@ namespace edm { void Timing::preModule(ModuleDescription const&) { - pushStack(); + pushStack(configuredInTopLevelProcess_); } void @@ -534,7 +600,7 @@ namespace edm { void Timing::preModuleGlobal(GlobalContext const&, ModuleCallingContext const&) { - pushStack(); + pushStack(configuredInTopLevelProcess_); } void @@ -543,18 +609,28 @@ namespace edm { } void - Timing::postGlobalBeginRun(GlobalContext const&) { - ++begin_run_count_; + Timing::postGlobalBeginRun(GlobalContext const& gc) { + if (!configuredInTopLevelProcess_) { + return; + } + if (!gc.processContext()->isSubProcess()) { + ++begin_run_count_; + } } void - Timing::postGlobalBeginLumi(GlobalContext const&) { - ++begin_lumi_count_; + Timing::postGlobalBeginLumi(GlobalContext const& gc) { + if (!configuredInTopLevelProcess_) { + return; + } + if (!gc.processContext()->isSubProcess()) { + ++begin_lumi_count_; + } } void Timing::preModuleStream(StreamContext const&, ModuleCallingContext const&) { - pushStack(); + pushStack(configuredInTopLevelProcess_); } void @@ -564,6 +640,9 @@ namespace edm { double Timing::postCommon() const { + if (!configuredInTopLevelProcess_) { + return 0.0; + } double t = popStack(); if(t > threshold_) { LogError("ExcessiveTime") @@ -579,6 +658,9 @@ namespace edm { eventsetup::EventSetupRecordKey const&, eventsetup::DataKey const&) { + if (!configuredInTopLevelProcess_) { + return; + } accumulateTimeBegin(countAndTimeForLock_, accumulatedTimeForLock_); } @@ -587,6 +669,9 @@ namespace edm { eventsetup::EventSetupRecordKey const&, eventsetup::DataKey const&) { + if (!configuredInTopLevelProcess_) { + return; + } accumulateTimeEnd(countAndTimeForLock_, accumulatedTimeForLock_); accumulateTimeBegin(countAndTimeForGet_, accumulatedTimeForGet_); } From 1dd6290e4d4c6aaa90f6f9aa4a7bf69da89bf41a Mon Sep 17 00:00:00 2001 From: Felice Date: Wed, 14 Mar 2018 23:08:40 +0100 Subject: [PATCH 143/426] isolate parallel for --- RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc index 61634ba46abd2..a37dace97305d 100644 --- a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc +++ b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc @@ -12,6 +12,9 @@ #include "FWCore/Concurrency/interface/SerialTaskQueue.h" #include "tbb/tbb.h" +#include "tbb/task_arena.h" + + void HGCalImagingAlgo::populate(const HGCRecHitCollection& hits){ //loop over all hits and create the Hexel structure, skip energies below ecut @@ -73,6 +76,7 @@ void HGCalImagingAlgo::makeClusters() std::vector > > layerClustersPerLayer(2*(maxlayer+2)); edm::SerialTaskQueue layersQueue; //assign all hits in each layer to a cluster core or halo + tbb::this_task_arena::isolate( [&]{ tbb::parallel_for(size_t(0), size_t(2*maxlayer+2), [&](size_t i) { KDTreeBox bounds(minpos[i][0],maxpos[i][0], minpos[i][1],maxpos[i][1]); @@ -93,6 +97,7 @@ void HGCalImagingAlgo::makeClusters() } ); } }); + }); } std::vector HGCalImagingAlgo::getClusters(bool doSharing){ From 1f6cb85f2f0f403cbf03a5f7e1dc0db393aa8299 Mon Sep 17 00:00:00 2001 From: Raffaele Date: Thu, 15 Mar 2018 11:24:07 +0100 Subject: [PATCH 144/426] last fixes --- .../python/OfflineDbClient_cff.py | 44 ++++++++---- .../test/analysis_test_cfg.py | 38 ---------- .../test/source_test_cfg.py | 41 ----------- .../src/AnalysisDescriptions.cc | 72 ++++++++++++------- 4 files changed, 77 insertions(+), 118 deletions(-) delete mode 100644 DQM/SiStripCommissioningDbClients/test/analysis_test_cfg.py delete mode 100644 DQM/SiStripCommissioningDbClients/test/source_test_cfg.py diff --git a/DQM/SiStripCommissioningDbClients/python/OfflineDbClient_cff.py b/DQM/SiStripCommissioningDbClients/python/OfflineDbClient_cff.py index 4242f7c885e6d..a6d9d073340a5 100644 --- a/DQM/SiStripCommissioningDbClients/python/OfflineDbClient_cff.py +++ b/DQM/SiStripCommissioningDbClients/python/OfflineDbClient_cff.py @@ -33,25 +33,43 @@ SkipGainUpdate = cms.bool(False) # wether to keep the gain the same as already on the db ), PedestalsParameters = cms.PSet( - DeadStripMax = cms.double(10), # number times the noise spread below mean noise - NoisyStripMin = cms.double(10), # number times the noise spread above mean noise + DeadStripMax = cms.double(10), # number times the noise spread below mean noise + NoisyStripMin = cms.double(10), # number times the noise spread above mean noise HighThreshold = cms.double(5), # analysis-wide high threshold for the fed zero suppression LowThreshold = cms.double(2), # analysis-wide low threshold for the fed zero suppression DisableBadStrips = cms.bool(False), # for experts! disables bad strips on the fed level - AddBadStrips = cms.bool(False), #for experts! keep and add disabled bad strips. - KeepsStripsDisabled = cms.bool(False) # for experts! keep strips disabled as in the db's current state + AddBadStrips = cms.bool(False), #for experts! keep and add disabled bad strips. + KeepStripsDisabled = cms.bool(False) # for experts! keep strips disabled as in the db's current state ), PedsOnlyParameters = cms.PSet(), + ### Bad channel analysis PedsFullNoiseParameters = cms.PSet( - DeadStripMax = cms.double(10), # number times the noise spread below mean noise - NoisyStripMin = cms.double(10), # number times the noise spread above mean noise - HighThreshold = cms.double(5), # analysis-wide high threshold for the fed zero suppression - LowThreshold = cms.double(2), # analysis-wide low threshold for the fed zero suppression - KsProbCut = cms.double(10), - DisableBadStrips = cms.bool(False), # for experts! disables bad strips on the fed level - AddBadStrips = cms.bool(False), #for experts! keep and add disabled bad strips. - KeepsStripsDisabled = cms.bool(False) # for experts! keeps strip disabling as in the db's current state - ), + #### selections used to define a bad strip + MaxDriftResidualCut = cms.double(20), ### the strip baseline can drift during run .. if more then N ADC count, mark the strip as bad + MinStripNoiseCut = cms.double(2), ### if a strip has a noise value less the N ADC, mark as low noisy i.e. bad + MaxStripNoiseCut = cms.double(30), ### if a strip has a noise value larger than N ADC, mark strip has high noisy i.e. bad + MaxStripNoiseSignificanceCut = cms.double(10), ## if a strip has a noise significance larger than N, mark it as bad + AdProbabCut = cms.double(0.002699796063), ### this is 3 sigma quantile selection on the AndersonDarling p-value + KsProbabCut = cms.double(0.002699796063), ### this is 3 sigma quantile selection on the Kolmogorov Smirnov p-value + GenerateRandomHisto = cms.bool(False), ### random sampling of the gaussian fit or not while computing p-values + JbProbabCut = cms.double(0.000000573303), ### this is 3 sigma quantile selection on the jacque-Bera p-value + Chi2ProbabCut = cms.double(0.000000573303), ### this is 3 sigma quantile selection on the chi2 p-value (from a Gaussian fit) + KurtosisCut = cms.double(2), ### max value of kurtosis to identify strips with long tails + IntegralNsigma = cms.int32(5), ### this is expressed in terms of number of gaussian quantiles .. 5 means take the integral 5-sigma from the peak + IntegralTailCut = cms.double(0.0005), ### selection on the N-sigma integral + AshmanDistance = cms.double(2), ### to flag double peaked strips + AmplitudeRatio = cms.double(0.85), ### to flag double peaked strips + #### Zero suppression information + HighThreshold = cms.double(5), ### analysis-wide high threshold for the fed zero suppression + LowThreshold = cms.double(2), ### analysis-wide low threshold for the fed zero suppression + #### Flags on bad strips + DisableBadStrips = cms.bool(True), ### When the upload is performed, strips are masked in case they are flagged by the analysis + KeepStripsDisabled = cms.bool(False), ### True: if a strip is already flagged bad in the db, it will be kept bad; False: if a strip was bad, now the analysis will tell us if it's bad or not + UploadOnlyStripBadChannelBit = cms.bool(False), ### True: means that pedestal and noise values are not changed in the FED version --> use old values + SkipEmptyStrips = cms.bool(True), ### In the analysis, if true strips with no data are not marked as bad but as dead --> could be mis-configured at the time of the run, not masked + UploadPedsFullNoiseDBTable = cms.bool(False) ### Tell whether the PedsFullNoise DB table needs to be uploaded --> for the time being this can be done ONLY on the oracle test account. + ), SamplingParameters = cms.PSet(), VpspScanParameters = cms.PSet(), ) + diff --git a/DQM/SiStripCommissioningDbClients/test/analysis_test_cfg.py b/DQM/SiStripCommissioningDbClients/test/analysis_test_cfg.py deleted file mode 100644 index 2b172a7724fec..0000000000000 --- a/DQM/SiStripCommissioningDbClients/test/analysis_test_cfg.py +++ /dev/null @@ -1,38 +0,0 @@ -import FWCore.ParameterSet.Config as cms -process = cms.Process("SiStripCommissioningOfflineDbClient") -process.load("DQM.SiStripCommon.MessageLogger_cfi") -process.load("DQM.SiStripCommon.DaqMonitorROOTBackEnd_cfi") - -process.load("OnlineDB.SiStripConfigDb.SiStripConfigDb_cfi") -process.SiStripConfigDb.UsingDb = True ### cause we don't have access to the db -process.SiStripConfigDb.ConfDb = 'overwritten/by@confdb' -process.SiStripConfigDb.Partitions.PrimaryPartition.PartitionName = 'CR_14-JUL-2017_1' -process.SiStripConfigDb.Partitions.PrimaryPartition.RunNumber = 299055 -process.SiStripConfigDb.TNS_ADMIN = '/home/xdaqtk/' - -process.source = cms.Source("EmptySource") -process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(2) ) - -process.load("DQM.SiStripCommissioningDbClients.OfflineDbClient_cff") -process.db_client.FilePath = cms.untracked.string('./') -process.db_client.RunNumber = cms.untracked.uint32(299055) -process.db_client.UseClientFile = cms.untracked.bool(False) -process.db_client.DisableDevices = cms.untracked.bool(False) -process.db_client.UploadHwConfig = cms.untracked.bool(False) -process.db_client.UploadAnalyses = cms.untracked.bool(False) -process.db_client.SaveClientFile = cms.untracked.bool(True) -### Bad strip analysis options -process.db_client.PedsFullNoiseParameters.DisableBadStrips = cms.bool(True) -process.db_client.PedsFullNoiseParameters.KeepStripsDisabled = cms.bool(False) -process.db_client.PedsFullNoiseParameters.UploadOnlyStripBadChannelBit = cms.bool(False) -process.db_client.PedsFullNoiseParameters.SkipEmptyStrips = cms.bool(True) -process.db_client.PedsFullNoiseParameters.UploadPedsFullNoiseDBTable = cms.bool(False) - -process.db_client.OutputRootFile = cms.untracked.string("SiStripCommissioningClient_CRACK") - -process.p = cms.Path(process.db_client) - - -processDumpFile = open('processDump.py', 'w') -print >> processDumpFile, process.dumpPython() - diff --git a/DQM/SiStripCommissioningDbClients/test/source_test_cfg.py b/DQM/SiStripCommissioningDbClients/test/source_test_cfg.py deleted file mode 100644 index acc6977b4a5e4..0000000000000 --- a/DQM/SiStripCommissioningDbClients/test/source_test_cfg.py +++ /dev/null @@ -1,41 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -process = cms.Process("Source") - -process.load("DQM.SiStripCommon.MessageLogger_cfi") - -process.load("DQM.SiStripCommon.DaqMonitorROOTBackEnd_cfi") - -process.load("OnlineDB.SiStripConfigDb.SiStripConfigDb_cfi") -process.SiStripConfigDb.UsingDb = True # should be true! -process.SiStripConfigDb.ConfDb = 'user/password@account' # taken from $CONFDB -process.SiStripConfigDb.Partitions.PrimaryPartition.PartitionName = 'CR_14-JUL-2017_1' -process.SiStripConfigDb.Partitions.PrimaryPartition.RunNumber = 299055 - -process.SiStripCondObjBuilderFromDb = cms.Service("SiStripCondObjBuilderFromDb") -process.FedCablingFromConfigDb = cms.ESSource("SiStripFedCablingBuilderFromDb", - CablingSource = cms.untracked.string('UNDEFINED') ## <-- this should be replaced by "DEVICES" for a connection run! -) -process.SiStripDetInfoFileReader = cms.Service("SiStripDetInfoFileReader") -process.PedestalsFromConfigDb = cms.ESSource("SiStripPedestalsBuilderFromDb") -process.NoiseFromConfigDb = cms.ESSource("SiStripNoiseBuilderFromDb") -# produce SiStripFecCabling and SiStripDetCabling out of SiStripFedCabling -process.sistripconn = cms.ESProducer("SiStripConnectivity") - -process.source = cms.Source("NewEventStreamFileReader", - fileNames = cms.untracked.vstring() -) -process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) ) - -process.load("EventFilter.SiStripRawToDigi.FedChannelDigis_cfi") -process.FedChannelDigis.UnpackBadChannels = cms.bool(False) - -process.load("DQM.SiStripCommissioningSources.CommissioningHistos_cfi") -process.CommissioningHistos.CommissioningTask = 'PEDS_FULL_NOISE' # <-- run type taken from event data, but can be overriden -process.CommissioningHistos.PedsFullNoiseParameters.NrEvToSkipAtStart = 100 -process.CommissioningHistos.PedsFullNoiseParameters.NrEvForPeds = 1000 -process.CommissioningHistos.PedsFullNoiseParameters.FillNoiseProfile = True - -process.p = cms.Path(process.FedChannelDigis*process.CommissioningHistos) - -process.source.fileNames.extend(cms.untracked.vstring('file:/exports/Data/closed/USC.00299055.0001.A.storageManager.00.0000.dat')) diff --git a/OnlineDB/SiStripConfigDb/src/AnalysisDescriptions.cc b/OnlineDB/SiStripConfigDb/src/AnalysisDescriptions.cc index cbdb736d510e9..0051dbe42c379 100644 --- a/OnlineDB/SiStripConfigDb/src/AnalysisDescriptions.cc +++ b/OnlineDB/SiStripConfigDb/src/AnalysisDescriptions.cc @@ -72,6 +72,11 @@ SiStripConfigDb::AnalysisDescriptionsRange SiStripConfigDb::getAnalysisDescripti iter->second.pedestalsVersion().first, iter->second.pedestalsVersion().second, analysis_type ); + } else if ( analysis_type == AnalysisDescription::T_ANALYSIS_PEDSFULLNOISE ) { + tmp1 = deviceFactory(__func__)->getAnalysisHistory( iter->second.partitionName(), + iter->second.pedestalsVersion().first, + iter->second.pedestalsVersion().second, + analysis_type ); } else if ( analysis_type == AnalysisDescription::T_ANALYSIS_APVLATENCY ) { tmp1 = deviceFactory(__func__)->getAnalysisHistory( iter->second.partitionName(), iter->second.apvLatencyVersion().first, @@ -201,7 +206,7 @@ void SiStripConfigDb::addAnalysisDescriptions( std::string partition, AnalysisDe // Add to local cache analyses_.loadNext( partition, tmp ); - + // Some debug std::stringstream ss; ss << "[SiStripConfigDb::" << __func__ << "]" @@ -211,7 +216,6 @@ void SiStripConfigDb::addAnalysisDescriptions( std::string partition, AnalysisDe << " (Cache holds analysis descriptions for " << analyses_.size() << " partitions.)"; LogTrace(mlConfigDb_) << ss.str(); - } else { stringstream ss; ss << "[SiStripConfigDb::" << __func__ << "]" @@ -261,29 +265,46 @@ void SiStripConfigDb::uploadAnalysisDescriptions( bool calibration_for_physics, for ( ; iter != jter; ++iter ) { if ( partition == "" || partition == iter->second.partitionName() ) { - + AnalysisDescriptionsRange range = analyses_.find( iter->second.partitionName() ); if ( range != analyses_.emptyRange() ) { - - AnalysisDescriptionsV anals( range.begin(), range.end() ); - - AnalysisType analysis_type = AnalysisDescription::T_UNKNOWN; - if ( anals.front() ) { analysis_type = anals.front()->getType(); } - if ( analysis_type == AnalysisDescription::T_UNKNOWN ) { - edm::LogWarning(mlConfigDb_) - << "[SiStripConfigDb::" << __func__ << "]" - << " Analysis type is UNKNOWN. Aborting upload!"; - return; + + AnalysisDescriptionsV anals( range.begin(), range.end() ); /// list of all analysis type + + vector analysis_type; // check how many different analysis type we have --> more than one analysis table could be uploaded in the same job + for(auto element : anals){ + if(std::find(analysis_type.begin(),analysis_type.end(),element->getType()) == analysis_type.end() and element->getType() != AnalysisDescription::T_UNKNOWN){ + analysis_type.push_back(element->getType()); + } + else if(element->getType() == AnalysisDescription::T_UNKNOWN){ + edm::LogWarning(mlConfigDb_) + << "[SiStripConfigDb::" << __func__ << "]" + << " Analysis type is UNKNOWN. Aborting upload!"; + return; + } } - - uint32_t version = deviceFactory(__func__)->uploadAnalysis( iter->second.runNumber(), - iter->second.partitionName(), - analysis_type, - anals, - calibration_for_physics ); + + vector analysisToUpload; // in case there are more than one analysis type to be uploaded + for(auto type : analysis_type){ + AnalysisDescriptionsV ana_temp; + for(auto element : anals){ + if(element->getType() == type) + ana_temp.push_back(element); + } + analysisToUpload.push_back(ana_temp); + } + + // perform the upload + for(auto analysis : analysisToUpload){ - // Update current state with analysis descriptions - if ( calibration_for_physics ) { deviceFactory(__func__)->uploadAnalysisState( version ); } + uint32_t version = deviceFactory(__func__)->uploadAnalysis( iter->second.runNumber(), + iter->second.partitionName(), + analysis.front()->getType(), + analysis, + calibration_for_physics); + // Update current state with analysis descriptions + if ( calibration_for_physics ) { deviceFactory(__func__)->uploadAnalysisState( version );} + } // Some debug std::stringstream ss; @@ -303,7 +324,7 @@ void SiStripConfigDb::uploadAnalysisDescriptions( bool calibration_for_physics, continue; } - } else { + }else { // stringstream ss; // ss << "[SiStripConfigDb::" << __func__ << "]" // << " Cannot find partition \"" << partition @@ -311,10 +332,8 @@ void SiStripConfigDb::uploadAnalysisDescriptions( bool calibration_for_physics, // << dbParams_.partitionNames( dbParams_.partitionNames() ) // << "\", therefore aborting upload for this partition!"; // edm::LogWarning(mlConfigDb_) << ss.str(); - } - - } - + } + } } catch (...) { handleException( __func__ ); } allowCalibUpload_ = true; @@ -514,6 +533,7 @@ std::string SiStripConfigDb::analysisType( AnalysisType analysis_type ) const { else if ( analysis_type == AnalysisDescription::T_ANALYSIS_TIMING ) { return "APV_TIMING"; } else if ( analysis_type == AnalysisDescription::T_ANALYSIS_OPTOSCAN ) { return "OPTO_SCAN"; } else if ( analysis_type == AnalysisDescription::T_ANALYSIS_PEDESTALS ) { return "PEDESTALS"; } + else if ( analysis_type == AnalysisDescription::T_ANALYSIS_PEDSFULLNOISE ) { return "PEDSFULLNOISE"; } else if ( analysis_type == AnalysisDescription::T_ANALYSIS_APVLATENCY ) { return "APV_LATENCY"; } else if ( analysis_type == AnalysisDescription::T_ANALYSIS_FINEDELAY ) { return "FINE_DELAY"; } else if ( analysis_type == AnalysisDescription::T_ANALYSIS_CALIBRATION ) { return "CALIBRATION"; } From aad6e5e57e7addabaecba5fcd226801cf719e913 Mon Sep 17 00:00:00 2001 From: Raffaele Date: Thu, 15 Mar 2018 14:21:02 +0100 Subject: [PATCH 145/426] better tune for pulse shape fit --- .../src/CalibrationAlgorithm.cc | 7 ++++--- .../src/CalibrationHistograms.cc | 7 +++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/DQM/SiStripCommissioningAnalysis/src/CalibrationAlgorithm.cc b/DQM/SiStripCommissioningAnalysis/src/CalibrationAlgorithm.cc index 42ca35e86fd72..e0903b69ac08d 100644 --- a/DQM/SiStripCommissioningAnalysis/src/CalibrationAlgorithm.cc +++ b/DQM/SiStripCommissioningAnalysis/src/CalibrationAlgorithm.cc @@ -28,12 +28,13 @@ CalibrationAlgorithm::CalibrationAlgorithm( const edm::ParameterSet & pset, Cali deconv_fitter_ = new TF1("deconv_fitter",fdeconv,0,200,6); deconv_fitter_->SetParLimits(0,1,70); //x deconv_fitter_->SetParLimits(1,0,40); //z = tau - deconv_fitter_->SetParLimits(4,35,55); // turn-on-time t_0 - deconv_fitter_->SetParameters(1,25,0.8000,50,0.8); + deconv_fitter_->SetParLimits(4,15,55); // turn-on-time t_0 + deconv_fitter_->SetParameters(2,25,0.8000,50,40); + peak_fitter_ = new TF1("peak_fitter",fpeak,0,200,5); peak_fitter_->SetParLimits(0,1,70); //x peak_fitter_->SetParLimits(1,20,70);//z = tau - peak_fitter_->SetParLimits(4,20,35); //turn-on-time t_0 + peak_fitter_->SetParLimits(4,15,35); //turn-on-time t_0 peak_fitter_->SetParameters(17,50,0,5000,20); } diff --git a/DQM/SiStripCommissioningClients/src/CalibrationHistograms.cc b/DQM/SiStripCommissioningClients/src/CalibrationHistograms.cc index ded5de9f60cc8..4abdd0f36cce3 100644 --- a/DQM/SiStripCommissioningClients/src/CalibrationHistograms.cc +++ b/DQM/SiStripCommissioningClients/src/CalibrationHistograms.cc @@ -68,6 +68,9 @@ void CalibrationHistograms::histoAnalysis( bool debug ) { data().clear(); // Iterate through map containing vectors of profile histograms + long int iChannel = 0; + long int total = histos().size(); + HistosMap::const_iterator iter = histos().begin(); for ( ; iter != histos().end(); iter++ ) { // Check vector of histos is not empty (should be 1 histo) @@ -78,6 +81,10 @@ void CalibrationHistograms::histoAnalysis( bool debug ) { continue; } + std::cout.flush(); + if(iChannel %10 == 0) std::cout<<"\r"<<"CalibrationHistograms::histoAnalysis: Channel analyzed "<<100*double(iChannel)/(total)<<" % "; + iChannel++; + // Retrieve pointers to 1D histos for this FED channel vector profs; Histos::const_iterator ihis = iter->second.begin(); From 5e87469108cdc1a9224e07ed1037b0b8df3f971c Mon Sep 17 00:00:00 2001 From: Raffaele Date: Thu, 15 Mar 2018 14:50:38 +0100 Subject: [PATCH 146/426] style updates --- .../src/PedsFullNoiseAlgorithm.cc | 6 +++--- .../interface/PedsFullNoiseHistosUsingDb.h | 2 +- .../SiStripConfigDb/src/AnalysisDescriptions.cc | 14 +++++++------- OnlineDB/SiStripConfigDb/src/SiStripPartition.cc | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/DQM/SiStripCommissioningAnalysis/src/PedsFullNoiseAlgorithm.cc b/DQM/SiStripCommissioningAnalysis/src/PedsFullNoiseAlgorithm.cc index d340f5f263d3d..d1e36946adfa5 100644 --- a/DQM/SiStripCommissioningAnalysis/src/PedsFullNoiseAlgorithm.cc +++ b/DQM/SiStripCommissioningAnalysis/src/PedsFullNoiseAlgorithm.cc @@ -393,7 +393,7 @@ void PedsFullNoiseAlgorithm::analyse() { apvID = 0; TH1S* histoResidualStrip = new TH1S("histoResidualStrip","",histoNoise->GetNbinsX(),histoNoise->GetXaxis()->GetXmin(),histoNoise->GetXaxis()->GetXmax()); histoResidualStrip->Sumw2(); - histoResidualStrip->SetDirectory(0); + histoResidualStrip->SetDirectory(nullptr); TF1* fitFunc = new TF1 ("fitFunc","gaus(0)",histoNoise->GetXaxis()->GetXmin(),histoNoise->GetXaxis()->GetXmax()); TF1* fit2Gaus = nullptr; TH1F* randomHisto = nullptr; @@ -478,7 +478,7 @@ void PedsFullNoiseAlgorithm::analyse() { if(randomHisto == nullptr) randomHisto = (TH1F*) histoResidualStrip->Clone("randomHisto"); randomHisto->Reset(); - randomHisto->SetDirectory(0); + randomHisto->SetDirectory(nullptr); if(generateRandomHisto_){/// randomHisto->FillRandom("fitFunc",histoResidualStrip->Integral()); @@ -498,7 +498,7 @@ void PedsFullNoiseAlgorithm::analyse() { ana->ksProbab_[apvID][stripBin] = histoResidualStrip->KolmogorovTest(randomHisto,"N"); ROOT::Fit::BinData data1; ROOT::Fit::BinData data2; - ROOT::Fit::FillData(data1,histoResidualStrip,0); + ROOT::Fit::FillData(data1,histoResidualStrip,nullptr); data2.Initialize(randomHisto->GetNbinsX()+1,1); for(int ibin = 0; ibin < randomHisto->GetNbinsX(); ibin++){ if(histoResidualStrip->GetBinContent(ibin+1) != 0 or randomHisto->GetBinContent(ibin+1) >= 1) diff --git a/DQM/SiStripCommissioningDbClients/interface/PedsFullNoiseHistosUsingDb.h b/DQM/SiStripCommissioningDbClients/interface/PedsFullNoiseHistosUsingDb.h index 8d139fe23194b..9070635ad1b59 100644 --- a/DQM/SiStripCommissioningDbClients/interface/PedsFullNoiseHistosUsingDb.h +++ b/DQM/SiStripCommissioningDbClients/interface/PedsFullNoiseHistosUsingDb.h @@ -15,7 +15,7 @@ class PedsFullNoiseHistosUsingDb : public CommissioningHistosUsingDb, public Ped ~PedsFullNoiseHistosUsingDb() override; - virtual void uploadConfigurations() override; + void uploadConfigurations() override; private: diff --git a/OnlineDB/SiStripConfigDb/src/AnalysisDescriptions.cc b/OnlineDB/SiStripConfigDb/src/AnalysisDescriptions.cc index 0051dbe42c379..8cfb522e6fb9e 100644 --- a/OnlineDB/SiStripConfigDb/src/AnalysisDescriptions.cc +++ b/OnlineDB/SiStripConfigDb/src/AnalysisDescriptions.cc @@ -34,7 +34,7 @@ SiStripConfigDb::AnalysisDescriptionsRange SiStripConfigDb::getAnalysisDescripti SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end(); for ( ; iter != jter; ++iter ) { - if ( partition == "" || partition == iter->second.partitionName() ) { + if ( partition.empty() || partition == iter->second.partitionName() ) { if ( iter->second.partitionName() == SiStripPartition::defaultPartitionName_ ) { continue; } @@ -135,7 +135,7 @@ SiStripConfigDb::AnalysisDescriptionsRange SiStripConfigDb::getAnalysisDescripti uint16_t np = 0; uint16_t nc = 0; AnalysisDescriptionsRange anals = analyses_.emptyRange(); - if ( partition != "" ) { + if ( !partition.empty() ) { anals = analyses_.find( partition ); np = 1; nc = anals.size(); @@ -264,7 +264,7 @@ void SiStripConfigDb::uploadAnalysisDescriptions( bool calibration_for_physics, SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end(); for ( ; iter != jter; ++iter ) { - if ( partition == "" || partition == iter->second.partitionName() ) { + if ( partition.empty() || partition == iter->second.partitionName() ) { AnalysisDescriptionsRange range = analyses_.find( iter->second.partitionName() ); if ( range != analyses_.emptyRange() ) { @@ -355,7 +355,7 @@ void SiStripConfigDb::clearAnalysisDescriptions( std::string partition ) { // Reproduce temporary cache for "all partitions except specified one" (or clear all if none specified) AnalysisDescriptions temporary_cache; - if ( partition == "" ) { temporary_cache = AnalysisDescriptions(); } + if ( partition.empty() ) { temporary_cache = AnalysisDescriptions(); } else { SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin(); SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end(); @@ -377,7 +377,7 @@ void SiStripConfigDb::clearAnalysisDescriptions( std::string partition ) { // Delete objects in local cache for specified partition (or all if not specified) AnalysisDescriptionsRange anals = analyses_.emptyRange(); - if ( partition == "" ) { + if ( partition.empty() ) { if ( !analyses_.empty() ) { anals = AnalysisDescriptionsRange( analyses_.find( dbParams_.partitions().begin()->second.partitionName() ).begin(), analyses_.find( (--(dbParams_.partitions().end()))->second.partitionName() ).end() ); @@ -396,7 +396,7 @@ void SiStripConfigDb::clearAnalysisDescriptions( std::string partition ) { } else { stringstream ss; ss << "[SiStripConfigDb::" << __func__ << "]"; - if ( partition == "" ) { ss << " Found no analysis descriptions in local cache!"; } + if ( partition.empty() ) { ss << " Found no analysis descriptions in local cache!"; } else { ss << " Found no analysis descriptions in local cache for partition \"" << partition << "\"!"; } edm::LogWarning(mlConfigDb_) << ss.str(); } @@ -422,7 +422,7 @@ void SiStripConfigDb::printAnalysisDescriptions( std::string partition ) { for ( ; ianal != janal; ++ianal ) { cntr++; - if ( partition == "" || partition == ianal->first ) { + if ( partition.empty() || partition == ianal->first ) { ss << " Partition number : " << cntr << " (out of " << analyses_.size() << ")" << std::endl; ss << " Partition name : \"" << ianal->first << "\"" << std::endl; diff --git a/OnlineDB/SiStripConfigDb/src/SiStripPartition.cc b/OnlineDB/SiStripConfigDb/src/SiStripPartition.cc index 40a84087ecfbe..3bbf1496fad79 100644 --- a/OnlineDB/SiStripConfigDb/src/SiStripPartition.cc +++ b/OnlineDB/SiStripConfigDb/src/SiStripPartition.cc @@ -496,7 +496,7 @@ void SiStripPartition::update( const SiStripConfigDb* const db ) { } else { // ---------- USE RUN NUMBER ---------- // Retrieve TkRun object for given run (0 means "latest run") - TkRun* run = 0; + TkRun* run = nullptr; if ( !runNumber_ ) { run = df->getLastRun( partitionName_ ); } else { run = df->getRun( partitionName_, runNumber_ ); } From 8743e8515fcb6ec4dc925ae141281bb78f955281 Mon Sep 17 00:00:00 2001 From: Petar Date: Thu, 15 Mar 2018 15:14:47 -0500 Subject: [PATCH 147/426] Fix crashes in gcc 7.X relvals when forming the file name for locally loaded templates. --- .../SiPixelRecHits/src/SiPixelTemplate.cc | 45 +++++++++---------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/RecoLocalTracker/SiPixelRecHits/src/SiPixelTemplate.cc b/RecoLocalTracker/SiPixelRecHits/src/SiPixelTemplate.cc index f3250de59c184..b9e8302de3d81 100755 --- a/RecoLocalTracker/SiPixelRecHits/src/SiPixelTemplate.cc +++ b/RecoLocalTracker/SiPixelRecHits/src/SiPixelTemplate.cc @@ -1,5 +1,5 @@ // -// SiPixelTemplate.cc Version 10.20 +// SiPixelTemplate.cc Version 10.21 // // Add goodness-of-fit info and spare entries to templates, version number in template header, more error checking // Add correction for (Q_F-Q_L)/(Q_F+Q_L) bias @@ -79,7 +79,7 @@ // V10.12 - Enforce minimum signal size in pixel charge uncertainty calculation // V10.13 - Update the variable size [SI_PIXEL_TEMPLATE_USE_BOOST] option so that it works with VI's enhancements // V10.20 - Add directory path selection to the ascii pushfile method - +// V10.21 - Address runtime issues in pushfile() for gcc 7.X due to using tempfile as char string + misc. cleanup [Petar] // Created by Morris Swartz on 10/27/06. @@ -134,36 +134,36 @@ bool SiPixelTemplate::pushfile(int filenum, std::vector< SiPixelTemplateStore > // Local variables int i, j, k, l; float qavg_avg; - const char *tempfile; - // char title[80]; remove this char c; const int code_version={17}; - - // Create a filename for this run - - std::ostringstream tout; - - // Create different path in CMSSW than standalone + std::string tempfile = std::to_string(filenum); #ifndef SI_PIXEL_TEMPLATE_STANDALONE - tout << dir << "template_summary_zp" - << std::setw(4) << std::setfill('0') << std::right << filenum << ".out" << std::ends; - std::string tempf = tout.str(); - edm::FileInPath file( tempf.c_str() ); - tempfile = (file.fullPath()).c_str(); + // If integer filenum has less than 4 digits, prepend 0's until we have four numerical characters, e.g. "0292" + int nzeros = 4-tempfile.length(); + if (nzeros > 0) + tempfile = std::string(nzeros, '0') + tempfile; + /// Alt implementation: for (unsigned cnt=4-tempfile.length(); cnt > 0; cnt-- ){ tempfile = "0" + tempfile; } + + tempfile = dir + "template_summary_zp" + tempfile + ".out"; + edm::FileInPath file( tempfile ); // Find the file in CMSSW + tempfile = file.fullPath(); // Put it back with the whole path. + #else + // This is the same as above, but more elegant. (Elegance not allowed in CMSSW...) + std::ostringstream tout; tout << "template_summary_zp" << std::setw(4) << std::setfill('0') << std::right << filenum << ".out" << std::ends; - std::string tempf = tout.str(); - tempfile = tempf.c_str(); + tempfile = tout.str(); + #endif - // open the template file - - std::ifstream in_file(tempfile, std::ios::in); + // Open the template file + // + std::ifstream in_file(tempfile); + if(in_file.is_open() && in_file.good()) { - if(in_file.is_open()) { // Create a local template storage entry @@ -556,7 +556,6 @@ bool SiPixelTemplate::pushfile(const SiPixelTemplateDBObject& dbobject, std::vec // Local variables int i, j, k, l; float qavg_avg; - // const char *tempfile; const int code_version={17}; // We must create a new object because dbobject must be a const and our stream must not be @@ -2572,7 +2571,7 @@ int SiPixelTemplate::qbin(int id, float cotalpha, float cotbeta, float locBz, fl - ilow = ihigh = 0; + // Unneded: ilow = ihigh = 0; auto xxratio = 0.f; { From cec3b6de22476a1d97f44d4df59a112be66896dd Mon Sep 17 00:00:00 2001 From: Pierre Depasse Date: Fri, 16 Mar 2018 09:39:45 +0100 Subject: [PATCH 148/426] Remove queries to OMDS --- .../Ecal/interface/EcalIntercalibHandler.h | 56 ++-- CondTools/Ecal/python/updateIntercali.py | 50 ++-- CondTools/Ecal/python/updateIntercali_test.py | 60 ----- CondTools/Ecal/src/EcalIntercalibHandler.cc | 241 ++++-------------- 4 files changed, 92 insertions(+), 315 deletions(-) delete mode 100644 CondTools/Ecal/python/updateIntercali_test.py diff --git a/CondTools/Ecal/interface/EcalIntercalibHandler.h b/CondTools/Ecal/interface/EcalIntercalibHandler.h index 911f45ee9e3da..411d3586279c9 100644 --- a/CondTools/Ecal/interface/EcalIntercalibHandler.h +++ b/CondTools/Ecal/interface/EcalIntercalibHandler.h @@ -49,44 +49,26 @@ namespace edm { class EventSetup; } -namespace popcon -{ - - - class EcalIntercalibHandler : public popcon::PopConSourceHandler - { - - public: - EcalIntercalibHandler(edm::ParameterSet const & ); - ~EcalIntercalibHandler() override; - - void getNewObjects() override; - void readXML(const std::string& filename, EcalFloatCondObjectContainer& record); - - std::string id() const override { return m_name;} - EcalCondDBInterface* econn; - - - - private: - const EcalIntercalibConstants * myintercalib; - - unsigned int m_firstRun ; - unsigned int m_lastRun ; +namespace popcon { + class EcalIntercalibHandler : public popcon::PopConSourceHandler { + public: + EcalIntercalibHandler(edm::ParameterSet const & ); + ~EcalIntercalibHandler() override; - std::string m_location; - std::string m_gentag; - std::string m_sid; - std::string m_user; - std::string m_pass; - std::string m_locationsource; - std::string m_name; - std::string m_file_lowfield; - std::string m_file_highfield; - double m_value_highfield; - - - }; + void getNewObjects() override; + void readXML(const std::string& filename, EcalFloatCondObjectContainer& record); + void readTXT(const std::string& filename, EcalFloatCondObjectContainer& record); + + std::string id() const override { return m_name;} + EcalCondDBInterface* econn; + + private: + const EcalIntercalibConstants * myintercalib; + std::string m_name; + unsigned int m_firstRun ; + std::string m_file_name; + std::string m_file_type; + }; } #endif diff --git a/CondTools/Ecal/python/updateIntercali.py b/CondTools/Ecal/python/updateIntercali.py index 42db899d9d1c7..9323fc7bd5f0e 100644 --- a/CondTools/Ecal/python/updateIntercali.py +++ b/CondTools/Ecal/python/updateIntercali.py @@ -17,41 +17,33 @@ interval = cms.uint64(1) ) -process.load("CondCore.DBCommon.CondDBCommon_cfi") +process.load("CondCore.CondDB.CondDB_cfi") -#process.CondDBCommon.connect = 'sqlite_file:DB.db' -#process.CondDBCommon.connect = 'oracle://cms_orcoff_prep/CMS_COND_ECAL' -process.CondDBCommon.connect = 'oracle://cms_orcon_prod/CMS_COND_31X_ECAL' -process.CondDBCommon.DBParameters.authenticationPath = '/nfshome0/popcondev/conddb' +process.CondDB.connect = 'sqlite_file:EcalIntercalibConstants.db' process.PoolDBOutputService = cms.Service("PoolDBOutputService", - process.CondDBCommon, - logconnect = cms.untracked.string('sqlite_file:log.db'), - toPut = cms.VPSet(cms.PSet( - record = cms.string('EcalIntercalibConstantsRcd'), - tag = cms.string('EcalIntercalibConstants_v9_offline') - )) + process.CondDB, + logconnect = cms.untracked.string('sqlite_file:log.db'), + toPut = cms.VPSet( + cms.PSet( + record = cms.string('EcalIntercalibConstantsRcd'), + tag = cms.string('EcalIntercalibConstants') + ) + ) ) process.Test1 = cms.EDAnalyzer("ExTestEcalIntercalibAnalyzer", - record = cms.string('EcalIntercalibConstantsRcd'), - loggingOn= cms.untracked.bool(True), - IsDestDbCheckedInQueryLog=cms.untracked.bool(True), - SinceAppendMode=cms.bool(True), - Source=cms.PSet( - FileLowField = cms.string('/nfshome0/popcondev/EcalTPGPopCon/CMSSW_3_11_0_ONLINE/src/CondTools/Ecal/python/interCalib_Boff.xml'), - FileHighField = cms.string('/nfshome0/popcondev/EcalTPGPopCon/CMSSW_3_11_0_ONLINE/src/CondTools/Ecal/python/interCalib_Bon.xml'), - Value_Bon = cms.untracked.double(0.75585), - firstRun = cms.string('98273'), - lastRun = cms.string('10000000'), - OnlineDBSID = cms.string('cms_omds_lb'), - OnlineDBUser = cms.string('cms_ecal_r'), - OnlineDBPassword = cms.string('*******'), - LocationSource = cms.string('P5'), - Location = cms.string('P5_Co'), - GenTag = cms.string('GLOBAL'), - RunType = cms.string('COSMICS') - ) + record = cms.string('EcalIntercalibConstantsRcd'), + loggingOn= cms.untracked.bool(True), + IsDestDbCheckedInQueryLog=cms.untracked.bool(True), + SinceAppendMode=cms.bool(True), + Source=cms.PSet( + firstRun = cms.string('1'), +# type = cms.string('txt'), +# fileName = cms.string('IC2017.txt'), + type = cms.string('xml'), + fileName = cms.string('Intercalib_Bon.xml'), + ) ) process.p = cms.Path(process.Test1) diff --git a/CondTools/Ecal/python/updateIntercali_test.py b/CondTools/Ecal/python/updateIntercali_test.py deleted file mode 100644 index 5371e330759b0..0000000000000 --- a/CondTools/Ecal/python/updateIntercali_test.py +++ /dev/null @@ -1,60 +0,0 @@ -import FWCore.ParameterSet.Config as cms -import CondTools.Ecal.conddb_init as conddb_init -import CondTools.Ecal.db_credentials as auth - -process = cms.Process("ProcessOne") - -process.MessageLogger = cms.Service("MessageLogger", - debugModules = cms.untracked.vstring('*'), - cout = cms.untracked.PSet( - threshold = cms.untracked.string('DEBUG') - ), - destinations = cms.untracked.vstring('cout') -) - -process.source = cms.Source("EmptyIOVSource", - lastValue = cms.uint64(100000000000), - timetype = cms.string('runnumber'), - firstValue = cms.uint64(100000000000), - interval = cms.uint64(1) -) - -process.load("CondCore.CondDB.CondDB_cfi") - -process.CondDB.DBParameters.authenticationPath = '' -process.CondDB.connect = conddb_init.options.destinationDatabase -if process.CondDB.connect == '': - process.CondDB.connect = 'sqlite_file:EcalIntercalibConstants_test.db' - -process.PoolDBOutputService = cms.Service("PoolDBOutputService", - process.CondDB, - toPut = cms.VPSet(cms.PSet( - record = cms.string('EcalIntercalibConstantsRcd'), - tag = cms.string('EcalIntercalib_test') - )) -) - -db_service,db_user,db_pwd = auth.get_readOnly_db_credentials() - -process.Test1 = cms.EDAnalyzer("ExTestEcalIntercalibAnalyzer", - record = cms.string('EcalIntercalibConstantsRcd'), - loggingOn= cms.untracked.bool(True), - IsDestDbCheckedInQueryLog=cms.untracked.bool(True), - SinceAppendMode=cms.bool(True), - Source=cms.PSet( - FileLowField = cms.string('Intercalib_Boff.xml'), - FileHighField = cms.string('Intercalib_Bon.xml'), - Value_Bon = cms.untracked.double(0.7041), - firstRun = cms.string('207149'), - lastRun = cms.string('10000000'), - OnlineDBSID = cms.string(db_service), - OnlineDBUser = cms.string(db_user), - OnlineDBPassword = cms.string( db_pwd ), - LocationSource = cms.string('P5'), - Location = cms.string('P5_Co'), - GenTag = cms.string('GLOBAL'), - RunType = cms.string('COSMICS') - ) -) - -process.p = cms.Path(process.Test1) diff --git a/CondTools/Ecal/src/EcalIntercalibHandler.cc b/CondTools/Ecal/src/EcalIntercalibHandler.cc index a39e3a0470198..f74911446bedc 100644 --- a/CondTools/Ecal/src/EcalIntercalibHandler.cc +++ b/CondTools/Ecal/src/EcalIntercalibHandler.cc @@ -10,202 +10,33 @@ const Int_t kEBChannels = 61200, kEEChannels = 14648; popcon::EcalIntercalibHandler::EcalIntercalibHandler(const edm::ParameterSet & ps) : m_name(ps.getUntrackedParameter("name","EcalIntercalibHandler")) { - std::cout << "EcalIntercalib Source handler constructor\n" << std::endl; - m_firstRun=static_cast(atoi( ps.getParameter("firstRun").c_str())); - m_lastRun=static_cast(atoi( ps.getParameter("lastRun").c_str())); - m_sid= ps.getParameter("OnlineDBSID"); - m_user= ps.getParameter("OnlineDBUser"); - m_pass= ps.getParameter("OnlineDBPassword"); - m_locationsource= ps.getParameter("LocationSource"); - m_location=ps.getParameter("Location"); - m_gentag=ps.getParameter("GenTag"); - m_file_lowfield= ps.getParameter("FileLowField"); - m_file_highfield= ps.getParameter("FileHighField"); - m_value_highfield= ps.getUntrackedParameter< double >("Value_Bon"); - // m_value_highfield= 0.75585; - - - - std::cout << m_sid<<"/"<(atoi( ps.getParameter("firstRun").c_str())); + m_file_type = ps.getParameter("type"); // xml/txt + m_file_name = ps.getParameter("fileName"); } +popcon::EcalIntercalibHandler::~EcalIntercalibHandler() {} -void popcon::EcalIntercalibHandler::getNewObjects() -{ - +void popcon::EcalIntercalibHandler::getNewObjects() { std::cout << "------- Ecal - > getNewObjects\n"; - std::ostringstream ss; ss<<"ECAL "; - - unsigned int max_since=0; - max_since=static_cast(tagInfo().lastInterval.first); - std::cout << "max_since : " << max_since << std::endl; - bool something_to_transfer = false; - bool magnet_high = true; - if(tagInfo().size) { - Ref ped_db = lastPayload(); - - // we parse the last record in the DB and check if it is low or high field - - std::cout << "retrieved last payload " << std::endl; - - - EcalIntercalibConstant the_cal = 0. ; // relies on it being a float. - // instead should perhaps - // protect the next if when - // the EEDetId isn't valid? - - int iX=50; - int iY=5; - int iZ=-1; - - - float the_value_high=(float)m_value_highfield; - std::cout << "The value for high field at EE x/y/z= 50/5/-1 is " << the_value_high << std::endl; - - if (EEDetId::validDetId(iX,iY,iZ)) - { - EEDetId eedetidpos(iX,iY,iZ); - - EcalIntercalibConstants::const_iterator it =ped_db->find(eedetidpos.rawId()); - - - the_cal = (*it); - - } - if(the_cal!= the_value_high) magnet_high=false; - } // check if there is already a payload - else something_to_transfer = true; - - // here we connect to the online DB to check the value of the magnetic field - std::cout << "Connecting to ONLINE DB ... " << std::endl; - econn = new EcalCondDBInterface( m_sid, m_user, m_pass ); - std::cout << "Connection done" << std::endl; - - if (!econn) - { - std::cout << " Problem with OMDS: connection parameters " < rundat; - RunIOV rp ; - run_t runmax=10000000; - std::string location_p5="P5_Co"; - econn->fetchValidDataSet(&rundat , &rp, location_p5 ,runmax); - - unsigned long long irun=(unsigned long long) rp.getRunNumber(); - - std::cout<< "retrieved run number "<< irun <max_since) { - // retrieve from last value data record - // always call this method at first run - - std::map dataset; - - econn->fetchDataSet(&dataset, &rp); - - if (dataset.empty()) { - throw(std::runtime_error("Zero rows read back")); - } else { - std::cout<< "retrieved magnet current"<::iterator it; - for (it=dataset.begin(); it!=dataset.end(); ++it){ - - RunDCSMagnetDat a_mag = (*it).second; - mag_cur= a_mag.getMagnetCurrent(); - - } - - - std::string file_=m_file_highfield; - if(tagInfo().size) { - - if(mag_cur>7000. && magnet_high ) { - - std::cout << " the magnet is ON and the constants are for magnet ON " << std::endl; - - } else if(mag_cur>7000. && !magnet_high ) { - something_to_transfer=true; - std::cout << " the magnet is ON and the constants are for magnet OFF " << std::endl; - std::cout << " I transfer the ON constants "<< std::endl; - file_=m_file_highfield; - - } else if(mag_cur<6000. && magnet_high ) { - something_to_transfer=true; - std::cout << " the magnet is OFF and the constants are for magnet ON "<< std::endl; - std::cout << " I transfer the OFF constants "<< std::endl; - file_=m_file_lowfield; - - } else if( mag_cur<6000. && !magnet_high ){ - - std::cout << " the magnet is OFF and the constants are for magnet OFF "<< std::endl; - file_=m_file_lowfield; - - } else { - - std::cout << " the magnet is in a strange situation I do nothing ... just be patient "<< std::endl; - - } - } - else { - if(mag_cur>7000.) - std::cout <<" first payload, the magnet is ON " << std::endl; - else if( mag_cur<6000.) { - std::cout <<" first payload, the magnet is OFF " << std::endl; - file_=m_file_lowfield; - } - else - std::cout << " the magnet is in a strange situation I do nothing ... just be patient "<< std::endl; - } - - if(something_to_transfer){ - - std::cout << "Generating popcon record for run " << irun << "..." << std::flush; - std::cout << "going to open file "<::m_to_transfer.push_back( - std::make_pair(payload,snc)); - ss << "Run=" << irun << "_Magnet_changed_"< max_since - else { - std::cout << "Run " << irun << " nothing sent to the DB"<< std::endl; - ss<< "Run=" << irun << "_no_new_runs_"< end of getNewObjects -----------\n"; + unsigned long long irun; + std::string file_= m_file_name; + std::cout << "going to open file "<< file_ << std::endl; + + // EcalCondHeader header; + EcalIntercalibConstants * payload = new EcalIntercalibConstants; + if(m_file_type == "xml") + readXML(file_, *payload); + else + readTXT(file_, *payload); + irun = m_firstRun; + Time_t snc= (Time_t) irun ; + + popcon::PopConSourceHandler::m_to_transfer.push_back(std::make_pair(payload, snc)); } void popcon::EcalIntercalibHandler::readXML(const std::string& file_, @@ -266,3 +97,35 @@ void popcon::EcalIntercalibHandler::readXML(const std::string& file_, record[myEEDetId] = val; } } + +void popcon::EcalIntercalibHandler::readTXT(const std::string& file_, + EcalFloatCondObjectContainer& record){ + std::ifstream ftxt; + ftxt.open(file_); + if(!ftxt.is_open()) { + std::cout << "ERROR : cannot open file " << file_ << std::endl; + exit (1); + } + int number_of_lines = 0, eta, phi, x, y, z; + float val; + std::string line; + while (std::getline(ftxt, line)) { + if(number_of_lines < kEBChannels) { // barrel + sscanf(line.c_str(), "%i %i %i %f", &eta, &phi, &z, &val); + EBDetId ebdetid(eta, phi, EBDetId::ETAPHIMODE); + record[ebdetid] = val; + } + else { // endcaps + sscanf(line.c_str(), "%i %i %i %f", &x, &y, &z, &val); + EEDetId eedetid(x, y, z, EEDetId::XYMODE); + record[eedetid] = val; + } + number_of_lines++; + } + std::cout << "Number of lines in text file: " << number_of_lines << std::endl; + int kChannels = kEBChannels + kEEChannels; + if(number_of_lines != kChannels) std:: cout << + "***************************************************************" << + "*** wrong number of channels! Please check ***" << + "***************************************************************" << std::endl; +} From 4f02020047ee8e3146983df1883e9a0db1780b19 Mon Sep 17 00:00:00 2001 From: Heiner Tholen Date: Fri, 16 Mar 2018 15:10:36 +0100 Subject: [PATCH 149/426] New DQM plots for CSV PF trigger paths --- .../Trigger/interface/BTVHLTOfflineSource.h | 101 +++++--- DQMOffline/Trigger/src/BTVHLTOfflineSource.cc | 220 ++++++++++++------ 2 files changed, 220 insertions(+), 101 deletions(-) diff --git a/DQMOffline/Trigger/interface/BTVHLTOfflineSource.h b/DQMOffline/Trigger/interface/BTVHLTOfflineSource.h index f0f5071627778..d2c79b84e8ad3 100644 --- a/DQMOffline/Trigger/interface/BTVHLTOfflineSource.h +++ b/DQMOffline/Trigger/interface/BTVHLTOfflineSource.h @@ -2,7 +2,7 @@ #define BTVHLTOfflineSource_H /* BTVHLTOffline DQM code -*/ +*/ // // Originally created by: Anne-Catherine Le Bihan // June 2015 @@ -53,10 +53,10 @@ class BTVHLTOfflineSource : public DQMEDAnalyzer { std::string dirname_; std::string processname_; std::string pathname_; - std::string filtername_; - + std::string filtername_; + std::vector > custompathnamepairs_; - + edm::InputTag triggerSummaryLabel_; edm::InputTag triggerResultsLabel_; @@ -67,22 +67,28 @@ class BTVHLTOfflineSource : public DQMEDAnalyzer { edm::EDGetTokenT > hltPFPVToken_; edm::EDGetTokenT > hltCaloPVToken_; edm::EDGetTokenT > offlinePVToken_; - + edm::EDGetTokenT triggerResultsToken; edm::EDGetTokenT triggerResultsFUToken; edm::EDGetTokenT triggerSummaryToken; edm::EDGetTokenT triggerSummaryFUToken; - + + edm::EDGetTokenT,reco::Track,edm::refhelper::FindUsingAdvance,reco::Track> >,reco::JTATagInfo>,reco::Vertex> > > + csvPfTagInfosToken_; + + edm::Handle,reco::Track,edm::refhelper::FindUsingAdvance,reco::Track> >,reco::JTATagInfo>,reco::Vertex> > > + csvPfTagInfos; + edm::EDGetTokenT csvCaloTagsToken_; edm::EDGetTokenT csvPfTagsToken_; edm::Handle csvCaloTags; edm::Handle csvPfTags; - + HLTConfigProvider hltConfig_; edm::Handle triggerResults_; edm::TriggerNames triggerNames_; edm::Handle triggerObj_; - + class PathInfo { PathInfo(): prescaleUsed_(-1), @@ -92,25 +98,33 @@ class BTVHLTOfflineSource : public DQMEDAnalyzer { objectType_(-1), triggerType_("unset") {}; - + public: void setHistos( - MonitorElement* const CSV, MonitorElement* const Pt, MonitorElement* const Eta, - MonitorElement* const CSV_RECOvsHLT, MonitorElement* const PVz, MonitorElement* const fastPVz, - MonitorElement* const PVz_HLTMinusRECO, MonitorElement* const fastPVz_HLTMinusRECO - ) + MonitorElement* const CSV, MonitorElement* const Pt, MonitorElement* const Eta, + MonitorElement* const CSV_RECOvsHLT, MonitorElement* const PVz, MonitorElement* const fastPVz, + MonitorElement* const PVz_HLTMinusRECO, MonitorElement* const fastPVz_HLTMinusRECO, + MonitorElement* const n_vtx, MonitorElement* const vtx_mass, MonitorElement* const n_vtx_trks, + MonitorElement* const n_sel_tracks, MonitorElement* const h_3d_ip_distance, + MonitorElement* const h_3d_ip_error, MonitorElement* const h_3d_ip_sig, + MonitorElement* const n_pixel_hits, MonitorElement* const n_total_hits + ) { CSV_ = CSV; Pt_ = Pt; Eta_ = Eta; CSV_RECOvsHLT_ = CSV_RECOvsHLT; PVz_ = PVz; fastPVz_ = fastPVz; PVz_HLTMinusRECO_ = PVz_HLTMinusRECO; fastPVz_HLTMinusRECO_ = fastPVz_HLTMinusRECO; + n_vtx_ = n_vtx; vtx_mass_ = vtx_mass; n_vtx_trks_ = n_vtx_trks; + n_sel_tracks_ = n_sel_tracks; h_3d_ip_distance_ = h_3d_ip_distance; + h_3d_ip_error_ = h_3d_ip_error; h_3d_ip_sig_ = h_3d_ip_sig; + n_pixel_hits_ = n_pixel_hits; n_total_hits_ = n_total_hits; }; ~PathInfo() = default;; PathInfo(int prescaleUsed, - std::string pathName, - std::string filterName, - std::string processName, - size_t type, - std::string triggerType): + std::string pathName, + std::string filterName, + std::string processName, + size_t type, + std::string triggerType): prescaleUsed_(prescaleUsed), pathName_(std::move(pathName)), filterName_(std::move(filterName)), @@ -128,40 +142,49 @@ class BTVHLTOfflineSource : public DQMEDAnalyzer { MonitorElement * getMEhisto_fastPVz() { return fastPVz_;} MonitorElement * getMEhisto_PVz_HLTMinusRECO() { return PVz_HLTMinusRECO_;} MonitorElement * getMEhisto_fastPVz_HLTMinusRECO() { return fastPVz_HLTMinusRECO_;} - + MonitorElement * getMEhisto_n_vtx() { return n_vtx_; } + MonitorElement * getMEhisto_vtx_mass() { return vtx_mass_; } + MonitorElement * getMEhisto_n_vtx_trks() { return n_vtx_trks_; } + MonitorElement * getMEhisto_n_sel_tracks() { return n_sel_tracks_; } + MonitorElement * getMEhisto_h_3d_ip_distance() { return h_3d_ip_distance_; } + MonitorElement * getMEhisto_h_3d_ip_error() { return h_3d_ip_error_; } + MonitorElement * getMEhisto_h_3d_ip_sig() { return h_3d_ip_sig_; } + MonitorElement * getMEhisto_n_pixel_hits() { return n_pixel_hits_; } + MonitorElement * getMEhisto_n_total_hits() { return n_total_hits_; } + const std::string getLabel( ) const { - return filterName_; + return filterName_; } void setLabel(std::string labelName){ - filterName_ = std::move(labelName); - return; + filterName_ = std::move(labelName); + return; } const std::string getPath( ) const { - return pathName_; + return pathName_; } const int getprescaleUsed() const { - return prescaleUsed_; + return prescaleUsed_; } const std::string getProcess( ) const { - return processName_; + return processName_; } const int getObjectType( ) const { - return objectType_; + return objectType_; } const std::string getTriggerType( ) const { - return triggerType_; + return triggerType_; } const edm::InputTag getTag() const{ - edm::InputTag tagName(filterName_,"",processName_); - return tagName; + edm::InputTag tagName(filterName_,"",processName_); + return tagName; } bool operator==(const std::string& v) { - return v==pathName_; + return v==pathName_; } private: - + int prescaleUsed_; std::string pathName_; std::string filterName_; @@ -172,14 +195,24 @@ class BTVHLTOfflineSource : public DQMEDAnalyzer { MonitorElement* CSV_; MonitorElement* Pt_; MonitorElement* Eta_; - MonitorElement* CSV_RECOvsHLT_; + MonitorElement* CSV_RECOvsHLT_; MonitorElement* PVz_; MonitorElement* fastPVz_; MonitorElement* PVz_HLTMinusRECO_; MonitorElement* fastPVz_HLTMinusRECO_; - + MonitorElement* n_vtx_; + MonitorElement* vtx_mass_; + MonitorElement* n_vtx_trks_; + MonitorElement* n_sel_tracks_; + MonitorElement* h_3d_ip_distance_; + MonitorElement* h_3d_ip_error_; + MonitorElement* h_3d_ip_sig_; + MonitorElement* n_pixel_hits_; + MonitorElement* n_total_hits_; + + }; - + class PathInfoCollection: public std::vector { public: PathInfoCollection(): std::vector() diff --git a/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc b/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc index ff99ee28e1e2f..f332e4315adc7 100644 --- a/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc +++ b/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc @@ -29,16 +29,17 @@ #include "TPRegexp.h" #include +#include using namespace edm; using namespace reco; using namespace std; using namespace trigger; - + BTVHLTOfflineSource::BTVHLTOfflineSource(const edm::ParameterSet& iConfig) { LogDebug("BTVHLTOfflineSource") << "constructor...."; - + dirname_ = iConfig.getUntrackedParameter("dirname",std::string("HLT/BTV/")); processname_ = iConfig.getParameter("processname"); verbose_ = iConfig.getUntrackedParameter< bool >("verbose", false); @@ -48,6 +49,8 @@ BTVHLTOfflineSource::BTVHLTOfflineSource(const edm::ParameterSet& iConfig) triggerResultsToken = consumes (triggerResultsLabel_); triggerSummaryFUToken = consumes (edm::InputTag(triggerSummaryLabel_.label(),triggerSummaryLabel_.instance(),std::string("FU"))); triggerResultsFUToken = consumes (edm::InputTag(triggerResultsLabel_.label(),triggerResultsLabel_.instance(),std::string("FU"))); + csvPfTagInfosToken_ = consumes,reco::Track,edm::refhelper::FindUsingAdvance,reco::Track> >,reco::JTATagInfo>,reco::Vertex> > > ( + edm::InputTag("hltSecondaryVertexTagInfosPF")); csvCaloTagsToken_ = consumes (edm::InputTag("hltCombinedSecondaryVertexBJetTagsCalo")); csvPfTagsToken_ = consumes (edm::InputTag("hltCombinedSecondaryVertexBJetTagsPF")); offlineCSVTokenPF_ = consumes (iConfig.getParameter("offlineCSVLabelPF")); @@ -56,9 +59,9 @@ BTVHLTOfflineSource::BTVHLTOfflineSource(const edm::ParameterSet& iConfig) hltPFPVToken_ = consumes > (iConfig.getParameter("hltPFPVLabel")); hltCaloPVToken_ = consumes > (iConfig.getParameter("hltCaloPVLabel")); offlinePVToken_ = consumes > (iConfig.getParameter("offlinePVLabel")); - + std::vector paths = iConfig.getParameter >("pathPairs"); - for(auto & path : paths) { + for(auto & path : paths) { custompathnamepairs_.push_back(make_pair( path.getParameter("pathname"), path.getParameter("pathtype") @@ -73,7 +76,7 @@ void BTVHLTOfflineSource::dqmBeginRun(const edm::Run& run, const edm::EventSetup if (!hltConfig_.init(run, c, processname_, changed)) { LogDebug("BTVHLTOfflineSource") << "HLTConfigProvider failed to initialize."; } - + const unsigned int numberOfPaths(hltConfig_.size()); for(unsigned int i=0; i!=numberOfPaths; ++i){ pathname_ = hltConfig_.triggerName(i); @@ -82,22 +85,22 @@ void BTVHLTOfflineSource::dqmBeginRun(const edm::Run& run, const edm::EventSetup unsigned int objectType = 0; std::string triggerType = ""; bool trigSelected = false; - + for (auto & custompathnamepair : custompathnamepairs_){ if(pathname_.find(custompathnamepair.first)!=std::string::npos) { trigSelected = true; triggerType = custompathnamepair.second;} } - + if (!trigSelected) continue; - - hltPathsAll_.push_back(PathInfo(usedPrescale, pathname_, "dummy", processname_, objectType, triggerType)); + + hltPathsAll_.push_back(PathInfo(usedPrescale, pathname_, "dummy", processname_, objectType, triggerType)); } - + } void BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) -{ +{ iEvent.getByToken(triggerResultsToken, triggerResults_); if(!triggerResults_.isValid()) { iEvent.getByToken(triggerResultsFUToken,triggerResults_); @@ -107,9 +110,9 @@ BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iS return; } } - + triggerNames_ = iEvent.triggerNames(*triggerResults_); - + iEvent.getByToken(triggerSummaryToken,triggerObj_); if(!triggerObj_.isValid()) { iEvent.getByToken(triggerSummaryFUToken,triggerObj_); @@ -118,45 +121,50 @@ BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iS "skipping event"; return; } - } - + } + iEvent.getByToken(csvCaloTagsToken_, csvCaloTags); iEvent.getByToken(csvPfTagsToken_, csvPfTags); - + Handle VertexHandler; - + Handle offlineJetTagHandlerPF; iEvent.getByToken(offlineCSVTokenPF_, offlineJetTagHandlerPF); - + Handle offlineJetTagHandlerCalo; iEvent.getByToken(offlineCSVTokenCalo_, offlineJetTagHandlerCalo); - + Handle offlineVertexHandler; iEvent.getByToken(offlinePVToken_, offlineVertexHandler); - + if(verbose_ && iEvent.id().event()%10000==0) - cout<<"Run = "<begin(); - + float CSV_online = iter->second; if (CSV_online<0) CSV_online = -0.05; - - v.getMEhisto_CSV()->Fill(CSV_online); - v.getMEhisto_Pt()->Fill(iter->first->pt()); + + v.getMEhisto_CSV()->Fill(CSV_online); + v.getMEhisto_Pt()->Fill(iter->first->pt()); v.getMEhisto_Eta()->Fill(iter->first->eta()); - + DR = 9999.; if(offlineJetTagHandlerPF.isValid()){ - for (auto const & iterO : *offlineJetTagHandlerPF){ + for (auto const & iterO : *offlineJetTagHandlerPF){ float CSV_offline = iterO.second; if (CSV_offline<0) CSV_offline = -0.05; DR = reco::deltaR(iterO.first->eta(),iterO.first->phi(),iter->first->eta(),iter->first->phi()); @@ -165,26 +173,65 @@ BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iS } } } - + iEvent.getByToken(hltPFPVToken_, VertexHandler); if (VertexHandler.isValid()) - { - v.getMEhisto_PVz()->Fill(VertexHandler->begin()->z()); + { + v.getMEhisto_PVz()->Fill(VertexHandler->begin()->z()); if (offlineVertexHandler.isValid()) v.getMEhisto_PVz_HLTMinusRECO()->Fill(VertexHandler->begin()->z()-offlineVertexHandler->begin()->z()); } } - - if (csvCaloTags.isValid() && v.getTriggerType() == "Calo" && !csvCaloTags->empty()) - { + + iEvent.getByToken(csvPfTagInfosToken_, csvPfTagInfos); + if (csvPfTagInfos.isValid() && v.getTriggerType() == "PF") { + + // loop over secondary vertex tag infos + for (const auto & csvPfTagInfo : *csvPfTagInfos) { + v.getMEhisto_n_vtx()->Fill(csvPfTagInfo.nVertexCandidates()); + v.getMEhisto_n_sel_tracks()->Fill(csvPfTagInfo.nSelectedTracks()); + + // loop over selected tracks in each tag info + for (unsigned i_trk=0; i_trk < csvPfTagInfo.nSelectedTracks(); i_trk++) { + const auto & ip3d = csvPfTagInfo.trackIPData(i_trk).ip3d; + v.getMEhisto_h_3d_ip_distance()->Fill(ip3d.value()); + v.getMEhisto_h_3d_ip_error()->Fill(ip3d.error()); + v.getMEhisto_h_3d_ip_sig()->Fill(ip3d.significance()); + } + + // loop over vertex candidates in each tag info + for (unsigned i_sv=0; i_sv < csvPfTagInfo.nVertexCandidates(); i_sv++) { + const auto & sv = csvPfTagInfo.secondaryVertex(i_sv); + v.getMEhisto_vtx_mass()->Fill(sv.p4().mass()); + v.getMEhisto_n_vtx_trks()->Fill(sv.nTracks()); + + // loop over tracks for number of pixel and total hits + const auto & trkIPTagInfo = csvPfTagInfo.trackIPTagInfoRef().get(); + for (const auto & trk : trkIPTagInfo->selectedTracks()) { + v.getMEhisto_n_pixel_hits()->Fill(trk.get()->hitPattern().numberOfValidPixelHits()); + v.getMEhisto_n_total_hits()->Fill(trk.get()->hitPattern().numberOfValidHits()); + } + } + } + } + +// _|_|_| _| +// _| _|_|_| _| _|_| +// _| _| _| _| _| _| +// _| _| _| _| _| _| +// _|_|_| _|_|_| _| _|_| + + if (csvCaloTags.isValid() && v.getTriggerType() == "Calo" && !csvCaloTags->empty()) + { + auto iter = csvCaloTags->begin(); - + float CSV_online = iter->second; if (CSV_online<0) CSV_online = -0.05; - - v.getMEhisto_CSV()->Fill(CSV_online); - v.getMEhisto_Pt()->Fill(iter->first->pt()); + + v.getMEhisto_CSV()->Fill(CSV_online); + v.getMEhisto_Pt()->Fill(iter->first->pt()); v.getMEhisto_Eta()->Fill(iter->first->eta()); - + DR = 9999.; if(offlineJetTagHandlerCalo.isValid()){ for (auto const & iterO : *offlineJetTagHandlerCalo) @@ -192,82 +239,121 @@ BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iS float CSV_offline = iterO.second; if (CSV_offline<0) CSV_offline = -0.05; DR = reco::deltaR(iterO.first->eta(),iterO.first->phi(),iter->first->eta(),iter->first->phi()); - if (DR<0.3) + if (DR<0.3) { v.getMEhisto_CSV_RECOvsHLT()->Fill(CSV_offline,CSV_online); continue; - } - } + } + } } - + iEvent.getByToken(hltFastPVToken_, VertexHandler); - if (VertexHandler.isValid()) + if (VertexHandler.isValid()) { - v.getMEhisto_PVz()->Fill(VertexHandler->begin()->z()); + v.getMEhisto_PVz()->Fill(VertexHandler->begin()->z()); if (offlineVertexHandler.isValid()) v.getMEhisto_fastPVz_HLTMinusRECO()->Fill(VertexHandler->begin()->z()-offlineVertexHandler->begin()->z()); } - + iEvent.getByToken(hltCaloPVToken_, VertexHandler); if (VertexHandler.isValid()) { - v.getMEhisto_fastPVz()->Fill(VertexHandler->begin()->z()); + v.getMEhisto_fastPVz()->Fill(VertexHandler->begin()->z()); if (offlineVertexHandler.isValid()) v.getMEhisto_PVz_HLTMinusRECO()->Fill(VertexHandler->begin()->z()-offlineVertexHandler->begin()->z()); } - + } - - + + } } - } -void +void BTVHLTOfflineSource::bookHistograms(DQMStore::IBooker & iBooker, edm::Run const & run, edm::EventSetup const & c) { - iBooker.setCurrentFolder(dirname_); + iBooker.setCurrentFolder(dirname_); for(auto & v : hltPathsAll_){ // std::string trgPathName = HLTConfigProvider::removeVersion(v.getPath()); std::string subdirName = dirname_ +"/"+ trgPathName; std::string trigPath = "("+trgPathName+")"; - iBooker.setCurrentFolder(subdirName); + iBooker.setCurrentFolder(subdirName); std::string labelname("HLT"); std::string histoname(labelname+""); std::string title(labelname+""); - + histoname = labelname+"_CSV"; title = labelname+"_CSV "+trigPath; MonitorElement * CSV = iBooker.book1D(histoname.c_str(),title.c_str(),110,-0.1,1); - + histoname = labelname+"_Pt"; title = labelname+"_Pt "+trigPath; MonitorElement * Pt = iBooker.book1D(histoname.c_str(),title.c_str(),100,0,400); - + histoname = labelname+"_Eta"; title = labelname+"_Eta "+trigPath; MonitorElement * Eta = iBooker.book1D(histoname.c_str(),title.c_str(),60,-3.0,3.0); - + histoname = "RECOvsHLT_CSV"; title = "offline CSV vs online CSV "+trigPath; MonitorElement * CSV_RECOvsHLT = iBooker.book2D(histoname.c_str(),title.c_str(),110,-0.1,1,110,-0.1,1); - + histoname = labelname+"_PVz"; title = "online z(PV) "+trigPath; MonitorElement * PVz = iBooker.book1D(histoname.c_str(),title.c_str(),80,-20,20); - + histoname = labelname+"_fastPVz"; title = "online z(fastPV) "+trigPath; MonitorElement * fastPVz = iBooker.book1D(histoname.c_str(),title.c_str(),80,-20,20); - + histoname = "HLTMinusRECO_PVz"; title = "online z(PV) - offline z(PV) "+trigPath; MonitorElement * PVz_HLTMinusRECO = iBooker.book1D(histoname.c_str(),title.c_str(),200,-0.5,0.5); - + histoname = "HLTMinusRECO_fastPVz"; title = "online z(fastPV) - offline z(PV) "+trigPath; MonitorElement * fastPVz_HLTMinusRECO = iBooker.book1D(histoname.c_str(),title.c_str(),100,-2,2); - - v.setHistos(CSV,Pt,Eta,CSV_RECOvsHLT,PVz,fastPVz,PVz_HLTMinusRECO,fastPVz_HLTMinusRECO); + + histoname = "n_vtx"; + title = "N vertex candidates "+trigPath; + MonitorElement * n_vtx = iBooker.book1D(histoname.c_str(),title.c_str(), 10, -0.5, 9.5); + + histoname = "vtx_mass"; + title = "secondary vertex mass (GeV)"+trigPath; + MonitorElement * vtx_mass = iBooker.book1D(histoname.c_str(), title.c_str(), 20, 0, 10); + + histoname = "n_vtx_trks"; + title = "N tracks associated to secondary vertex"+trigPath; + MonitorElement * n_vtx_trks = iBooker.book1D(histoname.c_str(), title.c_str(), 20, -0.5, 19.5); + + histoname = "n_sel_tracks"; + title = "N selected tracks"+trigPath; + MonitorElement * n_sel_tracks = iBooker.book1D(histoname.c_str(), title.c_str(), 25, -0.5, 24.5); + + histoname = "3d_ip_distance"; + title = "3D IP distance of tracks (cm)"+trigPath; + MonitorElement * h_3d_ip_distance = iBooker.book1D(histoname.c_str(), title.c_str(), 40, -0.1, 0.1); + + histoname = "3d_ip_error"; + title = "3D IP error of tracks (cm)"+trigPath; + MonitorElement * h_3d_ip_error = iBooker.book1D(histoname.c_str(), title.c_str(), 40, 0., 0.1); + + histoname = "3d_ip_sig"; + title = "3D IP significance of tracks (cm)"+trigPath; + MonitorElement * h_3d_ip_sig = iBooker.book1D(histoname.c_str(), title.c_str(), 40, -40, 40); + + histoname = "n_pixel_hits"; + title = "N pixel hits"+trigPath; + MonitorElement * n_pixel_hits = iBooker.book1D(histoname.c_str(), title.c_str(), 16, -0.5, 15.5); + + histoname = "n_total_hits"; + title = "N hits"+trigPath; + MonitorElement * n_total_hits = iBooker.book1D(histoname.c_str(), title.c_str(), 40, -0.5, 39.5); + + + v.setHistos( + CSV,Pt,Eta,CSV_RECOvsHLT,PVz,fastPVz,PVz_HLTMinusRECO,fastPVz_HLTMinusRECO, + n_vtx, vtx_mass, n_vtx_trks, n_sel_tracks, h_3d_ip_distance, h_3d_ip_error, h_3d_ip_sig, n_pixel_hits, n_total_hits + ); } } From 2ae9eba65e5ab0c6f668bee730b7021f0cfceb39 Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Fri, 16 Mar 2018 11:20:03 -0500 Subject: [PATCH 150/426] Add thread safety macro, delete unnecessary code --- FWCore/Services/plugins/Timing.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/FWCore/Services/plugins/Timing.cc b/FWCore/Services/plugins/Timing.cc index 894be2a4140ce..b0233857eaac1 100644 --- a/FWCore/Services/plugins/Timing.cc +++ b/FWCore/Services/plugins/Timing.cc @@ -25,6 +25,7 @@ #include "FWCore/ServiceRegistry/interface/ProcessContext.h" #include "FWCore/ServiceRegistry/interface/SystemBounds.h" #include "FWCore/Utilities/interface/Exception.h" +#include "FWCore/Utilities/interface/thread_safety_macros.h" #include #include @@ -137,10 +138,10 @@ namespace edm { CountAndTime countAndTimeZero_; std::atomic countAndTimeForLock_; - double accumulatedTimeForLock_; + CMS_THREAD_GUARD(countAndTimeForLock_) double accumulatedTimeForLock_; std::atomic countAndTimeForGet_; - double accumulatedTimeForGet_; + CMS_THREAD_GUARD(countAndTimeForGet_)double accumulatedTimeForGet_; std::vector>> countSubProcessesPreEvent_; std::vector>> countSubProcessesPostEvent_; @@ -693,7 +694,7 @@ namespace edm { CountAndTime* oldStat = countAndTime.load(); while (oldStat == nullptr || !countAndTime.compare_exchange_strong(oldStat, nullptr)) { - oldStat = countAndTime.load(); + // do nothing } newStat->count_ = oldStat->count_ + 1; @@ -714,7 +715,7 @@ namespace edm { CountAndTime* oldStat = countAndTime.load(); while (oldStat == nullptr || !countAndTime.compare_exchange_strong(oldStat, nullptr)) { - oldStat = countAndTime.load(); + // do nothing } if (oldStat->count_ == 1) { From eb3d8949296260eff4c19c4926a0f847af3cee1c Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Fri, 16 Mar 2018 11:24:38 -0500 Subject: [PATCH 151/426] Fix spacing --- FWCore/Services/plugins/Timing.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FWCore/Services/plugins/Timing.cc b/FWCore/Services/plugins/Timing.cc index b0233857eaac1..b0a5925ccef5c 100644 --- a/FWCore/Services/plugins/Timing.cc +++ b/FWCore/Services/plugins/Timing.cc @@ -141,7 +141,7 @@ namespace edm { CMS_THREAD_GUARD(countAndTimeForLock_) double accumulatedTimeForLock_; std::atomic countAndTimeForGet_; - CMS_THREAD_GUARD(countAndTimeForGet_)double accumulatedTimeForGet_; + CMS_THREAD_GUARD(countAndTimeForGet_) double accumulatedTimeForGet_; std::vector>> countSubProcessesPreEvent_; std::vector>> countSubProcessesPostEvent_; From 1024bd25d74a14e77ce88f9786e7236f41a69501 Mon Sep 17 00:00:00 2001 From: Marco Rovere Date: Fri, 16 Mar 2018 17:53:57 +0100 Subject: [PATCH 152/426] Test ROOT Schema Evolution on TH* When an update on the ROOT external brings in schema evolution for any object that has to be handled also by DQMGUI, trigger a test failure. The fix of the test is trivial. This will serve as a check-and-trigger to update the root.spec file on the comp side of cmsdist. --- DQMServices/Components/test/BuildFile.xml | 4 + .../Components/test/testSchemaEvolution.cpp | 143 ++++++++++++++++++ 2 files changed, 147 insertions(+) create mode 100644 DQMServices/Components/test/testSchemaEvolution.cpp diff --git a/DQMServices/Components/test/BuildFile.xml b/DQMServices/Components/test/BuildFile.xml index 2708dbf00e2f8..7b929a930b7d2 100644 --- a/DQMServices/Components/test/BuildFile.xml +++ b/DQMServices/Components/test/BuildFile.xml @@ -5,6 +5,7 @@ + @@ -18,3 +19,6 @@
+ + + diff --git a/DQMServices/Components/test/testSchemaEvolution.cpp b/DQMServices/Components/test/testSchemaEvolution.cpp new file mode 100644 index 0000000000000..ba74a69805f11 --- /dev/null +++ b/DQMServices/Components/test/testSchemaEvolution.cpp @@ -0,0 +1,143 @@ +#include "Utilities/Testing/interface/CppUnit_testdriver.icpp" //gives main +#include + +#include "TClass.h" +#include "TList.h" +#include "TDataMember.h" + +#include +#include +#include +#include +#include + + +class TestSchemaEvolution : public CppUnit::TestFixture { + CPPUNIT_TEST_SUITE(TestSchemaEvolution); + CPPUNIT_TEST(checkVersions); + CPPUNIT_TEST_SUITE_END(); + +public: + TestSchemaEvolution() = default; + ~TestSchemaEvolution() = default; + void setUp() {} + void tearDown() {} + void checkVersions(); + +private: + void fillBaseline(); + void gatherAllClasses(); + void runComparison(); + void loopOnDataMembers(TClass *); + void loopOnBases(TClass *); + void analyseClass(TClass *); + std::set> unique_classes_; + std::set> unique_classes_current_; + +}; + +CPPUNIT_TEST_SUITE_REGISTRATION( TestSchemaEvolution ); + +void TestSchemaEvolution::fillBaseline() { + unique_classes_current_.insert(std::make_tuple("TArray", 1)); + unique_classes_current_.insert(std::make_tuple("TArrayD", 1)); + unique_classes_current_.insert(std::make_tuple("TArrayF", 1)); + unique_classes_current_.insert(std::make_tuple("TArrayI", 1)); + unique_classes_current_.insert(std::make_tuple("TArrayS", 1)); + unique_classes_current_.insert(std::make_tuple("TAtt3D", 1)); + unique_classes_current_.insert(std::make_tuple("TAttAxis", 4)); + unique_classes_current_.insert(std::make_tuple("TAttFill", 2)); + unique_classes_current_.insert(std::make_tuple("TAttLine", 2)); + unique_classes_current_.insert(std::make_tuple("TAttMarker", 2)); + unique_classes_current_.insert(std::make_tuple("TAxis", 10)); + unique_classes_current_.insert(std::make_tuple("TH1", 8)); + unique_classes_current_.insert(std::make_tuple("TH1D", 2)); + unique_classes_current_.insert(std::make_tuple("TH1F", 2)); + unique_classes_current_.insert(std::make_tuple("TH1I", 2)); + unique_classes_current_.insert(std::make_tuple("TH1S", 2)); + unique_classes_current_.insert(std::make_tuple("TH2", 4)); + unique_classes_current_.insert(std::make_tuple("TH2D", 3)); + unique_classes_current_.insert(std::make_tuple("TH2F", 3)); + unique_classes_current_.insert(std::make_tuple("TH2I", 3)); + unique_classes_current_.insert(std::make_tuple("TH2S", 3)); + unique_classes_current_.insert(std::make_tuple("TH3", 5)); + unique_classes_current_.insert(std::make_tuple("TH3D", 3)); + unique_classes_current_.insert(std::make_tuple("TH3F", 3)); + unique_classes_current_.insert(std::make_tuple("TH3I", 3)); + unique_classes_current_.insert(std::make_tuple("TH3S", 3)); + unique_classes_current_.insert(std::make_tuple("TNamed", 1)); + unique_classes_current_.insert(std::make_tuple("TObject", 1)); + unique_classes_current_.insert(std::make_tuple("TProfile", 6)); + unique_classes_current_.insert(std::make_tuple("TProfile2D", 7)); + unique_classes_current_.insert(std::make_tuple("TString", 2)); +} + +void TestSchemaEvolution::runComparison() { + CPPUNIT_ASSERT(unique_classes_current_.size() == unique_classes_.size()); + for (auto cl : unique_classes_current_) { + std::cout << "Checking " << std::get<0>(cl) << " " << std::get<1>(cl) << std::endl; + CPPUNIT_ASSERT(unique_classes_.find(cl) != unique_classes_.end()); + } +} + +void TestSchemaEvolution::checkVersions() { + fillBaseline(); + gatherAllClasses(); + runComparison(); +} + +void TestSchemaEvolution::gatherAllClasses() { + static const char *classes[] = + { + "TH1F", "TH1S", "TH1D", "TH1I", + "TH2F", "TH2S", "TH2D", "TH2I", + "TH3F", "TH3S", "TH3D", "TH3I", + "TProfile", "TProfile2D", 0 + }; + + int i = 0; + while (classes[i]) + { + TClass *tcl = TClass::GetClass(classes[i]); + if (!tcl) + continue; + unique_classes_.insert(std::make_tuple(classes[i], tcl->GetClassVersion())); + analyseClass(tcl); + ++i; + } +} + +void TestSchemaEvolution::loopOnDataMembers(TClass *tcl) +{ + TList *dms = tcl->GetListOfDataMembers(); + TIter next(dms); + while (TObject *obj = next()) { + TClass *cl = TClass::GetClass(((TDataMember *)obj)->GetFullTypeName()); + if (cl && cl->HasDictionary()) { + unique_classes_.insert(std::make_tuple(cl->GetName(), cl->GetClassVersion())); + analyseClass(cl); + } + } +} + + +void TestSchemaEvolution::loopOnBases(TClass *tcl) +{ + TList *bases = tcl->GetListOfBases(); + TIter next(bases); + while (TObject *obj = next()) { + TClass *cl = TClass::GetClass(obj->GetName()); + if (cl && cl->HasDictionary()) { + unique_classes_.insert(std::make_tuple(cl->GetName(), cl->GetClassVersion())); + analyseClass(cl); + } + } +} + + +void TestSchemaEvolution::analyseClass(TClass *cl) +{ + loopOnBases(cl); + loopOnDataMembers(cl); +} + From 5916a0aec86db66675f5ee00fd67aa09b22f1328 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Fri, 16 Mar 2018 18:01:29 +0100 Subject: [PATCH 153/426] Add the method fillDescription to a number of producer classes --- .../interface/IPTCorrector.h | 3 +++ .../IsolatedPixelTrackCandidateL1TProducer.h | 4 +++- .../IsolatedPixelTrackCandidateProducer.h | 4 +++- .../python/iptCorrector_cfi.py | 9 -------- .../python/isolPixelTrackProdL1T_cfi.py | 21 ----------------- .../python/isolPixelTrackProd_cfi.py | 21 ----------------- .../HcalIsolatedTrackReco/src/IPTCorrector.cc | 8 +++++++ .../IsolatedPixelTrackCandidateL1TProducer.cc | 23 +++++++++++++++++-- .../IsolatedPixelTrackCandidateProducer.cc | 23 +++++++++++++++++-- 9 files changed, 59 insertions(+), 57 deletions(-) delete mode 100644 Calibration/HcalIsolatedTrackReco/python/iptCorrector_cfi.py delete mode 100644 Calibration/HcalIsolatedTrackReco/python/isolPixelTrackProdL1T_cfi.py delete mode 100644 Calibration/HcalIsolatedTrackReco/python/isolPixelTrackProd_cfi.py diff --git a/Calibration/HcalIsolatedTrackReco/interface/IPTCorrector.h b/Calibration/HcalIsolatedTrackReco/interface/IPTCorrector.h index 5b11e88b99070..51132bb75bdd0 100644 --- a/Calibration/HcalIsolatedTrackReco/interface/IPTCorrector.h +++ b/Calibration/HcalIsolatedTrackReco/interface/IPTCorrector.h @@ -11,6 +11,7 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "DataFormats/Common/interface/Ref.h" #include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h" @@ -21,6 +22,8 @@ class IPTCorrector : public edm::global::EDProducer<> public: IPTCorrector (const edm::ParameterSet& ps); + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const override; private: diff --git a/Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateL1TProducer.h b/Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateL1TProducer.h index 4d02b267fa2a1..7153c4e47741c 100644 --- a/Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateL1TProducer.h +++ b/Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateL1TProducer.h @@ -9,6 +9,7 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" @@ -47,7 +48,8 @@ class IsolatedPixelTrackCandidateL1TProducer : public edm::stream::EDProducer<> IsolatedPixelTrackCandidateL1TProducer (const edm::ParameterSet& ps); ~IsolatedPixelTrackCandidateL1TProducer() override; - + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); void beginRun(const edm::Run&, const edm::EventSetup&) override; void produce(edm::Event& evt, const edm::EventSetup& es) override; diff --git a/Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateProducer.h b/Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateProducer.h index d92435245092a..2bedfb949b66b 100644 --- a/Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateProducer.h +++ b/Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateProducer.h @@ -9,6 +9,7 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" @@ -44,7 +45,8 @@ class IsolatedPixelTrackCandidateProducer : public edm::stream::EDProducer<> { IsolatedPixelTrackCandidateProducer (const edm::ParameterSet& ps); ~IsolatedPixelTrackCandidateProducer() override; - + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); void beginRun(const edm::Run&, const edm::EventSetup&) override; void produce(edm::Event& evt, const edm::EventSetup& es) override; diff --git a/Calibration/HcalIsolatedTrackReco/python/iptCorrector_cfi.py b/Calibration/HcalIsolatedTrackReco/python/iptCorrector_cfi.py deleted file mode 100644 index 14795a2ff71c9..0000000000000 --- a/Calibration/HcalIsolatedTrackReco/python/iptCorrector_cfi.py +++ /dev/null @@ -1,9 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -iptCorrector = cms.EDProducer("IPTCorrector", - corTracksLabel = cms.InputTag( "hltIter0PFlowCtfWithMaterialTracks" ), - filterLabel = cms.InputTag( "hltIsolPixelTrackL2Filter" ), - associationCone = cms.double( 0.2 ) -) - - diff --git a/Calibration/HcalIsolatedTrackReco/python/isolPixelTrackProdL1T_cfi.py b/Calibration/HcalIsolatedTrackReco/python/isolPixelTrackProdL1T_cfi.py deleted file mode 100644 index 50d399aabd96b..0000000000000 --- a/Calibration/HcalIsolatedTrackReco/python/isolPixelTrackProdL1T_cfi.py +++ /dev/null @@ -1,21 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -#IsolatedPixelTrackCandidateProducer default configuration -isolPixelTrackProd = cms.EDProducer("IsolatedPixelTrackCandidateL1TProducer", - L1eTauJetsSource = cms.InputTag( 'hltGtStage2Digis','Tau' ), - tauAssociationCone = cms.double( 0.0 ), - tauUnbiasCone = cms.double( 1.2 ), - PixelTracksSources = cms.VInputTag( "hltPixelTracks" ), - ExtrapolationConeSize = cms.double(1.0), - PixelIsolationConeSizeAtEC = cms.double(40), - L1GTSeedLabel = cms.InputTag( "hltL1sV0SingleJet60" ), - MaxVtxDXYSeed = cms.double( 101.0 ), - MaxVtxDXYIsol = cms.double( 101.0 ), - VertexLabel = cms.InputTag( "hltTrimmedPixelVertices" ), - MagFieldRecordName = cms.string("VolumeBasedMagneticField"), - minPTrack = cms.double( 5.0 ), - maxPTrackForIsolation = cms.double( 3.0 ), - EBEtaBoundary = cms.double(1.479) -) - - diff --git a/Calibration/HcalIsolatedTrackReco/python/isolPixelTrackProd_cfi.py b/Calibration/HcalIsolatedTrackReco/python/isolPixelTrackProd_cfi.py deleted file mode 100644 index b5e1495ecb1ca..0000000000000 --- a/Calibration/HcalIsolatedTrackReco/python/isolPixelTrackProd_cfi.py +++ /dev/null @@ -1,21 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -#IsolatedPixelTrackCandidateProducer default configuration -isolPixelTrackProd = cms.EDProducer("IsolatedPixelTrackCandidateProducer", - L1eTauJetsSource = cms.InputTag('hltCaloStage2Digis','Tau'), - tauAssociationCone = cms.double( 0.0 ), - tauUnbiasCone = cms.double( 1.2 ), - PixelTracksSources = cms.VInputTag( "hltPixelTracks" ), - ExtrapolationConeSize = cms.double(1.0), - PixelIsolationConeSizeAtEC = cms.double(40), - L1GTSeedLabel = cms.InputTag( "hltL1sIsoTrack" ), - MaxVtxDXYSeed = cms.double( 101.0 ), - MaxVtxDXYIsol = cms.double( 101.0 ), - VertexLabel = cms.InputTag( "hltTrimmedPixelVertices" ), - MagFieldRecordName = cms.string("VolumeBasedMagneticField"), - minPTrack = cms.double( 5.0 ), - maxPTrackForIsolation = cms.double( 3.0 ), - EBEtaBoundary = cms.double(1.479) -) - - diff --git a/Calibration/HcalIsolatedTrackReco/src/IPTCorrector.cc b/Calibration/HcalIsolatedTrackReco/src/IPTCorrector.cc index cf2bf000ae1f0..233143df88fad 100644 --- a/Calibration/HcalIsolatedTrackReco/src/IPTCorrector.cc +++ b/Calibration/HcalIsolatedTrackReco/src/IPTCorrector.cc @@ -9,6 +9,7 @@ #include "DataFormats/Common/interface/Handle.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/Utilities/interface/Exception.h" // #include "DataFormats/Common/interface/TriggerResults.h" @@ -27,6 +28,13 @@ IPTCorrector::IPTCorrector(const edm::ParameterSet& config) : produces< reco::IsolatedPixelTrackCandidateCollection >(); } +void IPTCorrector::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("corTracksLabel",edm::InputTag("hltIter0PFlowCtfWithMaterialTracks")); + desc.add("filterLabel",edm::InputTag("hltIsolPixelTrackL2Filter")); + desc.add("associationCone",0.2); + descriptions.add("iptCorrector",desc); +} void IPTCorrector::produce(edm::StreamID, edm::Event& theEvent, edm::EventSetup const&) const { diff --git a/Calibration/HcalIsolatedTrackReco/src/IsolatedPixelTrackCandidateL1TProducer.cc b/Calibration/HcalIsolatedTrackReco/src/IsolatedPixelTrackCandidateL1TProducer.cc index 73c22200df0a1..d73bd98edb761 100644 --- a/Calibration/HcalIsolatedTrackReco/src/IsolatedPixelTrackCandidateL1TProducer.cc +++ b/Calibration/HcalIsolatedTrackReco/src/IsolatedPixelTrackCandidateL1TProducer.cc @@ -11,6 +11,7 @@ #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/ESTransientHandle.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/Utilities/interface/transform.h" // @@ -63,8 +64,26 @@ IsolatedPixelTrackCandidateL1TProducer::IsolatedPixelTrackCandidateL1TProducer(c produces< reco::IsolatedPixelTrackCandidateCollection >(); } -IsolatedPixelTrackCandidateL1TProducer::~IsolatedPixelTrackCandidateL1TProducer() { - +IsolatedPixelTrackCandidateL1TProducer::~IsolatedPixelTrackCandidateL1TProducer() { } + +void IsolatedPixelTrackCandidateL1TProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + std::vector tracksrc = {edm::InputTag("hltPixelTracks")}; + desc.add("L1eTauJetsSource",edm::InputTag("hltGtStage2Digis","Tau")); + desc.add("tauAssociationCone", 0.0 ); + desc.add("tauUnbiasCone", 1.2 ); + desc.add >("PixelTracksSources",tracksrc); + desc.add("ExtrapolationConeSize", 1.0); + desc.add("PixelIsolationConeSizeAtEC",40); + desc.add("L1GTSeedLabel",edm::InputTag("hltL1sV0SingleJet60")); + desc.add("MaxVtxDXYSeed", 101.0); + desc.add("MaxVtxDXYIsol", 101.0); + desc.add("VertexLabel",edm::InputTag("hltTrimmedPixelVertices")); + desc.add("MagFieldRecordName","VolumeBasedMagneticField"); + desc.add("minPTrack", 5.0); + desc.add("maxPTrackForIsolation", 3.0); + desc.add("EBEtaBoundary", 1.479); + descriptions.add("isolPixelTrackProdL1T",desc); } void IsolatedPixelTrackCandidateL1TProducer::beginRun(const edm::Run &run, const edm::EventSetup &theEventSetup) { diff --git a/Calibration/HcalIsolatedTrackReco/src/IsolatedPixelTrackCandidateProducer.cc b/Calibration/HcalIsolatedTrackReco/src/IsolatedPixelTrackCandidateProducer.cc index 29b2b0d1f8efb..3e0beca1c4dc7 100644 --- a/Calibration/HcalIsolatedTrackReco/src/IsolatedPixelTrackCandidateProducer.cc +++ b/Calibration/HcalIsolatedTrackReco/src/IsolatedPixelTrackCandidateProducer.cc @@ -11,6 +11,7 @@ #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/ESTransientHandle.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/Utilities/interface/transform.h" // @@ -64,8 +65,26 @@ IsolatedPixelTrackCandidateProducer::IsolatedPixelTrackCandidateProducer(const e produces< reco::IsolatedPixelTrackCandidateCollection >(); } -IsolatedPixelTrackCandidateProducer::~IsolatedPixelTrackCandidateProducer() { - +IsolatedPixelTrackCandidateProducer::~IsolatedPixelTrackCandidateProducer() { } + +void IsolatedPixelTrackCandidateProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + std::vector tracksrc = {edm::InputTag("hltPixelTracks")}; + desc.add("L1eTauJetsSource",edm::InputTag("hltCaloStage2Digis","Tau")); + desc.add("tauAssociationCone", 0.0 ); + desc.add("tauUnbiasCone", 1.2 ); + desc.add >("PixelTracksSources",tracksrc); + desc.add("ExtrapolationConeSize", 1.0); + desc.add("PixelIsolationConeSizeAtEC",40); + desc.add("L1GTSeedLabel",edm::InputTag("hltL1sIsoTrack")); + desc.add("MaxVtxDXYSeed", 101.0); + desc.add("MaxVtxDXYIsol", 101.0); + desc.add("VertexLabel",edm::InputTag("hltTrimmedPixelVertices")); + desc.add("MagFieldRecordName","VolumeBasedMagneticField"); + desc.add("minPTrack", 5.0); + desc.add("maxPTrackForIsolation", 3.0); + desc.add("EBEtaBoundary", 1.479); + descriptions.add("isolPixelTrackProd",desc); } void IsolatedPixelTrackCandidateProducer::beginRun(const edm::Run &run, const edm::EventSetup &theEventSetup) { From eca3571c73deb1dcc8ab3faf12e3619dec96468a Mon Sep 17 00:00:00 2001 From: Petar Date: Fri, 16 Mar 2018 19:53:05 -0500 Subject: [PATCH 154/426] Added the missing SiPixel2DTemplateDBObjectESProducer --- .../SiPixel2DTemplateDBObjectESProducer.h | 33 ++++++++++ .../SiPixel2DTemplateDBObjectESProducer.cc | 62 +++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 CalibTracker/SiPixelESProducers/interface/SiPixel2DTemplateDBObjectESProducer.h create mode 100644 CalibTracker/SiPixelESProducers/plugins/SiPixel2DTemplateDBObjectESProducer.cc diff --git a/CalibTracker/SiPixelESProducers/interface/SiPixel2DTemplateDBObjectESProducer.h b/CalibTracker/SiPixelESProducers/interface/SiPixel2DTemplateDBObjectESProducer.h new file mode 100644 index 0000000000000..3c6a6d7ed93ea --- /dev/null +++ b/CalibTracker/SiPixelESProducers/interface/SiPixel2DTemplateDBObjectESProducer.h @@ -0,0 +1,33 @@ +#ifndef CalibTracker_SiPixelESProducers_SiPixel2DTemplateDBObjectESProducer_h +#define CalibTracker_SiPixelESProducers_SiPixel2DTemplateDBObjectESProducer_h +// -*- C++ -*- +// +// Package: SiPixel2DTemplateDBObjectESProducer +// Class: SiPixel2DTemplateDBObjectESProducer +// +/**\class SiPixel2DTemplateDBObjectESProducer SiPixel2DTemplateDBObjectESProducer.cc CalibTracker/SiPixelESProducers/plugin/SiPixel2DTemplateDBObjectESProducer.cc + + Description: ESProducer for magnetic-field-dependent local reco templates + + Implementation: Used inside the RecoLocalTracker/Records/TkPixelRecord to select the correct db for given magnetic field +*/ +// +// Original Author: D.Fehling +// Created: Tue Sep 29 14:49:31 CET 2009 +// +// + +#include "FWCore/Framework/interface/ESProducer.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "CondFormats/SiPixelObjects/interface/SiPixel2DTemplateDBObject.h" +#include "CalibTracker/Records/interface/SiPixel2DTemplateDBObjectESProducerRcd.h" + +class SiPixel2DTemplateDBObjectESProducer : public edm::ESProducer { + +public: + + SiPixel2DTemplateDBObjectESProducer(const edm::ParameterSet& iConfig); + ~SiPixel2DTemplateDBObjectESProducer() override; + std::shared_ptr produce(const SiPixel2DTemplateDBObjectESProducerRcd &); + }; +#endif diff --git a/CalibTracker/SiPixelESProducers/plugins/SiPixel2DTemplateDBObjectESProducer.cc b/CalibTracker/SiPixelESProducers/plugins/SiPixel2DTemplateDBObjectESProducer.cc new file mode 100644 index 0000000000000..78d1a9ec40a20 --- /dev/null +++ b/CalibTracker/SiPixelESProducers/plugins/SiPixel2DTemplateDBObjectESProducer.cc @@ -0,0 +1,62 @@ +// -*- C++ -*- +// Package: SiPixelESProducers +// Class: SiPixel2DTemplateDBObjectESProducer +// Original Author: D.Fehling +// Created: Tue Sep 29 14:49:31 CET 2009 +// + +#include "CalibTracker/SiPixelESProducers/interface/SiPixel2DTemplateDBObjectESProducer.h" + +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/do_nothing_deleter.h" + +#include +#include "boost/mpl/vector.hpp" + +#include "FWCore/Framework/interface/ModuleFactory.h" +#include "MagneticField/Engine/interface/MagneticField.h" + +using namespace edm; + +SiPixel2DTemplateDBObjectESProducer::SiPixel2DTemplateDBObjectESProducer(const edm::ParameterSet& iConfig) { + setWhatProduced(this); +} + + +SiPixel2DTemplateDBObjectESProducer::~SiPixel2DTemplateDBObjectESProducer(){ +} + + + + +std::shared_ptr SiPixel2DTemplateDBObjectESProducer::produce(const SiPixel2DTemplateDBObjectESProducerRcd & iRecord) { + + ESHandle magfield; + iRecord.getRecord().get(magfield); + + GlobalPoint center(0.0, 0.0, 0.0); + float theMagField = magfield.product()->inTesla(center).mag(); + + std::string label = ""; + + if( theMagField>=-0.1 && theMagField<1.0 ) label = "0T"; + else if(theMagField>=1.0 && theMagField<2.5 ) label = "2T"; + else if(theMagField>=2.5 && theMagField<3.25) label = "3T"; + else if(theMagField>=3.25 && theMagField<3.65) label = "35T"; + else if(theMagField>=3.9 && theMagField<4.1 ) label = "4T"; + else { + //label = "3.8T"; + if(theMagField>=4.1 || theMagField<-0.1) edm::LogWarning("UnexpectedMagneticFieldUsingDefaultPixel2DTemplate") << "Magnetic field is " << theMagField; + } + ESHandle dbobject; + iRecord.getRecord().get(label,dbobject); + + if(std::fabs(theMagField-dbobject->sVector()[22])>0.1) + edm::LogWarning("UnexpectedMagneticFieldUsingNonIdealPixel2DTemplate") << "Magnetic field is " << theMagField << " Template Magnetic field is " << dbobject->sVector()[22]; + + return std::shared_ptr(const_cast(&(*dbobject)), edm::do_nothing_deleter()); +} + +DEFINE_FWK_EVENTSETUP_MODULE(SiPixel2DTemplateDBObjectESProducer); From 49f2bf3593477024b0203d64a0e0330995248d8a Mon Sep 17 00:00:00 2001 From: Ianna Osborne Date: Mon, 19 Mar 2018 08:26:08 +0100 Subject: [PATCH 155/426] Add 2018 Zero material scenario and its DB scripts --- .../createExtended2018Payloads.sh | 27 +++++++++++++++++++ .../writehelpers/splitExtended2018Database.sh | 1 + .../GeometryExtended2018ZeroMaterial_cff.py | 11 ++++++++ 3 files changed, 39 insertions(+) create mode 100644 Configuration/Geometry/python/GeometryExtended2018ZeroMaterial_cff.py diff --git a/CondTools/Geometry/test/writehelpers/createExtended2018Payloads.sh b/CondTools/Geometry/test/writehelpers/createExtended2018Payloads.sh index 00c250c19c980..87e546599e96f 100755 --- a/CondTools/Geometry/test/writehelpers/createExtended2018Payloads.sh +++ b/CondTools/Geometry/test/writehelpers/createExtended2018Payloads.sh @@ -27,6 +27,33 @@ cmsRun geometryExtended2018_xmlwriter.py # reco parts of the database are also filled. cmsRun geometryExtended2018_writer.py +# Now put the other scenarios into the database. +# Input the many XML files referenced by the cff file and +# output a single big XML file. +# This is repeated several times below. The sed commands +# serve to give the following sequence of input and output +# files +# +# Input cff Output file +# GeometryIdeal_cff giSingleBigFile.xml +# +sed -i '{s/Extended2018/Extended2018ZeroMaterial/g}' geometryExtended2018_xmlwriter.py +sed -i '{s/\/ge/\/gez/g}' geometryExtended2018_xmlwriter.py +cmsRun geometryExtended2018_xmlwriter.py + +# Read the one big XML file and output a record to the +# database with the an identifying tag +# This is repeated several times below. The sed commands +# serve to give the following sequence of input file and output +# tag +# +# Input file Output tag +# gezSingleBigFile.xml XMLFILE_Geometry_${mytag}_Extended2018ZeroMaterial_mc +# +sed -i '{s/Extended/Extended2018ZeroMaterial/g}' xmlgeometrywriter.py +sed -i '{s/\/ge/\/gez/g}' xmlgeometrywriter.py +cmsRun xmlgeometrywriter.py + # All the database objects were written into one database # (myfile.db) in the steps above. Extract the different # pieces into separate database files. These are the payloads diff --git a/CondTools/Geometry/test/writehelpers/splitExtended2018Database.sh b/CondTools/Geometry/test/writehelpers/splitExtended2018Database.sh index 4db56c45766bf..2eac2afd463e2 100755 --- a/CondTools/Geometry/test/writehelpers/splitExtended2018Database.sh +++ b/CondTools/Geometry/test/writehelpers/splitExtended2018Database.sh @@ -1,6 +1,7 @@ #!/bin/sh conddb_import -f sqlite_file:myfile.db -c sqlite_file:GeometryFileExtended2018.db -t XMLFILE_Geometry_TagXX_Extended2018_mc -i XMLFILE_Geometry_TagXX_Extended2018_mc +conddb_import -f sqlite_file:myfile.db -c sqlite_file:GeometryFileExtended2018ZeroMaterial.db -t XMLFILE_Geometry_TagXX_Extended2018ZeroMaterial_mc -i XMLFILE_Geometry_TagXX_Extended2018ZeroMaterial_mc conddb_import -f sqlite_file:myfile.db -c sqlite_file:TKRECO_Geometry.db -t TKRECO_Geometry_TagXX -i TKRECO_Geometry_TagXX conddb_import -f sqlite_file:myfile.db -c sqlite_file:TKExtra_Geometry.db -t TKExtra_Geometry_TagXX -i TKExtra_Geometry_TagXX conddb_import -f sqlite_file:myfile.db -c sqlite_file:TKParameters_Geometry.db -t TKParameters_Geometry_TagXX -i TKParameters_Geometry_TagXX diff --git a/Configuration/Geometry/python/GeometryExtended2018ZeroMaterial_cff.py b/Configuration/Geometry/python/GeometryExtended2018ZeroMaterial_cff.py new file mode 100644 index 0000000000000..984727c4ba340 --- /dev/null +++ b/Configuration/Geometry/python/GeometryExtended2018ZeroMaterial_cff.py @@ -0,0 +1,11 @@ +import FWCore.ParameterSet.Config as cms + +# +# Geometry master configuration +# +# Ideal geometry, needed for simulation +from Geometry.CMSCommonData.cmsExtendedGeometry2018ZeroMaterialXML_cfi import * +from Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi import * +from Geometry.HcalCommonData.hcalParameters_cfi import * +from Geometry.HcalCommonData.hcalDDDSimConstants_cfi import * + From 29fa9ec1c018caf9ed82a4381693c58c32f862a8 Mon Sep 17 00:00:00 2001 From: kpanos Date: Mon, 19 Mar 2018 17:38:15 +0100 Subject: [PATCH 156/426] quick fix for the BMTF o2o --- .../src/L1TMuonBarrelParamsHelper.cc | 39 ++++++++++--------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/L1Trigger/L1TMuonBarrel/src/L1TMuonBarrelParamsHelper.cc b/L1Trigger/L1TMuonBarrel/src/L1TMuonBarrelParamsHelper.cc index 4268dd37f2273..985c7bb021845 100644 --- a/L1Trigger/L1TMuonBarrel/src/L1TMuonBarrelParamsHelper.cc +++ b/L1Trigger/L1TMuonBarrel/src/L1TMuonBarrelParamsHelper.cc @@ -124,6 +124,9 @@ void L1TMuonBarrelParamsHelper::configFromDB(l1t::TriggerSystem& trgSys) { std::map procRole = trgSys.getProcToRoleAssignment(); + //Cleaning the default masking from the prototype + l1mudttfmasks.reset(); + for(auto it_proc=procRole.begin(); it_proc!=procRole.end(); it_proc++ ) { @@ -171,26 +174,26 @@ void L1TMuonBarrelParamsHelper::configFromDB(l1t::TriggerSystem& trgSys) for(int sec=0; sec<12; sec++){ if(masks[m]=="mask_ctrl_N2"){ l1mudttfmasks.set_inrec_chdis_st1(-3,sec,true); - l1mudttfmasks.set_etsoc_chdis_st1(-3,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st1(-3,sec,true); } if(masks[m]=="mask_ctrl_N1"){ l1mudttfmasks.set_inrec_chdis_st1(-2,sec,true); - l1mudttfmasks.set_etsoc_chdis_st1(-2,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st1(-2,sec,true); } if(masks[m]=="mask_ctrl_0"){ l1mudttfmasks.set_inrec_chdis_st1(-1,sec,true); l1mudttfmasks.set_inrec_chdis_st1(1,sec,true); - l1mudttfmasks.set_etsoc_chdis_st1(-1,sec,true); - l1mudttfmasks.set_etsoc_chdis_st1(1,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st1(-1,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st1(1,sec,true); } if(masks[m]=="mask_ctrl_P1"){ l1mudttfmasks.set_inrec_chdis_st1(2,sec,true); - l1mudttfmasks.set_etsoc_chdis_st1(2,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st1(2,sec,true); } if(masks[m]=="mask_ctrl_P2"){ l1mudttfmasks.set_inrec_chdis_st1(3,sec,true); - l1mudttfmasks.set_etsoc_chdis_st1(3,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st1(3,sec,true); } } @@ -200,26 +203,26 @@ void L1TMuonBarrelParamsHelper::configFromDB(l1t::TriggerSystem& trgSys) for(int sec=0; sec<12; sec++){ if(masks[m]=="mask_ctrl_N2"){ l1mudttfmasks.set_inrec_chdis_st2(-3,sec,true); - l1mudttfmasks.set_etsoc_chdis_st2(-3,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st2(-3,sec,true); } if(masks[m]=="mask_ctrl_N1"){ l1mudttfmasks.set_inrec_chdis_st2(-2,sec,true); - l1mudttfmasks.set_etsoc_chdis_st2(-2,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st2(-2,sec,true); } if(masks[m]=="mask_ctrl_0"){ l1mudttfmasks.set_inrec_chdis_st2(-1,sec,true); l1mudttfmasks.set_inrec_chdis_st2(1,sec,true); - l1mudttfmasks.set_etsoc_chdis_st2(-1,sec,true); - l1mudttfmasks.set_etsoc_chdis_st2(1,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st2(-1,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st2(1,sec,true); } if(masks[m]=="mask_ctrl_P1"){ l1mudttfmasks.set_inrec_chdis_st2(2,sec,true); - l1mudttfmasks.set_etsoc_chdis_st2(2,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st2(2,sec,true); } if(masks[m]=="mask_ctrl_P2"){ l1mudttfmasks.set_inrec_chdis_st2(3,sec,true); - l1mudttfmasks.set_etsoc_chdis_st2(3,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st2(3,sec,true); } } } @@ -228,26 +231,26 @@ void L1TMuonBarrelParamsHelper::configFromDB(l1t::TriggerSystem& trgSys) for(int sec=0; sec<12; sec++){ if(masks[m]=="mask_ctrl_N2"){ l1mudttfmasks.set_inrec_chdis_st3(-3,sec,true); - l1mudttfmasks.set_etsoc_chdis_st3(-3,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st3(-3,sec,true); } if(masks[m]=="mask_ctrl_N1"){ l1mudttfmasks.set_inrec_chdis_st3(-2,sec,true); - l1mudttfmasks.set_etsoc_chdis_st3(-2,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st3(-2,sec,true); } if(masks[m]=="mask_ctrl_0"){ l1mudttfmasks.set_inrec_chdis_st3(-1,sec,true); l1mudttfmasks.set_inrec_chdis_st3(1,sec,true); - l1mudttfmasks.set_etsoc_chdis_st3(-1,sec,true); - l1mudttfmasks.set_etsoc_chdis_st3(1,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st3(-1,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st3(1,sec,true); } if(masks[m]=="mask_ctrl_P1"){ l1mudttfmasks.set_inrec_chdis_st3(2,sec,true); - l1mudttfmasks.set_etsoc_chdis_st3(2,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st3(2,sec,true); } if(masks[m]=="mask_ctrl_P2"){ l1mudttfmasks.set_inrec_chdis_st3(3,sec,true); - l1mudttfmasks.set_etsoc_chdis_st3(3,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st3(3,sec,true); } } } From abf291fdd310c6527ac8413eefa688b18ac80f87 Mon Sep 17 00:00:00 2001 From: kpanos Date: Mon, 19 Mar 2018 17:51:10 +0100 Subject: [PATCH 157/426] removed DQM Quality Tests from this branch --- .../data/L1TStage2BMTFQualityTests.xml | 16 ---------------- .../python/L1TStage2EventInfoClient_cfi.py | 10 ---------- 2 files changed, 26 deletions(-) diff --git a/DQM/L1TMonitorClient/data/L1TStage2BMTFQualityTests.xml b/DQM/L1TMonitorClient/data/L1TStage2BMTFQualityTests.xml index 77e3405db2176..8c45a1ade4704 100644 --- a/DQM/L1TMonitorClient/data/L1TStage2BMTFQualityTests.xml +++ b/DQM/L1TMonitorClient/data/L1TStage2BMTFQualityTests.xml @@ -28,20 +28,4 @@ BMTF_WedgeBXNoisyWedge - - - - ContentsYRange - 0.00 - 0.00 - 0.95 - 0.99 - 1 - - - - zeroSupp_MismatchRatioMax0 - - - diff --git a/DQM/L1TMonitorClient/python/L1TStage2EventInfoClient_cfi.py b/DQM/L1TMonitorClient/python/L1TStage2EventInfoClient_cfi.py index 130939e3a6175..a72924144bc7b 100644 --- a/DQM/L1TMonitorClient/python/L1TStage2EventInfoClient_cfi.py +++ b/DQM/L1TMonitorClient/python/L1TStage2EventInfoClient_cfi.py @@ -110,16 +110,6 @@ QualityTestHist = cms.string("L1T/L1TStage2BMTF/bmtf_wedge_bx"), QualityTestSummaryEnabled = cms.uint32(1) ), - cms.PSet( - QualityTestName = cms.string("zeroSupp_MismatchRatioMax0"), - QualityTestHist = cms.string("L1T/L1TStage2BMTF/zeroSuppression/AllEvts/mismatchRatio"), - QualityTestSummaryEnabled = cms.uint32(1) - ), - cms.PSet( - QualityTestName = cms.string("zeroSupp_MismatchRatioMax0"), - QualityTestHist = cms.string("L1T/L1TStage2BMTF/zeroSuppression/FatEvts/mismatchRatio"), - QualityTestSummaryEnabled = cms.uint32(1) - ), ) ), cms.PSet( From 30581e76c96306b5be3913dd2284465c01230fc4 Mon Sep 17 00:00:00 2001 From: Kyle Knoepfel Date: Mon, 19 Mar 2018 14:03:46 -0500 Subject: [PATCH 158/426] Removing caching of temporary variables' addresses. --- DQM/SiStripCommon/interface/TkHistoMap.h | 11 ++-- DQM/SiStripCommon/src/TkHistoMap.cc | 65 +++++++++++++----------- 2 files changed, 39 insertions(+), 37 deletions(-) diff --git a/DQM/SiStripCommon/interface/TkHistoMap.h b/DQM/SiStripCommon/interface/TkHistoMap.h index 8c441b08edcd1..acb87c4bb94a2 100644 --- a/DQM/SiStripCommon/interface/TkHistoMap.h +++ b/DQM/SiStripCommon/interface/TkHistoMap.h @@ -47,18 +47,15 @@ class TkHistoMap{ void saveAsCanvas(const std::string& filename, const std::string& options="", const std::string& mode="RECREATE"); private: - + void load(const TkDetMap* tkDetMap, const std::string& path, float baseline, bool mechanicalView, bool isTH2F, bool createTkMap = true); - void createTkHistoMap(const std::string& path, const std::string& MapName, float baseline, bool mechanicalView); + void createTkHistoMap(DQMStore::IBooker& ibooker, const std::string& path, const std::string& MapName, float baseline, bool mechanicalView); - std::string folderDefinition(std::string folder, const std::string& MapName, int layer , bool mechanicalView,std::string& fullName ); + std::string folderDefinition(DQMStore::IBooker& ibooker, std::string folder, const std::string& MapName, int layer , bool mechanicalView,std::string& fullName ); DQMStore* dqmStore_{nullptr}; - DQMStore::IBooker* ibooker_{nullptr}; - DQMStore::IGetter* igetter_{nullptr}; - - + const TkDetMap* tkdetmap_; DetId cached_detid; int16_t cached_layer; diff --git a/DQM/SiStripCommon/src/TkHistoMap.cc b/DQM/SiStripCommon/src/TkHistoMap.cc index e4eed1c0dd31b..f5c84d1a5c8bc 100644 --- a/DQM/SiStripCommon/src/TkHistoMap.cc +++ b/DQM/SiStripCommon/src/TkHistoMap.cc @@ -6,32 +6,41 @@ TkHistoMap::TkHistoMap(const TkDetMap* tkDetMap): HistoNumber(35) { - LogTrace("TkHistoMap") <<"TkHistoMap::constructor without parameters"; + LogTrace("TkHistoMap") <<"TkHistoMap::constructor without parameters"; load(tkDetMap, "", 0.0f, false, false, false); } TkHistoMap::TkHistoMap(const TkDetMap* tkDetMap, const std::string& path, const std::string& MapName, float baseline, bool mechanicalView): - HistoNumber(35), + HistoNumber(35), MapName_(MapName) { - LogTrace("TkHistoMap") <<"TkHistoMap::constructor with parameters"; + LogTrace("TkHistoMap") <<"TkHistoMap::constructor with parameters"; load(tkDetMap, path, baseline, mechanicalView, false); + dqmStore_->meBookerGetter([this, &path, &baseline, mechanicalView](DQMStore::IBooker& ibooker, + DQMStore::IGetter&){ + this->createTkHistoMap(ibooker, path, MapName_, baseline, mechanicalView); + }); } TkHistoMap::TkHistoMap(const TkDetMap* tkDetMap, const std::string& path, const std::string& MapName, float baseline, bool mechanicalView, bool isTH2F): HistoNumber(35), MapName_(MapName) { - LogTrace("TkHistoMap") <<"TkHistoMap::constructor with parameters"; + LogTrace("TkHistoMap") <<"TkHistoMap::constructor with parameters"; load(tkDetMap, path, baseline, mechanicalView, isTH2F); + dqmStore_->meBookerGetter([this, &path, &baseline, mechanicalView](DQMStore::IBooker& ibooker, + DQMStore::IGetter&){ + this->createTkHistoMap(ibooker, path, MapName_, baseline, mechanicalView); + }); } TkHistoMap::TkHistoMap(const TkDetMap* tkDetMap, DQMStore::IBooker& ibooker, const std::string& path, const std::string& MapName, float baseline, bool mechanicalView): HistoNumber(35), MapName_(MapName) { - LogTrace("TkHistoMap") <<"TkHistoMap::constructor with parameters"; + LogTrace("TkHistoMap") <<"TkHistoMap::constructor with parameters"; load(tkDetMap, path, baseline, mechanicalView, false); + createTkHistoMap(ibooker, path, MapName_, baseline, mechanicalView); } void TkHistoMap::load(const TkDetMap* tkDetMap, const std::string& path, float baseline, bool mechanicalView, bool isTH2F, bool createTkMap) @@ -41,7 +50,6 @@ void TkHistoMap::load(const TkDetMap* tkDetMap, const std::string& path, float b loadServices(); tkdetmap_ = tkDetMap; isTH2F_ = isTH2F; - if (createTkMap) createTkHistoMap(path, MapName_, baseline, mechanicalView); } void TkHistoMap::loadServices(){ @@ -51,12 +59,8 @@ void TkHistoMap::loadServices(){ "\nUnAvailable Service DQMStore: please insert in the configuration file an instance like" "\n\tprocess.load(\"DQMServices.Core.DQMStore_cfg\")" "\n------------------------------------------"; - } + } dqmStore_ = edm::Service().operator->(); - dqmStore_->meBookerGetter([this](DQMStore::IBooker &b, DQMStore::IGetter &g){ - this->ibooker_ = &b; - this->igetter_ = &g; - }); } void TkHistoMap::save(const std::string& filename){ @@ -66,24 +70,27 @@ void TkHistoMap::save(const std::string& filename){ void TkHistoMap::loadTkHistoMap(const std::string& path, const std::string& MapName, bool mechanicalView){ MapName_=MapName; - std::string fullName, folder; tkHistoMap_.resize(HistoNumber); - for(int layer=1;layerget(folder+fullName); + if (folder.find_last_of("/")!=folder.length()-1) + folder+="/"; + tkHistoMap_[layer]=igetter.get(folder+fullName); #ifdef debug_TkHistoMap - LogTrace("TkHistoMap") << "[TkHistoMap::loadTkHistoMap] folder " << folder << " histoName " << fullName << " layer " << layer << " ptr " << tkHistoMap_[layer] << " find " << folder.find_last_of("/") << " length " << folder.length(); + LogTrace("TkHistoMap") << "[TkHistoMap::loadTkHistoMap] folder " << folder << " histoName " << fullName << " layer " << layer << " ptr " << tkHistoMap_[layer] << " find " << folder.find_last_of("/") << " length " << folder.length(); #endif - } + } + }; + dqmStore_->meBookerGetter(loadMap); } -void TkHistoMap::createTkHistoMap(const std::string& path, const std::string& MapName, float baseline, bool mechanicalView){ +void TkHistoMap::createTkHistoMap(DQMStore::IBooker& ibooker, const std::string& path, const std::string& MapName, float baseline, bool mechanicalView){ int nchX; int nchY; @@ -94,17 +101,17 @@ void TkHistoMap::createTkHistoMap(const std::string& path, const std::string& Ma tkHistoMap_.resize(HistoNumber); const bool bookTH2F = isTH2F_; for(int layer=1;layergetComponents(layer,nchX,lowX,highX,nchY,lowY,highY); MonitorElement* me; if(bookTH2F==false){ - me = ibooker_->bookProfile2D(fullName.c_str(),fullName.c_str(), + me = ibooker.bookProfile2D(fullName.c_str(),fullName.c_str(), nchX,lowX,highX, nchY,lowY,highY, 0.0, 0.0); } else{ - me = ibooker_->book2D(fullName.c_str(),fullName.c_str(), + me = ibooker.book2D(fullName.c_str(),fullName.c_str(), nchX,lowX,highX, nchY,lowY,highY); } @@ -123,11 +130,10 @@ void TkHistoMap::createTkHistoMap(const std::string& path, const std::string& Ma } } -std::string TkHistoMap::folderDefinition(std::string folder, const std::string& MapName, int layer , bool mechanicalView,std::string& fullName ){ +std::string TkHistoMap::folderDefinition(DQMStore::IBooker& ibooker, std::string folder, const std::string& MapName, int layer , bool mechanicalView,std::string& fullName ){ std::string name = MapName+std::string("_"); fullName=name+TkDetMap::getLayerName(layer); - // std::cout << "[TkHistoMap::folderDefinition] fullName: " << fullName << std::endl; if(mechanicalView){ std::stringstream ss; @@ -140,9 +146,8 @@ std::string TkHistoMap::folderDefinition(std::string folder, const std::string& TkDetMap::getSubDetLayerSide(layer,subDet,subdetlayer,side); folderOrg.getSubDetLayerFolderName(ss,subDet,subdetlayer,side); folder = ss.str(); - // std::cout << "[TkHistoMap::folderDefinition] folder: " << folder << std::endl; } - ibooker_->setCurrentFolder(folder); + ibooker.setCurrentFolder(folder); return folder; } @@ -323,4 +328,4 @@ void TkHistoMap::saveAsCanvas(const std::string& filename, const std::string& op CTECM->Write(); f->Close(); delete f; -} \ No newline at end of file +} From be8f6519981a4a001f0a3afb1a2e65a18c36d81a Mon Sep 17 00:00:00 2001 From: Petar Date: Mon, 19 Mar 2018 15:15:50 -0500 Subject: [PATCH 159/426] Finally something that may be working + cosmetic cleanup ... --- ...SiPixel2DTemplateDBObjectESProducer_cfi.py | 4 + CondCore/SiPixelPlugins/src/plugin.cc | 13 +- .../SiPixel2DTemplateDBObject0TRcd.h | 26 ++++ .../SiPixel2DTemplateDBObject38TRcd.h | 26 ++++ .../SiPixel2DTemplateDBObject4TRcd.h | 26 ++++ .../src/SiPixel2DTemplateDBObject0TRcd.cc | 16 +++ .../src/SiPixel2DTemplateDBObject38TRcd.cc | 16 +++ .../src/SiPixel2DTemplateDBObject4TRcd.cc | 16 +++ .../interface/SiPixelTemplate.h | 6 +- .../interface/SiPixelTemplateReco2D.h | 2 - .../python/PixelCPEESProducers_cff.py | 3 +- .../src/PixelCPEClusterRepair.cc | 126 ++++++++---------- .../src/PixelCPETemplateReco.cc | 2 +- .../SiPixelRecHits/src/SiPixelGenError.cc | 2 +- .../SiPixelRecHits/src/SiPixelTemplate2D.cc | 2 +- .../src/SiPixelTemplateReco2D.cc | 4 +- 16 files changed, 206 insertions(+), 84 deletions(-) create mode 100644 CalibTracker/SiPixelESProducers/python/SiPixel2DTemplateDBObjectESProducer_cfi.py create mode 100644 CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject0TRcd.h create mode 100644 CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject38TRcd.h create mode 100644 CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject4TRcd.h create mode 100644 CondFormats/DataRecord/src/SiPixel2DTemplateDBObject0TRcd.cc create mode 100644 CondFormats/DataRecord/src/SiPixel2DTemplateDBObject38TRcd.cc create mode 100644 CondFormats/DataRecord/src/SiPixel2DTemplateDBObject4TRcd.cc diff --git a/CalibTracker/SiPixelESProducers/python/SiPixel2DTemplateDBObjectESProducer_cfi.py b/CalibTracker/SiPixelESProducers/python/SiPixel2DTemplateDBObjectESProducer_cfi.py new file mode 100644 index 0000000000000..9b7e06b89760c --- /dev/null +++ b/CalibTracker/SiPixelESProducers/python/SiPixel2DTemplateDBObjectESProducer_cfi.py @@ -0,0 +1,4 @@ +import FWCore.ParameterSet.Config as cms + +siPixelTemplateDBObjectESProducer = cms.ESProducer("SiPixel2DTemplateDBObjectESProducer") + diff --git a/CondCore/SiPixelPlugins/src/plugin.cc b/CondCore/SiPixelPlugins/src/plugin.cc index dce0fde30426c..ec115267b7c92 100644 --- a/CondCore/SiPixelPlugins/src/plugin.cc +++ b/CondCore/SiPixelPlugins/src/plugin.cc @@ -10,8 +10,6 @@ #include "CondFormats/DataRecord/interface/SiPixelGainCalibrationRcd.h" #include "CondFormats/SiPixelObjects/interface/SiPixelLorentzAngle.h" #include "CondFormats/SiPixelObjects/interface/SiPixelDynamicInefficiency.h" -#include "CondFormats/SiPixelObjects/interface/SiPixel2DTemplateDBObject.h" -#include "CondFormats/DataRecord/interface/SiPixel2DTemplateDBObjectRcd.h" #include "CondFormats/DataRecord/interface/SiPixelLorentzAngleRcd.h" #include "CondFormats/DataRecord/interface/SiPixelDynamicInefficiencyRcd.h" #include "CondFormats/SiPixelObjects/interface/SiPixelCalibConfiguration.h" @@ -23,11 +21,19 @@ #include "CondFormats/DataRecord/interface/SiPixelQualityRcd.h" #include "CondFormats/SiPixelObjects/interface/SiPixelCPEGenericErrorParm.h" #include "CondFormats/DataRecord/interface/SiPixelCPEGenericErrorParmRcd.h" + #include "CondFormats/SiPixelObjects/interface/SiPixelTemplateDBObject.h" #include "CondFormats/DataRecord/interface/SiPixelTemplateDBObjectRcd.h" #include "CondFormats/DataRecord/interface/SiPixelTemplateDBObject38TRcd.h" #include "CondFormats/DataRecord/interface/SiPixelTemplateDBObject4TRcd.h" #include "CondFormats/DataRecord/interface/SiPixelTemplateDBObject0TRcd.h" + +#include "CondFormats/SiPixelObjects/interface/SiPixel2DTemplateDBObject.h" +#include "CondFormats/DataRecord/interface/SiPixel2DTemplateDBObjectRcd.h" +#include "CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject38TRcd.h" +#include "CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject4TRcd.h" +#include "CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject0TRcd.h" + #include "CondFormats/SiPixelObjects/interface/SiPixelGenErrorDBObject.h" #include "CondFormats/DataRecord/interface/SiPixelGenErrorDBObjectRcd.h" #include "CondFormats/SiPixelObjects/interface/PixelDCSObject.h" @@ -61,6 +67,9 @@ REGISTER_PLUGIN(SiPixelTemplateDBObject38TRcd,SiPixelTemplateDBObject); REGISTER_PLUGIN(SiPixelTemplateDBObject4TRcd,SiPixelTemplateDBObject); REGISTER_PLUGIN(SiPixelTemplateDBObject0TRcd,SiPixelTemplateDBObject); REGISTER_PLUGIN(SiPixel2DTemplateDBObjectRcd,SiPixel2DTemplateDBObject); +REGISTER_PLUGIN(SiPixel2DTemplateDBObject38TRcd,SiPixel2DTemplateDBObject); +REGISTER_PLUGIN(SiPixel2DTemplateDBObject4TRcd,SiPixel2DTemplateDBObject); +REGISTER_PLUGIN(SiPixel2DTemplateDBObject0TRcd,SiPixel2DTemplateDBObject); REGISTER_PLUGIN(SiPixelGenErrorDBObjectRcd,SiPixelGenErrorDBObject); REGISTER_PLUGIN(PixelCaenChannelIsOnRcd, PixelDCSObject); diff --git a/CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject0TRcd.h b/CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject0TRcd.h new file mode 100644 index 0000000000000..c94643023f834 --- /dev/null +++ b/CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject0TRcd.h @@ -0,0 +1,26 @@ +#ifndef DataRecord_SiPixel2DTemplateDBObject0TRcd_h +#define DataRecord_SiPixel2DTemplateDBObject0TRcd_h +// -*- C++ -*- +// +// Package: DataRecord +// Class : SiPixel2DTemplateDBObject0TRcd +// +/**\class SiPixel2DTemplateDBObject0TRcd SiPixel2DTemplateDBObject0TRcd.h CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject0TRcd.h + + Description: + + Usage: + + +*/ +// +// Author: +// Created: Mon Sep 28 15:40:32 CEST 2009 +// $Id$ +// + +#include "FWCore/Framework/interface/EventSetupRecordImplementation.h" + +class SiPixel2DTemplateDBObject0TRcd : public edm::eventsetup::EventSetupRecordImplementation {}; + +#endif diff --git a/CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject38TRcd.h b/CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject38TRcd.h new file mode 100644 index 0000000000000..314fc4b0b4b9f --- /dev/null +++ b/CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject38TRcd.h @@ -0,0 +1,26 @@ +#ifndef DataRecord_SiPixel2DTemplateDBObject38TRcd_h +#define DataRecord_SiPixel2DTemplateDBObject38TRcd_h +// -*- C++ -*- +// +// Package: DataRecord +// Class : SiPixel2DTemplateDBObject38TRcd +// +/**\class SiPixel2DTemplateDBObject38TRcd SiPixel2DTemplateDBObject38TRcd.h CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject38TRcd.h + + Description: + + Usage: + + +*/ +// +// Author: +// Created: Mon Sep 28 15:40:47 CEST 2009 +// $Id$ +// + +#include "FWCore/Framework/interface/EventSetupRecordImplementation.h" + +class SiPixel2DTemplateDBObject38TRcd : public edm::eventsetup::EventSetupRecordImplementation {}; + +#endif diff --git a/CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject4TRcd.h b/CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject4TRcd.h new file mode 100644 index 0000000000000..6c486df4226b0 --- /dev/null +++ b/CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject4TRcd.h @@ -0,0 +1,26 @@ +#ifndef DataRecord_SiPixel2DTemplateDBObject4TRcd_h +#define DataRecord_SiPixel2DTemplateDBObject4TRcd_h +// -*- C++ -*- +// +// Package: DataRecord +// Class : SiPixel2DTemplateDBObject4TRcd +// +/**\class SiPixel2DTemplateDBObject4TRcd SiPixel2DTemplateDBObject4TRcd.h CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject4TRcd.h + + Description: + + Usage: + + +*/ +// +// Author: +// Created: Mon Sep 28 15:40:50 CEST 2009 +// $Id$ +// + +#include "FWCore/Framework/interface/EventSetupRecordImplementation.h" + +class SiPixel2DTemplateDBObject4TRcd : public edm::eventsetup::EventSetupRecordImplementation {}; + +#endif diff --git a/CondFormats/DataRecord/src/SiPixel2DTemplateDBObject0TRcd.cc b/CondFormats/DataRecord/src/SiPixel2DTemplateDBObject0TRcd.cc new file mode 100644 index 0000000000000..96f55b1f8c17a --- /dev/null +++ b/CondFormats/DataRecord/src/SiPixel2DTemplateDBObject0TRcd.cc @@ -0,0 +1,16 @@ +// -*- C++ -*- +// +// Package: DataRecord +// Class : SiPixel2DTemplateDBObject0TRcd +// +// Implementation: +// +// +// Author: +// Created: Mon Sep 28 15:40:32 CEST 2009 +// $Id$ + +#include "CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject0TRcd.h" +#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h" + +EVENTSETUP_RECORD_REG(SiPixel2DTemplateDBObject0TRcd); diff --git a/CondFormats/DataRecord/src/SiPixel2DTemplateDBObject38TRcd.cc b/CondFormats/DataRecord/src/SiPixel2DTemplateDBObject38TRcd.cc new file mode 100644 index 0000000000000..4197d11069891 --- /dev/null +++ b/CondFormats/DataRecord/src/SiPixel2DTemplateDBObject38TRcd.cc @@ -0,0 +1,16 @@ +// -*- C++ -*- +// +// Package: DataRecord +// Class : SiPixel2DTemplateDBObject38TRcd +// +// Implementation: +// +// +// Author: +// Created: Mon Sep 28 15:40:47 CEST 2009 +// $Id$ + +#include "CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject38TRcd.h" +#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h" + +EVENTSETUP_RECORD_REG(SiPixel2DTemplateDBObject38TRcd); diff --git a/CondFormats/DataRecord/src/SiPixel2DTemplateDBObject4TRcd.cc b/CondFormats/DataRecord/src/SiPixel2DTemplateDBObject4TRcd.cc new file mode 100644 index 0000000000000..e593c2179a4f1 --- /dev/null +++ b/CondFormats/DataRecord/src/SiPixel2DTemplateDBObject4TRcd.cc @@ -0,0 +1,16 @@ +// -*- C++ -*- +// +// Package: DataRecord +// Class : SiPixel2DTemplateDBObject4TRcd +// +// Implementation: +// +// +// Author: +// Created: Mon Sep 28 15:40:50 CEST 2009 +// $Id$ + +#include "CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject4TRcd.h" +#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h" + +EVENTSETUP_RECORD_REG(SiPixel2DTemplateDBObject4TRcd); diff --git a/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate.h b/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate.h index 0cf3f602603ce..e73d38de63bc8 100755 --- a/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate.h +++ b/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate.h @@ -219,9 +219,9 @@ struct SiPixelTemplateStore { //!< template storage structure SiPixelTemplateEntry entx[5][29]; //!< 29 Barrel x templates spanning cluster lengths from -6px (-1.125Rad) to +6px (+1.125Rad) in each of 5 slices [3x29 for fpix] void destroy() {}; #else - float* cotbetaY; - float* cotbetaX; - float* cotalphaX; + float* cotbetaY = nullptr; + float* cotbetaX = nullptr; + float* cotalphaX = nullptr; boost::multi_array enty; //!< use 1d entry to store [60] barrel entries or [28] fpix entries boost::multi_array entx; //!< use 2d entry to store [5][29] barrel entries or [3][29] fpix entries void destroy() { // deletes arrays created by pushfile method of SiPixelTemplate diff --git a/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateReco2D.h b/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateReco2D.h index 1d991bee3b6ab..f99c091c27591 100644 --- a/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateReco2D.h +++ b/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateReco2D.h @@ -23,8 +23,6 @@ #include "SiPixelTemplate2D.h" #endif -#define NPIXMAX 200 - #include #ifndef SiPixelTemplateClusMatrix2D diff --git a/RecoLocalTracker/SiPixelRecHits/python/PixelCPEESProducers_cff.py b/RecoLocalTracker/SiPixelRecHits/python/PixelCPEESProducers_cff.py index 584a66f248178..a1ff25af2e697 100644 --- a/RecoLocalTracker/SiPixelRecHits/python/PixelCPEESProducers_cff.py +++ b/RecoLocalTracker/SiPixelRecHits/python/PixelCPEESProducers_cff.py @@ -20,7 +20,8 @@ # from RecoLocalTracker.SiPixelRecHits.PixelCPEGeneric_cfi import * # -# 5. The new ESProducer for the Magnetic-field dependent template record +# 5. ESProducer for the Magnetic-field dependent template records # from CalibTracker.SiPixelESProducers.SiPixelTemplateDBObjectESProducer_cfi import * +from CalibTracker.SiPixelESProducers.SiPixel2DTemplateDBObjectESProducer_cfi import * diff --git a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEClusterRepair.cc b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEClusterRepair.cc index 888a41ab12327..4d5e4b878d8ca 100644 --- a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEClusterRepair.cc +++ b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEClusterRepair.cc @@ -139,7 +139,7 @@ PixelCPEClusterRepair::localPosition(DetParam const & theDetParam, ClusterParam if ( LoadTemplatesFromDB_ ) { int ID0 = templateDBobject_->getTemplateID(theDetParam.theDet->geographicalId()); // just to comapre ID = theDetParam.detTemplateId; - if(ID0!=ID) cout<<" different id"<< ID<<" "<getSplitClusterErrorX() > 0.0f && theClusterParam.theCluster->getSplitClusterErrorX() < 7777.7f && - theClusterParam.theCluster->getSplitClusterErrorY() > 0.0f && theClusterParam.theCluster->getSplitClusterErrorY() < 7777.7f ) - { - xerr = theClusterParam.theCluster->getSplitClusterErrorX() * micronsToCm; - yerr = theClusterParam.theCluster->getSplitClusterErrorY() * micronsToCm; + if (theVerboseLevel > 9) { + LogDebug("PixelCPEClusterRepair") + << " Sizex = " << theClusterParam.theCluster->sizeX() + << " Sizey = " << theClusterParam.theCluster->sizeY() + << " Edgex = " << theClusterParam.edgeTypeX_ + << " Edgey = " << theClusterParam.edgeTypeY_ + << " ErrX = " << xerr << " ErrY = " << yerr; } - else - { - //--- Check status of both template calls. - if ( (theClusterParam.ierr !=0) || (theClusterParam.ierr2 !=0) ) - { - // If reconstruction fails the hit position is calculated from cluster center of gravity - // corrected in x by average Lorentz drift. Assign huge errors. - // - if(!GeomDetEnumerators::isTrackerPixel(theDetParam.thePart)) - throw cms::Exception("PixelCPEClusterRepair::localPosition :") - << "A non-pixel detector type in here?"; - - // Assign better errors based on the residuals for failed template cases - if ( GeomDetEnumerators::isBarrel(theDetParam.thePart) ) - { - xerr = 55.0f * micronsToCm; - yerr = 36.0f * micronsToCm; - } - else - { - xerr = 42.0f * micronsToCm; - yerr = 39.0f * micronsToCm; - } - } - else if ( theClusterParam.edgeTypeX_ || theClusterParam.edgeTypeY_ ) - { - // for edge pixels assign errors according to observed residual RMS - if ( theClusterParam.edgeTypeX_ && !theClusterParam.edgeTypeY_ ) - { - xerr = 23.0f * micronsToCm; - yerr = 39.0f * micronsToCm; - } - else if ( !theClusterParam.edgeTypeX_ && theClusterParam.edgeTypeY_ ) - { - xerr = 24.0f * micronsToCm; - yerr = 96.0f * micronsToCm; - } - else if ( theClusterParam.edgeTypeX_ && theClusterParam.edgeTypeY_ ) - { - xerr = 31.0f * micronsToCm; - yerr = 90.0f * micronsToCm; - } - } - else - { - xerr = theClusterParam.templSigmaX_ * micronsToCm; - yerr = theClusterParam.templSigmaY_ * micronsToCm; - - // &&& should also check ierr (saved as class variable) and return - // &&& nonsense (another class static) if the template fit failed. - } - - if (theVerboseLevel > 9) - { - LogDebug("PixelCPEClusterRepair") - << " Sizex = " << theClusterParam.theCluster->sizeX() - << " Sizey = " << theClusterParam.theCluster->sizeY() - << " Edgex = " << theClusterParam.edgeTypeX_ - << " Edgey = " << theClusterParam.edgeTypeY_ - << " ErrX = " << xerr << " ErrY = " << yerr; - } - - } // else + if ( !(xerr > 0.0f) ) throw cms::Exception("PixelCPEClusterRepair::localError") diff --git a/RecoLocalTracker/SiPixelRecHits/src/PixelCPETemplateReco.cc b/RecoLocalTracker/SiPixelRecHits/src/PixelCPETemplateReco.cc index 8e84a413390d7..74a678076af8f 100644 --- a/RecoLocalTracker/SiPixelRecHits/src/PixelCPETemplateReco.cc +++ b/RecoLocalTracker/SiPixelRecHits/src/PixelCPETemplateReco.cc @@ -132,7 +132,7 @@ PixelCPETemplateReco::localPosition(DetParam const & theDetParam, ClusterParam & if ( LoadTemplatesFromDB_ ) { int ID0 = templateDBobject_->getTemplateID(theDetParam.theDet->geographicalId()); // just to comapre ID = theDetParam.detTemplateId; - if(ID0!=ID) cout<<" different id"<< ID<<" "< Date: Mon, 19 Mar 2018 20:51:09 -0500 Subject: [PATCH 160/426] Stupid, stupid Python! --- .../python/SiPixel2DTemplateDBObjectESProducer_cfi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CalibTracker/SiPixelESProducers/python/SiPixel2DTemplateDBObjectESProducer_cfi.py b/CalibTracker/SiPixelESProducers/python/SiPixel2DTemplateDBObjectESProducer_cfi.py index 9b7e06b89760c..ffb9fbffa042b 100644 --- a/CalibTracker/SiPixelESProducers/python/SiPixel2DTemplateDBObjectESProducer_cfi.py +++ b/CalibTracker/SiPixelESProducers/python/SiPixel2DTemplateDBObjectESProducer_cfi.py @@ -1,4 +1,4 @@ import FWCore.ParameterSet.Config as cms -siPixelTemplateDBObjectESProducer = cms.ESProducer("SiPixel2DTemplateDBObjectESProducer") +siPixel2D2DTemplateDBObjectESProducer = cms.ESProducer("SiPixel2DTemplateDBObjectESProducer") From 7f54084b36ecdfa3319ebacafedc8c01ff95f698 Mon Sep 17 00:00:00 2001 From: Raffaele Date: Tue, 20 Mar 2018 15:11:51 +0100 Subject: [PATCH 161/426] cleanup printout --- .../src/CalibrationHistograms.cc | 7 ------- .../src/PedsFullNoiseHistograms.cc | 6 ------ 2 files changed, 13 deletions(-) diff --git a/DQM/SiStripCommissioningClients/src/CalibrationHistograms.cc b/DQM/SiStripCommissioningClients/src/CalibrationHistograms.cc index 4abdd0f36cce3..ded5de9f60cc8 100644 --- a/DQM/SiStripCommissioningClients/src/CalibrationHistograms.cc +++ b/DQM/SiStripCommissioningClients/src/CalibrationHistograms.cc @@ -68,9 +68,6 @@ void CalibrationHistograms::histoAnalysis( bool debug ) { data().clear(); // Iterate through map containing vectors of profile histograms - long int iChannel = 0; - long int total = histos().size(); - HistosMap::const_iterator iter = histos().begin(); for ( ; iter != histos().end(); iter++ ) { // Check vector of histos is not empty (should be 1 histo) @@ -81,10 +78,6 @@ void CalibrationHistograms::histoAnalysis( bool debug ) { continue; } - std::cout.flush(); - if(iChannel %10 == 0) std::cout<<"\r"<<"CalibrationHistograms::histoAnalysis: Channel analyzed "<<100*double(iChannel)/(total)<<" % "; - iChannel++; - // Retrieve pointers to 1D histos for this FED channel vector profs; Histos::const_iterator ihis = iter->second.begin(); diff --git a/DQM/SiStripCommissioningClients/src/PedsFullNoiseHistograms.cc b/DQM/SiStripCommissioningClients/src/PedsFullNoiseHistograms.cc index ca33f18677613..74caa1b8635b7 100644 --- a/DQM/SiStripCommissioningClients/src/PedsFullNoiseHistograms.cc +++ b/DQM/SiStripCommissioningClients/src/PedsFullNoiseHistograms.cc @@ -56,15 +56,9 @@ void PedsFullNoiseHistograms::histoAnalysis( bool debug ) { data().clear(); // Iterate through map containing histograms - long int total = histos().size(); - long int iChannel = 0; for ( iter = histos().begin(); iter != histos().end(); iter++ ) { - std::cout.flush(); - if(iChannel %10 == 0) std::cout<<"\r"<<"PedsFullNoiseHistograms::histoAnalysis: strip analyzed "<<100*double(iChannel)/(total)<<" % "; - iChannel++; - // Check vector of histos is not empty if ( iter->second.empty() ) { edm::LogWarning(mlDqmClient_) From 4cb8ca24993c06bf4dab95b4926241171735b4af Mon Sep 17 00:00:00 2001 From: Hans Van Haevermaet Date: Tue, 20 Mar 2018 15:49:39 +0100 Subject: [PATCH 162/426] clean up code --- RecoLocalCalo/Castor/src/RecHitCorrector.cc | 35 +++++++-------------- 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/RecoLocalCalo/Castor/src/RecHitCorrector.cc b/RecoLocalCalo/Castor/src/RecHitCorrector.cc index 633765e8c10a7..57908eb2ea300 100644 --- a/RecoLocalCalo/Castor/src/RecHitCorrector.cc +++ b/RecoLocalCalo/Castor/src/RecHitCorrector.cc @@ -22,7 +22,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -44,15 +44,13 @@ // class declaration // -class RecHitCorrector : public edm::EDProducer { +class RecHitCorrector : public edm::stream::EDProducer<> { public: explicit RecHitCorrector(const edm::ParameterSet&); ~RecHitCorrector() override; private: - void beginJob() override ; void produce(edm::Event&, const edm::EventSetup&) override; - void endJob() override ; // ----------member data --------------------------- edm::EDGetTokenT tok_input_; @@ -122,18 +120,14 @@ RecHitCorrector::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) for (unsigned int i=0;isize();i++) { CastorRecHit rechit = (*rechits)[i]; - double fC = factor_*rechit.energy(); double time = rechit.time(); + double correctedenergy = factor_*rechit.energy(); - // do proper gain calibration reading the latest entries in the condDB - const CastorCalibrations& calibrations=conditions->getCastorCalibrations(rechit.id()); - int capid = 0; // take some capid, gains are the same for all capid's - - double correctedenergy = 0; if (doInterCalib_) { - correctedenergy = fC*calibrations.gain(capid); - } else { - correctedenergy = fC; + // do proper gain calibration reading the latest entries in the condDB + const CastorCalibrations& calibrations=conditions->getCastorCalibrations(rechit.id()); + int capid = 0; // take some capid, gains are the same for all capid's + correctedenergy *= calibrations.gain(capid); } // now check the channelquality of this rechit @@ -143,7 +137,10 @@ RecHitCorrector::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) for (auto channel : channels) { if (channel.rawId() == detcell.rawId()) { const CastorChannelStatus* mydigistatus=myqual->getValues(channel); - if (mydigistatus->getValue() == 2989) ok = false; // 2989 = BAD + if (mydigistatus->getValue() == 2989) { + ok = false; // 2989 = BAD + break; + } } } @@ -158,16 +155,6 @@ RecHitCorrector::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) } -// ------------ method called once each job just before starting event loop ------------ -void -RecHitCorrector::beginJob() -{ -} - -// ------------ method called once each job just after ending the event loop ------------ -void -RecHitCorrector::endJob() { -} //define this as a plug-in DEFINE_FWK_MODULE(RecHitCorrector); From 93deb3d64c4c67fa78e3e8f7840d076b279d376f Mon Sep 17 00:00:00 2001 From: nminafra Date: Tue, 20 Mar 2018 15:54:33 +0100 Subject: [PATCH 163/426] Starting new unpacker --- DataFormats/CTPPSDetId/src/classes.h | 2 ++ DataFormats/CTPPSDetId/src/classes_def.xml | 4 +++ .../plugins/TotemVFATRawToDigi.cc | 19 ++++++++++++- .../python/ctppsRawToDigi_cff.py | 28 +++++++++++++++++++ 4 files changed, 52 insertions(+), 1 deletion(-) diff --git a/DataFormats/CTPPSDetId/src/classes.h b/DataFormats/CTPPSDetId/src/classes.h index c529d815a77e2..715643332bc41 100644 --- a/DataFormats/CTPPSDetId/src/classes.h +++ b/DataFormats/CTPPSDetId/src/classes.h @@ -2,11 +2,13 @@ #include "DataFormats/CTPPSDetId/interface/CTPPSDetId.h" #include "DataFormats/CTPPSDetId/interface/CTPPSDiamondDetId.h" #include "DataFormats/CTPPSDetId/interface/CTPPSPixelDetId.h" +#include "DataFormats/CTPPSDetId/interface/TotemTimingDetId.h" namespace DataFormats_TotemRPDetId { struct dictionary { CTPPSDetId dummy0; TotemRPDetId dummy1; CTPPSDiamondDetId dummy2; CTPPSPixelDetId dummy3; + TotemTimingDetId dummy4; }; } diff --git a/DataFormats/CTPPSDetId/src/classes_def.xml b/DataFormats/CTPPSDetId/src/classes_def.xml index 95c41b0738666..ddfa1a7b4237b 100644 --- a/DataFormats/CTPPSDetId/src/classes_def.xml +++ b/DataFormats/CTPPSDetId/src/classes_def.xml @@ -13,5 +13,9 @@ + + + + diff --git a/EventFilter/CTPPSRawToDigi/plugins/TotemVFATRawToDigi.cc b/EventFilter/CTPPSRawToDigi/plugins/TotemVFATRawToDigi.cc index d64596bba3bd1..e9f2d35c489b8 100644 --- a/EventFilter/CTPPSRawToDigi/plugins/TotemVFATRawToDigi.cc +++ b/EventFilter/CTPPSRawToDigi/plugins/TotemVFATRawToDigi.cc @@ -31,6 +31,8 @@ #include "EventFilter/CTPPSRawToDigi/interface/RawDataUnpacker.h" #include "EventFilter/CTPPSRawToDigi/interface/RawToDigiConverter.h" +#include "DataFormats/CTPPSDigi/interface/TotemTimingDigi.h" + #include //---------------------------------------------------------------------------------------------------- @@ -47,7 +49,7 @@ class TotemVFATRawToDigi : public edm::stream::EDProducer<> private: std::string subSystemName; - enum { ssUndefined, ssTrackingStrip, ssTimingDiamond } subSystem; + enum { ssUndefined, ssTrackingStrip, ssTimingDiamond, ssTotemTiming } subSystem; std::vector fedIds; @@ -81,6 +83,8 @@ TotemVFATRawToDigi::TotemVFATRawToDigi(const edm::ParameterSet &conf): subSystem = ssTrackingStrip; if (subSystemName == "TimingDiamond") subSystem = ssTimingDiamond; + if (subSystemName == "TotemTiming") + subSystem = ssTotemTiming; if (subSystem == ssUndefined) throw cms::Exception("TotemVFATRawToDigi::TotemVFATRawToDigi") << "Unknown sub-system string " << subSystemName << "." << endl; @@ -94,6 +98,9 @@ TotemVFATRawToDigi::TotemVFATRawToDigi(const edm::ParameterSet &conf): if (subSystem == ssTimingDiamond) produces< DetSetVector >(subSystemName); + + if (subSystem == ssTotemTiming) + produces< DetSetVector >(subSystemName); // set default IDs if (fedIds.empty()) @@ -113,6 +120,13 @@ TotemVFATRawToDigi::TotemVFATRawToDigi(const edm::ParameterSet &conf): for (int id = FEDNumbering::MINCTPPSDiamondFEDID; id <= FEDNumbering::MAXCTPPSDiamondFEDID; ++id) fedIds.push_back(id); } + + if (subSystem == ssTotemTiming) + { + + for (int id = FEDNumbering::MINTotemRPTimingVerticalFEDID; id <= FEDNumbering::MAXTotemRPTimingVerticalFEDID; ++id) + fedIds.push_back(id); + } } // conversion status @@ -134,6 +148,9 @@ void TotemVFATRawToDigi::produce(edm::Event& event, const edm::EventSetup &es) if (subSystem == ssTimingDiamond) run< DetSetVector >(event, es); + + if (subSystem == ssTotemTiming) + run< DetSetVector >(event, es); } //---------------------------------------------------------------------------------------------------- diff --git a/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py b/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py index 2258fa24139f2..ad98c6c2c9a11 100644 --- a/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py +++ b/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py @@ -80,6 +80,34 @@ + + + +# ---------- Totem Timing ---------- +totemDAQMappingESSourceXML_TotemTiming = cms.ESSource("TotemDAQMappingESSourceXML", + verbosity = cms.untracked.uint32(0), + subSystem = cms.untracked.string("TotemTiming"), + configuration = cms.VPSet( + # 2017, before detector inserted in DAQ + cms.PSet( + validityRange = cms.EventRange("1:min - 310000:max"), + mappingFileNames = cms.vstring(), + maskFileNames = cms.vstring() + ), + # 2018 + cms.PSet( + validityRange = cms.EventRange("310000:min - 999999999:max"), + mappingFileNames = cms.vstring("CondFormats/CTPPSReadoutObjects/xml/mapping_totem_timing_2018.xml"), + maskFileNames = cms.vstring() + ) + ) +) + +from EventFilter.CTPPSRawToDigi.ctppsTotemTimingRawToDigi_cfi import totemTimingRawToDigi +totemTimingRawToDigi.rawDataTag = cms.InputTag("rawDataCollector") + + + # ---------- pixels ---------- from EventFilter.CTPPSRawToDigi.ctppsPixelDigis_cfi import ctppsPixelDigis From 49718b4458fbec1e8ba394dfca3667557d96d3fd Mon Sep 17 00:00:00 2001 From: nminafra Date: Tue, 20 Mar 2018 16:02:25 +0100 Subject: [PATCH 164/426] Starting new unpacker 2 --- .../CTPPSDetId/interface/TotemTimingDetId.h | 109 ++++++++++ .../CTPPSDetId/src/TotemTimingDetId.cc | 69 ++++++ .../CTPPSDetId/src/classes_def.xml.generated | 22 ++ .../CTPPSDigi/interface/CTPPSSampicDigi.h | 128 +++++++++++ .../CTPPSDigi/interface/TotemTimingDigi.h | 198 +++++++++++++++++ .../interface/TotemTimingEventInfo.h | 203 ++++++++++++++++++ DataFormats/CTPPSDigi/src/CTPPSSampicDigi.cc | 31 +++ DataFormats/CTPPSDigi/src/TotemTimingDigi.cc | 39 ++++ .../CTPPSDigi/src/TotemTimingEventInfo.cc | 42 ++++ .../interface/TotemSampicFrame.h | 104 +++++++++ .../python/totemTimingRawToDigi_cfi.py | 11 + 11 files changed, 956 insertions(+) create mode 100644 DataFormats/CTPPSDetId/interface/TotemTimingDetId.h create mode 100644 DataFormats/CTPPSDetId/src/TotemTimingDetId.cc create mode 100644 DataFormats/CTPPSDetId/src/classes_def.xml.generated create mode 100644 DataFormats/CTPPSDigi/interface/CTPPSSampicDigi.h create mode 100644 DataFormats/CTPPSDigi/interface/TotemTimingDigi.h create mode 100644 DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h create mode 100644 DataFormats/CTPPSDigi/src/CTPPSSampicDigi.cc create mode 100644 DataFormats/CTPPSDigi/src/TotemTimingDigi.cc create mode 100644 DataFormats/CTPPSDigi/src/TotemTimingEventInfo.cc create mode 100644 EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h create mode 100644 EventFilter/CTPPSRawToDigi/python/totemTimingRawToDigi_cfi.py diff --git a/DataFormats/CTPPSDetId/interface/TotemTimingDetId.h b/DataFormats/CTPPSDetId/interface/TotemTimingDetId.h new file mode 100644 index 0000000000000..ba24793085d11 --- /dev/null +++ b/DataFormats/CTPPSDetId/interface/TotemTimingDetId.h @@ -0,0 +1,109 @@ +/**************************************************************************** + * Author: Nicola Minafra + * March 2018 + ****************************************************************************/ + +#ifndef DataFormats_CTPPSDetId_TotemTimingDetId +#define DataFormats_CTPPSDetId_TotemTimingDetId + +#include "DataFormats/CTPPSDetId/interface/CTPPSDetId.h" + +#include "FWCore/Utilities/interface/Exception.h" + +#include +#include +#include + +/** + *\brief Detector ID class for CTPPS Totem Timing detectors. + * Bits [19:31] : Assigend in CTPPSDetId Calss + * Bits [17:18] : 2 bits for UFSD plane 0,1,2,3 + * Bits [12:16] : 5 bits for UFSD channel numbers 1,2,3,..16 + * Bits [0:11] : unspecified yet + * + * This class is very similar to CTPPSDiamondDetId; however the detector is completely separated, therefore it is useful to keep them separate and independent. + **/ + +class TotemTimingDetId : public CTPPSDetId +{ + public: + /// Construct from a raw id + explicit TotemTimingDetId(uint32_t id); + + TotemTimingDetId(const CTPPSDetId &id) : CTPPSDetId(id) + { + } + + /// Construct from hierarchy indeces. + TotemTimingDetId(uint32_t Arm, uint32_t Station, uint32_t RomanPot=0, uint32_t Plane=0, uint32_t Channel=0); + + static const uint32_t startPlaneBit, maskPlane, maxPlane, lowMaskPlane; + static const uint32_t startDetBit, maskChannel, maxChannel, lowMaskChannel; + + /// returns true if the raw ID is a PPS-timing one + static bool check(unsigned int raw) + { + return (((raw >>DetId::kDetOffset) & 0xF) == DetId::VeryForward && + ((raw >> DetId::kSubdetOffset) & 0x7) == sdTimingFastSilicon); + } + //-------------------- getting and setting methods -------------------- + + uint32_t plane() const + { + return ((id_>>startPlaneBit) & maskPlane); + } + + void setPlane(uint32_t channel) + { + id_ &= ~(maskPlane << startPlaneBit); + id_ |= ((channel & maskPlane) << startPlaneBit); + } + + uint32_t channel() const + { + return ((id_>>startDetBit) & maskChannel); + } + + void setChannel(uint32_t channel) + { + id_ &= ~(maskChannel << startDetBit); + id_ |= ((channel & maskChannel) << startDetBit); + } + + //-------------------- id getters for higher-level objects -------------------- + + TotemTimingDetId getPlaneId() const + { + return TotemTimingDetId( rawId() & (~lowMaskPlane) ); + } + + //-------------------- name methods -------------------- + + inline void planeName(std::string &name, NameFlag flag = nFull) const + { + switch (flag) + { + case nShort: name = ""; break; + case nFull: rpName(name, flag); name += "_"; break; + case nPath: rpName(name, flag); name += "/plane "; break; + } + + name += std::to_string(plane()); + } + + inline void channelName(std::string &name, NameFlag flag = nFull) const + { + switch (flag) + { + case nShort: name = ""; break; + case nFull: planeName(name, flag); name += "_"; break; + case nPath: planeName(name, flag); name += "/channel "; break; + } + + name += std::to_string(channel()); + } +}; + +std::ostream& operator<<(std::ostream& os, const TotemTimingDetId& id); + +#endif diff --git a/DataFormats/CTPPSDetId/src/TotemTimingDetId.cc b/DataFormats/CTPPSDetId/src/TotemTimingDetId.cc new file mode 100644 index 0000000000000..7e90898ac16f6 --- /dev/null +++ b/DataFormats/CTPPSDetId/src/TotemTimingDetId.cc @@ -0,0 +1,69 @@ +/**************************************************************************** + * Author: Nicola Minafra + * March 2018 + ****************************************************************************/ + + +#include "DataFormats/CTPPSDetId/interface/TotemTimingDetId.h" + +#include "FWCore/Utilities/interface/Exception.h" + +using namespace std; + +//---------------------------------------------------------------------------------------------------- + +const uint32_t TotemTimingDetId::startPlaneBit = 17, TotemTimingDetId::maskPlane = 0x3, TotemTimingDetId::maxPlane = 3, TotemTimingDetId::lowMaskPlane = 0x1FFFF; +const uint32_t TotemTimingDetId::startDetBit = 12, TotemTimingDetId::maskChannel = 0x1F, TotemTimingDetId::maxChannel = 31, TotemTimingDetId::lowMaskChannel = 0xFFF; + +//---------------------------------------------------------------------------------------------------- + +TotemTimingDetId::TotemTimingDetId(uint32_t id) : CTPPSDetId(id) +{ + if (! check(id)) + { + throw cms::Exception("InvalidDetId") << "TotemTimingDetId ctor:" + << " channel: " << channel() + << " subdet: " << subdetId() + << " is not a valid CTPPS Timing Diamond id"; + } +} + +//---------------------------------------------------------------------------------------------------- + +TotemTimingDetId::TotemTimingDetId(uint32_t Arm, uint32_t Station, uint32_t RomanPot, uint32_t Plane, uint32_t Channel) : + CTPPSDetId(sdTimingDiamond, Arm, Station, RomanPot) +{ + if (Arm > maxArm || Station > maxStation || RomanPot > maxRP || Plane > maxPlane || Channel > maxChannel) + { + throw cms::Exception("InvalidDetId") << "TotemTimingDetId ctor:" + << " Invalid parameters:" + << " arm=" << Arm + << " station=" << Station + << " rp=" << RomanPot + << " plane=" << Plane + << " detector=" << Channel + << std::endl; + } + + uint32_t ok=0xfe000000; + id_ &= ok; + + id_ |= ((Arm & maskArm) << startArmBit); + id_ |= ((Station & maskStation) << startStationBit); + id_ |= ((RomanPot & maskRP) << startRPBit); + id_ |= ((Plane & maskPlane) << startPlaneBit); + id_ |= ((Channel & maskChannel) << startDetBit); +} + +//---------------------------------------------------------------------------------------------------- + +std::ostream& operator << (std::ostream& os, const TotemTimingDetId& id) +{ + os << "arm=" << id.arm() + << " station=" << id.station() + << " rp=" << id.rp() + << " plane=" << id.plane() + << " Detector=" << id.channel(); + + return os; +} diff --git a/DataFormats/CTPPSDetId/src/classes_def.xml.generated b/DataFormats/CTPPSDetId/src/classes_def.xml.generated new file mode 100644 index 0000000000000..c7565891ee6b3 --- /dev/null +++ b/DataFormats/CTPPSDetId/src/classes_def.xml.generated @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/DataFormats/CTPPSDigi/interface/CTPPSSampicDigi.h b/DataFormats/CTPPSDigi/interface/CTPPSSampicDigi.h new file mode 100644 index 0000000000000..e56ef8c61801a --- /dev/null +++ b/DataFormats/CTPPSDigi/interface/CTPPSSampicDigi.h @@ -0,0 +1,128 @@ +#ifndef CTPPSDigi_CTPPSSampicDigi_h +#define CTPPSDigi_CTPPSSampicDigi_h + +/** \class CTPPSSampicDigi + * + * Digi Class for CTPPS Timing Detector + * + * + * \author Seyed Mohsen Etesami + * March 2016 + */ + +#include +#include "DataFormats/CTPPSDigi/interface/HPTDCErrorFlags.h" + +class CTPPSSampicDigi{ + + public: + + CTPPSSampicDigi(unsigned int ledgt_, unsigned int tedgt_, unsigned int threvolt, bool mhit_, unsigned short hptdcerror_); + CTPPSSampicDigi(); + ~CTPPSSampicDigi() {}; + + /// Digis are equal if they are have same ledt and tedt, threshold voltage, multihit flag, hptdcerror flags + bool operator==(const CTPPSSampicDigi& digi) const; + + /// Return digi values number + + unsigned int getLeadingEdge() const + { + return ledgt; + } + + unsigned int getTrailingEdge() const + { + return tedgt; + } + + unsigned int getThresholdVoltage() const + { + return threvolt; + } + + bool getMultipleHit() const + { + return mhit; + } + + HPTDCErrorFlags getHPTDCErrorFlags() const + { + return hptdcerror; + } + + /// Set digi values + inline void setLeadingEdge(unsigned int ledgt_) + { + ledgt = ledgt_; + } + inline void setTrailingEdge(unsigned int tedgt_) + { + tedgt = tedgt_; + } + inline void setThresholdVoltage(unsigned int threvolt_) + { + threvolt = threvolt_; + } + inline void setMultipleHit(bool mhit_) + { + mhit = mhit_; + } + inline void setHPTDCErrorFlags(const HPTDCErrorFlags& hptdcerror_) + { + hptdcerror = hptdcerror_; + } + + + private: + // variable represents leading edge time + unsigned int ledgt; + // variable represents trailing edge time + unsigned int tedgt; + // variable represents threshold voltage + unsigned int threvolt; + // variable represents multi-hit + bool mhit; + HPTDCErrorFlags hptdcerror; +}; + +#include + + +inline bool operator< (const CTPPSSampicDigi& one, const CTPPSSampicDigi& other) +{ + if( one.getLeadingEdge() < other.getLeadingEdge() ) + return true; + if( one.getLeadingEdge() > other.getLeadingEdge() ) + return false; + if( one.getTrailingEdge() < other.getTrailingEdge() ) + return true; + if( one.getTrailingEdge() > other.getTrailingEdge() ) + return false; + if( one.getMultipleHit() < other.getMultipleHit() ) + return true; + if( one.getMultipleHit() > other.getMultipleHit() ) + return false; + if( one.getHPTDCErrorFlags().getErrorFlag() < other.getHPTDCErrorFlags().getErrorFlag() ) + return true; + if( one.getHPTDCErrorFlags().getErrorFlag() > other.getHPTDCErrorFlags().getErrorFlag() ) + return false; + if( one.getThresholdVoltage() < other.getThresholdVoltage() ) + return true; + if( one.getThresholdVoltage() > other.getThresholdVoltage() ) + return false; + return false; +} + + +inline std::ostream & operator<<(std::ostream & o, const CTPPSSampicDigi& digi) +{ + return o << " " << digi.getLeadingEdge() + << " " << digi.getTrailingEdge() + << " " << digi.getThresholdVoltage() + << " " << digi.getMultipleHit() + << " " << digi.getHPTDCErrorFlags().getErrorFlag(); +} + +#endif + diff --git a/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h b/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h new file mode 100644 index 0000000000000..f2100cd8a181c --- /dev/null +++ b/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h @@ -0,0 +1,198 @@ +#ifndef CTPPSDigi_TotemTimingDigi_h +#define CTPPSDigi_TotemTimingDigi_h + +/** \class TotemTimingDigi + * + * Digi Class for CTPPS Timing Detector + * + * \author Mirko Berretti + * \author Nicola Minafra + * March 2018 + */ + +#include +#include + +class TotemTimingDigi{ + + public: + TotemTimingDigi(const uint8_t hwId, const uint64_t FPGATimeStamp, const uint16_t TimeStampA, const uint16_t TimeStampB, const uint16_t CellInfo, const std::vector< uint8_t>& Samples); + TotemTimingDigi(const TotemTimingDigi& digi); + TotemTimingDigi(); + ~TotemTimingDigi() {}; + + /// Digis are equal if they have all the same values, NOT checking the samples! + bool operator==(const TotemTimingDigi& digi) const; + + /// Return digi values number + + /// Hardware Id formatted as: bits 0-3 Channel Id, bit 4 Sampic Id, bits 5-7 Digitizer Board Id + inline unsigned int getHardwareId() const + { + return hwId_; + } + + inline unsigned int getHardwareBoardId() const + { + return (hwId_&0xE0)>>5; + } + + inline unsigned int getHardwareSampicId() const + { + return (hwId_&0x10)>>4; + } + + inline unsigned int getHardwareChannelId() const + { + return (hwId_&0x0F); + } + + inline unsigned int getFPGATimeStamp() const + { + return FPGATimeStamp_; + } + + inline unsigned int getTimeStampA() const + { + return TimeStampA_; + } + + inline unsigned int getTimeStampB() const + { + return TimeStampB_; + } + + inline unsigned int getCellInfo() const + { + return CellInfo_; + } + + inline std::vector< uint8_t > getSamples() const + { + return samples_; + } + + inline std::vector< uint8_t >::const_iterator getSamplesBegin() const + { + return samples_.cbegin(); + } + + inline std::vector< uint8_t >::const_iterator getSamplesEnd() const + { + return samples_.cend(); + } + + inline unsigned int getNumberOfSamples() const + { + return samples_.size(); + } + + inline int getSampleAt( const unsigned int i ) const + { + int sampleValue = -1; + if ( i < samples_.size() ) sampleValue = (int) samples_.at(i); + return sampleValue; + } + + + /// Set digi values + /// Hardware Id formatted as: bits 0-3 Channel Id, bit 4 Sampic Id, bits 5-7 Digitizer Board Id + inline void setHardwareId(const uint8_t hwId) + { + hwId_ = hwId; + } + + inline void setHardwareBoardId(const unsigned int BoardId) + { + hwId_ &= 0x1F; // Set board bits to 0 + hwId_ |= ((BoardId&0x07)<<5) & 0xE0; + } + + inline void setHardwareSampicId(const unsigned int SampicId) + { + hwId_ &= 0xEF; // Set sampic bit to 0 + hwId_ |= ((SampicId&0x01)<<4) & 0x10; + } + + inline void setHardwareChannelId(const unsigned int ChannelId) + { + hwId_ &= 0xF0; // Set sampic bit to 0 + hwId_ |= (ChannelId&0x0F) & 0x0F; + } + + inline void setFPGATimeStamp(const uint64_t FPGATimeStamp) + { + FPGATimeStamp_ = FPGATimeStamp; + } + + inline void setTimeStampA(const uint16_t TimeStampA) + { + TimeStampA_ = TimeStampA; + } + + inline void setTimeStampB(const uint16_t TimeStampB) + { + TimeStampB_ = TimeStampB; + } + + inline void setCellInfo(const uint16_t CellInfo) + { + CellInfo_ = CellInfo; + } + + inline void setSamples(const std::vector< uint8_t >& samples) + { + samples_ = samples; + } + + inline void addSample(const uint8_t sampleValue) + { + samples_.emplace_back(sampleValue); + } + + inline void setSampleAt( const unsigned int i, const uint8_t sampleValue ) + { + if ( i < samples_.size() ) samples_.at(i) = sampleValue; + } + + + + + private: + uint8_t hwId_; + uint64_t FPGATimeStamp_; + uint16_t TimeStampA_; + uint16_t TimeStampB_; + uint16_t CellInfo_; + + std::vector< uint8_t > samples_; + +}; + +#include + + +inline bool operator< (const TotemTimingDigi& one, const TotemTimingDigi& other) +{ + if( one.getHardwareId() < other.getHardwareId() ) + return true; + return false; +} + + +inline std::ostream & operator<<(std::ostream & o, const TotemTimingDigi& digi) +{ + return o << "TotemTimingDigi:" + << "\nHardwareId:\t" << std::hex << digi.getHardwareId() + << "\nDB: " << std::dec << digi.getHardwareBoardId() << "\tSampic: " << digi.getHardwareSampicId() << "\tChannel: " << digi.getHardwareChannelId() + << "\nFPGATimeStamp:\t" << std::hex << digi.getFPGATimeStamp() + << "\nTimeStampA:\t" << std::hex << digi.getTimeStampA() + << "\nTimeStampA:\t" << std::hex << digi.getTimeStampA() + << "\nCellInfo:\t" << std::hex << digi.getCellInfo() + << "\nNumberOfSamples:\t" << std::dec << digi.getNumberOfSamples() + << std::endl; + +} + +#endif + diff --git a/DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h b/DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h new file mode 100644 index 0000000000000..6d277e9aa380f --- /dev/null +++ b/DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h @@ -0,0 +1,203 @@ +#ifndef CTPPSDigi_TotemTimingEventInfo_h +#define CTPPSDigi_TotemTimingEventInfo_h + +/** \class TotemTimingEventInfo + * + * Event Info Class for CTPPS Timing Detector + * + * \author Mirko Berretti + * \author Nicola Minafra + * March 2018 + */ + +#include + +class TotemTimingEventInfo{ + + public: + TotemTimingEventInfo(const uint8_t hwId, const uint64_t L1ATimeStamp, const uint16_t bunchNumber, const uint32_t orbitNumber, const uint32_t eventNumber, const uint16_t channelMap, const uint16_t L1ALatency, const uint8_t numberOfSamples, const uint8_t offsetOfSamples ); + TotemTimingEventInfo(const TotemTimingEventInfo& eventInfo); + TotemTimingEventInfo(); + ~TotemTimingEventInfo() {}; + + /// Digis are equal if they have all the same values, NOT checking the samples! + bool operator==(const TotemTimingEventInfo& eventInfo) const; + + /// Return digi values number + + /// Hardware Id formatted as: bits 0-3 Channel Id, bit 4 Sampic Id, bits 5-7 Digitizer Board Id + inline unsigned int getHardwareId() const + { + return hwId_; + } + + inline unsigned int getHardwareBoardId() const + { + return (hwId_&0xE0)>>5; + } + + inline unsigned int getHardwareSampicId() const + { + return (hwId_&0x10)>>4; + } + + inline unsigned int getHardwareChannelId() const + { + return (hwId_&0x0F); + } + + inline unsigned int getL1ATimeStamp() const + { + return L1ATimeStamp_; + } + + inline unsigned int getBunchNumber() const + { + return bunchNumber_; + } + + inline unsigned int getOrbitNumber() const + { + return orbitNumber_; + } + + inline unsigned int getEventNumber() const + { + return orbitNumber_; + } + + inline uint16_t getChannelMap() const + { + return channelMap_; + } + + inline unsigned int getL1ALatency() const + { + return L1ALatency_; + } + + inline unsigned int getNumberOfSamples() const + { + return numberOfSamples_; + } + + inline unsigned int getOffsetOfSamples() const + { + return offsetOfSamples_; + } + + + + /// Set digi values + /// Hardware Id formatted as: bits 0-3 Channel Id, bit 4 Sampic Id, bits 5-7 Digitizer Board Id + inline void setHardwareId(const uint8_t hwId) + { + hwId_ = hwId; + } + + inline void setHardwareBoardId(const unsigned int BoardId) + { + hwId_ &= 0x1F; // Set board bits to 0 + hwId_ |= ((BoardId&0x07)<<5) & 0xE0; + } + + inline void setHardwareSampicId(const unsigned int SampicId) + { + hwId_ &= 0xEF; // Set sampic bit to 0 + hwId_ |= ((SampicId&0x01)<<4) & 0x10; + } + + inline void setHardwareChannelId(const unsigned int ChannelId) + { + hwId_ &= 0xF0; // Set sampic bit to 0 + hwId_ |= (ChannelId&0x0F) & 0x0F; + } + + inline void setL1ATimeStamp(const uint64_t L1ATimeStamp) + { + L1ATimeStamp_ = L1ATimeStamp; + } + + inline void setBunchNumber(const uint16_t bunchNumber) + { + bunchNumber_ = bunchNumber; + } + + inline void setOrbitNumber(const uint32_t orbitNumber) + { + orbitNumber_ = orbitNumber; + } + + inline void setEventNumber(const uint32_t eventNumber) + { + eventNumber_ = eventNumber; + } + + inline void setChannelMap(const uint16_t channelMap) + { + channelMap_ = channelMap; + } + + inline void setL1ALatency(const uint16_t L1ALatency) + { + L1ALatency_ = L1ALatency; + } + + inline void setNumberOfSamples(const uint8_t numberOfSamples) + { + numberOfSamples_ = numberOfSamples; + } + + inline void setOffsetOfSamples(const uint8_t offsetOfSamples) + { + offsetOfSamples_ = offsetOfSamples; + } + + + + + + + private: + uint8_t hwId_; + uint64_t L1ATimeStamp_; + uint16_t bunchNumber_; + uint32_t orbitNumber_; + uint32_t eventNumber_; + uint16_t channelMap_; + uint16_t L1ALatency_; + uint8_t numberOfSamples_; + uint8_t offsetOfSamples_; + +}; + +#include + + +inline bool operator< (const TotemTimingEventInfo& one, const TotemTimingEventInfo& other) +{ + if( one.getHardwareId() < other.getHardwareId() ) + return true; + return false; +} + + +inline std::ostream & operator<<(std::ostream & o, const TotemTimingEventInfo& digi) +{ + return o << "TotemTimingEventInfo:" + << "\nHardwareId:\t" << std::hex << digi.getHardwareId() + << "\nDB: " << std::dec << digi.getHardwareBoardId() << "\tSampic: " << digi.getHardwareSampicId() << "\tChannel: " << digi.getHardwareChannelId() + << "\nL1A Time Stamp:\t" << std::dec << digi.getL1ATimeStamp() + << "\nL1A Latency:\t" << std::dec << digi.getL1ALatency() + << "\nBunch Number:\t" << std::dec << digi.getBunchNumber() + << "\nOrbit Number:\t" << std::dec << digi.getOrbitNumber() + << "\nEvent Number:\t" << std::dec << digi.getEventNumber() + << "\nChannels fired:\t" << std::hex << digi.getChannelMap() + << "\nNumber of Samples:\t" << std::dec << digi.getNumberOfSamples() + << "\nOffset of Samples:\t" << std::dec << digi.getOffsetOfSamples() + << std::endl; + +} + +#endif + diff --git a/DataFormats/CTPPSDigi/src/CTPPSSampicDigi.cc b/DataFormats/CTPPSDigi/src/CTPPSSampicDigi.cc new file mode 100644 index 0000000000000..83f9535503eb7 --- /dev/null +++ b/DataFormats/CTPPSDigi/src/CTPPSSampicDigi.cc @@ -0,0 +1,31 @@ +/** \file + * + * + * \author Seyed Mohsen Etesami + */ + +#include + +using namespace std; + +CTPPSSampicDigi::CTPPSSampicDigi(unsigned int ledgt_, unsigned int tedgt_, unsigned int threvolt_, bool mhit_, unsigned short hptdcerror_) : + ledgt(ledgt_), tedgt(tedgt_), threvolt(threvolt_), mhit(mhit_), hptdcerror(HPTDCErrorFlags(hptdcerror_)) +{} + +CTPPSSampicDigi::CTPPSSampicDigi() : + ledgt(0), tedgt(0), threvolt(0), mhit(false), hptdcerror(HPTDCErrorFlags(0)) +{} + +// Comparison +bool +CTPPSSampicDigi::operator==(const CTPPSSampicDigi& digi) const +{ + if ( ledgt != digi.getLeadingEdge() + || tedgt != digi.getTrailingEdge() + || threvolt != digi.getThresholdVoltage() + || mhit != digi.getMultipleHit() + || hptdcerror.getErrorFlag() != digi.getHPTDCErrorFlags().getErrorFlag()) return false; + else + return true; +} + diff --git a/DataFormats/CTPPSDigi/src/TotemTimingDigi.cc b/DataFormats/CTPPSDigi/src/TotemTimingDigi.cc new file mode 100644 index 0000000000000..ece72baab74ff --- /dev/null +++ b/DataFormats/CTPPSDigi/src/TotemTimingDigi.cc @@ -0,0 +1,39 @@ +/** \file + * + * + * \author Mirko Berretti + * \author Nicola Minafra + */ + +#include + +using namespace std; + +TotemTimingDigi::TotemTimingDigi(const uint8_t hwId, const uint64_t FPGATimeStamp, const uint16_t TimeStampA, const uint16_t TimeStampB, const uint16_t CellInfo, const std::vector< uint8_t>& Samples) : + hwId_(hwId), FPGATimeStamp_(FPGATimeStamp), TimeStampA_(TimeStampA), TimeStampB_(TimeStampB), CellInfo_(CellInfo), samples_(Samples) +{} + +TotemTimingDigi::TotemTimingDigi(const TotemTimingDigi& digi) : + hwId_(digi.getHardwareId()), FPGATimeStamp_(digi.getFPGATimeStamp()), TimeStampA_(digi.getTimeStampA()), TimeStampB_(digi.getTimeStampB()), CellInfo_(digi.getCellInfo()), samples_(digi.getSamples()) +{} + +TotemTimingDigi::TotemTimingDigi() : + hwId_(0), FPGATimeStamp_(0), TimeStampA_(0), TimeStampB_(0), CellInfo_(0) +{} + + +// Comparison +bool +TotemTimingDigi::operator==(const TotemTimingDigi& digi) const +{ + if ( hwId_ != digi.getHardwareId() + || FPGATimeStamp_ != digi.getFPGATimeStamp() + || TimeStampA_ != digi.getTimeStampA() + || TimeStampB_ != digi.getTimeStampB() + || CellInfo_ != digi.getCellInfo() + || samples_ != digi.getSamples() + ) return false; + else + return true; +} + diff --git a/DataFormats/CTPPSDigi/src/TotemTimingEventInfo.cc b/DataFormats/CTPPSDigi/src/TotemTimingEventInfo.cc new file mode 100644 index 0000000000000..234d31155c8c2 --- /dev/null +++ b/DataFormats/CTPPSDigi/src/TotemTimingEventInfo.cc @@ -0,0 +1,42 @@ +/** \file + * + * + * \author Mirko Berretti + * \author Nicola Minafra + */ + +#include + +using namespace std; + +TotemTimingEventInfo::TotemTimingEventInfo(const uint8_t hwId, const uint64_t L1ATimeStamp, const uint16_t bunchNumber, const uint32_t orbitNumber, const uint32_t eventNumber, const uint16_t channelMap, const uint16_t L1ALatency, const uint8_t numberOfSamples, const uint8_t offsetOfSamples ) : + hwId_(hwId), L1ATimeStamp_(L1ATimeStamp), bunchNumber_(bunchNumber), orbitNumber_(orbitNumber), eventNumber_(eventNumber), channelMap_(channelMap), L1ALatency_(L1ALatency), numberOfSamples_(numberOfSamples), offsetOfSamples_(offsetOfSamples) +{} + +TotemTimingEventInfo::TotemTimingEventInfo(const TotemTimingEventInfo& eventInfo) : + hwId_(eventInfo.getHardwareId()), L1ATimeStamp_(eventInfo.getL1ATimeStamp()), bunchNumber_(eventInfo.getBunchNumber()), orbitNumber_(eventInfo.getOrbitNumber()), eventNumber_(eventInfo.getEventNumber()), channelMap_(eventInfo.getChannelMap()), L1ALatency_(eventInfo.getL1ALatency()), numberOfSamples_(eventInfo.getNumberOfSamples()), offsetOfSamples_(eventInfo.getOffsetOfSamples()) +{} + +TotemTimingEventInfo::TotemTimingEventInfo() : + hwId_(0), L1ATimeStamp_(0), bunchNumber_(0), orbitNumber_(0), eventNumber_(0), channelMap_(0), L1ALatency_(0), numberOfSamples_(0), offsetOfSamples_(0) +{} + + +// Comparison +bool +TotemTimingEventInfo::operator==(const TotemTimingEventInfo& eventInfo) const +{ + if ( hwId_ != eventInfo.getHardwareId() + || L1ATimeStamp_ != eventInfo.getL1ATimeStamp() + || bunchNumber_ != eventInfo.getBunchNumber() + || orbitNumber_ != eventInfo.getOrbitNumber() + || eventNumber_ != eventInfo.getEventNumber() + || channelMap_ != eventInfo.getChannelMap() + || L1ALatency_ != eventInfo.getL1ALatency() + || numberOfSamples_ != eventInfo.getNumberOfSamples() + || offsetOfSamples_ != eventInfo.getOffsetOfSamples() + ) return false; + else + return true; +} + diff --git a/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h b/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h new file mode 100644 index 0000000000000..5ab97d69216c5 --- /dev/null +++ b/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h @@ -0,0 +1,104 @@ +/**************************************************************************** +* +* This is a part of the TOTEM offline software. +* Authors: +* Seyed Mohsen Etesami (setesami@cern.ch) +* Nicola Minafra +* +****************************************************************************/ + +#ifndef EventFilter_CTPPSRawToDigi_DiamondVFATFrame +#define EventFilter_CTPPSRawToDigi_DiamondVFATFrame + +#include +#include +#include + +#include "EventFilter/CTPPSRawToDigi/interface/VFATFrame.h" + +#pragma pack(push,1) +struct TotemSampicData{ + uint8_t sample[24]; + + TotemSampicData() {}; +} +#pragma pack(pop) + +#pragma pack(push,1) +struct TotemSampicInfo{ + uint16_t reserved[3]; + uint16_t CellInfo; + uint16_t TimestampA; + uint16_t TimestampB; + uint8_t FPGATime[5]; + uint16_t ADC_EOC; + uint8_t controlBits[4]; + uint8_t hwId; + + TotemSampicInfo() {}; +} +#pragma pack(pop) + +#pragma pack(push,1) +struct TotemSampicEventInfo{ + uint8_t reserved[2]; + uint8_t offsetOfSamples; + uint8_t numberOfSamples; + uint16_t L1ALatency; + uint16_t channelMap; + uint32_t eventNumber; + uint32_t orbitNumber; + uint16_t bunchNumber; + uint64_t L1ATimeStamp; + uint8_t hwId; + + TotemSampicEventInfo() {}; +} +#pragma pack(pop) + + +/** + * This class is intended to handle the timing infromation of SAMPIC in the TOTEM implementation +**/ +class TotemSampicFrame +{ + public: + TotemSampicFrame(const uint8_t* inputData = nullptr) + { + + } + ~TotemSampicFrame() {} + + + + + + protected: + /** Raw data frame as sent by electronics. + * The container is organized as follows: + * Even IndexinFiber: Ch Data + * \verbatim + * buffer index content size + * --------------------------------------------------------------- + * 0->23 Channel data sampic 8bit samples + * \endverbatim + * + * Odd IndexinFiber: Ch Info + * \verbatim + * buffer index content size + * --------------------------------------------------------------- + * 0->5 Empty 48 bit + * 6->7 Cell Info 16 bit + * 8->9 TimestampA 16 bit + * 10->11 TimestampB 16 bit + * 12->16 FPGATime 40 bit + * 17->19 ADC EOC 16 bit + * 20->22 controlBits 32 bit + * 23 hwId 8 bit + * \endverbatim + **/ + word data[12]; + +}; + +#endif diff --git a/EventFilter/CTPPSRawToDigi/python/totemTimingRawToDigi_cfi.py b/EventFilter/CTPPSRawToDigi/python/totemTimingRawToDigi_cfi.py new file mode 100644 index 0000000000000..18c54d5bf7b4f --- /dev/null +++ b/EventFilter/CTPPSRawToDigi/python/totemTimingRawToDigi_cfi.py @@ -0,0 +1,11 @@ +import FWCore.ParameterSet.Config as cms + +from EventFilter.CTPPSRawToDigi.totemVFATRawToDigi_cfi import totemVFATRawToDigi + +totemTimingRawToDigi = totemVFATRawToDigi.clone( + subSystem = cms.string('TotemTiming'), + + # IMPORTANT: leave empty to load the default configuration from + # DataFormats/FEDRawData/interface/FEDNumbering.h + fedIds = cms.vuint32(), +) From 6612356b3f520a49d8444f6848be221ec05b494b Mon Sep 17 00:00:00 2001 From: mmusich Date: Mon, 19 Mar 2018 17:43:55 +0100 Subject: [PATCH 165/426] introduce RunInfo Payload Inspector --- .../interface/RunInfoPayloadInspectoHelper.h | 99 ++++++++ CondCore/RunInfoPlugins/plugins/BuildFile.xml | 8 + .../plugins/RunInfo_PayloadInspector.cc | 233 ++++++++++++++++++ CondCore/RunInfoPlugins/test/BuildFile.xml | 8 + .../test/testRunInfoPayloadInspector.cpp | 44 ++++ .../test/testRunInfoPayloadInspector.sh | 29 +++ 6 files changed, 421 insertions(+) create mode 100644 CondCore/RunInfoPlugins/interface/RunInfoPayloadInspectoHelper.h create mode 100644 CondCore/RunInfoPlugins/plugins/BuildFile.xml create mode 100644 CondCore/RunInfoPlugins/plugins/RunInfo_PayloadInspector.cc create mode 100644 CondCore/RunInfoPlugins/test/BuildFile.xml create mode 100644 CondCore/RunInfoPlugins/test/testRunInfoPayloadInspector.cpp create mode 100755 CondCore/RunInfoPlugins/test/testRunInfoPayloadInspector.sh diff --git a/CondCore/RunInfoPlugins/interface/RunInfoPayloadInspectoHelper.h b/CondCore/RunInfoPlugins/interface/RunInfoPayloadInspectoHelper.h new file mode 100644 index 0000000000000..1fde30f7addcc --- /dev/null +++ b/CondCore/RunInfoPlugins/interface/RunInfoPayloadInspectoHelper.h @@ -0,0 +1,99 @@ +#ifndef CONDCORE_RUNINFOPLUGINS_RUNINFOPAYLOADINSPECTORHELPER_H +#define CONDCORE_RUNINFOPLUGINS_RUNINFOPAYLOADINSPECTORHELPER_H + +#include +#include +#include "TH1.h" +#include "TH2.h" +#include "TStyle.h" +#include "TPaveText.h" +#include "TStyle.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +namespace RunInfoPI { + + // values are taken from https://github.com/cms-sw/cmssw/blob/master/MagneticField/GeomBuilder/plugins/VolumeBasedMagneticFieldESProducerFromDB.cc#L74-L75 + constexpr std::array nominalCurrents {{-1 ,0 ,9558,14416,16819,18268,19262}}; + constexpr std::array nominalFields {{3.8 ,0. , 2., 3., 3.5, 3.8, 4.}}; + + // all parameter than can be displayed + enum parameters {m_run, // int + m_start_time_ll, // long long; + m_stop_time_ll, // long long + m_start_current, // float + m_stop_current, // float + m_avg_current, // float + m_max_current, // float + m_min_current, // float + m_run_intervall_micros, // float + m_fedIN, // unsigned int + m_BField, // float + END_OF_TYPES}; + + /************************************************/ + float theBField (const float current){ + + // logic is taken from https://github.com/cms-sw/cmssw/blob/master/MagneticField/GeomBuilder/plugins/VolumeBasedMagneticFieldESProducerFromDB.cc#L156 + + int i=0; + for(;i<(int)nominalFields.size()-1;i++) { + if(2*current < nominalCurrents[i]+nominalCurrents[i+1] ){ + return nominalFields[i]; + } + } + return nominalFields[i]; + } + + /************************************************/ + std::string getStringFromTypeEnum (const parameters ¶meter){ + switch(parameter){ + case m_run : return "run number"; + case m_start_time_ll : return "start time"; + case m_stop_time_ll : return "stop time"; + case m_start_current : return "start current [A]"; + case m_stop_current : return "stop current [A]"; + case m_avg_current : return "average current [A]"; + case m_max_current : return "max current [A]"; + case m_min_current : return "min current [A]"; + case m_run_intervall_micros : return "run duration [#mus]"; + case m_fedIN : return "n. FEDs"; + case m_BField : return "B-field intensity [T]"; + default: return "should never be here"; + } + } + + /************************************************/ + void reportSummaryMapPalette(TH2* obj){ + + static int pcol[20]; + + float rgb[20][3]; + + for( int i=0; i<20; i++ ) { + if ( i < 17 ){ + rgb[i][0] = 0.80+0.01*i; + rgb[i][1] = 0.00+0.03*i; + rgb[i][2] = 0.00; + } else if ( i < 19 ) { + rgb[i][0] = 0.80+0.01*i; + rgb[i][1] = 0.00+0.03*i+0.15+0.10*(i-17); + rgb[i][2] = 0.00; + } else if ( i == 19 ){ + rgb[i][0] = 0.00; + rgb[i][1] = 0.80; + rgb[i][2] = 0.00; + } + pcol[i] = TColor::GetColor(rgb[i][0], rgb[i][1], rgb[i][2]); + } + + gStyle->SetPalette(20, pcol); + + if( obj ){ + obj->SetMinimum(-1.e-15); + obj->SetMaximum(+1.0); + obj->SetOption("colz"); + } + } + +}; +#endif diff --git a/CondCore/RunInfoPlugins/plugins/BuildFile.xml b/CondCore/RunInfoPlugins/plugins/BuildFile.xml new file mode 100644 index 0000000000000..4e290c7753304 --- /dev/null +++ b/CondCore/RunInfoPlugins/plugins/BuildFile.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/CondCore/RunInfoPlugins/plugins/RunInfo_PayloadInspector.cc b/CondCore/RunInfoPlugins/plugins/RunInfo_PayloadInspector.cc new file mode 100644 index 0000000000000..28931fff862e5 --- /dev/null +++ b/CondCore/RunInfoPlugins/plugins/RunInfo_PayloadInspector.cc @@ -0,0 +1,233 @@ +/*! + \file RunInfo_PayloadInspector + \Payload Inspector Plugin for RunInfo + \author M. Musich + \version $Revision: 1.0 $ + \date $Date: 2018/03/18 10:01:00 $ +*/ + +#include "CondCore/Utilities/interface/PayloadInspectorModule.h" +#include "CondCore/Utilities/interface/PayloadInspector.h" +#include "CondCore/CondDB/interface/Time.h" + +// the data format of the condition to be inspected +#include "CondFormats/RunInfo/interface/RunInfo.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +// helper +#include "CondCore/RunInfoPlugins/interface/RunInfoPayloadInspectoHelper.h" + +// system includes +#include +#include +#include + +// include ROOT +#include "TProfile.h" +#include "TH2F.h" +#include "TLegend.h" +#include "TCanvas.h" +#include "TLine.h" +#include "TStyle.h" +#include "TLatex.h" +#include "TPave.h" +#include "TPaveStats.h" +#include "TPaletteAxis.h" + +namespace { + + /************************************************ + RunInfo Payload Inspector of 1 IOV + *************************************************/ + class RunInfoTest : public cond::payloadInspector::Histogram1D { + + public: + RunInfoTest() : cond::payloadInspector::Histogram1D( "Test RunInfo", "Test RunInfo",10,0.0,10.0) + { + Base::setSingleIov( true ); + } + + bool fill( const std::vector >& iovs ) override{ + auto iov = iovs.front(); + std::shared_ptr payload = Base::fetchPayload( std::get<1>(iov) ); + + if(payload.get() ) { + payload->printAllValues(); + } + return true; + } + }; + + /************************************************ + Summary of RunInfo of 1 IOV + *************************************************/ + class RunInfoParameters : public cond::payloadInspector::PlotImage { + public: + RunInfoParameters() : cond::payloadInspector::PlotImage( "Display of RunInfo parameters" ){ + setSingleIov( true ); + } + + bool fill( const std::vector >& iovs ) override{ + auto iov = iovs.front(); + std::shared_ptr payload = fetchPayload( std::get<1>(iov) ); + + TCanvas canvas("Beam Spot Parameters Summary","RunInfo Parameters summary",1000,1000); + canvas.cd(); + + gStyle->SetHistMinimumZero(); + + canvas.SetTopMargin(0.08); + canvas.SetBottomMargin(0.06); + canvas.SetLeftMargin(0.3); + canvas.SetRightMargin(0.02); + canvas.Modified(); + canvas.SetGrid(); + + auto h2_RunInfoParameters = std::unique_ptr(new TH2F("Parameters","",1,0.0,1.0,11,0,11.)); + auto h2_RunInfoState = std::unique_ptr(new TH2F("State","",1,0.0,1.0,11,0,11.)); + h2_RunInfoParameters->SetStats(false); + h2_RunInfoState->SetStats(false); + + float fieldIntensity = RunInfoPI::theBField(payload->m_avg_current); + + std::function cutFunctor = [&payload,fieldIntensity](RunInfoPI::parameters my_param) { + float ret(-999.); + switch(my_param){ + case RunInfoPI::m_run : return float(payload->m_run); + case RunInfoPI::m_start_time_ll : return float(payload->m_start_time_ll); + case RunInfoPI::m_stop_time_ll : return float(payload->m_stop_time_ll); + case RunInfoPI::m_start_current : return payload->m_start_current; + case RunInfoPI::m_stop_current : return payload->m_stop_current; + case RunInfoPI::m_avg_current : return payload->m_avg_current; + case RunInfoPI::m_max_current : return payload->m_max_current; + case RunInfoPI::m_min_current : return payload->m_min_current; + case RunInfoPI::m_run_intervall_micros : return payload->m_run_intervall_micros; + case RunInfoPI::m_BField : return fieldIntensity; + case RunInfoPI::m_fedIN : return float((payload->m_fed_in).size()); + case RunInfoPI::END_OF_TYPES : return ret; + default : return ret; + } + }; + + h2_RunInfoParameters->GetXaxis()->SetBinLabel(1,"Value"); + h2_RunInfoState->GetXaxis()->SetBinLabel(1,"Value"); + + unsigned int yBin=11; + for(int foo = RunInfoPI::m_run; foo != RunInfoPI::END_OF_TYPES; foo++ ){ + RunInfoPI::parameters param = static_cast(foo); + std::string theLabel = RunInfoPI::getStringFromTypeEnum(param); + h2_RunInfoState->GetYaxis()->SetBinLabel(yBin,theLabel.c_str()); + h2_RunInfoParameters->GetYaxis()->SetBinLabel(yBin,theLabel.c_str()); + h2_RunInfoParameters->SetBinContent(1,yBin,cutFunctor(param)); + // non-fake payload + if((payload->m_run)!=-1){ + if ((payload->m_avg_current)<=-1){ + // go in error state + h2_RunInfoState->SetBinContent(1,yBin,0.); + } else { + // all is OK + h2_RunInfoState->SetBinContent(1,yBin,1.); + } + } else { + // this is a fake payload + h2_RunInfoState->SetBinContent(1,yBin,0.9); + } + yBin--; + + } + + h2_RunInfoParameters->GetXaxis()->LabelsOption("h"); + h2_RunInfoParameters->GetYaxis()->SetLabelSize(0.05); + h2_RunInfoParameters->GetXaxis()->SetLabelSize(0.05); + h2_RunInfoParameters->SetMarkerSize(1.5); + + h2_RunInfoState->GetXaxis()->LabelsOption("h"); + h2_RunInfoState->GetYaxis()->SetLabelSize(0.05); + h2_RunInfoState->GetXaxis()->SetLabelSize(0.05); + h2_RunInfoState->SetMarkerSize(1.5); + + RunInfoPI::reportSummaryMapPalette(h2_RunInfoState.get()); + h2_RunInfoState->Draw("col"); + + h2_RunInfoParameters->Draw("TEXTsame"); + + TLatex t1; + t1.SetNDC(); + t1.SetTextAlign(12); + t1.SetTextSize(0.03); + t1.DrawLatex(0.1, 0.98,"RunInfo parameters:"); + t1.DrawLatex(0.1, 0.95,"payload:"); + + t1.SetTextFont(42); + t1.SetTextColor(4); + t1.DrawLatex(0.37, 0.982,Form("IOV %s",std::to_string(+std::get<0>(iov)).c_str())); + t1.DrawLatex(0.21, 0.952,Form(" %s",(std::get<1>(iov)).c_str())); + + std::string fileName(m_imageFileName); + canvas.SaveAs(fileName.c_str()); + + return true; + } + + + }; + + /************************************************ + time history of Magnet currents from RunInfo + *************************************************/ + + template class RunInfoCurrentHistory : public cond::payloadInspector::HistoryPlot { + public: + RunInfoCurrentHistory() : cond::payloadInspector::HistoryPlot(getStringFromTypeEnum(param),getStringFromTypeEnum(param)+" value"){} + ~RunInfoCurrentHistory() override = default; + + float getFromPayload( RunInfo& payload ) override{ + + float fieldIntensity = RunInfoPI::theBField(payload.m_avg_current); + + switch(param){ + case RunInfoPI::m_start_current : return payload.m_start_current; + case RunInfoPI::m_stop_current : return payload.m_stop_current; + case RunInfoPI::m_avg_current : return payload.m_avg_current; + case RunInfoPI::m_max_current : return payload.m_max_current; + case RunInfoPI::m_min_current : return payload.m_min_current; + case RunInfoPI::m_BField : return fieldIntensity; + default: + edm::LogWarning("LogicError") << "Unknown parameter: " << param; + break; + } + + } // payload + + /************************************************/ + std::string getStringFromTypeEnum (const RunInfoPI::parameters ¶meter){ + switch(parameter){ + case RunInfoPI::m_start_current : return "Magent start current [A]"; + case RunInfoPI::m_stop_current : return "Magnet stop current [A]"; + case RunInfoPI::m_avg_current : return "Magnet average current [A]"; + case RunInfoPI::m_max_current : return "Magnet max current [A]"; + case RunInfoPI::m_min_current : return "Magnet min current [A]"; + case RunInfoPI::m_BField : return "B-field intensity [T]"; + default: return "should never be here"; + } + } + }; + + typedef RunInfoCurrentHistory RunInfoStartCurrentHistory; + typedef RunInfoCurrentHistory RunInfoStopCurrentHistory; + typedef RunInfoCurrentHistory RunInfoAverageCurrentHistory; + typedef RunInfoCurrentHistory RunInfoMaxCurrentHistory; + typedef RunInfoCurrentHistory RunInfoMinCurrentHistory; + typedef RunInfoCurrentHistory RunInfoBFieldHistory; + +} // close namespace + +PAYLOAD_INSPECTOR_MODULE( RunInfo ){ + PAYLOAD_INSPECTOR_CLASS( RunInfoTest ); + PAYLOAD_INSPECTOR_CLASS( RunInfoParameters ) ; + PAYLOAD_INSPECTOR_CLASS( RunInfoStopCurrentHistory ) ; + PAYLOAD_INSPECTOR_CLASS( RunInfoAverageCurrentHistory) ; + PAYLOAD_INSPECTOR_CLASS( RunInfoMaxCurrentHistory ) ; + PAYLOAD_INSPECTOR_CLASS( RunInfoMinCurrentHistory ) ; + PAYLOAD_INSPECTOR_CLASS( RunInfoBFieldHistory ) ; +} diff --git a/CondCore/RunInfoPlugins/test/BuildFile.xml b/CondCore/RunInfoPlugins/test/BuildFile.xml new file mode 100644 index 0000000000000..1d25e5fc2ac57 --- /dev/null +++ b/CondCore/RunInfoPlugins/test/BuildFile.xml @@ -0,0 +1,8 @@ + + + + + + + diff --git a/CondCore/RunInfoPlugins/test/testRunInfoPayloadInspector.cpp b/CondCore/RunInfoPlugins/test/testRunInfoPayloadInspector.cpp new file mode 100644 index 0000000000000..fa18dd9c76eee --- /dev/null +++ b/CondCore/RunInfoPlugins/test/testRunInfoPayloadInspector.cpp @@ -0,0 +1,44 @@ +#include +#include +#include "CondCore/Utilities/interface/PayloadInspector.h" +#include "CondCore/RunInfoPlugins/plugins/RunInfo_PayloadInspector.cc" + +#include "FWCore/PluginManager/interface/PluginManager.h" +#include "FWCore/PluginManager/interface/standard.h" +#include "FWCore/PluginManager/interface/SharedLibrary.h" +#include "FWCore/ServiceRegistry/interface/ServiceRegistry.h" + +int main(int argc, char** argv) { + + edmplugin::PluginManager::Config config; + edmplugin::PluginManager::configure(edmplugin::standard::config()); + + std::vector psets; + edm::ParameterSet pSet; + pSet.addParameter("@service_type",std::string("SiteLocalConfigService")); + psets.push_back(pSet); + edm::ServiceToken servToken(edm::ServiceRegistry::createSet(psets)); + edm::ServiceRegistry::Operate operate(servToken); + + std::string connectionString("frontier://FrontierProd/CMS_CONDITIONS"); + + std::string tag = "runinfo_31X_hlt"; + std::string runTimeType = cond::time::timeTypeName(cond::runnumber); + cond::Time_t start = boost::lexical_cast(311950); + cond::Time_t end = boost::lexical_cast(312237); + + std::cout <<"## RunInfo testing"< Date: Tue, 20 Mar 2018 18:57:20 +0100 Subject: [PATCH 166/426] Adding DQM plots for Calo CSV paths --- .../Trigger/interface/BTVHLTOfflineSource.h | 4 +++ DQMOffline/Trigger/src/BTVHLTOfflineSource.cc | 34 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/DQMOffline/Trigger/interface/BTVHLTOfflineSource.h b/DQMOffline/Trigger/interface/BTVHLTOfflineSource.h index d2c79b84e8ad3..e213e21c311e2 100644 --- a/DQMOffline/Trigger/interface/BTVHLTOfflineSource.h +++ b/DQMOffline/Trigger/interface/BTVHLTOfflineSource.h @@ -73,9 +73,13 @@ class BTVHLTOfflineSource : public DQMEDAnalyzer { edm::EDGetTokenT triggerSummaryToken; edm::EDGetTokenT triggerSummaryFUToken; + edm::EDGetTokenT,reco::Track,edm::refhelper::FindUsingAdvance,reco::Track> >,reco::JTATagInfo>,reco::Vertex> > > + csvCaloTagInfosToken_; edm::EDGetTokenT,reco::Track,edm::refhelper::FindUsingAdvance,reco::Track> >,reco::JTATagInfo>,reco::Vertex> > > csvPfTagInfosToken_; + edm::Handle,reco::Track,edm::refhelper::FindUsingAdvance,reco::Track> >,reco::JTATagInfo>,reco::Vertex> > > + csvCaloTagInfos; edm::Handle,reco::Track,edm::refhelper::FindUsingAdvance,reco::Track> >,reco::JTATagInfo>,reco::Vertex> > > csvPfTagInfos; diff --git a/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc b/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc index f332e4315adc7..a4054d304322f 100644 --- a/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc +++ b/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc @@ -49,6 +49,8 @@ BTVHLTOfflineSource::BTVHLTOfflineSource(const edm::ParameterSet& iConfig) triggerResultsToken = consumes (triggerResultsLabel_); triggerSummaryFUToken = consumes (edm::InputTag(triggerSummaryLabel_.label(),triggerSummaryLabel_.instance(),std::string("FU"))); triggerResultsFUToken = consumes (edm::InputTag(triggerResultsLabel_.label(),triggerResultsLabel_.instance(),std::string("FU"))); + csvCaloTagInfosToken_ = consumes,reco::Track,edm::refhelper::FindUsingAdvance,reco::Track> >,reco::JTATagInfo>,reco::Vertex> > > ( + edm::InputTag("hltInclusiveSecondaryVertexFinderTagInfos")); csvPfTagInfosToken_ = consumes,reco::Track,edm::refhelper::FindUsingAdvance,reco::Track> >,reco::JTATagInfo>,reco::Vertex> > > ( edm::InputTag("hltSecondaryVertexTagInfosPF")); csvCaloTagsToken_ = consumes (edm::InputTag("hltCombinedSecondaryVertexBJetTagsCalo")); @@ -262,6 +264,38 @@ BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iS } + iEvent.getByToken(csvCaloTagInfosToken_, csvCaloTagInfos); + if (csvCaloTagInfos.isValid() && v.getTriggerType() == "Calo") { + + // loop over secondary vertex tag infos + for (const auto & csvCaloTagInfo : *csvCaloTagInfos) { + v.getMEhisto_n_vtx()->Fill(csvCaloTagInfo.nVertexCandidates()); + v.getMEhisto_n_sel_tracks()->Fill(csvCaloTagInfo.nSelectedTracks()); + + // loop over selected tracks in each tag info + for (unsigned i_trk=0; i_trk < csvCaloTagInfo.nSelectedTracks(); i_trk++) { + const auto & ip3d = csvCaloTagInfo.trackIPData(i_trk).ip3d; + v.getMEhisto_h_3d_ip_distance()->Fill(ip3d.value()); + v.getMEhisto_h_3d_ip_error()->Fill(ip3d.error()); + v.getMEhisto_h_3d_ip_sig()->Fill(ip3d.significance()); + } + + // loop over vertex candidates in each tag info + for (unsigned i_sv=0; i_sv < csvCaloTagInfo.nVertexCandidates(); i_sv++) { + const auto & sv = csvCaloTagInfo.secondaryVertex(i_sv); + v.getMEhisto_vtx_mass()->Fill(sv.p4().mass()); + v.getMEhisto_n_vtx_trks()->Fill(sv.nTracks()); + + // loop over tracks for number of pixel and total hits + const auto & trkIPTagInfo = csvCaloTagInfo.trackIPTagInfoRef().get(); + for (const auto & trk : trkIPTagInfo->selectedTracks()) { + v.getMEhisto_n_pixel_hits()->Fill(trk.get()->hitPattern().numberOfValidPixelHits()); + v.getMEhisto_n_total_hits()->Fill(trk.get()->hitPattern().numberOfValidHits()); + } + } + } + } + } } From aac4b161f33766abad57117c8e0df078b9323394 Mon Sep 17 00:00:00 2001 From: Tanmay Mudholkar Date: Wed, 21 Mar 2018 02:54:54 +0100 Subject: [PATCH 167/426] Fixed bug in binning that led to incorrect bin numbers while filling many 2D histograms by supercrystal based on the electronics ID. --- DQM/EcalCommon/src/MESetBinningUtils2.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/DQM/EcalCommon/src/MESetBinningUtils2.cc b/DQM/EcalCommon/src/MESetBinningUtils2.cc index 9a4ba0c4d838c..754eb064b2576 100644 --- a/DQM/EcalCommon/src/MESetBinningUtils2.cc +++ b/DQM/EcalCommon/src/MESetBinningUtils2.cc @@ -726,11 +726,13 @@ namespace ecaldqm case kEB: xbin = 4 * ((iDCC - 9) % 18) + (isEBm ? towerid - 1 : 68 - towerid) % 4 + 1; ybin = (towerid - 1) / 4 * (isEBm ? -1 : 1) + (isEBm ? 18 : 17); + nbinsX = 72; break; case kSM: case kEBSM: xbin = (towerid - 1) / 4 + 1; ybin = (isEBm ? towerid - 1 : 68 - towerid) % 4 + 1; + nbinsX = 17; break; default: break; From 55e8ab7ca882136cab4a057376b13f2c7a52da9a Mon Sep 17 00:00:00 2001 From: Tanmay Mudholkar Date: Wed, 21 Mar 2018 02:55:44 +0100 Subject: [PATCH 168/426] Modified MESetNonObject to be able to access float value of DQM_KIND_REAL. --- DQM/EcalCommon/interface/MESetNonObject.h | 2 ++ DQM/EcalCommon/src/MESetNonObject.cc | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/DQM/EcalCommon/interface/MESetNonObject.h b/DQM/EcalCommon/interface/MESetNonObject.h index e058a517f541e..eab2579c1ccd8 100644 --- a/DQM/EcalCommon/interface/MESetNonObject.h +++ b/DQM/EcalCommon/interface/MESetNonObject.h @@ -29,6 +29,8 @@ namespace ecaldqm double getBinContent(int, int = 0) const override; + double getFloatValue() const; + double getBinError(int, int = 0) const override; double getBinEntries(int, int = 0) const override; diff --git a/DQM/EcalCommon/src/MESetNonObject.cc b/DQM/EcalCommon/src/MESetNonObject.cc index d263268110d86..e2bd429ccb0b3 100644 --- a/DQM/EcalCommon/src/MESetNonObject.cc +++ b/DQM/EcalCommon/src/MESetNonObject.cc @@ -264,6 +264,13 @@ namespace ecaldqm return mes_[0]->getBinContent(_bin); } + double + MESetNonObject::getFloatValue() const + { + if(kind_ == MonitorElement::DQM_KIND_REAL) return mes_[0]->getFloatValue(); + else return 0.; + } + double MESetNonObject::getBinError(int _bin, int) const { From fc03d1a8a57a53b99aea9e86d395bc7021707f3a Mon Sep 17 00:00:00 2001 From: Tanmay Mudholkar Date: Wed, 21 Mar 2018 02:56:18 +0100 Subject: [PATCH 169/426] Included a plot to keep track of current LHC status in TriggerPrimitivesTask. --- DQM/EcalMonitorTasks/BuildFile.xml | 1 + DQM/EcalMonitorTasks/interface/TrigPrimTask.h | 10 +++++++ .../python/TrigPrimTask_cfi.py | 10 ++++++- DQM/EcalMonitorTasks/src/TrigPrimTask.cc | 26 ++++++++++++++++++- 4 files changed, 45 insertions(+), 2 deletions(-) diff --git a/DQM/EcalMonitorTasks/BuildFile.xml b/DQM/EcalMonitorTasks/BuildFile.xml index c9fc5c1c10295..cfbb551e0bbb7 100644 --- a/DQM/EcalMonitorTasks/BuildFile.xml +++ b/DQM/EcalMonitorTasks/BuildFile.xml @@ -7,6 +7,7 @@ + diff --git a/DQM/EcalMonitorTasks/interface/TrigPrimTask.h b/DQM/EcalMonitorTasks/interface/TrigPrimTask.h index cf609af093393..ff395671d2bc5 100644 --- a/DQM/EcalMonitorTasks/interface/TrigPrimTask.h +++ b/DQM/EcalMonitorTasks/interface/TrigPrimTask.h @@ -4,8 +4,12 @@ #include "DQWorkerTask.h" #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" +#include "DataFormats/TCDS/interface/TCDSRecord.h" #include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include "FWCore/Utilities/interface/EDGetToken.h" #include "CondFormats/EcalObjects/interface/EcalTPGTowerStatus.h" #include "CondFormats/EcalObjects/interface/EcalTPGStripStatus.h" @@ -29,6 +33,8 @@ namespace ecaldqm { void runOnEmulTPs(EcalTrigPrimDigiCollection const&); template void runOnDigis(DigiCollection const&); + void setTokens(edm::ConsumesCollector&) override; + enum Constants { nBXBins = 15 }; @@ -53,6 +59,10 @@ namespace ecaldqm { edm::ESHandle TTStatusRcd; edm::ESHandle StripStatusRcd; + edm::InputTag lhcStatusInfoCollectionTag_; + edm::EDGetTokenT lhcStatusInfoRecordToken_; + bool lhcStatusSet_; + }; inline bool TrigPrimTask::analyze(void const* _p, Collections _collection){ diff --git a/DQM/EcalMonitorTasks/python/TrigPrimTask_cfi.py b/DQM/EcalMonitorTasks/python/TrigPrimTask_cfi.py index de5c7bc3a46f8..2be326b74bf48 100644 --- a/DQM/EcalMonitorTasks/python/TrigPrimTask_cfi.py +++ b/DQM/EcalMonitorTasks/python/TrigPrimTask_cfi.py @@ -23,7 +23,8 @@ params = cms.untracked.PSet( # HLTMuonPath = cms.untracked.string('HLT_Mu5_v*'), # HLTCaloPath = cms.untracked.string('HLT_SingleJet*'), - runOnEmul = cms.untracked.bool(True) + runOnEmul = cms.untracked.bool(True), + lhcStatusInfoCollectionTag = cms.untracked.InputTag("tcdsDigis","tcdsRecord") ), MEs = cms.untracked.PSet( LowIntMap = cms.untracked.PSet( @@ -268,6 +269,13 @@ btype = cms.untracked.string('User'), path = cms.untracked.string('%(subdet)s/%(prefix)sTriggerTowerTask/%(prefix)sTTT Real vs Emulated TP Et%(suffix)s'), description = cms.untracked.string('Real data VS emulated TP Et (in-time)') + ), + LHCStatusByLumi = cms.untracked.PSet( + path = cms.untracked.string('Ecal/Trends/LHC status by lumi'), + kind = cms.untracked.string('REAL'), + otype = cms.untracked.string('None'), + btype = cms.untracked.string('User'), + description = cms.untracked.string('LHC Status in this lumisection. The convention for the value is the same as in the plot Info/LhcInfo/beamMode') ) ) ) diff --git a/DQM/EcalMonitorTasks/src/TrigPrimTask.cc b/DQM/EcalMonitorTasks/src/TrigPrimTask.cc index b8bb4594fa764..2c6ab6d1f6896 100644 --- a/DQM/EcalMonitorTasks/src/TrigPrimTask.cc +++ b/DQM/EcalMonitorTasks/src/TrigPrimTask.cc @@ -24,7 +24,9 @@ namespace ecaldqm // HLTMuonBit_(false), bxBinEdges_{ {1, 271, 541, 892, 1162, 1432, 1783, 2053, 2323, 2674, 2944, 3214, 3446, 3490, 3491, 3565} }, bxBin_(0.), - towerReadouts_() + towerReadouts_(), + lhcStatusInfoCollectionTag_(), + lhcStatusSet_(false) { } @@ -39,6 +41,7 @@ namespace ecaldqm MEs_.erase(std::string("EtEmulError")); MEs_.erase(std::string("FGEmulError")); } + lhcStatusInfoCollectionTag_ = _params.getUntrackedParameter("lhcStatusInfoCollectionTag", edm::InputTag("tcdsDigis", "tcdsRecord")); } void @@ -62,6 +65,10 @@ namespace ecaldqm { // Reset by LS plots at beginning of every LS MEs_.at("EtSummaryByLumi").reset(); + MEs_.at("LHCStatusByLumi").reset(-1); + + // Reset lhcStatusSet_ to false at the beginning of each LS; when LHC status is set in some event this variable will be set to true + lhcStatusSet_ = false; } void @@ -71,6 +78,17 @@ namespace ecaldqm towerReadouts_.clear(); + if (!lhcStatusSet_) { + // Update LHC status once each LS + MESet& meLHCStatusByLumi(static_cast(MEs_.at("LHCStatusByLumi"))); + edm::Handle tcdsData; + _evt.getByToken(lhcStatusInfoRecordToken_, tcdsData); + if (tcdsData.isValid()) { + meLHCStatusByLumi.fill(double(tcdsData->getBST().getBeamMode())); + lhcStatusSet_ = true; + } + } + realTps_ = nullptr; // HLTCaloBit_ = false; @@ -177,6 +195,12 @@ namespace ecaldqm } } + void + TrigPrimTask::setTokens(edm::ConsumesCollector& _collector) + { + lhcStatusInfoRecordToken_ = _collector.consumes(lhcStatusInfoCollectionTag_); + } + void TrigPrimTask::runOnRealTPs(EcalTrigPrimDigiCollection const& _tps) { From 56cf19c49871a1733cd66c7f8244ba8f8d001852 Mon Sep 17 00:00:00 2001 From: Tanmay Mudholkar Date: Wed, 21 Mar 2018 02:56:38 +0100 Subject: [PATCH 170/426] Modified ECALMonitorClient to take LHC info into account, whenever available, and to mask the false alarm when not in collisions. --- DQM/EcalMonitorClient/python/TrigPrimClient_cfi.py | 1 + DQM/EcalMonitorClient/src/TrigPrimClient.cc | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/DQM/EcalMonitorClient/python/TrigPrimClient_cfi.py b/DQM/EcalMonitorClient/python/TrigPrimClient_cfi.py index d6a26e1055850..de2a49e0480e5 100644 --- a/DQM/EcalMonitorClient/python/TrigPrimClient_cfi.py +++ b/DQM/EcalMonitorClient/python/TrigPrimClient_cfi.py @@ -17,6 +17,7 @@ TTFlags4 = ecalTrigPrimTask.MEs.TTFlags4, TTMaskMapAll = ecalTrigPrimTask.MEs.TTMaskMapAll, TTFMismatch = ecalTrigPrimTask.MEs.TTFMismatch, + LHCStatusByLumi = ecalTrigPrimTask.MEs.LHCStatusByLumi, TPDigiThrAll = ecalOccupancyTask.MEs.TPDigiThrAll ), MEs = cms.untracked.PSet( diff --git a/DQM/EcalMonitorClient/src/TrigPrimClient.cc b/DQM/EcalMonitorClient/src/TrigPrimClient.cc index 488d5fab36f8d..3076ef50fe5fb 100644 --- a/DQM/EcalMonitorClient/src/TrigPrimClient.cc +++ b/DQM/EcalMonitorClient/src/TrigPrimClient.cc @@ -1,6 +1,7 @@ #include "../interface/TrigPrimClient.h" #include "DQM/EcalCommon/interface/EcalDQMCommonUtils.h" +#include "DQM/EcalCommon/interface/MESetNonObject.h" #include "CondFormats/EcalObjects/interface/EcalDQMStatusHelper.h" @@ -35,12 +36,16 @@ namespace ecaldqm MESet const& sEtEmulError(sources_.at("EtEmulError")); MESet const& sMatchedIndex(sources_.at("MatchedIndex")); MESet const& sTPDigiThrAll(sources_.at("TPDigiThrAll")); + MESetNonObject const& sLHCStatusByLumi(static_cast(sources_.at("LHCStatusByLumi"))); uint32_t mask(1 << EcalDQMStatusHelper::PHYSICS_BAD_CHANNEL_WARNING); // Store # of entries for Occupancy analysis std::vector Nentries(nDCC,0.); + double currentLHCStatus = sLHCStatusByLumi.getFloatValue(); + bool statsCheckEnabled = ((currentLHCStatus > 10.5 && currentLHCStatus < 11.5) || currentLHCStatus < 0); // currentLHCStatus = -1 is the default when no beam info is available + for(unsigned iTT(0); iTT < EcalTrigTowerDetId::kSizeForDenseIndexing; iTT++){ EcalTrigTowerDetId ttid(EcalTrigTowerDetId::detIdFromDenseIndex(iTT)); @@ -158,7 +163,7 @@ namespace ecaldqm rmsFED = rmsFEDEE; } float threshold( meanFED < nRMS*rmsFED ? minEntries_ : meanFED - nRMS*rmsFED ); - if ( meanFED > 100. && Nentries[iDCC] < threshold ) + if ( (meanFED > 100. && Nentries[iDCC] < threshold) && statsCheckEnabled ) meEmulQualitySummary.setBinContent( ttid, meEmulQualitySummary.maskMatches(ttid, mask, statusManager_) ? kMBad : kBad ); } From 0e71e212d52fe875c54139105bf571a11ddb1b97 Mon Sep 17 00:00:00 2001 From: Tanmay Mudholkar Date: Wed, 21 Mar 2018 02:57:12 +0100 Subject: [PATCH 171/426] Added TCDS Digis for monitoring LHC status to online client. --- .../python/clients/ecal_dqm_sourceclient-live_cfg.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/DQM/Integration/python/clients/ecal_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/ecal_dqm_sourceclient-live_cfg.py index 13012338c7647..a069b26f4a38b 100644 --- a/DQM/Integration/python/clients/ecal_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/ecal_dqm_sourceclient-live_cfg.py @@ -1,5 +1,6 @@ ### AUTO-GENERATED CMSRUN CONFIGURATION FOR ECAL DQM ### import FWCore.ParameterSet.Config as cms +from EventFilter.Utilities.tcdsRawToDigi_cfi import * # To monitor LHC status, e.g. to mask trigger primitives quality alarm during Cosmics process = cms.Process("process") @@ -92,6 +93,9 @@ process.preScaler.prescaleFactor = 1 +process.tcdsDigis = tcdsRawToDigi.clone() +process.tcdsDigis.InputLabel = cms.InputTag("rawDataCollector") + process.DQMStore.referenceFileName = "/dqmdata/dqm/reference/ecal_reference.root" process.dqmEnv.subSystemFolder = cms.untracked.string('Ecal') @@ -122,7 +126,7 @@ ### Paths ### -process.ecalMonitorPath = cms.Path(process.preScaler+process.ecalPreRecoSequence+process.ecalPhysicsFilter+process.ecalRecoSequence+process.ecalMonitorTask) +process.ecalMonitorPath = cms.Path(process.preScaler+process.ecalPreRecoSequence+process.ecalPhysicsFilter+process.ecalRecoSequence+process.tcdsDigis+process.ecalMonitorTask) process.ecalClientPath = cms.Path(process.preScaler+process.ecalPreRecoSequence+process.ecalPhysicsFilter+process.ecalMonitorClient) process.dqmEndPath = cms.EndPath(process.dqmEnv) From 95eed04a96ac618a285c8388001c3542a3f0445f Mon Sep 17 00:00:00 2001 From: Tanmay Mudholkar Date: Wed, 21 Mar 2018 02:57:42 +0100 Subject: [PATCH 172/426] Patch to ignore events causing ECAL DQM Calibration application crashes. --- DQM/EcalMonitorTasks/src/PNDiodeTask.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/DQM/EcalMonitorTasks/src/PNDiodeTask.cc b/DQM/EcalMonitorTasks/src/PNDiodeTask.cc index d93a71cc4553f..bbe155c1f2608 100644 --- a/DQM/EcalMonitorTasks/src/PNDiodeTask.cc +++ b/DQM/EcalMonitorTasks/src/PNDiodeTask.cc @@ -1,6 +1,7 @@ #include "../interface/PNDiodeTask.h" #include "FWCore/Utilities/interface/Exception.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" namespace ecaldqm { @@ -59,7 +60,12 @@ namespace ecaldqm { } std::for_each(_ids.begin(), _ids.end(), [&](EcalElectronicsIdCollection::value_type const& id){ - set->fill(EcalElectronicsId(id.dccId(), id.towerId(), 1, id.xtalId())); + if (id.towerId() == 69) { + edm::LogWarning("EcalDQM") << "PNDiodeTask::runOnErrors : one of the ids in the electronics ID collection is unphysical in lumi number " << timestamp_.iLumi << ", event number " << timestamp_.iEvt; // Added March 2018 because some events have this unphysical tower ID and cause the ECAL calibration application to crash. + } + else { + set->fill(EcalElectronicsId(id.dccId(), id.towerId(), 1, id.xtalId())); + } }); } From 023865908790852da0e5570b2c3070f358f83c3b Mon Sep 17 00:00:00 2001 From: Tanmay Mudholkar Date: Wed, 21 Mar 2018 02:58:04 +0100 Subject: [PATCH 173/426] Modified noise tolerance in presample plots to range (175, 240) ADC counts instead of the current (175, 225) ADC counts, because the pedestal value in some towers has been drifting higher especially in the endcaps causing the presample plots to be liberally peppered in RED. --- DQM/EcalMonitorClient/interface/PresampleClient.h | 3 ++- DQM/EcalMonitorClient/python/PresampleClient_cfi.py | 10 ++++++---- DQM/EcalMonitorClient/src/PresampleClient.cc | 8 +++++--- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/DQM/EcalMonitorClient/interface/PresampleClient.h b/DQM/EcalMonitorClient/interface/PresampleClient.h index f91df947c1f51..d0b557dec50f6 100644 --- a/DQM/EcalMonitorClient/interface/PresampleClient.h +++ b/DQM/EcalMonitorClient/interface/PresampleClient.h @@ -17,7 +17,8 @@ namespace ecaldqm int minChannelEntries_; float expectedMean_; - float toleranceMean_; + float toleranceLow_; + float toleranceHigh_; float toleranceRMS_; float toleranceRMSFwd_; }; diff --git a/DQM/EcalMonitorClient/python/PresampleClient_cfi.py b/DQM/EcalMonitorClient/python/PresampleClient_cfi.py index 440a6c48f9e19..356351f652cb6 100644 --- a/DQM/EcalMonitorClient/python/PresampleClient_cfi.py +++ b/DQM/EcalMonitorClient/python/PresampleClient_cfi.py @@ -5,7 +5,8 @@ minChannelEntries = 6 expectedMean = 200.0 -toleranceMean = 25.0 +toleranceLow = 25.0 +toleranceHigh = 40.0 toleranceRMS = 3.0 toleranceRMSFwd = 6.0 @@ -13,7 +14,8 @@ params = cms.untracked.PSet( minChannelEntries = cms.untracked.int32(minChannelEntries), expectedMean = cms.untracked.double(expectedMean), - toleranceMean = cms.untracked.double(toleranceMean), + toleranceLow = cms.untracked.double(toleranceLow), + toleranceHigh = cms.untracked.double(toleranceHigh), toleranceRMS = cms.untracked.double(toleranceRMS), toleranceRMSFwd = cms.untracked.double(toleranceRMSFwd) ), @@ -84,14 +86,14 @@ kind = cms.untracked.string('TH2F'), otype = cms.untracked.string('Ecal3P'), btype = cms.untracked.string('Crystal'), - description = cms.untracked.string('Summary of the presample data quality. A channel is red if presample mean is off by ' + str(toleranceMean) + ' from ' + str(expectedMean) + ' or RMS is greater than ' + str(toleranceRMS) + '. RMS threshold is ' + str(toleranceRMSFwd) + ' in the forward region (|eta| > 2.1). Channels with entries less than ' + str(minChannelEntries) + ' are not considered.') + description = cms.untracked.string('Summary of the presample data quality. A channel is red if presample mean is outside the range (' + str(expectedMean - toleranceLow) + ', ' + str(expectedMean + toleranceHigh) + '), or RMS is greater than ' + str(toleranceRMS) + '. RMS threshold is ' + str(toleranceRMSFwd) + ' in the forward region (|eta| > 2.1). Channels with entries less than ' + str(minChannelEntries) + ' are not considered.') ), Quality = cms.untracked.PSet( path = cms.untracked.string('%(subdet)s/%(prefix)sPedestalOnlineClient/%(prefix)sPOT pedestal quality G12 %(sm)s'), kind = cms.untracked.string('TH2F'), otype = cms.untracked.string('SM'), btype = cms.untracked.string('Crystal'), - description = cms.untracked.string('Summary of the presample data quality. A channel is red if presample mean is off by ' + str(toleranceMean) + ' from ' + str(expectedMean) + ' or RMS is greater than ' + str(toleranceRMS) + '. RMS threshold is ' + str(toleranceRMSFwd) + ' in the forward region (|eta| > 2.1). Channels with entries less than ' + str(minChannelEntries) + ' are not considered.') + description = cms.untracked.string('Summary of the presample data quality. A channel is red if presample mean is outside the range (' + str(expectedMean - toleranceLow) + ', ' + str(expectedMean + toleranceHigh) + '), or RMS is greater than ' + str(toleranceRMS) + '. RMS threshold is ' + str(toleranceRMSFwd) + ' in the forward region (|eta| > 2.1). Channels with entries less than ' + str(minChannelEntries) + ' are not considered.') ), ErrorsSummary = cms.untracked.PSet( path = cms.untracked.string('%(subdet)s/%(prefix)sSummaryClient/%(prefix)sPOT pedestal quality errors summary G12'), diff --git a/DQM/EcalMonitorClient/src/PresampleClient.cc b/DQM/EcalMonitorClient/src/PresampleClient.cc index 32925dd3ed534..ddf50274a1a0d 100644 --- a/DQM/EcalMonitorClient/src/PresampleClient.cc +++ b/DQM/EcalMonitorClient/src/PresampleClient.cc @@ -15,7 +15,8 @@ namespace ecaldqm DQWorkerClient(), minChannelEntries_(0), expectedMean_(0.), - toleranceMean_(0.), + toleranceLow_(0.), + toleranceHigh_(0.), toleranceRMS_(0.), toleranceRMSFwd_(0.) { @@ -28,7 +29,8 @@ namespace ecaldqm { minChannelEntries_ = _params.getUntrackedParameter("minChannelEntries"); expectedMean_ = _params.getUntrackedParameter("expectedMean"); - toleranceMean_ = _params.getUntrackedParameter("toleranceMean"); + toleranceLow_ = _params.getUntrackedParameter("toleranceLow"); + toleranceHigh_ = _params.getUntrackedParameter("toleranceHigh"); toleranceRMS_ = _params.getUntrackedParameter("toleranceRMS"); toleranceRMSFwd_ = _params.getUntrackedParameter("toleranceRMSFwd"); } @@ -93,7 +95,7 @@ namespace ecaldqm meRMSMap.setBinContent(id, rms); meRMSMapAllByLumi.setBinContent(id, rmsLS); - if(std::abs(mean - expectedMean_) > toleranceMean_ || rms > rmsThresh){ + if(((mean > expectedMean_ + toleranceHigh_) || (mean < expectedMean_ - toleranceLow_)) || rms > rmsThresh){ qItr->setBinContent(doMask ? kMBad : kBad); meQualitySummary.setBinContent(id, doMask ? kMBad : kBad); if(!doMask) meErrorsSummary.fill(id); From cb7a7850bc76b66e60309022bc0f8ab1f32776c4 Mon Sep 17 00:00:00 2001 From: Pierre Depasse Date: Wed, 21 Mar 2018 08:11:38 +0100 Subject: [PATCH 174/426] Remove queries to OMDS --- CondTools/Ecal/src/EcalIntercalibHandler.cc | 24 +++++++++------------ 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/CondTools/Ecal/src/EcalIntercalibHandler.cc b/CondTools/Ecal/src/EcalIntercalibHandler.cc index f74911446bedc..69cebc787d0ba 100644 --- a/CondTools/Ecal/src/EcalIntercalibHandler.cc +++ b/CondTools/Ecal/src/EcalIntercalibHandler.cc @@ -10,7 +10,7 @@ const Int_t kEBChannels = 61200, kEEChannels = 14648; popcon::EcalIntercalibHandler::EcalIntercalibHandler(const edm::ParameterSet & ps) : m_name(ps.getUntrackedParameter("name","EcalIntercalibHandler")) { - std::cout << "EcalIntercalib Source handler constructor\n" << std::endl; + edm::LogInfo("EcalIntercalib Source handler constructor\n"); m_firstRun = static_cast(atoi( ps.getParameter("firstRun").c_str())); m_file_type = ps.getParameter("type"); // xml/txt m_file_name = ps.getParameter("fileName"); @@ -19,13 +19,13 @@ popcon::EcalIntercalibHandler::EcalIntercalibHandler(const edm::ParameterSet & p popcon::EcalIntercalibHandler::~EcalIntercalibHandler() {} void popcon::EcalIntercalibHandler::getNewObjects() { - std::cout << "------- Ecal - > getNewObjects\n"; + // std::cout << "------- Ecal - > getNewObjects\n"; std::ostringstream ss; ss<<"ECAL "; unsigned long long irun; std::string file_= m_file_name; - std::cout << "going to open file "<< file_ << std::endl; + edm::LogInfo("going to open file ") << file_; // EcalCondHeader header; EcalIntercalibConstants * payload = new EcalIntercalibConstants; @@ -45,7 +45,7 @@ void popcon::EcalIntercalibHandler::readXML(const std::string& file_, std::ifstream fxml; fxml.open(file_); if(!fxml.is_open()) { - std::cout << "ERROR : cannot open file " << file_ << std::endl; + edm::LogInfo("ERROR : cannot open file ") << file_; exit (1); } // header @@ -54,13 +54,12 @@ void popcon::EcalIntercalibHandler::readXML(const std::string& file_, // std::cout << dummyLine << std::endl; } fxml >> bid; - // std::cout << bid << std::endl; std::string stt = bid.substr(7,5); std::istringstream iEB(stt); int nEB; iEB >> nEB; if(nEB != kEBChannels) { - std::cout << " strange number of EB channels " << nEB << std::endl; + edm::LogInfo("strange number of EB channels ") << nEB; exit(-1); } fxml >> bid; // 0 @@ -77,13 +76,12 @@ void popcon::EcalIntercalibHandler::readXML(const std::string& file_, // std::cout << dummyLine << std::endl; } fxml >> bid; - // cout << bid << endl; stt = bid.substr(7,5); std::istringstream iEE(stt); int nEE; iEE >> nEE; if(nEE != kEEChannels) { - std::cout << " strange number of EE channels " << nEE << std::endl; + edm::LogInfo("strange number of EE channels ") << nEE; exit(-1); } fxml >> bid; // 0 @@ -103,7 +101,7 @@ void popcon::EcalIntercalibHandler::readTXT(const std::string& file_, std::ifstream ftxt; ftxt.open(file_); if(!ftxt.is_open()) { - std::cout << "ERROR : cannot open file " << file_ << std::endl; + edm::LogInfo("ERROR : cannot open file ") << file_; exit (1); } int number_of_lines = 0, eta, phi, x, y, z; @@ -122,10 +120,8 @@ void popcon::EcalIntercalibHandler::readTXT(const std::string& file_, } number_of_lines++; } - std::cout << "Number of lines in text file: " << number_of_lines << std::endl; + edm::LogInfo("Number of lines in text file: ") << number_of_lines; int kChannels = kEBChannels + kEEChannels; - if(number_of_lines != kChannels) std:: cout << - "***************************************************************" << - "*** wrong number of channels! Please check ***" << - "***************************************************************" << std::endl; + if(number_of_lines != kChannels) + edm::LogInfo("wrong number of channels! Please check "); } From ec449da1af62f5d08e64e6491199086f6bd80a5e Mon Sep 17 00:00:00 2001 From: Tanmay Mudholkar Date: Wed, 21 Mar 2018 08:53:06 +0100 Subject: [PATCH 175/426] Updated line in code to be compatible with latest CMSSW style requirements. --- DQM/EcalCommon/src/MESetNonObject.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DQM/EcalCommon/src/MESetNonObject.cc b/DQM/EcalCommon/src/MESetNonObject.cc index e2bd429ccb0b3..313b7b995afa8 100644 --- a/DQM/EcalCommon/src/MESetNonObject.cc +++ b/DQM/EcalCommon/src/MESetNonObject.cc @@ -48,7 +48,7 @@ namespace ecaldqm MESetNonObject::clone(std::string const& _path/* = ""*/) const { std::string path(path_); - if(_path != "") path_ = _path; + if(!_path.empty()) path_ = _path; MESet* copy(new MESetNonObject(*this)); path_ = path; return copy; From 93693f27c58da3d62f5d4606c8e01233edabbd74 Mon Sep 17 00:00:00 2001 From: Ianna Osborne Date: Wed, 21 Mar 2018 11:24:02 +0100 Subject: [PATCH 176/426] CTPPS 2018 Geometry Scripts --- .../writehelpers/createCTPPS2017Payloads.sh | 1 + .../createCTPPSExtended2016Payloads.sh | 1 + .../writehelpers/createCTPPSHLTPayload.sh | 4 ++ .../writehelpers/geometryCTPPS2017_writer.py | 4 +- .../geometryCTPPS2017_xmlwriter.py | 6 +-- .../writehelpers/geometryCTPPS2018_writer.py | 38 +++++++++++++++++++ .../geometryCTPPS2018_xmlwriter.py | 27 +++++++++++++ 7 files changed, 76 insertions(+), 5 deletions(-) create mode 100755 CondTools/Geometry/test/writehelpers/createCTPPS2017Payloads.sh create mode 100644 CondTools/Geometry/test/writehelpers/createCTPPSExtended2016Payloads.sh create mode 100755 CondTools/Geometry/test/writehelpers/createCTPPSHLTPayload.sh create mode 100644 CondTools/Geometry/test/writehelpers/geometryCTPPS2018_writer.py create mode 100644 CondTools/Geometry/test/writehelpers/geometryCTPPS2018_xmlwriter.py diff --git a/CondTools/Geometry/test/writehelpers/createCTPPS2017Payloads.sh b/CondTools/Geometry/test/writehelpers/createCTPPS2017Payloads.sh new file mode 100755 index 0000000000000..c12720002ae61 --- /dev/null +++ b/CondTools/Geometry/test/writehelpers/createCTPPS2017Payloads.sh @@ -0,0 +1 @@ +conddb_import -f sqlite_file:myfile.db -c sqlite_file:XMLFILE_CTPPS_Geometry.db -t XMLFILE_CTPPS_Geometry_2017_101YV3 -i XMLFILE_CTPPS_Geometry_2017_101YV3 diff --git a/CondTools/Geometry/test/writehelpers/createCTPPSExtended2016Payloads.sh b/CondTools/Geometry/test/writehelpers/createCTPPSExtended2016Payloads.sh new file mode 100644 index 0000000000000..f7aa5f1e0a6bb --- /dev/null +++ b/CondTools/Geometry/test/writehelpers/createCTPPSExtended2016Payloads.sh @@ -0,0 +1 @@ +conddb_import -f sqlite_file:myfile.db -c sqlite_file:XMLFILE_CTPPS_Geometry.db -t XMLFILE_CTPPS_Geometry_2016_922V1 -i XMLFILE_CTPPS_Geometry_2016_922V1 diff --git a/CondTools/Geometry/test/writehelpers/createCTPPSHLTPayload.sh b/CondTools/Geometry/test/writehelpers/createCTPPSHLTPayload.sh new file mode 100755 index 0000000000000..2ba15d9b8429e --- /dev/null +++ b/CondTools/Geometry/test/writehelpers/createCTPPSHLTPayload.sh @@ -0,0 +1,4 @@ +conddb_import -f frontier://FrontierProd/CMS_CONDITIONS -i XMLFILE_CTPPS_Geometry_2016_922V1 -c sqlite:file.db -b 264232 -e 286693 -t XMLFILE_CTPPS_Geometry_101YV3_hlt +conddb_import -f frontier://FrontierProd/CMS_CONDITIONS -i XMLFILE_CTPPS_Geometry_2017_101YV3 -c sqlite:file.db -b 286693 -e 309055 -t XMLFILE_CTPPS_Geometry_101YV3_hlt +conddb_import -f frontier://FrontierProd/CMS_CONDITIONS -i XMLFILE_CTPPS_Geometry_2018_101YV1 -c sqlite:file.db -b 309055 -t XMLFILE_CTPPS_Geometry_101YV3_hlt +conddb_import -f sqlite_file:file.db -c sqlite_file:XMLFILE_CTPPS_HLT_Geometry.db -t XMLFILE_CTPPS_Geometry_101YV3_hlt -i XMLFILE_CTPPS_Geometry_101YV3_hlt diff --git a/CondTools/Geometry/test/writehelpers/geometryCTPPS2017_writer.py b/CondTools/Geometry/test/writehelpers/geometryCTPPS2017_writer.py index 091c693879ce8..5a2375a8520b4 100644 --- a/CondTools/Geometry/test/writehelpers/geometryCTPPS2017_writer.py +++ b/CondTools/Geometry/test/writehelpers/geometryCTPPS2017_writer.py @@ -17,7 +17,7 @@ # XML files, but there is no way to directly build the # DDCompactView from this. process.XMLGeometryWriter = cms.EDAnalyzer("XMLGeometryBuilder", - XMLFileName = cms.untracked.string("./geSingleBigFile.xml"), + XMLFileName = cms.untracked.string("./ge2017SingleBigFile.xml"), ZIP = cms.untracked.bool(True) ) @@ -26,7 +26,7 @@ process.PoolDBOutputService = cms.Service("PoolDBOutputService", process.CondDB, toPut = cms.VPSet(cms.PSet(record = cms.string('GeometryFileRcd'), - tag = cms.string('XMLFILE_CTPPS_Geometry_TagXX')) + tag = cms.string('XMLFILE_CTPPS_Geometry_2017_TagXX')) ) ) diff --git a/CondTools/Geometry/test/writehelpers/geometryCTPPS2017_xmlwriter.py b/CondTools/Geometry/test/writehelpers/geometryCTPPS2017_xmlwriter.py index 02d0e846221e3..781248d59863a 100644 --- a/CondTools/Geometry/test/writehelpers/geometryCTPPS2017_xmlwriter.py +++ b/CondTools/Geometry/test/writehelpers/geometryCTPPS2017_xmlwriter.py @@ -2,8 +2,8 @@ process = cms.Process("GeometryXMLWriter") -process.load('Geometry.VeryForwardGeometry.geometryRPFromDD_cfi') -from Geometry.VeryForwardGeometry.geometryRPFromDD_cfi import XMLIdealGeometryESSource_CTPPS +process.load('Geometry.VeryForwardGeometry.geometryRPFromDD_2017_cfi') +from Geometry.VeryForwardGeometry.geometryRPFromDD_2017_cfi import XMLIdealGeometryESSource_CTPPS process.XMLIdealGeometryESSource = XMLIdealGeometryESSource_CTPPS.clone() process.source = cms.Source("EmptyIOVSource", @@ -15,7 +15,7 @@ process.BigXMLWriter = cms.EDAnalyzer("OutputDDToDDL", rotNumSeed = cms.int32(0), - fileName = cms.untracked.string("./geSingleBigFile.xml") + fileName = cms.untracked.string("./ge2017SingleBigFile.xml") ) diff --git a/CondTools/Geometry/test/writehelpers/geometryCTPPS2018_writer.py b/CondTools/Geometry/test/writehelpers/geometryCTPPS2018_writer.py new file mode 100644 index 0000000000000..12db9758baaf6 --- /dev/null +++ b/CondTools/Geometry/test/writehelpers/geometryCTPPS2018_writer.py @@ -0,0 +1,38 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("GeometryWriter") + +process.load('CondCore.CondDB.CondDB_cfi') + +process.source = cms.Source("EmptyIOVSource", + lastValue = cms.uint64(1), + timetype = cms.string('runnumber'), + firstValue = cms.uint64(1), + interval = cms.uint64(1) + ) + +# This reads the big XML file and the only way to fill the +# nonreco part of the database is to read this file. It +# somewhat duplicates the information read from the little +# XML files, but there is no way to directly build the +# DDCompactView from this. +process.XMLGeometryWriter = cms.EDAnalyzer("XMLGeometryBuilder", + XMLFileName = cms.untracked.string("./ge2018SingleBigFile.xml"), + ZIP = cms.untracked.bool(True) + ) + +process.CondDB.timetype = cms.untracked.string('runnumber') +process.CondDB.connect = cms.string('sqlite_file:myfile.db') +process.PoolDBOutputService = cms.Service("PoolDBOutputService", + process.CondDB, + toPut = cms.VPSet(cms.PSet(record = cms.string('GeometryFileRcd'), + tag = cms.string('XMLFILE_CTPPS_Geometry_2018_101YV1')) + ) + ) + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(1) + ) + +process.p1 = cms.Path(process.XMLGeometryWriter) + diff --git a/CondTools/Geometry/test/writehelpers/geometryCTPPS2018_xmlwriter.py b/CondTools/Geometry/test/writehelpers/geometryCTPPS2018_xmlwriter.py new file mode 100644 index 0000000000000..5a0ff2737497c --- /dev/null +++ b/CondTools/Geometry/test/writehelpers/geometryCTPPS2018_xmlwriter.py @@ -0,0 +1,27 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("GeometryXMLWriter") + +process.load('Geometry.VeryForwardGeometry.geometryRPFromDD_2018_cfi') +from Geometry.VeryForwardGeometry.geometryRPFromDD_2018_cfi import XMLIdealGeometryESSource_CTPPS +process.XMLIdealGeometryESSource = XMLIdealGeometryESSource_CTPPS.clone() + +process.source = cms.Source("EmptyIOVSource", + lastValue = cms.uint64(1), + timetype = cms.string('runnumber'), + firstValue = cms.uint64(1), + interval = cms.uint64(1) + ) + +process.BigXMLWriter = cms.EDAnalyzer("OutputDDToDDL", + rotNumSeed = cms.int32(0), + fileName = cms.untracked.string("./ge2018SingleBigFile.xml") + ) + + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(1) + ) + +process.p1 = cms.Path(process.BigXMLWriter) + From decbc4e7c5a40b67fcabb01f4eb4cdd86f2c3f4e Mon Sep 17 00:00:00 2001 From: masegura Date: Wed, 21 Mar 2018 11:27:00 +0100 Subject: [PATCH 177/426] CPPFDigis emulator V2 @maseguracern --- L1Trigger/L1TMuonCPPF/BuildFile.xml | 33 ++ L1Trigger/L1TMuonCPPF/README.md | 47 ++ L1Trigger/L1TMuonCPPF/interface/EmulateCPPF.h | 36 ++ .../L1TMuonCPPF/interface/RecHitProcessor.h | 79 +++ L1Trigger/L1TMuonCPPF/plugins/BuildFile.xml | 4 + .../plugins/L1TMuonCPPFDigiProducer.cc | 41 ++ .../plugins/L1TMuonCPPFDigiProducer.h | 66 +++ .../python/emulatorCppfDigis_cfi.py | 21 + L1Trigger/L1TMuonCPPF/src/EmulateCPPF.cc | 88 ++++ L1Trigger/L1TMuonCPPF/src/RecHitProcessor.cc | 468 ++++++++++++++++++ .../L1TMuonCPPF/test/cppf_emulator_MC.py | 137 +++++ .../L1TMuonCPPF/test/cppf_emulator_RAW.py | 99 ++++ 12 files changed, 1119 insertions(+) create mode 100644 L1Trigger/L1TMuonCPPF/BuildFile.xml create mode 100644 L1Trigger/L1TMuonCPPF/README.md create mode 100644 L1Trigger/L1TMuonCPPF/interface/EmulateCPPF.h create mode 100644 L1Trigger/L1TMuonCPPF/interface/RecHitProcessor.h create mode 100644 L1Trigger/L1TMuonCPPF/plugins/BuildFile.xml create mode 100644 L1Trigger/L1TMuonCPPF/plugins/L1TMuonCPPFDigiProducer.cc create mode 100644 L1Trigger/L1TMuonCPPF/plugins/L1TMuonCPPFDigiProducer.h create mode 100644 L1Trigger/L1TMuonCPPF/python/emulatorCppfDigis_cfi.py create mode 100644 L1Trigger/L1TMuonCPPF/src/EmulateCPPF.cc create mode 100644 L1Trigger/L1TMuonCPPF/src/RecHitProcessor.cc create mode 100644 L1Trigger/L1TMuonCPPF/test/cppf_emulator_MC.py create mode 100644 L1Trigger/L1TMuonCPPF/test/cppf_emulator_RAW.py diff --git a/L1Trigger/L1TMuonCPPF/BuildFile.xml b/L1Trigger/L1TMuonCPPF/BuildFile.xml new file mode 100644 index 0000000000000..7f886a6fab6eb --- /dev/null +++ b/L1Trigger/L1TMuonCPPF/BuildFile.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/L1Trigger/L1TMuonCPPF/README.md b/L1Trigger/L1TMuonCPPF/README.md new file mode 100644 index 0000000000000..27522c7b7f799 --- /dev/null +++ b/L1Trigger/L1TMuonCPPF/README.md @@ -0,0 +1,47 @@ +# CPPFDigis Emulator + +This is the first version of the CPPF emulator. we use the RPC Digitization and +reconstruction as intermedate steps. +Under test you can find two examples, one unpacking 2017F RAW Data (cppf_emulator_RAW.py) +and another one using generated MC events (cppf_emulator_MC.py). +The output of the unpacker is an edm branch named emulatorCppfDigis, following +the CPPFDigi dataformat already committed in CMSSW_10_1_X. + +# Out of the box instructions + +``` +ssh -XY username@lxplus.cern.ch +#setenv SCRAM_ARCH slc6_amd64_gcc630 +#(or export SCRAM_ARCH=slc6_amd64_gcc630) +cmsrel CMSSW_10_1_X_2018-03-11-2300 +cd CMSSW_10_1_X_2018-03-11-2300/src +cmsenv +``` + +``` +git cms-init +git fetch maseguracern +git cms-merge-topic -u maseguracern:CPPF_Emulator +#scram b clean +scram b -j6 +``` + +## Run the code (check the input) +``` +cd L1Trigger/L1TMuonCPPF +cmsRun test/cppf_emulator_RAW.py +``` + +## Setup your Github space (In case you haven't) +``` +git remote add YourGitHubName git@github.com:YourGitHubName/cmssw.git +git fetch YourGitHubName +git checkout -b YourBranchName +``` + +## Modifying files +``` +git add +git commit -m "Commit message" +git push my-cmssw YourBranchName +``` diff --git a/L1Trigger/L1TMuonCPPF/interface/EmulateCPPF.h b/L1Trigger/L1TMuonCPPF/interface/EmulateCPPF.h new file mode 100644 index 0000000000000..f5282dac78138 --- /dev/null +++ b/L1Trigger/L1TMuonCPPF/interface/EmulateCPPF.h @@ -0,0 +1,36 @@ +#ifndef L1Trigger_L1TMuonCPPF_EmulateCPPF_h +#define L1Trigger_L1TMuonCPPF_EmulateCPPF_h + +#include "L1Trigger/L1TMuonCPPF/interface/RecHitProcessor.h" + +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + + +class EmulateCPPF { + + public: + explicit EmulateCPPF(const edm::ParameterSet& iConfig, edm::ConsumesCollector&& iConsumes); + ~EmulateCPPF(); + + void process( + // Input + const edm::Event& iEvent, const edm::EventSetup& iSetup, + // Output + l1t::CPPFDigiCollection& cppf_recHit + ); + + + private: + + // For now, treat CPPF as single board + // In the future, may want to treat the 4 CPPF boards in each endcap as separate entities + std::array recHit_processors_; + + const edm::EDGetToken recHitToken_; + enum class CppfSource { File, EventSetup } cppfSource_; + std::vector CppfVec_1; + int MaxClusterSize_; +}; // End class EmulateCPPF + +#endif // #define L1Trigger_L1TMuonCPPF_EmulateCPPF_h diff --git a/L1Trigger/L1TMuonCPPF/interface/RecHitProcessor.h b/L1Trigger/L1TMuonCPPF/interface/RecHitProcessor.h new file mode 100644 index 0000000000000..fe48143e1fa49 --- /dev/null +++ b/L1Trigger/L1TMuonCPPF/interface/RecHitProcessor.h @@ -0,0 +1,79 @@ +#ifndef L1Trigger_L1TMuonCPPF_RecHitProcessor_h +#define L1Trigger_L1TMuonCPPF_RecHitProcessor_h + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include "Geometry/RPCGeometry/interface/RPCRoll.h" +#include "Geometry/RPCGeometry/interface/RPCGeometry.h" +#include "Geometry/Records/interface/MuonGeometryRecord.h" + +#include "DataFormats/MuonDetId/interface/RPCDetId.h" +#include "DataFormats/RPCRecHit/interface/RPCRecHitCollection.h" +#include "DataFormats/L1TMuon/interface/CPPFDigi.h" + +#include "CondFormats/RPCObjects/interface/RPCMaskedStrips.h" +#include "CondFormats/RPCObjects/interface/RPCDeadStrips.h" + +#include "CondFormats/Serialization/interface/Serializable.h" +#include "L1Trigger/L1TMuonEndCap/interface/TrackTools.h" + +#include +#include +#include +#include +#include +#include + +class RecHitProcessor { + public: + explicit RecHitProcessor(); + ~RecHitProcessor(); + + struct CppfItem { + + int lb; + int rawId; + int strip; + int lbchannel; + int halfchannel; + int int_phi; + int int_theta; + COND_SERIALIZABLE; + }; + + std::vector const & getCppfVec() const {return CppfVec;} + std::vector CppfVec; + + + void processLook( + // Input + const edm::Event& iEvent, + const edm::EventSetup& iSetup, + const edm::EDGetToken& recHitToken, + std::vector& CppfVec1, + // Output + l1t::CPPFDigiCollection& cppfDigis, + const int MaxClusterSize + ) const; + + void process( + // Input + const edm::Event& iEvent, + const edm::EventSetup& iSetup, + const edm::EDGetToken& recHitToken, + // Output + l1t::CPPFDigiCollection& cppfDigis + ) const; + + void print(int a, int b, float c, float d) const {std::cout << a << " " << b << " " << c << " " << d << std::endl;}; + + COND_SERIALIZABLE; + + private: + +}; + +#endif /* #define L1Trigger_L1TMuonCPPF_RecHitProcessor_h */ diff --git a/L1Trigger/L1TMuonCPPF/plugins/BuildFile.xml b/L1Trigger/L1TMuonCPPF/plugins/BuildFile.xml new file mode 100644 index 0000000000000..6cdb6e2231720 --- /dev/null +++ b/L1Trigger/L1TMuonCPPF/plugins/BuildFile.xml @@ -0,0 +1,4 @@ + + + + diff --git a/L1Trigger/L1TMuonCPPF/plugins/L1TMuonCPPFDigiProducer.cc b/L1Trigger/L1TMuonCPPF/plugins/L1TMuonCPPFDigiProducer.cc new file mode 100644 index 0000000000000..a5951b6d0a1e3 --- /dev/null +++ b/L1Trigger/L1TMuonCPPF/plugins/L1TMuonCPPFDigiProducer.cc @@ -0,0 +1,41 @@ +// Emulator that takes RPC hits and produces CPPFDigis to send to EMTF +// Author Alejandro Segura -- Universidad de los Andes + +#include "L1TMuonCPPFDigiProducer.h" + + +L1TMuonCPPFDigiProducer::L1TMuonCPPFDigiProducer(const edm::ParameterSet& iConfig) : + cppf_emulator_(std::make_unique(iConfig, consumesCollector())) + //cppf_emulator_(new EmulateCPPF(iConfig, consumesCollector())) +{ + // produces("rpcDigi"); + produces("recHit"); +} + +L1TMuonCPPFDigiProducer::~L1TMuonCPPFDigiProducer() { +} + +void L1TMuonCPPFDigiProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + + // Create pointers to the collections which will store the cppfDigis + // auto cppf_rpcDigi = std::make_unique(); + auto cppf_recHit = std::make_unique(); + + // Main CPPF emulation process: emulates CPPF output from RPCDigi or RecHit inputs + // From src/EmulateCPPF.cc + // cppf_emulator_->process(iEvent, iSetup, *cppf_rpcDigi, *cppf_recHit); + cppf_emulator_->process(iEvent, iSetup, *cppf_recHit); + + // Fill the output collections + // iEvent.put(std::move(cppf_rpcDigi), "rpcDigi"); + iEvent.put(std::move(cppf_recHit), "recHit"); +} + +void L1TMuonCPPFDigiProducer::beginStream(edm::StreamID iID) { +} + +void L1TMuonCPPFDigiProducer::endStream(){ +} + +// Define this as a plug-in +DEFINE_FWK_MODULE(L1TMuonCPPFDigiProducer); diff --git a/L1Trigger/L1TMuonCPPF/plugins/L1TMuonCPPFDigiProducer.h b/L1Trigger/L1TMuonCPPF/plugins/L1TMuonCPPFDigiProducer.h new file mode 100644 index 0000000000000..1d475522a91fe --- /dev/null +++ b/L1Trigger/L1TMuonCPPF/plugins/L1TMuonCPPFDigiProducer.h @@ -0,0 +1,66 @@ +// Emulator that takes RPC hits and produces CPPFDigis to send to EMTF +// Author Alejandro Segura -- Universidad de los Andes + +#ifndef L1Trigger_L1TMuonCPPF_L1TMuonCPPFDigiProducer_h +#define L1Trigger_L1TMuonCPPF_L1TMuonCPPFDigiProducer_h + +#include "L1Trigger/L1TMuonCPPF/interface/EmulateCPPF.h" + +// System include files +#include + +// User include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +//#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +// Other includes (all needed? - AWB 27.07.17) +#include "FWCore/Utilities/interface/InputTag.h" + +#include "DataFormats/RPCDigi/interface/RPCDigiCollection.h" +#include "DataFormats/RPCRecHit/interface/RPCRecHitCollection.h" + +#include "CondFormats/RPCObjects/interface/RPCDeadStrips.h" + +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/Framework/interface/ESHandle.h" + +#include "DataFormats/MuonDetId/interface/RPCDetId.h" +#include "DataFormats/L1TMuon/interface/CPPFDigi.h" + +#include "Geometry/RPCGeometry/interface/RPCRoll.h" +#include "Geometry/RPCGeometry/interface/RPCGeometry.h" + +#include "L1Trigger/L1TMuonEndCap/interface/PrimitiveConversion.h" +#include "L1Trigger/L1TMuonEndCap/interface/SectorProcessorLUT.h" + +#include + +#include +#include +#include +#include "TVector3.h" + +// Class declaration +class L1TMuonCPPFDigiProducer : public edm::stream::EDProducer<> { + + public: + explicit L1TMuonCPPFDigiProducer(const edm::ParameterSet&); + ~L1TMuonCPPFDigiProducer() override; + + private: + + void beginStream(edm::StreamID) override; + void endStream() override; + void produce(edm::Event& event, const edm::EventSetup& setup) override; + + private: + std::unique_ptr cppf_emulator_; + +}; + +#endif /* #define L1Trigger_L1TMuonCPPF_L1TMuonCPPFDigiProducer_h */ diff --git a/L1Trigger/L1TMuonCPPF/python/emulatorCppfDigis_cfi.py b/L1Trigger/L1TMuonCPPF/python/emulatorCppfDigis_cfi.py new file mode 100644 index 0000000000000..a3b581a6f5772 --- /dev/null +++ b/L1Trigger/L1TMuonCPPF/python/emulatorCppfDigis_cfi.py @@ -0,0 +1,21 @@ +import FWCore.ParameterSet.Config as cms + +emulatorCppfDigis = cms.EDProducer("L1TMuonCPPFDigiProducer", + + ## Input collection + recHitLabel = cms.InputTag("rpcRecHits"), + MaxClusterSize = cms.int32(3), + # cppfSource = cms.string('Geo'), #'File' for Look up table and 'Geo' for CMSSW Geometry + cppfSource = cms.string('File'), #'File' for Look up table and 'Geo' for CMSSW Geometry + + cppfvecfile = cms.FileInPath('L1Trigger/L1TMuon/data/cppf/angleScale_RPC_CPPFmerged.txt') + # cppfvecfile = cms.FileInPath('L1Trigger/L1TMuon/data/cppf/angleScale_RPC_CPPFn1.txt') + # cppfvecfile = cms.FileInPath('L1Trigger/L1TMuon/data/cppf/angleScale_RPC_CPPFn2.txt') + # cppfvecfile = cms.FileInPath('L1Trigger/L1TMuon/data/cppf/angleScale_RPC_CPPFn3.txt') + # cppfvecfile = cms.FileInPath('L1Trigger/L1TMuon/data/cppf/angleScale_RPC_CPPFn4.txt') + # cppfvecfile = cms.FileInPath('L1Trigger/L1TMuon/data/cppf/angleScale_RPC_CPPFp1.txt') + # cppfvecfile = cms.FileInPath('L1Trigger/L1TMuon/data/cppf/angleScale_RPC_CPPFp2.txt') + # cppfvecfile = cms.FileInPath('L1Trigger/L1TMuon/data/cppf/angleScale_RPC_CPPFp3.txt') + # cppfvecfile = cms.FileInPath('L1Trigger/L1TMuon/data/cppf/angleScale_RPC_CPPFp4.txt') + ) + diff --git a/L1Trigger/L1TMuonCPPF/src/EmulateCPPF.cc b/L1Trigger/L1TMuonCPPF/src/EmulateCPPF.cc new file mode 100644 index 0000000000000..fab4fbb6bb095 --- /dev/null +++ b/L1Trigger/L1TMuonCPPF/src/EmulateCPPF.cc @@ -0,0 +1,88 @@ + +#include "L1Trigger/L1TMuonCPPF/interface/EmulateCPPF.h" +#include "CondFormats/RPCObjects/interface/RPCMaskedStrips.h" +#include "CondFormats/RPCObjects/interface/RPCDeadStrips.h" +#include +#include + +EmulateCPPF::EmulateCPPF(const edm::ParameterSet& iConfig, edm::ConsumesCollector&& iConsumes) : + // rpcDigi_processors_(), + recHit_processors_(), + // rpcDigiToken_( iConsumes.consumes(iConfig.getParameter("recHitLabel")) ), + recHitToken_(iConsumes.consumes(iConfig.getParameter("recHitLabel"))), + cppfSource_(CppfSource::EventSetup), + MaxClusterSize_(0) +{ + MaxClusterSize_ = iConfig.getParameter("MaxClusterSize"); + + const std::string cppfSource = iConfig.getParameter("cppfSource"); + //Look up table + if (cppfSource == "File"){ + cppfSource_ = CppfSource::File; + edm::FileInPath fp = iConfig.getParameter("cppfvecfile"); + std::ifstream inputFile(fp.fullPath().c_str(), std::ios::in); + if ( !inputFile ) { + throw cms::Exception("No LUT") << "Error: CPPF look up table file cannot not be opened"; + exit(1); + } + while ( inputFile.good() ) { + RecHitProcessor::CppfItem Item; + inputFile >> Item.rawId >> Item.strip >> Item.lb >> Item.halfchannel >> Item.int_phi >> Item.int_theta; + if ( inputFile.good() ) CppfVec_1.push_back(Item); + } + inputFile.close(); + } + + //RPC Geometry + else if (cppfSource == "Geo") { + cppfSource_ = CppfSource::EventSetup; + } + //Error for wrong input + else { + throw cms::Exception("Invalid option") << "Error: Specify in python/emulatorCppfDigis_cfi 'File' for look up table or 'Geo' for RPC Geometry"; + exit(1); + } + +} + +EmulateCPPF::~EmulateCPPF() { +} + +void EmulateCPPF::process( + const edm::Event& iEvent, const edm::EventSetup& iSetup, + // l1t::CPPFDigiCollection& cppf_rpcDigi, + l1t::CPPFDigiCollection& cppf_recHit + ) { + + if( cppfSource_ == CppfSource::File ){ + //Using the look up table to fill the information + cppf_recHit.clear(); + for (auto& recHit_processor : recHit_processors_) { + recHit_processor.processLook( iEvent, iSetup, recHitToken_, CppfVec_1, cppf_recHit, MaxClusterSize_); + // recHit_processors_.at(recHit_processor).processLook( iEvent, iSetup, recHitToken_, CppfVec_1, cppf_recHit ); + } + } + else if (cppfSource_ == CppfSource::EventSetup) { + // Clear output collections + // cppf_rpcDigi.clear(); + cppf_recHit.clear(); + + // // Get the RPCDigis from the event + // edm::Handle rpcDigis; + // iEvent.getByToken(rpcDigiToken_, rpcDigis); + + // _________________________________________________________________________________ + // Run the CPPF clusterization+coordinate conversion algo on RPCDigis and RecHits + + // For now, treat CPPF as single board + // In the future, may want to treat the 4 CPPF boards in each endcap as separate entities + + // for (unsigned int iBoard = 0; iBoard < rpcDigi_processors_.size(); iBoard++) { + // rpcDigi_processors_.at(iBoard).process( iSetup, rpcDigis, cppf_rpcDigi ); + // } + for (auto& recHit_processor : recHit_processors_) { + recHit_processor.process( iEvent, iSetup, recHitToken_, cppf_recHit ); + //recHit_processors_.at(recHit_processor).process( iEvent, iSetup, recHitToken_, cppf_recHit ); + } + } +} // End void EmulateCPPF::process() diff --git a/L1Trigger/L1TMuonCPPF/src/RecHitProcessor.cc b/L1Trigger/L1TMuonCPPF/src/RecHitProcessor.cc new file mode 100644 index 0000000000000..a918890881e11 --- /dev/null +++ b/L1Trigger/L1TMuonCPPF/src/RecHitProcessor.cc @@ -0,0 +1,468 @@ +#include "L1Trigger/L1TMuonCPPF/interface/RecHitProcessor.h" + +RecHitProcessor::RecHitProcessor() { +} + +RecHitProcessor::~RecHitProcessor() { +} + +void RecHitProcessor::processLook( + const edm::Event& iEvent, + const edm::EventSetup& iSetup, + const edm::EDGetToken& recHitToken, + std::vector& CppfVec1, + l1t::CPPFDigiCollection& cppfDigis, + const int MaxClusterSize + ) const { + + edm::Handle recHits; + iEvent.getByToken(recHitToken, recHits); + + edm::ESHandle rpcGeom; + iSetup.get().get(rpcGeom); + + // The loop is over the detector container in the rpc geometry collection. We are interested in the RPDdetID (inside of RPCChamber vectors), specifically, the RPCrechits. to assignment the CPPFDigis. + for ( TrackingGeometry::DetContainer::const_iterator iDet = rpcGeom->dets().begin(); iDet < rpcGeom->dets().end(); iDet++ ) { + + // we do a cast over the class RPCChamber to obtain the RPCroll vectors, inside of them, the RPCRechits are found. in other words, the method ->rolls() does not exist for other kind of vector within DetContainer and we can not obtain the rpcrechits in a suitable way. + if (dynamic_cast( *iDet ) == nullptr ) continue; + + auto chamb = dynamic_cast( *iDet ); + + std::vector rolls = (chamb->rolls()); + + // Loop over rolls in the chamber + for(auto& iRoll : rolls){ + + RPCDetId rpcId = (*iRoll).id(); + + + + typedef std::pair rangeRecHits; + rangeRecHits recHitCollection = recHits->get(rpcId); + + + + //Loop over the RPC digis + for (RPCRecHitCollection::const_iterator rechit_it = recHitCollection.first; rechit_it != recHitCollection.second; rechit_it++) { + + //const RPCDetId& rpcId = rechit_it->rpcId(); + int rawId = rpcId.rawId(); + //int station = rpcId.station(); + int Bx = rechit_it->BunchX(); + int isValid = rechit_it->isValid(); + int firststrip = rechit_it->firstClusterStrip(); + int clustersize = rechit_it->clusterSize(); + LocalPoint lPos = rechit_it->localPosition(); + const RPCRoll* roll = rpcGeom->roll(rpcId); + const BoundPlane& rollSurface = roll->surface(); + GlobalPoint gPos = rollSurface.toGlobal(lPos); + float global_theta = emtf::rad_to_deg(gPos.theta().value()); + float global_phi = emtf::rad_to_deg(gPos.phi().value()); + //:::::::::::::::::::::::::::: + //Establish the average position of the rechit + int rechitstrip = firststrip; + + if(clustersize > 2) { + int medium = 0; + if (clustersize % 2 == 0) medium = 0.5*(clustersize); + else medium = 0.5*(clustersize-1); + rechitstrip += medium; + } + + if(clustersize > MaxClusterSize) continue; + //This is just for test CPPFDigis with the RPC Geometry, It must be "true" in the normal runs + bool Geo = true; + ////::::::::::::::::::::::::::::::::::::::::::::::::: + //Set the EMTF Sector + int EMTFsector1 = 0; + int EMTFsector2 = 0; + + //sector 1 + if ((global_phi > 15.) && (global_phi <= 16.3)) { + EMTFsector1 = 1; + EMTFsector2 = 6; + } + else if ((global_phi > 16.3) && (global_phi <= 53.)) { + EMTFsector1 = 1; + EMTFsector2 = 0; + } + else if ((global_phi > 53.) && (global_phi <= 75.)) { + EMTFsector1 = 1; + EMTFsector2 = 2; + } + //sector 2 + else if ((global_phi > 75.) && (global_phi <= 76.3)) { + EMTFsector1 = 1; + EMTFsector2 = 2; + } + else if ((global_phi > 76.3) && (global_phi <= 113.)) { + EMTFsector1 = 2; + EMTFsector2 = 0; + } + else if ((global_phi > 113.) && (global_phi <= 135.)) { + EMTFsector1 = 2; + EMTFsector2 = 3; + } + //sector 3 + //less than 180 + else if ((global_phi > 135.) && (global_phi <= 136.3)) { + EMTFsector1 = 2; + EMTFsector2 = 3; + } + else if ((global_phi > 136.3) && (global_phi <= 173.)) { + EMTFsector1 = 3; + EMTFsector2 = 0; + } + else if ((global_phi > 173.) && (global_phi <= 180.)) { + EMTFsector1 = 3; + EMTFsector2 = 4; + } + //Greater than -180 + else if ((global_phi < -165.) && (global_phi >= -180.)) { + EMTFsector1 = 3; + EMTFsector2 = 4; + } + //Fourth sector + else if ((global_phi > -165.) && (global_phi <= -163.7)) { + EMTFsector1 = 3; + EMTFsector2 = 4; + } + else if ((global_phi > -163.7) && (global_phi <= -127.)) { + EMTFsector1 = 4; + EMTFsector2 = 0; + } + else if ((global_phi > -127.) && (global_phi <= -105.)) { + EMTFsector1 = 4; + EMTFsector2 = 5; + } + //fifth sector + else if ((global_phi > -105.) && (global_phi <= -103.7)) { + EMTFsector1 = 4; + EMTFsector2 = 5; + } + else if ((global_phi > -103.7) && (global_phi <= -67.)) { + EMTFsector1 = 5; + EMTFsector2 = 0; + } + else if ((global_phi > -67.) && (global_phi <= -45.)) { + EMTFsector1 = 5; + EMTFsector2 = 6; + } + //sixth sector + else if ((global_phi > -45.) && (global_phi <= -43.7)) { + EMTFsector1 = 5; + EMTFsector2 = 6; + } + else if ((global_phi > -43.7) && (global_phi <= -7.)) { + EMTFsector1 = 6; + EMTFsector2 = 0; + } + else if ((global_phi > -7.) && (global_phi <= 15.)) { + EMTFsector1 = 6; + EMTFsector2 = 1; + } + + + // std::vector::iterator it; + // for(it = CppfVec1.begin(); it != CppfVec1.end(); it++){ + // if( (*it).rawId == rawId) if(Geo_true) std::cout << (*it).rawId << "rawid" << rawId << std::endl; + // } + //Loop over the look up table + double EMTFLink1 = 0.; + double EMTFLink2 = 0.; + + std::vector::iterator cppf1; + std::vector::iterator cppf; + for(cppf1 = CppfVec1.begin(); cppf1 != CppfVec1.end(); cppf1++){ + + + + //Condition to save the CPPFDigi + if(((*cppf1).rawId == rawId) && ((*cppf1).strip == rechitstrip)){ + + int old_strip = (*cppf1).strip; + int before = 0; + int after = 0; + + if(cppf1 != CppfVec1.begin()) + before = (*(cppf1-2)).strip; + + else if (cppf1 == CppfVec1.begin()) + before = (*cppf1).strip; + + if(cppf1 != CppfVec1.end()) + after = (*(cppf1+2)).strip; + + else if (cppf1 == CppfVec1.end()) + after = (*cppf1).strip; + + cppf = cppf1; + + if(clustersize == 2){ + + if(firststrip == 1){ + if(before < after) cppf=(cppf1-1); + else if (before > after) cppf=(cppf1+1); + } + else if(firststrip > 1){ + if(before < after) cppf=(cppf1+1); + else if (before > after) cppf=(cppf1-1); + } + + } + //Using the RPCGeometry + if(Geo){ + std::shared_ptr MainVariables1(new l1t::CPPFDigi(rpcId, Bx , (*cppf).int_phi, (*cppf).int_theta, isValid, (*cppf).lb, (*cppf).halfchannel, EMTFsector1, EMTFLink1, old_strip, clustersize, global_phi, global_theta)); + std::shared_ptr MainVariables2(new l1t::CPPFDigi(rpcId, Bx , (*cppf).int_phi, (*cppf).int_theta, isValid, (*cppf).lb, (*cppf).halfchannel, EMTFsector2, EMTFLink2, old_strip, clustersize, global_phi, global_theta)); + + if ((EMTFsector1 > 0) && (EMTFsector2 == 0)){ + cppfDigis.push_back(*MainVariables1.get()); + } + else if ((EMTFsector1 > 0) && (EMTFsector2 > 0)){ + cppfDigis.push_back(*MainVariables1.get()); + cppfDigis.push_back(*MainVariables2.get()); + } + else if ((EMTFsector1 == 0) && (EMTFsector2 == 0)) { + continue; + } + } //Geo is true + else { + global_phi = 0.; + global_theta = 0.; + std::shared_ptr MainVariables1(new l1t::CPPFDigi(rpcId, Bx , (*cppf).int_phi, (*cppf).int_theta, isValid, (*cppf).lb, (*cppf).halfchannel, EMTFsector1, EMTFLink1, old_strip, clustersize, global_phi, global_theta)); + std::shared_ptr MainVariables2(new l1t::CPPFDigi(rpcId, Bx , (*cppf).int_phi, (*cppf).int_theta, isValid, (*cppf).lb, (*cppf).halfchannel, EMTFsector2, EMTFLink2, old_strip, clustersize, global_phi, global_theta)); + if ((EMTFsector1 > 0) && (EMTFsector2 == 0)){ + cppfDigis.push_back(*MainVariables1.get()); + } + else if ((EMTFsector1 > 0) && (EMTFsector2 > 0)){ + cppfDigis.push_back(*MainVariables1.get()); + cppfDigis.push_back(*MainVariables2.get()); + } + else if ((EMTFsector1 == 0) && (EMTFsector2 == 0)) { + continue; + } + } + } //Condition to save the CPPFDigi + } //Loop over the LUTVector + } //Loop over the recHits + } // End loop: for (std::vector::const_iterator r = rolls.begin(); r != rolls.end(); ++r) + } // End loop: for (TrackingGeometry::DetContainer::const_iterator iDet = rpcGeom->dets().begin(); iDet < rpcGeom->dets().end(); iDet++) + +} + + +void RecHitProcessor::process( + const edm::Event& iEvent, + const edm::EventSetup& iSetup, + const edm::EDGetToken& recHitToken, + l1t::CPPFDigiCollection& cppfDigis + ) const { + + // Get the RPC Geometry + edm::ESHandle rpcGeom; + iSetup.get().get(rpcGeom); + + // Get the RecHits from the event + edm::Handle recHits; + iEvent.getByToken(recHitToken, recHits); + + + // The loop is over the detector container in the rpc geometry collection. We are interested in the RPDdetID (inside of RPCChamber vectors), specifically, the RPCrechits. to assignment the CPPFDigis. + for ( TrackingGeometry::DetContainer::const_iterator iDet = rpcGeom->dets().begin(); iDet < rpcGeom->dets().end(); iDet++ ) { + + // we do a cast over the class RPCChamber to obtain the RPCroll vectors, inside of them, the RPCRechits are found. in other words, the method ->rolls() does not exist for other kind of vector within DetContainer and we can not obtain the rpcrechits in a suitable way. + if (dynamic_cast( *iDet ) == nullptr ) continue; + + auto chamb = dynamic_cast( *iDet ); + std::vector rolls = (chamb->rolls()); + + // Loop over rolls in the chamber + for(auto& iRoll : rolls){ + + RPCDetId rpcId = (*iRoll).id(); + + typedef std::pair rangeRecHits; + rangeRecHits recHitCollection = recHits->get(rpcId); + + + for (RPCRecHitCollection::const_iterator rechit_it = recHitCollection.first; rechit_it != recHitCollection.second; rechit_it++) { + + //const RPCDetId& rpcId = rechit_it->rpcId(); + //int rawId = rpcId.rawId(); + int region = rpcId.region(); + //int station = rpcId.station(); + int Bx = rechit_it->BunchX(); + int isValid = rechit_it->isValid(); + int firststrip = rechit_it->firstClusterStrip(); + int clustersize = rechit_it->clusterSize(); + LocalPoint lPos = rechit_it->localPosition(); + const RPCRoll* roll = rpcGeom->roll(rpcId); + const BoundPlane& rollSurface = roll->surface(); + GlobalPoint gPos = rollSurface.toGlobal(lPos); + float global_theta = emtf::rad_to_deg(gPos.theta().value()); + float global_phi = emtf::rad_to_deg(gPos.phi().value()); + //Endcap region only + + if (region != 0) { + + int int_theta = (region == -1 ? 180. * 32. / 36.5 : 0.) + + (float)region * global_theta * 32. / 36.5 + - 8.5 * 32 / 36.5; + + if(region == 1) { + if(global_theta < 8.5) int_theta = 0; + if(global_theta > 45.) int_theta = 31; + } + else if(region == -1) { + if(global_theta < 135.) int_theta = 31; + if(global_theta > 171.5) int_theta = 0; + } + + //Local EMTF + double local_phi = 0.; + int EMTFsector1 = 0; + int EMTFsector2 = 0; + + //sector 1 + if ((global_phi > 15.) && (global_phi <= 16.3)) { + local_phi = global_phi-15.; + EMTFsector1 = 1; + EMTFsector2 = 6; + } + else if ((global_phi > 16.3) && (global_phi <= 53.)) { + local_phi = global_phi-15.; + EMTFsector1 = 1; + EMTFsector2 = 0; + } + else if ((global_phi > 53.) && (global_phi <= 75.)) { + local_phi = global_phi-15.; + EMTFsector1 = 1; + EMTFsector2 = 2; + } + //sector 2 + else if ((global_phi > 75.) && (global_phi <= 76.3)) { + local_phi = global_phi-15.; + EMTFsector1 = 1; + EMTFsector2 = 2; + } + else if ((global_phi > 76.3) && (global_phi <= 113.)) { + local_phi = global_phi-75.; + EMTFsector1 = 2; + EMTFsector2 = 0; + } + else if ((global_phi > 113.) && (global_phi <= 135.)) { + local_phi = global_phi-75.; + EMTFsector1 = 2; + EMTFsector2 = 3; + } + //sector 3 + //less than 180 + else if ((global_phi > 135.) && (global_phi <= 136.3)) { + local_phi = global_phi-75.; + EMTFsector1 = 2; + EMTFsector2 = 3; + } + else if ((global_phi > 136.3) && (global_phi <= 173.)) { + local_phi = global_phi-135.; + EMTFsector1 = 3; + EMTFsector2 = 0; + } + else if ((global_phi > 173.) && (global_phi <= 180.)) { + local_phi = global_phi-135.; + EMTFsector1 = 3; + EMTFsector2 = 4; + } + //Greater than -180 + else if ((global_phi < -165.) && (global_phi >= -180.)) { + local_phi = global_phi+225.; + EMTFsector1 = 3; + EMTFsector2 = 4; + } + //Fourth sector + else if ((global_phi > -165.) && (global_phi <= -163.7)) { + local_phi = global_phi+225.; + EMTFsector1 = 3; + EMTFsector2 = 4; + } + else if ((global_phi > -163.7) && (global_phi <= -127.)) { + local_phi = global_phi+165.; + EMTFsector1 = 4; + EMTFsector2 = 0; + } + else if ((global_phi > -127.) && (global_phi <= -105.)) { + local_phi = global_phi+165.; + EMTFsector1 = 4; + EMTFsector2 = 5; + } + //fifth sector + else if ((global_phi > -105.) && (global_phi <= -103.7)) { + local_phi = global_phi+165.; + EMTFsector1 = 4; + EMTFsector2 = 5; + } + else if ((global_phi > -103.7) && (global_phi <= -67.)) { + local_phi = global_phi+105.; + EMTFsector1 = 5; + EMTFsector2 = 0; + } + else if ((global_phi > -67.) && (global_phi <= -45.)) { + local_phi = global_phi+105.; + EMTFsector1 = 5; + EMTFsector2 = 6; + } + //sixth sector + else if ((global_phi > -45.) && (global_phi <= -43.7)) { + local_phi = global_phi+105.; + EMTFsector1 = 5; + EMTFsector2 = 6; + } + else if ((global_phi > -43.7) && (global_phi <= -7.)) { + local_phi = global_phi+45.; + EMTFsector1 = 6; + EMTFsector2 = 0; + } + else if ((global_phi > -7.) && (global_phi <= 15.)) { + local_phi = global_phi+45.; + EMTFsector1 = 6; + EMTFsector2 = 1; + } + + int int_phi = int((local_phi + 22.0 )*15. + .5); + + double EMTFLink1 = 0.; + double EMTFLink2 = 0.; + double lb = 0.; + double halfchannel = 0.; + + //Invalid hit + if (isValid == 0) int_phi = 2047; + //Right integers range + assert(0 <= int_phi && int_phi < 1250); + assert(0 <= int_theta && int_theta < 32); + + std::shared_ptr MainVariables1(new l1t::CPPFDigi(rpcId, Bx , int_phi, int_theta, isValid, lb, halfchannel, EMTFsector1, EMTFLink1, firststrip, clustersize, global_phi, global_theta)); + std::shared_ptr MainVariables2(new l1t::CPPFDigi(rpcId, Bx , int_phi, int_theta, isValid, lb, halfchannel, EMTFsector2, EMTFLink2, firststrip, clustersize, global_phi, global_theta)); + if(int_theta == 31) continue; + if ((EMTFsector1 > 0) && (EMTFsector2 == 0)){ + cppfDigis.push_back(*MainVariables1.get()); + } + if ((EMTFsector1 > 0) && (EMTFsector2 > 0)){ + cppfDigis.push_back(*MainVariables1.get()); + cppfDigis.push_back(*MainVariables2.get()); + } + if ((EMTFsector1 == 0) && (EMTFsector2 == 0)){ + continue; + } + } // No barrel rechits + + } // End loop: for (RPCRecHitCollection::const_iterator recHit = recHitCollection.first; recHit != recHitCollection.second; recHit++) + + } // End loop: for (std::vector::const_iterator r = rolls.begin(); r != rolls.end(); ++r) + } // End loop: for (TrackingGeometry::DetContainer::const_iterator iDet = rpcGeom->dets().begin(); iDet < rpcGeom->dets().end(); iDet++) +} // End function: void RecHitProcessor::process() + + + + + diff --git a/L1Trigger/L1TMuonCPPF/test/cppf_emulator_MC.py b/L1Trigger/L1TMuonCPPF/test/cppf_emulator_MC.py new file mode 100644 index 0000000000000..788e08784fd52 --- /dev/null +++ b/L1Trigger/L1TMuonCPPF/test/cppf_emulator_MC.py @@ -0,0 +1,137 @@ +# Auto generated configuration file +# using: +# Revision: 1.19 +# Source: /local/reps/CMSSW/CMSSW/Configuration/Applications/python/ConfigBuilder.py,v +# with command line options: SingleMuPt10_pythia8_cfi.py -s GEN,SIM,DIGI --pileup=NoPileUp --geometry DB --conditions=auto:run1_mc --eventcontent FEVTDEBUGHLT --no_exec -n 30 +import FWCore.ParameterSet.Config as cms +import datetime +import random + +process = cms.Process('DIGI') + +# import of standard configurations +process.load('Configuration.StandardSequences.Services_cff') +process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('Configuration.EventContent.EventContent_cff') +process.load('SimGeneral.MixingModule.mixNoPU_cfi') +#process.load('Configuration.StandardSequences.GeometryRecoDB_cff') +#process.load('Configuration.Geometry.GeometryDB_cff') +#process.load('Configuration.StandardSequences.GeometryExtended_cff') +process.load('Configuration.Geometry.GeometryExtended2016_cff') +process.load('Configuration.Geometry.GeometryExtended2016Reco_cff') +process.load('Configuration.StandardSequences.MagneticField_38T_cff') +process.load('Configuration.StandardSequences.Generator_cff') +process.load('IOMC.EventVertexGenerators.VtxSmearedRealistic50ns13TeVCollision_cfi') +process.load('GeneratorInterface.Core.genFilterSummary_cff') +process.load('Configuration.StandardSequences.SimIdeal_cff') +process.load('Configuration.StandardSequences.Digi_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') + +process.load('RecoLocalMuon.RPCRecHit.rpcRecHits_cfi') +from RecoLocalMuon.RPCRecHit.rpcRecHits_cfi import * + +process.load('L1Trigger.L1TMuonCPPF.emulatorCppfDigis_cfi') +from L1Trigger.L1TMuonCPPF.emulatorCppfDigis_cfi import * + +process.MessageLogger.cerr.FwkReport.reportEvery = cms.untracked.int32(1) +process.MessageLogger = cms.Service("MessageLogger") +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(300) + ) + + +# Input source +process.source = cms.Source("EmptySource" + ) +process.options = cms.untracked.PSet( + ) + +# Production Info +process.configurationMetadata = cms.untracked.PSet( + annotation = cms.untracked.string('SingleMuPt10_pythia8_cfi.py nevts:100'), + name = cms.untracked.string('Applications'), + version = cms.untracked.string('$Revision: 1.19 $') + ) + +# Output definition + +process.FEVTDEBUGHLToutput = cms.OutputModule("PoolOutputModule", + SelectEvents = cms.untracked.PSet( + SelectEvents = cms.vstring('generation_step') + ), + dataset = cms.untracked.PSet( + dataTier = cms.untracked.string(''), + filterName = cms.untracked.string('') + ), + eventAutoFlushCompressedSize = cms.untracked.int32(10485760), + fileName = cms.untracked.string('SingleMuPt10_pythia8_cfi_py_GEN_SIM_DIGI.root'), + outputCommands = cms.untracked.vstring('drop *',"keep *_emulatorMuonRPCDigis_*_*", "keep *_emulatorCppfDigis_*_*", + "keep *_rpcRecHits_*_*", "keep *_genParticles_*_*"), + #outputCommands = process.FEVTDEBUGHLTEventContent.outputCommands, + splitLevel = cms.untracked.int32(0) + ) + +# Additional output definition + +# Other statements +process.genstepfilter.triggerConditions=cms.vstring("generation_step") +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_mc', '') + + +from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper +randHelper = RandomNumberServiceHelper(process.RandomNumberGeneratorService) +randHelper.populate() + +process.RandomNumberGeneratorService.saveFileName = cms.untracked.string("RandomEngineState.log") + + +process.generator = cms.EDFilter("Pythia8PtGun", + PGunParameters = cms.PSet( + AddAntiParticle = cms.bool(True), + MaxEta = cms.double(1.6), + MaxPhi = cms.double(3.14159265359), + MaxPt = cms.double(30.1), + MinEta = cms.double(1.2), + MinPhi = cms.double(-3.14159265359), + MinPt = cms.double(1.1), + ParticleID = cms.vint32(-13) + ), + PythiaParameters = cms.PSet( + parameterSets = cms.vstring() + ), + Verbosity = cms.untracked.int32(0), + firstRun = cms.untracked.uint32(1), + psethack = cms.string('single mu pt 10') + ) + +process.rpcRecHits.rpcDigiLabel = 'simMuonRPCDigis' +process.emulatorCppfDigis.recHitLabel = 'rpcRecHits' + +# Path and EndPath definitions +process.generation_step = cms.Path(process.pgen) +process.simulation_step = cms.Path(process.psim) +process.digitisation_step = cms.Path(process.pdigi) +process.rpcrechits_step = cms.Path(process.rpcRecHits) +process.emulatorCppfDigis_step = cms.Path(process.emulatorCppfDigis) +process.genfiltersummary_step = cms.EndPath(process.genFilterSummary) +process.endjob_step = cms.EndPath(process.endOfProcess) +process.FEVTDEBUGHLToutput_step = cms.EndPath(process.FEVTDEBUGHLToutput) + + +# Schedule definition +process.schedule = cms.Schedule(process.generation_step,process.genfiltersummary_step,process.simulation_step,process.digitisation_step,process.rpcrechits_step,process.emulatorCppfDigis_step,process.endjob_step,process.FEVTDEBUGHLToutput_step) +from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask +associatePatAlgosToolsTask(process) +# filter all path with the production filter sequence +for path in process.paths: + getattr(process,path)._seq = process.generator * getattr(process,path)._seq + + + # Customisation from command line + # Add early deletion of temporary data products to reduce peak memory need + from Configuration.StandardSequences.earlyDeleteSettings_cff import customiseEarlyDelete + process = customiseEarlyDelete(process) +# End adding early deletion diff --git a/L1Trigger/L1TMuonCPPF/test/cppf_emulator_RAW.py b/L1Trigger/L1TMuonCPPF/test/cppf_emulator_RAW.py new file mode 100644 index 0000000000000..3a0ca2684727b --- /dev/null +++ b/L1Trigger/L1TMuonCPPF/test/cppf_emulator_RAW.py @@ -0,0 +1,99 @@ + +import FWCore.ParameterSet.Config as cms +import datetime +import random + +process = cms.Process('DIGI') + +# import of standard configurations +process.load('Configuration.StandardSequences.Services_cff') +process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('Configuration.EventContent.EventContent_cff') +process.load('SimGeneral.MixingModule.mixNoPU_cfi') +#process.load('Configuration.StandardSequences.GeometryRecoDB_cff') +#process.load('Configuration.Geometry.GeometryDB_cff') +#process.load('Configuration.StandardSequences.GeometryExtended_cff') +process.load('Configuration.Geometry.GeometryExtended2016_cff') +process.load('Configuration.Geometry.GeometryExtended2016Reco_cff') +process.load('Configuration.StandardSequences.MagneticField_38T_cff') +process.load('Configuration.StandardSequences.Generator_cff') +process.load('IOMC.EventVertexGenerators.VtxSmearedRealistic50ns13TeVCollision_cfi') +process.load('GeneratorInterface.Core.genFilterSummary_cff') +process.load('Configuration.StandardSequences.SimIdeal_cff') +process.load('Configuration.StandardSequences.Digi_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') + +process.load("EventFilter.RPCRawToDigi.rpcUnpacker_cfi") +import EventFilter.RPCRawToDigi.rpcUnpacker_cfi +muonRPCDigis = EventFilter.RPCRawToDigi.rpcUnpacker_cfi.rpcunpacker.clone() +muonRPCDigis.InputLabel = 'rawDataCollector' + +process.load('RecoLocalMuon.RPCRecHit.rpcRecHits_cfi') +from RecoLocalMuon.RPCRecHit.rpcRecHits_cfi import * + +process.load('L1Trigger.L1TMuonCPPF.emulatorCppfDigis_cfi') +from L1Trigger.L1TMuonCPPF.emulatorCppfDigis_cfi import * + +process.MessageLogger.cerr.FwkReport.reportEvery = cms.untracked.int32(1) +process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) ) + + +# Input source +process.source = cms.Source( + 'PoolSource',fileNames = cms.untracked.vstring ('/store/data/Run2017F/SingleMuon/RAW/v1/000/306/125/00000/4EDD5765-B3C0-E711-B906-02163E01A2D5.root') + ) + +process.options = cms.untracked.PSet( + ) + +process.treeOut = cms.OutputModule("PoolOutputModule", + fileName = cms.untracked.string('test_cppf_emulator.root'), + outputCommands = cms.untracked.vstring('drop *', + "keep *_rpcunpacker_*_*", + "keep *_emulatorCppfDigis_*_*", + "keep *_rpcRecHits_*_*" + #"keep *" + ) + ) + + +# Additional output definition + +# Other statements + +# process.genstepfilter.triggerConditions=cms.vstring("generation_step") +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_mc', '') + + +process.rpcunpacker.InputLabel = 'rawDataCollector' +process.rpcRecHits.rpcDigiLabel = 'rpcunpacker' +process.emulatorCppfDigis.recHitLabel = 'rpcRecHits' + +# Path and EndPath definitions +process.path_step = cms.Path(process.rpcunpacker) +process.rpcrechits_step = cms.Path(process.rpcRecHits) +process.emulatorCppfDigis_step = cms.Path(process.emulatorCppfDigis) +process.endjob_step = cms.EndPath(process.endOfProcess) +process.treeOut_step = cms.EndPath(process.treeOut) + + + +# Schedule definition +process.schedule = cms.Schedule( + process.path_step, + process.rpcrechits_step, + process.emulatorCppfDigis_step, + process.endjob_step, + process.treeOut_step ) + +from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask +associatePatAlgosToolsTask(process) + +# Customisation from command line +# Add early deletion of temporary data products to reduce peak memory need +from Configuration.StandardSequences.earlyDeleteSettings_cff import customiseEarlyDelete +process = customiseEarlyDelete(process) +# End adding early deletion From 752ab256ad62b0609cab51ca7ab8ffa1cac90105 Mon Sep 17 00:00:00 2001 From: Cedric Prieels Date: Wed, 21 Mar 2018 11:41:45 +0100 Subject: [PATCH 178/426] Plots now in png format as well --- .../test/macro/IsoValHistoPublisher.C | 14 +++---- Validation/RecoMuon/test/macro/PlotHelpers.C | 3 +- .../test/macro/RecoMuonValHistoPublisher.C | 22 +++++------ .../test/macro/RecoValHistoPublisher.C | 12 +++--- .../test/macro/SeedValHistoPublisher.C | 12 +++--- .../test/macro/TrackValHistoPublisher.C | 20 +++++----- .../RecoMuon/test/macro/new_PlotHelpers.C | 3 +- .../test/macro/new_TrackValHistoPublisher.C | 39 ++++++++++--------- .../RecoMuon/test/new_muonReleaseSummary.py | 3 ++ 9 files changed, 68 insertions(+), 60 deletions(-) diff --git a/Validation/RecoMuon/test/macro/IsoValHistoPublisher.C b/Validation/RecoMuon/test/macro/IsoValHistoPublisher.C index 02771ad6fe8d3..3fe3057db8fe9 100644 --- a/Validation/RecoMuon/test/macro/IsoValHistoPublisher.C +++ b/Validation/RecoMuon/test/macro/IsoValHistoPublisher.C @@ -97,7 +97,7 @@ void IsoValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="RE Double_t norm [] = {0.,0.,0.,0.}; //===== Tracker, ECAL Deposits const char* plots1 [] = {"sumPt", "emEt", "sumPt_cd", "emEt_cd"}; - Plot4Histograms(newDir + "/muonIso1.pdf", + Plot4Histograms(newDir + "/muonIso1", rdir, sdir, rcollname, scollname, "IsoHistos1", "Tracker, ECAL Deposits", @@ -107,7 +107,7 @@ void IsoValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="RE //===== HCAL and HO Isolation Distributions const char* plots2 [] = {"hadEt", "hoEt", "hadEt_cd", "hoEt_cd"}; - Plot4Histograms(newDir + "/muonIso2.pdf", + Plot4Histograms(newDir + "/muonIso2", rdir, sdir, rcollname, scollname, "IsoHistos2", "HCAL, HO Deposits", @@ -117,7 +117,7 @@ void IsoValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="RE //===== N_Tracks, N_Jets around #mu const char* plots3 [] = {"nTracks", "nJets", "nTracks_cd", "nJets_cd"}; - Plot4Histograms(newDir + "/muonIso3.pdf", + Plot4Histograms(newDir + "/muonIso3", rdir, sdir, rcollname, scollname, "IsoHistos3", "Number of tracks, jets around #mu", @@ -129,7 +129,7 @@ void IsoValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="RE //===== avg Pt, weighted Et around #mu const char* plots4 [] = {"avgPt", "weightedEt", "avgPt_cd", "weightedEt_cd"}; - Plot4Histograms(newDir + "/muonIso4.pdf", + Plot4Histograms(newDir + "/muonIso4", rdir, sdir, rcollname, scollname, "IsoHistos4", "Average p_{T}, weighted E_{T} aroun #mu", @@ -141,7 +141,7 @@ void IsoValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="RE //===== Tracker and CAL deposits vs muon pT const char* plots5 [] = {"muonPt_sumPt", "muonPt_emEt", "muonPt_hadEt", "muonPt_hoEt"}; Double_t norm2 [] = {-999.,-999.,-999.,-999.}; - Plot4Histograms(newDir + "/muonIso5.pdf", + Plot4Histograms(newDir + "/muonIso5", rdir, sdir, rcollname, scollname, "IsoHistos5", "Trk, CAL Isolations vs. #mu p_{T}", @@ -151,7 +151,7 @@ void IsoValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="RE //===== NTracks, NJets, avgPt, weightedEt vs Muon pT const char* plots6 [] = {"muonPt_nTracks", "muonPt_nJets", "muonPt_avgPt", "muonPt_weightedEt"}; - Plot4Histograms(newDir + "/muonIso6.pdf", + Plot4Histograms(newDir + "/muonIso6", rdir, sdir, rcollname, scollname, "IsoHistos6", "Other stuff vs #mu p_{T}", @@ -179,7 +179,7 @@ void IsoValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="RE gSystem->Rename(mergefile, destfile); cout << ">> Deleting partial pdf files" << endl; - gSystem->Exec("rm -rf "+newDir); + gSystem->Exec("rm -rf "+newDir+"/*.pdf"); cout << " ... Done" << endl; } // end of "while loop" diff --git a/Validation/RecoMuon/test/macro/PlotHelpers.C b/Validation/RecoMuon/test/macro/PlotHelpers.C index f0c23ced8b811..49a83f33b506f 100644 --- a/Validation/RecoMuon/test/macro/PlotHelpers.C +++ b/Validation/RecoMuon/test/macro/PlotHelpers.C @@ -534,7 +534,8 @@ void PlotNHistograms(const TString& pdfFile, l->Draw(); // Print Canvas - canvas->Print(pdfFile); + canvas->SaveAs(pdfFile+".pdf"); + canvas->SaveAs(pdfFile+".png"); // Clean memory // delete l; diff --git a/Validation/RecoMuon/test/macro/RecoMuonValHistoPublisher.C b/Validation/RecoMuon/test/macro/RecoMuonValHistoPublisher.C index 58560926973d0..36cdbd17850e4 100644 --- a/Validation/RecoMuon/test/macro/RecoMuonValHistoPublisher.C +++ b/Validation/RecoMuon/test/macro/RecoMuonValHistoPublisher.C @@ -117,7 +117,7 @@ void RecoMuonValHistoPublisher(const char* newFile="NEW_FILE",const char* refFil "GlobalMuon(GLB) #Delta p/p", "GlobalMuon(GLB) #Delta p_{T}/p_{T} vs #sigma(#eta)", "GlobalMuon(GLB) #Delta p_{T}/p_{T} vs #sigma(p_{T})"}; - Plot4Histograms(newDir + "/muonRecoGlb.pdf", + Plot4Histograms(newDir + "/muonRecoGlb", rdir, sdir, rcollname, scollname, "RecHistosGlb", "Distributions for GlobalMuons (GLB)", @@ -138,7 +138,7 @@ void RecoMuonValHistoPublisher(const char* newFile="NEW_FILE",const char* refFil Double_t minx1 [] = {5., -1E100, 5., -1E100, -1E100, -1E100 }; Double_t maxx1 [] = {maxPT, -1E100,maxPT, -1E100, -1E100, -1E100 }; Double_t norm2 [] = {-999.,-999.,-999.,-999.,-999.,-999.}; //Normalize to first histogram - Plot4Histograms(newDir + "/muonRecoGlbEff.pdf", + Plot4Histograms(newDir + "/muonRecoGlbEff", rdir, sdir, rcollname, scollname, "RecEffHistosGlb", "Distributions for GlobalMuons (GLB), efficiencies and fractions", @@ -153,7 +153,7 @@ void RecoMuonValHistoPublisher(const char* newFile="NEW_FILE",const char* refFil (baseh + "ErrPt_vs_Eta_Sigma").Data(), (baseh + "ErrPt_vs_Pt_Sigma").Data()}; const char* plotst3[] = {"PFGlobalMuon(GLBPF) #Delta p_{T}/p_{T}", "PFGlobalMuon(GLBPF) #Delta p/p", "PFGlobalMuon(GLBPF) #Delta p_{T}/p_{T} vs #sigma(#eta)", "PFGlobalMuon(GLBPF) #Delta p_{T}/p_{T} vs #sigma(p_{T})"}; - Plot4Histograms(newDir + "/muonRecoGlbPF.pdf", + Plot4Histograms(newDir + "/muonRecoGlbPF", rdir, sdir, rcollname, scollname, "RecHistosGlbPF", "Distributions for PFGlobalMuons (GLBPF)", @@ -167,7 +167,7 @@ void RecoMuonValHistoPublisher(const char* newFile="NEW_FILE",const char* refFil (baseh + "FractP").Data(), (baseh + "FractEta").Data()}; const char* plotst4[] = {"PFGlobalMuon(GLBPF) #epsilon vs. p", "PFGlobalMuon(GLBPF) #epsilon vs. #eta", "PFGlobalMuon(GLBPF) fraction vs. p", "PFGlobalMuon(GLBPF) fraction vs. #eta"}; - Plot4Histograms(newDir + "/muonRecoGlbPFEff.pdf", + Plot4Histograms(newDir + "/muonRecoGlbPFEff", rdir, sdir, rcollname, scollname, "RecEffHistosGlbPF", "Distributions for PFGlobalMuons (GLBPF), efficiencies and fractions", @@ -186,7 +186,7 @@ void RecoMuonValHistoPublisher(const char* newFile="NEW_FILE",const char* refFil "StandAloneMuon(STA) #Delta p/p", "StandAloneMuon(STA) #Delta p_{T}/p_{T} vs #sigma(#eta)", "StandAloneMuon(STA) #Delta p_{T}/p_{T} vs #sigma(p_{T})"}; - Plot4Histograms(newDir + "/muonRecoSta.pdf", + Plot4Histograms(newDir + "/muonRecoSta", rdir, sdir, rcollname, scollname, "RecHistosSta", "Distributions for StandAloneMuons (STA)", @@ -205,7 +205,7 @@ void RecoMuonValHistoPublisher(const char* newFile="NEW_FILE",const char* refFil "StandAloneMuon(STA) #epsilon vs. #eta", "StandAloneMuon(STA) fraction vs. p", "StandAloneMuon(STA) fraction vs. #eta"}; - Plot4Histograms(newDir + "/muonRecoStaEff.pdf", + Plot4Histograms(newDir + "/muonRecoStaEff", rdir, sdir, rcollname, scollname, "RecEffHistosSta", "Distributions for StandAloneMuons (STA), efficiencies and fractions", @@ -225,7 +225,7 @@ void RecoMuonValHistoPublisher(const char* newFile="NEW_FILE",const char* refFil "TrackerMuon(TRK) #Delta p/p", "TrackerMuon(TRK) #Delta p_{T}/p_{T} vs #sigma(#eta)", "TrackerMuon(TRK) #Delta p_{T}/p_{T} vs #sigma(p_{T})"}; - Plot4Histograms(newDir + "/muonRecoTrk.pdf", + Plot4Histograms(newDir + "/muonRecoTrk", rdir, sdir, rcollname, scollname, "RecHistosTrk", "Distributions for TrackerMuons (TRK)", @@ -244,7 +244,7 @@ void RecoMuonValHistoPublisher(const char* newFile="NEW_FILE",const char* refFil "TrackerMuon(TRK) #epsilon vs. #eta", "TrackerMuon(TRK) fraction vs. p", "TrackerMuon(TRK) fraction vs. #eta"}; - Plot4Histograms(newDir + "/muonRecoTrkEff.pdf", + Plot4Histograms(newDir + "/muonRecoTrkEff", rdir, sdir, rcollname, scollname, "RecEffHistosTrk", "Distributions for TrackerMuons (TRK), efficiencies and fractions", @@ -265,7 +265,7 @@ void RecoMuonValHistoPublisher(const char* newFile="NEW_FILE",const char* refFil "Tight Muon #Delta p/p", "Tight Muon #Delta p_{T}/p_{T} vs #sigma(#eta)", "Tight Muon #Delta p_{T}/p_{T} vs #sigma(p_{T})"}; - Plot4Histograms(newDir + "/muonRecoTgt.pdf", + Plot4Histograms(newDir + "/muonRecoTgt", rdir, sdir, rcollname, scollname, "RecHistosTgt", "Distributions for Tight Muons", @@ -284,7 +284,7 @@ void RecoMuonValHistoPublisher(const char* newFile="NEW_FILE",const char* refFil "Tight Muon #epsilon vs. #eta", "Tight Muon fraction vs. p", "Tight Muon fraction vs. #eta"}; - Plot4Histograms(newDir + "/muonRecoTgtEff.pdf", + Plot4Histograms(newDir + "/muonRecoTgtEff", rdir, sdir, rcollname, scollname, "RecEffHistosTgt", "Distributions for Tight Muons, efficiencies and fractions", @@ -321,7 +321,7 @@ void RecoMuonValHistoPublisher(const char* newFile="NEW_FILE",const char* refFil cout << " ... Done" << endl; cout << ">> Deleting partial pdf files" << endl; - gSystem->Exec("rm -r "+newDir); + gSystem->Exec("rm -r "+newDir+"/*.pdf"); } // end of "while loop" diff --git a/Validation/RecoMuon/test/macro/RecoValHistoPublisher.C b/Validation/RecoMuon/test/macro/RecoValHistoPublisher.C index ae98628c0679a..392bb18f56453 100644 --- a/Validation/RecoMuon/test/macro/RecoValHistoPublisher.C +++ b/Validation/RecoMuon/test/macro/RecoValHistoPublisher.C @@ -127,7 +127,7 @@ void RecoValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="R //===== reco muon distributions: GLB_GLB const char* plots1 [] = {"GlbMuon_Glb_eta", "GlbMuon_Glb_phi", "GlbMuon_Glb_pt", "GlbMuon_Glb_chi2OverDf"}; const char* plotst1 [] = {"GlobalMuon(GLB) #eta", "GlobalMuon(GLB) #phi", "GlobalMuon(GLB) pT", "GlobalMuon(GLB) #chi^{2}/ndf"}; - Plot4Histograms(newDir + "/muonReco1.pdf", + Plot4Histograms(newDir + "/muonReco1", rdir, sdir, rcollname, scollname, "RecoHistos1", "Distributions for GlobalMuons (GLB)", @@ -142,7 +142,7 @@ void RecoValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="R Double_t minx1 [] = {-1E100,-1E100, 5., -1E100, -1E100 }; Double_t maxx1 [] = {-1E100, -1E100,maxPT, -1E100, -1E100 }; - Plot4Histograms(newDir + "/muonReco2.pdf", + Plot4Histograms(newDir + "/muonReco2", rdir, sdir, rcollname, scollname, "RecoHistos2", "Distributions for GlobalMuons (STA)", @@ -154,7 +154,7 @@ void RecoValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="R //===== reco muon distributions: GLB_TK const char* plots3 [] = {"GlbMuon_Tk_eta", "GlbMuon_Tk_phi", "GlbMuon_Tk_pt", "GlbMuon_Tk_chi2OverDf"}; const char* plotst3 [] = {"GlobalMuon(TK) #eta", "GlobalMuon(TK) #phi", "GlobalMuon(TK) pT", "GlobalMuon(TK) #chi^{2}/ndf"}; - Plot4Histograms(newDir + "/muonReco3.pdf", + Plot4Histograms(newDir + "/muonReco3", rdir, sdir, rcollname, scollname, "RecoHistos3", "Distributions for GlobalMuons (TK)", @@ -166,7 +166,7 @@ void RecoValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="R //===== reco muon distributions: STA const char* plots4 [] = {"StaMuon_eta", "StaMuon_phi", "StaMuon_pt", "StaMuon_chi2OverDf"}; const char* plotst4 [] = {"StaMuon #eta", "StaMuon #phi", "StaMuon p_T", "StaMuon #chi^{2}/ndf"}; - Plot4Histograms(newDir + "/muonReco4.pdf", + Plot4Histograms(newDir + "/muonReco4", rdir, sdir, rcollname, scollname, "RecoHistos4", "Distributions for StandAlone Muons", @@ -178,7 +178,7 @@ void RecoValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="R //===== reco muon distributions: Tracker Muons const char* plots5 [] = {"TkMuon_eta", "TkMuon_phi", "TkMuon_pt", "TkMuon_chi2OverDf"}; const char* plotst5 [] = {"TkMuon #eta", "TkMuon #phi", "TkMuon p_T", "TkMuon #chi^{2}/ndf"}; - Plot4Histograms(newDir + "/muonReco5.pdf", + Plot4Histograms(newDir + "/muonReco5", rdir, sdir, rcollname, scollname, "RecoHistos5", "Distributions for Tracker Muons", @@ -206,7 +206,7 @@ void RecoValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="R gSystem->Rename(mergefile, destfile); cout << ">> Deleting partial pdf files" << endl; - gSystem->Exec("rm -r "+newDir); + gSystem->Exec("rm -r "+newDir+"/*.pdf"); cout << " ... Done" << endl; } // end of "while loop" diff --git a/Validation/RecoMuon/test/macro/SeedValHistoPublisher.C b/Validation/RecoMuon/test/macro/SeedValHistoPublisher.C index 6ba156da72ce8..1e14cc19e186b 100644 --- a/Validation/RecoMuon/test/macro/SeedValHistoPublisher.C +++ b/Validation/RecoMuon/test/macro/SeedValHistoPublisher.C @@ -120,7 +120,7 @@ void SeedValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="R /* const char* plots [] = {"", "", "", ""}; const char* plotsl[] = {"", "", "", ""}; - Plot4Histograms(newDir + "/muonIso1.pdf", + Plot4Histograms(newDir + "/muonIso1", rdir, sdir, rcollname, scollname, "", "", @@ -132,7 +132,7 @@ void SeedValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="R //===== muon seeds plots, first page: const char* plots1 [] = {"seedEta_", "seedEtaErr_", "seedPhi_", "seedPhiErr_"}; const char* plotsl1[] = {"seed #eta", "seed #eta error", "seed #phi", "seed #phi error"}; - Plot4Histograms(newDir + "/muonSeed1.pdf", + Plot4Histograms(newDir + "/muonSeed1", rdir, sdir, rcollname, scollname, "Seeds1", "Seeds eta and phi", @@ -145,7 +145,7 @@ void SeedValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="R // NOTE: Originally in one page, now split in two pages // const char* plots2 [] = {"seedPt_", "seedPtErrOverPt_", "seedPz_", "seedPzErrOverPz_"}; // const char* plotsl2[] = {"seed P_{T}", "seed P_{T} Err/P_{T}", "seed P_{Z}", "seed P_{Z} Err/P_{Z}"}; - // Plot4Histograms(newDir + "/muonSeed2.pdf", + // Plot4Histograms(newDir + "/muonSeed2", // rdir, sdir, // rcollname, scollname, // "Seeds2", "Seeds momenta", @@ -155,7 +155,7 @@ void SeedValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="R // const char* plots3 [] = {"NumberOfRecHitsPerSeed_", "seedPErrOverP_", "", ""}; // const char* plotsl3[] = {"Nr RecHits per seed", "seed P Err/P", "", ""}; - // Plot4Histograms(newDir + "/muonSeed3.pdf", + // Plot4Histograms(newDir + "/muonSeed3", // rdir, sdir, // rcollname, scollname, // "Seeds3", "Seeds hits and momentum", @@ -169,7 +169,7 @@ void SeedValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="R "NumberOfRecHitsPerSeed_", "seedPErrOverP_"}; const char* plotsl2 [] = {"seed P_{T}", "seed P_{T} Err/P_{T}", "seed P_{Z}", "seed P_{Z} Err/P_{Z}", "Nr RecHits per seed", "seed P Err/P"}; - Plot6Histograms(newDir + "/muonSeed2.pdf", + Plot6Histograms(newDir + "/muonSeed2", rdir, sdir, rcollname, scollname, "Seeds2", "Seeds momenta and hits", @@ -194,7 +194,7 @@ void SeedValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="R gSystem->Rename(mergefile, destfile); cout << ">> Deleting partial pdf files" << endl; - gSystem->Exec("rm -r "+newDir); + gSystem->Exec("rm -r "+newDir+"/*.pdf"); cout << " ... Done" << endl; } // end of "while loop" diff --git a/Validation/RecoMuon/test/macro/TrackValHistoPublisher.C b/Validation/RecoMuon/test/macro/TrackValHistoPublisher.C index 061295e903563..2fac61fc73bbe 100644 --- a/Validation/RecoMuon/test/macro/TrackValHistoPublisher.C +++ b/Validation/RecoMuon/test/macro/TrackValHistoPublisher.C @@ -313,7 +313,7 @@ void TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile=" const char* plots0[] = {"effic", "fakerate", "efficPt", "fakeratePt"}; const char* plotsl0[] = {"efficiency vs #eta", "fakerate vs #eta", "efficiency vs Pt", "fakerate vs Pt"}; bool logy0 [] = {false, false, false, false }; - Plot4Histograms(newDir + "/building.pdf", + Plot4Histograms(newDir + "/building", rdir, sdir, rcollname, scollname, "Seeds", "Efficiency Vs Pt and Vs #eta", @@ -325,7 +325,7 @@ void TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile=" const char* plots1[] = { "effic_vs_hit", "fakerate_vs_hit","effic_vs_phi","fakerate_vs_phi"}; const char* plotsl1[] = { "efficiency vs hits", "fakerate vs hits","efficiency vs #phi","fakerate vs #phi"}; bool logy [] = {false, false, false, false }; - Plot4Histograms(newDir + "/building2.pdf", + Plot4Histograms(newDir + "/building2", rdir, sdir, rcollname, scollname, "Seeds2", "Efficiency vs hits and #phi", @@ -343,7 +343,7 @@ void TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile=" // Double_t maxx2 [] = {-1E100, -1E100, -1E100, -1E100, -1E100, -1E100 }; // Double_t miny2 [] = {0.5, -1E100, 0., -1E100, 0.5, -1E100 }; // Double_t maxy2 [] = {1.0125, -1E100, -1E100, -1E100, -1E100, -1E100 }; - Plot4Histograms(newDir + "/hitsAndPt.pdf", + Plot4Histograms(newDir + "/hitsAndPt", rdir, sdir, rcollname, scollname, "hits", "Pt", @@ -356,7 +356,7 @@ void TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile=" bool logy3 [] = {false, true, false, true }; bool doKolmo3 [] = {true, true, true, true }; const char* plots3 [] = {"chi2","chi2_prob","chi2mean", "ptres_vs_eta_Mean"}; - Plot4Histograms(newDir + "/tuning.pdf", + Plot4Histograms(newDir + "/tuning", rdir, sdir, rcollname, scollname, "IsoHistos2", "HCAL, HO Deposits", @@ -375,7 +375,7 @@ void TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile=" // Double_t maxx4 [] = {10,10,10, 10, 10, 10 }; // Double_t miny4 [] = {0., -1E100, 0., -1E100, 0, -1E100 }; // Double_t maxy4 [] = {-1E100, -1E100, -1E100, -1E100, -1E100, -1E100 }; - Plot6Histograms(newDir + "/Pulls.pdf", + Plot6Histograms(newDir + "/Pulls", rdir, sdir, rcollname, scollname, "Pullsdis", "Pull Distributions", @@ -396,7 +396,7 @@ void TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile=" // Double_t maxy5 [] = {-1E100, -1E100, -1E100, -1E100, -1E100, -1E100 }; resol= true; - Plot6Histograms(newDir + "/residuals.pdf", + Plot6Histograms(newDir + "/residuals", rdir, sdir, rcollname, scollname, "residualdis", "residuals vs Pt", @@ -414,7 +414,7 @@ void TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile=" // Double_t maxx6 [] = {-1E100, -1E100, -1E100, -1E100, -1E100, -1E100 }; // Double_t miny6 [] = {0., -1E100, 0., -1E100, 0, -1E100 }; // Double_t maxy6 [] = {-1E100, -1E100, -1E100, -1E100, -1E100, -1E100 }; - Plot5Histograms(newDir + "/residualsEta.pdf", + Plot5Histograms(newDir + "/residualsEta", rdir, sdir, rcollname, scollname, "residualsdisEta", "residuals vs Eta", @@ -431,7 +431,7 @@ void TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile=" // Double_t maxx7 [] = {-1E100, -1E100, -1E100, -1E100, -1E100, -1E100 }; // Double_t miny7 [] = {0., -1E100, 0., -1E100, 0, -1E100 }; // Double_t maxy7 [] = {-1E100, -1E100, -1E100, -1E100, -1E100, -1E100 }; - Plot5Histograms(newDir + "/meanvaluesEta.pdf", + Plot5Histograms(newDir + "/meanvaluesEta", rdir, sdir, rcollname, scollname, "meanvaluesEtadis", "mean values vs eta", @@ -451,7 +451,7 @@ void TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile=" Double_t maxx8 [] = {maxPT,maxPT,maxPT,maxPT,maxPT,maxPT}; // Double_t miny8 [] = {0., -1E100, 0., -1E100, 0, -1E100 }; // Double_t maxy8 [] = {-1E100, -1E100, -1E100, -1E100, -1E100, -1E100 }; - Plot5Histograms(newDir + "/resolutionsPt.pdf", + Plot5Histograms(newDir + "/resolutionsPt", rdir, sdir, rcollname, scollname, "resolutionsPtdis", "resolution vs pt", @@ -487,7 +487,7 @@ void TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile=" gSystem->Rename(mergefile, destfile); cout << ">> Deleting partial pdf files" << endl; - gSystem->Exec("rm -rf "+newDir); + gSystem->Exec("rm -rf "+newDir+"/*.pdf"); cout << " ... Done" << endl; } // end of "while loop" diff --git a/Validation/RecoMuon/test/macro/new_PlotHelpers.C b/Validation/RecoMuon/test/macro/new_PlotHelpers.C index 558bbc62dd54c..459d10612b426 100644 --- a/Validation/RecoMuon/test/macro/new_PlotHelpers.C +++ b/Validation/RecoMuon/test/macro/new_PlotHelpers.C @@ -526,7 +526,8 @@ void PlotNHistograms(const TString& pdfFile, l->Draw(); // Print Canvas - canvas->Print(pdfFile); + canvas->SaveAs(pdfFile+".pdf"); + canvas->SaveAs(pdfFile+".png"); // Clean memory // delete l; diff --git a/Validation/RecoMuon/test/macro/new_TrackValHistoPublisher.C b/Validation/RecoMuon/test/macro/new_TrackValHistoPublisher.C index 11b9d44edd9e2..aa8a7acea3279 100644 --- a/Validation/RecoMuon/test/macro/new_TrackValHistoPublisher.C +++ b/Validation/RecoMuon/test/macro/new_TrackValHistoPublisher.C @@ -181,7 +181,7 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi maxy[2]=1.09; maxy[3]=0.; - Plot4Histograms(newDir + "/eff_eta_phi.pdf", + Plot4Histograms(newDir + "/eff_eta_phi", rdir, sdir, rcollname, scollname, "eff_eta_phi", "Efficiency vs eta and Vs phi", @@ -222,7 +222,7 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi maxy[2]= 0.; maxy[3]= 0.; - Plot4Histograms(newDir + "/eff_pt.pdf", + Plot4Histograms(newDir + "/eff_pt", rdir, sdir, rcollname, scollname, "eff_pt", "Efficiency vs pt and sim,reco distributions", @@ -258,7 +258,7 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi maxy[2]= 0.; maxy[3]= 0.; - Plot4Histograms(newDir + "/eff_hits.pdf", + Plot4Histograms(newDir + "/eff_hits", rdir, sdir, rcollname, scollname, "eff_hits", "Efficiency vs Number of hits and hit multiplicity per track", @@ -280,7 +280,7 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi maxy[0]= 1.09; maxy[1]= 0.; - Plot4Histograms(newDir + "/eff_pu.pdf", + Plot4Histograms(newDir + "/eff_pu", rdir, sdir, rcollname, scollname, "eff_pu", "Efficiency vs n.PU interactions", @@ -309,7 +309,7 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi logy[1]=false; logy[2]=false; - Plot4Histograms(newDir + "/chi2.pdf", + Plot4Histograms(newDir + "/chi2", rdir, sdir, rcollname, scollname, "chi2", "chi2 distributions", @@ -347,7 +347,7 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi norm[4]= 2.; norm[5]= 2.; - Plot6Histograms(newDir + "/pulls.pdf", + Plot6Histograms(newDir + "/pulls", rdir, sdir, rcollname, scollname, "pulls", "pull distributions", @@ -386,7 +386,7 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi norm[4]= 2.; norm[5]= 2.; - Plot6Histograms(newDir + "/residuals.pdf", + Plot6Histograms(newDir + "/residuals", rdir, sdir, rcollname, scollname, "residuals", "residual distributions", @@ -411,7 +411,7 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi logy[4]=true; logy[5]=false; - Plot6Histograms(newDir + "/resol_eta.pdf", + Plot6Histograms(newDir + "/resol_eta", rdir, sdir, rcollname, scollname, "resol_eta", "resolutions vs eta", @@ -442,7 +442,7 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi logy[4]=true; logy[5]=false; - Plot6Histograms(newDir + "/resol_pt.pdf", + Plot6Histograms(newDir + "/resol_pt", rdir, sdir, rcollname, scollname, "resol_pt", "resolutions vs pt", @@ -478,7 +478,7 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi maxy[2]= 0.; maxy[3]= 0.; - Plot4Histograms(newDir + "/chargeMisId.pdf", + Plot4Histograms(newDir + "/chargeMisId", rdir, sdir, rcollname, scollname, "chargeMisId", "charge misId rate vs eta, pt, nhits, PU", @@ -518,7 +518,7 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi gSystem->Rename(mergefile, destfile); cout << ">> Deleting partial pdf files" << endl; - gSystem->Exec("rm -rf "+newDir); + gSystem->Exec("rm -rf "+newDir+"/*.pdf"); cout << " ... Done" << endl; } // end of "while loop" @@ -526,6 +526,9 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi /////////////////////////////////////////////////////////////////////////////// // comparison plots of Muon and Track associators on the probeTracks + TString dir_MABH_vs_TABH = newDirBase + "probeTrks_MABH_vs_TABH"; + gSystem->mkdir(dir_MABH_vs_TABH, kTRUE); + // in case of HLT or HeavyIons skip the following TString new_Sample_Name("NEW_LABEL"); @@ -585,7 +588,7 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi maxy[2]=1.09; maxy[3]=0.; - Plot4Histograms("eff_pt_eta.pdf", + Plot4Histograms(dir_MABH_vs_TABH + "/eff_pt_eta", sdir, sdir, rcollname, scollname, "eff_pt_eta_MABHvsTABH", "Efficiency vs eta and pt - Muon vs Track Associator", @@ -610,7 +613,7 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi maxy[2]=1.09; maxy[3]=0.; - Plot4Histograms("eff_phi_hits.pdf", + Plot4Histograms(dir_MABH_vs_TABH + "/eff_phi_hits", sdir, sdir, rcollname, scollname, "eff_phi_hits_MABHvsTABH", "Efficiency vs phi and N. hits - Muon vs Track Associator", @@ -632,7 +635,7 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi maxy[0]= 1.09; maxy[1]= 0.; - PlotNHistograms("eff_pu.pdf", + PlotNHistograms(dir_MABH_vs_TABH + "/eff_pu", sdir, sdir, rcollname, scollname, "eff_pu_MABHvsTABH", "Efficiency vs N.PU interactions - Muon vs Track Associator", @@ -643,16 +646,16 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi //// Merge pdf files together and rename the merged pdf after the TString _destfile = newDirBase + "probeTrks_MABH_vs_TABH" + ".pdf"; // Destination file name TString _gscommand = "gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=" + _destfile + " " - + "./eff_pt_eta.pdf " - + "./eff_phi_hits.pdf " - + "./eff_pu.pdf "; + + dir_MABH_vs_TABH + "/eff_pt_eta.pdf " + + dir_MABH_vs_TABH + "/eff_phi_hits.pdf " + + dir_MABH_vs_TABH + "/eff_pu.pdf "; cout << ">> Merging partial pdfs to " << _destfile << "..." << endl; if (DEBUG) cout << " ...with command \"" << _gscommand << "\"" << endl; gSystem->Exec(_gscommand); cout << ">> Deleting partial pdf files" << endl; - gSystem->Exec("rm -rf eff_*.pdf"); + gSystem->Exec("rm -rf "+ dir_MABH_vs_TABH +"/eff_*.pdf"); cout << " ... Done" << endl; cout << ">> Removing the relval files from ROOT before closing..." << endl; diff --git a/Validation/RecoMuon/test/new_muonReleaseSummary.py b/Validation/RecoMuon/test/new_muonReleaseSummary.py index d18d22d6687b0..37d184bc3f6e6 100644 --- a/Validation/RecoMuon/test/new_muonReleaseSummary.py +++ b/Validation/RecoMuon/test/new_muonReleaseSummary.py @@ -338,6 +338,9 @@ def getReplaceMap(newparams, refparams, sample, datatype, cfgkey, cfgfile): else: print('ERROR: Could not find "' + newpath + '/RecoMuonV.pdf') + os.system('mkdir '+newpath+'/PDF') + os.system('mv '+newpath+'/*.pdf '+newpath+'/PDF/.') + if(new_userparams.Publish): newpath = GetSamplePath(new_userparams.NewParams,sample) newlocalsample = GetLocalSampleName(new_userparams.NewParams, sample) From 33d916ed0ebb4588d2e08211ed35b96446ceac1e Mon Sep 17 00:00:00 2001 From: David Date: Wed, 21 Mar 2018 14:18:46 +0100 Subject: [PATCH 179/426] Rename HEP17 to just HE for 2018 --- DQM/HcalTasks/interface/LEDTask.h | 2 +- DQM/HcalTasks/interface/LaserTask.h | 2 +- DQM/HcalTasks/interface/PedestalTask.h | 2 +- DQM/HcalTasks/plugins/LEDTask.cc | 6 +++--- DQM/HcalTasks/plugins/LaserTask.cc | 6 +++--- DQM/HcalTasks/plugins/PedestalTask.cc | 6 +++--- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/DQM/HcalTasks/interface/LEDTask.h b/DQM/HcalTasks/interface/LEDTask.h index 276958047a18e..4211688113ef4 100644 --- a/DQM/HcalTasks/interface/LEDTask.h +++ b/DQM/HcalTasks/interface/LEDTask.h @@ -45,7 +45,7 @@ class LEDTask : public hcaldqm::DQTask // tags and tokens edm::InputTag _tagHBHE; - edm::InputTag _tagHEP17; + edm::InputTag _tagHE; edm::InputTag _tagHO; edm::InputTag _tagHF; edm::InputTag _tagTrigger; diff --git a/DQM/HcalTasks/interface/LaserTask.h b/DQM/HcalTasks/interface/LaserTask.h index 4a8c3b0ae7f58..7cd9af7bc99eb 100644 --- a/DQM/HcalTasks/interface/LaserTask.h +++ b/DQM/HcalTasks/interface/LaserTask.h @@ -50,7 +50,7 @@ class LaserTask : public hcaldqm::DQTask // tags and tokens edm::InputTag _tagHBHE; - edm::InputTag _tagHEP17; + edm::InputTag _tagHE; edm::InputTag _tagHO; edm::InputTag _tagHF; edm::InputTag _taguMN; diff --git a/DQM/HcalTasks/interface/PedestalTask.h b/DQM/HcalTasks/interface/PedestalTask.h index c0d2c96aadd74..51adbd0df7d3c 100644 --- a/DQM/HcalTasks/interface/PedestalTask.h +++ b/DQM/HcalTasks/interface/PedestalTask.h @@ -42,7 +42,7 @@ class PedestalTask : public hcaldqm::DQTask // tags and tokens edm::InputTag _tagHBHE; - edm::InputTag _tagHEP17; + edm::InputTag _tagHE; edm::InputTag _tagHO; edm::InputTag _tagHF; edm::InputTag _tagTrigger; diff --git a/DQM/HcalTasks/plugins/LEDTask.cc b/DQM/HcalTasks/plugins/LEDTask.cc index 3b3bdca70deed..0ff2f64f95dae 100644 --- a/DQM/HcalTasks/plugins/LEDTask.cc +++ b/DQM/HcalTasks/plugins/LEDTask.cc @@ -10,7 +10,7 @@ LEDTask::LEDTask(edm::ParameterSet const& ps): // tags _tagHBHE = ps.getUntrackedParameter("tagHBHE", edm::InputTag("hcalDigis")); - _tagHEP17 = ps.getUntrackedParameter("tagHEP17", + _tagHE = ps.getUntrackedParameter("tagHE", edm::InputTag("hcalDigis")); _tagHO = ps.getUntrackedParameter("tagHO", edm::InputTag("hcalDigis")); @@ -19,7 +19,7 @@ LEDTask::LEDTask(edm::ParameterSet const& ps): _tagTrigger = ps.getUntrackedParameter("tagTrigger", edm::InputTag("tbunpacker")); _tokHBHE = consumes(_tagHBHE); - _tokHEP17 = consumes(_tagHEP17); + _tokHEP17 = consumes(_tagHE); _tokHO = consumes(_tagHO); _tokHF = consumes(_tagHF); _tokTrigger = consumes(_tagTrigger); @@ -306,7 +306,7 @@ LEDTask::LEDTask(edm::ParameterSet const& ps): + _tagHF.label() + " " + _tagHF.instance()); if (!e.getByToken(_tokHEP17, chep17)) _logger.dqmthrow("Collection QIE11DigiCollection isn't available " - + _tagHEP17.label() + " " + _tagHEP17.instance()); + + _tagHE.label() + " " + _tagHE.instance()); // int currentEvent = e.eventAuxiliary().id().event(); diff --git a/DQM/HcalTasks/plugins/LaserTask.cc b/DQM/HcalTasks/plugins/LaserTask.cc index cbaec5ac7daf4..45a2a0eb73d89 100644 --- a/DQM/HcalTasks/plugins/LaserTask.cc +++ b/DQM/HcalTasks/plugins/LaserTask.cc @@ -12,7 +12,7 @@ LaserTask::LaserTask(edm::ParameterSet const& ps): // tags _tagHBHE = ps.getUntrackedParameter("tagHBHE", edm::InputTag("hcalDigis")); - _tagHEP17 = ps.getUntrackedParameter("tagHEP17", + _tagHE = ps.getUntrackedParameter("tagHE", edm::InputTag("hcalDigis")); _tagHO = ps.getUntrackedParameter("tagHO", edm::InputTag("hcalDigis")); @@ -21,7 +21,7 @@ LaserTask::LaserTask(edm::ParameterSet const& ps): _taguMN = ps.getUntrackedParameter("taguMN", edm::InputTag("hcalDigis")); _tokHBHE = consumes(_tagHBHE); - _tokHEP17 = consumes(_tagHEP17); + _tokHEP17 = consumes(_tagHE); _tokHO = consumes(_tagHO); _tokHF = consumes(_tagHF); _tokuMN = consumes(_taguMN); @@ -350,7 +350,7 @@ LaserTask::LaserTask(edm::ParameterSet const& ps): + _tagHBHE.label() + " " + _tagHBHE.instance()); if (!e.getByToken(_tokHEP17, chep17)) _logger.dqmthrow("Collection QIE11DigiCollection isn't available " - + _tagHEP17.label() + " " + _tagHEP17.instance()); + + _tagHE.label() + " " + _tagHE.instance()); if (!e.getByToken(_tokHO, cho)) _logger.dqmthrow("Collection HODigiCollection isn't available " + _tagHO.label() + " " + _tagHO.instance()); diff --git a/DQM/HcalTasks/plugins/PedestalTask.cc b/DQM/HcalTasks/plugins/PedestalTask.cc index 4dfb1abb7e6a3..2add7f03ce4c7 100644 --- a/DQM/HcalTasks/plugins/PedestalTask.cc +++ b/DQM/HcalTasks/plugins/PedestalTask.cc @@ -9,7 +9,7 @@ PedestalTask::PedestalTask(edm::ParameterSet const& ps): // tags _tagHBHE = ps.getUntrackedParameter("tagHBHE", edm::InputTag("hcalDigis")); - _tagHEP17 = ps.getUntrackedParameter("tagHEP17", + _tagHE = ps.getUntrackedParameter("tagHE", edm::InputTag("hcalDigis")); _tagHO = ps.getUntrackedParameter("tagHO", edm::InputTag("hcalDigis")); @@ -20,7 +20,7 @@ PedestalTask::PedestalTask(edm::ParameterSet const& ps): _taguMN = ps.getUntrackedParameter("taguMN", edm::InputTag("hcalDigis")); _tokHBHE = consumes(_tagHBHE); - _tokHEP17 = consumes(_tagHEP17); + _tokHEP17 = consumes(_tagHE); _tokHO = consumes(_tagHO); _tokHF = consumes(_tagHF); _tokTrigger = consumes(_tagTrigger); @@ -859,7 +859,7 @@ PedestalTask::PedestalTask(edm::ParameterSet const& ps): + _tagHF.label() + " " + _tagHF.instance()); if (!e.getByToken(_tokHEP17, chep17)) _logger.dqmthrow("Collection QIE11DigiCollection isn't available" - + _tagHEP17.label() + " " + _tagHEP17.instance()); + + _tagHE.label() + " " + _tagHE.instance()); int nHB(0), nHE(0), nHO(0), nHF(0); for (HBHEDigiCollection::const_iterator it=chbhe->begin(); From 64d3f5d839c9c92e2779ff7547f87b7f6f87af12 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 21 Mar 2018 14:19:09 +0100 Subject: [PATCH 180/426] Integrate QIE11Task into DigiTask, and fill all plots for HE --- DQM/HcalTasks/interface/DigiTask.h | 36 +-- DQM/HcalTasks/plugins/DigiTask.cc | 242 +++++++++--------- .../clients/hcal_dqm_sourceclient-live_cfg.py | 10 +- 3 files changed, 146 insertions(+), 142 deletions(-) diff --git a/DQM/HcalTasks/interface/DigiTask.h b/DQM/HcalTasks/interface/DigiTask.h index a3ca5002c6993..0419140cea16a 100644 --- a/DQM/HcalTasks/interface/DigiTask.h +++ b/DQM/HcalTasks/interface/DigiTask.h @@ -44,15 +44,15 @@ class DigiTask : public hcaldqm::DQTask void _resetMonitors(hcaldqm::UpdateFreq) override; edm::InputTag _tagHBHE; - edm::InputTag _tagHEP17; + edm::InputTag _tagHE; edm::InputTag _tagHO; edm::InputTag _tagHF; edm::EDGetTokenT _tokHBHE; - edm::EDGetTokenT _tokHEP17; + edm::EDGetTokenT _tokHE; edm::EDGetTokenT _tokHO; edm::EDGetTokenT _tokHF; - double _cutSumQ_HBHE, _cutSumQ_HEP17, _cutSumQ_HO, _cutSumQ_HF; + double _cutSumQ_HBHE, _cutSumQ_HE, _cutSumQ_HO, _cutSumQ_HF; double _thresh_unihf; // flag vector @@ -79,8 +79,8 @@ class DigiTask : public hcaldqm::DQTask hcaldqm::filter::HashFilter _filter_VME; hcaldqm::filter::HashFilter _filter_uTCA; hcaldqm::filter::HashFilter _filter_FEDHF; - hcaldqm::filter::HashFilter _filter_HF; - hcaldqm::filter::HashFilter _filter_notHF; + hcaldqm::filter::HashFilter _filter_QIE1011; + hcaldqm::filter::HashFilter _filter_QIE8; hcaldqm::filter::HashFilter _filter_HEP17; /* hcaldqm::Containers */ @@ -93,17 +93,17 @@ class DigiTask : public hcaldqm::DQTask hcaldqm::ContainerProf1D _cSumQvsBX_SubdetPM; // online only! // ADC, fC for HF (QIE10 has different ADC/fC) - hcaldqm::Container1D _cADC_SubdetPM_HF; - hcaldqm::Container1D _cfC_SubdetPM_HF; - hcaldqm::Container1D _cSumQ_SubdetPM_HF; - hcaldqm::ContainerProf1D _cSumQvsLS_SubdetPM_HF; - hcaldqm::ContainerProf1D _cSumQvsBX_SubdetPM_HF; // online only! + hcaldqm::Container1D _cADC_SubdetPM_QIE1011; + hcaldqm::Container1D _cfC_SubdetPM_QIE1011; + hcaldqm::Container1D _cSumQ_SubdetPM_QIE1011; + hcaldqm::ContainerProf1D _cSumQvsLS_SubdetPM_QIE1011; + hcaldqm::ContainerProf1D _cSumQvsBX_SubdetPM_QIE1011; // online only! // Shape - just filling - not summary! hcaldqm::Container1D _cShapeCut_FED; hcaldqm::Container2D _cADCvsTS_SubdetPM; - hcaldqm::Container2D _cADCvsTS_SubdetPM_HF; + hcaldqm::Container2D _cADCvsTS_SubdetPM_QIE1011; // Timing // just filling - no summary! @@ -143,7 +143,7 @@ class DigiTask : public hcaldqm::DQTask hcaldqm::Container2D _cOccupancyCut_depth; hcaldqm::Container1D _cOccupancyCutvsiphi_SubdetPM; // online only hcaldqm::Container1D _cOccupancyCutvsieta_Subdet; // online only - hcaldqm::Container2D _cOccupancyCutvsSlotvsLS_HFPM; // online only + //hcaldqm::Container2D _cOccupancyCutvsSlotvsLS_HFPM; // online only hcaldqm::Container2D _cOccupancyCutvsiphivsLS_SubdetPM; // online only // Occupancy w/o and w/ a Cut vs BX and vs LS @@ -167,14 +167,14 @@ class DigiTask : public hcaldqm::DQTask hcaldqm::Container1D _cLETDCTime_SubdetPM; // Bad TDC histograms - hcaldqm::Container1D _cBadTDCValues_SubdetPM_HF; - hcaldqm::Container1D _cBadTDCvsBX_SubdetPM_HF; - hcaldqm::Container1D _cBadTDCvsLS_SubdetPM_HF; + hcaldqm::Container1D _cBadTDCValues_SubdetPM; + hcaldqm::Container1D _cBadTDCvsBX_SubdetPM; + hcaldqm::Container1D _cBadTDCvsLS_SubdetPM; hcaldqm::Container2D _cBadTDCCount_depth; - hcaldqm::Container1D _cBadTDCValues_SubdetPM_HEP17; - hcaldqm::Container1D _cBadTDCvsBX_SubdetPM_HEP17; - hcaldqm::Container1D _cBadTDCvsLS_SubdetPM_HEP17; + hcaldqm::Container1D _cBadTDCValues; + hcaldqm::Container1D _cBadTDCvsBX; + hcaldqm::Container1D _cBadTDCvsLS; // #events counters MonitorElement *meNumEvents1LS; // to transfer the #events to harvesting diff --git a/DQM/HcalTasks/plugins/DigiTask.cc b/DQM/HcalTasks/plugins/DigiTask.cc index e7ca5855988da..d31e754b9f5f0 100644 --- a/DQM/HcalTasks/plugins/DigiTask.cc +++ b/DQM/HcalTasks/plugins/DigiTask.cc @@ -9,7 +9,7 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): { _tagHBHE = ps.getUntrackedParameter("tagHBHE", edm::InputTag("hcalDigis")); - _tagHEP17 = ps.getUntrackedParameter("tagHEP17", + _tagHE = ps.getUntrackedParameter("tagHE", edm::InputTag("hcalDigis")); _tagHO = ps.getUntrackedParameter("tagHO", edm::InputTag("hcalDigis")); @@ -17,12 +17,12 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): edm::InputTag("hcalDigis")); _tokHBHE = consumes(_tagHBHE); - _tokHEP17 = consumes(_tagHEP17); + _tokHE = consumes(_tagHE); _tokHO = consumes(_tagHO); _tokHF = consumes(_tagHF); _cutSumQ_HBHE = ps.getUntrackedParameter("cutSumQ_HBHE", 20); - _cutSumQ_HEP17 = ps.getUntrackedParameter("cutSumQ_HEP17", 20); + _cutSumQ_HE = ps.getUntrackedParameter("cutSumQ_HE", 20); _cutSumQ_HO = ps.getUntrackedParameter("cutSumQ_HO", 20); _cutSumQ_HF = ps.getUntrackedParameter("cutSumQ_HF", 20); _thresh_unihf = ps.getUntrackedParameter("thresh_unihf", 0.2); @@ -63,20 +63,14 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): _filter_uTCA.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, vuTCA); - // Filters for HEP17 and HF, aka QIE10/11 - std::vector vhashHF; - vhashHF.push_back(hcaldqm::hashfunctions::hash_did[hcaldqm::hashfunctions::fSubdet](HcalDetId(HcalForward, 29,1,1))); - _filter_HF.initialize(filter::fPreserver, hcaldqm::hashfunctions::fSubdet, - vhashHF); - _filter_notHF.initialize(filter::fFilter, hcaldqm::hashfunctions::fSubdet, - vhashHF); - - std::vector vhashHEP17; - vhashHEP17.push_back(HcalDetId(HcalEndcap, 1, 63, 1)); - vhashHEP17.push_back(HcalDetId(HcalEndcap, 1, 64, 1)); - vhashHEP17.push_back(HcalDetId(HcalEndcap, 1, 65, 1)); - vhashHEP17.push_back(HcalDetId(HcalEndcap, 1, 66, 1)); - _filter_HEP17.initialize(filter::fPreserver, hcaldqm::hashfunctions::fSubdetPMiphi, vhashHEP17); + // Filters for QIE8 vs QIE10/11 + std::vector vhashQIE1011; + vhashQIE1011.push_back(hcaldqm::hashfunctions::hash_did[hcaldqm::hashfunctions::fSubdet](HcalDetId(HcalEndcap, 20,1,1))); + vhashQIE1011.push_back(hcaldqm::hashfunctions::hash_did[hcaldqm::hashfunctions::fSubdet](HcalDetId(HcalForward, 29,1,1))); + _filter_QIE1011.initialize(filter::fPreserver, hcaldqm::hashfunctions::fSubdet, + vhashQIE1011); + _filter_QIE8.initialize(filter::fFilter, hcaldqm::hashfunctions::fSubdet, + vhashQIE1011); // INITIALIZE FIRST _cADC_SubdetPM.initialize(_name, "ADC", hcaldqm::hashfunctions::fSubdetPM, @@ -97,16 +91,16 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): new hcaldqm::quantity::LumiSection(_maxLS), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_10000),0); - _cADC_SubdetPM_HF.initialize(_name, "ADC", hcaldqm::hashfunctions::fSubdetPM, + _cADC_SubdetPM_QIE1011.initialize(_name, "ADC", hcaldqm::hashfunctions::fSubdetPM, new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cfC_SubdetPM_HF.initialize(_name, "fC", hcaldqm::hashfunctions::fSubdetPM, + _cfC_SubdetPM_QIE1011.initialize(_name, "fC", hcaldqm::hashfunctions::fSubdetPM, new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_10000), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cSumQ_SubdetPM_HF.initialize(_name, "SumQ", hcaldqm::hashfunctions::fSubdetPM, + _cSumQ_SubdetPM_QIE1011.initialize(_name, "SumQ", hcaldqm::hashfunctions::fSubdetPM, new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_10000), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cSumQvsLS_SubdetPM_HF.initialize(_name, "SumQvsLS", + _cSumQvsLS_SubdetPM_QIE1011.initialize(_name, "SumQvsLS", hcaldqm::hashfunctions::fSubdetPM, new hcaldqm::quantity::LumiSection(_maxLS), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_10000),0); @@ -157,11 +151,12 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_128), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cADCvsTS_SubdetPM_HF.initialize(_name, "ADCvsTS", + _cADCvsTS_SubdetPM_QIE1011.initialize(_name, "ADCvsTS", hcaldqm::hashfunctions::fSubdetPM, new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); + _cLETDCTimevsADC_SubdetPM.initialize(_name, "LETDCTimevsADC", hcaldqm::hashfunctions::fSubdetPM, new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256), @@ -181,15 +176,16 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): hcaldqm::hashfunctions::fSubdetPM, new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTime_ns_250), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); - _cBadTDCValues_SubdetPM_HF.initialize(_name, "BadTDCValues", + + _cBadTDCValues_SubdetPM.initialize(_name, "BadTDCValues", hcaldqm::hashfunctions::fSubdetPM, new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBadTDC), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); - _cBadTDCvsBX_SubdetPM_HF.initialize(_name, "BadTDCvsBX", + _cBadTDCvsBX_SubdetPM.initialize(_name, "BadTDCvsBX", hcaldqm::hashfunctions::fSubdetPM, new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); - _cBadTDCvsLS_SubdetPM_HF.initialize(_name, "BadTDCvsLS", + _cBadTDCvsLS_SubdetPM.initialize(_name, "BadTDCvsLS", hcaldqm::hashfunctions::fSubdetPM, new hcaldqm::quantity::LumiSection(_maxLS), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); @@ -198,18 +194,6 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cBadTDCValues_SubdetPM_HEP17.initialize(_name, "BadTDCValues", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBadTDC), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); - _cBadTDCvsBX_SubdetPM_HEP17.initialize(_name, "BadTDCvsBX", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); - _cBadTDCvsLS_SubdetPM_HEP17.initialize(_name, "BadTDCvsLS", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); if (_ptype == fOnline || _ptype == fLocal) { _cOccupancy_Crate.initialize(_name, @@ -236,7 +220,7 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): hcaldqm::hashfunctions::fSubdetPM, new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_10000),0); - _cSumQvsBX_SubdetPM_HF.initialize(_name, "SumQvsBX", + _cSumQvsBX_SubdetPM_QIE1011.initialize(_name, "SumQvsBX", hcaldqm::hashfunctions::fSubdetPM, new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_10000),0); @@ -428,18 +412,18 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): char cutstr2[200]; sprintf(cutstr2, "_SumQHF%d", int(_cutSumQ_HF)); - _cADC_SubdetPM.book(ib, _emap, _filter_notHF, _subsystem); - _cADC_SubdetPM_HF.book(ib, _emap, _filter_HF, _subsystem); - _cfC_SubdetPM.book(ib, _emap, _filter_notHF, _subsystem); - _cfC_SubdetPM_HF.book(ib, _emap, _filter_HF, _subsystem); - _cSumQ_SubdetPM.book(ib, _emap, _filter_notHF, _subsystem); - _cSumQ_SubdetPM_HF.book(ib, _emap, _filter_HF, _subsystem); + _cADC_SubdetPM.book(ib, _emap, _filter_QIE8, _subsystem); + _cADC_SubdetPM_QIE1011.book(ib, _emap, _filter_QIE1011, _subsystem); + _cfC_SubdetPM.book(ib, _emap, _filter_QIE8, _subsystem); + _cfC_SubdetPM_QIE1011.book(ib, _emap, _filter_QIE1011, _subsystem); + _cSumQ_SubdetPM.book(ib, _emap, _filter_QIE8, _subsystem); + _cSumQ_SubdetPM_QIE1011.book(ib, _emap, _filter_QIE1011, _subsystem); _cSumQ_depth.book(ib, _emap, _subsystem); - _cSumQvsLS_SubdetPM.book(ib, _emap, _filter_notHF, _subsystem); - _cSumQvsLS_SubdetPM_HF.book(ib, _emap, _filter_HF, _subsystem); + _cSumQvsLS_SubdetPM.book(ib, _emap, _filter_QIE8, _subsystem); + _cSumQvsLS_SubdetPM_QIE1011.book(ib, _emap, _filter_QIE1011, _subsystem); _cDigiSize_Crate.book(ib, _emap, _subsystem); - _cADCvsTS_SubdetPM.book(ib, _emap, _filter_notHF, _subsystem); - _cADCvsTS_SubdetPM_HF.book(ib, _emap, _filter_HF, _subsystem); + _cADCvsTS_SubdetPM.book(ib, _emap, _filter_QIE8, _subsystem); + _cADCvsTS_SubdetPM_QIE1011.book(ib, _emap, _filter_QIE1011, _subsystem); if (_ptype != fOffline) { // hidefed2crate _cShapeCut_FED.book(ib, _emap, _subsystem); @@ -467,17 +451,15 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): _cOccupancy_depth.book(ib, _emap, _subsystem); _cOccupancyCut_depth.book(ib, _emap, _subsystem); - _cLETDCTimevsADC_SubdetPM.book(ib, _emap, _filter_HF, _subsystem); - _cLETDCvsADC_SubdetPM.book(ib, _emap, _filter_HF, _subsystem); - _cLETDCvsTS_SubdetPM.book(ib, _emap, _filter_HF, _subsystem); - _cLETDCTime_SubdetPM.book(ib, _emap, _filter_HF, _subsystem); - _cBadTDCValues_SubdetPM_HF.book(ib, _emap, _filter_HF, _subsystem); - _cBadTDCvsBX_SubdetPM_HF.book(ib, _emap, _filter_HF, _subsystem); - _cBadTDCvsLS_SubdetPM_HF.book(ib, _emap, _filter_HF, _subsystem); - _cBadTDCCount_depth.book(ib, _emap, _filter_HF, _subsystem); - _cBadTDCValues_SubdetPM_HEP17.book(ib, _emap, _filter_HEP17, _subsystem); - _cBadTDCvsBX_SubdetPM_HEP17.book(ib, _emap, _filter_HEP17, _subsystem); - _cBadTDCvsLS_SubdetPM_HEP17.book(ib, _emap, _filter_HEP17, _subsystem); + _cLETDCTimevsADC_SubdetPM.book(ib, _emap, _subsystem); + _cLETDCvsADC_SubdetPM.book(ib, _emap, _subsystem); + _cLETDCvsTS_SubdetPM.book(ib, _emap, _subsystem); + _cLETDCTime_SubdetPM.book(ib, _emap, _subsystem); + + _cBadTDCValues_SubdetPM.book(ib, _emap, _subsystem); + _cBadTDCvsBX_SubdetPM.book(ib, _emap, _subsystem); + _cBadTDCvsLS_SubdetPM.book(ib, _emap, _subsystem); + _cBadTDCCount_depth.book(ib, _emap, _subsystem); // BOOK HISTOGRAMS that are only for Online _ehashmap.initialize(_emap, electronicsmap::fD2EHashMap); @@ -491,8 +473,8 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): if (_ptype==fOnline) { _cQ2Q12CutvsLS_FEDHF.book(ib, _emap, _filter_FEDHF, _subsystem); - _cSumQvsBX_SubdetPM.book(ib, _emap, _filter_notHF, _subsystem); - _cSumQvsBX_SubdetPM_HF.book(ib, _emap, _filter_HF, _subsystem); + _cSumQvsBX_SubdetPM.book(ib, _emap, _filter_QIE8, _subsystem); + _cSumQvsBX_SubdetPM_QIE1011.book(ib, _emap, _filter_QIE1011, _subsystem); _cDigiSizevsLS_FED.book(ib, _emap, _subsystem); _cTimingCutvsiphi_SubdetPM.book(ib, _emap, _subsystem); _cTimingCutvsieta_Subdet.book(ib, _emap, _subsystem); @@ -502,7 +484,7 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): _cOccupancyvsieta_Subdet.book(ib, _emap, _subsystem); _cOccupancyCutvsiphi_SubdetPM.book(ib, _emap, _subsystem); _cOccupancyCutvsieta_Subdet.book(ib, _emap, _subsystem); -// _cOccupancyCutvsSlotvsLS_HFPM.book(ib, _emap, _filter_HF, _subsystem); +// _cOccupancyCutvsSlotvsLS_HFPM.book(ib, _emap, _filter_QIE1011, _subsystem); _cOccupancyCutvsiphivsLS_SubdetPM.book(ib, _emap, _subsystem); _cSummaryvsLS_FED.book(ib, _emap, _subsystem); _cSummaryvsLS.book(ib, _subsystem); @@ -583,16 +565,16 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): edm::EventSetup const&) { edm::Handle chbhe; - edm::Handle chep17; + edm::Handle che_qie11; edm::Handle cho; edm::Handle chf; if (!e.getByToken(_tokHBHE, chbhe)) _logger.dqmthrow("Collection HBHEDigiCollection isn't available" + _tagHBHE.label() + " " + _tagHBHE.instance()); - if (!e.getByToken(_tokHEP17, chep17)) - _logger.dqmthrow("Collection HEP17DigiCollection isn't available" - + _tagHEP17.label() + " " + _tagHEP17.instance()); + if (!e.getByToken(_tokHE, che_qie11)) + _logger.dqmthrow("Collection QIE11DigiCollection isn't available" + + _tagHE.label() + " " + _tagHE.instance()); if (!e.getByToken(_tokHO, cho)) _logger.dqmthrow("Collection HODigiCollection isn't available" + _tagHO.label() + " " + _tagHO.instance()); @@ -733,15 +715,8 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): did.subdet()==HcalBarrel?numChs++:numChsHE++; } - // HEP17 collection - // The following are filled w.r.t. HBHE digis - // - All eta-phi maps - // - Occupancy in electronics coordinates - // - Digi size - // - // The following are not filled: - // - ADC, fC, sumQ, timing. These are different for QIE11 vs. QIE8. Find them in QIE11Task instead. - for (QIE11DigiCollection::const_iterator it=chep17->begin(); it!=chep17->end(); + // HE QIE11 collection + for (QIE11DigiCollection::const_iterator it=che_qie11->begin(); it!=che_qie11->end(); ++it) { const QIE11DataFrame digi = static_cast(*it); @@ -752,12 +727,11 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): if (rawid==0) {meUnknownIds1LS->Fill(1); _unknownIdsPresent=true;continue;} HcalElectronicsId const& eid(rawid); - if (did.subdet()==HcalBarrel) // Note: since this is HEP17, we obviously expect did.subdet() always to be HcalEndcap, but QIE11DigiCollection may someday expand. + if (did.subdet()==HcalBarrel) // Note: since this is HE, we obviously expect did.subdet() always to be HcalEndcap, but QIE11DigiCollection may someday expand. rawidHBValid = did.rawId(); else if (did.subdet()==HcalEndcap) rawidHEValid = did.rawId(); - //double sumQ = hcaldqm::utilities::sumQ_v10(digi, 2.5, 0, digi.samples()-1); CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB(_dbService, did, digi); double sumQ = hcaldqm::utilities::sumQDB(_dbService, digi_fC, did, digi, 0, digi.samples()-1); @@ -771,7 +745,12 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): continue; } + _cSumQ_SubdetPM.fill(did, sumQ); _cOccupancy_depth.fill(did); + if (_ptype == fOnline || _ptype == fLocal) { + _cOccupancy_Crate.fill(eid); + _cOccupancy_CrateSlot.fill(eid); + } if (_ptype==fOnline) { _cDigiSizevsLS_FED.fill(eid, _currentLS, digi.samples()); @@ -801,27 +780,49 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): } } for (int i=0; i(_dbService, digi_fC, did, digi, i); + _cADC_SubdetPM_QIE1011.fill(did, digi[i].adc()); + _cfC_SubdetPM_QIE1011.fill(did, q); + _cLETDCvsADC_SubdetPM.fill(did, digi[i].adc(), digi[i].tdc()); + _cLETDCvsTS_SubdetPM.fill(did, (int)i, digi[i].tdc()); + if (digi[i].tdc() <50) { + double time = i*25. + (digi[i].tdc() / 2.); + _cLETDCTime_SubdetPM.fill(did, time); + _cLETDCTimevsADC_SubdetPM.fill(did, digi[i].adc(), time); } + // Bad TDC values: 50-61 should never happen in QIE10 or QIE11, but we saw some in 2017 data. + if ((50 <= digi[i].tdc()) && (digi[i].tdc() <= 61)) { + _cBadTDCValues_SubdetPM.fill(did, digi[i].tdc()); + _cBadTDCvsBX_SubdetPM.fill(did, bx); + _cBadTDCvsLS_SubdetPM.fill(did, _currentLS); + _cBadTDCCount_depth.fill(did); + } + if (_ptype != fOffline) { // hidefed2crate + _cADCvsTS_SubdetPM_QIE1011.fill(did, i, q); + if (sumQ>_cutSumQ_HE) { + _cShapeCut_FED.fill(eid, i, q); + } + } } - if (sumQ>_cutSumQ_HEP17) + if (sumQ>_cutSumQ_HE) { //double timing = hcaldqm::utilities::aveTS_v10(digi, 2.5, 0,digi.samples()-1); double timing = hcaldqm::utilities::aveTSDB(_dbService, digi_fC, did, digi, 0, digi.samples()-1); - - _cOccupancyCut_depth.fill(did); + _cTimingCut_SubdetPM.fill(did, timing); _cTimingCut_depth.fill(did, timing); + _cOccupancyCut_depth.fill(did); + _cTimingCutvsLS_SubdetPM.fill(did, _currentLS, timing); + if (_ptype != fOffline) { // hidefed2crate + _cTimingCutvsLS_FED.fill(eid, _currentLS, timing); + } _cSumQ_depth.fill(did, sumQ); + _cSumQvsLS_SubdetPM_QIE1011.fill(did, _currentLS, sumQ); if (_ptype==fOnline) { + _cSumQvsBX_SubdetPM_QIE1011.fill(did, bx, sumQ); + _cTimingCutvsiphi_SubdetPM.fill(did, timing); + _cTimingCutvsieta_Subdet.fill(did, timing); _cOccupancyCutvsiphi_SubdetPM.fill(did); _cOccupancyCutvsieta_Subdet.fill(did); _cOccupancyCutvsiphivsLS_SubdetPM.fill(did, _currentLS); @@ -829,11 +830,15 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): if (_ptype != fOffline) { // hidefed2crate if (eid.isVMEid()) { + _cTimingCut_FEDVME.fill(eid, timing); + _cTimingCut_ElectronicsVME.fill(eid, timing); _cOccupancyCut_FEDVME.fill(eid); _cOccupancyCut_ElectronicsVME.fill(eid); } else { + _cTimingCut_FEDuTCA.fill(eid, timing); + _cTimingCut_ElectronicsuTCA.fill(eid, timing); _cOccupancyCut_FEDuTCA.fill(eid); _cOccupancyCut_ElectronicsuTCA.fill(eid); } @@ -1038,9 +1043,9 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): cs.isBitSet(HcalChannelStatus::HcalCellDead)) continue; } - if (!_filter_HF.filter(did)) { - _cSumQ_SubdetPM_HF.fill(did, sumQ); - } + //if (!_filter_QIE1011.filter(did)) { + _cSumQ_SubdetPM_QIE1011.fill(did, sumQ); + //} _cOccupancy_depth.fill(did); if (_ptype==fOnline) { @@ -1075,31 +1080,30 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): for (int i=0; i(_dbService, digi_fC, did, digi, i); - if (!_filter_HF.filter(did)) { - _cADC_SubdetPM_HF.fill(did, digi[i].adc()); - _cfC_SubdetPM_HF.fill(did, q); - _cLETDCvsADC_SubdetPM.fill(did, digi[i].adc(), digi[i].le_tdc()); - _cLETDCvsTS_SubdetPM.fill(did, (int)i, digi[i].le_tdc()); - if (digi[i].le_tdc() <50) { - double time = i*25. + (digi[i].le_tdc() / 2.); - _cLETDCTime_SubdetPM.fill(did, time); - _cLETDCTimevsADC_SubdetPM.fill(did, digi[i].adc(), time); - } - - // Bad TDC values: 50-61 should never happen in QIE10 or QIE11, but we are seeing some in 2017 data. - if ((50 <= digi[i].le_tdc()) && (digi[i].le_tdc() <= 61)) { - _cBadTDCValues_SubdetPM_HF.fill(did, digi[i].le_tdc()); - _cBadTDCvsBX_SubdetPM_HF.fill(did, bx); - _cBadTDCvsLS_SubdetPM_HF.fill(did, _currentLS); - _cBadTDCCount_depth.fill(did); - } + //if (!_filter_QIE1011.filter(did)) { + _cADC_SubdetPM_QIE1011.fill(did, digi[i].adc()); + _cfC_SubdetPM_QIE1011.fill(did, q); + _cLETDCvsADC_SubdetPM.fill(did, digi[i].adc(), digi[i].le_tdc()); + _cLETDCvsTS_SubdetPM.fill(did, (int)i, digi[i].le_tdc()); + if (digi[i].le_tdc() <50) { + double time = i*25. + (digi[i].le_tdc() / 2.); + _cLETDCTime_SubdetPM.fill(did, time); + _cLETDCTimevsADC_SubdetPM.fill(did, digi[i].adc(), time); } + // Bad TDC values: 50-61 should never happen in QIE10 or QIE11, but we are seeing some in 2017 data. + if ((50 <= digi[i].le_tdc()) && (digi[i].le_tdc() <= 61)) { + _cBadTDCValues_SubdetPM.fill(did, digi[i].le_tdc()); + _cBadTDCvsBX_SubdetPM.fill(did, bx); + _cBadTDCvsLS_SubdetPM.fill(did, _currentLS); + _cBadTDCCount_depth.fill(did); + } if (_ptype != fOffline) { // hidefed2crate - _cADCvsTS_SubdetPM_HF.fill(did, (int)i, q); + _cADCvsTS_SubdetPM_QIE1011.fill(did, (int)i, q); if (sumQ>_cutSumQ_HF) _cShapeCut_FED.fill(eid, (int)i, q); } + //} } if (sumQ>_cutSumQ_HF) @@ -1110,14 +1114,17 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): double q2 = hcaldqm::utilities::adc2fCDBMinusPedestal(_dbService, digi_fC, did, digi, 2); double q2q12 = q2/(q1+q2); _cSumQ_depth.fill(did, sumQ); - if (!_filter_HF.filter(did)) { - _cSumQvsLS_SubdetPM_HF.fill(did, _currentLS, sumQ); - } + //if (!_filter_QIE1011.filter(did)) { + _cSumQvsLS_SubdetPM_QIE1011.fill(did, _currentLS, sumQ); + //} + _cTimingCut_SubdetPM.fill(did, timing); + _cTimingCut_depth.fill(did, timing); + _cTimingCutvsLS_SubdetPM.fill(did, _currentLS, timing); if (_ptype==fOnline) { - if (!_filter_HF.filter(did)) { - _cSumQvsBX_SubdetPM_HF.fill(did, bx, sumQ); - } + //if (!_filter_QIE1011.filter(did)) { + _cSumQvsBX_SubdetPM_QIE1011.fill(did, bx, sumQ); + //} _cTimingCutvsiphi_SubdetPM.fill(did, timing); _cTimingCutvsieta_Subdet.fill(did, timing); _cOccupancyCutvsiphi_SubdetPM.fill(did); @@ -1126,9 +1133,6 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): // _cOccupancyCutvsSlotvsLS_HFPM.fill(did, _currentLS); _xUniHF.get(eid)++; } - _cTimingCut_SubdetPM.fill(did, timing); - _cTimingCut_depth.fill(did, timing); - _cTimingCutvsLS_SubdetPM.fill(did, _currentLS, timing); if (_ptype != fOffline) { // hidefed2crate _cTimingCutvsLS_FED.fill(eid, _currentLS, timing); } diff --git a/DQM/Integration/python/clients/hcal_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/hcal_dqm_sourceclient-live_cfg.py index f6dae40b9e1ed..fca7fe6b115ae 100644 --- a/DQM/Integration/python/clients/hcal_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/hcal_dqm_sourceclient-live_cfg.py @@ -113,7 +113,7 @@ process.load('DQM.HcalTasks.RawTask') process.load('DQM.HcalTasks.NoCQTask') #process.load('DQM.HcalTasks.ZDCTask') -process.load('DQM.HcalTasks.QIE11Task') +#process.load('DQM.HcalTasks.QIE11Task') # 2018: integrate QIE11Task into DigiTask process.load('DQM.HcalTasks.HcalOnlineHarvesting') #------------------------------------- @@ -149,9 +149,9 @@ #process.zdcTask.runkeyVal = runType #process.zdcTask.runkeyName = runTypeName #process.zdcTask.tagQIE10 = cms.untracked.InputTag("castorDigis") -process.qie11Task.runkeyVal = runType -process.qie11Task.runkeyName = runTypeName -process.qie11Task.tagQIE11 = cms.untracked.InputTag("hcalDigis") +#process.qie11Task.runkeyVal = runType +#process.qie11Task.runkeyName = runTypeName +#process.qie11Task.tagQIE11 = cms.untracked.InputTag("hcalDigis") #------------------------------------- # Hcal DQM Tasks/Clients Sequences Definition @@ -161,7 +161,7 @@ +process.digiTask +process.tpTask +process.nocqTask - +process.qie11Task + #+process.qie11Task #ZDC to be removed for 2017 pp running #+process.zdcTask ) From 7c7f57939898ffaa43cb55dd904565a96388f129 Mon Sep 17 00:00:00 2001 From: Heiner Tholen Date: Wed, 21 Mar 2018 15:15:05 +0100 Subject: [PATCH 181/426] removing ascii art headlines --- DQMOffline/Trigger/src/BTVHLTOfflineSource.cc | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc b/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc index a4054d304322f..f4895acc71f08 100644 --- a/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc +++ b/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc @@ -148,12 +148,9 @@ BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iS unsigned index = triggerNames_.triggerIndex(v.getPath()); if (index < triggerNames_.size() ){ float DR = 9999.; -// _|_|_| _|_|_|_| -// _| _| _| -// _|_|_| _|_|_| -// _| _| -// _| _| - if (csvPfTags.isValid() && v.getTriggerType() == "PF") + + // PF btagging + if (csvPfTags.isValid() && v.getTriggerType() == "PF") { auto iter = csvPfTags->begin(); @@ -216,12 +213,7 @@ BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iS } } -// _|_|_| _| -// _| _|_|_| _| _|_| -// _| _| _| _| _| _| -// _| _| _| _| _| _| -// _|_|_| _|_|_| _| _|_| - + // Calo b-tagging if (csvCaloTags.isValid() && v.getTriggerType() == "Calo" && !csvCaloTags->empty()) { From 4aa7b34fe42d90fd6c6e4dca1dfd257b3ee42dbd Mon Sep 17 00:00:00 2001 From: David Date: Wed, 21 Mar 2018 16:42:50 +0100 Subject: [PATCH 182/426] Bug fix --- DQM/HcalTasks/plugins/DigiTask.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DQM/HcalTasks/plugins/DigiTask.cc b/DQM/HcalTasks/plugins/DigiTask.cc index d31e754b9f5f0..ca9d8702899cd 100644 --- a/DQM/HcalTasks/plugins/DigiTask.cc +++ b/DQM/HcalTasks/plugins/DigiTask.cc @@ -745,7 +745,7 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): continue; } - _cSumQ_SubdetPM.fill(did, sumQ); + _cSumQ_SubdetPM_QIE1011.fill(did, sumQ); _cOccupancy_depth.fill(did); if (_ptype == fOnline || _ptype == fLocal) { _cOccupancy_Crate.fill(eid); From a4d0c8a01163417f6cfd755b12a508bd5676d8f1 Mon Sep 17 00:00:00 2001 From: Petar Date: Wed, 21 Mar 2018 11:31:16 -0500 Subject: [PATCH 183/426] Three changes: 1) Reimplementing change from shared_ptr to unique_ptr from #22031, and also applying the same principle to PixelCPEClusterRepairESProducer. 2) going with label = "numerator" in SiPixel2DTemplateDBObjectESProducer.cc. This corresponds to data, in particular to Barrel Layer 1 from the end of 2017 run. This is what we want to test in data. Given what we have in the DB right now, this is the most useful at the moment. 3) cosmetic: fix typo in python variable name in SiPixel2DTemplateDBObjectESProducer_cfi.py (2D2D -> 2D) --- .../plugins/SiPixel2DTemplateDBObjectESProducer.cc | 2 +- .../python/SiPixel2DTemplateDBObjectESProducer_cfi.py | 2 +- .../interface/PixelCPEClusterRepairESProducer.h | 3 +-- .../SiPixelRecHits/interface/PixelCPEGenericESProducer.h | 3 +-- .../interface/PixelCPETemplateRecoESProducer.h | 3 +-- .../plugins/PixelCPEClusterRepairESProducer.cc | 8 +++----- .../SiPixelRecHits/plugins/PixelCPEGenericESProducer.cc | 6 ++---- .../plugins/PixelCPETemplateRecoESProducer.cc | 6 ++---- 8 files changed, 12 insertions(+), 21 deletions(-) diff --git a/CalibTracker/SiPixelESProducers/plugins/SiPixel2DTemplateDBObjectESProducer.cc b/CalibTracker/SiPixelESProducers/plugins/SiPixel2DTemplateDBObjectESProducer.cc index 78d1a9ec40a20..88338572ffadd 100644 --- a/CalibTracker/SiPixelESProducers/plugins/SiPixel2DTemplateDBObjectESProducer.cc +++ b/CalibTracker/SiPixelESProducers/plugins/SiPixel2DTemplateDBObjectESProducer.cc @@ -39,7 +39,7 @@ std::shared_ptr SiPixel2DTemplateDBObjectESProducer:: GlobalPoint center(0.0, 0.0, 0.0); float theMagField = magfield.product()->inTesla(center).mag(); - std::string label = ""; + std::string label = "numerator"; // &&& Temporary: matches Barrel Layer1 for 2017 data if( theMagField>=-0.1 && theMagField<1.0 ) label = "0T"; else if(theMagField>=1.0 && theMagField<2.5 ) label = "2T"; diff --git a/CalibTracker/SiPixelESProducers/python/SiPixel2DTemplateDBObjectESProducer_cfi.py b/CalibTracker/SiPixelESProducers/python/SiPixel2DTemplateDBObjectESProducer_cfi.py index ffb9fbffa042b..659a654f6f1e7 100644 --- a/CalibTracker/SiPixelESProducers/python/SiPixel2DTemplateDBObjectESProducer_cfi.py +++ b/CalibTracker/SiPixelESProducers/python/SiPixel2DTemplateDBObjectESProducer_cfi.py @@ -1,4 +1,4 @@ import FWCore.ParameterSet.Config as cms -siPixel2D2DTemplateDBObjectESProducer = cms.ESProducer("SiPixel2DTemplateDBObjectESProducer") +siPixel2DTemplateDBObjectESProducer = cms.ESProducer("SiPixel2DTemplateDBObjectESProducer") diff --git a/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEClusterRepairESProducer.h b/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEClusterRepairESProducer.h index f06ec3b474539..7dd87dbcbbc62 100644 --- a/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEClusterRepairESProducer.h +++ b/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEClusterRepairESProducer.h @@ -11,9 +11,8 @@ class PixelCPEClusterRepairESProducer: public edm::ESProducer{ public: PixelCPEClusterRepairESProducer(const edm::ParameterSet & p); ~PixelCPEClusterRepairESProducer() override; - std::shared_ptr produce(const TkPixelCPERecord &); + std::unique_ptr produce(const TkPixelCPERecord &); private: - std::shared_ptr cpe_; edm::ParameterSet pset_; bool DoLorentz_; }; diff --git a/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEGenericESProducer.h b/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEGenericESProducer.h index 3e1dd6ac171e5..e10ecc700de03 100644 --- a/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEGenericESProducer.h +++ b/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEGenericESProducer.h @@ -11,9 +11,8 @@ class PixelCPEGenericESProducer: public edm::ESProducer{ public: PixelCPEGenericESProducer(const edm::ParameterSet & p); ~PixelCPEGenericESProducer() override; - std::shared_ptr produce(const TkPixelCPERecord &); + std::unique_ptr produce(const TkPixelCPERecord &); private: - std::shared_ptr cpe_; edm::ParameterSet pset_; edm::ESInputTag magname_; bool useLAWidthFromDB_; diff --git a/RecoLocalTracker/SiPixelRecHits/interface/PixelCPETemplateRecoESProducer.h b/RecoLocalTracker/SiPixelRecHits/interface/PixelCPETemplateRecoESProducer.h index 67e1c081b09f6..4a47426f44f23 100644 --- a/RecoLocalTracker/SiPixelRecHits/interface/PixelCPETemplateRecoESProducer.h +++ b/RecoLocalTracker/SiPixelRecHits/interface/PixelCPETemplateRecoESProducer.h @@ -11,9 +11,8 @@ class PixelCPETemplateRecoESProducer: public edm::ESProducer{ public: PixelCPETemplateRecoESProducer(const edm::ParameterSet & p); ~PixelCPETemplateRecoESProducer() override; - std::shared_ptr produce(const TkPixelCPERecord &); + std::unique_ptr produce(const TkPixelCPERecord &); private: - std::shared_ptr cpe_; edm::ParameterSet pset_; bool DoLorentz_; }; diff --git a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEClusterRepairESProducer.cc b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEClusterRepairESProducer.cc index efde8f4d3c046..b6355b431645e 100644 --- a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEClusterRepairESProducer.cc +++ b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEClusterRepairESProducer.cc @@ -37,7 +37,7 @@ PixelCPEClusterRepairESProducer::PixelCPEClusterRepairESProducer(const edm::Para PixelCPEClusterRepairESProducer::~PixelCPEClusterRepairESProducer() {} -std::shared_ptr +std::unique_ptr PixelCPEClusterRepairESProducer::produce(const TkPixelCPERecord & iRecord){ ESHandle magfield; @@ -65,16 +65,14 @@ PixelCPEClusterRepairESProducer::produce(const TkPixelCPERecord & iRecord){ ESHandle templateDBobject2D; iRecord.getRecord().get(templateDBobject2D); - // cpe_ = std::make_shared(pset_,magfield.product(),lorentzAngle.product(),templateDBobject.product() ); - cpe_ = - std::make_shared(pset_, + return + std::make_unique(pset_, magfield.product(), *pDD.product(), *hTT.product(), lorentzAngleProduct, templateDBobject.product(), templateDBobject2D.product() ); - return cpe_; } diff --git a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEGenericESProducer.cc b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEGenericESProducer.cc index f5dfeab62a735..be729d9c3862f 100644 --- a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEGenericESProducer.cc +++ b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEGenericESProducer.cc @@ -45,7 +45,7 @@ PixelCPEGenericESProducer::PixelCPEGenericESProducer(const edm::ParameterSet & p PixelCPEGenericESProducer::~PixelCPEGenericESProducer() {} -std::shared_ptr +std::unique_ptr PixelCPEGenericESProducer::produce(const TkPixelCPERecord & iRecord){ ESHandle magfield; @@ -83,12 +83,10 @@ PixelCPEGenericESProducer::produce(const TkPixelCPERecord & iRecord){ //} else { //std::cout<<" pass an empty GenError pointer"<( + return std::make_unique( pset_,magfield.product(),*pDD.product(), *hTT.product(),lorentzAngle.product(), genErrorDBObjectProduct,lorentzAngleWidthProduct); - - return cpe_; } diff --git a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPETemplateRecoESProducer.cc b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPETemplateRecoESProducer.cc index 8877d7459c3be..3bc2e3ff4bf57 100644 --- a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPETemplateRecoESProducer.cc +++ b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPETemplateRecoESProducer.cc @@ -35,7 +35,7 @@ PixelCPETemplateRecoESProducer::PixelCPETemplateRecoESProducer(const edm::Parame PixelCPETemplateRecoESProducer::~PixelCPETemplateRecoESProducer() {} -std::shared_ptr +std::unique_ptr PixelCPETemplateRecoESProducer::produce(const TkPixelCPERecord & iRecord){ ESHandle magfield; @@ -60,9 +60,7 @@ PixelCPETemplateRecoESProducer::produce(const TkPixelCPERecord & iRecord){ ESHandle templateDBobject; iRecord.getRecord().get(templateDBobject); - // cpe_ = std::make_shared(pset_,magfield.product(),lorentzAngle.product(),templateDBobject.product() ); - cpe_ = std::make_shared(pset_,magfield.product(),*pDD.product(),*hTT.product(),lorentzAngleProduct,templateDBobject.product() ); - return cpe_; + return std::make_unique(pset_,magfield.product(),*pDD.product(),*hTT.product(),lorentzAngleProduct,templateDBobject.product() ); } From 1a7e3eab8431927140b1a731faa493b4c945b8ea Mon Sep 17 00:00:00 2001 From: Sunanda Date: Wed, 21 Mar 2018 22:59:42 +0100 Subject: [PATCH 184/426] Update DetId class for new HGCal module --- DataFormats/DetId/interface/DetId.h | 3 +- .../interface/ForwardSubdetector.h | 2 + .../interface/HGCScintillatorDetId.h | 16 +- .../interface/HGCalTriggerDetId.h | 114 ++++++++++++ .../ForwardDetId/src/HGCScintillatorDetId.cc | 7 +- .../ForwardDetId/src/HGCalTriggerDetId.cc | 167 ++++++++++++++++++ DataFormats/ForwardDetId/src/classes.h | 6 + DataFormats/ForwardDetId/src/classes_def.xml | 6 + DataFormats/ForwardDetId/test/testHGCDetId.cc | 39 ++++ 9 files changed, 349 insertions(+), 11 deletions(-) create mode 100644 DataFormats/ForwardDetId/interface/HGCalTriggerDetId.h create mode 100644 DataFormats/ForwardDetId/src/HGCalTriggerDetId.cc diff --git a/DataFormats/DetId/interface/DetId.h b/DataFormats/DetId/interface/DetId.h index 634dd4f3988f8..f5d731f2d2b31 100644 --- a/DataFormats/DetId/interface/DetId.h +++ b/DataFormats/DetId/interface/DetId.h @@ -22,7 +22,8 @@ class DetId { enum Detector {Tracker=1, Muon=2, Ecal=3, Hcal=4, Calo=5, Forward=6, - VeryForward=7, HGCalEE=8, HGCalHSi=9, HGCalHSc=10 }; + VeryForward=7, HGCalEE=8, HGCalHSi=9, HGCalHSc=10, + HGCalTrigger=11}; /// Create an empty or null id (also for persistence) DetId() : id_(0) { } /// Create an id from a raw number diff --git a/DataFormats/ForwardDetId/interface/ForwardSubdetector.h b/DataFormats/ForwardDetId/interface/ForwardSubdetector.h index ab17dcf0e0ed0..04678738bfe6a 100644 --- a/DataFormats/ForwardDetId/interface/ForwardSubdetector.h +++ b/DataFormats/ForwardDetId/interface/ForwardSubdetector.h @@ -3,5 +3,7 @@ enum ForwardSubdetector { ForwardEmpty=0, FastTime=1, BHM=2, HGCEE=3, HGCHEF=4, HGCHEB=5, HGCHET=6, HGCTrigger=7 }; +enum HGCalTriggerSubdetector { HGCalEmptyTrigger=0, HGCalEETrigger=1, + HGCalHSiTrigger=2, HGCalHScTrigger=3}; #endif diff --git a/DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h b/DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h index 4ae87b6db5bee..b9446260d48ff 100644 --- a/DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h +++ b/DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h @@ -9,9 +9,10 @@ [0:8] iphi index wrt x-axis on +z side [9:16] |ieta| index (starting from |etamin|) [17:21] Layer # - [22:22] z-side (0 for +z; 1 for -z) - [23:23] Type (0 fine divisions; 1 for coarse division) - [24:24] Reserved for future extension + [22:24] Reserved for future extension + [25:25] z-side (0 for +z; 1 for -z) + [26:27] Type (0 fine divisions of scintillators; + 1 coarse divisions of scintillators) [28:31] Detector type (HGCalHSc) */ @@ -34,7 +35,7 @@ class HGCScintillatorDetId : public DetId { HGCScintillatorDetId geometryCell () const {return HGCScintillatorDetId (type(), layer(), ieta(), 0);} /// get the subdetector - ForwardSubdetector subdet() const { return HGCHEB; } + DetId::Detector subdet() const { return det(); } /// get the type int type() const { return (id_>>kHGCalTypeOffset)&kHGCalTypeMask; } @@ -68,11 +69,10 @@ class HGCScintillatorDetId : public DetId { static const int kHGCalEtaMask = 0xFF; static const int kHGCalLayerOffset = 17; static const int kHGCalLayerMask = 0x1F; - static const int kHGCalZsideOffset = 22; + static const int kHGCalZsideOffset = 25; static const int kHGCalZsideMask = 0x1; - static const int kHGCalZsideMask2 = 0x400000; - static const int kHGCalTypeOffset = 23; - static const int kHGCalTypeMask = 0x1; + static const int kHGCalTypeOffset = 26; + static const int kHGCalTypeMask = 0x3; }; std::ostream& operator<<(std::ostream&,const HGCScintillatorDetId& id); diff --git a/DataFormats/ForwardDetId/interface/HGCalTriggerDetId.h b/DataFormats/ForwardDetId/interface/HGCalTriggerDetId.h new file mode 100644 index 0000000000000..5190ce6886055 --- /dev/null +++ b/DataFormats/ForwardDetId/interface/HGCalTriggerDetId.h @@ -0,0 +1,114 @@ +#ifndef DataFormats_ForwardDetId_HGCalTriggerDetId_H +#define DataFormats_ForwardDetId_HGCalTriggerDetId_H 1 + +#include +#include +#include "DataFormats/DetId/interface/DetId.h" +#include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h" +#include "DataFormats/ForwardDetId/interface/HGCSiliconDetId.h" + +/* \brief description of the bit assigment + [0:4] u-coordinate of the cell (measured from the lower left + [5:9] v-coordinate of the cell corner of the wafer) + [10:13] abs(u) of the wafer (u-axis points along -x axis) + [14:14] sign of u (0:+u; 1:-u) (u=0 is at the center of beam line) + [15:18] abs(v) of the wafer (v-axis points 60-degree wrt x-axis) + [19:19] sign of v (0:+v; 1:-v) (v=0 is at the center of beam line) + [20:24] layer number + [25:25] z-side (0 for +z; 1 for -z) + [26:27] Type (0 fine divisions of wafer with 120 mum thick silicon + 1 coarse divisions of wafer with 200 mum thick silicon + 2 coarse divisions of wafer with 300 mum thick silicon) + [28:31] Detector type (HGCalEE or HGCalHSi) +*/ + +class HGCalTriggerDetId : public DetId { + +public: + + static const int HGCalTriggerCell =4; + + /** Create a null cellid*/ + HGCalTriggerDetId(); + /** Create cellid from raw id (0=invalid tower id) */ + HGCalTriggerDetId(uint32_t rawid); + /** Constructor from subdetector, zplus, layer, module, cell numbers */ + HGCalTriggerDetId(int subdet, int zp, int type, int layer, + int waferU, int waferV, int cellU, int cellV); + /** Constructor from a generic cell id */ + HGCalTriggerDetId(const DetId& id); + /** Assignment from a generic cell id */ + HGCalTriggerDetId& operator=(const DetId& id); + + /// get the subdetector + HGCalTriggerSubdetector subdet() const { + return (HGCalTriggerSubdetector)((id_>>kHGCalSubdetOffset)&kHGCalSubdetMask); } + + /// get the type + int type() const { return (id_>>kHGCalTypeOffset)&kHGCalTypeMask; } + + /// get the z-side of the cell (1/-1) + int zside() const { return (((id_>>kHGCalZsideOffset) & kHGCalZsideMask) ? -1 : 1); } + + /// get the layer # + int layer() const { return (id_>>kHGCalLayerOffset)&kHGCalLayerMask; } + + /// get the cell #'s in u,v or in x,y + int triggerCellU() const { return (id_>>kHGCalCellUOffset)&kHGCalCellUMask; } + int triggerCellV() const { return (id_>>kHGCalCellVOffset)&kHGCalCellVMask; } + std::pair triggerCellUV() const { + return std::pair(triggerCellU(),triggerCellV()); } + int triggerCellX() const; + int triggerCellY() const; + std::pair triggerCellXY() const { + return std::pair(triggerCellX(),triggerCellY()); } + + /// get the wafer #'s in u,v or in x,y + int waferUAbs() const { return (id_>>kHGCalWaferUOffset)&kHGCalWaferUMask; } + int waferVAbs() const { return (id_>>kHGCalWaferVOffset)&kHGCalWaferVMask; } + int waferU() const { return (((id_>>kHGCalWaferUSignOffset) & kHGCalWaferUSignMask) ? -waferUAbs() : waferUAbs()); } + int waferV() const { return (((id_>>kHGCalWaferVSignOffset) & kHGCalWaferVSignMask) ? -waferVAbs() : waferVAbs()); } + std::pair waferUV() const { return std::pair(waferU(),waferV()); } + int waferX() const { return (-2*waferU()+waferV()); } + int waferY() const { return (2*waferV()); } + std::pair waferXY() const { return std::pair(waferX(),waferY()); } + + // get trigger cell u,v + std::vector cellU() const; + std::vector cellV() const; + std::vector > cellUV() const; + + /// consistency check : no bits left => no overhead + bool isEE() const { return (subdet() == HGCalEETrigger); } + bool isHSilicon() const { return (subdet() == HGCalHSiTrigger); } + bool isForward() const { return true; } + + static const HGCalTriggerDetId Undefined; + + private: + + static const int kHGCalCellUOffset = 0; + static const int kHGCalCellUMask = 0xF; + static const int kHGCalCellVOffset = 4; + static const int kHGCalCellVMask = 0xF; + static const int kHGCalWaferUOffset = 8; + static const int kHGCalWaferUMask = 0xF; + static const int kHGCalWaferUSignOffset = 12; + static const int kHGCalWaferUSignMask = 0x1; + static const int kHGCalWaferVOffset = 13; + static const int kHGCalWaferVMask = 0xF; + static const int kHGCalWaferVSignOffset = 17; + static const int kHGCalWaferVSignMask = 0x1; + static const int kHGCalLayerOffset = 18; + static const int kHGCalLayerMask = 0x1F; + static const int kHGCalTypeOffset = 23; + static const int kHGCalTypeMask = 0x1; + static const int kHGCalZsideOffset = 27; + static const int kHGCalZsideMask = 0x1; + static const int kHGCalSubdetOffset = 25; + static const int kHGCalSubdetMask = 0x3; +}; + +std::ostream& operator<<(std::ostream&,const HGCalTriggerDetId& id); + +#endif diff --git a/DataFormats/ForwardDetId/src/HGCScintillatorDetId.cc b/DataFormats/ForwardDetId/src/HGCScintillatorDetId.cc index 329ca05671b11..912271f88fb3b 100644 --- a/DataFormats/ForwardDetId/src/HGCScintillatorDetId.cc +++ b/DataFormats/ForwardDetId/src/HGCScintillatorDetId.cc @@ -12,11 +12,14 @@ HGCScintillatorDetId::HGCScintillatorDetId(uint32_t rawid) : DetId(rawid) { } HGCScintillatorDetId::HGCScintillatorDetId(int type, int layer, int eta, - int phi) : DetId(HGCalHSc,HGCHEB) { + int phi) : DetId(HGCalHSc,ForwardEmpty) { + int zside = (eta < 0) ? 1 : 0; + int etaAbs = std::abs(eta); id_ |= ((type&kHGCalTypeMask)< +#include + +const HGCalTriggerDetId HGCalTriggerDetId::Undefined(HGCalEE,0,0,0,0,0,0,0); + +HGCalTriggerDetId::HGCalTriggerDetId() : DetId() { +} + +HGCalTriggerDetId::HGCalTriggerDetId(uint32_t rawid) : DetId(rawid) { +} + +HGCalTriggerDetId::HGCalTriggerDetId(int subdet, int zp, int type, int layer, + int waferU, int waferV, int cellU, + int cellV) : DetId(HGCalTrigger,ForwardEmpty) { + + int waferUabs(std::abs(waferU)), waferVabs(std::abs(waferV)); + int waferUsign = (waferU >= 0) ? 0 : 1; + int waferVsign = (waferV >= 0) ? 0 : 1; + int zside = (zp < 0) ? 1 : 0; + id_ |= (((cellU & kHGCalCellUMask) << kHGCalCellUOffset) | + ((cellV & kHGCalCellVMask) << kHGCalCellVOffset) | + ((waferUabs & kHGCalWaferUMask) << kHGCalWaferUOffset) | + ((waferUsign& kHGCalWaferUSignMask) << kHGCalWaferUSignOffset) | + ((waferVabs & kHGCalWaferVMask) << kHGCalWaferVOffset) | + ((waferVsign& kHGCalWaferVSignMask) << kHGCalWaferVSignOffset) | + ((layer & kHGCalLayerMask) << kHGCalLayerOffset) | + ((zside & kHGCalZsideMask) << kHGCalZsideOffset) | + ((type & kHGCalTypeMask) << kHGCalTypeOffset) | + ((subdet & kHGCalSubdetMask)<< kHGCalSubdetOffset)); +} + +HGCalTriggerDetId::HGCalTriggerDetId(const DetId& gen) { + if (!gen.null()) { + if ((gen.det()!=HGCalTrigger) || + (((gen.subdetId()&kHGCalSubdetMask)!=HGCalEETrigger) && + ((gen.subdetId()&kHGCalSubdetMask)!=HGCalHSiTrigger))) { + throw cms::Exception("Invalid DetId") << "Cannot initialize HGCalTriggerDetId from " << std::hex << gen.rawId() << std::dec; + } + } + id_ = gen.rawId(); +} + +HGCalTriggerDetId& HGCalTriggerDetId::operator=(const DetId& gen) { + if (!gen.null()) { + if ((gen.det()!=HGCalTrigger) || + (((gen.subdetId()&kHGCalSubdetMask)!=HGCalEETrigger) && + ((gen.subdetId()&kHGCalSubdetMask)!=HGCalHSiTrigger))) { + throw cms::Exception("Invalid DetId") << "Cannot assign HGCalTriggerDetId from " << std::hex << gen.rawId() << std::dec; + } + } + id_ = gen.rawId(); + return (*this); +} + +int HGCalTriggerDetId::triggerCellX() const { + int nT = (type() == HGCSiliconDetId::HGCalFine) ? + HGCSiliconDetId::HGCalFineTrigger : HGCSiliconDetId::HGCalCoarseTrigger; + int N = nT*HGCalTriggerCell; + std::vector vc = cellV(); + int x(0); + for (auto const & v : vc) + x += (3*(v-N)+2); + return (x/vc.size()); +} + +int HGCalTriggerDetId::triggerCellY() const { + int nT = (type() == HGCSiliconDetId::HGCalFine) ? + HGCSiliconDetId::HGCalFineTrigger : HGCSiliconDetId::HGCalCoarseTrigger; + int N = nT*HGCalTriggerCell; + std::vector uc = cellU(); + std::vector vc = cellV(); + int y(0); + for (unsigned int k=0; k HGCalTriggerDetId::cellU() const { + std::vector uc; + int nT = (type() == HGCSiliconDetId::HGCalFine) ? + HGCSiliconDetId::HGCalFineTrigger : HGCSiliconDetId::HGCalCoarseTrigger; + if ((triggerCellU() >= HGCalTriggerCell) && + (triggerCellV() >= HGCalTriggerCell)) { + int u0 = nT*triggerCellU(); + for (int i=0; i HGCalTriggerDetId::cellV() const { + + std::vector vc; + int nT = (type() == HGCSiliconDetId::HGCalFine) ? + HGCSiliconDetId::HGCalFineTrigger : HGCSiliconDetId::HGCalCoarseTrigger; + if ((triggerCellU() >= HGCalTriggerCell) && + (triggerCellV() >= HGCalTriggerCell)) { + int v0 = nT*triggerCellV(); + for (int i=0; i > HGCalTriggerDetId::cellUV() const { + + std::vector uc = cellU(); + std::vector vc = cellV(); + std::vector > uv; + for (unsigned int k=0; k(uc[k],vc[k])); + } + return uv; +} + +std::ostream& operator<<(std::ostream& s,const HGCalTriggerDetId& id) { + return s << " EE:HSil= " << id.isEE() << ":" << id.isHSilicon() + << " type= " << id.type() << " z= " << id.zside() + << " layer= " << id.layer() + << " wafer(u,v:x,y)= (" << id.waferU() << "," << id.waferV() << ":" + << id.waferX() << "," << id.waferY() << ")" + << " triggerCell(u,v:x,y)= (" << id.triggerCellU() << "," + << id.triggerCellV() << ":" << id.triggerCellX() << "," + << id.triggerCellY() << ")"; +} + + diff --git a/DataFormats/ForwardDetId/src/classes.h b/DataFormats/ForwardDetId/src/classes.h index 21cf11bbcd429..38902bbe20825 100644 --- a/DataFormats/ForwardDetId/src/classes.h +++ b/DataFormats/ForwardDetId/src/classes.h @@ -2,6 +2,8 @@ #include "DataFormats/ForwardDetId/interface/HGCEEDetId.h" #include "DataFormats/ForwardDetId/interface/HGCHEDetId.h" #include "DataFormats/ForwardDetId/interface/HGCalDetId.h" +#include "DataFormats/ForwardDetId/interface/HGCSiliconDetId.h" +#include "DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h" #include "DataFormats/ForwardDetId/interface/HGCTriggerDetId.h" #include "DataFormats/ForwardDetId/interface/FastTimeDetId.h" @@ -17,6 +19,10 @@ namespace DataFormats_ForwardDetId { //HGCal specific HGCalDetId anHGCalDetId; + //HGCal specific (new format) + HGCSiliconDetId anHGCSiliconDetid; + HGCScintillatorDetId anHGCScintillatorDetId; + //FastTimer specific FastTimeDetId anFastTimeDetId; }; diff --git a/DataFormats/ForwardDetId/src/classes_def.xml b/DataFormats/ForwardDetId/src/classes_def.xml index c50f6e562b075..e77f6ba13491a 100644 --- a/DataFormats/ForwardDetId/src/classes_def.xml +++ b/DataFormats/ForwardDetId/src/classes_def.xml @@ -14,6 +14,12 @@
+ + + + + + diff --git a/DataFormats/ForwardDetId/test/testHGCDetId.cc b/DataFormats/ForwardDetId/test/testHGCDetId.cc index 38800e426144b..d4c81d46158eb 100644 --- a/DataFormats/ForwardDetId/test/testHGCDetId.cc +++ b/DataFormats/ForwardDetId/test/testHGCDetId.cc @@ -1,5 +1,6 @@ #include "DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h" #include "DataFormats/ForwardDetId/interface/HGCSiliconDetId.h" +#include "DataFormats/ForwardDetId/interface/HGCalTriggerDetId.h" #include "DataFormats/DetId/interface/DetId.h" #include @@ -115,6 +116,42 @@ void testScint(int layer) { } } +void testTriggerCell(int type) { + + int N = (type == 0) ? + HGCSiliconDetId::HGCalFineN : HGCSiliconDetId::HGCalCoarseN; + const int waferu(0), waferv(0), layer(1), zside(1); + std::string error[2] = {"ERROR","OK"}; + int ntot(0), nerror(0); + for (int u=0; u<2*N; ++u) { + for (int v=0; v<2*N; ++v) { + if (((v-u) < N) && (u-v) <= N) { + HGCSiliconDetId id(DetId::HGCalEE,zside,type,layer,waferu,waferv,u,v); + std::cout << "ID " << std::hex << id.rawId() << std::dec << " " << id + << " Trigger: " << id.triggerCellU() << ":" + << id.triggerCellV() << std::endl; + HGCalTriggerDetId idt((int)(HGCalEETrigger),id.zside(),id.type(), + id.layer(),id.waferU(),id.waferV(), + id.triggerCellU(),id.triggerCellV()); + int ok(0); + std::vector > uvs = idt.cellUV(); + for (auto const& uv : uvs) { + HGCSiliconDetId idn(DetId::HGCalEE,idt.zside(),idt.type(), + idt.layer(),idt.waferU(),idt.waferV(), + uv.first,uv.second); + if (idn == id) {ok = 1; break;} + } + std::cout << "Trigger Cell: " << idt << " obtained from cell (" + << error[ok] << ")" << std::endl; + ++ntot; + if (ok == 0) ++nerror; + } + } + } + std::cout << "Total of " << ntot << " cells in type " << type << " with " + << nerror << " errors for trigger cells" << std::endl; +} + int main() { testCell(0); @@ -123,6 +160,8 @@ int main() { testWafer(28, 352.46, 1658.68); testScint(10); testScint(22); + testTriggerCell(0); + testTriggerCell(1); return 0; } From 341fb559b029c5c26ef6c9c495dcd8fc15a4aaf6 Mon Sep 17 00:00:00 2001 From: "S. Lehti" Date: Wed, 21 Mar 2018 12:20:14 +0100 Subject: [PATCH 185/426] HLTTauDQMOffline: added regexp support for paths in HLTTauDQMTagAndProbePlotter --- .../interface/HLTTauDQMOfflineSource.h | 5 +- .../interface/HLTTauDQMTagAndProbePlotter.h | 23 +- .../Trigger/python/HLTTauDQMOffline_cfi.py | 529 +----------------- .../Trigger/src/HLTTauDQMOfflineSource.cc | 80 ++- .../src/HLTTauDQMTagAndProbePlotter.cc | 71 ++- 5 files changed, 154 insertions(+), 554 deletions(-) diff --git a/DQMOffline/Trigger/interface/HLTTauDQMOfflineSource.h b/DQMOffline/Trigger/interface/HLTTauDQMOfflineSource.h index 20d7bace699a7..6678db94b4e45 100644 --- a/DQMOffline/Trigger/interface/HLTTauDQMOfflineSource.h +++ b/DQMOffline/Trigger/interface/HLTTauDQMOfflineSource.h @@ -59,9 +59,10 @@ class HLTTauDQMOfflineSource : public DQMEDAnalyzer { }; std::vector refObjects_; bool tagAndProbe_; + std::vector tagAndProbePaths; - std::vector > num_genTriggerEventFlag_; - std::vector > den_genTriggerEventFlag_; + //std::vector > num_genTriggerEventFlag_; + //std::vector > den_genTriggerEventFlag_; //DQM Prescaler int counterEvt_; //counter diff --git a/DQMOffline/Trigger/interface/HLTTauDQMTagAndProbePlotter.h b/DQMOffline/Trigger/interface/HLTTauDQMTagAndProbePlotter.h index 9c8f2fd494d49..00e4c29d715ff 100644 --- a/DQMOffline/Trigger/interface/HLTTauDQMTagAndProbePlotter.h +++ b/DQMOffline/Trigger/interface/HLTTauDQMTagAndProbePlotter.h @@ -5,13 +5,14 @@ #include "DQMOffline/Trigger/interface/HLTTauDQMPlotter.h" #include "DQMOffline/Trigger/interface/HLTTauDQMPath.h" -#include "CommonTools/TriggerUtils/interface/GenericTriggerEventFlag.h" - +//#include "CommonTools/TriggerUtils/interface/GenericTriggerEventFlag.h" +#include "FWCore/Common/interface/TriggerNames.h" +#include "DataFormats/Common/interface/TriggerResults.h" namespace edm { class Event; class EventSetup; - class TriggerResults; +// class TriggerResults; } namespace trigger { @@ -22,17 +23,21 @@ class HLTConfigProvider; class HLTTauDQMTagAndProbePlotter: private HLTTauDQMPlotter { public: - HLTTauDQMTagAndProbePlotter(const edm::ParameterSet& iConfig, std::unique_ptr numFlag, std::unique_ptr denFlag, const std::string& dqmBaseFolder); +// HLTTauDQMTagAndProbePlotter(const edm::ParameterSet& iConfig, std::unique_ptr numFlag, std::unique_ptr denFlag, const std::string& dqmBaseFolder); + HLTTauDQMTagAndProbePlotter(const edm::ParameterSet& iConfig, const std::vector& modLabels, const std::string& dqmBaseFolder); ~HLTTauDQMTagAndProbePlotter(); using HLTTauDQMPlotter::isValid; void bookHistograms(DQMStore::IBooker &iBooker, edm::Run const &iRun, edm::EventSetup const &iSetup); - void analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup, const HLTTauDQMOfflineObjects& refCollection); + //void analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup, const HLTTauDQMOfflineObjects& refCollection); + void analyze(edm::Event const& iEvent, const edm::TriggerResults& triggerResults, const trigger::TriggerEvent& triggerEvent, const HLTTauDQMOfflineObjects& refCollection); private: + LV findTrgObject(std::string, const trigger::TriggerEvent&); + const int nbinsPt_; const double ptmin_,ptmax_; int nbinsEta_; @@ -41,8 +46,12 @@ class HLTTauDQMTagAndProbePlotter: private HLTTauDQMPlotter { const double phimin_,phimax_; std::string xvariable; - std::unique_ptr num_genTriggerEventFlag_; - std::unique_ptr den_genTriggerEventFlag_; + //std::unique_ptr num_genTriggerEventFlag_; + //std::unique_ptr den_genTriggerEventFlag_; + std::vector numTriggers; + std::vector denTriggers; + + std::vector moduleLabels; unsigned int nOfflineObjs; diff --git a/DQMOffline/Trigger/python/HLTTauDQMOffline_cfi.py b/DQMOffline/Trigger/python/HLTTauDQMOffline_cfi.py index b844153e3de1a..0c3c4e62af8f6 100644 --- a/DQMOffline/Trigger/python/HLTTauDQMOffline_cfi.py +++ b/DQMOffline/Trigger/python/HLTTauDQMOffline_cfi.py @@ -153,12 +153,12 @@ def TriggerSelectionParameters(hltpaths): cms.untracked.PSet( FilterName = cms.untracked.InputTag("TauRefProducer","MET"), matchObjectID = cms.untracked.int32(0), - ), - ), - ), + ), + ), + ), TagAndProbe = cms.untracked.VPSet( cms.untracked.PSet( - name = cms.string('LooseChargedIsoPFTau20_SingleL1'), + name = cms.string('MuTauTemplate'), xvariable = cms.string('Tau'), nPtBins = cms.int32(20), ptmin = cms.double(0.), @@ -169,416 +169,11 @@ def TriggerSelectionParameters(hltpaths): nPhiBins = cms.int32(20), phimin = cms.double(-3.15), phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_LooseChargedIsoPFTau20_SingleL1_v*','HLT_IsoMu27_LooseChargedIsoPFTau20_SingleL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('MediumChargedIsoPFTau20_SingleL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau20_SingleL1_v*','HLT_IsoMu27_MediumChargedIsoPFTau20_SingleL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('TightChargedIsoPFTau20_SingleL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_TightChargedIsoPFTau20_SingleL1_v*','HLT_IsoMu27_TightChargedIsoPFTau20_SingleL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('LooseChargedIsoPFTau20_TightID_SingleL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_LooseChargedIsoPFTau20_TightID_SingleL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('MediumChargedIsoPFTau20_TightID_SingleL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau20_TightID_SingleL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('TightChargedIsoPFTau20_TightID_SingleL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_TightChargedIsoPFTau20_TightID_SingleL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('LooseChargedIsoPFTau27_eta2p1_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('MediumChargedIsoPFTau27_eta2p1_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu20_eta2p1_MediumChargedIsoPFTau27_eta2p1_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('TightChargedIsoPFTau27_eta2p1_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu20_eta2p1_TightChargedIsoPFTau27_eta2p1_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('LooseChargedIsoPFTau27_eta2p1_TightID_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_TightID_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('MediumChargedIsoPFTau27_eta2p1_TightID_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu20_eta2p1_MediumChargedIsoPFTau27_eta2p1_TightID_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('TightChargedIsoPFTau27_eta2p1_TightID_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu20_eta2p1_TightChargedIsoPFTau27_eta2p1_TightID_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('MediumChargedIsoPFTau50_Trk30_eta2p1_1pr'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(30), - ptmin = cms.double(0.), - ptmax = cms.double(300.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('LooseChargedIsoPFTau35_Trk1_eta2p1_Reg_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_LooseChargedIsoPFTau35_Trk1_eta2p1_Reg_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('MediumChargedIsoPFTau35_Trk1_eta2p1_Reg_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau35_Trk1_eta2p1_Reg_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('TightChargedIsoPFTau35_Trk1_eta2p1_Reg_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_TightChargedIsoPFTau35_Trk1_eta2p1_Reg_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('LooseChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_LooseChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('MediumChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('TightChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_TightChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('LooseChargedIsoPFTau40_Trk1_eta2p1_Reg_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_LooseChargedIsoPFTau40_Trk1_eta2p1_Reg_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('MediumChargedIsoPFTau40_Trk1_eta2p1_Reg_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau40_Trk1_eta2p1_Reg_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('TightChargedIsoPFTau40_Trk1_eta2p1_Reg_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_TightChargedIsoPFTau40_Trk1_eta2p1_Reg_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('LooseChargedIsoPFTau40_Trk1_TightID_eta2p1_Reg_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_LooseChargedIsoPFTau40_Trk1_TightID_eta2p1_Reg_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('MediumChargedIsoPFTau40_Trk1_TightID_eta2p1_Reg_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau40_Trk1_TightID_eta2p1_Reg_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('TightChargedIsoPFTau40_Trk1_TightID_eta2p1_Reg_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_TightChargedIsoPFTau40_Trk1_TightID_eta2p1_Reg_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('MediumChargedIsoPFTau180HighPtRelaxedIso_Trk50_eta2p1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(50), - ptmin = cms.double(0.), - ptmax = cms.double(500.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_MediumChargedIsoPFTau180HighPtRelaxedIso_Trk50_eta2p1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('MediumChargedIsoPFTau180HighPtRelaxedIso_Trk50_eta2p1_1pr'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(50), - ptmin = cms.double(0.), - ptmax = cms.double(500.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_MediumChargedIsoPFTau100HighPtRelaxedIso_Trk50_eta2p1_1pr_v*','HLT_MediumChargedIsoPFTau180HighPtRelaxedIso_Trk50_eta2p1_1pr_v*')), + numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_.+PFTau.+')), denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) ), cms.untracked.PSet( - name = cms.string('LooseChargedIsoPFTau30_eta2p1_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_Ele24_eta2p1_WPTight_Gsf_LooseChargedIsoPFTau30_eta2p1_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_Ele35_WPTight_Gsf_v*')) - ), - cms.untracked.PSet( - name = cms.string('MediumChargedIsoPFTau30_eta2p1_CrossL1'), + name = cms.string('ETauTemplate'), xvariable = cms.string('Tau'), nPtBins = cms.int32(20), ptmin = cms.double(0.), @@ -589,115 +184,19 @@ def TriggerSelectionParameters(hltpaths): nPhiBins = cms.int32(20), phimin = cms.double(-3.15), phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_Ele24_eta2p1_WPTight_Gsf_MediumChargedIsoPFTau30_eta2p1_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_Ele35_WPTight_Gsf_v*')) - ), - cms.untracked.PSet( - name = cms.string('TightChargedIsoPFTau30_eta2p1_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_Ele24_eta2p1_WPTight_Gsf_TightChargedIsoPFTau30_eta2p1_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_Ele35_WPTight_Gsf_v*')) - ), - cms.untracked.PSet( - name = cms.string('LooseChargedIsoPFTau30_eta2p1_TightID_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_Ele24_eta2p1_WPTight_Gsf_LooseChargedIsoPFTau30_eta2p1_TightID_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_Ele35_WPTight_Gsf_v*')) - ), - cms.untracked.PSet( - name = cms.string('MediumChargedIsoPFTau30_eta2p1_TightID_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_Ele24_eta2p1_WPTight_Gsf_MediumChargedIsoPFTau30_eta2p1_TightID_CrossL1_v*')), + numerator = TriggerSelectionParameters(cms.vstring('HLT_Ele.+PFTau.+')), denominator = TriggerSelectionParameters(cms.vstring('HLT_Ele35_WPTight_Gsf_v*')) ), cms.untracked.PSet( - name = cms.string('TightChargedIsoPFTau30_eta2p1_TightID_CrossL1'), - xvariable = cms.string('Tau'), + name = cms.string('TauMETTemplate'), + xvariable = cms.string('MET'), nPtBins = cms.int32(20), ptmin = cms.double(0.), ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), nPhiBins = cms.int32(20), phimin = cms.double(-3.15), phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_Ele24_eta2p1_WPTight_Gsf_TightChargedIsoPFTau30_eta2p1_TightID_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_Ele35_WPTight_Gsf_v*')) - ), - cms.untracked.PSet( - name = cms.string('MET90'), - xvariable = cms.string('MET'), - nPtBins = cms.int32(50), - ptmin = cms.double(0.), - ptmax = cms.double(500.), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET90_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_v*')) - ), - cms.untracked.PSet( - name = cms.string('MET100'), - xvariable = cms.string('MET'), - nPtBins = cms.int32(50), - ptmin = cms.double(0.), - ptmax = cms.double(500.), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET100_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_v*')) - ), - cms.untracked.PSet( - name = cms.string('MET110'), - xvariable = cms.string('MET'), - nPtBins = cms.int32(50), - ptmin = cms.double(0.), - ptmax = cms.double(500.), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET110_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_v*')) - ), - cms.untracked.PSet( - name = cms.string('MET120'), - xvariable = cms.string('MET'), - nPtBins = cms.int32(50), - ptmin = cms.double(0.), - ptmax = cms.double(500.), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET120_v*')), + numerator = TriggerSelectionParameters(cms.vstring('HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET.*')), denominator = TriggerSelectionParameters(cms.vstring('HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_v*')) ), cms.untracked.PSet( @@ -728,9 +227,8 @@ def TriggerSelectionParameters(hltpaths): nPhiBins = cms.int32(20), phimin = cms.double(-3.15), phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_DoubleIsoMu24_eta2p1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')), - nOfflObjs = cms.untracked.uint32(2) + numerator = TriggerSelectionParameters(cms.vstring('HLT_DoubleIsoMu24_eta2p1_v*')), + denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) ), cms.untracked.PSet( name = cms.string('Ele24_eta2p1_WPTight_Gsf'), @@ -745,8 +243,7 @@ def TriggerSelectionParameters(hltpaths): phimin = cms.double(-3.15), phimax = cms.double(3.15), numerator = TriggerSelectionParameters(cms.vstring('HLT_DoubleEle24_eta2p1_WPTight_Gsf_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_Ele35_WPTight_Gsf_v*')), - nOfflObjs = cms.untracked.uint32(2) + denominator = TriggerSelectionParameters(cms.vstring('HLT_Ele35_WPTight_Gsf_v*')) ) ) ) diff --git a/DQMOffline/Trigger/src/HLTTauDQMOfflineSource.cc b/DQMOffline/Trigger/src/HLTTauDQMOfflineSource.cc index 12aacc4c46447..6bc9b7a64b464 100644 --- a/DQMOffline/Trigger/src/HLTTauDQMOfflineSource.cc +++ b/DQMOffline/Trigger/src/HLTTauDQMOfflineSource.cc @@ -43,14 +43,14 @@ HLTTauDQMOfflineSource::HLTTauDQMOfflineSource( const edm::ParameterSet& ps ): } tagAndProbe_ = false; if(ps.exists("TagAndProbe")) { - std::vector tagAndProbePaths = ps.getUntrackedParameter >("TagAndProbe"); + tagAndProbePaths = ps.getUntrackedParameter >("TagAndProbe"); tagAndProbe_ = true; // tagandprobePlotters_.reserve(tagAndProbePaths.size()); - for(const edm::ParameterSet& tpset: tagAndProbePaths) { - num_genTriggerEventFlag_.emplace_back(new GenericTriggerEventFlag(tpset.getParameter("numerator"),consumesCollector(), *this)); - den_genTriggerEventFlag_.emplace_back(new GenericTriggerEventFlag(tpset.getParameter("denominator"),consumesCollector(), *this)); - tagandprobePlotters_.emplace_back( new HLTTauDQMTagAndProbePlotter(tpset,std::move(num_genTriggerEventFlag_.back()),std::move(den_genTriggerEventFlag_.back()),dqmBaseFolder_)); - } + //for(const edm::ParameterSet& tpset: tagAndProbePaths) { + // num_genTriggerEventFlag_.emplace_back(new GenericTriggerEventFlag(tpset.getParameter("numerator"),consumesCollector(), *this)); + // den_genTriggerEventFlag_.emplace_back(new GenericTriggerEventFlag(tpset.getParameter("denominator"),consumesCollector(), *this)); + // tagandprobePlotters_.emplace_back( new HLTTauDQMTagAndProbePlotter(tpset,std::move(num_genTriggerEventFlag_.back()),std::move(den_genTriggerEventFlag_.back()),dqmBaseFolder_)); + //} } if(doRefAnalysis_) { @@ -72,19 +72,19 @@ void HLTTauDQMOfflineSource::dqmBeginRun(const edm::Run& iRun, const edm::EventS if(HLTCP_.init(iRun, iSetup, hltProcessName_, hltMenuChanged)) { LogDebug("HLTTauDQMOffline") << "dqmBeginRun(), hltMenuChanged " << hltMenuChanged; if(hltMenuChanged) { - // Find all paths to monitor - std::vector foundPaths; - std::smatch what; - LogDebug("HLTTauDQMOffline") << "Looking for paths with regex " << pathRegex_; - for(const std::string& pathName: HLTCP_.triggerNames()) { - if(std::regex_search(pathName, what, pathRegex_)) { - LogDebug("HLTTauDQMOffline") << "Found path " << pathName; - foundPaths.emplace_back(pathName); - } - } - std::sort(foundPaths.begin(), foundPaths.end()); - if(!tagAndProbe_) { + // Find all paths to monitor + std::vector foundPaths; + std::smatch what; + LogDebug("HLTTauDQMOffline") << "Looking for paths with regex " << pathRegex_; + for(const std::string& pathName: HLTCP_.triggerNames()) { + if(std::regex_search(pathName, what, pathRegex_)) { + LogDebug("HLTTauDQMOffline") << "Found path " << pathName; + foundPaths.emplace_back(pathName); + } + } + std::sort(foundPaths.begin(), foundPaths.end()); + // Construct path plotters std::vector pathObjects; pathPlotters_.reserve(foundPaths.size()); @@ -100,6 +100,48 @@ void HLTTauDQMOfflineSource::dqmBeginRun(const edm::Run& iRun, const edm::EventS if(pathSummaryPlotter_) { pathSummaryPlotter_->setPathObjects(pathObjects); } + }else{ // tag and probe + // Find all paths to monitor + std::vector foundPaths; + std::smatch what; + + for(const edm::ParameterSet& tpset: tagAndProbePaths) { + std::vector moduleLabels; + edm::ParameterSet denpset = tpset.getParameter("denominator"); + std::vector denominators = denpset.getParameter >("hltPaths"); + std::vector updatedDenominators; + for(size_t i = 0; i < denominators.size(); ++i){ + const std::regex denRegex_(denominators[i]); + for(const std::string& pathName: HLTCP_.triggerNames()) { + if(std::regex_search(pathName, what, denRegex_)) { + updatedDenominators.push_back(pathName); + moduleLabels = HLTCP_.moduleLabels(pathName); + } + } + } + denpset.addParameter >("hltPaths",updatedDenominators); + + + + edm::ParameterSet numpset = tpset.getParameter("numerator"); + std::vector numerators = numpset.getParameter >("hltPaths"); + + const std::regex numRegex_(numerators[0]); + for(const std::string& pathName: HLTCP_.triggerNames()) { + if(std::regex_search(pathName, what, numRegex_)) { + + edm::ParameterSet new_tpset = tpset; + new_tpset.addParameter("name",pathName); + std::vector updatedHltPaths; + updatedHltPaths.push_back(pathName); + numpset.addParameter >("hltPaths",updatedHltPaths); + new_tpset.addParameter("numerator",numpset); + new_tpset.addParameter("denominator",denpset); + + tagandprobePlotters_.emplace_back( new HLTTauDQMTagAndProbePlotter(new_tpset,moduleLabels,dqmBaseFolder_)); + } + } + } } } } else { @@ -186,7 +228,7 @@ void HLTTauDQMOfflineSource::analyze(const Event& iEvent, const EventSetup& iSet //Tag and probe plotters for(auto& tpPlotter: tagandprobePlotters_) { if(tpPlotter->isValid()) - tpPlotter->analyze(iEvent,iSetup,refC); + tpPlotter->analyze(iEvent,*triggerResultsHandle, *triggerEventHandle, refC); } } else { diff --git a/DQMOffline/Trigger/src/HLTTauDQMTagAndProbePlotter.cc b/DQMOffline/Trigger/src/HLTTauDQMTagAndProbePlotter.cc index 5f5760254b826..eb6af642d1e08 100644 --- a/DQMOffline/Trigger/src/HLTTauDQMTagAndProbePlotter.cc +++ b/DQMOffline/Trigger/src/HLTTauDQMTagAndProbePlotter.cc @@ -4,6 +4,7 @@ #include "DataFormats/HLTReco/interface/TriggerTypeDefs.h" #include +#include "Math/GenVector/VectorUtil.h" namespace { std::string stripVersion(const std::string& pathName) { @@ -14,7 +15,8 @@ namespace { } } -HLTTauDQMTagAndProbePlotter::HLTTauDQMTagAndProbePlotter(const edm::ParameterSet& iConfig, std::unique_ptr numFlag, std::unique_ptr denFlag, const std::string& dqmBaseFolder) : +//HLTTauDQMTagAndProbePlotter::HLTTauDQMTagAndProbePlotter(const edm::ParameterSet& iConfig, std::unique_ptr numFlag, std::unique_ptr denFlag, const std::string& dqmBaseFolder) : +HLTTauDQMTagAndProbePlotter::HLTTauDQMTagAndProbePlotter(const edm::ParameterSet& iConfig, const std::vector& modLabels, const std::string& dqmBaseFolder) : HLTTauDQMPlotter(stripVersion(iConfig.getParameter("name")), dqmBaseFolder), nbinsPt_(iConfig.getParameter("nPtBins")), ptmin_(iConfig.getParameter("ptmin")), @@ -27,8 +29,12 @@ HLTTauDQMTagAndProbePlotter::HLTTauDQMTagAndProbePlotter(const edm::ParameterSet phimax_(iConfig.getParameter("phimax")), xvariable(iConfig.getParameter("xvariable")) { - num_genTriggerEventFlag_ = std::move(numFlag); - den_genTriggerEventFlag_ = std::move(denFlag); + //num_genTriggerEventFlag_ = std::move(numFlag); + //den_genTriggerEventFlag_ = std::move(denFlag); + numTriggers = iConfig.getParameter("numerator").getParameter >("hltPaths"); + denTriggers = iConfig.getParameter("denominator").getParameter >("hltPaths"); + + moduleLabels = modLabels; boost::algorithm::to_lower(xvariable); @@ -47,8 +53,8 @@ void HLTTauDQMTagAndProbePlotter::bookHistograms(DQMStore::IBooker &iBooker,edm: return; // Initialize the GenericTriggerEventFlag - if ( num_genTriggerEventFlag_ && num_genTriggerEventFlag_->on() ) num_genTriggerEventFlag_->initRun( iRun, iSetup ); - if ( den_genTriggerEventFlag_ && den_genTriggerEventFlag_->on() ) den_genTriggerEventFlag_->initRun( iRun, iSetup ); + //if ( num_genTriggerEventFlag_ && num_genTriggerEventFlag_->on() ) num_genTriggerEventFlag_->initRun( iRun, iSetup ); + //if ( den_genTriggerEventFlag_ && den_genTriggerEventFlag_->on() ) den_genTriggerEventFlag_->initRun( iRun, iSetup ); // Efficiency helpers iBooker.setCurrentFolder(triggerTag()+"/helpers"); @@ -73,8 +79,28 @@ void HLTTauDQMTagAndProbePlotter::bookHistograms(DQMStore::IBooker &iBooker,edm: HLTTauDQMTagAndProbePlotter::~HLTTauDQMTagAndProbePlotter() = default; -void HLTTauDQMTagAndProbePlotter::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup, const HLTTauDQMOfflineObjects& refCollection) { +LV HLTTauDQMTagAndProbePlotter::findTrgObject(std::string pathName, const trigger::TriggerEvent& triggerEvent){ + trigger::TriggerObjectCollection trigObjs = triggerEvent.getObjects(); + const unsigned moduleIndex = moduleLabels.size()-2; + + const unsigned hltFilterIndex = triggerEvent.filterIndex(edm::InputTag(moduleLabels[moduleIndex],"","HLT")); + + if (hltFilterIndex < triggerEvent.sizeFilters()) { + const trigger::Keys triggerKeys(triggerEvent.filterKeys(hltFilterIndex)); + const trigger::Vids triggerVids(triggerEvent.filterIds(hltFilterIndex)); + + const unsigned nTriggers = triggerVids.size(); + for (size_t iTrig = 0; iTrig < nTriggers; ++iTrig) { + const trigger::TriggerObject trigObject = trigObjs[triggerKeys[iTrig]]; +// std::cout << " trigger objs pt,eta,phi: " << triggerKeys[iTrig] << " " +// << trigObject.pt() << " " << trigObject.eta() << " " << trigObject.phi() << " " << trigObject.id() << std::endl; + return LV(trigObject.px(),trigObject.py(),trigObject.pz(),trigObject.energy()); + } + } + return LV(0,0,0,0); +} +void HLTTauDQMTagAndProbePlotter::analyze(edm::Event const& iEvent, const edm::TriggerResults& triggerResults, const trigger::TriggerEvent& triggerEvent, const HLTTauDQMOfflineObjects& refCollection) { std::vector offlineObjects; if(xvariable == "tau") offlineObjects = refCollection.taus; if(xvariable == "muon") offlineObjects = refCollection.muons; @@ -83,10 +109,28 @@ void HLTTauDQMTagAndProbePlotter::analyze(edm::Event const& iEvent, edm::EventSe if(offlineObjects.size() < nOfflineObjs) return; - for(const LV& offlineObject: offlineObjects) { + const edm::TriggerNames& trigNames = iEvent.triggerNames(triggerResults); + for(const LV& offlineObject: offlineObjects) { // Filter out events if Trigger Filtering is requested - if (den_genTriggerEventFlag_->on() && ! den_genTriggerEventFlag_->accept( iEvent, iSetup) ) return; + bool passTrigger = false; + bool hltMatched = false; + for ( size_t i = 0; i < denTriggers.size(); ++i){ + LV trgObject = findTrgObject(denTriggers[i],triggerEvent); + + for ( unsigned int hltIndex = 0; hltIndex < trigNames.size(); ++hltIndex){ + passTrigger = (trigNames.triggerName(hltIndex).find(denTriggers[i]) != std::string::npos && triggerResults.wasrun(hltIndex) && triggerResults.accept(hltIndex)); + + if (passTrigger) { + double dr = ROOT::Math::VectorUtil::DeltaR(trgObject,offlineObject); + if(dr < 0.4) hltMatched = true; + break; + } + } + if (passTrigger) break; + } + if(!passTrigger) return; + if(hltMatched) return; // do not consider offline objects which match the tag trigger h_den_pt->Fill(offlineObject.pt()); if(xvariable != "met"){ @@ -95,9 +139,16 @@ void HLTTauDQMTagAndProbePlotter::analyze(edm::Event const& iEvent, edm::EventSe } h_den_phi->Fill(offlineObject.phi()); - // applying selection for numerator - if (num_genTriggerEventFlag_->on() && ! num_genTriggerEventFlag_->accept( iEvent, iSetup) ) return; + passTrigger = false; + for ( size_t i = 0; i < numTriggers.size(); ++i){ + for ( unsigned int hltIndex = 0; hltIndex < trigNames.size(); ++hltIndex){ + passTrigger = (trigNames.triggerName(hltIndex).find(numTriggers[i]) != std::string::npos && triggerResults.wasrun(hltIndex) && triggerResults.accept(hltIndex)); + if (passTrigger) break; + } + if (passTrigger) break; + } + if(!passTrigger) return; h_num_pt->Fill(offlineObject.pt()); if(xvariable != "met"){ From 1ef048d42ccc8a0ba8ae285abf80dbbe6d4c186d Mon Sep 17 00:00:00 2001 From: "S. Lehti" Date: Thu, 22 Mar 2018 09:12:30 +0100 Subject: [PATCH 186/426] HLTTauDQM: changed histogram ranges --- DQMOffline/Trigger/python/HLTTauDQMOffline_cfi.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DQMOffline/Trigger/python/HLTTauDQMOffline_cfi.py b/DQMOffline/Trigger/python/HLTTauDQMOffline_cfi.py index 0c3c4e62af8f6..5cdf19a79a519 100644 --- a/DQMOffline/Trigger/python/HLTTauDQMOffline_cfi.py +++ b/DQMOffline/Trigger/python/HLTTauDQMOffline_cfi.py @@ -86,6 +86,7 @@ L1ETMMin = cms.untracked.double(50), ), Paths = cms.untracked.string("PFTau"), + PtHistoMax = cms.untracked.double(500), PathSummaryPlotter = cms.untracked.PSet( DQMFolder = cms.untracked.string('Summary'), ), @@ -192,7 +193,7 @@ def TriggerSelectionParameters(hltpaths): xvariable = cms.string('MET'), nPtBins = cms.int32(20), ptmin = cms.double(0.), - ptmax = cms.double(200.), + ptmax = cms.double(500.), nPhiBins = cms.int32(20), phimin = cms.double(-3.15), phimax = cms.double(3.15), From 44fd94e4e018166826fda636b5fcaf670656eb4c Mon Sep 17 00:00:00 2001 From: "S. Lehti" Date: Thu, 22 Mar 2018 09:17:17 +0100 Subject: [PATCH 187/426] HLTTauDQM: changed histogram number of bins to match the range change --- DQMOffline/Trigger/python/HLTTauDQMOffline_cfi.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DQMOffline/Trigger/python/HLTTauDQMOffline_cfi.py b/DQMOffline/Trigger/python/HLTTauDQMOffline_cfi.py index 5cdf19a79a519..82f902980a3c7 100644 --- a/DQMOffline/Trigger/python/HLTTauDQMOffline_cfi.py +++ b/DQMOffline/Trigger/python/HLTTauDQMOffline_cfi.py @@ -86,6 +86,7 @@ L1ETMMin = cms.untracked.double(50), ), Paths = cms.untracked.string("PFTau"), + PtHistoBins = cms.untracked.int32(50), PtHistoMax = cms.untracked.double(500), PathSummaryPlotter = cms.untracked.PSet( DQMFolder = cms.untracked.string('Summary'), @@ -191,7 +192,7 @@ def TriggerSelectionParameters(hltpaths): cms.untracked.PSet( name = cms.string('TauMETTemplate'), xvariable = cms.string('MET'), - nPtBins = cms.int32(20), + nPtBins = cms.int32(50), ptmin = cms.double(0.), ptmax = cms.double(500.), nPhiBins = cms.int32(20), From 733cda319e391eefc80ab14ff40792154f9284a5 Mon Sep 17 00:00:00 2001 From: Vincenzo Innocente Date: Thu, 22 Mar 2018 11:00:57 +0100 Subject: [PATCH 188/426] check joseph form --- TrackingTools/KalmanUpdators/src/KFUpdator.cc | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/TrackingTools/KalmanUpdators/src/KFUpdator.cc b/TrackingTools/KalmanUpdators/src/KFUpdator.cc index 2e11026418b6e..d0cece4394771 100644 --- a/TrackingTools/KalmanUpdators/src/KFUpdator.cc +++ b/TrackingTools/KalmanUpdators/src/KFUpdator.cc @@ -7,6 +7,40 @@ #include "DataFormats/Math/interface/invertPosDefMatrix.h" #include "DataFormats/Math/interface/ProjectMatrix.h" +#include +#include +namespace { + + struct Stat { + Stat(): tot(0), + nopd(0), jnopd(0), fnopd(0), + inopd(0), ijnopd(0), ifnopd(0) + {} + + std::atomic tot; + std::atomic nopd; + std::atomic jnopd; + std::atomic fnopd; + std::atomic inopd; + std::atomic ijnopd; + std::atomic ifnopd; + + ~Stat() { + std::cout << "KF " << tot + << " " << nopd << " " << jnopd << " " << fnopd + << " " << inopd << " " << ijnopd << " " << ifnopd + << std::endl; + } + }; + + Stat stat; + + bool isNopd(AlgebraicSymMatrix55 const & m) { + return m(0,0)<0 || m(1,1)<0 || m(2,2)<0 || m(3,3)<0 || m(4,4)<0; + } +} + + namespace { template @@ -51,6 +85,28 @@ TrajectoryStateOnSurface lupdate(const TrajectoryStateOnSurface& tsos, // Compute covariance matrix of local filtered state vector AlgebraicSymMatrix55 fse = ROOT::Math::Similarity(M, C) + ROOT::Math::Similarity(K, V); + AlgebraicSymMatrix55 fse2; ROOT::Math::AssignSym::Evaluate(fse2, M*C); + + // std::cout << "Joseph Form \n" << fse << std::endl; + // std::cout << "Fast Form \n" << fse2 << std::endl; + + + stat.tot++; + auto n1 = isNopd(fse); + auto n2 = isNopd(fse2); + if (n1&&n2) stat.nopd++; + if (n1) stat.jnopd++; + if (n2) stat.fnopd++; + + AlgebraicSymMatrix55 ifse = fse; invertPosDefMatrix(ifse); + AlgebraicSymMatrix55 ifse2 = fse2; invertPosDefMatrix(ifse2); + n1 = isNopd(ifse); + n2 = isNopd(ifse2); + if (n1&&n2) stat.inopd++; + if (n1) stat.ijnopd++; + if (n2) stat.ifnopd++; + + /* // expanded similariy From 341877cc49bbaf2d2efbae7155f0e875da7dea7f Mon Sep 17 00:00:00 2001 From: angelo giacomo zecchinelli Date: Thu, 22 Mar 2018 12:14:21 +0100 Subject: [PATCH 189/426] fix muonEndCap forest --- .../python/fakeEmtfParams_cff.py | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/L1Trigger/L1TMuonEndCap/python/fakeEmtfParams_cff.py b/L1Trigger/L1TMuonEndCap/python/fakeEmtfParams_cff.py index a663c6a3a407f..f349816d5feb0 100644 --- a/L1Trigger/L1TMuonEndCap/python/fakeEmtfParams_cff.py +++ b/L1Trigger/L1TMuonEndCap/python/fakeEmtfParams_cff.py @@ -37,23 +37,23 @@ firstValid = cms.vuint32(1) ) -emtfForestsDB = cms.ESSource( - "PoolDBESSource", - CondDB, - toGet = cms.VPSet( - cms.PSet( - ## https://cms-conddb.cern.ch/cmsDbBrowser/search/Prod/L1TMuonEndCapForest - record = cms.string("L1TMuonEndCapForestRcd"), - - # ## v5 EMTF pT LUTs from ~August 2016 - # tag = cms.string("L1TMuonEndCapForest_static_2016_mc") - # ## v6 EMTF pT LUTs from May 24, 2017 - # tag = cms.string("L1TMuonEndCapForest_static_Sq_20170523_mc") - ## v7 EMTF pT LUTs from June 7, 2017 - AWB 07.06.17 - tag = cms.string("L1TMuonEndCapForest_static_Sq_20170613_v7_mc") - ) - ) - ) +#emtfForestsDB = cms.ESSource( +# "PoolDBESSource", +# CondDB, +# toGet = cms.VPSet( +# cms.PSet( +# ## https://cms-conddb.cern.ch/cmsDbBrowser/search/Prod/L1TMuonEndCapForest +# record = cms.string("L1TMuonEndCapForestRcd"), +# +# # ## v5 EMTF pT LUTs from ~August 2016 +# # tag = cms.string("L1TMuonEndCapForest_static_2016_mc") +# # ## v6 EMTF pT LUTs from May 24, 2017 +# # tag = cms.string("L1TMuonEndCapForest_static_Sq_20170523_mc") +# ## v7 EMTF pT LUTs from June 7, 2017 - AWB 07.06.17 +# tag = cms.string("L1TMuonEndCapForest_static_Sq_20170613_v7_mc") +# ) +# ) +# ) # ## EMTF ESProducer. Fills CondFormats from local XML files instead of database. # emtfForests = cms.ESProducer( From 6b66fb716c9db75ae40fb2207d457a1559c1723d Mon Sep 17 00:00:00 2001 From: Ferenc Sikler Date: Thu, 22 Mar 2018 15:17:20 +0100 Subject: [PATCH 190/426] removed GBRForestFileName, prepared for 2018 --- .../python/clients/beam_dqm_sourceclient-live_cfg.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/DQM/Integration/python/clients/beam_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/beam_dqm_sourceclient-live_cfg.py index b9d33a3cde290..bb9fd37b202e5 100644 --- a/DQM/Integration/python/clients/beam_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/beam_dqm_sourceclient-live_cfg.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms from Configuration.StandardSequences.Eras import eras -process = cms.Process("BeamMonitor", eras.Run2_2017) +process = cms.Process("BeamMonitor", eras.Run2_2018) #---------------------------------------------- # Switch to change between firstStep and Pixel @@ -131,7 +131,6 @@ minLayers = cms.vint32( 0, 2, 3 ) ), ignoreVertices = cms.bool( True ), - GBRForestFileName = cms.string( "" ) ) process.pixelTracksHP = cms.EDProducer( "TrackCollectionFilterCloner", minQuality = cms.string( "highPurity" ), From e11f03c2ca0cfd1dda1195df221a729e86cb3625 Mon Sep 17 00:00:00 2001 From: Ferenc Sikler Date: Thu, 22 Mar 2018 15:17:28 +0100 Subject: [PATCH 191/426] removed GBRForestFileName, prepared for 2018 --- .../python/clients/beamhlt_dqm_sourceclient-live_cfg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DQM/Integration/python/clients/beamhlt_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/beamhlt_dqm_sourceclient-live_cfg.py index 613a9b5aee636..c4c3e0c82b562 100755 --- a/DQM/Integration/python/clients/beamhlt_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/beamhlt_dqm_sourceclient-live_cfg.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms from Configuration.StandardSequences.Eras import eras -process = cms.Process("BeamMonitor", eras.Run2_2017) +process = cms.Process("BeamMonitor", eras.Run2_2018) # Message logger #process.load("FWCore.MessageLogger.MessageLogger_cfi") From f8934772d33c8bc636a0c8284ddc873ba5a6be62 Mon Sep 17 00:00:00 2001 From: Petar Date: Thu, 22 Mar 2018 10:57:47 -0500 Subject: [PATCH 192/426] Matti's fix of the large memory footprint: move the TemplateStore2D (~ 14 MB) from the stack to the heap. We have enough memory in the process, but not enough on the stack! --- RecoLocalTracker/SiPixelRecHits/src/SiPixelTemplate2D.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/RecoLocalTracker/SiPixelRecHits/src/SiPixelTemplate2D.cc b/RecoLocalTracker/SiPixelRecHits/src/SiPixelTemplate2D.cc index 6e076cb2c3843..87546ebeb35e8 100644 --- a/RecoLocalTracker/SiPixelRecHits/src/SiPixelTemplate2D.cc +++ b/RecoLocalTracker/SiPixelRecHits/src/SiPixelTemplate2D.cc @@ -267,14 +267,14 @@ bool SiPixelTemplate2D::pushfile(const SiPixel2DTemplateDBObject& dbobject, std: SiPixel2DTemplateDBObject db = dbobject; // Create a local template storage entry - SiPixelTemplateStore2D theCurrentTemp; - + /// SiPixelTemplateStore2D theCurrentTemp; // can't do this (crashes): too large (14 MB) for stack! + auto tmpPtr = std::make_unique(); // must be allocated on the heap instead + auto & theCurrentTemp = *tmpPtr; + // Fill the template storage for each template calibration stored in the db for(int m=0; m Date: Thu, 22 Mar 2018 12:00:00 -0500 Subject: [PATCH 193/426] 1) Matti's fix moving template store from stack to the heap. Applied to PixelTemplate, PixelTemplate2D, and GenError. 2) change thePixelTemp_ to pixelTemp in pushfile() to avoid confusion with the class variable. (pushfile() is invoked globally). --- .../SiPixel2DTemplateDBObjectESProducer.cc | 6 ++++-- .../interface/SiPixelGenError.h | 8 +++----- .../interface/SiPixelTemplate.h | 8 +++++--- .../interface/SiPixelTemplate2D.h | 5 +++-- .../SiPixelRecHits/src/SiPixelGenError.cc | 20 +++++++++---------- .../SiPixelRecHits/src/SiPixelTemplate.cc | 19 ++++++++++-------- .../SiPixelRecHits/src/SiPixelTemplate2D.cc | 10 +++++----- 7 files changed, 41 insertions(+), 35 deletions(-) diff --git a/CalibTracker/SiPixelESProducers/plugins/SiPixel2DTemplateDBObjectESProducer.cc b/CalibTracker/SiPixelESProducers/plugins/SiPixel2DTemplateDBObjectESProducer.cc index 88338572ffadd..511d58b044e9d 100644 --- a/CalibTracker/SiPixelESProducers/plugins/SiPixel2DTemplateDBObjectESProducer.cc +++ b/CalibTracker/SiPixelESProducers/plugins/SiPixel2DTemplateDBObjectESProducer.cc @@ -39,8 +39,10 @@ std::shared_ptr SiPixel2DTemplateDBObjectESProducer:: GlobalPoint center(0.0, 0.0, 0.0); float theMagField = magfield.product()->inTesla(center).mag(); - std::string label = "numerator"; // &&& Temporary: matches Barrel Layer1 for 2017 data - + // std::string label = "numerator"; // &&& Temporary: matches Barrel Layer1 for 2017 data + // std::string label = "denominator"; // &&& Temporary: matches Barrel Layer1 fullsim MC + std::string label = ""; // the correct default + if( theMagField>=-0.1 && theMagField<1.0 ) label = "0T"; else if(theMagField>=1.0 && theMagField<2.5 ) label = "2T"; else if(theMagField>=2.5 && theMagField<3.25) label = "3T"; diff --git a/RecoLocalTracker/SiPixelRecHits/interface/SiPixelGenError.h b/RecoLocalTracker/SiPixelRecHits/interface/SiPixelGenError.h index 8be4f20b7ca94..7d01c8b7966db 100644 --- a/RecoLocalTracker/SiPixelRecHits/interface/SiPixelGenError.h +++ b/RecoLocalTracker/SiPixelRecHits/interface/SiPixelGenError.h @@ -9,11 +9,9 @@ // V2.01 - Allow subdetector ID=5 for FPix R2P2, Fix error message // V2.10 - Update the variable size [SI_PIXEL_TEMPLATE_USE_BOOST] option so that it works with VI's enhancements // V2.20 - Add directory path selection to the ascii pushfile method +// V2.21 - Move templateStore to the heap, fix variable name in pushfile() - -// - // Build the template storage structure from several pieces #ifndef SiPixelGenError_h @@ -121,10 +119,10 @@ class SiPixelGenError { // Load the private store with info from the file with the index (int) filenum from directory dir: // ${dir}generror_summary_zp${filenum}.out - static bool pushfile(int filenum, std::vector< SiPixelGenErrorStore > & thePixelTemp_ , std::string dir = ""); + static bool pushfile(int filenum, std::vector< SiPixelGenErrorStore > & pixelTemp , std::string dir = ""); #ifndef SI_PIXEL_TEMPLATE_STANDALONE - static bool pushfile(const SiPixelGenErrorDBObject& dbobject, std::vector< SiPixelGenErrorStore > & thePixelTemp_); // load the private store with info from db + static bool pushfile(const SiPixelGenErrorDBObject& dbobject, std::vector< SiPixelGenErrorStore > & pixelTemp); // load the private store with info from db #endif // initialize the binary search information; diff --git a/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate.h b/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate.h index e73d38de63bc8..bd172853c7c37 100755 --- a/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate.h +++ b/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate.h @@ -77,6 +77,8 @@ // V10.12 - Enforce minimum signal size in pixel charge uncertainty calculation // V10.13 - Update the variable size [SI_PIXEL_TEMPLATE_USE_BOOST] option so that it works with VI's enhancements // V10.20 - Add directory path selection to the ascii pushfile method +// V10.21 - Address runtime issues in pushfile() for gcc 7.X due to using tempfile as char string + misc. cleanup [Petar] +// V10.22 - Move templateStore to the heap, fix variable name in pushfile() [Petar] @@ -260,10 +262,10 @@ class SiPixelTemplate { // Load the private store with info from the file with the index (int) filenum from directory dir: // ${dir}template_summary_zp${filenum}.out #ifdef SI_PIXEL_TEMPLATE_STANDALONE - static bool pushfile(int filenum, std::vector< SiPixelTemplateStore > & thePixelTemp_ , std::string dir = ""); + static bool pushfile(int filenum, std::vector< SiPixelTemplateStore > & pixelTemp , std::string dir = ""); #else - static bool pushfile(int filenum, std::vector< SiPixelTemplateStore > & thePixelTemp_ , std::string dir = "CalibTracker/SiPixelESProducers/data/"); // *&^%$#@! Different default dir -- remove once FastSim is updated. - static bool pushfile(const SiPixelTemplateDBObject& dbobject, std::vector< SiPixelTemplateStore > & thePixelTemp_); // load the private store with info from db + static bool pushfile(int filenum, std::vector< SiPixelTemplateStore > & pixelTemp , std::string dir = "CalibTracker/SiPixelESProducers/data/"); // *&^%$#@! Different default dir -- remove once FastSim is updated. + static bool pushfile(const SiPixelTemplateDBObject& dbobject, std::vector< SiPixelTemplateStore > & pixelTemp); // load the private store with info from db #endif // initialize the rest; diff --git a/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate2D.h b/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate2D.h index f1b67122fe49b..0927a4ad429c8 100644 --- a/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate2D.h +++ b/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate2D.h @@ -14,6 +14,7 @@ // v2.25 - Resize template store to accommodate FPix Templates // v2.30 - Fix bug found by P. Shuetze that compromises sqlite file loading // v2.35 - Add directory path selection to the ascii pushfile method +// V2.36 - Move templateStore to the heap, fix variable name in pushfile() // // Build the template storage structure from several pieces @@ -136,10 +137,10 @@ class SiPixelTemplate2D { // load the private store with info from the // file with the index (int) filenum ${dir}template_summary_zp${filenum}.out - static bool pushfile(int filenum, std::vector< SiPixelTemplateStore2D > & thePixelTemp_, std::string dir = ""); + static bool pushfile(int filenum, std::vector< SiPixelTemplateStore2D > & pixelTemp, std::string dir = ""); #ifndef SI_PIXEL_TEMPLATE_STANDALONE - static bool pushfile(const SiPixel2DTemplateDBObject& dbobject, std::vector< SiPixelTemplateStore2D > & thePixelTemp_); // load the private store with info from db + static bool pushfile(const SiPixel2DTemplateDBObject& dbobject, std::vector< SiPixelTemplateStore2D > & pixelTemp); // load the private store with info from db #endif // Initialize things before interpolating diff --git a/RecoLocalTracker/SiPixelRecHits/src/SiPixelGenError.cc b/RecoLocalTracker/SiPixelRecHits/src/SiPixelGenError.cc index 3e485dec0460c..5f11139037a11 100644 --- a/RecoLocalTracker/SiPixelRecHits/src/SiPixelGenError.cc +++ b/RecoLocalTracker/SiPixelRecHits/src/SiPixelGenError.cc @@ -9,11 +9,9 @@ // V2.01 - Allow subdetector ID=5 for FPix R2P2, Fix error message // V2.10 - Update the variable size [SI_PIXEL_TEMPLATE_USE_BOOST] option so that it works with VI's enhancements // V2.20 - Add directory path selection to the ascii pushfile method +// V2.21 - Move templateStore to the heap, fix variable name in pushfile() - -// - //#include //#include #ifndef SI_PIXEL_TEMPLATE_STANDALONE @@ -56,7 +54,7 @@ using namespace edm; //! digits of filenum. //! \param filenum - an integer NNNN used in the filename generror_summary_zpNNNN //**************************************************************** -bool SiPixelGenError::pushfile(int filenum, std::vector< SiPixelGenErrorStore > & thePixelTemp_ , std::string dir) +bool SiPixelGenError::pushfile(int filenum, std::vector< SiPixelGenErrorStore > & pixelTemp , std::string dir) { // Add info stored in external file numbered filenum to theGenErrorStore @@ -225,9 +223,9 @@ bool SiPixelGenError::pushfile(int filenum, std::vector< SiPixelGenErrorStore > // Add this info to the store - thePixelTemp_.push_back(theCurrentTemp); + pixelTemp.push_back(theCurrentTemp); - postInit(thePixelTemp_); + postInit(pixelTemp); return true; @@ -251,7 +249,7 @@ bool SiPixelGenError::pushfile(int filenum, std::vector< SiPixelGenErrorStore > //! \param dbobject - db storing multiple generic calibrations //**************************************************************** bool SiPixelGenError::pushfile(const SiPixelGenErrorDBObject& dbobject, - std::vector< SiPixelGenErrorStore > & thePixelTemp_) { + std::vector< SiPixelGenErrorStore > & pixelTemp) { // Add GenError stored in external dbobject to theGenErrorStore // Local variables @@ -264,7 +262,9 @@ bool SiPixelGenError::pushfile(const SiPixelGenErrorDBObject& dbobject, SiPixelGenErrorDBObject db = dbobject; // Create a local GenError storage entry - SiPixelGenErrorStore theCurrentTemp; + /// SiPixelGenErrorStore theCurrentTemp; // not on the stack... + auto tmpPtr = std::make_unique(); // must be allocated on the heap instead + auto & theCurrentTemp = *tmpPtr; // Fill the GenError storage for each GenError calibration stored in the db for(int m=0; m & thePixelTemp_ , std::string dir) +bool SiPixelTemplate::pushfile(int filenum, std::vector< SiPixelTemplateStore > & pixelTemp , std::string dir) { // Add template stored in external file numbered filenum to theTemplateStore @@ -524,9 +525,9 @@ bool SiPixelTemplate::pushfile(int filenum, std::vector< SiPixelTemplateStore > // Add this template to the store - thePixelTemp_.push_back(theCurrentTemp); + pixelTemp.push_back(theCurrentTemp); - postInit(thePixelTemp_); + postInit(pixelTemp); return true; } else { @@ -549,7 +550,7 @@ bool SiPixelTemplate::pushfile(int filenum, std::vector< SiPixelTemplateStore > //! external file template_summary_zpNNNN where NNNN are four digits //! \param dbobject - db storing multiple template calibrations //**************************************************************** -bool SiPixelTemplate::pushfile(const SiPixelTemplateDBObject& dbobject, std::vector< SiPixelTemplateStore > & thePixelTemp_) +bool SiPixelTemplate::pushfile(const SiPixelTemplateDBObject& dbobject, std::vector< SiPixelTemplateStore > & pixelTemp) { // Add template stored in external dbobject to theTemplateStore @@ -562,8 +563,10 @@ bool SiPixelTemplate::pushfile(const SiPixelTemplateDBObject& dbobject, std::vec auto db(dbobject.reader()); // Create a local template storage entry - SiPixelTemplateStore theCurrentTemp; - + /// SiPixelTemplateStore theCurrentTemp; // large, don't allocate it on the stack + auto tmpPtr = std::make_unique(); // must be allocated on the heap instead + auto & theCurrentTemp = *tmpPtr; + // Fill the template storage for each template calibration stored in the db for(int m=0; m @@ -57,7 +57,7 @@ using namespace edm; //! digits of filenum. //! \param filenum - an integer NNNN used in the filename template_summary_zpNNNN //**************************************************************** -bool SiPixelTemplate2D::pushfile(int filenum, std::vector< SiPixelTemplateStore2D > & thePixelTemp_, std::string dir) +bool SiPixelTemplate2D::pushfile(int filenum, std::vector< SiPixelTemplateStore2D > & pixelTemp, std::string dir) { // Add template stored in external file numbered filenum to theTemplateStore @@ -231,7 +231,7 @@ bool SiPixelTemplate2D::pushfile(int filenum, std::vector< SiPixelTemplateStore2 // Add this template to the store - thePixelTemp_.push_back(theCurrentTemp); + pixelTemp.push_back(theCurrentTemp); return true; @@ -254,7 +254,7 @@ bool SiPixelTemplate2D::pushfile(int filenum, std::vector< SiPixelTemplateStore2 //! external file template_summary_zpNNNN where NNNN are four digits //! \param dbobject - db storing multiple template calibrations //**************************************************************** -bool SiPixelTemplate2D::pushfile(const SiPixel2DTemplateDBObject& dbobject, std::vector< SiPixelTemplateStore2D > & thePixelTemp_) +bool SiPixelTemplate2D::pushfile(const SiPixel2DTemplateDBObject& dbobject, std::vector< SiPixelTemplateStore2D > & pixelTemp) { // Add template stored in external dbobject to theTemplateStore @@ -421,7 +421,7 @@ bool SiPixelTemplate2D::pushfile(const SiPixel2DTemplateDBObject& dbobject, std: // Add this template to the store - thePixelTemp_.push_back(theCurrentTemp); + pixelTemp.push_back(theCurrentTemp); } From ea0e4ebea9e887aade792c54fe5acdec6ff7f220 Mon Sep 17 00:00:00 2001 From: mmusich Date: Thu, 22 Mar 2018 21:48:21 +0100 Subject: [PATCH 194/426] Revert "Temporarily disable modifications to DQM sequences pending a fix of the new crashing module" This reverts commit 77374d215ee9a675101b44c2d8fd0858b299b917. --- .../SiStripClientConfig_Tier0_Cosmic_cff.py | 43 +++++++++---------- ...SiStripClientConfig_Tier0_HeavyIons_cff.py | 39 ++++++++--------- .../python/SiStripClientConfig_Tier0_cff.py | 39 ++++++++--------- 3 files changed, 59 insertions(+), 62 deletions(-) diff --git a/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_Cosmic_cff.py b/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_Cosmic_cff.py index 76ebbe3eca577..1380afcfc1496 100644 --- a/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_Cosmic_cff.py +++ b/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_Cosmic_cff.py @@ -21,30 +21,29 @@ getQualityTestsFromFile = cms.untracked.bool(True) ) -# from CalibTracker.SiStripESProducers.SiStripBadModuleFedErrESSource_cfi import* -# siStripBadModuleFedErrESSource.appendToDataLabel = cms.string('BadModules_from_FEDBadChannel') -# siStripBadModuleFedErrESSource.ReadFromFile = cms.bool(False) - -# from CalibTracker.SiStripESProducers.SiStripQualityESProducer_cfi import* -# siStripQualityESProducer.ListOfRecordToMerge = cms.VPSet( -# cms.PSet(record = cms.string("SiStripDetVOffRcd"), tag = cms.string('')), # DCS information -# cms.PSet(record = cms.string('SiStripDetCablingRcd'), tag = cms.string('')), # Use Detector cabling information to exclude detectors not connected -# cms.PSet(record = cms.string('SiStripBadChannelRcd'), tag = cms.string('')), # Online Bad components -# cms.PSet(record = cms.string('SiStripBadFiberRcd'), tag = cms.string('')), # Bad Channel list from the selected IOV as done at PCL -# cms.PSet(record = cms.string('SiStripBadModuleFedErrRcd'), tag = cms.string('BadModules_from_FEDBadChannel')), # BadChannel list from FED erroes -# cms.PSet(record = cms.string('RunInfoRcd'), tag = cms.string('')) # List of FEDs exluded during data taking -# ) -# siStripQualityESProducer.ReduceGranularity = cms.bool(False) -# siStripQualityESProducer.ThresholdForReducedGranularity = cms.double(0.3) -# siStripQualityESProducer.appendToDataLabel = 'MergedBadComponent' - -# siStripBadComponentInfo = cms.EDProducer("SiStripBadComponentInfo", -# StripQualityLabel = cms.string('MergedBadComponent') -# ) +from CalibTracker.SiStripESProducers.SiStripBadModuleFedErrESSource_cfi import* +siStripBadModuleFedErrESSource.appendToDataLabel = cms.string('BadModules_from_FEDBadChannel') +siStripBadModuleFedErrESSource.ReadFromFile = cms.bool(False) + +from CalibTracker.SiStripESProducers.SiStripQualityESProducer_cfi import* +siStripQualityESProducer.ListOfRecordToMerge = cms.VPSet( + cms.PSet(record = cms.string("SiStripDetVOffRcd"), tag = cms.string('')), # DCS information + cms.PSet(record = cms.string('SiStripDetCablingRcd'), tag = cms.string('')), # Use Detector cabling information to exclude detectors not connected + cms.PSet(record = cms.string('SiStripBadChannelRcd'), tag = cms.string('')), # Online Bad components + cms.PSet(record = cms.string('SiStripBadFiberRcd'), tag = cms.string('')), # Bad Channel list from the selected IOV as done at PCL + cms.PSet(record = cms.string('SiStripBadModuleFedErrRcd'), tag = cms.string('BadModules_from_FEDBadChannel')), # BadChannel list from FED erroes + cms.PSet(record = cms.string('RunInfoRcd'), tag = cms.string('')) # List of FEDs exluded during data taking + ) +siStripQualityESProducer.ReduceGranularity = cms.bool(False) +siStripQualityESProducer.ThresholdForReducedGranularity = cms.double(0.3) +siStripQualityESProducer.appendToDataLabel = 'MergedBadComponent' + +siStripBadComponentInfo = cms.EDProducer("SiStripBadComponentInfo", + StripQualityLabel = cms.string('MergedBadComponent') +) # Sequence -# SiStripCosmicDQMClient = cms.Sequence(siStripQTester*siStripOfflineAnalyser*siStripBadComponentInfo) -SiStripCosmicDQMClient = cms.Sequence(siStripQTester*siStripOfflineAnalyser) +SiStripCosmicDQMClient = cms.Sequence(siStripQTester*siStripOfflineAnalyser*siStripBadComponentInfo) #removed modules using TkDetMap #SiStripCosmicDQMClient = cms.Sequence(siStripQTester) diff --git a/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_HeavyIons_cff.py b/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_HeavyIons_cff.py index 4dcac3a03adbb..b145e9b4ff887 100644 --- a/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_HeavyIons_cff.py +++ b/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_HeavyIons_cff.py @@ -32,32 +32,31 @@ getQualityTestsFromFile = cms.untracked.bool(True) ) -# from CalibTracker.SiStripESProducers.SiStripBadModuleFedErrESSource_cfi import* -# siStripBadModuleFedErrESSource.appendToDataLabel = cms.string('BadModules_from_FEDBadChannel') -# siStripBadModuleFedErrESSource.ReadFromFile = cms.bool(False) +from CalibTracker.SiStripESProducers.SiStripBadModuleFedErrESSource_cfi import* +siStripBadModuleFedErrESSource.appendToDataLabel = cms.string('BadModules_from_FEDBadChannel') +siStripBadModuleFedErrESSource.ReadFromFile = cms.bool(False) -# from CalibTracker.SiStripESProducers.SiStripQualityESProducer_cfi import* -# siStripQualityESProducer.ListOfRecordToMerge = cms.VPSet( -# cms.PSet(record = cms.string("SiStripDetVOffRcd"), tag = cms.string('')), # DCS information -# cms.PSet(record = cms.string('SiStripDetCablingRcd'), tag = cms.string('')), # Use Detector cabling information to exclude detectors not connected -# cms.PSet(record = cms.string('SiStripBadChannelRcd'), tag = cms.string('')), # Online Bad components -# cms.PSet(record = cms.string('SiStripBadFiberRcd'), tag = cms.string('')), # Bad Channel list from the selected IOV as done at PCL -# cms.PSet(record = cms.string('SiStripBadModuleFedErrRcd'), tag = cms.string('BadModules_from_FEDBadChannel')), # BadChannel list from FED erroes -# cms.PSet(record = cms.string('RunInfoRcd'), tag = cms.string('')) # List of FEDs exluded during data taking -# ) -# siStripQualityESProducer.ReduceGranularity = cms.bool(False) -# siStripQualityESProducer.ThresholdForReducedGranularity = cms.double(0.3) -# siStripQualityESProducer.appendToDataLabel = 'MergedBadComponent' +from CalibTracker.SiStripESProducers.SiStripQualityESProducer_cfi import* +siStripQualityESProducer.ListOfRecordToMerge = cms.VPSet( + cms.PSet(record = cms.string("SiStripDetVOffRcd"), tag = cms.string('')), # DCS information + cms.PSet(record = cms.string('SiStripDetCablingRcd'), tag = cms.string('')), # Use Detector cabling information to exclude detectors not connected + cms.PSet(record = cms.string('SiStripBadChannelRcd'), tag = cms.string('')), # Online Bad components + cms.PSet(record = cms.string('SiStripBadFiberRcd'), tag = cms.string('')), # Bad Channel list from the selected IOV as done at PCL + cms.PSet(record = cms.string('SiStripBadModuleFedErrRcd'), tag = cms.string('BadModules_from_FEDBadChannel')), # BadChannel list from FED erroes + cms.PSet(record = cms.string('RunInfoRcd'), tag = cms.string('')) # List of FEDs exluded during data taking + ) +siStripQualityESProducer.ReduceGranularity = cms.bool(False) +siStripQualityESProducer.ThresholdForReducedGranularity = cms.double(0.3) +siStripQualityESProducer.appendToDataLabel = 'MergedBadComponent' -# siStripBadComponentInfo = cms.EDProducer("SiStripBadComponentInfo", -# StripQualityLabel = cms.string('MergedBadComponent') -# ) +siStripBadComponentInfo = cms.EDProducer("SiStripBadComponentInfo", + StripQualityLabel = cms.string('MergedBadComponent') +) # define new HI sequence #removed modules using TkDetMap #SiStripOfflineDQMClientHI = cms.Sequence(siStripQTesterHI) -# SiStripOfflineDQMClientHI = cms.Sequence(siStripQTesterHI*siStripOfflineAnalyser*siStripBadComponentInfo) -SiStripOfflineDQMClientHI = cms.Sequence(siStripQTesterHI*siStripOfflineAnalyser) +SiStripOfflineDQMClientHI = cms.Sequence(siStripQTesterHI*siStripOfflineAnalyser*siStripBadComponentInfo) # Services needed for TkHistoMap from CalibTracker.SiStripCommon.TkDetMap_cff import * diff --git a/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_cff.py b/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_cff.py index f9787e729c008..b779f0d3c9319 100644 --- a/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_cff.py +++ b/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_cff.py @@ -37,31 +37,30 @@ getQualityTestsFromFile = cms.untracked.bool(True) ) -# from CalibTracker.SiStripESProducers.SiStripBadModuleFedErrESSource_cfi import* -# siStripBadModuleFedErrESSource.appendToDataLabel = cms.string('BadModules_from_FEDBadChannel') -# siStripBadModuleFedErrESSource.ReadFromFile = cms.bool(False) +from CalibTracker.SiStripESProducers.SiStripBadModuleFedErrESSource_cfi import* +siStripBadModuleFedErrESSource.appendToDataLabel = cms.string('BadModules_from_FEDBadChannel') +siStripBadModuleFedErrESSource.ReadFromFile = cms.bool(False) -# from CalibTracker.SiStripESProducers.SiStripQualityESProducer_cfi import* -# siStripQualityESProducer.ListOfRecordToMerge = cms.VPSet( -# cms.PSet(record = cms.string("SiStripDetVOffRcd"), tag = cms.string('')), # DCS information -# cms.PSet(record = cms.string('SiStripDetCablingRcd'), tag = cms.string('')), # Use Detector cabling information to exclude detectors not connected -# cms.PSet(record = cms.string('SiStripBadChannelRcd'), tag = cms.string('')), # Online Bad components -# cms.PSet(record = cms.string('SiStripBadFiberRcd'), tag = cms.string('')), # Bad Channel list from the selected IOV as done at PCL -# cms.PSet(record = cms.string('SiStripBadModuleFedErrRcd'), tag = cms.string('BadModules_from_FEDBadChannel')), # BadChannel list from FED erroes -# cms.PSet(record = cms.string('RunInfoRcd'), tag = cms.string('')) # List of FEDs exluded during data taking -# ) -# siStripQualityESProducer.ReduceGranularity = cms.bool(False) -# siStripQualityESProducer.ThresholdForReducedGranularity = cms.double(0.3) -# siStripQualityESProducer.appendToDataLabel = 'MergedBadComponent' +from CalibTracker.SiStripESProducers.SiStripQualityESProducer_cfi import* +siStripQualityESProducer.ListOfRecordToMerge = cms.VPSet( + cms.PSet(record = cms.string("SiStripDetVOffRcd"), tag = cms.string('')), # DCS information + cms.PSet(record = cms.string('SiStripDetCablingRcd'), tag = cms.string('')), # Use Detector cabling information to exclude detectors not connected + cms.PSet(record = cms.string('SiStripBadChannelRcd'), tag = cms.string('')), # Online Bad components + cms.PSet(record = cms.string('SiStripBadFiberRcd'), tag = cms.string('')), # Bad Channel list from the selected IOV as done at PCL + cms.PSet(record = cms.string('SiStripBadModuleFedErrRcd'), tag = cms.string('BadModules_from_FEDBadChannel')), # BadChannel list from FED erroes + cms.PSet(record = cms.string('RunInfoRcd'), tag = cms.string('')) # List of FEDs exluded during data taking + ) +siStripQualityESProducer.ReduceGranularity = cms.bool(False) +siStripQualityESProducer.ThresholdForReducedGranularity = cms.double(0.3) +siStripQualityESProducer.appendToDataLabel = 'MergedBadComponent' -# siStripBadComponentInfo = cms.EDProducer("SiStripBadComponentInfo", -# StripQualityLabel = cms.string('MergedBadComponent') -# ) +siStripBadComponentInfo = cms.EDProducer("SiStripBadComponentInfo", + StripQualityLabel = cms.string('MergedBadComponent') +) # Sequence -# SiStripOfflineDQMClient = cms.Sequence(siStripQTester*siStripOfflineAnalyser*siStripBadComponentInfo) -SiStripOfflineDQMClient = cms.Sequence(siStripQTester*siStripOfflineAnalyser) +SiStripOfflineDQMClient = cms.Sequence(siStripQTester*siStripOfflineAnalyser*siStripBadComponentInfo) #removed modules using TkDetMap #SiStripOfflineDQMClient = cms.Sequence(siStripQTester) From ebf16286e19bc5e3897f855398b2dffc350c5296 Mon Sep 17 00:00:00 2001 From: mmusich Date: Thu, 22 Mar 2018 21:28:55 +0100 Subject: [PATCH 195/426] fix segfault in SiStripBadComponentInfo --- .../plugins/SiStripBadComponentInfo.cc | 73 +++++++++++-------- .../plugins/SiStripBadComponentInfo.h | 10 ++- 2 files changed, 48 insertions(+), 35 deletions(-) diff --git a/DQM/SiStripMonitorClient/plugins/SiStripBadComponentInfo.cc b/DQM/SiStripMonitorClient/plugins/SiStripBadComponentInfo.cc index ed98b9fdf4219..d38cd9621ab67 100644 --- a/DQM/SiStripMonitorClient/plugins/SiStripBadComponentInfo.cc +++ b/DQM/SiStripMonitorClient/plugins/SiStripBadComponentInfo.cc @@ -40,27 +40,26 @@ SiStripBadComponentInfo::~SiStripBadComponentInfo() { // -- Begin Run // void SiStripBadComponentInfo::beginRun(edm::Run const& run, edm::EventSetup const& eSetup) { +} +// +// -- Read Condition +// +void SiStripBadComponentInfo::checkBadComponents(edm::EventSetup const& eSetup) { + LogDebug ("SiStripBadComponentInfo") <<"SiStripBadComponentInfo:: Begining of Run"; //Retrieve tracker topology from geometry eSetup.get().get(tTopoHandle_); - + const TrackerTopology* const topo = tTopoHandle_.product(); + unsigned long long cacheID = eSetup.get().cacheIdentifier(); if (m_cacheID_ == !cacheID) { - m_cacheID_ = cacheID; LogDebug("SiStripBadComponentInfo") <<"SiStripBadchannelInfoNew::readCondition : " - << " Change in Cache"; + <<" Change in Cache"; eSetup.get().get(qualityLabel_,siStripQuality_); - } -} -// -// -- Read Condition -// -void SiStripBadComponentInfo::checkBadComponents() { - const TrackerTopology* const topo = tTopoHandle_.product(); - + std::vector BC = siStripQuality_->getBadComponentList(); for (size_t i=0;itecWheel(BC[i].detid); } - fillBadComponentHistos(subdet,component,BC[i]); + fillBadComponentMaps(subdet,component,BC[i]); } + //&&&&&&&&&&&&&&&&&& // Single Strip Info //&&&&&&&&&&&&&&&&&& @@ -125,27 +125,33 @@ void SiStripBadComponentInfo::checkBadComponents() { else subdet=1; component=topo->tecWheel(detid); } - + SiStripQuality::Range sqrange = SiStripQuality::Range( siStripQuality_->getDataVectorBegin()+rp->ibegin , siStripQuality_->getDataVectorBegin()+rp->iend ); for(int it=0;itdecode( *(sqrange.first+it) ).range; - float val = badStripME_->getBinContent(subdet, component); + float val = (mapBadStrip.find(std::make_pair(subdet,component))!=mapBadStrip.end()) ? mapBadStrip.at(std::make_pair(subdet,component)) : 0.; val += range; - badStripME_->setBinContent(subdet, component,val); + mapBadStrip[std::make_pair(subdet,component)]=val; } } } // // -- End Run // +void SiStripBadComponentInfo::endRun(edm::Run const& run, edm::EventSetup const& eSetup){ + LogDebug ("SiStripBadComponentInfo") <<"SiStripBadComponentInfo:: End of Run"; + checkBadComponents(eSetup); +} +// +// -- End Job +// void SiStripBadComponentInfo::dqmEndJob(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter){ LogDebug ("SiStripBadComponentInfo") <<"SiStripBadComponentInfo::dqmEndRun"; bookBadComponentHistos(ibooker, igetter); - checkBadComponents(); - createSummary(badAPVME_); - createSummary(badFiberME_); - createSummary(badStripME_); + createSummary(badAPVME_ ,mapBadAPV ); + createSummary(badFiberME_,mapBadFiber); + createSummary(badStripME_,mapBadStrip); } // // -- Book MEs for SiStrip Dcs Fraction @@ -159,7 +165,7 @@ void SiStripBadComponentInfo::bookBadComponentHistos(DQMStore::IBooker &ibooker, ibooker.cd("SiStrip"); strip_dir = ibooker.pwd(); } - std::cout << "SiStripBadComponentInfo::bookBadComponentHistos ==> " << strip_dir << " " << ibooker.pwd() << std::endl; + edm::LogInfo ("SiStripBadComponentInfo") << "SiStripBadComponentInfo::bookBadComponentHistos ==> " << strip_dir << " " << ibooker.pwd() << std::endl; if (!strip_dir.empty()) ibooker.setCurrentFolder(strip_dir+"/EventInfo"); else ibooker.setCurrentFolder("SiStrip/EventInfo"); @@ -203,28 +209,31 @@ void SiStripBadComponentInfo::bookBadComponentHistos(DQMStore::IBooker &ibooker, ibooker.cd(); } } -void SiStripBadComponentInfo::fillBadComponentHistos(int xbin,int component,SiStripQuality::BadComponent& BC){ +void SiStripBadComponentInfo::fillBadComponentMaps(int xbin,int component,SiStripQuality::BadComponent& BC){ + + auto index = std::make_pair(xbin,component); if (BC.BadApvs){ - int ntot = std::bitset<16>(BC.BadApvs&0x3f).count(); - float val = badAPVME_->getBinContent(xbin, component); + int ntot = std::bitset<16>(BC.BadApvs&0x3f).count(); + float val = (mapBadAPV.find(index)!=mapBadAPV.end()) ? mapBadAPV.at(index) : 0.; val += ntot; - badAPVME_->setBinContent(xbin, component, val); + mapBadAPV[index]=val; } if (BC.BadFibers){ int ntot = std::bitset<16>(BC.BadFibers&0x7).count(); - float val = badFiberME_->getBinContent(xbin, component); + float val = (mapBadStrip.find(index)!=mapBadStrip.end()) ? mapBadStrip.at(index) : 0.; val+= ntot; - badFiberME_->setBinContent(xbin, component, val); + mapBadStrip[index]=val; } } -void SiStripBadComponentInfo::createSummary(MonitorElement* me) { +void SiStripBadComponentInfo::createSummary(MonitorElement* me,std::map,float > map) { for (int i=1; igetNbinsY(); k++) { - if (me->getBinContent(i,k)) sum+= me->getBinContent(i,k); - } - me->setBinContent(i,me->getNbinsY(), sum); + float sum = 0.0; + for (int k=1; kgetNbinsY(); k++) { + me->setBinContent(i,k,map[std::make_pair(i,k)]); // fill the layer/wheel bins + if (map[std::make_pair(i,k)]) sum+= map[std::make_pair(i,k)]; + } + me->setBinContent(i,me->getNbinsY(), sum); // fill the summary bin (last one) } } #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/DQM/SiStripMonitorClient/plugins/SiStripBadComponentInfo.h b/DQM/SiStripMonitorClient/plugins/SiStripBadComponentInfo.h index af1a3f781dec1..12d4ca3474260 100644 --- a/DQM/SiStripMonitorClient/plugins/SiStripBadComponentInfo.h +++ b/DQM/SiStripMonitorClient/plugins/SiStripBadComponentInfo.h @@ -50,18 +50,22 @@ class SiStripBadComponentInfo: public DQMEDHarvester { protected: void beginRun(edm::Run const&, edm::EventSetup const&) override; + void endRun(edm::Run const&, edm::EventSetup const&) override; void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override; //performed in the endJob private: - void checkBadComponents(); + void checkBadComponents(edm::EventSetup const& eSetup); void bookBadComponentHistos(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter); - void fillBadComponentHistos(int xbin, int component,SiStripQuality::BadComponent& BC); - void createSummary(MonitorElement* me); + void fillBadComponentMaps(int xbin, int component,SiStripQuality::BadComponent& BC); + void createSummary(MonitorElement* me,std::map,float > map); MonitorElement * badAPVME_; MonitorElement * badFiberME_; MonitorElement * badStripME_; + std::map,float > mapBadAPV; + std::map,float > mapBadFiber; + std::map,float > mapBadStrip; unsigned long long m_cacheID_; bool bookedStatus_; From 8b707848196941e9dba3c537b8e12737e4e71c3a Mon Sep 17 00:00:00 2001 From: mmusich Date: Thu, 22 Mar 2018 22:46:51 +0100 Subject: [PATCH 196/426] pass maps by const reference and clear cache at begin run --- .../plugins/SiStripBadComponentInfo.cc | 13 +++++++++---- .../plugins/SiStripBadComponentInfo.h | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/DQM/SiStripMonitorClient/plugins/SiStripBadComponentInfo.cc b/DQM/SiStripMonitorClient/plugins/SiStripBadComponentInfo.cc index d38cd9621ab67..89aa4ab3b056e 100644 --- a/DQM/SiStripMonitorClient/plugins/SiStripBadComponentInfo.cc +++ b/DQM/SiStripMonitorClient/plugins/SiStripBadComponentInfo.cc @@ -34,7 +34,9 @@ SiStripBadComponentInfo::SiStripBadComponentInfo(edm::ParameterSet const& pSet) // SiStripBadComponentInfo::~SiStripBadComponentInfo() { LogDebug("SiStripBadComponentInfo") << "SiStripBadComponentInfo::Deleting SiStripBadComponentInfo "; - + mapBadAPV.clear(); + mapBadFiber.clear(); + mapBadStrip.clear(); } // // -- Begin Run @@ -226,12 +228,15 @@ void SiStripBadComponentInfo::fillBadComponentMaps(int xbin,int component,SiStri mapBadStrip[index]=val; } } -void SiStripBadComponentInfo::createSummary(MonitorElement* me,std::map,float > map) { +void SiStripBadComponentInfo::createSummary(MonitorElement* me,const std::map,float >& map) { for (int i=1; igetNbinsY(); k++) { - me->setBinContent(i,k,map[std::make_pair(i,k)]); // fill the layer/wheel bins - if (map[std::make_pair(i,k)]) sum+= map[std::make_pair(i,k)]; + auto index = std::make_pair(i,k); + if (map.find(index)!=map.end()){ + me->setBinContent(i,k,map.at(index)); // fill the layer/wheel bins + sum += map.at(index); + } } me->setBinContent(i,me->getNbinsY(), sum); // fill the summary bin (last one) } diff --git a/DQM/SiStripMonitorClient/plugins/SiStripBadComponentInfo.h b/DQM/SiStripMonitorClient/plugins/SiStripBadComponentInfo.h index 12d4ca3474260..4086a297403d1 100644 --- a/DQM/SiStripMonitorClient/plugins/SiStripBadComponentInfo.h +++ b/DQM/SiStripMonitorClient/plugins/SiStripBadComponentInfo.h @@ -57,7 +57,7 @@ class SiStripBadComponentInfo: public DQMEDHarvester { void checkBadComponents(edm::EventSetup const& eSetup); void bookBadComponentHistos(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter); void fillBadComponentMaps(int xbin, int component,SiStripQuality::BadComponent& BC); - void createSummary(MonitorElement* me,std::map,float > map); + void createSummary(MonitorElement* me,const std::map,float >& map); MonitorElement * badAPVME_; MonitorElement * badFiberME_; From 3843c692a825bb6f5ea4a83b8ec14deac3b947dd Mon Sep 17 00:00:00 2001 From: Duncan Date: Fri, 23 Mar 2018 10:21:10 +0100 Subject: [PATCH 197/426] Changed online summary plot to be less granular --- .../interface/SiPixelPhase1Summary.h | 4 + .../python/SiPixelPhase1Summary_cfi.py | 11 +- .../src/SiPixelPhase1Summary.cc | 128 ++++++++++++++---- 3 files changed, 113 insertions(+), 30 deletions(-) diff --git a/DQM/SiPixelPhase1Summary/interface/SiPixelPhase1Summary.h b/DQM/SiPixelPhase1Summary/interface/SiPixelPhase1Summary.h index fa3008f39e648..9d5b99afa6d44 100644 --- a/DQM/SiPixelPhase1Summary/interface/SiPixelPhase1Summary.h +++ b/DQM/SiPixelPhase1Summary/interface/SiPixelPhase1Summary.h @@ -68,6 +68,7 @@ bool firstLumi; std::map summaryMap_; + MonitorElement * deadROCSummary; MonitorElement * reportSummary; //Float value of the average of the ins in the grand summary std::map summaryPlotName_; @@ -76,6 +77,9 @@ std::map deadROCTrends_; std::map ineffROCTrends_; + //Error thresholds for the dead ROC plots + std::vector deadRocThresholds_; + //book the summary plots void bookSummaries(DQMStore::IBooker & iBooker); diff --git a/DQM/SiPixelPhase1Summary/python/SiPixelPhase1Summary_cfi.py b/DQM/SiPixelPhase1Summary/python/SiPixelPhase1Summary_cfi.py index f079f8fe6d6ad..fad85abfd48b6 100644 --- a/DQM/SiPixelPhase1Summary/python/SiPixelPhase1Summary_cfi.py +++ b/DQM/SiPixelPhase1Summary/python/SiPixelPhase1Summary_cfi.py @@ -30,7 +30,9 @@ MapName = cms.string("Charge"), MapHist = cms.string("mean_charge") ) - ) + ), + # Number of dead ROCs required to generate an error. Order must be layers 1-4, ring1, ring2. + DeadROCErrorThreshold = cms.vdouble(0.2,0.2,0.2,0.2,0.2,0.2) ) SiPixelPhase1SummaryOffline = DQMEDHarvester("SiPixelPhase1Summary", @@ -58,7 +60,9 @@ MapName = cms.string("Charge"), MapHist = cms.string("mean_charge") ) - ) + ), + DeadROCErrorThreshold = cms.vdouble(0.2,0.2,0.2,0.2,0.2,0.2) + ) SiPixelPhase1SummaryCosmics = DQMEDHarvester("SiPixelPhase1Summary", @@ -78,7 +82,8 @@ MapName = cms.string("Charge"), MapHist = cms.string("mean_charge") ) - ) + ), + DeadROCErrorThreshold = cms.vdouble(0.2,0.2,0.2,0.2,0.2,0.2) ) ADCQTester = cms.EDAnalyzer("QualityTester", diff --git a/DQM/SiPixelPhase1Summary/src/SiPixelPhase1Summary.cc b/DQM/SiPixelPhase1Summary/src/SiPixelPhase1Summary.cc index 1e675484e0b7e..5b6087fa85c24 100644 --- a/DQM/SiPixelPhase1Summary/src/SiPixelPhase1Summary.cc +++ b/DQM/SiPixelPhase1Summary/src/SiPixelPhase1Summary.cc @@ -62,7 +62,7 @@ SiPixelPhase1Summary::SiPixelPhase1Summary(const edm::ParameterSet& iConfig) : for (auto const mapPSet : mapPSets){ summaryPlotName_[mapPSet.getParameter("MapName")] = mapPSet.getParameter("MapHist"); } - + deadRocThresholds_ = conf_.getParameter >("DeadROCErrorThreshold"); } SiPixelPhase1Summary::~SiPixelPhase1Summary() @@ -83,9 +83,9 @@ void SiPixelPhase1Summary::dqmEndLuminosityBlock(DQMStore::IBooker & iBooker, DQ } if (runOnEndLumi_){ - fillSummaries(iBooker,iGetter); int lumiSec = lumiSeg.id().luminosityBlock(); fillTrendPlots(iBooker,iGetter,lumiSec); + fillSummaries(iBooker,iGetter); } // iBooker.cd(); @@ -103,8 +103,9 @@ void SiPixelPhase1Summary::dqmEndJob(DQMStore::IBooker & iBooker, DQMStore::IGet firstLumi = false; } if (runOnEndJob_){ - fillSummaries(iBooker,iGetter); if (!runOnEndLumi_) fillTrendPlots(iBooker,iGetter); //If we're filling these plots at the end lumi step, it doesn't really make sense to also do them at the end job + fillSummaries(iBooker,iGetter); + } } @@ -125,13 +126,37 @@ void SiPixelPhase1Summary::bookSummaries(DQMStore::IBooker & iBooker){ auto name = mapInfo.first; summaryMap_[name] = iBooker.book2D("pixel"+name+"Summary","Pixel "+name+" Summary",12,0,12,4,0,4); } - //Now book the overall summary map + //Make the new 6 bin ROC summary + deadROCSummary = iBooker.book2D("deadROCSummary","Percentage of dead ROCs per layer/ring",2,0,2,4,0,4); + std::vector xAxisLabelsReduced_ = {"Barrel","Forward"}; + deadROCSummary->setAxisTitle("Subdetector",1); + for (unsigned int i = 0; i < xAxisLabelsReduced_.size(); i++){ + deadROCSummary->setBinLabel(i+1,xAxisLabelsReduced_[i]); + } + + //Book the summary plot iBooker.setCurrentFolder("PixelPhase1/EventInfo"); - summaryMap_["Grand"] = iBooker.book2D("reportSummaryMap","Pixel Summary Map",12,0,12,4,0,4); + + if (runOnEndLumi_){ + //New less granular summary plot - this is currently only done online + summaryMap_["Grand"] = iBooker.book2D("reportSummaryMap_new","Pixel Summary Map",2,0,2,4,0,4); + summaryMap_["Grand"]->setAxisTitle("Subdetector",1); + for (unsigned int i = 0; i < xAxisLabelsReduced_.size(); i++){ + summaryMap_["Grand"]->setBinLabel(i+1,xAxisLabelsReduced_[i]); + for (unsigned int j = 0; j < 4; j++){ summaryMap_["Grand"]->setBinContent(i,j,-1);} + } + } + else{ + //Book the original summary plot, for now juts doing this one offline. + summaryMap_["Grand"] = iBooker.book2D("reportSummaryMap","Pixel Summary Map",12,0,12,4,0,4); + } + reportSummary = iBooker.bookFloat("reportSummary"); + //Now set up axis and bin labels for (auto summaryMapEntry: summaryMap_){ + if (summaryMapEntry.first == "Grand") continue; auto summaryMap = summaryMapEntry.second; for (unsigned int i = 0; i < xAxisLabels_.size(); i++){ summaryMap->setBinLabel(i+1, xAxisLabels_[i],1); @@ -141,13 +166,14 @@ void SiPixelPhase1Summary::bookSummaries(DQMStore::IBooker & iBooker){ } summaryMap->setAxisTitle("Subdetector",1); summaryMap->setAxisTitle("Layer/disk",2); - for (int i = 0; i < 12; i++){ // !??!?!? xAxisLabels_.size() ?!?! - for (int j = 0; j < 4; j++){ // !??!?!? yAxisLabels_.size() ?!?!?! + for (int i = 0; i < summaryMap->getTH1()->GetXaxis()->GetNbins(); i++){ // !??!?!? xAxisLabels_.size() ?!?! + for (int j = 0; j < summaryMap->getTH1()->GetYaxis()->GetNbins(); j++){ // !??!?!? yAxisLabels_.size() ?!?!?! summaryMap->Fill(i,j,-1.); } } } reportSummary->Fill(-1.); + //Reset the iBooker iBooker.setCurrentFolder("PixelPhase1/"); } @@ -175,8 +201,8 @@ void SiPixelPhase1Summary::bookTrendPlots(DQMStore::IBooker & iBooker){ } } else { - deadROCTrends_[offline] = iBooker.book1D("deadRocTotal","N dead ROCs",6,0,6); - ineffROCTrends_[offline] = iBooker.book1D("ineffRocTotal","N inefficient ROCs",6,0,6); + deadROCTrends_[offline] = iBooker.bookProfile("deadRocTotal","N dead ROCs",6,0,6,0.,8192,""); + ineffROCTrends_[offline] = iBooker.bookProfile("ineffRocTotal","N inefficient ROCs",6,0,6,0.,8192,""); deadROCTrends_[offline]->setAxisTitle("Subdetector",1); ineffROCTrends_[offline]->setAxisTitle("Subdetector",1); for (unsigned int i = 1; i <= binAxisLabels.size(); i++){ @@ -223,28 +249,68 @@ void SiPixelPhase1Summary::fillSummaries(DQMStore::IBooker & iBooker, DQMStore:: } } } + + //Fill the dead ROC summary + std::vector trendOrder = {layer1,layer2,layer3,layer4,ring1,ring2}; + std::vector nRocsPerTrend = {1536,3584,5632,8192,4224,6528}; + for (unsigned int i = 0; i < trendOrder.size(); i++){ + int xBin = i < 4 ? 1 : 2; + int yBin = i%4 + 1; + float nROCs = 0.; + if (runOnEndLumi_){ //Online case + TH1 * tempProfile = deadROCTrends_[trendOrder[i]]->getTH1(); + nROCs = tempProfile->GetBinContent(tempProfile->FindLastBinAbove()); + } + else { //Offline case + TH1* tempProfile = deadROCTrends_[offline]->getTH1(); + nROCs = tempProfile->GetBinContent(i+1); + } + deadROCSummary->setBinContent(xBin,yBin,nROCs/nRocsPerTrend[i]); + } + //Sum of non-negative bins for the reportSummary float sumOfNonNegBins = 0.; //Now we will use the other summary maps to create the overall map. - for (int i = 0; i < 12; i++){ // !??!?!? xAxisLabels_.size() ?!?! - if (summaryMap_["Grand"]==nullptr){ - edm::LogWarning("SiPixelPhase1Summary") << "Grand summary does not exist!"; - break; - } - for (int j = 0; j < 4; j++){ // !??!?!? yAxisLabels_.size() ?!?!?! - summaryMap_["Grand"]->setBinContent(i+1,j+1,1); // This resets the map to be good. We only then set it to 0 if there has been a problem in one of the other summaries. - for (auto const mapInfo: summaryPlotName_){ //Check summary maps - auto name = mapInfo.first; - if (summaryMap_[name]==nullptr){ - edm::LogWarning("SiPixelPhase1Summary") << "Summary " << name << " does not exist!"; - continue; + //For now we only want to do this offline + if (!runOnEndLumi_){ + for (int i = 0; i < 12; i++){ // !??!?!? xAxisLabels_.size() ?!?! + if (summaryMap_["Grand"]==nullptr){ + edm::LogWarning("SiPixelPhase1Summary") << "Grand summary does not exist!"; + break; + } + for (int j = 0; j < 4; j++){ // !??!?!? yAxisLabels_.size() ?!?!?! + summaryMap_["Grand"]->setBinContent(i+1,j+1,1); // This resets the map to be good. We only then set it to 0 if there has been a problem in one of the other summaries. + for (auto const mapInfo: summaryPlotName_){ //Check summary maps + auto name = mapInfo.first; + if (summaryMap_[name]==nullptr){ + edm::LogWarning("SiPixelPhase1Summary") << "Summary " << name << " does not exist!"; + continue; + } + if (summaryMap_["Grand"]->getBinContent(i+1,j+1) > summaryMap_[name]->getBinContent(i+1,j+1)) summaryMap_["Grand"]->setBinContent(i+1,j+1,summaryMap_[name]->getBinContent(i+1,j+1)); } - if (summaryMap_["Grand"]->getBinContent(i+1,j+1) > summaryMap_[name]->getBinContent(i+1,j+1)) summaryMap_["Grand"]->setBinContent(i+1,j+1,summaryMap_[name]->getBinContent(i+1,j+1)); + if (summaryMap_["Grand"]->getBinContent(i+1,j+1) > -0.1) sumOfNonNegBins += summaryMap_["Grand"]->getBinContent(i+1,j+1); + } + } + reportSummary->Fill(sumOfNonNegBins/40.); // The average of the 40 useful bins in the summary map. + } + + //Fill the new overall map + // if (!runOnEndLumi_) return; + else{ //Do this for online only + for (int i = 0; i < 2; i++){ + if (summaryMap_["Grand"]==nullptr){ + edm::LogWarning("SiPixelPhase1Summary") << "Grand summary does not exist!"; + break; + } + for (int j = 0; j < 4; j++){ // !??!?!? yAxisLabels_.size() ?!?!?! + //Ignore the bins without detectors in them + if (i == 1 && j > 1) continue; + summaryMap_["Grand"]->setBinContent(i+1,j+1,1); // This resets the map to be good. We only then set it to 0 if there has been a problem in one of the other summaries. + if (deadROCSummary->getBinContent(i+1,j+1) > deadRocThresholds_[i*4+j]) summaryMap_["Grand"]->setBinContent(i+1,j+1,0); + sumOfNonNegBins += summaryMap_["Grand"]->getBinContent(i+1,j+1); } - if (summaryMap_["Grand"]->getBinContent(i+1,j+1) > -0.1) sumOfNonNegBins += summaryMap_["Grand"]->getBinContent(i+1,j+1); } } - reportSummary->Fill(sumOfNonNegBins/40.); // The average of the 40 useful bins in the summary map. } @@ -256,9 +322,17 @@ void SiPixelPhase1Summary::fillTrendPlots(DQMStore::IBooker & iBooker, DQMStore: // If we're running in online mode and the lumi section is not modulo 10, return. Offline running always uses lumiSec=0, so it will pass this test. if (lumiSec%10 != 0) return; + if (runOnEndLumi_) { + MonitorElement * nClustersAll = iGetter.get("PixelPhase1/Phase1_MechanicalView/num_clusters_per_Lumisection_PXAll"); + if (nClustersAll==nullptr){ + edm::LogWarning("SiPixelPhase1Summary") << "All pixel cluster trend plot not available!!"; + return; + } + if (nClustersAll->getTH1()->GetBinContent(lumiSec) < 100) return; + } + std::string histName; - //Find the total number of filled bins and hi efficiency bins std::vector trendOrder = {layer1,layer2,layer3,layer4,ring1,ring2}; std::vector nFilledROCs(trendOrder.size(),0); @@ -294,8 +368,8 @@ void SiPixelPhase1Summary::fillTrendPlots(DQMStore::IBooker & iBooker, DQMStore: if (!runOnEndLumi_) { //offline for (unsigned int i = 0; i < trendOrder.size(); i++){ - deadROCTrends_[offline]->setBinContent(i+1,nRocsPerTrend[i]-nFilledROCs[i]); - ineffROCTrends_[offline]->setBinContent(i+1,nFilledROCs[i]-hiEffROCs[i]); + deadROCTrends_[offline]->Fill(i,nRocsPerTrend[i]-nFilledROCs[i]); + ineffROCTrends_[offline]->Fill(i,nFilledROCs[i]-hiEffROCs[i]); } } else { //online From f8aeac9086a41dc160e997be433fe5f2091ea48f Mon Sep 17 00:00:00 2001 From: David Date: Fri, 23 Mar 2018 14:28:51 +0100 Subject: [PATCH 198/426] HBHEDigiCollection: only use HB digis now --- DQM/HcalTasks/plugins/DigiTask.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/DQM/HcalTasks/plugins/DigiTask.cc b/DQM/HcalTasks/plugins/DigiTask.cc index ca9d8702899cd..f62f483017313 100644 --- a/DQM/HcalTasks/plugins/DigiTask.cc +++ b/DQM/HcalTasks/plugins/DigiTask.cc @@ -602,6 +602,9 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): { // Explicit check on the DetIds present in the Collection HcalDetId const& did = it->id(); + if (did.subdet() != HcalBarrel) { + continue; + } uint32_t rawid = _ehashmap.lookup(did); if (rawid==0) {meUnknownIds1LS->Fill(1); _unknownIdsPresent=true;continue;} From c7743ec17ef2e64cab3092f557cabd07ecafbcc0 Mon Sep 17 00:00:00 2001 From: Peter Stein Date: Fri, 23 Mar 2018 16:03:58 +0100 Subject: [PATCH 199/426] Reduce the number of bins in the Eloss histograms --- Validation/TrackerHits/src/TrackerHitAnalyzer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Validation/TrackerHits/src/TrackerHitAnalyzer.cc b/Validation/TrackerHits/src/TrackerHitAnalyzer.cc index 5dedceefd0346..6fe9a38d3fd04 100644 --- a/Validation/TrackerHits/src/TrackerHitAnalyzer.cc +++ b/Validation/TrackerHits/src/TrackerHitAnalyzer.cc @@ -101,7 +101,7 @@ void TrackerHitAnalyzer::bookHistograms(DQMStore::IBooker & ibooker,const edm::R const char *Region[] = {"005","051","115","152","225","253", "-050","-105","-151","-215","-252","-325"}; - nbin = 10000; + nbin = 200; // Energy loss histograms for(int i=0; i<12; i++) { From 50dbd820935477cfde11b96abecaaea95e408068 Mon Sep 17 00:00:00 2001 From: David Date: Fri, 23 Mar 2018 16:14:06 +0100 Subject: [PATCH 200/426] Laser task fix: increase z axis for laser signal in fC --- DQM/HcalCommon/interface/ValueQuantity.h | 10 +++++----- DQM/HcalTasks/plugins/LaserTask.cc | 19 ++++++++++--------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/DQM/HcalCommon/interface/ValueQuantity.h b/DQM/HcalCommon/interface/ValueQuantity.h index 335dd9c6b5d51..3787ce0937dbf 100644 --- a/DQM/HcalCommon/interface/ValueQuantity.h +++ b/DQM/HcalCommon/interface/ValueQuantity.h @@ -77,10 +77,10 @@ namespace hcaldqm {ffC_1000,"fC (QIE8)"}, {ffC_3000,"fC (QIE8)"}, {ffC_10000,"fC (QIE8)"}, - {fQIE8fC_1000_50,"fC (QIE8)"}, - {fQIE10fC_2000,"fC (QIE10/11)"}, - {fQIE10fC_10000,"fC (QIE10/11)"}, - {fQIE10fC_400000,"fC (QIE10/11)"}, + {fQIE8fC_1000_50,"fC"}, + {fQIE10fC_2000,"fC"}, + {fQIE10fC_10000,"fC"}, + {fQIE10fC_400000,"fC"}, {ffC_generic_10000,"fC (QIE8/10/11)"}, {ffC_generic_400000,"fC (QIE8/10/11)"}, {fTiming_TS,"Timing"}, @@ -112,7 +112,7 @@ namespace hcaldqm {fTime_ns_250,"Time (ns)"}, {fDualAnodeAsymmetry, "(q_{1}-q_{2})/(q_{1}+q_{2})"}, {fTimingRatio, "q_{SOI+1}/q_{SOI}"}, - {fQIE10fC_100000Coarse,"fC (QIE10/11)"}, + {fQIE10fC_100000Coarse,"fC"}, {fBadTDC, "TDC"}, }; const std::map min_value = { diff --git a/DQM/HcalTasks/plugins/LaserTask.cc b/DQM/HcalTasks/plugins/LaserTask.cc index 45a2a0eb73d89..3226a20580273 100644 --- a/DQM/HcalTasks/plugins/LaserTask.cc +++ b/DQM/HcalTasks/plugins/LaserTask.cc @@ -66,7 +66,7 @@ LaserTask::LaserTask(edm::ParameterSet const& ps): // INITIALIZE _cSignalMean_Subdet.initialize(_name, "SignalMean", hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_3000), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_100000Coarse), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); _cSignalRMS_Subdet.initialize(_name, "SignalRMS", hcaldqm::hashfunctions::fSubdet, @@ -91,12 +91,12 @@ LaserTask::LaserTask(edm::ParameterSet const& ps): hcaldqm::hashfunctions::fFED, new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_3000),0); + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_100000Coarse),0); _cSignalMean_FEDuTCA.initialize(_name, "SignalMean", hcaldqm::hashfunctions::fFED, new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_3000),0); + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_100000Coarse),0); _cSignalRMS_FEDVME.initialize(_name, "SignalRMS", hcaldqm::hashfunctions::fFED, new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), @@ -162,7 +162,7 @@ LaserTask::LaserTask(edm::ParameterSet const& ps): hcaldqm::hashfunctions::fdepth, new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_3000),0); + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_100000Coarse),0); _cSignalRMS_depth.initialize(_name, "SignalRMS", hcaldqm::hashfunctions::fdepth, new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), @@ -293,11 +293,6 @@ LaserTask::LaserTask(edm::ParameterSet const& ps): HcalDetId did = HcalDetId(it->rawId()); HcalElectronicsId eid(_ehashmap.lookup(*it)); int n = _xEntries.get(did); - double msig = _xSignalSum.get(did)/n; - double mtim = _xTimingSum.get(did)/n; - double rsig = sqrt(_xSignalSum2.get(did)/n-msig*msig); - double rtim = sqrt(_xTimingSum2.get(did)/n-mtim*mtim); - // channels missing or low signal if (n==0) { @@ -310,6 +305,12 @@ LaserTask::LaserTask(edm::ParameterSet const& ps): } continue; } + + double msig = _xSignalSum.get(did)/n; + double mtim = _xTimingSum.get(did)/n; + double rsig = sqrt(_xSignalSum2.get(did)/n-msig*msig); + double rtim = sqrt(_xTimingSum2.get(did)/n-mtim*mtim); + _cSignalMean_Subdet.fill(did, msig); _cSignalMean_depth.fill(did, msig); _cSignalRMS_Subdet.fill(did, rsig); From 96e694fc37d3db47725a4671d7f8817377381828 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Fri, 23 Mar 2018 16:34:31 +0100 Subject: [PATCH 201/426] Modify the HGCal geometry to introduce z-dependent wafer type --- .../HGCalCommonData/data/hgcal/v9/hgcal.xml | 32 +++- .../HGCalCommonData/data/hgcal/v9p/hgcal.xml | 156 ++++++++++++++++++ .../HGCalCommonData/data/hgcalEE/v9/hgcal.xml | 16 +- .../data/hgcalEE/v9/hgcalEE.xml | 10 +- .../data/hgcalHEmix/v9/hgcal.xml | 32 +++- .../data/hgcalHEmix/v9/hgcalHEmix.xml | 41 +++-- .../data/hgcalHEsil/v9/hgcal.xml | 16 +- .../data/hgcalHEsil/v9/hgcalHEsil.xml | 10 +- .../interface/HGCalWaferType.h | 40 +++++ .../HGCalCommonData/plugins/DDHGCalEEAlgo.cc | 34 ++-- .../HGCalCommonData/plugins/DDHGCalEEAlgo.h | 14 +- .../HGCalCommonData/plugins/DDHGCalHEAlgo.cc | 39 +++-- .../HGCalCommonData/plugins/DDHGCalHEAlgo.h | 16 +- .../HGCalCommonData/src/HGCalWaferType.cc | 73 ++++++++ .../test/dumpSimGeometry_cfg.py | 6 + 15 files changed, 468 insertions(+), 67 deletions(-) create mode 100644 Geometry/HGCalCommonData/data/hgcal/v9p/hgcal.xml create mode 100644 Geometry/HGCalCommonData/interface/HGCalWaferType.h create mode 100644 Geometry/HGCalCommonData/src/HGCalWaferType.cc diff --git a/Geometry/HGCalCommonData/data/hgcal/v9/hgcal.xml b/Geometry/HGCalCommonData/data/hgcal/v9/hgcal.xml index 67c95fd3076a8..1a531937f9185 100644 --- a/Geometry/HGCalCommonData/data/hgcal/v9/hgcal.xml +++ b/Geometry/HGCalCommonData/data/hgcal/v9/hgcal.xml @@ -11,10 +11,34 @@ - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/HGCalCommonData/data/hgcal/v9p/hgcal.xml b/Geometry/HGCalCommonData/data/hgcal/v9p/hgcal.xml new file mode 100644 index 0000000000000..eb474bf7a9e52 --- /dev/null +++ b/Geometry/HGCalCommonData/data/hgcal/v9p/hgcal.xml @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/HGCalCommonData/data/hgcalEE/v9/hgcal.xml b/Geometry/HGCalCommonData/data/hgcalEE/v9/hgcal.xml index e451989b073c1..57f3245be3063 100644 --- a/Geometry/HGCalCommonData/data/hgcalEE/v9/hgcal.xml +++ b/Geometry/HGCalCommonData/data/hgcalEE/v9/hgcal.xml @@ -11,10 +11,18 @@ - - - - + + + + + + + + + + + + diff --git a/Geometry/HGCalCommonData/data/hgcalEE/v9/hgcalEE.xml b/Geometry/HGCalCommonData/data/hgcalEE/v9/hgcalEE.xml index 30678536b18de..d059fc584d572 100644 --- a/Geometry/HGCalCommonData/data/hgcalEE/v9/hgcalEE.xml +++ b/Geometry/HGCalCommonData/data/hgcalEE/v9/hgcalEE.xml @@ -57,8 +57,14 @@
- - + + [hgcal:rad100200P0], [hgcal:rad100200P1], [hgcal:rad100200P2], + [hgcal:rad100200P3], [hgcal:rad100200P4] + + [hgcal:rad200300P0], [hgcal:rad200300P1], [hgcal:rad200300P2], + [hgcal:rad200300P3], [hgcal:rad200300P4] + + diff --git a/Geometry/HGCalCommonData/data/hgcalHEmix/v9/hgcal.xml b/Geometry/HGCalCommonData/data/hgcalHEmix/v9/hgcal.xml index 0d2d184e162c7..98329b1f6c1ae 100644 --- a/Geometry/HGCalCommonData/data/hgcalHEmix/v9/hgcal.xml +++ b/Geometry/HGCalCommonData/data/hgcalHEmix/v9/hgcal.xml @@ -11,10 +11,34 @@ - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/HGCalCommonData/data/hgcalHEmix/v9/hgcalHEmix.xml b/Geometry/HGCalCommonData/data/hgcalHEmix/v9/hgcalHEmix.xml index f2581fba3c4a8..eac5d626751c2 100644 --- a/Geometry/HGCalCommonData/data/hgcalHEmix/v9/hgcalHEmix.xml +++ b/Geometry/HGCalCommonData/data/hgcalHEmix/v9/hgcalHEmix.xml @@ -16,24 +16,33 @@ HEHeatShield
35.0*mm, 68.0*mm, 1.0*mm, 1.0*mm, 7.9*mm, 6.0*mm - - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 - + + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 + 50.9*mm, 50.9*mm, 50.9*mm, 50.9*mm, 83.9*mm, 83.9*mm, - 83.9*mm, 83.9*mm, 83.9*mm, 83.9*mm, 83.9*mm, 83.9*mm - - 1380.0*mm, 1320.0*mm, 1200.0*mm, 1200.0*mm, 1150.0*mm, 1060.0*mm, - 910.0*mm, 910.0*mm, 910.0*mm, 910.0*mm, 910.0*mm, 910.0*mm - + 83.9*mm, 83.9*mm, 83.9*mm, 83.9*mm, 83.9*mm, 83.9*mm, + 83.9*mm, 83.9*mm, 83.9*mm, 83.9*mm + + [hgcal:radMixL0], [hgcal:radMixL1], [hgcal:radMixL2], + [hgcal:radMixL3], [hgcal:radMixL4], [hgcal:radMixL5], + [hgcal:radMixL6], [hgcal:radMixL7], [hgcal:radMixL8], + [hgcal:radMixL9], [hgcal:radMixL10], [hgcal:radMixL11], + [hgcal:radMixL12], [hgcal:radMixL13], [hgcal:radMixL14], + [hgcal:radMixL15] + 0, 2, 3, 4, 5, 0, 2, 3, 4, 5, 0, 2, 3, 4, 5, 0, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, - 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5 - + 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, + 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, + 1, 2, 3, 4, 5 + + 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, + 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, - 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0 + 0, 0, 0, 1, 0 materials:Cables, materials:H_Scintillator, @@ -56,8 +65,14 @@ 0, 0, 0, 0, 1, 0 - - + + [hgcal:rad100200P0], [hgcal:rad100200P1], [hgcal:rad100200P2], + [hgcal:rad100200P3], [hgcal:rad100200P4] + + [hgcal:rad200300P0], [hgcal:rad200300P1], [hgcal:rad200300P2], + [hgcal:rad200300P3], [hgcal:rad200300P4] + + diff --git a/Geometry/HGCalCommonData/data/hgcalHEsil/v9/hgcal.xml b/Geometry/HGCalCommonData/data/hgcalHEsil/v9/hgcal.xml index 8407714e8c4f9..b254e1b034f54 100644 --- a/Geometry/HGCalCommonData/data/hgcalHEsil/v9/hgcal.xml +++ b/Geometry/HGCalCommonData/data/hgcalHEsil/v9/hgcal.xml @@ -11,10 +11,18 @@ - - - - + + + + + + + + + + + + diff --git a/Geometry/HGCalCommonData/data/hgcalHEsil/v9/hgcalHEsil.xml b/Geometry/HGCalCommonData/data/hgcalHEsil/v9/hgcalHEsil.xml index 92fe6c52b6039..2c9cdfbb9810f 100644 --- a/Geometry/HGCalCommonData/data/hgcalHEsil/v9/hgcalHEsil.xml +++ b/Geometry/HGCalCommonData/data/hgcalHEsil/v9/hgcalHEsil.xml @@ -43,8 +43,14 @@ 0, 0, 0, 0, 0, 0, 1, 0, 0 - - + + [hgcal:rad100200P0], [hgcal:rad100200P1], [hgcal:rad100200P2], + [hgcal:rad100200P3], [hgcal:rad100200P4] + + [hgcal:rad200300P0], [hgcal:rad200300P1], [hgcal:rad200300P2], + [hgcal:rad200300P3], [hgcal:rad200300P4] + + diff --git a/Geometry/HGCalCommonData/interface/HGCalWaferType.h b/Geometry/HGCalCommonData/interface/HGCalWaferType.h new file mode 100644 index 0000000000000..6e0d64c740588 --- /dev/null +++ b/Geometry/HGCalCommonData/interface/HGCalWaferType.h @@ -0,0 +1,40 @@ +#ifndef HGCalCommonData_HGCalWaferType_h +#define HGCalCommonData_HGCalWaferType_h + +/** \class HGCalWaferType + * + * this class determines the wafer type depending on its position + * (taken from Philippe Bloch's parametrisation) + * rad100, rad200 parameters assume r,z to be in cm + * xpos, ypos, zpos, zmin, waferSize are all in mm + * + * $Date: 2018/03/22 00:06:50 $ + * \author Sunanda Banerjee, Fermilab + * + */ + +#include +#include + +class HGCalWaferType { + +public: + + HGCalWaferType(const std::vector& rad100, + const std::vector& rad200, + double waferSize, double zMin, int cutValue); + ~HGCalWaferType(); + int getType(double xpos, double ypos, double zpos); + std::pair rLimits(double zpos); + +private: + + const std::vector rad100_; + const std::vector rad200_; + const double waferSize_; + const double zMin_; + const int cutValue_; + double r_, R_; +}; + +#endif diff --git a/Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.cc b/Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.cc index 1858deb773523..9312984e8d906 100644 --- a/Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.cc +++ b/Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.cc @@ -15,13 +15,15 @@ //#define EDM_ML_DEBUG -DDHGCalEEAlgo::DDHGCalEEAlgo() { +DDHGCalEEAlgo::DDHGCalEEAlgo() : waferType_(nullptr) { #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "DDHGCalEEAlgo: Creating an instance"; #endif } -DDHGCalEEAlgo::~DDHGCalEEAlgo() {} +DDHGCalEEAlgo::~DDHGCalEEAlgo() { + delete waferType_; +} void DDHGCalEEAlgo::initialize(const DDNumericArguments & nArgs, const DDVectorArguments & vArgs, @@ -87,17 +89,24 @@ void DDHGCalEEAlgo::initialize(const DDNumericArguments & nArgs, << layerSense_[i]; #endif zMinBlock_ = nArgs["zMinBlock"]; - rMaxFine_ = nArgs["rMaxFine"]; - rMinThick_ = nArgs["rMinThick"]; + rad100to200_ = vArgs["rad100to200"]; + rad200to300_ = vArgs["rad200to300"]; + zMinRadPar_ = nArgs["zMinForRadPar"]; + nCutRadPar_ = (int)(nArgs["nCornerCut"]); waferSize_ = nArgs["waferSize"]; waferSepar_ = nArgs["SensorSeparation"]; sectors_ = (int)(nArgs["Sectors"]); #ifdef EDM_ML_DEBUG - edm::LogVerbatim("HGCalGeom") << "zStart " << zMinBlock_ << " rFineCoarse " - << rMaxFine_ << " rMaxThick " << rMinThick_ + edm::LogVerbatim("HGCalGeom") << "zStart " << zMinBlock_ + << " radius for wafer type separation uses " + << rad100to200_.size() << " parameters; zmin " + << zMinRadPar_ << " cutoff " << nCutRadPar_ << " wafer width " << waferSize_ << " separations " << waferSepar_ << " sectors " << sectors_; + for (unsigned int k=0; kgetType(xpos,ypos,zpos); + int copy = type*1000000 + iv*100 + iu; if (u < 0) copy += 10000; if (v < 0) copy += 100000; #ifdef EDM_ML_DEBUG @@ -321,10 +335,8 @@ void DDHGCalEEAlgo::positionSensitive(const DDLogicalPart& glog, double rin, if (iv > ivmAll) ivmAll = iv; ++nin; #endif - double rpos = std::sqrt(xpos*xpos+ypos*ypos); DDTranslation tran(xpos, ypos, 0.0); DDRotation rotation; - int type = (rpos < rMaxFine_) ? 0 : ((rpos < rMinThick_) ? 1 : 2); if (layertype > 1) type += 3; DDName name = DDName(DDSplit(wafers_[type]).first, DDSplit(wafers_[type]).second); diff --git a/Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.h b/Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.h index 3f1dcc25f01f0..00d514dd57962 100644 --- a/Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.h +++ b/Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.h @@ -2,11 +2,13 @@ #define HGCalCommonData_DDHGCalEEAlgo_h #include +#include #include + #include "DetectorDescription/Core/interface/DDTypes.h" #include "DetectorDescription/Core/interface/DDAlgorithm.h" #include "DetectorDescription/Core/interface/DDLogicalPart.h" -#include +#include "Geometry/HGCalCommonData/interface/HGCalWaferType.h" class DDHGCalEEAlgo : public DDAlgorithm { @@ -27,11 +29,13 @@ class DDHGCalEEAlgo : public DDAlgorithm { void constructLayers (const DDLogicalPart&, DDCompactView& cpv); double rMax(double z); void positionSensitive(const DDLogicalPart& glog, double rin, - double rout, int layertype, + double rout, double zpos, int layertype, DDCompactView& cpv); private: + HGCalWaferType* waferType_; + std::vector wafers_; //Wafers std::vector materials_; //Materials std::vector names_; //Names @@ -43,8 +47,10 @@ class DDHGCalEEAlgo : public DDAlgorithm { std::vector layerSense_; //Content of a layer (sensitive?) int firstLayer_; //Copy # of the first sensitive layer double zMinBlock_; //Starting z-value of the block - double rMaxFine_; //Maximum r-value for fine wafer - double rMinThick_; //Transition R between 200 & 300 mum + std::vector rad100to200_; //Parameters for 120-200mum trans. + std::vector rad200to300_; //Parameters for 200-300mum trans. + double zMinRadPar_; //Minimum z for radius parametriz. + int nCutRadPar_; //Cut off threshold for corners double waferSize_; //Width of the wafer double waferSepar_; //Sensor separation int sectors_; //Sectors diff --git a/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.cc b/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.cc index 3e5c7d21d5c21..5bc245b63d0f2 100644 --- a/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.cc +++ b/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.cc @@ -14,13 +14,15 @@ //#define EDM_ML_DEBUG -DDHGCalHEAlgo::DDHGCalHEAlgo() { +DDHGCalHEAlgo::DDHGCalHEAlgo() : waferType_(nullptr) { #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: Creating an instance"; #endif } -DDHGCalHEAlgo::~DDHGCalHEAlgo() {} +DDHGCalHEAlgo::~DDHGCalHEAlgo() { + delete waferType_; +} void DDHGCalHEAlgo::initialize(const DDNumericArguments & nArgs, const DDVectorArguments & vArgs, @@ -131,18 +133,24 @@ void DDHGCalHEAlgo::initialize(const DDNumericArguments & nArgs, << layerSenseBot_[i]; #endif zMinBlock_ = nArgs["zMinBlock"]; - rMaxFine_ = nArgs["rMaxFine"]; - rMinThick_ = nArgs["rMinThick"]; + rad100to200_ = vArgs["rad100to200"]; + rad200to300_ = vArgs["rad200to300"]; + zMinRadPar_ = nArgs["zMinForRadPar"]; + nCutRadPar_ = (int)(nArgs["nCornerCut"]); waferSize_ = nArgs["waferSize"]; waferSepar_ = nArgs["SensorSeparation"]; sectors_ = (int)(nArgs["Sectors"]); #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: zStart " << zMinBlock_ - << " rFineCoarse " << rMaxFine_ - << " rMaxThick " << rMinThick_ + << " radius for wafer type separation uses " + << rad100to200_.size() << " parameters; zmin " + << zMinRadPar_ << " cutoff " << nCutRadPar_ << " wafer width " << waferSize_ << " separations " << waferSepar_ << " sectors " << sectors_; + for (unsigned int k=0; k thick) { @@ -468,7 +480,7 @@ void DDHGCalHEAlgo::positionMix(const DDLogicalPart& glog, } void DDHGCalHEAlgo::positionSensitive(const DDLogicalPart& glog, double rin, - double rout, int layertype, + double rout, double zpos, int layertype, DDCompactView& cpv) { static const double sqrt3 = std::sqrt(3.0); double r = 0.5*(waferSize_ + waferSepar_); @@ -507,7 +519,8 @@ void DDHGCalHEAlgo::positionSensitive(const DDLogicalPart& glog, double rin, ++ntot; #endif if (cornerOne) { - int copy = iv*100 + iu; + int type = waferType_->getType(xpos,ypos,zpos); + int copy = type*1000000 + iv*100 + iu; if (u < 0) copy += 10000; if (v < 0) copy += 100000; #ifdef EDM_ML_DEBUG @@ -522,10 +535,8 @@ void DDHGCalHEAlgo::positionSensitive(const DDLogicalPart& glog, double rin, if (iv > ivmAll) ivmAll = iv; ++nin; #endif - double rpos = std::sqrt(xpos*xpos+ypos*ypos); DDTranslation tran(xpos, ypos, 0.0); DDRotation rotation; - int type = (rpos < rMaxFine_) ? 0 : ((rpos < rMinThick_) ? 1 : 2); if (layertype > 1) type += 3; DDName name = DDName(DDSplit(wafers_[type]).first, DDSplit(wafers_[type]).second); diff --git a/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.h b/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.h index 38928c778b235..88696b36d4bb6 100644 --- a/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.h +++ b/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.h @@ -2,12 +2,14 @@ #define HGCalCommonData_DDHGCalHEAlgo_h #include +#include #include + #include "DetectorDescription/Core/interface/DDTypes.h" #include "DetectorDescription/Core/interface/DDAlgorithm.h" #include "DetectorDescription/Core/interface/DDLogicalPart.h" #include "DetectorDescription/Core/interface/DDMaterial.h" -#include +#include "Geometry/HGCalCommonData/interface/HGCalWaferType.h" class DDHGCalHEAlgo : public DDAlgorithm { @@ -29,14 +31,16 @@ class DDHGCalHEAlgo : public DDAlgorithm { double rMax(double z); void positionMix(const DDLogicalPart& glog,const std::string& name, int copy, double thick, const DDMaterial& matter, - double rin, double rmid, double routF, + double rin, double rmid, double routF, double zz, DDCompactView& cpv); void positionSensitive(const DDLogicalPart& glog, double rin, - double rout, int layertype, + double rout, double zpos, int layertype, DDCompactView& cpv); private: + HGCalWaferType* waferType_; + std::vector wafers_; //Wafers std::vector materials_; //Materials std::vector names_; //Names @@ -61,8 +65,10 @@ class DDHGCalHEAlgo : public DDAlgorithm { std::vector layerSenseBot_; //Content of bottom layer (sensitive?) double zMinBlock_; //Starting z-value of the block - double rMaxFine_; //Maximum r-value for fine wafer - double rMinThick_; //Transition R between 200 & 300 mum + std::vector rad100to200_; //Parameters for 120-200mum trans. + std::vector rad200to300_; //Parameters for 200-300mum trans. + double zMinRadPar_; //Minimum z for radius parametriz. + int nCutRadPar_; //Cut off threshold for corners double waferSize_; //Width of the wafer double waferSepar_; //Sensor separation int sectors_; //Sectors diff --git a/Geometry/HGCalCommonData/src/HGCalWaferType.cc b/Geometry/HGCalCommonData/src/HGCalWaferType.cc new file mode 100644 index 0000000000000..22b7faed7ba49 --- /dev/null +++ b/Geometry/HGCalCommonData/src/HGCalWaferType.cc @@ -0,0 +1,73 @@ +#include "Geometry/HGCalCommonData/interface/HGCalWaferType.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include + +//#define EDM_ML_DEBUG + +const double k_ScaleFromDDD = 0.1; + +HGCalWaferType::HGCalWaferType(const std::vector& rad100, + const std::vector& rad200, + double waferSize, double zMin, + int cutValue) : rad100_(rad100), + rad200_(rad200), + waferSize_(waferSize), + zMin_(zMin), + cutValue_(cutValue) { + r_ = 0.5*waferSize_; + R_ = waferSize_/std::sqrt(3.0); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HGCalGeom") << "HGCalWaferType: initialized with waferR's " + << waferSize_ << ":" << r_ << ":" << R_ + << " Cut " << cutValue_ << " zMin " << zMin_ + << " with " << rad100_.size() << ":" + << rad200_.size() << " parameters for R:"; + for (unsigned k=0; k rv = rLimits(zpos); + int fine(0), coarse(0); + for (int k=0; k<6; ++k) { + double rpos = std::sqrt(xc[k]*xc[k]+yc[k]*yc[k]); + if (rpos <= rv.first) ++fine; + else if (rpos <= rv.second) ++coarse; + } + int type = 2; + if (fine >= cutValue_) type = 0; + else if (coarse >= cutValue_) type = 1; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HGCalGeom") << "HGCalWaferType: position " << xpos << ":" + << ypos << ":" << zpos << " R " << ":" + << rv.first << ":" << rv.second + << " corners|type " << fine << ":" << coarse + << ":" << type ; +#endif + return type; +} + +std::pair HGCalWaferType::rLimits(double zpos) { + double zz = std::abs(zpos); + if (zz < zMin_) zz = zMin_; + zz *= k_ScaleFromDDD; + double rfine = rad100_[0]; + double rcoarse = rad200_[0]; + for (int i=1; i<5; ++i) { + rfine *= zz; rfine += rad100_[i]; + rcoarse *= zz; rcoarse += rad200_[i]; + } + return std::pair(rfine/k_ScaleFromDDD,rcoarse/k_ScaleFromDDD); +} + diff --git a/Geometry/HGCalCommonData/test/dumpSimGeometry_cfg.py b/Geometry/HGCalCommonData/test/dumpSimGeometry_cfg.py index 30f798240d048..ff15753ac81f5 100644 --- a/Geometry/HGCalCommonData/test/dumpSimGeometry_cfg.py +++ b/Geometry/HGCalCommonData/test/dumpSimGeometry_cfg.py @@ -2,6 +2,12 @@ process = cms.Process("DUMP") process.load("Geometry.HGCalCommonData.testHGCXML_cfi") +process.load('FWCore.MessageService.MessageLogger_cfi') + +if 'MessageLogger' in process.__dict__: + process.MessageLogger.categories.append('G4cerr') + process.MessageLogger.categories.append('G4cout') + process.MessageLogger.categories.append('HGCalGeom') process.source = cms.Source("EmptySource") From 1615ca2225edcfb90ebe89c9fbb39b47ce4e7e4e Mon Sep 17 00:00:00 2001 From: Duncan Date: Fri, 23 Mar 2018 16:38:39 +0100 Subject: [PATCH 202/426] Updating new summary map name to be the same as the old --- DQM/SiPixelPhase1Summary/src/SiPixelPhase1Summary.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DQM/SiPixelPhase1Summary/src/SiPixelPhase1Summary.cc b/DQM/SiPixelPhase1Summary/src/SiPixelPhase1Summary.cc index 5b6087fa85c24..ed17e95e564bc 100644 --- a/DQM/SiPixelPhase1Summary/src/SiPixelPhase1Summary.cc +++ b/DQM/SiPixelPhase1Summary/src/SiPixelPhase1Summary.cc @@ -139,7 +139,7 @@ void SiPixelPhase1Summary::bookSummaries(DQMStore::IBooker & iBooker){ if (runOnEndLumi_){ //New less granular summary plot - this is currently only done online - summaryMap_["Grand"] = iBooker.book2D("reportSummaryMap_new","Pixel Summary Map",2,0,2,4,0,4); + summaryMap_["Grand"] = iBooker.book2D("reportSummaryMap","Pixel Summary Map",2,0,2,4,0,4); summaryMap_["Grand"]->setAxisTitle("Subdetector",1); for (unsigned int i = 0; i < xAxisLabelsReduced_.size(); i++){ summaryMap_["Grand"]->setBinLabel(i+1,xAxisLabelsReduced_[i]); From e156ea448ea243a92c6cba5d1f2b0dd5cb3a4e6c Mon Sep 17 00:00:00 2001 From: Vincenzo Innocente Date: Fri, 23 Mar 2018 16:42:25 +0100 Subject: [PATCH 203/426] rms as well --- TrackingTools/KalmanUpdators/src/KFUpdator.cc | 33 ++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/TrackingTools/KalmanUpdators/src/KFUpdator.cc b/TrackingTools/KalmanUpdators/src/KFUpdator.cc index d0cece4394771..21c58ab750664 100644 --- a/TrackingTools/KalmanUpdators/src/KFUpdator.cc +++ b/TrackingTools/KalmanUpdators/src/KFUpdator.cc @@ -14,8 +14,8 @@ namespace { struct Stat { Stat(): tot(0), nopd(0), jnopd(0), fnopd(0), - inopd(0), ijnopd(0), ifnopd(0) - {} + inopd(0), ijnopd(0), ifnopd(0),dtot(0) + {for (int i=0;i<5;++i) idmm[i]=0; } std::atomic tot; std::atomic nopd; @@ -25,8 +25,17 @@ namespace { std::atomic ijnopd; std::atomic ifnopd; + std::atomic dtot; + std::atomic idmm[5]; + double mm = 0; + double dmm[5] = {0}; + bool ok=true; ~Stat() { - std::cout << "KF " << tot + double n = 1.e-3/double(dtot); + std::cout << "KF " << tot*1.e-9 << "G " << mm <<" " + < std::numeric_limits::max() ) stat.ok=false; + } + } + AlgebraicSymMatrix55 ifse = fse; invertPosDefMatrix(ifse); AlgebraicSymMatrix55 ifse2 = fse2; invertPosDefMatrix(ifse2); n1 = isNopd(ifse); @@ -107,7 +133,6 @@ TrajectoryStateOnSurface lupdate(const TrajectoryStateOnSurface& tsos, if (n2) stat.ifnopd++; - /* // expanded similariy AlgebraicSymMatrix55 fse; From d282334d979ea9865efa8562ba0a8b71894bbaa2 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Fri, 23 Mar 2018 17:22:14 +0100 Subject: [PATCH 204/426] Take care of Kevin's & David's comments --- Geometry/HGCalCommonData/interface/HGCalWaferType.h | 2 ++ Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.cc | 12 +++++------- Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.h | 3 ++- Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.cc | 12 +++++------- Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.h | 3 ++- Geometry/HGCalCommonData/src/HGCalWaferType.cc | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Geometry/HGCalCommonData/interface/HGCalWaferType.h b/Geometry/HGCalCommonData/interface/HGCalWaferType.h index 6e0d64c740588..17f05da72e33c 100644 --- a/Geometry/HGCalCommonData/interface/HGCalWaferType.h +++ b/Geometry/HGCalCommonData/interface/HGCalWaferType.h @@ -13,6 +13,7 @@ * */ +#include #include #include @@ -29,6 +30,7 @@ class HGCalWaferType { private: + const double sqrt3_ = 1.0/std::sqrt(3.0); const std::vector rad100_; const std::vector rad200_; const double waferSize_; diff --git a/Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.cc b/Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.cc index 9312984e8d906..00f0d832f64ce 100644 --- a/Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.cc +++ b/Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.cc @@ -15,15 +15,13 @@ //#define EDM_ML_DEBUG -DDHGCalEEAlgo::DDHGCalEEAlgo() : waferType_(nullptr) { +DDHGCalEEAlgo::DDHGCalEEAlgo() { #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "DDHGCalEEAlgo: Creating an instance"; #endif } -DDHGCalEEAlgo::~DDHGCalEEAlgo() { - delete waferType_; -} +DDHGCalEEAlgo::~DDHGCalEEAlgo() { } void DDHGCalEEAlgo::initialize(const DDNumericArguments & nArgs, const DDVectorArguments & vArgs, @@ -126,9 +124,9 @@ void DDHGCalEEAlgo::initialize(const DDNumericArguments & nArgs, edm::LogVerbatim("HGCalGeom") << "DDHGCalEEAlgo: NameSpace " << nameSpace_; #endif - waferType_ = new HGCalWaferType(rad100to200_, rad200to300_, - (waferSize_+waferSepar_), zMinRadPar_, - nCutRadPar_); + waferType_ = std::make_unique(rad100to200_, rad200to300_, + (waferSize_+waferSepar_), + zMinRadPar_, nCutRadPar_); } //////////////////////////////////////////////////////////////////// diff --git a/Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.h b/Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.h index 00d514dd57962..352fd555804ef 100644 --- a/Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.h +++ b/Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.h @@ -1,6 +1,7 @@ #ifndef HGCalCommonData_DDHGCalEEAlgo_h #define HGCalCommonData_DDHGCalEEAlgo_h +#include #include #include #include @@ -34,7 +35,7 @@ class DDHGCalEEAlgo : public DDAlgorithm { private: - HGCalWaferType* waferType_; + std::unique_ptr waferType_; std::vector wafers_; //Wafers std::vector materials_; //Materials diff --git a/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.cc b/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.cc index 5bc245b63d0f2..edc73289080bf 100644 --- a/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.cc +++ b/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.cc @@ -14,15 +14,13 @@ //#define EDM_ML_DEBUG -DDHGCalHEAlgo::DDHGCalHEAlgo() : waferType_(nullptr) { +DDHGCalHEAlgo::DDHGCalHEAlgo() { #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: Creating an instance"; #endif } -DDHGCalHEAlgo::~DDHGCalHEAlgo() { - delete waferType_; -} +DDHGCalHEAlgo::~DDHGCalHEAlgo() { } void DDHGCalHEAlgo::initialize(const DDNumericArguments & nArgs, const DDVectorArguments & vArgs, @@ -170,9 +168,9 @@ void DDHGCalHEAlgo::initialize(const DDNumericArguments & nArgs, edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: NameSpace " << nameSpace_; #endif - waferType_ = new HGCalWaferType(rad100to200_, rad200to300_, - (waferSize_+waferSepar_), zMinRadPar_, - nCutRadPar_); + waferType_ = std::make_unique(rad100to200_, rad200to300_, + (waferSize_+waferSepar_), + zMinRadPar_, nCutRadPar_); } //////////////////////////////////////////////////////////////////// diff --git a/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.h b/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.h index 88696b36d4bb6..02269a25e1cc9 100644 --- a/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.h +++ b/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.h @@ -1,6 +1,7 @@ #ifndef HGCalCommonData_DDHGCalHEAlgo_h #define HGCalCommonData_DDHGCalHEAlgo_h +#include #include #include #include @@ -39,7 +40,7 @@ class DDHGCalHEAlgo : public DDAlgorithm { private: - HGCalWaferType* waferType_; + std::unique_ptr waferType_; std::vector wafers_; //Wafers std::vector materials_; //Materials diff --git a/Geometry/HGCalCommonData/src/HGCalWaferType.cc b/Geometry/HGCalCommonData/src/HGCalWaferType.cc index 22b7faed7ba49..7965c104c04b5 100644 --- a/Geometry/HGCalCommonData/src/HGCalWaferType.cc +++ b/Geometry/HGCalCommonData/src/HGCalWaferType.cc @@ -15,7 +15,7 @@ HGCalWaferType::HGCalWaferType(const std::vector& rad100, zMin_(zMin), cutValue_(cutValue) { r_ = 0.5*waferSize_; - R_ = waferSize_/std::sqrt(3.0); + R_ = sqrt3_*waferSize_; #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "HGCalWaferType: initialized with waferR's " << waferSize_ << ":" << r_ << ":" << R_ From f2ef0e39cc65b4a2368d86e1307afe3acd14f834 Mon Sep 17 00:00:00 2001 From: Vincenzo Innocente Date: Fri, 23 Mar 2018 18:48:54 +0100 Subject: [PATCH 205/426] protect with ifdef --- TrackingTools/KalmanUpdators/src/KFUpdator.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/TrackingTools/KalmanUpdators/src/KFUpdator.cc b/TrackingTools/KalmanUpdators/src/KFUpdator.cc index 21c58ab750664..3a450853d909e 100644 --- a/TrackingTools/KalmanUpdators/src/KFUpdator.cc +++ b/TrackingTools/KalmanUpdators/src/KFUpdator.cc @@ -7,10 +7,13 @@ #include "DataFormats/Math/interface/invertPosDefMatrix.h" #include "DataFormats/Math/interface/ProjectMatrix.h" + +// test of joseph form +#ifdef KU_JF_TEST + #include #include namespace { - struct Stat { Stat(): tot(0), nopd(0), jnopd(0), fnopd(0), @@ -48,6 +51,7 @@ namespace { return m(0,0)<0 || m(1,1)<0 || m(2,2)<0 || m(3,3)<0 || m(4,4)<0; } } +#endif namespace { @@ -94,6 +98,9 @@ TrajectoryStateOnSurface lupdate(const TrajectoryStateOnSurface& tsos, // Compute covariance matrix of local filtered state vector AlgebraicSymMatrix55 fse = ROOT::Math::Similarity(M, C) + ROOT::Math::Similarity(K, V); +// test of joseph form +#ifdef KU_JF_TEST + AlgebraicSymMatrix55 fse2; ROOT::Math::AssignSym::Evaluate(fse2, M*C); // std::cout << "Joseph Form \n" << fse << std::endl; @@ -131,7 +138,7 @@ TrajectoryStateOnSurface lupdate(const TrajectoryStateOnSurface& tsos, if (n1&&n2) stat.inopd++; if (n1) stat.ijnopd++; if (n2) stat.ifnopd++; - +#endif /* // expanded similariy From 13b212fc2047335d000c87c8fb7af928b5dcf147 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Fri, 23 Mar 2018 21:32:35 +0100 Subject: [PATCH 206/426] Modify AlCaReco code to accommodate new EE thresholds --- .../plugins/AlCaIsoTracksFilter.cc | 42 +++++++++--- .../HcalCalibAlgos/test/HcalIsoTrkAnalyzer.cc | 41 +++++++++++- .../IsolatedParticles/interface/eCone.h | 3 + .../IsolatedParticles/interface/eCone.icc | 64 ++++++++++++++----- 4 files changed, 121 insertions(+), 29 deletions(-) diff --git a/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksFilter.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksFilter.cc index 101d31889934a..3eab936d9a235 100644 --- a/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksFilter.cc +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksFilter.cc @@ -92,7 +92,10 @@ class AlCaIsoTracksFilter : public edm::stream::EDFilter("maxTrackP")), slopeRestrictionP_(iConfig.getParameter("slopeTrackP")), eIsolate_(iConfig.getParameter("isolationEnergy")), + hitEthrEB_(iConfig.getParameter("EBHitEnergyThreshold") ), + hitEthrEE0_(iConfig.getParameter("EEHitEnergyThreshold0") ), + hitEthrEE1_(iConfig.getParameter("EEHitEnergyThreshold1") ), + hitEthrEE2_(iConfig.getParameter("EEHitEnergyThreshold2") ), + hitEthrEE3_(iConfig.getParameter("EEHitEnergyThreshold3") ), pTrackLow_(iConfig.getParameter("momentumRangeLow")), pTrackHigh_(iConfig.getParameter("momentumRangeHigh")), preScale_(iConfig.getParameter("preScaleFactor")), @@ -340,13 +348,23 @@ bool AlCaIsoTracksFilter::filter(edm::Event& iEvent, edm::EventSetup const& iSet if (qltyFlag && trkDetItr->okECAL && trkDetItr->okHCAL) { double t_p = pTrack->p(); nselTracks++; - int nRH_eMipDR(0), nNearTRKs(0); - double eMipDR = spr::eCone_ecal(geo, barrelRecHitsHandle, - endcapRecHitsHandle, - trkDetItr->pointHCAL, - trkDetItr->pointECAL, a_mipR_, - trkDetItr->directionECAL, - nRH_eMipDR); + int nNearTRKs(0); + std::vector eIds; + std::vector eHit; + double eEcal = spr::eCone_ecal(geo, barrelRecHitsHandle, + endcapRecHitsHandle, + trkDetItr->pointHCAL, + trkDetItr->pointECAL, a_mipR_, + trkDetItr->directionECAL, + eIds, eHit); + double eMipDR(0); + for (unsigned int k=0; kgetPosition(eIds[k]); + double eta = std::abs(pos.eta()); + double eThr = (eIds[k].subdetId() == EcalBarrel) ? hitEthrEB_ : + (((eta*hitEthrEE3_+hitEthrEE2_)*eta+hitEthrEE1_)*eta+hitEthrEE0_); + if (eHit[k] > eThr) eMipDR += eHit[k]; + } double hmaxNearP = spr::chargeIsolationCone(nTracks, trkCaloDirections, a_charIsoR_, @@ -358,7 +376,7 @@ bool AlCaIsoTracksFilter::filter(edm::Event& iEvent, edm::EventSetup const& iSet << pTrack->pt() << "|" << pTrack->eta() << "|" << pTrack->phi() << "|" << t_p - << "e_MIP " << eMipDR + << "e_MIP " << eMipDR <<":" << eEcal << " Chg Isolation " << hmaxNearP << ":" << eIsolation; if (t_p>pTrackMin_ && eMipDR("maxTrackP",8.0); desc.add("slopeTrackP",0.05090504066); desc.add("isolationEnergy",10.0); + // energy thershold for ECAL (from Egamma group) + desc.add("EBHitEnergyThreshold",0.10); + desc.add("EEHitEnergyThreshold0",-41.0664); + desc.add("EEHitEnergyThreshold1",68.7950); + desc.add("EEHitEnergyThreshold2",-38.1482); + desc.add("EEHitEnergyThreshold3",7.04352); // Prescale events only containing isolated tracks in the range desc.add("momentumRangeLow",20.0); desc.add("momentumRangeHigh",40.0); diff --git a/Calibration/HcalCalibAlgos/test/HcalIsoTrkAnalyzer.cc b/Calibration/HcalCalibAlgos/test/HcalIsoTrkAnalyzer.cc index 2c58a0d98ae35..85551aaf18c99 100644 --- a/Calibration/HcalCalibAlgos/test/HcalIsoTrkAnalyzer.cc +++ b/Calibration/HcalCalibAlgos/test/HcalIsoTrkAnalyzer.cc @@ -132,6 +132,8 @@ class HcalIsoTrkAnalyzer : public edm::one::EDAnalyzer> tok_alg_; TTree *tree, *tree2; + unsigned int t_RunNo, t_EventNo; int t_Run, t_Event, t_DataType, t_ieta, t_iphi; int t_goodPV, t_nVtx, t_nTrk; double t_EventWeight, t_p, t_pt, t_phi; @@ -169,7 +172,7 @@ class HcalIsoTrkAnalyzer : public edm::one::EDAnalyzer *t_trgbits, *t_hltbits; bool t_L1Bit; int t_Tracks, t_TracksProp, t_TracksSaved; - int t_TracksLoose, t_TracksTight; + int t_TracksLoose, t_TracksTight, t_allvertex; std::vector *t_ietaAll, *t_ietaGood, *t_trackType; }; @@ -199,6 +202,11 @@ HcalIsoTrkAnalyzer::HcalIsoTrkAnalyzer(const edm::ParameterSet& iConfig) : useL1Trigger_(iConfig.getUntrackedParameter("useL1Trigger",false)), unCorrect_(iConfig.getUntrackedParameter("unCorrect",false)), collapseDepth_(iConfig.getUntrackedParameter("collapseDepth",false)), + hitEthrEB_(iConfig.getParameter("EBHitEnergyThreshold") ), + hitEthrEE0_(iConfig.getParameter("EEHitEnergyThreshold0") ), + hitEthrEE1_(iConfig.getParameter("EEHitEnergyThreshold1") ), + hitEthrEE2_(iConfig.getParameter("EEHitEnergyThreshold2") ), + hitEthrEE3_(iConfig.getParameter("EEHitEnergyThreshold3") ), triggerEvent_(iConfig.getParameter("labelTriggerEvent")), theTriggerResultsLabel_(iConfig.getParameter("labelTriggerResult")), labelGenTrack_(iConfig.getParameter("labelTrack")), @@ -409,6 +417,7 @@ void HcalIsoTrkAnalyzer::analyze(edm::Event const& iEvent, edm::EventSetup const if (t_goodPV == 0 && beamSpotH.isValid()) { leadPV = beamSpotH->position(); } + t_allvertex = t_goodPV; #ifdef EDM_ML_DEBUG edm::LogVerbatim("HcalIsoTrack") << "Primary Vertex " << leadPV << " out of " << t_goodPV << " vertex"; @@ -446,6 +455,8 @@ void HcalIsoTrkAnalyzer::analyze(edm::Event const& iEvent, edm::EventSetup const spr::propagateCALO(trkCollection, geo, bField, theTrackQuality_, trkCaloDirections, false); std::vector vecL1, vecL3; + t_RunNo = iEvent.id().run(); + t_EventNo = iEvent.id().event(); t_Tracks = trkCollection->size(); t_TracksProp = trkCaloDirections.size(); t_ietaAll->clear(); t_ietaGood->clear(); t_trackType->clear(); @@ -693,6 +704,8 @@ void HcalIsoTrkAnalyzer::beginJob() { } tree2 = fs->make("EventInfo", "Event Information"); + tree2->Branch("t_RunNo", &t_RunNo, "t_RunNo/i"); + tree2->Branch("t_EventNo", &t_EventNo, "t_EventNo/i"); tree2->Branch("t_Tracks", &t_Tracks, "t_Tracks/I"); tree2->Branch("t_TracksProp", &t_TracksProp, "t_TracksProp/I"); tree2->Branch("t_TracksSaved", &t_TracksSaved, "t_TracksSaved/I"); @@ -701,6 +714,7 @@ void HcalIsoTrkAnalyzer::beginJob() { tree2->Branch("t_TrigPass", &t_TrigPass, "t_TrigPass/O"); tree2->Branch("t_TrigPassSel", &t_TrigPassSel, "t_TrigPassSel/O"); tree2->Branch("t_L1Bit", &t_L1Bit, "t_L1Bit/O"); + tree2->Branch("t_allvertex", &t_allvertex, "t_allvertex/I"); t_hltbits = new std::vector(); t_ietaAll = new std::vector(); t_ietaGood = new std::vector(); @@ -786,6 +800,12 @@ void HcalIsoTrkAnalyzer::fillDescriptions(edm::ConfigurationDescriptions& descri desc.add("slopeTrackP",0.05090504066); desc.add("isolationEnergyTight",2.0); desc.add("isolationEnergyLoose",10.0); + // energy thershold for ECAL (from Egamma group) + desc.add("EBHitEnergyThreshold",0.10); + desc.add("EEHitEnergyThreshold0",-41.0664); + desc.add("EEHitEnergyThreshold1",68.7950); + desc.add("EEHitEnergyThreshold2",-38.1482); + desc.add("EEHitEnergyThreshold3",7.04352); // various labels for collections used in the code desc.add("labelTriggerEvent",edm::InputTag("hltTriggerSummaryAOD","","HLT")); desc.add("labelTriggerResult",edm::InputTag("TriggerResults","","HLT")); @@ -890,11 +910,26 @@ std::array HcalIsoTrkAnalyzer::fillTree(std::vector< math::XYZTLorentzVec t_qltyFlag = (qltyFlag && trkDetItr->okECAL && trkDetItr->okHCAL); if (t_qltyFlag) { nselTracks++; - int nRH_eMipDR(0), nNearTRKs(0); + int nNearTRKs(0); + std::vector eIds; + std::vector eHit; t_eMipDR = spr::eCone_ecal(geo, barrelRecHitsHandle, endcapRecHitsHandle, trkDetItr->pointHCAL, trkDetItr->pointECAL, a_mipR_, - trkDetItr->directionECAL, nRH_eMipDR); + trkDetItr->directionECAL, eIds, eHit); + double eEcal(0); + for (unsigned int k=0; kgetPosition(eIds[k]); + double eta = std::abs(pos.eta()); + double eThr = (eIds[k].subdetId() == EcalBarrel) ? hitEthrEB_ : + (((eta*hitEthrEE3_+hitEthrEE2_)*eta+hitEthrEE1_)*eta+hitEthrEE0_); + if (eHit[k] > eThr) eEcal += eHit[k]; + } +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "eMIP befor and after: " << t_eMipDR + << ":" << eEcal; +#endif + t_eMipDR = eEcal; t_hmaxNearP = spr::chargeIsolationCone(nTracks, trkCaloDirections, a_charIsoR_, nNearTRKs, false); t_gentrackP = trackP(pTrack, genParticles); diff --git a/Calibration/IsolatedParticles/interface/eCone.h b/Calibration/IsolatedParticles/interface/eCone.h index f33cd3ef8e037..797f98adce464 100644 --- a/Calibration/IsolatedParticles/interface/eCone.h +++ b/Calibration/IsolatedParticles/interface/eCone.h @@ -41,6 +41,9 @@ namespace spr{ template double eCone_ecal(const CaloGeometry* geo, edm::Handle& barrelhits, edm::Handle& endcaphits, const GlobalPoint& hpoint1, const GlobalPoint& point1, double dR, const GlobalVector& trackMom, int& nRecHits, double ebThr=-100, double eeThr=-100, double tMin=-500, double tMax=500, bool debug=false); + template + double eCone_ecal(const CaloGeometry* geo, edm::Handle& barrelhits, edm::Handle& endcaphits, const GlobalPoint& hpoint1, const GlobalPoint& point1, double dR, const GlobalVector& trackMom, std::vector& coneRecHitDetIds, std::vector& eHit, double ebThr=-100, double eeThr=-100, double tMin=-500, double tMax=500, bool debug=false); + } #include "eCone.icc" diff --git a/Calibration/IsolatedParticles/interface/eCone.icc b/Calibration/IsolatedParticles/interface/eCone.icc index 8ed53aafecf7f..c1b68deb49a3f 100644 --- a/Calibration/IsolatedParticles/interface/eCone.icc +++ b/Calibration/IsolatedParticles/interface/eCone.icc @@ -16,11 +16,11 @@ namespace spr{ nRecHits = -99; double energySum = 0.0; std::set uniqueIdset; - for (unsigned int ihit=0; ihitid()).subdetId(); + for (auto const& ihit : hit) { + int subdet = DetId(ihit->id()).subdetId(); if (detOnly < 0 || subdet == detOnly) { - double eTower = spr::getEnergy(hit[ihit],useRaw); - double tt = hit[ihit]->time(); + double eTower = spr::getEnergy(ihit,useRaw); + double tt = ihit->time(); bool ok = (eTower>hbThr); if (subdet == (int)(HcalEndcap)) ok = (eTower>heThr); else if (subdet == (int)(HcalForward)) ok = (eTower>hfThr); @@ -29,7 +29,7 @@ namespace spr{ energySum += eTower; int eta(-99); int phi(-99); - spr::getEtaPhi(hit[ihit], eta, phi); + spr::getEtaPhi(ihit, eta, phi); int uniqueEtaPhiId = 100*eta+phi; uniqueIdset.insert(uniqueEtaPhiId); } @@ -76,7 +76,7 @@ namespace spr{ int uniqueEtaPhiId = 100*eta+phi; uniqueIdset.insert(uniqueEtaPhiId); // Get list of det ids - coneRecHitDetIds.push_back(hit[ihit]->id()); + coneRecHitDetIds.emplace_back(hit[ihit]->id()); } } @@ -106,18 +106,18 @@ namespace spr{ nRecHits = -99; double energySum = 0.0; std::set uniqueIdset; - for (unsigned int ihit=0; ihitid()); - eHit.push_back(energy); + coneRecHitDetIds.emplace_back(ihit->id()); + eHit.emplace_back(energy); } nRecHits = uniqueIdset.size(); @@ -168,7 +168,7 @@ namespace spr{ int uniqueEtaPhiId = 100*eta+phi; uniqueIdset.insert(uniqueEtaPhiId); // Get vector of detids. - coneRecHitDetIds.push_back(hit[ihit]->id()); + coneRecHitDetIds.emplace_back(hit[ihit]->id()); } } nRecHits = uniqueIdset.size(); @@ -200,12 +200,12 @@ namespace spr{ // No depth in Ecal so nRecHits = hit.size() nRecHits = hit.size(); double energySum = 0.0; - for (unsigned int ihit=0; ihitenergy(); - double tt = hit[ihit]->time(); - if (DetId(hit[ihit]->id()).subdetId()==EcalBarrel) ok = (eTower > ebThr); - else if (DetId(hit[ihit]->id()).subdetId()==EcalEndcap) ok = (eTower > eeThr); + double eTower = ihit->energy(); + double tt = ihit->time(); + if (DetId(ihit->id()).subdetId()==EcalBarrel) ok = (eTower > ebThr); + else if (DetId(ihit->id()).subdetId()==EcalEndcap) ok = (eTower > eeThr); // No need for hcal sampling weight if (ok && tt > tMin && tt < tMax) energySum += eTower; } @@ -217,6 +217,36 @@ namespace spr{ return energySum; } + // + template + double eCone_ecal(const CaloGeometry* geo, edm::Handle& barrelhits, edm::Handle& endcaphits, const GlobalPoint& hpoint1, const GlobalPoint& point1, double dR, const GlobalVector& trackMom, std::vector& coneRecHitDetIds, std::vector& eHit, double ebThr, double eeThr, double tMin, double tMax, bool debug) { + + std::vector< typename T::const_iterator> hit = spr::findHitCone(geo, barrelhits, endcaphits, hpoint1, point1, dR, trackMom, debug); + + // No depth in Ecal + double energySum = 0.0; + for (auto const& ihit : hit) { + bool ok = true; + double eTower = ihit->energy(); + double tt = ihit->time(); + if (DetId(ihit->id()).subdetId()==EcalBarrel) ok = (eTower > ebThr); + else if (DetId(ihit->id()).subdetId()==EcalEndcap) ok = (eTower > eeThr); + // No need for hcal sampling weight + if (tt > tMin && tt < tMax) { + if (ok) energySum += eTower; + // Get list of det ids + coneRecHitDetIds.emplace_back(ihit->id()); + eHit.emplace_back(eTower); + } + } + + if (debug) { + std::cout << "eCone_ecal: Energy " << energySum << " from " << hit.size() + << " hits" << std::endl; + } + return energySum; + } + } From 7c7fccbfae740726ed122e3d4b6dcc33385cc211 Mon Sep 17 00:00:00 2001 From: Vincenzo Innocente Date: Sat, 24 Mar 2018 10:07:35 +0100 Subject: [PATCH 207/426] use ifdef --- TrackingTools/KalmanUpdators/src/KFUpdator.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/TrackingTools/KalmanUpdators/src/KFUpdator.cc b/TrackingTools/KalmanUpdators/src/KFUpdator.cc index 3a450853d909e..a0034e0e4e4fa 100644 --- a/TrackingTools/KalmanUpdators/src/KFUpdator.cc +++ b/TrackingTools/KalmanUpdators/src/KFUpdator.cc @@ -95,8 +95,14 @@ TrajectoryStateOnSurface lupdate(const TrajectoryStateOnSurface& tsos, // Compute local filtered state vector AlgebraicVector5 fsv = x + K * r; - // Compute covariance matrix of local filtered state vector + + // Compute covariance matrix of local filtered state vector +#define KU_JosephForm +#ifdef KU_JosephForm AlgebraicSymMatrix55 fse = ROOT::Math::Similarity(M, C) + ROOT::Math::Similarity(K, V); +#else + AlgebraicSymMatrix55 fse; ROOT::Math::AssignSym::Evaluate(fse, M*C); +#endif // test of joseph form #ifdef KU_JF_TEST From 9097e488bed0fd536183ce260419ef593bcd017d Mon Sep 17 00:00:00 2001 From: Sunanda Date: Sat, 24 Mar 2018 16:43:19 +0100 Subject: [PATCH 208/426] Changes some default values --- .../HcalAlCaRecoProducers/plugins/AlCaIsoTracksFilter.cc | 4 ++-- Calibration/HcalCalibAlgos/test/HcalIsoTrkAnalyzer.cc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksFilter.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksFilter.cc index 3eab936d9a235..1dd98737c7e01 100644 --- a/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksFilter.cc +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksFilter.cc @@ -465,8 +465,8 @@ void AlCaIsoTracksFilter::fillDescriptions(edm::ConfigurationDescriptions& descr desc.add("EBHitEnergyThreshold",0.10); desc.add("EEHitEnergyThreshold0",-41.0664); desc.add("EEHitEnergyThreshold1",68.7950); - desc.add("EEHitEnergyThreshold2",-38.1482); - desc.add("EEHitEnergyThreshold3",7.04352); + desc.add("EEHitEnergyThreshold2",-38.1483); + desc.add("EEHitEnergyThreshold3",7.04303); // Prescale events only containing isolated tracks in the range desc.add("momentumRangeLow",20.0); desc.add("momentumRangeHigh",40.0); diff --git a/Calibration/HcalCalibAlgos/test/HcalIsoTrkAnalyzer.cc b/Calibration/HcalCalibAlgos/test/HcalIsoTrkAnalyzer.cc index 85551aaf18c99..c24350628e412 100644 --- a/Calibration/HcalCalibAlgos/test/HcalIsoTrkAnalyzer.cc +++ b/Calibration/HcalCalibAlgos/test/HcalIsoTrkAnalyzer.cc @@ -804,8 +804,8 @@ void HcalIsoTrkAnalyzer::fillDescriptions(edm::ConfigurationDescriptions& descri desc.add("EBHitEnergyThreshold",0.10); desc.add("EEHitEnergyThreshold0",-41.0664); desc.add("EEHitEnergyThreshold1",68.7950); - desc.add("EEHitEnergyThreshold2",-38.1482); - desc.add("EEHitEnergyThreshold3",7.04352); + desc.add("EEHitEnergyThreshold2",-38.1483); + desc.add("EEHitEnergyThreshold3",7.04303); // various labels for collections used in the code desc.add("labelTriggerEvent",edm::InputTag("hltTriggerSummaryAOD","","HLT")); desc.add("labelTriggerResult",edm::InputTag("TriggerResults","","HLT")); From b862bceeb08cbe773f39a61cad87814fc2636949 Mon Sep 17 00:00:00 2001 From: nminafra Date: Sat, 24 Mar 2018 18:00:57 +0100 Subject: [PATCH 209/426] Tested up to RawToDigi, dynamic mapping still todo --- .../plugins/TotemDAQMappingESSourceXML.cc | 160 ++++++++++- .../xml/mapping_totem_timing_2018.xml | 115 ++++++++ .../CTPPSDetId/src/TotemTimingDetId.cc | 4 +- .../CTPPSDigi/interface/TotemTimingDigi.h | 18 +- DataFormats/CTPPSDigi/src/TotemTimingDigi.cc | 19 +- DataFormats/CTPPSDigi/src/classes.h | 9 + DataFormats/CTPPSDigi/src/classes_def.xml | 21 ++ .../interface/RawDataUnpacker.h | 4 + .../interface/RawToDigiConverter.h | 8 + .../interface/TotemSampicFrame.h | 257 +++++++++++++++--- .../CTPPSRawToDigi/interface/VFATFrame.h | 5 + .../plugins/TotemVFATRawToDigi.cc | 3 +- .../python/ctppsRawToDigi_cff.py | 3 +- .../python/totemTimingRawToDigi_cfi.py | 11 + .../CTPPSRawToDigi/src/RawDataUnpacker.cc | 87 +++++- .../CTPPSRawToDigi/src/RawToDigiConverter.cc | 73 ++++- .../test/analyze_vfat_frames.py | 6 +- .../test/test_standard_sequence_cfg.py | 10 +- 18 files changed, 735 insertions(+), 78 deletions(-) create mode 100644 CondFormats/CTPPSReadoutObjects/xml/mapping_totem_timing_2018.xml diff --git a/CondFormats/CTPPSReadoutObjects/plugins/TotemDAQMappingESSourceXML.cc b/CondFormats/CTPPSReadoutObjects/plugins/TotemDAQMappingESSourceXML.cc index b894fe1182a1a..eb0e3a85d9a90 100644 --- a/CondFormats/CTPPSReadoutObjects/plugins/TotemDAQMappingESSourceXML.cc +++ b/CondFormats/CTPPSReadoutObjects/plugins/TotemDAQMappingESSourceXML.cc @@ -22,6 +22,7 @@ #include "DataFormats/CTPPSDetId/interface/TotemRPDetId.h" #include "DataFormats/CTPPSDetId/interface/CTPPSDiamondDetId.h" +#include "DataFormats/CTPPSDetId/interface/TotemTimingDetId.h" #include "CondFormats/DataRecord/interface/TotemReadoutRcd.h" #include "CondFormats/CTPPSReadoutObjects/interface/TotemDAQMapping.h" @@ -38,7 +39,7 @@ #include #include -//#define DEBUG 1 +// #define DEBUG 1 //---------------------------------------------------------------------------------------------------- @@ -68,7 +69,11 @@ class TotemDAQMappingESSourceXML: public edm::ESProducer, public edm::EventSetup /// diamond specific tags static const std::string tagDiamondPlane; - static const std::string tagDiamondCh; + static const std::string tagDiamondCh; + + /// totem timing specific tags + static const std::string tagSampicBoard; + static const std::string tagSampicCh; TotemDAQMappingESSourceXML(const edm::ParameterSet &); ~TotemDAQMappingESSourceXML() override; @@ -106,7 +111,7 @@ class TotemDAQMappingESSourceXML: public edm::ESProducer, public edm::EventSetup bool currentBlockValid; /// enumeration of XML node types - enum NodeType { nUnknown, nSkip, nTop, nArm, nRPStation, nRPPot, nRPPlane, nDiamondPlane, nChip, nDiamondCh, nChannel }; + enum NodeType { nUnknown, nSkip, nTop, nArm, nRPStation, nRPPot, nRPPlane, nDiamondPlane, nChip, nDiamondCh, nChannel, nSampicBoard, nSampicChannel }; /// whether to parse a mapping of a mask XML enum ParseType { pMapping, pMask }; @@ -121,6 +126,10 @@ class TotemDAQMappingESSourceXML: public edm::ESProducer, public edm::EventSetup /// recursive method to extract RP-related information from the DOM tree void ParseTreeDiamond(ParseType, xercesc::DOMNode *, NodeType, unsigned int parentID, const std::shared_ptr&, const std::shared_ptr&); + + /// recursive method to extract RP-related information from the DOM tree + void ParseTreeTotemTiming(ParseType, xercesc::DOMNode *, NodeType, unsigned int parentID, + const std::shared_ptr&, const std::shared_ptr&); private: /// adds the path prefix, if needed @@ -161,6 +170,12 @@ class TotemDAQMappingESSourceXML: public edm::ESProducer, public edm::EventSetup { return ((type == nArm)||(type == nRPStation)||(type == nRPPot)||(type == nDiamondPlane)||(type == nDiamondCh)); } + + bool TotemTimingNode(NodeType type) + { + return ((type == nArm)||(type == nRPStation)||(type == nRPPot)||(type == nSampicBoard)||(type == nSampicChannel)); + } + bool CommonNode(NodeType type) { return ((type==nChip)||(type==nArm)); @@ -197,6 +212,9 @@ const string TotemDAQMappingESSourceXML::tagRPPlane = "rp_plane"; const string TotemDAQMappingESSourceXML::tagDiamondPlane = "rp_plane_diamond"; const string TotemDAQMappingESSourceXML::tagDiamondCh = "diamond_channel"; +// specific tags for totem timing +const string TotemDAQMappingESSourceXML::tagSampicBoard = "rp_sampic_board"; +const string TotemDAQMappingESSourceXML::tagSampicCh = "rp_sampic_channel"; //---------------------------------------------------------------------------------------------------- @@ -339,6 +357,8 @@ void TotemDAQMappingESSourceXML::ParseXML(ParseType pType, const string &file, ParseTreeRP(pType, elementRoot, nTop, 0, mapping, mask); ParseTreeDiamond(pType, elementRoot, nTop, 0, mapping, mask); + + ParseTreeTotemTiming(pType, elementRoot, nTop, 0, mapping, mask); } //----------------------------------------------------------------------------------------------------------- @@ -348,7 +368,7 @@ void TotemDAQMappingESSourceXML::ParseTreeRP(ParseType pType, xercesc::DOMNode * const std::shared_ptr& mask) { #ifdef DEBUG - printf(">> TotemDAQMappingESSourceXML::ParseTreeRP(%s, %u, %u)\n", cms::xerces::toString(parent->getNodeName()), + printf(">> TotemDAQMappingESSourceXML::ParseTreeRP(%s, %u, %u)\n", cms::xerces::toString(parent->getNodeName()).c_str(), parentType, parentID); #endif @@ -363,7 +383,7 @@ void TotemDAQMappingESSourceXML::ParseTreeRP(ParseType pType, xercesc::DOMNode * NodeType type = GetNodeType(n); #ifdef DEBUG - printf("\tname = %s, type = %u\n", cms::xerces::toString(n->getNodeName()), type); + printf("\tname = %s, type = %u\n", cms::xerces::toString(n->getNodeName()).c_str(), type); #endif // structure control @@ -483,8 +503,8 @@ void TotemDAQMappingESSourceXML::ParseTreeDiamond(ParseType pType, xercesc::DOMN { #ifdef DEBUG - printf(">> TotemDAQMappingESSourceXML::ParseTreeDiamond(%s, %u, %u)\n", cms::xerces::toString(parent->getNodeName()), - parentType, parentID); + printf(">> TotemDAQMappingESSourceXML::ParseTreeDiamond(%s, %u, %u)\n", cms::xerces::toString(parent->getNodeName()).c_str(), + parentType, parentID); #endif DOMNodeList *children = parent->getChildNodes(); @@ -497,7 +517,7 @@ void TotemDAQMappingESSourceXML::ParseTreeDiamond(ParseType pType, xercesc::DOMN NodeType type = GetNodeType(n); #ifdef DEBUG - printf("\tname = %s, type = %u\n", cms::xerces::toString(n->getNodeName()), type); + printf("\tname = %s, type = %u\n", cms::xerces::toString(n->getNodeName()).c_str(), type); #endif // structure control @@ -533,13 +553,13 @@ void TotemDAQMappingESSourceXML::ParseTreeDiamond(ParseType pType, xercesc::DOMN if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "id")) { sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%u", &id); - id_set = true; + id_set = true; } if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "hw_id")) { sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%x", &hw_id); - hw_id_set = true; + hw_id_set = true; } } @@ -547,16 +567,15 @@ void TotemDAQMappingESSourceXML::ParseTreeDiamond(ParseType pType, xercesc::DOMN // content control if (!id_set) throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeDiamond") << "id not given for element `" - << cms::xerces::toString(n->getNodeName()) << "'" << endl; - + << cms::xerces::toString(n->getNodeName()) << "'" << endl; if (!hw_id_set && type == nDiamondCh && pType == pMapping) throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeDiamond") << "hw_id not given for element `" - << cms::xerces::toString(n->getNodeName()) << "'" << endl; + << cms::xerces::toString(n->getNodeName()) << "'" << endl; if (type == nDiamondPlane && id > 3) throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeDiamond") << - "Plane IDs range from 0 to 3. id = " << id << " is invalid." << endl; + "Plane IDs range from 0 to 3. id = " << id << " is invalid." << endl; #ifdef DEBUG printf("\tID found: 0x%x\n", id); @@ -583,7 +602,6 @@ void TotemDAQMappingESSourceXML::ParseTreeDiamond(ParseType pType, xercesc::DOMN } - mapping->insert(framepos, vfatInfo); continue; @@ -602,6 +620,114 @@ void TotemDAQMappingESSourceXML::ParseTreeDiamond(ParseType pType, xercesc::DOMN } +//---------------------------------------------------------------------------------------------------- + +void TotemDAQMappingESSourceXML::ParseTreeTotemTiming(ParseType pType, xercesc::DOMNode * parent, NodeType parentType, + unsigned int parentID, const std::shared_ptr& mapping, + const std::shared_ptr& mask) +{ + +#ifdef DEBUG + printf(">> TotemDAQMappingESSourceXML::ParseTreeTotemTiming(%s, %u, %u)\n", cms::xerces::toString(parent->getNodeName()).c_str(), + parentType, parentID); +#endif + + DOMNodeList *children = parent->getChildNodes(); + + for (unsigned int i = 0; i < children->getLength(); i++) + { + DOMNode *n = children->item(i); + if (n->getNodeType() != DOMNode::ELEMENT_NODE) + continue; + + NodeType type = GetNodeType(n); +#ifdef DEBUG + printf("\tname = %s, type = %u\n", cms::xerces::toString(n->getNodeName()).c_str(), type); +#endif + + // structure control + if (!TotemTimingNode(type)) + continue; + + NodeType expectedParentType; + switch (type) + { + case nArm: expectedParentType = nTop; break; + case nRPStation: expectedParentType = nArm; break; + case nRPPot: expectedParentType = nRPStation; break; + case nSampicBoard: expectedParentType = nRPPot; break; + case nSampicChannel: expectedParentType = nSampicBoard; break; + default: expectedParentType = nUnknown; break; + } + + if (expectedParentType != parentType) + { + throw cms::Exception("TotemDAQMappingESSourceXML") << "Node " << cms::xerces::toString(n->getNodeName()) + << " not allowed within " << cms::xerces::toString(parent->getNodeName()) << " block.\n"; + } + + // parse tag attributes + unsigned int id =0; + bool id_set = false; + DOMNamedNodeMap* attr = n->getAttributes(); + + for (unsigned int j = 0; j < attr->getLength(); j++) + { + DOMNode *a = attr->item(j); + + if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "id")) + { + sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%u", &id); + id_set = true; + } + + } + + // content control + if (!id_set) + throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeTotemTiming") << "id not given for element `" + << cms::xerces::toString(n->getNodeName()) << "'" << endl; + if (type == nSampicBoard && id > 5) + throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeTotemTiming") << + "SampicBoard IDs range from 0 to 5. id = " << id << " is invalid." << endl; + +#ifdef DEBUG + printf("\tID found: 0x%x\n", id); +#endif + + // store mapping data + if (pType == pMapping &&type == nSampicChannel) + { + + const TotemFramePosition &framepos = ChipFramePosition(n); +// std::cout<< "Reading XML... GOH " << framepos.getGOHId()<< " Idx " << framepos.getIdxInFiber() << std::endl; + + TotemVFATInfo vfatInfo; +// vfatInfo.hwID = hw_id; + unsigned int ArmNum = (parentID/ 10000) % 10; + unsigned int StationNum = (parentID / 1000) % 10; + unsigned int RpNum = (parentID/ 100) % 10; + + vfatInfo.symbolicID.symbolicID = TotemTimingDetId(ArmNum, StationNum, RpNum, 0, 0); //Dynamical: it is encoded in the frame + + mapping->insert(framepos, vfatInfo); + + continue; + } + + unsigned int childId; + if (pType == pMapping &&type == nSampicBoard) + childId = parentID * 100 + id; + else + childId = parentID * 10 + id; + + ParseTreeTotemTiming(pType,n ,type ,childId ,mapping ,mask); + + } + +} + + //---------------------------------------------------------------------------------------------------- TotemFramePosition TotemDAQMappingESSourceXML::ChipFramePosition(xercesc::DOMNode *chipnode) @@ -648,6 +774,10 @@ TotemDAQMappingESSourceXML::NodeType TotemDAQMappingESSourceXML::GetNodeType(xer //diamond specifics if (Test(n, tagDiamondCh)) return nDiamondCh; if (Test(n, tagDiamondPlane)) return nDiamondPlane; + + //totem timing specifics + if (Test(n, tagSampicBoard)) return nSampicBoard; + if (Test(n, tagSampicCh)) return nSampicChannel; // for backward compatibility if (Test(n, "trigger_vfat")) return nSkip; diff --git a/CondFormats/CTPPSReadoutObjects/xml/mapping_totem_timing_2018.xml b/CondFormats/CTPPSReadoutObjects/xml/mapping_totem_timing_2018.xml new file mode 100644 index 0000000000000..f07d0e0ce8926 --- /dev/null +++ b/CondFormats/CTPPSReadoutObjects/xml/mapping_totem_timing_2018.xml @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DataFormats/CTPPSDetId/src/TotemTimingDetId.cc b/DataFormats/CTPPSDetId/src/TotemTimingDetId.cc index 7e90898ac16f6..b3b9057ce5a06 100644 --- a/DataFormats/CTPPSDetId/src/TotemTimingDetId.cc +++ b/DataFormats/CTPPSDetId/src/TotemTimingDetId.cc @@ -24,14 +24,14 @@ TotemTimingDetId::TotemTimingDetId(uint32_t id) : CTPPSDetId(id) throw cms::Exception("InvalidDetId") << "TotemTimingDetId ctor:" << " channel: " << channel() << " subdet: " << subdetId() - << " is not a valid CTPPS Timing Diamond id"; + << " is not a valid Totem Timing id"; } } //---------------------------------------------------------------------------------------------------- TotemTimingDetId::TotemTimingDetId(uint32_t Arm, uint32_t Station, uint32_t RomanPot, uint32_t Plane, uint32_t Channel) : - CTPPSDetId(sdTimingDiamond, Arm, Station, RomanPot) + CTPPSDetId(sdTimingFastSilicon, Arm, Station, RomanPot) { if (Arm > maxArm || Station > maxStation || RomanPot > maxRP || Plane > maxPlane || Channel > maxChannel) { diff --git a/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h b/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h index f2100cd8a181c..a0a84b7db5c38 100644 --- a/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h +++ b/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h @@ -13,10 +13,12 @@ #include #include +#include + class TotemTimingDigi{ public: - TotemTimingDigi(const uint8_t hwId, const uint64_t FPGATimeStamp, const uint16_t TimeStampA, const uint16_t TimeStampB, const uint16_t CellInfo, const std::vector< uint8_t>& Samples); + TotemTimingDigi(const uint8_t hwId, const uint64_t FPGATimeStamp, const uint16_t TimeStampA, const uint16_t TimeStampB, const uint16_t CellInfo, const std::vector< uint8_t>& Samples, const TotemTimingEventInfo& totemTimingEventInfo); TotemTimingDigi(const TotemTimingDigi& digi); TotemTimingDigi(); ~TotemTimingDigi() {}; @@ -93,6 +95,11 @@ class TotemTimingDigi{ if ( i < samples_.size() ) sampleValue = (int) samples_.at(i); return sampleValue; } + + inline TotemTimingEventInfo getEventInfo() const + { + return totemTimingEventInfo_; + } /// Set digi values @@ -155,9 +162,14 @@ class TotemTimingDigi{ if ( i < samples_.size() ) samples_.at(i) = sampleValue; } + inline void setEventInfo( const TotemTimingEventInfo& totemTimingEventInfo ) + { + totemTimingEventInfo_ = totemTimingEventInfo; + } + private: uint8_t hwId_; uint64_t FPGATimeStamp_; @@ -167,6 +179,8 @@ class TotemTimingDigi{ std::vector< uint8_t > samples_; + TotemTimingEventInfo totemTimingEventInfo_; + }; #include @@ -190,7 +204,7 @@ inline std::ostream & operator<<(std::ostream & o, const TotemTimingDigi& digi) << "\nTimeStampA:\t" << std::hex << digi.getTimeStampA() << "\nCellInfo:\t" << std::hex << digi.getCellInfo() << "\nNumberOfSamples:\t" << std::dec << digi.getNumberOfSamples() - << std::endl; + << std::endl << digi.getEventInfo() << std::endl; } diff --git a/DataFormats/CTPPSDigi/src/TotemTimingDigi.cc b/DataFormats/CTPPSDigi/src/TotemTimingDigi.cc index ece72baab74ff..b4d58cfb618a7 100644 --- a/DataFormats/CTPPSDigi/src/TotemTimingDigi.cc +++ b/DataFormats/CTPPSDigi/src/TotemTimingDigi.cc @@ -9,12 +9,12 @@ using namespace std; -TotemTimingDigi::TotemTimingDigi(const uint8_t hwId, const uint64_t FPGATimeStamp, const uint16_t TimeStampA, const uint16_t TimeStampB, const uint16_t CellInfo, const std::vector< uint8_t>& Samples) : - hwId_(hwId), FPGATimeStamp_(FPGATimeStamp), TimeStampA_(TimeStampA), TimeStampB_(TimeStampB), CellInfo_(CellInfo), samples_(Samples) +TotemTimingDigi::TotemTimingDigi(const uint8_t hwId, const uint64_t FPGATimeStamp, const uint16_t TimeStampA, const uint16_t TimeStampB, const uint16_t CellInfo, const std::vector< uint8_t>& Samples, const TotemTimingEventInfo& totemTimingEventInfo ) : + hwId_(hwId), FPGATimeStamp_(FPGATimeStamp), TimeStampA_(TimeStampA), TimeStampB_(TimeStampB), CellInfo_(CellInfo), samples_(Samples), totemTimingEventInfo_(totemTimingEventInfo) {} TotemTimingDigi::TotemTimingDigi(const TotemTimingDigi& digi) : - hwId_(digi.getHardwareId()), FPGATimeStamp_(digi.getFPGATimeStamp()), TimeStampA_(digi.getTimeStampA()), TimeStampB_(digi.getTimeStampB()), CellInfo_(digi.getCellInfo()), samples_(digi.getSamples()) + hwId_(digi.getHardwareId()), FPGATimeStamp_(digi.getFPGATimeStamp()), TimeStampA_(digi.getTimeStampA()), TimeStampB_(digi.getTimeStampB()), CellInfo_(digi.getCellInfo()), samples_(digi.getSamples()), totemTimingEventInfo_(digi.getEventInfo()) {} TotemTimingDigi::TotemTimingDigi() : @@ -26,12 +26,13 @@ TotemTimingDigi::TotemTimingDigi() : bool TotemTimingDigi::operator==(const TotemTimingDigi& digi) const { - if ( hwId_ != digi.getHardwareId() - || FPGATimeStamp_ != digi.getFPGATimeStamp() - || TimeStampA_ != digi.getTimeStampA() - || TimeStampB_ != digi.getTimeStampB() - || CellInfo_ != digi.getCellInfo() - || samples_ != digi.getSamples() + if ( hwId_ != digi.getHardwareId() + || FPGATimeStamp_ != digi.getFPGATimeStamp() + || TimeStampA_ != digi.getTimeStampA() + || TimeStampB_ != digi.getTimeStampB() + || CellInfo_ != digi.getCellInfo() + || samples_ != digi.getSamples() +// || totemTimingEventInfo_ != digi.getEventInfo() ) return false; else return true; diff --git a/DataFormats/CTPPSDigi/src/classes.h b/DataFormats/CTPPSDigi/src/classes.h index 10021bcc99643..61534ddebecd0 100644 --- a/DataFormats/CTPPSDigi/src/classes.h +++ b/DataFormats/CTPPSDigi/src/classes.h @@ -15,6 +15,7 @@ #include "DataFormats/CTPPSDigi/interface/TotemVFATStatus.h" #include "DataFormats/CTPPSDigi/interface/TotemFEDInfo.h" #include "DataFormats/CTPPSDigi/interface/CTPPSDiamondDigi.h" +#include "DataFormats/CTPPSDigi/interface/TotemTimingDigi.h" #include "DataFormats/CTPPSDigi/interface/CTPPSPixelDigi.h" #include "DataFormats/CTPPSDigi/interface/CTPPSPixelDigiCollection.h" @@ -56,6 +57,14 @@ namespace DataFormats_CTPPSDigi { std::vector > vec_ds_rp_diamo_dig; edm::Wrapper > wds_rp_diamo_dig; edm::Wrapper > wdsv_rp_diamo_dig; + + TotemTimingDigi rm_totTiming_dig; + edm::DetSet ds_rp_totTiming_dig; + std::vector vec_rp_totTiming_dig; + edm::DetSetVector dsv_rp_totTiming_dig; + std::vector > vec_ds_rp_totTiming_dig; + edm::Wrapper > wds_rp_totTiming_dig; + edm::Wrapper > wdsv_rp_totTiming_dig; HPTDCErrorFlags rm_hptdcerr; CTPPSPixelDigi ff0; diff --git a/DataFormats/CTPPSDigi/src/classes_def.xml b/DataFormats/CTPPSDigi/src/classes_def.xml index 3bc5bfff38f6c..5e3e311b574df 100644 --- a/DataFormats/CTPPSDigi/src/classes_def.xml +++ b/DataFormats/CTPPSDigi/src/classes_def.xml @@ -46,6 +46,27 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/EventFilter/CTPPSRawToDigi/interface/RawDataUnpacker.h b/EventFilter/CTPPSRawToDigi/interface/RawDataUnpacker.h index 86273e54609cd..e98cce40ea823 100644 --- a/EventFilter/CTPPSRawToDigi/interface/RawDataUnpacker.h +++ b/EventFilter/CTPPSRawToDigi/interface/RawDataUnpacker.h @@ -14,6 +14,7 @@ #include "DataFormats/FEDRawData/interface/FEDRawData.h" #include "DataFormats/CTPPSDigi/interface/TotemFEDInfo.h" +#include "DataFormats/FEDRawData/interface/FEDNumbering.h" #include "EventFilter/CTPPSRawToDigi/interface/VFATFrameCollection.h" #include "EventFilter/CTPPSRawToDigi/interface/SimpleVFATFrameCollection.h" @@ -53,6 +54,9 @@ namespace ctpps /// Process one Opto-Rx frame in parallel (new) format int ProcessOptoRxFrameParallel(const word *buffer, unsigned int frameSize, TotemFEDInfo &fedInfo, SimpleVFATFrameCollection *fc) const; + + /// Process one Opto-Rx frame that contains SAMPIC frames + int ProcessOptoRxFrameSampic(const word *buffer, unsigned int frameSize, TotemFEDInfo &fedInfo, SimpleVFATFrameCollection *fc) const; /// Process data from one VFAT in parallel (new) format int ProcessVFATDataParallel(const uint16_t *buf, unsigned int maxWords, unsigned int OptoRxId, SimpleVFATFrameCollection *fc) const; diff --git a/EventFilter/CTPPSRawToDigi/interface/RawToDigiConverter.h b/EventFilter/CTPPSRawToDigi/interface/RawToDigiConverter.h index 990c9f5ae6ba5..c9ffbf9392d41 100644 --- a/EventFilter/CTPPSRawToDigi/interface/RawToDigiConverter.h +++ b/EventFilter/CTPPSRawToDigi/interface/RawToDigiConverter.h @@ -20,6 +20,10 @@ #include "DataFormats/CTPPSDigi/interface/TotemRPDigi.h" #include "DataFormats/CTPPSDigi/interface/TotemVFATStatus.h" #include "DataFormats/CTPPSDigi/interface/CTPPSDiamondDigi.h" +#include "DataFormats/CTPPSDigi/interface/TotemTimingDigi.h" + +#include "EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h" +#include "EventFilter/CTPPSRawToDigi/interface/DiamondVFATFrame.h" /// \brief Collection of code to convert TOTEM raw data into digi. class RawToDigiConverter @@ -34,6 +38,10 @@ class RawToDigiConverter /// Creates Diamond digi. void Run(const VFATFrameCollection &coll, const TotemDAQMapping &mapping, const TotemAnalysisMask &mask, edm::DetSetVector &digi, edm::DetSetVector &status); + + /// Creates Totem Timing digi. + void Run(const VFATFrameCollection &coll, const TotemDAQMapping &mapping, const TotemAnalysisMask &mask, + edm::DetSetVector &digi, edm::DetSetVector &status); /// Print error summaries. void PrintSummaries() const; diff --git a/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h b/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h index 5ab97d69216c5..9c8af21e710d9 100644 --- a/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h +++ b/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h @@ -2,60 +2,82 @@ * * This is a part of the TOTEM offline software. * Authors: -* Seyed Mohsen Etesami (setesami@cern.ch) * Nicola Minafra * ****************************************************************************/ -#ifndef EventFilter_CTPPSRawToDigi_DiamondVFATFrame -#define EventFilter_CTPPSRawToDigi_DiamondVFATFrame +#ifndef EventFilter_CTPPSRawToDigi_TotemSampicFrame +#define EventFilter_CTPPSRawToDigi_TotemSampicFrame #include #include #include +#include +#include #include "EventFilter/CTPPSRawToDigi/interface/VFATFrame.h" +enum TotemSampicConstant { + NumberOfSamples = 24, +}; + #pragma pack(push,1) struct TotemSampicData{ - uint8_t sample[24]; + uint8_t samples[TotemSampicConstant::NumberOfSamples]; TotemSampicData() {}; -} +}; #pragma pack(pop) #pragma pack(push,1) struct TotemSampicInfo{ - uint16_t reserved[3]; - uint16_t CellInfo; - uint16_t TimestampA; - uint16_t TimestampB; - uint8_t FPGATime[5]; - uint16_t ADC_EOC; - uint8_t controlBits[4]; uint8_t hwId; + uint8_t controlBits[6]; + uint8_t FPGATime[5]; + uint16_t TimeStampA; + uint16_t TimeStampB; + uint16_t CellInfo; + uint16_t reserved[3]; TotemSampicInfo() {}; -} +}; #pragma pack(pop) #pragma pack(push,1) struct TotemSampicEventInfo{ - uint8_t reserved[2]; - uint8_t offsetOfSamples; - uint8_t numberOfSamples; - uint16_t L1ALatency; - uint16_t channelMap; - uint32_t eventNumber; - uint32_t orbitNumber; - uint16_t bunchNumber; - uint64_t L1ATimeStamp; uint8_t hwId; + uint8_t L1ATimeStamp[5]; + uint16_t bunchNumber; + uint32_t orbitNumber; + uint32_t eventNumber; + uint16_t channelMap; + uint16_t L1ALatency; + uint8_t numberOfSamples; + uint8_t offsetOfSamples; + uint8_t reserved[2]; TotemSampicEventInfo() {}; -} +}; #pragma pack(pop) +uint8_t GrayToBinary_8bit(const uint8_t &gcode_data) +{ + //b[0] = g[0] + uint8_t binary_byte=(gcode_data & 0x80); //MSB is the same + + //b[i] = g[i] xor b[i-1] + binary_byte |= (gcode_data ^ (binary_byte >> 1)) & 0x40; + binary_byte |= (gcode_data ^ (binary_byte >> 1)) & 0x20; + binary_byte |= (gcode_data ^ (binary_byte >> 1)) & 0x10; + binary_byte |= (gcode_data ^ (binary_byte >> 1)) & 0x08; + binary_byte |= (gcode_data ^ (binary_byte >> 1)) & 0x04; + binary_byte |= (gcode_data ^ (binary_byte >> 1)) & 0x02; + binary_byte |= (gcode_data ^ (binary_byte >> 1)) & 0x01; + + return binary_byte; +} + + /** * This class is intended to handle the timing infromation of SAMPIC in the TOTEM implementation @@ -63,26 +85,164 @@ struct TotemSampicEventInfo{ class TotemSampicFrame { public: - TotemSampicFrame(const uint8_t* inputData = nullptr) + TotemSampicFrame(const uint8_t* chInfoPtr, const uint8_t* chDataPtr, const uint8_t* eventInfoPtr) : + TotemSampicInfo_(nullptr), TotemSampicData_(nullptr), TotemSampicEventInfo_(nullptr), status_(0) +// chInfoPtr_(chInfoPtr), chDataPtr_(chDataPtr), eventInfoPtr_(eventInfoPtr) { - + if ( chInfoPtr!=nullptr && chDataPtr!=nullptr && eventInfoPtr!=nullptr) { + TotemSampicInfo_ = (TotemSampicInfo*) chInfoPtr; + TotemSampicData_ = (TotemSampicData*) chDataPtr; + TotemSampicEventInfo_ = (TotemSampicEventInfo*) eventInfoPtr; + } + if ( TotemSampicEventInfo_->numberOfSamples == TotemSampicConstant::NumberOfSamples || TotemSampicEventInfo_->numberOfSamples == 0) + status_ = 1; } ~TotemSampicFrame() {} + /// Prints the frame. + /// If binary is true, binary format is used. + void PrintRaw(bool binary = false) const + { + std::cout << "Event Info: " << std::endl; + PrintRawBuffer( (uint16_t*) TotemSampicEventInfo_ ); + + std::cout << "Channel Info: " << std::endl; + PrintRawBuffer( (uint16_t*) TotemSampicInfo_ ); + + std::cout << "Channel Data: " << std::endl; + PrintRawBuffer( (uint16_t*) TotemSampicData_ ); + } + + void Print() const + { + std::bitset<16> bitsCellInfo( getCellInfo() ); + std::cout << "TotemSampicFrame:\nEvent:" + << "HardwareId (Event):\t" << std::hex << (unsigned int) getEventHardwareId() + << "\nL1A Time Stamp:\t" << std::dec << getL1ATimeStamp() + << "\nL1A Latency:\t" << std::dec << getL1ALatency() + << "\nBunch Number:\t" << std::dec << getBunchNumber() + << "\nOrbit Number:\t" << std::dec << getOrbitNumber() + << "\nEvent Number:\t" << std::dec << getEventNumber() + << "\nChannels fired:\t" << std::hex << getChannelMap() + << "\nNumber of Samples:\t" << std::dec << getNumberOfSentSamples() + << "\nOffset of Samples:\t" << std::dec << (int) getOffsetOfSamples() + << "\nChannel:\nHardwareId:\t" << std::hex << (unsigned int) getHardwareId() + << "\nFPGATimeStamp:\t" << std::dec << getFPGATimeStamp() + << "\nTimeStampA:\t" << std::dec << getTimeStampA() + << "\nTimeStampA:\t" << std::dec << getTimeStampA() + << "\nCellInfo:\t" << bitsCellInfo.to_string() + << std::endl << std::endl; + } + + // All getters + inline uint8_t getHardwareId() const + { + return status_ * TotemSampicInfo_->hwId; + } + + inline uint64_t getFPGATimeStamp() const + { + uint64_t time = 0; + for (int i=0; i<5; ++i) + time += TotemSampicInfo_->FPGATime[i] << 8*1; + return status_ * time; + } + + inline uint16_t getTimeStampA() const + { + return status_ * GrayToBinary_8bit(TotemSampicInfo_->TimeStampA); + } + + inline uint16_t getTimeStampB() const + { + return status_ * GrayToBinary_8bit(TotemSampicInfo_->TimeStampB); + } + + inline uint16_t getCellInfo() const + { + return status_ * TotemSampicInfo_->CellInfo; + } + + const std::vector< uint8_t > getSamples() const + { + std::vector< uint8_t > samples; + if (status_) { + samples.assign( TotemSampicData_->samples, TotemSampicData_->samples + TotemSampicConstant::NumberOfSamples); + std::for_each(samples.begin(), samples.end(), &GrayToBinary_8bit); + } + return samples; + } + + inline unsigned int getNumberOfSamples() const + { + return status_ * TotemSampicConstant::NumberOfSamples; + } + + + + // Event Info + inline uint8_t getEventHardwareId() const + { + return status_ * TotemSampicEventInfo_->hwId; + } + + inline uint64_t getL1ATimeStamp() const + { + uint64_t time = 0; + for (int i=0; i<5; ++i) + time += TotemSampicEventInfo_->L1ATimeStamp[i] << 8*1; + return status_ * time; + } + + inline uint16_t getBunchNumber() const + { + return status_ * TotemSampicEventInfo_->bunchNumber; + } + + inline uint32_t getOrbitNumber() const + { + return status_ * TotemSampicEventInfo_->orbitNumber; + } + + inline uint32_t getEventNumber() const + { + return status_ * TotemSampicEventInfo_->orbitNumber; + } + + inline uint16_t getChannelMap() const + { + return status_ * TotemSampicEventInfo_->channelMap; + } + + inline uint16_t getL1ALatency() const + { + return status_ *TotemSampicEventInfo_->L1ALatency; + } + + inline uint8_t getNumberOfSentSamples() const + { + return status_ * TotemSampicEventInfo_->numberOfSamples; + } + + inline uint8_t getOffsetOfSamples() const + { + return status_ * TotemSampicEventInfo_->offsetOfSamples; + } + + + + inline bool isOK() const + { + return status_; + } + protected: /** Raw data frame as sent by electronics. * The container is organized as follows: - * Even IndexinFiber: Ch Data - * \verbatim - * buffer index content size - * --------------------------------------------------------------- - * 0->23 Channel data sampic 8bit samples - * \endverbatim - * * Odd IndexinFiber: Ch Info * \verbatim * buffer index content size @@ -96,9 +256,38 @@ class TotemSampicFrame * 20->22 controlBits 32 bit * 23 hwId 8 bit * \endverbatim + * + * Even IndexinFiber: Ch Data + * \verbatim + * buffer index content size + * --------------------------------------------------------------- + * 0->23 Channel data sampic 8bit samples + * \endverbatim + * **/ - word data[12]; + const TotemSampicInfo* TotemSampicInfo_; + const TotemSampicData* TotemSampicData_; + const TotemSampicEventInfo* TotemSampicEventInfo_; + + int status_; + +// uint8_t* chInfoPtr_; +// uint8_t* chDataPtr_; +// uint8_t* eventInfoPtr_; + + inline void PrintRawBuffer(uint16_t const* buffer, const bool binary=false, const unsigned int size=12) const { + for (unsigned int i = 0; i < size; i++) { + if (binary) { + std::bitset<16> bits( *(buffer++) ); + std::cout << bits.to_string() << std::endl; + } + else + std::cout << std::setfill('0') << std::setw(4) << std::hex << *(buffer++) << std::endl; + } + std::cout << std::endl; + } + +}; -}; #endif diff --git a/EventFilter/CTPPSRawToDigi/interface/VFATFrame.h b/EventFilter/CTPPSRawToDigi/interface/VFATFrame.h index f795b5770590b..4b4c346919036 100644 --- a/EventFilter/CTPPSRawToDigi/interface/VFATFrame.h +++ b/EventFilter/CTPPSRawToDigi/interface/VFATFrame.h @@ -41,6 +41,11 @@ class VFATFrame { return data; } + + const VFATFrame::word* getData() const + { + return data; + } /// Returns Bunch Crossing number (BC<11:0>). VFATFrame::word getBC() const diff --git a/EventFilter/CTPPSRawToDigi/plugins/TotemVFATRawToDigi.cc b/EventFilter/CTPPSRawToDigi/plugins/TotemVFATRawToDigi.cc index e9f2d35c489b8..1cbe1f4a01186 100644 --- a/EventFilter/CTPPSRawToDigi/plugins/TotemVFATRawToDigi.cc +++ b/EventFilter/CTPPSRawToDigi/plugins/TotemVFATRawToDigi.cc @@ -79,6 +79,7 @@ TotemVFATRawToDigi::TotemVFATRawToDigi(const edm::ParameterSet &conf): fedDataToken = consumes(conf.getParameter("rawDataTag")); // validate chosen subSystem + std::cout << subSystemName << std::endl; if (subSystemName == "TrackingStrip") subSystem = ssTrackingStrip; if (subSystemName == "TimingDiamond") @@ -116,14 +117,12 @@ TotemVFATRawToDigi::TotemVFATRawToDigi(const edm::ParameterSet &conf): if (subSystem == ssTimingDiamond) { - for (int id = FEDNumbering::MINCTPPSDiamondFEDID; id <= FEDNumbering::MAXCTPPSDiamondFEDID; ++id) fedIds.push_back(id); } if (subSystem == ssTotemTiming) { - for (int id = FEDNumbering::MINTotemRPTimingVerticalFEDID; id <= FEDNumbering::MAXTotemRPTimingVerticalFEDID; ++id) fedIds.push_back(id); } diff --git a/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py b/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py index ad98c6c2c9a11..8de7c16e96e92 100644 --- a/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py +++ b/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py @@ -103,7 +103,7 @@ ) ) -from EventFilter.CTPPSRawToDigi.ctppsTotemTimingRawToDigi_cfi import totemTimingRawToDigi +from EventFilter.CTPPSRawToDigi.totemTimingRawToDigi_cfi import totemTimingRawToDigi totemTimingRawToDigi.rawDataTag = cms.InputTag("rawDataCollector") @@ -118,5 +118,6 @@ totemTriggerRawToDigi * totemRPRawToDigi * ctppsDiamondRawToDigi* + totemTimingRawToDigi* ctppsPixelDigis ) diff --git a/EventFilter/CTPPSRawToDigi/python/totemTimingRawToDigi_cfi.py b/EventFilter/CTPPSRawToDigi/python/totemTimingRawToDigi_cfi.py index 18c54d5bf7b4f..8ff33b409e2d5 100644 --- a/EventFilter/CTPPSRawToDigi/python/totemTimingRawToDigi_cfi.py +++ b/EventFilter/CTPPSRawToDigi/python/totemTimingRawToDigi_cfi.py @@ -8,4 +8,15 @@ # IMPORTANT: leave empty to load the default configuration from # DataFormats/FEDRawData/interface/FEDNumbering.h fedIds = cms.vuint32(), + + RawToDigi = cms.PSet( + verbosity = cms.untracked.uint32(0), + + # disable all the checks + testFootprint = cms.uint32(0), + testCRC = cms.uint32(0), + testID = cms.uint32(0), # compare the ID from data and mapping + testECMostFrequent = cms.uint32(0), # compare frame's EC with the most frequent value in the event + testBCMostFrequent = cms.uint32(0), # compare frame's BC with the most frequent value in the event + ) ) diff --git a/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc b/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc index c1cc49e5f8e80..b3ff64709220e 100644 --- a/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc +++ b/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc @@ -8,9 +8,11 @@ ****************************************************************************/ #include "EventFilter/CTPPSRawToDigi/interface/RawDataUnpacker.h" - #include "FWCore/MessageLogger/interface/MessageLogger.h" + +#define DEBUG 0 + //---------------------------------------------------------------------------------------------------- using namespace std; @@ -20,7 +22,7 @@ using namespace ctpps; //---------------------------------------------------------------------------------------------------- RawDataUnpacker::RawDataUnpacker(const edm::ParameterSet& iConfig) : - verbosity(iConfig.getUntrackedParameter("verbosity", 0)) + verbosity(iConfig.getUntrackedParameter("verbosity", 10)) {} //---------------------------------------------------------------------------------------------------- @@ -35,6 +37,8 @@ int RawDataUnpacker::Run(int fedId, const FEDRawData &data, vector "Data in FED " << fedId << " too short (size = " << size_in_words << " words)."; return 1; } + LogWarning("Totem") << "RawDataUnpacker::Run > " << + "Data in FED " << fedId << " (size = " << size_in_words << " words)."; fedInfoColl.push_back(TotemFEDInfo(fedId)); @@ -55,8 +59,10 @@ int RawDataUnpacker::ProcessOptoRxFrame(const word *buf, unsigned int frameSize, unsigned int BOE = (head >> 60) & 0xF; unsigned int H0 = (head >> 0) & 0xF; - //unsigned long LV1 = (head >> 32) & 0xFFFFFF; - //unsigned long BX = (head >> 20) & 0xFFF; + #ifdef DEBUG + unsigned long LV1 = (head >> 32) & 0xFFFFFF; + unsigned long BX = (head >> 20) & 0xFFF; + #endif unsigned int OptoRxId = (head >> 8) & 0xFFF; unsigned int FOV = (head >> 4) & 0xF; @@ -74,12 +80,26 @@ int RawDataUnpacker::ProcessOptoRxFrame(const word *buf, unsigned int frameSize, << ". OptoRxID=" << OptoRxId << ". Skipping frame." << endl; return 0; } + + + LogWarning("Totem") << "RawDataUnpacker::ProcessOptoRxFrame > " << "Structure of OptoRx header/footer: " + << "BOE=" << BOE << ", H0=" << H0 << ", EOE=" << EOE << ", F0=" << F0 + << ", size (OptoRx)=" << FSize << ", size (DATE)=" << frameSize + << ". OptoRxID=" << OptoRxId << ", FOV= " << FOV << endl; +// for (unsigned int i = 0; i < frameSize; ++i ) { +// std::cout<< setfill('0') << setw(16)<> RawDataUnpacker::ProcessOptoRxFrame > OptoRxId = %u, BX = %lu, LV1 = %lu, frameSize = %u, subFrames = %u)\n", - OptoRxId, BX, LV1, frameSize, subFrames); + printf(">> RawDataUnpacker::ProcessOptoRxFrame > OptoRxId = %u, BX = %lu, LV1 = %lu, frameSize = %u)\n", + OptoRxId, BX, LV1, frameSize); #endif + if (OptoRxId >= FEDNumbering::MINTotemRPTimingVerticalFEDID && OptoRxId <= FEDNumbering::MAXTotemRPTimingVerticalFEDID) { + ProcessOptoRxFrameSampic(buf, frameSize, fedInfo, fc); + return 0; + } + // parallel or serial transmission? switch (FOV) { case 1: @@ -222,6 +242,7 @@ int RawDataUnpacker::ProcessVFATDataParallel(const uint16_t *buf, unsigned int m // check header flag unsigned int hFlag = (buf[0] >> 8) & 0xFF; + std::cout<<"hFlag " << hFlag << " OptoRxId " << OptoRxId << std::endl; if (hFlag != vmCluster && hFlag != vmRaw && hFlag != vmDiamondCompact) { if (verbosity) @@ -425,3 +446,57 @@ int RawDataUnpacker::ProcessVFATDataParallel(const uint16_t *buf, unsigned int m return wordsProcessed; } + +//---------------------------------------------------------------------------------------------------- + +int RawDataUnpacker::ProcessOptoRxFrameSampic(const word *buf, unsigned int frameSize, TotemFEDInfo &fedInfo, SimpleVFATFrameCollection *fc) const +{ + + + unsigned int OptoRxId = (buf[0] >> 8) & 0xFFF; +// std::cout<< "Processing sampic frame: OptoRx " << OptoRxId << " GOH " << gohIdx << " Idx " << fiberIdx << " framesize: " << frameSize << std::endl; + + unsigned int orbitCounterVFATFrameWords = 6; + unsigned int sizeofVFATPayload = 12; + + VFATFrame::word *VFATFrameWordPtr = (VFATFrame::word *) buf; + VFATFrameWordPtr += orbitCounterVFATFrameWords - 1; + +// std::cout << "Framesize: " << frameSize << " frames: " << frameSize/(sizeofVFATPayload+2) << std::endl; + + unsigned int nWords = (frameSize-2) * 4 - 2; + + for (unsigned int i=1; i*(sizeofVFATPayload+2)> 4) & 0xF; + TotemFramePosition fp(0, 0, OptoRxId, gohIdx, fiberIdx); +// std::cout << "OptoRx: " << OptoRxId << " Goh: " << gohIdx << " Idx: " << fiberIdx << std::endl; + + // prepare temporary VFAT frame + VFATFrame frame(++VFATFrameWordPtr); + VFATFrameWordPtr += sizeofVFATPayload; + +// VFATFrame::word *fd = frame.getData(); +// for (unsigned int j = 0; j < sizeofVFATPayload; j++) { +// std::cout << j << "\t" << std::hex<< fd[sizeofVFATPayload - j - 1] << std::endl; +// } + + if ( *(VFATFrameWordPtr) != 0xf00e ) { + std::cout<<"!!!!Wrong trailer!!!! " << *VFATFrameWordPtr << std::endl; + continue; + } + else { + // save frame to output + frame.setPresenceFlags(1); + fc->Insert(fp, frame); + } +// std::cout << "Trailer: " << std::hex << *VFATFrameWordPtr << std::endl; +// std::cout << std::endl; + + } + + return 0; +} + diff --git a/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc b/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc index add0a282c8d5e..60ba03fefcab6 100644 --- a/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc +++ b/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc @@ -14,8 +14,8 @@ #include "DataFormats/CTPPSDetId/interface/TotemRPDetId.h" #include "DataFormats/CTPPSDetId/interface/CTPPSDiamondDetId.h" +#include "DataFormats/CTPPSDetId/interface/TotemTimingDetId.h" -#include "EventFilter/CTPPSRawToDigi/interface/DiamondVFATFrame.h" //---------------------------------------------------------------------------------------------------- @@ -279,6 +279,9 @@ void RawToDigiConverter::Run(const VFATFrameCollection &coll, const TotemDAQMapp if (record.status.isOK()) { + const TotemFramePosition* framepos = &p.first; + std::cout<< "Subsystem: " << framepos->getSubSystemId() << "\tTOTFED: "<< framepos->getTOTFEDId()<< "\tGOH: "<< framepos->getGOHId() << "\tIdxInFiber: " << framepos->getIdxInFiber() << std::endl; + const VFATFrame *fr = record.frame; const DiamondVFATFrame *diamondframe = static_cast(fr); @@ -296,6 +299,74 @@ void RawToDigiConverter::Run(const VFATFrameCollection &coll, const TotemDAQMapp } } +//---------------------------------------------------------------------------------------------------- + +void RawToDigiConverter::Run(const VFATFrameCollection &coll, const TotemDAQMapping &mapping, const TotemAnalysisMask &mask, + edm::DetSetVector &digi, edm::DetSetVector &status) +{ + // structure merging vfat frame data with the mapping + map records; + + // common processing - frame validation + RunCommon(coll, mapping, records); + + // second loop over data + for (auto &p : records) + { + Record &record = p.second; + if (!record.status.isOK()) continue; + + const TotemFramePosition* framepos = &p.first; + + if(((framepos->getIdxInFiber()%2)==0)&&(framepos->getIdxInFiber()<14)) + { + //corresponding channel data are always in the neighbouring idx in fiber + + TotemFramePosition frameposdata(framepos->getSubSystemId(),framepos->getTOTFEDId(),framepos->getOptoRxId(),framepos->getGOHId(),(framepos->getIdxInFiber()+1)); + TotemFramePosition frameposEvtInfo(framepos->getSubSystemId(),framepos->getTOTFEDId(),framepos->getOptoRxId(),framepos->getGOHId(),0xe); + + +// std::cout<< "Framing: GOH " << framepos->getGOHId()<< " Idx " << framepos->getIdxInFiber() << " Ch Info" << std::endl; +// record.frame->Print(); + auto channelwaveformPtr = records.find(frameposdata); + auto eventInfoPtr = records.find(frameposEvtInfo); + + if ( channelwaveformPtr != records.end() && eventInfoPtr != records.end() ) { + Record &channelwaveform = records[frameposdata]; + // std::cout<< "Ch Data" << std::endl; + // channelwaveform.frame->Print(); + Record &eventInfo = records[frameposEvtInfo]; + // std::cout<< "Event Info" << std::endl; + // eventInfo.frame->Print(); + + // Extract all the waveform information from the raw data + TotemSampicFrame totemSampicFrame((uint8_t*) record.frame->getData(), (uint8_t*) channelwaveform.frame->getData(), (uint8_t*) eventInfo.frame->getData()); + + // totemSampicFrame.PrintRaw(); +// if (totemSampicFrame.isOK()) totemSampicFrame.Print(); + + if (totemSampicFrame.isOK()) + { + // create the digi + TotemTimingEventInfo eventInfoTmp( totemSampicFrame.getEventHardwareId(), totemSampicFrame.getL1ATimeStamp(), totemSampicFrame.getBunchNumber(), totemSampicFrame.getOrbitNumber(), totemSampicFrame.getEventNumber(), totemSampicFrame.getChannelMap(), totemSampicFrame.getL1ALatency(), totemSampicFrame.getNumberOfSentSamples(), totemSampicFrame.getOffsetOfSamples() ); + TotemTimingDigi digiTmp( totemSampicFrame.getHardwareId(), totemSampicFrame.getFPGATimeStamp(), totemSampicFrame.getTimeStampA(), totemSampicFrame.getTimeStampB(), totemSampicFrame.getCellInfo(), totemSampicFrame.getSamples(), eventInfoTmp); + // calculate ids + TotemTimingDetId detId(record.info->symbolicID.symbolicID); + std::cout << "Plane: " << digiTmp.getHardwareSampicId() % 4 << " Ch: " << digiTmp.getHardwareChannelId() << std::endl; + detId.setPlane( digiTmp.getHardwareSampicId() % 4 ); + detId.setChannel( digiTmp.getHardwareChannelId() ); + + + + DetSet &digiDetSet = digi.find_or_insert(detId); //TODO: ID!! + digiDetSet.push_back(digiTmp); + } + } + } + } +} + + //---------------------------------------------------------------------------------------------------- void RawToDigiConverter::PrintSummaries() const diff --git a/EventFilter/CTPPSRawToDigi/test/analyze_vfat_frames.py b/EventFilter/CTPPSRawToDigi/test/analyze_vfat_frames.py index 6b195f8b249df..e6894871205cd 100644 --- a/EventFilter/CTPPSRawToDigi/test/analyze_vfat_frames.py +++ b/EventFilter/CTPPSRawToDigi/test/analyze_vfat_frames.py @@ -5,7 +5,7 @@ # default options options = VarParsing.VarParsing ('analysis') -options.inputFiles= 'file:/afs/cern.ch/user/j/jkaspar/public/run268608_ls0001_streamA_StorageManager.root', +options.inputFiles= 'file:/eos/cms/store/group/dpg_ctpps/comm_ctpps/TotemTiming/Minidaq/306/run312306_ls0015_streamA_StorageManager.dat', options.outputFile = 'this_is_not_used' options.maxEvents = 10 @@ -22,7 +22,7 @@ ) # raw data source -process.source = cms.Source("PoolSource", +process.source = cms.Source("NewEventStreamFileReader", fileNames = cms.untracked.vstring(options.inputFiles) ) @@ -33,7 +33,7 @@ # frame analyzer process.totemVFATFrameAnalyzer = cms.EDAnalyzer("TotemVFATFrameAnalyzer", rawDataTag = cms.InputTag("rawDataCollector"), - fedIds = cms.vuint32(578, 579, 580), + fedIds = cms.vuint32(587), RawUnpacking = cms.PSet() ) diff --git a/EventFilter/CTPPSRawToDigi/test/test_standard_sequence_cfg.py b/EventFilter/CTPPSRawToDigi/test/test_standard_sequence_cfg.py index f5f13db4eddde..8ad4ee87cac46 100644 --- a/EventFilter/CTPPSRawToDigi/test/test_standard_sequence_cfg.py +++ b/EventFilter/CTPPSRawToDigi/test/test_standard_sequence_cfg.py @@ -12,15 +12,19 @@ ) # raw data source -process.source = cms.Source("PoolSource", +process.source = cms.Source("NewEventStreamFileReader", fileNames = cms.untracked.vstring( # '/store/express/Run2016H/ExpressPhysics/FEVT/Express-v2/000/283/877/00000/4EE44B0E-2499-E611-A155-02163E011938.root' - '/store/data/Run2016H/ZeroBias/RAW/v1/000/283/820/00000/462D2A5B-B19A-E611-B100-02163E01382E.root' + 'file:/eos/cms/store/group/dpg_ctpps/comm_ctpps/TotemTiming/Minidaq/519/run312519_ls0002_streamA_StorageManager.dat' ) ) process.maxEvents = cms.untracked.PSet( - input = cms.untracked.int32(100) + input = cms.untracked.int32(10) +) + +process.verbosity = cms.untracked.PSet( + input = cms.untracked.int32(10) ) # raw-to-digi conversion From 419009bc5262fe6eb421f8d6ae83069d82e27d0b Mon Sep 17 00:00:00 2001 From: Shilpi Date: Sun, 25 Mar 2018 11:51:15 +0200 Subject: [PATCH 210/426] changes for 10X --- .../python/ALCARECOEcalCalIsolElectron_Output_cff.py | 10 ++++++---- .../python/ALCARECOEcalUncalIsolElectron_Output_cff.py | 10 +++++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Calibration/EcalAlCaRecoProducers/python/ALCARECOEcalCalIsolElectron_Output_cff.py b/Calibration/EcalAlCaRecoProducers/python/ALCARECOEcalCalIsolElectron_Output_cff.py index 29cc327dbe624..dd484da3704a3 100644 --- a/Calibration/EcalAlCaRecoProducers/python/ALCARECOEcalCalIsolElectron_Output_cff.py +++ b/Calibration/EcalAlCaRecoProducers/python/ALCARECOEcalCalIsolElectron_Output_cff.py @@ -24,8 +24,8 @@ ), outputCommands = cms.untracked.vstring( 'keep *_pfMet_*_*', # met for Wenu selection - 'keep *_kt6PFJetsForRhoCorrection_rho_*', #rho for effective area subtraction - 'keep *_kt6PFJets_rho_*', #rho for effective area subtraction + #'keep *_kt6PFJetsForRhoCorrection_rho_*', #rho for effective area subtraction + #'keep *_kt6PFJets_rho_*', #rho for effective area subtraction #'keep recoVertexs_offlinePrimaryVertices*_*_*', 'keep recoVertexs_offlinePrimaryVertices_*_*', 'keep recoVertexs_offlinePrimaryVerticesWithBS_*_*', @@ -34,14 +34,14 @@ 'keep *_conversions_*_*', #'keep *GsfTrack*_*_*_*', 'keep *GsfTrack*_electronGsfTracks_*_*', - 'keep *GsfTrack*_uncleanedOnlyElectronGsfTracks_*_*', +# 'keep *GsfTrack*_uncleanedOnlyElectronGsfTracks_*_*', 'keep *_generator_*_*', 'keep *_addPileupInfo_*_*', 'keep *_genParticles_*_*', 'keep recoGsfElectron*_gsfElectron*_*_*', #'keep recoGsfElectron*_gedGsfElectron*_*_*', 'keep recoGsfElectron*_gedGsfElectrons_*_*', - 'keep recoGsfElectron*_gedGsfElectronsTmp_*_*', +# 'keep recoGsfElectron*_gedGsfElectronsTmp_*_*', 'keep recoGsfElectron*_gedGsfElectronCores_*_*', 'keep recoPhoton*_gedPhoton_*_*', #'keep recoCaloClusters_*_*_*', @@ -94,6 +94,8 @@ # pfisolation CMSSW_5_3_X 'keep *EcalRecHit*_alCaIsolatedElectrons_*_*', 'keep *EcalRecHit*_reducedEcalRecHitsES_alCaRecHitsES_*', + 'keep *_fixedGridRhoFastjetAll_*_*' + ) ) diff --git a/Calibration/EcalAlCaRecoProducers/python/ALCARECOEcalUncalIsolElectron_Output_cff.py b/Calibration/EcalAlCaRecoProducers/python/ALCARECOEcalUncalIsolElectron_Output_cff.py index f0e523a8d6816..64f4cf47baa8e 100644 --- a/Calibration/EcalAlCaRecoProducers/python/ALCARECOEcalUncalIsolElectron_Output_cff.py +++ b/Calibration/EcalAlCaRecoProducers/python/ALCARECOEcalUncalIsolElectron_Output_cff.py @@ -18,7 +18,15 @@ 'drop recoSuperClusters_*_*_*', 'drop recoPreshowerCluster*_*_*_*', 'drop *EcalRecHit*_reducedEcalRecHitsES*_*_*', - 'keep reco*Clusters_pfElectronTranslator_*_*' + 'keep reco*Clusters_pfElectronTranslator_*_*', + 'drop TrajectorysToOnerecoGsfTracksAssociation_electronGsfTracks_*_*', + 'drop TrajectorysToOnerecoGsfTracksAssociation_uncleanedOnlyElectronGsfTracks_*_*', + 'drop recoGsfElectronsrecoGsfElectronrecoGsfElectronsrecoGsfElectronedmrefhelperFindUsingAdvanceedmRefedmValueMap_gedGsfElectronsTmp_*_*', + 'drop recoConversions_conversions_uncleanedConversions_*', + 'drop recoGsfElectrons_gedGsfElectronsTmp_*_*', + 'drop recoGsfTracks_uncleanedOnlyElectronGsfTracks_*_*', + 'drop recoGsfTrackExtras_uncleanedOnlyElectronGsfTracks_*_*' + ) OutALCARECOEcalUncalElectron.SelectEvents = cms.untracked.PSet( From f296d1500401188b9e029df67a2c134cbcf15851 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Sun, 25 Mar 2018 18:25:40 +0200 Subject: [PATCH 211/426] Take Vladimir's suggestions --- .../ForwardDetId/src/HGCScintillatorDetId.cc | 10 +++++----- .../ForwardDetId/src/HGCSiliconDetId.cc | 18 +++++++++--------- .../ForwardDetId/src/HGCalTriggerDetId.cc | 6 ++++-- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/DataFormats/ForwardDetId/src/HGCScintillatorDetId.cc b/DataFormats/ForwardDetId/src/HGCScintillatorDetId.cc index 912271f88fb3b..52581071429c8 100644 --- a/DataFormats/ForwardDetId/src/HGCScintillatorDetId.cc +++ b/DataFormats/ForwardDetId/src/HGCScintillatorDetId.cc @@ -16,11 +16,11 @@ HGCScintillatorDetId::HGCScintillatorDetId(int type, int layer, int eta, int zside = (eta < 0) ? 1 : 0; int etaAbs = std::abs(eta); - id_ |= ((type&kHGCalTypeMask)<= 0) ? 0 : 1; int waferVsign = (waferV >= 0) ? 0 : 1; int zside = (zp < 0) ? 1 : 0; - id_ |= ((cellU & kHGCalCellUMask) << kHGCalCellUOffset); - id_ |= ((cellV & kHGCalCellVMask) << kHGCalCellVOffset); - id_ |= ((waferUabs & kHGCalWaferUMask) << kHGCalWaferUOffset); - id_ |= ((waferUsign& kHGCalWaferUSignMask) << kHGCalWaferUSignOffset); - id_ |= ((waferVabs & kHGCalWaferVMask) << kHGCalWaferVOffset); - id_ |= ((waferVsign& kHGCalWaferVSignMask) << kHGCalWaferVSignOffset); - id_ |= ((layer & kHGCalLayerMask) << kHGCalLayerOffset); - id_ |= ((zside & kHGCalZsideMask) << kHGCalZsideOffset); - id_ |= ((type & kHGCalTypeMask) << kHGCalTypeOffset); + id_ |= (((cellU & kHGCalCellUMask) << kHGCalCellUOffset) | + ((cellV & kHGCalCellVMask) << kHGCalCellVOffset) | + ((waferUabs & kHGCalWaferUMask) << kHGCalWaferUOffset) | + ((waferUsign& kHGCalWaferUSignMask) << kHGCalWaferUSignOffset) | + ((waferVabs & kHGCalWaferVMask) << kHGCalWaferVOffset) | + ((waferVsign& kHGCalWaferVSignMask) << kHGCalWaferVSignOffset) | + ((layer & kHGCalLayerMask) << kHGCalLayerOffset) | + ((zside & kHGCalZsideMask) << kHGCalZsideOffset) | + ((type & kHGCalTypeMask) << kHGCalTypeOffset)); } HGCSiliconDetId::HGCSiliconDetId(const DetId& gen) { diff --git a/DataFormats/ForwardDetId/src/HGCalTriggerDetId.cc b/DataFormats/ForwardDetId/src/HGCalTriggerDetId.cc index 062a0f2d860ca..f28bc7ab4fe8d 100644 --- a/DataFormats/ForwardDetId/src/HGCalTriggerDetId.cc +++ b/DataFormats/ForwardDetId/src/HGCalTriggerDetId.cc @@ -60,8 +60,9 @@ int HGCalTriggerDetId::triggerCellX() const { int N = nT*HGCalTriggerCell; std::vector vc = cellV(); int x(0); - for (auto const & v : vc) + for (auto const & v : vc) { x += (3*(v-N)+2); + } return (x/vc.size()); } @@ -72,8 +73,9 @@ int HGCalTriggerDetId::triggerCellY() const { std::vector uc = cellU(); std::vector vc = cellV(); int y(0); - for (unsigned int k=0; k Date: Mon, 26 Mar 2018 12:53:43 +0200 Subject: [PATCH 212/426] Change ROOT Schema Evolution tests During the review process it appeared that the time line with which the development IBs of CMSSW receive ROOT updates is different with respect to the regular IBs. Since they both use the same CMSSW branch with different ROOT externals, we cannot tune the test in CMSSW. Therefore the test has been designed such that it will fail iff there is schema evolution in the future, i.e. if the version X coming from the currently used ROOT external is greater than the baseline case. Therefore the test will be in sync with whatever release/IB is more far in the future with respect to ROOT developments. All other releases will anyway pass the test since their respective streamerInfo will be lower than the, by now updated, baseline case. --- .../Components/test/testSchemaEvolution.cpp | 84 ++++++++++--------- 1 file changed, 44 insertions(+), 40 deletions(-) diff --git a/DQMServices/Components/test/testSchemaEvolution.cpp b/DQMServices/Components/test/testSchemaEvolution.cpp index ba74a69805f11..c8e5fcc4a1ec5 100644 --- a/DQMServices/Components/test/testSchemaEvolution.cpp +++ b/DQMServices/Components/test/testSchemaEvolution.cpp @@ -6,11 +6,12 @@ #include "TDataMember.h" #include -#include -#include +#include #include #include +using std::unordered_map; +using std::string; class TestSchemaEvolution : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(TestSchemaEvolution); @@ -31,52 +32,55 @@ class TestSchemaEvolution : public CppUnit::TestFixture { void loopOnDataMembers(TClass *); void loopOnBases(TClass *); void analyseClass(TClass *); - std::set> unique_classes_; - std::set> unique_classes_current_; + + + unordered_map unique_classes_; + unordered_map unique_classes_current_; }; CPPUNIT_TEST_SUITE_REGISTRATION( TestSchemaEvolution ); void TestSchemaEvolution::fillBaseline() { - unique_classes_current_.insert(std::make_tuple("TArray", 1)); - unique_classes_current_.insert(std::make_tuple("TArrayD", 1)); - unique_classes_current_.insert(std::make_tuple("TArrayF", 1)); - unique_classes_current_.insert(std::make_tuple("TArrayI", 1)); - unique_classes_current_.insert(std::make_tuple("TArrayS", 1)); - unique_classes_current_.insert(std::make_tuple("TAtt3D", 1)); - unique_classes_current_.insert(std::make_tuple("TAttAxis", 4)); - unique_classes_current_.insert(std::make_tuple("TAttFill", 2)); - unique_classes_current_.insert(std::make_tuple("TAttLine", 2)); - unique_classes_current_.insert(std::make_tuple("TAttMarker", 2)); - unique_classes_current_.insert(std::make_tuple("TAxis", 10)); - unique_classes_current_.insert(std::make_tuple("TH1", 8)); - unique_classes_current_.insert(std::make_tuple("TH1D", 2)); - unique_classes_current_.insert(std::make_tuple("TH1F", 2)); - unique_classes_current_.insert(std::make_tuple("TH1I", 2)); - unique_classes_current_.insert(std::make_tuple("TH1S", 2)); - unique_classes_current_.insert(std::make_tuple("TH2", 4)); - unique_classes_current_.insert(std::make_tuple("TH2D", 3)); - unique_classes_current_.insert(std::make_tuple("TH2F", 3)); - unique_classes_current_.insert(std::make_tuple("TH2I", 3)); - unique_classes_current_.insert(std::make_tuple("TH2S", 3)); - unique_classes_current_.insert(std::make_tuple("TH3", 5)); - unique_classes_current_.insert(std::make_tuple("TH3D", 3)); - unique_classes_current_.insert(std::make_tuple("TH3F", 3)); - unique_classes_current_.insert(std::make_tuple("TH3I", 3)); - unique_classes_current_.insert(std::make_tuple("TH3S", 3)); - unique_classes_current_.insert(std::make_tuple("TNamed", 1)); - unique_classes_current_.insert(std::make_tuple("TObject", 1)); - unique_classes_current_.insert(std::make_tuple("TProfile", 6)); - unique_classes_current_.insert(std::make_tuple("TProfile2D", 7)); - unique_classes_current_.insert(std::make_tuple("TString", 2)); + unique_classes_current_.insert(std::make_pair("TArray", 1)); + unique_classes_current_.insert(std::make_pair("TArrayD", 1)); + unique_classes_current_.insert(std::make_pair("TArrayF", 1)); + unique_classes_current_.insert(std::make_pair("TArrayI", 1)); + unique_classes_current_.insert(std::make_pair("TArrayS", 1)); + unique_classes_current_.insert(std::make_pair("TAtt3D", 1)); + unique_classes_current_.insert(std::make_pair("TAttAxis", 4)); + unique_classes_current_.insert(std::make_pair("TAttFill", 2)); + unique_classes_current_.insert(std::make_pair("TAttLine", 2)); + unique_classes_current_.insert(std::make_pair("TAttMarker", 2)); + unique_classes_current_.insert(std::make_pair("TAxis", 10)); + unique_classes_current_.insert(std::make_pair("TH1", 8)); + unique_classes_current_.insert(std::make_pair("TH1D", 2)); + unique_classes_current_.insert(std::make_pair("TH1F", 2)); + unique_classes_current_.insert(std::make_pair("TH1I", 2)); + unique_classes_current_.insert(std::make_pair("TH1S", 2)); + unique_classes_current_.insert(std::make_pair("TH2", 4)); + unique_classes_current_.insert(std::make_pair("TH2D", 3)); + unique_classes_current_.insert(std::make_pair("TH2F", 3)); + unique_classes_current_.insert(std::make_pair("TH2I", 3)); + unique_classes_current_.insert(std::make_pair("TH2S", 3)); + unique_classes_current_.insert(std::make_pair("TH3", 5)); + unique_classes_current_.insert(std::make_pair("TH3D", 3)); + unique_classes_current_.insert(std::make_pair("TH3F", 3)); + unique_classes_current_.insert(std::make_pair("TH3I", 3)); + unique_classes_current_.insert(std::make_pair("TH3S", 3)); + unique_classes_current_.insert(std::make_pair("TNamed", 1)); + unique_classes_current_.insert(std::make_pair("TObject", 1)); + unique_classes_current_.insert(std::make_pair("TProfile", 6)); + unique_classes_current_.insert(std::make_pair("TProfile2D", 7)); + unique_classes_current_.insert(std::make_pair("TString", 2)); } void TestSchemaEvolution::runComparison() { CPPUNIT_ASSERT(unique_classes_current_.size() == unique_classes_.size()); for (auto cl : unique_classes_current_) { - std::cout << "Checking " << std::get<0>(cl) << " " << std::get<1>(cl) << std::endl; - CPPUNIT_ASSERT(unique_classes_.find(cl) != unique_classes_.end()); + std::cout << "Checking " << cl.first << " " << cl.second << std::endl; + CPPUNIT_ASSERT(unique_classes_.find(cl.first) != unique_classes_.end()); + CPPUNIT_ASSERT(unique_classes_[cl.first] <= unique_classes_current_[cl.first]); } } @@ -101,7 +105,7 @@ void TestSchemaEvolution::gatherAllClasses() { TClass *tcl = TClass::GetClass(classes[i]); if (!tcl) continue; - unique_classes_.insert(std::make_tuple(classes[i], tcl->GetClassVersion())); + unique_classes_.insert(std::make_pair(classes[i], tcl->GetClassVersion())); analyseClass(tcl); ++i; } @@ -114,7 +118,7 @@ void TestSchemaEvolution::loopOnDataMembers(TClass *tcl) while (TObject *obj = next()) { TClass *cl = TClass::GetClass(((TDataMember *)obj)->GetFullTypeName()); if (cl && cl->HasDictionary()) { - unique_classes_.insert(std::make_tuple(cl->GetName(), cl->GetClassVersion())); + unique_classes_.insert(std::make_pair(cl->GetName(), cl->GetClassVersion())); analyseClass(cl); } } @@ -128,7 +132,7 @@ void TestSchemaEvolution::loopOnBases(TClass *tcl) while (TObject *obj = next()) { TClass *cl = TClass::GetClass(obj->GetName()); if (cl && cl->HasDictionary()) { - unique_classes_.insert(std::make_tuple(cl->GetName(), cl->GetClassVersion())); + unique_classes_.insert(std::make_pair(cl->GetName(), cl->GetClassVersion())); analyseClass(cl); } } From d280c0abbbd543a1760cbef4c604b1ca95a15976 Mon Sep 17 00:00:00 2001 From: mmusich Date: Wed, 14 Mar 2018 18:34:59 +0100 Subject: [PATCH 213/426] remove useless triplication of AAG data in calibTree --- .../SiStripChannelGain/python/ntuple_cff.py | 48 ++++++++----------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/CalibTracker/SiStripChannelGain/python/ntuple_cff.py b/CalibTracker/SiStripChannelGain/python/ntuple_cff.py index 14ac29a906ced..4839c5b75d7a4 100644 --- a/CalibTracker/SiStripChannelGain/python/ntuple_cff.py +++ b/CalibTracker/SiStripChannelGain/python/ntuple_cff.py @@ -6,29 +6,23 @@ from CalibTracker.SiStripCommon.SiStripBFieldFilter_cfi import * from HLTrigger.HLTfilters.triggerResultsFilter_cfi import * -AAGFilter = triggerResultsFilter.clone( -# triggerConditions = cms.vstring("HLT_ZeroBias_*"), - triggerConditions = cms.vstring("HLT_ZeroBias_FirstCollisionAfterAbortGap_*"), - hltResults = cms.InputTag( "TriggerResults", "", "HLT" ), - l1tResults = cms.InputTag( "" ), - throw = cms.bool(False) - ) - -IsolatedMuonFilter = triggerResultsFilter.clone( -# triggerConditions = cms.vstring("HLT_ZeroBias_*"), - triggerConditions = cms.vstring("HLT_IsoMu20_*"), - hltResults = cms.InputTag( "TriggerResults", "", "HLT" ), - l1tResults = cms.InputTag( "" ), - throw = cms.bool(False) - ) - -ZeroBiasFilter = triggerResultsFilter.clone( -# triggerConditions = cms.vstring("HLT_ZeroBias_*"), - triggerConditions = cms.vstring("HLT_ZeroBias_*"), - hltResults = cms.InputTag( "TriggerResults", "", "HLT" ), - l1tResults = cms.InputTag( "" ), - throw = cms.bool(False) - ) +AAGFilter = triggerResultsFilter.clone(triggerConditions = cms.vstring("HLT_ZeroBias_FirstCollisionAfterAbortGap_*"), + hltResults = cms.InputTag( "TriggerResults", "", "HLT" ), + l1tResults = cms.InputTag( "" ), + throw = cms.bool(False) + ) + +IsolatedMuonFilter = triggerResultsFilter.clone(triggerConditions = cms.vstring("HLT_IsoMu20_*"), + hltResults = cms.InputTag( "TriggerResults", "", "HLT" ), + l1tResults = cms.InputTag( "" ), + throw = cms.bool(False) + ) + +ZeroBiasFilter = triggerResultsFilter.clone(triggerConditions = cms.vstring("HLT_ZeroBias_*",), + hltResults = cms.InputTag( "TriggerResults", "", "HLT" ), + l1tResults = cms.InputTag( "" ), + throw = cms.bool(False) + ) OfflineChannelGainOutputCommands = [ @@ -65,10 +59,10 @@ inputDataSequence = cms.Sequence( shallowEventRun + shallowTracks + shallowGainCalibration ) -OfflineGainNtuple_StdBunch = cms.Sequence( ZeroBiasFilter + siStripBFieldOnFilter + +OfflineGainNtuple_StdBunch = cms.Sequence( ZeroBiasFilter + ~AAGFilter + siStripBFieldOnFilter + inputDataSequence * gainCalibrationTreeStdBunch ) -OfflineGainNtuple_StdBunch0T = cms.Sequence( ZeroBiasFilter + siStripBFieldOffFilter + +OfflineGainNtuple_StdBunch0T = cms.Sequence( ZeroBiasFilter + ~AAGFilter + siStripBFieldOffFilter + inputDataSequence * gainCalibrationTreeStdBunch0T ) OfflineGainNtuple_AagBunch = cms.Sequence( siStripBFieldOnFilter + AAGFilter + @@ -77,10 +71,10 @@ OfflineGainNtuple_AagBunch0T = cms.Sequence( siStripBFieldOffFilter + AAGFilter + inputDataSequence * gainCalibrationTreeAagBunch0T ) -OfflineGainNtuple_IsoMuon = cms.Sequence( siStripBFieldOnFilter + AAGFilter + +OfflineGainNtuple_IsoMuon = cms.Sequence( siStripBFieldOnFilter + IsolatedMuonFilter + inputDataSequence * gainCalibrationTreeIsoMuon ) -OfflineGainNtuple_IsoMuon0T = cms.Sequence( siStripBFieldOffFilter + AAGFilter + +OfflineGainNtuple_IsoMuon0T = cms.Sequence( siStripBFieldOffFilter + IsolatedMuonFilter + inputDataSequence * gainCalibrationTreeIsoMuon0T ) #OfflineGainNtuple = cms.Sequence( (shallowEventRun+ From ea1df7abc365266ad43e84bc7b879b942bd56c67 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Mon, 26 Mar 2018 16:37:46 +0200 Subject: [PATCH 214/426] Take Vladimir's suggestions --- Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.cc | 2 +- Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.h | 1 + Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.cc | 6 +++--- Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.h | 1 + .../{dumpSimGeometry_cfg.py => dumpHGCalGeometry_cfg.py} | 0 5 files changed, 6 insertions(+), 4 deletions(-) rename Geometry/HGCalCommonData/test/{dumpSimGeometry_cfg.py => dumpHGCalGeometry_cfg.py} (100%) diff --git a/Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.cc b/Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.cc index 00f0d832f64ce..aad35834b7d7f 100644 --- a/Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.cc +++ b/Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.cc @@ -244,7 +244,7 @@ void DDHGCalEEAlgo::constructLayers(const DDLogicalPart& module, } // End of loop over layers in a block zi = zo; laymin = laymax; - if (fabs(thickTot-layerThick_[i]) < 0.00001) { + if (std::abs(thickTot-layerThick_[i]) < 0.00001) { } else if (thickTot > layerThick_[i]) { edm::LogError("HGCalGeom") << "Thickness of the partition " << layerThick_[i] << " is smaller than " diff --git a/Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.h b/Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.h index 352fd555804ef..7518251849176 100644 --- a/Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.h +++ b/Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.h @@ -1,6 +1,7 @@ #ifndef HGCalCommonData_DDHGCalEEAlgo_h #define HGCalCommonData_DDHGCalEEAlgo_h +#include #include #include #include diff --git a/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.cc b/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.cc index edc73289080bf..70c9d70e3af53 100644 --- a/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.cc +++ b/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.cc @@ -287,7 +287,7 @@ void DDHGCalHEAlgo::constructLayers(const DDLogicalPart& module, } // End of loop over layers in a block zi = zo; laymin = laymax; - if (fabs(thickTot-layerThick_[i]) < 0.00001) { + if (std::abs(thickTot-layerThick_[i]) < 0.00001) { } else if (thickTot > layerThick_[i]) { edm::LogError("HGCalGeom") << "Thickness of the partition " << layerThick_[i] << " is smaller than " @@ -394,7 +394,7 @@ void DDHGCalHEAlgo::positionMix(const DDLogicalPart& glog, ++copyNumberTop_[ii]; zpos += hthickl; } - if (fabs(thickTot-thick) < 0.00001) { + if (std::abs(thickTot-thick) < 0.00001) { } else if (thickTot > thick) { edm::LogError("HGCalGeom") << "Thickness of the partition " << thick << " is smaller than " << thickTot @@ -464,7 +464,7 @@ void DDHGCalHEAlgo::positionMix(const DDLogicalPart& glog, zpos += hthickl; ++copyNumberBot_[ii]; } - if (fabs(thickTot-thick) < 0.00001) { + if (std::abs(thickTot-thick) < 0.00001) { } else if (thickTot > thick) { edm::LogError("HGCalGeom") << "Thickness of the partition " << thick << " is smaller than " << thickTot diff --git a/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.h b/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.h index 02269a25e1cc9..1332f489b9afe 100644 --- a/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.h +++ b/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.h @@ -1,6 +1,7 @@ #ifndef HGCalCommonData_DDHGCalHEAlgo_h #define HGCalCommonData_DDHGCalHEAlgo_h +#include #include #include #include diff --git a/Geometry/HGCalCommonData/test/dumpSimGeometry_cfg.py b/Geometry/HGCalCommonData/test/dumpHGCalGeometry_cfg.py similarity index 100% rename from Geometry/HGCalCommonData/test/dumpSimGeometry_cfg.py rename to Geometry/HGCalCommonData/test/dumpHGCalGeometry_cfg.py From 24bac29f88d38dcc01458856680373f77facd8c0 Mon Sep 17 00:00:00 2001 From: nminafra Date: Mon, 26 Mar 2018 16:41:05 +0200 Subject: [PATCH 215/426] Added hwId to plane,channel mapping --- .../interface/TotemDAQMapping.h | 11 +++ .../plugins/TotemDAQMappingESSourceXML.cc | 54 ++++++++++++++- .../src/TotemDAQMapping.cc | 10 +++ .../xml/mapping_totem_timing_2018.xml | 68 +++++++++++++++++-- .../CTPPSDetId/interface/TotemTimingDetId.h | 4 +- .../interface/TotemSampicFrame.h | 32 +++++++-- .../plugins/TotemVFATRawToDigi.cc | 1 - .../CTPPSRawToDigi/src/RawDataUnpacker.cc | 14 +--- .../CTPPSRawToDigi/src/RawToDigiConverter.cc | 35 +++++++--- 9 files changed, 191 insertions(+), 38 deletions(-) diff --git a/CondFormats/CTPPSReadoutObjects/interface/TotemDAQMapping.h b/CondFormats/CTPPSReadoutObjects/interface/TotemDAQMapping.h index 30d68a3dd8027..fb92ade3aea38 100644 --- a/CondFormats/CTPPSReadoutObjects/interface/TotemDAQMapping.h +++ b/CondFormats/CTPPSReadoutObjects/interface/TotemDAQMapping.h @@ -43,7 +43,18 @@ class TotemDAQMapping public: std::map VFATMapping; + // Hw Id mapping for Totem Timing (dynamicla mapping in Sampic) + struct TotemTimingPlaneChannelPair { + int channel; + int plane; + + TotemTimingPlaneChannelPair(const int& channel=-1, const int& plane=-1) : channel(channel), plane(plane) {}; + }; + std::map totemTimingChannelMap; + void insert(const TotemFramePosition &fp, const TotemVFATInfo &vi); + + const TotemTimingPlaneChannelPair getTimingChannel( const uint8_t hwId ) const; }; #endif diff --git a/CondFormats/CTPPSReadoutObjects/plugins/TotemDAQMappingESSourceXML.cc b/CondFormats/CTPPSReadoutObjects/plugins/TotemDAQMappingESSourceXML.cc index eb0e3a85d9a90..3035663877f23 100644 --- a/CondFormats/CTPPSReadoutObjects/plugins/TotemDAQMappingESSourceXML.cc +++ b/CondFormats/CTPPSReadoutObjects/plugins/TotemDAQMappingESSourceXML.cc @@ -38,6 +38,9 @@ #include #include +#include +#include + // #define DEBUG 1 @@ -74,11 +77,15 @@ class TotemDAQMappingESSourceXML: public edm::ESProducer, public edm::EventSetup /// totem timing specific tags static const std::string tagSampicBoard; static const std::string tagSampicCh; + static const std::string tagTotemTimingCh; + static const std::string tagTotemTimingPlane; TotemDAQMappingESSourceXML(const edm::ParameterSet &); ~TotemDAQMappingESSourceXML() override; edm::ESProducts< std::shared_ptr, std::shared_ptr > produce( const TotemReadoutRcd & ); + + private: unsigned int verbosity; @@ -111,7 +118,7 @@ class TotemDAQMappingESSourceXML: public edm::ESProducer, public edm::EventSetup bool currentBlockValid; /// enumeration of XML node types - enum NodeType { nUnknown, nSkip, nTop, nArm, nRPStation, nRPPot, nRPPlane, nDiamondPlane, nChip, nDiamondCh, nChannel, nSampicBoard, nSampicChannel }; + enum NodeType { nUnknown, nSkip, nTop, nArm, nRPStation, nRPPot, nRPPlane, nDiamondPlane, nChip, nDiamondCh, nChannel, nSampicBoard, nSampicChannel, nTotemTimingPlane, nTotemTimingCh }; /// whether to parse a mapping of a mask XML enum ParseType { pMapping, pMask }; @@ -173,7 +180,7 @@ class TotemDAQMappingESSourceXML: public edm::ESProducer, public edm::EventSetup bool TotemTimingNode(NodeType type) { - return ((type == nArm)||(type == nRPStation)||(type == nRPPot)||(type == nSampicBoard)||(type == nSampicChannel)); + return ((type == nArm)||(type == nRPStation)||(type == nRPPot)||(type == nSampicBoard)||(type == nSampicChannel)||(type == nTotemTimingPlane)||(type == nTotemTimingCh)); } bool CommonNode(NodeType type) @@ -215,6 +222,8 @@ const string TotemDAQMappingESSourceXML::tagDiamondCh = "diamond_channel"; // specific tags for totem timing const string TotemDAQMappingESSourceXML::tagSampicBoard = "rp_sampic_board"; const string TotemDAQMappingESSourceXML::tagSampicCh = "rp_sampic_channel"; +const string TotemDAQMappingESSourceXML::tagTotemTimingCh = "timing_channel"; +const string TotemDAQMappingESSourceXML::tagTotemTimingPlane = "timing_plane"; //---------------------------------------------------------------------------------------------------- @@ -633,6 +642,40 @@ void TotemDAQMappingESSourceXML::ParseTreeTotemTiming(ParseType pType, xercesc:: #endif DOMNodeList *children = parent->getChildNodes(); + + // Create map plane/ch -> hwId + for (unsigned int i = 0; i < children->getLength(); i++) + { + DOMNode *child = children->item(i); + if ( (child->getNodeType() != DOMNode::ELEMENT_NODE) || (GetNodeType(child)!=nTotemTimingCh) ) + continue; + + int plane = -1; + DOMNamedNodeMap* attr = parent->getAttributes(); + for (unsigned int j = 0; j < attr->getLength(); j++) + { + DOMNode *a = attr->item(j); + + if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "id")) + sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%d", &plane); + } + + + int channel = -1; + unsigned int hwId = 0; + attr = child->getAttributes(); + for (unsigned int j = 0; j < attr->getLength(); j++) + { + DOMNode *a = attr->item(j); + + if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "id")) + sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%d", &channel); + if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "hwId")) + sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%x", &hwId); + } + + mapping->totemTimingChannelMap[ (uint8_t) hwId ] = TotemDAQMapping::TotemTimingPlaneChannelPair(plane, channel); + } for (unsigned int i = 0; i < children->getLength(); i++) { @@ -657,6 +700,8 @@ void TotemDAQMappingESSourceXML::ParseTreeTotemTiming(ParseType pType, xercesc:: case nRPPot: expectedParentType = nRPStation; break; case nSampicBoard: expectedParentType = nRPPot; break; case nSampicChannel: expectedParentType = nSampicBoard; break; + case nTotemTimingPlane: expectedParentType = nRPPot; break; + case nTotemTimingCh: expectedParentType = nTotemTimingPlane; break; default: expectedParentType = nUnknown; break; } @@ -670,6 +715,7 @@ void TotemDAQMappingESSourceXML::ParseTreeTotemTiming(ParseType pType, xercesc:: unsigned int id =0; bool id_set = false; DOMNamedNodeMap* attr = n->getAttributes(); + for (unsigned int j = 0; j < attr->getLength(); j++) { @@ -708,7 +754,7 @@ void TotemDAQMappingESSourceXML::ParseTreeTotemTiming(ParseType pType, xercesc:: unsigned int StationNum = (parentID / 1000) % 10; unsigned int RpNum = (parentID/ 100) % 10; - vfatInfo.symbolicID.symbolicID = TotemTimingDetId(ArmNum, StationNum, RpNum, 0, 0); //Dynamical: it is encoded in the frame + vfatInfo.symbolicID.symbolicID = TotemTimingDetId(ArmNum, StationNum, RpNum, 0, TotemTimingDetId::ID_NOT_SET); //Dynamical: it is encoded in the frame mapping->insert(framepos, vfatInfo); @@ -778,6 +824,8 @@ TotemDAQMappingESSourceXML::NodeType TotemDAQMappingESSourceXML::GetNodeType(xer //totem timing specifics if (Test(n, tagSampicBoard)) return nSampicBoard; if (Test(n, tagSampicCh)) return nSampicChannel; + if (Test(n, tagTotemTimingCh)) return nTotemTimingCh; + if (Test(n, tagTotemTimingPlane)) return nTotemTimingPlane; // for backward compatibility if (Test(n, "trigger_vfat")) return nSkip; diff --git a/CondFormats/CTPPSReadoutObjects/src/TotemDAQMapping.cc b/CondFormats/CTPPSReadoutObjects/src/TotemDAQMapping.cc index e39918a00f4db..9c4fe5180457b 100644 --- a/CondFormats/CTPPSReadoutObjects/src/TotemDAQMapping.cc +++ b/CondFormats/CTPPSReadoutObjects/src/TotemDAQMapping.cc @@ -37,4 +37,14 @@ void TotemDAQMapping::insert(const TotemFramePosition &fp, const TotemVFATInfo & //---------------------------------------------------------------------------------------------------- +const TotemDAQMapping::TotemTimingPlaneChannelPair TotemDAQMapping::getTimingChannel( const uint8_t hwId ) const { + TotemTimingPlaneChannelPair pair; + auto iterator = totemTimingChannelMap.find( hwId ); + if ( iterator != totemTimingChannelMap.end() ) pair = iterator->second; +// std::cout << "inside: adding plane: " << std::dec << pair.plane << " ch: " << pair.channel << " hwId: " << std::hex << (unsigned int) hwId << " size: " << totemTimingChannelMap.size() << std::endl; + return pair; +} + +//---------------------------------------------------------------------------------------------------- + TYPELOOKUP_DATA_REG(TotemDAQMapping); diff --git a/CondFormats/CTPPSReadoutObjects/xml/mapping_totem_timing_2018.xml b/CondFormats/CTPPSReadoutObjects/xml/mapping_totem_timing_2018.xml index f07d0e0ce8926..c1bb4a4b401dc 100644 --- a/CondFormats/CTPPSReadoutObjects/xml/mapping_totem_timing_2018.xml +++ b/CondFormats/CTPPSReadoutObjects/xml/mapping_totem_timing_2018.xml @@ -1,7 +1,63 @@ - - + + + + + + + + + + + + + + + . + + + + + + + + + + + + + + . + + + + + + + + + + + + + + . + + + + + + + + + + + + + + . + @@ -51,13 +107,13 @@ - + - - - + + + diff --git a/DataFormats/CTPPSDetId/interface/TotemTimingDetId.h b/DataFormats/CTPPSDetId/interface/TotemTimingDetId.h index ba24793085d11..51cabb522285e 100644 --- a/DataFormats/CTPPSDetId/interface/TotemTimingDetId.h +++ b/DataFormats/CTPPSDetId/interface/TotemTimingDetId.h @@ -27,10 +27,12 @@ class TotemTimingDetId : public CTPPSDetId { public: + enum { ID_NOT_SET = 28 }; + /// Construct from a raw id explicit TotemTimingDetId(uint32_t id); - TotemTimingDetId(const CTPPSDetId &id) : CTPPSDetId(id) + TotemTimingDetId(const CTPPSDetId &id) : CTPPSDetId(id) { } diff --git a/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h b/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h index 9c8af21e710d9..c67dd84d64102 100644 --- a/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h +++ b/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h @@ -37,7 +37,9 @@ struct TotemSampicInfo{ uint16_t TimeStampA; uint16_t TimeStampB; uint16_t CellInfo; - uint16_t reserved[3]; + uint8_t PlaneId; + uint8_t ChannelId; + uint16_t reserved[2]; TotemSampicInfo() {}; }; @@ -54,7 +56,8 @@ struct TotemSampicEventInfo{ uint16_t L1ALatency; uint8_t numberOfSamples; uint8_t offsetOfSamples; - uint8_t reserved[2]; + uint8_t FWVersion; + uint8_t reserved; TotemSampicEventInfo() {}; }; @@ -94,7 +97,7 @@ class TotemSampicFrame TotemSampicData_ = (TotemSampicData*) chDataPtr; TotemSampicEventInfo_ = (TotemSampicEventInfo*) eventInfoPtr; } - if ( TotemSampicEventInfo_->numberOfSamples == TotemSampicConstant::NumberOfSamples || TotemSampicEventInfo_->numberOfSamples == 0) + if ( TotemSampicEventInfo_->numberOfSamples == TotemSampicConstant::NumberOfSamples || TotemSampicInfo_->controlBits[3] == 0x69 ) status_ = 1; } ~TotemSampicFrame() {} @@ -117,6 +120,7 @@ class TotemSampicFrame void Print() const { std::bitset<16> bitsCellInfo( getCellInfo() ); + std::bitset<16> bitsChannelMap( getChannelMap() ); std::cout << "TotemSampicFrame:\nEvent:" << "HardwareId (Event):\t" << std::hex << (unsigned int) getEventHardwareId() << "\nL1A Time Stamp:\t" << std::dec << getL1ATimeStamp() @@ -124,14 +128,17 @@ class TotemSampicFrame << "\nBunch Number:\t" << std::dec << getBunchNumber() << "\nOrbit Number:\t" << std::dec << getOrbitNumber() << "\nEvent Number:\t" << std::dec << getEventNumber() - << "\nChannels fired:\t" << std::hex << getChannelMap() + << "\nChannels fired:\t" << std::hex << bitsChannelMap.to_string() << "\nNumber of Samples:\t" << std::dec << getNumberOfSentSamples() << "\nOffset of Samples:\t" << std::dec << (int) getOffsetOfSamples() + << "\nFW Version:\t" << std::dec << (int) getFWVersion() << "\nChannel:\nHardwareId:\t" << std::hex << (unsigned int) getHardwareId() << "\nFPGATimeStamp:\t" << std::dec << getFPGATimeStamp() << "\nTimeStampA:\t" << std::dec << getTimeStampA() << "\nTimeStampA:\t" << std::dec << getTimeStampA() << "\nCellInfo:\t" << bitsCellInfo.to_string() + << "\nPlane:\t" << std::dec << getDetPlane() + << "\nChannel:\t" << std::dec << getDetChannel() << std::endl << std::endl; } @@ -164,6 +171,21 @@ class TotemSampicFrame return status_ * TotemSampicInfo_->CellInfo; } + inline int getDetPlane() const + { + return status_ * TotemSampicInfo_->PlaneId; + } + + inline int getDetChannel() const + { + return status_ * TotemSampicInfo_->ChannelId; + } + + inline int getFWVersion() const + { + return status_ * TotemSampicEventInfo_->FWVersion; + } + const std::vector< uint8_t > getSamples() const { std::vector< uint8_t > samples; @@ -207,7 +229,7 @@ class TotemSampicFrame inline uint32_t getEventNumber() const { - return status_ * TotemSampicEventInfo_->orbitNumber; + return status_ * TotemSampicEventInfo_->eventNumber; } inline uint16_t getChannelMap() const diff --git a/EventFilter/CTPPSRawToDigi/plugins/TotemVFATRawToDigi.cc b/EventFilter/CTPPSRawToDigi/plugins/TotemVFATRawToDigi.cc index 1cbe1f4a01186..b949d3bea29ce 100644 --- a/EventFilter/CTPPSRawToDigi/plugins/TotemVFATRawToDigi.cc +++ b/EventFilter/CTPPSRawToDigi/plugins/TotemVFATRawToDigi.cc @@ -79,7 +79,6 @@ TotemVFATRawToDigi::TotemVFATRawToDigi(const edm::ParameterSet &conf): fedDataToken = consumes(conf.getParameter("rawDataTag")); // validate chosen subSystem - std::cout << subSystemName << std::endl; if (subSystemName == "TrackingStrip") subSystem = ssTrackingStrip; if (subSystemName == "TimingDiamond") diff --git a/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc b/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc index b3ff64709220e..5b6b4a8309505 100644 --- a/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc +++ b/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc @@ -11,7 +11,7 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" -#define DEBUG 0 +// #define DEBUG 0 //---------------------------------------------------------------------------------------------------- @@ -22,7 +22,7 @@ using namespace ctpps; //---------------------------------------------------------------------------------------------------- RawDataUnpacker::RawDataUnpacker(const edm::ParameterSet& iConfig) : - verbosity(iConfig.getUntrackedParameter("verbosity", 10)) + verbosity(iConfig.getUntrackedParameter("verbosity", 0)) {} //---------------------------------------------------------------------------------------------------- @@ -37,8 +37,6 @@ int RawDataUnpacker::Run(int fedId, const FEDRawData &data, vector "Data in FED " << fedId << " too short (size = " << size_in_words << " words)."; return 1; } - LogWarning("Totem") << "RawDataUnpacker::Run > " << - "Data in FED " << fedId << " (size = " << size_in_words << " words)."; fedInfoColl.push_back(TotemFEDInfo(fedId)); @@ -81,14 +79,6 @@ int RawDataUnpacker::ProcessOptoRxFrame(const word *buf, unsigned int frameSize, return 0; } - - LogWarning("Totem") << "RawDataUnpacker::ProcessOptoRxFrame > " << "Structure of OptoRx header/footer: " - << "BOE=" << BOE << ", H0=" << H0 << ", EOE=" << EOE << ", F0=" << F0 - << ", size (OptoRx)=" << FSize << ", size (DATE)=" << frameSize - << ". OptoRxID=" << OptoRxId << ", FOV= " << FOV << endl; -// for (unsigned int i = 0; i < frameSize; ++i ) { -// std::cout<< setfill('0') << setw(16)<> RawDataUnpacker::ProcessOptoRxFrame > OptoRxId = %u, BX = %lu, LV1 = %lu, frameSize = %u)\n", diff --git a/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc b/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc index 60ba03fefcab6..74092d16a90e1 100644 --- a/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc +++ b/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc @@ -26,7 +26,7 @@ using namespace edm; RawToDigiConverter::RawToDigiConverter(const edm::ParameterSet &conf) : verbosity(conf.getUntrackedParameter("verbosity", 0)), - printErrorSummary(conf.getUntrackedParameter("printErrorSummary", 1)), + printErrorSummary(conf.getUntrackedParameter("printErrorSummary", 0)), printUnknownFrameSummary(conf.getUntrackedParameter("printUnknownFrameSummary", 1)), testFootprint(conf.getParameter("testFootprint")), @@ -279,9 +279,6 @@ void RawToDigiConverter::Run(const VFATFrameCollection &coll, const TotemDAQMapp if (record.status.isOK()) { - const TotemFramePosition* framepos = &p.first; - std::cout<< "Subsystem: " << framepos->getSubSystemId() << "\tTOTFED: "<< framepos->getTOTFEDId()<< "\tGOH: "<< framepos->getGOHId() << "\tIdxInFiber: " << framepos->getIdxInFiber() << std::endl; - const VFATFrame *fr = record.frame; const DiamondVFATFrame *diamondframe = static_cast(fr); @@ -342,7 +339,7 @@ void RawToDigiConverter::Run(const VFATFrameCollection &coll, const TotemDAQMapp // Extract all the waveform information from the raw data TotemSampicFrame totemSampicFrame((uint8_t*) record.frame->getData(), (uint8_t*) channelwaveform.frame->getData(), (uint8_t*) eventInfo.frame->getData()); - // totemSampicFrame.PrintRaw(); +// totemSampicFrame.PrintRaw(); // if (totemSampicFrame.isOK()) totemSampicFrame.Print(); if (totemSampicFrame.isOK()) @@ -352,13 +349,31 @@ void RawToDigiConverter::Run(const VFATFrameCollection &coll, const TotemDAQMapp TotemTimingDigi digiTmp( totemSampicFrame.getHardwareId(), totemSampicFrame.getFPGATimeStamp(), totemSampicFrame.getTimeStampA(), totemSampicFrame.getTimeStampB(), totemSampicFrame.getCellInfo(), totemSampicFrame.getSamples(), eventInfoTmp); // calculate ids TotemTimingDetId detId(record.info->symbolicID.symbolicID); - std::cout << "Plane: " << digiTmp.getHardwareSampicId() % 4 << " Ch: " << digiTmp.getHardwareChannelId() << std::endl; - detId.setPlane( digiTmp.getHardwareSampicId() % 4 ); - detId.setChannel( digiTmp.getHardwareChannelId() ); - + if ( totemSampicFrame.getFWVersion() == 0 ) { +// detId.setPlane( digiTmp.getHardwareSampicId() % 4 ); +// detId.setChannel( digiTmp.getHardwareChannelId() ); + const TotemDAQMapping::TotemTimingPlaneChannelPair pair = mapping.getTimingChannel( totemSampicFrame.getHardwareId() ); + +// std::cout << "RawToDigi: adding plane: " << std::dec << pair.plane << " ch: " << pair.channel << " hwId: " << std::hex << (unsigned int) totemSampicFrame.getHardwareId() << std::endl; + + if ( pair.plane == -1 || pair.channel == -1 ) { + if (verbosity > 1) + LogWarning("Totem") << "Error in RawToDigiConverter::TotemTiming > " << "HwId not recognized! hwId: " << std::hex << (unsigned int) totemSampicFrame.getHardwareId() << endl; + } + else { + detId.setPlane( pair.plane ); + detId.setChannel( pair.channel ); + } + + + } + else { + detId.setPlane( totemSampicFrame.getDetPlane() % 4 ); + detId.setChannel( totemSampicFrame.getDetChannel() % 32 ); + } - DetSet &digiDetSet = digi.find_or_insert(detId); //TODO: ID!! + DetSet &digiDetSet = digi.find_or_insert(detId); digiDetSet.push_back(digiTmp); } } From eb3ac5fac7e53a23adb4889cdfa6e139c7c1a2fa Mon Sep 17 00:00:00 2001 From: Tanmay Mudholkar Date: Mon, 26 Mar 2018 16:56:17 +0200 Subject: [PATCH 216/426] Modified storage of ECAL object types in TH1s to use TObject's UniqueID() rather than TH1's fBits, because the latter is intended for ROOT internal use only. --- DQM/EcalCommon/src/MESetEcal.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/DQM/EcalCommon/src/MESetEcal.cc b/DQM/EcalCommon/src/MESetEcal.cc index 26e2e45e84059..600fdc7e8fe62 100644 --- a/DQM/EcalCommon/src/MESetEcal.cc +++ b/DQM/EcalCommon/src/MESetEcal.cc @@ -231,6 +231,18 @@ namespace ecaldqm me->getTH1()->SetBit(uint32_t(actualObject + 1) << 20); if(isMap) me->getTH1()->SetBit(0x1 << 19); */ + + // The render plugin requires some metadata in order to set the correct rendering for each plot. + // The original solution was to use bits number 19 to 23 in TH1::fBits, but these were meant for ROOT's internal usage and eventually started breaking things, see: https://github.com/cms-sw/cmssw/issues/21423 + // The current solution is to use the UniqueID field in the parent TObject, which is expected to work if there is no TRef pointing to the TObject. + + // To check that indeed there is no such TRef, one can use TestBit(kIsReferenced), e.g. + // std::cout << "Need to set unique ID at path = " << path << "; for this path, TestBit(kIsReferenced) is: " << (me->getTH1()->TestBit(kIsReferenced)? "true": "false") << std::endl; // should always output false for the solution to work + + // Originally, bit 19 in TH1::fBits was set to isMap, while bits 20-23 contained (actualObject+1). + // The idea is to make sure that both these variables are easily recoverable in the render plugin, + // as in this solution, where isMap is the last bit. + me->getTH1()->SetUniqueID(uint32_t(2*(actualObject + 1) + (isMap? 1: 0))); } if(lumiFlag_) me->setLumiFlag(); From 7393ef1f104d73b80389b5318af4df141181b6e5 Mon Sep 17 00:00:00 2001 From: Tanmay Mudholkar Date: Mon, 26 Mar 2018 17:16:26 +0200 Subject: [PATCH 217/426] Modified code to be up to date with latest CMSSW standards. --- DQM/EcalCommon/src/MESetEcal.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DQM/EcalCommon/src/MESetEcal.cc b/DQM/EcalCommon/src/MESetEcal.cc index 600fdc7e8fe62..e13f19b1597b5 100644 --- a/DQM/EcalCommon/src/MESetEcal.cc +++ b/DQM/EcalCommon/src/MESetEcal.cc @@ -59,7 +59,7 @@ namespace ecaldqm MESetEcal::clone(std::string const& _path/* = ""*/) const { std::string path(path_); - if(_path != "") path_ = _path; + if(!_path.empty()) path_ = _path; MESet* copy(new MESetEcal(*this)); path_ = path; return copy; @@ -94,7 +94,7 @@ namespace ecaldqm if(xaxis.nbins == 0){ // uses preset binning::AxisSpecs xdef(binning::getBinning(actualObject, btype_, isMap, 1, iME)); - if(xaxis.labels || xaxis.title != ""){ // PSet specifies title / label only + if(xaxis.labels || !xaxis.title.empty()){ // PSet specifies title / label only std::string* labels(xaxis.labels); std::string title(xaxis.title); xaxis = xdef; @@ -108,7 +108,7 @@ namespace ecaldqm if(isMap && yaxis.nbins == 0){ binning::AxisSpecs ydef(binning::getBinning(actualObject, btype_, isMap, 2, iME)); - if(yaxis.labels || yaxis.title != ""){ // PSet specifies title / label only + if(yaxis.labels || !yaxis.title.empty()){ // PSet specifies title / label only std::string* labels(yaxis.labels); std::string title(yaxis.title); yaxis = ydef; From 94ada58799336ac29ec5f472ac7a83b18ccc0401 Mon Sep 17 00:00:00 2001 From: Antonio Vagnerini Date: Mon, 26 Mar 2018 17:26:49 +0200 Subject: [PATCH 218/426] updating MssmHbb and BTag monitor path by replacing p33 -> p79 --- .../python/MssmHbbBtagTriggerMonitor_cfi.py | 16 ++++++++-------- .../Trigger/python/MssmHbbMonitoring_cff.py | 12 ++++++------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/DQMOffline/Trigger/python/MssmHbbBtagTriggerMonitor_cfi.py b/DQMOffline/Trigger/python/MssmHbbBtagTriggerMonitor_cfi.py index fe02032e31418..987c600583d95 100644 --- a/DQMOffline/Trigger/python/MssmHbbBtagTriggerMonitor_cfi.py +++ b/DQMOffline/Trigger/python/MssmHbbBtagTriggerMonitor_cfi.py @@ -43,53 +43,53 @@ mssmHbbBtagTriggerMonitorSL40noMu.jetPtMin = cms.double(40) mssmHbbBtagTriggerMonitorSL40noMu.triggerobjbtag = cms.string("hltBTagCalo30x8CSVp0p92SingleWithMatching") mssmHbbBtagTriggerMonitorSL40noMu.histoPSet.jetPt = cms.vdouble(40,45,50,55,60,65,70,75,80,85,90,95,100) -mssmHbbBtagTriggerMonitorSL40noMu.genericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets40_CaloBTagCSV_p33_v*') +mssmHbbBtagTriggerMonitorSL40noMu.genericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets40_CaloBTagCSV_p79_v*') mssmHbbBtagTriggerMonitorSL40 = mssmHbbBtagTriggerMonitor.clone() mssmHbbBtagTriggerMonitorSL40.dirname = cms.string("HLT/Higgs/MssmHbb/semileptonic/BtagTrigger/pt40") mssmHbbBtagTriggerMonitorSL40.jetPtMin = cms.double(40) mssmHbbBtagTriggerMonitorSL40.triggerobjbtag = cms.string("hltBTagCalo30x8CSVp0p92SingleWithMatching") mssmHbbBtagTriggerMonitorSL40.histoPSet.jetPt = cms.vdouble(40,45,50,55,60,65,70,75,80,85,90,95,100) -mssmHbbBtagTriggerMonitorSL40.genericTriggerEventPSet.hltPaths = cms.vstring('HLT_Mu12_DoublePFJets40_CaloBTagCSV_p33_v*') +mssmHbbBtagTriggerMonitorSL40.genericTriggerEventPSet.hltPaths = cms.vstring('HLT_Mu12_DoublePFJets40_CaloBTagCSV_p79_v*') mssmHbbBtagTriggerMonitorSL100 = mssmHbbBtagTriggerMonitor.clone() mssmHbbBtagTriggerMonitorSL100.dirname = cms.string("HLT/Higgs/MssmHbb/semileptonic/BtagTrigger/pt100") mssmHbbBtagTriggerMonitorSL100.jetPtMin = cms.double(100) mssmHbbBtagTriggerMonitorSL100.triggerobjbtag = cms.string("hltBTagCalo30x8CSVp0p92SingleWithMatching") mssmHbbBtagTriggerMonitorSL100.histoPSet.jetPt = cms.vdouble(100,110,120,130,140,150,160,170,180,190,200) -mssmHbbBtagTriggerMonitorSL100.genericTriggerEventPSet.hltPaths = cms.vstring('HLT_Mu12_DoublePFJets100_CaloBTagCSV_p33_v*') +mssmHbbBtagTriggerMonitorSL100.genericTriggerEventPSet.hltPaths = cms.vstring('HLT_Mu12_DoublePFJets100_CaloBTagCSV_p79_v*') mssmHbbBtagTriggerMonitorSL200 = mssmHbbBtagTriggerMonitor.clone() mssmHbbBtagTriggerMonitorSL200.dirname = cms.string("HLT/Higgs/MssmHbb/semileptonic/BtagTrigger/pt200") mssmHbbBtagTriggerMonitorSL200.jetPtMin = cms.double(200) mssmHbbBtagTriggerMonitorSL200.triggerobjbtag = cms.string("hltBTagCalo30x8CSVp0p92SingleWithMatching") mssmHbbBtagTriggerMonitorSL200.histoPSet.jetPt = cms.vdouble(200,210,220,230,240,250,260,270,280,290,300,310,320,330,340,350) -mssmHbbBtagTriggerMonitorSL200.genericTriggerEventPSet.hltPaths = cms.vstring('HLT_Mu12_DoublePFJets200_CaloBTagCSV_p33_v*') +mssmHbbBtagTriggerMonitorSL200.genericTriggerEventPSet.hltPaths = cms.vstring('HLT_Mu12_DoublePFJets200_CaloBTagCSV_p79_v*') mssmHbbBtagTriggerMonitorSL350 = mssmHbbBtagTriggerMonitor.clone() mssmHbbBtagTriggerMonitorSL350.dirname = cms.string("HLT/Higgs/MssmHbb/semileptonic/BtagTrigger/pt350") mssmHbbBtagTriggerMonitorSL350.jetPtMin = cms.double(350) mssmHbbBtagTriggerMonitorSL350.triggerobjbtag = cms.string("hltBTagCalo30x8CSVp0p92SingleWithMatching") mssmHbbBtagTriggerMonitorSL350.histoPSet.jetPt = cms.vdouble(350,360,370,380,390,400,410,420,430,440,450,460,470,480,490,500,510,520,530,540,550,560,570,580,590,600) -mssmHbbBtagTriggerMonitorSL350.genericTriggerEventPSet.hltPaths = cms.vstring('HLT_Mu12_DoublePFJets350_CaloBTagCSV_p33_v*') +mssmHbbBtagTriggerMonitorSL350.genericTriggerEventPSet.hltPaths = cms.vstring('HLT_Mu12_DoublePFJets350_CaloBTagCSV_p79_v*') mssmHbbBtagTriggerMonitorAH100 = mssmHbbBtagTriggerMonitor.clone() mssmHbbBtagTriggerMonitorAH100.dirname = cms.string("HLT/Higgs/MssmHbb/fullhadronic/BtagTrigger/pt100") mssmHbbBtagTriggerMonitorAH100.jetPtMin = cms.double(100) mssmHbbBtagTriggerMonitorAH100.triggerobjbtag = cms.string("hltBTagCalo80x6CSVp0p92SingleWithMatching") mssmHbbBtagTriggerMonitorAH100.histoPSet.jetPt = cms.vdouble(100,110,120,130,140,150,160,170,180,190,200) -mssmHbbBtagTriggerMonitorAH100.genericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets100_CaloBTagCSV_p33_v*') +mssmHbbBtagTriggerMonitorAH100.genericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets100_CaloBTagCSV_p79_v*') mssmHbbBtagTriggerMonitorAH200 = mssmHbbBtagTriggerMonitor.clone() mssmHbbBtagTriggerMonitorAH200.dirname = cms.string("HLT/Higgs/MssmHbb/fullhadronic/BtagTrigger/pt200") mssmHbbBtagTriggerMonitorAH200.jetPtMin = cms.double(200) mssmHbbBtagTriggerMonitorAH200.triggerobjbtag = cms.string("hltBTagCalo80x6CSVp0p92SingleWithMatching") mssmHbbBtagTriggerMonitorAH200.histoPSet.jetPt = cms.vdouble(200,210,220,230,240,250,260,270,280,290,300,310,320,330,340,350) -mssmHbbBtagTriggerMonitorAH200.genericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets200_CaloBTagCSV_p33_v*') +mssmHbbBtagTriggerMonitorAH200.genericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets200_CaloBTagCSV_p79_v*') mssmHbbBtagTriggerMonitorAH350 = mssmHbbBtagTriggerMonitor.clone() mssmHbbBtagTriggerMonitorAH350.dirname = cms.string("HLT/Higgs/MssmHbb/fullhadronic/BtagTrigger/pt350") mssmHbbBtagTriggerMonitorAH350.jetPtMin = cms.double(350) mssmHbbBtagTriggerMonitorAH350.triggerobjbtag = cms.string("hltBTagCalo80x6CSVp0p92SingleWithMatching") mssmHbbBtagTriggerMonitorAH350.histoPSet.jetPt = cms.vdouble(350,360,370,380,390,400,410,420,430,440,450,460,470,480,490,500,510,520,530,540,550,560,570,580,590,600) -mssmHbbBtagTriggerMonitorAH350.genericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets350_CaloBTagCSV_p33_v*') +mssmHbbBtagTriggerMonitorAH350.genericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets350_CaloBTagCSV_p79_v*') diff --git a/DQMOffline/Trigger/python/MssmHbbMonitoring_cff.py b/DQMOffline/Trigger/python/MssmHbbMonitoring_cff.py index 748fbb06448c7..1bed7c621b1d9 100644 --- a/DQMOffline/Trigger/python/MssmHbbMonitoring_cff.py +++ b/DQMOffline/Trigger/python/MssmHbbMonitoring_cff.py @@ -15,7 +15,7 @@ hltMssmHbbmonitoringAL100.nmuons = cms.uint32(0) hltMssmHbbmonitoringAL100.nbjets = cms.uint32(2) hltMssmHbbmonitoringAL100.bjetSelection = cms.string('pt>110 & abs(eta)<2.2') -hltMssmHbbmonitoringAL100.numGenericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets100MaxDeta1p6_DoubleCaloBTagCSV_p33_v*') +hltMssmHbbmonitoringAL100.numGenericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets100MaxDeta1p6_DoubleCaloBTagCSV_p79_v*') hltMssmHbbmonitoringAL100.histoPSet.jetPtBinning = cms.vdouble(0,250,280,300,320,360,400,700,1000,1500) hltMssmHbbmonitoringAL116 = hltMssmHbbmonitoring.clone() @@ -23,7 +23,7 @@ hltMssmHbbmonitoringAL116.nmuons = cms.uint32(0) hltMssmHbbmonitoringAL116.nbjets = cms.uint32(2) hltMssmHbbmonitoringAL116.bjetSelection = cms.string('pt>116 & abs(eta)<2.2') -hltMssmHbbmonitoringAL116.numGenericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets116MaxDeta1p6_DoubleCaloBTagCSV_p33_v*') +hltMssmHbbmonitoringAL116.numGenericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets116MaxDeta1p6_DoubleCaloBTagCSV_p79_v*') hltMssmHbbmonitoringAL116.histoPSet.jetPtBinning = cms.vdouble(0,250,280,300,320,360,400,700,1000,1500) hltMssmHbbmonitoringAL128 = hltMssmHbbmonitoring.clone() @@ -31,7 +31,7 @@ hltMssmHbbmonitoringAL128.nmuons = cms.uint32(0) hltMssmHbbmonitoringAL128.nbjets = cms.uint32(2) hltMssmHbbmonitoringAL128.bjetSelection = cms.string('pt>128 & abs(eta)<2.2') -hltMssmHbbmonitoringAL128.numGenericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets128MaxDeta1p6_DoubleCaloBTagCSV_p33_v*') +hltMssmHbbmonitoringAL128.numGenericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets128MaxDeta1p6_DoubleCaloBTagCSV_p79_v*') hltMssmHbbmonitoringAL128.histoPSet.jetPtBinning = cms.vdouble(0,250,280,300,320,360,400,700,1000,1500) # Semi-leptonic MssmHbb(mu) @@ -41,7 +41,7 @@ hltMssmHbbmonitoringSL40.nbjets = cms.uint32(2) hltMssmHbbmonitoringSL40.muoSelection = cms.string('pt>12 & abs(eta)<2.2 & isPFMuon & isGlobalMuon & innerTrack.hitPattern.trackerLayersWithMeasurement>5 & innerTrack.hitPattern.numberOfValidPixelHits>0 & globalTrack.hitPattern.numberOfValidMuonHits>0 & globalTrack.normalizedChi2<10') hltMssmHbbmonitoringSL40.bjetSelection = cms.string('pt>40 & abs(eta)<2.2') -hltMssmHbbmonitoringSL40.numGenericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets40MaxDeta1p6_DoubleCaloBTagCSV_p33_v*') +hltMssmHbbmonitoringSL40.numGenericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets40MaxDeta1p6_DoubleCaloBTagCSV_p79_v*') hltMssmHbbmonitoringSL40.histoPSet.jetPtBinning = cms.vdouble(0,250,280,300,320,360,400,700,1000,1500) hltMssmHbbmonitoringSL54 = hltMssmHbbmonitoring.clone() @@ -50,7 +50,7 @@ hltMssmHbbmonitoringSL54.nbjets = cms.uint32(2) hltMssmHbbmonitoringSL54.muoSelection = cms.string('pt>12 & abs(eta)<2.2 & isPFMuon & isGlobalMuon & innerTrack.hitPattern.trackerLayersWithMeasurement>5 & innerTrack.hitPattern.numberOfValidPixelHits>0 & globalTrack.hitPattern.numberOfValidMuonHits>0 & globalTrack.normalizedChi2<10') hltMssmHbbmonitoringSL54.bjetSelection = cms.string('pt>54 & abs(eta)<2.2') -hltMssmHbbmonitoringSL54.numGenericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets54MaxDeta1p6_DoubleCaloBTagCSV_p33_v*') +hltMssmHbbmonitoringSL54.numGenericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets54MaxDeta1p6_DoubleCaloBTagCSV_p79_v*') hltMssmHbbmonitoringSL54.histoPSet.jetPtBinning = cms.vdouble(0,250,280,300,320,360,400,700,1000,1500) hltMssmHbbmonitoringSL62 = hltMssmHbbmonitoring.clone() @@ -59,7 +59,7 @@ hltMssmHbbmonitoringSL62.nbjets = cms.uint32(2) hltMssmHbbmonitoringSL62.muoSelection = cms.string('pt>12 & abs(eta)<2.2 & isPFMuon & isGlobalMuon & innerTrack.hitPattern.trackerLayersWithMeasurement>5 & innerTrack.hitPattern.numberOfValidPixelHits>0 & globalTrack.hitPattern.numberOfValidMuonHits>0 & globalTrack.normalizedChi2<10') hltMssmHbbmonitoringSL62.bjetSelection = cms.string('pt>62 & abs(eta)<2.2') -hltMssmHbbmonitoringSL62.numGenericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets62MaxDeta1p6_DoubleCaloBTagCSV_p33_v*') +hltMssmHbbmonitoringSL62.numGenericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets62MaxDeta1p6_DoubleCaloBTagCSV_p79_v*') hltMssmHbbmonitoringSL62.histoPSet.jetPtBinning = cms.vdouble(0,250,280,300,320,360,400,700,1000,1500) #control b-tagging From 2db4bffc4449c40d653cf4fcb68b1243848cc698 Mon Sep 17 00:00:00 2001 From: nminafra Date: Mon, 26 Mar 2018 18:30:21 +0200 Subject: [PATCH 219/426] cleanup --- .../interface/TotemDAQMapping.h | 6 +- .../plugins/TotemDAQMappingESSourceXML.cc | 39 ++-- .../src/TotemDAQMapping.cc | 4 +- .../xml/mapping_totem_timing_2018.xml | 170 +++++++++++++++++- .../CTPPSDigi/interface/CTPPSSampicDigi.h | 128 ------------- .../CTPPSDigi/interface/TotemTimingDigi.h | 4 +- .../interface/TotemTimingEventInfo.h | 6 +- DataFormats/CTPPSDigi/src/CTPPSSampicDigi.cc | 31 ---- .../interface/TotemSampicFrame.h | 2 +- .../python/ctppsRawToDigi_cff.py | 2 +- .../python/totemTimingRawToDigi_cfi.py | 6 + .../CTPPSRawToDigi/src/RawDataUnpacker.cc | 4 - .../CTPPSRawToDigi/src/RawToDigiConverter.cc | 5 +- 13 files changed, 206 insertions(+), 201 deletions(-) delete mode 100644 DataFormats/CTPPSDigi/interface/CTPPSSampicDigi.h delete mode 100644 DataFormats/CTPPSDigi/src/CTPPSSampicDigi.cc diff --git a/CondFormats/CTPPSReadoutObjects/interface/TotemDAQMapping.h b/CondFormats/CTPPSReadoutObjects/interface/TotemDAQMapping.h index fb92ade3aea38..314bd9ceece2d 100644 --- a/CondFormats/CTPPSReadoutObjects/interface/TotemDAQMapping.h +++ b/CondFormats/CTPPSReadoutObjects/interface/TotemDAQMapping.h @@ -43,8 +43,9 @@ class TotemDAQMapping public: std::map VFATMapping; - // Hw Id mapping for Totem Timing (dynamicla mapping in Sampic) - struct TotemTimingPlaneChannelPair { + /// Hw Id mapping for Totem Timing (dynamical mapping in Sampic) + struct TotemTimingPlaneChannelPair + { int channel; int plane; @@ -54,6 +55,7 @@ class TotemDAQMapping void insert(const TotemFramePosition &fp, const TotemVFATInfo &vi); + /// Given the hardware ID, returns the corresponding Plane, Channel pair (TotemTimingPlaneChannelPair) const TotemTimingPlaneChannelPair getTimingChannel( const uint8_t hwId ) const; }; diff --git a/CondFormats/CTPPSReadoutObjects/plugins/TotemDAQMappingESSourceXML.cc b/CondFormats/CTPPSReadoutObjects/plugins/TotemDAQMappingESSourceXML.cc index 3035663877f23..4cf21d0d29818 100644 --- a/CondFormats/CTPPSReadoutObjects/plugins/TotemDAQMappingESSourceXML.cc +++ b/CondFormats/CTPPSReadoutObjects/plugins/TotemDAQMappingESSourceXML.cc @@ -38,11 +38,10 @@ #include #include -#include #include -// #define DEBUG 1 +//#define DEBUG 1 //---------------------------------------------------------------------------------------------------- @@ -72,7 +71,7 @@ class TotemDAQMappingESSourceXML: public edm::ESProducer, public edm::EventSetup /// diamond specific tags static const std::string tagDiamondPlane; - static const std::string tagDiamondCh; + static const std::string tagDiamondCh; /// totem timing specific tags static const std::string tagSampicBoard; @@ -85,8 +84,6 @@ class TotemDAQMappingESSourceXML: public edm::ESProducer, public edm::EventSetup edm::ESProducts< std::shared_ptr, std::shared_ptr > produce( const TotemReadoutRcd & ); - - private: unsigned int verbosity; @@ -377,7 +374,7 @@ void TotemDAQMappingESSourceXML::ParseTreeRP(ParseType pType, xercesc::DOMNode * const std::shared_ptr& mask) { #ifdef DEBUG - printf(">> TotemDAQMappingESSourceXML::ParseTreeRP(%s, %u, %u)\n", cms::xerces::toString(parent->getNodeName()).c_str(), + printf(">> TotemDAQMappingESSourceXML::ParseTreeRP(%s, %u, %u)\n", cms::xerces::toString(parent->getNodeName()), parentType, parentID); #endif @@ -392,7 +389,7 @@ void TotemDAQMappingESSourceXML::ParseTreeRP(ParseType pType, xercesc::DOMNode * NodeType type = GetNodeType(n); #ifdef DEBUG - printf("\tname = %s, type = %u\n", cms::xerces::toString(n->getNodeName()).c_str(), type); + printf("\tname = %s, type = %u\n", cms::xerces::toString(n->getNodeName()), type); #endif // structure control @@ -512,7 +509,7 @@ void TotemDAQMappingESSourceXML::ParseTreeDiamond(ParseType pType, xercesc::DOMN { #ifdef DEBUG - printf(">> TotemDAQMappingESSourceXML::ParseTreeDiamond(%s, %u, %u)\n", cms::xerces::toString(parent->getNodeName()).c_str(), + printf(">> TotemDAQMappingESSourceXML::ParseTreeDiamond(%s, %u, %u)\n", cms::xerces::toString(parent->getNodeName()), parentType, parentID); #endif @@ -526,7 +523,7 @@ void TotemDAQMappingESSourceXML::ParseTreeDiamond(ParseType pType, xercesc::DOMN NodeType type = GetNodeType(n); #ifdef DEBUG - printf("\tname = %s, type = %u\n", cms::xerces::toString(n->getNodeName()).c_str(), type); + printf("\tname = %s, type = %u\n", cms::xerces::toString(n->getNodeName()), type); #endif // structure control @@ -576,11 +573,11 @@ void TotemDAQMappingESSourceXML::ParseTreeDiamond(ParseType pType, xercesc::DOMN // content control if (!id_set) throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeDiamond") << "id not given for element `" - << cms::xerces::toString(n->getNodeName()) << "'" << endl; + << cms::xerces::toString(n->getNodeName()) << "'" << endl; if (!hw_id_set && type == nDiamondCh && pType == pMapping) throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeDiamond") << "hw_id not given for element `" - << cms::xerces::toString(n->getNodeName()) << "'" << endl; + << cms::xerces::toString(n->getNodeName()) << "'" << endl; if (type == nDiamondPlane && id > 3) throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeDiamond") << @@ -611,6 +608,7 @@ void TotemDAQMappingESSourceXML::ParseTreeDiamond(ParseType pType, xercesc::DOMN } + mapping->insert(framepos, vfatInfo); continue; @@ -635,15 +633,9 @@ void TotemDAQMappingESSourceXML::ParseTreeTotemTiming(ParseType pType, xercesc:: unsigned int parentID, const std::shared_ptr& mapping, const std::shared_ptr& mask) { - -#ifdef DEBUG - printf(">> TotemDAQMappingESSourceXML::ParseTreeTotemTiming(%s, %u, %u)\n", cms::xerces::toString(parent->getNodeName()).c_str(), - parentType, parentID); -#endif - DOMNodeList *children = parent->getChildNodes(); - // Create map plane/ch -> hwId + // Fill map hwId -> TotemTimingPlaneChannelPair for (unsigned int i = 0; i < children->getLength(); i++) { DOMNode *child = children->item(i); @@ -684,9 +676,6 @@ void TotemDAQMappingESSourceXML::ParseTreeTotemTiming(ParseType pType, xercesc:: continue; NodeType type = GetNodeType(n); -#ifdef DEBUG - printf("\tname = %s, type = %u\n", cms::xerces::toString(n->getNodeName()).c_str(), type); -#endif // structure control if (!TotemTimingNode(type)) @@ -737,19 +726,13 @@ void TotemDAQMappingESSourceXML::ParseTreeTotemTiming(ParseType pType, xercesc:: throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeTotemTiming") << "SampicBoard IDs range from 0 to 5. id = " << id << " is invalid." << endl; -#ifdef DEBUG - printf("\tID found: 0x%x\n", id); -#endif - - // store mapping data + // store mapping data if (pType == pMapping &&type == nSampicChannel) { const TotemFramePosition &framepos = ChipFramePosition(n); -// std::cout<< "Reading XML... GOH " << framepos.getGOHId()<< " Idx " << framepos.getIdxInFiber() << std::endl; TotemVFATInfo vfatInfo; -// vfatInfo.hwID = hw_id; unsigned int ArmNum = (parentID/ 10000) % 10; unsigned int StationNum = (parentID / 1000) % 10; unsigned int RpNum = (parentID/ 100) % 10; diff --git a/CondFormats/CTPPSReadoutObjects/src/TotemDAQMapping.cc b/CondFormats/CTPPSReadoutObjects/src/TotemDAQMapping.cc index 9c4fe5180457b..b51207b24e6f6 100644 --- a/CondFormats/CTPPSReadoutObjects/src/TotemDAQMapping.cc +++ b/CondFormats/CTPPSReadoutObjects/src/TotemDAQMapping.cc @@ -37,11 +37,11 @@ void TotemDAQMapping::insert(const TotemFramePosition &fp, const TotemVFATInfo & //---------------------------------------------------------------------------------------------------- -const TotemDAQMapping::TotemTimingPlaneChannelPair TotemDAQMapping::getTimingChannel( const uint8_t hwId ) const { +const TotemDAQMapping::TotemTimingPlaneChannelPair TotemDAQMapping::getTimingChannel( const uint8_t hwId ) const +{ TotemTimingPlaneChannelPair pair; auto iterator = totemTimingChannelMap.find( hwId ); if ( iterator != totemTimingChannelMap.end() ) pair = iterator->second; -// std::cout << "inside: adding plane: " << std::dec << pair.plane << " ch: " << pair.channel << " hwId: " << std::hex << (unsigned int) hwId << " size: " << totemTimingChannelMap.size() << std::endl; return pair; } diff --git a/CondFormats/CTPPSReadoutObjects/xml/mapping_totem_timing_2018.xml b/CondFormats/CTPPSReadoutObjects/xml/mapping_totem_timing_2018.xml index c1bb4a4b401dc..ed3459e75e0e7 100644 --- a/CondFormats/CTPPSReadoutObjects/xml/mapping_totem_timing_2018.xml +++ b/CondFormats/CTPPSReadoutObjects/xml/mapping_totem_timing_2018.xml @@ -113,7 +113,7 @@ - + @@ -167,5 +167,173 @@ + + + + + + + + + + + + + + + + . + + + + + + + + + + + + + + . + + + + + + + + + + + + + + . + + + + + + + + + + + + + + . + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DataFormats/CTPPSDigi/interface/CTPPSSampicDigi.h b/DataFormats/CTPPSDigi/interface/CTPPSSampicDigi.h deleted file mode 100644 index e56ef8c61801a..0000000000000 --- a/DataFormats/CTPPSDigi/interface/CTPPSSampicDigi.h +++ /dev/null @@ -1,128 +0,0 @@ -#ifndef CTPPSDigi_CTPPSSampicDigi_h -#define CTPPSDigi_CTPPSSampicDigi_h - -/** \class CTPPSSampicDigi - * - * Digi Class for CTPPS Timing Detector - * - * - * \author Seyed Mohsen Etesami - * March 2016 - */ - -#include -#include "DataFormats/CTPPSDigi/interface/HPTDCErrorFlags.h" - -class CTPPSSampicDigi{ - - public: - - CTPPSSampicDigi(unsigned int ledgt_, unsigned int tedgt_, unsigned int threvolt, bool mhit_, unsigned short hptdcerror_); - CTPPSSampicDigi(); - ~CTPPSSampicDigi() {}; - - /// Digis are equal if they are have same ledt and tedt, threshold voltage, multihit flag, hptdcerror flags - bool operator==(const CTPPSSampicDigi& digi) const; - - /// Return digi values number - - unsigned int getLeadingEdge() const - { - return ledgt; - } - - unsigned int getTrailingEdge() const - { - return tedgt; - } - - unsigned int getThresholdVoltage() const - { - return threvolt; - } - - bool getMultipleHit() const - { - return mhit; - } - - HPTDCErrorFlags getHPTDCErrorFlags() const - { - return hptdcerror; - } - - /// Set digi values - inline void setLeadingEdge(unsigned int ledgt_) - { - ledgt = ledgt_; - } - inline void setTrailingEdge(unsigned int tedgt_) - { - tedgt = tedgt_; - } - inline void setThresholdVoltage(unsigned int threvolt_) - { - threvolt = threvolt_; - } - inline void setMultipleHit(bool mhit_) - { - mhit = mhit_; - } - inline void setHPTDCErrorFlags(const HPTDCErrorFlags& hptdcerror_) - { - hptdcerror = hptdcerror_; - } - - - private: - // variable represents leading edge time - unsigned int ledgt; - // variable represents trailing edge time - unsigned int tedgt; - // variable represents threshold voltage - unsigned int threvolt; - // variable represents multi-hit - bool mhit; - HPTDCErrorFlags hptdcerror; -}; - -#include - - -inline bool operator< (const CTPPSSampicDigi& one, const CTPPSSampicDigi& other) -{ - if( one.getLeadingEdge() < other.getLeadingEdge() ) - return true; - if( one.getLeadingEdge() > other.getLeadingEdge() ) - return false; - if( one.getTrailingEdge() < other.getTrailingEdge() ) - return true; - if( one.getTrailingEdge() > other.getTrailingEdge() ) - return false; - if( one.getMultipleHit() < other.getMultipleHit() ) - return true; - if( one.getMultipleHit() > other.getMultipleHit() ) - return false; - if( one.getHPTDCErrorFlags().getErrorFlag() < other.getHPTDCErrorFlags().getErrorFlag() ) - return true; - if( one.getHPTDCErrorFlags().getErrorFlag() > other.getHPTDCErrorFlags().getErrorFlag() ) - return false; - if( one.getThresholdVoltage() < other.getThresholdVoltage() ) - return true; - if( one.getThresholdVoltage() > other.getThresholdVoltage() ) - return false; - return false; -} - - -inline std::ostream & operator<<(std::ostream & o, const CTPPSSampicDigi& digi) -{ - return o << " " << digi.getLeadingEdge() - << " " << digi.getTrailingEdge() - << " " << digi.getThresholdVoltage() - << " " << digi.getMultipleHit() - << " " << digi.getHPTDCErrorFlags().getErrorFlag(); -} - -#endif - diff --git a/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h b/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h index a0a84b7db5c38..06fe5b3c9190e 100644 --- a/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h +++ b/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h @@ -188,7 +188,9 @@ class TotemTimingDigi{ inline bool operator< (const TotemTimingDigi& one, const TotemTimingDigi& other) { - if( one.getHardwareId() < other.getHardwareId() ) + if ( one.getEventInfo() < other.getEventInfo() ) + return true; + if ( one.getHardwareId() < other.getHardwareId() ) return true; return false; } diff --git a/DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h b/DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h index 6d277e9aa380f..24ed2db5ef985 100644 --- a/DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h +++ b/DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h @@ -176,7 +176,11 @@ class TotemTimingEventInfo{ inline bool operator< (const TotemTimingEventInfo& one, const TotemTimingEventInfo& other) { - if( one.getHardwareId() < other.getHardwareId() ) + if ( one.getEventNumber() < other.getEventNumber() ) + return true; + if ( one.getL1ATimeStamp() < other.getL1ATimeStamp() ) + return true; + if ( one.getHardwareId() < other.getHardwareId() ) return true; return false; } diff --git a/DataFormats/CTPPSDigi/src/CTPPSSampicDigi.cc b/DataFormats/CTPPSDigi/src/CTPPSSampicDigi.cc deleted file mode 100644 index 83f9535503eb7..0000000000000 --- a/DataFormats/CTPPSDigi/src/CTPPSSampicDigi.cc +++ /dev/null @@ -1,31 +0,0 @@ -/** \file - * - * - * \author Seyed Mohsen Etesami - */ - -#include - -using namespace std; - -CTPPSSampicDigi::CTPPSSampicDigi(unsigned int ledgt_, unsigned int tedgt_, unsigned int threvolt_, bool mhit_, unsigned short hptdcerror_) : - ledgt(ledgt_), tedgt(tedgt_), threvolt(threvolt_), mhit(mhit_), hptdcerror(HPTDCErrorFlags(hptdcerror_)) -{} - -CTPPSSampicDigi::CTPPSSampicDigi() : - ledgt(0), tedgt(0), threvolt(0), mhit(false), hptdcerror(HPTDCErrorFlags(0)) -{} - -// Comparison -bool -CTPPSSampicDigi::operator==(const CTPPSSampicDigi& digi) const -{ - if ( ledgt != digi.getLeadingEdge() - || tedgt != digi.getTrailingEdge() - || threvolt != digi.getThresholdVoltage() - || mhit != digi.getMultipleHit() - || hptdcerror.getErrorFlag() != digi.getHPTDCErrorFlags().getErrorFlag()) return false; - else - return true; -} - diff --git a/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h b/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h index c67dd84d64102..2a6e9630a71ba 100644 --- a/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h +++ b/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h @@ -122,7 +122,7 @@ class TotemSampicFrame std::bitset<16> bitsCellInfo( getCellInfo() ); std::bitset<16> bitsChannelMap( getChannelMap() ); std::cout << "TotemSampicFrame:\nEvent:" - << "HardwareId (Event):\t" << std::hex << (unsigned int) getEventHardwareId() + << "\nHardwareId (Event):\t" << std::hex << (unsigned int) getEventHardwareId() << "\nL1A Time Stamp:\t" << std::dec << getL1ATimeStamp() << "\nL1A Latency:\t" << std::dec << getL1ALatency() << "\nBunch Number:\t" << std::dec << getBunchNumber() diff --git a/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py b/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py index 8de7c16e96e92..73ce73fb2f849 100644 --- a/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py +++ b/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py @@ -96,7 +96,7 @@ ), # 2018 cms.PSet( - validityRange = cms.EventRange("310000:min - 999999999:max"), + validityRange = cms.EventRange("310001:min - 999999999:max"), mappingFileNames = cms.vstring("CondFormats/CTPPSReadoutObjects/xml/mapping_totem_timing_2018.xml"), maskFileNames = cms.vstring() ) diff --git a/EventFilter/CTPPSRawToDigi/python/totemTimingRawToDigi_cfi.py b/EventFilter/CTPPSRawToDigi/python/totemTimingRawToDigi_cfi.py index 8ff33b409e2d5..1183792e65007 100644 --- a/EventFilter/CTPPSRawToDigi/python/totemTimingRawToDigi_cfi.py +++ b/EventFilter/CTPPSRawToDigi/python/totemTimingRawToDigi_cfi.py @@ -18,5 +18,11 @@ testID = cms.uint32(0), # compare the ID from data and mapping testECMostFrequent = cms.uint32(0), # compare frame's EC with the most frequent value in the event testBCMostFrequent = cms.uint32(0), # compare frame's BC with the most frequent value in the event + + # if non-zero, prints a per-VFAT error summary at the end of the job + printErrorSummary = cms.untracked.uint32(0), + + # if non-zero, prints a summary of frames found in data, but not in the mapping + printUnknownFrameSummary = cms.untracked.uint32(0) ) ) diff --git a/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc b/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc index 5b6b4a8309505..55ec91c8ab5e8 100644 --- a/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc +++ b/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc @@ -10,9 +10,6 @@ #include "EventFilter/CTPPSRawToDigi/interface/RawDataUnpacker.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" - -// #define DEBUG 0 - //---------------------------------------------------------------------------------------------------- using namespace std; @@ -232,7 +229,6 @@ int RawDataUnpacker::ProcessVFATDataParallel(const uint16_t *buf, unsigned int m // check header flag unsigned int hFlag = (buf[0] >> 8) & 0xFF; - std::cout<<"hFlag " << hFlag << " OptoRxId " << OptoRxId << std::endl; if (hFlag != vmCluster && hFlag != vmRaw && hFlag != vmDiamondCompact) { if (verbosity) diff --git a/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc b/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc index 74092d16a90e1..2d41a91bc9c78 100644 --- a/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc +++ b/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc @@ -14,6 +14,7 @@ #include "DataFormats/CTPPSDetId/interface/TotemRPDetId.h" #include "DataFormats/CTPPSDetId/interface/CTPPSDiamondDetId.h" +#include "EventFilter/CTPPSRawToDigi/interface/DiamondVFATFrame.h" #include "DataFormats/CTPPSDetId/interface/TotemTimingDetId.h" @@ -26,7 +27,7 @@ using namespace edm; RawToDigiConverter::RawToDigiConverter(const edm::ParameterSet &conf) : verbosity(conf.getUntrackedParameter("verbosity", 0)), - printErrorSummary(conf.getUntrackedParameter("printErrorSummary", 0)), + printErrorSummary(conf.getUntrackedParameter("printErrorSummary", 1)), printUnknownFrameSummary(conf.getUntrackedParameter("printUnknownFrameSummary", 1)), testFootprint(conf.getParameter("testFootprint")), @@ -373,6 +374,8 @@ void RawToDigiConverter::Run(const VFATFrameCollection &coll, const TotemDAQMapp detId.setChannel( totemSampicFrame.getDetChannel() % 32 ); } + std::cout << digiTmp << std::endl; + DetSet &digiDetSet = digi.find_or_insert(detId); digiDetSet.push_back(digiTmp); } From 5f30575c8c9044f1705664bd6bfaa945ed52270f Mon Sep 17 00:00:00 2001 From: nminafra Date: Mon, 26 Mar 2018 18:33:41 +0200 Subject: [PATCH 220/426] cleanup --- EventFilter/CTPPSRawToDigi/test/analyze_vfat_frames.py | 2 +- EventFilter/CTPPSRawToDigi/test/test_standard_sequence_cfg.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/EventFilter/CTPPSRawToDigi/test/analyze_vfat_frames.py b/EventFilter/CTPPSRawToDigi/test/analyze_vfat_frames.py index e6894871205cd..64997170ce264 100644 --- a/EventFilter/CTPPSRawToDigi/test/analyze_vfat_frames.py +++ b/EventFilter/CTPPSRawToDigi/test/analyze_vfat_frames.py @@ -40,4 +40,4 @@ # execution configuration process.p = cms.Path( process.totemVFATFrameAnalyzer -) +) \ No newline at end of file diff --git a/EventFilter/CTPPSRawToDigi/test/test_standard_sequence_cfg.py b/EventFilter/CTPPSRawToDigi/test/test_standard_sequence_cfg.py index 8ad4ee87cac46..1d1a5563f7c2f 100644 --- a/EventFilter/CTPPSRawToDigi/test/test_standard_sequence_cfg.py +++ b/EventFilter/CTPPSRawToDigi/test/test_standard_sequence_cfg.py @@ -44,4 +44,4 @@ ) ) -process.outpath = cms.EndPath(process.output) +process.outpath = cms.EndPath(process.output) \ No newline at end of file From 52f2181582f82031663251c684c2431f2815d433 Mon Sep 17 00:00:00 2001 From: jingyuluo Date: Tue, 27 Mar 2018 02:50:06 +0200 Subject: [PATCH 221/426] add DQM for new backup DisplacedJet Path --- .../Trigger/python/DisplacedJet_Monitor_cff.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/DQMOffline/Trigger/python/DisplacedJet_Monitor_cff.py b/DQMOffline/Trigger/python/DisplacedJet_Monitor_cff.py index 0338cefb4fed6..c886563ccd44c 100644 --- a/DQMOffline/Trigger/python/DisplacedJet_Monitor_cff.py +++ b/DQMOffline/Trigger/python/DisplacedJet_Monitor_cff.py @@ -60,6 +60,11 @@ hltHT_HT430_DisplacedDijet80_DisplacedTrack_Prommonitoring.jetSelection = cms.string("pt>80 && eta<2.0") hltHT_HT430_DisplacedDijet80_DisplacedTrack_Prommonitoring.jetSelection_HT = cms.string("pt > 40 && eta < 3.0") +hltHT_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring = hltHTmonitoring.clone() +hltHT_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring.FolderName = cms.string('HLT/EXO/DisplacedJet/HT/HLT_CaloJet_HT500_DisplacedDijet40_DisplacedTrack') +hltHT_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_HT500_DisplacedDijet40_DisplacedTrack_v*") +hltHT_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring.jetSelection = cms.string("pt>40 && eta<2.0") +hltHT_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring.jetSelection_HT = cms.string("pt > 40 && eta <3.0") hltHT_HT550_DisplacedDijet60_Inclusive_Prommonitoring = hltHTmonitoring.clone() @@ -137,6 +142,16 @@ hltJet_HT430_DisplacedDijet60_DisplacedTrack_Prommonitoring.iscalojettrg = cms.bool(True) +hltJet_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring = hltJetMETmonitoring.clone() +hltJet_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring.jetSrc = cms.InputTag("ak4CaloJets") +hltJet_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring.FolderName = cms.string('HLT/EXO/DisplacedJet/Jet/HLT_CaloJet_HT500_DisplacedDijet40_DisplacedTrack') +hltJet_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring.ptcut = cms.double(20) +hltJet_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring.histoPSet.jetptBinning = cms.vdouble(20.,26.,28.,30.,32.,34.,36.,38.,40.,42.,44.,46.,48.,50.,55.,60.,70.,80.,100.,120.,170.,220.,300.,400.) +hltJet_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_HT500_DisplacedDijet40_DisplacedTrack_v*") +hltJet_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring.ispfjettrg = cms.bool(False) +hltJet_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring.iscalojettrg = cms.bool(True) + + hltJet_HT550_DisplacedDijet60_Inclusive_Prommonitoring = hltJetMETmonitoring.clone() hltJet_HT550_DisplacedDijet60_Inclusive_Prommonitoring.jetSrc = cms.InputTag("ak4CaloJets") hltJet_HT550_DisplacedDijet60_Inclusive_Prommonitoring.FolderName = cms.string('HLT/EXO/DisplacedJet/Jet/HLT_CaloJet_HT550_DisplacedDijet60_Inclusive') @@ -196,6 +211,7 @@ +hltHT_HT430_DisplacedDijet40_DisplacedTrack_Prommonitoring +hltHT_HT430_DisplacedDijet60_DisplacedTrack_Prommonitoring +hltHT_HT430_DisplacedDijet80_DisplacedTrack_Prommonitoring ++hltHT_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring +hltHT_HT550_DisplacedDijet60_Inclusive_Prommonitoring +hltHT_HT550_DisplacedDijet80_Inclusive_Prommonitoring +hltHT_HT650_DisplacedDijet60_Inclusive_Prommonitoring @@ -205,6 +221,7 @@ +hltJet_HT430_DisplacedDijet40_DisplacedTrack_Prommonitoring +hltJet_HT430_DisplacedDijet60_DisplacedTrack_Prommonitoring +hltJet_HT430_DisplacedDijet80_DisplacedTrack_Prommonitoring ++hltJet_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring +hltJet_HT550_DisplacedDijet60_Inclusive_Prommonitoring +hltJet_HT550_DisplacedDijet80_Inclusive_Prommonitoring +hltJet_HT650_DisplacedDijet60_Inclusive_Prommonitoring From c60850d0a77ecce965c1027801a74cf1407e8468 Mon Sep 17 00:00:00 2001 From: jingyuluo Date: Tue, 27 Mar 2018 03:14:11 +0200 Subject: [PATCH 222/426] remove DQM for disabled DisplacedJet Paths --- .../python/DisplacedJet_Monitor_cff.py | 77 ------------------- 1 file changed, 77 deletions(-) diff --git a/DQMOffline/Trigger/python/DisplacedJet_Monitor_cff.py b/DQMOffline/Trigger/python/DisplacedJet_Monitor_cff.py index c886563ccd44c..fea4ebe551704 100644 --- a/DQMOffline/Trigger/python/DisplacedJet_Monitor_cff.py +++ b/DQMOffline/Trigger/python/DisplacedJet_Monitor_cff.py @@ -54,12 +54,6 @@ hltHT_HT430_DisplacedDijet60_DisplacedTrack_Prommonitoring.jetSelection_HT = cms.string("pt > 40 && eta < 3.0") -hltHT_HT430_DisplacedDijet80_DisplacedTrack_Prommonitoring = hltHTmonitoring.clone() -hltHT_HT430_DisplacedDijet80_DisplacedTrack_Prommonitoring.FolderName = cms.string('HLT/EXO/DisplacedJet/HT/HLT_CaloJet_HT430_DisplacedDijet80_DisplacedTrack') -hltHT_HT430_DisplacedDijet80_DisplacedTrack_Prommonitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_HT430_DisplacedDijet80_DisplacedTrack_v*") -hltHT_HT430_DisplacedDijet80_DisplacedTrack_Prommonitoring.jetSelection = cms.string("pt>80 && eta<2.0") -hltHT_HT430_DisplacedDijet80_DisplacedTrack_Prommonitoring.jetSelection_HT = cms.string("pt > 40 && eta < 3.0") - hltHT_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring = hltHTmonitoring.clone() hltHT_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring.FolderName = cms.string('HLT/EXO/DisplacedJet/HT/HLT_CaloJet_HT500_DisplacedDijet40_DisplacedTrack') hltHT_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_HT500_DisplacedDijet40_DisplacedTrack_v*") @@ -73,13 +67,6 @@ hltHT_HT550_DisplacedDijet60_Inclusive_Prommonitoring.jetSelection = cms.string("pt>60 && eta<2.0") hltHT_HT550_DisplacedDijet60_Inclusive_Prommonitoring.jetSelection_HT = cms.string("pt > 40 && eta < 3.0") -hltHT_HT550_DisplacedDijet80_Inclusive_Prommonitoring = hltHTmonitoring.clone() -hltHT_HT550_DisplacedDijet80_Inclusive_Prommonitoring.FolderName = cms.string('HLT/EXO/DisplacedJet/HT/HT_CaloJet_HLT_HT550_DisplacedDijet80_Inclusive') -hltHT_HT550_DisplacedDijet80_Inclusive_Prommonitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_HT550_DisplacedDijet80_Inclusive_v*") -hltHT_HT550_DisplacedDijet80_Inclusive_Prommonitoring.jetSelection = cms.string("pt>80 && eta<2.0") -hltHT_HT550_DisplacedDijet80_Inclusive_Prommonitoring.jetSelection_HT = cms.string("pt > 40 && eta < 3.0") - - hltHT_HT650_DisplacedDijet60_Inclusive_Prommonitoring = hltHTmonitoring.clone() hltHT_HT650_DisplacedDijet60_Inclusive_Prommonitoring.FolderName = cms.string('HLT/EXO/DisplacedJet/HT/HT_CaloJet_HLT_HT650_DisplacedDijet60_Inclusive') @@ -88,20 +75,6 @@ hltHT_HT650_DisplacedDijet60_Inclusive_Prommonitoring.jetSelection_HT = cms.string("pt > 40 && eta < 3.0") -hltHT_HT650_DisplacedDijet80_Inclusive_Prommonitoring = hltHTmonitoring.clone() -hltHT_HT650_DisplacedDijet80_Inclusive_Prommonitoring.FolderName = cms.string('HLT/EXO/DisplacedJet/HT/HT_CaloJet_HLT_HT650_DisplacedDijet80_Inclusive') -hltHT_HT650_DisplacedDijet80_Inclusive_Prommonitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_HT650_DisplacedDijet80_Inclusive_v*") -hltHT_HT650_DisplacedDijet80_Inclusive_Prommonitoring.jetSelection = cms.string("pt>80 && eta<2.0") -hltHT_HT650_DisplacedDijet80_Inclusive_Prommonitoring.jetSelection_HT = cms.string("pt > 40 && eta < 3.0") - - -hltHT_HT750_DisplacedDijet80_Inclusive_Prommonitoring = hltHTmonitoring.clone() -hltHT_HT750_DisplacedDijet80_Inclusive_Prommonitoring.FolderName = cms.string('HLT/EXO/DisplacedJet/HT/HT_CaloJet_HLT_HT750_DisplacedDijet80_Inclusive') -hltHT_HT750_DisplacedDijet80_Inclusive_Prommonitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_HT750_DisplacedDijet80_Inclusive_v*") -hltHT_HT750_DisplacedDijet80_Inclusive_Prommonitoring.jetSelection = cms.string("pt>80 && eta<2.0") -hltHT_HT750_DisplacedDijet80_Inclusive_Prommonitoring.jetSelection_HT = cms.string("pt > 40 && eta < 3.0") - - hltJet_HT400_DisplacedDijet40_DisplacedTrack_Prommonitoring = hltJetMETmonitoring.clone() hltJet_HT400_DisplacedDijet40_DisplacedTrack_Prommonitoring.jetSrc = cms.InputTag("ak4CaloJets") hltJet_HT400_DisplacedDijet40_DisplacedTrack_Prommonitoring.FolderName = cms.string('HLT/EXO/DisplacedJet/Jet/HLT_CaloJet_HT400_DisplacedDijet40_DisplacedTrack') @@ -132,16 +105,6 @@ hltJet_HT430_DisplacedDijet60_DisplacedTrack_Prommonitoring.iscalojettrg = cms.bool(True) -hltJet_HT430_DisplacedDijet80_DisplacedTrack_Prommonitoring = hltJetMETmonitoring.clone() -hltJet_HT430_DisplacedDijet80_DisplacedTrack_Prommonitoring.jetSrc = cms.InputTag("ak4CaloJets") -hltJet_HT430_DisplacedDijet80_DisplacedTrack_Prommonitoring.FolderName = cms.string('HLT/EXO/DisplacedJet/Jet/HLT_CaloJet_HT430_DisplacedDijet80_DisplacedTrack') -hltJet_HT430_DisplacedDijet80_DisplacedTrack_Prommonitoring.ptcut = cms.double(20) -hltJet_HT430_DisplacedDijet80_DisplacedTrack_Prommonitoring.histoPSet.jetptBinning = cms.vdouble(20.,30.,40.,50.,60.,65.,68.,70.,72.,74.,76.,78.,80.,82.,84.,86.,88.,90.,92.,94.,100.,120.,170.,220.,300.,400.) -hltJet_HT430_DisplacedDijet80_DisplacedTrack_Prommonitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_HT430_DisplacedDijet80_DisplacedTrack_v*") -hltJet_HT430_DisplacedDijet80_DisplacedTrack_Prommonitoring.ispfjettrg = cms.bool(False) -hltJet_HT430_DisplacedDijet60_DisplacedTrack_Prommonitoring.iscalojettrg = cms.bool(True) - - hltJet_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring = hltJetMETmonitoring.clone() hltJet_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring.jetSrc = cms.InputTag("ak4CaloJets") hltJet_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring.FolderName = cms.string('HLT/EXO/DisplacedJet/Jet/HLT_CaloJet_HT500_DisplacedDijet40_DisplacedTrack') @@ -162,17 +125,6 @@ hltJet_HT550_DisplacedDijet60_Inclusive_Prommonitoring.iscalojettrg = cms.bool(True) -hltJet_HT550_DisplacedDijet80_Inclusive_Prommonitoring = hltJetMETmonitoring.clone() -hltJet_HT550_DisplacedDijet80_Inclusive_Prommonitoring.jetSrc = cms.InputTag("ak4CaloJets") -hltJet_HT550_DisplacedDijet80_Inclusive_Prommonitoring.FolderName = cms.string('HLT/EXO/DisplacedJet/Jet/HLT_CaloJet_HT550_DisplacedDijet80_Inclusive') -hltJet_HT550_DisplacedDijet80_Inclusive_Prommonitoring.ptcut = cms.double(20) -hltJet_HT550_DisplacedDijet80_Inclusive_Prommonitoring.histoPSet.jetptBinning = cms.vdouble(20.,30.,40.,50.,60,65,68,70,72,74,76,78,80,82,84,86,88,90,92,94,100,120,170,220,300,400) -hltJet_HT550_DisplacedDijet80_Inclusive_Prommonitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_HT550_DisplacedDijet80_Inclusive_v*") -hltJet_HT550_DisplacedDijet80_Inclusive_Prommonitoring.ispfjettrg = cms.bool(False) -hltJet_HT550_DisplacedDijet80_Inclusive_Prommonitoring.iscalojettrg = cms.bool(True) - - - hltJet_HT650_DisplacedDijet60_Inclusive_Prommonitoring = hltJetMETmonitoring.clone() hltJet_HT650_DisplacedDijet60_Inclusive_Prommonitoring.jetSrc = cms.InputTag("ak4CaloJets") hltJet_HT650_DisplacedDijet60_Inclusive_Prommonitoring.FolderName = cms.string('HLT/EXO/DisplacedJet/Jet/HLT_CaloJet_HT650_DisplacedDijet60_Inclusive') @@ -183,50 +135,21 @@ hltJet_HT650_DisplacedDijet60_Inclusive_Prommonitoring.iscalojettrg = cms.bool(True) -hltJet_HT650_DisplacedDijet80_Inclusive_Prommonitoring = hltJetMETmonitoring.clone() -hltJet_HT650_DisplacedDijet80_Inclusive_Prommonitoring.jetSrc = cms.InputTag("ak4CaloJets") -hltJet_HT650_DisplacedDijet80_Inclusive_Prommonitoring.FolderName = cms.string('HLT/EXO/DisplacedJet/Jet/HLT_CaloJet_HT650_DisplacedDijet80_Inclusive') -hltJet_HT650_DisplacedDijet80_Inclusive_Prommonitoring.ptcut = cms.double(20) -hltJet_HT650_DisplacedDijet80_Inclusive_Prommonitoring.histoPSet.jetptBinning = cms.vdouble(20,30,40,50,60,65,68,70,72,74,76,78,80,82,84,86,88,90,92,94,100,120,170,220,300,400) -hltJet_HT650_DisplacedDijet80_Inclusive_Prommonitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_HT650_DisplacedDijet80_Inclusive_v*") -hltJet_HT650_DisplacedDijet80_Inclusive_Prommonitoring.ispfjettrg = cms.bool(False) -hltJet_HT650_DisplacedDijet80_Inclusive_Prommonitoring.iscalojettrg = cms.bool(True) - - -hltJet_HT750_DisplacedDijet80_Inclusive_Prommonitoring = hltJetMETmonitoring.clone() -hltJet_HT750_DisplacedDijet80_Inclusive_Prommonitoring.jetSrc = cms.InputTag("ak4CaloJets") -hltJet_HT750_DisplacedDijet80_Inclusive_Prommonitoring.FolderName = cms.string('HLT/EXO/DisplacedJet/Jet/HLT_CaloJet_HT750_DisplacedDijet80_Inclusive') -hltJet_HT750_DisplacedDijet80_Inclusive_Prommonitoring.ptcut = cms.double(20) -hltJet_HT750_DisplacedDijet80_Inclusive_Prommonitoring.histoPSet.jetptBinning = cms.vdouble(20,30,40,50,60,65,68,70,72,74,76,78,80,82,84,86,88,90,92,94,100,120,170,220,300,400) -hltJet_HT750_DisplacedDijet80_Inclusive_Prommonitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_HT750_DisplacedDijet80_Inclusive_v*") -hltJet_HT750_DisplacedDijet80_Inclusive_Prommonitoring.ispfjettrg = cms.bool(False) -hltJet_HT750_DisplacedDijet80_Inclusive_Prommonitoring.iscalojettrg = cms.bool(True) - - - exoHLTDisplacedJetmonitoring = cms.Sequence( hltHT_HT425_Prommonitoring +hltHT_HT400_DisplacedDijet40_DisplacedTrack_Prommonitoring +hltHT_HT430_DisplacedDijet40_DisplacedTrack_Prommonitoring +hltHT_HT430_DisplacedDijet60_DisplacedTrack_Prommonitoring -+hltHT_HT430_DisplacedDijet80_DisplacedTrack_Prommonitoring +hltHT_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring +hltHT_HT550_DisplacedDijet60_Inclusive_Prommonitoring -+hltHT_HT550_DisplacedDijet80_Inclusive_Prommonitoring +hltHT_HT650_DisplacedDijet60_Inclusive_Prommonitoring -+hltHT_HT650_DisplacedDijet80_Inclusive_Prommonitoring -+hltHT_HT750_DisplacedDijet80_Inclusive_Prommonitoring +hltJet_HT400_DisplacedDijet40_DisplacedTrack_Prommonitoring +hltJet_HT430_DisplacedDijet40_DisplacedTrack_Prommonitoring +hltJet_HT430_DisplacedDijet60_DisplacedTrack_Prommonitoring -+hltJet_HT430_DisplacedDijet80_DisplacedTrack_Prommonitoring +hltJet_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring +hltJet_HT550_DisplacedDijet60_Inclusive_Prommonitoring -+hltJet_HT550_DisplacedDijet80_Inclusive_Prommonitoring +hltJet_HT650_DisplacedDijet60_Inclusive_Prommonitoring -+hltJet_HT650_DisplacedDijet80_Inclusive_Prommonitoring -+hltJet_HT750_DisplacedDijet80_Inclusive_Prommonitoring ) From bfe0404ff5e227b2f1a9f5e0ca1544591f25cb64 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Tue, 27 Mar 2018 09:36:42 +0200 Subject: [PATCH 223/426] Fix muon copy comparison harvesting path. --- DQM/L1TMonitorClient/python/L1TStage2uGMTClient_cff.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DQM/L1TMonitorClient/python/L1TStage2uGMTClient_cff.py b/DQM/L1TMonitorClient/python/L1TStage2uGMTClient_cff.py index c067e8b6c2008..3c27339afa54d 100644 --- a/DQM/L1TMonitorClient/python/L1TStage2uGMTClient_cff.py +++ b/DQM/L1TMonitorClient/python/L1TStage2uGMTClient_cff.py @@ -12,9 +12,9 @@ # Muons l1tStage2uGMTMuonVsuGMTMuonCopy1RatioClient = DQMEDHarvester("L1TStage2RatioClient", - monitorDir = cms.untracked.string(ugmtDqmDir+'/uGMTMuonCopy1'), - inputNum = cms.untracked.string(ugmtDqmDir+'/uGMTMuonCopy1/'+errHistNumStr), - inputDen = cms.untracked.string(ugmtDqmDir+'/uGMTMuonCopy1/'+errHistDenStr), + monitorDir = cms.untracked.string(ugmtMuCpyDqmDir+'/uGMTMuonCopy1'), + inputNum = cms.untracked.string(ugmtMuCpyDqmDir+'/uGMTMuonCopy1/'+errHistNumStr), + inputDen = cms.untracked.string(ugmtMuCpyDqmDir+'/uGMTMuonCopy1/'+errHistDenStr), ratioName = cms.untracked.string('mismatchRatio'), ratioTitle = cms.untracked.string('Summary of mismatch rates between uGMT muons and uGMT muon copy 1'), yAxisTitle = cms.untracked.string('# mismatch / # total'), From 9d38e0e19c1e131d7e951f42626f5f61cff267c5 Mon Sep 17 00:00:00 2001 From: Santiago Date: Tue, 27 Mar 2018 12:43:45 +0200 Subject: [PATCH 224/426] BugFix for L3MuonCandidateProducerFromMuons, matching efficiency was degrading for very high-pt muons, this brings back the possibility of using the innerTrack when available and using the outerTrack otherwise --- .../L3MuonProducer/src/L3MuonCandidateProducerFromMuons.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/RecoMuon/L3MuonProducer/src/L3MuonCandidateProducerFromMuons.cc b/RecoMuon/L3MuonProducer/src/L3MuonCandidateProducerFromMuons.cc index 8f3389dd5f227..db7d7bed6ab08 100644 --- a/RecoMuon/L3MuonProducer/src/L3MuonCandidateProducerFromMuons.cc +++ b/RecoMuon/L3MuonProducer/src/L3MuonCandidateProducerFromMuons.cc @@ -60,8 +60,10 @@ void L3MuonCandidateProducerFromMuons::produce(StreamID, Event& event, const Eve LogError(category) << muons.whyFailed()->what(); } else { for (unsigned int i=0; isize(); i++) { - TrackRef tkref = (*muons)[i].muonBestTrack(); // avoids crashing in case the muon is SA only. - + + // avoids crashing in case the muon is SA only. + TrackRef tkref = ((*muons)[i].innerTrack().isNonnull())? (*muons)[i].innerTrack() : (*muons)[i].muonBestTrack(); + Particle::Charge q = tkref->charge(); Particle::LorentzVector p4(tkref->px(), tkref->py(), tkref->pz(), tkref->p()); Particle::Point vtx(tkref->vx(),tkref->vy(), tkref->vz()); From c6ad21e7657610122e70f7c243d7129c3d886432 Mon Sep 17 00:00:00 2001 From: Emanuele Di Marco Date: Fri, 23 Mar 2018 16:48:05 +0100 Subject: [PATCH 225/426] for miniaod v2 remove the module to do scale corrections for ele and pho --- PhysicsTools/NanoAOD/python/electrons_cff.py | 23 ++++---------------- PhysicsTools/NanoAOD/python/photons_cff.py | 18 ++++----------- 2 files changed, 8 insertions(+), 33 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/electrons_cff.py b/PhysicsTools/NanoAOD/python/electrons_cff.py index 27c4cad91f536..c4de88dd85f9e 100644 --- a/PhysicsTools/NanoAOD/python/electrons_cff.py +++ b/PhysicsTools/NanoAOD/python/electrons_cff.py @@ -100,20 +100,6 @@ run2_miniAOD_80XLegacy.toModify(ptRatioRelForEle, srcLep = "slimmedElectronsUpdated") run2_nanoAOD_92X.toModify(ptRatioRelForEle, srcLep = "slimmedElectronsUpdated") -from EgammaAnalysis.ElectronTools.calibratedElectronsRun2_cfi import calibratedPatElectrons -calibratedPatElectrons.correctionFile = cms.string("PhysicsTools/NanoAOD/data/80X_ichepV1_2016_ele") # hack, should go somewhere in EgammaAnalysis -calibratedPatElectrons.semiDeterministic = cms.bool(True) -run2_miniAOD_80XLegacy.toModify(calibratedPatElectrons, electrons = "slimmedElectronsUpdated") -run2_nanoAOD_92X.toModify(calibratedPatElectrons, electrons = "slimmedElectronsUpdated") - -energyCorrForEle = cms.EDProducer("ElectronEnergyVarProducer", - srcRaw = cms.InputTag("slimmedElectrons"), - srcCorr = cms.InputTag("calibratedPatElectrons"), -) -run2_miniAOD_80XLegacy.toModify(energyCorrForEle, srcRaw = "slimmedElectronsUpdated") -run2_nanoAOD_92X.toModify(energyCorrForEle, srcRaw = "slimmedElectronsUpdated") - - slimmedElectronsWithUserData = cms.EDProducer("PATElectronUserDataEmbedder", src = cms.InputTag("slimmedElectrons"), userFloats = cms.PSet( @@ -127,7 +113,6 @@ ptRatio = cms.InputTag("ptRatioRelForEle:ptRatio"), ptRel = cms.InputTag("ptRatioRelForEle:ptRel"), jetNDauChargedMVASel = cms.InputTag("ptRatioRelForEle:jetNDauChargedMVASel"), - eCorr = cms.InputTag("energyCorrForEle:eCorr"), ), userIntFromBools = cms.PSet( mvaFall17Iso_WP90 = cms.InputTag("egmGsfElectronIDs:mvaEleID-Fall17-iso-V1-wp90"), @@ -215,8 +200,8 @@ variables = cms.PSet(CandVars, jetIdx = Var("?hasUserCand('jet')?userCand('jet').key():-1", int, doc="index of the associated jet (-1 if none)"), photonIdx = Var("?overlaps('photons').size()>0?overlaps('photons')[0].key():-1", int, doc="index of the associated photon (-1 if none)"), - energyErr = Var("p4Error('P4_COMBINATION')*userFloat('eCorr')",float,doc="energy error of the cluster-track combination",precision=6), - eCorr = Var("userFloat('eCorr')",float,doc="ratio of the calibrated energy/miniaod energy"), + energyErr = Var("userFloat('ecalTrkEnergyErrPostCorr')",float,doc="energy error of the cluster-track combination",precision=6), + eCorr = Var("userFloat('ecalTrkEnergyPostCorr')/userFloat('ecalTrkEnergyPreCorr')",float,doc="ratio of the calibrated energy/miniaod energy"), dz = Var("dB('PVDZ')",float,doc="dz (with sign) wrt first PV, in cm",precision=10), dzErr = Var("abs(edB('PVDZ'))",float,doc="dz uncertainty, in cm",precision=6), dxy = Var("dB('PV2D')",float,doc="dxy (with sign) wrt first PV, in cm",precision=10), @@ -255,7 +240,7 @@ mvaTTH = ExtVar(cms.InputTag("electronMVATTH"),float, doc="TTH MVA lepton ID score",precision=14), ), ) -electronTable.variables.pt = Var("pt*userFloat('eCorr')", float, precision=-1, doc="p_{T} after energy correction & smearing") +electronTable.variables.pt = Var("pt*userFloat('ecalTrkEnergyPostCorr')/userFloat('ecalTrkEnergyPreCorr')", float, precision=-1, doc="p_{T} after energy correction & smearing") run2_miniAOD_80XLegacy.toModify(electronTable.variables, cutBased_HLTPreSel = Var("userInt('cutbasedID_HLT')",int,doc="cut-based HLT pre-selection ID"), mvaSpring16GP = Var("userFloat('mvaSpring16GP')",float,doc="MVA general-purpose ID score"), @@ -294,7 +279,7 @@ docString = cms.string("MC matching to status==1 electrons or photons"), ) -electronSequence = cms.Sequence(heepIDVarValueMaps + egmGsfElectronIDSequence + bitmapVIDForEle + isoForEle + ptRatioRelForEle + calibratedPatElectrons + energyCorrForEle + slimmedElectronsWithUserData + finalElectrons) +electronSequence = cms.Sequence(heepIDVarValueMaps + egmGsfElectronIDSequence + bitmapVIDForEle + isoForEle + ptRatioRelForEle + slimmedElectronsWithUserData + finalElectrons) electronTables = cms.Sequence (electronMVATTH + electronTable) electronMC = cms.Sequence(electronsMCMatchForTable + electronMCTable) diff --git a/PhysicsTools/NanoAOD/python/photons_cff.py b/PhysicsTools/NanoAOD/python/photons_cff.py index 8694ded721d72..d48e754fa7fd9 100644 --- a/PhysicsTools/NanoAOD/python/photons_cff.py +++ b/PhysicsTools/NanoAOD/python/photons_cff.py @@ -47,22 +47,12 @@ EAFile_PFIso_Pho = cms.FileInPath("RecoEgamma/PhotonIdentification/data/Spring16/effAreaPhotons_cone03_pfPhotons_90percentBased.txt"), ) -from EgammaAnalysis.ElectronTools.calibratedPhotonsRun2_cfi import calibratedPatPhotons -calibratedPatPhotons.correctionFile = cms.string("PhysicsTools/NanoAOD/data/80X_ichepV2_2016_pho") # hack, should go somewhere in EgammaAnalysis -calibratedPatPhotons.semiDeterministic = cms.bool(True) - -energyCorrForPhoton = cms.EDProducer("PhotonEnergyVarProducer", - srcRaw = cms.InputTag("slimmedPhotons"), - srcCorr = cms.InputTag("calibratedPatPhotons"), -) - slimmedPhotonsWithUserData = cms.EDProducer("PATPhotonUserDataEmbedder", src = cms.InputTag("slimmedPhotons"), userFloats = cms.PSet( mvaID = cms.InputTag("photonMVAValueMapProducer:PhotonMVAEstimatorRun2Spring16NonTrigV1Values"), PFIsoChg = cms.InputTag("isoForPho:PFIsoChg"), PFIsoAll = cms.InputTag("isoForPho:PFIsoAll"), - eCorr = cms.InputTag("energyCorrForPhoton:eCorr"), ), userIntFromBools = cms.PSet( cutbasedID_loose = cms.InputTag("egmPhotonIDs:cutBasedPhotonID-Spring16-V2p2-loose"), @@ -91,8 +81,8 @@ variables = cms.PSet(CandVars, jetIdx = Var("?hasUserCand('jet')?userCand('jet').key():-1", int, doc="index of the associated jet (-1 if none)"), electronIdx = Var("?hasUserCand('electron')?userCand('electron').key():-1", int, doc="index of the associated electron (-1 if none)"), - energyErr = Var("getCorrectedEnergyError('regression2')*userFloat('eCorr')",float,doc="energy error of the cluster from regression",precision=6), - eCorr = Var("userFloat('eCorr')",float,doc="ratio of the calibrated energy/miniaod energy"), + energyErr = Var("userFloat('ecalEnergyErrPostCorr')",float,doc="energy error of the cluster from regression",precision=6), + eCorr = Var("userFloat('ecalEnergyPostCorr')/userFloat('ecalEnergyPreCorr')",float,doc="ratio of the calibrated energy/miniaod energy"), r9 = Var("full5x5_r9()",float,doc="R9 of the supercluster, calculated with full 5x5 region",precision=10), sieie = Var("full5x5_sigmaIetaIeta()",float,doc="sigma_IetaIeta of the supercluster, calculated with full 5x5 region",precision=10), cutBased = Var("userInt('cutbasedID_loose')+userInt('cutbasedID_medium')+userInt('cutbasedID_tight')",int,doc="cut-based ID (0:fail, 1::loose, 2:medium, 3:tight)"), @@ -109,7 +99,7 @@ isScEtaEE = Var("abs(superCluster().eta()) > 1.566 && abs(superCluster().eta()) < 2.5",bool,doc="is supercluster eta within endcap acceptance"), ) ) -photonTable.variables.pt = Var("pt*userFloat('eCorr')", float, precision=-1) +photonTable.variables.pt = Var("pt*userFloat('ecalEnergyPostCorr')/userFloat('ecalEnergyPreCorr')", float, precision=-1) photonsMCMatchForTable = cms.EDProducer("MCMatcher", # cut on deltaR, deltaPt/Pt; pick best by deltaR src = photonTable.src, # final reco collection @@ -132,6 +122,6 @@ docString = cms.string("MC matching to status==1 photons or electrons"), ) -photonSequence = cms.Sequence(egmPhotonIDSequence + bitmapVIDForPho + isoForPho + calibratedPatPhotons + energyCorrForPhoton + slimmedPhotonsWithUserData + finalPhotons) +photonSequence = cms.Sequence(egmPhotonIDSequence + bitmapVIDForPho + isoForPho + slimmedPhotonsWithUserData + finalPhotons) photonTables = cms.Sequence ( photonTable) photonMC = cms.Sequence(photonsMCMatchForTable + photonMCTable) From cf478b84c6865d0f13c644dcd8a6d45fe5178598 Mon Sep 17 00:00:00 2001 From: Emanuele Di Marco Date: Fri, 23 Mar 2018 16:55:46 +0100 Subject: [PATCH 226/426] rnd no more needed since smearing is done in miniAODv2 --- PhysicsTools/NanoAOD/test/nano_cfg.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/PhysicsTools/NanoAOD/test/nano_cfg.py b/PhysicsTools/NanoAOD/test/nano_cfg.py index 1b4e2d5a9418f..f89dcfd27998b 100644 --- a/PhysicsTools/NanoAOD/test/nano_cfg.py +++ b/PhysicsTools/NanoAOD/test/nano_cfg.py @@ -22,22 +22,13 @@ # '/store/relval/CMSSW_9_4_0_pre3/RelValProdTTbar_13/MINIAODSIM/94X_mcRun2_asymptotic_v0-v1/10000/06F85EC5-7BB9-E711-A2CB-0025905A6134.root' #sample with LHE - '/store/mc/RunIISummer17MiniAOD/TT_TuneCUETP8M2T4_13TeV-powheg-pythia8/MINIAODSIM/92X_upgrade2017_realistic_v10_ext1-v1/110000/187F7EDA-0986-E711-ABB3-02163E014C21.root' +'/store/cmst3/group/nanoAOD/pre-94XMiniAODv2/TTToSemiLeptonic_TuneCP5_PSweights_13TeV-powheg-pythia8.root' ] process.load("PhysicsTools.NanoAOD.nano_cff") -process.RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService", - calibratedPatElectrons = cms.PSet(initialSeed = cms.untracked.uint32(81), - engineName = cms.untracked.string('TRandom3'), - ), - calibratedPatPhotons = cms.PSet(initialSeed = cms.untracked.uint32(81), - engineName = cms.untracked.string('TRandom3'), - ), -) + process.nanoPath = cms.Path(process.nanoSequenceMC) -process.calibratedPatElectrons.isMC = cms.bool(True) -process.calibratedPatPhotons.isMC = cms.bool(True) #for data: #process.nanoPath = cms.Path(process.nanoSequence) #process.GlobalTag.globaltag = autoCond['run2_data'] From 622e4f6f6d65c94dd363747b8f23798da7fe8ba7 Mon Sep 17 00:00:00 2001 From: Giovanni Date: Fri, 23 Mar 2018 18:19:20 +0100 Subject: [PATCH 227/426] Use eras to keep old module for 80X, and to run new E/gamma module in 94Xv1 --- PhysicsTools/NanoAOD/python/electrons_cff.py | 47 +++++++++++++++++- PhysicsTools/NanoAOD/python/nano_cff.py | 10 ++-- PhysicsTools/NanoAOD/python/photons_cff.py | 52 ++++++++++++++++++++ 3 files changed, 103 insertions(+), 6 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/electrons_cff.py b/PhysicsTools/NanoAOD/python/electrons_cff.py index c4de88dd85f9e..d920689460d4a 100644 --- a/PhysicsTools/NanoAOD/python/electrons_cff.py +++ b/PhysicsTools/NanoAOD/python/electrons_cff.py @@ -1,6 +1,7 @@ import FWCore.ParameterSet.Config as cms from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy from Configuration.Eras.Modifier_run2_nanoAOD_92X_cff import run2_nanoAOD_92X +from Configuration.Eras.Modifier_run2_nanoAOD_94XMiniAODv1_cff import run2_nanoAOD_94XMiniAODv1 from PhysicsTools.NanoAOD.common_cff import * import PhysicsTools.PatAlgos.producersLayer1.electronProducer_cfi from math import ceil,log @@ -100,6 +101,21 @@ run2_miniAOD_80XLegacy.toModify(ptRatioRelForEle, srcLep = "slimmedElectronsUpdated") run2_nanoAOD_92X.toModify(ptRatioRelForEle, srcLep = "slimmedElectronsUpdated") +import EgammaAnalysis.ElectronTools.calibratedElectronsRun2_cfi +calibratedPatElectrons80X = EgammaAnalysis.ElectronTools.calibratedElectronsRun2_cfi.calibratedPatElectrons.clone( + electrons = cms.InputTag("slimmedElectronsUpdated"), + correctionFile = cms.string("PhysicsTools/NanoAOD/data/80X_ichepV1_2016_ele"), + semiDeterministic = cms.bool(True) +) +energyCorrForEle80X = cms.EDProducer("ElectronEnergyVarProducer", + srcRaw = cms.InputTag("slimmedElectronsUpdated"), + srcCorr = cms.InputTag("calibratedPatElectrons80X"), +) +import RecoEgamma.EgammaTools.calibratedEgammas_cff +calibratedPatElectrons94Xv1 = RecoEgamma.EgammaTools.calibratedEgammas_cff.calibratedPatElectrons.clone( + produceCalibratedObjs = False +) + slimmedElectronsWithUserData = cms.EDProducer("PATElectronUserDataEmbedder", src = cms.InputTag("slimmedElectrons"), userFloats = cms.PSet( @@ -141,6 +157,12 @@ mvaSpring16HZZ = cms.InputTag("electronMVAValueMapProducer:ElectronMVAEstimatorRun2Spring16HZZV1Values"), mvaFall17Iso = None, mvaFall17noIso = None, + eCorr = cms.InputTag("energyCorrForEle80X","eCorr") +) +run2_nanoAOD_94XMiniAODv1.toModify(slimmedElectronsWithUserData.userFloats, + ecalTrkEnergyErrPostCorr = cms.InputTag("calibratedPatElectrons94Xv1","ecalTrkEnergyErrPostCorr"), + ecalTrkEnergyPreCorr = cms.InputTag("calibratedPatElectrons94Xv1","ecalTrkEnergyPreCorr"), + ecalTrkEnergyPostCorr = cms.InputTag("calibratedPatElectrons94Xv1","ecalTrkEnergyPostCorr"), ) run2_miniAOD_80XLegacy.toReplaceWith(slimmedElectronsWithUserData.userIntFromBools, cms.PSet( @@ -240,7 +262,7 @@ mvaTTH = ExtVar(cms.InputTag("electronMVATTH"),float, doc="TTH MVA lepton ID score",precision=14), ), ) -electronTable.variables.pt = Var("pt*userFloat('ecalTrkEnergyPostCorr')/userFloat('ecalTrkEnergyPreCorr')", float, precision=-1, doc="p_{T} after energy correction & smearing") +electronTable.variables.pt = Var("pt*userFloat('ecalTrkEnergyPostCorr')/userFloat('ecalTrkEnergyPreCorr')", float, precision=-1, doc="p_{T}") run2_miniAOD_80XLegacy.toModify(electronTable.variables, cutBased_HLTPreSel = Var("userInt('cutbasedID_HLT')",int,doc="cut-based HLT pre-selection ID"), mvaSpring16GP = Var("userFloat('mvaSpring16GP')",float,doc="MVA general-purpose ID score"), @@ -256,7 +278,20 @@ mvaFall17noIso_WP80 = None, mvaFall17noIso_WP90 = None, mvaFall17noIso_WPL = None, + pt = Var("pt*userFloat('eCorr')", float, precision=-1, doc="p_{T} after energy correction & smearing"), + energyErr = Var("p4Error('P4_COMBINATION')*userFloat('eCorr')",float,doc="energy error of the cluster-track combination",precision=6), + eCorr = Var("userFloat('eCorr')",float,doc="ratio of the calibrated energy/miniaod energy"), ) +run2_nanoAOD_92X.toModify(electronTable.variables, + pt = Var("pt", float, precision=-1, doc="p_{T} (no energy correction & smearing)"), + energyErr = Var("p4Error('P4_COMBINATION')",float,doc="energy error of the cluster-track combination",precision=6), + eCorr = None, +) +#run2_nanoAOD_94XMiniAODv1.toModify(electronTable.variables, +# pt = Var("pt", float, precision=-1, doc="p_{T} (no energy correction & smearing)"), +# energyErr = Var("p4Error('P4_COMBINATION')",float,doc="energy error of the cluster-track combination",precision=6), +# eCorr = None, +#) electronsMCMatchForTable = cms.EDProducer("MCMatcher", # cut on deltaR, deltaPt/Pt; pick best by deltaR src = electronTable.src, # final reco collection @@ -285,4 +320,12 @@ _withUpdate_sequence = cms.Sequence(slimmedElectronsUpdated + electronSequence.copy()) run2_nanoAOD_92X.toReplaceWith(electronSequence, _withUpdate_sequence) -run2_miniAOD_80XLegacy.toReplaceWith(electronSequence, _withUpdate_sequence) + +_withUpdateAnd80XScale_sequence = _withUpdate_sequence.copy() +_withUpdateAnd80XScale_sequence.replace(slimmedElectronsWithUserData, calibratedPatElectrons80X + energyCorrForEle80X + slimmedElectronsWithUserData) +run2_miniAOD_80XLegacy.toReplaceWith(electronSequence, _withUpdateAnd80XScale_sequence) + +_with94Xv1Scale_sequence = electronSequence.copy() +_with94Xv1Scale_sequence.replace(slimmedElectronsWithUserData, calibratedPatElectrons94Xv1 + slimmedElectronsWithUserData) +run2_nanoAOD_94XMiniAODv1.toReplaceWith(electronSequence, _with94Xv1Scale_sequence) + diff --git a/PhysicsTools/NanoAOD/python/nano_cff.py b/PhysicsTools/NanoAOD/python/nano_cff.py index 96bf144ec10f3..3a2799770540e 100644 --- a/PhysicsTools/NanoAOD/python/nano_cff.py +++ b/PhysicsTools/NanoAOD/python/nano_cff.py @@ -84,14 +84,16 @@ def nanoAOD_customizeCommon(process): def nanoAOD_customizeData(process): process = nanoAOD_customizeCommon(process) - process.calibratedPatElectrons.isMC = cms.bool(False) - process.calibratedPatPhotons.isMC = cms.bool(False) + if hasattr(process,'calibratedPatElectrons80X'): + process.calibratedPatElectrons80X.isMC = cms.bool(False) + process.calibratedPatPhotons80X.isMC = cms.bool(False) return process def nanoAOD_customizeMC(process): process = nanoAOD_customizeCommon(process) - process.calibratedPatElectrons.isMC = cms.bool(True) - process.calibratedPatPhotons.isMC = cms.bool(True) + if hasattr(process,'calibratedPatElectrons80X'): + process.calibratedPatElectrons80X.isMC = cms.bool(True) + process.calibratedPatPhotons80X.isMC = cms.bool(True) return process ### Era dependent customization diff --git a/PhysicsTools/NanoAOD/python/photons_cff.py b/PhysicsTools/NanoAOD/python/photons_cff.py index d48e754fa7fd9..d69ed7c503952 100644 --- a/PhysicsTools/NanoAOD/python/photons_cff.py +++ b/PhysicsTools/NanoAOD/python/photons_cff.py @@ -2,6 +2,10 @@ from PhysicsTools.NanoAOD.common_cff import * from math import ceil,log +from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy +from Configuration.Eras.Modifier_run2_nanoAOD_92X_cff import run2_nanoAOD_92X +from Configuration.Eras.Modifier_run2_nanoAOD_94XMiniAODv1_cff import run2_nanoAOD_94XMiniAODv1 + from PhysicsTools.SelectorUtils.tools.vid_id_tools import setupVIDSelection from RecoEgamma.PhotonIdentification.egmPhotonIDs_cfi import * from RecoEgamma.PhotonIdentification.PhotonIDValueMapProducer_cfi import * @@ -47,6 +51,21 @@ EAFile_PFIso_Pho = cms.FileInPath("RecoEgamma/PhotonIdentification/data/Spring16/effAreaPhotons_cone03_pfPhotons_90percentBased.txt"), ) +import EgammaAnalysis.ElectronTools.calibratedPhotonsRun2_cfi +calibratedPatPhotons80X = EgammaAnalysis.ElectronTools.calibratedPhotonsRun2_cfi.calibratedPatPhotons.clone( + correctionFile = cms.string("PhysicsTools/NanoAOD/data/80X_ichepV2_2016_pho"), # hack, should go somewhere in EgammaAnalysis + semiDeterministic = cms.bool(True), +) +energyCorrForPhoton80X = cms.EDProducer("PhotonEnergyVarProducer", + srcRaw = cms.InputTag("slimmedPhotons"), + srcCorr = cms.InputTag("calibratedPatPhotons80X"), +) +import RecoEgamma.EgammaTools.calibratedEgammas_cff +calibratedPatPhotons94Xv1 = RecoEgamma.EgammaTools.calibratedEgammas_cff.calibratedPatPhotons.clone( + produceCalibratedObjs = False +) + + slimmedPhotonsWithUserData = cms.EDProducer("PATPhotonUserDataEmbedder", src = cms.InputTag("slimmedPhotons"), userFloats = cms.PSet( @@ -65,6 +84,14 @@ VIDNestedWPBitmap = cms.InputTag("bitmapVIDForPho"), ), ) +run2_miniAOD_80XLegacy.toModify(slimmedPhotonsWithUserData.userFloats, + eCorr = cms.InputTag("energyCorrForPhoton80X","eCorr") +) +run2_nanoAOD_94XMiniAODv1.toModify(slimmedPhotonsWithUserData.userFloats, + ecalEnergyErrPostCorr = cms.InputTag("calibratedPatPhotons94Xv1","ecalEnergyErrPostCorr"), + ecalEnergyPreCorr = cms.InputTag("calibratedPatPhotons94Xv1","ecalEnergyPreCorr"), + ecalEnergyPostCorr = cms.InputTag("calibratedPatPhotons94Xv1","ecalEnergyPostCorr"), +) finalPhotons = cms.EDFilter("PATPhotonRefSelector", src = cms.InputTag("slimmedPhotonsWithUserData"), @@ -100,6 +127,22 @@ ) ) photonTable.variables.pt = Var("pt*userFloat('ecalEnergyPostCorr')/userFloat('ecalEnergyPreCorr')", float, precision=-1) +run2_miniAOD_80XLegacy.toModify(photonTable.variables, + pt = Var("pt*userFloat('eCorr')", float, precision=-1, doc="p_{T} (no energy correction & smearing)"), + energyErr = Var("getCorrectedEnergyError('regression2')*userFloat('eCorr')",float,doc="energy error of the cluster from regression",precision=6), + eCorr = Var("userFloat('eCorr')",float,doc="ratio of the calibrated energy/miniaod energy"), +) +run2_nanoAOD_92X.toModify(photonTable.variables, + pt = Var("pt", float, precision=-1, doc="p_{T} (no energy correction & smearing)"), + energyErr = Var("getCorrectedEnergyError('regression2')",float,doc="energy error of the cluster from regression",precision=6), + eCorr = None, +) +#run2_nanoAOD_94XMiniAODv1.toModify(photonTable.variables, +# pt = Var("pt", float, precision=-1, doc="p_{T} (no energy correction & smearing)"), +# energyErr = Var("getCorrectedEnergyError('regression2')",float,doc="energy error of the cluster from regression",precision=6), +# eCorr = None, +#) + photonsMCMatchForTable = cms.EDProducer("MCMatcher", # cut on deltaR, deltaPt/Pt; pick best by deltaR src = photonTable.src, # final reco collection @@ -125,3 +168,12 @@ photonSequence = cms.Sequence(egmPhotonIDSequence + bitmapVIDForPho + isoForPho + slimmedPhotonsWithUserData + finalPhotons) photonTables = cms.Sequence ( photonTable) photonMC = cms.Sequence(photonsMCMatchForTable + photonMCTable) + +_with80XScale_sequence = photonSequence.copy() +_with80XScale_sequence.replace(slimmedPhotonsWithUserData, calibratedPatPhotons80X + energyCorrForPhoton80X + slimmedPhotonsWithUserData) +run2_miniAOD_80XLegacy.toReplaceWith(photonSequence, _with80XScale_sequence) + +_with94Xv1Scale_sequence = photonSequence.copy() +_with94Xv1Scale_sequence.replace(slimmedPhotonsWithUserData, calibratedPatPhotons94Xv1 + slimmedPhotonsWithUserData) +run2_nanoAOD_94XMiniAODv1.toReplaceWith(photonSequence, _with94Xv1Scale_sequence) + From 14bc9fcd899162402b6163db032a438cf407d624 Mon Sep 17 00:00:00 2001 From: Giovanni Date: Fri, 23 Mar 2018 18:25:48 +0100 Subject: [PATCH 228/426] remove commented out code --- PhysicsTools/NanoAOD/python/electrons_cff.py | 5 ----- PhysicsTools/NanoAOD/python/photons_cff.py | 5 ----- 2 files changed, 10 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/electrons_cff.py b/PhysicsTools/NanoAOD/python/electrons_cff.py index d920689460d4a..be84aacf37794 100644 --- a/PhysicsTools/NanoAOD/python/electrons_cff.py +++ b/PhysicsTools/NanoAOD/python/electrons_cff.py @@ -287,11 +287,6 @@ energyErr = Var("p4Error('P4_COMBINATION')",float,doc="energy error of the cluster-track combination",precision=6), eCorr = None, ) -#run2_nanoAOD_94XMiniAODv1.toModify(electronTable.variables, -# pt = Var("pt", float, precision=-1, doc="p_{T} (no energy correction & smearing)"), -# energyErr = Var("p4Error('P4_COMBINATION')",float,doc="energy error of the cluster-track combination",precision=6), -# eCorr = None, -#) electronsMCMatchForTable = cms.EDProducer("MCMatcher", # cut on deltaR, deltaPt/Pt; pick best by deltaR src = electronTable.src, # final reco collection diff --git a/PhysicsTools/NanoAOD/python/photons_cff.py b/PhysicsTools/NanoAOD/python/photons_cff.py index d69ed7c503952..ce8b50b40a760 100644 --- a/PhysicsTools/NanoAOD/python/photons_cff.py +++ b/PhysicsTools/NanoAOD/python/photons_cff.py @@ -137,11 +137,6 @@ energyErr = Var("getCorrectedEnergyError('regression2')",float,doc="energy error of the cluster from regression",precision=6), eCorr = None, ) -#run2_nanoAOD_94XMiniAODv1.toModify(photonTable.variables, -# pt = Var("pt", float, precision=-1, doc="p_{T} (no energy correction & smearing)"), -# energyErr = Var("getCorrectedEnergyError('regression2')",float,doc="energy error of the cluster from regression",precision=6), -# eCorr = None, -#) photonsMCMatchForTable = cms.EDProducer("MCMatcher", # cut on deltaR, deltaPt/Pt; pick best by deltaR From f7bb010fabc6565cdce62031b21264710a4d8efc Mon Sep 17 00:00:00 2001 From: peruzzim Date: Wed, 21 Mar 2018 18:04:09 +0100 Subject: [PATCH 229/426] Fix bug in mvaID_WP80 for photons --- PhysicsTools/NanoAOD/python/photons_cff.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PhysicsTools/NanoAOD/python/photons_cff.py b/PhysicsTools/NanoAOD/python/photons_cff.py index ce8b50b40a760..6c91d1ea8d78a 100644 --- a/PhysicsTools/NanoAOD/python/photons_cff.py +++ b/PhysicsTools/NanoAOD/python/photons_cff.py @@ -118,7 +118,7 @@ pixelSeed = Var("hasPixelSeed()",bool,doc="has pixel seed"), mvaID = Var("userFloat('mvaID')",float,doc="MVA ID score",precision=10), mvaID_WP90 = Var("userInt('mvaID_WP90')",bool,doc="MVA ID WP90"), - mvaID_WP80 = Var("userInt('mvaID_WP90')",bool,doc="MVA ID WP80"), + mvaID_WP80 = Var("userInt('mvaID_WP80')",bool,doc="MVA ID WP80"), pfRelIso03_chg = Var("userFloat('PFIsoChg')/pt",float,doc="PF relative isolation dR=0.3, charged component (with rho*EA PU corrections)"), pfRelIso03_all = Var("userFloat('PFIsoAll')/pt",float,doc="PF relative isolation dR=0.3, total (with rho*EA PU corrections)"), hoe = Var("hadronicOverEm()",float,doc="H over E",precision=8), From 58ac58ea41a10a925ff31437129c5bfab8b0c046 Mon Sep 17 00:00:00 2001 From: peruzzim Date: Thu, 22 Mar 2018 10:40:36 +0100 Subject: [PATCH 230/426] Fall17 photon ID in NanoAOD --- PhysicsTools/NanoAOD/python/photons_cff.py | 60 ++++++++++++++++------ 1 file changed, 45 insertions(+), 15 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/photons_cff.py b/PhysicsTools/NanoAOD/python/photons_cff.py index 6c91d1ea8d78a..78f9230bdf6a8 100644 --- a/PhysicsTools/NanoAOD/python/photons_cff.py +++ b/PhysicsTools/NanoAOD/python/photons_cff.py @@ -1,4 +1,5 @@ import FWCore.ParameterSet.Config as cms +from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy from PhysicsTools.NanoAOD.common_cff import * from math import ceil,log @@ -15,28 +16,44 @@ egmPhotonIDSequence = cms.Sequence(cms.Task(egmPhotonIsolationMiniAODTask,photonIDValueMapProducer,photonMVAValueMapProducer,egmPhotonIDs,photonRegressionValueMapProducer)) egmPhotonIDs.physicsObjectIDs = cms.VPSet() egmPhotonIDs.physicsObjectSrc = cms.InputTag('slimmedPhotons') -_photon_id_vid_modules=[ -'RecoEgamma.PhotonIdentification.Identification.cutBasedPhotonID_Spring16_V2p2_cff', -'RecoEgamma.PhotonIdentification.Identification.mvaPhotonID_Spring16_nonTrig_V1_cff', -] -_bitmapVIDForPho_WorkingPoints = cms.vstring( + +_photon_id_vid_modules_WorkingPoints = cms.PSet( + modules = cms.vstring( + 'RecoEgamma.PhotonIdentification.Identification.cutBasedPhotonID_Fall17_94X_V1_TrueVtx_cff', + 'RecoEgamma.PhotonIdentification.Identification.mvaPhotonID_Fall17_94X_V1_cff', + ), + WorkingPoints = cms.vstring( +# can run only for one working point for the moment, as the working points are not nested +# "egmPhotonIDs:cutBasedPhotonID-Fall17-94X-V1-loose", + "egmPhotonIDs:cutBasedPhotonID-Fall17-94X-V1-medium", +# "egmPhotonIDs:cutBasedPhotonID-Fall17-94X-V1-tight", + ) +) +run2_miniAOD_80XLegacy.toModify(_photon_id_vid_modules_WorkingPoints, + modules = cms.vstring( + 'RecoEgamma.PhotonIdentification.Identification.cutBasedPhotonID_Spring16_V2p2_cff', + 'RecoEgamma.PhotonIdentification.Identification.mvaPhotonID_Spring16_nonTrig_V1_cff', + ), + WorkingPoints = cms.vstring( "egmPhotonIDs:cutBasedPhotonID-Spring16-V2p2-loose", "egmPhotonIDs:cutBasedPhotonID-Spring16-V2p2-medium", "egmPhotonIDs:cutBasedPhotonID-Spring16-V2p2-tight", + ) ) + _bitmapVIDForPho_docstring = '' -for modname in _photon_id_vid_modules: +for modname in _photon_id_vid_modules_WorkingPoints.modules: ids= __import__(modname, globals(), locals(), ['idName','cutFlow']) for name in dir(ids): _id = getattr(ids,name) if hasattr(_id,'idName') and hasattr(_id,'cutFlow'): setupVIDSelection(egmPhotonIDs,_id) - if (len(_bitmapVIDForPho_WorkingPoints)>0 and _id.idName==_bitmapVIDForPho_WorkingPoints[0].split(':')[-1]): - _bitmapVIDForPho_docstring = 'VID compressed bitmap (%s), %d bits per cut'%(','.join([cut.cutName.value() for cut in _id.cutFlow]),int(ceil(log(len(_bitmapVIDForPho_WorkingPoints)+1,2)))) + if (len(_photon_id_vid_modules_WorkingPoints.WorkingPoints)>0 and _id.idName==_photon_id_vid_modules_WorkingPoints.WorkingPoints[0].split(':')[-1]): + _bitmapVIDForPho_docstring = 'VID compressed bitmap (%s), %d bits per cut'%(','.join([cut.cutName.value() for cut in _id.cutFlow]),int(ceil(log(len(_photon_id_vid_modules_WorkingPoints.WorkingPoints)+1,2)))) bitmapVIDForPho = cms.EDProducer("PhoVIDNestedWPBitmapProducer", src = cms.InputTag("slimmedPhotons"), - WorkingPoints = _bitmapVIDForPho_WorkingPoints, + WorkingPoints = _photon_id_vid_modules_WorkingPoints.WorkingPoints, ) isoForPho = cms.EDProducer("PhoIsoValueMapProducer", @@ -46,6 +63,11 @@ mapIsoChg = cms.InputTag("photonIDValueMapProducer:phoChargedIsolation"), mapIsoNeu = cms.InputTag("photonIDValueMapProducer:phoNeutralHadronIsolation"), mapIsoPho = cms.InputTag("photonIDValueMapProducer:phoPhotonIsolation"), + EAFile_PFIso_Chg = cms.FileInPath("RecoEgamma/PhotonIdentification/data/Fall17/effAreaPhotons_cone03_pfChargedHadrons_90percentBased_TrueVtx.txt"), + EAFile_PFIso_Neu = cms.FileInPath("RecoEgamma/PhotonIdentification/data/Fall17/effAreaPhotons_cone03_pfNeutralHadrons_90percentBased_TrueVtx.txt"), + EAFile_PFIso_Pho = cms.FileInPath("RecoEgamma/PhotonIdentification/data/Fall17/effAreaPhotons_cone03_pfPhotons_90percentBased_TrueVtx.txt"), +) +run2_miniAOD_80XLegacy.toModify(isoForPho, EAFile_PFIso_Chg = cms.FileInPath("RecoEgamma/PhotonIdentification/data/Spring16/effAreaPhotons_cone03_pfChargedHadrons_90percentBased.txt"), EAFile_PFIso_Neu = cms.FileInPath("RecoEgamma/PhotonIdentification/data/Spring16/effAreaPhotons_cone03_pfNeutralHadrons_90percentBased.txt"), EAFile_PFIso_Pho = cms.FileInPath("RecoEgamma/PhotonIdentification/data/Spring16/effAreaPhotons_cone03_pfPhotons_90percentBased.txt"), @@ -69,24 +91,32 @@ slimmedPhotonsWithUserData = cms.EDProducer("PATPhotonUserDataEmbedder", src = cms.InputTag("slimmedPhotons"), userFloats = cms.PSet( - mvaID = cms.InputTag("photonMVAValueMapProducer:PhotonMVAEstimatorRun2Spring16NonTrigV1Values"), + mvaID = cms.InputTag("photonMVAValueMapProducer:PhotonMVAEstimatorRunIIFall17v1Values"), PFIsoChg = cms.InputTag("isoForPho:PFIsoChg"), PFIsoAll = cms.InputTag("isoForPho:PFIsoAll"), ), userIntFromBools = cms.PSet( - cutbasedID_loose = cms.InputTag("egmPhotonIDs:cutBasedPhotonID-Spring16-V2p2-loose"), - cutbasedID_medium = cms.InputTag("egmPhotonIDs:cutBasedPhotonID-Spring16-V2p2-medium"), - cutbasedID_tight = cms.InputTag("egmPhotonIDs:cutBasedPhotonID-Spring16-V2p2-tight"), - mvaID_WP90 = cms.InputTag("egmPhotonIDs:mvaPhoID-Spring16-nonTrig-V1-wp90"), - mvaID_WP80 = cms.InputTag("egmPhotonIDs:mvaPhoID-Spring16-nonTrig-V1-wp80"), + cutbasedID_loose = cms.InputTag("egmPhotonIDs:cutBasedPhotonID-Fall17-94X-V1-loose"), + cutbasedID_medium = cms.InputTag("egmPhotonIDs:cutBasedPhotonID-Fall17-94X-V1-medium"), + cutbasedID_tight = cms.InputTag("egmPhotonIDs:cutBasedPhotonID-Fall17-94X-V1-tight"), + mvaID_WP90 = cms.InputTag("egmPhotonIDs:mvaPhoID-RunIIFall17-v1-wp90"), + mvaID_WP80 = cms.InputTag("egmPhotonIDs:mvaPhoID-RunIIFall17-v1-wp80"), ), userInts = cms.PSet( VIDNestedWPBitmap = cms.InputTag("bitmapVIDForPho"), ), ) run2_miniAOD_80XLegacy.toModify(slimmedPhotonsWithUserData.userFloats, + mvaID = cms.InputTag("photonMVAValueMapProducer:PhotonMVAEstimatorRun2Spring16NonTrigV1Values"), eCorr = cms.InputTag("energyCorrForPhoton80X","eCorr") ) +run2_miniAOD_80XLegacy.toModify(slimmedPhotonsWithUserData.userIntFromBools, + cutbasedID_loose = cms.InputTag("egmPhotonIDs:cutBasedPhotonID-Spring16-V2p2-loose"), + cutbasedID_medium = cms.InputTag("egmPhotonIDs:cutBasedPhotonID-Spring16-V2p2-medium"), + cutbasedID_tight = cms.InputTag("egmPhotonIDs:cutBasedPhotonID-Spring16-V2p2-tight"), + mvaID_WP90 = cms.InputTag("egmPhotonIDs:mvaPhoID-Spring16-nonTrig-V1-wp90"), + mvaID_WP80 = cms.InputTag("egmPhotonIDs:mvaPhoID-Spring16-nonTrig-V1-wp80"), +) run2_nanoAOD_94XMiniAODv1.toModify(slimmedPhotonsWithUserData.userFloats, ecalEnergyErrPostCorr = cms.InputTag("calibratedPatPhotons94Xv1","ecalEnergyErrPostCorr"), ecalEnergyPreCorr = cms.InputTag("calibratedPatPhotons94Xv1","ecalEnergyPreCorr"), From 80a2c720c0d2fd464854d367e1b0e4edda76d14e Mon Sep 17 00:00:00 2001 From: peruzzim Date: Thu, 22 Mar 2018 12:12:19 +0100 Subject: [PATCH 231/426] Adapt photon cut-based ID storage to bitmap for non-nested working points --- PhysicsTools/NanoAOD/python/nanoDQM_cfi.py | 2 +- PhysicsTools/NanoAOD/python/photons_cff.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py b/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py index 7731ab1f66d0d..950dd49aadb2a 100644 --- a/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py +++ b/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py @@ -331,7 +331,7 @@ Count1D('_size', 9, -0.5, 8.5, 'slimmedPhotons after basic selection (pt > 5 )'), Plot1D('charge', 'charge', 1, -0.5, 0.5, 'electric charge'), Plot1D('cleanmask', 'cleanmask', 1, 0.5, 1.5, 'simple cleaning mask with priority to leptons'), - Plot1D('cutBased', 'cutBased', 4, -0.5, 3.5, 'cut-based ID (0:fail, 1::loose, 2:medium, 3:tight)'), + Plot1D('cutBasedBitmap', 'cutBasedBitmap', 8, -0.5, 7.5, 'cut-based ID bitmap, 2^(0:loose, 1:medium, 2:tight)'), Plot1D('eCorr', 'eCorr', 20, 0.6, 1.6, 'ratio of the calibrated energy/miniaod energy'), NoPlot('electronIdx'), Plot1D('electronVeto', 'electronVeto', 2, -0.5, 1.5, 'pass electron veto'), diff --git a/PhysicsTools/NanoAOD/python/photons_cff.py b/PhysicsTools/NanoAOD/python/photons_cff.py index 78f9230bdf6a8..88abad4aead57 100644 --- a/PhysicsTools/NanoAOD/python/photons_cff.py +++ b/PhysicsTools/NanoAOD/python/photons_cff.py @@ -142,7 +142,7 @@ eCorr = Var("userFloat('ecalEnergyPostCorr')/userFloat('ecalEnergyPreCorr')",float,doc="ratio of the calibrated energy/miniaod energy"), r9 = Var("full5x5_r9()",float,doc="R9 of the supercluster, calculated with full 5x5 region",precision=10), sieie = Var("full5x5_sigmaIetaIeta()",float,doc="sigma_IetaIeta of the supercluster, calculated with full 5x5 region",precision=10), - cutBased = Var("userInt('cutbasedID_loose')+userInt('cutbasedID_medium')+userInt('cutbasedID_tight')",int,doc="cut-based ID (0:fail, 1::loose, 2:medium, 3:tight)"), + cutBasedBitmap = Var("userInt('cutbasedID_loose')+2*userInt('cutbasedID_medium')+4*userInt('cutbasedID_tight')",int,doc="cut-based ID bitmap, 2^(0:loose, 1:medium, 2:tight)"), vidNestedWPBitmap = Var("userInt('VIDNestedWPBitmap')",int,doc=_bitmapVIDForPho_docstring), electronVeto = Var("passElectronVeto()",bool,doc="pass electron veto"), pixelSeed = Var("hasPixelSeed()",bool,doc="has pixel seed"), @@ -158,6 +158,8 @@ ) photonTable.variables.pt = Var("pt*userFloat('ecalEnergyPostCorr')/userFloat('ecalEnergyPreCorr')", float, precision=-1) run2_miniAOD_80XLegacy.toModify(photonTable.variables, + cutBasedBitmap = None, + cutBased = Var("userInt('cutbasedID_loose')+userInt('cutbasedID_medium')+userInt('cutbasedID_tight')",int,doc="cut-based ID (0:fail, 1::loose, 2:medium, 3:tight)"), pt = Var("pt*userFloat('eCorr')", float, precision=-1, doc="p_{T} (no energy correction & smearing)"), energyErr = Var("getCorrectedEnergyError('regression2')*userFloat('eCorr')",float,doc="energy error of the cluster from regression",precision=6), eCorr = Var("userFloat('eCorr')",float,doc="ratio of the calibrated energy/miniaod energy"), From 1aa433b148d13d774eca8c23ef8629dabb99696d Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Tue, 27 Mar 2018 15:15:25 +0200 Subject: [PATCH 232/426] Ignore the BX range bin for the uGMT to uGT link check to be save in case the uGMT is not in the run. --- DQM/L1TMonitor/python/L1TStage2uGT_cff.py | 1 + DQM/L1TMonitorClient/python/L1TStage2uGTClient_cff.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/DQM/L1TMonitor/python/L1TStage2uGT_cff.py b/DQM/L1TMonitor/python/L1TStage2uGT_cff.py index 02319dc42c34a..b930f89e7ecf5 100644 --- a/DQM/L1TMonitor/python/L1TStage2uGT_cff.py +++ b/DQM/L1TMonitor/python/L1TStage2uGT_cff.py @@ -14,6 +14,7 @@ muonCollection1Title = cms.untracked.string("uGMT output muons"), muonCollection2Title = cms.untracked.string("uGT input muons"), summaryTitle = cms.untracked.string("Summary of comparison between uGMT output muons and uGT input muons"), + ignoreBin = cms.untracked.vint32([1]), # ignore the BX range bin verbose = cms.untracked.bool(False), ) diff --git a/DQM/L1TMonitorClient/python/L1TStage2uGTClient_cff.py b/DQM/L1TMonitorClient/python/L1TStage2uGTClient_cff.py index 936699aed3b38..744e29e2a5c10 100644 --- a/DQM/L1TMonitorClient/python/L1TStage2uGTClient_cff.py +++ b/DQM/L1TMonitorClient/python/L1TStage2uGTClient_cff.py @@ -1,5 +1,6 @@ import FWCore.ParameterSet.Config as cms from DQMServices.Core.DQMEDHarvester import DQMEDHarvester +from DQM.L1TMonitor.L1TStage2uGT_cff import l1tStage2uGMTOutVsuGTIn # directory path shortening ugtDqmDir = 'L1T/L1TStage2uGT' @@ -12,6 +13,7 @@ monitorDir = cms.untracked.string(ugtDqmDir+'/uGMToutput_vs_uGTinput'), inputNum = cms.untracked.string(ugtDqmDir+'/uGMToutput_vs_uGTinput/'+errHistNumStr), inputDen = cms.untracked.string(ugtDqmDir+'/uGMToutput_vs_uGTinput/'+errHistDenStr), + ignoreBin = cms.untracked.vint32(l1tStage2uGMTOutVsuGTIn.ignoreBin), ratioName = cms.untracked.string('mismatchRatio'), ratioTitle = cms.untracked.string('Summary of mismatch rates between uGMT output muons and uGT input muons'), yAxisTitle = cms.untracked.string('# mismatch / # total'), @@ -21,7 +23,6 @@ dqmRatioTimingPlots = DQMEDHarvester("DQMGenericClient", subDirs = cms.untracked.vstring("L1T/L1TStage2uGT/"), - monitorDir = cms.untracked.string(ugtDqmDir), efficiency = cms.vstring( "Ratio_First_Bunch_In_Train 'First Bunch In Train Ratio; Bunch crossing number relative to L1A; Algorithm trigger bit' first_bunch_in_train den_first_bunch_in_train", "Ratio_Last_Bunch_In_Train 'Last Bunch In Train Ratio; Bunch crossing number relative to L1A; Algorithm trigger bit' last_bunch_in_train den_last_bunch_in_train", From daed4cbd2777424e847c45c55ca9b3ef5d4dd7ac Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Sauvan Date: Tue, 27 Mar 2018 15:16:26 +0200 Subject: [PATCH 233/426] Fix hoe computation in HGCalClusterT --- DataFormats/L1THGCal/interface/HGCalClusterT.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/DataFormats/L1THGCal/interface/HGCalClusterT.h b/DataFormats/L1THGCal/interface/HGCalClusterT.h index 4908be1041691..b740216b89cbc 100644 --- a/DataFormats/L1THGCal/interface/HGCalClusterT.h +++ b/DataFormats/L1THGCal/interface/HGCalClusterT.h @@ -120,18 +120,20 @@ namespace l1t double pt_had = 0.; double hOe = 0.; - for(const auto& constituent : constituents()) + for(const auto& id_constituent : constituents()) { - switch( constituent->subdetId() ) + auto id_fraction = constituentsFraction_.find(id_constituent.first); + double fraction = (id_fraction!=constituentsFraction_.end() ? id_fraction->second : 1.); + switch( id_constituent.second->subdetId() ) { case HGCEE: - pt_em += constituent->pt(); + pt_em += id_constituent.second->pt() * fraction; break; case HGCHEF: - pt_had += constituent->pt(); + pt_had += id_constituent.second->pt() * fraction; break; case HGCHEB: - pt_had += constituent->pt(); + pt_had += id_constituent.second->pt() * fraction; break; default: break; From 17af3736a0d0dfe7d18fce336c8f6f0bf103164a Mon Sep 17 00:00:00 2001 From: Giovanni Date: Tue, 27 Mar 2018 15:10:59 +0200 Subject: [PATCH 234/426] fix NanoAOD runtests.sh to use 94X eras --- PhysicsTools/NanoAOD/test/runtests.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PhysicsTools/NanoAOD/test/runtests.sh b/PhysicsTools/NanoAOD/test/runtests.sh index 8086690ee755b..397af33d850f0 100755 --- a/PhysicsTools/NanoAOD/test/runtests.sh +++ b/PhysicsTools/NanoAOD/test/runtests.sh @@ -4,8 +4,9 @@ function die { echo $1: status $2 ; exit $2; } #to be enabled with the right files #cmsDriver.py test80X -s NANO --mc --eventcontent NANOAODSIM --datatier NANO --filein /store/relval/CMSSW_8_0_0/RelValTTbar_13/MINIAODSIM/PU25ns_80X_mcRun2_asymptotic_v4-v1/10000/A65CD249-BFDA-E511-813A-0025905A6066.root --conditions auto:run2_mc -n 100 --era Run2_2016,run2_miniAOD_80XLegacy || die 'Failure using cmsdriver 80X' $? -cmsDriver.py test92X -s NANO --mc --eventcontent NANOAODSIM --datatier NANOAODSIM --filein /store/relval/CMSSW_9_2_12/RelValTTbar_13/MINIAODSIM/PU25ns_92X_upgrade2017_realistic_v11-v1/00000/080E2624-F59D-E711-ACEE-0CC47A7C35A4.root --conditions auto:phase1_2017_realistic -n 100 --era Run2_2017,run2_nanoAOD_92X || die 'Failure using cmsdriver 92X' $? +#cmsDriver.py test92X -s NANO --mc --eventcontent NANOAODSIM --datatier NANOAODSIM --filein /store/relval/CMSSW_9_2_12/RelValTTbar_13/MINIAODSIM/PU25ns_92X_upgrade2017_realistic_v11-v1/00000/080E2624-F59D-E711-ACEE-0CC47A7C35A4.root --conditions auto:phase1_2017_realistic -n 100 --era Run2_2017,run2_nanoAOD_92X || die 'Failure using cmsdriver 92X' $? -cmsDriver.py test94X -s NANO --mc --eventcontent NANOAODSIM --datatier NANOAODSIM --filein /store/relval/CMSSW_9_4_0_pre3/RelValTTbar_13/MINIAODSIM/PU25ns_94X_mc2017_realistic_v4-v1/10000/52B94CC0-6FBB-E711-B577-0CC47A7C35F8.root --conditions auto:phase1_2017_realistic -n 100 --era Run2_2017 || die 'Failure using cmsdriver 94X' $? +cmsDriver.py test94Xv1 -s NANO --mc --eventcontent NANOAODSIM --datatier NANOAODSIM --filein /store/relval/CMSSW_9_4_0_pre3/RelValTTbar_13/MINIAODSIM/PU25ns_94X_mc2017_realistic_v4-v1/10000/52B94CC0-6FBB-E711-B577-0CC47A7C35F8.root --conditions auto:phase1_2017_realistic -n 100 --era Run2_2017,run2_nanoAOD_94XMiniAODv1 || die 'Failure using cmsdriver 94X v1' $? +cmsDriver.py test94Xv2 -s NANO --mc --eventcontent NANOAODSIM --datatier NANOAODSIM --filein /store/relval/CMSSW_9_4_5_cand1/RelValTTbar_13/MINIAODSIM/94X_mc2017_realistic_v14_PU_RelVal_rmaod-v1/10000/84A84D5B-9E2E-E811-B103-0CC47A7C35F4.root --conditions auto:phase1_2017_realistic -n 100 --era Run2_2017,run2_nanoAOD_94XMiniAODv2 || die 'Failure using cmsdriver 94X v2' $? From cd40517720b390285b04374174ba604263891f94 Mon Sep 17 00:00:00 2001 From: Giovanni Date: Tue, 27 Mar 2018 15:20:57 +0200 Subject: [PATCH 235/426] Fix eras in NanoAOD matrix relvals --- .../PyReleaseValidation/python/relval_standard.py | 7 ++++--- .../PyReleaseValidation/python/relval_steps.py | 15 ++++++++++++++- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Configuration/PyReleaseValidation/python/relval_standard.py b/Configuration/PyReleaseValidation/python/relval_standard.py index 6e428d03255e4..bd077d30f473f 100644 --- a/Configuration/PyReleaseValidation/python/relval_standard.py +++ b/Configuration/PyReleaseValidation/python/relval_standard.py @@ -437,10 +437,11 @@ workflows[1325.51] = ['', ['TTbar_13_94XreminiaodINPUT','REMINIAOD_mc2017','HARVESTUP17_REMINIAOD_mc2017']] # nanoaod wf without intermediate EDM, starting from existing MINIAOD inputs -workflows[1325.6] = ['', ['TTbar_13_94XNanoAODINPUT','NANOAODMC2017']] +workflows[1325.6] = ['', ['TTbar_13_94Xv1NanoAODINPUT','NANOAODMC2017_94XMiniAODv1']] # nanoaod wf with intermediate EDM and merge step, starting from existing MINIAOD inputs -workflows[1325.7] = ['', ['TTbar_13_94XNanoAODINPUT','NANOEDMMC2017','HARVESTNANOAODMC2017']] -workflows[1325.8] = ['', ['TTbar_13_92XNanoAODINPUT','NANOEDMMC2017_92X','HARVESTNANOAODMC2017_92X']] +workflows[1325.7] = ['', ['TTbar_13_94Xv2NanoAODINPUT','NANOEDMMC2017_94XMiniAODv2','HARVESTNANOAODMC2017_94XMiniAODv2']] +workflows[1325.8] = ['', ['TTbar_13_94Xv1NanoAODINPUT','NANOEDMMC2017_94XMiniAODv1','HARVESTNANOAODMC2017_94XMiniAODv1']] +workflows[1325.9] = ['', ['TTbar_13_92XNanoAODINPUT','NANOEDMMC2017_92X','HARVESTNANOAODMC2017_92X']] #using ZEE as I cannot find TT at CERN workflows[1329.1] = ['', ['ZEE_13_80XNanoAODINPUT','NANOEDMMC2016_80X','HARVESTNANOAODMC2016_80X']] diff --git a/Configuration/PyReleaseValidation/python/relval_steps.py b/Configuration/PyReleaseValidation/python/relval_steps.py index 4edd508807a10..6355d71232aba 100644 --- a/Configuration/PyReleaseValidation/python/relval_steps.py +++ b/Configuration/PyReleaseValidation/python/relval_steps.py @@ -558,7 +558,8 @@ def identitySim(wf): #input for a NANOAOD from MINIAOD workflow steps['ZEE_13_80XNanoAODINPUT']={'INPUT':InputInfo(dataSet='/RelValZEE_13/CMSSW_8_0_21-PU25ns_80X_mcRun2_asymptotic_2016_TrancheIV_v6_Tr4GT_v6-v1/MINIAODSIM',label='nanoaod80X',location='STD')} steps['TTbar_13_92XNanoAODINPUT']={'INPUT':InputInfo(dataSet='/RelValTTbar_13/CMSSW_9_2_12-PU25ns_92X_upgrade2017_realistic_v11-v1/MINIAODSIM',label='nanoaod92X',location='STD')} -steps['TTbar_13_94XNanoAODINPUT']={'INPUT':InputInfo(dataSet='/RelValTTbar_13/CMSSW_9_4_0_pre3-PU25ns_94X_mc2017_realistic_v4-v1/MINIAODSIM',label='nanoaod94X',location='STD')} +steps['TTbar_13_94Xv1NanoAODINPUT']={'INPUT':InputInfo(dataSet='/RelValTTbar_13/CMSSW_9_4_0_pre3-PU25ns_94X_mc2017_realistic_v4-v1/MINIAODSIM',label='nanoaod94X',location='STD')} +steps['TTbar_13_94Xv2NanoAODINPUT']={'INPUT':InputInfo(dataSet='/RelValTTbar_13/CMSSW_9_4_5_cand1-94X_mc2017_realistic_v14_PU_RelVal_rmaod-v1/MINIAODSIM',label='nanoaod94Xv2',location='STD')} # 13 TeV recycle GEN-SIM input steps['MinBias_13INPUT']={'INPUT':InputInfo(dataSet='/RelValMinBias_13/%s/GEN-SIM'%(baseDataSetRelease[3],),location='STD')} @@ -2226,27 +2227,39 @@ def gen2018HiMix(fragment,howMuch): steps['NANOAOD2016_80X'] = merge([{'--era': 'Run2_2016,run2_miniAOD_80XLegacy'}, steps['NANOAOD2016'] ]) steps['NANOAOD2017_92X'] = merge([{'--era': 'Run2_2017,run2_nanoAOD_92X'}, steps['NANOAOD2017'] ]) +steps['NANOAOD2017_94XMiniAODv1'] = merge([{'--era': 'Run2_2017,run2_nanoAOD_94XMiniAODv1'}, steps['NANOAOD2017'] ]) +steps['NANOAOD2017_94XMiniAODv2'] = merge([{'--era': 'Run2_2017,run2_nanoAOD_94XMiniAODv2'}, steps['NANOAOD2017'] ]) steps['NANOAODMC2016'] = merge([{'--conditions': 'auto:run2_mc', '--era': 'Run2_2016'}, stepNanoAODMC ]) steps['NANOAODMC2017'] = merge([{'--conditions': 'auto:phase1_2017_realistic', '--era': 'Run2_2017'}, stepNanoAODMC ]) steps['NANOAODMC2016_80X'] = merge([{'--era': 'Run2_2016,run2_miniAOD_80XLegacy'}, steps['NANOAODMC2016'] ]) steps['NANOAODMC2017_92X'] = merge([{'--era': 'Run2_2017,run2_nanoAOD_92X'}, steps['NANOAODMC2017'] ]) +steps['NANOAODMC2017_94XMiniAODv1'] = merge([{'--era': 'Run2_2017,run2_nanoAOD_94XMiniAODv1'}, steps['NANOAODMC2017'] ]) +steps['NANOAODMC2017_94XMiniAODv2'] = merge([{'--era': 'Run2_2017,run2_nanoAOD_94XMiniAODv2'}, steps['NANOAODMC2017'] ]) steps['NANOEDMMC2017'] = merge([{'--conditions': 'auto:phase1_2017_realistic', '--era': 'Run2_2017'}, stepNanoEDMMC ]) steps['NANOEDMMC2017_92X'] = merge([{'--era': 'Run2_2017,run2_nanoAOD_92X'}, steps['NANOEDMMC2017'] ]) +steps['NANOEDMMC2017_94XMiniAODv1'] = merge([{'--era': 'Run2_2017,run2_nanoAOD_94XMiniAODv1'}, steps['NANOEDMMC2017'] ]) +steps['NANOEDMMC2017_94XMiniAODv2'] = merge([{'--era': 'Run2_2017,run2_nanoAOD_94XMiniAODv2'}, steps['NANOEDMMC2017'] ]) steps['NANOEDMMC2016_80X'] = merge([{'--conditions': 'auto:run2_mc', '--era': 'Run2_2016,run2_miniAOD_80XLegacy'}, steps['NANOEDMMC2017'] ]) steps['NANOEDM2017'] = merge([{'--conditions': 'auto:run2_data_relval', '--era': 'Run2_2017'}, stepNanoEDMData ]) steps['NANOEDM2017_92X'] = merge([{'--era': 'Run2_2017,run2_nanoAOD_92X'}, steps['NANOEDM2017'] ]) +steps['NANOEDM2017_94XMiniAODv1'] = merge([{'--era': 'Run2_2017,run2_nanoAOD_94XMiniAODv1'}, steps['NANOEDM2017'] ]) +steps['NANOEDM2017_94XMiniAODv2'] = merge([{'--era': 'Run2_2017,run2_nanoAOD_94XMiniAODv2'}, steps['NANOEDM2017'] ]) steps['NANOEDM2016_80X'] = merge([{'--era': 'Run2_2016,run2_miniAOD_80XLegacy'}, steps['NANOEDM2017'] ]) steps['HARVESTNANOAODMC2017']=merge([{'-s':'HARVESTING:@nanoAODDQM','--conditions': 'auto:phase1_2017_realistic','--era': 'Run2_2017'},steps['HARVESTUP15']]) steps['HARVESTNANOAODMC2017_92X']=merge([{'--era': 'Run2_2017,run2_nanoAOD_92X'},steps['HARVESTNANOAODMC2017']]) +steps['HARVESTNANOAODMC2017_94XMiniAODv1']=merge([{'--era': 'Run2_2017,run2_nanoAOD_94XMiniAODv1'},steps['HARVESTNANOAODMC2017']]) +steps['HARVESTNANOAODMC2017_94XMiniAODv2']=merge([{'--era': 'Run2_2017,run2_nanoAOD_94XMiniAODv2'},steps['HARVESTNANOAODMC2017']]) steps['HARVESTNANOAODMC2016_80X']=merge([{'--conditions': 'auto:run2_mc','--era': 'Run2_2016,run2_miniAOD_80XLegacy'},steps['HARVESTNANOAODMC2017']]) steps['HARVESTNANOAOD2017']=merge([{'--data':'','-s':'HARVESTING:@nanoAODDQM','--conditions':'auto:run2_data_relval','--era':'Run2_2017'},steps['HARVESTDR2']]) steps['HARVESTNANOAOD2017_92X']=merge([{'--era': 'Run2_2017,run2_nanoAOD_92X'},steps['HARVESTNANOAOD2017']]) +steps['HARVESTNANOAOD2017_94XMiniAODv1']=merge([{'--era': 'Run2_2017,run2_nanoAOD_94XMiniAODv1'},steps['HARVESTNANOAOD2017']]) +steps['HARVESTNANOAOD2017_94XMiniAODv2']=merge([{'--era': 'Run2_2017,run2_nanoAOD_94XMiniAODv2'},steps['HARVESTNANOAOD2017']]) steps['HARVESTNANOAOD2016_80X']=merge([{'--era': 'Run2_2016,run2_miniAOD_80XLegacy'},steps['HARVESTNANOAOD2017']]) steps['NANOMERGE'] = { '-s': 'ENDJOB', '-n': 1000 , '--eventcontent' : 'NANOAODSIM','--datatier': 'NANOAODSIM', '--conditions': 'auto:run2_mc' } From 5517f1222611c852607763c7a036a9fc027968e7 Mon Sep 17 00:00:00 2001 From: Felice Date: Tue, 27 Mar 2018 16:03:21 +0200 Subject: [PATCH 236/426] some debugging --- .../interface/HGCalImagingAlgo.h | 2 +- .../HGCalRecAlgos/src/HGCalImagingAlgo.cc | 29 ++++++++++--------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/RecoLocalCalo/HGCalRecAlgos/interface/HGCalImagingAlgo.h b/RecoLocalCalo/HGCalRecAlgos/interface/HGCalImagingAlgo.h index 2e12faa4afc47..58d6713eb8b72 100644 --- a/RecoLocalCalo/HGCalRecAlgos/interface/HGCalImagingAlgo.h +++ b/RecoLocalCalo/HGCalRecAlgos/interface/HGCalImagingAlgo.h @@ -255,7 +255,7 @@ typedef KDTreeNodeInfoT KDNode; // A vector of vectors of KDNodes holding an Hexel in the clusters - to be used to build CaloClusters of DetIds -std::vector< std::vector > current_v; +tbb::concurrent_vector< std::vector > current_v; std::vector sort_by_delta(const std::vector &v) const { std::vector idx(v.size()); diff --git a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc index a37dace97305d..874ed593f32e2 100644 --- a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc +++ b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc @@ -90,12 +90,14 @@ void HGCalImagingAlgo::makeClusters() calculateDistanceToHigher(points[i]); findAndAssignClusters(points[i],hit_kdtree,maxdensity,bounds,actualLayer, layerClustersPerLayer[i]); size_t nClusters = layerClustersPerLayer[i].size(); + layersQueue.pushAndWait( [&]{ + current_v.reserve(current_v.size()+nClusters); for(size_t j=0; j HGCalImagingAlgo::getClusters(bool doSharing){ thisCluster.clear(); } } + std::cout << "found clusters: "<< clusters_v.size() << std::endl; return clusters_v; } @@ -298,7 +301,7 @@ int HGCalImagingAlgo::findAndAssignClusters(std::vector &nd, KDTree &lp, //so when filling the cluster temporary vector of Hexels we resize each time by the number //of clusters found. This is always equal to the number of cluster centers... - unsigned int clusterIndex = 0; + unsigned int nClustersOnLayer = 0; float delta_c; // critical distance if( layer<=lastLayerEE ) delta_c = vecDeltas[0]; else if( layer<=lastLayerFH ) delta_c = vecDeltas[1]; @@ -321,18 +324,18 @@ int HGCalImagingAlgo::findAndAssignClusters(std::vector &nd, KDTree &lp, continue; - nd[ds[i]].data.clusterIndex = clusterIndex; + nd[ds[i]].data.clusterIndex = nClustersOnLayer; if (verbosity < pINFO) { - std::cout << "Adding new cluster with index " << clusterIndex << std::endl; + std::cout << "Adding new cluster with index " << nClustersOnLayer << std::endl; std::cout << "Cluster center is hit " << ds[i] << std::endl; } - clusterIndex++; + nClustersOnLayer++; } - //at this point clusterIndex is equal to the number of cluster centers - if it is zero we are + //at this point nClustersOnLayer is equal to the number of cluster centers - if it is zero we are //done - if(clusterIndex==0) return clusterIndex; + if(nClustersOnLayer==0) return nClustersOnLayer; //assign remaining points to clusters, using the nearestHigher set from previous step (always set except // for top density hit that is skipped...) @@ -348,13 +351,13 @@ int HGCalImagingAlgo::findAndAssignClusters(std::vector &nd, KDTree &lp, // from this layer if (verbosity < pINFO) { - std::cout << "resizing cluster vector by "<< clusterIndex << std::endl; + std::cout << "resizing cluster vector by "<< nClustersOnLayer << std::endl; } - clustersOnLayer.resize(clusterIndex); + clustersOnLayer.resize(nClustersOnLayer); //assign points closer than dc to other clusters to border region //and find critical border density - std::vector rho_b(clusterIndex,0.); + std::vector rho_b(nClustersOnLayer,0.); lp.clear(); lp.build(nd,bounds); //now loop on all hits again :( and check: if there are hits from another cluster within d_c -> flag as border hit @@ -409,9 +412,9 @@ int HGCalImagingAlgo::findAndAssignClusters(std::vector &nd, KDTree &lp, //prepare the offset for the next layer if there is one if (verbosity < pINFO) { - std::cout << "moving cluster offset by " << clusterIndex << std::endl; + std::cout << "moving cluster offset by " << nClustersOnLayer << std::endl; } - return clusterIndex; + return nClustersOnLayer; } From 3316f9b5378188c3e8c2a573483f23eb84190127 Mon Sep 17 00:00:00 2001 From: nminafra Date: Tue, 27 Mar 2018 16:08:18 +0200 Subject: [PATCH 237/426] Cleanup and bugfixing --- .../xml/mapping_totem_timing_2018.xml | 128 ++++++++++++++++-- .../CTPPSDigi/interface/TotemTimingDigi.h | 2 +- .../interface/TotemTimingEventInfo.h | 2 +- .../interface/TotemSampicFrame.h | 5 +- .../python/ctppsRawToDigi_cff.py | 2 +- .../CTPPSRawToDigi/src/RawToDigiConverter.cc | 35 ++--- 6 files changed, 140 insertions(+), 34 deletions(-) diff --git a/CondFormats/CTPPSReadoutObjects/xml/mapping_totem_timing_2018.xml b/CondFormats/CTPPSReadoutObjects/xml/mapping_totem_timing_2018.xml index ed3459e75e0e7..cd9b34da40b6c 100644 --- a/CondFormats/CTPPSReadoutObjects/xml/mapping_totem_timing_2018.xml +++ b/CondFormats/CTPPSReadoutObjects/xml/mapping_totem_timing_2018.xml @@ -14,7 +14,7 @@ - . + @@ -28,7 +28,7 @@ - . + @@ -42,7 +42,7 @@ - . + @@ -56,8 +56,64 @@ - . + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -182,7 +238,7 @@ - . + @@ -196,7 +252,7 @@ - . + @@ -210,7 +266,7 @@ - . + @@ -224,8 +280,64 @@ - . + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h b/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h index 06fe5b3c9190e..23d5ab5059b9a 100644 --- a/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h +++ b/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h @@ -144,7 +144,7 @@ class TotemTimingDigi{ inline void setCellInfo(const uint16_t CellInfo) { - CellInfo_ = CellInfo; + CellInfo_ = CellInfo & 0x3F; } inline void setSamples(const std::vector< uint8_t >& samples) diff --git a/DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h b/DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h index 24ed2db5ef985..3ffb8279a6700 100644 --- a/DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h +++ b/DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h @@ -63,7 +63,7 @@ class TotemTimingEventInfo{ inline unsigned int getEventNumber() const { - return orbitNumber_; + return eventNumber_; } inline uint16_t getChannelMap() const diff --git a/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h b/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h index 2a6e9630a71ba..700284f615874 100644 --- a/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h +++ b/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h @@ -119,7 +119,6 @@ class TotemSampicFrame void Print() const { - std::bitset<16> bitsCellInfo( getCellInfo() ); std::bitset<16> bitsChannelMap( getChannelMap() ); std::cout << "TotemSampicFrame:\nEvent:" << "\nHardwareId (Event):\t" << std::hex << (unsigned int) getEventHardwareId() @@ -136,7 +135,7 @@ class TotemSampicFrame << "\nFPGATimeStamp:\t" << std::dec << getFPGATimeStamp() << "\nTimeStampA:\t" << std::dec << getTimeStampA() << "\nTimeStampA:\t" << std::dec << getTimeStampA() - << "\nCellInfo:\t" << bitsCellInfo.to_string() + << "\nCellInfo:\t" << std::dec << getCellInfo() << "\nPlane:\t" << std::dec << getDetPlane() << "\nChannel:\t" << std::dec << getDetChannel() << std::endl << std::endl; @@ -168,7 +167,7 @@ class TotemSampicFrame inline uint16_t getCellInfo() const { - return status_ * TotemSampicInfo_->CellInfo; + return status_ * (TotemSampicInfo_->CellInfo & 0x3F); } inline int getDetPlane() const diff --git a/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py b/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py index 73ce73fb2f849..b3e06f147b9ed 100644 --- a/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py +++ b/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py @@ -85,7 +85,7 @@ # ---------- Totem Timing ---------- totemDAQMappingESSourceXML_TotemTiming = cms.ESSource("TotemDAQMappingESSourceXML", - verbosity = cms.untracked.uint32(0), + verbosity = cms.untracked.uint32(10), subSystem = cms.untracked.string("TotemTiming"), configuration = cms.VPSet( # 2017, before detector inserted in DAQ diff --git a/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc b/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc index 2d41a91bc9c78..d0f779d7cddb1 100644 --- a/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc +++ b/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc @@ -323,24 +323,18 @@ void RawToDigiConverter::Run(const VFATFrameCollection &coll, const TotemDAQMapp TotemFramePosition frameposdata(framepos->getSubSystemId(),framepos->getTOTFEDId(),framepos->getOptoRxId(),framepos->getGOHId(),(framepos->getIdxInFiber()+1)); TotemFramePosition frameposEvtInfo(framepos->getSubSystemId(),framepos->getTOTFEDId(),framepos->getOptoRxId(),framepos->getGOHId(),0xe); - -// std::cout<< "Framing: GOH " << framepos->getGOHId()<< " Idx " << framepos->getIdxInFiber() << " Ch Info" << std::endl; -// record.frame->Print(); auto channelwaveformPtr = records.find(frameposdata); auto eventInfoPtr = records.find(frameposEvtInfo); - if ( channelwaveformPtr != records.end() && eventInfoPtr != records.end() ) { + if ( channelwaveformPtr != records.end() && eventInfoPtr != records.end() ) + { Record &channelwaveform = records[frameposdata]; - // std::cout<< "Ch Data" << std::endl; - // channelwaveform.frame->Print(); Record &eventInfo = records[frameposEvtInfo]; - // std::cout<< "Event Info" << std::endl; - // eventInfo.frame->Print(); + // Extract all the waveform information from the raw data TotemSampicFrame totemSampicFrame((uint8_t*) record.frame->getData(), (uint8_t*) channelwaveform.frame->getData(), (uint8_t*) eventInfo.frame->getData()); -// totemSampicFrame.PrintRaw(); // if (totemSampicFrame.isOK()) totemSampicFrame.Print(); if (totemSampicFrame.isOK()) @@ -351,31 +345,32 @@ void RawToDigiConverter::Run(const VFATFrameCollection &coll, const TotemDAQMapp // calculate ids TotemTimingDetId detId(record.info->symbolicID.symbolicID); - if ( totemSampicFrame.getFWVersion() == 0 ) { -// detId.setPlane( digiTmp.getHardwareSampicId() % 4 ); -// detId.setChannel( digiTmp.getHardwareChannelId() ); + // for FW Version > 0 plane and channel are encoded in the dataframe + if ( totemSampicFrame.getFWVersion() == 0 ) + { const TotemDAQMapping::TotemTimingPlaneChannelPair pair = mapping.getTimingChannel( totemSampicFrame.getHardwareId() ); -// std::cout << "RawToDigi: adding plane: " << std::dec << pair.plane << " ch: " << pair.channel << " hwId: " << std::hex << (unsigned int) totemSampicFrame.getHardwareId() << std::endl; - if ( pair.plane == -1 || pair.channel == -1 ) { - if (verbosity > 1) + if ( pair.plane == -1 || pair.channel == -1 ) + { + if (verbosity>0) LogWarning("Totem") << "Error in RawToDigiConverter::TotemTiming > " << "HwId not recognized! hwId: " << std::hex << (unsigned int) totemSampicFrame.getHardwareId() << endl; + std::cout << digiTmp << std::endl; } - else { + else + { detId.setPlane( pair.plane ); detId.setChannel( pair.channel ); } } - else { + else + { detId.setPlane( totemSampicFrame.getDetPlane() % 4 ); detId.setChannel( totemSampicFrame.getDetChannel() % 32 ); } - - std::cout << digiTmp << std::endl; - + DetSet &digiDetSet = digi.find_or_insert(detId); digiDetSet.push_back(digiTmp); } From e9e1c01e47bedf97b7b8dd21a8334107f2eccdd1 Mon Sep 17 00:00:00 2001 From: Felice Date: Tue, 27 Mar 2018 17:56:21 +0200 Subject: [PATCH 238/426] allow parallelization without serialization of the output --- .../interface/HGCalImagingAlgo.h | 5 ++- .../HGCalRecAlgos/src/HGCalImagingAlgo.cc | 36 +++++++------------ 2 files changed, 15 insertions(+), 26 deletions(-) diff --git a/RecoLocalCalo/HGCalRecAlgos/interface/HGCalImagingAlgo.h b/RecoLocalCalo/HGCalRecAlgos/interface/HGCalImagingAlgo.h index 58d6713eb8b72..a69a13c335036 100644 --- a/RecoLocalCalo/HGCalRecAlgos/interface/HGCalImagingAlgo.h +++ b/RecoLocalCalo/HGCalRecAlgos/interface/HGCalImagingAlgo.h @@ -138,8 +138,8 @@ void getEventSetup(const edm::EventSetup& es){ } // use this if you want to reuse the same cluster object but don't want to accumulate clusters (hardly useful?) void reset(){ - current_v.clear(); clusters_v.clear(); + layerClustersPerLayer.clear(); for( auto& it: points) { it.clear(); @@ -254,8 +254,7 @@ typedef KDTreeLinkerAlgo KDTree; typedef KDTreeNodeInfoT KDNode; -// A vector of vectors of KDNodes holding an Hexel in the clusters - to be used to build CaloClusters of DetIds -tbb::concurrent_vector< std::vector > current_v; +std::vector > > layerClustersPerLayer; std::vector sort_by_delta(const std::vector &v) const { std::vector idx(v.size()); diff --git a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc index 874ed593f32e2..cb1e4eb527e5e 100644 --- a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc +++ b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc @@ -9,8 +9,6 @@ #include "RecoEcal/EgammaCoreTools/interface/PositionCalc.h" // #include "DataFormats/CaloRecHit/interface/CaloID.h" -#include "FWCore/Concurrency/interface/SerialTaskQueue.h" - #include "tbb/tbb.h" #include "tbb/task_arena.h" @@ -73,8 +71,7 @@ void HGCalImagingAlgo::populate(const HGCRecHitCollection& hits){ // with different input (reset should be called between events) void HGCalImagingAlgo::makeClusters() { - std::vector > > layerClustersPerLayer(2*(maxlayer+2)); - edm::SerialTaskQueue layersQueue; + layerClustersPerLayer.resize(2*maxlayer+2); //assign all hits in each layer to a cluster core or halo tbb::this_task_arena::isolate( [&]{ tbb::parallel_for(size_t(0), size_t(2*maxlayer+2), [&](size_t i) { @@ -89,15 +86,6 @@ void HGCalImagingAlgo::makeClusters() // calculate distance to nearest point with higher density storing distance (delta) and point's index calculateDistanceToHigher(points[i]); findAndAssignClusters(points[i],hit_kdtree,maxdensity,bounds,actualLayer, layerClustersPerLayer[i]); - size_t nClusters = layerClustersPerLayer[i].size(); - layersQueue.pushAndWait( [&]{ - current_v.reserve(current_v.size()+nClusters); - for(size_t j=0; j HGCalImagingAlgo::getClusters(bool doSharing){ reco::CaloID caloID = reco::CaloID::DET_HGCAL_ENDCAP; std::vector< std::pair > thisCluster; - for (unsigned int i = 0; i < current_v.size(); ++i){ + for(auto& clsOnLayer : layerClustersPerLayer) + { + for (unsigned int i = 0; i < clsOnLayer.size(); ++i){ double energy = 0; Point position; if( doSharing ) { - std::vector seeds = findLocalMaximaInCluster(current_v[i]); + std::vector seeds = findLocalMaximaInCluster(clsOnLayer[i]); // sharing found seeds.size() sub-cluster seeds in cluster i std::vector > fractions; // first pass can have noise it in - shareEnergy(current_v[i],seeds,fractions); + shareEnergy(clsOnLayer[i],seeds,fractions); // reset and run second pass after vetoing seeds // that result in trivial clusters (less than 2 effective cells) @@ -125,14 +115,14 @@ std::vector HGCalImagingAlgo::getClusters(bool doSharing){ for( unsigned isub = 0; isub < fractions.size(); ++isub ) { double effective_hits = 0.0; - double energy = calculateEnergyWithFraction(current_v[i],fractions[isub]); - Point position = calculatePositionWithFraction(current_v[i],fractions[isub]); + double energy = calculateEnergyWithFraction(clsOnLayer[i],fractions[isub]); + Point position = calculatePositionWithFraction(clsOnLayer[i],fractions[isub]); for( unsigned ihit = 0; ihit < fractions[isub].size(); ++ihit ) { const double fraction = fractions[isub][ihit]; if( fraction > 1e-7 ) { effective_hits += fraction; - thisCluster.emplace_back(current_v[i][ihit].data.detid,fraction); + thisCluster.emplace_back(clsOnLayer[i][ihit].data.detid,fraction); } } @@ -149,9 +139,9 @@ std::vector HGCalImagingAlgo::getClusters(bool doSharing){ thisCluster.clear(); } }else{ - position = calculatePosition(current_v[i]); // energy-weighted position + position = calculatePosition(clsOnLayer[i]); // energy-weighted position // std::vector< KDNode >::iterator it; - for (auto& it: current_v[i]) + for (auto& it: clsOnLayer[i]) { energy += it.data.isHalo ? 0. : it.data.weight; // use fraction to store whether this is a Halo hit or not @@ -161,7 +151,7 @@ std::vector HGCalImagingAlgo::getClusters(bool doSharing){ { std::cout << "******** NEW CLUSTER (HGCIA) ********" << std::endl; std::cout << "Index " << i << std::endl; - std::cout << "No. of cells = " << current_v[i].size() << std::endl; + std::cout << "No. of cells = " << clsOnLayer[i].size() << std::endl; std::cout << " Energy = " << energy << std::endl; std::cout << " Phi = " << position.phi() << std::endl; std::cout << " Eta = " << position.eta() << std::endl; @@ -171,7 +161,7 @@ std::vector HGCalImagingAlgo::getClusters(bool doSharing){ thisCluster.clear(); } } - std::cout << "found clusters: "<< clusters_v.size() << std::endl; +} return clusters_v; } From 4a4de46f104e5240ed02977bf2526175a894ed43 Mon Sep 17 00:00:00 2001 From: Felice Date: Tue, 27 Mar 2018 17:57:55 +0200 Subject: [PATCH 239/426] fixing indentation --- .../HGCalRecAlgos/src/HGCalImagingAlgo.cc | 330 +++++++++--------- 1 file changed, 169 insertions(+), 161 deletions(-) diff --git a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc index cb1e4eb527e5e..d8db13234d52c 100644 --- a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc +++ b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc @@ -69,99 +69,107 @@ void HGCalImagingAlgo::populate(const HGCRecHitCollection& hits){ // Create a vector of Hexels associated to one cluster from a collection of HGCalRecHits - this can be used // directly to make the final cluster list - this method can be invoked multiple times for the same event // with different input (reset should be called between events) -void HGCalImagingAlgo::makeClusters() -{ - layerClustersPerLayer.resize(2*maxlayer+2); - //assign all hits in each layer to a cluster core or halo - tbb::this_task_arena::isolate( [&]{ - tbb::parallel_for(size_t(0), size_t(2*maxlayer+2), [&](size_t i) { - KDTreeBox bounds(minpos[i][0],maxpos[i][0], - minpos[i][1],maxpos[i][1]); - KDTree hit_kdtree; - hit_kdtree.build(points[i], bounds); - - unsigned int actualLayer = i > maxlayer ? (i-(maxlayer+1)) : i; // maps back from index used for KD trees to actual layer - - double maxdensity = calculateLocalDensity(points[i],hit_kdtree, actualLayer); // also stores rho (energy density) for each point (node) - // calculate distance to nearest point with higher density storing distance (delta) and point's index - calculateDistanceToHigher(points[i]); - findAndAssignClusters(points[i],hit_kdtree,maxdensity,bounds,actualLayer, layerClustersPerLayer[i]); - }); +void HGCalImagingAlgo::makeClusters() { + layerClustersPerLayer.resize(2 * maxlayer + 2); + // assign all hits in each layer to a cluster core or halo + tbb::this_task_arena::isolate([&] { + tbb::parallel_for(size_t(0), size_t(2 * maxlayer + 2), [&](size_t i) { + KDTreeBox bounds(minpos[i][0], maxpos[i][0], minpos[i][1], maxpos[i][1]); + KDTree hit_kdtree; + hit_kdtree.build(points[i], bounds); + + unsigned int actualLayer = + i > maxlayer + ? (i - (maxlayer + 1)) + : i; // maps back from index used for KD trees to actual layer + + double maxdensity = calculateLocalDensity( + points[i], hit_kdtree, actualLayer); // also stores rho (energy + // density) for each point (node) + // calculate distance to nearest point with higher density storing + // distance (delta) and point's index + calculateDistanceToHigher(points[i]); + findAndAssignClusters(points[i], hit_kdtree, maxdensity, bounds, + actualLayer, layerClustersPerLayer[i]); }); + }); } -std::vector HGCalImagingAlgo::getClusters(bool doSharing){ +std::vector HGCalImagingAlgo::getClusters(bool doSharing) { reco::CaloID caloID = reco::CaloID::DET_HGCAL_ENDCAP; - std::vector< std::pair > thisCluster; - for(auto& clsOnLayer : layerClustersPerLayer) - { - for (unsigned int i = 0; i < clsOnLayer.size(); ++i){ - double energy = 0; - Point position; - - if( doSharing ) { - - std::vector seeds = findLocalMaximaInCluster(clsOnLayer[i]); - // sharing found seeds.size() sub-cluster seeds in cluster i - - std::vector > fractions; - // first pass can have noise it in - shareEnergy(clsOnLayer[i],seeds,fractions); - - // reset and run second pass after vetoing seeds - // that result in trivial clusters (less than 2 effective cells) - - - for( unsigned isub = 0; isub < fractions.size(); ++isub ) { - double effective_hits = 0.0; - double energy = calculateEnergyWithFraction(clsOnLayer[i],fractions[isub]); - Point position = calculatePositionWithFraction(clsOnLayer[i],fractions[isub]); - - for( unsigned ihit = 0; ihit < fractions[isub].size(); ++ihit ) { - const double fraction = fractions[isub][ihit]; - if( fraction > 1e-7 ) { - effective_hits += fraction; - thisCluster.emplace_back(clsOnLayer[i][ihit].data.detid,fraction); - } - } - - if (verbosity < pINFO) - { - std::cout << "\t******** NEW CLUSTER (SHARING) ********" << std::endl; - std::cout << "\tEff. No. of cells = " << effective_hits << std::endl; - std::cout << "\t Energy = " << energy << std::endl; - std::cout << "\t Phi = " << position.phi() << std::endl; - std::cout << "\t Eta = " << position.eta() << std::endl; - std::cout << "\t*****************************" << std::endl; - } - clusters_v.emplace_back(energy, position, caloID, thisCluster,algoId); - thisCluster.clear(); + std::vector> thisCluster; + for (auto &clsOnLayer : layerClustersPerLayer) { + for (unsigned int i = 0; i < clsOnLayer.size(); ++i) { + double energy = 0; + Point position; + + if (doSharing) { + + std::vector seeds = findLocalMaximaInCluster(clsOnLayer[i]); + // sharing found seeds.size() sub-cluster seeds in cluster i + + std::vector> fractions; + // first pass can have noise it in + shareEnergy(clsOnLayer[i], seeds, fractions); + + // reset and run second pass after vetoing seeds + // that result in trivial clusters (less than 2 effective cells) + + for (unsigned isub = 0; isub < fractions.size(); ++isub) { + double effective_hits = 0.0; + double energy = + calculateEnergyWithFraction(clsOnLayer[i], fractions[isub]); + Point position = + calculatePositionWithFraction(clsOnLayer[i], fractions[isub]); + + for (unsigned ihit = 0; ihit < fractions[isub].size(); ++ihit) { + const double fraction = fractions[isub][ihit]; + if (fraction > 1e-7) { + effective_hits += fraction; + thisCluster.emplace_back(clsOnLayer[i][ihit].data.detid, + fraction); + } + } + + if (verbosity < pINFO) { + std::cout << "\t******** NEW CLUSTER (SHARING) ********" + << std::endl; + std::cout << "\tEff. No. of cells = " << effective_hits + << std::endl; + std::cout << "\t Energy = " << energy << std::endl; + std::cout << "\t Phi = " << position.phi() + << std::endl; + std::cout << "\t Eta = " << position.eta() + << std::endl; + std::cout << "\t*****************************" << std::endl; + } + clusters_v.emplace_back(energy, position, caloID, thisCluster, + algoId); + thisCluster.clear(); + } + } else { + position = calculatePosition(clsOnLayer[i]); // energy-weighted position + // std::vector< KDNode >::iterator it; + for (auto &it : clsOnLayer[i]) { + energy += it.data.isHalo ? 0. : it.data.weight; + // use fraction to store whether this is a Halo hit or not + thisCluster.emplace_back(it.data.detid, (it.data.isHalo ? 0.f : 1.f)); + }; + if (verbosity < pINFO) { + std::cout << "******** NEW CLUSTER (HGCIA) ********" << std::endl; + std::cout << "Index " << i << std::endl; + std::cout << "No. of cells = " << clsOnLayer[i].size() << std::endl; + std::cout << " Energy = " << energy << std::endl; + std::cout << " Phi = " << position.phi() << std::endl; + std::cout << " Eta = " << position.eta() << std::endl; + std::cout << "*****************************" << std::endl; + } + clusters_v.emplace_back(energy, position, caloID, thisCluster, algoId); + thisCluster.clear(); } - }else{ - position = calculatePosition(clsOnLayer[i]); // energy-weighted position - // std::vector< KDNode >::iterator it; - for (auto& it: clsOnLayer[i]) - { - energy += it.data.isHalo ? 0. : it.data.weight; - // use fraction to store whether this is a Halo hit or not - thisCluster.emplace_back(it.data.detid,(it.data.isHalo ? 0.f : 1.f)); - }; - if (verbosity < pINFO) - { - std::cout << "******** NEW CLUSTER (HGCIA) ********" << std::endl; - std::cout << "Index " << i << std::endl; - std::cout << "No. of cells = " << clsOnLayer[i].size() << std::endl; - std::cout << " Energy = " << energy << std::endl; - std::cout << " Phi = " << position.phi() << std::endl; - std::cout << " Eta = " << position.eta() << std::endl; - std::cout << "*****************************" << std::endl; - } - clusters_v.emplace_back(energy, position, caloID, thisCluster, algoId); - thisCluster.clear(); } } -} return clusters_v; } @@ -198,8 +206,8 @@ math::XYZPoint HGCalImagingAlgo::calculatePosition(std::vector &v) const if (total_weight != 0) { auto inv_tot_weight = 1./total_weight; return math::XYZPoint( x*inv_tot_weight, - y*inv_tot_weight, - z*inv_tot_weight); + y*inv_tot_weight, + z*inv_tot_weight); } } else if (v_size > 0) { @@ -221,13 +229,13 @@ double HGCalImagingAlgo::calculateLocalDensity(std::vector &nd, KDTree & for(unsigned int i = 0; i < nd.size(); ++i){ // speec up search by looking within +/- delta_c window only KDTreeBox search_box(nd[i].dims[0]-delta_c,nd[i].dims[0]+delta_c, - nd[i].dims[1]-delta_c,nd[i].dims[1]+delta_c); + nd[i].dims[1]-delta_c,nd[i].dims[1]+delta_c); std::vector found; lp.search(search_box,found); const unsigned int found_size = found.size(); for(unsigned int j = 0; j < found_size; j++){ if(distance(nd[i].data,found[j].data) < delta_c){ - nd[i].data.rho += found[j].data.weight; + nd[i].data.rho += found[j].data.weight; maxdensity = std::max(maxdensity, nd[i].data.rho); } } // end loop found @@ -276,8 +284,8 @@ double HGCalImagingAlgo::calculateDistanceToHigher(std::vector &nd) cons unsigned int j = rs[oj]; double tmp = distance2(nd[i].data, nd[j].data); if(tmp <= dist2){ //this "<=" instead of "<" addresses the (rare) case when there are only two hits - dist2 = tmp; - nearestHigher = j; + dist2 = tmp; + nearestHigher = j; } } nd[i].data.delta = std::sqrt(dist2); @@ -317,8 +325,8 @@ int HGCalImagingAlgo::findAndAssignClusters(std::vector &nd, KDTree &lp, nd[ds[i]].data.clusterIndex = nClustersOnLayer; if (verbosity < pINFO) { - std::cout << "Adding new cluster with index " << nClustersOnLayer << std::endl; - std::cout << "Cluster center is hit " << ds[i] << std::endl; + std::cout << "Adding new cluster with index " << nClustersOnLayer << std::endl; + std::cout << "Cluster center is hit " << ds[i] << std::endl; } nClustersOnLayer++; } @@ -356,28 +364,28 @@ int HGCalImagingAlgo::findAndAssignClusters(std::vector &nd, KDTree &lp, bool flag_isolated = true; if(ci != -1){ KDTreeBox search_box(nd[i].dims[0]-delta_c,nd[i].dims[0]+delta_c, - nd[i].dims[1]-delta_c,nd[i].dims[1]+delta_c); + nd[i].dims[1]-delta_c,nd[i].dims[1]+delta_c); std::vector found; lp.search(search_box,found); const unsigned int found_size = found.size(); for(unsigned int j = 0; j < found_size; j++){ // start from 0 here instead of 1 - //check if the hit is not within d_c of another cluster - if(found[j].data.clusterIndex!=-1){ - float dist = distance(found[j].data,nd[i].data); - if(dist < delta_c && found[j].data.clusterIndex!=ci){ - //in which case we assign it to the border - nd[i].data.isBorder = true; - break; - } - //because we are using two different containers, we have to make sure that we don't unflag the - // hit when it finds *itself* closer than delta_c - if(dist < delta_c && dist != 0. && found[j].data.clusterIndex==ci){ - // in this case it is not an isolated hit + //check if the hit is not within d_c of another cluster + if(found[j].data.clusterIndex!=-1){ + float dist = distance(found[j].data,nd[i].data); + if(dist < delta_c && found[j].data.clusterIndex!=ci){ + //in which case we assign it to the border + nd[i].data.isBorder = true; + break; + } + //because we are using two different containers, we have to make sure that we don't unflag the + // hit when it finds *itself* closer than delta_c + if(dist < delta_c && dist != 0. && found[j].data.clusterIndex==ci){ + // in this case it is not an isolated hit // the dist!=0 is because the hit being looked at is also inside the search box and at dist==0 - flag_isolated = false; - } - } + flag_isolated = false; + } + } } if(flag_isolated) nd[i].data.isBorder = true; //the hit is more than delta_c from any of its brethren } @@ -393,9 +401,9 @@ int HGCalImagingAlgo::findAndAssignClusters(std::vector &nd, KDTree &lp, if (nd[i].data.rho <= rho_b[ci]) nd[i].data.isHalo = true; clustersOnLayer[ci].push_back(nd[i]); if (verbosity < pINFO) - { - std::cout << "Pushing hit " << i << " into cluster with index " << ci << std::endl; - } + { + std::cout << "Pushing hit " << i << " into cluster with index " << ci << std::endl; + } } } @@ -417,10 +425,10 @@ std::vector HGCalImagingAlgo::findLocalMaximaInCluster(const std::vect for( unsigned i = 0; i < cluster.size(); ++i ) { for( unsigned j = 0; j < cluster.size(); ++j ) { if( i != j and distance(cluster[i].data,cluster[j].data) < delta_c ) { - if( cluster[i].data.weight < cluster[j].data.weight ) { - seed[i] = false; - break; - } + if( cluster[i].data.weight < cluster[j].data.weight ) { + seed[i] = false; + break; + } } } } @@ -438,7 +446,7 @@ std::vector HGCalImagingAlgo::findLocalMaximaInCluster(const std::vect } math::XYZPoint HGCalImagingAlgo::calculatePositionWithFraction(const std::vector& hits, - const std::vector& fractions) { + const std::vector& fractions) { double norm(0.0), x(0.0), y(0.0), z(0.0); for( unsigned i = 0; i < hits.size(); ++i ) { const double weight = fractions[i]*hits[i].data.weight; @@ -453,7 +461,7 @@ math::XYZPoint HGCalImagingAlgo::calculatePositionWithFraction(const std::vector } double HGCalImagingAlgo::calculateEnergyWithFraction(const std::vector& hits, - const std::vector& fractions) { + const std::vector& fractions) { double result = 0.0; for( unsigned i = 0 ; i < hits.size(); ++i ) { result += fractions[i]*hits[i].data.weight; @@ -462,8 +470,8 @@ double HGCalImagingAlgo::calculateEnergyWithFraction(const std::vector& } void HGCalImagingAlgo::shareEnergy(const std::vector& incluster, - const std::vector& seeds, - std::vector >& outclusters) { + const std::vector& seeds, + std::vector >& outclusters) { std::vector isaseed(incluster.size(),false); outclusters.clear(); outclusters.resize(seeds.size()); @@ -491,9 +499,9 @@ void HGCalImagingAlgo::shareEnergy(const std::vector& incluster, outclusters[i].resize(incluster.size(),0.0); for( unsigned j = 0; j < incluster.size(); ++j ) { if( j == seeds[i] ) { - outclusters[i][j] = 1.0; - centroids[i] = math::XYZPoint(incluster[j].data.x,incluster[j].data.y,incluster[j].data.z); - energies[i] = incluster[j].data.weight; + outclusters[i][j] = 1.0; + centroids[i] = math::XYZPoint(incluster[j].data.x,incluster[j].data.y,incluster[j].data.z); + energies[i] = incluster[j].data.weight; } } } @@ -513,31 +521,31 @@ void HGCalImagingAlgo::shareEnergy(const std::vector& incluster, const Hexel& ihit = incluster[i].data; double fracTot(0.0); for( unsigned j = 0; j < numberOfSeeds; ++j ) { - double fraction = 0.0; - double d2 = ( std::pow(ihit.x - centroids[j].x(),2.0) + - std::pow(ihit.y - centroids[j].y(),2.0) + - std::pow(ihit.z - centroids[j].z(),2.0) )/sigma2; - dist2[j] = d2; - // now we set the fractions up based on hit type - if( i == seeds[j] ) { // this cluster's seed - fraction = 1.0; - } else if( isaseed[i] ) { - fraction = 0.0; - } else { - fraction = energies[j]*std::exp( -0.5*d2 ); - } - fracTot += fraction; - frac[j] = fraction; + double fraction = 0.0; + double d2 = ( std::pow(ihit.x - centroids[j].x(),2.0) + + std::pow(ihit.y - centroids[j].y(),2.0) + + std::pow(ihit.z - centroids[j].z(),2.0) )/sigma2; + dist2[j] = d2; + // now we set the fractions up based on hit type + if( i == seeds[j] ) { // this cluster's seed + fraction = 1.0; + } else if( isaseed[i] ) { + fraction = 0.0; + } else { + fraction = energies[j]*std::exp( -0.5*d2 ); + } + fracTot += fraction; + frac[j] = fraction; } // now that we have calculated all fractions for all hits // assign the new fractions for( unsigned j = 0; j < numberOfSeeds; ++j ) { - if( fracTot > minFracTot || - ( i == seeds[j] && fracTot > 0.0 ) ) { - outclusters[j][i] = frac[j]/fracTot; - } else { - outclusters[j][i] = 0.0; - } + if( fracTot > minFracTot || + ( i == seeds[j] && fracTot > 0.0 ) ) { + outclusters[j][i] = frac[j]/fracTot; + } else { + outclusters[j][i] = 0.0; + } } } @@ -575,23 +583,23 @@ void HGCalImagingAlgo::computeThreshold() { const std::vector& listDetId( icalo==0 ? listee : listfh); for(auto& detid: listDetId) - { - int wafer = rhtools_.getWafer(detid); - if(wafer==previouswafer) continue; - previouswafer = wafer; - // no need to do it twice - if(rhtools_.zside(detid)<0) continue; - int layer = rhtools_.getLayerWithOffset(detid); - float thickness = rhtools_.getSiThickness(detid); - int thickIndex = -1; - if( thickness>99. && thickness<101.) thickIndex=0; - else if( thickness>199. && thickness<201. ) thickIndex=1; - else if( thickness>299. && thickness<301. ) thickIndex=2; - else assert( thickIndex>0 && "ERROR - silicon thickness has a nonsensical value" ); - float sigmaNoise = 0.001f * fcPerEle * nonAgedNoises[thickIndex] * dEdXweights[layer] / (fcPerMip[thickIndex] * thicknessCorrection[thickIndex]); - thresholds[layer-1][wafer]=sigmaNoise*ecut; - v_sigmaNoise[layer-1][wafer] = sigmaNoise; - } + { + int wafer = rhtools_.getWafer(detid); + if(wafer==previouswafer) continue; + previouswafer = wafer; + // no need to do it twice + if(rhtools_.zside(detid)<0) continue; + int layer = rhtools_.getLayerWithOffset(detid); + float thickness = rhtools_.getSiThickness(detid); + int thickIndex = -1; + if( thickness>99. && thickness<101.) thickIndex=0; + else if( thickness>199. && thickness<201. ) thickIndex=1; + else if( thickness>299. && thickness<301. ) thickIndex=2; + else assert( thickIndex>0 && "ERROR - silicon thickness has a nonsensical value" ); + float sigmaNoise = 0.001f * fcPerEle * nonAgedNoises[thickIndex] * dEdXweights[layer] / (fcPerMip[thickIndex] * thicknessCorrection[thickIndex]); + thresholds[layer-1][wafer]=sigmaNoise*ecut; + v_sigmaNoise[layer-1][wafer] = sigmaNoise; + } } // now BH, much faster From d9b185e763759eeea53e9d415a95e280980a6496 Mon Sep 17 00:00:00 2001 From: nminafra Date: Tue, 27 Mar 2018 18:11:10 +0200 Subject: [PATCH 240/426] Add PLLInfo --- .../CTPPSDigi/interface/TotemTimingEventInfo.h | 15 +++++++++++++++ DataFormats/CTPPSDigi/src/classes_def.xml | 2 +- .../CTPPSRawToDigi/interface/TotemSampicFrame.h | 9 ++++++++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h b/DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h index 3ffb8279a6700..003753b5570ff 100644 --- a/DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h +++ b/DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h @@ -11,6 +11,8 @@ */ #include +#include + class TotemTimingEventInfo{ @@ -86,6 +88,11 @@ class TotemTimingEventInfo{ return offsetOfSamples_; } + inline uint8_t getPLLInfo() const + { + return PLLInfo_; + } + /// Set digi values @@ -153,6 +160,11 @@ class TotemTimingEventInfo{ offsetOfSamples_ = offsetOfSamples; } + inline void setPLLInfo(const uint8_t PLLInfo) + { + PLLInfo_ = PLLInfo; + } + @@ -168,6 +180,7 @@ class TotemTimingEventInfo{ uint16_t L1ALatency_; uint8_t numberOfSamples_; uint8_t offsetOfSamples_; + uint8_t PLLInfo_; }; @@ -188,6 +201,7 @@ inline bool operator< (const TotemTimingEventInfo& one, const TotemTimingEventIn inline std::ostream & operator<<(std::ostream & o, const TotemTimingEventInfo& digi) { + std::bitset<16> bitsPLLInfo( digi.getPLLInfo() ); return o << "TotemTimingEventInfo:" << "\nHardwareId:\t" << std::hex << digi.getHardwareId() << "\nDB: " << std::dec << digi.getHardwareBoardId() << "\tSampic: " << digi.getHardwareSampicId() << "\tChannel: " << digi.getHardwareChannelId() @@ -199,6 +213,7 @@ inline std::ostream & operator<<(std::ostream & o, const TotemTimingEventInfo& d << "\nChannels fired:\t" << std::hex << digi.getChannelMap() << "\nNumber of Samples:\t" << std::dec << digi.getNumberOfSamples() << "\nOffset of Samples:\t" << std::dec << digi.getOffsetOfSamples() + << "\\nPLL Info:\t" << bitsPLLInfo.to_string() << std::endl; } diff --git a/DataFormats/CTPPSDigi/src/classes_def.xml b/DataFormats/CTPPSDigi/src/classes_def.xml index 5e3e311b574df..420b3ff58e573 100644 --- a/DataFormats/CTPPSDigi/src/classes_def.xml +++ b/DataFormats/CTPPSDigi/src/classes_def.xml @@ -58,7 +58,7 @@ - + diff --git a/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h b/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h index 700284f615874..e90a938089944 100644 --- a/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h +++ b/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h @@ -57,7 +57,7 @@ struct TotemSampicEventInfo{ uint8_t numberOfSamples; uint8_t offsetOfSamples; uint8_t FWVersion; - uint8_t reserved; + uint8_t PLLInfo; TotemSampicEventInfo() {}; }; @@ -120,6 +120,7 @@ class TotemSampicFrame void Print() const { std::bitset<16> bitsChannelMap( getChannelMap() ); + std::bitset<16> bitsPLLInfo( getPLLInfo() ); std::cout << "TotemSampicFrame:\nEvent:" << "\nHardwareId (Event):\t" << std::hex << (unsigned int) getEventHardwareId() << "\nL1A Time Stamp:\t" << std::dec << getL1ATimeStamp() @@ -138,6 +139,7 @@ class TotemSampicFrame << "\nCellInfo:\t" << std::dec << getCellInfo() << "\nPlane:\t" << std::dec << getDetPlane() << "\nChannel:\t" << std::dec << getDetChannel() + << "\\nPLL Info:\t" << bitsPLLInfo.to_string() << std::endl << std::endl; } @@ -180,6 +182,11 @@ class TotemSampicFrame return status_ * TotemSampicInfo_->ChannelId; } + inline int getPLLInfo() const + { + return status_ * TotemSampicEventInfo_->PLLInfo; + } + inline int getFWVersion() const { return status_ * TotemSampicEventInfo_->FWVersion; From c3cdccbb3cb57fa622cff03295b2d9115a0276c7 Mon Sep 17 00:00:00 2001 From: David Date: Tue, 27 Mar 2018 18:25:05 +0200 Subject: [PATCH 241/426] Require HE for QIE11 digis --- DQM/HcalTasks/plugins/DigiTask.cc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/DQM/HcalTasks/plugins/DigiTask.cc b/DQM/HcalTasks/plugins/DigiTask.cc index f62f483017313..3a7f18c4fd6ec 100644 --- a/DQM/HcalTasks/plugins/DigiTask.cc +++ b/DQM/HcalTasks/plugins/DigiTask.cc @@ -727,13 +727,20 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): // Explicit check on the DetIds present in the Collection HcalDetId const& did = digi.detid(); uint32_t rawid = _ehashmap.lookup(did); - if (rawid==0) - {meUnknownIds1LS->Fill(1); _unknownIdsPresent=true;continue;} + if (rawid==0) { + meUnknownIds1LS->Fill(1); + _unknownIdsPresent=true; + continue; + } HcalElectronicsId const& eid(rawid); - if (did.subdet()==HcalBarrel) // Note: since this is HE, we obviously expect did.subdet() always to be HcalEndcap, but QIE11DigiCollection may someday expand. + if (did.subdet() != HcalEndcap) { + continue; + } + if (did.subdet()==HcalBarrel) { // Note: since this is HE, we obviously expect did.subdet() always to be HcalEndcap, but QIE11DigiCollection will have HB for Run 3. rawidHBValid = did.rawId(); - else if (did.subdet()==HcalEndcap) + } else if (did.subdet()==HcalEndcap) { rawidHEValid = did.rawId(); + } CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB(_dbService, did, digi); double sumQ = hcaldqm::utilities::sumQDB(_dbService, digi_fC, did, digi, 0, digi.samples()-1); From a057106fe326f95c3773ee88ad1e4f0a9ef3ddd6 Mon Sep 17 00:00:00 2001 From: nminafra Date: Tue, 27 Mar 2018 19:42:47 +0200 Subject: [PATCH 242/426] Plane and Channel ID reduced to 4+4 bits --- DQM/CTPPS/python/ctppsDQM_cff.py | 3 +++ .../CTPPSRawToDigi/interface/TotemSampicFrame.h | 11 +++++------ EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/DQM/CTPPS/python/ctppsDQM_cff.py b/DQM/CTPPS/python/ctppsDQM_cff.py index cb6fc665ce3ab..7ee4a5b3b958e 100644 --- a/DQM/CTPPS/python/ctppsDQM_cff.py +++ b/DQM/CTPPS/python/ctppsDQM_cff.py @@ -7,11 +7,14 @@ from DQM.CTPPS.ctppsDiamondDQMSource_cfi import * +from DQM.CTPPS.totemTimingDQMSource_cfi import * + from DQM.CTPPS.ctppsPixelDQMSource_cfi import * ctppsDQM = cms.Sequence( totemDAQTriggerDQMSource + (totemRPDQMSource * totemRPDQMHarvester) + ctppsDiamondDQMSource + + totemTimingDQMSource + ctppsPixelDQMSource ) diff --git a/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h b/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h index e90a938089944..b6e4e8c358dd5 100644 --- a/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h +++ b/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h @@ -37,9 +37,8 @@ struct TotemSampicInfo{ uint16_t TimeStampA; uint16_t TimeStampB; uint16_t CellInfo; - uint8_t PlaneId; - uint8_t ChannelId; - uint16_t reserved[2]; + uint8_t PlaneChannelId; + uint8_t reserved[5]; TotemSampicInfo() {}; }; @@ -131,7 +130,7 @@ class TotemSampicFrame << "\nChannels fired:\t" << std::hex << bitsChannelMap.to_string() << "\nNumber of Samples:\t" << std::dec << getNumberOfSentSamples() << "\nOffset of Samples:\t" << std::dec << (int) getOffsetOfSamples() - << "\nFW Version:\t" << std::dec << (int) getFWVersion() + << "\nFW Version:\t" << std::hex << (int) getFWVersion() << "\nChannel:\nHardwareId:\t" << std::hex << (unsigned int) getHardwareId() << "\nFPGATimeStamp:\t" << std::dec << getFPGATimeStamp() << "\nTimeStampA:\t" << std::dec << getTimeStampA() @@ -174,12 +173,12 @@ class TotemSampicFrame inline int getDetPlane() const { - return status_ * TotemSampicInfo_->PlaneId; + return status_ * ((TotemSampicInfo_->PlaneChannelId & 0xF0)>>4); } inline int getDetChannel() const { - return status_ * TotemSampicInfo_->ChannelId; + return status_ * (TotemSampicInfo_->PlaneChannelId & 0xF0); } inline int getPLLInfo() const diff --git a/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc b/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc index d0f779d7cddb1..2e3897bda0915 100644 --- a/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc +++ b/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc @@ -368,7 +368,7 @@ void RawToDigiConverter::Run(const VFATFrameCollection &coll, const TotemDAQMapp else { detId.setPlane( totemSampicFrame.getDetPlane() % 4 ); - detId.setChannel( totemSampicFrame.getDetChannel() % 32 ); + detId.setChannel( totemSampicFrame.getDetChannel() % 16 ); } DetSet &digiDetSet = digi.find_or_insert(detId); From 60bee5878c064a36db4e69b2df3011f43f259053 Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Tue, 27 Mar 2018 21:15:42 +0200 Subject: [PATCH 243/426] CommonTools-Statistics: Fix clang warning : unsequenced modification and access to j. In file included from /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/CommonTools/Statistics/src/SequentialCombinationGenerator.cc:1: /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/CommonTools/Statistics/interface/SequentialCombinationGenerator.h:105:52: warning: unsequenced modification and access to 'j' [-Wunsequenced] for (int j=0;j class SequentialCombinationGenerator { Vecint::iterator j1=find_if(ss.begin(),ss.end(),bind2nd(std::greater(),mincnew2)); if (ss.end()-j1 < p[i]) return empty; Vecint sss(j1,ss.end()); - for (int j=0;j Date: Tue, 27 Mar 2018 21:22:39 +0200 Subject: [PATCH 244/426] RecoMuon/MuonIsolation: Fixes for these clang warnings: -Wlogical-not-parentheses -Woverloaded-virtual /build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/llvm/5.0.0-jpkldn/bin/clang++ -c -DGNU_GCC -D_GNU_SOURCE -DTBB_USE_GLIBCXX_VERSION=60300 -DBOOST_SPIRIT_THREADSAFE -DPHOENIX_THREADSAFE -DCMSSW_GIT_HASH='CMSSW_10_1_CLANG_X_2018-03-26-2300' -DPROJECT_NAME='CMSSW' -DPROJECT_VERSION='CMSSW_10_1_CLANG_X_2018-03-26-2300' -I/build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/lcg/root/6.10.09-jpkldn/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/boost/1.63.0-jpkldn/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/pcre/8.37-oenich/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/bz2lib/1.0.6/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/clhep/2.4.0.0-jpkldn/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/gsl/2.2.1/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/hepmc/2.06.07-oenich/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/libuuid/2.22.2/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/python/2.7.11-jpkldn/include/python2.7 -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/tbb/2018_U1/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/cms/vdt/0.4.0/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/xerces-c/3.1.3/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/xz/5.2.2-oenich/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/zlib-x86_64/1.2.11/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/md5/1.0.0/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/tinyxml/2.5.3-jpkldn/include -O2 -pthread -pipe -Werror=main -Werror=pointer-arith -Werror=overlength-strings -Wno-vla -Werror=overflow -std=c++1z -ftree-vectorize -Wstrict-overflow -Werror=array-bounds -Werror=type-limits -fvisibility-inlines-hidden -fno-math-errno --param vect-max-version-for-alias-checks=50 -Xassembler --compress-debug-sections -msse3 -felide-constructors -fmessage-length=0 -Wall -Wno-long-long -Wreturn-type -Wunused -Wparentheses -Wno-deprecated -Werror=return-type -Werror=missing-braces -Werror=unused-value -Werror=address -Werror=format -Werror=sign-compare -Werror=write-strings -Werror=delete-non-virtual-dtor -Werror=strict-aliasing -Werror=narrowing -Werror=uninitialized -Werror=reorder -Werror=unused-variable -Werror=conversion-null -Werror=switch -fdiagnostics-show-option -Wno-unused-local-typedefs -Wno-attributes -Wno-c99-extensions -Wno-c++11-narrowing -D__STRICT_ANSI__ -Wno-unused-private-field -Wno-unknown-pragmas -Wno-unused-command-line-argument -Wno-unknown-warning-option -ftemplate-depth=512 -Wno-error=potentially-evaluated-expression -Wno-error=unused-variable -Wno-error=unused-variable -Wno-error=unused-variable -DBOOST_DISABLE_ASSERTS -fPIC -MMD -MF tmp/slc6_amd64_gcc630/src/RecoMuon/MuonIsolation/plugins/RecoMuonMuonIsolationPlugins/CutsIsolatorWithCorrection.d /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/RecoMuon/MuonIsolation/plugins/CutsIsolatorWithCorrection.cc -o tmp/slc6_amd64_gcc630/src/RecoMuon/MuonIsolation/plugins/RecoMuonMuonIsolationPlugins/CutsIsolatorWithCorrection.o /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/RecoMuon/MuonIsolation/plugins/CaloExtractorByAssociator.cc:108:7: warning: logical not is only applied to the left hand side of this comparison [-Wlogical-not-parentheses] if (! theDepositInstanceLabels[0].compare(0,1, std::string("e")) == 0 ^ ~~ /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/RecoMuon/MuonIsolation/plugins/CaloExtractorByAssociator.cc:108:7: note: add parentheses after the '!' to evaluate the comparison first if (! theDepositInstanceLabels[0].compare(0,1, std::string("e")) == 0 ^ ( ) /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/RecoMuon/MuonIsolation/plugins/CaloExtractorByAssociator.cc:108:7: note: add parentheses around left hand side expression to silence this warning if (! theDepositInstanceLabels[0].compare(0,1, std::string("e")) == 0 ^ ( ) /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/RecoMuon/MuonIsolation/plugins/CaloExtractorByAssociator.cc:109:10: warning: logical not is only applied to the left hand side of this comparison [-Wlogical-not-parentheses] || ! theDepositInstanceLabels[1].compare(0,1, std::string("h")) == 0 ^ ~~ /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/RecoMuon/MuonIsolation/plugins/CaloExtractorByAssociator.cc:109:10: note: add parentheses after the '!' to evaluate the comparison first || ! theDepositInstanceLabels[1].compare(0,1, std::string("h")) == 0 ^ ( ) /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/RecoMuon/MuonIsolation/plugins/CaloExtractorByAssociator.cc:109:10: note: add parentheses around left hand side expression to silence this warning || ! theDepositInstanceLabels[1].compare(0,1, std::string("h")) == 0 ^ ( ) /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/RecoMuon/MuonIsolation/plugins/CaloExtractorByAssociator.cc:110:10: warning: logical not is only applied to the left hand side of this comparison [-Wlogical-not-parentheses] || ! theDepositInstanceLabels[2].compare(0,2, std::string("ho")) == 0){ ^ ~~ /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/RecoMuon/MuonIsolation/plugins/CaloExtractorByAssociator.cc:110:10: note: add parentheses after the '!' to evaluate the comparison first || ! theDepositInstanceLabels[2].compare(0,2, std::string("ho")) == 0){ ^ ( ) /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/RecoMuon/MuonIsolation/plugins/CaloExtractorByAssociator.cc:110:10: note: add parentheses around left hand side expression to silence this warning || ! theDepositInstanceLabels[2].compare(0,2, std::string("ho")) == 0){ ^ ( ) 1 warning generated. In file included from /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/RecoMuon/MuonIsolation/plugins/ExtractorFromDeposits.cc:1: /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/RecoMuon/MuonIsolation/plugins/ExtractorFromDeposits.h:29:28: warning: 'muonisolation::ExtractorFromDeposits::deposit' hides overloaded virtual functions [-Woverloaded-virtual] virtual reco::IsoDeposit deposit (const edm::Event & ev, const edm::EventSetup & evSetup, ^ /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/PhysicsTools/IsolationAlgos/interface/IsoDepositExtractor.h:44:32: note: hidden overloaded virtual function 'reco::isodeposit::IsoDepositExtractor::deposit' declared here: type mismatch at 3rd parameter ('const reco::TrackBaseRef &' (aka 'const RefToBase &') vs 'const reco::TrackRef &' (aka 'const Ref > &')) virtual reco::IsoDeposit deposit(const edm::Event & ev, const edm::EventSetup & evSetup, ^ /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/PhysicsTools/IsolationAlgos/interface/IsoDepositExtractor.h:51:32: note: hidden overloaded virtual function 'reco::isodeposit::IsoDepositExtractor::deposit' declared here: type mismatch at 3rd parameter ('const reco::Candidate &' vs 'const reco::TrackRef &' (aka 'const Ref > &')) virtual reco::IsoDeposit deposit(const edm::Event & ev, const edm::EventSetup & evSetup, ^ /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/PhysicsTools/IsolationAlgos/interface/IsoDepositExtractor.h:60:32: note: hidden overloaded virtual function 'reco::isodeposit::IsoDepositExtractor::deposit' declared here: type mismatch at 3rd parameter ('const reco::CandidateBaseRef &' (aka 'const RefToBase &') vs 'const reco::TrackRef &' (aka 'const Ref > &')) virtual reco::IsoDeposit deposit(const edm::Event & ev, const edm::EventSetup & evSetup, ^ 1 warning generated. --- RecoMuon/MuonIsolation/plugins/CaloExtractorByAssociator.cc | 6 +++--- RecoMuon/MuonIsolation/plugins/ExtractorFromDeposits.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/RecoMuon/MuonIsolation/plugins/CaloExtractorByAssociator.cc b/RecoMuon/MuonIsolation/plugins/CaloExtractorByAssociator.cc index db21c238b79e3..c210beee93eb3 100644 --- a/RecoMuon/MuonIsolation/plugins/CaloExtractorByAssociator.cc +++ b/RecoMuon/MuonIsolation/plugins/CaloExtractorByAssociator.cc @@ -105,9 +105,9 @@ std::vector CaloExtractorByAssociator::deposits( const Event & event if (theDepositInstanceLabels.size() != 3){ LogError("MuonIsolation")<<"Configuration is inconsistent: Need 3 deposit instance labels"; } - if (! theDepositInstanceLabels[0].compare(0,1, std::string("e")) == 0 - || ! theDepositInstanceLabels[1].compare(0,1, std::string("h")) == 0 - || ! theDepositInstanceLabels[2].compare(0,2, std::string("ho")) == 0){ + if (! (theDepositInstanceLabels[0].compare(0,1, std::string("e")) == 0) + || ! (theDepositInstanceLabels[1].compare(0,1, std::string("h")) == 0) + || ! (theDepositInstanceLabels[2].compare(0,2, std::string("ho")) == 0)){ LogWarning("MuonIsolation")<<"Deposit instance labels do not look like (e*, h*, ho*):" <<"proceed at your own risk. The extractor interprets lab0=from ecal; lab1=from hcal; lab2=from ho"; } diff --git a/RecoMuon/MuonIsolation/plugins/ExtractorFromDeposits.h b/RecoMuon/MuonIsolation/plugins/ExtractorFromDeposits.h index acd03f2cff1a9..fb394b668f4d0 100644 --- a/RecoMuon/MuonIsolation/plugins/ExtractorFromDeposits.h +++ b/RecoMuon/MuonIsolation/plugins/ExtractorFromDeposits.h @@ -26,6 +26,7 @@ class ExtractorFromDeposits : public reco::isodeposit::IsoDepositExtractor { const reco::TrackCollection & tracks) override; reco::IsoDeposit deposit (const edm::Event & ev, const edm::EventSetup & evSetup, const reco::Track & track) const override; + using reco::isodeposit::IsoDepositExtractor::deposit; virtual reco::IsoDeposit deposit (const edm::Event & ev, const edm::EventSetup & evSetup, const reco::TrackRef & track) const; From a907b1d7cadcbc2ca1575d81b944ff7b19c5a1b2 Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Tue, 27 Mar 2018 21:46:05 +0200 Subject: [PATCH 245/426] RecoTracker/TrackProducer: fix for clang warning -Woverloaded-virtual In file included from /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/RecoTracker/TrackProducer/plugins/SealModules.cc:3: /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/RecoTracker/TrackProducer/plugins/DAFTrackProducer.h:29:8: warning: 'DAFTrackProducer::getFromEvt' hides overloaded virtual functions [-Woverloaded-virtual] void getFromEvt(edm::Event&, edm::Handle&, reco::BeamSpot&); ^ /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/RecoTracker/TrackProducer/interface/TrackProducerBase.h:66:16: note: hidden overloaded virtual function 'TrackProducerBase::getFromEvt' declared here: type mismatch at 2nd parameter ('edm::Handle &' (aka 'Handle > &') vs 'edm::Handle &' (aka 'Handle, vector, unsigned short> > > &')) virtual void getFromEvt(edm::Event&, edm::Handle&, reco::BeamSpot&); ^ /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/RecoTracker/TrackProducer/interface/TrackProducerBase.h:68:16: note: hidden overloaded virtual function 'TrackProducerBase::getFromEvt' declared here: type mismatch at 2nd parameter ('edm::Handle &' (aka 'Handle > &') vs 'edm::Handle &' (aka 'Handle, vector, unsigned short> > > &')) virtual void getFromEvt(edm::Event&, edm::Handle&, reco::BeamSpot&); ^ --- RecoTracker/TrackProducer/plugins/DAFTrackProducer.h | 1 + 1 file changed, 1 insertion(+) diff --git a/RecoTracker/TrackProducer/plugins/DAFTrackProducer.h b/RecoTracker/TrackProducer/plugins/DAFTrackProducer.h index 1f8efb4cbde21..867415af16c46 100644 --- a/RecoTracker/TrackProducer/plugins/DAFTrackProducer.h +++ b/RecoTracker/TrackProducer/plugins/DAFTrackProducer.h @@ -26,6 +26,7 @@ class DAFTrackProducer : public KfTrackProducerBase, public edm::stream::EDProdu private: DAFTrackProducerAlgorithm theAlgo; + using TrackProducerBase::getFromEvt; void getFromEvt(edm::Event&, edm::Handle&, reco::BeamSpot&); void putInEvtTrajAnn(edm::Event& theEvent, TrajAnnealingCollection & trajannResults, std::unique_ptr& selTrajAnn); From ad57dde03e47502152f6fb8f5210d10716373e8d Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Tue, 27 Mar 2018 21:49:24 +0200 Subject: [PATCH 246/426] DataFormats/V0Candidate: fix for clang warning -Woverloaded-virtual In file included from /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/DataFormats/V0Candidate/src/V0Candidate.cc:1: /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/DataFormats/V0Candidate/interface/V0Candidate.h:23:10: warning: 'reco::V0Candidate::setVertex' hides overloaded virtual function [-Woverloaded-virtual] void setVertex( const Vertex & vtxIn ); ^ /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/DataFormats/Candidate/interface/LeafCandidate.h:158:10: note: hidden overloaded virtual function 'reco::LeafCandidate::setVertex' declared here: type mismatch at 1st parameter ('const reco::LeafCandidate::Point &' (aka 'const PositionVector3D > &') vs 'const reco::Vertex &') void setVertex( const Point & vertex ) override { m_state.setVertex(vertex); } ^ 1 warning generated. --- DataFormats/V0Candidate/interface/V0Candidate.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DataFormats/V0Candidate/interface/V0Candidate.h b/DataFormats/V0Candidate/interface/V0Candidate.h index e15b5d2d82712..c116be0986f21 100644 --- a/DataFormats/V0Candidate/interface/V0Candidate.h +++ b/DataFormats/V0Candidate/interface/V0Candidate.h @@ -19,7 +19,7 @@ namespace reco{ const Vertex::CovarianceMatrix vtxCovariance() { return recoVertex.covariance(); } - + using LeafCandidate::setVertex; void setVertex( const Vertex & vtxIn ); // virtual int pdgId() const { return PDGid; } // void setPdgId( const int & Id ) { PDGid = Id; } From 89b60e09d52f36f754def5daac3d9901c5dce50c Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Tue, 27 Mar 2018 21:52:05 +0200 Subject: [PATCH 247/426] SimDataFormats/CaloHit: fix clang warning by updating function parameter to match base class. In file included from /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/SimDataFormats/CaloHit/src/CastorShowerLibraryInfo.cc:1: /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/SimDataFormats/CaloHit/interface/CastorShowerLibraryInfo.h:17:19: warning: 'SLBin::Clear' hides overloaded virtual function [-Woverloaded-virtual] void Clear() {NEvts=NBins=NEvtPerBin=0;Bins.clear();}; ^ /build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/lcg/root/6.10.09-jpkldn/include/TObject.h:91:24: note: hidden overloaded virtual function 'TObject::Clear' declared here: different number of parameters (1 vs 0) virtual void Clear(Option_t * /*option*/ ="") { } ^ In file included from /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/SimDataFormats/CaloHit/src/CastorShowerLibraryInfo.cc:1: /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/SimDataFormats/CaloHit/interface/CastorShowerLibraryInfo.h:44:10: warning: 'CastorShowerLibraryInfo::Clear' hides overloaded virtual function [-Woverloaded-virtual] void Clear(); ^ /build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/lcg/root/6.10.09-jpkldn/include/TObject.h:91:24: note: hidden overloaded virtual function 'TObject::Clear' declared here: different number of parameters (1 vs 0) virtual void Clear(Option_t * /*option*/ ="") { } ^ In file included from /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/SimDataFormats/CaloHit/src/CastorShowerEvent.cc:1: /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/SimDataFormats/CaloHit/interface/CastorShowerEvent.h:25:10: warning: 'CastorShowerEvent::Clear' hides overloaded virtual function [-Woverloaded-virtual] void Clear(); ^ /build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/lcg/root/6.10.09-jpkldn/include/TObject.h:91:24: note: hidden overloaded virtual function 'TObject::Clear' declared here: different number of parameters (1 vs 0) virtual void Clear(Option_t * /*option*/ ="") { } ^ 1 warning generated. --- SimDataFormats/CaloHit/interface/CastorShowerEvent.h | 3 +-- .../CaloHit/interface/CastorShowerLibraryInfo.h | 6 +++--- SimDataFormats/CaloHit/src/CastorShowerEvent.cc | 2 +- SimDataFormats/CaloHit/src/CastorShowerLibraryInfo.cc | 9 ++++----- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/SimDataFormats/CaloHit/interface/CastorShowerEvent.h b/SimDataFormats/CaloHit/interface/CastorShowerEvent.h index 7c6def782f614..8b0a6240e449d 100644 --- a/SimDataFormats/CaloHit/interface/CastorShowerEvent.h +++ b/SimDataFormats/CaloHit/interface/CastorShowerEvent.h @@ -21,8 +21,7 @@ CastorShowerEvent(); ~CastorShowerEvent() override; - - void Clear(); + void Clear(Option_t *) override; // private: diff --git a/SimDataFormats/CaloHit/interface/CastorShowerLibraryInfo.h b/SimDataFormats/CaloHit/interface/CastorShowerLibraryInfo.h index 728318f970f96..65e187ebba1cb 100644 --- a/SimDataFormats/CaloHit/interface/CastorShowerLibraryInfo.h +++ b/SimDataFormats/CaloHit/interface/CastorShowerLibraryInfo.h @@ -14,7 +14,7 @@ class SLBin: public TObject { SLBin() {}; ~SLBin() override {}; // Setters - void Clear() {NEvts=NBins=NEvtPerBin=0;Bins.clear();}; + void Clear(Option_t *) override {NEvts=NBins=NEvtPerBin=0;Bins.clear();}; void setNEvts(unsigned int n) {NEvts = n;}; void setNBins(unsigned int n) {NBins = n;}; void setNEvtPerBin(unsigned int n) {NEvtPerBin=n;}; @@ -40,8 +40,8 @@ class CastorShowerLibraryInfo : public TObject { CastorShowerLibraryInfo(); ~CastorShowerLibraryInfo() override; - - void Clear(); + + void Clear(Option_t *) override; // Data members SLBin Energy; diff --git a/SimDataFormats/CaloHit/src/CastorShowerEvent.cc b/SimDataFormats/CaloHit/src/CastorShowerEvent.cc index 16fd92a2a21db..95147cdab30fc 100644 --- a/SimDataFormats/CaloHit/src/CastorShowerEvent.cc +++ b/SimDataFormats/CaloHit/src/CastorShowerEvent.cc @@ -9,7 +9,7 @@ CastorShowerEvent::CastorShowerEvent() { CastorShowerEvent::~CastorShowerEvent() {} -void CastorShowerEvent::Clear() { +void CastorShowerEvent::Clear(Option_t *) { nhit = 0; detID.clear(); hitPosition.clear(); diff --git a/SimDataFormats/CaloHit/src/CastorShowerLibraryInfo.cc b/SimDataFormats/CaloHit/src/CastorShowerLibraryInfo.cc index df84fc877a0ba..1f40b484a62cf 100644 --- a/SimDataFormats/CaloHit/src/CastorShowerLibraryInfo.cc +++ b/SimDataFormats/CaloHit/src/CastorShowerLibraryInfo.cc @@ -8,9 +8,8 @@ CastorShowerLibraryInfo::CastorShowerLibraryInfo() { CastorShowerLibraryInfo::~CastorShowerLibraryInfo() {} - -void CastorShowerLibraryInfo::Clear() { - Energy.Clear(); - Eta.Clear(); - Phi.Clear(); +void CastorShowerLibraryInfo::Clear(Option_t *) { + Energy.Clear(""); + Eta.Clear(""); + Phi.Clear(""); } From 2f50b3cde8f97d3a79866ba6cce7542c71e32b49 Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Tue, 27 Mar 2018 21:55:05 +0200 Subject: [PATCH 248/426] RecoParticleFlow/PFClusterTools: fix clang warnings by updating function signatures to match base class. In file included from /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/RecoParticleFlow/PFClusterTools/src/PFResolutionMap.cc:1: /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/RecoParticleFlow/PFClusterTools/interface/PFResolutionMap.h:45:8: warning: 'PFResolutionMap::FindBin' hides overloaded virtual function [-Woverloaded-virtual] int FindBin(double eta, double e); ^ /build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/lcg/root/6.10.09-jpkldn/include/TH1.h:216:21: note: hidden overloaded virtual function 'TH1::FindBin' declared here: different number of parameters (3 vs 2) virtual Int_t FindBin(Double_t x, Double_t y=0, Double_t z=0); ^ --- RecoParticleFlow/PFClusterTools/interface/PFResolutionMap.h | 2 +- RecoParticleFlow/PFClusterTools/src/PFResolutionMap.cc | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/RecoParticleFlow/PFClusterTools/interface/PFResolutionMap.h b/RecoParticleFlow/PFClusterTools/interface/PFResolutionMap.h index 581d2aaf9481b..040832b94eada 100644 --- a/RecoParticleFlow/PFClusterTools/interface/PFResolutionMap.h +++ b/RecoParticleFlow/PFClusterTools/interface/PFResolutionMap.h @@ -42,7 +42,7 @@ class PFResolutionMap : public TH2D { bool WriteMapFile(const char* mapfile); /// extrapolation requires overloading of this function - int FindBin(double eta, double e); + int FindBin(double eta, double e, double z) override; double getRes(double eta, double phi, double e,int MapEta = -1); diff --git a/RecoParticleFlow/PFClusterTools/src/PFResolutionMap.cc b/RecoParticleFlow/PFClusterTools/src/PFResolutionMap.cc index eb79e8572c9d8..a1024a274c328 100644 --- a/RecoParticleFlow/PFClusterTools/src/PFResolutionMap.cc +++ b/RecoParticleFlow/PFClusterTools/src/PFResolutionMap.cc @@ -240,7 +240,7 @@ double PFResolutionMap::getRes(double eta, double phi, double e, int MapEta){ if( efMaxE ) e = fMaxE-0.001; - unsigned bin = FindBin(TMath::Abs(eta),e); + unsigned bin = FindBin(TMath::Abs(eta),e, 0); double res= GetBinContent(bin); if(MapEta>-1){ @@ -254,11 +254,11 @@ double PFResolutionMap::getRes(double eta, double phi, double e, int MapEta){ -int PFResolutionMap::FindBin(double eta, double e) { +int PFResolutionMap::FindBin(double eta, double e, double z) { if(e >= GetYaxis()->GetXmax() ) e = GetYaxis()->GetXmax() - 0.001; - return TH2D::FindBin(eta,e); + return TH2D::FindBin(eta,e,z); } From c2d2cc79ef982e0cc790881083112939a9727431 Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Tue, 27 Mar 2018 22:18:14 +0200 Subject: [PATCH 249/426] Make the number of parameters 2 passed to TH2D::FindBin so correct function is invoked from base class. --- RecoParticleFlow/PFClusterTools/interface/PFResolutionMap.h | 2 +- RecoParticleFlow/PFClusterTools/src/PFResolutionMap.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/RecoParticleFlow/PFClusterTools/interface/PFResolutionMap.h b/RecoParticleFlow/PFClusterTools/interface/PFResolutionMap.h index 040832b94eada..b36f6362452e5 100644 --- a/RecoParticleFlow/PFClusterTools/interface/PFResolutionMap.h +++ b/RecoParticleFlow/PFClusterTools/interface/PFResolutionMap.h @@ -42,7 +42,7 @@ class PFResolutionMap : public TH2D { bool WriteMapFile(const char* mapfile); /// extrapolation requires overloading of this function - int FindBin(double eta, double e, double z) override; + int FindBin(double eta, double e, double z = 0 ) override; double getRes(double eta, double phi, double e,int MapEta = -1); diff --git a/RecoParticleFlow/PFClusterTools/src/PFResolutionMap.cc b/RecoParticleFlow/PFClusterTools/src/PFResolutionMap.cc index a1024a274c328..c2c6c60913965 100644 --- a/RecoParticleFlow/PFClusterTools/src/PFResolutionMap.cc +++ b/RecoParticleFlow/PFClusterTools/src/PFResolutionMap.cc @@ -240,7 +240,7 @@ double PFResolutionMap::getRes(double eta, double phi, double e, int MapEta){ if( efMaxE ) e = fMaxE-0.001; - unsigned bin = FindBin(TMath::Abs(eta),e, 0); + unsigned bin = FindBin(TMath::Abs(eta),e); double res= GetBinContent(bin); if(MapEta>-1){ @@ -258,7 +258,7 @@ int PFResolutionMap::FindBin(double eta, double e, double z) { if(e >= GetYaxis()->GetXmax() ) e = GetYaxis()->GetXmax() - 0.001; - return TH2D::FindBin(eta,e,z); + return TH2D::FindBin(eta,e); } From 7de474c6e1386ac9af1ea716e26ab3368bb71158 Mon Sep 17 00:00:00 2001 From: Mateusz Zarucki Date: Tue, 27 Mar 2018 23:34:52 +0200 Subject: [PATCH 250/426] Added offline DQM code for monitoring of SoftMuHardJetMET SUSY HLT path --- DQMOffline/Trigger/plugins/TopMonitor.cc | 14 ++- DQMOffline/Trigger/plugins/TopMonitor.h | 3 + .../SoftMuHardJetMETSUSYMonitor_Client_cff.py | 37 ++++++++ .../python/SoftMuHardJetMETSUSYMonitor_cff.py | 92 +++++++++++++++++++ .../python/SusyMonitoring_Client_cff.py | 2 + .../Trigger/python/SusyMonitoring_cff.py | 6 +- DQMOffline/Trigger/python/TopMonitor_cfi.py | 1 + 7 files changed, 148 insertions(+), 7 deletions(-) create mode 100644 DQMOffline/Trigger/python/SoftMuHardJetMETSUSYMonitor_Client_cff.py create mode 100644 DQMOffline/Trigger/python/SoftMuHardJetMETSUSYMonitor_cff.py diff --git a/DQMOffline/Trigger/plugins/TopMonitor.cc b/DQMOffline/Trigger/plugins/TopMonitor.cc index 4a3f2e472c0be..5832ab3bcd594 100644 --- a/DQMOffline/Trigger/plugins/TopMonitor.cc +++ b/DQMOffline/Trigger/plugins/TopMonitor.cc @@ -95,6 +95,8 @@ TopMonitor::TopMonitor( const edm::ParameterSet& iConfig ) : , invMassCutInAllMuPairs_ (iConfig.getParameter("invMassCutInAllMuPairs")) //Menglei , enablePhotonPlot_ ( iConfig.getParameter("enablePhotonPlot") ) + //Mateusz + , enableMETplot_(iConfig.getParameter("enableMETplot")) { std::string metcut_str = iConfig.getParameter("metSelection"); @@ -165,7 +167,7 @@ void TopMonitor::bookHistograms(DQMStore::IBooker & ibooker, std::string currentFolder = folderName_ ; ibooker.setCurrentFolder(currentFolder); - if (applyMETcut_){ + if (applyMETcut_ || enableMETplot_){ histname = "met"; histtitle = "PFMET"; bookME(ibooker,metME_,histname,histtitle,met_binning_.nbins,met_binning_.xmin, met_binning_.xmax); @@ -555,7 +557,7 @@ void TopMonitor::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup edm::Handle metHandle; iEvent.getByToken( metToken_, metHandle ); - if (!metHandle.isValid() && applyMETcut_){ + if (!metHandle.isValid() && (applyMETcut_ || enableMETplot_)){ edm::LogWarning("TopMonitor") << "MET handle not valid \n"; return; } @@ -563,7 +565,7 @@ void TopMonitor::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup float met = 0; float phi = 0; - if (applyMETcut_){ + if (applyMETcut_ || enableMETplot_){ reco::PFMET pfmet = metHandle->front(); if ( ! metSelection_( pfmet ) ) return; met = pfmet.pt(); @@ -759,7 +761,7 @@ void TopMonitor::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup int ls = iEvent.id().luminosityBlock(); // filling histograms (denominator) - if (applyMETcut_){ + if (applyMETcut_ || enableMETplot_){ metME_.denominator -> Fill(met); metME_variableBinning_.denominator -> Fill(met); metPhiME_.denominator -> Fill(phi); @@ -902,7 +904,7 @@ void TopMonitor::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup // filling histograms (num_genTriggerEventFlag_) - if (applyMETcut_>0){ + if (applyMETcut_>0 || enableMETplot_){ metME_.numerator -> Fill(met); metME_variableBinning_.numerator -> Fill(met); metPhiME_.numerator -> Fill(phi); @@ -1089,6 +1091,8 @@ void TopMonitor::fillDescriptions(edm::ConfigurationDescriptions & descriptions) desc.add("invMassCutInAllMuPairs",false); //Menglei desc.add("enablePhotonPlot", false); + //Mateusz + desc.add("enableMETplot", false); edm::ParameterSetDescription genericTriggerEventPSet; genericTriggerEventPSet.add("andOr"); diff --git a/DQMOffline/Trigger/plugins/TopMonitor.h b/DQMOffline/Trigger/plugins/TopMonitor.h index 86132d14cce4c..9cbfe8a3604cf 100644 --- a/DQMOffline/Trigger/plugins/TopMonitor.h +++ b/DQMOffline/Trigger/plugins/TopMonitor.h @@ -279,6 +279,9 @@ bool invMassCutInAllMuPairs_; //Menglei bool enablePhotonPlot_; + + //Mateusz + bool enableMETplot_; }; diff --git a/DQMOffline/Trigger/python/SoftMuHardJetMETSUSYMonitor_Client_cff.py b/DQMOffline/Trigger/python/SoftMuHardJetMETSUSYMonitor_Client_cff.py new file mode 100644 index 0000000000000..04372cb148c22 --- /dev/null +++ b/DQMOffline/Trigger/python/SoftMuHardJetMETSUSYMonitor_Client_cff.py @@ -0,0 +1,37 @@ +import FWCore.ParameterSet.Config as cms +from DQMServices.Core.DQMEDHarvester import DQMEDHarvester + +SoftMuHardJetMETEfficiency_muPt = DQMEDHarvester("DQMGenericClient", + subDirs = cms.untracked.vstring("HLT/SUSY/SoftMuHardJetMET/Muon"), + verbose = cms.untracked.uint32(0), + resolution = cms.vstring(), + efficiency = cms.vstring( + "effic_muPt 'Efficiency vs Muon p_{T} ; Muon p_{T} [GeV] ; efficiency' muPt_1_variableBinning_numerator muPt_1_variableBinning_denominator", + "effic_muEta 'Efficiency vs Muon #eta ; Muon #eta ; efficiency' muEta_1_variableBinning_numerator muEta_1_variableBinning_denominator", + ), +) + +SoftMuHardJetMETEfficiency_jetPt = DQMEDHarvester("DQMGenericClient", + subDirs = cms.untracked.vstring("HLT/SUSY/SoftMuHardJetMET/Jet"), + verbose = cms.untracked.uint32(0), + resolution = cms.vstring(), + efficiency = cms.vstring( + "effic_jetPt 'Efficiency vs Jet p_{T} ; PFJet p_{T} [GeV] ; efficiency' jetPt_1_numerator jetPt_1_denominator", + "effic_jetEta 'Efficiency vs Jet #eta ; Jet #eta ; efficiency' jetEta_1_numerator jetEta_1_denominator", + ), +) + +SoftMuHardJetMETEfficiency_metPt = DQMEDHarvester("DQMGenericClient", + subDirs = cms.untracked.vstring("HLT/SUSY/SoftMuHardJetMET/MET"), + verbose = cms.untracked.uint32(0), + resolution = cms.vstring(), + efficiency = cms.vstring( + "effic_metPt 'Efficiency vs MET ; PF MET [GeV] ; efficiency' met_numerator met_denominator", + ), +) + +susyHLTSoftMuHardJetMETClient = cms.Sequence( + SoftMuHardJetMETEfficiency_muPt + + SoftMuHardJetMETEfficiency_jetPt + + SoftMuHardJetMETEfficiency_metPt +) diff --git a/DQMOffline/Trigger/python/SoftMuHardJetMETSUSYMonitor_cff.py b/DQMOffline/Trigger/python/SoftMuHardJetMETSUSYMonitor_cff.py new file mode 100644 index 0000000000000..956f5838300f1 --- /dev/null +++ b/DQMOffline/Trigger/python/SoftMuHardJetMETSUSYMonitor_cff.py @@ -0,0 +1,92 @@ +# Offline DQM for HLT_Mu3er1p5_PFJet100er2p5_PFMETX_PFMHTX_IDTight (X = 70, 80, 90) +# Mateusz Zarucki 2018 + +import FWCore.ParameterSet.Config as cms + +from DQMOffline.Trigger.SusyMonitor_cfi import hltSUSYmonitoring + +SoftMuHardJetMETSUSYmonitoring = hltSUSYmonitoring.clone() +SoftMuHardJetMETSUSYmonitoring.FolderName = cms.string('HLT/SUSY/SoftMuHardJetMET/') + +SoftMuHardJetMETSUSYmonitoring.numGenericTriggerEventPSet.hltInputTag = cms.InputTag("TriggerResults","","HLT") +SoftMuHardJetMETSUSYmonitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring( + "HLT_Mu3er1p5_PFJet100er2p5_PFMET70_PFMHT70_IDTight_v*", + "HLT_Mu3er1p5_PFJet100er2p5_PFMET80_PFMHT80_IDTight_v*", + "HLT_Mu3er1p5_PFJet100er2p5_PFMET90_PFMHT90_IDTight_v*" +) + +SoftMuHardJetMETSUSYmonitoring.met = cms.InputTag("pfMetEI") +SoftMuHardJetMETSUSYmonitoring.jets = cms.InputTag("ak4PFJetsCHS") +SoftMuHardJetMETSUSYmonitoring.muons = cms.InputTag("muons") + +SoftMuHardJetMETSUSYmonitoring.HTdefinition = cms.string('pt>30 & abs(eta)<2.5') +SoftMuHardJetMETSUSYmonitoring.leptJetDeltaRmin = cms.double(0.4) +SoftMuHardJetMETSUSYmonitoring.MHTdefinition = cms.string('pt>30 & abs(eta)<2.4') + +############### +### Muon pt ### +############### +SoftMuHardJetMETSUSYmonitoring_muPt = SoftMuHardJetMETSUSYmonitoring.clone() +SoftMuHardJetMETSUSYmonitoring_muPt.FolderName = cms.string('HLT/SUSY/SoftMuHardJetMET/Muon') + +## Selection ## +SoftMuHardJetMETSUSYmonitoring_muPt.denGenericTriggerEventPSet.hltPaths = cms.vstring('HLT_PFMET120_PFMHT120_IDTight_v*', 'HLT_PFMET130_PFMHT130_IDTight_v*', 'HLT_PFMET140_PFMHT140_IDTight_v*') +# Muon selection +SoftMuHardJetMETSUSYmonitoring_muPt.nmuons = cms.uint32(1) +SoftMuHardJetMETSUSYmonitoring_muPt.muoSelection = cms.string('abs(eta)<1.5') +# Jet selection +SoftMuHardJetMETSUSYmonitoring_muPt.njets = cms.uint32(1) +SoftMuHardJetMETSUSYmonitoring_muPt.jetSelection = cms.string("pt>130 & abs(eta)<2.5") +# MET selection +SoftMuHardJetMETSUSYmonitoring_muPt.metSelection = cms.string('pt>150') +SoftMuHardJetMETSUSYmonitoring_muPt.MHTcut = cms.double(150) + +## Binning ## +SoftMuHardJetMETSUSYmonitoring_muPt.histoPSet.muPtBinning = cms.vdouble(0,2,5,7,10,12,15,17,20,25,30,50) + +############## +### Jet pt ### +############## +SoftMuHardJetMETSUSYmonitoring_jetPt = SoftMuHardJetMETSUSYmonitoring.clone() +SoftMuHardJetMETSUSYmonitoring_jetPt.FolderName = cms.string('HLT/SUSY/SoftMuHardJetMET/Jet') + +## Selection ## +SoftMuHardJetMETSUSYmonitoring_jetPt.denGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_IsoMu27_v*") +# Muon selection +SoftMuHardJetMETSUSYmonitoring_jetPt.nmuons = cms.uint32(1) +SoftMuHardJetMETSUSYmonitoring_jetPt.muoSelection = cms.string('pt>30 & abs(eta)<1.5') +# Jet selection +SoftMuHardJetMETSUSYmonitoring_jetPt.njets = cms.uint32(1) +SoftMuHardJetMETSUSYmonitoring_jetPt.jetSelection = cms.string("abs(eta)<2.5") +# MET selection +SoftMuHardJetMETSUSYmonitoring_jetPt.metSelection = cms.string('pt>150') +SoftMuHardJetMETSUSYmonitoring_jetPt.MHTcut = cms.double(150) + +# Binning +SoftMuHardJetMETSUSYmonitoring_jetPt.histoPSet.jetPtBinning = cms.vdouble(0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,90,100,120,200,400) + +############## +### MET pt ### +############## +SoftMuHardJetMETSUSYmonitoring_metPt = SoftMuHardJetMETSUSYmonitoring.clone() +SoftMuHardJetMETSUSYmonitoring_metPt.FolderName = cms.string('HLT/SUSY/SoftMuHardJetMET/MET') + +## Selection ## +SoftMuHardJetMETSUSYmonitoring_metPt.denGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_IsoMu27_v*") +# Muon selection +SoftMuHardJetMETSUSYmonitoring_metPt.nmuons = cms.uint32(1) +SoftMuHardJetMETSUSYmonitoring_metPt.muoSelection = cms.string('pt>30 & abs(eta)<1.5') +# Jet selection +SoftMuHardJetMETSUSYmonitoring_metPt.njets = cms.uint32(1) +SoftMuHardJetMETSUSYmonitoring_metPt.jetSelection = cms.string("pt>130 & abs(eta)<2.5") +# MET selection +SoftMuHardJetMETSUSYmonitoring_metPt.enableMETplot = cms.bool(True) + +# Binning +SoftMuHardJetMETSUSYmonitoring_metPt.histoPSet.metPSet = cms.PSet(nbins=cms.uint32(50),xmin=cms.double(50),xmax=cms.double(300)) + +susyHLTSoftMuHardJetMETMonitoring = cms.Sequence( + SoftMuHardJetMETSUSYmonitoring_muPt + + SoftMuHardJetMETSUSYmonitoring_jetPt + + SoftMuHardJetMETSUSYmonitoring_metPt +) diff --git a/DQMOffline/Trigger/python/SusyMonitoring_Client_cff.py b/DQMOffline/Trigger/python/SusyMonitoring_Client_cff.py index 3f79633527906..bb3bde8be3dff 100644 --- a/DQMOffline/Trigger/python/SusyMonitoring_Client_cff.py +++ b/DQMOffline/Trigger/python/SusyMonitoring_Client_cff.py @@ -4,6 +4,7 @@ from DQMOffline.Trigger.LepHTMonitor_cff import * from DQMOffline.Trigger.susyHLTEleCaloJetsClient_cfi import * from DQMOffline.Trigger.RazorMonitor_Client_cff import * +from DQMOffline.Trigger.SoftMuHardJetMETSUSYMonitor_Client_cff import * #george double_soft_muon_muonpt_efficiency = DQMEDHarvester("DQMGenericClient", @@ -182,4 +183,5 @@ + double_soft_dca_metpt_efficiency + susyHLTRazorClient + triple_muon_mupt_efficiency + + susyHLTSoftMuHardJetMETClient ) diff --git a/DQMOffline/Trigger/python/SusyMonitoring_cff.py b/DQMOffline/Trigger/python/SusyMonitoring_cff.py index cf1e5d1f2c2fa..0e91df4ba5205 100644 --- a/DQMOffline/Trigger/python/SusyMonitoring_cff.py +++ b/DQMOffline/Trigger/python/SusyMonitoring_cff.py @@ -4,6 +4,7 @@ from DQMOffline.Trigger.VBFSUSYMonitor_cff import * from DQMOffline.Trigger.LepHTMonitor_cff import * from DQMOffline.Trigger.susyHLTEleCaloJets_cff import * +from DQMOffline.Trigger.SoftMuHardJetMETSUSYMonitor_cff import * from DQMOffline.Trigger.TopMonitor_cfi import hltTOPmonitoring #george @@ -257,6 +258,7 @@ + double_soft_muon_backup_90_metpt + double_soft_muon_backup_90_mhtpt + susyMuEGMonitoring - +double_soft_muon_dca_muonpt - +double_soft_muon_dca_metpt + + double_soft_muon_dca_muonpt + + double_soft_muon_dca_metpt + + susyHLTSoftMuHardJetMETMonitoring ) diff --git a/DQMOffline/Trigger/python/TopMonitor_cfi.py b/DQMOffline/Trigger/python/TopMonitor_cfi.py index eecbe38b999e5..41dc466f9825e 100644 --- a/DQMOffline/Trigger/python/TopMonitor_cfi.py +++ b/DQMOffline/Trigger/python/TopMonitor_cfi.py @@ -70,6 +70,7 @@ hltTOPmonitoring.enablePhotonPlot = cms.bool(False) +hltTOPmonitoring.enableMETplot = cms.bool(False) #MET and HT binning hltTOPmonitoring.histoPSet.metBinning = cms.vdouble(0,20,40,60,80,100,125,150,175,200) From 867ef65d48420091f061a267c74170901a3e31e8 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Wed, 28 Mar 2018 10:25:48 +0200 Subject: [PATCH 251/426] Ignore BX range mismatch in OMTF to uGMT comparison. --- DQM/L1TMonitor/python/L1TStage2uGMT_cff.py | 2 ++ DQM/L1TMonitorClient/python/L1TStage2uGMTClient_cff.py | 1 + 2 files changed, 3 insertions(+) diff --git a/DQM/L1TMonitor/python/L1TStage2uGMT_cff.py b/DQM/L1TMonitor/python/L1TStage2uGMT_cff.py index 85f346bc86723..b648e60b9624a 100644 --- a/DQM/L1TMonitor/python/L1TStage2uGMT_cff.py +++ b/DQM/L1TMonitor/python/L1TStage2uGMT_cff.py @@ -84,6 +84,7 @@ # List of bins to ignore ignoreBins = { 'Bmtf' : [1], + 'Omtf' : [1], 'Emtf' : [1] } @@ -111,6 +112,7 @@ regionalMuonCollection1Title = cms.untracked.string("OMTF output data"), regionalMuonCollection2Title = cms.untracked.string("uGMT input data from OMTF"), summaryTitle = cms.untracked.string("Summary of comparison between OMTF output muons and uGMT input muons from OMTF"), + ignoreBin = cms.untracked.vint32(ignoreBins['Omtf']), verbose = cms.untracked.bool(False), ) diff --git a/DQM/L1TMonitorClient/python/L1TStage2uGMTClient_cff.py b/DQM/L1TMonitorClient/python/L1TStage2uGMTClient_cff.py index c067e8b6c2008..6b2161b8d2682 100644 --- a/DQM/L1TMonitorClient/python/L1TStage2uGMTClient_cff.py +++ b/DQM/L1TMonitorClient/python/L1TStage2uGMTClient_cff.py @@ -58,6 +58,7 @@ l1tStage2OmtfOutVsuGMTInRatioClient.inputNum = cms.untracked.string(ugmtDqmDir+'/OMTFoutput_vs_uGMTinput/'+errHistNumStr) l1tStage2OmtfOutVsuGMTInRatioClient.inputDen = cms.untracked.string(ugmtDqmDir+'/OMTFoutput_vs_uGMTinput/'+errHistDenStr) l1tStage2OmtfOutVsuGMTInRatioClient.ratioTitle = cms.untracked.string('Summary of mismatch rates between OMTF output muons and uGMT input muons from OMTF') +l1tStage2OmtfOutVsuGMTInRatioClient.ignoreBin = cms.untracked.vint32(ignoreBins['Omtf']) l1tStage2EmtfOutVsuGMTInRatioClient = l1tStage2uGMTMuonVsuGMTMuonCopy1RatioClient.clone() l1tStage2EmtfOutVsuGMTInRatioClient.monitorDir = cms.untracked.string(ugmtDqmDir+'/EMTFoutput_vs_uGMTinput') From 303ac72cd6e7464037a04358b958b46e4d5573d8 Mon Sep 17 00:00:00 2001 From: nminafra Date: Wed, 28 Mar 2018 11:51:49 +0200 Subject: [PATCH 252/426] Ready for PR --- .../CTPPSDetId/src/classes_def.xml.generated | 22 --------- .../test/test_totem_timing_cfg.py | 47 +++++++++++++++++++ 2 files changed, 47 insertions(+), 22 deletions(-) delete mode 100644 DataFormats/CTPPSDetId/src/classes_def.xml.generated create mode 100644 EventFilter/CTPPSRawToDigi/test/test_totem_timing_cfg.py diff --git a/DataFormats/CTPPSDetId/src/classes_def.xml.generated b/DataFormats/CTPPSDetId/src/classes_def.xml.generated deleted file mode 100644 index c7565891ee6b3..0000000000000 --- a/DataFormats/CTPPSDetId/src/classes_def.xml.generated +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/EventFilter/CTPPSRawToDigi/test/test_totem_timing_cfg.py b/EventFilter/CTPPSRawToDigi/test/test_totem_timing_cfg.py new file mode 100644 index 0000000000000..a045a025b6926 --- /dev/null +++ b/EventFilter/CTPPSRawToDigi/test/test_totem_timing_cfg.py @@ -0,0 +1,47 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("CTPPSRawToDigiTestStandardSequence") + +# minimum of logs +process.MessageLogger = cms.Service("MessageLogger", + statistics = cms.untracked.vstring(), + destinations = cms.untracked.vstring('cerr'), + cerr = cms.untracked.PSet( + threshold = cms.untracked.string('WARNING') + ) +) + +# raw data source +process.source = cms.Source("NewEventStreamFileReader", + fileNames = cms.untracked.vstring( +# '/store/express/Run2016H/ExpressPhysics/FEVT/Express-v2/000/283/877/00000/4EE44B0E-2499-E611-A155-02163E011938.root' + 'file:/eos/cms/store/group/dpg_ctpps/comm_ctpps/TotemTiming/Minidaq/519/run312519_ls0002_streamA_StorageManager.dat' + ) +) + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(10) +) + +process.verbosity = cms.untracked.PSet( + input = cms.untracked.int32(10) +) + +# raw-to-digi conversion +process.load("EventFilter.CTPPSRawToDigi.ctppsRawToDigi_cff") + +# execution configuration +process.p = cms.Path( + process.ctppsRawToDigi +) + +# output configuration +process.output = cms.OutputModule("PoolOutputModule", + fileName = cms.untracked.string("file:./totemTiming_digi.root"), + outputCommands = cms.untracked.vstring( + 'drop *', + 'keep *_*totemTimingRawToDigi_*_*', + ) +) + +process.outpath = cms.EndPath(process.output) \ No newline at end of file From 2f35900a0ed99d39abf3a2e3440c8e7c78c5195a Mon Sep 17 00:00:00 2001 From: Piergiulio Date: Thu, 22 Mar 2018 17:07:53 +0100 Subject: [PATCH 253/426] add the LHE particle four momenta --- .../NanoAOD/plugins/LHETablesProducer.cc | 42 ++++++++++++++++--- PhysicsTools/NanoAOD/python/nano_cff.py | 1 + 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/PhysicsTools/NanoAOD/plugins/LHETablesProducer.cc b/PhysicsTools/NanoAOD/plugins/LHETablesProducer.cc index b2c20d0fd2ef9..e521c55e41509 100644 --- a/PhysicsTools/NanoAOD/plugins/LHETablesProducer.cc +++ b/PhysicsTools/NanoAOD/plugins/LHETablesProducer.cc @@ -5,6 +5,7 @@ #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "DataFormats/NanoAOD/interface/FlatTable.h" #include "SimDataFormats/GeneratorProducts/interface/LHEEventProduct.h" +#include "TLorentzVector.h" #include #include @@ -13,9 +14,12 @@ class LHETablesProducer : public edm::global::EDProducer<> { public: LHETablesProducer( edm::ParameterSet const & params ) : - lheTag_(consumes(params.getParameter("lheInfo"))) + lheTag_(consumes(params.getParameter("lheInfo"))), + precision_(params.existsAs("precision") ? params.getParameter("precision") : -1) { - produces(); + produces("LHE"); + produces("LHEPart"); + } ~LHETablesProducer() override {} @@ -25,23 +29,42 @@ class LHETablesProducer : public edm::global::EDProducer<> { edm::Handle lheInfo; if (iEvent.getByToken(lheTag_, lheInfo)) { - fillLHEObjectTable(*lheInfo, *lheTab); + auto lhePartTab = std::make_unique(lheInfo->hepeup().NUP, "LHEPart", false); + fillLHEObjectTable(*lheInfo, *lheTab, *lhePartTab); + iEvent.put(std::move(lhePartTab), "LHEPart"); + } else { + auto lhePartTab = std::make_unique(1, "LHEPart", false); //dummy + iEvent.put(std::move(lhePartTab), "LHEPart"); } + iEvent.put(std::move(lheTab), "LHE"); - iEvent.put(std::move(lheTab)); } - void fillLHEObjectTable(const LHEEventProduct & lheProd, nanoaod::FlatTable & out) const { + void fillLHEObjectTable(const LHEEventProduct & lheProd, nanoaod::FlatTable & out, nanoaod::FlatTable & outPart) const { double lheHT = 0, lheHTIncoming = 0; unsigned int lheNj = 0, lheNb = 0, lheNc = 0, lheNuds = 0, lheNglu = 0; double lheVpt = 0; const auto & hepeup = lheProd.hepeup(); const auto & pup = hepeup.PUP; + const auto & nup = hepeup.NUP; int lep = -1, lepBar = -1, nu = -1, nuBar = -1; + std::vector vals_pt(nup); + std::vector vals_eta(nup); + std::vector vals_phi(nup); + std::vector vals_mass(nup); + std::vector vals_pid(nup); + std::vector vals_status(nup); for (unsigned int i = 0, n = pup.size(); i < n; ++i) { int status = hepeup.ISTUP[i]; int idabs = std::abs(hepeup.IDUP[i]); + TLorentzVector p4(pup[i][0], pup[i][1], pup[i][2], pup[i][3]); // x,y,z,t + vals_pt[i] = p4.Pt(); + vals_eta[i] = p4.Eta(); + vals_phi[i] = p4.Phi(); + vals_mass[i] = p4.M(); + vals_pid[i] = hepeup.IDUP[i]; + vals_status[i] = hepeup.ISTUP[i]; if ( (status == 1) && ( ( idabs == 21 ) || (idabs > 0 && idabs < 7) ) ) { //# gluons and quarks // object counters lheNj++; @@ -83,16 +106,25 @@ class LHETablesProducer : public edm::global::EDProducer<> { out.addColumnValue("Vpt", lheVpt, "pT of the W or Z boson at LHE step", nanoaod::FlatTable::FloatColumn); out.addColumnValue("NpNLO", lheProd.npNLO(), "number of partons at NLO", nanoaod::FlatTable::UInt8Column); out.addColumnValue("NpLO", lheProd.npLO(), "number of partons at LO", nanoaod::FlatTable::UInt8Column); + + outPart.addColumn("pt", vals_pt, "Pt of LHE particles", nanoaod::FlatTable::FloatColumn, this->precision_); + outPart.addColumn("eta", vals_eta, "Pseodorapidity of LHE particles", nanoaod::FlatTable::FloatColumn, this->precision_); + outPart.addColumn("phi", vals_phi, "Phi of LHE particles", nanoaod::FlatTable::FloatColumn, this->precision_); + outPart.addColumn("mass", vals_mass, "Mass of LHE particles", nanoaod::FlatTable::FloatColumn, this->precision_); + outPart.addColumn ("pdgId", vals_pid, "PDG ID of LHE particles", nanoaod::FlatTable::IntColumn); + outPart.addColumn ("status", vals_status, "Status of LHE particles", nanoaod::FlatTable::IntColumn); } static void fillDescriptions(edm::ConfigurationDescriptions & descriptions) { edm::ParameterSetDescription desc; desc.add("lheInfo", edm::InputTag("externalLHEProducer"))->setComment("tag for the LHE information (LHEEventProduct)"); + desc.add("precision", -1)->setComment("precision on the 4-momenta of the LHE particles"); descriptions.add("lheInfoTable", desc); } protected: const edm::EDGetTokenT lheTag_; + const unsigned int precision_; }; #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/PhysicsTools/NanoAOD/python/nano_cff.py b/PhysicsTools/NanoAOD/python/nano_cff.py index 3a2799770540e..25fcd3f173c7f 100644 --- a/PhysicsTools/NanoAOD/python/nano_cff.py +++ b/PhysicsTools/NanoAOD/python/nano_cff.py @@ -65,6 +65,7 @@ ) lheInfoTable = cms.EDProducer("LHETablesProducer", lheInfo = cms.InputTag("externalLHEProducer"), + precision = cms.int32(14) ) l1bits=cms.EDProducer("L1TriggerResultsConverter", src=cms.InputTag("gtStage2Digis"), legacyL1=cms.bool(False)) From f9bbff17d0f6ebbaeb79663ebd204fd2ef22b439 Mon Sep 17 00:00:00 2001 From: Piergiulio Date: Fri, 23 Mar 2018 21:08:41 +0100 Subject: [PATCH 254/426] only save status 1 --- .../NanoAOD/plugins/LHETablesProducer.cc | 64 ++++++++++--------- PhysicsTools/NanoAOD/python/nano_cff.py | 3 +- 2 files changed, 35 insertions(+), 32 deletions(-) diff --git a/PhysicsTools/NanoAOD/plugins/LHETablesProducer.cc b/PhysicsTools/NanoAOD/plugins/LHETablesProducer.cc index e521c55e41509..cf37552d2970d 100644 --- a/PhysicsTools/NanoAOD/plugins/LHETablesProducer.cc +++ b/PhysicsTools/NanoAOD/plugins/LHETablesProducer.cc @@ -15,10 +15,12 @@ class LHETablesProducer : public edm::global::EDProducer<> { public: LHETablesProducer( edm::ParameterSet const & params ) : lheTag_(consumes(params.getParameter("lheInfo"))), - precision_(params.existsAs("precision") ? params.getParameter("precision") : -1) + precision_(params.existsAs("precision") ? params.getParameter("precision") : -1), + storeLHEParticles_(params.existsAs("storeLHEParticles") ? params.getParameter("storeLHEParticles") : -1) { produces("LHE"); - produces("LHEPart"); + if (storeLHEParticles_) + produces("LHEPart"); } @@ -29,42 +31,37 @@ class LHETablesProducer : public edm::global::EDProducer<> { edm::Handle lheInfo; if (iEvent.getByToken(lheTag_, lheInfo)) { - auto lhePartTab = std::make_unique(lheInfo->hepeup().NUP, "LHEPart", false); - fillLHEObjectTable(*lheInfo, *lheTab, *lhePartTab); - iEvent.put(std::move(lhePartTab), "LHEPart"); - } else { - auto lhePartTab = std::make_unique(1, "LHEPart", false); //dummy - iEvent.put(std::move(lhePartTab), "LHEPart"); - } + auto lhePartTab = fillLHEObjectTable(*lheInfo, *lheTab); + if (storeLHEParticles_) iEvent.put(std::move(lhePartTab), "LHEPart"); + } iEvent.put(std::move(lheTab), "LHE"); } - void fillLHEObjectTable(const LHEEventProduct & lheProd, nanoaod::FlatTable & out, nanoaod::FlatTable & outPart) const { + std::unique_ptr fillLHEObjectTable(const LHEEventProduct & lheProd, nanoaod::FlatTable & out) const { double lheHT = 0, lheHTIncoming = 0; unsigned int lheNj = 0, lheNb = 0, lheNc = 0, lheNuds = 0, lheNglu = 0; double lheVpt = 0; const auto & hepeup = lheProd.hepeup(); const auto & pup = hepeup.PUP; - const auto & nup = hepeup.NUP; int lep = -1, lepBar = -1, nu = -1, nuBar = -1; - std::vector vals_pt(nup); - std::vector vals_eta(nup); - std::vector vals_phi(nup); - std::vector vals_mass(nup); - std::vector vals_pid(nup); - std::vector vals_status(nup); + std::vector vals_pt; + std::vector vals_eta; + std::vector vals_phi; + std::vector vals_mass; + std::vector vals_pid; for (unsigned int i = 0, n = pup.size(); i < n; ++i) { int status = hepeup.ISTUP[i]; int idabs = std::abs(hepeup.IDUP[i]); - TLorentzVector p4(pup[i][0], pup[i][1], pup[i][2], pup[i][3]); // x,y,z,t - vals_pt[i] = p4.Pt(); - vals_eta[i] = p4.Eta(); - vals_phi[i] = p4.Phi(); - vals_mass[i] = p4.M(); - vals_pid[i] = hepeup.IDUP[i]; - vals_status[i] = hepeup.ISTUP[i]; + if (status == 1){ + TLorentzVector p4(pup[i][0], pup[i][1], pup[i][2], pup[i][3]); // x,y,z,t + vals_pt.push_back(p4.Pt()); + vals_eta.push_back(p4.Eta()); + vals_phi.push_back(p4.Phi()); + vals_mass.push_back(p4.M()); + vals_pid.push_back(hepeup.IDUP[i]); + } if ( (status == 1) && ( ( idabs == 21 ) || (idabs > 0 && idabs < 7) ) ) { //# gluons and quarks // object counters lheNj++; @@ -106,25 +103,30 @@ class LHETablesProducer : public edm::global::EDProducer<> { out.addColumnValue("Vpt", lheVpt, "pT of the W or Z boson at LHE step", nanoaod::FlatTable::FloatColumn); out.addColumnValue("NpNLO", lheProd.npNLO(), "number of partons at NLO", nanoaod::FlatTable::UInt8Column); out.addColumnValue("NpLO", lheProd.npLO(), "number of partons at LO", nanoaod::FlatTable::UInt8Column); - - outPart.addColumn("pt", vals_pt, "Pt of LHE particles", nanoaod::FlatTable::FloatColumn, this->precision_); - outPart.addColumn("eta", vals_eta, "Pseodorapidity of LHE particles", nanoaod::FlatTable::FloatColumn, this->precision_); - outPart.addColumn("phi", vals_phi, "Phi of LHE particles", nanoaod::FlatTable::FloatColumn, this->precision_); - outPart.addColumn("mass", vals_mass, "Mass of LHE particles", nanoaod::FlatTable::FloatColumn, this->precision_); - outPart.addColumn ("pdgId", vals_pid, "PDG ID of LHE particles", nanoaod::FlatTable::IntColumn); - outPart.addColumn ("status", vals_status, "Status of LHE particles", nanoaod::FlatTable::IntColumn); + + + auto outPart = std::make_unique(vals_pt.size(), "LHEPart", false); + outPart->addColumn("pt", vals_pt, "Pt of LHE particles", nanoaod::FlatTable::FloatColumn, this->precision_); + outPart->addColumn("eta", vals_eta, "Pseodorapidity of LHE particles", nanoaod::FlatTable::FloatColumn, this->precision_); + outPart->addColumn("phi", vals_phi, "Phi of LHE particles", nanoaod::FlatTable::FloatColumn, this->precision_); + outPart->addColumn("mass", vals_mass, "Mass of LHE particles", nanoaod::FlatTable::FloatColumn, this->precision_); + outPart->addColumn ("pdgId", vals_pid, "PDG ID of LHE particles", nanoaod::FlatTable::IntColumn); + + return outPart; } static void fillDescriptions(edm::ConfigurationDescriptions & descriptions) { edm::ParameterSetDescription desc; desc.add("lheInfo", edm::InputTag("externalLHEProducer"))->setComment("tag for the LHE information (LHEEventProduct)"); desc.add("precision", -1)->setComment("precision on the 4-momenta of the LHE particles"); + desc.add("storeLHEParticles", false)->setComment("Whether we want to store the 4-momenta of the status 1 particles at LHE level"); descriptions.add("lheInfoTable", desc); } protected: const edm::EDGetTokenT lheTag_; const unsigned int precision_; + const bool storeLHEParticles_; }; #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/PhysicsTools/NanoAOD/python/nano_cff.py b/PhysicsTools/NanoAOD/python/nano_cff.py index 25fcd3f173c7f..bb9b547b0f8b7 100644 --- a/PhysicsTools/NanoAOD/python/nano_cff.py +++ b/PhysicsTools/NanoAOD/python/nano_cff.py @@ -65,7 +65,8 @@ ) lheInfoTable = cms.EDProducer("LHETablesProducer", lheInfo = cms.InputTag("externalLHEProducer"), - precision = cms.int32(14) + precision = cms.int32(14), + storeLHEParticles = cms.bool(True) ) l1bits=cms.EDProducer("L1TriggerResultsConverter", src=cms.InputTag("gtStage2Digis"), legacyL1=cms.bool(False)) From 27389a5a454193ac0ee52a51a0740197ceb11f95 Mon Sep 17 00:00:00 2001 From: Giacomo Govi Date: Wed, 28 Mar 2018 14:25:34 +0200 Subject: [PATCH 255/426] Fix for file handling: delete after copy, save for upload errors --- CondCore/Utilities/python/popcon2dropbox.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/CondCore/Utilities/python/popcon2dropbox.py b/CondCore/Utilities/python/popcon2dropbox.py index 5e4ddaec5a2d3..12008182a66a7 100644 --- a/CondCore/Utilities/python/popcon2dropbox.py +++ b/CondCore/Utilities/python/popcon2dropbox.py @@ -9,8 +9,8 @@ from datetime import datetime errorInImportFileFolder = 'import_errors' -dateformatForFolder = "%y-%m-%d-%H-%M-%S" -dateformatForLabel = "%y-%m-%d %H:%M:%S" +dateformatForFolder = "%Y-%m-%d-%H-%M-%S" +dateformatForLabel = "%Y-%m-%d %H:%M:%S" auth_path_key = 'COND_AUTH_PATH' @@ -183,10 +183,10 @@ def run( args ): return retCode ret = checkFile( dbName ) - if ret < 0: - return ret - elif ret == 0: - return 0 - if args.copy: - return copy( args, dbName ) - return upload( args, dbName ) + if ret > 0: + if args.copy: + ret = copy( args, dbName ) + else: + ret = upload( args, dbName ) + os.remove( '%s.db' %dbName ) + return ret From d8896f89c77237f5583db2f4638c95ab788cbecd Mon Sep 17 00:00:00 2001 From: nminafra Date: Wed, 28 Mar 2018 14:51:26 +0200 Subject: [PATCH 256/426] improved code readability, bugfixing --- .../interface/TotemDAQMapping.h | 4 +- .../xml/mapping_totem_timing_2018.xml | 222 +++++++++--------- .../interface/TotemSampicFrame.h | 28 --- .../CTPPSRawToDigi/src/RawToDigiConverter.cc | 36 ++- .../test/test_standard_sequence_cfg.py | 2 +- 5 files changed, 137 insertions(+), 155 deletions(-) diff --git a/CondFormats/CTPPSReadoutObjects/interface/TotemDAQMapping.h b/CondFormats/CTPPSReadoutObjects/interface/TotemDAQMapping.h index 314bd9ceece2d..d9a4deff7d72d 100644 --- a/CondFormats/CTPPSReadoutObjects/interface/TotemDAQMapping.h +++ b/CondFormats/CTPPSReadoutObjects/interface/TotemDAQMapping.h @@ -46,10 +46,10 @@ class TotemDAQMapping /// Hw Id mapping for Totem Timing (dynamical mapping in Sampic) struct TotemTimingPlaneChannelPair { - int channel; int plane; + int channel; - TotemTimingPlaneChannelPair(const int& channel=-1, const int& plane=-1) : channel(channel), plane(plane) {}; + TotemTimingPlaneChannelPair(const int& plane=-1, const int& channel=-1) : plane(plane), channel(channel) {}; }; std::map totemTimingChannelMap; diff --git a/CondFormats/CTPPSReadoutObjects/xml/mapping_totem_timing_2018.xml b/CondFormats/CTPPSReadoutObjects/xml/mapping_totem_timing_2018.xml index cd9b34da40b6c..c9b0db9df1ff9 100644 --- a/CondFormats/CTPPSReadoutObjects/xml/mapping_totem_timing_2018.xml +++ b/CondFormats/CTPPSReadoutObjects/xml/mapping_totem_timing_2018.xml @@ -58,62 +58,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -169,6 +113,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -282,6 +282,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -338,61 +393,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h b/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h index b6e4e8c358dd5..84b052b0b54ee 100644 --- a/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h +++ b/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h @@ -89,7 +89,6 @@ class TotemSampicFrame public: TotemSampicFrame(const uint8_t* chInfoPtr, const uint8_t* chDataPtr, const uint8_t* eventInfoPtr) : TotemSampicInfo_(nullptr), TotemSampicData_(nullptr), TotemSampicEventInfo_(nullptr), status_(0) -// chInfoPtr_(chInfoPtr), chDataPtr_(chDataPtr), eventInfoPtr_(eventInfoPtr) { if ( chInfoPtr!=nullptr && chDataPtr!=nullptr && eventInfoPtr!=nullptr) { TotemSampicInfo_ = (TotemSampicInfo*) chInfoPtr; @@ -268,39 +267,12 @@ class TotemSampicFrame protected: - /** Raw data frame as sent by electronics. - * The container is organized as follows: - * Odd IndexinFiber: Ch Info - * \verbatim - * buffer index content size - * --------------------------------------------------------------- - * 0->5 Empty 48 bit - * 6->7 Cell Info 16 bit - * 8->9 TimestampA 16 bit - * 10->11 TimestampB 16 bit - * 12->16 FPGATime 40 bit - * 17->19 ADC EOC 16 bit - * 20->22 controlBits 32 bit - * 23 hwId 8 bit - * \endverbatim - * - * Even IndexinFiber: Ch Data - * \verbatim - * buffer index content size - * --------------------------------------------------------------- - * 0->23 Channel data sampic 8bit samples - * \endverbatim - * - **/ const TotemSampicInfo* TotemSampicInfo_; const TotemSampicData* TotemSampicData_; const TotemSampicEventInfo* TotemSampicEventInfo_; int status_; -// uint8_t* chInfoPtr_; -// uint8_t* chDataPtr_; -// uint8_t* eventInfoPtr_; inline void PrintRawBuffer(uint16_t const* buffer, const bool binary=false, const unsigned int size=12) const { for (unsigned int i = 0; i < size; i++) { diff --git a/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc b/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc index 2e3897bda0915..9dfa6eedf62d9 100644 --- a/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc +++ b/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc @@ -345,30 +345,40 @@ void RawToDigiConverter::Run(const VFATFrameCollection &coll, const TotemDAQMapp // calculate ids TotemTimingDetId detId(record.info->symbolicID.symbolicID); + const TotemDAQMapping::TotemTimingPlaneChannelPair SWpair = mapping.getTimingChannel( totemSampicFrame.getHardwareId() ); // for FW Version > 0 plane and channel are encoded in the dataframe - if ( totemSampicFrame.getFWVersion() == 0 ) + if ( totemSampicFrame.getFWVersion() == 0 ) // Mapping not present in HW, read from SW { - const TotemDAQMapping::TotemTimingPlaneChannelPair pair = mapping.getTimingChannel( totemSampicFrame.getHardwareId() ); - - - if ( pair.plane == -1 || pair.channel == -1 ) + if ( SWpair.plane == -1 || SWpair.channel == -1 ) { if (verbosity>0) LogWarning("Totem") << "Error in RawToDigiConverter::TotemTiming > " << "HwId not recognized! hwId: " << std::hex << (unsigned int) totemSampicFrame.getHardwareId() << endl; - std::cout << digiTmp << std::endl; } else { - detId.setPlane( pair.plane ); - detId.setChannel( pair.channel ); + detId.setPlane( SWpair.plane % 4); + detId.setChannel( SWpair.channel ); + detId.setRP( SWpair.plane / 4 ); // Top:0 or Bottom:1 } - - } - else + else // Mapping read from HW, checked by SW { - detId.setPlane( totemSampicFrame.getDetPlane() % 4 ); - detId.setChannel( totemSampicFrame.getDetChannel() % 16 ); + const int HWplane = totemSampicFrame.getDetPlane() % 16; + const int HWchannel = totemSampicFrame.getDetChannel() % 16; + + if ( SWpair.plane == -1 || SWpair.channel == -1 ) + { + if ( verbosity>0 ) + LogWarning("Totem") << "Warning in RawToDigiConverter::TotemTiming > " << "HwId not recognized! hwId: " << std::hex << (unsigned int) totemSampicFrame.getHardwareId() << "\tUsing plane and ch from HW without check!" << endl; + } + else + { + if ( verbosity>0 && ( SWpair.plane != HWplane || SWpair.channel != HWchannel ) ) + LogWarning("Totem") << "Warning in RawToDigiConverter::TotemTiming > " << "Hw mapping different from SW mapping. hwId: " << std::hex << (unsigned int) totemSampicFrame.getHardwareId() << "HW: " << std::dec << HWplane << ":" << HWchannel << "\tSW " << SWpair.plane << ":" << SWpair.channel << "\tUsing plane and ch from HW!" << endl; + } + detId.setPlane( HWplane % 4 ); + detId.setChannel( HWchannel ); + detId.setRP( HWplane / 4 ); // Top:0 or Bottom:1 } DetSet &digiDetSet = digi.find_or_insert(detId); diff --git a/EventFilter/CTPPSRawToDigi/test/test_standard_sequence_cfg.py b/EventFilter/CTPPSRawToDigi/test/test_standard_sequence_cfg.py index 1d1a5563f7c2f..a1ddd56fd1f7f 100644 --- a/EventFilter/CTPPSRawToDigi/test/test_standard_sequence_cfg.py +++ b/EventFilter/CTPPSRawToDigi/test/test_standard_sequence_cfg.py @@ -40,7 +40,7 @@ fileName = cms.untracked.string("file:./reco_digi.root"), outputCommands = cms.untracked.vstring( 'drop *', - 'keep *_*RawToDigi_*_*', + 'keep *_*totemTimingRawToDigi_*_*', ) ) From 5e025790977cfbe7bf2a6991a9ddfea725ecbbec Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Wed, 28 Mar 2018 15:04:00 +0200 Subject: [PATCH 257/426] Review equal operator for GlobalAlgBlk and remove some comparisons. --- DataFormats/L1TGlobal/src/GlobalAlgBlk.cc | 37 ++++++++++++++++++----- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/DataFormats/L1TGlobal/src/GlobalAlgBlk.cc b/DataFormats/L1TGlobal/src/GlobalAlgBlk.cc index 313fc93e1c588..236dfa529b9f5 100644 --- a/DataFormats/L1TGlobal/src/GlobalAlgBlk.cc +++ b/DataFormats/L1TGlobal/src/GlobalAlgBlk.cc @@ -161,16 +161,39 @@ void GlobalAlgBlk::reset() // compare the content of this GlobalAlgBlk with another one bool GlobalAlgBlk::operator==(const GlobalAlgBlk& rhs) const { - return m_orbitNr == rhs.getL1MenuUUID() + // Not all variables can be compared since the prescale counters are + // generally not the same when producing the collections and so the + // prescaled algo decisions do not match. + bool eq = m_orbitNr == rhs.getL1MenuUUID() && m_bxNr == rhs.getL1FirmwareUUID() && m_bxInEvent == rhs.getbxInEventNr() - && m_finalOR == rhs.getFinalOR() - && m_finalORPreVeto == rhs.getFinalORPreVeto() - && m_finalORVeto == rhs.getFinalORVeto() - && m_preScColumn == rhs.getPreScColumn() + //&& m_finalOR == rhs.getFinalOR() + //&& m_finalORPreVeto == rhs.getFinalORPreVeto() + //&& m_finalORVeto == rhs.getFinalORVeto() + //&& m_preScColumn == rhs.getPreScColumn() && m_algoDecisionInitial == rhs.getAlgoDecisionInitial() - && m_algoDecisionPreScaled == rhs.getAlgoDecisionInterm() - && m_algoDecisionFinal == rhs.getAlgoDecisionFinal(); + //&& m_algoDecisionPreScaled == rhs.getAlgoDecisionInterm() + //&& m_algoDecisionFinal == rhs.getAlgoDecisionFinal() + ; + + if (not eq) { + std::cout << "m_orbitNr: " << m_orbitNr << " : " << rhs.getL1MenuUUID() << std::endl + << "m_bxNr: " << m_bxNr << " : " << rhs.getL1FirmwareUUID() << std::endl + << "m_bxInEvent: " << m_bxInEvent << " : " << rhs.getbxInEventNr() << std::endl + << "m_finalOR: " << m_finalOR << " : " << rhs.getFinalOR() << std::endl + << "m_finalORPreVeto: " << m_finalORPreVeto << " : " << rhs.getFinalORPreVeto() << std::endl + << "m_finalORVeto: " << m_finalORVeto << " : " << rhs.getFinalORVeto() << std::endl + << "m_preScColumn: " << m_preScColumn << " : " << rhs.getPreScColumn() << std::endl + << std::endl; + std::cout << "algoDecisions" << std::endl; + for (size_t i = 0; i < m_algoDecisionInitial.size(); ++i) { + std::cout << "bit " << i << ": " << m_algoDecisionInitial.at(i) << " : " << rhs.getAlgoDecisionInitial(i) + << " " << m_algoDecisionPreScaled.at(i) << " : " << rhs.getAlgoDecisionInterm(i) + << " " << m_algoDecisionFinal.at(i) << " : " << rhs.getAlgoDecisionFinal(i) << std::endl; + } + } + + return eq; } // pretty print the content of a GlobalAlgBlk From 5fb3a33c2661ddc29502d2da4d0914419cb7875e Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Wed, 28 Mar 2018 15:14:06 +0200 Subject: [PATCH 258/426] Comment out printing code. --- DataFormats/L1TGlobal/src/GlobalAlgBlk.cc | 32 +++++++++++------------ 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/DataFormats/L1TGlobal/src/GlobalAlgBlk.cc b/DataFormats/L1TGlobal/src/GlobalAlgBlk.cc index 236dfa529b9f5..ee9ba468ab802 100644 --- a/DataFormats/L1TGlobal/src/GlobalAlgBlk.cc +++ b/DataFormats/L1TGlobal/src/GlobalAlgBlk.cc @@ -176,22 +176,22 @@ bool GlobalAlgBlk::operator==(const GlobalAlgBlk& rhs) const //&& m_algoDecisionFinal == rhs.getAlgoDecisionFinal() ; - if (not eq) { - std::cout << "m_orbitNr: " << m_orbitNr << " : " << rhs.getL1MenuUUID() << std::endl - << "m_bxNr: " << m_bxNr << " : " << rhs.getL1FirmwareUUID() << std::endl - << "m_bxInEvent: " << m_bxInEvent << " : " << rhs.getbxInEventNr() << std::endl - << "m_finalOR: " << m_finalOR << " : " << rhs.getFinalOR() << std::endl - << "m_finalORPreVeto: " << m_finalORPreVeto << " : " << rhs.getFinalORPreVeto() << std::endl - << "m_finalORVeto: " << m_finalORVeto << " : " << rhs.getFinalORVeto() << std::endl - << "m_preScColumn: " << m_preScColumn << " : " << rhs.getPreScColumn() << std::endl - << std::endl; - std::cout << "algoDecisions" << std::endl; - for (size_t i = 0; i < m_algoDecisionInitial.size(); ++i) { - std::cout << "bit " << i << ": " << m_algoDecisionInitial.at(i) << " : " << rhs.getAlgoDecisionInitial(i) - << " " << m_algoDecisionPreScaled.at(i) << " : " << rhs.getAlgoDecisionInterm(i) - << " " << m_algoDecisionFinal.at(i) << " : " << rhs.getAlgoDecisionFinal(i) << std::endl; - } - } + //if (not eq) { + // std::cout << "m_orbitNr: " << m_orbitNr << " : " << rhs.getL1MenuUUID() << std::endl + // << "m_bxNr: " << m_bxNr << " : " << rhs.getL1FirmwareUUID() << std::endl + // << "m_bxInEvent: " << m_bxInEvent << " : " << rhs.getbxInEventNr() << std::endl + // << "m_finalOR: " << m_finalOR << " : " << rhs.getFinalOR() << std::endl + // << "m_finalORPreVeto: " << m_finalORPreVeto << " : " << rhs.getFinalORPreVeto() << std::endl + // << "m_finalORVeto: " << m_finalORVeto << " : " << rhs.getFinalORVeto() << std::endl + // << "m_preScColumn: " << m_preScColumn << " : " << rhs.getPreScColumn() << std::endl + // << std::endl; + // std::cout << "algoDecisions" << std::endl; + // for (size_t i = 0; i < m_algoDecisionInitial.size(); ++i) { + // std::cout << "bit " << i << ": " << m_algoDecisionInitial.at(i) << " : " << rhs.getAlgoDecisionInitial(i) + // << " " << m_algoDecisionPreScaled.at(i) << " : " << rhs.getAlgoDecisionInterm(i) + // << " " << m_algoDecisionFinal.at(i) << " : " << rhs.getAlgoDecisionFinal(i) << std::endl; + // } + //} return eq; } From 0dd65184d2e6381852e4ed6d51707bd70ed996e4 Mon Sep 17 00:00:00 2001 From: Giovanni Date: Wed, 28 Mar 2018 17:14:42 +0200 Subject: [PATCH 259/426] Fix LHETablesProducer for non-LHE samples --- PhysicsTools/NanoAOD/plugins/LHETablesProducer.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/PhysicsTools/NanoAOD/plugins/LHETablesProducer.cc b/PhysicsTools/NanoAOD/plugins/LHETablesProducer.cc index cf37552d2970d..98e5eba258036 100644 --- a/PhysicsTools/NanoAOD/plugins/LHETablesProducer.cc +++ b/PhysicsTools/NanoAOD/plugins/LHETablesProducer.cc @@ -33,7 +33,12 @@ class LHETablesProducer : public edm::global::EDProducer<> { if (iEvent.getByToken(lheTag_, lheInfo)) { auto lhePartTab = fillLHEObjectTable(*lheInfo, *lheTab); if (storeLHEParticles_) iEvent.put(std::move(lhePartTab), "LHEPart"); - } + } else { + if (storeLHEParticles_) { // need to store a dummy table anyway to make the framework happy + auto lhePartTab = std::make_unique(1, "LHEPart", true); + iEvent.put(std::move(lhePartTab), "LHEPart"); + } + } iEvent.put(std::move(lheTab), "LHE"); } From 740c3f017b2901c2e11eaf324eb3657c4ded86c7 Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Wed, 28 Mar 2018 17:53:44 +0200 Subject: [PATCH 260/426] Put the default value for Option_t in the function stub so calls to Clear() with no arguments can be made. --- .../CaloHit/interface/CastorShowerLibraryInfo.h | 4 ++-- SimDataFormats/CaloHit/src/CastorShowerEvent.cc | 2 +- SimDataFormats/CaloHit/src/CastorShowerLibraryInfo.cc | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/SimDataFormats/CaloHit/interface/CastorShowerLibraryInfo.h b/SimDataFormats/CaloHit/interface/CastorShowerLibraryInfo.h index 65e187ebba1cb..5b5b5ea7a7b0a 100644 --- a/SimDataFormats/CaloHit/interface/CastorShowerLibraryInfo.h +++ b/SimDataFormats/CaloHit/interface/CastorShowerLibraryInfo.h @@ -14,7 +14,7 @@ class SLBin: public TObject { SLBin() {}; ~SLBin() override {}; // Setters - void Clear(Option_t *) override {NEvts=NBins=NEvtPerBin=0;Bins.clear();}; + void Clear(Option_t * option = "") override final {NEvts=NBins=NEvtPerBin=0;Bins.clear();}; void setNEvts(unsigned int n) {NEvts = n;}; void setNBins(unsigned int n) {NBins = n;}; void setNEvtPerBin(unsigned int n) {NEvtPerBin=n;}; @@ -41,7 +41,7 @@ class CastorShowerLibraryInfo : public TObject { CastorShowerLibraryInfo(); ~CastorShowerLibraryInfo() override; - void Clear(Option_t *) override; + void Clear(Option_t * option = "") override; // Data members SLBin Energy; diff --git a/SimDataFormats/CaloHit/src/CastorShowerEvent.cc b/SimDataFormats/CaloHit/src/CastorShowerEvent.cc index 95147cdab30fc..7fc6115bc3266 100644 --- a/SimDataFormats/CaloHit/src/CastorShowerEvent.cc +++ b/SimDataFormats/CaloHit/src/CastorShowerEvent.cc @@ -9,7 +9,7 @@ CastorShowerEvent::CastorShowerEvent() { CastorShowerEvent::~CastorShowerEvent() {} -void CastorShowerEvent::Clear(Option_t *) { +void CastorShowerEvent::Clear(Option_t * option) { nhit = 0; detID.clear(); hitPosition.clear(); diff --git a/SimDataFormats/CaloHit/src/CastorShowerLibraryInfo.cc b/SimDataFormats/CaloHit/src/CastorShowerLibraryInfo.cc index 1f40b484a62cf..91930dd593d13 100644 --- a/SimDataFormats/CaloHit/src/CastorShowerLibraryInfo.cc +++ b/SimDataFormats/CaloHit/src/CastorShowerLibraryInfo.cc @@ -8,8 +8,8 @@ CastorShowerLibraryInfo::CastorShowerLibraryInfo() { CastorShowerLibraryInfo::~CastorShowerLibraryInfo() {} -void CastorShowerLibraryInfo::Clear(Option_t *) { - Energy.Clear(""); - Eta.Clear(""); - Phi.Clear(""); +void CastorShowerLibraryInfo::Clear(Option_t * option) { + Energy.Clear(); + Eta.Clear(); + Phi.Clear(); } From bf07b4962d86370e92fd94b6094716a321867cf9 Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Wed, 28 Mar 2018 18:25:55 +0200 Subject: [PATCH 261/426] Remove final keyword. Make coordinated change the Clear() calls. --- SimDataFormats/CaloHit/interface/CastorShowerLibraryInfo.h | 2 +- SimG4CMS/Forward/src/CastorShowerLibrary.cc | 2 +- .../ShowerLibraryProducer/src/CastorShowerLibraryMaker.cc | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/SimDataFormats/CaloHit/interface/CastorShowerLibraryInfo.h b/SimDataFormats/CaloHit/interface/CastorShowerLibraryInfo.h index 5b5b5ea7a7b0a..3418bd310d79c 100644 --- a/SimDataFormats/CaloHit/interface/CastorShowerLibraryInfo.h +++ b/SimDataFormats/CaloHit/interface/CastorShowerLibraryInfo.h @@ -14,7 +14,7 @@ class SLBin: public TObject { SLBin() {}; ~SLBin() override {}; // Setters - void Clear(Option_t * option = "") override final {NEvts=NBins=NEvtPerBin=0;Bins.clear();}; + void Clear(Option_t * option = "") override {NEvts=NBins=NEvtPerBin=0;Bins.clear();}; void setNEvts(unsigned int n) {NEvts = n;}; void setNBins(unsigned int n) {NBins = n;}; void setNEvtPerBin(unsigned int n) {NEvtPerBin=n;}; diff --git a/SimG4CMS/Forward/src/CastorShowerLibrary.cc b/SimG4CMS/Forward/src/CastorShowerLibrary.cc index 399bc1ec47f44..b9b4911c334c9 100644 --- a/SimG4CMS/Forward/src/CastorShowerLibrary.cc +++ b/SimG4CMS/Forward/src/CastorShowerLibrary.cc @@ -219,7 +219,7 @@ CastorShowerEvent CastorShowerLibrary::getShowerHits(G4Step * aStep, bool & ok) int parCode = track->GetDefinition()->GetPDGEncoding(); CastorShowerEvent hit; - hit.Clear(); + hit.Clear(""); ok = false; if (parCode == pi0PDG || parCode == etaPDG || parCode == nuePDG || diff --git a/SimG4CMS/ShowerLibraryProducer/src/CastorShowerLibraryMaker.cc b/SimG4CMS/ShowerLibraryProducer/src/CastorShowerLibraryMaker.cc index c61af8581117d..2bb2f423a4e75 100644 --- a/SimG4CMS/ShowerLibraryProducer/src/CastorShowerLibraryMaker.cc +++ b/SimG4CMS/ShowerLibraryProducer/src/CastorShowerLibraryMaker.cc @@ -531,7 +531,7 @@ void CastorShowerLibraryMaker::update(const EndOfEvent * evt) { NHitInEvent+=shower->getNhit(); NEvtAccepted++; } - else {shower->Clear();} + else {shower->Clear("");} } // Check for unassociated energy @@ -588,8 +588,8 @@ void CastorShowerLibraryMaker::update(const EndOfRun * run) hadInfo= &hadSLHolder.SLInfo; while(nEvtInTreeClear(); - if (hadShower) hadShower->Clear(); + if (emShower) emShower->Clear(""); + if (hadShower) hadShower->Clear(""); while(ibine0){ emShower = &(emSLHolder.SLCollection.at(ibine).at(ibineta).at(ibinphi).at(ievt)); ievt++; From c872cc60f5d639e889abe5c8759fb16743cee4de Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Wed, 28 Mar 2018 18:34:50 +0200 Subject: [PATCH 262/426] Added default option in other Clear definitiion so coordinated changes aren't needed. --- SimDataFormats/CaloHit/interface/CastorShowerEvent.h | 2 +- SimG4CMS/Forward/src/CastorShowerLibrary.cc | 2 +- .../ShowerLibraryProducer/src/CastorShowerLibraryMaker.cc | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/SimDataFormats/CaloHit/interface/CastorShowerEvent.h b/SimDataFormats/CaloHit/interface/CastorShowerEvent.h index 8b0a6240e449d..e879480b95ee3 100644 --- a/SimDataFormats/CaloHit/interface/CastorShowerEvent.h +++ b/SimDataFormats/CaloHit/interface/CastorShowerEvent.h @@ -21,7 +21,7 @@ CastorShowerEvent(); ~CastorShowerEvent() override; - void Clear(Option_t *) override; + void Clear(Option_t * option ="") override; // private: diff --git a/SimG4CMS/Forward/src/CastorShowerLibrary.cc b/SimG4CMS/Forward/src/CastorShowerLibrary.cc index b9b4911c334c9..399bc1ec47f44 100644 --- a/SimG4CMS/Forward/src/CastorShowerLibrary.cc +++ b/SimG4CMS/Forward/src/CastorShowerLibrary.cc @@ -219,7 +219,7 @@ CastorShowerEvent CastorShowerLibrary::getShowerHits(G4Step * aStep, bool & ok) int parCode = track->GetDefinition()->GetPDGEncoding(); CastorShowerEvent hit; - hit.Clear(""); + hit.Clear(); ok = false; if (parCode == pi0PDG || parCode == etaPDG || parCode == nuePDG || diff --git a/SimG4CMS/ShowerLibraryProducer/src/CastorShowerLibraryMaker.cc b/SimG4CMS/ShowerLibraryProducer/src/CastorShowerLibraryMaker.cc index 2bb2f423a4e75..c61af8581117d 100644 --- a/SimG4CMS/ShowerLibraryProducer/src/CastorShowerLibraryMaker.cc +++ b/SimG4CMS/ShowerLibraryProducer/src/CastorShowerLibraryMaker.cc @@ -531,7 +531,7 @@ void CastorShowerLibraryMaker::update(const EndOfEvent * evt) { NHitInEvent+=shower->getNhit(); NEvtAccepted++; } - else {shower->Clear("");} + else {shower->Clear();} } // Check for unassociated energy @@ -588,8 +588,8 @@ void CastorShowerLibraryMaker::update(const EndOfRun * run) hadInfo= &hadSLHolder.SLInfo; while(nEvtInTreeClear(""); - if (hadShower) hadShower->Clear(""); + if (emShower) emShower->Clear(); + if (hadShower) hadShower->Clear(); while(ibine0){ emShower = &(emSLHolder.SLCollection.at(ibine).at(ibineta).at(ibinphi).at(ievt)); ievt++; From 247da1ddfc7047dc8c0eae42c9b93b904a1a7499 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Wed, 28 Mar 2018 18:37:07 +0200 Subject: [PATCH 263/426] Replace legacy L1 FED monitoring with upgrade FED monitoring. --- .../clients/fed_dqm_sourceclient-live_cfg.py | 10 +++++----- DQM/L1TMonitor/python/L1TStage2FED_cff.py | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 DQM/L1TMonitor/python/L1TStage2FED_cff.py diff --git a/DQM/Integration/python/clients/fed_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/fed_dqm_sourceclient-live_cfg.py index 791e42e1cdaa8..c79fd06451e64 100644 --- a/DQM/Integration/python/clients/fed_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/fed_dqm_sourceclient-live_cfg.py @@ -29,9 +29,9 @@ folder_name = 'FEDIntegrity_EvF' # L1T sequence: -process.load('DQM.L1TMonitor.L1TFED_cfi') +process.load('DQM.L1TMonitor.L1Tstage2FED_cff') # stage2 L1T path = 'L1T/%s/' % folder_name -process.l1tfed.FEDDirName = cms.untracked.string(path) +process.l1tStage2Fed.FEDDirName = cms.untracked.string(path) # Pixel sequence: process.load('Configuration.StandardSequences.MagneticField_cff') process.load('EventFilter.SiPixelRawToDigi.SiPixelRawToDigi_cfi') @@ -80,7 +80,7 @@ # Setting raw data collection label for all subsytem modules, depending on run type: if (process.runType.getRunType() == process.runType.hi_run): - process.l1tfed.rawTag = cms.InputTag('rawDataRepacker') + process.l1tStage2Fed.rawTag = cms.InputTag('rawDataRepacker') process.siPixelDigis.InputLabel = cms.InputTag('rawDataRepacker') process.SiPixelHLTSource.RawInput = cms.InputTag('rawDataRepacker') process.siStripFEDCheck.RawDataTag = cms.InputTag('rawDataRepacker') @@ -93,7 +93,7 @@ process.rpcunpacker.InputLabel = cms.InputTag('rawDataRepacker') process.cscDQMEvF.InputObjects = cms.untracked.InputTag('rawDataRepacker') else: - process.l1tfed.rawTag = cms.InputTag('rawDataCollector') + process.l1tStage2Fed.rawTag = cms.InputTag('rawDataCollector') process.siPixelDigis.InputLabel = cms.InputTag('rawDataCollector') process.SiPixelHLTSource.RawInput = cms.InputTag('rawDataCollector') process.siStripFEDCheck.RawDataTag = cms.InputTag('rawDataCollector') @@ -114,7 +114,7 @@ # Modules for the FED process.FEDModulesPath = cms.Path( - process.l1tfed + process.l1tStage2Fed + process.siPixelDigis + process.SiPixelHLTSource + process.siStripFEDCheck diff --git a/DQM/L1TMonitor/python/L1TStage2FED_cff.py b/DQM/L1TMonitor/python/L1TStage2FED_cff.py new file mode 100644 index 0000000000000..bd21bc1db1558 --- /dev/null +++ b/DQM/L1TMonitor/python/L1TStage2FED_cff.py @@ -0,0 +1,14 @@ +from DQM.L1TMonitor.L1TFED_cfi import * + +l1tStage2Fed = l1tfed.clone() +l1tStage2Fed.L1FEDS = cms.vint32( + 1354, 1356, 1358, # CALOL1 + 1360, # CALOL2 + 1376, 1377, # BMTF + 1380, 1381, # OMTF + 1384, 1385, # EMTF + 1386, # CPPF + 1402, # GMT + 1404, # UGT + 1405) # UGTSPARE + From 12864846c9fe2fbc688f75f3b69a8003987b95db Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Wed, 28 Mar 2018 18:48:14 +0200 Subject: [PATCH 264/426] Increase maximal FED size and label bins of profile histogram. --- DQM/L1TMonitor/src/L1TFED.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DQM/L1TMonitor/src/L1TFED.cc b/DQM/L1TMonitor/src/L1TFED.cc index 161d4d83e1c42..b3b16a4a5b789 100755 --- a/DQM/L1TMonitor/src/L1TFED.cc +++ b/DQM/L1TMonitor/src/L1TFED.cc @@ -34,13 +34,14 @@ void L1TFED::bookHistograms(DQMStore::IBooker & ibooker, edm::Run const & iRun, fedentries = ibooker.book1D("FEDEntries", "Fed ID occupancy", l1feds_.size(), 0.,l1feds_.size() ); fedfatal = ibooker.book1D("FEDFatal", "Fed ID non present ", l1feds_.size(), 0., l1feds_.size()); fednonfatal = ibooker.book1D("FEDNonFatal", "Fed corrupted data ", l1feds_.size(), 0.,l1feds_.size() ); - hfedprof = ibooker.bookProfile("fedprofile","FED Size by ID", l1feds_.size(), 0., l1feds_.size(),0,0.,5000.); + hfedprof = ibooker.bookProfile("fedprofile","FED Size by ID", l1feds_.size(), 0., l1feds_.size(),0,0.,10000.); for(unsigned int i=0;isetBinLabel(i+1,"FED "+ sfed.str()); fedfatal->setBinLabel(i+1,"FED "+ sfed.str()); fednonfatal->setBinLabel(i+1,"FED "+ sfed.str()); + hfedprof->setBinLabel(i+1,"FED "+ sfed.str()); } hfedsize = ibooker.book1D("fedsize","FED Size Distribution",100,0.,10000.); From 9f060f4de0f9556c4f4d97b9cf2f44e5794336f9 Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Wed, 28 Mar 2018 19:25:48 +0200 Subject: [PATCH 265/426] Rename setVertex to setRecoVertex to match getRecoVertex. Added advantage: it no longer shadows setVertex from base class. --- DataFormats/V0Candidate/interface/V0Candidate.h | 3 +-- DataFormats/V0Candidate/src/V0Candidate.cc | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/DataFormats/V0Candidate/interface/V0Candidate.h b/DataFormats/V0Candidate/interface/V0Candidate.h index c116be0986f21..ab99d593e111c 100644 --- a/DataFormats/V0Candidate/interface/V0Candidate.h +++ b/DataFormats/V0Candidate/interface/V0Candidate.h @@ -19,8 +19,7 @@ namespace reco{ const Vertex::CovarianceMatrix vtxCovariance() { return recoVertex.covariance(); } - using LeafCandidate::setVertex; - void setVertex( const Vertex & vtxIn ); + void setRecoVertex( const Vertex & vtxIn ); // virtual int pdgId() const { return PDGid; } // void setPdgId( const int & Id ) { PDGid = Id; } private: diff --git a/DataFormats/V0Candidate/src/V0Candidate.cc b/DataFormats/V0Candidate/src/V0Candidate.cc index eb4fef042c550..18765e87953b1 100644 --- a/DataFormats/V0Candidate/src/V0Candidate.cc +++ b/DataFormats/V0Candidate/src/V0Candidate.cc @@ -2,7 +2,7 @@ using namespace reco; -void V0Candidate::setVertex( const Vertex & vtxIn ) { +void V0Candidate::setRecoVertex( const Vertex & vtxIn ) { recoVertex = vtxIn; LeafCandidate::setVertex( vtxIn.position() ); } From 2c94e8fda59f790ff428a03c599aa0f9c006a5cc Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Wed, 28 Mar 2018 20:46:16 +0200 Subject: [PATCH 266/426] RecoEgamma/PhotonIdentification: fix clang warnings: -Wpessimizing-move, -Winconsistent-missing-override std::vector&& is implied in return values. /build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/llvm/5.0.0-jpkldn/bin/clang++ -c -DGNU_GCC -D_GNU_SOURCE -DEIGEN_DONT_PARALLELIZE -DTBB_USE_GLIBCXX_VERSION=60300 -DBOOST_SPIRIT_THREADSAFE -DPHOENIX_THREADSAFE -DCMSSW_GIT_HASH='CMSSW_10_1_CLANG_X_2018-03-27-2300' -DPROJECT_NAME='CMSSW' -DPROJECT_VERSION='CMSSW_10_1_CLANG_X_2018-03-27-2300' -I/build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/82a05c04338ac50120cfd99cab7eced5/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-27-2300/src -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/cms/coral/CORAL_2_3_21-jpkldn/include/LCG -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/lcg/root/6.10.09-jpkldn/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/boost/1.63.0-jpkldn/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/pcre/8.37-oenich/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/bz2lib/1.0.6/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/clhep/2.4.0.0-jpkldn/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/gsl/2.2.1/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/hepmc/2.06.07-oenich/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/libuuid/2.22.2/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/openssl/1.0.2d/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/python/2.7.11-jpkldn/include/python2.7 -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/sigcpp/2.6.2-oenich/include/sigc++-2.0 -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/tbb/2018_U1/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/cms/vdt/0.4.0/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/xerces-c/3.1.3/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/xz/5.2.2-oenich/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/zlib-x86_64/1.2.11/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/eigen/1ae2849542a7892089f81f2ee460b510cdb0a16d/include/eigen3 -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/md5/1.0.0/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/tinyxml/2.5.3-jpkldn/include -O2 -pthread -pipe -Werror=main -Werror=pointer-arith -Werror=overlength-strings -Wno-vla -Werror=overflow -std=c++1z -ftree-vectorize -Wstrict-overflow -Werror=array-bounds -Werror=type-limits -fvisibility-inlines-hidden -fno-math-errno --param vect-max-version-for-alias-checks=50 -Xassembler --compress-debug-sections -msse3 -felide-constructors -fmessage-length=0 -Wall -Wno-long-long -Wreturn-type -Wunused -Wparentheses -Wno-deprecated -Werror=return-type -Werror=missing-braces -Werror=unused-value -Werror=address -Werror=format -Werror=sign-compare -Werror=write-strings -Werror=delete-non-virtual-dtor -Werror=strict-aliasing -Werror=narrowing -Werror=uninitialized -Werror=reorder -Werror=unused-variable -Werror=conversion-null -Werror=switch -fdiagnostics-show-option -Wno-unused-local-typedefs -Wno-attributes -Wno-c99-extensions -Wno-c++11-narrowing -D__STRICT_ANSI__ -Wno-unused-private-field -Wno-unknown-pragmas -Wno-unused-command-line-argument -Wno-unknown-warning-option -ftemplate-depth=512 -Wno-error=potentially-evaluated-expression -Wno-error=unused-variable -Wno-error=unused-variable -Wno-error=unused-variable -DBOOST_DISABLE_ASSERTS -fPIC -MMD -MF tmp/slc6_amd64_gcc630/src/RecoEgamma/PhotonIdentification/plugins/RecoEgammaPhotonIdentificationPlugins/PhotonMVAValueMapProducer.d /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/82a05c04338ac50120cfd99cab7eced5/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-27-2300/src/RecoEgamma/PhotonIdentification/plugins/PhotonMVAValueMapProducer.cc -o tmp/slc6_amd64_gcc630/src/RecoEgamma/PhotonIdentification/plugins/RecoEgammaPhotonIdentificationPlugins/PhotonMVAValueMapProducer.o /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/82a05c04338ac50120cfd99cab7eced5/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-27-2300/src/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRun2Phys14NonTrig.cc:55:35: warning: moving a temporary object prevents copy elision [-Wpessimizing-move] const std::vector vars = std::move( fillMVAVariables( particle, iEvent ) ); ^ /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/82a05c04338ac50120cfd99cab7eced5/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-27-2300/src/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRun2Phys14NonTrig.cc:55:35: note: remove std::move call here const std::vector vars = std::move( fillMVAVariables( particle, iEvent ) ); ^~~~~~~~~~~ ~ /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/82a05c04338ac50120cfd99cab7eced5/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-27-2300/src/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRun2Phys14NonTrig.cc:309:12: warning: moving a temporary object prevents copy elision [-Wpessimizing-move] vars = std::move( packMVAVariables(allMVAVars.varPhi, ^ /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/82a05c04338ac50120cfd99cab7eced5/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-27-2300/src/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRun2Phys14NonTrig.cc:309:12: note: remove std::move call here vars = std::move( packMVAVariables(allMVAVars.varPhi, ^~~~~~~~~~~ /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/82a05c04338ac50120cfd99cab7eced5/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-27-2300/src/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRun2Phys14NonTrig.cc:331:12: warning: moving a temporary object prevents copy elision [-Wpessimizing-move] vars = std::move( packMVAVariables(allMVAVars.varPhi, ^ /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/82a05c04338ac50120cfd99cab7eced5/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-27-2300/src/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRun2Phys14NonTrig.cc:331:12: note: remove std::move call here vars = std::move( packMVAVariables(allMVAVars.varPhi, ^~~~~~~~~~~ /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/82a05c04338ac50120cfd99cab7eced5/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-27-2300/src/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRun2Spring15NonTrig.cc:62:35: warning: moving a temporary object prevents copy elision [-Wpessimizing-move] const std::vector vars = std::move( fillMVAVariables( particle, iEvent ) ); ^ /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/82a05c04338ac50120cfd99cab7eced5/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-27-2300/src/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRun2Spring15NonTrig.cc:62:35: note: remove std::move call here const std::vector vars = std::move( fillMVAVariables( particle, iEvent ) ); ^~~~~~~~~~~ ~ /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/82a05c04338ac50120cfd99cab7eced5/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-27-2300/src/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRun2Spring15NonTrig.cc:321:12: warning: moving a temporary object prevents copy elision [-Wpessimizing-move] vars = std::move( packMVAVariables(allMVAVars.varPhi, ^ /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/82a05c04338ac50120cfd99cab7eced5/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-27-2300/src/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRun2Spring15NonTrig.cc:321:12: note: remove std::move call here vars = std::move( packMVAVariables(allMVAVars.varPhi, ^~~~~~~~~~~ /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/82a05c04338ac50120cfd99cab7eced5/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-27-2300/src/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRun2Spring15NonTrig.cc:343:12: warning: moving a temporary object prevents copy elision [-Wpessimizing-move] vars = std::move( packMVAVariables(allMVAVars.varPhi, ^ /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/82a05c04338ac50120cfd99cab7eced5/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-27-2300/src/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRun2Spring15NonTrig.cc:343:12: note: remove std::move call here vars = std::move( packMVAVariables(allMVAVars.varPhi, ^~~~~~~~~~~ In file included from /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/82a05c04338ac50120cfd99cab7eced5/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-27-2300/src/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRunIIFall17.cc:1: /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/82a05c04338ac50120cfd99cab7eced5/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-27-2300/src/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRunIIFall17.h:64:9: warning: 'mvaValue' overrides a member function but is not marked 'override' [-Winconsistent-missing-override] float mvaValue( const edm::Ptr& particle, const edm::Event&) const; ^ /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/82a05c04338ac50120cfd99cab7eced5/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-27-2300/src/RecoEgamma/EgammaTools/interface/AnyMVAEstimatorRun2Base.h:22:17: note: overridden virtual function is here virtual float mvaValue( const edm::Ptr& particle, const edm::Event&) const = 0; ^ In file included from /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/82a05c04338ac50120cfd99cab7eced5/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-27-2300/src/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRunIIFall17.cc:1: /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/82a05c04338ac50120cfd99cab7eced5/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-27-2300/src/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRunIIFall17.h:69:15: warning: 'getNCategories' overrides a member function but is not marked 'override' [-Winconsistent-missing-override] virtual int getNCategories() const { return nCategories; } ^ /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/82a05c04338ac50120cfd99cab7eced5/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-27-2300/src/RecoEgamma/EgammaTools/interface/AnyMVAEstimatorRun2Base.h:32:15: note: overridden virtual function is here virtual int getNCategories() const = 0; ^ --- .../plugins/PhotonMVAEstimatorRun2Phys14NonTrig.cc | 10 +++++----- .../plugins/PhotonMVAEstimatorRun2Spring15NonTrig.cc | 10 +++++----- .../plugins/PhotonMVAEstimatorRun2Spring16NonTrig.cc | 10 +++++----- .../plugins/PhotonMVAEstimatorRunIIFall17.h | 4 ++-- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRun2Phys14NonTrig.cc b/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRun2Phys14NonTrig.cc index 4ba2d42fee5aa..e7bfe1f56366b 100644 --- a/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRun2Phys14NonTrig.cc +++ b/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRun2Phys14NonTrig.cc @@ -52,7 +52,7 @@ float PhotonMVAEstimatorRun2Phys14NonTrig:: mvaValue( const edm::Ptr& particle, const edm::Event& iEvent) const { const int iCategory = findCategory( particle ); - const std::vector vars = std::move( fillMVAVariables( particle, iEvent ) ); + const std::vector vars = fillMVAVariables( particle, iEvent ) ; const float result = _gbrForests.at(iCategory)->GetClassifier(vars.data()); // DEBUG @@ -306,7 +306,7 @@ std::vector PhotonMVAEstimatorRun2Phys14NonTrig::fillMVAVariables(const e std::vector vars; if( isEndcapCategory( findCategory( particle ) ) ) { - vars = std::move( packMVAVariables(allMVAVars.varPhi, + vars = packMVAVariables(allMVAVars.varPhi, allMVAVars.varR9, allMVAVars.varSieie, allMVAVars.varSieip, @@ -326,9 +326,9 @@ std::vector PhotonMVAEstimatorRun2Phys14NonTrig::fillMVAVariables(const e // Declare spectator vars allMVAVars.varPt, allMVAVars.varEta) - ); + ; } else { - vars = std::move( packMVAVariables(allMVAVars.varPhi, + vars = packMVAVariables(allMVAVars.varPhi, allMVAVars.varR9, allMVAVars.varSieie, allMVAVars.varSieip, @@ -346,7 +346,7 @@ std::vector PhotonMVAEstimatorRun2Phys14NonTrig::fillMVAVariables(const e // Declare spectator vars allMVAVars.varPt, allMVAVars.varEta) - ); + ; } return vars; diff --git a/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRun2Spring15NonTrig.cc b/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRun2Spring15NonTrig.cc index 8b059b13de524..3f8e86cab1e42 100644 --- a/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRun2Spring15NonTrig.cc +++ b/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRun2Spring15NonTrig.cc @@ -59,7 +59,7 @@ float PhotonMVAEstimatorRun2Spring15NonTrig:: mvaValue(const edm::Ptr& particle, const edm::Event& iEvent) const { const int iCategory = findCategory( particle ); - const std::vector vars = std::move( fillMVAVariables( particle, iEvent ) ); + const std::vector vars = fillMVAVariables( particle, iEvent ) ; const float result = _gbrForests.at(iCategory)->GetClassifier(vars.data()); @@ -318,7 +318,7 @@ std::vector PhotonMVAEstimatorRun2Spring15NonTrig::fillMVAVariables(const std::vector vars; if( isEndcapCategory( findCategory( particle ) ) ) { - vars = std::move( packMVAVariables(allMVAVars.varPhi, + vars = packMVAVariables(allMVAVars.varPhi, allMVAVars.varR9, allMVAVars.varSieie, allMVAVars.varSieip, @@ -338,9 +338,9 @@ std::vector PhotonMVAEstimatorRun2Spring15NonTrig::fillMVAVariables(const // Declare spectator vars allMVAVars.varPt, allMVAVars.varEta) - ); + ; } else { - vars = std::move( packMVAVariables(allMVAVars.varPhi, + vars = packMVAVariables(allMVAVars.varPhi, allMVAVars.varR9, allMVAVars.varSieie, allMVAVars.varSieip, @@ -358,7 +358,7 @@ std::vector PhotonMVAEstimatorRun2Spring15NonTrig::fillMVAVariables(const // Declare spectator vars allMVAVars.varPt, allMVAVars.varEta) - ); + ; } return vars; } diff --git a/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRun2Spring16NonTrig.cc b/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRun2Spring16NonTrig.cc index 9627d47066959..a484d9848ea69 100644 --- a/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRun2Spring16NonTrig.cc +++ b/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRun2Spring16NonTrig.cc @@ -53,7 +53,7 @@ float PhotonMVAEstimatorRun2Spring16NonTrig:: mvaValue(const edm::Ptr& particle, const edm::Event& iEvent) const { const int iCategory = findCategory( particle ); - const std::vector vars = std::move( fillMVAVariables( particle, iEvent ) ); + const std::vector vars = fillMVAVariables( particle, iEvent ) ; const float result = gbrForests_.at(iCategory)->GetClassifier(vars.data()); @@ -279,7 +279,7 @@ std::vector PhotonMVAEstimatorRun2Spring16NonTrig::fillMVAVariables(const // std::vector vars; if( isEndcapCategory( findCategory( particle ) ) ) { - vars = std::move( packMVAVariables( + vars = packMVAVariables( allMVAVars.scPhi, allMVAVars.varR9, allMVAVars.varSieie, @@ -296,9 +296,9 @@ std::vector PhotonMVAEstimatorRun2Spring16NonTrig::fillMVAVariables(const allMVAVars.varESEffSigmaRR, allMVAVars.varESEnOverRawE ) - ); + ; } else { - vars = std::move( packMVAVariables( + vars = packMVAVariables( allMVAVars.scPhi, allMVAVars.varR9, allMVAVars.varSieie, @@ -313,7 +313,7 @@ std::vector PhotonMVAEstimatorRun2Spring16NonTrig::fillMVAVariables(const allMVAVars.varChIsoRaw, allMVAVars.varWorstChRaw ) - ); + ; } return vars; } diff --git a/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRunIIFall17.h b/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRunIIFall17.h index b4d34420bc793..e0e15c8570394 100644 --- a/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRunIIFall17.h +++ b/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRunIIFall17.h @@ -61,12 +61,12 @@ class PhotonMVAEstimatorRunIIFall17 : public AnyMVAEstimatorRun2Base{ ~PhotonMVAEstimatorRunIIFall17(); // Calculation of the MVA value - float mvaValue( const edm::Ptr& particle, const edm::Event&) const; + float mvaValue( const edm::Ptr& particle, const edm::Event&) const override; // Utility functions std::unique_ptr createSingleReader(const int iCategory, const edm::FileInPath &weightFile); - virtual int getNCategories() const { return nCategories; } + virtual int getNCategories() const override { return nCategories; } bool isEndcapCategory( int category ) const; virtual const std::string& getName() const override final { return name_; } virtual const std::string& getTag() const override final { return tag_; } From f9ae17e095aebe4627c80a77cfa4309c777a361b Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Wed, 28 Mar 2018 20:59:50 +0200 Subject: [PATCH 267/426] RecoLocalFastTime/FTLRecProducers: fix clang warning: -Wpessimizing-move && return value is implied in assignment operator. /build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/llvm/5.0.0-jpkldn/bin/clang++ -c -DGNU_GCC -D_GNU_SOURCE -DTBB_USE_GLIBCXX_VERSION=60300 -DBOOST_SPIRIT_THREADSAFE -DPHOENIX_THREADSAFE -DCMSSW_GIT_HASH='CMSSW_10_1_CLANG_X_2018-03-27-2300' -DPROJECT_NAME='CMSSW' -DPROJECT_VERSION='CMSSW_10_1_CLANG_X_2018-03-27-2300' -I/build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/82a05c04338ac50120cfd99cab7eced5/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-27-2300/src -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/lcg/root/6.10.09-jpkldn/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/boost/1.63.0-jpkldn/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/pcre/8.37-oenich/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/bz2lib/1.0.6/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/clhep/2.4.0.0-jpkldn/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/gsl/2.2.1/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/libuuid/2.22.2/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/python/2.7.11-jpkldn/include/python2.7 -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/tbb/2018_U1/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/xerces-c/3.1.3/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/xz/5.2.2-oenich/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/zlib-x86_64/1.2.11/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/md5/1.0.0/include -I/build/cmsbld/jenkins/workspace/build-any-ib/w/slc6_amd64_gcc630/external/tinyxml/2.5.3-jpkldn/include -O2 -pthread -pipe -Werror=main -Werror=pointer-arith -Werror=overlength-strings -Wno-vla -Werror=overflow -std=c++1z -ftree-vectorize -Wstrict-overflow -Werror=array-bounds -Werror=type-limits -fvisibility-inlines-hidden -fno-math-errno --param vect-max-version-for-alias-checks=50 -Xassembler --compress-debug-sections -msse3 -felide-constructors -fmessage-length=0 -Wall -Wno-long-long -Wreturn-type -Wunused -Wparentheses -Wno-deprecated -Werror=return-type -Werror=missing-braces -Werror=unused-value -Werror=address -Werror=format -Werror=sign-compare -Werror=write-strings -Werror=delete-non-virtual-dtor -Werror=strict-aliasing -Werror=narrowing -Werror=uninitialized -Werror=reorder -Werror=unused-variable -Werror=conversion-null -Werror=switch -fdiagnostics-show-option -Wno-unused-local-typedefs -Wno-attributes -Wno-c99-extensions -Wno-c++11-narrowing -D__STRICT_ANSI__ -Wno-unused-private-field -Wno-unknown-pragmas -Wno-unused-command-line-argument -Wno-unknown-warning-option -ftemplate-depth=512 -Wno-error=potentially-evaluated-expression -Wno-error=unused-variable -Wno-error=unused-variable -DBOOST_DISABLE_ASSERTS -fPIC -MMD -MF tmp/slc6_amd64_gcc630/src/RecoLocalFastTime/FTLRecProducers/plugins/RecoLocalFastTimeFTLRecProducersPlugins/FTLUncalibratedRecHitProducer.d /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/82a05c04338ac50120cfd99cab7eced5/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-27-2300/src/RecoLocalFastTime/FTLRecProducers/plugins/FTLUncalibratedRecHitProducer.cc -o tmp/slc6_amd64_gcc630/src/RecoLocalFastTime/FTLRecProducers/plugins/RecoLocalFastTimeFTLRecProducersPlugins/FTLUncalibratedRecHitProducer.o /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/82a05c04338ac50120cfd99cab7eced5/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-27-2300/src/RecoLocalFastTime/FTLRecProducers/plugins/FTLRecHitProducer.cc:75:19: warning: moving a temporary object prevents copy elision [-Wpessimizing-move] auto rechit = std::move(barrel_->makeRecHit(uhit, flags)); ^ /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/82a05c04338ac50120cfd99cab7eced5/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-27-2300/src/RecoLocalFastTime/FTLRecProducers/plugins/FTLRecHitProducer.cc:75:19: note: remove std::move call here auto rechit = std::move(barrel_->makeRecHit(uhit, flags)); ^~~~~~~~~~ ~ /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/82a05c04338ac50120cfd99cab7eced5/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-27-2300/src/RecoLocalFastTime/FTLRecProducers/plugins/FTLRecHitProducer.cc:84:19: warning: moving a temporary object prevents copy elision [-Wpessimizing-move] auto rechit = std::move(endcap_->makeRecHit(uhit, flags)); ^ /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/82a05c04338ac50120cfd99cab7eced5/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-27-2300/src/RecoLocalFastTime/FTLRecProducers/plugins/FTLRecHitProducer.cc:84:19: note: remove std::move call here auto rechit = std::move(endcap_->makeRecHit(uhit, flags)); ^~~~~~~~~~ ~ /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/82a05c04338ac50120cfd99cab7eced5/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-27-2300/src/RecoLocalFastTime/FTLRecProducers/plugins/FTLUncalibratedRecHitProducer.cc:74:31: warning: moving a temporary object prevents copy elision [-Wpessimizing-move] barrelRechits->push_back( std::move(barrel_->makeRecHit(digi)) ); ^ /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/82a05c04338ac50120cfd99cab7eced5/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-27-2300/src/RecoLocalFastTime/FTLRecProducers/plugins/FTLUncalibratedRecHitProducer.cc:74:31: note: remove std::move call here barrelRechits->push_back( std::move(barrel_->makeRecHit(digi)) ); ^~~~~~~~~~ ~ /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/82a05c04338ac50120cfd99cab7eced5/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-27-2300/src/RecoLocalFastTime/FTLRecProducers/plugins/FTLUncalibratedRecHitProducer.cc:81:31: warning: moving a temporary object prevents copy elision [-Wpessimizing-move] endcapRechits->push_back( std::move(endcap_->makeRecHit(digi)) ); ^ /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/82a05c04338ac50120cfd99cab7eced5/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-27-2300/src/RecoLocalFastTime/FTLRecProducers/plugins/FTLUncalibratedRecHitProducer.cc:81:31: note: remove std::move call here endcapRechits->push_back( std::move(endcap_->makeRecHit(digi)) ); ^~~~~~~~~~ ~ --- .../FTLRecProducers/plugins/FTLRecHitProducer.cc | 4 ++-- .../FTLRecProducers/plugins/FTLUncalibratedRecHitProducer.cc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/RecoLocalFastTime/FTLRecProducers/plugins/FTLRecHitProducer.cc b/RecoLocalFastTime/FTLRecProducers/plugins/FTLRecHitProducer.cc index fff0b8e6d9afe..bc874da0819a3 100644 --- a/RecoLocalFastTime/FTLRecProducers/plugins/FTLRecHitProducer.cc +++ b/RecoLocalFastTime/FTLRecProducers/plugins/FTLRecHitProducer.cc @@ -72,7 +72,7 @@ FTLRecHitProducer::produce(edm::Event& evt, const edm::EventSetup& es) { barrelRechits->reserve(hBarrel->size()/2); for(const auto& uhit : *hBarrel) { uint32_t flags = FTLRecHit::kGood; - auto rechit = std::move(barrel_->makeRecHit(uhit, flags)); + auto rechit = barrel_->makeRecHit(uhit, flags); if( flags == FTLRecHit::kGood ) barrelRechits->push_back( std::move(rechit) ); } @@ -81,7 +81,7 @@ FTLRecHitProducer::produce(edm::Event& evt, const edm::EventSetup& es) { endcapRechits->reserve(hEndcap->size()/2); for(const auto& uhit : *hEndcap) { uint32_t flags = FTLRecHit::kGood; - auto rechit = std::move(endcap_->makeRecHit(uhit, flags)); + auto rechit = endcap_->makeRecHit(uhit, flags); if( flags == FTLRecHit::kGood ) endcapRechits->push_back( std::move(rechit) ); } diff --git a/RecoLocalFastTime/FTLRecProducers/plugins/FTLUncalibratedRecHitProducer.cc b/RecoLocalFastTime/FTLRecProducers/plugins/FTLUncalibratedRecHitProducer.cc index 0ed535888a6e9..9467026b045de 100644 --- a/RecoLocalFastTime/FTLRecProducers/plugins/FTLUncalibratedRecHitProducer.cc +++ b/RecoLocalFastTime/FTLRecProducers/plugins/FTLUncalibratedRecHitProducer.cc @@ -71,14 +71,14 @@ FTLUncalibratedRecHitProducer::produce(edm::Event& evt, const edm::EventSetup& e evt.getByToken( ftlbDigis_, hBarrel ); barrelRechits->reserve(hBarrel->size()/2); for(const auto& digi : *hBarrel) { - barrelRechits->push_back( std::move(barrel_->makeRecHit(digi)) ); + barrelRechits->push_back( barrel_->makeRecHit(digi) ); } edm::Handle< FTLDigiCollection > hEndcap; evt.getByToken( ftleDigis_, hEndcap ); endcapRechits->reserve(hEndcap->size()/2); for(const auto& digi : *hEndcap) { - endcapRechits->push_back( std::move(endcap_->makeRecHit(digi)) ); + endcapRechits->push_back( endcap_->makeRecHit(digi) ); } // put the collection of recunstructed hits in the event From e77225f63936a3a9521097e11044bc182b4c738f Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Wed, 28 Mar 2018 22:37:38 +0200 Subject: [PATCH 268/426] RecoTracker/TkNavigation: fix clang warning: -Woverloaded-virtual src/RecoTracker/TkNavigation/plugins/SimpleBarrelNavigableLayer.h:34:3: warning: 'SimpleBarrelNavigableLayer::compatibleLayers' hides overloaded virtual function [-Woverloaded-virtual] compatibleLayers( NavigationDirection direction) const override; ^ src/RecoTracker/TkNavigation/plugins/SimpleNavigableLayer.h:36:35: note: hidden overloaded virtual function 'SimpleNavigableLayer::compatibleLayers' declared here: different number of parameters (3 vs 1) std::vector< const DetLayer * > compatibleLayers (const FreeTrajectoryState &fts, ^ src/RecoTracker/TkNavigation/plugins/SimpleBarrelNavigableLayer.h:37:3: warning: 'SimpleBarrelNavigableLayer::compatibleLayers' hides overloaded virtual function [-Woverloaded-virtual] compatibleLayers( const FreeTrajectoryState& fts, ^ src/RecoTracker/TkNavigation/plugins/SimpleNavigableLayer.h:36:35: note: hidden overloaded virtual function 'SimpleNavigableLayer::compatibleLayers' declared here: different number of parameters (3 vs 2) std::vector< const DetLayer * > compatibleLayers (const FreeTrajectoryState &fts, ^ src/RecoTracker/TkNavigation/plugins/SimpleForwardNavigableLayer.h:29:3: warning: 'SimpleForwardNavigableLayer::compatibleLayers' hides overloaded virtual function [-Woverloaded-virtual] compatibleLayers( NavigationDirection direction) const override; ^ src/RecoTracker/TkNavigation/plugins/SimpleNavigableLayer.h:36:35: note: hidden overloaded virtual function 'SimpleNavigableLayer::compatibleLayers' declared here: different number of parameters (3 vs 1) std::vector< const DetLayer * > compatibleLayers (const FreeTrajectoryState &fts, ^ src/RecoTracker/TkNavigation/plugins/SimpleForwardNavigableLayer.h:32:3: warning: 'SimpleForwardNavigableLayer::compatibleLayers' hides overloaded virtual function [-Woverloaded-virtual] compatibleLayers( const FreeTrajectoryState& fts, ^ src/RecoTracker/TkNavigation/plugins/SimpleNavigableLayer.h:36:35: note: hidden overloaded virtual function 'SimpleNavigableLayer::compatibleLayers' declared here: different number of parameters (3 vs 2) std::vector< const DetLayer * > compatibleLayers (const FreeTrajectoryState &fts, ^ src/RecoTracker/TkNavigation/plugins/CosmicNavigationSchool.cc:47:8: warning: 'CosmicNavigationSchool::establishInverseRelations' hides overloaded virtual function [-Woverloaded-virtual] void establishInverseRelations( SymmetricLayerFinder& symFinder ); ^ src/RecoTracker/TkNavigation/plugins/SimpleNavigationSchool.h:73:16: note: hidden overloaded virtual function 'SimpleNavigationSchool::establishInverseRelations' declared here: different number of parameters (0 vs 1) virtual void establishInverseRelations(); ^ --- RecoTracker/TkNavigation/plugins/CosmicNavigationSchool.cc | 2 +- RecoTracker/TkNavigation/plugins/SimpleNavigableLayer.h | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/RecoTracker/TkNavigation/plugins/CosmicNavigationSchool.cc b/RecoTracker/TkNavigation/plugins/CosmicNavigationSchool.cc index a1e473728bef5..7cc232896d383 100644 --- a/RecoTracker/TkNavigation/plugins/CosmicNavigationSchool.cc +++ b/RecoTracker/TkNavigation/plugins/CosmicNavigationSchool.cc @@ -44,6 +44,7 @@ class dso_hidden CosmicNavigationSchool : public SimpleNavigationSchool { //FakeDetLayer* theFakeDetLayer; void linkBarrelLayers( SymmetricLayerFinder& symFinder) override; //void linkForwardLayers( SymmetricLayerFinder& symFinder); + void establishInverseRelations() override {}; void establishInverseRelations( SymmetricLayerFinder& symFinder ); void buildAdditionalBarrelLinks(); void buildAdditionalForwardLinks(SymmetricLayerFinder& symFinder); @@ -210,7 +211,6 @@ linkBarrelLayers( SymmetricLayerFinder& symFinder) } } - // identical to SimpleNavigationSchool but for the last additional stuff void CosmicNavigationSchool::establishInverseRelations(SymmetricLayerFinder& symFinder) { diff --git a/RecoTracker/TkNavigation/plugins/SimpleNavigableLayer.h b/RecoTracker/TkNavigation/plugins/SimpleNavigableLayer.h index 6081d6f7f6747..c3b4942ce39cc 100644 --- a/RecoTracker/TkNavigation/plugins/SimpleNavigableLayer.h +++ b/RecoTracker/TkNavigation/plugins/SimpleNavigableLayer.h @@ -32,6 +32,13 @@ class dso_hidden SimpleNavigableLayer : public NavigableLayer { void setCheckCrossingSide(bool docheck) {theCheckCrossingSide = docheck;} + virtual std::vector + compatibleLayers( NavigationDirection direction) const = 0; + + virtual std::vector + compatibleLayers( const FreeTrajectoryState& fts, + PropagationDirection timeDirection) const {int counter =0; return compatibleLayers(fts,timeDirection,counter);}; + std::vector< const DetLayer * > compatibleLayers (const FreeTrajectoryState &fts, PropagationDirection timeDirection, From c4278526c6a796f243006234e77eb7642d25032a Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Tue, 27 Mar 2018 21:39:31 +0200 Subject: [PATCH 269/426] RecoTracker/TkNavigation: fixes for these clanf warnings -Woverloaded-virtual In file included from /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/RecoTracker/TkNavigation/plugins/SimpleNavigationSchool.cc:5: /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/RecoTracker/TkNavigation/plugins/SimpleBarrelNavigableLayer.h:34:3: warning: 'SimpleBarrelNavigableLayer::compatibleLayers' hides overloaded virtual function [-Woverloaded-virtual] compatibleLayers( NavigationDirection direction) const override; ^ /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/RecoTracker/TkNavigation/plugins/SimpleNavigableLayer.h:36:35: note: hidden overloaded virtual function 'SimpleNavigableLayer::compatibleLayers' declared here: different number of parameters (3 vs 1) std::vector< const DetLayer * > compatibleLayers (const FreeTrajectoryState &fts, ^ In file included from /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/RecoTracker/TkNavigation/plugins/SimpleNavigationSchool.cc:5: /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/RecoTracker/TkNavigation/plugins/SimpleBarrelNavigableLayer.h:37:3: warning: 'SimpleBarrelNavigableLayer::compatibleLayers' hides overloaded virtual function [-Woverloaded-virtual] compatibleLayers( const FreeTrajectoryState& fts, ^ /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/RecoTracker/TkNavigation/plugins/SimpleNavigableLayer.h:36:35: note: hidden overloaded virtual function 'SimpleNavigableLayer::compatibleLayers' declared here: different number of parameters (3 vs 2) std::vector< const DetLayer * > compatibleLayers (const FreeTrajectoryState &fts, ^ In file included from /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/RecoTracker/TkNavigation/plugins/SimpleNavigationSchool.cc:6: /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/RecoTracker/TkNavigation/plugins/SimpleForwardNavigableLayer.h:29:3: warning: 'SimpleForwardNavigableLayer::compatibleLayers' hides overloaded virtual function [-Woverloaded-virtual] compatibleLayers( NavigationDirection direction) const override; ^ /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/RecoTracker/TkNavigation/plugins/SimpleNavigableLayer.h:36:35: note: hidden overloaded virtual function 'SimpleNavigableLayer::compatibleLayers' declared here: different number of parameters (3 vs 1) std::vector< const DetLayer * > compatibleLayers (const FreeTrajectoryState &fts, ^ In file included from /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/RecoTracker/TkNavigation/plugins/SimpleNavigationSchool.cc:6: /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/RecoTracker/TkNavigation/plugins/SimpleForwardNavigableLayer.h:32:3: warning: 'SimpleForwardNavigableLayer::compatibleLayers' hides overloaded virtual function [-Woverloaded-virtual] compatibleLayers( const FreeTrajectoryState& fts, ^ /build/cmsbld/jenkins/workspace/build-any-ib/w/tmp/BUILDROOT/c6796210c53b02f1870cdf07f5d562c4/opt/cmssw/slc6_amd64_gcc630/cms/cmssw/CMSSW_10_1_CLANG_X_2018-03-26-2300/src/RecoTracker/TkNavigation/plugins/SimpleNavigableLayer.h:36:35: note: hidden overloaded virtual function 'SimpleNavigableLayer::compatibleLayers' declared here: different number of parameters (3 vs 2) std::vector< const DetLayer * > compatibleLayers (const FreeTrajectoryState &fts, ^ --- RecoTracker/TkNavigation/plugins/CosmicNavigationSchool.cc | 1 + RecoTracker/TkNavigation/plugins/SimpleBarrelNavigableLayer.h | 2 ++ RecoTracker/TkNavigation/plugins/SimpleForwardNavigableLayer.h | 2 ++ 3 files changed, 5 insertions(+) diff --git a/RecoTracker/TkNavigation/plugins/CosmicNavigationSchool.cc b/RecoTracker/TkNavigation/plugins/CosmicNavigationSchool.cc index a1e473728bef5..24d565591101a 100644 --- a/RecoTracker/TkNavigation/plugins/CosmicNavigationSchool.cc +++ b/RecoTracker/TkNavigation/plugins/CosmicNavigationSchool.cc @@ -44,6 +44,7 @@ class dso_hidden CosmicNavigationSchool : public SimpleNavigationSchool { //FakeDetLayer* theFakeDetLayer; void linkBarrelLayers( SymmetricLayerFinder& symFinder) override; //void linkForwardLayers( SymmetricLayerFinder& symFinder); + using SimpleNavigationSchool::establishInverseRelations; void establishInverseRelations( SymmetricLayerFinder& symFinder ); void buildAdditionalBarrelLinks(); void buildAdditionalForwardLinks(SymmetricLayerFinder& symFinder); diff --git a/RecoTracker/TkNavigation/plugins/SimpleBarrelNavigableLayer.h b/RecoTracker/TkNavigation/plugins/SimpleBarrelNavigableLayer.h index e800165f8ef20..ee32a394baa7f 100644 --- a/RecoTracker/TkNavigation/plugins/SimpleBarrelNavigableLayer.h +++ b/RecoTracker/TkNavigation/plugins/SimpleBarrelNavigableLayer.h @@ -30,6 +30,8 @@ class dso_hidden SimpleBarrelNavigableLayer final : public SimpleNavigableLayer nextLayers( const FreeTrajectoryState& fts, PropagationDirection timeDirection) const override; + using SimpleNavigableLayer::compatibleLayers; + std::vector compatibleLayers( NavigationDirection direction) const override; diff --git a/RecoTracker/TkNavigation/plugins/SimpleForwardNavigableLayer.h b/RecoTracker/TkNavigation/plugins/SimpleForwardNavigableLayer.h index 396147cdd3077..103047eb8f8ea 100644 --- a/RecoTracker/TkNavigation/plugins/SimpleForwardNavigableLayer.h +++ b/RecoTracker/TkNavigation/plugins/SimpleForwardNavigableLayer.h @@ -25,6 +25,8 @@ class dso_hidden SimpleForwardNavigableLayer final : public SimpleNavigableLayer nextLayers( const FreeTrajectoryState& fts, PropagationDirection timeDirection) const override; + using SimpleNavigableLayer::compatibleLayers; + std::vector compatibleLayers( NavigationDirection direction) const override; From 2b35e5595c10afbb7dc8d3846392871d80f24053 Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Thu, 29 Mar 2018 00:43:20 +0200 Subject: [PATCH 270/426] code checks --- RecoTracker/TkNavigation/plugins/SimpleNavigableLayer.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/RecoTracker/TkNavigation/plugins/SimpleNavigableLayer.h b/RecoTracker/TkNavigation/plugins/SimpleNavigableLayer.h index c3b4942ce39cc..73f1a135e4c7c 100644 --- a/RecoTracker/TkNavigation/plugins/SimpleNavigableLayer.h +++ b/RecoTracker/TkNavigation/plugins/SimpleNavigableLayer.h @@ -32,12 +32,12 @@ class dso_hidden SimpleNavigableLayer : public NavigableLayer { void setCheckCrossingSide(bool docheck) {theCheckCrossingSide = docheck;} - virtual std::vector - compatibleLayers( NavigationDirection direction) const = 0; + std::vector + compatibleLayers( NavigationDirection direction) const override = 0; - virtual std::vector + std::vector compatibleLayers( const FreeTrajectoryState& fts, - PropagationDirection timeDirection) const {int counter =0; return compatibleLayers(fts,timeDirection,counter);}; + PropagationDirection timeDirection) const override {int counter =0; return compatibleLayers(fts,timeDirection,counter);}; std::vector< const DetLayer * > compatibleLayers (const FreeTrajectoryState &fts, From 5cbd3157bada1e896bd4663d97d1c0727adc1876 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Thu, 29 Mar 2018 09:44:11 +0200 Subject: [PATCH 271/426] Fix typo. --- DQM/Integration/python/clients/fed_dqm_sourceclient-live_cfg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DQM/Integration/python/clients/fed_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/fed_dqm_sourceclient-live_cfg.py index c79fd06451e64..9aa9d9c373b70 100644 --- a/DQM/Integration/python/clients/fed_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/fed_dqm_sourceclient-live_cfg.py @@ -29,7 +29,7 @@ folder_name = 'FEDIntegrity_EvF' # L1T sequence: -process.load('DQM.L1TMonitor.L1Tstage2FED_cff') # stage2 L1T +process.load('DQM.L1TMonitor.L1TStage2FED_cff') # stage2 L1T path = 'L1T/%s/' % folder_name process.l1tStage2Fed.FEDDirName = cms.untracked.string(path) # Pixel sequence: From 6c334e1c4500e85e5cb7a6d7e0c761411b056937 Mon Sep 17 00:00:00 2001 From: "S. Lehti" Date: Thu, 29 Mar 2018 11:09:36 +0200 Subject: [PATCH 272/426] HLTTauDQMTagAndProbePlotter: fixed the code-check issue --- DQMOffline/Trigger/src/HLTTauDQMTagAndProbePlotter.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DQMOffline/Trigger/src/HLTTauDQMTagAndProbePlotter.cc b/DQMOffline/Trigger/src/HLTTauDQMTagAndProbePlotter.cc index eb6af642d1e08..f5d5fbf3344a2 100644 --- a/DQMOffline/Trigger/src/HLTTauDQMTagAndProbePlotter.cc +++ b/DQMOffline/Trigger/src/HLTTauDQMTagAndProbePlotter.cc @@ -86,8 +86,8 @@ LV HLTTauDQMTagAndProbePlotter::findTrgObject(std::string pathName, const trigge const unsigned hltFilterIndex = triggerEvent.filterIndex(edm::InputTag(moduleLabels[moduleIndex],"","HLT")); if (hltFilterIndex < triggerEvent.sizeFilters()) { - const trigger::Keys triggerKeys(triggerEvent.filterKeys(hltFilterIndex)); - const trigger::Vids triggerVids(triggerEvent.filterIds(hltFilterIndex)); + const trigger::Keys& triggerKeys(triggerEvent.filterKeys(hltFilterIndex)); + const trigger::Vids& triggerVids(triggerEvent.filterIds(hltFilterIndex)); const unsigned nTriggers = triggerVids.size(); for (size_t iTrig = 0; iTrig < nTriggers; ++iTrig) { From c0d35362446c04feb98ba3516e5fee7da01bffe2 Mon Sep 17 00:00:00 2001 From: nminafra Date: Thu, 29 Mar 2018 12:29:33 +0200 Subject: [PATCH 273/426] Removed try catch --- DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc b/DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc index f77bde35b09db..374e473608d26 100644 --- a/DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc +++ b/DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc @@ -414,15 +414,10 @@ CTPPSDiamondDQMSource::dqmBeginRun( const edm::Run& iRun, const edm::EventSetup& // Rough alignement of pixel detector for diamond thomography const CTPPSPixelDetId pixid(0, CTPPS_PIXEL_STATION_ID, CTPPS_FAR_RP_ID, 0); - try { + if ( iRun.run()>300000 ) { //Pixel installed det = geom->getSensor( pixid ); horizontalShiftBwDiamondPixels_ = det->translation().x() - det->params().at( 0 ) - horizontalShiftOfDiamond_ - 3; } - catch (...) - { - // Pixel not yet installed... tomography will be empty - horizontalShiftBwDiamondPixels_ = 0; - } } From 07cd919ad5ea9e3836b5d31a1e28237d39751410 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Thu, 29 Mar 2018 15:28:09 +0200 Subject: [PATCH 274/426] Stripped the TOTEM timing DQM subpart from the CTPPS DQM --- DQM/CTPPS/python/ctppsDQM_cff.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/DQM/CTPPS/python/ctppsDQM_cff.py b/DQM/CTPPS/python/ctppsDQM_cff.py index 7ee4a5b3b958e..cb6fc665ce3ab 100644 --- a/DQM/CTPPS/python/ctppsDQM_cff.py +++ b/DQM/CTPPS/python/ctppsDQM_cff.py @@ -7,14 +7,11 @@ from DQM.CTPPS.ctppsDiamondDQMSource_cfi import * -from DQM.CTPPS.totemTimingDQMSource_cfi import * - from DQM.CTPPS.ctppsPixelDQMSource_cfi import * ctppsDQM = cms.Sequence( totemDAQTriggerDQMSource + (totemRPDQMSource * totemRPDQMHarvester) + ctppsDiamondDQMSource - + totemTimingDQMSource + ctppsPixelDQMSource ) From de2e6426e15119cc501dbf36afdc7c955b454b13 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Thu, 29 Mar 2018 15:49:25 +0200 Subject: [PATCH 275/426] Further cleanup --- .../plugins/TotemDAQMappingESSourceXML.cc | 6 +- .../CTPPSDigi/interface/TotemTimingDigi.h | 11 +- .../interface/TotemTimingEventInfo.h | 68 +++++------ DataFormats/CTPPSDigi/src/TotemTimingDigi.cc | 8 +- .../interface/RawDataUnpacker.h | 1 - .../interface/RawToDigiConverter.h | 3 - .../interface/TotemSampicFrame.h | 111 +++++++----------- .../python/ctppsRawToDigi_cff.py | 12 -- .../CTPPSRawToDigi/src/RawDataUnpacker.cc | 1 + .../CTPPSRawToDigi/src/RawToDigiConverter.cc | 9 +- 10 files changed, 79 insertions(+), 151 deletions(-) diff --git a/CondFormats/CTPPSReadoutObjects/plugins/TotemDAQMappingESSourceXML.cc b/CondFormats/CTPPSReadoutObjects/plugins/TotemDAQMappingESSourceXML.cc index 4cf21d0d29818..c74d7903014b5 100644 --- a/CondFormats/CTPPSReadoutObjects/plugins/TotemDAQMappingESSourceXML.cc +++ b/CondFormats/CTPPSReadoutObjects/plugins/TotemDAQMappingESSourceXML.cc @@ -38,8 +38,6 @@ #include #include -#include - //#define DEBUG 1 @@ -83,7 +81,7 @@ class TotemDAQMappingESSourceXML: public edm::ESProducer, public edm::EventSetup ~TotemDAQMappingESSourceXML() override; edm::ESProducts< std::shared_ptr, std::shared_ptr > produce( const TotemReadoutRcd & ); - + private: unsigned int verbosity; @@ -753,10 +751,8 @@ void TotemDAQMappingESSourceXML::ParseTreeTotemTiming(ParseType pType, xercesc:: ParseTreeTotemTiming(pType,n ,type ,childId ,mapping ,mask); } - } - //---------------------------------------------------------------------------------------------------- TotemFramePosition TotemDAQMappingESSourceXML::ChipFramePosition(xercesc::DOMNode *chipnode) diff --git a/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h b/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h index 23d5ab5059b9a..14fa5ccf72f40 100644 --- a/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h +++ b/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h @@ -15,8 +15,8 @@ #include -class TotemTimingDigi{ - +class TotemTimingDigi +{ public: TotemTimingDigi(const uint8_t hwId, const uint64_t FPGATimeStamp, const uint16_t TimeStampA, const uint16_t TimeStampB, const uint16_t CellInfo, const std::vector< uint8_t>& Samples, const TotemTimingEventInfo& totemTimingEventInfo); TotemTimingDigi(const TotemTimingDigi& digi); @@ -166,9 +166,6 @@ class TotemTimingDigi{ { totemTimingEventInfo_ = totemTimingEventInfo; } - - - private: uint8_t hwId_; @@ -180,12 +177,10 @@ class TotemTimingDigi{ std::vector< uint8_t > samples_; TotemTimingEventInfo totemTimingEventInfo_; - }; #include - inline bool operator< (const TotemTimingDigi& one, const TotemTimingDigi& other) { if ( one.getEventInfo() < other.getEventInfo() ) @@ -195,7 +190,6 @@ inline bool operator< (const TotemTimingDigi& one, const TotemTimingDigi& other) return false; } - inline std::ostream & operator<<(std::ostream & o, const TotemTimingDigi& digi) { return o << "TotemTimingDigi:" @@ -207,7 +201,6 @@ inline std::ostream & operator<<(std::ostream & o, const TotemTimingDigi& digi) << "\nCellInfo:\t" << std::hex << digi.getCellInfo() << "\nNumberOfSamples:\t" << std::dec << digi.getNumberOfSamples() << std::endl << digi.getEventInfo() << std::endl; - } #endif diff --git a/DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h b/DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h index 003753b5570ff..5ecf6dd0f73a4 100644 --- a/DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h +++ b/DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h @@ -7,15 +7,14 @@ * * \author Mirko Berretti * \author Nicola Minafra - * March 2018 + * \date March 2018 */ #include #include - -class TotemTimingEventInfo{ - +class TotemTimingEventInfo +{ public: TotemTimingEventInfo(const uint8_t hwId, const uint64_t L1ATimeStamp, const uint16_t bunchNumber, const uint32_t orbitNumber, const uint32_t eventNumber, const uint16_t channelMap, const uint16_t L1ALatency, const uint8_t numberOfSamples, const uint8_t offsetOfSamples ); TotemTimingEventInfo(const TotemTimingEventInfo& eventInfo); @@ -26,74 +25,72 @@ class TotemTimingEventInfo{ bool operator==(const TotemTimingEventInfo& eventInfo) const; /// Return digi values number - + /// Hardware Id formatted as: bits 0-3 Channel Id, bit 4 Sampic Id, bits 5-7 Digitizer Board Id inline unsigned int getHardwareId() const { return hwId_; } - + inline unsigned int getHardwareBoardId() const { return (hwId_&0xE0)>>5; } - + inline unsigned int getHardwareSampicId() const { return (hwId_&0x10)>>4; } - + inline unsigned int getHardwareChannelId() const { return (hwId_&0x0F); } - + inline unsigned int getL1ATimeStamp() const { return L1ATimeStamp_; } - + inline unsigned int getBunchNumber() const { return bunchNumber_; } - + inline unsigned int getOrbitNumber() const { return orbitNumber_; } - + inline unsigned int getEventNumber() const { return eventNumber_; } - + inline uint16_t getChannelMap() const { return channelMap_; } - + inline unsigned int getL1ALatency() const { return L1ALatency_; } - + inline unsigned int getNumberOfSamples() const { return numberOfSamples_; } - + inline unsigned int getOffsetOfSamples() const { return offsetOfSamples_; } - + inline uint8_t getPLLInfo() const { return PLLInfo_; } - - /// Set digi values /// Hardware Id formatted as: bits 0-3 Channel Id, bit 4 Sampic Id, bits 5-7 Digitizer Board Id @@ -101,74 +98,69 @@ class TotemTimingEventInfo{ { hwId_ = hwId; } - + inline void setHardwareBoardId(const unsigned int BoardId) { hwId_ &= 0x1F; // Set board bits to 0 hwId_ |= ((BoardId&0x07)<<5) & 0xE0; } - + inline void setHardwareSampicId(const unsigned int SampicId) { hwId_ &= 0xEF; // Set sampic bit to 0 hwId_ |= ((SampicId&0x01)<<4) & 0x10; } - + inline void setHardwareChannelId(const unsigned int ChannelId) { hwId_ &= 0xF0; // Set sampic bit to 0 hwId_ |= (ChannelId&0x0F) & 0x0F; } - + inline void setL1ATimeStamp(const uint64_t L1ATimeStamp) { L1ATimeStamp_ = L1ATimeStamp; } - + inline void setBunchNumber(const uint16_t bunchNumber) { bunchNumber_ = bunchNumber; } - + inline void setOrbitNumber(const uint32_t orbitNumber) { orbitNumber_ = orbitNumber; } - + inline void setEventNumber(const uint32_t eventNumber) { eventNumber_ = eventNumber; } - + inline void setChannelMap(const uint16_t channelMap) { channelMap_ = channelMap; } - + inline void setL1ALatency(const uint16_t L1ALatency) { L1ALatency_ = L1ALatency; } - + inline void setNumberOfSamples(const uint8_t numberOfSamples) { numberOfSamples_ = numberOfSamples; } - + inline void setOffsetOfSamples(const uint8_t offsetOfSamples) { offsetOfSamples_ = offsetOfSamples; } - + inline void setPLLInfo(const uint8_t PLLInfo) { PLLInfo_ = PLLInfo; } - - - - - private: uint8_t hwId_; @@ -181,12 +173,10 @@ class TotemTimingEventInfo{ uint8_t numberOfSamples_; uint8_t offsetOfSamples_; uint8_t PLLInfo_; - }; #include - inline bool operator< (const TotemTimingEventInfo& one, const TotemTimingEventInfo& other) { if ( one.getEventNumber() < other.getEventNumber() ) @@ -198,7 +188,6 @@ inline bool operator< (const TotemTimingEventInfo& one, const TotemTimingEventIn return false; } - inline std::ostream & operator<<(std::ostream & o, const TotemTimingEventInfo& digi) { std::bitset<16> bitsPLLInfo( digi.getPLLInfo() ); @@ -215,7 +204,6 @@ inline std::ostream & operator<<(std::ostream & o, const TotemTimingEventInfo& d << "\nOffset of Samples:\t" << std::dec << digi.getOffsetOfSamples() << "\\nPLL Info:\t" << bitsPLLInfo.to_string() << std::endl; - } #endif diff --git a/DataFormats/CTPPSDigi/src/TotemTimingDigi.cc b/DataFormats/CTPPSDigi/src/TotemTimingDigi.cc index b4d58cfb618a7..6f3e8a0fde658 100644 --- a/DataFormats/CTPPSDigi/src/TotemTimingDigi.cc +++ b/DataFormats/CTPPSDigi/src/TotemTimingDigi.cc @@ -5,11 +5,9 @@ * \author Nicola Minafra */ -#include +#include "DataFormats/CTPPSDigi/interface/TotemTimingDigi.h" -using namespace std; - -TotemTimingDigi::TotemTimingDigi(const uint8_t hwId, const uint64_t FPGATimeStamp, const uint16_t TimeStampA, const uint16_t TimeStampB, const uint16_t CellInfo, const std::vector< uint8_t>& Samples, const TotemTimingEventInfo& totemTimingEventInfo ) : +TotemTimingDigi::TotemTimingDigi(const uint8_t hwId, const uint64_t FPGATimeStamp, const uint16_t TimeStampA, const uint16_t TimeStampB, const uint16_t CellInfo, const std::vector& Samples, const TotemTimingEventInfo& totemTimingEventInfo ) : hwId_(hwId), FPGATimeStamp_(FPGATimeStamp), TimeStampA_(TimeStampA), TimeStampB_(TimeStampB), CellInfo_(CellInfo), samples_(Samples), totemTimingEventInfo_(totemTimingEventInfo) {} @@ -21,7 +19,6 @@ TotemTimingDigi::TotemTimingDigi() : hwId_(0), FPGATimeStamp_(0), TimeStampA_(0), TimeStampB_(0), CellInfo_(0) {} - // Comparison bool TotemTimingDigi::operator==(const TotemTimingDigi& digi) const @@ -32,7 +29,6 @@ TotemTimingDigi::operator==(const TotemTimingDigi& digi) const || TimeStampB_ != digi.getTimeStampB() || CellInfo_ != digi.getCellInfo() || samples_ != digi.getSamples() -// || totemTimingEventInfo_ != digi.getEventInfo() ) return false; else return true; diff --git a/EventFilter/CTPPSRawToDigi/interface/RawDataUnpacker.h b/EventFilter/CTPPSRawToDigi/interface/RawDataUnpacker.h index e98cce40ea823..90075343a1cf6 100644 --- a/EventFilter/CTPPSRawToDigi/interface/RawDataUnpacker.h +++ b/EventFilter/CTPPSRawToDigi/interface/RawDataUnpacker.h @@ -14,7 +14,6 @@ #include "DataFormats/FEDRawData/interface/FEDRawData.h" #include "DataFormats/CTPPSDigi/interface/TotemFEDInfo.h" -#include "DataFormats/FEDRawData/interface/FEDNumbering.h" #include "EventFilter/CTPPSRawToDigi/interface/VFATFrameCollection.h" #include "EventFilter/CTPPSRawToDigi/interface/SimpleVFATFrameCollection.h" diff --git a/EventFilter/CTPPSRawToDigi/interface/RawToDigiConverter.h b/EventFilter/CTPPSRawToDigi/interface/RawToDigiConverter.h index c9ffbf9392d41..944edc9062e43 100644 --- a/EventFilter/CTPPSRawToDigi/interface/RawToDigiConverter.h +++ b/EventFilter/CTPPSRawToDigi/interface/RawToDigiConverter.h @@ -22,9 +22,6 @@ #include "DataFormats/CTPPSDigi/interface/CTPPSDiamondDigi.h" #include "DataFormats/CTPPSDigi/interface/TotemTimingDigi.h" -#include "EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h" -#include "EventFilter/CTPPSRawToDigi/interface/DiamondVFATFrame.h" - /// \brief Collection of code to convert TOTEM raw data into digi. class RawToDigiConverter { diff --git a/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h b/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h index 84b052b0b54ee..1976795447223 100644 --- a/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h +++ b/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h @@ -25,7 +25,7 @@ enum TotemSampicConstant { struct TotemSampicData{ uint8_t samples[TotemSampicConstant::NumberOfSamples]; - TotemSampicData() {}; + TotemSampicData() {} }; #pragma pack(pop) @@ -40,7 +40,7 @@ struct TotemSampicInfo{ uint8_t PlaneChannelId; uint8_t reserved[5]; - TotemSampicInfo() {}; + TotemSampicInfo() {} }; #pragma pack(pop) @@ -58,7 +58,7 @@ struct TotemSampicEventInfo{ uint8_t FWVersion; uint8_t PLLInfo; - TotemSampicEventInfo() {}; + TotemSampicEventInfo() {} }; #pragma pack(pop) @@ -79,8 +79,6 @@ uint8_t GrayToBinary_8bit(const uint8_t &gcode_data) return binary_byte; } - - /** * This class is intended to handle the timing infromation of SAMPIC in the TOTEM implementation **/ @@ -88,8 +86,7 @@ class TotemSampicFrame { public: TotemSampicFrame(const uint8_t* chInfoPtr, const uint8_t* chDataPtr, const uint8_t* eventInfoPtr) : - TotemSampicInfo_(nullptr), TotemSampicData_(nullptr), TotemSampicEventInfo_(nullptr), status_(0) - { + TotemSampicInfo_(nullptr), TotemSampicData_(nullptr), TotemSampicEventInfo_(nullptr), status_(0) { if ( chInfoPtr!=nullptr && chDataPtr!=nullptr && eventInfoPtr!=nullptr) { TotemSampicInfo_ = (TotemSampicInfo*) chInfoPtr; TotemSampicData_ = (TotemSampicData*) chDataPtr; @@ -100,11 +97,9 @@ class TotemSampicFrame } ~TotemSampicFrame() {} - /// Prints the frame. /// If binary is true, binary format is used. - void PrintRaw(bool binary = false) const - { + void PrintRaw(bool binary = false) const { std::cout << "Event Info: " << std::endl; PrintRawBuffer( (uint16_t*) TotemSampicEventInfo_ ); @@ -114,9 +109,8 @@ class TotemSampicFrame std::cout << "Channel Data: " << std::endl; PrintRawBuffer( (uint16_t*) TotemSampicData_ ); } - - void Print() const - { + + void Print() const { std::bitset<16> bitsChannelMap( getChannelMap() ); std::bitset<16> bitsPLLInfo( getPLLInfo() ); std::cout << "TotemSampicFrame:\nEvent:" @@ -140,87 +134,72 @@ class TotemSampicFrame << "\\nPLL Info:\t" << bitsPLLInfo.to_string() << std::endl << std::endl; } - + // All getters - inline uint8_t getHardwareId() const - { + inline uint8_t getHardwareId() const { return status_ * TotemSampicInfo_->hwId; } - - inline uint64_t getFPGATimeStamp() const - { + + inline uint64_t getFPGATimeStamp() const { uint64_t time = 0; - for (int i=0; i<5; ++i) + for (int i=0; i<5; ++i) time += TotemSampicInfo_->FPGATime[i] << 8*1; return status_ * time; } - - inline uint16_t getTimeStampA() const - { + + inline uint16_t getTimeStampA() const { return status_ * GrayToBinary_8bit(TotemSampicInfo_->TimeStampA); } - - inline uint16_t getTimeStampB() const - { + + inline uint16_t getTimeStampB() const { return status_ * GrayToBinary_8bit(TotemSampicInfo_->TimeStampB); } - - inline uint16_t getCellInfo() const - { + + inline uint16_t getCellInfo() const { return status_ * (TotemSampicInfo_->CellInfo & 0x3F); } - - inline int getDetPlane() const - { + + inline int getDetPlane() const { return status_ * ((TotemSampicInfo_->PlaneChannelId & 0xF0)>>4); } - - inline int getDetChannel() const - { + + inline int getDetChannel() const { return status_ * (TotemSampicInfo_->PlaneChannelId & 0xF0); } - - inline int getPLLInfo() const - { + + inline int getPLLInfo() const { return status_ * TotemSampicEventInfo_->PLLInfo; } - - inline int getFWVersion() const - { + + inline int getFWVersion() const { return status_ * TotemSampicEventInfo_->FWVersion; } - - const std::vector< uint8_t > getSamples() const - { - std::vector< uint8_t > samples; + + const std::vector< uint8_t > getSamples() const { + std::vector samples; if (status_) { samples.assign( TotemSampicData_->samples, TotemSampicData_->samples + TotemSampicConstant::NumberOfSamples); std::for_each(samples.begin(), samples.end(), &GrayToBinary_8bit); } return samples; } - - inline unsigned int getNumberOfSamples() const - { + + inline unsigned int getNumberOfSamples() const { return status_ * TotemSampicConstant::NumberOfSamples; } - - - + // Event Info - inline uint8_t getEventHardwareId() const - { + inline uint8_t getEventHardwareId() const { return status_ * TotemSampicEventInfo_->hwId; } - - inline uint64_t getL1ATimeStamp() const - { + + inline uint64_t getL1ATimeStamp() const { uint64_t time = 0; for (int i=0; i<5; ++i) time += TotemSampicEventInfo_->L1ATimeStamp[i] << 8*1; return status_ * time; } - + inline uint16_t getBunchNumber() const { return status_ * TotemSampicEventInfo_->bunchNumber; @@ -255,25 +234,18 @@ class TotemSampicFrame { return status_ * TotemSampicEventInfo_->offsetOfSamples; } - - - - inline bool isOK() const - { + + inline bool isOK() const { return status_; } - - - - + protected: const TotemSampicInfo* TotemSampicInfo_; const TotemSampicData* TotemSampicData_; const TotemSampicEventInfo* TotemSampicEventInfo_; - + int status_; - - + inline void PrintRawBuffer(uint16_t const* buffer, const bool binary=false, const unsigned int size=12) const { for (unsigned int i = 0; i < size; i++) { if (binary) { @@ -285,7 +257,6 @@ class TotemSampicFrame } std::cout << std::endl; } - }; diff --git a/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py b/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py index b3e06f147b9ed..a1f813cf70eaa 100644 --- a/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py +++ b/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py @@ -4,8 +4,6 @@ from EventFilter.CTPPSRawToDigi.totemTriggerRawToDigi_cfi import totemTriggerRawToDigi totemTriggerRawToDigi.rawDataTag = cms.InputTag("rawDataCollector") - - # ---------- Si strips ---------- totemDAQMappingESSourceXML_TrackingStrip = cms.ESSource("TotemDAQMappingESSourceXML", verbosity = cms.untracked.uint32(0), @@ -47,8 +45,6 @@ # totemRPRawToDigi.RawToDigi.printErrorSummary = 1 # totemRPRawToDigi.RawToDigi.printUnknownFrameSummary = 1 - - # ---------- diamonds ---------- totemDAQMappingESSourceXML_TimingDiamond = cms.ESSource("TotemDAQMappingESSourceXML", verbosity = cms.untracked.uint32(0), @@ -78,11 +74,6 @@ from EventFilter.CTPPSRawToDigi.ctppsDiamondRawToDigi_cfi import ctppsDiamondRawToDigi ctppsDiamondRawToDigi.rawDataTag = cms.InputTag("rawDataCollector") - - - - - # ---------- Totem Timing ---------- totemDAQMappingESSourceXML_TotemTiming = cms.ESSource("TotemDAQMappingESSourceXML", verbosity = cms.untracked.uint32(10), @@ -106,10 +97,7 @@ from EventFilter.CTPPSRawToDigi.totemTimingRawToDigi_cfi import totemTimingRawToDigi totemTimingRawToDigi.rawDataTag = cms.InputTag("rawDataCollector") - - # ---------- pixels ---------- - from EventFilter.CTPPSRawToDigi.ctppsPixelDigis_cfi import ctppsPixelDigis ctppsPixelDigis.inputLabel = cms.InputTag("rawDataCollector") diff --git a/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc b/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc index 55ec91c8ab5e8..2f589d90eed5e 100644 --- a/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc +++ b/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc @@ -9,6 +9,7 @@ #include "EventFilter/CTPPSRawToDigi/interface/RawDataUnpacker.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "DataFormats/FEDRawData/interface/FEDNumbering.h" //---------------------------------------------------------------------------------------------------- diff --git a/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc b/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc index 9dfa6eedf62d9..c975ad55b253e 100644 --- a/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc +++ b/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc @@ -6,18 +6,17 @@ * Seyed Mohsen Etesami (setesami@cern.ch) ****************************************************************************/ -#include "EventFilter/CTPPSRawToDigi/interface/RawToDigiConverter.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "EventFilter/CTPPSRawToDigi/interface/RawToDigiConverter.h" #include "EventFilter/CTPPSRawToDigi/interface/CounterChecker.h" - -#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "EventFilter/CTPPSRawToDigi/interface/DiamondVFATFrame.h" +#include "EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h" #include "DataFormats/CTPPSDetId/interface/TotemRPDetId.h" #include "DataFormats/CTPPSDetId/interface/CTPPSDiamondDetId.h" -#include "EventFilter/CTPPSRawToDigi/interface/DiamondVFATFrame.h" #include "DataFormats/CTPPSDetId/interface/TotemTimingDetId.h" - //---------------------------------------------------------------------------------------------------- using namespace std; From 669041d0a05ec575860047cfaec37fe72ac4c15d Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Thu, 29 Mar 2018 15:50:44 +0200 Subject: [PATCH 276/426] Cleanup --- .../test/analyze_vfat_frames.py | 3 +- .../test/test_standard_sequence_cfg.py | 3 +- .../test/test_totem_timing_cfg.py | 31 ++++++++++--------- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/EventFilter/CTPPSRawToDigi/test/analyze_vfat_frames.py b/EventFilter/CTPPSRawToDigi/test/analyze_vfat_frames.py index 64997170ce264..656709fcce142 100644 --- a/EventFilter/CTPPSRawToDigi/test/analyze_vfat_frames.py +++ b/EventFilter/CTPPSRawToDigi/test/analyze_vfat_frames.py @@ -40,4 +40,5 @@ # execution configuration process.p = cms.Path( process.totemVFATFrameAnalyzer -) \ No newline at end of file +) + diff --git a/EventFilter/CTPPSRawToDigi/test/test_standard_sequence_cfg.py b/EventFilter/CTPPSRawToDigi/test/test_standard_sequence_cfg.py index a1ddd56fd1f7f..bffe53cea52a3 100644 --- a/EventFilter/CTPPSRawToDigi/test/test_standard_sequence_cfg.py +++ b/EventFilter/CTPPSRawToDigi/test/test_standard_sequence_cfg.py @@ -44,4 +44,5 @@ ) ) -process.outpath = cms.EndPath(process.output) \ No newline at end of file +process.outpath = cms.EndPath(process.output) + diff --git a/EventFilter/CTPPSRawToDigi/test/test_totem_timing_cfg.py b/EventFilter/CTPPSRawToDigi/test/test_totem_timing_cfg.py index a045a025b6926..404f66d1848a1 100644 --- a/EventFilter/CTPPSRawToDigi/test/test_totem_timing_cfg.py +++ b/EventFilter/CTPPSRawToDigi/test/test_totem_timing_cfg.py @@ -4,19 +4,19 @@ # minimum of logs process.MessageLogger = cms.Service("MessageLogger", - statistics = cms.untracked.vstring(), - destinations = cms.untracked.vstring('cerr'), - cerr = cms.untracked.PSet( - threshold = cms.untracked.string('WARNING') - ) + statistics = cms.untracked.vstring(), + destinations = cms.untracked.vstring('cerr'), + cerr = cms.untracked.PSet( + threshold = cms.untracked.string('WARNING') + ) ) # raw data source process.source = cms.Source("NewEventStreamFileReader", - fileNames = cms.untracked.vstring( -# '/store/express/Run2016H/ExpressPhysics/FEVT/Express-v2/000/283/877/00000/4EE44B0E-2499-E611-A155-02163E011938.root' - 'file:/eos/cms/store/group/dpg_ctpps/comm_ctpps/TotemTiming/Minidaq/519/run312519_ls0002_streamA_StorageManager.dat' - ) + fileNames = cms.untracked.vstring( +# '/store/express/Run2016H/ExpressPhysics/FEVT/Express-v2/000/283/877/00000/4EE44B0E-2499-E611-A155-02163E011938.root' + 'file:/eos/cms/store/group/dpg_ctpps/comm_ctpps/TotemTiming/Minidaq/519/run312519_ls0002_streamA_StorageManager.dat' + ) ) process.maxEvents = cms.untracked.PSet( @@ -37,11 +37,12 @@ # output configuration process.output = cms.OutputModule("PoolOutputModule", - fileName = cms.untracked.string("file:./totemTiming_digi.root"), - outputCommands = cms.untracked.vstring( - 'drop *', - 'keep *_*totemTimingRawToDigi_*_*', - ) + fileName = cms.untracked.string("file:./totemTiming_digi.root"), + outputCommands = cms.untracked.vstring( + 'drop *', + 'keep *_*totemTimingRawToDigi_*_*', + ) ) -process.outpath = cms.EndPath(process.output) \ No newline at end of file +process.outpath = cms.EndPath(process.output) + From 5fb1804bec5103d4c82eca2aa388bca19fc5fe77 Mon Sep 17 00:00:00 2001 From: Giacomo Govi Date: Thu, 29 Mar 2018 16:39:48 +0200 Subject: [PATCH 277/426] Added scripts for o2o steering in offline and online --- CondCore/Utilities/o2o/deploy_offline.sh | 79 ++++++++++++++ CondCore/Utilities/o2o/deploy_online.sh | 89 ++++++++++++++++ .../o2o/deployed/offline/EcalLaser.sh | 3 + .../o2o/deployed/offline/EcalLaserTest.sh | 3 + .../o2o/deployed/offline/EcalLaser_express.sh | 3 + .../deployed/offline/EcalLaser_expressTest.sh | 3 + .../o2o/deployed/offline/SiStripDCS.crontab | 4 + .../o2o/deployed/offline/SiStripDCS.sh | 18 ++++ .../deployed/offline/runTimeBasedO2O.crontab | 1 + .../o2o/deployed/offline/runTimeBasedO2O.sh | 26 +++++ .../o2o/deployed/offline/setStripO2O.sh | 33 ++++++ .../o2o/deployed/offline/setupO2O.sh | 100 ++++++++++++++++++ .../Utilities/o2o/deployed/online/EcalDAQ.sh | 3 + .../o2o/deployed/online/EcalDAQTest.sh | 3 + .../Utilities/o2o/deployed/online/EcalDCS.sh | 3 + .../o2o/deployed/online/EcalDCSTest.sh | 3 + .../Utilities/o2o/deployed/online/EcalTPG.sh | 68 ++++++++++++ .../o2o/deployed/online/EcalTPGTest.sh | 55 ++++++++++ .../o2o/deployed/online/RunInfoStart.sh | 3 + .../o2o/deployed/online/RunInfoStartTest.sh | 3 + .../o2o/deployed/online/RunInfoStop.sh | 3 + .../o2o/deployed/online/RunInfoStopTest.sh | 3 + .../Utilities/o2o/deployed/online/runStart.sh | 16 +++ .../Utilities/o2o/deployed/online/runStop.sh | 14 +++ .../o2o/deployed/online/runTestStart.sh | 15 +++ .../o2o/deployed/online/runTestStop.sh | 13 +++ .../Utilities/o2o/deployed/online/setupO2O.sh | 100 ++++++++++++++++++ CondCore/Utilities/o2o/templates/EcalDAQ.sh | 3 + .../Utilities/o2o/templates/EcalDAQTest.sh | 3 + CondCore/Utilities/o2o/templates/EcalDCS.sh | 3 + .../Utilities/o2o/templates/EcalDCSTest.sh | 3 + CondCore/Utilities/o2o/templates/EcalLaser.sh | 3 + .../Utilities/o2o/templates/EcalLaserTest.sh | 3 + .../o2o/templates/EcalLaser_express.sh | 3 + .../o2o/templates/EcalLaser_expressTest.sh | 3 + CondCore/Utilities/o2o/templates/EcalTPG.sh | 68 ++++++++++++ .../Utilities/o2o/templates/RunInfoStart.sh | 3 + .../o2o/templates/RunInfoStartTest.sh | 3 + .../Utilities/o2o/templates/RunInfoStop.sh | 3 + .../o2o/templates/RunInfoStopTest.sh | 3 + .../Utilities/o2o/templates/SiStripDCS.sh | 18 ++++ .../Utilities/o2o/templates/ecal_laser.sh | 26 +++++ CondCore/Utilities/o2o/templates/runStart.sh | 16 +++ CondCore/Utilities/o2o/templates/runStop.sh | 13 +++ .../Utilities/o2o/templates/runTestStart.sh | 15 +++ .../Utilities/o2o/templates/runTestStop.sh | 13 +++ CondCore/Utilities/o2o/templates/setStrip.sh | 33 ++++++ CondCore/Utilities/o2o/templates/setup.sh | 95 +++++++++++++++++ 48 files changed, 1000 insertions(+) create mode 100644 CondCore/Utilities/o2o/deploy_offline.sh create mode 100644 CondCore/Utilities/o2o/deploy_online.sh create mode 100755 CondCore/Utilities/o2o/deployed/offline/EcalLaser.sh create mode 100755 CondCore/Utilities/o2o/deployed/offline/EcalLaserTest.sh create mode 100755 CondCore/Utilities/o2o/deployed/offline/EcalLaser_express.sh create mode 100755 CondCore/Utilities/o2o/deployed/offline/EcalLaser_expressTest.sh create mode 100644 CondCore/Utilities/o2o/deployed/offline/SiStripDCS.crontab create mode 100755 CondCore/Utilities/o2o/deployed/offline/SiStripDCS.sh create mode 100644 CondCore/Utilities/o2o/deployed/offline/runTimeBasedO2O.crontab create mode 100755 CondCore/Utilities/o2o/deployed/offline/runTimeBasedO2O.sh create mode 100755 CondCore/Utilities/o2o/deployed/offline/setStripO2O.sh create mode 100755 CondCore/Utilities/o2o/deployed/offline/setupO2O.sh create mode 100755 CondCore/Utilities/o2o/deployed/online/EcalDAQ.sh create mode 100755 CondCore/Utilities/o2o/deployed/online/EcalDAQTest.sh create mode 100755 CondCore/Utilities/o2o/deployed/online/EcalDCS.sh create mode 100755 CondCore/Utilities/o2o/deployed/online/EcalDCSTest.sh create mode 100755 CondCore/Utilities/o2o/deployed/online/EcalTPG.sh create mode 100755 CondCore/Utilities/o2o/deployed/online/EcalTPGTest.sh create mode 100644 CondCore/Utilities/o2o/deployed/online/RunInfoStart.sh create mode 100644 CondCore/Utilities/o2o/deployed/online/RunInfoStartTest.sh create mode 100644 CondCore/Utilities/o2o/deployed/online/RunInfoStop.sh create mode 100644 CondCore/Utilities/o2o/deployed/online/RunInfoStopTest.sh create mode 100755 CondCore/Utilities/o2o/deployed/online/runStart.sh create mode 100755 CondCore/Utilities/o2o/deployed/online/runStop.sh create mode 100755 CondCore/Utilities/o2o/deployed/online/runTestStart.sh create mode 100755 CondCore/Utilities/o2o/deployed/online/runTestStop.sh create mode 100755 CondCore/Utilities/o2o/deployed/online/setupO2O.sh create mode 100755 CondCore/Utilities/o2o/templates/EcalDAQ.sh create mode 100755 CondCore/Utilities/o2o/templates/EcalDAQTest.sh create mode 100755 CondCore/Utilities/o2o/templates/EcalDCS.sh create mode 100755 CondCore/Utilities/o2o/templates/EcalDCSTest.sh create mode 100755 CondCore/Utilities/o2o/templates/EcalLaser.sh create mode 100755 CondCore/Utilities/o2o/templates/EcalLaserTest.sh create mode 100755 CondCore/Utilities/o2o/templates/EcalLaser_express.sh create mode 100755 CondCore/Utilities/o2o/templates/EcalLaser_expressTest.sh create mode 100755 CondCore/Utilities/o2o/templates/EcalTPG.sh create mode 100644 CondCore/Utilities/o2o/templates/RunInfoStart.sh create mode 100644 CondCore/Utilities/o2o/templates/RunInfoStartTest.sh create mode 100644 CondCore/Utilities/o2o/templates/RunInfoStop.sh create mode 100644 CondCore/Utilities/o2o/templates/RunInfoStopTest.sh create mode 100755 CondCore/Utilities/o2o/templates/SiStripDCS.sh create mode 100755 CondCore/Utilities/o2o/templates/ecal_laser.sh create mode 100755 CondCore/Utilities/o2o/templates/runStart.sh create mode 100755 CondCore/Utilities/o2o/templates/runStop.sh create mode 100755 CondCore/Utilities/o2o/templates/runTestStart.sh create mode 100755 CondCore/Utilities/o2o/templates/runTestStop.sh create mode 100755 CondCore/Utilities/o2o/templates/setStrip.sh create mode 100755 CondCore/Utilities/o2o/templates/setup.sh diff --git a/CondCore/Utilities/o2o/deploy_offline.sh b/CondCore/Utilities/o2o/deploy_offline.sh new file mode 100644 index 0000000000000..aec7e3669ba5e --- /dev/null +++ b/CondCore/Utilities/o2o/deploy_offline.sh @@ -0,0 +1,79 @@ +#!/bin/sh + +home=~ +localhome=/data/condbpro +root=/data/O2O +cmsswroot=/cvmfs/cms.cern.ch/ +extroot=/data/ext +release=CMSSW_10_0_5 +arch=slc6_amd64_gcc630 +sourceroot=CondCore/Utilities/o2o/templates +source=$cmsswroot/$arch/cms/cmssw/$release/src/$sourceroot + +files=( setup.sh + setStrip.sh + SiStripDCS.sh + ecal_laser.sh + EcalLaser.sh + EcalLaserTest.sh + EcalLaser_express.sh + EcalLaser_expressTest.sh ) + +folders=( EcalLaser + EcalLaserTest + EcalLaser_express + EcalLaser_expressTest + SiStrip ) + +cd $root +if [ ! -d scripts ]; then + mkdir scripts +fi +if [ ! -d logs ]; then + mkdir logs +fi + +sed_fmt () { + var=$(echo $1 | sed -e "s#/#\\\/#g") +} + +replace_params () { + params=( @root + @home + @cmsswroot + @extroot ) + tgt_file=$1 + var='' + # replace path params + sed_fmt $root + tgt_root=$var + sed -i -e s/@root/$tgt_root/g $tgt_file + sed_fmt $cmsswroot + tgt_cmsswroot=$var + sed -i -e s/@cmsswroot/$tgt_cmsswroot/g $tgt_file + sed_fmt $extroot + tgt_extroot=$var + sed -i -e s/@extroot/$tgt_extroot/g $tgt_file + sed_fmt $home + tgt_home=$var + # relace non-path params + sed -i -e s/@home/$tgt_home/g $tgt_file + sed -i -e s/@release/$release/g $tgt_file + sed -i -e s/@arch/$arch/g $tgt_file +} + +for file in "${files[@]}" +do + cp $source/$file scripts/ + tgt_file=scripts/$file + replace_params $tgt_file +done +for f in "${folders[@]}" +do + if [ ! -d $f ]; then + mkdir -p $f + fi + if [ ! -d logs/$f ]; then + mkdir logs/$f + fi +done diff --git a/CondCore/Utilities/o2o/deploy_online.sh b/CondCore/Utilities/o2o/deploy_online.sh new file mode 100644 index 0000000000000..94b7561325285 --- /dev/null +++ b/CondCore/Utilities/o2o/deploy_online.sh @@ -0,0 +1,89 @@ +#!/bin/sh + +home=~ +localhome=/data/popconpro +root=/data/O2O +cmsswroot=/opt/offline +extroot=/data/ext +release=CMSSW_10_0_5 +arch=slc7_amd64_gcc630 +sourceroot=CondCore/Utilities/o2o/templates +source=$cmsswroot/$arch/cms/cmssw/$release/src/$sourceroot + +files=( setup.sh + runStart.sh + runTestStart.sh + runStop.sh + runTestStop.sh + EcalDAQ.sh + EcalDAQTest.sh + EcalDCS.sh + EcalDCSTest.sh + EcalTPG.sh + RunInfoStart.sh + RunInfoStop.sh + RunInfoStartTest.sh + RunInfoStopTest.sh ) + +folders=( EcalDAQ + EcalDAQTest + EcalDCS + EcalDCSTest + EcalTPG + RunInfoStart + RunInfoStop + RunInfoStartTest + RunInfoStopTest ) + +cd $root +if [ ! -d scripts ]; then + mkdir scripts +fi +if [ ! -d logs ]; then + mkdir logs +fi + +sed_fmt () { + var=$(echo $1 | sed -e "s#/#\\\/#g") +} + +replace_params () { + params=( @root + @home + @cmsswroot + @extroot ) + tgt_file=$1 + var='' + # replace path params + sed_fmt $root + tgt_root=$var + sed -i -e s/@root/$tgt_root/g $tgt_file + sed_fmt $cmsswroot + tgt_cmsswroot=$var + sed -i -e s/@cmsswroot/$tgt_cmsswroot/g $tgt_file + sed_fmt $extroot + tgt_extroot=$var + sed -i -e s/@extroot/$tgt_extroot/g $tgt_file + sed_fmt $home + tgt_home=$var + # relace non-path params + sed -i -e s/@home/$tgt_home/g $tgt_file + sed -i -e s/@release/$release/g $tgt_file + sed -i -e s/@arch/$arch/g $tgt_file +} + +for file in "${files[@]}" +do + cp $source/$file scripts/ + tgt_file=scripts/$file + replace_params $tgt_file +done +for f in "${folders[@]}" +do + if [ ! -d $f ]; then + mkdir -p $f + fi + if [ ! -d logs/$f ]; then + mkdir logs/$f + fi +done diff --git a/CondCore/Utilities/o2o/deployed/offline/EcalLaser.sh b/CondCore/Utilities/o2o/deployed/offline/EcalLaser.sh new file mode 100755 index 0000000000000..c625c82aec887 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/offline/EcalLaser.sh @@ -0,0 +1,3 @@ +source /data/O2O/scripts/setupO2O.sh -s Ecal -j Laser +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python +submit_popCon EcalLaser $SRCDIR/EcalLaser_prompt_popcon.py diff --git a/CondCore/Utilities/o2o/deployed/offline/EcalLaserTest.sh b/CondCore/Utilities/o2o/deployed/offline/EcalLaserTest.sh new file mode 100755 index 0000000000000..61c71e74e4042 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/offline/EcalLaserTest.sh @@ -0,0 +1,3 @@ +source /data/O2O/scripts/setupO2O.sh -s Ecal -j LaserTest +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python +submit_popCon EcalLaserTest $SRCDIR/EcalLaser_prompt_popcon.py diff --git a/CondCore/Utilities/o2o/deployed/offline/EcalLaser_express.sh b/CondCore/Utilities/o2o/deployed/offline/EcalLaser_express.sh new file mode 100755 index 0000000000000..4db2775f4fea0 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/offline/EcalLaser_express.sh @@ -0,0 +1,3 @@ +source /data/O2O/scripts/setupO2O.sh -s Ecal -j Laser_express +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python +submit_popCon EcalLaser_express $SRCDIR/EcalLaser_express_popcon.py diff --git a/CondCore/Utilities/o2o/deployed/offline/EcalLaser_expressTest.sh b/CondCore/Utilities/o2o/deployed/offline/EcalLaser_expressTest.sh new file mode 100755 index 0000000000000..771c6cc78a5ca --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/offline/EcalLaser_expressTest.sh @@ -0,0 +1,3 @@ +source /data/O2O/scripts/setupO2O_new.sh -s Ecal -j Laser_expressTest +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python +submit_test_popCon EcalLaser_expressTest $SRCDIR/EcalLaser_express_popcon.py diff --git a/CondCore/Utilities/o2o/deployed/offline/SiStripDCS.crontab b/CondCore/Utilities/o2o/deployed/offline/SiStripDCS.crontab new file mode 100644 index 0000000000000..a09be0c0cb4e9 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/offline/SiStripDCS.crontab @@ -0,0 +1,4 @@ +5 * * * * /data/O2O/scripts/SiStripDCS.sh SiStripDetVOff_1hourDelay +20 * * * * /data/O2O/scripts/SiStripDCS.sh SiStripDetVOff_13hourDelay +40 * * * * /data/O2O/scripts/SiStripDCS.sh SiStripDetVOff_prompt +45 * * * * /data/O2O/scripts/SiStripDCS.sh SiStripDetVOff_sampling_test \ No newline at end of file diff --git a/CondCore/Utilities/o2o/deployed/offline/SiStripDCS.sh b/CondCore/Utilities/o2o/deployed/offline/SiStripDCS.sh new file mode 100755 index 0000000000000..6c4b3bdd5fa32 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/offline/SiStripDCS.sh @@ -0,0 +1,18 @@ +#!/bin/sh +# +# wrapper script to run DCS O2O +# Last updated: Apr 21, 2017 +# Author: Huilin Qu +# +# Usage: SiStripDCS.sh JOB_NAME + +JOBNAME=$1 + +O2O_HOME=/data/O2O/ + +source $O2O_HOME/scripts/setStripO2O.sh $JOBNAME +o2oRun_SiStripDCS.py $JOBNAME |tee -a $LOGFILE + +# Exit with status of last command +# Make sure the last command is o2oRun_SiStripDCS.py! +exit $? diff --git a/CondCore/Utilities/o2o/deployed/offline/runTimeBasedO2O.crontab b/CondCore/Utilities/o2o/deployed/offline/runTimeBasedO2O.crontab new file mode 100644 index 0000000000000..e3e73bb7ebd2c --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/offline/runTimeBasedO2O.crontab @@ -0,0 +1 @@ +0 */2 * * * /bin/sh /data/O2O/scripts/runTimeBasedO2O.sh >/dev/null 2>&1 diff --git a/CondCore/Utilities/o2o/deployed/offline/runTimeBasedO2O.sh b/CondCore/Utilities/o2o/deployed/offline/runTimeBasedO2O.sh new file mode 100755 index 0000000000000..1db430b3a498e --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/offline/runTimeBasedO2O.sh @@ -0,0 +1,26 @@ +#!/bin/bash +####### ------ beginning -------- ####################### +BASEDIR=/data/O2O +LOGFILE=${BASEDIR}/logs/TimeBasedO2O.log +DATE=`date` +echo " " | tee -a $LOGFILE +echo "----- new cronjob started for Time Based O2O at -----" | tee -a $LOGFILE +echo "$DATE" | tee -a $LOGFILE + +#Check if the exportation scripts are running, if so exits without launching them +PID_0=`ps aux | grep '/bin/sh /data/O2O/scripts/EcalLaser.sh' | grep -v grep | awk '{print $2}'` +if [ "${PID_0}" ] + then + echo "Ecal Laser Exportation script still running with pid ${PID_0}: exiting" | tee -a $LOGFILE + exit 1 +else + /bin/sh /data/O2O/scripts/EcalLaser.sh +fi +PID_1=`ps aux | grep '/bin/sh /data/O2O/scripts/EcalLaser_express.sh' | grep -v grep | awk '{print $2}'` +if [ "${PID_1}" ] + then + echo "Ecal LaserExpress Exportation script still running with pid ${PID_1}: exiting" | tee -a $LOGFILE + exit 1 +else + /bin/sh /data/O2O/scripts/EcalLaser_express.sh +fi diff --git a/CondCore/Utilities/o2o/deployed/offline/setStripO2O.sh b/CondCore/Utilities/o2o/deployed/offline/setStripO2O.sh new file mode 100755 index 0000000000000..d06950b821034 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/offline/setStripO2O.sh @@ -0,0 +1,33 @@ +#!/bin/sh +# +# set the CMSSW environtmet for SiStripO2O +# and the proxies for conditionUploader +# + +O2ONAME=$1 + +# deployment-specific params +BASEDIR=/data/O2O +SCRAM_ARCH=slc6_amd64_gcc630 +RELEASE=CMSSW_10_0_5 +RELEASEDIR=/cvmfs/cms.cern.ch/slc6_amd64_gcc630/cms/cmssw/${RELEASE} + +source /cvmfs/cms.cern.ch/cmsset_default.sh +cd ${RELEASEDIR}/src +eval `scramv1 ru -sh` +cd - + +O2O_HOME=/data/O2O/SiStrip/ + +# for sqlalchmey (?) +export PYTHON_EGG_CACHE=/data/condbpro +# path to .netrc file and .cms_cond dir +export COND_AUTH_PATH=/data/O2O/SiStrip + +# save log files produced by o2oRun.py on disk +export JOBDIR=${O2O_HOME}/jobs/${O2ONAME} +export O2O_LOG_FOLDER=${BASEDIR}/logs/${O2ONAME} +export LOGFILE=${BASEDIR}/logs/$O2ONAME.log + +# temperoray fix for TNS_ADMIN +export TNS_ADMIN=/cvmfs/cms.cern.ch/slc6_amd64_gcc530/cms/oracle-env/29/etc diff --git a/CondCore/Utilities/o2o/deployed/offline/setupO2O.sh b/CondCore/Utilities/o2o/deployed/offline/setupO2O.sh new file mode 100755 index 0000000000000..1a3a7caf9d5d8 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/offline/setupO2O.sh @@ -0,0 +1,100 @@ +#!/bin/sh + +# deployment-specific params +BASEDIR=/data/O2O +RELEASE=CMSSW_10_0_5 +RELEASEDIR=/cvmfs/cms.cern.ch/slc6_amd64_gcc630/cms/cmssw/${RELEASE} + +# command params +OPTIND=1 + +SUBSYS="" +JOBNAME="" + +while getopts "h?s:j:" opt; do + case $opt in + h|\?) + echo "Mo' to spiego..." + exit 0 + ;; + s) SUBSYS=$OPTARG + ;; + j) JOBNAME=$OPTARG + ;; + esac +done + +shift $((OPTIND-1)) + +[ "$1" = "--" ] && shift + +O2ONAME=$SUBSYS$JOBNAME +#echo "name=$O2ONAME, subsystem=$SUBSYS, job=$JOBNAME" + +# o2o specific params +LOGFILE=${BASEDIR}/logs/$O2ONAME.log +JOBDIR=${BASEDIR}/${SUBSYS}/${JOBNAME} +DATE=`date` + +# functions +function logRun(){ + echo "----- new job started for $1 at -----" | tee -a $LOGFILE + echo $DATE | tee -a $LOGFILE +} + +function log() { + echo "[`date`] : $@ " | tee -a $LOGFILE +} + +function submit_command() { + logRun $1 + o2o run -n $1 "$2" | tee -a $LOGFILE +} + +function submit_test_command() { + logRun $1 + o2o --db dev run -n $1 "$2" | tee -a $LOGFILE +} + +function submit_cmsRun() { + COMMAND="cmsRun $2 destinationDatabase={db} destinationTag={tag}" + logRun $1 + o2o run -n $1 "$COMMAND" | tee -a $LOGFILE +} + +function submit_test_cmsRun() { + COMMAND="cmsRun $2 destinationDatabase={db} destinationTag={tag}" + logRun $1 + o2o --db dev run -n $1 "$COMMAND" | tee -a $LOGFILE +} + +function submit_popCon() { + COMMAND="popconRun $2 -d {db} -t {tag} -c" + logRun $1 + o2o run -n $1 "$COMMAND" | tee -a $LOGFILE +} + +function submit_test_popCon() { + COMMAND="popconRun $2 -d {db} -t {tag} -c" + logRun $1 + o2o --db dev run -n $1 "$COMMAND" | tee -a $LOGFILE +} + +# global variables +export PYTHON_EGG_CACHE=/data/condbpro +export SCRAM_ARCH=slc6_amd64_gcc630 +export O2O_LOG_FOLDER=/data/O2O/logs/${O2ONAME} +export COND_AUTH_PATH=$BASEDIR +source /cvmfs/cms.cern.ch/cmsset_default.sh + +cd ${RELEASEDIR}/src +eval `scramv1 run -sh` +# set up OCCI workaround +export LD_PRELOAD=$CMS_ORACLEOCCI_LIB + +# workaround for oracle tnsnames +export TNS_ADMIN=/cvmfs/cms.cern.ch/slc6_amd64_gcc530/cms/oracle-env/29/etc + +cd ${JOBDIR} + + diff --git a/CondCore/Utilities/o2o/deployed/online/EcalDAQ.sh b/CondCore/Utilities/o2o/deployed/online/EcalDAQ.sh new file mode 100755 index 0000000000000..924483807112c --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/online/EcalDAQ.sh @@ -0,0 +1,3 @@ +source /data/O2O/scripts/setupO2O.sh -s Ecal -j DAQ +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python +submit_popCon EcalDAQ $SRCDIR/EcalDAQ_popcon.py diff --git a/CondCore/Utilities/o2o/deployed/online/EcalDAQTest.sh b/CondCore/Utilities/o2o/deployed/online/EcalDAQTest.sh new file mode 100755 index 0000000000000..b9d5f6dfe6559 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/online/EcalDAQTest.sh @@ -0,0 +1,3 @@ +source /data/O2O/scripts/setupO2O.sh -s Ecal -j DAQTest +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python +submit_popCon EcalDAQTest $SRCDIR/EcalDAQ_popcon.py diff --git a/CondCore/Utilities/o2o/deployed/online/EcalDCS.sh b/CondCore/Utilities/o2o/deployed/online/EcalDCS.sh new file mode 100755 index 0000000000000..0fbdf27fa6bf3 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/online/EcalDCS.sh @@ -0,0 +1,3 @@ +source /data/O2O/scripts/setupO2O.sh -s Ecal -j DCS +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python +submit_popCon EcalDCS $SRCDIR/EcalDCS_popcon.py diff --git a/CondCore/Utilities/o2o/deployed/online/EcalDCSTest.sh b/CondCore/Utilities/o2o/deployed/online/EcalDCSTest.sh new file mode 100755 index 0000000000000..a86c72eb59369 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/online/EcalDCSTest.sh @@ -0,0 +1,3 @@ +source /data/O2O/scripts/setupO2O.sh -s Ecal -j DCSTest +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python +submit_popCon EcalDCSTest $SRCDIR/EcalDCS_popcon.py diff --git a/CondCore/Utilities/o2o/deployed/online/EcalTPG.sh b/CondCore/Utilities/o2o/deployed/online/EcalTPG.sh new file mode 100755 index 0000000000000..40f2beccb1a08 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/online/EcalTPG.sh @@ -0,0 +1,68 @@ +#!/bin/bash +#setting up environment variables +export HOME=/nfshome0/popconpro +export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin:/opt/ibutils/bin:/nfshome0/popconpro/bin + +JCPORT=9999 + +while getopts ":t:r:p:k" options; do + case $options in + t ) TPG_KEY=$OPTARG;; + r ) RUN_NUMBER=$OPTARG;; + p ) JCPORT=$OPTARG;; + k ) KILLSWITCH=1;; + esac +done + +source /data/O2O/scripts/setupO2O.sh -s Ecal -j TPG + +log "-----------------------------------------------------------------------" +log "EcalTPG.sh" +log "PID $$" +log "HOSTNAME $HOSTNAME" +log "JCPORT $JCPORT" +log "TPG_KEY $TPG_KEY" +log "RUN_NUMBER $RUN_NUMBER" +log "date `date`" +log "-----------------------------------------------------------------------" + +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python + +# run the O2Os... +submit_cmsRun EcalTPGTowerStatus $SRCDIR/copyBadTT_cfg.py +submit_cmsRun EcalTPGCrystalStatus $SRCDIR/copyBadXT_cfg.py +submit_cmsRun EcalTPGFineGrainEBGroup $SRCDIR/copyFgrGroup_cfg.py +submit_cmsRun EcalTPGFineGrainEBIdMap $SRCDIR/copyFgrIdMap_cfg.py +submit_cmsRun EcalTPGFineGrainStripEE $SRCDIR/copyFgrStripEE_cfg.py +submit_cmsRun EcalTPGFineGrainTowerEE $SRCDIR/copyFgrTowerEE_cfg.py +submit_cmsRun EcalTPGLinearizationConst $SRCDIR/copyLin_cfg.py +submit_cmsRun EcalTPGLutGroup $SRCDIR/copyLutGroup_cfg.py +submit_cmsRun EcalTPGLutIdMap $SRCDIR/copyLutIdMap_cfg.py +submit_cmsRun EcalTPGPedestals $SRCDIR/copyPed_cfg.py +submit_cmsRun EcalTPGPhysicsConst $SRCDIR/copyPhysConst_cfg.py +submit_cmsRun EcalTPGSlidingWindow $SRCDIR/copySli_cfg.py +submit_cmsRun EcalTPGWeightGroup $SRCDIR/copyWGroup_cfg.py +submit_cmsRun EcalTPGWeightIdMap $SRCDIR/copyWIdMap_cfg.py +submit_cmsRun EcalTPGSpike $SRCDIR/copySpikeTh_cfg.py +submit_cmsRun EcalTPGStripStatus $SRCDIR/copyBadStrip_cfg.py +submit_command EcalADCToGeV_express "cmsRun $SRCDIR/EcalADCToGeVConstantPopConBTransitionAnalyzer_cfg.py runNumber=$RUN_NUMBER destinationDatabase={db} destinationTag={tag} tagForRunInfo={runInfoTag} tagForBOff={boffTag} tagForBOn={bonTag}" +submit_command EcalADCToGeV_hlt "cmsRun $SRCDIR/EcalADCToGeVConstantPopConBTransitionAnalyzer_cfg.py runNumber=$RUN_NUMBER destinationDatabase={db} destinationTag={tag} tagForRunInfo={runInfoTag} tagForBOff={boffTag} tagForBOn={bonTag}" +submit_command EcalIntercalibConstants_express "cmsRun $SRCDIR/EcalIntercalibConstantsPopConBTransitionAnalyzer_cfg.py runNumber=$RUN_NUMBER destinationDatabase={db} destinationTag={tag} tagForRunInfo={runInfoTag} tagForBOff={boffTag} tagForBOn={bonTag}" +submit_command EcalIntercalibConstants_hlt "cmsRun $SRCDIR/EcalIntercalibConstantsPopConBTransitionAnalyzer_cfg.py runNumber=$RUN_NUMBER destinationDatabase={db} destinationTag={tag} tagForRunInfo={runInfoTag} tagForBOff={boffTag} tagForBOn={bonTag}" + +log "-----------------------------------------------------------------------" +if [ -n "$KILLSWITCH" ]; then + log "Killswitch activated" +ADDR="http://$HOSTNAME:$JCPORT/urn:xdaq-application:service=jobcontrol/ProcKill?kill=$$" + +KILLCMD="curl $ADDR" + +log $KILLCMD +$KILLCMD > /dev/null + +fi + +log DONE + + +exit 0 diff --git a/CondCore/Utilities/o2o/deployed/online/EcalTPGTest.sh b/CondCore/Utilities/o2o/deployed/online/EcalTPGTest.sh new file mode 100755 index 0000000000000..f34553a5c7fe0 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/online/EcalTPGTest.sh @@ -0,0 +1,55 @@ +#!/bin/bash +#setting up environment variables +export HOME=/nfshome0/popconpro +export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin:/opt/ibutils/bin:/nfshome0/popconpro/bin + +#JCPORT=9999 + +#while getopts ":t:r:p:k" options; do +# case $options in +# t ) TPG_KEY=$OPTARG;; +# r ) RUN_NUMBER=$OPTARG;; +# p ) JCPORT=$OPTARG;; +# k ) KILLSWITCH=1;; +# esac +#done + +source /data/O2O/scripts/setupO2O.sh -s Ecal -j TPGTest + +#log "-----------------------------------------------------------------------" +#log "EcalTPG.sh" +#log "PID $$" +#log "HOSTNAME $HOSTNAME" +#log "JCPORT $JCPORT" +#log "TPG_KEY $TPG_KEY" +#log "RUN_NUMBER $RUN_NUMBER" +#log "date `date`" +#log "-----------------------------------------------------------------------" + +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python + +# run the O2Os... +submit_test_cmsRun copyBadTT $SRCDIR/copyBadTT_cfg.py +submit_test_cmsRun copyLin copyLin_cfg.py +submit_test_cmsRun copyPed copyPed_cfg.py +submit_test_cmsRun copyPhysConst copyPhysConst_cfg.py +submit_test_cmsRun copySli copySli_cfg.py +submit_test_cmsRun updateADCToGeV_express updateADCToGeV_express.py + +# END OF CHANGES +#log "-----------------------------------------------------------------------" +#if [ -n "$KILLSWITCH" ]; then +# log "Killswitch activated" +#ADDR="http://$HOSTNAME:$JCPORT/urn:xdaq-application:service=jobcontrol/ProcKill?kill=$$" + +#KILLCMD="curl $ADDR" + +#log $KILLCMD +#$KILLCMD > /dev/null + +#fi + +#log DONE + + +exit 0 diff --git a/CondCore/Utilities/o2o/deployed/online/RunInfoStart.sh b/CondCore/Utilities/o2o/deployed/online/RunInfoStart.sh new file mode 100644 index 0000000000000..102df4adc3cbb --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/online/RunInfoStart.sh @@ -0,0 +1,3 @@ +source /data/O2O/scripts/setupO2O.sh -s RunInfo -j Start +SRCDIR=$RELEASEDIR/src/CondTools/RunInfo/python +submit_command RunInfoStart "cmsRun $SRCDIR/RunInfoPopConAnalyzer.py runNumber=$1 destinationConnection={db} tag={tag}" diff --git a/CondCore/Utilities/o2o/deployed/online/RunInfoStartTest.sh b/CondCore/Utilities/o2o/deployed/online/RunInfoStartTest.sh new file mode 100644 index 0000000000000..be4bbd7955738 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/online/RunInfoStartTest.sh @@ -0,0 +1,3 @@ +source /data/O2O/scripts/setupO2O.sh -s RunInfo -j StartTest +SRCDIR=$RELEASEDIR/src/CondTools/RunInfo/python +submit_test_command RunInfoStartTest "cmsRun $SRCDIR/RunInfoPopConAnalyzer.py runNumber=$1 destinationConnection={db} tag={tag}" diff --git a/CondCore/Utilities/o2o/deployed/online/RunInfoStop.sh b/CondCore/Utilities/o2o/deployed/online/RunInfoStop.sh new file mode 100644 index 0000000000000..27216bcb0fe94 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/online/RunInfoStop.sh @@ -0,0 +1,3 @@ +source /data/O2O/scripts/setupO2O.sh -s RunInfo -j Stop +SRCDIR=$RELEASEDIR/src/CondTools/RunInfo/python +submit_command RunInfoStop "cmsRun $SRCDIR/RunInfoPopConAnalyzer.py runNumber=$1 destinationConnection={db} tag={tag}" diff --git a/CondCore/Utilities/o2o/deployed/online/RunInfoStopTest.sh b/CondCore/Utilities/o2o/deployed/online/RunInfoStopTest.sh new file mode 100644 index 0000000000000..bdae7b9b2c9db --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/online/RunInfoStopTest.sh @@ -0,0 +1,3 @@ +source /data/O2O/scripts/setupO2O.sh -s RunInfo -j StopTest +SRCDIR=$RELEASEDIR/src/CondTools/RunInfo/python +submit_test_command RunInfoStopTest "cmsRun $SRCDIR/RunInfoPopConAnalyzer.py runNumber=$1 destinationConnection={db} tag={tag}" diff --git a/CondCore/Utilities/o2o/deployed/online/runStart.sh b/CondCore/Utilities/o2o/deployed/online/runStart.sh new file mode 100755 index 0000000000000..f0e51c1f563c2 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/online/runStart.sh @@ -0,0 +1,16 @@ +#!/bin/bash +####### ------ beginning -------- ####################### +LOGFILE=/data/O2O/logs/runStart.log +DATE=`date` +#setting up environment variables +export HOME=/nfshome0/popconpro +export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin:/opt/ibutils/bin:/nfshome0/popconpro/bin + +echo " " | tee -a $LOGFILE +echo "----- new job started for run $1 start at -----" | tee -a $LOGFILE +echo "$DATE" | tee -a $LOGFILE + +/bin/sh /data/O2O/scripts/RunInfoStart.sh $1 | tee -a $LOGFILE +/bin/sh /data/O2O/scripts/EcalDAQ.sh | tee -a $LOGFILE +/bin/sh /data/O2O/scripts/EcalDCS.sh | tee -a $LOGFILE +#/bin/sh /data/O2O/scripts/RunInfoStartTest.sh $1 | tee -a /data/O2O/logs/runTestStart.log diff --git a/CondCore/Utilities/o2o/deployed/online/runStop.sh b/CondCore/Utilities/o2o/deployed/online/runStop.sh new file mode 100755 index 0000000000000..3cde915c38aa7 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/online/runStop.sh @@ -0,0 +1,14 @@ +#!/bin/bash +####### ------ beginning -------- ####################### +LOGFILE=/data/O2O/logs/runStop.log +DATE=`date` +#setting up environment variables +export HOME=/nfshome0/popconpro +export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin:/opt/ibutils/bin:/nfshome0/popconpro/bin + +echo " " | tee -a $LOGFILE +echo "----- new job started for run $1 stop at -----" | tee -a $LOGFILE +echo "$DATE" | tee -a $LOGFILE + +/bin/sh /data/O2O/scripts/RunInfoStop.sh $1 | tee -a $LOGFILE +#/bin/sh /data/O2O/scripts/RunInfoStopTest.sh $1 | tee -a /data/O2O/logs/runTestStop.log \ No newline at end of file diff --git a/CondCore/Utilities/o2o/deployed/online/runTestStart.sh b/CondCore/Utilities/o2o/deployed/online/runTestStart.sh new file mode 100755 index 0000000000000..d4fa05e02f513 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/online/runTestStart.sh @@ -0,0 +1,15 @@ +#!/bin/bash +####### ------ beginning -------- ####################### +LOGFILE=/data/O2O/logs/runTestStart.log +DATE=`date` +#setting up environment variables +export HOME=/nfshome0/popconpro +export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin:/opt/ibutils/bin:/nfshome0/popconpro/bin + +echo " " | tee -a $LOGFILE +echo "----- new cronjob started for Run $1 test start at -----" | tee -a $LOGFILE +echo "$DATE" | tee -a $LOGFILE + +/bin/sh /data/O2O/scripts/RunInfoStartTest.sh $1 | tee -a $LOGFILE +/bin/sh /data/O2O/scripts/EcalDAQTest.sh | tee -a $LOGFILE +/bin/sh /data/O2O/scripts/EcalDCSTest.sh | tee -a $LOGFILE \ No newline at end of file diff --git a/CondCore/Utilities/o2o/deployed/online/runTestStop.sh b/CondCore/Utilities/o2o/deployed/online/runTestStop.sh new file mode 100755 index 0000000000000..83ceb4334a157 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/online/runTestStop.sh @@ -0,0 +1,13 @@ +#!/bin/bash +####### ------ beginning -------- ####################### +LOGFILE=/data/O2O/logs/runTestStop.log +DATE=`date` +#setting up environment variables +export HOME=/nfshome0/popconpro +export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin:/opt/ibutils/bin:/nfshome0/popconpro/bin + +echo " " | tee -a $LOGFILE +echo "----- new job started for run $1 test stop at -----" | tee -a $LOGFILE +echo "$DATE" | tee -a $LOGFILE + +/bin/sh /data/O2O/scripts/RunInfoStopTest.sh $1 | tee -a $LOGFILE diff --git a/CondCore/Utilities/o2o/deployed/online/setupO2O.sh b/CondCore/Utilities/o2o/deployed/online/setupO2O.sh new file mode 100755 index 0000000000000..ed4b9abc3a6c8 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/online/setupO2O.sh @@ -0,0 +1,100 @@ +#!/bin/sh + +# deployment-specific params +BASEDIR=/data/O2O +RELEASE=CMSSW_10_0_5 +ARCH=slc7_amd64_gcc630 +RELEASEDIR=/opt/offline/${ARCH}/cms/cmssw/${RELEASE} + +# command params +OPTIND=1 + +SUBSYS="" +JOBNAME="" + +while getopts "h?s:j:" opt; do + case $opt in + h|\?) + echo "Mo' to spiego..." + exit 0 + ;; + s) SUBSYS=$OPTARG + ;; + j) JOBNAME=$OPTARG + ;; + esac +done + +shift $((OPTIND-1)) + +[ "$1" = "--" ] && shift + +O2ONAME=$SUBSYS$JOBNAME +#echo "name=$O2ONAME, subsystem=$SUBSYS, job=$JOBNAME" + +# o2o specific params +LOGFILE=${BASEDIR}/logs/$O2ONAME.log +JOBDIR=${BASEDIR}/${SUBSYS}/${JOBNAME} +DATE=`date` + +# functions +function logRun(){ + echo "----- new job started for $1 at -----" | tee -a $LOGFILE + echo $DATE | tee -a $LOGFILE +} + +function log() { + echo "[`date`] : $@ " | tee -a $LOGFILE +} + +function submit_command() { + logRun $1 + o2o run -n $1 "$2" | tee -a $LOGFILE +} + +function submit_test_command() { + logRun $1 + o2o --db dev run -n $1 "$2" | tee -a $LOGFILE +} + +function submit_cmsRun() { + COMMAND="cmsRun $2 destinationDatabase={db} destinationTag={tag}" + logRun $1 + o2o run -n $1 "$COMMAND" | tee -a $LOGFILE +} + +function submit_test_cmsRun() { + COMMAND="cmsRun $2 destinationDatabase={db} destinationTag={tag}" + logRun $1 + o2o --db dev run -n $1 "$COMMAND" | tee -a $LOGFILE +} + +function submit_popCon() { + COMMAND="popconRun $2 -d {db} -t {tag} -c" + logRun $1 + o2o run -n $1 "$COMMAND" | tee -a $LOGFILE +} + +function submit_test_popCon() { + COMMAND="popconRun $2 -d {db} -t {tag} -c" + logRun $1 + o2o --db dev run -n $1 "$COMMAND" | tee -a $LOGFILE +} + +# global variables +export SCRAM_ARCH=$ARCH +export O2O_LOG_FOLDER=/data/O2O/logs/${O2ONAME} +export COND_AUTH_PATH=$BASEDIR +source /opt/offline/cmsset_default.sh + +cd ${RELEASEDIR}/src +eval `scramv1 run -sh` +# set up OCCI workaround +export LD_PRELOAD=$CMS_ORACLEOCCI_LIB + +# workaround for oracle tnsnames +export TNS_ADMIN=/data/ext/oracle-env/29/etc + +cd ${JOBDIR} + + diff --git a/CondCore/Utilities/o2o/templates/EcalDAQ.sh b/CondCore/Utilities/o2o/templates/EcalDAQ.sh new file mode 100755 index 0000000000000..f4e5a03d5f8cb --- /dev/null +++ b/CondCore/Utilities/o2o/templates/EcalDAQ.sh @@ -0,0 +1,3 @@ +source @root/scripts/setup.sh -j EcalDAQ +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python +submit_popCon EcalDAQ $SRCDIR/EcalDAQ_popcon.py diff --git a/CondCore/Utilities/o2o/templates/EcalDAQTest.sh b/CondCore/Utilities/o2o/templates/EcalDAQTest.sh new file mode 100755 index 0000000000000..68d887d87b4d6 --- /dev/null +++ b/CondCore/Utilities/o2o/templates/EcalDAQTest.sh @@ -0,0 +1,3 @@ +source @root/scripts/setup.sh -j EcalDAQTest +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python +submit_popCon EcalDAQTest $SRCDIR/EcalDAQ_popcon.py diff --git a/CondCore/Utilities/o2o/templates/EcalDCS.sh b/CondCore/Utilities/o2o/templates/EcalDCS.sh new file mode 100755 index 0000000000000..bcfef7d0b99ce --- /dev/null +++ b/CondCore/Utilities/o2o/templates/EcalDCS.sh @@ -0,0 +1,3 @@ +source @root/scripts/setup.sh -j EcalDCS +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python +submit_popCon EcalDCS $SRCDIR/EcalDCS_popcon.py diff --git a/CondCore/Utilities/o2o/templates/EcalDCSTest.sh b/CondCore/Utilities/o2o/templates/EcalDCSTest.sh new file mode 100755 index 0000000000000..215673cf07506 --- /dev/null +++ b/CondCore/Utilities/o2o/templates/EcalDCSTest.sh @@ -0,0 +1,3 @@ +source @root/scripts/setup.sh -j EcalDCSTest +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python +submit_popCon EcalDCSTest $SRCDIR/EcalDCS_popcon.py diff --git a/CondCore/Utilities/o2o/templates/EcalLaser.sh b/CondCore/Utilities/o2o/templates/EcalLaser.sh new file mode 100755 index 0000000000000..52c262a3f89d7 --- /dev/null +++ b/CondCore/Utilities/o2o/templates/EcalLaser.sh @@ -0,0 +1,3 @@ +source @root/scripts/setup.sh -j EcalLaser +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python +submit_popCon EcalLaser $SRCDIR/EcalLaser_prompt_popcon.py diff --git a/CondCore/Utilities/o2o/templates/EcalLaserTest.sh b/CondCore/Utilities/o2o/templates/EcalLaserTest.sh new file mode 100755 index 0000000000000..c2586688b6c19 --- /dev/null +++ b/CondCore/Utilities/o2o/templates/EcalLaserTest.sh @@ -0,0 +1,3 @@ +source @root/scripts/setup.sh -j EcalLaserTest +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python +submit_popCon EcalLaserTest $SRCDIR/EcalLaser_prompt_popcon.py diff --git a/CondCore/Utilities/o2o/templates/EcalLaser_express.sh b/CondCore/Utilities/o2o/templates/EcalLaser_express.sh new file mode 100755 index 0000000000000..2c0f8becd9c69 --- /dev/null +++ b/CondCore/Utilities/o2o/templates/EcalLaser_express.sh @@ -0,0 +1,3 @@ +source @root/scripts/setup.sh -j EcalLaser_express +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python +submit_popCon EcalLaser_express $SRCDIR/EcalLaser_express_popcon.py diff --git a/CondCore/Utilities/o2o/templates/EcalLaser_expressTest.sh b/CondCore/Utilities/o2o/templates/EcalLaser_expressTest.sh new file mode 100755 index 0000000000000..f433d8345b69e --- /dev/null +++ b/CondCore/Utilities/o2o/templates/EcalLaser_expressTest.sh @@ -0,0 +1,3 @@ +source @root/scripts/setup.sh -j EcalLaser_expressTest +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python +submit_test_popCon EcalLaser_expressTest $SRCDIR/EcalLaser_express_popcon.py diff --git a/CondCore/Utilities/o2o/templates/EcalTPG.sh b/CondCore/Utilities/o2o/templates/EcalTPG.sh new file mode 100755 index 0000000000000..1ab900de0a7be --- /dev/null +++ b/CondCore/Utilities/o2o/templates/EcalTPG.sh @@ -0,0 +1,68 @@ +#!/bin/bash +#setting up environment variables +export HOME=@home +export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin:/opt/ibutils/bin:@home/bin + +JCPORT=9999 + +while getopts ":t:r:p:k" options; do + case $options in + t ) TPG_KEY=$OPTARG;; + r ) RUN_NUMBER=$OPTARG;; + p ) JCPORT=$OPTARG;; + k ) KILLSWITCH=1;; + esac +done + +source @root/scripts/setup.sh -j EcalTPG + +log "-----------------------------------------------------------------------" +log "EcalTPG.sh" +log "PID $$" +log "HOSTNAME $HOSTNAME" +log "JCPORT $JCPORT" +log "TPG_KEY $TPG_KEY" +log "RUN_NUMBER $RUN_NUMBER" +log "date `date`" +log "-----------------------------------------------------------------------" + +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python + +# run the O2Os... +submit_cmsRun EcalTPGTowerStatus $SRCDIR/copyBadTT_cfg.py +submit_cmsRun EcalTPGCrystalStatus $SRCDIR/copyBadXT_cfg.py +submit_cmsRun EcalTPGFineGrainEBGroup $SRCDIR/copyFgrGroup_cfg.py +submit_cmsRun EcalTPGFineGrainEBIdMap $SRCDIR/copyFgrIdMap_cfg.py +submit_cmsRun EcalTPGFineGrainStripEE $SRCDIR/copyFgrStripEE_cfg.py +submit_cmsRun EcalTPGFineGrainTowerEE $SRCDIR/copyFgrTowerEE_cfg.py +submit_cmsRun EcalTPGLinearizationConst $SRCDIR/copyLin_cfg.py +submit_cmsRun EcalTPGLutGroup $SRCDIR/copyLutGroup_cfg.py +submit_cmsRun EcalTPGLutIdMap $SRCDIR/copyLutIdMap_cfg.py +submit_cmsRun EcalTPGPedestals $SRCDIR/copyPed_cfg.py +submit_cmsRun EcalTPGPhysicsConst $SRCDIR/copyPhysConst_cfg.py +submit_cmsRun EcalTPGSlidingWindow $SRCDIR/copySli_cfg.py +submit_cmsRun EcalTPGWeightGroup $SRCDIR/copyWGroup_cfg.py +submit_cmsRun EcalTPGWeightIdMap $SRCDIR/copyWIdMap_cfg.py +submit_cmsRun EcalTPGSpike $SRCDIR/copySpikeTh_cfg.py +submit_cmsRun EcalTPGStripStatus $SRCDIR/copyBadStrip_cfg.py +submit_command EcalADCToGeV_express "cmsRun $SRCDIR/EcalADCToGeVConstantPopConBTransitionAnalyzer_cfg.py runNumber=$RUN_NUMBER destinationDatabase={db} destinationTag={tag} tagForRunInfo={runInfoTag} tagForBOff={boffTag} tagForBOn={bonTag}" +submit_command EcalADCToGeV_hlt "cmsRun $SRCDIR/EcalADCToGeVConstantPopConBTransitionAnalyzer_cfg.py runNumber=$RUN_NUMBER destinationDatabase={db} destinationTag={tag} tagForRunInfo={runInfoTag} tagForBOff={boffTag} tagForBOn={bonTag}" +submit_command EcalIntercalibConstants_express "cmsRun $SRCDIR/EcalIntercalibConstantsPopConBTransitionAnalyzer_cfg.py runNumber=$RUN_NUMBER destinationDatabase={db} destinationTag={tag} tagForRunInfo={runInfoTag} tagForBOff={boffTag} tagForBOn={bonTag}" +submit_command EcalIntercalibConstants_hlt "cmsRun $SRCDIR/EcalIntercalibConstantsPopConBTransitionAnalyzer_cfg.py runNumber=$RUN_NUMBER destinationDatabase={db} destinationTag={tag} tagForRunInfo={runInfoTag} tagForBOff={boffTag} tagForBOn={bonTag}" + +log "-----------------------------------------------------------------------" +if [ -n "$KILLSWITCH" ]; then + log "Killswitch activated" +ADDR="http://$HOSTNAME:$JCPORT/urn:xdaq-application:service=jobcontrol/ProcKill?kill=$$" + +KILLCMD="curl $ADDR" + +log $KILLCMD +$KILLCMD > /dev/null + +fi + +log DONE + + +exit 0 diff --git a/CondCore/Utilities/o2o/templates/RunInfoStart.sh b/CondCore/Utilities/o2o/templates/RunInfoStart.sh new file mode 100644 index 0000000000000..fb643348bf769 --- /dev/null +++ b/CondCore/Utilities/o2o/templates/RunInfoStart.sh @@ -0,0 +1,3 @@ +source @root/scripts/setup.sh -j RunInfoStart +SRCDIR=$RELEASEDIR/src/CondTools/RunInfo/python +submit_command RunInfoStart "cmsRun $SRCDIR/RunInfoPopConAnalyzer.py runNumber=$1 destinationConnection={db} tag={tag}" diff --git a/CondCore/Utilities/o2o/templates/RunInfoStartTest.sh b/CondCore/Utilities/o2o/templates/RunInfoStartTest.sh new file mode 100644 index 0000000000000..7c0e0f6701acd --- /dev/null +++ b/CondCore/Utilities/o2o/templates/RunInfoStartTest.sh @@ -0,0 +1,3 @@ +source @root/scripts/setup.sh -j RunInfoStartTest +SRCDIR=$RELEASEDIR/src/CondTools/RunInfo/python +submit_test_command RunInfoStartTest "cmsRun $SRCDIR/RunInfoPopConAnalyzer.py runNumber=$1 destinationConnection={db} tag={tag}" diff --git a/CondCore/Utilities/o2o/templates/RunInfoStop.sh b/CondCore/Utilities/o2o/templates/RunInfoStop.sh new file mode 100644 index 0000000000000..f7b890f32b677 --- /dev/null +++ b/CondCore/Utilities/o2o/templates/RunInfoStop.sh @@ -0,0 +1,3 @@ +source @root/scripts/setup.sh -j RunInfoStop +SRCDIR=$RELEASEDIR/src/CondTools/RunInfo/python +submit_command RunInfoStop "cmsRun $SRCDIR/RunInfoPopConAnalyzer.py runNumber=$1 destinationConnection={db} tag={tag}" diff --git a/CondCore/Utilities/o2o/templates/RunInfoStopTest.sh b/CondCore/Utilities/o2o/templates/RunInfoStopTest.sh new file mode 100644 index 0000000000000..2d00c78731045 --- /dev/null +++ b/CondCore/Utilities/o2o/templates/RunInfoStopTest.sh @@ -0,0 +1,3 @@ +source @root/scripts/setup.sh -j RunInfoStopTest +SRCDIR=$RELEASEDIR/src/CondTools/RunInfo/python +submit_test_command RunInfoStopTest "cmsRun $SRCDIR/RunInfoPopConAnalyzer.py runNumber=$1 destinationConnection={db} tag={tag}" diff --git a/CondCore/Utilities/o2o/templates/SiStripDCS.sh b/CondCore/Utilities/o2o/templates/SiStripDCS.sh new file mode 100755 index 0000000000000..f85242a0f7032 --- /dev/null +++ b/CondCore/Utilities/o2o/templates/SiStripDCS.sh @@ -0,0 +1,18 @@ +#!/bin/sh +# +# wrapper script to run DCS O2O +# Last updated: Apr 21, 2017 +# Author: Huilin Qu +# +# Usage: SiStripDCS.sh JOB_NAME + +JOBNAME=$1 + +O2O_HOME=@root + +source $O2O_HOME/scripts/setStrip.sh $JOBNAME +o2oRun_SiStripDCS.py $JOBNAME |tee -a $LOGFILE + +# Exit with status of last command +# Make sure the last command is o2oRun_SiStripDCS.py! +exit $? diff --git a/CondCore/Utilities/o2o/templates/ecal_laser.sh b/CondCore/Utilities/o2o/templates/ecal_laser.sh new file mode 100755 index 0000000000000..73cee73809d6f --- /dev/null +++ b/CondCore/Utilities/o2o/templates/ecal_laser.sh @@ -0,0 +1,26 @@ +#!/bin/bash +####### ------ beginning -------- ####################### +BASEDIR=@root +LOGFILE=${BASEDIR}/logs/TimeBasedO2O.log +DATE=`date` +echo " " | tee -a $LOGFILE +echo "----- new cronjob started for Time Based O2O at -----" | tee -a $LOGFILE +echo "$DATE" | tee -a $LOGFILE + +#Check if the exportation script is running, if so exits without launching it +PID_0=`ps aux | grep '/bin/sh @root/scripts/EcalLaser.sh' | grep -v grep | awk '{print $2}'` +if [ "${PID_0}" ] + then + echo "Ecal Laser Exportation script still running with pid ${PID_0}: exiting" | tee -a $LOGFILE + exit 1 +else + /bin/sh @root/scripts/EcalLaser.sh +fi +PID_1=`ps aux | grep '/bin/sh @root/scripts/EcalLaser_express.sh' | grep -v grep | awk '{print $2}'` +if [ "${PID_1}" ] + then + echo "Ecal LaserExpress Exportation script still running with pid ${PID_1}: exiting" | tee -a $LOGFILE + exit 1 +else + /bin/sh @root/scripts/EcalLaser_express.sh +fi diff --git a/CondCore/Utilities/o2o/templates/runStart.sh b/CondCore/Utilities/o2o/templates/runStart.sh new file mode 100755 index 0000000000000..2fb4bc2a32c7a --- /dev/null +++ b/CondCore/Utilities/o2o/templates/runStart.sh @@ -0,0 +1,16 @@ +#!/bin/bash +####### ------ beginning -------- ####################### +LOGFILE=@root/logs/runStart.log +DATE=`date` +#setting up environment variables +export HOME=@home +export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin:/opt/ibutils/bin:@home/bin + +echo " " | tee -a $LOGFILE +echo "----- new job started for run $1 start at -----" | tee -a $LOGFILE +echo "$DATE" | tee -a $LOGFILE + +/bin/sh @root/scripts/RunInfoStart.sh $1 | tee -a $LOGFILE +/bin/sh @root/scripts/EcalDAQ.sh | tee -a $LOGFILE +/bin/sh @root/scripts/EcalDCS.sh | tee -a $LOGFILE + diff --git a/CondCore/Utilities/o2o/templates/runStop.sh b/CondCore/Utilities/o2o/templates/runStop.sh new file mode 100755 index 0000000000000..80ff72487b180 --- /dev/null +++ b/CondCore/Utilities/o2o/templates/runStop.sh @@ -0,0 +1,13 @@ +#!/bin/bash +####### ------ beginning -------- ####################### +LOGFILE=@root/logs/runStop.log +DATE=`date` +#setting up environment variables +export HOME=@home +export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin:/opt/ibutils/bin:@home/bin + +echo " " | tee -a $LOGFILE +echo "----- new job started for run $1 stop at -----" | tee -a $LOGFILE +echo "$DATE" | tee -a $LOGFILE + +/bin/sh @root/scripts/RunInfoStop.sh $1 | tee -a $LOGFILE diff --git a/CondCore/Utilities/o2o/templates/runTestStart.sh b/CondCore/Utilities/o2o/templates/runTestStart.sh new file mode 100755 index 0000000000000..0e5d91cfe4ec9 --- /dev/null +++ b/CondCore/Utilities/o2o/templates/runTestStart.sh @@ -0,0 +1,15 @@ +#!/bin/bash +####### ------ beginning -------- ####################### +LOGFILE=@root/logs/runTestStart.log +DATE=`date` +#setting up environment variables +export HOME=@home +export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin:/opt/ibutils/bin:@home/bin + +echo " " | tee -a $LOGFILE +echo "----- new cronjob started for Run $1 test start at -----" | tee -a $LOGFILE +echo "$DATE" | tee -a $LOGFILE + +/bin/sh @root/scripts/RunInfoStartTest.sh $1 | tee -a $LOGFILE +/bin/sh @root/scripts/EcalDAQTest.sh | tee -a $LOGFILE +/bin/sh @root/scripts/EcalDCSTest.sh | tee -a $LOGFILE \ No newline at end of file diff --git a/CondCore/Utilities/o2o/templates/runTestStop.sh b/CondCore/Utilities/o2o/templates/runTestStop.sh new file mode 100755 index 0000000000000..00601ca371a42 --- /dev/null +++ b/CondCore/Utilities/o2o/templates/runTestStop.sh @@ -0,0 +1,13 @@ +#!/bin/bash +####### ------ beginning -------- ####################### +LOGFILE=@root/logs/runTestStop.log +DATE=`date` +#setting up environment variables +export HOME=@home +export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin:/opt/ibutils/bin:@home/bin + +echo " " | tee -a $LOGFILE +echo "----- new job started for run $1 test stop at -----" | tee -a $LOGFILE +echo "$DATE" | tee -a $LOGFILE + +/bin/sh @root/scripts/RunInfoStopTest.sh $1 | tee -a $LOGFILE diff --git a/CondCore/Utilities/o2o/templates/setStrip.sh b/CondCore/Utilities/o2o/templates/setStrip.sh new file mode 100755 index 0000000000000..8e252cac96b66 --- /dev/null +++ b/CondCore/Utilities/o2o/templates/setStrip.sh @@ -0,0 +1,33 @@ +#!/bin/sh +# +# set the CMSSW environtmet for SiStripO2O +# and the proxies for conditionUploader +# + +O2ONAME=$1 + +# deployment-specific params +BASEDIR=@root +SCRAM_ARCH=@arch +RELEASE=@release +RELEASEDIR=@cmsswroot/@arch/cms/cmssw/${RELEASE} + +source @cmsswroot/cmsset_default.sh +cd ${RELEASEDIR}/src +eval `scramv1 ru -sh` +cd - + +O2O_HOME=$BASEDIR/SiStrip/ + +# for sqlalchmey (?) +export PYTHON_EGG_CACHE=@localhome +# path to .netrc file and .cms_cond dir +export COND_AUTH_PATH=@root/SiStrip + +# save log files produced by o2oRun.py on disk +export JOBDIR=${O2O_HOME}/jobs/${O2ONAME} +export O2O_LOG_FOLDER=${BASEDIR}/logs/${O2ONAME} +export LOGFILE=${BASEDIR}/logs/$O2ONAME.log + +# temperoray fix for TNS_ADMIN +export TNS_ADMIN=@extroot/oracle-env/29/etc diff --git a/CondCore/Utilities/o2o/templates/setup.sh b/CondCore/Utilities/o2o/templates/setup.sh new file mode 100755 index 0000000000000..1158c53931393 --- /dev/null +++ b/CondCore/Utilities/o2o/templates/setup.sh @@ -0,0 +1,95 @@ +#!/bin/sh + +# deployment-specific params +BASEDIR=@root +RELEASE=@release +ARCH=@arch +RELEASEDIR=@cmsswroot/${RELEASE} + +# command params +OPTIND=1 + +JOBNAME="" + +while getopts "h?s:j:" opt; do + case $opt in + h|\?) + echo "Mo' to spiego..." + exit 0 + ;; + j) JOBNAME=$OPTARG + ;; + esac +done + +shift $((OPTIND-1)) + +[ "$1" = "--" ] && shift + +# o2o specific params +LOGFILE=${BASEDIR}/logs/$JOBNAME.log +JOBDIR=${BASEDIR}/${JOBNAME} +DATE=`date` + +# functions +function logRun(){ + echo "----- new job started for $1 at -----" | tee -a $LOGFILE + echo $DATE | tee -a $LOGFILE +} + +function log() { + echo "[`date`] : $@ " | tee -a $LOGFILE +} + +function submit_command() { + logRun $1 + o2o run -n $1 "$2" | tee -a $LOGFILE +} + +function submit_test_command() { + logRun $1 + o2o --db dev run -n $1 "$2" | tee -a $LOGFILE +} + +function submit_cmsRun() { + COMMAND="cmsRun $2 destinationDatabase={db} destinationTag={tag}" + logRun $1 + o2o run -n $1 "$COMMAND" | tee -a $LOGFILE +} + +function submit_test_cmsRun() { + COMMAND="cmsRun $2 destinationDatabase={db} destinationTag={tag}" + logRun $1 + o2o --db dev run -n $1 "$COMMAND" | tee -a $LOGFILE +} + +function submit_popCon() { + COMMAND="popconRun $2 -d {db} -t {tag} -c" + logRun $1 + o2o run -n $1 "$COMMAND" | tee -a $LOGFILE +} + +function submit_test_popCon() { + COMMAND="popconRun $2 -d {db} -t {tag} -c" + logRun $1 + o2o --db dev run -n $1 "$COMMAND" | tee -a $LOGFILE +} + +# global variables +export PYTHON_EGG_CACHE=@localhome +export SCRAM_ARCH=$ARCH +export O2O_LOG_FOLDER=@root/logs/${JOBNAME} +export COND_AUTH_PATH=$BASEDIR +source @cmsswroot/cmsset_default.sh + +cd ${RELEASEDIR}/src +eval `scramv1 run -sh` +# set up OCCI workaround +export LD_PRELOAD=$CMS_ORACLEOCCI_LIB + +# workaround for oracle tnsnames +export TNS_ADMIN=@extroot/oracle-env/29/etc + +cd ${JOBDIR} + + From 19181b034fc2e46fcdefc753c955eecbaeca0c09 Mon Sep 17 00:00:00 2001 From: Heshy Roskes Date: Thu, 29 Mar 2018 18:48:30 +0200 Subject: [PATCH 278/426] fix preexisting validation --- .../python/TkAlAllInOneTool/preexistingValidation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Alignment/OfflineValidation/python/TkAlAllInOneTool/preexistingValidation.py b/Alignment/OfflineValidation/python/TkAlAllInOneTool/preexistingValidation.py index 3c9fc5b9ca1ba..baec6c0bdd2f5 100644 --- a/Alignment/OfflineValidation/python/TkAlAllInOneTool/preexistingValidation.py +++ b/Alignment/OfflineValidation/python/TkAlAllInOneTool/preexistingValidation.py @@ -1,7 +1,7 @@ import os from genericValidation import GenericValidation, GenericValidationData from geometryComparison import GeometryComparison -from helperFunctions import getCommandOutput2, parsecolor, parsestyle +from helperFunctions import boolfromstring, getCommandOutput2, parsecolor, parsestyle from monteCarloValidation import MonteCarloValidation from offlineValidation import OfflineValidation from plottingOptions import PlottingOptions @@ -31,7 +31,7 @@ def __init__(self, valName, config): if "|" in self.title or "," in self.title or '"' in self.title: msg = "The characters '|', '\"', and ',' cannot be used in the alignment title!" raise AllInOneError(msg) - self.needsproxy = bool(int(self.general["needsproxy"])) + self.needsproxy = boolfromstring(self.general["needsproxy"], "needsproxy") self.jobid = self.general["jobid"] if self.jobid: try: #make sure it's actually a valid jobid From 7db28c78c07b90bbd60c178aa5294732e271ac9f Mon Sep 17 00:00:00 2001 From: Felice Date: Thu, 29 Mar 2018 19:33:40 +0200 Subject: [PATCH 279/426] clang format --- .../HGCalRecAlgos/src/HGCalImagingAlgo.cc | 552 ++++++++++-------- 1 file changed, 303 insertions(+), 249 deletions(-) diff --git a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc index d8db13234d52c..6b6a7d7801634 100644 --- a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc +++ b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc @@ -1,74 +1,88 @@ #include "RecoLocalCalo/HGCalRecAlgos/interface/HGCalImagingAlgo.h" // Geometry -#include "Geometry/Records/interface/IdealGeometryRecord.h" -#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" -#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" #include "DataFormats/HcalDetId/interface/HcalSubdetector.h" +#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" +#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" +#include "Geometry/Records/interface/IdealGeometryRecord.h" #include "RecoEcal/EgammaCoreTools/interface/PositionCalc.h" // #include "DataFormats/CaloRecHit/interface/CaloID.h" -#include "tbb/tbb.h" #include "tbb/task_arena.h" +#include "tbb/tbb.h" - -void HGCalImagingAlgo::populate(const HGCRecHitCollection& hits){ - //loop over all hits and create the Hexel structure, skip energies below ecut +void HGCalImagingAlgo::populate(const HGCRecHitCollection &hits) { + // loop over all hits and create the Hexel structure, skip energies below ecut if (dependSensor) { - // for each layer and wafer calculate the thresholds (sigmaNoise and energy) once + // for each layer and wafer calculate the thresholds (sigmaNoise and energy) + // once computeThreshold(); } - std::vector firstHit(2*(maxlayer+1), true); - for (unsigned int i=0;i firstHit(2 * (maxlayer + 1), true); + for (unsigned int i = 0; i < hits.size(); ++i) { - const HGCRecHit& hgrh = hits[i]; + const HGCRecHit &hgrh = hits[i]; DetId detid = hgrh.detid(); unsigned int layer = rhtools_.getLayerWithOffset(detid); float thickness = 0.f; - // set sigmaNoise default value 1 to use kappa value directly in case of sensor-independent thresholds + // set sigmaNoise default value 1 to use kappa value directly in case of + // sensor-independent thresholds float sigmaNoise = 1.f; - if(dependSensor){ - if (layer<= lastLayerFH) // only EE and FH have silicon sensors + if (dependSensor) { + if (layer <= lastLayerFH) // only EE and FH have silicon sensors thickness = rhtools_.getSiThickness(detid); - double storedThreshold=thresholds[layer-1][layer<=lastLayerFH ? rhtools_.getWafer(detid) : 0]; - sigmaNoise = v_sigmaNoise[layer-1][layer<=lastLayerFH ? rhtools_.getWafer(detid) : 0]; - - if(hgrh.energy() < storedThreshold) - continue; //this sets the ZS threshold at ecut times the sigma noise for the sensor + double storedThreshold = + thresholds[layer - 1] + [layer <= lastLayerFH ? rhtools_.getWafer(detid) : 0]; + sigmaNoise = + v_sigmaNoise[layer - 1] + [layer <= lastLayerFH ? rhtools_.getWafer(detid) : 0]; + + if (hgrh.energy() < storedThreshold) + continue; // this sets the ZS threshold at ecut times the sigma noise + // for the sensor } - if(!dependSensor && hgrh.energy() < ecut) continue; + if (!dependSensor && hgrh.energy() < ecut) + continue; - // map layers from positive endcap (z) to layer + maxlayer+1 to prevent mixing up hits from different sides - layer += int(rhtools_.zside(detid)>0)*(maxlayer+1); + // map layers from positive endcap (z) to layer + maxlayer+1 to prevent + // mixing up hits from different sides + layer += int(rhtools_.zside(detid) > 0) * (maxlayer + 1); // determine whether this is a half-hexagon bool isHalf = rhtools_.isHalfCell(detid); - const GlobalPoint position( rhtools_.getPosition( detid ) ); - - //here's were the KDNode is passed its dims arguments - note that these are *copied* from the Hexel - points[layer].emplace_back(Hexel(hgrh,detid,isHalf,sigmaNoise,thickness,&rhtools_),position.x(),position.y()); - - // for each layer, store the minimum and maximum x and y coordinates for the KDTreeBox boundaries - if(firstHit[layer]){ - minpos[layer][0] = position.x(); minpos[layer][1] = position.y(); - maxpos[layer][0] = position.x(); maxpos[layer][1] = position.y(); + const GlobalPoint position(rhtools_.getPosition(detid)); + + // here's were the KDNode is passed its dims arguments - note that these are + // *copied* from the Hexel + points[layer].emplace_back( + Hexel(hgrh, detid, isHalf, sigmaNoise, thickness, &rhtools_), + position.x(), position.y()); + + // for each layer, store the minimum and maximum x and y coordinates for the + // KDTreeBox boundaries + if (firstHit[layer]) { + minpos[layer][0] = position.x(); + minpos[layer][1] = position.y(); + maxpos[layer][0] = position.x(); + maxpos[layer][1] = position.y(); firstHit[layer] = false; - }else{ - minpos[layer][0] = std::min((float)position.x(),minpos[layer][0]); - minpos[layer][1] = std::min((float)position.y(),minpos[layer][1]); - maxpos[layer][0] = std::max((float)position.x(),maxpos[layer][0]); - maxpos[layer][1] = std::max((float)position.y(),maxpos[layer][1]); + } else { + minpos[layer][0] = std::min((float)position.x(), minpos[layer][0]); + minpos[layer][1] = std::min((float)position.y(), minpos[layer][1]); + maxpos[layer][0] = std::max((float)position.x(), maxpos[layer][0]); + maxpos[layer][1] = std::max((float)position.y(), maxpos[layer][1]); } } // end loop hits - } -// Create a vector of Hexels associated to one cluster from a collection of HGCalRecHits - this can be used -// directly to make the final cluster list - this method can be invoked multiple times for the same event -// with different input (reset should be called between events) +// Create a vector of Hexels associated to one cluster from a collection of +// HGCalRecHits - this can be used directly to make the final cluster list - +// this method can be invoked multiple times for the same event with different +// input (reset should be called between events) void HGCalImagingAlgo::makeClusters() { layerClustersPerLayer.resize(2 * maxlayer + 2); // assign all hits in each layer to a cluster core or halo @@ -173,7 +187,8 @@ std::vector HGCalImagingAlgo::getClusters(bool doSharing) { return clusters_v; } -math::XYZPoint HGCalImagingAlgo::calculatePosition(std::vector &v) const { +math::XYZPoint +HGCalImagingAlgo::calculatePosition(std::vector &v) const { float total_weight = 0.f; float x = 0.f; float y = 0.f; @@ -186,15 +201,14 @@ math::XYZPoint HGCalImagingAlgo::calculatePosition(std::vector &v) const // loop over hits in cluster candidate building up weight for // energy-weighted position calculation and determining the maximum // energy hit in case this is a halo-only cluster - for (unsigned int i = 0; i < v_size; i++){ - if(!v[i].data.isHalo){ + for (unsigned int i = 0; i < v_size; i++) { + if (!v[i].data.isHalo) { haloOnlyCluster = false; total_weight += v[i].data.weight; - x += v[i].data.x*v[i].data.weight; - y += v[i].data.y*v[i].data.weight; - z += v[i].data.z*v[i].data.weight; - } - else { + x += v[i].data.x * v[i].data.weight; + y += v[i].data.y * v[i].data.weight; + z += v[i].data.z * v[i].data.weight; + } else { if (v[i].data.weight > maxEnergyValue) { maxEnergyValue = v[i].data.weight; maxEnergyIndex = i; @@ -204,64 +218,68 @@ math::XYZPoint HGCalImagingAlgo::calculatePosition(std::vector &v) const if (!haloOnlyCluster) { if (total_weight != 0) { - auto inv_tot_weight = 1./total_weight; - return math::XYZPoint( x*inv_tot_weight, - y*inv_tot_weight, - z*inv_tot_weight); + auto inv_tot_weight = 1. / total_weight; + return math::XYZPoint(x * inv_tot_weight, y * inv_tot_weight, + z * inv_tot_weight); } - } - else if (v_size > 0) { + } else if (v_size > 0) { // return position of hit with maximum energy - return math::XYZPoint(v[maxEnergyIndex].data.x, v[maxEnergyIndex].data.y, v[maxEnergyIndex].data.z); + return math::XYZPoint(v[maxEnergyIndex].data.x, v[maxEnergyIndex].data.y, + v[maxEnergyIndex].data.z); } return math::XYZPoint(0, 0, 0); } -double HGCalImagingAlgo::calculateLocalDensity(std::vector &nd, KDTree &lp, const unsigned int layer) const{ +double HGCalImagingAlgo::calculateLocalDensity(std::vector &nd, + KDTree &lp, + const unsigned int layer) const { double maxdensity = 0.; - float delta_c; // maximum search distance (critical distance) for local density calculation - if( layer<= lastLayerEE ) delta_c = vecDeltas[0]; - else if( layer <= lastLayerFH) delta_c = vecDeltas[1]; - else delta_c = vecDeltas[2]; + float delta_c; // maximum search distance (critical distance) for local + // density calculation + if (layer <= lastLayerEE) + delta_c = vecDeltas[0]; + else if (layer <= lastLayerFH) + delta_c = vecDeltas[1]; + else + delta_c = vecDeltas[2]; // for each node calculate local density rho and store it - for(unsigned int i = 0; i < nd.size(); ++i){ + for (unsigned int i = 0; i < nd.size(); ++i) { // speec up search by looking within +/- delta_c window only - KDTreeBox search_box(nd[i].dims[0]-delta_c,nd[i].dims[0]+delta_c, - nd[i].dims[1]-delta_c,nd[i].dims[1]+delta_c); + KDTreeBox search_box(nd[i].dims[0] - delta_c, nd[i].dims[0] + delta_c, + nd[i].dims[1] - delta_c, nd[i].dims[1] + delta_c); std::vector found; - lp.search(search_box,found); + lp.search(search_box, found); const unsigned int found_size = found.size(); - for(unsigned int j = 0; j < found_size; j++){ - if(distance(nd[i].data,found[j].data) < delta_c){ + for (unsigned int j = 0; j < found_size; j++) { + if (distance(nd[i].data, found[j].data) < delta_c) { nd[i].data.rho += found[j].data.weight; maxdensity = std::max(maxdensity, nd[i].data.rho); } } // end loop found - } // end loop nodes + } // end loop nodes return maxdensity; } -double HGCalImagingAlgo::calculateDistanceToHigher(std::vector &nd) const { - +double +HGCalImagingAlgo::calculateDistanceToHigher(std::vector &nd) const { - //sort vector of Hexels by decreasing local density + // sort vector of Hexels by decreasing local density std::vector rs = sorted_indices(nd); double maxdensity = 0.0; int nearestHigher = -1; - - if(!rs.empty()) + if (!rs.empty()) maxdensity = nd[rs[0]].data.rho; else return maxdensity; // there are no hits double dist2 = 0.; - //start by setting delta for the highest density hit to - //the most distant hit - this is a convention + // start by setting delta for the highest density hit to + // the most distant hit - this is a convention - for (auto& j: nd) { + for (auto &j : nd) { double tmp = distance2(nd[rs[0]].data, j.data); if (tmp > dist2) dist2 = tmp; @@ -269,172 +287,196 @@ double HGCalImagingAlgo::calculateDistanceToHigher(std::vector &nd) cons nd[rs[0]].data.delta = std::sqrt(dist2); nd[rs[0]].data.nearestHigher = nearestHigher; - //now we save the largest distance as a starting point + // now we save the largest distance as a starting point const double max_dist2 = dist2; const unsigned int nd_size = nd.size(); - for(unsigned int oi = 1; oi < nd_size; ++oi){ // start from second-highest density + for (unsigned int oi = 1; oi < nd_size; + ++oi) { // start from second-highest density dist2 = max_dist2; unsigned int i = rs[oi]; // we only need to check up to oi since hits // are ordered by decreasing density // and all points coming BEFORE oi are guaranteed to have higher rho // and the ones AFTER to have lower rho - for(unsigned int oj = 0; oj < oi; ++oj){ + for (unsigned int oj = 0; oj < oi; ++oj) { unsigned int j = rs[oj]; double tmp = distance2(nd[i].data, nd[j].data); - if(tmp <= dist2){ //this "<=" instead of "<" addresses the (rare) case when there are only two hits + if (tmp <= dist2) { // this "<=" instead of "<" addresses the (rare) case + // when there are only two hits dist2 = tmp; nearestHigher = j; } } nd[i].data.delta = std::sqrt(dist2); - nd[i].data.nearestHigher = nearestHigher; //this uses the original unsorted hitlist + nd[i].data.nearestHigher = + nearestHigher; // this uses the original unsorted hitlist } return maxdensity; } -int HGCalImagingAlgo::findAndAssignClusters(std::vector &nd, KDTree &lp, double maxdensity, KDTreeBox &bounds, const unsigned int layer, std::vector >& clustersOnLayer) const { +int HGCalImagingAlgo::findAndAssignClusters( + std::vector &nd, KDTree &lp, double maxdensity, KDTreeBox &bounds, + const unsigned int layer, + std::vector> &clustersOnLayer) const { - //this is called once per layer and endcap... - //so when filling the cluster temporary vector of Hexels we resize each time by the number - //of clusters found. This is always equal to the number of cluster centers... + // this is called once per layer and endcap... + // so when filling the cluster temporary vector of Hexels we resize each time + // by the number of clusters found. This is always equal to the number of + // cluster centers... unsigned int nClustersOnLayer = 0; float delta_c; // critical distance - if( layer<=lastLayerEE ) delta_c = vecDeltas[0]; - else if( layer<=lastLayerFH ) delta_c = vecDeltas[1]; - else delta_c = vecDeltas[2]; + if (layer <= lastLayerEE) + delta_c = vecDeltas[0]; + else if (layer <= lastLayerFH) + delta_c = vecDeltas[1]; + else + delta_c = vecDeltas[2]; - std::vector rs = sorted_indices(nd); // indices sorted by decreasing rho - std::vector ds = sort_by_delta(nd); // sort in decreasing distance to higher + std::vector rs = + sorted_indices(nd); // indices sorted by decreasing rho + std::vector ds = + sort_by_delta(nd); // sort in decreasing distance to higher const unsigned int nd_size = nd.size(); - for(unsigned int i=0; i < nd_size; ++i){ + for (unsigned int i = 0; i < nd_size; ++i) { - if(nd[ds[i]].data.delta < delta_c) break; // no more cluster centers to be looked at - if(dependSensor){ + if (nd[ds[i]].data.delta < delta_c) + break; // no more cluster centers to be looked at + if (dependSensor) { - float rho_c = kappa*nd[ds[i]].data.sigmaNoise; - if(nd[ds[i]].data.rho < rho_c ) continue; // set equal to kappa times noise threshold + float rho_c = kappa * nd[ds[i]].data.sigmaNoise; + if (nd[ds[i]].data.rho < rho_c) + continue; // set equal to kappa times noise threshold - } - else if(nd[ds[i]].data.rho*kappa < maxdensity) + } else if (nd[ds[i]].data.rho * kappa < maxdensity) continue; - nd[ds[i]].data.clusterIndex = nClustersOnLayer; - if (verbosity < pINFO) - { - std::cout << "Adding new cluster with index " << nClustersOnLayer << std::endl; - std::cout << "Cluster center is hit " << ds[i] << std::endl; - } + if (verbosity < pINFO) { + std::cout << "Adding new cluster with index " << nClustersOnLayer + << std::endl; + std::cout << "Cluster center is hit " << ds[i] << std::endl; + } nClustersOnLayer++; } - //at this point nClustersOnLayer is equal to the number of cluster centers - if it is zero we are - //done - if(nClustersOnLayer==0) return nClustersOnLayer; + // at this point nClustersOnLayer is equal to the number of cluster centers - + // if it is zero we are done + if (nClustersOnLayer == 0) + return nClustersOnLayer; - //assign remaining points to clusters, using the nearestHigher set from previous step (always set except + // assign remaining points to clusters, using the nearestHigher set from + // previous step (always set except // for top density hit that is skipped...) - for(unsigned int oi =1; oi < nd_size; ++oi){ + for (unsigned int oi = 1; oi < nd_size; ++oi) { unsigned int i = rs[oi]; int ci = nd[i].data.clusterIndex; - if(ci == -1){ // clusterIndex is initialised with -1 if not yet used in cluster - nd[i].data.clusterIndex = nd[nd[i].data.nearestHigher].data.clusterIndex; + if (ci == + -1) { // clusterIndex is initialised with -1 if not yet used in cluster + nd[i].data.clusterIndex = nd[nd[i].data.nearestHigher].data.clusterIndex; } } - //make room in the temporary cluster vector for the additional clusterIndex clusters + // make room in the temporary cluster vector for the additional clusterIndex + // clusters // from this layer - if (verbosity < pINFO) - { - std::cout << "resizing cluster vector by "<< nClustersOnLayer << std::endl; - } + if (verbosity < pINFO) { + std::cout << "resizing cluster vector by " << nClustersOnLayer << std::endl; + } clustersOnLayer.resize(nClustersOnLayer); - //assign points closer than dc to other clusters to border region - //and find critical border density - std::vector rho_b(nClustersOnLayer,0.); + // assign points closer than dc to other clusters to border region + // and find critical border density + std::vector rho_b(nClustersOnLayer, 0.); lp.clear(); - lp.build(nd,bounds); - //now loop on all hits again :( and check: if there are hits from another cluster within d_c -> flag as border hit - for(unsigned int i = 0; i < nd_size; ++i){ + lp.build(nd, bounds); + // now loop on all hits again :( and check: if there are hits from another + // cluster within d_c -> flag as border hit + for (unsigned int i = 0; i < nd_size; ++i) { int ci = nd[i].data.clusterIndex; bool flag_isolated = true; - if(ci != -1){ - KDTreeBox search_box(nd[i].dims[0]-delta_c,nd[i].dims[0]+delta_c, - nd[i].dims[1]-delta_c,nd[i].dims[1]+delta_c); + if (ci != -1) { + KDTreeBox search_box(nd[i].dims[0] - delta_c, nd[i].dims[0] + delta_c, + nd[i].dims[1] - delta_c, nd[i].dims[1] + delta_c); std::vector found; - lp.search(search_box,found); + lp.search(search_box, found); const unsigned int found_size = found.size(); - for(unsigned int j = 0; j < found_size; j++){ // start from 0 here instead of 1 - //check if the hit is not within d_c of another cluster - if(found[j].data.clusterIndex!=-1){ - float dist = distance(found[j].data,nd[i].data); - if(dist < delta_c && found[j].data.clusterIndex!=ci){ - //in which case we assign it to the border + for (unsigned int j = 0; j < found_size; + j++) { // start from 0 here instead of 1 + // check if the hit is not within d_c of another cluster + if (found[j].data.clusterIndex != -1) { + float dist = distance(found[j].data, nd[i].data); + if (dist < delta_c && found[j].data.clusterIndex != ci) { + // in which case we assign it to the border nd[i].data.isBorder = true; break; } - //because we are using two different containers, we have to make sure that we don't unflag the + // because we are using two different containers, we have to make sure + // that we don't unflag the // hit when it finds *itself* closer than delta_c - if(dist < delta_c && dist != 0. && found[j].data.clusterIndex==ci){ + if (dist < delta_c && dist != 0. && + found[j].data.clusterIndex == ci) { // in this case it is not an isolated hit - // the dist!=0 is because the hit being looked at is also inside the search box and at dist==0 + // the dist!=0 is because the hit being looked at is also inside the + // search box and at dist==0 flag_isolated = false; } } } - if(flag_isolated) nd[i].data.isBorder = true; //the hit is more than delta_c from any of its brethren + if (flag_isolated) + nd[i].data.isBorder = + true; // the hit is more than delta_c from any of its brethren } - //check if this border hit has density larger than the current rho_b and update - if(nd[i].data.isBorder && rho_b[ci] < nd[i].data.rho) + // check if this border hit has density larger than the current rho_b and + // update + if (nd[i].data.isBorder && rho_b[ci] < nd[i].data.rho) rho_b[ci] = nd[i].data.rho; } // end loop all hits - //flag points in cluster with density < rho_b as halo points, then fill the cluster vector - for(unsigned int i = 0; i < nd_size; ++i){ + // flag points in cluster with density < rho_b as halo points, then fill the + // cluster vector + for (unsigned int i = 0; i < nd_size; ++i) { int ci = nd[i].data.clusterIndex; - if(ci!=-1) { - if (nd[i].data.rho <= rho_b[ci]) nd[i].data.isHalo = true; + if (ci != -1) { + if (nd[i].data.rho <= rho_b[ci]) + nd[i].data.isHalo = true; clustersOnLayer[ci].push_back(nd[i]); - if (verbosity < pINFO) - { - std::cout << "Pushing hit " << i << " into cluster with index " << ci << std::endl; + if (verbosity < pINFO) { + std::cout << "Pushing hit " << i << " into cluster with index " << ci + << std::endl; } } } - //prepare the offset for the next layer if there is one - if (verbosity < pINFO) - { - std::cout << "moving cluster offset by " << nClustersOnLayer << std::endl; - } + // prepare the offset for the next layer if there is one + if (verbosity < pINFO) { + std::cout << "moving cluster offset by " << nClustersOnLayer << std::endl; + } return nClustersOnLayer; } - // find local maxima within delta_c, marking the indices in the cluster -std::vector HGCalImagingAlgo::findLocalMaximaInCluster(const std::vector& cluster) { +std::vector +HGCalImagingAlgo::findLocalMaximaInCluster(const std::vector &cluster) { std::vector result; - std::vector seed(cluster.size(),true); + std::vector seed(cluster.size(), true); float delta_c = 2.; - for( unsigned i = 0; i < cluster.size(); ++i ) { - for( unsigned j = 0; j < cluster.size(); ++j ) { - if( i != j and distance(cluster[i].data,cluster[j].data) < delta_c ) { - if( cluster[i].data.weight < cluster[j].data.weight ) { - seed[i] = false; - break; - } + for (unsigned i = 0; i < cluster.size(); ++i) { + for (unsigned j = 0; j < cluster.size(); ++j) { + if (i != j and distance(cluster[i].data, cluster[j].data) < delta_c) { + if (cluster[i].data.weight < cluster[j].data.weight) { + seed[i] = false; + break; + } } } } - for( unsigned i = 0 ; i < cluster.size(); ++i ) { - if( seed[i] && cluster[i].data.weight > 5e-4) { + for (unsigned i = 0; i < cluster.size(); ++i) { + if (seed[i] && cluster[i].data.weight > 5e-4) { // seed at i with energy cluster[i].weight result.push_back(i); } @@ -445,49 +487,49 @@ std::vector HGCalImagingAlgo::findLocalMaximaInCluster(const std::vect return result; } -math::XYZPoint HGCalImagingAlgo::calculatePositionWithFraction(const std::vector& hits, - const std::vector& fractions) { +math::XYZPoint HGCalImagingAlgo::calculatePositionWithFraction( + const std::vector &hits, const std::vector &fractions) { double norm(0.0), x(0.0), y(0.0), z(0.0); - for( unsigned i = 0; i < hits.size(); ++i ) { - const double weight = fractions[i]*hits[i].data.weight; + for (unsigned i = 0; i < hits.size(); ++i) { + const double weight = fractions[i] * hits[i].data.weight; norm += weight; - x += weight*hits[i].data.x; - y += weight*hits[i].data.y; - z += weight*hits[i].data.z; + x += weight * hits[i].data.x; + y += weight * hits[i].data.y; + z += weight * hits[i].data.z; } - math::XYZPoint result(x,y,z); + math::XYZPoint result(x, y, z); result /= norm; return result; } -double HGCalImagingAlgo::calculateEnergyWithFraction(const std::vector& hits, - const std::vector& fractions) { +double HGCalImagingAlgo::calculateEnergyWithFraction( + const std::vector &hits, const std::vector &fractions) { double result = 0.0; - for( unsigned i = 0 ; i < hits.size(); ++i ) { - result += fractions[i]*hits[i].data.weight; + for (unsigned i = 0; i < hits.size(); ++i) { + result += fractions[i] * hits[i].data.weight; } return result; } -void HGCalImagingAlgo::shareEnergy(const std::vector& incluster, - const std::vector& seeds, - std::vector >& outclusters) { - std::vector isaseed(incluster.size(),false); +void HGCalImagingAlgo::shareEnergy( + const std::vector &incluster, const std::vector &seeds, + std::vector> &outclusters) { + std::vector isaseed(incluster.size(), false); outclusters.clear(); outclusters.resize(seeds.size()); std::vector centroids(seeds.size()); std::vector energies(seeds.size()); - if( seeds.size() == 1 ) { // short circuit the case of a lone cluster + if (seeds.size() == 1) { // short circuit the case of a lone cluster outclusters[0].clear(); - outclusters[0].resize(incluster.size(),1.0); + outclusters[0].resize(incluster.size(), 1.0); return; } // saving seeds // create quick seed lookup - for( unsigned i = 0; i < seeds.size(); ++i ) { + for (unsigned i = 0; i < seeds.size(); ++i) { isaseed[seeds[i]] = true; } @@ -495,57 +537,60 @@ void HGCalImagingAlgo::shareEnergy(const std::vector& incluster, // centroids start off at seed positions // seeds always have fraction 1.0, to stabilize fit // initializing fit - for( unsigned i = 0; i < seeds.size(); ++i ) { - outclusters[i].resize(incluster.size(),0.0); - for( unsigned j = 0; j < incluster.size(); ++j ) { - if( j == seeds[i] ) { - outclusters[i][j] = 1.0; - centroids[i] = math::XYZPoint(incluster[j].data.x,incluster[j].data.y,incluster[j].data.z); - energies[i] = incluster[j].data.weight; + for (unsigned i = 0; i < seeds.size(); ++i) { + outclusters[i].resize(incluster.size(), 0.0); + for (unsigned j = 0; j < incluster.size(); ++j) { + if (j == seeds[i]) { + outclusters[i][j] = 1.0; + centroids[i] = math::XYZPoint(incluster[j].data.x, incluster[j].data.y, + incluster[j].data.z); + energies[i] = incluster[j].data.weight; } } } - // run the fit while we are less than max iterations, and clusters are still moving + // run the fit while we are less than max iterations, and clusters are still + // moving const double minFracTot = 1e-20; unsigned iter = 0; const unsigned iterMax = 50; double diff = std::numeric_limits::max(); const double stoppingTolerance = 1e-8; const auto numberOfSeeds = seeds.size(); - auto toleranceScaling = numberOfSeeds > 2 ? (numberOfSeeds-1)*(numberOfSeeds-1) : 1; + auto toleranceScaling = + numberOfSeeds > 2 ? (numberOfSeeds - 1) * (numberOfSeeds - 1) : 1; std::vector prevCentroids; std::vector frac(numberOfSeeds), dist2(numberOfSeeds); - while( iter++ < iterMax && diff > stoppingTolerance*toleranceScaling ) { - for( unsigned i = 0; i < incluster.size(); ++i ) { - const Hexel& ihit = incluster[i].data; + while (iter++ < iterMax && diff > stoppingTolerance * toleranceScaling) { + for (unsigned i = 0; i < incluster.size(); ++i) { + const Hexel &ihit = incluster[i].data; double fracTot(0.0); - for( unsigned j = 0; j < numberOfSeeds; ++j ) { - double fraction = 0.0; - double d2 = ( std::pow(ihit.x - centroids[j].x(),2.0) + - std::pow(ihit.y - centroids[j].y(),2.0) + - std::pow(ihit.z - centroids[j].z(),2.0) )/sigma2; - dist2[j] = d2; - // now we set the fractions up based on hit type - if( i == seeds[j] ) { // this cluster's seed - fraction = 1.0; - } else if( isaseed[i] ) { - fraction = 0.0; - } else { - fraction = energies[j]*std::exp( -0.5*d2 ); - } - fracTot += fraction; - frac[j] = fraction; + for (unsigned j = 0; j < numberOfSeeds; ++j) { + double fraction = 0.0; + double d2 = (std::pow(ihit.x - centroids[j].x(), 2.0) + + std::pow(ihit.y - centroids[j].y(), 2.0) + + std::pow(ihit.z - centroids[j].z(), 2.0)) / + sigma2; + dist2[j] = d2; + // now we set the fractions up based on hit type + if (i == seeds[j]) { // this cluster's seed + fraction = 1.0; + } else if (isaseed[i]) { + fraction = 0.0; + } else { + fraction = energies[j] * std::exp(-0.5 * d2); + } + fracTot += fraction; + frac[j] = fraction; } // now that we have calculated all fractions for all hits // assign the new fractions - for( unsigned j = 0; j < numberOfSeeds; ++j ) { - if( fracTot > minFracTot || - ( i == seeds[j] && fracTot > 0.0 ) ) { - outclusters[j][i] = frac[j]/fracTot; - } else { - outclusters[j][i] = 0.0; - } + for (unsigned j = 0; j < numberOfSeeds; ++j) { + if (fracTot > minFracTot || (i == seeds[j] && fracTot > 0.0)) { + outclusters[j][i] = frac[j] / fracTot; + } else { + outclusters[j][i] = 0.0; + } } } @@ -554,64 +599,73 @@ void HGCalImagingAlgo::shareEnergy(const std::vector& incluster, // finally update the position of the centroids from the last iteration centroids.resize(numberOfSeeds); double diff2 = 0.0; - for( unsigned i = 0; i < numberOfSeeds; ++i ) { - centroids[i] = calculatePositionWithFraction(incluster,outclusters[i]); - energies[i] = calculateEnergyWithFraction(incluster,outclusters[i]); + for (unsigned i = 0; i < numberOfSeeds; ++i) { + centroids[i] = calculatePositionWithFraction(incluster, outclusters[i]); + energies[i] = calculateEnergyWithFraction(incluster, outclusters[i]); // calculate convergence parameters - const double delta2 = (prevCentroids[i]-centroids[i]).perp2(); + const double delta2 = (prevCentroids[i] - centroids[i]).perp2(); diff2 = std::max(delta2, diff2); } - //update convergance parameter outside loop + // update convergance parameter outside loop diff = std::sqrt(diff2); } } void HGCalImagingAlgo::computeThreshold() { - if(initialized) return; // only need to calculate thresholds once - const std::vector& listee(rhtools_.getGeometry()->getValidDetIds(DetId::Forward,ForwardSubdetector::HGCEE)); - const std::vector& listfh(rhtools_.getGeometry()->getValidDetIds(DetId::Forward,ForwardSubdetector::HGCHEF)); + if (initialized) + return; // only need to calculate thresholds once + const std::vector &listee(rhtools_.getGeometry()->getValidDetIds( + DetId::Forward, ForwardSubdetector::HGCEE)); + const std::vector &listfh(rhtools_.getGeometry()->getValidDetIds( + DetId::Forward, ForwardSubdetector::HGCHEF)); std::vector dummy; dummy.resize(maxNumberOfWafersPerLayer, 0); thresholds.resize(maxlayer, dummy); v_sigmaNoise.resize(maxlayer, dummy); - int previouswafer=-999; + int previouswafer = -999; - for(unsigned icalo=0;icalo<2;++icalo) - { - const std::vector& listDetId( icalo==0 ? listee : listfh); + for (unsigned icalo = 0; icalo < 2; ++icalo) { + const std::vector &listDetId(icalo == 0 ? listee : listfh); - for(auto& detid: listDetId) - { + for (auto &detid : listDetId) { int wafer = rhtools_.getWafer(detid); - if(wafer==previouswafer) continue; + if (wafer == previouswafer) + continue; previouswafer = wafer; // no need to do it twice - if(rhtools_.zside(detid)<0) continue; + if (rhtools_.zside(detid) < 0) + continue; int layer = rhtools_.getLayerWithOffset(detid); float thickness = rhtools_.getSiThickness(detid); int thickIndex = -1; - if( thickness>99. && thickness<101.) thickIndex=0; - else if( thickness>199. && thickness<201. ) thickIndex=1; - else if( thickness>299. && thickness<301. ) thickIndex=2; - else assert( thickIndex>0 && "ERROR - silicon thickness has a nonsensical value" ); - float sigmaNoise = 0.001f * fcPerEle * nonAgedNoises[thickIndex] * dEdXweights[layer] / (fcPerMip[thickIndex] * thicknessCorrection[thickIndex]); - thresholds[layer-1][wafer]=sigmaNoise*ecut; - v_sigmaNoise[layer-1][wafer] = sigmaNoise; - } + if (thickness > 99. && thickness < 101.) + thickIndex = 0; + else if (thickness > 199. && thickness < 201.) + thickIndex = 1; + else if (thickness > 299. && thickness < 301.) + thickIndex = 2; + else + assert(thickIndex > 0 && + "ERROR - silicon thickness has a nonsensical value"); + float sigmaNoise = + 0.001f * fcPerEle * nonAgedNoises[thickIndex] * dEdXweights[layer] / + (fcPerMip[thickIndex] * thicknessCorrection[thickIndex]); + thresholds[layer - 1][wafer] = sigmaNoise * ecut; + v_sigmaNoise[layer - 1][wafer] = sigmaNoise; } + } // now BH, much faster - for ( unsigned ilayer=lastLayerFH+1;ilayer<=maxlayer;++ilayer) - { - float sigmaNoise = 0.001f * noiseMip * dEdXweights[ilayer]; - std::vector bhDummy_thresholds; - std::vector bhDummy_sigmaNoise; - bhDummy_thresholds.push_back(sigmaNoise*ecut); - bhDummy_sigmaNoise.push_back(sigmaNoise); - thresholds[ilayer-1]=bhDummy_thresholds; - v_sigmaNoise[ilayer-1]=bhDummy_sigmaNoise; - } - initialized=true; + for (unsigned ilayer = lastLayerFH + 1; ilayer <= maxlayer; ++ilayer) { + float sigmaNoise = 0.001f * noiseMip * dEdXweights[ilayer]; + std::vector bhDummy_thresholds; + std::vector bhDummy_sigmaNoise; + bhDummy_thresholds.push_back(sigmaNoise * ecut); + bhDummy_sigmaNoise.push_back(sigmaNoise); + thresholds[ilayer - 1] = bhDummy_thresholds; + v_sigmaNoise[ilayer - 1] = bhDummy_sigmaNoise; + } + initialized = true; } From 0765bb976a6f54a77afee4b6d5e82559ba17f3cf Mon Sep 17 00:00:00 2001 From: Felice Date: Thu, 29 Mar 2018 19:41:47 +0200 Subject: [PATCH 280/426] removing spurious ; --- RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc index 6b6a7d7801634..fa26245cd8622 100644 --- a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc +++ b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc @@ -169,7 +169,7 @@ std::vector HGCalImagingAlgo::getClusters(bool doSharing) { energy += it.data.isHalo ? 0. : it.data.weight; // use fraction to store whether this is a Halo hit or not thisCluster.emplace_back(it.data.detid, (it.data.isHalo ? 0.f : 1.f)); - }; + } if (verbosity < pINFO) { std::cout << "******** NEW CLUSTER (HGCIA) ********" << std::endl; std::cout << "Index " << i << std::endl; From 76e5d14cb8cabdc5e7e322c8befeaec339d5a6b7 Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Thu, 29 Mar 2018 20:24:42 +0200 Subject: [PATCH 281/426] use using statements as before --- .../TkNavigation/plugins/CosmicNavigationSchool.cc | 2 +- RecoTracker/TkNavigation/plugins/SimpleNavigableLayer.h | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/RecoTracker/TkNavigation/plugins/CosmicNavigationSchool.cc b/RecoTracker/TkNavigation/plugins/CosmicNavigationSchool.cc index 7cc232896d383..99b55ea904cd7 100644 --- a/RecoTracker/TkNavigation/plugins/CosmicNavigationSchool.cc +++ b/RecoTracker/TkNavigation/plugins/CosmicNavigationSchool.cc @@ -44,7 +44,7 @@ class dso_hidden CosmicNavigationSchool : public SimpleNavigationSchool { //FakeDetLayer* theFakeDetLayer; void linkBarrelLayers( SymmetricLayerFinder& symFinder) override; //void linkForwardLayers( SymmetricLayerFinder& symFinder); - void establishInverseRelations() override {}; + using SimpleNavigationSchool::establishInverseRelations; void establishInverseRelations( SymmetricLayerFinder& symFinder ); void buildAdditionalBarrelLinks(); void buildAdditionalForwardLinks(SymmetricLayerFinder& symFinder); diff --git a/RecoTracker/TkNavigation/plugins/SimpleNavigableLayer.h b/RecoTracker/TkNavigation/plugins/SimpleNavigableLayer.h index 73f1a135e4c7c..df9bfde9c3d77 100644 --- a/RecoTracker/TkNavigation/plugins/SimpleNavigableLayer.h +++ b/RecoTracker/TkNavigation/plugins/SimpleNavigableLayer.h @@ -32,14 +32,7 @@ class dso_hidden SimpleNavigableLayer : public NavigableLayer { void setCheckCrossingSide(bool docheck) {theCheckCrossingSide = docheck;} - std::vector - compatibleLayers( NavigationDirection direction) const override = 0; - - std::vector - compatibleLayers( const FreeTrajectoryState& fts, - PropagationDirection timeDirection) const override {int counter =0; return compatibleLayers(fts,timeDirection,counter);}; - - + using NavigableLayer::compatibleLayers; std::vector< const DetLayer * > compatibleLayers (const FreeTrajectoryState &fts, PropagationDirection timeDirection, int& counter) const final; From 0aa4e687cdc6f291b4ff8eca908f959bcd39657c Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Thu, 29 Mar 2018 20:34:56 +0200 Subject: [PATCH 282/426] use emplace_back instead of push_back --- .../FTLRecProducers/plugins/FTLUncalibratedRecHitProducer.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RecoLocalFastTime/FTLRecProducers/plugins/FTLUncalibratedRecHitProducer.cc b/RecoLocalFastTime/FTLRecProducers/plugins/FTLUncalibratedRecHitProducer.cc index 9467026b045de..d57f204309bc3 100644 --- a/RecoLocalFastTime/FTLRecProducers/plugins/FTLUncalibratedRecHitProducer.cc +++ b/RecoLocalFastTime/FTLRecProducers/plugins/FTLUncalibratedRecHitProducer.cc @@ -71,14 +71,14 @@ FTLUncalibratedRecHitProducer::produce(edm::Event& evt, const edm::EventSetup& e evt.getByToken( ftlbDigis_, hBarrel ); barrelRechits->reserve(hBarrel->size()/2); for(const auto& digi : *hBarrel) { - barrelRechits->push_back( barrel_->makeRecHit(digi) ); + barrelRechits->emplace_back( barrel_->makeRecHit(digi) ); } edm::Handle< FTLDigiCollection > hEndcap; evt.getByToken( ftleDigis_, hEndcap ); endcapRechits->reserve(hEndcap->size()/2); for(const auto& digi : *hEndcap) { - endcapRechits->push_back( endcap_->makeRecHit(digi) ); + endcapRechits->emplace_back( endcap_->makeRecHit(digi) ); } // put the collection of recunstructed hits in the event From af9db1cbb92157df9441dc1f3671b92f93e3d67d Mon Sep 17 00:00:00 2001 From: Mauro Date: Thu, 29 Mar 2018 21:28:57 +0200 Subject: [PATCH 283/426] Updated cfg file for beampixel application for 2018 run --- .../beampixel_dqm_sourceclient-live_cfg.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/DQM/Integration/python/clients/beampixel_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/beampixel_dqm_sourceclient-live_cfg.py index 01c407a6810b0..7e92c37348862 100644 --- a/DQM/Integration/python/clients/beampixel_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/beampixel_dqm_sourceclient-live_cfg.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms from Configuration.StandardSequences.Eras import eras -process = cms.Process("BeamPixel", eras.Run2_2017) +process = cms.Process("BeamPixel", eras.Run2_2018) #---------------------------- @@ -59,9 +59,9 @@ #---------------------------- from DQM.Integration.config.online_customizations_cfi import * process = customise(process) - from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer + #---------------------------- # Proton-Proton Specific Part #---------------------------- @@ -127,16 +127,14 @@ #---------------------------- from RecoPixelVertexing.PixelLowPtUtilities.siPixelClusterShapeCache_cfi import * process.siPixelClusterShapeCachePreSplitting = siPixelClusterShapeCache.clone(src = 'siPixelClustersPreSplitting') - process.load("RecoLocalTracker.SiPixelRecHits.PixelCPEGeneric_cfi") - process.load("RecoPixelVertexing.PixelTrackFitting.PixelTracks_2017_cff") - process.load("RecoVertex.PrimaryVertexProducer.OfflinePixel3DPrimaryVertices_cfi") + process.load("RecoPixelVertexing.Configuration.RecoPixelVertexing_cff") process.recopixelvertexing = cms.Sequence(process.pixelTracksSequence + process.pixelVertices) process.pixelVertices.TkFilterParameters.minPt = process.pixelTracksTrackingRegions.RegionPSet.ptMin - process.pixelTracksTrackingRegions.RegionPSet.originRadius = 0.4 - process.pixelTracksTrackingRegions.RegionPSet.originHalfLength = 6 - process.pixelTracksTrackingRegions.RegionPSet.originXPos = 0.08 - process.pixelTracksTrackingRegions.RegionPSet.originYPos = -0.03 - process.pixelTracksTrackingRegions.RegionPSet.originZPos = 1 + process.pixelTracksTrackingRegions.RegionPSet.originRadius = 0.4 + process.pixelTracksTrackingRegions.RegionPSet.originHalfLength = 15. + process.pixelTracksTrackingRegions.RegionPSet.originXPos = 0.08 + process.pixelTracksTrackingRegions.RegionPSet.originYPos = -0.03 + process.pixelTracksTrackingRegions.RegionPSet.originZPos = 0. #---------------------------- From 914fbeeb8f1c42c88369ad12e8863b6c3a7c9f4d Mon Sep 17 00:00:00 2001 From: Igor Date: Fri, 30 Mar 2018 10:27:43 +0200 Subject: [PATCH 284/426] Fix effective pedestals logic (ignore such peds for QIE8) --- .../HcalRecProducers/src/HBHEPhase1Reconstructor.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/RecoLocalCalo/HcalRecProducers/src/HBHEPhase1Reconstructor.cc b/RecoLocalCalo/HcalRecProducers/src/HBHEPhase1Reconstructor.cc index db6d39d2c0303..d807dfa42fa07 100644 --- a/RecoLocalCalo/HcalRecProducers/src/HBHEPhase1Reconstructor.cc +++ b/RecoLocalCalo/HcalRecProducers/src/HBHEPhase1Reconstructor.cc @@ -493,6 +493,7 @@ void HBHEPhase1Reconstructor::processData(const Collection& coll, coder.adc2fC(frame, cs); // Prepare to iterate over time slices + const bool saveEffectivePeds = channelInfo->hasEffectivePedestals(); const int nRead = cs.size(); const int maxTS = std::min(nRead, static_cast(HBHEChannelInfo::MAXSAMPLES)); const int soi = tsFromDB_ ? param_ts->firstSample() : frame.presamples(); @@ -508,8 +509,8 @@ void HBHEPhase1Reconstructor::processData(const Collection& coll, const int capid = s.capid(); //optionally store "effective" pedestal (measured with bias voltage on) // = QIE contribution + SiPM contribution (from dark current + crosstalk) - const double pedestal = saveEffectivePedestal_ ? calib.effpedestal(capid) : calib.pedestal(capid); - const double pedestalWidth = saveEffectivePedestal_ ? calibWidth.effpedestal(capid) : calibWidth.pedestal(capid); + const double pedestal = saveEffectivePeds ? calib.effpedestal(capid) : calib.pedestal(capid); + const double pedestalWidth = saveEffectivePeds ? calibWidth.effpedestal(capid) : calibWidth.pedestal(capid); const double gain = calib.respcorrgain(capid); const double gainWidth = calibWidth.gain(capid); //always use QIE-only pedestal for this computation From 10717664100e12737213bd8374e97ddb551bd5e7 Mon Sep 17 00:00:00 2001 From: lata Date: Fri, 30 Mar 2018 11:41:44 +0200 Subject: [PATCH 285/426] change in the code to remove warnings --- CondTools/BTau/src/BTagCalibrationReader.cc | 2 +- CondTools/BTau/test/BTagCalibrationStandalone.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CondTools/BTau/src/BTagCalibrationReader.cc b/CondTools/BTau/src/BTagCalibrationReader.cc index a6ecc51c3215f..a34ac7e3cdb52 100644 --- a/CondTools/BTau/src/BTagCalibrationReader.cc +++ b/CondTools/BTau/src/BTagCalibrationReader.cc @@ -67,7 +67,7 @@ BTagCalibrationReader::BTagCalibrationReaderImpl::BTagCalibrationReaderImpl( << "Every otherSysType should only be given once. Duplicate: " << ost; } - otherSysTypeReaders_[ost] = std::auto_ptr( + otherSysTypeReaders_[ost] = std::unique_ptr( new BTagCalibrationReaderImpl(op, ost) ); } diff --git a/CondTools/BTau/test/BTagCalibrationStandalone.cpp b/CondTools/BTau/test/BTagCalibrationStandalone.cpp index 63b8b30794587..eb596a103b61e 100644 --- a/CondTools/BTau/test/BTagCalibrationStandalone.cpp +++ b/CondTools/BTau/test/BTagCalibrationStandalone.cpp @@ -432,7 +432,7 @@ std::cerr << "ERROR in BTagCalibration: " << ost; throw std::exception(); } - otherSysTypeReaders_[ost] = std::auto_ptr( + otherSysTypeReaders_[ost] = std::unique_ptr( new BTagCalibrationReaderImpl(op, ost) ); } @@ -443,7 +443,7 @@ void BTagCalibrationReader::BTagCalibrationReaderImpl::load( BTagEntry::JetFlavor jf, std::string measurementType) { - if (tmpData_[jf].size()) { + if (!tmpData_[jf].empty()) { std::cerr << "ERROR in BTagCalibration: " << "Data for this jet-flavor is already loaded: " << jf; From 623a73b380f4d65bce3678c5e47199b4a59086ba Mon Sep 17 00:00:00 2001 From: Heiner Tholen Date: Fri, 30 Mar 2018 14:45:19 +0200 Subject: [PATCH 286/426] using shallowTagInfos as default and normal tag infos as a fallback --- .../Trigger/interface/BTVHLTOfflineSource.h | 7 ++ DQMOffline/Trigger/src/BTVHLTOfflineSource.cc | 105 +++++++++++------- 2 files changed, 71 insertions(+), 41 deletions(-) diff --git a/DQMOffline/Trigger/interface/BTVHLTOfflineSource.h b/DQMOffline/Trigger/interface/BTVHLTOfflineSource.h index e213e21c311e2..681f727fe25b5 100644 --- a/DQMOffline/Trigger/interface/BTVHLTOfflineSource.h +++ b/DQMOffline/Trigger/interface/BTVHLTOfflineSource.h @@ -25,6 +25,7 @@ #include "DQMServices/Core/interface/MonitorElement.h" #include "DataFormats/BTauReco/interface/JetTag.h" #include "DataFormats/BTauReco/interface/SecondaryVertexTagInfo.h" +#include "DataFormats/BTauReco/interface/ShallowTagInfo.h" #include "DataFormats/Common/interface/TriggerResults.h" #include "DataFormats/HLTReco/interface/TriggerEvent.h" #include "DataFormats/HLTReco/interface/TriggerObject.h" @@ -73,6 +74,12 @@ class BTVHLTOfflineSource : public DQMEDAnalyzer { edm::EDGetTokenT triggerSummaryToken; edm::EDGetTokenT triggerSummaryFUToken; + edm::EDGetTokenT > shallowTagInfosTokenCalo_; + edm::EDGetTokenT > shallowTagInfosTokenPf_; + + edm::Handle > shallowTagInfosCalo; + edm::Handle > shallowTagInfosPf; + edm::EDGetTokenT,reco::Track,edm::refhelper::FindUsingAdvance,reco::Track> >,reco::JTATagInfo>,reco::Vertex> > > csvCaloTagInfosToken_; edm::EDGetTokenT,reco::Track,edm::refhelper::FindUsingAdvance,reco::Track> >,reco::JTATagInfo>,reco::Vertex> > > diff --git a/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc b/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc index f4895acc71f08..102af472b32c8 100644 --- a/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc +++ b/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc @@ -49,6 +49,8 @@ BTVHLTOfflineSource::BTVHLTOfflineSource(const edm::ParameterSet& iConfig) triggerResultsToken = consumes (triggerResultsLabel_); triggerSummaryFUToken = consumes (edm::InputTag(triggerSummaryLabel_.label(),triggerSummaryLabel_.instance(),std::string("FU"))); triggerResultsFUToken = consumes (edm::InputTag(triggerResultsLabel_.label(),triggerResultsLabel_.instance(),std::string("FU"))); + shallowTagInfosTokenCalo_ = consumes > (edm::InputTag("hltDeepCombinedSecondaryVertexBJetTagsInfosCalo")); + shallowTagInfosTokenPf_ = consumes > (edm::InputTag("hltDeepCombinedSecondaryVertexBJetTagsInfos")); csvCaloTagInfosToken_ = consumes,reco::Track,edm::refhelper::FindUsingAdvance,reco::Track> >,reco::JTATagInfo>,reco::Vertex> > > ( edm::InputTag("hltInclusiveSecondaryVertexFinderTagInfos")); csvPfTagInfosToken_ = consumes,reco::Track,edm::refhelper::FindUsingAdvance,reco::Track> >,reco::JTATagInfo>,reco::Vertex> > > ( @@ -181,37 +183,6 @@ BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iS } } - iEvent.getByToken(csvPfTagInfosToken_, csvPfTagInfos); - if (csvPfTagInfos.isValid() && v.getTriggerType() == "PF") { - - // loop over secondary vertex tag infos - for (const auto & csvPfTagInfo : *csvPfTagInfos) { - v.getMEhisto_n_vtx()->Fill(csvPfTagInfo.nVertexCandidates()); - v.getMEhisto_n_sel_tracks()->Fill(csvPfTagInfo.nSelectedTracks()); - - // loop over selected tracks in each tag info - for (unsigned i_trk=0; i_trk < csvPfTagInfo.nSelectedTracks(); i_trk++) { - const auto & ip3d = csvPfTagInfo.trackIPData(i_trk).ip3d; - v.getMEhisto_h_3d_ip_distance()->Fill(ip3d.value()); - v.getMEhisto_h_3d_ip_error()->Fill(ip3d.error()); - v.getMEhisto_h_3d_ip_sig()->Fill(ip3d.significance()); - } - - // loop over vertex candidates in each tag info - for (unsigned i_sv=0; i_sv < csvPfTagInfo.nVertexCandidates(); i_sv++) { - const auto & sv = csvPfTagInfo.secondaryVertex(i_sv); - v.getMEhisto_vtx_mass()->Fill(sv.p4().mass()); - v.getMEhisto_n_vtx_trks()->Fill(sv.nTracks()); - - // loop over tracks for number of pixel and total hits - const auto & trkIPTagInfo = csvPfTagInfo.trackIPTagInfoRef().get(); - for (const auto & trk : trkIPTagInfo->selectedTracks()) { - v.getMEhisto_n_pixel_hits()->Fill(trk.get()->hitPattern().numberOfValidPixelHits()); - v.getMEhisto_n_total_hits()->Fill(trk.get()->hitPattern().numberOfValidHits()); - } - } - } - } // Calo b-tagging if (csvCaloTags.isValid() && v.getTriggerType() == "Calo" && !csvCaloTags->empty()) @@ -256,30 +227,83 @@ BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iS } + // additional plots from tag info collections + ///////////////////////////////////////////// + + iEvent.getByToken(shallowTagInfosTokenPf_, shallowTagInfosPf); + iEvent.getByToken(csvPfTagInfosToken_, csvPfTagInfos); + iEvent.getByToken(shallowTagInfosTokenCalo_, shallowTagInfosCalo); iEvent.getByToken(csvCaloTagInfosToken_, csvCaloTagInfos); - if (csvCaloTagInfos.isValid() && v.getTriggerType() == "Calo") { + + // first try to get info from shallowTagInfos ... + if ( (v.getTriggerType() == "PF" && shallowTagInfosPf.isValid()) + || (v.getTriggerType() == "Calo" && shallowTagInfosCalo.isValid()) ) + { + const auto & shallowTagInfoCollection = (v.getTriggerType() == "PF") ? shallowTagInfosPf : shallowTagInfosCalo; + for (const auto & shallowTagInfo : *shallowTagInfoCollection) { + const auto & tagVars = shallowTagInfo.taggingVariables(); + + // n secondary vertices and n selected tracks + for (const auto & tagVar : tagVars.getList(reco::btau::jetNSecondaryVertices, false)) { + v.getMEhisto_n_vtx()->Fill(tagVar); + } + for (const auto & tagVar : tagVars.getList(reco::btau::jetNSelectedTracks, false)) { + v.getMEhisto_n_sel_tracks()->Fill(tagVar);} + + // impact parameter + const auto & trackSip3dVal = tagVars.getList(reco::btau::trackSip3dVal, false); + const auto & trackSip3dSig = tagVars.getList(reco::btau::trackSip3dSig, false); + for (unsigned i_trk=0; i_trk < trackSip3dVal.size(); i_trk++) { + float val = trackSip3dVal[i_trk]; + float sig = trackSip3dSig[i_trk]; + v.getMEhisto_h_3d_ip_distance()->Fill(val); + v.getMEhisto_h_3d_ip_error()->Fill(val/sig); + v.getMEhisto_h_3d_ip_sig()->Fill(sig); + } + + // vertex mass and tracks per vertex + for (const auto & tagVar : tagVars.getList(reco::btau::vertexMass, false)) { + v.getMEhisto_vtx_mass()->Fill(tagVar);} + for (const auto & tagVar : tagVars.getList(reco::btau::vertexNTracks, false)) { + if (tagVar > 0.) { + v.getMEhisto_n_vtx_trks()->Fill(tagVar);}} + + // track N total/pixel hits + for (const auto & tagVar : tagVars.getList(reco::btau::trackNPixelHits, false)) { + v.getMEhisto_n_pixel_hits()->Fill(tagVar);} + for (const auto & tagVar : tagVars.getList(reco::btau::trackNTotalHits, false)) { + v.getMEhisto_n_total_hits()->Fill(tagVar);} + } + } + + // ... otherwise from usual tag infos. + else + if ( (v.getTriggerType() == "PF" && csvPfTagInfos.isValid()) + || (v.getTriggerType() == "Calo" && csvCaloTagInfos.isValid()) ) + { + const auto & csvTagInfoCollection = (v.getTriggerType() == "PF") ? csvPfTagInfos : csvCaloTagInfos; // loop over secondary vertex tag infos - for (const auto & csvCaloTagInfo : *csvCaloTagInfos) { - v.getMEhisto_n_vtx()->Fill(csvCaloTagInfo.nVertexCandidates()); - v.getMEhisto_n_sel_tracks()->Fill(csvCaloTagInfo.nSelectedTracks()); + for (const auto & csvTagInfo : *csvTagInfoCollection) { + v.getMEhisto_n_vtx()->Fill(csvTagInfo.nVertexCandidates()); + v.getMEhisto_n_sel_tracks()->Fill(csvTagInfo.nSelectedTracks()); // loop over selected tracks in each tag info - for (unsigned i_trk=0; i_trk < csvCaloTagInfo.nSelectedTracks(); i_trk++) { - const auto & ip3d = csvCaloTagInfo.trackIPData(i_trk).ip3d; + for (unsigned i_trk=0; i_trk < csvTagInfo.nSelectedTracks(); i_trk++) { + const auto & ip3d = csvTagInfo.trackIPData(i_trk).ip3d; v.getMEhisto_h_3d_ip_distance()->Fill(ip3d.value()); v.getMEhisto_h_3d_ip_error()->Fill(ip3d.error()); v.getMEhisto_h_3d_ip_sig()->Fill(ip3d.significance()); } // loop over vertex candidates in each tag info - for (unsigned i_sv=0; i_sv < csvCaloTagInfo.nVertexCandidates(); i_sv++) { - const auto & sv = csvCaloTagInfo.secondaryVertex(i_sv); + for (unsigned i_sv=0; i_sv < csvTagInfo.nVertexCandidates(); i_sv++) { + const auto & sv = csvTagInfo.secondaryVertex(i_sv); v.getMEhisto_vtx_mass()->Fill(sv.p4().mass()); v.getMEhisto_n_vtx_trks()->Fill(sv.nTracks()); // loop over tracks for number of pixel and total hits - const auto & trkIPTagInfo = csvCaloTagInfo.trackIPTagInfoRef().get(); + const auto & trkIPTagInfo = csvTagInfo.trackIPTagInfoRef().get(); for (const auto & trk : trkIPTagInfo->selectedTracks()) { v.getMEhisto_n_pixel_hits()->Fill(trk.get()->hitPattern().numberOfValidPixelHits()); v.getMEhisto_n_total_hits()->Fill(trk.get()->hitPattern().numberOfValidHits()); @@ -288,7 +312,6 @@ BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iS } } - } } } From 4b9b515cdd1e0dcc96477981448dfee2729e4683 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Wed, 21 Feb 2018 23:09:32 +0100 Subject: [PATCH 287/426] Customize premixing input in step3 with premix_stage2 modifier --- .../TrackingParticleConversionRefSelector.cc | 2 +- ...ackingParticleConversionRefSelector_cfi.py | 5 ++ .../python/trackingParticleRefSelector_cfi.py | 4 +- .../python/trackingParticleSelector_cfi.py | 4 +- .../python/simHitTPAssociation_cfi.py | 3 + ...ckingParticleNumberOfLayersProducer_cff.py | 3 + .../python/MuonAssociatorByHits_cfi.py | 11 +++ ...ackingParticleRecoTrackAsssociation_cfi.py | 2 + .../python/quickTrackAssociatorByHits_cfi.py | 6 ++ .../python/trackAssociatorByHits_cfi.py | 5 ++ .../TrackingParticleBHadronRefSelector.cc | 2 +- .../TrackHistory/python/TrackHistory_cff.py | 2 + .../TrackHistory/python/TrackQuality_cff.py | 8 ++ .../trackingParticleBHadronRefSelector_cfi.py | 5 ++ .../python/tpClusterProducer_cfi.py | 7 ++ .../python/globalrechits_analyze_cfi.py | 7 +- .../HcalDigis/python/HLTHcalDigisParam_cfi.py | 5 ++ .../HcalDigis/python/HcalDigisParam_cfi.py | 5 ++ .../python/rpcRecHitValidation_cfi.py | 2 + .../RecoMuon/python/MuonTrackValidator_cfi.py | 6 ++ .../RecoMuon/python/RecoMuonValidator_cfi.py | 3 + Validation/RecoMuon/python/associators_cff.py | 4 +- Validation/RecoMuon/python/selectors_cff.py | 9 ++- .../python/MultiTrackValidator_cfi.py | 7 ++ .../python/SiPixelTrackingRecHitsValid_cfi.py | 5 ++ .../python/SiStripTrackingRecHitsValid_cfi.py | 6 +- .../RecoTrack/python/associators_cff.py | 79 ++++--------------- .../PrimaryVertexAnalyzer4PUSlimmed_cfi.py | 5 ++ .../RecoVertex/python/v0validator_cfi.py | 3 + .../python/SiPixelPhase1HitsV_cfi.py | 2 + .../SiPixelPhase1TrackingParticleV_cfi.py | 2 + .../python/SiPixelRecHitsValid_cfi.py | 6 +- .../python/SiStripRecHitsValid_cfi.py | 6 +- .../python/trackingTruthValidation_cfi.py | 3 +- 34 files changed, 154 insertions(+), 80 deletions(-) create mode 100644 CommonTools/RecoAlgos/python/trackingParticleConversionRefSelector_cfi.py create mode 100644 SimTracker/TrackHistory/python/trackingParticleBHadronRefSelector_cfi.py diff --git a/CommonTools/RecoAlgos/plugins/TrackingParticleConversionRefSelector.cc b/CommonTools/RecoAlgos/plugins/TrackingParticleConversionRefSelector.cc index 1f411cba9ef7b..fd7c5de75df74 100644 --- a/CommonTools/RecoAlgos/plugins/TrackingParticleConversionRefSelector.cc +++ b/CommonTools/RecoAlgos/plugins/TrackingParticleConversionRefSelector.cc @@ -31,7 +31,7 @@ TrackingParticleConversionRefSelector::TrackingParticleConversionRefSelector(con void TrackingParticleConversionRefSelector::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.add("src", edm::InputTag("mix", "MergedTrackTruth")); - descriptions.add("trackingParticleConversionRefSelector", desc); + descriptions.add("trackingParticleConversionRefSelectorDefault", desc); } void TrackingParticleConversionRefSelector::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { diff --git a/CommonTools/RecoAlgos/python/trackingParticleConversionRefSelector_cfi.py b/CommonTools/RecoAlgos/python/trackingParticleConversionRefSelector_cfi.py new file mode 100644 index 0000000000000..dc7ffb018b2b8 --- /dev/null +++ b/CommonTools/RecoAlgos/python/trackingParticleConversionRefSelector_cfi.py @@ -0,0 +1,5 @@ +from CommonTools.RecoAlgos.trackingParticleConversionRefSelectorDefault_cfi import trackingParticleConversionRefSelectorDefault as _trackingParticleConversionRefSelectorDefault +trackingParticleConversionRefSelector = _trackingParticleConversionRefSelectorDefault.clone() + +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(trackingParticleConversionRefSelector, src = "mixData:MergedTrackTruth") diff --git a/CommonTools/RecoAlgos/python/trackingParticleRefSelector_cfi.py b/CommonTools/RecoAlgos/python/trackingParticleRefSelector_cfi.py index cca1cdf827744..9cc21efd01c5c 100644 --- a/CommonTools/RecoAlgos/python/trackingParticleRefSelector_cfi.py +++ b/CommonTools/RecoAlgos/python/trackingParticleRefSelector_cfi.py @@ -18,5 +18,5 @@ maxPhi = cms.double(3.2), ) - - +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(trackingParticleRefSelector, src = "mixData:MergedTrackTruth") diff --git a/PhysicsTools/RecoAlgos/python/trackingParticleSelector_cfi.py b/PhysicsTools/RecoAlgos/python/trackingParticleSelector_cfi.py index 61a2b49c65d8f..a51b01bfb4c71 100644 --- a/PhysicsTools/RecoAlgos/python/trackingParticleSelector_cfi.py +++ b/PhysicsTools/RecoAlgos/python/trackingParticleSelector_cfi.py @@ -18,5 +18,5 @@ maxPhi = cms.double(3.2), ) - - +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(trackingParticleSelector, src = "mixData:MergedTrackTruth") diff --git a/SimGeneral/TrackingAnalysis/python/simHitTPAssociation_cfi.py b/SimGeneral/TrackingAnalysis/python/simHitTPAssociation_cfi.py index 2c251718a8d80..ffcde897870b0 100644 --- a/SimGeneral/TrackingAnalysis/python/simHitTPAssociation_cfi.py +++ b/SimGeneral/TrackingAnalysis/python/simHitTPAssociation_cfi.py @@ -29,3 +29,6 @@ "MuonSimHits:MuonDTHits", "MuonSimHits:MuonRPCHits"] ) + +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(simHitTPAssocProducer, trackingParticleSrc = "mixData:MergedTrackTruth") diff --git a/SimGeneral/TrackingAnalysis/python/trackingParticleNumberOfLayersProducer_cff.py b/SimGeneral/TrackingAnalysis/python/trackingParticleNumberOfLayersProducer_cff.py index 646386efb873e..98353db571132 100644 --- a/SimGeneral/TrackingAnalysis/python/trackingParticleNumberOfLayersProducer_cff.py +++ b/SimGeneral/TrackingAnalysis/python/trackingParticleNumberOfLayersProducer_cff.py @@ -3,3 +3,6 @@ fastSim.toModify(trackingParticleNumberOfLayersProducer, simHits=['fastSimProducer:TrackerHits']) from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker phase2_tracker.toModify(trackingParticleNumberOfLayersProducer, simHits = ["g4SimHits:TrackerHitsPixelBarrelLowTof", "g4SimHits:TrackerHitsPixelEndcapLowTof"]) + +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(trackingParticleNumberOfLayersProducer, trackingParticles = "mixData:MergedTrackTruth") diff --git a/SimMuon/MCTruth/python/MuonAssociatorByHits_cfi.py b/SimMuon/MCTruth/python/MuonAssociatorByHits_cfi.py index be42e93976c5d..7092fcdcfbe16 100644 --- a/SimMuon/MCTruth/python/MuonAssociatorByHits_cfi.py +++ b/SimMuon/MCTruth/python/MuonAssociatorByHits_cfi.py @@ -114,6 +114,16 @@ RPCsimhitsXFTag = "mix:MuonSimHitsMuonRPCHits", ROUList = ['fastSimProducerTrackerHits'] ) + +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(muonAssociatorByHitsCommonParameters, + DTdigisimlinkTag = "mixData:simMuonDTDigis", + CSClinksTag = "mixData:MuonCSCStripDigiSimLinks", + CSCwireLinksTag = "mixData:MuonCSCWireDigiSimLinks", + RPCdigisimlinkTag = "mixData:RPCDigiSimLink", + pixelSimLinkSrc = "mixData:PixelDigiSimLink", + stripSimLinkSrc = "mixData:StripDigiSimLink", +) muonAssociatorByHits = cms.EDProducer("MuonAssociatorEDProducer", # COMMON CONFIGURATION @@ -146,3 +156,4 @@ ignoreMissingTrackCollection = cms.untracked.bool(False), ) +premix_stage2.toModify(muonAssociatorByHits, tpTag = "mixData:MergedTrackTruth") diff --git a/SimTracker/TrackAssociation/python/trackingParticleRecoTrackAsssociation_cfi.py b/SimTracker/TrackAssociation/python/trackingParticleRecoTrackAsssociation_cfi.py index a1908afc0f383..cdc07e07c9fd8 100644 --- a/SimTracker/TrackAssociation/python/trackingParticleRecoTrackAsssociation_cfi.py +++ b/SimTracker/TrackAssociation/python/trackingParticleRecoTrackAsssociation_cfi.py @@ -7,4 +7,6 @@ ignoremissingtrackcollection=cms.untracked.bool(False) ) +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(trackingParticleRecoTrackAsssociation, label_tp = "mixData:MergedTrackTruth") diff --git a/SimTracker/TrackAssociatorProducers/python/quickTrackAssociatorByHits_cfi.py b/SimTracker/TrackAssociatorProducers/python/quickTrackAssociatorByHits_cfi.py index 63317698a2e83..66b2ded41ce33 100644 --- a/SimTracker/TrackAssociatorProducers/python/quickTrackAssociatorByHits_cfi.py +++ b/SimTracker/TrackAssociatorProducers/python/quickTrackAssociatorByHits_cfi.py @@ -29,3 +29,9 @@ pixelSimLinkSrc = cms.InputTag("simSiPixelDigis","Pixel"), stripSimLinkSrc = cms.InputTag("simSiPixelDigis","Tracker") ) + +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(quickTrackAssociatorByHits, + pixelSimLinkSrc = "mixData:PixelDigiSimLink", + stripSimLinkSrc = "mixData:StripDigiSimLink", +) diff --git a/SimTracker/TrackAssociatorProducers/python/trackAssociatorByHits_cfi.py b/SimTracker/TrackAssociatorProducers/python/trackAssociatorByHits_cfi.py index 96f4991655ff7..980daf3d7d6a7 100644 --- a/SimTracker/TrackAssociatorProducers/python/trackAssociatorByHits_cfi.py +++ b/SimTracker/TrackAssociatorProducers/python/trackAssociatorByHits_cfi.py @@ -31,3 +31,8 @@ ) +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(trackAssociatorByHits, + pixelSimLinkSrc = "mixData:PixelDigiSimLink", + stripSimLinkSrc = "mixData:StripDigiSimLink", +) diff --git a/SimTracker/TrackHistory/plugins/TrackingParticleBHadronRefSelector.cc b/SimTracker/TrackHistory/plugins/TrackingParticleBHadronRefSelector.cc index 5567cff067035..96da6ca9e1450 100644 --- a/SimTracker/TrackHistory/plugins/TrackingParticleBHadronRefSelector.cc +++ b/SimTracker/TrackHistory/plugins/TrackingParticleBHadronRefSelector.cc @@ -39,7 +39,7 @@ TrackingParticleBHadronRefSelector::TrackingParticleBHadronRefSelector(const edm void TrackingParticleBHadronRefSelector::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.add("src", edm::InputTag("mix", "MergedTrackTruth")); - descriptions.add("trackingParticleBHadronRefSelector", desc); + descriptions.add("trackingParticleBHadronRefSelectorDefault", desc); } void TrackingParticleBHadronRefSelector::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { diff --git a/SimTracker/TrackHistory/python/TrackHistory_cff.py b/SimTracker/TrackHistory/python/TrackHistory_cff.py index 33649d10e1b9e..026e08cefca1a 100644 --- a/SimTracker/TrackHistory/python/TrackHistory_cff.py +++ b/SimTracker/TrackHistory/python/TrackHistory_cff.py @@ -17,3 +17,5 @@ ) +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(trackHistory, trackingTruth = "mixData:MergedTrackTruth") diff --git a/SimTracker/TrackHistory/python/TrackQuality_cff.py b/SimTracker/TrackHistory/python/TrackQuality_cff.py index ee227c2ec8955..b09c7649e7b5b 100644 --- a/SimTracker/TrackHistory/python/TrackQuality_cff.py +++ b/SimTracker/TrackHistory/python/TrackQuality_cff.py @@ -16,3 +16,11 @@ stripSimLinkSrc = cms.InputTag("simSiStripDigis") ) ) + +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(trackQuality, + hitAssociator = dict( + pixelSimLinkSrc = "mixData:PixelDigiSimLink", + stripSimLinkSrc = "mixData:StripDigiSimLink", + ) +) diff --git a/SimTracker/TrackHistory/python/trackingParticleBHadronRefSelector_cfi.py b/SimTracker/TrackHistory/python/trackingParticleBHadronRefSelector_cfi.py new file mode 100644 index 0000000000000..436e60c27976c --- /dev/null +++ b/SimTracker/TrackHistory/python/trackingParticleBHadronRefSelector_cfi.py @@ -0,0 +1,5 @@ +from SimTracker.TrackHistory.trackingParticleBHadronRefSelectorDefault_cfi import trackingParticleBHadronRefSelectorDefault as _trackingParticleBHadronRefSelectorDefault +trackingParticleBHadronRefSelector = _trackingParticleBHadronRefSelectorDefault.clone() + +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(trackingParticleBHadronRefSelector, src = "mixData:MergedTrackTruth") diff --git a/SimTracker/TrackerHitAssociation/python/tpClusterProducer_cfi.py b/SimTracker/TrackerHitAssociation/python/tpClusterProducer_cfi.py index d9909629cd059..522a5da1771b8 100644 --- a/SimTracker/TrackerHitAssociation/python/tpClusterProducer_cfi.py +++ b/SimTracker/TrackerHitAssociation/python/tpClusterProducer_cfi.py @@ -10,3 +10,10 @@ pixelSimLinkSrc = cms.InputTag("simSiPixelDigis", "Pixel"), phase2OTSimLinkSrc = cms.InputTag("simSiPixelDigis","Tracker") ) + +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(tpClusterProducer, + trackingParticleSrc = "mixData:MergedTrackTruth", + pixelSimLinkSrc = "mixData:PixelDigiSimLink", + stripSimLinkSrc = "mixData:StripDigiSimLink", +) diff --git a/Validation/GlobalRecHits/python/globalrechits_analyze_cfi.py b/Validation/GlobalRecHits/python/globalrechits_analyze_cfi.py index 9c90dcc4efa65..d8cc071607ee0 100644 --- a/Validation/GlobalRecHits/python/globalrechits_analyze_cfi.py +++ b/Validation/GlobalRecHits/python/globalrechits_analyze_cfi.py @@ -50,5 +50,8 @@ ECalEBSrc = cms.InputTag("ecalRecHit","EcalRecHitsEB") ) - - +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(globalrechitsanalyze, + pixelSimLinkSrc = "mixData:PixelDigiSimLink", + stripSimLinkSrc = "mixData:StripDigiSimLink", +) diff --git a/Validation/HcalDigis/python/HLTHcalDigisParam_cfi.py b/Validation/HcalDigis/python/HLTHcalDigisParam_cfi.py index 99320d148e319..4454d526c16c7 100644 --- a/Validation/HcalDigis/python/HLTHcalDigisParam_cfi.py +++ b/Validation/HcalDigis/python/HLTHcalDigisParam_cfi.py @@ -16,6 +16,11 @@ hltHCALdigisAnalyzer.TestNumber = cms.bool(False) hltHCALdigisAnalyzer.hep17 = cms.bool(False) +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(hltHCALdigisAnalyzer, + dataTPs = "DMHcalTriggerPrimitiveDigis", +) + from Configuration.Eras.Modifier_run2_HCAL_2017_cff import run2_HCAL_2017 run2_HCAL_2017.toModify(hltHCALdigisAnalyzer, TestNumber = cms.bool(True) diff --git a/Validation/HcalDigis/python/HcalDigisParam_cfi.py b/Validation/HcalDigis/python/HcalDigisParam_cfi.py index e404b98bc0e47..209dda2ef343c 100644 --- a/Validation/HcalDigis/python/HcalDigisParam_cfi.py +++ b/Validation/HcalDigis/python/HcalDigisParam_cfi.py @@ -23,6 +23,11 @@ from Configuration.Eras.Modifier_fastSim_cff import fastSim fastSim.toModify(hcaldigisAnalyzer, simHits = "fastSimProducer:HcalHits") +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(hcaldigisAnalyzer, + dataTPs = "DMHcalTriggerPrimitiveDigis", +) + from Configuration.Eras.Modifier_run2_HCAL_2017_cff import run2_HCAL_2017 run2_HCAL_2017.toModify(hcaldigisAnalyzer, TestNumber = cms.bool(True) diff --git a/Validation/RPCRecHits/python/rpcRecHitValidation_cfi.py b/Validation/RPCRecHits/python/rpcRecHitValidation_cfi.py index 7ab0c0c3e7c46..eaaa2b488f99c 100644 --- a/Validation/RPCRecHits/python/rpcRecHitValidation_cfi.py +++ b/Validation/RPCRecHits/python/rpcRecHitValidation_cfi.py @@ -15,3 +15,5 @@ from Configuration.Eras.Modifier_fastSim_cff import fastSim fastSim.toModify(rpcRecHitV, simHit = "MuonSimHits:MuonRPCHits") +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(rpcRecHitV, simTrack = "mixData:MergedTrackTruth") diff --git a/Validation/RecoMuon/python/MuonTrackValidator_cfi.py b/Validation/RecoMuon/python/MuonTrackValidator_cfi.py index c93c802f19573..a92189bdee0c6 100644 --- a/Validation/RecoMuon/python/MuonTrackValidator_cfi.py +++ b/Validation/RecoMuon/python/MuonTrackValidator_cfi.py @@ -54,3 +54,9 @@ run3_GEM.toModify( muonTrackValidator, useGEMs = cms.bool(True) ) from Configuration.Eras.Modifier_phase2_muon_cff import phase2_muon phase2_muon.toModify( muonTrackValidator, useME0 = cms.bool(True) ) + +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(muonTrackValidator, + label_tp_effic = "mixData:MergedTrackTruth", + label_tp_fake = "mixData:MergedTrackTruth", +) diff --git a/Validation/RecoMuon/python/RecoMuonValidator_cfi.py b/Validation/RecoMuon/python/RecoMuonValidator_cfi.py index 9ad9c694c6c30..5f0db2196dff6 100644 --- a/Validation/RecoMuon/python/RecoMuonValidator_cfi.py +++ b/Validation/RecoMuon/python/RecoMuonValidator_cfi.py @@ -93,3 +93,6 @@ # Number of sim,reco Tracks # nTrks = cms.untracked.uint32(50) ) + +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(recoMuonValidator, simLabel = "mixData:MergedTrackTruth") diff --git a/Validation/RecoMuon/python/associators_cff.py b/Validation/RecoMuon/python/associators_cff.py index 010b94de761dc..a63a5cc27d510 100644 --- a/Validation/RecoMuon/python/associators_cff.py +++ b/Validation/RecoMuon/python/associators_cff.py @@ -9,9 +9,9 @@ import SimTracker.TrackAssociatorProducers.quickTrackAssociatorByHits_cfi trackAssociatorByHits = SimTracker.TrackAssociatorProducers.quickTrackAssociatorByHits_cfi.quickTrackAssociatorByHits.clone() -tpToTkmuTrackAssociation = cms.EDProducer('TrackAssociatorEDProducer', +from SimTracker.TrackAssociation.trackingParticleRecoTrackAsssociation_cfi import trackingParticleRecoTrackAsssociation as _trackingParticleRecoTrackAsssociation +tpToTkmuTrackAssociation = _trackingParticleRecoTrackAsssociation.clone( associator = cms.InputTag('trackAssociatorByHits'), - label_tp = cms.InputTag('mix', 'MergedTrackTruth'), # label_tr = cms.InputTag('generalTracks') label_tr = cms.InputTag('probeTracks') ) diff --git a/Validation/RecoMuon/python/selectors_cff.py b/Validation/RecoMuon/python/selectors_cff.py index e9a103e48db8d..9a3caf3e3eb19 100644 --- a/Validation/RecoMuon/python/selectors_cff.py +++ b/Validation/RecoMuon/python/selectors_cff.py @@ -16,9 +16,10 @@ stableOnly = cms.bool(True), # discard decays in flight from the signal event chargedOnly = cms.bool(True) ) +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(muonTPSet, src = "mixData:MergedTrackTruth") -me0MuonTPSet = cms.PSet( - src = cms.InputTag("mix", "MergedTrackTruth"), +me0MuonTPSet = muonTPSet.clone( pdgId = cms.vint32(13, -13), tip = cms.double(3.5), lip = cms.double(30.0), @@ -33,8 +34,7 @@ chargedOnly = cms.bool(True) ) -displacedMuonTPSet = cms.PSet( - src = cms.InputTag("mix", "MergedTrackTruth"), +displacedMuonTPSet = muonTPSet.clone( pdgId = cms.vint32(13, -13), tip = cms.double(85.), # radius to have at least the 3 outermost TOB layers lip = cms.double(210.), # z to have at least the 3 outermost TEC layers @@ -63,6 +63,7 @@ stableOnly = cms.bool(True), # accept only TP from the Generator (linked to GenParticles) chargedOnly = cms.bool(True) ) +premix_stage2.toModify(cosmicMuonTPSet, src = "mixData:MergedTrackTruth") #muonTP = cms.EDFilter("TrackingParticleSelector", # muonTPSet diff --git a/Validation/RecoTrack/python/MultiTrackValidator_cfi.py b/Validation/RecoTrack/python/MultiTrackValidator_cfi.py index 2009f045c3f05..717f7a288a0cc 100644 --- a/Validation/RecoTrack/python/MultiTrackValidator_cfi.py +++ b/Validation/RecoTrack/python/MultiTrackValidator_cfi.py @@ -102,3 +102,10 @@ from Configuration.Eras.Modifier_fastSim_cff import fastSim fastSim.toModify(multiTrackValidator, sim = ['fastSimProducer:TrackerHits']) + +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(multiTrackValidator, + label_tp_effic = "mixData:MergedTrackTruth", + label_tp_fake = "mixData:MergedTrackTruth", + label_tv = "mixData:MergedTrackTruth", +) diff --git a/Validation/RecoTrack/python/SiPixelTrackingRecHitsValid_cfi.py b/Validation/RecoTrack/python/SiPixelTrackingRecHitsValid_cfi.py index 5a47f8dfb2c99..c6d400e39bb1d 100644 --- a/Validation/RecoTrack/python/SiPixelTrackingRecHitsValid_cfi.py +++ b/Validation/RecoTrack/python/SiPixelTrackingRecHitsValid_cfi.py @@ -27,3 +27,8 @@ ) +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(PixelTrackingRecHitsValid, + pixelSimLinkSrc = "mixData:PixelDigiSimLink", + stripSimLinkSrc = "mixData:StripDigiSimLink", +) diff --git a/Validation/RecoTrack/python/SiStripTrackingRecHitsValid_cfi.py b/Validation/RecoTrack/python/SiStripTrackingRecHitsValid_cfi.py index d6400edf10d7f..1c13b1652541a 100644 --- a/Validation/RecoTrack/python/SiStripTrackingRecHitsValid_cfi.py +++ b/Validation/RecoTrack/python/SiStripTrackingRecHitsValid_cfi.py @@ -998,4 +998,8 @@ associateStrip = cms.bool(True) ) - +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(StripTrackingRecHitsValid, + pixelSimLinkSrc = "mixData:PixelDigiSimLink", + stripSimLinkSrc = "mixData:StripDigiSimLink", +) diff --git a/Validation/RecoTrack/python/associators_cff.py b/Validation/RecoTrack/python/associators_cff.py index e79dca2ba3c38..73c6f416e509c 100644 --- a/Validation/RecoTrack/python/associators_cff.py +++ b/Validation/RecoTrack/python/associators_cff.py @@ -4,6 +4,7 @@ import SimTracker.TrackAssociatorProducers.quickTrackAssociatorByHits_cfi import SimTracker.TrackAssociatorProducers.trackAssociatorByPosition_cfi from SimTracker.TrackerHitAssociation.tpClusterProducer_cfi import tpClusterProducer as _tpClusterProducer +from SimTracker.TrackAssociation.trackingParticleRecoTrackAsssociation_cfi import trackingParticleRecoTrackAsssociation as _trackingParticleRecoTrackAsssociation hltTPClusterProducer = _tpClusterProducer.clone( pixelClusterSrc = "hltSiPixelClusters", @@ -28,118 +29,72 @@ # to run MTV for HLT, as it is configured to produce the # track-TrackingParticle association on the fly. The configuration # snippets below are, however, kept for reference. -tpToHLTpixelTrackAssociation = cms.EDProducer("TrackAssociatorEDProducer", +tpToHLTpixelTrackAssociation = _trackingParticleRecoTrackAsssociation.clone( label_tr = cms.InputTag("hltPixelTracks"), - label_tp = cms.InputTag("mix","MergedTrackTruth"), associator = cms.InputTag('hltTrackAssociatorByHits'), ignoremissingtrackcollection = cms.untracked.bool(True) ) -tpToHLTiter0tracksAssociation = cms.EDProducer("TrackAssociatorEDProducer", +tpToHLTiter0tracksAssociation = tpToHLTpixelTrackAssociation.clone( label_tr = cms.InputTag("hltIter0PFlowCtfWithMaterialTracks"), - label_tp = cms.InputTag("mix","MergedTrackTruth"), - associator = cms.InputTag('hltTrackAssociatorByHits'), # associator = cms.InputTag('hltTrackAssociatorByDeltaR'), - ignoremissingtrackcollection = cms.untracked.bool(True) ) -tpToHLTiter0HPtracksAssociation = cms.EDProducer("TrackAssociatorEDProducer", +tpToHLTiter0HPtracksAssociation = tpToHLTpixelTrackAssociation.clone( label_tr = cms.InputTag("hltIter0PFlowTrackSelectionHighPurity"), - label_tp = cms.InputTag("mix","MergedTrackTruth"), - associator = cms.InputTag('hltTrackAssociatorByHits'), # associator = cms.InputTag('hltTrackAssociatorByDeltaR'), - ignoremissingtrackcollection = cms.untracked.bool(True) ) -tpToHLTiter1tracksAssociation = cms.EDProducer("TrackAssociatorEDProducer", +tpToHLTiter1tracksAssociation = tpToHLTpixelTrackAssociation.clone( label_tr = cms.InputTag("hltIter1PFlowCtfWithMaterialTracks"), - label_tp = cms.InputTag("mix","MergedTrackTruth"), - associator = cms.InputTag('hltTrackAssociatorByHits'), - ignoremissingtrackcollection = cms.untracked.bool(True) ) -tpToHLTiter1HPtracksAssociation = cms.EDProducer("TrackAssociatorEDProducer", +tpToHLTiter1HPtracksAssociation = tpToHLTpixelTrackAssociation.clone( label_tr = cms.InputTag("hltIter1PFlowTrackSelectionHighPurity"), - label_tp = cms.InputTag("mix","MergedTrackTruth"), - associator = cms.InputTag('hltTrackAssociatorByHits'), - ignoremissingtrackcollection = cms.untracked.bool(True) ) -tpToHLTiter1MergedTracksAssociation = cms.EDProducer("TrackAssociatorEDProducer", +tpToHLTiter1MergedTracksAssociation = tpToHLTpixelTrackAssociation.clone( label_tr = cms.InputTag("hltIter1Merged"), - label_tp = cms.InputTag("mix","MergedTrackTruth"), - associator = cms.InputTag('hltTrackAssociatorByHits'), - ignoremissingtrackcollection = cms.untracked.bool(True) ) -tpToHLTiter2tracksAssociation = cms.EDProducer("TrackAssociatorEDProducer", +tpToHLTiter2tracksAssociation = tpToHLTpixelTrackAssociation.clone( label_tr = cms.InputTag("hltIter2PFlowCtfWithMaterialTracks"), - label_tp = cms.InputTag("mix","MergedTrackTruth"), - associator = cms.InputTag('hltTrackAssociatorByHits'), - ignoremissingtrackcollection = cms.untracked.bool(True) ) -tpToHLTiter2HPtracksAssociation = cms.EDProducer("TrackAssociatorEDProducer", +tpToHLTiter2HPtracksAssociation = tpToHLTpixelTrackAssociation.clone( label_tr = cms.InputTag("hltIter2PFlowTrackSelectionHighPurity"), - label_tp = cms.InputTag("mix","MergedTrackTruth"), - associator = cms.InputTag('hltTrackAssociatorByHits'), - ignoremissingtrackcollection = cms.untracked.bool(True) ) -tpToHLTiter2MergedTracksAssociation = cms.EDProducer("TrackAssociatorEDProducer", +tpToHLTiter2MergedTracksAssociation = tpToHLTpixelTrackAssociation.clone( label_tr = cms.InputTag("hltIter2Merged"), - label_tp = cms.InputTag("mix","MergedTrackTruth"), - associator = cms.InputTag('hltTrackAssociatorByHits'), - ignoremissingtrackcollection = cms.untracked.bool(True) ) -tpToHLTiter3tracksAssociation = cms.EDProducer("TrackAssociatorEDProducer", +tpToHLTiter3tracksAssociation = tpToHLTpixelTrackAssociation.clone( label_tr = cms.InputTag("hltIter3PFlowCtfWithMaterialTracks"), - label_tp = cms.InputTag("mix","MergedTrackTruth"), - associator = cms.InputTag('hltTrackAssociatorByHits'), - ignoremissingtrackcollection = cms.untracked.bool(True) ) -tpToHLTiter3HPtracksAssociation = cms.EDProducer("TrackAssociatorEDProducer", +tpToHLTiter3HPtracksAssociation = tpToHLTpixelTrackAssociation.clone( label_tr = cms.InputTag("hltIter3PFlowTrackSelectionHighPurity"), - label_tp = cms.InputTag("mix","MergedTrackTruth"), - associator = cms.InputTag('hltTrackAssociatorByHits'), - ignoremissingtrackcollection = cms.untracked.bool(True) ) -tpToHLTiter3MergedTracksAssociation = cms.EDProducer("TrackAssociatorEDProducer", +tpToHLTiter3MergedTracksAssociation = tpToHLTpixelTrackAssociation.clone( label_tr = cms.InputTag("hltIter3Merged"), - label_tp = cms.InputTag("mix","MergedTrackTruth"), - associator = cms.InputTag('hltTrackAssociatorByHits'), - ignoremissingtrackcollection = cms.untracked.bool(True) ) -tpToHLTiter4tracksAssociation = cms.EDProducer("TrackAssociatorEDProducer", +tpToHLTiter4tracksAssociation = tpToHLTpixelTrackAssociation.clone( label_tr = cms.InputTag("hltIter4PFlowCtfWithMaterialTracks"), - label_tp = cms.InputTag("mix","MergedTrackTruth"), - associator = cms.InputTag('hltTrackAssociatorByHits'), - ignoremissingtrackcollection = cms.untracked.bool(True) ) -tpToHLTiter4HPtracksAssociation = cms.EDProducer("TrackAssociatorEDProducer", +tpToHLTiter4HPtracksAssociation = tpToHLTpixelTrackAssociation.clone( label_tr = cms.InputTag("hltIter4PFlowTrackSelectionHighPurity"), - label_tp = cms.InputTag("mix","MergedTrackTruth"), - associator = cms.InputTag('hltTrackAssociatorByHits'), - ignoremissingtrackcollection = cms.untracked.bool(True) ) -tpToHLTiter4MergedTracksAssociation = cms.EDProducer("TrackAssociatorEDProducer", +tpToHLTiter4MergedTracksAssociation = tpToHLTpixelTrackAssociation.clone( label_tr = cms.InputTag("hltIter4Merged"), - label_tp = cms.InputTag("mix","MergedTrackTruth"), - associator = cms.InputTag('hltTrackAssociatorByHits'), - ignoremissingtrackcollection = cms.untracked.bool(True) ) -tpToHLTgsfTrackAssociation = cms.EDProducer("TrackAssociatorEDProducer", +tpToHLTgsfTrackAssociation = tpToHLTpixelTrackAssociation.clone( label_tr = cms.InputTag("hltEgammaGsfTracks"), - label_tp = cms.InputTag("mix","MergedTrackTruth"), - associator = cms.InputTag('hltTrackAssociatorByHits'), - ignoremissingtrackcollection = cms.untracked.bool(True) ) tpToHLTtracksAssociationSequence = cms.Sequence( diff --git a/Validation/RecoVertex/python/PrimaryVertexAnalyzer4PUSlimmed_cfi.py b/Validation/RecoVertex/python/PrimaryVertexAnalyzer4PUSlimmed_cfi.py index 609b69f29cf33..a12290cb65193 100644 --- a/Validation/RecoVertex/python/PrimaryVertexAnalyzer4PUSlimmed_cfi.py +++ b/Validation/RecoVertex/python/PrimaryVertexAnalyzer4PUSlimmed_cfi.py @@ -28,6 +28,11 @@ "selectedOfflinePrimaryVerticesWithBS" ), ) +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(vertexAnalysis, + trackingParticleCollection = "mixData:MergedTrackTruth", + trackingVertexCollection = "mixData:MergedTrackTruth", +) vertexAnalysisTrackingOnly = vertexAnalysis.clone( vertexRecoCollections = vertexAnalysis.vertexRecoCollections.value() + [ diff --git a/Validation/RecoVertex/python/v0validator_cfi.py b/Validation/RecoVertex/python/v0validator_cfi.py index 5b6182b7d3fb1..1df09fad0907b 100644 --- a/Validation/RecoVertex/python/v0validator_cfi.py +++ b/Validation/RecoVertex/python/v0validator_cfi.py @@ -10,3 +10,6 @@ vertexCollection = cms.untracked.InputTag("offlinePrimaryVertices"), dirName = cms.untracked.string('Vertexing/V0V') ) + +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(v0Validator, trackingVertexCollection = "mixData:MergedTrackTruth") diff --git a/Validation/SiPixelPhase1HitsV/python/SiPixelPhase1HitsV_cfi.py b/Validation/SiPixelPhase1HitsV/python/SiPixelPhase1HitsV_cfi.py index b22257ae58209..0b0012a79d006 100644 --- a/Validation/SiPixelPhase1HitsV/python/SiPixelPhase1HitsV_cfi.py +++ b/Validation/SiPixelPhase1HitsV/python/SiPixelPhase1HitsV_cfi.py @@ -147,6 +147,8 @@ histograms = SiPixelPhase1HitsConf, geometry = SiPixelPhase1Geometry ) +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(SiPixelPhase1HitsAnalyzerV, tpTag = "mixData:MergedTrackTruth") SiPixelPhase1HitsHarvesterV = DQMEDHarvester("SiPixelPhase1Harvester", histograms = SiPixelPhase1HitsConf, diff --git a/Validation/SiPixelPhase1TrackingParticleV/python/SiPixelPhase1TrackingParticleV_cfi.py b/Validation/SiPixelPhase1TrackingParticleV/python/SiPixelPhase1TrackingParticleV_cfi.py index eb4566818fb0d..fdd90bcf158d7 100644 --- a/Validation/SiPixelPhase1TrackingParticleV/python/SiPixelPhase1TrackingParticleV_cfi.py +++ b/Validation/SiPixelPhase1TrackingParticleV/python/SiPixelPhase1TrackingParticleV_cfi.py @@ -127,6 +127,8 @@ histograms = SiPixelPhase1TrackingParticleConf, geometry = SiPixelPhase1Geometry ) +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(SiPixelPhase1TrackingParticleAnalyzerV, src = "mixData:MergedTrackTruth") SiPixelPhase1TrackingParticleHarvesterV = DQMEDHarvester("SiPixelPhase1Harvester", histograms = SiPixelPhase1TrackingParticleConf, diff --git a/Validation/TrackerRecHits/python/SiPixelRecHitsValid_cfi.py b/Validation/TrackerRecHits/python/SiPixelRecHitsValid_cfi.py index 7ad69316e880c..ef9bf9f9700ae 100644 --- a/Validation/TrackerRecHits/python/SiPixelRecHitsValid_cfi.py +++ b/Validation/TrackerRecHits/python/SiPixelRecHitsValid_cfi.py @@ -15,4 +15,8 @@ verbose = cms.untracked.bool(False) ) - +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(pixRecHitsValid, + pixelSimLinkSrc = "mixData:PixelDigiSimLink", + stripSimLinkSrc = "mixData:StripDigiSimLink", +) diff --git a/Validation/TrackerRecHits/python/SiStripRecHitsValid_cfi.py b/Validation/TrackerRecHits/python/SiStripRecHitsValid_cfi.py index 2679a043298d9..6d8782de85006 100644 --- a/Validation/TrackerRecHits/python/SiStripRecHitsValid_cfi.py +++ b/Validation/TrackerRecHits/python/SiStripRecHitsValid_cfi.py @@ -295,4 +295,8 @@ verbose = cms.untracked.bool(False) ) - +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(stripRecHitsValid, + pixelSimLinkSrc = "mixData:PixelDigiSimLink", + stripSimLinkSrc = "mixData:StripDigiSimLink", +) diff --git a/Validation/TrackingMCTruth/python/trackingTruthValidation_cfi.py b/Validation/TrackingMCTruth/python/trackingTruthValidation_cfi.py index 59926e57829f3..36170c77d1cb8 100644 --- a/Validation/TrackingMCTruth/python/trackingTruthValidation_cfi.py +++ b/Validation/TrackingMCTruth/python/trackingTruthValidation_cfi.py @@ -11,4 +11,5 @@ outputFile = cms.string('') ) - +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(trackingTruthValid, src = "mixData:MergedTrackTruth") From 7029f6356adbe74de3dfc3e1edfc4c165b1793d2 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Thu, 22 Feb 2018 00:05:12 +0100 Subject: [PATCH 288/426] Remove tpClusterProducerDefault from global namespace --- .../TrackerHitAssociation/python/tpClusterProducer_cfi.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SimTracker/TrackerHitAssociation/python/tpClusterProducer_cfi.py b/SimTracker/TrackerHitAssociation/python/tpClusterProducer_cfi.py index 522a5da1771b8..599e5369145bf 100644 --- a/SimTracker/TrackerHitAssociation/python/tpClusterProducer_cfi.py +++ b/SimTracker/TrackerHitAssociation/python/tpClusterProducer_cfi.py @@ -1,8 +1,8 @@ import FWCore.ParameterSet.Config as cms -from SimTracker.TrackerHitAssociation.tpClusterProducerDefault_cfi import * +from SimTracker.TrackerHitAssociation.tpClusterProducerDefault_cfi import tpClusterProducerDefault as _tpClusterProducerDefault -tpClusterProducer = tpClusterProducerDefault.clone() +tpClusterProducer = _tpClusterProducerDefault.clone() from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker phase2_tracker.toModify( From 10494ebf3e3c3bbc352af3715d774d03f752cded Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Thu, 22 Feb 2018 12:21:55 +0100 Subject: [PATCH 289/426] Replace customiseForPremixingInput with premix_stage2 Modifier in workflow definitions --- .../python/relval_steps.py | 16 ++-- .../python/customiseForPremixingInput.py | 74 ------------------- 2 files changed, 7 insertions(+), 83 deletions(-) delete mode 100644 SimGeneral/DataMixingModule/python/customiseForPremixingInput.py diff --git a/Configuration/PyReleaseValidation/python/relval_steps.py b/Configuration/PyReleaseValidation/python/relval_steps.py index 25b974790e195..2bae19c07942f 100644 --- a/Configuration/PyReleaseValidation/python/relval_steps.py +++ b/Configuration/PyReleaseValidation/python/relval_steps.py @@ -913,7 +913,6 @@ def genS(fragment,howMuch): "--datamix" : "PreMix", "--procModifiers": "premix_stage2", "--pileup_input" : "dbs:/RelValFS_PREMIXUP15_PU25/%s/GEN-SIM-DIGI-RAW"%(baseDataSetRelease[8],), - "--customise":"SimGeneral/DataMixingModule/customiseForPremixingInput.customiseForPreMixingInput" }, Kby(100,500),step1FastUpg2015Defaults]) @@ -1770,17 +1769,17 @@ def gen2018HiMix(fragment,howMuch): # for premixing: no --pileup_input for replay; GEN-SIM only available for in-time event, from FEVTDEBUGHLT previous step steps['RECOPRMXUP15_PU25']=merge([ - {'--era':'Run2_2016','--customise':'SimGeneral/DataMixingModule/customiseForPremixingInput.customiseForPreMixingInput'}, # temporary replacement for premix; to be brought back to customisePostLS1; DataMixer customize for rerouting inputs to mixed data. + {'--era':'Run2_2016','--procModifiers':'premix_stage2'}, # temporary replacement for premix; to be brought back to customisePostLS1; DataMixer customize for rerouting inputs to mixed data. step3Up2015Defaults]) steps['RECOPRMXUP15_PU50']=merge([ - {'--era':'Run2_50ns','--customise':'SimGeneral/DataMixingModule/customiseForPremixingInput.customiseForPreMixingInput'}, + {'--era':'Run2_50ns','--procModifiers':'premix_stage2'}, step3Up2015Defaults50ns]) steps['RECOPRMXUP17_PU25']=merge([ - {'--conditions':'auto:phase1_2017_realistic','--era':'Run2_2017','--customise':'SimGeneral/DataMixingModule/customiseForPremixingInput.customiseForPreMixingInput'}, + {'--conditions':'auto:phase1_2017_realistic','--era':'Run2_2017','--procModifiers':'premix_stage2'}, step3Up2015Defaults]) steps['RECOPRMXUP18_PU25']=merge([ - {'--conditions':'auto:phase1_2018_realistic','--era':'Run2_2018','--customise':'SimGeneral/DataMixingModule/customiseForPremixingInput.customiseForPreMixingInput'}, + {'--conditions':'auto:phase1_2018_realistic','--era':'Run2_2018','--procModifiers':'premix_stage2'}, step3Up2015Defaults]) steps['RECOPRMXUP18_PU25_L1TEgDQM']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,RECOSIM,EI,PAT,VALIDATION:@standardValidation+@miniAODValidation,DQM:@standardDQM+@ExtraHLT+@miniAODDQM+@L1TEgamma'},steps['RECOPRMXUP18_PU25']]) steps['RECOPRMXUP18_PU25_L1TMuDQM']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,RECOSIM,EI,PAT,VALIDATION:@standardValidation+@miniAODValidation,DQM:@standardDQM+@ExtraHLT+@miniAODDQM+@L1TMuon'},steps['RECOPRMXUP18_PU25']]) @@ -2632,11 +2631,10 @@ def gen2018HiMix(fragment,howMuch): "--procModifiers": "premix_stage2"}, d]) elif "Reco" in step: - custNew = "SimGeneral/DataMixingModule/customiseForPremixingInput.customiseForPreMixingInput" - if "--customise" in d: - d["--customise"] += ","+custNew + if "--procModifiers" in d: + d["--procModifiers"] += ",premix_stage2" else: - d["--customise"] = custNew + d["--procModifiers"] = "premix_stage2" upgradeStepDict[stepNamePUpmx][k] = d for step in upgradeStepDict.keys(): diff --git a/SimGeneral/DataMixingModule/python/customiseForPremixingInput.py b/SimGeneral/DataMixingModule/python/customiseForPremixingInput.py deleted file mode 100644 index 00899461ac526..0000000000000 --- a/SimGeneral/DataMixingModule/python/customiseForPremixingInput.py +++ /dev/null @@ -1,74 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -def customiseForPreMixingInput(process): - from PhysicsTools.PatAlgos.tools.helpers import massSearchReplaceAnyInputTag - - # Replace TrackingParticles and TrackingVertices globally - # only apply on validation and dqm: we don't want to apply this in the mixing and digitization sequences - for s in process.paths_().keys() + process.endpaths_().keys(): - if s.lower().find("validation")>= 0 or s.lower().find("dqm") >= 0: - massSearchReplaceAnyInputTag(getattr(process, s), cms.InputTag("mix", "MergedTrackTruth"), cms.InputTag("mixData", "MergedTrackTruth"), skipLabelTest=True) - - # Replace Pixel/StripDigiSimLinks only for the known modules - def replaceInputTag(tag, old, new): - if tag.value() == old: - tag.setValue(new) - - def replacePixelDigiSimLink(tag): - replaceInputTag(tag, "simSiPixelDigis", "mixData:PixelDigiSimLink") - def replaceStripDigiSimLink(tag): - replaceInputTag(tag, "simSiStripDigis", "mixData:StripDigiSimLink") - def replaceHcalTp(tag): - replaceInputTag(tag, "simHcalTriggerPrimitiveDigis", "DMHcalTriggerPrimitiveDigis") - - def replaceAnalyzer(label, analyzer): - if analyzer.type_() == "GlobalRecHitsAnalyzer": - replacePixelDigiSimLink(analyzer.pixelSimLinkSrc) - replaceStripDigiSimLink(analyzer.stripSimLinkSrc) - if analyzer.type_() == "SiPixelTrackingRecHitsValid": - replacePixelDigiSimLink(analyzer.pixelSimLinkSrc) - replaceStripDigiSimLink(analyzer.stripSimLinkSrc) - if analyzer.type_() == "SiStripTrackingRecHitsValid": - replacePixelDigiSimLink(analyzer.pixelSimLinkSrc) - replaceStripDigiSimLink(analyzer.stripSimLinkSrc) - if analyzer.type_() == "SiPixelRecHitsValid": - replacePixelDigiSimLink(analyzer.pixelSimLinkSrc) - replaceStripDigiSimLink(analyzer.stripSimLinkSrc) - if analyzer.type_() == "SiStripRecHitsValid": - replacePixelDigiSimLink(analyzer.pixelSimLinkSrc) - replaceStripDigiSimLink(analyzer.stripSimLinkSrc) - if analyzer.type_() == "HcalDigisValidation": - replaceHcalTp(analyzer.dataTPs) - - for label, producer in process.producers_().iteritems(): - if producer.type_() == "ClusterTPAssociationProducer": - replacePixelDigiSimLink(producer.pixelSimLinkSrc) - replaceStripDigiSimLink(producer.stripSimLinkSrc) - if producer.type_() == "QuickTrackAssociatorByHitsProducer": - replacePixelDigiSimLink(producer.pixelSimLinkSrc) - replaceStripDigiSimLink(producer.stripSimLinkSrc) - if producer.type_() == "TrackAssociatorByHitsProducer": - replacePixelDigiSimLink(producer.pixelSimLinkSrc) - replaceStripDigiSimLink(producer.stripSimLinkSrc) - if producer.type_() == "MuonAssociatorEDProducer": - producer.DTdigisimlinkTag = cms.InputTag("mixData","simMuonDTDigis") - producer.CSClinksTag = cms.InputTag("mixData","MuonCSCStripDigiSimLinks") - producer.CSCwireLinksTag = cms.InputTag("mixData","MuonCSCWireDigiSimLinks") - producer.RPCdigisimlinkTag = cms.InputTag("mixData","RPCDigiSimLink") - replacePixelDigiSimLink(producer.pixelSimLinkSrc) - replaceStripDigiSimLink(producer.stripSimLinkSrc) - if producer.type_() == "MuonToTrackingParticleAssociatorEDProducer": - producer.DTdigisimlinkTag = cms.InputTag("mixData","simMuonDTDigis") - producer.CSClinksTag = cms.InputTag("mixData","MuonCSCStripDigiSimLinks") - producer.CSCwireLinksTag = cms.InputTag("mixData","MuonCSCWireDigiSimLinks") - producer.RPCdigisimlinkTag = cms.InputTag("mixData","RPCDigiSimLink") - replacePixelDigiSimLink(producer.pixelSimLinkSrc) - replaceStripDigiSimLink(producer.stripSimLinkSrc) - # Most of DQM analyzers are nowadays EDProducers - replaceAnalyzer(label, producer) - - for label, analyzer in process.analyzers_().iteritems(): - replaceAnalyzer(label, analyzer) - - - return process From cc72b450e680e496d6d556d65f5e3c805f35e29b Mon Sep 17 00:00:00 2001 From: Juliette Date: Fri, 30 Mar 2018 15:14:16 +0200 Subject: [PATCH 290/426] add monitoring for 4 new displaced muon paths --- DQMOffline/Trigger/python/MuonMonitor_cff.py | 81 +++++++++++++++++++- 1 file changed, 80 insertions(+), 1 deletion(-) diff --git a/DQMOffline/Trigger/python/MuonMonitor_cff.py b/DQMOffline/Trigger/python/MuonMonitor_cff.py index 5b96b3bde5db2..1c70ea164f635 100644 --- a/DQMOffline/Trigger/python/MuonMonitor_cff.py +++ b/DQMOffline/Trigger/python/MuonMonitor_cff.py @@ -34,6 +34,19 @@ DoubleMu48NoFiltersNoVtx_monitoring.denGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_PFMET120_PFMHT120_IDTight_v*","HLT_PFMETTypeOne120_PFMHT120_IDTight_v*","HLT_MonoCentralPFJet80_PFMETNoMu120_PFMHTNoMu120_IDTight_v*") + +DoubleMu33NoFiltersNoVtxDisplaced_monitoring = hltMuonmonitoring.clone() +DoubleMu33NoFiltersNoVtxDisplaced_monitoring.FolderName = cms.string('HLT/EXO/DoubleMu33NoFiltersNoVtxDisplaced/') +DoubleMu33NoFiltersNoVtxDisplaced_monitoring.nmuons = cms.uint32(2) +DoubleMu33NoFiltersNoVtxDisplaced_monitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_DoubleMu33NoFiltersNoVtxDisplaced_v*") +DoubleMu33NoFiltersNoVtxDisplaced_monitoring.denGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_PFMET120_PFMHT120_IDTight_v*","HLT_PFMETTypeOne120_PFMHT120_IDTight_v*","HLT_MonoCentralPFJet80_PFMETNoMu120_PFMHTNoMu120_IDTight_v*") + +DoubleMu40NoFiltersNoVtxDisplaced_monitoring = hltMuonmonitoring.clone() +DoubleMu40NoFiltersNoVtxDisplaced_monitoring.FolderName = cms.string('HLT/EXO/DoubleMu40NoFiltersNoVtxDisplaced/') +DoubleMu40NoFiltersNoVtxDisplaced_monitoring.nmuons = cms.uint32(2) +DoubleMu40NoFiltersNoVtxDisplaced_monitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_DoubleMu40NoFiltersNoVtxDisplaced_v*") +DoubleMu40NoFiltersNoVtxDisplaced_monitoring.denGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_PFMET120_PFMHT120_IDTight_v*","HLT_PFMETTypeOne120_PFMHT120_IDTight_v*","HLT_MonoCentralPFJet80_PFMETNoMu120_PFMHTNoMu120_IDTight_v*") + #-------------------------------------------------- DoubleL2Mu23NoVtx_2Cha_monitoring = hltMuonmonitoring.clone() DoubleL2Mu23NoVtx_2Cha_monitoring.FolderName = cms.string('HLT/EXO/DoubleL2Mu23NoVtx_2Cha/') @@ -108,18 +121,84 @@ +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_monitoring = hltMuonmonitoring.clone() +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_monitoring.FolderName = cms.string('HLT/EXO/Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL/') +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_monitoring.nmuons = cms.uint32(1) +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_monitoring.nelectrons = cms.uint32(1) +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_monitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_v*") +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_monitoring.denGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_PFMET120_PFMHT120_IDTight_v*","HLT_PFMETTypeOne120_PFMHT120_IDTight_v*","HLT_MonoCentralPFJet80_PFMETNoMu120_PFMHTNoMu120_IDTight_v*") + + + +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_MuLeg_monitoring = hltMuonmonitoring.clone() +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_MuLeg_monitoring.FolderName = cms.string('HLT/EXO/Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_MuLeg/') +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_MuLeg_monitoring.nmuons = cms.uint32(1) +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_MuLeg_monitoring.nelectrons = cms.uint32(1) +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_MuLeg_monitoring.eleSelection = cms.string('pt > 38') +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_MuLeg_monitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_v*") +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_MuLeg_monitoring.denGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_PFMET120_PFMHT120_IDTight_v*","HLT_PFMETTypeOne120_PFMHT120_IDTight_v*","HLT_MonoCentralPFJet80_PFMETNoMu120_PFMHTNoMu120_IDTight_v*") + + + + +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_EleLeg_monitoring = hltMuonmonitoring.clone() +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_EleLeg_monitoring.FolderName = cms.string('HLT/EXO/Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_EleLeg/') +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_EleLeg_monitoring.nmuons = cms.uint32(1) +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_EleLeg_monitoring.nelectrons = cms.uint32(1) +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_EleLeg_monitoring.muonSelection = cms.string('pt > 38') +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_EleLeg_monitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_v*") +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_EleLeg_monitoring.denGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_PFMET120_PFMHT120_IDTight_v*","HLT_PFMETTypeOne120_PFMHT120_IDTight_v*","HLT_MonoCentralPFJet80_PFMETNoMu120_PFMHTNoMu120_IDTight_v*") + + + +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_monitoring = hltMuonmonitoring.clone() +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_monitoring.FolderName = cms.string('HLT/EXO/Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL/') +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_monitoring.nmuons = cms.uint32(1) +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_monitoring.nelectrons = cms.uint32(1) +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_monitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_v*") +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_monitoring.denGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_PFMET120_PFMHT120_IDTight_v*","HLT_PFMETTypeOne120_PFMHT120_IDTight_v*","HLT_MonoCentralPFJet80_PFMETNoMu120_PFMHTNoMu120_IDTight_v*") + + + +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_MuLeg_monitoring = hltMuonmonitoring.clone() +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_MuLeg_monitoring.FolderName = cms.string('HLT/EXO/Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_MuLeg/') +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_MuLeg_monitoring.nmuons = cms.uint32(1) +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_MuLeg_monitoring.nelectrons = cms.uint32(1) +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_MuLeg_monitoring.eleSelection = cms.string('pt > 43') +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_MuLeg_monitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_v*") +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_MuLeg_monitoring.denGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_PFMET120_PFMHT120_IDTight_v*","HLT_PFMETTypeOne120_PFMHT120_IDTight_v*","HLT_MonoCentralPFJet80_PFMETNoMu120_PFMHTNoMu120_IDTight_v*") + + + + +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_EleLeg_monitoring = hltMuonmonitoring.clone() +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_EleLeg_monitoring.FolderName = cms.string('HLT/EXO/Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_EleLeg/') +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_EleLeg_monitoring.nmuons = cms.uint32(1) +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_EleLeg_monitoring.nelectrons = cms.uint32(1) +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_EleLeg_monitoring.muonSelection = cms.string('pt > 43') +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_EleLeg_monitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_v*") +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_EleLeg_monitoring.denGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_PFMET120_PFMHT120_IDTight_v*","HLT_PFMETTypeOne120_PFMHT120_IDTight_v*","HLT_MonoCentralPFJet80_PFMETNoMu120_PFMHTNoMu120_IDTight_v*") + exoHLTMuonmonitoring = cms.Sequence( TrkMu12_DoubleTrkMu5NoFiltersNoVtx_monitoring + TrkMu16_DoubleTrkMu6NoFiltersNoVtx_monitoring + TrkMu17_DoubleTrkMu8NoFiltersNoVtx_monitoring + DoubleMu43NoFiltersNoVtx_monitoring - + Mu43NoFiltersNoVtx_Photon43_CaloIdL_monitoring + DoubleMu48NoFiltersNoVtx_monitoring + + DoubleMu33NoFiltersNoVtxDisplaced_monitoring + + DoubleMu40NoFiltersNoVtxDisplaced_monitoring + + Mu43NoFiltersNoVtx_Photon43_CaloIdL_monitoring + Mu48NoFiltersNoVtx_Photon48_CaloIdL_monitoring + Mu43NoFiltersNoVtx_Photon43_CaloIdL_MuLeg_monitoring + Mu48NoFiltersNoVtx_Photon48_CaloIdL_MuLeg_monitoring + Mu43NoFiltersNoVtx_Photon43_CaloIdL_EleLeg_monitoring + Mu48NoFiltersNoVtx_Photon48_CaloIdL_EleLeg_monitoring + + Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_monitoring + + Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_monitoring + + Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_MuLeg_monitoring + + Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_MuLeg_monitoring + + Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_EleLeg_monitoring + + Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_EleLeg_monitoring + DoubleL2Mu23NoVtx_2Cha_monitoring + DoubleL2Mu23NoVtx_2Cha_CosmicSeed_monitoring ) From b4e65872e9a56601137acb38ce41841ac4cfc980 Mon Sep 17 00:00:00 2001 From: Juliette Date: Fri, 30 Mar 2018 15:20:03 +0200 Subject: [PATCH 291/426] add exo hlt monitoring for 4 new displaced muon paths --- .../Exotica/python/analyses/hltExoticaDisplacedDimuon_cff.py | 2 ++ .../Exotica/python/analyses/hltExoticaDisplacedMuEG_cff.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/HLTriggerOffline/Exotica/python/analyses/hltExoticaDisplacedDimuon_cff.py b/HLTriggerOffline/Exotica/python/analyses/hltExoticaDisplacedDimuon_cff.py index e8a39c8631937..4dff59285e162 100644 --- a/HLTriggerOffline/Exotica/python/analyses/hltExoticaDisplacedDimuon_cff.py +++ b/HLTriggerOffline/Exotica/python/analyses/hltExoticaDisplacedDimuon_cff.py @@ -4,6 +4,8 @@ hltPathsToCheck = cms.vstring( "HLT_DoubleMu43NoFiltersNoVtx_v", # 2017 displaced mu-mu (main) "HLT_DoubleMu48NoFiltersNoVtx_v", # 2017 displaced mu-mu (backup) + "HLT_DoubleMu33NoFiltersNoVtxDisplaced_v", # 2017 displaced mu-mu, muons with dxy> 0.01 cm (main) + "HLT_DoubleMu40NoFiltersNoVtxDisplaced_v", # 2017 displaced mu-mu, muons with dxy> 0.01 cm (backup) ), recMuonLabel = cms.InputTag("muons"), # -- Analysis specific cuts diff --git a/HLTriggerOffline/Exotica/python/analyses/hltExoticaDisplacedMuEG_cff.py b/HLTriggerOffline/Exotica/python/analyses/hltExoticaDisplacedMuEG_cff.py index d197ca30b338d..0d80ab868e94f 100644 --- a/HLTriggerOffline/Exotica/python/analyses/hltExoticaDisplacedMuEG_cff.py +++ b/HLTriggerOffline/Exotica/python/analyses/hltExoticaDisplacedMuEG_cff.py @@ -4,6 +4,8 @@ hltPathsToCheck = cms.vstring( "HLT_Mu43NoFiltersNoVtx_Photon43_CaloIdL_v", # 2017 displaced e-mu (main) "HLT_Mu48NoFiltersNoVtx_Photon48_CaloIdL_v", # 2017 displaced e-mu (backup) + "HLT_Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_v", # 2017 displaced e-mu, muon with dxy> 0.01cm (main) + "HLT_Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_v", # 2017 displaced e-mu, muon with dxy> 0.01cm (backup) ), recElecLabel = cms.InputTag("gedGsfElectrons"), recMuonLabel = cms.InputTag("muons"), From 7f6ce4ef3e8d5a1338f700f33be3a60133d6e9a9 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Fri, 30 Mar 2018 16:30:04 +0200 Subject: [PATCH 292/426] Add a new shape for hexgonal geometry --- Geometry/CaloGeometry/interface/FlatHexagon.h | 92 ++++++ Geometry/CaloGeometry/src/FlatHexagon.cc | 295 ++++++++++++++++++ Geometry/CaloGeometry/src/FlatTrd.cc | 84 ++--- 3 files changed, 436 insertions(+), 35 deletions(-) create mode 100644 Geometry/CaloGeometry/interface/FlatHexagon.h create mode 100644 Geometry/CaloGeometry/src/FlatHexagon.cc diff --git a/Geometry/CaloGeometry/interface/FlatHexagon.h b/Geometry/CaloGeometry/interface/FlatHexagon.h new file mode 100644 index 0000000000000..ce674636aee61 --- /dev/null +++ b/Geometry/CaloGeometry/interface/FlatHexagon.h @@ -0,0 +1,92 @@ +#ifndef GeometryCaloGeometryFlatHexagon_h +#define GeometryCaloGeometryFlatHexagon_h + +#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" +#include +#include +#include +#include +#include +#include + +/** + + \class FlatHexagon + + \brief A base class to handle the hexagonal shape of HGCal silicon volumes. + +*/ + +class FlatHexagon : public CaloCellGeometry { +public: + + typedef CaloCellGeometry::CCGFloat CCGFloat ; + typedef CaloCellGeometry::Pt3D Pt3D ; + typedef CaloCellGeometry::Pt3DVec Pt3DVec ; + typedef CaloCellGeometry::Tr3D Tr3D ; + + FlatHexagon( void ); + + FlatHexagon( const FlatHexagon& tr ) ; + + FlatHexagon& operator=( const FlatHexagon& tr ) ; + + FlatHexagon( CornersMgr* cMgr , + const GlobalPoint& fCtr , + const GlobalPoint& bCtr , + const GlobalPoint& cor1 , + const CCGFloat* parV ) ; + + FlatHexagon( const CornersVec& corn , + const CCGFloat* par ) ; + + FlatHexagon( const FlatHexagon& tr, const Pt3D& local) ; + + ~FlatHexagon() override ; + + GlobalPoint const & getPosition() const override { return m_global; } + GlobalPoint getPosition( const Pt3D& local ) const override; + virtual float etaPos() const { return m_global.eta(); } + virtual float phiPos() const { return m_global.phi(); } + Pt3D getLocal( const GlobalPoint& global ) const; + + // Return thetaAxis polar angle of axis of the crystal + CCGFloat getThetaAxis() const ; + + // Return phiAxis azimuthal angle of axis of the crystal + CCGFloat getPhiAxis() const ; + + void vocalCorners( Pt3DVec& vec , + const CCGFloat* pv , + Pt3D& ref ) const override; + + const GlobalVector& axis() const ; + + static void createCorners( const std::vector& pv , + const Tr3D& tr , + std::vector& co ) ; + + static void localCorners( Pt3DVec& vec , + const CCGFloat* pv , + Pt3D& ref ) ; + + void getTransform( Tr3D& tr, Pt3DVec* lptr ) const override; + + void setPosition ( const GlobalPoint& p ) { m_global = p; setRefPoint(p); } + +private: + + void initCorners(CornersVec& ) override; + + GlobalVector makeAxis( void ); + + GlobalPoint backCtr( void ) const; + GlobalVector m_axis; + Pt3D m_corOne, m_local; + GlobalPoint m_global; + Tr3D m_tr; +}; + +std::ostream& operator<<( std::ostream& s, const FlatHexagon& cell ) ; + +#endif diff --git a/Geometry/CaloGeometry/src/FlatHexagon.cc b/Geometry/CaloGeometry/src/FlatHexagon.cc new file mode 100644 index 0000000000000..d1f9840c4a44a --- /dev/null +++ b/Geometry/CaloGeometry/src/FlatHexagon.cc @@ -0,0 +1,295 @@ +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "Geometry/CaloGeometry/interface/FlatHexagon.h" +#include "Geometry/CaloGeometry/interface/TruncatedPyramid.h" +#include +#include + +//#define EDM_ML_DEBUG + +typedef FlatHexagon::CCGFloat CCGFloat ; +typedef FlatHexagon::Pt3D Pt3D ; +typedef FlatHexagon::Pt3DVec Pt3DVec ; +typedef FlatHexagon::Tr3D Tr3D ; + +typedef HepGeom::Vector3D FVec3D ; +typedef HepGeom::Plane3D Plane3D ; + +typedef HepGeom::Vector3D DVec3D ; +typedef HepGeom::Plane3D DPlane3D ; +typedef HepGeom::Point3D DPt3D ; + +//---------------------------------------------------------------------- + +FlatHexagon::FlatHexagon() : CaloCellGeometry(), m_axis ( 0., 0., 0. ), + m_corOne ( 0., 0., 0. ), m_local (0., 0., 0.), + m_global ( 0., 0., 0. ) { +} + +FlatHexagon::FlatHexagon( const FlatHexagon& tr ) : CaloCellGeometry( tr ) { + *this = tr ; +} + +FlatHexagon& FlatHexagon::operator=( const FlatHexagon& tr ) { + CaloCellGeometry::operator=( tr ) ; + if ( this != &tr ) { + m_axis = tr.m_axis ; + m_corOne = tr.m_corOne ; + m_local = tr.m_local; + m_global = tr.m_global; + m_tr = tr.m_tr; + } +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("CaloGeometry") << "FlatHexagon(Copy): Local " << m_local + << " Global " << m_global << " eta " + << etaPos() << " phi " << phiPos() + << " Translation " << m_tr.getTranslation() + << " and rotation " << m_tr.getRotation(); +#endif + return *this ; +} + +FlatHexagon::FlatHexagon( CornersMgr* cMgr , + const GlobalPoint& fCtr , + const GlobalPoint& bCtr , + const GlobalPoint& cor1 , + const CCGFloat* parV ) : + CaloCellGeometry ( fCtr, cMgr, parV ) , + m_axis ( ( bCtr - fCtr ).unit() ) , + m_corOne ( cor1.x(), cor1.y(), cor1.z() ), + m_local (0., 0., 0.) { + getTransform(m_tr,nullptr); + Pt3D glb = m_tr*m_local; + m_global = GlobalPoint(glb.x(),glb.y(),glb.z()); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("CaloGeometry") << "FlatHexagon: Local " << m_local + << " Global " << glb << " eta " + << etaPos() << " phi " << phiPos() + << " Translation " << m_tr.getTranslation() + << " and rotation " << m_tr.getRotation(); +#endif +} + +FlatHexagon::FlatHexagon( const CornersVec& corn , + const CCGFloat* par ) : + CaloCellGeometry ( corn, par ) , + m_corOne ( corn[0].x(), corn[0].y(), corn[0].z() ), + m_local (0., 0., 0.) { + getTransform(m_tr,nullptr); + m_axis = makeAxis(); + Pt3D glb = m_tr*m_local; + m_global = GlobalPoint(glb.x(),glb.y(),glb.z()); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("CaloGeometry") << "FlatHexagon: Local " << m_local + << " Global " << glb << " eta " + << etaPos() << " phi " << phiPos() + << " Translation " << m_tr.getTranslation() + << " and rotation " << m_tr.getRotation(); +#endif +} + +FlatHexagon::FlatHexagon( const FlatHexagon& tr, const Pt3D & local ) : + CaloCellGeometry( tr ), m_local(local) { + *this = tr; + Pt3D glb = m_tr*m_local; + m_global = GlobalPoint(glb.x(),glb.y(),glb.z()); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("CaloGeometry") << "FlatHexagon: Local " << m_local + << " Global " << glb << " eta " + << etaPos() << " phi " << phiPos() + << " Translation " << m_tr.getTranslation() + << " and rotation " << m_tr.getRotation(); +#endif +} + +FlatHexagon::~FlatHexagon() {} + +GlobalPoint FlatHexagon::getPosition(const Pt3D& local ) const { + Pt3D glb = m_tr*local; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("CaloGeometry") << "FlatHexagon::Local " << local.x() << ":" + << local.y() << ":" << local.z() + << " Global " << glb.x() << ":" << glb.y() + << ":" << glb.z() << " TR " << m_tr.xx() + << ":" << m_tr.xy() << ":" << m_tr.xz() + << ":" << m_tr.yx() << ":" << m_tr.yy() + << ":" << m_tr.yz() << ":" << m_tr.zx() + << ":" << m_tr.zy() << ":" << m_tr.zz() + << ":" << m_tr.dx() << ":" << m_tr.dy() + << ":" << m_tr.dz(); +#endif + return GlobalPoint(glb.x(),glb.y(),glb.z()); +} + +Pt3D FlatHexagon::getLocal(const GlobalPoint& global) const { + Pt3D local = m_tr.inverse()*Pt3D(global.x(),global.y(),global.z()); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("CaloGeometry") << "FlatHexagon::Global " << global.x() + << ":" << global.y() << ":" << global.z() + << " Local " << local.x() << ":" + << local.y() << ":" << local.z(); +#endif + return local; +} + +CCGFloat FlatHexagon::getThetaAxis() const { + return m_axis.theta() ; +} + +CCGFloat FlatHexagon::getPhiAxis() const { + return m_axis.phi() ; +} + +const GlobalVector& FlatHexagon::axis() const { + return m_axis ; +} + +void FlatHexagon::vocalCorners( Pt3DVec& vec , + const CCGFloat* pv , + Pt3D& ref ) const { + localCorners( vec, pv, ref ) ; +} + +void FlatHexagon::createCorners( const std::vector& pv , + const Tr3D& tr , + std::vector& co ) { + + assert( 3 == pv.size() ) ; + assert( 12 == co.size() ) ; + + Pt3DVec ko ( 12, Pt3D(0,0,0) ) ; + + Pt3D tmp ; + Pt3DVec to ( 12, Pt3D(0,0,0) ) ; + localCorners( to, &pv.front(), tmp ) ; + + for( unsigned int i ( 0 ) ; i != 12 ; ++i ) { + ko[i] = tr * to[i] ; // apply transformation + const Pt3D & p ( ko[i] ) ; + co[ i ] = GlobalPoint( p.x(), p.y(), p.z() ) ; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("CaloGeometry") << "Corner[" << i << "] = " << co[i]; +#endif + } +} + +void FlatHexagon::localCorners( Pt3DVec& lc , + const CCGFloat* pv , + Pt3D& ref ) { + assert( nullptr != pv ) ; + assert( 12 == lc.size() ) ; + + const CCGFloat dz ( pv[0] ) ; + const CCGFloat r ( pv[1] ) ; + const CCGFloat R ( pv[2] ) ; + + lc[0] = Pt3D ( 0 , - 2*R , -dz ); // (0,-,-) + lc[1] = Pt3D ( - r , - R , -dz ); // (-,-,-) + lc[2] = Pt3D ( - r , R , -dz ); // (-,+,-) + lc[3] = Pt3D ( 0 , 2*R , -dz ); // (0,+,-) + lc[4] = Pt3D ( r , R , -dz ); // (+,+,-) + lc[5] = Pt3D ( r , - R , -dz ); // (+,-,-) + lc[6] = Pt3D ( 0 , - 2*R , dz ); // (0,-,+) + lc[7] = Pt3D ( - r , - R , dz ); // (-,-,+) + lc[8] = Pt3D ( - r , R , dz ); // (-,+,+) + lc[9] = Pt3D ( 0 , 2*R , dz ); // (0,+,+) + lc[10]= Pt3D ( r , R , dz ); // (+,+,+) + lc[11]= Pt3D ( r , - R , dz ); // (+,-,+) + + ref = ( lc[0] + lc[1] + lc[2] + lc[3] + lc[4] + lc[5] ) / 6.0; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("CaloGeometry") << "Ref " << ref << " Local Corners " + << lc[0] << "|" << lc[1] << "|" << lc[2] + << "|" << lc[3] << "|" << lc[4] << "|" + << lc[5] << "|" << lc[6] << "|" << lc[7] + << "|" << lc[8] << "|" << lc[9] << "|" + << lc[10] << "|" << lc[11]; +#endif +} + +void FlatHexagon::getTransform( Tr3D& tr, Pt3DVec* lptr ) const { + const GlobalPoint& p ( CaloCellGeometry::getPosition() ) ; + const Pt3D gFront ( p.x(), p.y(), p.z() ) ; + const DPt3D dgFront ( p.x(), p.y(), p.z() ) ; + + Pt3D lFront ; + assert( nullptr != param() ) ; + std::vector lc( 12, Pt3D(0,0,0) ) ; + localCorners( lc, param(), lFront ) ; + + // figure out if reflction volume or not + + Pt3D lBack ( (lc[6]+lc[7]+lc[8]+lc[9]+lc[10]+lc[11]) / 6.0 ) ; + + const DPt3D dlFront ( lFront.x(), lFront.y(), lFront.z() ) ; + const DPt3D dlBack ( lBack.x() , lBack.y() , lBack.z() ) ; + const DPt3D dlOne ( lc[0].x() , lc[0].y() , lc[0].z() ) ; + + const FVec3D dgAxis ( axis().x(), axis().y(), axis().z() ) ; + + const DPt3D dmOne ( m_corOne.x(), m_corOne.y(), m_corOne.z() ) ; + + const DPt3D dgBack ( dgFront + ( dlBack - dlFront ).mag()*dgAxis ) ; + DPt3D dgOne ( dgFront + ( dlOne - dlFront ).mag()*( dmOne - dgFront ).unit() ) ; + + const double dlangle ( ( dlBack - dlFront).angle( dlOne - dlFront ) ) ; + const double dgangle ( ( dgBack - dgFront).angle( dgOne - dgFront ) ) ; + const double dangle ( dlangle - dgangle ) ; + + if( 1.e-6 < fabs(dangle) ) {//guard against precision problems + const DPlane3D dgPl ( dgFront, dgOne, dgBack ) ; + const DPt3D dp2 ( dgFront + dgPl.normal().unit() ) ; + + DPt3D dgOld ( dgOne ) ; + + dgOne = ( dgFront + HepGeom::Rotate3D( -dangle, dgFront, dp2 )* + DVec3D( dgOld - dgFront ) ) ; + } + + tr = Tr3D( dlFront , dlBack , dlOne , + dgFront , dgBack , dgOne ) ; + + if( nullptr != lptr ) (*lptr) = lc ; +} + +void FlatHexagon::initCorners(CaloCellGeometry::CornersVec& co) { + + if( co.uninitialized() ) { + CornersVec& corners ( co ) ; + Pt3DVec lc ; + Tr3D tr ; + getTransform( tr, &lc ) ; + + for (unsigned int i ( 0 ) ; i != 12 ; ++i ) { + const Pt3D corn ( tr*lc[i] ) ; + corners[i] = GlobalPoint( corn.x(), corn.y(), corn.z() ) ; + } + } +} + +GlobalVector FlatHexagon::makeAxis() { + return GlobalVector( backCtr() - getPosition() ).unit() ; +} + +GlobalPoint FlatHexagon::backCtr() const { + float dz = (getCorners()[6].z() > getCorners()[0].z()) ? + param()[0] : -param()[0]; + Pt3D local_b(m_local.x(),m_local.y(),m_local.z()+dz); + Pt3D global_b = m_tr*local_b; + GlobalPoint global(global_b.x(),global_b.y(),global_b.z()); + return global; +} + +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- + +std::ostream& operator<<( std::ostream& s, const FlatHexagon& cell ) { + s << "Center: " << cell.getPosition() << " eta " << cell.etaPos() + << " phi " << cell.phiPos() << std::endl; + s << "Axis: " << cell.getThetaAxis() << " " << cell.getPhiAxis() < #include -//#define DebugLog +//#define EDM_ML_DEBUG typedef FlatTrd::CCGFloat CCGFloat ; typedef FlatTrd::Pt3D Pt3D ; @@ -37,10 +38,12 @@ FlatTrd& FlatTrd::operator=( const FlatTrd& tr ) { m_global = tr.m_global; m_tr = tr.m_tr; } -#ifdef DebugLog - std::cout << "FlatTrd(Copy): Local " << m_local << " Global " << m_global - << " eta " << etaPos() << " phi " << phiPos() << " Translation " - << m_tr.getTranslation() << " and rotation " << m_tr.getRotation(); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("CaloGeometry") << "FlatTrd(Copy): Local " << m_local + << " Global " << m_global << " eta " + << etaPos() << " phi " << phiPos() + << " Translation " << m_tr.getTranslation() + << " and rotation " << m_tr.getRotation(); #endif return *this ; } @@ -57,10 +60,12 @@ FlatTrd::FlatTrd( CornersMgr* cMgr , getTransform(m_tr,nullptr); Pt3D glb = m_tr*m_local; m_global = GlobalPoint(glb.x(),glb.y(),glb.z()); -#ifdef DebugLog - std::cout << "FlatTrd: Local " << m_local << " Global " << glb << " eta " - << etaPos() << " phi " << phiPos() << " Translation " - << m_tr.getTranslation() << " and rotation " << m_tr.getRotation(); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("CaloGeometry") << "FlatTrd: Local " << m_local + << " Global " << glb << " eta " + << etaPos() << " phi " << phiPos() + << " Translation " << m_tr.getTranslation() + << " and rotation " << m_tr.getRotation(); #endif } @@ -73,10 +78,12 @@ FlatTrd::FlatTrd( const CornersVec& corn , m_axis = makeAxis(); Pt3D glb = m_tr*m_local; m_global = GlobalPoint(glb.x(),glb.y(),glb.z()); -#ifdef DebugLog - std::cout << "FlatTrd: Local " << m_local << " Global " << glb << " eta " - << etaPos() << " phi " << phiPos() << " Translation " - << m_tr.getTranslation() << " and rotation " << m_tr.getRotation(); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("CaloGeometry") << "FlatTrd: Local " << m_local + << " Global " << glb << " eta " + << etaPos() << " phi " << phiPos() + << " Translation " << m_tr.getTranslation() + << " and rotation " << m_tr.getRotation(); #endif } @@ -85,10 +92,12 @@ FlatTrd::FlatTrd( const FlatTrd& tr, const Pt3D & local ) : *this = tr; Pt3D glb = m_tr*m_local; m_global = GlobalPoint(glb.x(),glb.y(),glb.z()); -#ifdef DebugLog - std::cout << "FlatTrd: Local " << m_local << " Global " << glb << " eta " - << etaPos() << " phi " << phiPos() << " Translation " - << m_tr.getTranslation() << " and rotation " << m_tr.getRotation(); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("CaloGeometry") << "FlatTrd: Local " << m_local + << " Global " << glb << " eta " + << etaPos() << " phi " << phiPos() + << " Translation " << m_tr.getTranslation() + << " and rotation " << m_tr.getRotation(); #endif } @@ -96,24 +105,28 @@ FlatTrd::~FlatTrd() {} GlobalPoint FlatTrd::getPosition(const Pt3D& local ) const { Pt3D glb = m_tr*local; -#ifdef DebugLog - std::cout << "FlatTrd::Local " << local.x() << ":" << local.y() << ":" - << local.z() << " Global " << glb.x() << ":" << glb.y() << ":" - << glb.z() << " TR " << m_tr.xx() << ":" << m_tr.xy() << ":" - << m_tr.xz() << ":" << m_tr.yx() << ":" << m_tr.yy() << ":" - << m_tr.yz() << ":" << m_tr.zx() << ":" << m_tr.zy() << ":" - << m_tr.zz() << ":" << m_tr.dx() << ":" << m_tr.dy() << ":" - << m_tr.dz() << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("CaloGeometry") << "FlatTrd::Local " << local.x() << ":" + << local.y() << ":" << local.z() + << " Global " << glb.x() << ":" << glb.y() + << ":" << glb.z() << " TR " << m_tr.xx() + << ":" << m_tr.xy() << ":" << m_tr.xz() + << ":" << m_tr.yx() << ":" << m_tr.yy() + << ":" << m_tr.yz() << ":" << m_tr.zx() + << ":" << m_tr.zy() << ":" << m_tr.zz() + << ":" << m_tr.dx() << ":" << m_tr.dy() + << ":" << m_tr.dz(); #endif return GlobalPoint(glb.x(),glb.y(),glb.z()); } Pt3D FlatTrd::getLocal(const GlobalPoint& global) const { Pt3D local = m_tr.inverse()*Pt3D(global.x(),global.y(),global.z()); -#ifdef DebugLog - std::cout << "FlatTrd::Global " << global.x() << ":" << global.y() << ":" - << global.z() << " Local " << local.x() << ":" << local.y() << ":" - << local.z() << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("CaloGeometry") << "FlatTrd::Global " << global.x() << ":" + << global.y() << ":" << global.z() + << " Local " << local.x() << ":" + << local.y() << ":" << local.z(); #endif return local; } @@ -153,8 +166,8 @@ void FlatTrd::createCorners( const std::vector& pv , ko[i] = tr * to[i] ; // apply transformation const Pt3D & p ( ko[i] ) ; co[ i ] = GlobalPoint( p.x(), p.y(), p.z() ) ; -#ifdef DebugLog - std::cout << "Corner[" << i << "] = " << co[i] << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("CaloGeometry") << "Corner[" << i << "] = " << co[i]; #endif } } @@ -183,10 +196,11 @@ void FlatTrd::localCorners( Pt3DVec& lc , lc[7] = Pt3D ( - h*ta1 + bl, - h , dz ); // (+,-,+) ref = 0.25*( lc[0] + lc[1] + lc[2] + lc[3] ) ; -#ifdef DebugLog - std::cout << "Ref " << ref << " Local Corners " << lc[0] << "|" << lc[1] - << "|" << lc[2] << "|" << lc[3] << "|" << lc[4] << "|" << lc[5] - << "|" << lc[6] << "|" << lc[7] << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("CaloGeometry") << "Ref " << ref << " Local Corners " + << lc[0] << "|" << lc[1] << "|" << lc[2] + << "|" << lc[3] << "|" << lc[4] << "|" + << lc[5] << "|" << lc[6] << "|" << lc[7]; #endif } From d974e988d88ae9a6d293f1723229df455fe63b95 Mon Sep 17 00:00:00 2001 From: Heshy Roskes Date: Fri, 30 Mar 2018 20:35:44 +0200 Subject: [PATCH 293/426] and another fix --- Alignment/OfflineValidation/scripts/validateAlignments.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Alignment/OfflineValidation/scripts/validateAlignments.py b/Alignment/OfflineValidation/scripts/validateAlignments.py index 5744ebd6c2ce6..f77224e6060aa 100755 --- a/Alignment/OfflineValidation/scripts/validateAlignments.py +++ b/Alignment/OfflineValidation/scripts/validateAlignments.py @@ -297,7 +297,7 @@ def createMergeScript( path, validations, options ): for validation in validations: for referenceName in validation.filesToCompare: validationtype = type(validation) - if isinstance(validationtype, PreexistingValidation): + if issubclass(validationtype, PreexistingValidation): #find the actual validationtype for parentclass in validationtype.mro(): if not issubclass(parentclass, PreexistingValidation): From 7861aea3442a96678256f63df30ec9c62a55171b Mon Sep 17 00:00:00 2001 From: Mauro Date: Fri, 30 Mar 2018 21:17:49 +0200 Subject: [PATCH 294/426] Update beampixel_dqm_sourceclient-live_cfg.py Fixed pixel vertexing sequence. --- .../python/clients/beampixel_dqm_sourceclient-live_cfg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DQM/Integration/python/clients/beampixel_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/beampixel_dqm_sourceclient-live_cfg.py index 7e92c37348862..422e28c40a4bf 100644 --- a/DQM/Integration/python/clients/beampixel_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/beampixel_dqm_sourceclient-live_cfg.py @@ -127,8 +127,8 @@ #---------------------------- from RecoPixelVertexing.PixelLowPtUtilities.siPixelClusterShapeCache_cfi import * process.siPixelClusterShapeCachePreSplitting = siPixelClusterShapeCache.clone(src = 'siPixelClustersPreSplitting') + process.load("RecoLocalTracker.SiPixelRecHits.PixelCPEGeneric_cfi") process.load("RecoPixelVertexing.Configuration.RecoPixelVertexing_cff") - process.recopixelvertexing = cms.Sequence(process.pixelTracksSequence + process.pixelVertices) process.pixelVertices.TkFilterParameters.minPt = process.pixelTracksTrackingRegions.RegionPSet.ptMin process.pixelTracksTrackingRegions.RegionPSet.originRadius = 0.4 process.pixelTracksTrackingRegions.RegionPSet.originHalfLength = 15. From cad8b0eb7d44779cb3fd54357a20954b58e5509a Mon Sep 17 00:00:00 2001 From: Leonard Apanasevich Date: Fri, 30 Mar 2018 15:07:17 -0500 Subject: [PATCH 295/426] Add DQM module to make uGT data/emulator comparisons --- ...tage2emulator_dqm_sourceclient-live_cfg.py | 3 + DQM/L1TMonitor/interface/L1TdeStage2uGT.h | 82 ++++++ DQM/L1TMonitor/plugins/SealModule.cc | 3 + .../python/L1TStage2Emulator_cff.py | 6 +- DQM/L1TMonitor/python/L1TdeStage2uGT_cfi.py | 10 + DQM/L1TMonitor/src/L1TdeStage2uGT.cc | 269 ++++++++++++++++++ 6 files changed, 372 insertions(+), 1 deletion(-) create mode 100644 DQM/L1TMonitor/interface/L1TdeStage2uGT.h create mode 100644 DQM/L1TMonitor/python/L1TdeStage2uGT_cfi.py create mode 100644 DQM/L1TMonitor/src/L1TdeStage2uGT.cc diff --git a/DQM/Integration/python/clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py index 81d7cda19c822..f32fd8acc0008 100644 --- a/DQM/Integration/python/clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py @@ -140,6 +140,9 @@ process.gtStage2Digis.InputLabel = cms.InputTag("rawDataRepacker") process.selfFatEventFilter.rawInput = cms.InputTag("rawDataRepacker") +process.valGtStage2Digis.EmulateBxInEvent = cms.int32(5) +process.valGtStage2Digis.PrescaleSet = cms.uint32(7) + #-------------------------------------------------- # L1T Emulator Online DQM Schedule diff --git a/DQM/L1TMonitor/interface/L1TdeStage2uGT.h b/DQM/L1TMonitor/interface/L1TdeStage2uGT.h new file mode 100644 index 0000000000000..e0fd2b7a479af --- /dev/null +++ b/DQM/L1TMonitor/interface/L1TdeStage2uGT.h @@ -0,0 +1,82 @@ +#ifndef L1TdeStage2uGT_H +#define L1TdeStage2uGT_H + +// system include files +#include +#include +#include + +// user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/EDAnalyzer.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/LuminosityBlock.h" + +#include "DQMServices/Core/interface/MonitorElement.h" +#include "DQMServices/Core/interface/DQMEDAnalyzer.h" + +#include "DataFormats/L1TGlobal/interface/GlobalAlgBlk.h" +#include "DataFormats/Provenance/interface/EventAuxiliary.h" + +#include "CondFormats/RunInfo/interface/RunInfo.h" +#include "CondFormats/DataRecord/interface/RunSummaryRcd.h" + +#include "L1Trigger/L1TGlobal/interface/L1TGlobalUtil.h" + +#include "FWCore/Utilities/interface/RegexMatch.h" +#include + +using namespace l1t; + +class L1TdeStage2uGT : public DQMEDAnalyzer { + public: + L1TdeStage2uGT(const edm::ParameterSet& ps); + ~L1TdeStage2uGT() override; + + protected: + void analyze(const edm::Event& e, const edm::EventSetup& c) override; + void bookHistograms(DQMStore::IBooker &ibooker, const edm::Run&, const edm::EventSetup&) override; + void dqmBeginRun(const edm::Run&, const edm::EventSetup&) override; + void beginLuminosityBlock(const edm::LuminosityBlock&, const edm::EventSetup&) override; + void endLuminosityBlock(const edm::LuminosityBlock&, const edm::EventSetup&) override; + + private: + // Input and config info + edm::InputTag dataLabel_; + edm::EDGetTokenT dataSource_; + edm::InputTag emulLabel_; + edm::EDGetTokenT emulSource_; + std::vector triggerBlackList_; + int numBx_; + std::string histFolder_; + L1TGlobalUtil* gtUtil_; + int numLS_; + + int firstBx, lastBx; + + std::map m_HistNamesInitial, m_HistNamesFinal, m_SummaryHistograms; + MonitorElement* initDecisionMismatches_vs_LS; + MonitorElement* finalDecisionMismatches_vs_LS; + + enum SummaryColumn { + Nevt, + NInitalMismatchDataNoEmul, + NInitalMismatchEmulNoData, + NFinalMismatchDataNoEmul, + NFinalMismatchEmulNoData, + NSummaryColumns, + }; + + void fillHist(const std::map&, const TString&, const Double_t& , const Double_t&); +}; + +#endif diff --git a/DQM/L1TMonitor/plugins/SealModule.cc b/DQM/L1TMonitor/plugins/SealModule.cc index 2247698bcc1bd..23beb85a3c676 100644 --- a/DQM/L1TMonitor/plugins/SealModule.cc +++ b/DQM/L1TMonitor/plugins/SealModule.cc @@ -121,3 +121,6 @@ DEFINE_FWK_MODULE(L1TStage2uGTCaloLayer2Comp); #include "DQM/L1TMonitor/interface/L1TdeStage2CaloLayer2.h" DEFINE_FWK_MODULE(L1TdeStage2CaloLayer2); + +#include +DEFINE_FWK_MODULE(L1TdeStage2uGT); diff --git a/DQM/L1TMonitor/python/L1TStage2Emulator_cff.py b/DQM/L1TMonitor/python/L1TStage2Emulator_cff.py index 52ca2dca3a502..86d52bc332f23 100644 --- a/DQM/L1TMonitor/python/L1TStage2Emulator_cff.py +++ b/DQM/L1TMonitor/python/L1TStage2Emulator_cff.py @@ -53,7 +53,7 @@ from L1Trigger.L1TGlobal.simGtExtFakeProd_cfi import simGtExtFakeProd valGtStage2Digis = simGtStage2Digis.clone() -valGtStage2Digis.ExtInputTag = cms.InputTag("simGtExtFakeProd") +valGtStage2Digis.ExtInputTag = cms.InputTag("gtStage2Digis") valGtStage2Digis.MuonInputTag = cms.InputTag("gtStage2Digis", "Muon") valGtStage2Digis.EGammaInputTag = cms.InputTag("gtStage2Digis", "EGamma") valGtStage2Digis.TauInputTag = cms.InputTag("gtStage2Digis", "Tau") @@ -61,6 +61,8 @@ valGtStage2Digis.EtSumInputTag = cms.InputTag("gtStage2Digis", "EtSum") valGtStage2Digis.AlgorithmTriggersUnmasked = cms.bool(False) valGtStage2Digis.AlgorithmTriggersUnprescaled = cms.bool(False) +valGtStage2Digis.EmulateBxInEvent = cms.int32(5) +valGtStage2Digis.PrescaleSet = cms.uint32(7) Stage2L1HardwareValidation = cms.Sequence( valCaloStage2Layer1Digis + @@ -101,6 +103,7 @@ # uGT from DQM.L1TMonitor.L1TStage2uGTEmul_cfi import * +from DQM.L1TMonitor.L1TdeStage2uGT_cfi import * #------------------------------------------------- # Stage2 Emulator and Emulator DQM Sequences @@ -111,6 +114,7 @@ l1tdeStage2Omtf + l1tdeStage2EmtfOnlineDQMSeq + l1tStage2uGMTEmulatorOnlineDQMSeq + + l1tdeStage2uGT + l1tStage2uGtEmul ) diff --git a/DQM/L1TMonitor/python/L1TdeStage2uGT_cfi.py b/DQM/L1TMonitor/python/L1TdeStage2uGT_cfi.py new file mode 100644 index 0000000000000..b4739f68af56a --- /dev/null +++ b/DQM/L1TMonitor/python/L1TdeStage2uGT_cfi.py @@ -0,0 +1,10 @@ +import FWCore.ParameterSet.Config as cms + +from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer +l1tdeStage2uGT = DQMEDAnalyzer('L1TdeStage2uGT', + dataSource = cms.InputTag("gtStage2Digis"), + emulSource = cms.InputTag("valGtStage2Digis"), + triggerBlackList = cms.vstring("L1_IsolatedBunch","L1_FirstBunchInTrain","L1_FirstBunchAfterTrain","*3BX"), + numBxToMonitor = cms.int32(5), + histFolder = cms.string('L1TEMU/L1TdeStage2uGT') +) diff --git a/DQM/L1TMonitor/src/L1TdeStage2uGT.cc b/DQM/L1TMonitor/src/L1TdeStage2uGT.cc new file mode 100644 index 0000000000000..91aca3cec94b5 --- /dev/null +++ b/DQM/L1TMonitor/src/L1TdeStage2uGT.cc @@ -0,0 +1,269 @@ +/* + * \file L1TdeStage2uGT.cc + * + * L. Apanasevich + */ + +#include "DQM/L1TMonitor/interface/L1TdeStage2uGT.h" + +L1TdeStage2uGT::L1TdeStage2uGT(const edm::ParameterSet & ps) : + dataLabel_(ps.getParameter("dataSource")), + dataSource_(consumes(dataLabel_)), + emulLabel_(ps.getParameter("emulSource")), + emulSource_(consumes(emulLabel_)), + triggerBlackList_(ps.getParameter >("triggerBlackList")), + numBx_(ps.getParameter("numBxToMonitor")), + histFolder_(ps.getParameter("histFolder")), + gtUtil_(new l1t::L1TGlobalUtil(ps, consumesCollector(), *this, ps.getParameter("dataSource"), ps.getParameter("dataSource"))), + numLS_(2000) +{ + + if (numBx_ >5 ) numBx_ = 5; + if ( ( numBx_ > 0 ) && ( ( numBx_ % 2 ) == 0 )) { + numBx_ = numBx_ - 1; + + edm::LogWarning("L1TdeStage2uGT") + << "\nWARNING: Number of bunch crossing to be emulated rounded to: " + << numBx_ << "\n The number must be an odd number!\n" + << std::endl; + } + firstBx = (numBx_ + 1)/2 - numBx_; + lastBx = (numBx_ + 1)/2 - 1; + + edm::LogInfo("L1TdeStage2uGT") << "Number of bunches crossings monitored: " << numBx_ + << "\t" << "Min BX= " << firstBx << "\t" << "Max BX= " << lastBx << std::endl; + +} + +L1TdeStage2uGT::~L1TdeStage2uGT() +{ +} + +void L1TdeStage2uGT::dqmBeginRun(const edm::Run& iRun, const edm::EventSetup& evtSetup) +{ +} + +void L1TdeStage2uGT::analyze(const edm::Event & event, const edm::EventSetup & es) +{ + edm::Handle dataCollection; + event.getByToken(dataSource_, dataCollection); + edm::Handle emulCollection; + event.getByToken(emulSource_, emulCollection); + + gtUtil_->retrieveL1(event,es,dataSource_); + + if (!dataCollection.isValid()) { + edm::LogInfo("L1TdeStage2uGT") << "Cannot find unpacked uGT readout record."; + return; + } + if (!emulCollection.isValid()) { + edm::LogInfo("L1TdeStage2uGT") << "Cannot find emulated uGT readout record."; + return; + } + + // Get standard event parameters + int lumi = event.luminosityBlock(); + if (lumi > numLS_) lumi=numLS_; + + // int bx = event.bunchCrossing(); + + // check that the requested range of BX's is consistant with the BX's in the emulated collection + if (emulCollection->getFirstBX() > firstBx) firstBx = emulCollection->getFirstBX(); + if (emulCollection->getLastBX() < lastBx) lastBx = emulCollection->getLastBX(); + + for (int ibx = firstBx; ibx <= lastBx; ++ibx) { + + ostringstream bxt; + if (ibx==0){ + bxt << "CentralBX"; + }else{ + bxt << "BX" << ibx; + } + TString hname, hsummary; + float wt; + + hsummary="dataEmulSummary_" + bxt.str(); + fillHist(m_SummaryHistograms, hsummary, float(Nevt),1.); + + std::vector::const_iterator it_data, it_emul; + for (it_data = dataCollection->begin(ibx), it_emul = emulCollection->begin(ibx); + it_data != dataCollection->end(ibx) && it_emul != emulCollection->end(ibx); + ++it_data, ++it_emul) { + + // Fills algorithm bits histograms + int numAlgs= it_data->getAlgoDecisionInitial().size(); + for(int algoBit = 0; algoBit < numAlgs; ++algoBit) { + + string algoName = "xxx"; + bool found=gtUtil_->getAlgNameFromBit(algoBit,algoName); + if (not found) algoName="NULL"; + if (algoName == "NULL") continue; + + // skip bits which emulator does not handle (only skiped for bx !=0) + bool isBlackListed(false); + BOOST_FOREACH(const std::string & pattern, triggerBlackList_) { + //std::cout << pattern << std::endl; + if (edm::is_glob(pattern)) { + std::regex regexp(edm::glob2reg(pattern)); + if (regex_match (algoName.c_str(),regexp)) isBlackListed = true; + } else { + if (algoName == pattern) isBlackListed = true; + } + } + if (ibx !=0 && isBlackListed) continue; + + // Check initial decisions + if(it_data->getAlgoDecisionInitial(algoBit) != it_emul->getAlgoDecisionInitial(algoBit)) { + + if (it_data->getAlgoDecisionInitial(algoBit)){ + hname = "DataNoEmul_" + bxt.str(); + fillHist(m_SummaryHistograms, hsummary, float(NInitalMismatchDataNoEmul),1.); + wt=1; + }else{ + hname = "EmulatorNoData_" + bxt.str(); + fillHist(m_SummaryHistograms, hsummary, float(NInitalMismatchEmulNoData),1.); + wt=-1; + } + fillHist(m_HistNamesInitial, hname, float(algoBit),1.); + initDecisionMismatches_vs_LS->Fill(float(lumi),wt); + + } + + // Check final decisions + if(it_data->getAlgoDecisionFinal(algoBit) != it_emul->getAlgoDecisionFinal(algoBit)) { + bool unprescaled=true; + // check the prescale factor + int prescale = -999; + bool dummy=gtUtil_->getPrescaleByBit(algoBit,prescale); + if (not dummy) + edm::LogError("L1TdeStage2uGT") << "Could not find prescale value for algobit: " << algoBit << std::endl; + + if (prescale != 1) unprescaled=false; + + if (unprescaled) { + + if (it_data->getAlgoDecisionFinal(algoBit)){ + hname = "DataNoEmul_" + bxt.str(); + fillHist(m_SummaryHistograms, hsummary, float(NFinalMismatchDataNoEmul),1.); + wt=1; + }else{ + hname = "EmulatorNoData_" + bxt.str(); + fillHist(m_SummaryHistograms, hsummary, float(NFinalMismatchEmulNoData),1.); + wt=-1; + } + fillHist(m_HistNamesFinal, hname, float(algoBit),1.); + finalDecisionMismatches_vs_LS->Fill(float(lumi), wt); + } + } + + }// end loop over algoBits + }// end loop over globalalgblk vector + }// endof loop over BX collections + +} + +void L1TdeStage2uGT::beginLuminosityBlock(const edm::LuminosityBlock&, const edm::EventSetup&) {} + +void L1TdeStage2uGT::endLuminosityBlock(const edm::LuminosityBlock& lumi, const edm::EventSetup&) {} + +void L1TdeStage2uGT::bookHistograms(DQMStore::IBooker &ibooker, const edm::Run& run , const edm::EventSetup& es) +{ + gtUtil_->retrieveL1Setup(es); + + auto const& prescales = gtUtil_->prescales(); + int nbins = prescales.size(); // dummy values for now; update later when gtutils function is called + double xmin = -0.5; + double xmax = nbins-0.5; + + string hname, htitle; + + int ibx = (numBx_ + 1)/2 - numBx_; + for ( int i = 0; i < numBx_; i++) { + + ostringstream bxn,bxt; + + if (ibx==0){ + bxt << "CentralBX"; + bxn << " Central BX "; + }else{ + bxt << "BX" << ibx; + bxn<< " BX " << ibx; + } + ibx++; + + ibooker.setCurrentFolder(histFolder_); + hname = "dataEmulSummary_" + bxt.str(); + htitle = "uGT Data/Emulator Mismatches --" + bxn.str(); + m_SummaryHistograms[hname] = ibooker.book1D(hname, htitle, NSummaryColumns, 0., double(NSummaryColumns)); + m_SummaryHistograms[hname]->getTH1F()->GetYaxis()->SetTitle("Events"); + m_SummaryHistograms[hname]->getTH1F()->GetXaxis()->SetBinLabel(1+Nevt, "Events processed"); + m_SummaryHistograms[hname]->getTH1F()->GetXaxis()->SetBinLabel(1+NInitalMismatchDataNoEmul, "Data, NoEmul -- Initial Decisions"); + m_SummaryHistograms[hname]->getTH1F()->GetXaxis()->SetBinLabel(1+NInitalMismatchEmulNoData, "Emulator, No Data -- Initial Decisions"); + m_SummaryHistograms[hname]->getTH1F()->GetXaxis()->SetBinLabel(1+NFinalMismatchDataNoEmul, "Data, NoEmul -- Final Decisions"); + m_SummaryHistograms[hname]->getTH1F()->GetXaxis()->SetBinLabel(1+NFinalMismatchEmulNoData, "Emulator, No Data -- Final Decisions"); + + + // book initial decisions histograms + ibooker.setCurrentFolder(histFolder_+"/InitialDecisionMismatches"); + initDecisionMismatches_vs_LS = ibooker.book1D("initialDecisionMismatches_vs_LS", "uGT initial decision mismatches vs Luminosity Segment", numLS_, 0., double(numLS_)); + initDecisionMismatches_vs_LS->getTH1F()->GetYaxis()->SetTitle("Events with Initial Decision Mismatch"); + initDecisionMismatches_vs_LS->getTH1F()->GetXaxis()->SetTitle("Luminosity Segment"); + + hname = "DataNoEmul_" + bxt.str(); + htitle = "uGT data-emul mismatch -- Data fired but not Emulator --" + bxn.str(); + m_HistNamesInitial[hname] = ibooker.book1D(hname, htitle, nbins, xmin, xmax); + + hname = "EmulatorNoData_" + bxt.str(); + htitle = "uGT data-emul mismatch -- Emulator fired but not Data --" + bxn.str(); + m_HistNamesInitial[hname] = ibooker.book1D(hname, htitle, nbins, xmin, xmax); + + + // book final decisions histograms + ibooker.setCurrentFolder(histFolder_+"/FinalDecisionMismatches"); + finalDecisionMismatches_vs_LS = ibooker.book1D("finalDecisionMismatches_vs_LS", "uGT final decision mismatches vs Luminosity Segment", numLS_, 0., double(numLS_)); + finalDecisionMismatches_vs_LS->getTH1F()->GetYaxis()->SetTitle("Events with Final Decision Mismatch"); + finalDecisionMismatches_vs_LS->getTH1F()->GetXaxis()->SetTitle("Luminosity Segment"); + + hname = "DataNoEmul_" + bxt.str(); + htitle = "uGT data-emul mismatch -- Data fired but not Emulator --" + bxn.str(); + m_HistNamesFinal[hname] = ibooker.book1D(hname, htitle, nbins, xmin, xmax); + + hname = "EmulatorNoData_" + bxt.str(); + htitle = "uGT data-emul mismatch -- Emulator fired but not Data --" + bxn.str(); + m_HistNamesFinal[hname] = ibooker.book1D(hname, htitle, nbins, xmin, xmax); + + } + + // Set some histogram attributes + for (std::map::iterator it = m_HistNamesInitial.begin(); it != m_HistNamesInitial.end(); ++it) { + // for (unsigned int i = 0; i < prescales.size(); i++) { + // auto const& name = prescales.at(i).first; + // if (name != "NULL") + // (*it).second->getTH1F()->GetXaxis()->SetBinLabel(1+i, name.c_str()); + // } + (*it).second->getTH1F()->GetXaxis()->SetTitle("Trigger Bit"); + (*it).second->getTH1F()->GetYaxis()->SetTitle("Events with Initial Decision Mismatch"); + } + + for (std::map::iterator it = m_HistNamesFinal.begin(); it != m_HistNamesFinal.end(); ++it) { + // for (unsigned int i = 0; i < prescales.size(); i++) { + // auto const& name = prescales.at(i).first; + // if (name != "NULL") + // (*it).second->getTH1F()->GetXaxis()->SetBinLabel(1+i, name.c_str()); + // } + (*it).second->getTH1F()->GetXaxis()->SetTitle("Trigger Bit (Unprescaled)"); + (*it).second->getTH1F()->GetYaxis()->SetTitle("Events with Final Decision Mismatch"); + } + + +} + +void L1TdeStage2uGT::fillHist(const std::map& m_HistNames, const TString& histName, const Double_t& value, const Double_t& wt=1.){ + + std::map::const_iterator hid = m_HistNames.find(histName); + + if (hid==m_HistNames.end()) + edm::LogError("L1TdeStage2uGT") << "%fillHist -- Could not find histogram with name: " << histName << std::endl; + else + hid->second->Fill(value,wt); +} From c1d7785da4a1819d7a4b069681a549fc015a2f7b Mon Sep 17 00:00:00 2001 From: Sunanda Date: Fri, 30 Mar 2018 23:03:42 +0200 Subject: [PATCH 296/426] Get a new way for PU correction to IsoTrack calibration --- Calibration/HcalCalibAlgos/macros/CalibRho.C | 689 ++++++++++++++++++ .../IsolatedParticles/plugins/StudyHLT.cc | 80 +- 2 files changed, 760 insertions(+), 9 deletions(-) create mode 100644 Calibration/HcalCalibAlgos/macros/CalibRho.C diff --git a/Calibration/HcalCalibAlgos/macros/CalibRho.C b/Calibration/HcalCalibAlgos/macros/CalibRho.C new file mode 100644 index 0000000000000..ebde86d8e4929 --- /dev/null +++ b/Calibration/HcalCalibAlgos/macros/CalibRho.C @@ -0,0 +1,689 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Usage: +// .L CalibRho.C+g +// +// EHcalVsRho c1(inpFilName, dupFileName); +// c1.LoopFill(maxEta, outFile1, logFile); +// FitEvsRho(logFile, parameterFile, outFile2); +// c1.LoopTest(maxEta, parameterFile, rootFile); +// FitEovPwithRho(maxEta, rootFile, outFile3); +// +// inpFileName (const char*) File name of the input ROOT tree +// dupFileName (const char*) Name of the file containing list of entries +// of duplicate events +// maxEta (int) Maximum value of |iEta| +// outFile1 (const char*) Output ROOT file name which will contain the +// scatter plots and profile histograms which +// will provide the estimate of "effective area" +// logFile (const char*) Name of the text file which will contain the +// effective area for each ieta value +// parameterFile (const char*) Name of the text file with values of the +// fitted parameter set +// outFile2 (const char*) Name of the ROOT file with the results of +// the fit +// rootFile (const char*) Name of the ROOT file with corrected and +// uncorrected histograms of E/p +// outFile3 (const char*) Name of the ROOT file containing the E/p +// histograms and the fit results +////////////////////////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +class EHcalVsRho { +public : + TTree *fChain; //!pointer to the analyzed TTree or TChain + Int_t fCurrent; //!current Tree number in a TChain + + EHcalVsRho(const char *inFile, const char *dupFile); + virtual ~EHcalVsRho(); + virtual Int_t Cut(Long64_t entry); + virtual Int_t GetEntry(Long64_t entry); + virtual Long64_t LoadTree(Long64_t entry); + virtual void Init(TTree *tree, const char* dupFile); + virtual Bool_t Notify(); + virtual void Show(Long64_t entry = -1); + void LoopFill(int maxEta, const char *outFile, const char *logFile); + void LoopTest(int maxEta, const char *inFile, const char *outFile); + double EffCalc(TH1D*, double, double&, double&); + double getEA(const int ieta, const double* par); + +private: + + // Declaration of leaf types + Int_t t_Run; + Int_t t_Event; + Int_t t_DataType; + Int_t t_ieta; + Int_t t_iphi; + Double_t t_EventWeight; + Int_t t_nVtx; + Int_t t_nTrk; + Int_t t_goodPV; + Double_t t_l1pt; + Double_t t_l1eta; + Double_t t_l1phi; + Double_t t_l3pt; + Double_t t_l3eta; + Double_t t_l3phi; + Double_t t_p; + Double_t t_pt; + Double_t t_phi; + Double_t t_mindR1; + Double_t t_mindR2; + Double_t t_eMipDR; + Double_t t_eHcal; + Double_t t_eHcal10; + Double_t t_eHcal30; + Double_t t_hmaxNearP; + Double_t t_rhoh; + Bool_t t_selectTk; + Bool_t t_qltyFlag; + Bool_t t_qltyMissFlag; + Bool_t t_qltyPVFlag; + Double_t t_gentrackP; + std::vector *t_DetIds; + std::vector *t_HitEnergies; + std::vector *t_trgbits; + std::vector *t_DetIds1; + std::vector *t_DetIds3; + std::vector *t_HitEnergies1; + std::vector *t_HitEnergies3; + + // List of branches + TBranch *b_t_Run; //! + TBranch *b_t_Event; //! + TBranch *b_t_DataType; //! + TBranch *b_t_ieta; //! + TBranch *b_t_iphi; //! + TBranch *b_t_EventWeight; //! + TBranch *b_t_nVtx; //! + TBranch *b_t_nTrk; //! + TBranch *b_t_goodPV; //! + TBranch *b_t_l1pt; //! + TBranch *b_t_l1eta; //! + TBranch *b_t_l1phi; //! + TBranch *b_t_l3pt; //! + TBranch *b_t_l3eta; //! + TBranch *b_t_l3phi; //! + TBranch *b_t_p; //! + TBranch *b_t_pt; //! + TBranch *b_t_phi; //! + TBranch *b_t_mindR1; //! + TBranch *b_t_mindR2; //! + TBranch *b_t_eMipDR; //! + TBranch *b_t_eHcal; //! + TBranch *b_t_eHcal10; //! + TBranch *b_t_eHcal30; //! + TBranch *b_t_hmaxNearP; //! + TBranch *b_t_rhoh; //! + TBranch *b_t_selectTk; //! + TBranch *b_t_qltyFlag; //! + TBranch *b_t_qltyMissFlag; //! + TBranch *b_t_qltyPVFlag; //! + TBranch *b_t_gentrackP; //! + TBranch *b_t_DetIds; //! + TBranch *b_t_HitEnergies; //! + TBranch *b_t_trgbits; //! + TBranch *b_t_DetIds1; //! + TBranch *b_t_DetIds3; //! + TBranch *b_t_HitEnergies1; //! + TBranch *b_t_HitEnergies3; //! + + std::vector entries_; +}; + +EHcalVsRho::EHcalVsRho(const char *inFile, const char *dupFile) : fChain(0) { + TFile *infile = TFile::Open(inFile); + TDirectory *dir = (TDirectory*)infile->FindObjectAny("HcalIsoTrkAnalyzer"); + TTree *tree = (TTree*)dir->FindObjectAny("CalibTree"); + Init(tree, dupFile); +} + +EHcalVsRho::~EHcalVsRho() { + if (!fChain) return; + delete fChain->GetCurrentFile(); +} + +Int_t EHcalVsRho::GetEntry(Long64_t entry) { + // Read contents of entry. + if (!fChain) return 0; + return fChain->GetEntry(entry); +} + +Long64_t EHcalVsRho::LoadTree(Long64_t entry) { + // Set the environment to read one entry + if (!fChain) return -5; + Long64_t centry = fChain->LoadTree(entry); + if (centry < 0) return centry; + if (fChain->GetTreeNumber() != fCurrent) { + fCurrent = fChain->GetTreeNumber(); + Notify(); + } + return centry; +} + +void EHcalVsRho::Init(TTree *tree, const char* dupFile) { + // The Init() function is called when the selector needs to initialize + // a new tree or chain. Typically here the branch addresses and branch + // pointers of the tree will be set. + // It is normally not necessary to make changes to the generated + // code, but the routine can be extended by the user if needed. + // Init() will be called many times when running on PROOF + // (once per file to be processed). + + // Set object pointer + t_DetIds = 0; + t_HitEnergies = 0; + t_trgbits = 0; + t_DetIds1 = 0; + t_DetIds3 = 0; + t_HitEnergies1 = 0; + t_HitEnergies3 = 0; + // Set branch addresses and branch pointers + if (!tree) return; + fChain = tree; + fCurrent = -1; + fChain->SetMakeClass(1); + + fChain->SetBranchAddress("t_Run", &t_Run, &b_t_Run); + fChain->SetBranchAddress("t_Event", &t_Event, &b_t_Event); + fChain->SetBranchAddress("t_DataType", &t_DataType, &b_t_DataType); + fChain->SetBranchAddress("t_ieta", &t_ieta, &b_t_ieta); + fChain->SetBranchAddress("t_iphi", &t_iphi, &b_t_iphi); + fChain->SetBranchAddress("t_EventWeight", &t_EventWeight, &b_t_EventWeight); + fChain->SetBranchAddress("t_nVtx", &t_nVtx, &b_t_nVtx); + fChain->SetBranchAddress("t_nTrk", &t_nTrk, &b_t_nTrk); + fChain->SetBranchAddress("t_goodPV", &t_goodPV, &b_t_goodPV); + fChain->SetBranchAddress("t_l1pt", &t_l1pt, &b_t_l1pt); + fChain->SetBranchAddress("t_l1eta", &t_l1eta, &b_t_l1eta); + fChain->SetBranchAddress("t_l1phi", &t_l1phi, &b_t_l1phi); + fChain->SetBranchAddress("t_l3pt", &t_l3pt, &b_t_l3pt); + fChain->SetBranchAddress("t_l3eta", &t_l3eta, &b_t_l3eta); + fChain->SetBranchAddress("t_l3phi", &t_l3phi, &b_t_l3phi); + fChain->SetBranchAddress("t_p", &t_p, &b_t_p); + fChain->SetBranchAddress("t_pt", &t_pt, &b_t_pt); + fChain->SetBranchAddress("t_phi", &t_phi, &b_t_phi); + fChain->SetBranchAddress("t_mindR1", &t_mindR1, &b_t_mindR1); + fChain->SetBranchAddress("t_mindR2", &t_mindR2, &b_t_mindR2); + fChain->SetBranchAddress("t_eMipDR", &t_eMipDR, &b_t_eMipDR); + fChain->SetBranchAddress("t_eHcal", &t_eHcal, &b_t_eHcal); + fChain->SetBranchAddress("t_eHcal10", &t_eHcal10, &b_t_eHcal10); + fChain->SetBranchAddress("t_eHcal30", &t_eHcal30, &b_t_eHcal30); + fChain->SetBranchAddress("t_hmaxNearP", &t_hmaxNearP, &b_t_hmaxNearP); + fChain->SetBranchAddress("t_rhoh", &t_rhoh, &b_t_rhoh); + fChain->SetBranchAddress("t_selectTk", &t_selectTk, &b_t_selectTk); + fChain->SetBranchAddress("t_qltyFlag", &t_qltyFlag, &b_t_qltyFlag); + fChain->SetBranchAddress("t_qltyMissFlag", &t_qltyMissFlag, &b_t_qltyMissFlag); + fChain->SetBranchAddress("t_qltyPVFlag", &t_qltyPVFlag, &b_t_qltyPVFlag); + fChain->SetBranchAddress("t_gentrackP", &t_gentrackP, &b_t_gentrackP); + fChain->SetBranchAddress("t_DetIds", &t_DetIds, &b_t_DetIds); + fChain->SetBranchAddress("t_HitEnergies", &t_HitEnergies, &b_t_HitEnergies); + fChain->SetBranchAddress("t_trgbits", &t_trgbits, &b_t_trgbits); + fChain->SetBranchAddress("t_DetIds1", &t_DetIds1, &b_t_DetIds1); + fChain->SetBranchAddress("t_DetIds3", &t_DetIds3, &b_t_DetIds3); + fChain->SetBranchAddress("t_HitEnergies1", &t_HitEnergies1, &b_t_HitEnergies1); + fChain->SetBranchAddress("t_HitEnergies3", &t_HitEnergies3, &b_t_HitEnergies3); + Notify(); + + ifstream infile(dupFile); + if (!infile.is_open()) { + std::cout << "Cannot open " << dupFile << std::endl; + } else { + while (1) { + Long64_t jentry; + infile >> jentry; + if (!infile.good()) break; + entries_.push_back(jentry); + } + infile.close(); + std::cout << "Reads a list of " << entries_.size() << " events from " + << dupFile << std::endl; + } +} + +Bool_t EHcalVsRho::Notify() { + // The Notify() function is called when a new file is opened. This + // can be either for a new TTree in a TChain or when when a new TTree + // is started when using PROOF. It is normally not necessary to make changes + // to the generated code, but the routine can be extended by the + // user if needed. The return value is currently not used. + + return kTRUE; +} + +void EHcalVsRho::Show(Long64_t entry) { + // Print contents of entry. + // If entry is not specified, print current entry + if (!fChain) return; + fChain->Show(entry); +} + +Int_t EHcalVsRho::Cut(Long64_t) { + // This function may be called from Loop. + // returns 1 if entry is accepted. + // returns -1 otherwise. + return 1; +} + +void EHcalVsRho::LoopFill(int maxEta, const char *outFile, const char *logFile){ + if (fChain == 0) return; + TFile *f1 = new TFile(outFile,"RECREATE"); + char name[100], Title[100], graph[100], proji[100]; + + std::vector VIsoRho; + std::vector Hcal_corr; + for (int ieta = 0; ietaGetEntriesFast(); + std::cout << "Total # of entries: " << nentries << std::endl; + Long64_t nbytes = 0, nb = 0; + Long64_t kount(0), duplicate(0), good(0); + for (Long64_t jentry=0; jentryGetEntry(jentry); nbytes += nb; + + ++kount; + if (kount%100000 == 0) std::cout << "Processing Entry " << kount<=40) && (t_p<=60)) { + VIsoRho[absIeta-1]->Fill(t_rhoh,t_eHcal); + Hcal_corr[absIeta-1]->Fill(t_rhoh,t_eHcal); + ++good; + } + } + std::cout << "Uses " << good << " events out of " << kount << " excluding " + << duplicate << " duplicate events" << std::endl; + + gStyle->SetCanvasBorderMode(0); gStyle->SetCanvasColor(kWhite); + gStyle->SetPadColor(kWhite); gStyle->SetFillColor(kWhite); + gStyle->SetOptTitle(0); gStyle->SetOptFit(1); + std::ofstream myfile; + myfile.open(logFile); + for (int ieta=0; ietaWrite(); + Hcal_corr[ieta]->Write(); + TH2D *his_i = dynamic_cast(VIsoRho[ieta]->Clone()); + his_i ->GetEntries(); + int dim = his_i->GetXaxis()->GetNbins(); + double *xcut, *binc, *errXL, *errXH, *errYL, *errYH; + double *errX, *errY; + double errX1, errX2, xmax(0); + + xcut = new double[dim]; + binc = new double[dim]; + errX = new double[dim]; + errY = new double[dim]; + errXL = new double[dim]; + errXH = new double[dim]; + errYL = new double[dim]; + errYH = new double[dim]; + + for (int j= 0; j < dim; j++) { + sprintf (proji,"proj%d-%d",ieta+1,j); + TH1D* h_proj = dynamic_cast(his_i->ProjectionY(proji,j,j+1," ")); + binc[j] = his_i->GetXaxis()->GetBinCenter(j+1); + xcut[j] = EffCalc(h_proj,0.90,errX1,errX2); + + errXL[j]=0.0; + errXH[j]=0.0; + errYL[j]=errX1; + errYH[j]=errX2; + + errX[j]=0.0; + errY[j]=0.0; + h_proj->Write(); + if (xcut[j] > xmax) xmax = xcut[j]; + } + + TGraphAsymmErrors * Isovsrho = new TGraphAsymmErrors(dim,binc,xcut,errXL,errXH,errYL,errYH); + sprintf(graph,"IsovsRho%d",ieta+1); + sprintf(name,"EvsRho%d",ieta+1); + + TF1 *fnc = new TF1("fnc","[1]*x + [0]",4,13); + TFitResultPtr fitI = Isovsrho->Fit("fnc","+QSR"); + double ic = fnc->GetParameter(1); + double err = fitI->FitResult::Error(1); + myfile << ieta+1 << " " << ic << " " << err << std::endl; + std::cout << "Fit " << ieta+1 << " " << fnc->GetParameter(0) << " " + << fitI->FitResult::Error(0) << " " << ic << " " << err << "\n"; + gStyle->SetOptFit(1); + TCanvas *pad = new TCanvas(graph,name,0,10,1200,400); + pad->SetRightMargin(0.10); + pad->SetTopMargin(0.10); + Isovsrho->SetMarkerStyle(24); + Isovsrho->SetMarkerSize(0.4); + Isovsrho->GetXaxis()->SetRangeUser(0,15); + Isovsrho->GetXaxis()->SetTitle("#rho"); + Isovsrho->GetXaxis()->SetLabelSize(0.04); + Isovsrho->GetXaxis()->SetTitleSize(0.06); + Isovsrho->GetXaxis()->SetTitleOffset(0.8); + Isovsrho->GetYaxis()->SetRangeUser(0,1.25*xmax); + Isovsrho->GetYaxis()->SetTitle("Energy (GeV)"); + Isovsrho->GetYaxis()->SetLabelSize(0.04); + Isovsrho->GetYaxis()->SetTitleSize(0.06); + Isovsrho->GetYaxis()->SetTitleOffset(0.6); + Isovsrho->Draw("AP"); + pad->Update(); + TPaveStats* st1 = (TPaveStats*)Isovsrho->GetListOfFunctions()->FindObject("stats"); + if (st1 != nullptr) { + st1->SetY1NDC(0.78); st1->SetY2NDC(0.90); + st1->SetX1NDC(0.65); st1->SetX2NDC(0.90); + } + pad->Write(); + } + + myfile.close(); + f1->Close(); +} + +double EHcalVsRho::EffCalc(TH1D* h, double perc, double & errXL, + double & errXH) { + double eff, eff_err=0.0, xCut=0.0; + int tot = h->GetEntries(); + int integ = 0; + errXL = 0.0; + errXH = 0.0; + for(int i = 0; i < (h->GetXaxis()->GetNbins()+1 ); i++) { + xCut = h->GetXaxis()->GetBinLowEdge(i); + integ += h->GetBinContent(i); + + if (integ != 0 && tot != 0 ) { + eff = (integ*1.0/tot); + eff_err = sqrt ( eff * ( 1 - eff ) / tot ) ; + } else { + eff = 0.0; + } + if (eff > perc) break; + } + if (eff == 0.0) xCut = 0.0; + errXL = eff_err; + errXH = eff_err; + return xCut; +} + +void EHcalVsRho::LoopTest(int maxEta, const char *inFile, const char *outFile) { + + if (fChain == 0) return; + + TFile *f1 = new TFile(outFile,"RECREATE"); + std::map histo, histo_uncorr; + char name[100], title[100]; + for (int ieta =-maxEta; ieta<=maxEta; ieta++) { + sprintf(name, "MPV%d",ieta); + sprintf(title, "Corrected Response (i#eta = %d)", ieta-30); + histo[ieta] = new TH1D(name, title, 100, 0, 2); + sprintf(name, "MPVUn%d",ieta); + sprintf(title, "Uncorrected Response (i#eta = %d)", ieta-30); + histo_uncorr[ieta] = new TH1D(name, title, 100, 0, 2); + } + std::cout << "Initialized histograms from " << -maxEta << ":" << maxEta<<"\n"; + + double par[10]; + ifstream myReadFile; + myReadFile.open(inFile); + int npar = 0; + if (myReadFile.is_open()) { + while (!myReadFile.eof()) { + myReadFile >> par[npar]; + ++npar; + } + } + myReadFile.close(); + std::cout << "Reads " << npar << " parameters:"; + for (int k=0; k 40) && (t_p < 60.0)); + if (select) { + double corr_eHcal = 0.0; + int absIeta = abs(t_ieta); + ++good; + if (absIeta <= maxEta) { + corr_eHcal = t_eHcal - t_rhoh*getEA(absIeta,par); + double myEovP = corr_eHcal/(t_p-t_eMipDR); + double myEovP_uncorr = t_eHcal/(t_p-t_eMipDR); + histo[t_ieta]->Fill(myEovP); + histo_uncorr[t_ieta]->Fill(myEovP_uncorr); + } + } + } + + for (std::map::iterator itr=histo.begin(); + itr != histo.end(); ++itr) itr->second->Write(); + for (std::map::iterator itr=histo_uncorr.begin(); + itr != histo_uncorr.end(); ++itr) itr->second->Write(); + f1->Close(); + std::cout << "Processes " << good << " out of " << kount << " events with " + << duplicate << " duplicate entries" << std::endl; +} + +double EHcalVsRho::getEA(const int eta, const double* par) { + double eA; + if (eta<20) + eA = par[0]; + else + eA = (((par[5]*eta+par[4])*eta+par[3])*eta+par[2])*eta+par[1]; + return eA; +} + +void FitEvsRho(const char *inFile, const char *outFile, const char *rootFile) { + + const int ndim=30; + double EA[ndim] = {0.0}; + double errEA[ndim]={0.0}; + double ietaEA[ndim]={0.0}; + ifstream myReadFile; + myReadFile.open(inFile); + + int ii = 0; + if (myReadFile.is_open()) { + while (!myReadFile.eof()) { + myReadFile >> ietaEA[ii] >> EA[ii] >> errEA[ii]; + if (EA[ii] < 0) EA[ii] = 0; + ii++; + } + } + myReadFile.close(); + std::cout << "Reads " << ii << " points from " << inFile << std::endl; + + gStyle->SetCanvasBorderMode(0); gStyle->SetCanvasColor(kWhite); + gStyle->SetPadColor(kWhite); gStyle->SetFillColor(kWhite); + gStyle->SetOptTitle(0); gStyle->SetOptStat(0); + gStyle->SetOptFit(0); + TFile *f1 = new TFile(rootFile,"RECREATE"); + TGraphErrors * eA = new TGraphErrors(ii,ietaEA,EA,errEA,errEA); + eA->SetMarkerStyle(20); eA->SetMarkerColor(4); + eA->SetLineColor(2); + eA->GetXaxis()->SetTitle("i#eta"); + eA->GetXaxis()->SetTitleOffset(0.6); + eA->GetXaxis()->SetTitleSize(0.06); + eA->GetYaxis()->SetTitle("Effective Area"); + eA->GetYaxis()->SetTitleOffset(0.6); + eA->GetYaxis()->SetTitleSize(0.06); + + Double_t par[6]; + const int nmid=19; + TF1 *g1 = new TF1("g1","pol0",1,nmid); + TF1 *g2 = new TF1("g2","pol4",nmid,ii); + + eA->Fit(g1,"R"); + eA->Fit(g2,"R+"); + g1->GetParameters(&par[0]); + g2->GetParameters(&par[1]); + + TCanvas *c2 = new TCanvas("EA vs #eta","EA vs ieta",0,10,1200,400); + eA->Draw("AP"); + c2->Write(); + f1->Close(); + + ofstream params; + params.open(outFile); + for (int i=0; i<6; i++) { + params << par[i] << endl; + std::cout << "Parameter[" << i << "] = " << par[i] << std::endl; + } + params.close(); +} + +void FitEovPwithRho(int maxEta, const char *inFile, const char *outFile) { + + TFile *file = new TFile(inFile); + std::map histo, histo_uncorr; + char name[100]; + for (int ieta =-maxEta; ieta<=maxEta; ieta++) { + sprintf(name, "MPV%d",ieta); + TH1D* h0 = (TH1D*)file->FindObjectAny(name); + histo[ieta] = (h0 != 0) ? (TH1D*)(h0->Clone()) : 0; + sprintf(name, "MPVUn%d",ieta); + TH1D* h1 = (TH1D*)file->FindObjectAny(name); + histo_uncorr[ieta] = (h1 != 0) ? (TH1D*)(h1->Clone()) : 0; + } + +//TFile *f1 = + new TFile(outFile,"RECREATE"); + double xlim = maxEta + 0.5; + TH1D* EovPvsieta = new TH1D("Corrected","Corrected",2*maxEta+1,-xlim,xlim); + TH1D* EovPvsieta_uncorr = new TH1D("Uncorrect","Uncorrect",2*maxEta+1,-xlim,xlim); + + TF1* fnc = new TF1("fnc","gaus"); + unsigned int k1(0), k2(0); + for (int ieta=-maxEta; ieta<=maxEta; ieta++) { + if (ieta == 0) continue; + if (histo[ieta] != 0) { + double mean = histo[ieta]->GetMean(); + double rms = histo[ieta]->GetRMS(); + TFitResultPtr FitG = histo[ieta]->Fit("fnc","QRWLS","",mean-rms,mean+rms); + double a = fnc->GetParameter(1); + double err = FitG->FitResult::Error(1); + histo[ieta]->Write(); + ++k1; + int ibin = ieta+maxEta+1; + EovPvsieta->SetBinContent(ibin,a); + EovPvsieta->SetBinError(ibin,err); + std::cout << "Correct[" << k1 << "] " << ieta << " a " << a << " +- " + << err << std::endl; + } + + if (histo_uncorr[ieta] != 0) { + double mean = histo_uncorr[ieta]->GetMean(); + double rms = histo_uncorr[ieta]->GetRMS(); + TFitResultPtr FitG = histo_uncorr[ieta]->Fit("fnc","QRWLS","",mean-rms,mean+rms); + double a = fnc->GetParameter(1); + double err = FitG->FitResult::Error(1); + histo_uncorr[ieta]->Write(); + ++k2; + int ibin = ieta+maxEta+1; + EovPvsieta_uncorr->SetBinContent(ibin,a); + EovPvsieta_uncorr->SetBinError(ibin,err); + std::cout << "Correct[" << k2 << "] " << ieta << " a " << a << " +- " + << err << std::endl; + } + } + + gStyle->SetCanvasBorderMode(0); gStyle->SetCanvasColor(kWhite); + gStyle->SetPadColor(kWhite); gStyle->SetFillColor(kWhite); + gStyle->SetOptTitle(0); + gStyle->SetOptStat(10); gStyle->SetOptFit(1); + TCanvas *c3 = new TCanvas("E/P vs ieta","E/P vs ieta",0,10,1200,400); + EovPvsieta->GetXaxis()->SetTitle("i#eta"); + EovPvsieta->GetYaxis()->SetTitle("MPV[E_{Hcal}/(p_{Track}-E_{Ecal})]"); + EovPvsieta->SetMarkerStyle(20); EovPvsieta->SetMarkerColor(2); + EovPvsieta->SetMarkerSize(1.0); + EovPvsieta->Fit("pol0","+QRWLS","",-maxEta,maxEta); + + EovPvsieta_uncorr->SetMarkerStyle(24); EovPvsieta_uncorr->SetMarkerColor(4); + EovPvsieta_uncorr->SetMarkerSize(1.0); + + EovPvsieta->GetYaxis()->SetRangeUser(0.5,2.0); + EovPvsieta->Draw(); + c3->Update(); + TPaveStats* st1 = (TPaveStats*)EovPvsieta->GetListOfFunctions()->FindObject("stats"); + if (st1 != nullptr) { + st1->SetY1NDC(0.81); st1->SetY2NDC(0.90); + st1->SetX1NDC(0.65); st1->SetX2NDC(0.90); + } + EovPvsieta_uncorr->Draw("sames"); + c3->Update(); + st1 = (TPaveStats*)EovPvsieta_uncorr->GetListOfFunctions()->FindObject("stats"); + std::cout << st1 << std::endl; + if (st1 != nullptr) { + st1->SetY1NDC(0.78); st1->SetY2NDC(0.81); + st1->SetX1NDC(0.65); st1->SetX2NDC(0.90); + } + c3->Modified(); + c3->Update(); + EovPvsieta->Write(); + EovPvsieta_uncorr->Write(); +} + +void PlotEvsRho(const char* inFile, int type=-1, bool save=false) { + + gStyle->SetCanvasBorderMode(0); gStyle->SetCanvasColor(kWhite); + gStyle->SetPadColor(kWhite); gStyle->SetFillColor(kWhite); + gStyle->SetOptTitle(0); + gStyle->SetOptStat(10); gStyle->SetOptFit(1); + + TFile *file = new TFile(inFile); + int itmin = (type > 0) ? type : 1; + int itmax = (type > 0) ? type : 25; + for (int it = itmin; it <= itmax; ++it) { + char name[50]; + sprintf (name, "IsovsRho%d", it); + TCanvas* pad = (TCanvas*)file->FindObjectAny(name); + pad->Draw(); + if (save) { + sprintf (name, "%s.pdf", pad->GetName()); + pad->Print(name); + } + } +} diff --git a/Calibration/IsolatedParticles/plugins/StudyHLT.cc b/Calibration/IsolatedParticles/plugins/StudyHLT.cc index 027ce346d8a8a..7aa64a7684ce3 100644 --- a/Calibration/IsolatedParticles/plugins/StudyHLT.cc +++ b/Calibration/IsolatedParticles/plugins/StudyHLT.cc @@ -104,7 +104,7 @@ class StudyHLT : public edm::one::EDAnalyzer&); // ----------member data --------------------------- - static const int nPBin_=10, nEtaBin_=4, nPVBin_=4; + static const int nPBin_=15, nEtaBin_=4, nPVBin_=4; static const int nGen_=(nPVBin_+12); HLTConfigProvider hltConfig_; edm::Service fs_; @@ -113,7 +113,7 @@ class StudyHLT : public edm::one::EDAnalyzer puWeights_; const edm::InputTag triggerEvent_, theTriggerResultsLabel_; spr::trackSelectionParameters selectionParameters_; @@ -135,8 +135,8 @@ class StudyHLT : public edm::one::EDAnalyzer h_HLTAccepts; - TH1D *h_p[nGen_+2], *h_pt[nGen_+2]; - TH1D *h_eta[nGen_+2], *h_phi[nGen_+2]; + TH1D *h_p[nGen_+2], *h_pt[nGen_+2], *h_counter[8]; + TH1D *h_eta[nGen_+2], *h_phi[nGen_+2], *h_h_pNew[8]; TH1I *h_ntrk[2]; TH1D *h_maxNearP[2], *h_ene1[2], *h_ene2[2], *h_ediff[2]; TH1D *h_energy[nPVBin_+8][nPBin_][nEtaBin_][6]; @@ -166,6 +166,7 @@ StudyHLT::StudyHLT(const edm::ParameterSet& iConfig) : tMinH_(iConfig.getUntrackedParameter("timeMinCutHCAL",-500.)), tMaxH_(iConfig.getUntrackedParameter("timeMaxCutHCAL",500.)), isItAOD_(iConfig.getUntrackedParameter("isItAOD",false)), + vetoTrigger_(iConfig.getUntrackedParameter("vetoTrigger",false)), doTree_(iConfig.getUntrackedParameter("doTree",false)), puWeights_(iConfig.getUntrackedParameter >("puWeights")), triggerEvent_(edm::InputTag("hltTriggerSummaryAOD","","HLT")), @@ -221,9 +222,11 @@ StudyHLT::StudyHLT(const edm::ParameterSet& iConfig) : << minTrackP_ << " maxTrackEta " << maxTrackEta_ << " tMinE_ " << tMinE_ << " tMaxE " << tMaxE_ << " tMinH_ " << tMinH_ << " tMaxH_ " << tMaxH_ - << " isItAOD " << isItAOD_ << " doTree " << doTree_; + << " isItAOD " << isItAOD_ << " doTree " << doTree_ + << " vetoTrigger " << vetoTrigger_; - double pBins[nPBin_+1] = {1.0,2.0,3.0,4.0,5.0,6.0,7.0,9.0,11.0,15.0,20.0}; + double pBins[nPBin_+1] = {1.0,2.0,3.0,4.0,5.0,6.0,7.0,9.0,11.0,15.0,20.0, + 25.0,30.0,40.0,60.0,100.0}; int etaBins[nEtaBin_+1] = {1, 7, 13, 17, 23}; int pvBins[nPVBin_+1] = {1, 2, 3, 5, 100}; for (int i=0; i<=nPBin_; ++i) pBin_[i] = pBins[i]; @@ -262,6 +265,7 @@ void StudyHLT::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { desc.addUntracked("timeMinCutHCAL",-500.0); desc.addUntracked("timeMaxCutHCAL", 500.0); desc.addUntracked("isItAOD", false); + desc.addUntracked("vetoTrigger", false); desc.addUntracked("doTree", false); desc.addUntracked >("puWeights", weights); descriptions.add("studyHLT",desc); @@ -269,6 +273,14 @@ void StudyHLT::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { void StudyHLT::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) { clear(); + int counter0[1000] = {0}; + int counter1[1000] = {0}; + int counter2[1000] = {0}; + int counter3[1000] = {0}; + int counter4[1000] = {0}; + int counter5[1000] = {0}; + int counter6[1000] = {0}; + int counter7[1000] = {0}; if (verbosity_ > 0) edm::LogInfo("IsoTrack") << "Event starts===================================="; int RunNo = iEvent.id().run(); @@ -310,8 +322,6 @@ void StudyHLT::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) const edm::TriggerNames & triggerNames = iEvent.triggerNames(*triggerResults); const std::vector & triggerNames_ = triggerNames.triggerNames(); for (unsigned int iHLT=0; iHLTsize(); iHLT++) { - // unsigned int triggerindx = hltConfig_.triggerIndex(triggerNames_[iHLT]); - // const std::vector& moduleLabels(hltConfig_.moduleLabels(triggerindx)); int ipos=-1; std::string newtriggerName = truncate_str(triggerNames_[iHLT]); for (unsigned int i=0; i 0) @@ -470,6 +481,10 @@ void StudyHLT::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) bool quality = pTrack->quality(selectionParameters_.minQuality); fillTrack(0, pt1,p1,eta1,phi1); if (quality) fillTrack(1, pt1,p1,eta1,phi1); + if (p1<1000) { + h_h_pNew[0]->Fill(p1); + ++counter0[(int)(p1)]; + } } h_ntrk[0]->Fill(ntrk,tr_eventWeight); @@ -568,15 +583,53 @@ void StudyHLT::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) fillTrack(nPVBin_+trackID+7, pt1,p1,eta1,phi1); fillEnergy(nPVBin_+trackID+3,ieta,p1,e7x7P.first,h3x3,e11x11P.first,h5x5); } + if (p1<1000) { + h_h_pNew[7]->Fill(p1); + ++counter7[(int)(p1)]; + } + } + if (p1<1000) { + h_h_pNew[6]->Fill(p1); + ++counter6[(int)(p1)]; } } + if (p1<1000) { + h_h_pNew[5]->Fill(p1); + ++counter5[(int)(p1)]; + } + } + if (p1<1000) { + h_h_pNew[4]->Fill(p1); + ++counter4[(int)(p1)]; } } + if (p1<1000) { + h_h_pNew[3]->Fill(p1); + ++counter3[(int)(p1)]; + } } + if (p1<1000) { + h_h_pNew[2]->Fill(p1); + ++counter2[(int)(p1)]; + } + } + if (p1<1000) { + h_h_pNew[1]->Fill(p1); + ++counter1[(int)(p1)]; } } h_ntrk[1]->Fill(ntrk,tr_eventWeight); if ((!tr_TrkPt.empty()) && doTree_) tree_->Fill(); + for (int i=0; i <1000; ++i) { + if (counter0[i]) h_counter[0]->Fill(i, counter0[i]); + if (counter1[i]) h_counter[1]->Fill(i, counter1[i]); + if (counter2[i]) h_counter[2]->Fill(i, counter2[i]); + if (counter3[i]) h_counter[3]->Fill(i, counter3[i]); + if (counter4[i]) h_counter[4]->Fill(i, counter4[i]); + if (counter5[i]) h_counter[5]->Fill(i, counter5[i]); + if (counter6[i]) h_counter[6]->Fill(i, counter6[i]); + if (counter7[i]) h_counter[7]->Fill(i, counter7[i]); + } } firstEvent_ = false; } @@ -709,13 +762,22 @@ void StudyHLT::beginJob() { (etaBin_[ie+1]-1), particle[i-4-nPVBin_].c_str(), TrkNames[7].c_str()); } - h_energy[i][ip][ie][j] = fs_->make(hname, htit, 500, -0.1, 4.9); + h_energy[i][ip][ie][j] = fs_->make(hname, htit, 5000,-0.1,49.9); h_energy[i][ip][ie][j]->Sumw2(); } } } } + for (int i=0; i<8; ++i) { + sprintf(hname,"counter%d",i); + sprintf(htit,"Counter with cut %d",i); + h_counter[i] = fs_->make(hname, htit, 1000, 0, 1000); + sprintf(hname,"h_pTNew%d",i); + sprintf(htit,"Track momentum with cut %d",i); + h_h_pNew[i] = fs_->make(hname, htit, 1000, 0, 1000); + } + // Now the tree if (doTree_) { tree_ = fs_->make("testTree", "new HLT Tree"); From ee5d0bf02137e36ba21c40e8c9fe5affdf1250a7 Mon Sep 17 00:00:00 2001 From: silviodonato Date: Sat, 31 Mar 2018 10:30:16 +0200 Subject: [PATCH 297/426] fix seg fault using hltGetConfiguration --l1-emulator uGT --- HLTrigger/Configuration/python/CustomConfigs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HLTrigger/Configuration/python/CustomConfigs.py b/HLTrigger/Configuration/python/CustomConfigs.py index bda6a99b80db3..ac0366e061f0f 100644 --- a/HLTrigger/Configuration/python/CustomConfigs.py +++ b/HLTrigger/Configuration/python/CustomConfigs.py @@ -134,7 +134,7 @@ def L1REPACK(process,sequence="Full"): getattr(process,path).insert(0,process.SimL1Emulator) # special L1T cleanup - for obj in ('SimL1TCalorimeter','SimL1TMuonCommon','SimL1TMuon','SimL1TechnicalTriggers','SimL1EmulatorCore','ecalDigiSequence','hcalDigiSequence','calDigi','me0TriggerPseudoDigiSequence'): + for obj in ('SimL1TCalorimeter','SimL1TMuonCommon','SimL1TMuon','SimL1TechnicalTriggers','SimL1EmulatorCore','ecalDigiSequence','hcalDigiSequence','calDigi','me0TriggerPseudoDigiSequence','hgcalTriggerGeometryESProducer'): if hasattr(process,obj): delattr(process,obj) From dba04ff77cdee8e9eb5b301f68f0595495cb39f0 Mon Sep 17 00:00:00 2001 From: Malik Shahzad Muzaffar Date: Sat, 31 Mar 2018 10:52:57 +0200 Subject: [PATCH 298/426] Revert "Make Timing Service work with SubProcess" --- FWCore/Services/plugins/Timing.cc | 136 ++++++------------------------ 1 file changed, 25 insertions(+), 111 deletions(-) diff --git a/FWCore/Services/plugins/Timing.cc b/FWCore/Services/plugins/Timing.cc index b0a5925ccef5c..d95ac557d6aaa 100644 --- a/FWCore/Services/plugins/Timing.cc +++ b/FWCore/Services/plugins/Timing.cc @@ -18,14 +18,11 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/ServiceRegistry/interface/ActivityRegistry.h" -#include "FWCore/ServiceRegistry/interface/GlobalContext.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/ServiceRegistry/interface/StreamContext.h" #include "FWCore/ServiceRegistry/interface/ModuleCallingContext.h" -#include "FWCore/ServiceRegistry/interface/ProcessContext.h" #include "FWCore/ServiceRegistry/interface/SystemBounds.h" #include "FWCore/Utilities/interface/Exception.h" -#include "FWCore/Utilities/interface/thread_safety_macros.h" #include #include @@ -55,13 +52,11 @@ namespace edm { private: - void preBeginJob(PathsAndConsumesOfModulesBase const&, ProcessContext const&); void postBeginJob(); void postEndJob(); void preEvent(StreamContext const&); void postEvent(StreamContext const&); - void lastPostEvent(double curr_event_time, unsigned int index, StreamContext const& iStream); void postModuleEvent(StreamContext const&, ModuleCallingContext const&); @@ -138,16 +133,10 @@ namespace edm { CountAndTime countAndTimeZero_; std::atomic countAndTimeForLock_; - CMS_THREAD_GUARD(countAndTimeForLock_) double accumulatedTimeForLock_; + double accumulatedTimeForLock_; std::atomic countAndTimeForGet_; - CMS_THREAD_GUARD(countAndTimeForGet_) double accumulatedTimeForGet_; - - std::vector>> countSubProcessesPreEvent_; - std::vector>> countSubProcessesPostEvent_; - - bool configuredInTopLevelProcess_; - unsigned int nSubProcesses_; + double accumulatedTimeForGet_; }; } } @@ -213,10 +202,7 @@ namespace edm { } static - void pushStack(bool configuredInTopLevelProcess) { - if (!configuredInTopLevelProcess) { - return; - } + void pushStack() { auto& modStack = moduleTimeStack(); modStack.push_back(getTime()); } @@ -240,11 +226,8 @@ namespace edm { countAndTimeForLock_{&countAndTimeZero_}, accumulatedTimeForLock_{0.0}, countAndTimeForGet_{&countAndTimeZero_}, - accumulatedTimeForGet_{0.0}, - configuredInTopLevelProcess_{false}, - nSubProcesses_{0} { + accumulatedTimeForGet_{0.0} { - iRegistry.watchPreBeginJob(this, &Timing::preBeginJob); iRegistry.watchPostBeginJob(this, &Timing::postBeginJob); iRegistry.watchPostEndJob(this, &Timing::postEndJob); @@ -325,12 +308,9 @@ namespace edm { sum_events_time_.resize(nStreams_,0.); max_events_time_.resize(nStreams_,0.); min_events_time_.resize(nStreams_,1.E6); - for (unsigned int i = 0; i < nStreams_; ++i) { - countSubProcessesPreEvent_.emplace_back(std::make_unique>(0)); - countSubProcessesPostEvent_.emplace_back(std::make_unique>(0)); - } + }); - + iRegistry.postGlobalEndRunSignal_.connect([this](edm::GlobalContext const&) { last_run_time_ = getTime(); last_run_cpu_ = getCPU(); @@ -363,18 +343,7 @@ namespace edm { "This service reports the time it takes to run each module in a job."); } - void Timing::preBeginJob(PathsAndConsumesOfModulesBase const& pathsAndConsumes, ProcessContext const& pc) { - if (pc.isSubProcess()) { - ++nSubProcesses_; - } else { - configuredInTopLevelProcess_ = true; - } - } - void Timing::postBeginJob() { - if (!configuredInTopLevelProcess_) { - return; - } curr_job_time_ = getTime(); curr_job_cpu_ = getCPU(); @@ -390,14 +359,6 @@ namespace edm { } void Timing::postEndJob() { - - if (!configuredInTopLevelProcess_) { - LogImportant("TimeReport") << "\nTimeReport> This instance of the Timing Service will be disabled because it is configured in a SubProcess.\n" - << "If multiple instances of the TimingService were configured only the one in the top level process will function.\n" - << "The other instance(s) will simply print this message and do nothing.\n\n"; - return; - } - const double job_end_time =getTime(); const double job_end_cpu =getCPU(); double total_job_time = job_end_time - jobStartTime(); @@ -492,48 +453,23 @@ namespace edm { } void Timing::preEvent(StreamContext const& iStream) { - if (!configuredInTopLevelProcess_) { - return; - } auto index = iStream.streamID().value(); - if (nSubProcesses_ == 0u) { - curr_events_time_[index] = getTime(); - } else { - unsigned int count = ++(*countSubProcessesPreEvent_[index]); - if (count == 1) { - curr_events_time_[index] = getTime(); - } else if (count == (nSubProcesses_ + 1)) { - *countSubProcessesPreEvent_[index] = 0; - } - } + curr_events_time_[index] = getTime(); } void Timing::postEvent(StreamContext const& iStream) { - if (!configuredInTopLevelProcess_) { - return; - } auto index = iStream.streamID().value(); - if (nSubProcesses_ == 0u) { - lastPostEvent(getTime() - curr_events_time_[index], index, iStream); - } else { - unsigned int count = ++(*countSubProcessesPostEvent_[index]); - if (count == (nSubProcesses_ + 1)) { - lastPostEvent(getTime() - curr_events_time_[index], index, iStream); - *countSubProcessesPostEvent_[index] = 0; - } - } - } - void Timing::lastPostEvent(double curr_event_time, unsigned int index, StreamContext const& iStream) { + double curr_event_time = getTime() - curr_events_time_[index]; sum_events_time_[index] +=curr_event_time; if(not summary_only_) { auto const & eventID = iStream.eventID(); LogPrint("TimeEvent") - << "TimeEvent> " - << eventID.event() << " " - << eventID.run() << " " - << curr_event_time ; + << "TimeEvent> " + << eventID.event() << " " + << eventID.run() << " " + << curr_event_time ; } if(curr_event_time > max_events_time_[index]) max_events_time_[index] = curr_event_time; if(curr_event_time < min_events_time_[index]) min_events_time_[index] = curr_event_time; @@ -541,9 +477,6 @@ namespace edm { } void Timing::postModuleEvent(StreamContext const& iStream, ModuleCallingContext const& iModule) { - if (!configuredInTopLevelProcess_) { - return; - } auto const & eventID = iStream.eventID(); auto const & desc = *(iModule.moduleDescription()); double t = postCommon(); @@ -558,7 +491,7 @@ namespace edm { } void Timing::preSourceEvent(StreamID sid) { - pushStack(configuredInTopLevelProcess_); + pushStack(); } void Timing::postSourceEvent(StreamID sid) { @@ -566,7 +499,7 @@ namespace edm { } void Timing::preSourceLumi(LuminosityBlockIndex index) { - pushStack(configuredInTopLevelProcess_); + pushStack(); } void Timing::postSourceLumi(LuminosityBlockIndex index) { @@ -574,7 +507,7 @@ namespace edm { } void Timing::preSourceRun(RunIndex index) { - pushStack(configuredInTopLevelProcess_); + pushStack(); } void Timing::postSourceRun(RunIndex index) { @@ -582,7 +515,7 @@ namespace edm { } void Timing::preOpenFile(std::string const& lfn, bool b) { - pushStack(configuredInTopLevelProcess_); + pushStack(); } void Timing::postOpenFile(std::string const& lfn, bool b) { @@ -591,7 +524,7 @@ namespace edm { void Timing::preModule(ModuleDescription const&) { - pushStack(configuredInTopLevelProcess_); + pushStack(); } void @@ -601,7 +534,7 @@ namespace edm { void Timing::preModuleGlobal(GlobalContext const&, ModuleCallingContext const&) { - pushStack(configuredInTopLevelProcess_); + pushStack(); } void @@ -610,28 +543,18 @@ namespace edm { } void - Timing::postGlobalBeginRun(GlobalContext const& gc) { - if (!configuredInTopLevelProcess_) { - return; - } - if (!gc.processContext()->isSubProcess()) { - ++begin_run_count_; - } + Timing::postGlobalBeginRun(GlobalContext const&) { + ++begin_run_count_; } void - Timing::postGlobalBeginLumi(GlobalContext const& gc) { - if (!configuredInTopLevelProcess_) { - return; - } - if (!gc.processContext()->isSubProcess()) { - ++begin_lumi_count_; - } + Timing::postGlobalBeginLumi(GlobalContext const&) { + ++begin_lumi_count_; } void Timing::preModuleStream(StreamContext const&, ModuleCallingContext const&) { - pushStack(configuredInTopLevelProcess_); + pushStack(); } void @@ -641,9 +564,6 @@ namespace edm { double Timing::postCommon() const { - if (!configuredInTopLevelProcess_) { - return 0.0; - } double t = popStack(); if(t > threshold_) { LogError("ExcessiveTime") @@ -659,9 +579,6 @@ namespace edm { eventsetup::EventSetupRecordKey const&, eventsetup::DataKey const&) { - if (!configuredInTopLevelProcess_) { - return; - } accumulateTimeBegin(countAndTimeForLock_, accumulatedTimeForLock_); } @@ -670,9 +587,6 @@ namespace edm { eventsetup::EventSetupRecordKey const&, eventsetup::DataKey const&) { - if (!configuredInTopLevelProcess_) { - return; - } accumulateTimeEnd(countAndTimeForLock_, accumulatedTimeForLock_); accumulateTimeBegin(countAndTimeForGet_, accumulatedTimeForGet_); } @@ -694,7 +608,7 @@ namespace edm { CountAndTime* oldStat = countAndTime.load(); while (oldStat == nullptr || !countAndTime.compare_exchange_strong(oldStat, nullptr)) { - // do nothing + oldStat = countAndTime.load(); } newStat->count_ = oldStat->count_ + 1; @@ -715,7 +629,7 @@ namespace edm { CountAndTime* oldStat = countAndTime.load(); while (oldStat == nullptr || !countAndTime.compare_exchange_strong(oldStat, nullptr)) { - // do nothing + oldStat = countAndTime.load(); } if (oldStat->count_ == 1) { From 293293eb233b8ef063a20002bfb210030de923f1 Mon Sep 17 00:00:00 2001 From: Andrew Brinkerhoff Date: Mon, 2 Apr 2018 13:45:51 +0200 Subject: [PATCH 299/426] Whitespace cleanup of EMTF related files --- DataFormats/L1TMuon/interface/EMTFTrack.h | 23 +-- DataFormats/L1TMuon/src/EMTFHit.cc | 8 +- .../L1TMuon/interface/GeometryTranslator.h | 2 +- .../L1TMuon/interface/MuonTriggerPrimitive.h | 26 ++-- .../interface/MuonTriggerPrimitiveFwd.h | 4 +- L1Trigger/L1TMuon/src/GeometryTranslator.cc | 108 ++++++------- L1Trigger/L1TMuon/src/MuonTriggerPrimitive.cc | 17 ++- L1Trigger/L1TMuonEndCap/interface/Common.h | 8 +- .../interface/EndCapParamsHelper.h | 8 +- .../interface/PtAssignmentEngineAux2017.h | 4 +- .../L1TMuonEndCap/interface/PtLutVarCalc.h | 14 +- L1Trigger/L1TMuonEndCap/interface/bdt/Event.h | 8 +- .../L1TMuonEndCap/interface/bdt/Forest.h | 8 +- .../interface/bdt/LossFunctions.h | 52 +++---- L1Trigger/L1TMuonEndCap/interface/bdt/Node.h | 2 +- .../plugins/L1TMuonEndCapForestESProducer.cc | 6 +- .../plugins/L1TMuonEndCapParamsESProducer.cc | 4 +- .../L1TMuonEndCap/src/AngleCalculation.cc | 4 +- .../L1TMuonEndCap/src/BestTrackSelection.cc | 4 +- .../L1TMuonEndCap/src/EndCapParamsHelper.cc | 8 +- .../L1TMuonEndCap/src/MicroGMTConverter.cc | 16 +- .../L1TMuonEndCap/src/PrimitiveConversion.cc | 8 +- .../L1TMuonEndCap/src/PrimitiveSelection.cc | 28 ++-- L1Trigger/L1TMuonEndCap/src/PtAssignment.cc | 6 +- .../L1TMuonEndCap/src/PtAssignmentEngine.cc | 8 +- .../src/PtAssignmentEngine2016.cc | 2 +- .../src/PtAssignmentEngine2017.cc | 144 +++++++++--------- .../src/PtAssignmentEngineAux2017.cc | 114 +++++++------- L1Trigger/L1TMuonEndCap/src/PtLUTWriter.cc | 2 +- L1Trigger/L1TMuonEndCap/src/PtLutVarCalc.cc | 102 ++++++------- .../L1TMuonEndCap/src/SectorProcessor.cc | 28 ++-- .../L1TMuonEndCap/src/SectorProcessorLUT.cc | 2 +- L1Trigger/L1TMuonEndCap/src/SingleHitTrack.cc | 78 +++++----- L1Trigger/L1TMuonEndCap/src/TrackFinder.cc | 2 +- L1Trigger/L1TMuonEndCap/src/bdt/Forest.cc | 82 +++++----- L1Trigger/L1TMuonEndCap/src/bdt/Node.cc | 48 +++--- L1Trigger/L1TMuonEndCap/src/bdt/Tree.cc | 76 ++++----- L1Trigger/L1TMuonEndCap/src/bdt/Utilities.cc | 2 +- .../test/unittests/TestPhiMemoryImage.cpp | 2 +- 39 files changed, 535 insertions(+), 533 deletions(-) diff --git a/DataFormats/L1TMuon/interface/EMTFTrack.h b/DataFormats/L1TMuon/interface/EMTFTrack.h index 058fad7e73a97..d97a237bc25b1 100644 --- a/DataFormats/L1TMuon/interface/EMTFTrack.h +++ b/DataFormats/L1TMuon/interface/EMTFTrack.h @@ -13,7 +13,7 @@ #include "DataFormats/L1TMuon/interface/EMTF/SP.h" namespace l1t { - + struct EMTFPtLUT { uint64_t address; uint16_t mode; @@ -31,31 +31,31 @@ namespace l1t { uint16_t bt_ci [5]; // ^ uint16_t bt_si [5]; // ^ }; - - + + class EMTFTrack { public: - - EMTFTrack() : - _PtLUT(), endcap(-99), sector(-99), sector_idx(-99), + + EMTFTrack() : + _PtLUT(), endcap(-99), sector(-99), sector_idx(-99), mode(-99), mode_CSC(0), mode_RPC(0), mode_neighbor(0), mode_inv(-99), rank(-99), winner(-99), charge(-99), bx(-99), first_bx(-99), second_bx(-99), pt(-99), pt_XML(-99), zone(-99), ph_num(-99), ph_q(-99), theta_fp(-99), theta(-99), eta(-99), phi_fp(-99), phi_loc(-99), phi_glob(-999), gmt_pt(-99), gmt_phi(-999), gmt_eta(-999), gmt_quality(-99), gmt_charge(-99), gmt_charge_valid(-99), - track_num(-99), numHits(-99) + track_num(-99), numHits(-99) {}; - + virtual ~EMTFTrack() {}; - + void ImportSP( const emtf::SP _SP, int _sector ); // void ImportPtLUT( int _mode, unsigned long _address ); - void clear_Hits() { _Hits.clear(); numHits = 0; mode_CSC = 0; mode_RPC = 0; mode_neighbor = 0; } + void push_Hit(const EMTFHit& hit) { _Hits.push_back( hit ); numHits = _Hits.size(); @@ -63,10 +63,11 @@ namespace l1t { mode_RPC += ( hit.Is_RPC() ? pow(2, 4 - hit.Station()) : 0 ); mode_neighbor += ( hit.Neighbor() ? pow(2, 4 - hit.Station()) : 0 ); } + void set_Hits(const EMTFHitCollection& hits) { clear_Hits(); for (const auto& hit : hits) - push_Hit( hit ); + push_Hit( hit ); } void set_HitIdx(const std::vector& bits) { _HitIdx = bits; } diff --git a/DataFormats/L1TMuon/src/EMTFHit.cc b/DataFormats/L1TMuon/src/EMTFHit.cc index cbefb8507a09c..96794539cfcfe 100644 --- a/DataFormats/L1TMuon/src/EMTFHit.cc +++ b/DataFormats/L1TMuon/src/EMTFHit.cc @@ -5,11 +5,11 @@ namespace l1t { CSCDetId EMTFHit::CreateCSCDetId() const { return CSCDetId( (endcap == 1) ? 1 : 2, station, - (ring == 4) ? 1 : ring, chamber, 0 ); + (ring == 4) ? 1 : ring, chamber, 0 ); // Layer always filled as 0 (indicates "whole chamber") // See http://cmslxr.fnal.gov/source/L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.cc#0198 } - + // // Not yet implemented - AWB 15.03.17 // RPCDetId EMTFHit::CreateRPCDetId() const { // return RPCDetId( endcap, ring, station, sector, rpc_layer, subsector, roll ); @@ -23,10 +23,10 @@ namespace l1t { // May consider filling "trknmb" with 2 for 2nd LCT in the same chamber. - AWB 24.05.17 // trknmb and bx0 are unused in the EMTF emulator code. mpclink = 0 (after bx) indicates unsorted. } - + // // Not yet implemented - AWB 15.03.17 // RPCDigi EMTFHit::CreateRPCDigi() const { // return RPCDigi( (strip_hi + strip_lo) / 2, bx + CSCConstants::LCT_CENTRAL_BX ); // } - + } // End namespace l1t diff --git a/L1Trigger/L1TMuon/interface/GeometryTranslator.h b/L1Trigger/L1TMuon/interface/GeometryTranslator.h index 6d8d0b9d13421..d6db1e76a8743 100644 --- a/L1Trigger/L1TMuon/interface/GeometryTranslator.h +++ b/L1Trigger/L1TMuon/interface/GeometryTranslator.h @@ -7,7 +7,7 @@ // digi information into local or global CMS coordinates for all // types of L1 trigger primitives that we want to consider for // use in the integrated muon trigger. -// +// // Note: This should be considered as a base class to some sort of global // look-up table // diff --git a/L1Trigger/L1TMuon/interface/MuonTriggerPrimitive.h b/L1Trigger/L1TMuon/interface/MuonTriggerPrimitive.h index ca16ea58d75e2..dea6bb2efd93a 100644 --- a/L1Trigger/L1TMuon/interface/MuonTriggerPrimitive.h +++ b/L1Trigger/L1TMuon/interface/MuonTriggerPrimitive.h @@ -70,8 +70,8 @@ namespace L1TMuon { struct CSCData { CSCData() : trknmb(0), valid(0), quality(0), keywire(0), strip(0), - pattern(0), bend(0), bx(0), mpclink(0), bx0(0), syncErr(0), - cscID(0) {} + pattern(0), bend(0), bx(0), mpclink(0), bx0(0), syncErr(0), + cscID(0) {} uint16_t trknmb; uint16_t valid; uint16_t quality; @@ -88,9 +88,9 @@ namespace L1TMuon { struct DTData { DTData() : bx(0), wheel(0), sector(0), station(0), radialAngle(0), - bendingAngle(0), qualityCode(0), Ts2TagCode(0), BxCntCode(0), - theta_bti_group(0), segment_number(0), theta_code(0), - theta_quality(0) {} + bendingAngle(0), qualityCode(0), Ts2TagCode(0), BxCntCode(0), + theta_bti_group(0), segment_number(0), theta_code(0), + theta_quality(0) {} // from ChambPhDigi (corresponds to a TRACO) // this gives us directly the phi int bx; // relative? bx number @@ -126,18 +126,18 @@ namespace L1TMuon { //DT TriggerPrimitive(const DTChamberId&, - const L1MuDTChambPhDigi&, - const int segment_number); + const L1MuDTChambPhDigi&, + const int segment_number); TriggerPrimitive(const DTChamberId&, - const L1MuDTChambThDigi&, - const int segment_number); + const L1MuDTChambThDigi&, + const int segment_number); TriggerPrimitive(const DTChamberId&, - const L1MuDTChambPhDigi&, - const L1MuDTChambThDigi&, - const int theta_bti_group); + const L1MuDTChambPhDigi&, + const L1MuDTChambThDigi&, + const int theta_bti_group); //CSC TriggerPrimitive(const CSCDetId&, - const CSCCorrelatedLCTDigi&); + const CSCCorrelatedLCTDigi&); //RPC TriggerPrimitive(const RPCDetId& detid, const unsigned strip, diff --git a/L1Trigger/L1TMuon/interface/MuonTriggerPrimitiveFwd.h b/L1Trigger/L1TMuon/interface/MuonTriggerPrimitiveFwd.h index 4f825819879db..6039185d9615f 100644 --- a/L1Trigger/L1TMuon/interface/MuonTriggerPrimitiveFwd.h +++ b/L1Trigger/L1TMuon/interface/MuonTriggerPrimitiveFwd.h @@ -6,11 +6,11 @@ #include "DataFormats/Common/interface/Ref.h" #include "DataFormats/Common/interface/Ptr.h" -namespace L1TMuon{ +namespace L1TMuon { class TriggerPrimitive; typedef std::vector TriggerPrimitiveCollection; - + //typedef edm::Ref TriggerPrimitiveRef; //typedef std::vector TriggerPrimitiveList; //typedef edm::Ptr TriggerPrimitivePtr; diff --git a/L1Trigger/L1TMuon/src/GeometryTranslator.cc b/L1Trigger/L1TMuon/src/GeometryTranslator.cc index 68443eaca0d6d..f45ad058fb03a 100644 --- a/L1Trigger/L1TMuon/src/GeometryTranslator.cc +++ b/L1Trigger/L1TMuon/src/GeometryTranslator.cc @@ -25,10 +25,10 @@ GeometryTranslator::GeometryTranslator(): _geom_cache_id(0ULL), _magfield_cache_id(0ULL) { } -GeometryTranslator::~GeometryTranslator() { +GeometryTranslator::~GeometryTranslator() { } -double +double GeometryTranslator::calculateGlobalEta(const TriggerPrimitive& tp) const { switch(tp.subsystem()) { case TriggerPrimitive::kDT: @@ -44,12 +44,12 @@ GeometryTranslator::calculateGlobalEta(const TriggerPrimitive& tp) const { return calcGEMSpecificEta(tp); break; default: - return std::nan("Invalid TP type!"); + return std::nan("Invalid TP type!"); break; } } -double +double GeometryTranslator::calculateGlobalPhi(const TriggerPrimitive& tp) const { switch(tp.subsystem()) { case TriggerPrimitive::kDT: @@ -70,7 +70,7 @@ GeometryTranslator::calculateGlobalPhi(const TriggerPrimitive& tp) const { } } -double +double GeometryTranslator::calculateBendAngle(const TriggerPrimitive& tp) const { switch(tp.subsystem()) { case TriggerPrimitive::kDT: @@ -174,23 +174,23 @@ GeometryTranslator::getRPCSpecificPoint(const TriggerPrimitive& tp) const { const GlobalPoint gp = roll->toGlobal(lp); //roll.release(); - + return gp; } -double -GeometryTranslator::calcRPCSpecificEta(const TriggerPrimitive& tp) const { +double +GeometryTranslator::calcRPCSpecificEta(const TriggerPrimitive& tp) const { return getRPCSpecificPoint(tp).eta(); } -double -GeometryTranslator::calcRPCSpecificPhi(const TriggerPrimitive& tp) const { +double +GeometryTranslator::calcRPCSpecificPhi(const TriggerPrimitive& tp) const { return getRPCSpecificPoint(tp).phi(); } // this function actually does nothing since RPC // hits are point-like objects -double +double GeometryTranslator::calcRPCSpecificBend(const TriggerPrimitive& tp) const { return 0.0; } @@ -198,11 +198,11 @@ GeometryTranslator::calcRPCSpecificBend(const TriggerPrimitive& tp) const { // alot of this is transcription and consolidation of the CSC // global phi calculation code -// this works directly with the geometry +// this works directly with the geometry // rather than using the old phi luts -GlobalPoint +GlobalPoint GeometryTranslator::getCSCSpecificPoint(const TriggerPrimitive& tp) const { - const CSCDetId id(tp.detId()); + const CSCDetId id(tp.detId()); // we should change this to weak_ptrs at some point // requires introducing std::shared_ptrs to geometry std::unique_ptr chamb(_geocsc->chamber(id)); @@ -212,13 +212,13 @@ GeometryTranslator::getCSCSpecificPoint(const TriggerPrimitive& tp) const { std::unique_ptr layer( chamb->layer(CSCConstants::KEY_ALCT_LAYER) ); - + const uint16_t halfstrip = tp.getCSCData().strip; const uint16_t pattern = tp.getCSCData().pattern; - const uint16_t keyWG = tp.getCSCData().keywire; - //const unsigned maxStrips = layer_geom->numberOfStrips(); + const uint16_t keyWG = tp.getCSCData().keywire; + //const unsigned maxStrips = layer_geom->numberOfStrips(); - // so we can extend this later + // so we can extend this later // assume TMB2007 half-strips only as baseline double offset = 0.0; switch(1) { @@ -230,46 +230,46 @@ GeometryTranslator::getCSCSpecificPoint(const TriggerPrimitive& tp) const { // the rough location of the hit at the ALCT key layer // we will refine this using the half strip information - const LocalPoint coarse_lp = - layer_geom->stripWireGroupIntersection(strip,keyWG); - const GlobalPoint coarse_gp = layer->surface().toGlobal(coarse_lp); - + const LocalPoint coarse_lp = + layer_geom->stripWireGroupIntersection(strip,keyWG); + const GlobalPoint coarse_gp = layer->surface().toGlobal(coarse_lp); + // the strip width/4.0 gives the offset of the half-strip // center with respect to the strip center const double hs_offset = layer_geom->stripPhiPitch()/4.0; - + // determine handedness of the chamber const bool ccw = isCSCCounterClockwise(layer); // we need to subtract the offset of even half strips and add the odd ones const double phi_offset = ( ( halfstrip_offs%2 ? 1 : -1)* - ( ccw ? -hs_offset : hs_offset ) ); - + ( ccw ? -hs_offset : hs_offset ) ); + // the global eta calculation uses the middle of the strip // so no need to increment it const GlobalPoint final_gp( GlobalPoint::Polar( coarse_gp.theta(), - (coarse_gp.phi().value() + - phi_offset), - coarse_gp.mag() ) ); - + (coarse_gp.phi().value() + + phi_offset), + coarse_gp.mag() ) ); + // We need to add in some notion of the 'error' on trigger primitives // like the width of the wire group by the width of the strip - // or something similar + // or something similar // release ownership of the pointers chamb.release(); layer_geom.release(); layer.release(); - + return final_gp; } -double -GeometryTranslator::calcCSCSpecificEta(const TriggerPrimitive& tp) const { +double +GeometryTranslator::calcCSCSpecificEta(const TriggerPrimitive& tp) const { return getCSCSpecificPoint(tp).eta(); } -double -GeometryTranslator::calcCSCSpecificPhi(const TriggerPrimitive& tp) const { +double +GeometryTranslator::calcCSCSpecificPhi(const TriggerPrimitive& tp) const { return getCSCSpecificPoint(tp).phi(); } @@ -279,55 +279,55 @@ GeometryTranslator::calcCSCSpecificBend(const TriggerPrimitive& tp) const { } GlobalPoint -GeometryTranslator::calcDTSpecificPoint(const TriggerPrimitive& tp) const { +GeometryTranslator::calcDTSpecificPoint(const TriggerPrimitive& tp) const { const DTChamberId baseid(tp.detId()); // do not use this pointer for anything other than creating a trig geom std::unique_ptr chamb( - const_cast(_geodt->chamber(baseid)) + const_cast(_geodt->chamber(baseid)) ); std::unique_ptr trig_geom( new DTTrigGeom(chamb.get(),false) ); - chamb.release(); // release it here so no one gets funny ideas + chamb.release(); // release it here so no one gets funny ideas // super layer one is the theta superlayer in a DT chamber // station 4 does not have a theta super layer // the BTI index from the theta trigger is an OR of some BTI outputs // so, we choose the BTI that's in the middle of the group // as the BTI that we get theta from // TODO:::::>>> need to make sure this ordering doesn't flip under wheel sign - const int NBTI_theta = ( (baseid.station() != 4) ? - trig_geom->nCell(2) : trig_geom->nCell(3) ); + const int NBTI_theta = ( (baseid.station() != 4) ? + trig_geom->nCell(2) : trig_geom->nCell(3) ); const int bti_group = tp.getDTData().theta_bti_group; - const unsigned bti_actual = bti_group*NBTI_theta/7 + NBTI_theta/14 + 1; - DTBtiId thetaBTI; + const unsigned bti_actual = bti_group*NBTI_theta/7 + NBTI_theta/14 + 1; + DTBtiId thetaBTI; if ( baseid.station() != 4 && bti_group != -1) { thetaBTI = DTBtiId(baseid,2,bti_actual); } else { // since this is phi oriented it'll give us theta in the middle // of the chamber - thetaBTI = DTBtiId(baseid,3,1); + thetaBTI = DTBtiId(baseid,3,1); } const GlobalPoint theta_gp = trig_geom->CMSPosition(thetaBTI); - + // local phi in sector -> global phi - double phi = ((double)tp.getDTData().radialAngle)/4096.0; - phi += tp.getDTData().sector*M_PI/6.0; // add sector offset + double phi = ((double)tp.getDTData().radialAngle)/4096.0; + phi += tp.getDTData().sector*M_PI/6.0; // add sector offset return GlobalPoint( GlobalPoint::Polar( theta_gp.theta(), - phi, - theta_gp.mag() ) ); + phi, + theta_gp.mag() ) ); } -double -GeometryTranslator::calcDTSpecificEta(const TriggerPrimitive& tp) const { +double +GeometryTranslator::calcDTSpecificEta(const TriggerPrimitive& tp) const { return calcDTSpecificPoint(tp).eta(); } -double +double GeometryTranslator::calcDTSpecificPhi(const TriggerPrimitive& tp) const { return calcDTSpecificPoint(tp).phi(); } // we have the bend except for station 3 -double +double GeometryTranslator::calcDTSpecificBend(const TriggerPrimitive& tp) const { int bend = tp.getDTData().bendingAngle; double bendf = bend/512.0; @@ -339,6 +339,6 @@ isCSCCounterClockwise(const std::unique_ptr& layer) const { const int nStrips = layer->geometry()->numberOfStrips(); const double phi1 = layer->centerOfStrip(1).phi(); const double phiN = layer->centerOfStrip(nStrips).phi(); - return ( (std::abs(phi1 - phiN) < M_PI && phi1 >= phiN) || - (std::abs(phi1 - phiN) >= M_PI && phi1 < phiN) ); + return ( (std::abs(phi1 - phiN) < M_PI && phi1 >= phiN) || + (std::abs(phi1 - phiN) >= M_PI && phi1 < phiN) ); } diff --git a/L1Trigger/L1TMuon/src/MuonTriggerPrimitive.cc b/L1Trigger/L1TMuon/src/MuonTriggerPrimitive.cc index 9b179db612cb0..5407c2dcda552 100644 --- a/L1Trigger/L1TMuon/src/MuonTriggerPrimitive.cc +++ b/L1Trigger/L1TMuon/src/MuonTriggerPrimitive.cc @@ -21,8 +21,8 @@ namespace { //constructors from DT data TriggerPrimitive::TriggerPrimitive(const DTChamberId& detid, - const L1MuDTChambPhDigi& digi_phi, - const int segment_number): + const L1MuDTChambPhDigi& digi_phi, + const int segment_number): _id(detid), _subsystem(TriggerPrimitive::kDT) { calculateDTGlobalSector(detid,_globalsector,_subsector); @@ -44,8 +44,8 @@ TriggerPrimitive::TriggerPrimitive(const DTChamberId& detid, } TriggerPrimitive::TriggerPrimitive(const DTChamberId& detid, - const L1MuDTChambThDigi& digi_th, - const int theta_bti_group): + const L1MuDTChambThDigi& digi_th, + const int theta_bti_group): _id(detid), _subsystem(TriggerPrimitive::kDT) { calculateDTGlobalSector(detid,_globalsector,_subsector); @@ -67,9 +67,9 @@ TriggerPrimitive::TriggerPrimitive(const DTChamberId& detid, } TriggerPrimitive::TriggerPrimitive(const DTChamberId& detid, - const L1MuDTChambPhDigi& digi_phi, - const L1MuDTChambThDigi& digi_th, - const int theta_bti_group): + const L1MuDTChambPhDigi& digi_phi, + const L1MuDTChambThDigi& digi_th, + const int theta_bti_group): _id(detid), _subsystem(TriggerPrimitive::kDT) { calculateDTGlobalSector(detid,_globalsector,_subsector); @@ -92,7 +92,7 @@ TriggerPrimitive::TriggerPrimitive(const DTChamberId& detid, //constructor from CSC data TriggerPrimitive::TriggerPrimitive(const CSCDetId& detid, - const CSCCorrelatedLCTDigi& digi): + const CSCCorrelatedLCTDigi& digi): _id(detid), _subsystem(TriggerPrimitive::kCSC) { calculateCSCGlobalSector(detid,_globalsector,_subsector); @@ -133,6 +133,7 @@ TriggerPrimitive::TriggerPrimitive(const RPCDetId& detid, _rpc.valid = 1; } + // constructor from GEM data TriggerPrimitive::TriggerPrimitive(const GEMDetId& detid, const GEMPadDigi& digi): diff --git a/L1Trigger/L1TMuonEndCap/interface/Common.h b/L1Trigger/L1TMuonEndCap/interface/Common.h index daddb852dfac5..b22055b7da9b2 100644 --- a/L1Trigger/L1TMuonEndCap/interface/Common.h +++ b/L1Trigger/L1TMuonEndCap/interface/Common.h @@ -47,20 +47,20 @@ namespace emtf { // from DataFormats/MuonDetId/interface/CSCDetId.h constexpr int MIN_ENDCAP = 1; constexpr int MAX_ENDCAP = 2; - + // from DataFormats/MuonDetId/interface/CSCTriggerNumbering.h constexpr int MIN_TRIGSECTOR = 1; constexpr int MAX_TRIGSECTOR = 6; constexpr int NUM_SECTORS = 12; - + // Zones constexpr int NUM_ZONES = 4; constexpr int NUM_ZONE_HITS = 160; - + // Stations constexpr int NUM_STATIONS = 4; constexpr int NUM_STATION_PAIRS = 6; - + // Fixed-size arrays template using sector_array = std::array; diff --git a/L1Trigger/L1TMuonEndCap/interface/EndCapParamsHelper.h b/L1Trigger/L1TMuonEndCap/interface/EndCapParamsHelper.h index 70dfbc5ddfc8f..6f2ad4c01b204 100644 --- a/L1Trigger/L1TMuonEndCap/interface/EndCapParamsHelper.h +++ b/L1Trigger/L1TMuonEndCap/interface/EndCapParamsHelper.h @@ -39,7 +39,7 @@ namespace l1t { class EndCapParamsHelper { public: enum {VERSION = 1}; - + ~EndCapParamsHelper(); //ctor if creating a new table (e.g. from XML or python file) @@ -54,7 +54,7 @@ namespace l1t { // "PhiMatchWindowSt1" arbitrarily re-mapped to Primitive conversion (PC LUT) version // because of rigid CondFormats naming conventions - AWB 02.06.17 void SetPrimConvVersion (unsigned version) {write_->PhiMatchWindowSt1_ = version;} - + unsigned GetPtAssignVersion() const {return read_->PtAssignVersion_;} unsigned GetFirmwareVersion() const {return read_->firmwareVersion_;} unsigned GetPrimConvVersion() const {return read_->PhiMatchWindowSt1_;} @@ -65,14 +65,14 @@ namespace l1t { // access to underlying pointers, mainly for ESProducer: const L1TMuonEndCapParams * getReadInstance() const {return read_;} L1TMuonEndCapParams * getWriteInstance(){return write_; } - + private: EndCapParamsHelper(const L1TMuonEndCapParams * es); void useCopy(); void check_write() { assert(write_); } // separating read from write allows for a high-performance read-only mode (as no copy is made): const L1TMuonEndCapParams * read_; // when reading/getting, use this. - L1TMuonEndCapParams * write_; // when writing/setting, use this. + L1TMuonEndCapParams * write_; // when writing/setting, use this. bool we_own_write_; }; diff --git a/L1Trigger/L1TMuonEndCap/interface/PtAssignmentEngineAux2017.h b/L1Trigger/L1TMuonEndCap/interface/PtAssignmentEngineAux2017.h index f3f1a34c41a65..0c3f5cbb4392f 100644 --- a/L1Trigger/L1TMuonEndCap/interface/PtAssignmentEngineAux2017.h +++ b/L1Trigger/L1TMuonEndCap/interface/PtAssignmentEngineAux2017.h @@ -29,10 +29,10 @@ class PtAssignmentEngineAux2017 { void unpack2bRPC(int rpc_2b, int& rpcA, int& rpcB, int& rpcC) const; int get8bMode15(int theta, int st1_ring2, int endcap, int sPhiAB, - int clctA, int clctB, int clctC, int clctD) const; + int clctA, int clctB, int clctC, int clctD) const; void unpack8bMode15( int mode15_8b, int& theta, int& st1_ring2, int endcap, int sPhiAB, - int& clctA, int& rpcA, int& rpcB, int& rpcC, int& rpcD) const; + int& clctA, int& rpcA, int& rpcB, int& rpcC, int& rpcD) const; // Need to re-check / verify this - AWB 17.03.17 // int getFRLUT(int sector, int station, int chamber) const; diff --git a/L1Trigger/L1TMuonEndCap/interface/PtLutVarCalc.h b/L1Trigger/L1TMuonEndCap/interface/PtLutVarCalc.h index a08548b41f673..75f2898e931fd 100644 --- a/L1Trigger/L1TMuonEndCap/interface/PtLutVarCalc.h +++ b/L1Trigger/L1TMuonEndCap/interface/PtLutVarCalc.h @@ -5,18 +5,18 @@ int CalcTrackTheta( const int th1, const int th2, const int th3, const int th4, const int ring1, const int mode, const bool BIT_COMP=false ); void CalcDeltaPhis( int& dPh12, int& dPh13, int& dPh14, int& dPh23, int& dPh24, int& dPh34, int& dPhSign, - int& dPhSum4, int& dPhSum4A, int& dPhSum3, int& dPhSum3A, int& outStPh, - const int ph1, const int ph2, const int ph3, const int ph4, const int mode, const bool BIT_COMP=false ); + int& dPhSum4, int& dPhSum4A, int& dPhSum3, int& dPhSum3A, int& outStPh, + const int ph1, const int ph2, const int ph3, const int ph4, const int mode, const bool BIT_COMP=false ); void CalcDeltaThetas( int& dTh12, int& dTh13, int& dTh14, int& dTh23, int& dTh24, int& dTh34, - const int th1, const int th2, const int th3, const int th4, const int mode, const bool BIT_COMP=false ); + const int th1, const int th2, const int th3, const int th4, const int mode, const bool BIT_COMP=false ); void CalcBends( int& bend1, int& bend2, int& bend3, int& bend4, - const int pat1, const int pat2, const int pat3, const int pat4, - const int dPhSign, const int endcap, const int mode, const bool BIT_COMP=false ); + const int pat1, const int pat2, const int pat3, const int pat4, + const int dPhSign, const int endcap, const int mode, const bool BIT_COMP=false ); -void CalcRPCs( int& RPC1, int& RPC2, int& RPC3, int& RPC4, const int mode, - const int st1_ring2, const int theta, const bool BIT_COMP=false ); +void CalcRPCs( int& RPC1, int& RPC2, int& RPC3, int& RPC4, const int mode, + const int st1_ring2, const int theta, const bool BIT_COMP=false ); int CalcBendFromPattern( const int pattern, const int endcap ); diff --git a/L1Trigger/L1TMuonEndCap/interface/bdt/Event.h b/L1Trigger/L1TMuonEndCap/interface/bdt/Event.h index 5db19022751c6..0490bc2038b5b 100644 --- a/L1Trigger/L1TMuonEndCap/interface/bdt/Event.h +++ b/L1Trigger/L1TMuonEndCap/interface/bdt/Event.h @@ -27,8 +27,8 @@ struct Event int Quality; static int sortingIndex; - int id; - std::vector data; + int id; + std::vector data; bool operator< (const Event &rhs) const { @@ -45,9 +45,9 @@ struct Event std::cout << "x"<< i << "=" << data[i] << ", "; } std::cout << std::endl; - + } - + void resetPredictedValue(){ predictedValue = 0; } }; diff --git a/L1Trigger/L1TMuonEndCap/interface/bdt/Forest.h b/L1Trigger/L1TMuonEndCap/interface/bdt/Forest.h index 06699193caed4..9aaacec0040c9 100644 --- a/L1Trigger/L1TMuonEndCap/interface/bdt/Forest.h +++ b/L1Trigger/L1TMuonEndCap/interface/bdt/Forest.h @@ -31,7 +31,7 @@ class Forest // Get info on variable importance. void rankVariables(std::vector& rank); - + // Output the list of split values used for each variable. void saveSplitValues(const char* savefilename); @@ -39,17 +39,17 @@ class Forest void listEvents(std::vector< std::vector >& e); void sortEventVectors(std::vector< std::vector >& e); void generate(int numTrainEvents, int numTestEvents, double sigma); - void loadForestFromXML(const char* directory, unsigned int numTrees); + void loadForestFromXML(const char* directory, unsigned int numTrees); void loadFromCondPayload(const L1TMuonEndCapForest::DForest& payload); // Perform the regression void updateRegTargets(Tree *tree, double learningRate, LossFunction* l); - void doRegression(int nodeLimit, int treeLimit, double learningRate, LossFunction* l, + void doRegression(int nodeLimit, int treeLimit, double learningRate, LossFunction* l, const char* savetreesdirectory, bool saveTrees); // Stochastic Gradient Boosting void prepareRandomSubsample(double fraction); - void doStochasticRegression(int nodeLimit, int treeLimit, double learningRate, + void doStochasticRegression(int nodeLimit, int treeLimit, double learningRate, double fraction, LossFunction* l); // Predict some events diff --git a/L1Trigger/L1TMuonEndCap/interface/bdt/LossFunctions.h b/L1Trigger/L1TMuonEndCap/interface/bdt/LossFunctions.h index 7e2e852094019..73a57ce2895a7 100644 --- a/L1Trigger/L1TMuonEndCap/interface/bdt/LossFunctions.h +++ b/L1Trigger/L1TMuonEndCap/interface/bdt/LossFunctions.h @@ -1,6 +1,6 @@ // LossFunctions.h // Here we define the different loss functions that can be used -// with the BDT system. +// with the BDT system. #ifndef L1Trigger_L1TMuonEndCap_emtf_LossFunctions #define L1Trigger_L1TMuonEndCap_emtf_LossFunctions @@ -30,7 +30,7 @@ class LossFunction virtual double fit(std::vector& v) = 0; virtual std::string name() = 0; virtual int id() = 0; - virtual ~LossFunction() = default; + virtual ~LossFunction() = default; }; // ======================================================== @@ -59,12 +59,12 @@ class LeastSquares : public LossFunction Event* e = v[i]; SUM += e->trueValue - e->predictedValue; } - + return SUM/v.size(); } std::string name() override { return "Least_Squares"; } int id() override{ return 1; } - + }; // ======================================================== @@ -91,8 +91,8 @@ class AbsoluteDeviation : public LossFunction // The median of the residuals minimizes absolute deviation. if(v.empty()) return 0; std::vector residuals(v.size()); - - // Load the residuals into a vector. + + // Load the residuals into a vector. for(unsigned int i=0; itrueValue - e->predictedValue; - double diff = residual - residual_median; + double diff = residual - residual_median; x += ((diff > 0)?1.0:-1.0)*std::min(quantile, std::abs(diff)); } return (residual_median + x/v.size()); - + } std::string name() override { return "Huber"; } @@ -173,18 +173,18 @@ class Huber : public LossFunction { // Container for the residuals. std::vector residuals(v.size()); - - // Load the residuals into a vector. + + // Load the residuals into a vector. for(unsigned int i=0; itrueValue - e->predictedValue); } - std::sort(residuals.begin(), residuals.end()); + std::sort(residuals.begin(), residuals.end()); unsigned int quantile_location = whichQuantile*(residuals.size()-1); return residuals[quantile_location]; - } + } }; // ======================================================== @@ -198,28 +198,28 @@ class PercentErrorSquared : public LossFunction ~PercentErrorSquared() override{} double target(Event* e) override - { + { // The gradient of the squared percent error. return (e->trueValue - e->predictedValue)/(e->trueValue * e->trueValue); - } + } double fit(std::vector& v) override - { + { // The average of the weighted residuals minimizes the squared percent error. - // Weight(i) = 1/true(i)^2. - + // Weight(i) = 1/true(i)^2. + double SUMtop = 0; double SUMbottom = 0; - + for(unsigned int i=0; itrueValue - e->predictedValue)/(e->trueValue*e->trueValue); + SUMtop += (e->trueValue - e->predictedValue)/(e->trueValue*e->trueValue); SUMbottom += 1/(e->trueValue*e->trueValue); - } - + } + return SUMtop/SUMbottom; - } + } std::string name() override { return "Percent_Error"; } int id() override{ return 4; } }; diff --git a/L1Trigger/L1TMuonEndCap/interface/bdt/Node.h b/L1Trigger/L1TMuonEndCap/interface/bdt/Node.h index 5b6ed208d1ad9..9c21e08a3415e 100644 --- a/L1Trigger/L1TMuonEndCap/interface/bdt/Node.h +++ b/L1Trigger/L1TMuonEndCap/interface/bdt/Node.h @@ -59,7 +59,7 @@ class Node Node* filterEventToDaughter(Event* e); void listEvents(); void theMiracleOfChildBirth(); - + private: Node(const Node &) = delete; Node& operator=(const Node &) = delete; diff --git a/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapForestESProducer.cc b/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapForestESProducer.cc index 339bafb2ad604..bd4e981611a58 100644 --- a/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapForestESProducer.cc +++ b/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapForestESProducer.cc @@ -95,10 +95,10 @@ L1TMuonEndCapForestESProducer::produce(const L1TMuonEndCapForestRcd& iRecord) PtAssignmentEngine* pt_assign_engine_; std::unique_ptr pt_assign_engine_2016_; std::unique_ptr pt_assign_engine_2017_; - + pt_assign_engine_2016_.reset(new PtAssignmentEngine2016()); pt_assign_engine_2017_.reset(new PtAssignmentEngine2017()); - + if (ptLUTVersion <= 5) pt_assign_engine_ = pt_assign_engine_2016_.get(); else pt_assign_engine_ = pt_assign_engine_2017_.get(); @@ -125,7 +125,7 @@ L1TMuonEndCapForestESProducer::produce(const L1TMuonEndCapForestRcd& iRecord) // of course, move has no effect here, but I'll keep it in case move constructor will be provided some day pEMTFForest->forest_coll_.push_back( std::move( cond_forest ) ); } - + return pEMTFForest; } diff --git a/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapParamsESProducer.cc b/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapParamsESProducer.cc index 5a966c44e404e..d8bf7a131e56b 100644 --- a/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapParamsESProducer.cc +++ b/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapParamsESProducer.cc @@ -22,7 +22,7 @@ class L1TMuonEndCapParamsESProducer : public edm::ESProducer { public: L1TMuonEndCapParamsESProducer(const edm::ParameterSet&); ~L1TMuonEndCapParamsESProducer() override; - + typedef std::shared_ptr ReturnType; ReturnType produce(const L1TMuonEndCapParamsRcd&); @@ -60,7 +60,7 @@ L1TMuonEndCapParamsESProducer::produce(const L1TMuonEndCapParamsRcd& iRecord) using namespace edm::es; auto pEMTFParams = std::make_shared(*data_.getWriteInstance()); return pEMTFParams; - + } // Define this as a plug-in diff --git a/L1Trigger/L1TMuonEndCap/src/AngleCalculation.cc b/L1Trigger/L1TMuonEndCap/src/AngleCalculation.cc index 5071f76f2ed67..a6a75944c6f26 100644 --- a/L1Trigger/L1TMuonEndCap/src/AngleCalculation.cc +++ b/L1Trigger/L1TMuonEndCap/src/AngleCalculation.cc @@ -339,7 +339,7 @@ void AngleCalculation::calculate_angles(EMTFTrack& track) const { // if (subsystem == TriggerPrimitive::kRPC) // return (station == 2); - // In EMTF firmware, RPC hits are treated as if they came from the corresponding + // In EMTF firmware, RPC hits are treated as if they came from the corresponding // CSC chamber, so the FR bit assignment is the same as for CSCs - AWB 06.06.17 // GEMs are in front of the CSCs @@ -372,7 +372,7 @@ void AngleCalculation::calculate_angles(EMTFTrack& track) const { const auto& v = st_conv_hits.at(i); ptlut_data.cpattern[i] = v.empty() ? 0 : v.front().Pattern(); // Automatically set to 0 for RPCs ptlut_data.fr[i] = v.empty() ? 0 : isFront(v.front().Station(), v.front().Ring(), v.front().Chamber(), v.front().Subsystem()); - if (i == 0) + if (i == 0) ptlut_data.st1_ring2 = v.empty() ? 0 : (v.front().Station() == 1 && (v.front().Ring() == 2 || v.front().Ring() == 3)); } diff --git a/L1Trigger/L1TMuonEndCap/src/BestTrackSelection.cc b/L1Trigger/L1TMuonEndCap/src/BestTrackSelection.cc index 4cdf183a973c3..112405f3dee05 100644 --- a/L1Trigger/L1TMuonEndCap/src/BestTrackSelection.cc +++ b/L1Trigger/L1TMuonEndCap/src/BestTrackSelection.cc @@ -72,7 +72,7 @@ void BestTrackSelection::cancel_one_bx( const std::deque& extended_best_track_cands, EMTFTrackCollection& best_tracks ) const { - const int max_z = emtf::NUM_ZONES; // = 4 zones + const int max_z = emtf::NUM_ZONES; // = 4 zones const int max_n = maxRoadsPerZone_; // = 3 candidates per zone const int max_zn = max_z * max_n; // = 12 total candidates if (not (maxTracks_ <= max_zn)) @@ -259,7 +259,7 @@ void BestTrackSelection::cancel_multi_bx( EMTFTrackCollection& best_tracks ) const { const int max_h = bxWindow_; // = 3 bx history - const int max_z = emtf::NUM_ZONES; // = 4 zones + const int max_z = emtf::NUM_ZONES; // = 4 zones const int max_n = maxRoadsPerZone_; // = 3 candidates per zone const int max_zn = max_z * max_n; // = 12 total candidates const int max_hzn = max_h * max_zn; // = 36 total candidates diff --git a/L1Trigger/L1TMuonEndCap/src/EndCapParamsHelper.cc b/L1Trigger/L1TMuonEndCap/src/EndCapParamsHelper.cc index ca0231d98074f..710cdcf834f6d 100644 --- a/L1Trigger/L1TMuonEndCap/src/EndCapParamsHelper.cc +++ b/L1Trigger/L1TMuonEndCap/src/EndCapParamsHelper.cc @@ -16,11 +16,11 @@ EndCapParamsHelper * EndCapParamsHelper::readAndWriteFromEventSetup(const L1TMu } EndCapParamsHelper::EndCapParamsHelper(L1TMuonEndCapParams * w) { - write_ = w; - check_write(); + write_ = w; + check_write(); we_own_write_ = false; - //write_->m_version = VERSION; - read_ = write_; + //write_->m_version = VERSION; + read_ = write_; } EndCapParamsHelper::EndCapParamsHelper(const L1TMuonEndCapParams * es) {read_ = es; write_=nullptr;} diff --git a/L1Trigger/L1TMuonEndCap/src/MicroGMTConverter.cc b/L1Trigger/L1TMuonEndCap/src/MicroGMTConverter.cc index 110e907d205df..b503113ca7af3 100644 --- a/L1Trigger/L1TMuonEndCap/src/MicroGMTConverter.cc +++ b/L1Trigger/L1TMuonEndCap/src/MicroGMTConverter.cc @@ -109,7 +109,7 @@ void MicroGMTConverter::convert_all( // Sort by processor to match uGMT unpacked order emtf::sort_uGMT_muons(out_cands); - + } @@ -118,12 +118,12 @@ namespace emtf { void sort_uGMT_muons( l1t::RegionalMuonCandBxCollection& cands ) { - + int minBX = cands.getFirstBX(); int maxBX = cands.getLastBX(); int emtfMinProc = 0; // ME+ sector 1 int emtfMaxProc = 11; // ME- sector 6 - + // New collection, sorted by processor to match uGMT unpacked order auto sortedCands = std::make_unique(); sortedCands->clear(); @@ -131,14 +131,14 @@ void sort_uGMT_muons( for (int iBX = minBX; iBX <= maxBX; ++iBX) { for (int proc = emtfMinProc; proc <= emtfMaxProc; proc++) { for (l1t::RegionalMuonCandBxCollection::const_iterator cand = cands.begin(iBX); cand != cands.end(iBX); ++cand) { - int cand_proc = cand->processor(); - if (cand->trackFinderType() == l1t::tftype::emtf_neg) cand_proc += 6; - if (cand_proc != proc) continue; - sortedCands->push_back(iBX, *cand); + int cand_proc = cand->processor(); + if (cand->trackFinderType() == l1t::tftype::emtf_neg) cand_proc += 6; + if (cand_proc != proc) continue; + sortedCands->push_back(iBX, *cand); } } } - + // Return sorted collection std::swap(cands, *sortedCands); sortedCands.reset(); diff --git a/L1Trigger/L1TMuonEndCap/src/PrimitiveConversion.cc b/L1Trigger/L1TMuonEndCap/src/PrimitiveConversion.cc index cf7f41cdf57ec..0174b9e2a567f 100644 --- a/L1Trigger/L1TMuonEndCap/src/PrimitiveConversion.cc +++ b/L1Trigger/L1TMuonEndCap/src/PrimitiveConversion.cc @@ -446,7 +446,7 @@ void PrimitiveConversion::convert_rpc( int tp_station = tp_detId.station(); // 1 - 4 int tp_ring = tp_detId.ring(); // 2 - 3 (increasing theta) int tp_roll = tp_detId.roll(); // 1 - 3 (decreasing theta; aka A - C; space between rolls is 9 - 15 in theta_fp) - // int tp_layer = tp_detId.layer(); + //int tp_layer = tp_detId.layer(); int tp_bx = tp_data.bx; int tp_strip = ((tp_data.strip_low + tp_data.strip_hi) / 2); // in full-strip unit @@ -533,8 +533,8 @@ void PrimitiveConversion::convert_rpc_details(EMTFHit& conv_hit) const { const int pc_chamber = conv_hit.PC_chamber(); const int pc_segment = conv_hit.PC_segment(); - // const int fw_endcap = (endcap_-1); - // const int fw_sector = (sector_-1); + //const int fw_endcap = (endcap_-1); + //const int fw_sector = (sector_-1); const int fw_station = (conv_hit.Station() == 1) ? (is_neighbor ? 0 : pc_station) : conv_hit.Station(); int fw_cscid = pc_chamber; @@ -613,7 +613,7 @@ void PrimitiveConversion::convert_gem( int tp_station = tp_detId.station(); int tp_ring = tp_detId.ring(); int tp_roll = tp_detId.roll(); - // int tp_layer = tp_detId.layer(); + //int tp_layer = tp_detId.layer(); int tp_chamber = tp_detId.chamber(); int tp_bx = tp_data.bx; diff --git a/L1Trigger/L1TMuonEndCap/src/PrimitiveSelection.cc b/L1Trigger/L1TMuonEndCap/src/PrimitiveSelection.cc index b5225d5565a9f..85fe5e5154c85 100644 --- a/L1Trigger/L1TMuonEndCap/src/PrimitiveSelection.cc +++ b/L1Trigger/L1TMuonEndCap/src/PrimitiveSelection.cc @@ -74,23 +74,23 @@ void PrimitiveSelection::process( if (selected_csc >= 0) { if (not(selected_csc < NUM_CSC_CHAMBERS)) - { edm::LogError("L1T") << "selected_csc = " << selected_csc << ", NUM_CSC_CHAMBERS = " << NUM_CSC_CHAMBERS; return; } - + { edm::LogError("L1T") << "selected_csc = " << selected_csc << ", NUM_CSC_CHAMBERS = " << NUM_CSC_CHAMBERS; return; } + if (selected_csc_map[selected_csc].size() < 2) { - selected_csc_map[selected_csc].push_back(new_tp); + selected_csc_map[selected_csc].push_back(new_tp); } else { - edm::LogWarning("L1T") << "\n******************* EMTF EMULATOR: SUPER-BIZZARE CASE *******************"; - edm::LogWarning("L1T") << "Found 3 CSC trigger primitives in the same chamber"; - for (int ii = 0; ii < 3; ii++) { - TriggerPrimitive tp_err = (ii < 2 ? selected_csc_map[selected_csc].at(ii) : new_tp); - edm::LogWarning("L1T") << "LCT #" << ii+1 << ": BX " << tp_err.getBX() - << ", endcap " << tp_err.detId().endcap() << ", sector " << tp_err.detId().triggerSector() - << ", station " << tp_err.detId().station() << ", ring " << tp_err.detId().ring() - << ", chamber " << tp_err.detId().chamber() << ", CSC ID " << tp_err.getCSCData().cscID - << ": strip " << tp_err.getStrip() << ", wire " << tp_err.getWire(); - } - edm::LogWarning("L1T") << "************************* ONLY KEEP FIRST TWO *************************\n\n"; + edm::LogWarning("L1T") << "\n******************* EMTF EMULATOR: SUPER-BIZZARE CASE *******************"; + edm::LogWarning("L1T") << "Found 3 CSC trigger primitives in the same chamber"; + for (int ii = 0; ii < 3; ii++) { + TriggerPrimitive tp_err = (ii < 2 ? selected_csc_map[selected_csc].at(ii) : new_tp); + edm::LogWarning("L1T") << "LCT #" << ii+1 << ": BX " << tp_err.getBX() + << ", endcap " << tp_err.detId().endcap() << ", sector " << tp_err.detId().triggerSector() + << ", station " << tp_err.detId().station() << ", ring " << tp_err.detId().ring() + << ", chamber " << tp_err.detId().chamber() << ", CSC ID " << tp_err.getCSCData().cscID + << ": strip " << tp_err.getStrip() << ", wire " << tp_err.getWire(); + } + edm::LogWarning("L1T") << "************************* ONLY KEEP FIRST TWO *************************\n\n"; } } // End conditional: if (selected_csc >= 0) diff --git a/L1Trigger/L1TMuonEndCap/src/PtAssignment.cc b/L1Trigger/L1TMuonEndCap/src/PtAssignment.cc index 53a8cf9210fcc..9fe342b5769b3 100644 --- a/L1Trigger/L1TMuonEndCap/src/PtAssignment.cc +++ b/L1Trigger/L1TMuonEndCap/src/PtAssignment.cc @@ -73,9 +73,9 @@ void PtAssignment::process( // Check address packing / unpacking if (not( fabs(xmlpt - pt_assign_engine_->calculate_pt(track)) < 0.001 ) ) - { edm::LogWarning("L1T") << "EMTF pT assignment mismatch: xmlpt = " << xmlpt - << ", pt_assign_engine_->calculate_pt(track)) = " - << pt_assign_engine_->calculate_pt(track); } + { edm::LogWarning("L1T") << "EMTF pT assignment mismatch: xmlpt = " << xmlpt + << ", pt_assign_engine_->calculate_pt(track)) = " + << pt_assign_engine_->calculate_pt(track); } pt = (xmlpt < 0.) ? 1. : xmlpt; // Matt used fabs(-1) when mode is invalid pt *= pt_assign_engine_->scale_pt(pt, track.Mode()); // Multiply by some factor to achieve 90% efficiency at threshold diff --git a/L1Trigger/L1TMuonEndCap/src/PtAssignmentEngine.cc b/L1Trigger/L1TMuonEndCap/src/PtAssignmentEngine.cc index 66899b5b0e0b5..484e7d856de16 100644 --- a/L1Trigger/L1TMuonEndCap/src/PtAssignmentEngine.cc +++ b/L1Trigger/L1TMuonEndCap/src/PtAssignmentEngine.cc @@ -49,13 +49,13 @@ void PtAssignmentEngine::load(const L1TMuonEndCapForest *payload) { for (unsigned i = 0; i < allowedModes_.size(); ++i) { int mode = allowedModes_.at(i); - + L1TMuonEndCapForest::DForestMap::const_iterator index = payload->forest_map_.find(mode); // associates mode to index if (index == payload->forest_map_.end()) continue; - + forests_.at(mode).loadFromCondPayload(payload->forest_coll_[index->second]); - - double boostWeight_ = payload->forest_map_.find(mode+16)->second / 1000000.; + + double boostWeight_ = payload->forest_map_.find(mode+16)->second / 1000000.; // std::cout << "Loaded forest for mode " << mode << " with boostWeight_ = " << boostWeight_ << std::endl; // std::cout << " * ptLUTVersion_ = " << ptLUTVersion_ << std::endl; forests_.at(mode).getTree(0)->setBoostWeight( boostWeight_ ); diff --git a/L1Trigger/L1TMuonEndCap/src/PtAssignmentEngine2016.cc b/L1Trigger/L1TMuonEndCap/src/PtAssignmentEngine2016.cc index edb68c87c3887..fe16715dafa68 100644 --- a/L1Trigger/L1TMuonEndCap/src/PtAssignmentEngine2016.cc +++ b/L1Trigger/L1TMuonEndCap/src/PtAssignmentEngine2016.cc @@ -705,4 +705,4 @@ float PtAssignmentEngine2016::calculate_pt_xml(const EMTFTrack& track) const { float pt = 0.; return pt; -} +} diff --git a/L1Trigger/L1TMuonEndCap/src/PtAssignmentEngine2017.cc b/L1Trigger/L1TMuonEndCap/src/PtAssignmentEngine2017.cc index 57d49108194bf..983d60ea1d279 100644 --- a/L1Trigger/L1TMuonEndCap/src/PtAssignmentEngine2017.cc +++ b/L1Trigger/L1TMuonEndCap/src/PtAssignmentEngine2017.cc @@ -21,7 +21,7 @@ float PtAssignmentEngine2017::scale_pt(const float pt, const int mode) const { // Scaling to achieve 90% efficency at any given L1 pT threshold // For now, a linear scaling based on SingleMu-quality (modes 11, 13, 14, 15), CSC+RPC tracks // Should maybe scale each mode differently in the future - AWB 31.05.17 - + // TRG = (1.2 + 0.015*TRG) * XML // TRG = 1.2*XML / (1 - 0.015*XML) // TRG / XML = 1.2 / (1 - 0.015*XML) @@ -55,7 +55,7 @@ PtAssignmentEngine::address_t PtAssignmentEngine2017::calculate_address(const EM address_t address = 0; EMTFPtLUT data = track.PtLUT(); - + int mode = track.Mode(); int theta = track.Theta_fp(); int endcap = track.Endcap(); @@ -88,7 +88,7 @@ PtAssignmentEngine::address_t PtAssignmentEngine2017::calculate_address(const EM iBC = (iB >= 0 && iC >= 0) ? iB + iC : -1; iCD = (iC >= 0 && iD >= 0) ? 5 : -1; - + // Fill variable info from pT LUT data int st1_ring2, dTheta; int dPhiAB, dPhiBC, dPhiCD; @@ -156,7 +156,7 @@ PtAssignmentEngine::address_t PtAssignmentEngine2017::calculate_address(const EM theta = aux().getTheta ( theta, st1_ring2, 5 ); } - + // Form the pT LUT address if (nHits == 4) { address |= (dPhiAB & ((1<<7)-1)) << (0); @@ -178,8 +178,8 @@ PtAssignmentEngine::address_t PtAssignmentEngine2017::calculate_address(const EM address |= (dTheta & ((1<<3)-1)) << (0+7+5+1); address |= (frA & ((1<<1)-1)) << (0+7+5+1+3); int bit = 0; - if (mode != 7) { - address |= (frB & ((1<<1)-1)) << (0+7+5+1+3+1); bit = 1; + if (mode != 7) { + address |= (frB & ((1<<1)-1)) << (0+7+5+1+3+1); bit = 1; } address |= (clctA & ((1<<2)-1)) << (0+7+5+1+3+1+bit); address |= (rpc_2b & ((1<<2)-1)) << (0+7+5+1+3+1+bit+2); @@ -193,8 +193,8 @@ PtAssignmentEngine::address_t PtAssignmentEngine2017::calculate_address(const EM if (not(address < pow(2, 27) && address >= pow(2, 26))) { edm::LogError("L1T") << "address = " << address; return 0; } } - } - else if (nHits == 2) { + } + else if (nHits == 2) { address |= (dPhiAB & ((1<<7)-1)) << (0); address |= (dTheta & ((1<<3)-1)) << (0+7); address |= (frA & ((1<<1)-1)) << (0+7+3); @@ -228,10 +228,10 @@ float PtAssignmentEngine2017::calculate_pt_xml(const address_t& address) const { { edm::LogError("L1T") << "address = " << address; return 0; } if (address >= pow(2, 29)) { nHits = 4; mode = 15; } else if (address >= pow(2, 27)) { nHits = 3; } - else if (address >= pow(2, 26)) { nHits = 3; mode = 7; } + else if (address >= pow(2, 26)) { nHits = 3; mode = 7; } else if (address >= pow(2, 24)) { nHits = 2; } else return pt_xml; - + // Variables to unpack from the pT LUT address int mode_ID, theta, dTheta; int dPhiAB, dPhiBC = -1, dPhiCD = -1; @@ -242,33 +242,33 @@ float PtAssignmentEngine2017::calculate_pt_xml(const address_t& address) const { int endcap = 1; sPhiAB = 1; // Assume positive endcap and dPhiAB for unpacking CLCT bend int mode15_8b = -1; // Combines track theta, stations with RPC hits, and station 1 bend information int rpc_2b = -1; // Identifies which stations have RPC hits in 3-station tracks - - + + // Unpack variable words from the pT LUT address if (nHits == 4) { - dPhiAB = (address >> (0) & ((1<<7)-1)); - dPhiBC = (address >> (0+7) & ((1<<5)-1)); - dPhiCD = (address >> (0+7+5) & ((1<<4)-1)); + dPhiAB = (address >> (0) & ((1<<7)-1)); + dPhiBC = (address >> (0+7) & ((1<<5)-1)); + dPhiCD = (address >> (0+7+5) & ((1<<4)-1)); sPhiBC = (address >> (0+7+5+4) & ((1<<1)-1)); sPhiCD = (address >> (0+7+5+4+1) & ((1<<1)-1)); dTheta = (address >> (0+7+5+4+1+1) & ((1<<2)-1)); - frA = (address >> (0+7+5+4+1+1+2) & ((1<<1)-1)); + frA = (address >> (0+7+5+4+1+1+2) & ((1<<1)-1)); mode15_8b = (address >> (0+7+5+4+1+1+2+1) & ((1<<8)-1)); mode_ID = (address >> (0+7+5+4+1+1+2+1+8) & ((1<<1)-1)); if (not(address < pow(2, 30))) { edm::LogError("L1T") << "address = " << address; return 0; } } else if (nHits == 3) { - dPhiAB = (address >> (0) & ((1<<7)-1)); - dPhiBC = (address >> (0+7) & ((1<<5)-1)); - sPhiBC = (address >> (0+7+5) & ((1<<1)-1)); - dTheta = (address >> (0+7+5+1) & ((1<<3)-1)); + dPhiAB = (address >> (0) & ((1<<7)-1)); + dPhiBC = (address >> (0+7) & ((1<<5)-1)); + sPhiBC = (address >> (0+7+5) & ((1<<1)-1)); + dTheta = (address >> (0+7+5+1) & ((1<<3)-1)); frA = (address >> (0+7+5+1+3) & ((1<<1)-1)); int bit = 0; - if (mode != 7) { + if (mode != 7) { frB = (address >> (0+7+5+1+3+1) & ((1<<1)-1)); bit = 1; } - clctA = (address >> (0+7+5+1+3+1+bit) & ((1<<2)-1)); + clctA = (address >> (0+7+5+1+3+1+bit) & ((1<<2)-1)); rpc_2b = (address >> (0+7+5+1+3+1+bit+2) & ((1<<2)-1)); theta = (address >> (0+7+5+1+3+1+bit+2+2) & ((1<<5)-1)); if (mode != 7) { @@ -281,12 +281,12 @@ float PtAssignmentEngine2017::calculate_pt_xml(const address_t& address) const { { edm::LogError("L1T") << "address = " << address; return 0; } } } - else if (nHits == 2) { + else if (nHits == 2) { dPhiAB = (address >> (0) & ((1<<7)-1)); - dTheta = (address >> (0+7) & ((1<<3)-1)); - frA = (address >> (0+7+3) & ((1<<1)-1)); - frB = (address >> (0+7+3+1) & ((1<<1)-1)); - clctA = (address >> (0+7+3+1+1) & ((1<<3)-1)); + dTheta = (address >> (0+7) & ((1<<3)-1)); + frA = (address >> (0+7+3) & ((1<<1)-1)); + frB = (address >> (0+7+3+1) & ((1<<1)-1)); + clctA = (address >> (0+7+3+1+1) & ((1<<3)-1)); clctB = (address >> (0+7+3+1+1+3) & ((1<<3)-1)); theta = (address >> (0+7+3+1+1+3+3) & ((1<<5)-1)); mode_ID = (address >> (0+7+3+1+1+3+3+5) & ((1<<3)-1)); @@ -334,7 +334,7 @@ float PtAssignmentEngine2017::calculate_pt_xml(const address_t& address) const { dPhiBC = aux().getdPhiFromBin( dPhiBC, 5, 256 ) * (sPhiBC == 1 ? 1 : -1); St1_ring2 = aux().unpackSt1Ring2( theta, 5 ); aux().unpack2bRPC ( rpc_2b, rpcA, rpcB, rpcC ); - + // // Check bit-wise compression / de-compression // if (not( dTheta == aux().getdTheta( aux().unpackdTheta( dTheta, 3), 3) ); // { edm::LogError("L1T") << " = " << ; return; } @@ -368,39 +368,39 @@ float PtAssignmentEngine2017::calculate_pt_xml(const address_t& address) const { // Fill vectors of variables for XMLs // KK: sequence of variables here should exaclty match block produced by TMVA std::vector predictors; - + // Variables for input to XMLs int dPhiSum4, dPhiSum4A, dPhiSum3, dPhiSum3A, outStPhi; // Convert words into variables for XMLs if (nHits == 4) { - predictors = { theta, St1_ring2, dPhiAB, dPhiBC, dPhiCD, dPhiAB + dPhiBC, - dPhiAB + dPhiBC + dPhiCD, dPhiBC + dPhiCD, frA, clctA }; + predictors = { theta, St1_ring2, dPhiAB, dPhiBC, dPhiCD, dPhiAB + dPhiBC, + dPhiAB + dPhiBC + dPhiCD, dPhiBC + dPhiCD, frA, clctA }; CalcDeltaPhiSums( dPhiSum4, dPhiSum4A, dPhiSum3, dPhiSum3A, outStPhi, - dPhiAB, dPhiAB + dPhiBC, dPhiAB + dPhiBC + dPhiCD, - dPhiBC, dPhiBC + dPhiCD, dPhiCD ); + dPhiAB, dPhiAB + dPhiBC, dPhiAB + dPhiBC + dPhiCD, + dPhiBC, dPhiBC + dPhiCD, dPhiCD ); int tmp[10] = {dPhiSum4, dPhiSum4A, dPhiSum3, dPhiSum3A, outStPhi, dTheta, rpcA, rpcB, rpcC, rpcD }; predictors.insert( predictors.end(), tmp, tmp+10 ); } else if (nHits == 3) { - if (mode == 14) - predictors = { theta, St1_ring2, dPhiAB, dPhiBC, dPhiAB + dPhiBC, - frA, frB, clctA, dTheta, rpcA, rpcB, rpcC }; + if (mode == 14) + predictors = { theta, St1_ring2, dPhiAB, dPhiBC, dPhiAB + dPhiBC, + frA, frB, clctA, dTheta, rpcA, rpcB, rpcC }; else if (mode == 13) - predictors = { theta, St1_ring2, dPhiAB, dPhiAB + dPhiBC, dPhiBC, - frA, frB, clctA, dTheta, rpcA, rpcB, rpcC }; + predictors = { theta, St1_ring2, dPhiAB, dPhiAB + dPhiBC, dPhiBC, + frA, frB, clctA, dTheta, rpcA, rpcB, rpcC }; else if (mode == 11) predictors = { theta, St1_ring2, dPhiBC, dPhiAB, dPhiAB + dPhiBC, - frA, frB, clctA, dTheta, rpcA, rpcB, rpcC }; + frA, frB, clctA, dTheta, rpcA, rpcB, rpcC }; else if (mode == 7) - predictors = { theta, dPhiAB, dPhiBC, dPhiAB + dPhiBC, - frA, clctA, dTheta, rpcA, rpcB, rpcC }; + predictors = { theta, dPhiAB, dPhiBC, dPhiAB + dPhiBC, + frA, clctA, dTheta, rpcA, rpcB, rpcC }; } else if (nHits == 2 && mode >= 8) { predictors = { theta, St1_ring2, dPhiAB, frA, frB, clctA, clctB, dTheta, (clctA == 0), (clctB == 0) }; - } + } else if (nHits == 2 && mode < 8) { predictors = { theta, dPhiAB, frA, frB, clctA, clctB, dTheta, (clctA == 0), (clctB == 0) }; } @@ -409,15 +409,15 @@ float PtAssignmentEngine2017::calculate_pt_xml(const address_t& address) const { // Retreive pT from XMLs std::vector tree_data(predictors.cbegin(),predictors.cend()); - + auto tree_event = std::make_unique(); tree_event->predictedValue = 0; tree_event->data = tree_data; - + // forests_.at(mode).predictEvent(tree_event.get(), 400); emtf::Forest &forest = const_cast(forests_.at(mode)); forest.predictEvent(tree_event.get(), 400); - + // // Adjust this for different XMLs // float log2_pt = tree_event->predictedValue; // pt_xml = pow(2, fmax(0.0, log2_pt)); // Protect against negative values @@ -429,13 +429,13 @@ float PtAssignmentEngine2017::calculate_pt_xml(const address_t& address) const { } // End function: float PtAssignmentEngine2017::calculate_pt_xml(const address_t& address) - + // Calculate XML pT directly from track quantities, without forming an address float PtAssignmentEngine2017::calculate_pt_xml(const EMTFTrack& track) const { float pt_xml = 0.; - + EMTFPtLUT data = track.PtLUT(); - + auto contain = [](const std::vector& vec, int elem) { return (std::find(vec.begin(), vec.end(), elem) != vec.end()); }; @@ -452,7 +452,7 @@ float PtAssignmentEngine2017::calculate_pt_xml(const EMTFTrack& track) const { int st2 = ((mode % 8) >= 4); int st3 = ((mode % 4) >= 2); int st4 = ((mode % 2) == 1); - + // Variables for input to XMLs int dPhi_12, dPhi_13, dPhi_14, dPhi_23, dPhi_24, dPhi_34, dPhiSign; int dPhiSum4, dPhiSum4A, dPhiSum3, dPhiSum3A, outStPhi; @@ -461,11 +461,11 @@ float PtAssignmentEngine2017::calculate_pt_xml(const EMTFTrack& track) const { int bend_1, bend_2, bend_3, bend_4; int RPC_1, RPC_2, RPC_3, RPC_4; int St1_ring2 = data.st1_ring2; - + int ph1 = -99, ph2 = -99, ph3 = -99, ph4 = -99; int th1 = -99, th2 = -99, th3 = -99, th4 = -99; int pat1 = -99, pat2 = -99, pat3 = -99, pat4 = -99; - + // Compute the original phi and theta coordinates if (st2) { ph2 = phi; // Track phi is from station 2 (if it exists), otherwise 3 or 4 @@ -476,13 +476,13 @@ float PtAssignmentEngine2017::calculate_pt_xml(const EMTFTrack& track) const { // Important that phi be from adjacent station pairs (see note below) if (st3 && st4) ph4 = ph3 + data.delta_ph[5]*(data.sign_ph[5] ? 1 : -1); else if (st4) ph4 = ph2 + data.delta_ph[4]*(data.sign_ph[4] ? 1 : -1); - // Important that theta be from first-last station pair, not adjacent pairs: delta_th values are "best" for each pair, but + // Important that theta be from first-last station pair, not adjacent pairs: delta_th values are "best" for each pair, but // thanks to duplicated CSC LCTs, are not necessarily consistent (or physical) between pairs or between delta_th and delta_ph. // This is an artifact of the firmware implementation of deltas: see src/AngleCalculation.cc. if (st1 && st3) th3 = th1 + data.delta_th[1]*(data.sign_th[1] ? 1 : -1); else if (st3) th3 = th2 + data.delta_th[3]*(data.sign_th[3] ? 1 : -1); - if (st1 && st4) th4 = th1 + data.delta_th[2]*(data.sign_th[2] ? 1 : -1); - else if (st4) th4 = th2 + data.delta_th[4]*(data.sign_th[4] ? 1 : -1); + if (st1 && st4) th4 = th1 + data.delta_th[2]*(data.sign_th[2] ? 1 : -1); + else if (st4) th4 = th2 + data.delta_th[4]*(data.sign_th[4] ? 1 : -1); } else if (st3) { ph3 = phi; th3 = theta; @@ -506,40 +506,40 @@ float PtAssignmentEngine2017::calculate_pt_xml(const EMTFTrack& track) const { // BEGIN: Identical (almost) to BDT training code in EMTFPtAssign2017/PtRegression_Apr_2017.C theta = CalcTrackTheta( th1, th2, th3, th4, St1_ring2, mode, true ); - + CalcDeltaPhis( dPhi_12, dPhi_13, dPhi_14, dPhi_23, dPhi_24, dPhi_34, dPhiSign, - dPhiSum4, dPhiSum4A, dPhiSum3, dPhiSum3A, outStPhi, - ph1, ph2, ph3, ph4, mode, true ); - + dPhiSum4, dPhiSum4A, dPhiSum3, dPhiSum3A, outStPhi, + ph1, ph2, ph3, ph4, mode, true ); + CalcDeltaThetas( dTh_12, dTh_13, dTh_14, dTh_23, dTh_24, dTh_34, - th1, th2, th3, th4, mode, true ); - + th1, th2, th3, th4, mode, true ); + FR_1 = (st1 ? data.fr[0] : -99); FR_2 = (st2 ? data.fr[1] : -99); FR_3 = (st3 ? data.fr[2] : -99); FR_4 = (st4 ? data.fr[3] : -99); - + CalcBends( bend_1, bend_2, bend_3, bend_4, - pat1, pat2, pat3, pat4, - dPhiSign, endcap, mode, true ); - + pat1, pat2, pat3, pat4, + dPhiSign, endcap, mode, true ); + RPC_1 = (st1 ? (pat1 == 0) : -99); RPC_2 = (st2 ? (pat2 == 0) : -99); RPC_3 = (st3 ? (pat3 == 0) : -99); RPC_4 = (st4 ? (pat4 == 0) : -99); CalcRPCs( RPC_1, RPC_2, RPC_3, RPC_4, mode, St1_ring2, theta, true ); - + // END: Identical (almost) to BDT training code in EMTFPtAssign2017/PtRegression_Apr_2017.C - - + + // Fill vectors of variables for XMLs // KK: sequence of variables here should exaclty match block produced by TMVA std::vector predictors; switch (mode) { case 15: // 1-2-3-4 predictors = { theta, St1_ring2, dPhi_12, dPhi_23, dPhi_34, dPhi_13, dPhi_14, dPhi_24, FR_1, bend_1, - dPhiSum4, dPhiSum4A, dPhiSum3, dPhiSum3A, outStPhi, dTh_14, RPC_1, RPC_2, RPC_3, RPC_4 }; + dPhiSum4, dPhiSum4A, dPhiSum3, dPhiSum3A, outStPhi, dTh_14, RPC_1, RPC_2, RPC_3, RPC_4 }; break; case 14: // 1-2-3 predictors = { theta, St1_ring2, dPhi_12, dPhi_23, dPhi_13, FR_1, FR_2, bend_1, dTh_13, RPC_1, RPC_2, RPC_3 }; break; @@ -547,7 +547,7 @@ float PtAssignmentEngine2017::calculate_pt_xml(const EMTFTrack& track) const { predictors = { theta, St1_ring2, dPhi_12, dPhi_14, dPhi_24, FR_1, FR_2, bend_1, dTh_14, RPC_1, RPC_2, RPC_4 }; break; case 11: // 1-3-4 predictors = { theta, St1_ring2, dPhi_34, dPhi_13, dPhi_14, FR_1, FR_3, bend_1, dTh_14, RPC_1, RPC_3, RPC_4 }; break; - case 7: // 2-3-4 + case 7: // 2-3-4 predictors = { theta, dPhi_23, dPhi_34, dPhi_24, FR_2, bend_2, dTh_24, RPC_2, RPC_3, RPC_4 }; break; case 12: // 1-2 predictors = { theta, St1_ring2, dPhi_12, FR_1, FR_2, bend_1, bend_2, dTh_12, RPC_1, RPC_2 }; break; @@ -564,15 +564,15 @@ float PtAssignmentEngine2017::calculate_pt_xml(const EMTFTrack& track) const { } std::vector tree_data(predictors.cbegin(),predictors.cend()); - + auto tree_event = std::make_unique(); tree_event->predictedValue = 0; tree_event->data = tree_data; - + // forests_.at(mode).predictEvent(tree_event.get(), 400); emtf::Forest &forest = const_cast(forests_.at(mode)); forest.predictEvent(tree_event.get(), 400); - + // // Adjust this for different XMLs // float log2_pt = tree_event->predictedValue; // pt_xml = pow(2, fmax(0.0, log2_pt)); // Protect against negative values diff --git a/L1Trigger/L1TMuonEndCap/src/PtAssignmentEngineAux2017.cc b/L1Trigger/L1TMuonEndCap/src/PtAssignmentEngineAux2017.cc index 4ae8db94fdaa7..16c4c7c1f7667 100644 --- a/L1Trigger/L1TMuonEndCap/src/PtAssignmentEngineAux2017.cc +++ b/L1Trigger/L1TMuonEndCap/src/PtAssignmentEngineAux2017.cc @@ -14,18 +14,18 @@ static const int dPhiNLBMap_4bit_256Max[16] = {0, 1, 2, 3, 4, 6, 8, 10, 12, 16, 20, 25, 31, 46, 68, 136}; // For use in dPhi23, dPhi24, and dPhi34 in 3- and 4-station modes (7, 11, 13, 14, 15), except for dPhi23 in mode 7 and dPhi34 in mode 15 -static const int dPhiNLBMap_5bit_256Max[32] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 19, 20, 21, 23, 25, 28, 31, 34, 39, 46, 55, 68, 91, 136}; +static const int dPhiNLBMap_5bit_256Max[32] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 19, 20, 21, 23, 25, 28, 31, 34, 39, 46, 55, 68, 91, 136}; // 512 max units---- // For use in all dPhiAB (where "A" and "B" are the first two stations in the track) in all modes -static const int dPhiNLBMap_7bit_512Max[128] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 71, 72, 73, 74, 75, 76, 77, 79, 80, 81, - 83, 84, 86, 87, 89, 91, 92, 94, 96, 98, 100, 102, 105, 107, 110, 112, - 115, 118, 121, 124, 127, 131, 135, 138, 143, 147, 152, 157, 162, 168, 174, 181, - 188, 196, 204, 214, 224, 235, 247, 261, 276, 294, 313, 336, 361, 391, 427, 470}; +static const int dPhiNLBMap_7bit_512Max[128] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 71, 72, 73, 74, 75, 76, 77, 79, 80, 81, + 83, 84, 86, 87, 89, 91, 92, 94, 96, 98, 100, 102, 105, 107, 110, 112, + 115, 118, 121, 124, 127, 131, 135, 138, 143, 147, 152, 157, 162, 168, 174, 181, + 188, 196, 204, 214, 224, 235, 247, 261, 276, 294, 313, 336, 361, 391, 427, 470}; int PtAssignmentEngineAux2017::getNLBdPhi(int dPhi, int bits, int max) const { @@ -44,8 +44,8 @@ int PtAssignmentEngineAux2017::getNLBdPhi(int dPhi, int bits, int max) const { if (bits == 4) { dPhi_ = dPhiNLBMap_4bit_256Max[(1 << bits) - 1]; for (int edge = 0; edge < (1 << bits) - 1; edge++) { - if (dPhiNLBMap_4bit_256Max[edge] <= dPhi && - dPhiNLBMap_4bit_256Max[edge+1] > dPhi) { + if (dPhiNLBMap_4bit_256Max[edge] <= dPhi && + dPhiNLBMap_4bit_256Max[edge+1] > dPhi) { dPhi_ = dPhiNLBMap_4bit_256Max[edge]; break; } @@ -54,8 +54,8 @@ int PtAssignmentEngineAux2017::getNLBdPhi(int dPhi, int bits, int max) const { if (bits == 5) { dPhi_ = dPhiNLBMap_5bit_256Max[(1 << bits) - 1]; for (int edge = 0; edge < (1 << bits) - 1; edge++) { - if (dPhiNLBMap_5bit_256Max[edge] <= dPhi && - dPhiNLBMap_5bit_256Max[edge+1] > dPhi) { + if (dPhiNLBMap_5bit_256Max[edge] <= dPhi && + dPhiNLBMap_5bit_256Max[edge+1] > dPhi) { dPhi_ = dPhiNLBMap_5bit_256Max[edge]; break; } @@ -67,8 +67,8 @@ int PtAssignmentEngineAux2017::getNLBdPhi(int dPhi, int bits, int max) const { if (bits == 7) { dPhi_ = dPhiNLBMap_7bit_512Max[(1 << bits) - 1]; for (int edge = 0; edge < (1 << bits) - 1; edge++) { - if (dPhiNLBMap_7bit_512Max[edge] <= dPhi && - dPhiNLBMap_7bit_512Max[edge+1] > dPhi) { + if (dPhiNLBMap_7bit_512Max[edge] <= dPhi && + dPhiNLBMap_7bit_512Max[edge+1] > dPhi) { dPhi_ = dPhiNLBMap_7bit_512Max[edge]; break; } @@ -93,12 +93,12 @@ int PtAssignmentEngineAux2017::getNLBdPhiBin(int dPhi, int bits, int max) const if (dPhi < 0) sign_ = -1; dPhi = sign_ * dPhi; - + if (max == 256) { if (bits == 4) { for (int edge = 0; edge < (1 << bits) - 1; edge++) { - if (dPhiNLBMap_4bit_256Max[edge] <= dPhi && - dPhiNLBMap_4bit_256Max[edge+1] > dPhi) { + if (dPhiNLBMap_4bit_256Max[edge] <= dPhi && + dPhiNLBMap_4bit_256Max[edge+1] > dPhi) { dPhiBin_ = edge; break; } @@ -106,20 +106,20 @@ int PtAssignmentEngineAux2017::getNLBdPhiBin(int dPhi, int bits, int max) const } // End conditional: if (bits == 4) if (bits == 5) { for (int edge = 0; edge < (1 << bits) - 1; edge++) { - if (dPhiNLBMap_5bit_256Max[edge] <= dPhi && - dPhiNLBMap_5bit_256Max[edge+1] > dPhi) { + if (dPhiNLBMap_5bit_256Max[edge] <= dPhi && + dPhiNLBMap_5bit_256Max[edge+1] > dPhi) { dPhiBin_ = edge; break; } } - } // End conditional: if (bits == 5) + } // End conditional: if (bits == 5) } // End conditional: if (max == 256) else if (max == 512) { if (bits == 7) { for (int edge = 0; edge < (1 << bits) - 1; edge++) { - if (dPhiNLBMap_7bit_512Max[edge] <= dPhi && - dPhiNLBMap_7bit_512Max[edge+1] > dPhi) { + if (dPhiNLBMap_7bit_512Max[edge] <= dPhi && + dPhiNLBMap_7bit_512Max[edge+1] > dPhi) { dPhiBin_ = edge; break; } @@ -143,7 +143,7 @@ int PtAssignmentEngineAux2017::getdPhiFromBin(int dPhiBin, int bits, int max) co if (dPhiBin > (1 << bits) - 1) dPhiBin = (1 << bits) - 1; - + if (max == 256) { if (bits == 4) dPhi_ = dPhiNLBMap_4bit_256Max[dPhiBin]; @@ -164,8 +164,8 @@ int PtAssignmentEngineAux2017::getdPhiFromBin(int dPhiBin, int bits, int max) co int PtAssignmentEngineAux2017::getCLCT(int clct, int endcap, int dPhiSign, int bits) const { - // std::cout << "Inside getCLCT: clct = " << clct << ", endcap = " << endcap - // << ", dPhiSign = " << dPhiSign << ", bits = " << bits << std::endl; + // std::cout << "Inside getCLCT: clct = " << clct << ", endcap = " << endcap + // << ", dPhiSign = " << dPhiSign << ", bits = " << bits << std::endl; if (not( clct >= 0 && clct <= 10 && abs(endcap) == 1 && abs(dPhiSign) == 1 && (bits == 2 || bits == 3) )) @@ -179,7 +179,7 @@ int PtAssignmentEngineAux2017::getCLCT(int clct, int endcap, int dPhiSign, int b // CLCT pattern can be converted into |bend| x sign as follows: // |bend| = (10 + (pattern % 2) - pattern) / 2 // * 10 --> 0, 9/8 --> 1, 7/6 --> 2, 5/4 --> 3, 3/2 --> 4, 0 indicates RPC hit - // sign = ((pattern % 2) == 1 ? -1 : 1) * (endcap == 1 ? -1 : 1) + // sign = ((pattern % 2) == 1 ? -1 : 1) * (endcap == 1 ? -1 : 1) // * In ME+, even CLCTs have negative sign, odd CLCTs have positive // For use in all 3- and 4-station modes (7, 11, 13, 14, 15) @@ -230,8 +230,8 @@ int PtAssignmentEngineAux2017::getCLCT(int clct, int endcap, int dPhiSign, int b int PtAssignmentEngineAux2017::unpackCLCT(int clct, int endcap, int dPhiSign, int bits) const { - // std::cout << "Inside unpackCLCT: clct = " << clct << ", endcap = " << endcap - // << ", dPhiSign = " << dPhiSign << ", bits = " << bits << std::endl; + // std::cout << "Inside unpackCLCT: clct = " << clct << ", endcap = " << endcap + // << ", dPhiSign = " << dPhiSign << ", bits = " << bits << std::endl; if (not(bits == 2 || bits == 3)) { edm::LogError("L1T") << "bits = " << bits; return 0; } @@ -251,7 +251,7 @@ int PtAssignmentEngineAux2017::unpackCLCT(int clct, int endcap, int dPhiSign, in case 3: clct_ = (sign_ > 0 ? 4 : 5); break; case 0: clct_ = 0; break; default: break; - } + } } else if (bits == 3) { switch (clct) { case 4: clct_ = 10; break; @@ -365,14 +365,14 @@ int PtAssignmentEngineAux2017::getTheta(int theta, int st1_ring2, int bits) cons if (st1_ring2 == 0) { // Should rarely fail ... should change to using ME1 for track theta - AWB 05.06.17 if (theta > 52) { - // std::cout << "\n\n*** Bizzare case of mode 15 track with ME1/1 LCT and track theta = " << theta << std::endl; - } + // std::cout << "\n\n*** Bizzare case of mode 15 track with ME1/1 LCT and track theta = " << theta << std::endl; + } theta_ = (std::min( std::max(theta, 5), 52) - 5) / 6; } else if (st1_ring2 == 1) { // Should rarely fail ... should change to using ME1 for track theta - AWB 05.06.17 if (theta < 46 || theta > 87) { - // std::cout << "\n\n*** Bizzare case of mode 15 track with ME1/2 LCT and track theta = " << theta << std::endl; + // std::cout << "\n\n*** Bizzare case of mode 15 track with ME1/2 LCT and track theta = " << theta << std::endl; } theta_ = ((std::min( std::max(theta, 46), 87) - 46) / 7) + 8; } @@ -447,10 +447,10 @@ int PtAssignmentEngineAux2017::get2bRPC(int clctA, int clctB, int clctC) const { int rpc_2b = -99; - if (clctA == 0) rpc_2b = 0; - else if (clctC == 0) rpc_2b = 1; - else if (clctB == 0) rpc_2b = 2; - else rpc_2b = 3; + if (clctA == 0) rpc_2b = 0; + else if (clctC == 0) rpc_2b = 1; + else if (clctB == 0) rpc_2b = 2; + else rpc_2b = 3; if (not(rpc_2b >= 0 && rpc_2b < 4)) { edm::LogError("L1T") << "rpc_2b = " << rpc_2b; return 0; } @@ -473,10 +473,10 @@ void PtAssignmentEngineAux2017::unpack2bRPC(int rpc_2b, int& rpcA, int& rpcB, in int PtAssignmentEngineAux2017::get8bMode15(int theta, int st1_ring2, int endcap, int sPhiAB, - int clctA, int clctB, int clctC, int clctD) const { + int clctA, int clctB, int clctC, int clctD) const { - // std::cout << "Inside get8bMode15, theta = " << theta << ", st1_ring2 = " << st1_ring2 << ", endcap = " << endcap << ", sPhiAB = " << sPhiAB - // << ", clctA = " << clctA << ", clctB = " << clctB << ", clctC = " << clctC << ", clctD = " << clctD << std::endl; + // std::cout << "Inside get8bMode15, theta = " << theta << ", st1_ring2 = " << st1_ring2 << ", endcap = " << endcap << ", sPhiAB = " << sPhiAB + // << ", clctA = " << clctA << ", clctB = " << clctB << ", clctC = " << clctC << ", clctD = " << clctD << std::endl; if (st1_ring2) theta = (std::min( std::max(theta, 46), 87) - 46) / 7; else theta = (std::min( std::max(theta, 5), 52) - 5) / 6; @@ -484,28 +484,28 @@ int PtAssignmentEngineAux2017::get8bMode15(int theta, int st1_ring2, int endcap, { edm::LogError("L1T") << "theta = " << theta; return 0; } int clctA_2b = getCLCT(clctA, endcap, sPhiAB, 2); - + int nRPC = (clctA == 0) + (clctB == 0) + (clctC == 0) + (clctD == 0); int rpc_word, rpc_clct, mode15_8b; if (st1_ring2) { - if (nRPC >= 2 && clctA == 0 && clctB == 0) rpc_word = 0; - else if (nRPC >= 2 && clctA == 0 && clctC == 0) rpc_word = 1; - else if (nRPC >= 2 && clctA == 0 && clctD == 0) rpc_word = 2; - else if (nRPC == 1 && clctA == 0 ) rpc_word = 3; - else if (nRPC >= 2 && clctD == 0 && clctB == 0) rpc_word = 4; - else if (nRPC >= 2 && clctD == 0 && clctC == 0) rpc_word = 8; - else if (nRPC >= 2 && clctB == 0 && clctC == 0) rpc_word = 12; - else if (nRPC == 1 && clctD == 0 ) rpc_word = 16; - else if (nRPC == 1 && clctB == 0 ) rpc_word = 20; - else if (nRPC == 1 && clctC == 0 ) rpc_word = 24; + if (nRPC >= 2 && clctA == 0 && clctB == 0) rpc_word = 0; + else if (nRPC >= 2 && clctA == 0 && clctC == 0) rpc_word = 1; + else if (nRPC >= 2 && clctA == 0 && clctD == 0) rpc_word = 2; + else if (nRPC == 1 && clctA == 0 ) rpc_word = 3; + else if (nRPC >= 2 && clctD == 0 && clctB == 0) rpc_word = 4; + else if (nRPC >= 2 && clctD == 0 && clctC == 0) rpc_word = 8; + else if (nRPC >= 2 && clctB == 0 && clctC == 0) rpc_word = 12; + else if (nRPC == 1 && clctD == 0 ) rpc_word = 16; + else if (nRPC == 1 && clctB == 0 ) rpc_word = 20; + else if (nRPC == 1 && clctC == 0 ) rpc_word = 24; else rpc_word = 28; rpc_clct = rpc_word + clctA_2b; mode15_8b = (theta*32) + rpc_clct + 64; } else { - if (theta >= 4 && clctD == 0) rpc_word = 0; - else if (theta >= 4 && clctC == 0) rpc_word = 1; - else if (theta >= 4 ) rpc_word = 2; + if (theta >= 4 && clctD == 0) rpc_word = 0; + else if (theta >= 4 && clctC == 0) rpc_word = 1; + else if (theta >= 4 ) rpc_word = 2; else rpc_word = 3; rpc_clct = rpc_word*4 + clctA_2b; mode15_8b = ((theta % 4)*16) + rpc_clct; @@ -542,7 +542,7 @@ void PtAssignmentEngineAux2017::unpack8bMode15( int mode15_8b, int& theta, int& if (st1_ring2) { rpc_clct = (mode15_8b % 32); - theta = (mode15_8b - 64 - rpc_clct) / 32; + theta = (mode15_8b - 64 - rpc_clct) / 32; theta += 8; if (rpc_clct < 4) clctA_2b = 0; @@ -587,7 +587,7 @@ void PtAssignmentEngineAux2017::unpack8bMode15( int mode15_8b, int& theta, int& } // std::cout << " * Output theta = " << theta << ", st1_ring2 = " << st1_ring2 << ", clctA = " << clctA - // << ", rpcA = " << rpcA << ", rpcB = " << rpcB << ", rpcC = " << rpcC << ", rpcD = " << rpcD << std::endl; + // << ", rpcA = " << rpcA << ", rpcB = " << rpcB << ", rpcC = " << rpcC << ", rpcD = " << rpcD << std::endl; if (not(nRPC >= 0)) { edm::LogError("L1T") << "nRPC = " << nRPC; return; } diff --git a/L1Trigger/L1TMuonEndCap/src/PtLUTWriter.cc b/L1Trigger/L1TMuonEndCap/src/PtLUTWriter.cc index 4cfd63926d87c..28eb4bce60aaa 100644 --- a/L1Trigger/L1TMuonEndCap/src/PtLUTWriter.cc +++ b/L1Trigger/L1TMuonEndCap/src/PtLUTWriter.cc @@ -40,7 +40,7 @@ void PtLUTWriter::write(const std::string& lut_full_path, const uint16_t num_, c throw std::invalid_argument(what); } - if (num_ == 1) + if (num_ == 1) ptlut_.at(0) = version_; // address 0 is the pT LUT version number typedef uint64_t full_word_t; diff --git a/L1Trigger/L1TMuonEndCap/src/PtLutVarCalc.cc b/L1Trigger/L1TMuonEndCap/src/PtLutVarCalc.cc index 998bdab4df6d8..7ff4b78a395d6 100644 --- a/L1Trigger/L1TMuonEndCap/src/PtLutVarCalc.cc +++ b/L1Trigger/L1TMuonEndCap/src/PtLutVarCalc.cc @@ -10,7 +10,7 @@ PtAssignmentEngineAux2017 ENG; int CalcTrackTheta( const int th1, const int th2, const int th3, const int th4, - const int st1_ring2, const int mode, const bool BIT_COMP ) { + const int st1_ring2, const int mode, const bool BIT_COMP ) { int theta = -99; @@ -34,8 +34,8 @@ int CalcTrackTheta( const int th1, const int th2, const int th3, const int th4, void CalcDeltaPhis( int& dPh12, int& dPh13, int& dPh14, int& dPh23, int& dPh24, int& dPh34, int& dPhSign, - int& dPhSum4, int& dPhSum4A, int& dPhSum3, int& dPhSum3A, int& outStPh, - const int ph1, const int ph2, const int ph3, const int ph4, const int mode, const bool BIT_COMP ) { + int& dPhSum4, int& dPhSum4A, int& dPhSum3, int& dPhSum3A, int& outStPh, + const int ph1, const int ph2, const int ph3, const int ph4, const int mode, const bool BIT_COMP ) { dPh12 = ph2 - ph1; dPh13 = ph3 - ph1; @@ -116,15 +116,15 @@ void CalcDeltaPhis( int& dPh12, int& dPh13, int& dPh14, int& dPh23, int& dPh24, // Compute summed quantities if (mode == 15) CalcDeltaPhiSums( dPhSum4, dPhSum4A, dPhSum3, dPhSum3A, outStPh, - dPh12, dPh13, dPh14, dPh23, dPh24, dPh34 ); + dPh12, dPh13, dPh14, dPh23, dPh24, dPh34 ); } // End function: CalcDeltaPhis() void CalcDeltaThetas( int& dTh12, int& dTh13, int& dTh14, int& dTh23, int& dTh24, int& dTh34, - const int th1, const int th2, const int th3, const int th4, const int mode, const bool BIT_COMP ) { - + const int th1, const int th2, const int th3, const int th4, const int mode, const bool BIT_COMP ) { + dTh12 = th2 - th1; dTh13 = th3 - th1; dTh14 = th4 - th1; @@ -148,14 +148,14 @@ void CalcDeltaThetas( int& dTh12, int& dTh13, int& dTh14, int& dTh23, int& dTh24 void CalcBends( int& bend1, int& bend2, int& bend3, int& bend4, - const int pat1, const int pat2, const int pat3, const int pat4, - const int dPhSign, const int endcap, const int mode, const bool BIT_COMP ) { + const int pat1, const int pat2, const int pat3, const int pat4, + const int dPhSign, const int endcap, const int mode, const bool BIT_COMP ) { bend1 = CalcBendFromPattern( pat1, endcap ); bend2 = CalcBendFromPattern( pat2, endcap ); bend3 = CalcBendFromPattern( pat3, endcap ); bend4 = CalcBendFromPattern( pat4, endcap ); - + if (BIT_COMP) { int nBits = 3; if (mode == 7 || mode == 11 || mode > 12) @@ -170,11 +170,11 @@ void CalcBends( int& bend1, int& bend2, int& bend3, int& bend4, if ( (mode % 2) > 0 ) // Has station 4 hit bend4 = ENG.getCLCT( pat4, endcap, dPhSign, nBits ); } // End conditional: if (BIT_COMP) - + } // End function: CalcBends() void CalcRPCs( int& RPC1, int& RPC2, int& RPC3, int& RPC4, const int mode, - const int st1_ring2, const int theta, const bool BIT_COMP ) { + const int st1_ring2, const int theta, const bool BIT_COMP ) { if (BIT_COMP) { @@ -184,55 +184,55 @@ void CalcRPCs( int& RPC1, int& RPC2, int& RPC3, int& RPC4, const int mode, RPC1 = 0; RPC2 = 0; if (theta < 4) { - RPC3 = 0; - RPC4 = 0; + RPC3 = 0; + RPC4 = 0; } } int nRPC = (RPC1 == 1) + (RPC2 == 1) + (RPC3 == 1) + (RPC4 == 1); - + // In 3- and 4-station modes, only specify some combinations of RPCs if (nRPC >= 2) { if (mode == 15) { - if (RPC1 == 1 && RPC2 == 1) { - RPC3 = 0; - RPC4 = 0; - } else if (RPC1 == 1 && RPC3 == 1) { - RPC4 = 0; - } else if (RPC4 == 1 && RPC2 == 1) { - RPC3 = 0; - } else if (RPC3 == 1 && RPC4 == 1 && !st1_ring2) { - RPC3 = 0; - } + if (RPC1 == 1 && RPC2 == 1) { + RPC3 = 0; + RPC4 = 0; + } else if (RPC1 == 1 && RPC3 == 1) { + RPC4 = 0; + } else if (RPC4 == 1 && RPC2 == 1) { + RPC3 = 0; + } else if (RPC3 == 1 && RPC4 == 1 && !st1_ring2) { + RPC3 = 0; + } } else if (mode == 14) { - if (RPC1 == 1) { - RPC2 = 0; - RPC3 = 0; - } else if (RPC3 == 1) { - RPC2 = 0; - } + if (RPC1 == 1) { + RPC2 = 0; + RPC3 = 0; + } else if (RPC3 == 1) { + RPC2 = 0; + } } else if (mode == 13) { - if (RPC1 == 1) { - RPC2 = 0; - RPC4 = 0; - } else if (RPC4 == 1) { - RPC2 = 0; - } + if (RPC1 == 1) { + RPC2 = 0; + RPC4 = 0; + } else if (RPC4 == 1) { + RPC2 = 0; + } } else if (mode == 11) { - if (RPC1 == 1) { - RPC3 = 0; - RPC4 = 0; - } else if (RPC4 == 1) { - RPC3 = 0; - } + if (RPC1 == 1) { + RPC3 = 0; + RPC4 = 0; + } else if (RPC4 == 1) { + RPC3 = 0; + } } else if (mode == 7) { - if (RPC2 == 1) { - RPC3 = 0; - RPC4 = 0; - } else if (RPC4 == 1) { - RPC3 = 0; - } + if (RPC2 == 1) { + RPC3 = 0; + RPC4 = 0; + } else if (RPC4 == 1) { + RPC3 = 0; + } } } // End conditional: if (nRPC >= 2) @@ -265,7 +265,7 @@ int CalcBendFromPattern( const int pattern, const int endcap ) { void CalcDeltaPhiSums( int& dPhSum4, int& dPhSum4A, int& dPhSum3, int& dPhSum3A, int& outStPh, - const int dPh12, const int dPh13, const int dPh14, const int dPh23, const int dPh24, const int dPh34 ) { + const int dPh12, const int dPh13, const int dPh14, const int dPh23, const int dPh24, const int dPh34 ) { dPhSum4 = dPh12 + dPh13 + dPh14 + dPh23 + dPh24 + dPh34; dPhSum4A = abs(dPh12) + abs(dPh13) + abs(dPh14) + abs(dPh23) + abs(dPh24) + abs(dPh34); @@ -273,13 +273,13 @@ void CalcDeltaPhiSums( int& dPhSum4, int& dPhSum4A, int& dPhSum3, int& dPhSum3A, int devSt2 = abs(dPh12) + abs(dPh23) + abs(dPh24); int devSt3 = abs(dPh13) + abs(dPh23) + abs(dPh34); int devSt4 = abs(dPh14) + abs(dPh24) + abs(dPh34); - + if (devSt4 > devSt3 && devSt4 > devSt2 && devSt4 > devSt1) outStPh = 4; else if (devSt3 > devSt4 && devSt3 > devSt2 && devSt3 > devSt1) outStPh = 3; else if (devSt2 > devSt4 && devSt2 > devSt3 && devSt2 > devSt1) outStPh = 2; else if (devSt1 > devSt4 && devSt1 > devSt3 && devSt1 > devSt2) outStPh = 1; else outStPh = 0; - + if (outStPh == 4) { dPhSum3 = dPh12 + dPh13 + dPh23; dPhSum3A = abs(dPh12) + abs(dPh13) + abs(dPh23); diff --git a/L1Trigger/L1TMuonEndCap/src/SectorProcessor.cc b/L1Trigger/L1TMuonEndCap/src/SectorProcessor.cc index 37f14846937bb..a4232bffda194 100644 --- a/L1Trigger/L1TMuonEndCap/src/SectorProcessor.cc +++ b/L1Trigger/L1TMuonEndCap/src/SectorProcessor.cc @@ -111,7 +111,7 @@ void SectorProcessor::configure_by_fw_version(unsigned fw_version) { // ___________________________________________________________________________ // Versions in 2017 - no full documentation, can refer to https://twiki.cern.ch/twiki/bin/viewauth/CMS/L1KnownIssues - + // Before July 9th (runs < 298653), all mode 7 tracks (station 2-3-4) assigned quality 11 // July 9th - 29th (runs 298653 - 300087), mode 7 tracks with |eta| > 1.6 in sector -6 assigned quality 12 // After July 29th (runs >= 300088), mode 7 track promotion applied in all sectors @@ -140,20 +140,20 @@ void SectorProcessor::configure_by_fw_version(unsigned fw_version) { fixME11Edges_ = false; pattDefinitions_ = { "4,15:15,7:7,7:7,7:7", - "3,16:16,7:7,7:6,7:6", - "3,14:14,7:7,8:7,8:7", - "2,18:17,7:7,7:5,7:5", // Should be 7:4 in ME3,4 (FW bug) - "2,13:12,7:7,10:7,10:7", - "1,22:19,7:7,7:0,7:0", - "1,11:8,7:7,14:7,14:7", - "0,30:23,7:7,7:0,7:0", - "0,7:0,7:7,14:7,14:7" }; + "3,16:16,7:7,7:6,7:6", + "3,14:14,7:7,8:7,8:7", + "2,18:17,7:7,7:5,7:5", // Should be 7:4 in ME3,4 (FW bug) + "2,13:12,7:7,10:7,10:7", + "1,22:19,7:7,7:0,7:0", + "1,11:8,7:7,14:7,14:7", + "0,30:23,7:7,7:0,7:0", + "0,7:0,7:7,14:7,14:7" }; // Straightness, hits in ME1, hits in ME2, hits in ME3, hits in ME4 symPattDefinitions_ = { "4,15:15:15:15,7:7:7:7,7:7:7:7,7:7:7:7", - "3,16:16:14:14,7:7:7:7,8:7:7:6,8:7:7:6", - "2,18:17:13:12,7:7:7:7,10:7:7:4,10:7:7:4", - "1,22:19:11:8,7:7:7:7,14:7:7:0,14:7:7:0", - "0,30:23:7:0,7:7:7:7,14:7:7:0,14:7:7:0" }; + "3,16:16:14:14,7:7:7:7,8:7:7:6,8:7:7:6", + "2,18:17:13:12,7:7:7:7,10:7:7:4,10:7:7:4", + "1,22:19:11:8,7:7:7:7,14:7:7:0,14:7:7:0", + "0,30:23:7:0,7:7:7:7,14:7:7:0,14:7:7:0" }; thetaWindow_ = 4; // Maximum dTheta between primitives in the same track useSingleHits_ = false; // Build "tracks" from single LCTs in ME1/1 @@ -164,7 +164,7 @@ void SectorProcessor::configure_by_fw_version(unsigned fw_version) { bugGMTPhi_ = true; promoteMode7_ = false; // Assign station 2-3-4 tracks with |eta| > 1.6 SingleMu quality } // End default settings for 2016 - + // ___________________________________________________________________________ // Versions in 2016 - refer to docs/EMTF_FW_LUT_versions_2016_draft2.xlsx diff --git a/L1Trigger/L1TMuonEndCap/src/SectorProcessorLUT.cc b/L1Trigger/L1TMuonEndCap/src/SectorProcessorLUT.cc index 27c9d2e101b72..def3139724e10 100644 --- a/L1Trigger/L1TMuonEndCap/src/SectorProcessorLUT.cc +++ b/L1Trigger/L1TMuonEndCap/src/SectorProcessorLUT.cc @@ -26,7 +26,7 @@ void SectorProcessorLUT::read(unsigned pc_lut_version) { coord_lut_dir = "ph_lut_v1"; // All year 2016 else if (pc_lut_version == 1) coord_lut_dir = "ph_lut_v2"; // Beginning of 2017 - else + else throw cms::Exception("SectorProcessorLUT") << "Trying to use EMTF pc_lut_version = " << pc_lut_version << ", does not exist!"; // Will catch user trying to run with Global Tag settings on 2016 data, rather than fakeEmtfParams. - AWB 08.06.17 diff --git a/L1Trigger/L1TMuonEndCap/src/SingleHitTrack.cc b/L1Trigger/L1TMuonEndCap/src/SingleHitTrack.cc index db030cffd88d7..bca987eb983d1 100644 --- a/L1Trigger/L1TMuonEndCap/src/SingleHitTrack.cc +++ b/L1Trigger/L1TMuonEndCap/src/SingleHitTrack.cc @@ -42,19 +42,19 @@ void SingleHitTrack::process( // Require subsector and CSC ID to match if (conv_hits_it.Subsector() != subsector || conv_hits_it.CSC_ID() != CSC_ID) - continue; + continue; // Only consider CSC LCTs if (conv_hits_it.Is_CSC() != 1) - continue; - + continue; + // Only consider hits in station 1, ring 1 if (conv_hits_it.Station() != 1 || (conv_hits_it.Ring() % 3) != 1) - continue; - + continue; + // Only consider hits in the same sector (not neighbor hits) if ( (conv_hits_it.Endcap() == 1) != (endcap_ == 1) || conv_hits_it.Sector() != sector_ ) - continue; + continue; // Check if a hit has already been used in a track bool already_used = false; @@ -62,34 +62,34 @@ void SingleHitTrack::process( // Loop over existing multi-hit tracks for (const auto & best_tracks_it : best_tracks) { - // Only consider tracks with a hit in station 1 - if (best_tracks_it.Mode() < 8) - continue; - - // Check if hit in track is identical - // "Duplicate" hits (with same strip but different wire) are considered identical - // const EMTFHit& conv_hit_i = *conv_hits_it; - const EMTFHit& conv_hit_j = best_tracks_it.Hits().front(); - - if ( - (conv_hits_it.Subsystem() == conv_hit_j.Subsystem()) && - (conv_hits_it.PC_station() == conv_hit_j.PC_station()) && - (conv_hits_it.PC_chamber() == conv_hit_j.PC_chamber()) && - ((conv_hits_it.Ring() % 3) == (conv_hit_j.Ring() % 3)) && // because of ME1/1 - (conv_hits_it.Strip() == conv_hit_j.Strip()) && - // (conv_hits_it.Wire() == conv_hit_j.Wire()) && - (conv_hits_it.BX() == conv_hit_j.BX()) && - true - ) { - already_used = true; - break; - } + // Only consider tracks with a hit in station 1 + if (best_tracks_it.Mode() < 8) + continue; + + // Check if hit in track is identical + // "Duplicate" hits (with same strip but different wire) are considered identical + // const EMTFHit& conv_hit_i = *conv_hits_it; + const EMTFHit& conv_hit_j = best_tracks_it.Hits().front(); + + if ( + (conv_hits_it.Subsystem() == conv_hit_j.Subsystem()) && + (conv_hits_it.PC_station() == conv_hit_j.PC_station()) && + (conv_hits_it.PC_chamber() == conv_hit_j.PC_chamber()) && + ((conv_hits_it.Ring() % 3) == (conv_hit_j.Ring() % 3)) && // because of ME1/1 + (conv_hits_it.Strip() == conv_hit_j.Strip()) && + // (conv_hits_it.Wire() == conv_hit_j.Wire()) && + (conv_hits_it.BX() == conv_hit_j.BX()) && + true + ) { + already_used = true; + break; + } } // End loop: for (const auto & best_tracks_it : best_tracks) // Only use hits that have not been used in a track if (already_used) - continue; - + continue; + int zone = -1; int zone_code = conv_hits_it.Zone_code(); if (zone_code & 0b1000) zone = 4; @@ -102,10 +102,10 @@ void SingleHitTrack::process( EMTFTrack new_trk; new_trk.push_Hit ( conv_hits_it ); - + EMTFPtLUT empty_LUT = {}; new_trk.set_PtLUT ( empty_LUT ); - + new_trk.set_endcap ( conv_hits_it.Endcap() ); new_trk.set_sector ( conv_hits_it.Sector() ); new_trk.set_sector_idx ( conv_hits_it.Sector_idx() ); @@ -126,19 +126,19 @@ void SingleHitTrack::process( new_trk.set_phi_loc ( conv_hits_it.Phi_loc() ); new_trk.set_phi_glob ( conv_hits_it.Phi_glob() ); new_trk.set_track_num ( maxTracks_ - 1 ); - + one_hit_trks.push_back( new_trk ); - + if (int(best_tracks.size()) + int(one_hit_trks.size()) >= maxTracks_) - break; - + break; + // Firmware only sends one single-hit track per sector - if (!one_hit_trks.empty()) - break; + if (!one_hit_trks.empty()) + break; } // End loop: for (const auto & conv_hits_it : conv_hits) - if (!one_hit_trks.empty()) + if (!one_hit_trks.empty()) break; } // End loop: for (int sub_ID = 5; sub_ID > 0; sub_ID--) { diff --git a/L1Trigger/L1TMuonEndCap/src/TrackFinder.cc b/L1Trigger/L1TMuonEndCap/src/TrackFinder.cc index 42ff902830c0f..158630ec35fa8 100644 --- a/L1Trigger/L1TMuonEndCap/src/TrackFinder.cc +++ b/L1Trigger/L1TMuonEndCap/src/TrackFinder.cc @@ -79,7 +79,7 @@ TrackFinder::TrackFinder(const edm::ParameterSet& iConfig, edm::ConsumesCollecto for (int endcap = emtf::MIN_ENDCAP; endcap <= emtf::MAX_ENDCAP; ++endcap) { for (int sector = emtf::MIN_TRIGSECTOR; sector <= emtf::MAX_TRIGSECTOR; ++sector) { const int es = (endcap - emtf::MIN_ENDCAP) * (emtf::MAX_TRIGSECTOR - emtf::MIN_TRIGSECTOR + 1) + (sector - emtf::MIN_TRIGSECTOR); - + sector_processors_.at(es).configure( &geometry_translator_, &condition_helper_, diff --git a/L1Trigger/L1TMuonEndCap/src/bdt/Forest.cc b/L1Trigger/L1TMuonEndCap/src/bdt/Forest.cc index e8da07a5b040c..adee9b9736559 100644 --- a/L1Trigger/L1TMuonEndCap/src/bdt/Forest.cc +++ b/L1Trigger/L1TMuonEndCap/src/bdt/Forest.cc @@ -8,7 +8,7 @@ // Tibshirani, and Friedman. // // *Greedy Function Approximation: A Gradient Boosting Machine. // // Friedman. The Annals of Statistics, Vol. 29, No. 5. Oct 2001. // -// *Inductive Learning of Tree-based Regression Models. Luis Torgo. // +// *Inductive Learning of Tree-based Regression Models. Luis Torgo. // // // ////////////////////////////////////////////////////////////////////////// @@ -80,7 +80,7 @@ Forest::Forest(const Forest &forest) Forest& Forest::operator=(const Forest &forest) { for(unsigned int i=0; i < trees.size(); i++) - { + { if(trees[i]) delete trees[i]; } trees.resize(0); @@ -104,14 +104,14 @@ void Forest::setTrainingEvents(std::vector& trainingEvents) Event* e = trainingEvents[0]; // Unused variable // unsigned int numrows = e->data.size(); - - // Reset the events matrix. + + // Reset the events matrix. events = std::vector< std::vector >(); - for(unsigned int i=0; idata.size(); i++) - { + for(unsigned int i=0; idata.size(); i++) + { events.push_back(trainingEvents); - } + } } ////////////////////////////////////////////////////////////////////////// @@ -127,8 +127,8 @@ std::vector Forest::getTrainingEvents(){ return events[0]; } // return the ith tree Tree* Forest::getTree(unsigned int i) -{ - if(/*i>=0 && */i=0 && */i >& e) for(unsigned int j=0; joutputEvent(); - } + } std::cout << std::endl; } } @@ -221,7 +221,7 @@ void Forest::rankVariables(std::vector& rank) // This function ranks the determining variables according to their importance // in determining the fit. Use a low learning rate for better results. // Separates completely useless variables from useful ones well, -// but isn't the best at separating variables of similar importance. +// but isn't the best at separating variables of similar importance. // This is calculated using the error reduction on the training set. The function // should be changed to use the testing set, but this works fine for now. // I will try to change this in the future. @@ -234,18 +234,18 @@ void Forest::rankVariables(std::vector& rank) for(unsigned int j=0; j < trees.size(); j++) { - trees[j]->rankVariables(v); + trees[j]->rankVariables(v); } double max = *std::max_element(v.begin(), v.end()); - + // Scale the importance. Maximum importance = 100. for(unsigned int i=0; i < v.size(); i++) { v[i] = 100*v[i]/max; } - // Change the storage format so that we can keep the index + // Change the storage format so that we can keep the index // and the value associated after sorting. std::vector< std::pair > w(events.size()); @@ -261,9 +261,9 @@ void Forest::rankVariables(std::vector& rank) for(int i=(v.size()-1); i>=0; i--) { rank.push_back(w[i].second); - // std::cout << "x" << w[i].second << ": " << w[i].first << std::endl; + // std::cout << "x" << w[i].second << ": " << w[i].first << std::endl; } - + // std::cout << std::endl << "Done." << std::endl << std::endl; } @@ -287,7 +287,7 @@ void Forest::saveSplitValues(const char* savefilename) // Gather the split values from each tree in the forest. for(unsigned int j=0; jgetSplitValues(v); + trees[j]->getSplitValues(v); } // Sort the lists of split values and remove the duplicates. @@ -307,7 +307,7 @@ void Forest::saveSplitValues(const char* savefilename) std::stringstream ss; ss.precision(14); ss << std::scientific << v[i][j]; - splitValues+=","; + splitValues+=","; splitValues+=ss.str().c_str(); } @@ -330,7 +330,7 @@ void Forest::updateRegTargets(Tree* tree, double learningRate, LossFunction* l) // Loop through the terminal nodes. for(std::list::iterator it=tn.begin(); it!=tn.end(); it++) - { + { // Get the events in the current terminal region. std::vector& v = (*it)->getEvents()[0]; @@ -370,21 +370,21 @@ void Forest::updateEvents(Tree* tree) // Loop through the terminal nodes. for(std::list::iterator it=tn.begin(); it!=tn.end(); it++) - { + { std::vector& v = (*it)->getEvents()[0]; double fit = (*it)->getFitValue(); // Loop through each event in the terminal region and update the // the global event it maps to. for(unsigned int j=0; jpredictedValue += fit; - } + } // Release memory. (*it)->getEvents() = std::vector< std::vector >(); - } + } } ////////////////////////////////////////////////////////////////////////// @@ -414,14 +414,14 @@ void Forest::doRegression(int nodeLimit, int treeLimit, double learningRate, Los { // std::cout << "++Building Tree " << i << "... " << std::endl; Tree* tree = new Tree(events); - trees.push_back(tree); + trees.push_back(tree); tree->buildTree(nodeLimit); // Update the targets for the next tree to fit. updateRegTargets(tree, learningRate, l); // Save trees to xml in some directory. - std::ostringstream ss; + std::ostringstream ss; ss << savetreesdirectory << "/" << i << ".xml"; std::string s = ss.str(); const char* c = s.c_str(); @@ -450,7 +450,7 @@ void Forest::predictEvents(std::vector& eventsp, unsigned int numtrees) } // i iterates through the trees in the forest. Each tree corrects the last prediction. - for(unsigned int i=0; i < numtrees; i++) + for(unsigned int i=0; i < numtrees; i++) { //std::cout << "++Tree " << i << "..." << std::endl; appendCorrection(eventsp, i); @@ -466,7 +466,7 @@ void Forest::appendCorrection(std::vector& eventsp, int treenum) // Update the prediction by appending the next correction. Tree* tree = trees[treenum]; - tree->filterEvents(eventsp); + tree->filterEvents(eventsp); // Update the events with their new prediction. updateEvents(tree); @@ -488,10 +488,10 @@ void Forest::predictEvent(Event* e, unsigned int numtrees) } // just like in line #2470 of https://root.cern.ch/doc/master/MethodBDT_8cxx_source.html for gradient boosting - e->predictedValue = trees[0]->getBoostWeight(); + e->predictedValue = trees[0]->getBoostWeight(); // i iterates through the trees in the forest. Each tree corrects the last prediction. - for(unsigned int i=0; i < numtrees; i++) + for(unsigned int i=0; i < numtrees; i++) { //std::cout << "++Tree " << i << "..." << std::endl; appendCorrection(e, i); @@ -507,7 +507,7 @@ void Forest::appendCorrection(Event* e, int treenum) // Update the prediction by appending the next correction. Tree* tree = trees[treenum]; - Node* terminalNode = tree->filterEvent(e); + Node* terminalNode = tree->filterEvent(e); // Update the event with its new prediction. double fit = terminalNode->getFitValue(); @@ -526,15 +526,15 @@ void Forest::loadForestFromXML(const char* directory, unsigned int numTrees) // Load the Forest. // std::cout << std::endl << "Loading Forest from XML ... " << std::endl; - for(unsigned int i=0; i < numTrees; i++) - { - trees[i] = new Tree(); + for(unsigned int i=0; i < numTrees; i++) + { + trees[i] = new Tree(); std::stringstream ss; ss << directory << "/" << i << ".xml"; trees[i]->loadFromXML(edm::FileInPath(ss.str().c_str()).fullPath().c_str()); - } + } //std::cout << "Done." << std::endl << std::endl; } @@ -579,14 +579,14 @@ void Forest::prepareRandomSubsample(double fraction) shuffle(events[0].begin(), events[0].end(), subSampleSize); // Get a copy of the random subset we just made. - std::vector v(events[0].begin(), events[0].begin()+subSampleSize); + std::vector v(events[0].begin(), events[0].begin()+subSampleSize); // Initialize and sort the subSample collection. for(unsigned int i=0; ibuildTree(nodeLimit); // Fit all of the events based upon the tree we built using @@ -634,7 +634,7 @@ void Forest::doStochasticRegression(int nodeLimit, int treeLimit, double learnin updateRegTargets(trees[i], learningRate, l); // Save trees to xml in some directory. - std::ostringstream ss; + std::ostringstream ss; ss << "trees/" << i << ".xml"; std::string s = ss.str(); const char* c = s.c_str(); diff --git a/L1Trigger/L1TMuonEndCap/src/bdt/Node.cc b/L1Trigger/L1TMuonEndCap/src/bdt/Node.cc index 0586c57915095..295c4bbea25a8 100644 --- a/L1Trigger/L1TMuonEndCap/src/bdt/Node.cc +++ b/L1Trigger/L1TMuonEndCap/src/bdt/Node.cc @@ -2,13 +2,13 @@ // Node.cxx // // =====================================================================// // This is the object implementation of a node, which is the // -// fundamental unit of a decision tree. // +// fundamental unit of a decision tree. // // References include // // *Elements of Statistical Learning by Hastie, // // Tibshirani, and Friedman. // // *Greedy Function Approximation: A Gradient Boosting Machine. // // Friedman. The Annals of Statistics, Vol. 29, No. 5. Oct 2001. // -// *Inductive Learning of Tree-based Regression Models. Luis Torgo. // +// *Inductive Learning of Tree-based Regression Models. Luis Torgo. // // // ////////////////////////////////////////////////////////////////////////// @@ -219,7 +219,7 @@ void Node::calcOptimumSplit() // Intialize some variables. double bestSplitValue = 0; - int bestSplitVariable = -1; + int bestSplitVariable = -1; double bestErrorReduction = -1; double SUM = 0; @@ -231,17 +231,17 @@ void Node::calcOptimumSplit() // Calculate the sum of the target variables and the sum of // the target variables squared. We use these later. for(unsigned int i=0; idata[0]; SUM += target; SSUM += target*target; - } + } unsigned int numVars = events.size(); // Calculate the best split point for each variable for(unsigned int variableToCheck = 1; variableToCheck < numVars; variableToCheck++) - { + { // The sum of the target variables in the left, right nodes double SUMleft = 0; @@ -255,15 +255,15 @@ void Node::calcOptimumSplit() std::vector& v = events[variableToCheck]; - // Find the best split point for this variable + // Find the best split point for this variable for(unsigned int i=1; idata[0]; SUMright = SUMright - v[i-1]->data[0]; - + // No need to check the split point if x on both sides is equal if(v[i-1]->data[candidateSplitVariable] < v[i]->data[candidateSplitVariable]) { @@ -271,7 +271,7 @@ void Node::calcOptimumSplit() // the following statement. candidateErrorReduction = SUMleft*SUMleft/nleft + SUMright*SUMright/nright - SUM*SUM/numEvents; // std::cout << "candidateErrorReduction= " << candidateErrorReduction << std::endl << std::endl; - + // if the new candidate is better than the current best, then we have a new overall best. if(candidateErrorReduction > bestErrorReduction) { @@ -285,7 +285,7 @@ void Node::calcOptimumSplit() nleft = nleft+1; } } - + // Store the information gained from our computations. // The fit value is the average for least squares. @@ -299,7 +299,7 @@ void Node::calcOptimumSplit() // [ -k^2 ] avgError = totalError/numEvents; // std::cout << "avgError= " << avgError << std::endl; - + errorReduction = bestErrorReduction; // std::cout << "errorReduction= " << errorReduction << std::endl; @@ -320,21 +320,21 @@ void Node::listEvents() std::cout << std::endl << "Listing Events... " << std::endl; for(unsigned int i=0; i < events.size(); i++) - { + { std::cout << std::endl << "Variable " << i << " vector contents: " << std::endl; for(unsigned int j=0; j < events[i].size(); j++) - { + { events[i][j]->outputEvent(); - } + } std::cout << std::endl; - } + } } // ---------------------------------------------------------------------- void Node::theMiracleOfChildBirth() -{ - // Create Daughter Nodes +{ + // Create Daughter Nodes Node* left = new Node(name + " left"); Node* right = new Node(name + " right"); @@ -342,7 +342,7 @@ void Node::theMiracleOfChildBirth() leftDaughter = left; rightDaughter = right; left->setParent(this); - right->setParent(this); + right->setParent(this); } // ---------------------------------------------------------------------- @@ -359,7 +359,7 @@ void Node::filterEventsToDaughters() // Anyways, this function takes events from the parent node // and filters an event into the left or right daughter // node depending on whether it is < or > the split point -// for the given split variable. +// for the given split variable. int sv = splitVariable; double sp = splitValue; @@ -380,10 +380,10 @@ void Node::filterEventsToDaughters() } } - events = std::vector< std::vector >(); + events = std::vector< std::vector >(); left->getEvents().swap(l); - right->getEvents().swap(r); + right->getEvents().swap(r); // Set the number of events in the node. left->setNumEvents(left->getEvents()[0].size()); @@ -397,7 +397,7 @@ Node* Node::filterEventToDaughter(Event* e) // Anyways, this function takes an event from the parent node // and filters an event into the left or right daughter // node depending on whether it is < or > the split point -// for the given split variable. +// for the given split variable. int sv = splitVariable; double sp = splitValue; @@ -410,6 +410,6 @@ Node* Node::filterEventToDaughter(Event* e) if(e->data[sv] < sp) nextNode = left; if(e->data[sv] >= sp) nextNode = right; - + return nextNode; } diff --git a/L1Trigger/L1TMuonEndCap/src/bdt/Tree.cc b/L1Trigger/L1TMuonEndCap/src/bdt/Tree.cc index 05f08bb286b07..db7a399db50d5 100644 --- a/L1Trigger/L1TMuonEndCap/src/bdt/Tree.cc +++ b/L1Trigger/L1TMuonEndCap/src/bdt/Tree.cc @@ -7,7 +7,7 @@ // Tibshirani, and Friedman. // // *Greedy Function Approximation: A Gradient Boosting Machine. // // Friedman. The Annals of Statistics, Vol. 29, No. 5. Oct 2001. // -// *Inductive Learning of Tree-based Regression Models. Luis Torgo. // +// *Inductive Learning of Tree-based Regression Models. Luis Torgo. // // // ////////////////////////////////////////////////////////////////////////// @@ -155,7 +155,7 @@ void Tree::setRootNode(Node *sRootNode) { rootNode = sRootNode; } - + Node * Tree::getRootNode() { return rootNode; @@ -184,19 +184,19 @@ int Tree::getNumTerminalNodes() // ______________________Performace_____________________________________// ////////////////////////////////////////////////////////////////////////// -void Tree::calcError() -{ -// Loop through the separate predictive regions (terminal nodes) and -// add up the errors to get the error of the entire space. - - double totalSquaredError = 0; - - for(std::list::iterator it=terminalNodes.begin(); it!=terminalNodes.end(); it++) - { - totalSquaredError += (*it)->getTotalError(); - } - rmsError = sqrt( totalSquaredError/rootNode->getNumEvents() ); -} +void Tree::calcError() +{ +// Loop through the separate predictive regions (terminal nodes) and +// add up the errors to get the error of the entire space. + + double totalSquaredError = 0; + + for(std::list::iterator it=terminalNodes.begin(); it!=terminalNodes.end(); it++) + { + totalSquaredError += (*it)->getTotalError(); + } + rmsError = sqrt( totalSquaredError/rootNode->getNumEvents() ); +} // ---------------------------------------------------------------------- @@ -207,20 +207,20 @@ void Tree::buildTree(int nodeLimit) Node* nodeToSplit = nullptr; if(numTerminalNodes == 1) - { + { rootNode->calcOptimumSplit(); calcError(); // std::cout << std::endl << " " << numTerminalNodes << " Nodes : " << rmsError << std::endl; } for(std::list::iterator it=terminalNodes.begin(); it!=terminalNodes.end(); it++) - { - if( (*it)->getErrorReduction() > bestNodeErrorReduction ) - { + { + if( (*it)->getErrorReduction() > bestNodeErrorReduction ) + { bestNodeErrorReduction = (*it)->getErrorReduction(); nodeToSplit = (*it); - } - } + } + } //std::cout << "nodeToSplit size = " << nodeToSplit->getNumEvents() << std::endl; @@ -233,7 +233,7 @@ void Tree::buildTree(int nodeLimit) // Get left and right daughters for reference. Node* left = nodeToSplit->getLeftDaughter(); Node* right = nodeToSplit->getRightDaughter(); - + // Update the list of terminal nodes. terminalNodes.remove(nodeToSplit); terminalNodes.push_back(left); @@ -241,7 +241,7 @@ void Tree::buildTree(int nodeLimit) numTerminalNodes++; // Filter the events from the parent into the daughters. - nodeToSplit->filterEventsToDaughters(); + nodeToSplit->filterEventsToDaughters(); // Calculate the best splits for the new nodes. left->calcOptimumSplit(); @@ -249,7 +249,7 @@ void Tree::buildTree(int nodeLimit) // See if the error reduces as we add more nodes. calcError(); - + if(numTerminalNodes % 1 == 0) { // std::cout << " " << numTerminalNodes << " Nodes : " << rmsError << std::endl; @@ -349,7 +349,7 @@ void Tree::rankVariablesRecursive(Node* node, std::vector& v) v[sv] += er; rankVariablesRecursive(left, v); - rankVariablesRecursive(right, v); + rankVariablesRecursive(right, v); } @@ -387,7 +387,7 @@ void Tree::getSplitValuesRecursive(Node* node, std::vector>& v[sv].push_back(sp); getSplitValuesRecursive(left, v); - getSplitValuesRecursive(right, v); + getSplitValuesRecursive(right, v); } @@ -416,7 +416,7 @@ std::string numToStr( T num ) void Tree::addXMLAttributes(TXMLEngine* xml, Node* node, XMLNodePointer_t np) { - // Convert Node members into XML attributes + // Convert Node members into XML attributes // and add them to the XMLEngine. xml->NewAttr(np, nullptr, "splitVar", numToStr(node->getSplitVariable()).c_str()); xml->NewAttr(np, nullptr, "splitVal", numToStr(node->getSplitValue()).c_str()); @@ -458,7 +458,7 @@ void Tree::saveToXMLRecursive(TXMLEngine* xml, Node* node, XMLNodePointer_t np) if(l==nullptr || r==nullptr) return; - // Add children to the XMLEngine. + // Add children to the XMLEngine. XMLNodePointer_t left = xml->NewChild(np, nullptr, "left"); XMLNodePointer_t right = xml->NewChild(np, nullptr, "right"); @@ -474,7 +474,7 @@ void Tree::saveToXMLRecursive(TXMLEngine* xml, Node* node, XMLNodePointer_t np) // ---------------------------------------------------------------------- void Tree::loadFromXML(const char* filename) -{ +{ // First create the engine. TXMLEngine* xml = new TXMLEngine; @@ -483,7 +483,7 @@ void Tree::loadFromXML(const char* filename) if (xmldoc==nullptr) { delete xml; - return; + return; } // Get access to main node of the xml file. @@ -505,7 +505,7 @@ void Tree::loadFromXML(const char* filename) } // Recursively connect nodes together. loadFromXMLRecursive(xml, mainnode, rootNode); - + // Release memory before exit xml->FreeDoc(xmldoc); delete xml; @@ -513,7 +513,7 @@ void Tree::loadFromXML(const char* filename) // ---------------------------------------------------------------------- -void Tree::loadFromXMLRecursive(TXMLEngine* xml, XMLNodePointer_t xnode, Node* tnode) +void Tree::loadFromXMLRecursive(TXMLEngine* xml, XMLNodePointer_t xnode, Node* tnode) { // Get the split information from xml. @@ -525,21 +525,21 @@ void Tree::loadFromXMLRecursive(TXMLEngine* xml, XMLNodePointer_t xnode, Node* t if(i==3 || i==4 || i==6){ splitInfo[j++] = xml->GetAttrValue(attr); } - attr = xml->GetNextAttr(attr); + attr = xml->GetNextAttr(attr); } } else { for(unsigned int i=0; i<3; i++) { - splitInfo[i] = xml->GetAttrValue(attr); - attr = xml->GetNextAttr(attr); + splitInfo[i] = xml->GetAttrValue(attr); + attr = xml->GetNextAttr(attr); } } - + // Convert strings into numbers. std::stringstream converter; int splitVar; double splitVal; - double fitVal; + double fitVal; converter << splitInfo[0]; converter >> splitVar; @@ -561,7 +561,7 @@ void Tree::loadFromXMLRecursive(TXMLEngine* xml, XMLNodePointer_t xnode, Node* t tnode->setSplitValue(splitVal); tnode->setFitValue(fitVal); - // Get the xml daughters of the current xml node. + // Get the xml daughters of the current xml node. XMLNodePointer_t xleft = xml->GetChild(xnode); XMLNodePointer_t xright = xml->GetNext(xleft); diff --git a/L1Trigger/L1TMuonEndCap/src/bdt/Utilities.cc b/L1Trigger/L1TMuonEndCap/src/bdt/Utilities.cc index b298b6c1dc127..0db4a88a14f8d 100644 --- a/L1Trigger/L1TMuonEndCap/src/bdt/Utilities.cc +++ b/L1Trigger/L1TMuonEndCap/src/bdt/Utilities.cc @@ -49,7 +49,7 @@ const std::vector emtf::twoJetsScale = std::vector(twoJets_scale float processPrediction(float BDTPt, int Quality, float PrelimFit) { -// Discretize and scale the BDTPt prediction +// Discretize and scale the BDTPt prediction // Fix terrible predictions diff --git a/L1Trigger/L1TMuonEndCap/test/unittests/TestPhiMemoryImage.cpp b/L1Trigger/L1TMuonEndCap/test/unittests/TestPhiMemoryImage.cpp index fda57031f2239..9b97e706c077c 100644 --- a/L1Trigger/L1TMuonEndCap/test/unittests/TestPhiMemoryImage.cpp +++ b/L1Trigger/L1TMuonEndCap/test/unittests/TestPhiMemoryImage.cpp @@ -110,7 +110,7 @@ void TestPhiMemoryImage::test_rotation() CPPUNIT_ASSERT_EQUAL(image.get_word(0, 0), (word1 << (i-128)) | (word0 >> (192-i))); else CPPUNIT_ASSERT_EQUAL(image.get_word(0, 0), (word0)); - + image.rotr(i); CPPUNIT_ASSERT_EQUAL(image.get_word(0, 0), word0); From 8f46c60f44ad00dcf6d85ce48ca88fc09649c9e3 Mon Sep 17 00:00:00 2001 From: Andrew Brinkerhoff Date: Mon, 2 Apr 2018 14:39:46 +0200 Subject: [PATCH 300/426] EMTF emulator data formats for upgrade trigger primitives --- DataFormats/L1TMuon/interface/EMTFHit.h | 66 ++++-- DataFormats/L1TMuon/interface/EMTFTrack.h | 23 ++- .../implementations_stage2/EMTFBlockME.cc | 2 +- .../EMTFUnpackerTools.cc | 2 +- L1Trigger/L1TMuon/BuildFile.xml | 3 + .../L1TMuon/interface/GeometryTranslator.h | 11 +- .../L1TMuon/interface/MuonTriggerPrimitive.h | 44 ++-- .../interface/MuonTriggerPrimitiveFwd.h | 10 +- .../L1TMuon/interface/TTGeometryTranslator.h | 74 +++++++ .../interface/TTMuonTriggerPrimitive.h | 121 +++++++++++ L1Trigger/L1TMuon/src/GeometryTranslator.cc | 41 +++- L1Trigger/L1TMuon/src/MuonTriggerPrimitive.cc | 89 ++++---- L1Trigger/L1TMuon/src/TTGeometryTranslator.cc | 195 ++++++++++++++++++ .../L1TMuon/src/TTMuonTriggerPrimitive.cc | 142 +++++++++++++ 14 files changed, 714 insertions(+), 109 deletions(-) create mode 100644 L1Trigger/L1TMuon/interface/TTGeometryTranslator.h create mode 100644 L1Trigger/L1TMuon/interface/TTMuonTriggerPrimitive.h create mode 100644 L1Trigger/L1TMuon/src/TTGeometryTranslator.cc create mode 100644 L1Trigger/L1TMuon/src/TTMuonTriggerPrimitive.cc diff --git a/DataFormats/L1TMuon/interface/EMTFHit.h b/DataFormats/L1TMuon/interface/EMTFHit.h index 3bb8bc046eeb7..0fb81b40b42a0 100644 --- a/DataFormats/L1TMuon/interface/EMTFHit.h +++ b/DataFormats/L1TMuon/interface/EMTFHit.h @@ -11,9 +11,11 @@ #include "DataFormats/MuonDetId/interface/CSCDetId.h" #include "DataFormats/MuonDetId/interface/RPCDetId.h" #include "DataFormats/MuonDetId/interface/GEMDetId.h" +#include "DataFormats/MuonDetId/interface/ME0DetId.h" #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigi.h" #include "DataFormats/RPCDigi/interface/RPCDigi.h" #include "DataFormats/GEMDigi/interface/GEMPadDigi.h" +#include "DataFormats/GEMDigi/interface/ME0PadDigi.h" #include "DataFormats/L1TMuon/interface/EMTF/ME.h" namespace l1t { @@ -22,15 +24,16 @@ namespace l1t { public: EMTFHit() : - endcap(-99), station(-99), ring(-99), sector(-99), sector_RPC(-99), sector_idx(-99), - subsector(-99), subsector_RPC(-99), chamber(-99), csc_ID(-99), csc_nID(-99), roll(-99), + rawDetId(0), + endcap(-99), station(-99), ring(-99), sector(-99), sector_RPC(-99), sector_idx(-99), + subsector(-99), subsector_RPC(-99), chamber(-99), csc_ID(-99), csc_nID(-99), roll(-99), neighbor(-99), mpc_link(-99), pc_sector(-99), pc_station(-99), pc_chamber(-99), pc_segment(-99), wire(-99), strip(-99), strip_hi(-99), strip_low(-99), track_num(-99), quality(-99), pattern(-99), bend(-99), valid(-99), sync_err(-99), bc0(-99), bx(-99), stub_num(-99), phi_fp(-99), theta_fp(-99), phzvl(-99), ph_hit(-99), zone_hit(-99), zone_code(-99), fs_segment(-99), fs_zone_code(-99), bt_station(-99), bt_segment(-99), - phi_loc(-99), phi_glob(-999), theta(-99), eta(-99), - phi_sim(-999), theta_sim(-99), eta_sim(-99), + phi_loc(-99), phi_glob(-999), theta(-99), eta(-99), time(-99), + phi_sim(-999), theta_sim(-99), eta_sim(-99), rho_sim(-99), z_sim(-99), is_CSC(-99), is_RPC(-99), is_GEM(-99), subsystem(-99) {}; @@ -52,19 +55,27 @@ namespace l1t { // void PrintSimulatorHeader() const; // void PrintForSimulator() const; - void SetCSCDetId (const CSCDetId& id) { csc_DetId = id; } - void SetRPCDetId (const RPCDetId& id) { rpc_DetId = id; } - void SetGEMDetId (const GEMDetId& id) { gem_DetId = id; } - void SetCSCLCTDigi (const CSCCorrelatedLCTDigi& digi) { csc_LCTDigi = digi; } - void SetRPCDigi (const RPCDigi& digi) { rpc_Digi = digi; } - void SetGEMPadDigi (const GEMPadDigi& digi) { gem_PadDigi = digi; } + //void SetCSCDetId (const CSCDetId& id) { csc_DetId = id; } + //void SetRPCDetId (const RPCDetId& id) { rpc_DetId = id; } + //void SetGEMDetId (const GEMDetId& id) { gem_DetId = id; } + //void SetCSCLCTDigi (const CSCCorrelatedLCTDigi& digi) { csc_LCTDigi = digi; } + //void SetRPCDigi (const RPCDigi& digi) { rpc_Digi = digi; } + //void SetGEMPadDigi (const GEMPadDigi& digi) { gem_PadDigi = digi; } + void SetCSCDetId (const CSCDetId& id) { rawDetId = id.rawId(); } + void SetRPCDetId (const RPCDetId& id) { rawDetId = id.rawId(); } + void SetGEMDetId (const GEMDetId& id) { rawDetId = id.rawId(); } + void SetME0DetId (const ME0DetId& id) { rawDetId = id.rawId(); } - CSCDetId CSC_DetId () const { return csc_DetId; } - RPCDetId RPC_DetId () const { return rpc_DetId; } - GEMDetId GEM_DetId () const { return gem_DetId; } - CSCCorrelatedLCTDigi CSC_LCTDigi () const { return csc_LCTDigi; } - RPCDigi RPC_Digi () const { return rpc_Digi; } - GEMPadDigi GEM_PadDigi () const { return gem_PadDigi; } + //CSCDetId CSC_DetId () const { return csc_DetId; } + //RPCDetId RPC_DetId () const { return rpc_DetId; } + //GEMDetId GEM_DetId () const { return gem_DetId; } + //CSCCorrelatedLCTDigi CSC_LCTDigi () const { return csc_LCTDigi; } + //RPCDigi RPC_Digi () const { return rpc_Digi; } + //GEMPadDigi GEM_PadDigi () const { return gem_PadDigi; } + CSCDetId CSC_DetId () const { return CSCDetId(rawDetId); } + RPCDetId RPC_DetId () const { return RPCDetId(rawDetId); } + GEMDetId GEM_DetId () const { return GEMDetId(rawDetId); } + ME0DetId ME0_DetId () const { return ME0DetId(rawDetId); } void set_endcap (int bits) { endcap = bits; } void set_station (int bits) { station = bits; } @@ -111,9 +122,12 @@ namespace l1t { void set_phi_glob (float val) { phi_glob = val; } void set_theta (float val) { theta = val; } void set_eta (float val) { eta = val; } + void set_time (float val) { time = val; } void set_phi_sim (float val) { phi_sim = val; } void set_theta_sim (float val) { theta_sim = val; } void set_eta_sim (float val) { eta_sim = val; } + void set_rho_sim (float val) { rho_sim = val; } + void set_z_sim (float val) { z_sim = val; } void set_is_CSC (int bits) { is_CSC = bits; } void set_is_RPC (int bits) { is_RPC = bits; } void set_is_GEM (int bits) { is_GEM = bits; } @@ -164,9 +178,12 @@ namespace l1t { float Phi_glob () const { return phi_glob ; } float Theta () const { return theta ; } float Eta () const { return eta ; } + float Time () const { return time ; } float Phi_sim () const { return phi_sim ; } float Theta_sim () const { return theta_sim ; } float Eta_sim () const { return eta_sim ; } + float Rho_sim () const { return rho_sim ; } + float Z_sim () const { return z_sim ; } int Is_CSC () const { return is_CSC ; } int Is_RPC () const { return is_RPC ; } int Is_GEM () const { return is_GEM ; } @@ -175,12 +192,14 @@ namespace l1t { private: - CSCDetId csc_DetId; - RPCDetId rpc_DetId; - GEMDetId gem_DetId; - CSCCorrelatedLCTDigi csc_LCTDigi; - RPCDigi rpc_Digi; - GEMPadDigi gem_PadDigi; + //CSCDetId csc_DetId; + //RPCDetId rpc_DetId; + //GEMDetId gem_DetId; + //CSCCorrelatedLCTDigi csc_LCTDigi; + //RPCDigi rpc_Digi; + //GEMPadDigi gem_PadDigi; + + uint32_t rawDetId; // raw CMSSW DetId int endcap ; // +/-1. For ME+ and ME-. int station ; // 1 - 4. @@ -227,9 +246,12 @@ namespace l1t { float phi_glob ; // +/-180. float theta ; // 0 - 90. float eta ; // +/-2.5. + float time ; // ? - ?. RPC time information float phi_sim ; // +/-180. float theta_sim ; // 0 - 90. float eta_sim ; // +/-2.5. + float rho_sim ; // ? - ?. + float z_sim ; // ? - ?. int is_CSC ; // 0 or 1. int is_RPC ; // 0 or 1. int is_GEM ; // 0 or 1. diff --git a/DataFormats/L1TMuon/interface/EMTFTrack.h b/DataFormats/L1TMuon/interface/EMTFTrack.h index d97a237bc25b1..9da4af04fd172 100644 --- a/DataFormats/L1TMuon/interface/EMTFTrack.h +++ b/DataFormats/L1TMuon/interface/EMTFTrack.h @@ -6,7 +6,6 @@ #include #include -#include #include "DataFormats/L1TMuon/interface/EMTFHit.h" #include "DataFormats/L1TMuon/interface/EMTFRoad.h" @@ -51,17 +50,21 @@ namespace l1t { void ImportSP( const emtf::SP _SP, int _sector ); // void ImportPtLUT( int _mode, unsigned long _address ); - void clear_Hits() { - _Hits.clear(); numHits = 0; - mode_CSC = 0; mode_RPC = 0; mode_neighbor = 0; + + void clear_Hits() { + _Hits.clear(); + numHits = 0; + mode_CSC = 0; + mode_RPC = 0; + mode_neighbor = 0; } void push_Hit(const EMTFHit& hit) { - _Hits.push_back( hit ); - numHits = _Hits.size(); - mode_CSC += ( hit.Is_CSC() ? pow(2, 4 - hit.Station()) : 0 ); - mode_RPC += ( hit.Is_RPC() ? pow(2, 4 - hit.Station()) : 0 ); - mode_neighbor += ( hit.Neighbor() ? pow(2, 4 - hit.Station()) : 0 ); + _Hits.push_back( hit ); + numHits = _Hits.size(); + if (hit.Is_CSC()) mode_CSC |= (1 << (4 - hit.Station())); + if (hit.Is_RPC()) mode_RPC |= (1 << (4 - hit.Station())); + if (hit.Neighbor()) mode_neighbor |= (1 << (4 - hit.Station())); } void set_Hits(const EMTFHitCollection& hits) { @@ -70,9 +73,9 @@ namespace l1t { push_Hit( hit ); } - void set_HitIdx(const std::vector& bits) { _HitIdx = bits; } void clear_HitIdx() { _HitIdx.clear(); } void push_HitIdx(unsigned int bits) { _HitIdx.push_back(bits); } + void set_HitIdx(const std::vector& bits) { _HitIdx = bits; } int NumHits () const { return numHits; } EMTFHitCollection Hits () const { return _Hits; } diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/EMTFBlockME.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/EMTFBlockME.cc index 4dacc60b40097..b33fbad403fee 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/EMTFBlockME.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/EMTFBlockME.cc @@ -190,7 +190,7 @@ namespace l1t { (res->at(iOut)).push_ME(ME_); res_hit->push_back(Hit_); if (not duplicate_hit_exists) // Don't write duplicate LCTs from adjacent sectors - res_LCT->insertDigi( Hit_.CSC_DetId(), Hit_.CSC_LCTDigi() ); + res_LCT->insertDigi( Hit_.CSC_DetId(), Hit_.CreateCSCCorrelatedLCTDigi() ); // Finished with unpacking one ME Data Record return true; diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/EMTFUnpackerTools.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/EMTFUnpackerTools.cc index 2b4a102870850..11037e08ab82e 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/EMTFUnpackerTools.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/EMTFUnpackerTools.cc @@ -31,7 +31,7 @@ namespace l1t { _hit.Subsector(), _hit.Ring(), _hit.CSC_ID() ) ); _hit.SetCSCDetId ( _hit.CreateCSCDetId() ); - _hit.SetCSCLCTDigi ( _hit.CreateCSCCorrelatedLCTDigi() ); + //_hit.SetCSCLCTDigi ( _hit.CreateCSCCorrelatedLCTDigi() ); // Station, CSC_ID, Sector, Subsector, and Neighbor filled in // EventFilter/L1TRawToDigi/src/implementations_stage2/EMTFBlockME.cc diff --git a/L1Trigger/L1TMuon/BuildFile.xml b/L1Trigger/L1TMuon/BuildFile.xml index a5c1862233333..9d4cb7d1a0d2d 100644 --- a/L1Trigger/L1TMuon/BuildFile.xml +++ b/L1Trigger/L1TMuon/BuildFile.xml @@ -29,3 +29,6 @@ + + + diff --git a/L1Trigger/L1TMuon/interface/GeometryTranslator.h b/L1Trigger/L1TMuon/interface/GeometryTranslator.h index d6db1e76a8743..9b03209f4e082 100644 --- a/L1Trigger/L1TMuon/interface/GeometryTranslator.h +++ b/L1Trigger/L1TMuon/interface/GeometryTranslator.h @@ -1,6 +1,6 @@ -#ifndef __L1TMUON_GEOMETRYTRANSLATOR_H__ -#define __L1TMUON_GEOMETRYTRANSLATOR_H__ -// +#ifndef __L1TMuon_GeometryTranslator_h__ +#define __L1TMuon_GeometryTranslator_h__ +// // Class: L1TMuon::GeometryTranslator // // Info: This class implements a the translations from packed bits or @@ -21,10 +21,11 @@ // forwards -namespace edm { +namespace edm { class EventSetup; } +class ME0Geometry; class GEMGeometry; class RPCGeometry; class CSCGeometry; @@ -48,6 +49,7 @@ namespace L1TMuon { void checkAndUpdateGeometry(const edm::EventSetup&); + const ME0Geometry& getME0Geometry() const { return *_geome0; } const GEMGeometry& getGEMGeometry() const { return *_geogem; } const RPCGeometry& getRPCGeometry() const { return *_georpc; } const CSCGeometry& getCSCGeometry() const { return *_geocsc; } @@ -58,6 +60,7 @@ namespace L1TMuon { private: // pointers to the current geometry records unsigned long long _geom_cache_id; + edm::ESHandle _geome0; edm::ESHandle _geogem; edm::ESHandle _georpc; edm::ESHandle _geocsc; diff --git a/L1Trigger/L1TMuon/interface/MuonTriggerPrimitive.h b/L1Trigger/L1TMuon/interface/MuonTriggerPrimitive.h index dea6bb2efd93a..8e0e0b2736dc0 100644 --- a/L1Trigger/L1TMuon/interface/MuonTriggerPrimitive.h +++ b/L1Trigger/L1TMuon/interface/MuonTriggerPrimitive.h @@ -1,5 +1,5 @@ -#ifndef __L1TMUON_TRIGGERPRIMITIVE_H__ -#define __L1TMUON_TRIGGERPRIMITIVE_H__ +#ifndef __L1TMuon_TriggerPrimitive_h__ +#define __L1TMuon_TriggerPrimitive_h__ // // Class: L1TMuon::TriggerPrimitive // @@ -26,9 +26,6 @@ //Global point (created on the fly) #include "DataFormats/GeometryVector/interface/GlobalPoint.h" -// Forward declaration -#include "L1Trigger/L1TMuon/interface/MuonTriggerPrimitiveFwd.h" - // DT digi types class DTChamberId; class L1MuDTChambPhDigi; @@ -39,13 +36,17 @@ class CSCCorrelatedLCTDigi; class CSCDetId; // RPC digi types -class RPCDigiL1Link; +class RPCDigi; class RPCDetId; // GEM digi types class GEMPadDigi; class GEMDetId; +// ME0 digi types +class ME0PadDigi; +class ME0DetId; + namespace L1TMuon { @@ -59,13 +60,14 @@ namespace L1TMuon { // within a subsystem // for RPCs you have to unroll the digi-link and raw det-id struct RPCData { - RPCData() : strip(0), strip_low(0), strip_hi(0), layer(0), bx(0), valid(0) {} + RPCData() : strip(0), strip_low(0), strip_hi(0), layer(0), bx(0), valid(0), time(0.) {} uint16_t strip; uint16_t strip_low; // for use in clustering uint16_t strip_hi; // for use in clustering uint16_t layer; int16_t bx; uint16_t valid; + double time; // why double? }; struct CSCData { @@ -114,11 +116,13 @@ namespace L1TMuon { }; struct GEMData { - GEMData() : pad(0), pad_low(0), pad_hi(0), bx(0) {} + GEMData() : pad(0), pad_low(0), pad_hi(0), bx(0), bend(0), isME0(false) {} uint16_t pad; uint16_t pad_low; // for use in clustering uint16_t pad_hi; // for use in clustering int16_t bx; + int16_t bend; + bool isME0; }; //Persistency @@ -140,6 +144,8 @@ namespace L1TMuon { const CSCCorrelatedLCTDigi&); //RPC TriggerPrimitive(const RPCDetId& detid, + const RPCDigi& digi); + TriggerPrimitive(const RPCDetId& detid, // keep this version for backward compatibility const unsigned strip, const unsigned layer, const int bx); @@ -147,6 +153,8 @@ namespace L1TMuon { // GEM TriggerPrimitive(const GEMDetId& detid, const GEMPadDigi& digi); + TriggerPrimitive(const ME0DetId& detid, + const ME0PadDigi& digi); //copy TriggerPrimitive(const TriggerPrimitive&); @@ -208,18 +216,14 @@ namespace L1TMuon { private: // Translate to 'global' position information at the level of 60 // degree sectors. Use CSC sectors as a template - void calculateDTGlobalSector(const DTChamberId& chid, - unsigned& global_sector, - unsigned& subsector ); - void calculateCSCGlobalSector(const CSCDetId& chid, - unsigned& global_sector, - unsigned& subsector ); - void calculateRPCGlobalSector(const RPCDetId& chid, - unsigned& global_sector, - unsigned& subsector ); - void calculateGEMGlobalSector(const GEMDetId& chid, - unsigned& global_sector, - unsigned& subsector ); + template + void calculateGlobalSector(const IDType& chid, + unsigned& globalsector, + unsigned& subsector ) { + // Not sure if this is ever going to get implemented + globalsector = 0; + subsector = 0; + } DTData _dt; CSCData _csc; diff --git a/L1Trigger/L1TMuon/interface/MuonTriggerPrimitiveFwd.h b/L1Trigger/L1TMuon/interface/MuonTriggerPrimitiveFwd.h index 6039185d9615f..0669ebf987121 100644 --- a/L1Trigger/L1TMuon/interface/MuonTriggerPrimitiveFwd.h +++ b/L1Trigger/L1TMuon/interface/MuonTriggerPrimitiveFwd.h @@ -1,5 +1,5 @@ -#ifndef __L1TMUON_TRIGGERPRIMITIVEFWD_H__ -#define __L1TMUON_TRIGGERPRIMITIVEFWD_H__ +#ifndef __L1TMuon_TriggerPrimitiveFwd_h__ +#define __L1TMuon_TriggerPrimitiveFwd_h__ #include #include @@ -14,7 +14,11 @@ namespace L1TMuon { //typedef edm::Ref TriggerPrimitiveRef; //typedef std::vector TriggerPrimitiveList; //typedef edm::Ptr TriggerPrimitivePtr; - typedef std::map TriggerPrimitiveStationMap; + //typedef std::map TriggerPrimitiveStationMap; + + class TTTriggerPrimitive; // Track Trigger hits + + typedef std::vector TTTriggerPrimitiveCollection; } #endif diff --git a/L1Trigger/L1TMuon/interface/TTGeometryTranslator.h b/L1Trigger/L1TMuon/interface/TTGeometryTranslator.h new file mode 100644 index 0000000000000..3fc79516ed36a --- /dev/null +++ b/L1Trigger/L1TMuon/interface/TTGeometryTranslator.h @@ -0,0 +1,74 @@ +#ifndef __L1TMuon_TTGeometryTranslator_h__ +#define __L1TMuon_TTGeometryTranslator_h__ + +// +// This class implements the translations from trigger primitive to +// global CMS coordinates for the Tracker trigger primitives analogous to +// the class GeometryTranslator. +// + +#include "FWCore/Framework/interface/ESHandle.h" +#include "DataFormats/GeometryVector/interface/GlobalPoint.h" +#include + + +// forwards +namespace edm { + class EventSetup; +} + +class TrackerGeometry; +class TrackerTopology; +class MagneticField; + +namespace L1TMuon { + + class TTTriggerPrimitive; + + class TTGeometryTranslator { + public: + TTGeometryTranslator(); + ~TTGeometryTranslator(); + + // Things you have to do to just get simple det id info... + bool isBarrel (const TTTriggerPrimitive&) const; + bool isPSModule(const TTTriggerPrimitive&) const; + int region (const TTTriggerPrimitive&) const; // 0 for Barrel, +/-1 for +/- Endcap + int layer (const TTTriggerPrimitive&) const; + int ring (const TTTriggerPrimitive&) const; + int module (const TTTriggerPrimitive&) const; + + // The translations + double calculateGlobalEta(const TTTriggerPrimitive&) const; + double calculateGlobalPhi(const TTTriggerPrimitive&) const; + double calculateBendAngle(const TTTriggerPrimitive&) const; + + GlobalPoint getGlobalPoint(const TTTriggerPrimitive&) const; + + // Update geometry if necessary + void checkAndUpdateGeometry(const edm::EventSetup&); + + // Retrieve the geometry records + const TrackerGeometry& getTrackerGeometry() const { return *_geom; } + const TrackerTopology& getTrackerTopology() const { return *_topo; } + const MagneticField& getMagneticField() const { return *_magfield; } + + private: + // Pointers to the current geometry records + unsigned long long _geom_cache_id; + edm::ESHandle _geom; + + unsigned long long _topo_cache_id; + edm::ESHandle _topo; + + unsigned long long _magfield_cache_id; + edm::ESHandle _magfield; + + GlobalPoint getTTSpecificPoint(const TTTriggerPrimitive&) const; + double calcTTSpecificEta(const TTTriggerPrimitive&) const; + double calcTTSpecificPhi(const TTTriggerPrimitive&) const; + double calcTTSpecificBend(const TTTriggerPrimitive&) const; + }; +} + +#endif diff --git a/L1Trigger/L1TMuon/interface/TTMuonTriggerPrimitive.h b/L1Trigger/L1TMuon/interface/TTMuonTriggerPrimitive.h new file mode 100644 index 0000000000000..bafc05cf03eab --- /dev/null +++ b/L1Trigger/L1TMuon/interface/TTMuonTriggerPrimitive.h @@ -0,0 +1,121 @@ +#ifndef __L1TMuon_TTMuonTriggerPrimitive_h__ +#define __L1TMuon_TTMuonTriggerPrimitive_h__ + +// +// This class implements a layer for Phase 2 Tracker trigger primitive +// analogous to the class MuonTriggerPrimitive. +// + +#include +#include +#include + +// DetId +#include "DataFormats/DetId/interface/DetId.h" +// Global point +#include "DataFormats/GeometryVector/interface/GlobalPoint.h" +// Track trigger data formats +#include "DataFormats/L1TrackTrigger/interface/TTTypes.h" + + +namespace L1TMuon { + + class TTTriggerPrimitive { + public: + // Define the subsystems that we have available (none at the moment). + // Start at 20 for TTMuonTriggerPrimitive to avoid collision with MuonTriggerPrimitive + enum subsystem_type{kTT = 20, kNSubsystems}; + + // Rename these + typedef TTStub TTDigi; + typedef DetId TTDetId; + + // Define the raw data + struct TTData { + TTData() : row_f(0.), col_f(0.), bend(0), bx(0) {} + float row_f; // why float? + float col_f; // why float? + int bend; + int16_t bx; + }; + + // Persistency + TTTriggerPrimitive(): _subsystem(kNSubsystems) {} + + // Constructor from track trigger digi + TTTriggerPrimitive(const TTDetId& detid, const TTDigi& digi); + + // Copy constructor + TTTriggerPrimitive(const TTTriggerPrimitive&); + + // Destructor + ~TTTriggerPrimitive() {} + + // Assignment operator + TTTriggerPrimitive& operator=(const TTTriggerPrimitive& tp); + + // Equality operator + bool operator==(const TTTriggerPrimitive& tp) const; + + // Subsystem type + const subsystem_type subsystem() const { return _subsystem; } + + // Global coordinates + const double getCMSGlobalEta() const { return _eta; } + void setCMSGlobalEta(const double eta) { _eta = eta; } + const double getCMSGlobalPhi() const { return _phi; } + void setCMSGlobalPhi(const double phi) { _phi = phi; } + const double getCMSGlobalRho() const { return _rho; } + void setCMSGlobalRho(const double rho) { _rho = rho; } + + const GlobalPoint getCMSGlobalPoint() const { + double theta = 2. * atan( exp(-_eta) ); + return GlobalPoint( GlobalPoint::Cylindrical( _rho, _phi, _rho/tan(theta)) ); + }; + + + // Detector id + TTDetId detId() const { return _id; } + + TTDetId rawId() const { return detId(); } + + // Accessors to raw data + void setTTData(const TTData& data) { _data = data; } + + const TTData getTTData() const { return _data; } + + TTData& accessTTData() { return _data; } + + // Accessors to common information + const int getStrip() const; + const int getSegment() const; + const int getBend() const; + const int getBX() const; + + const unsigned getGlobalSector() const { return _globalsector; } + const unsigned getSubSector() const { return _subsector; } + + void print(std::ostream&) const; + + private: + // Translate to 'global' position information at the level of 60 + // degree sectors. Use CSC sectors as a template + void calculateTTGlobalSector(const TTDetId& detid, + unsigned& globalsector, + unsigned& subsector ); + + TTData _data; + + TTDetId _id; + + subsystem_type _subsystem; + + unsigned _globalsector; // [1,6] in 60 degree sectors + unsigned _subsector; // [1,2] in 30 degree partitions of a sector + double _eta, _phi, _rho; // global pseudorapidity, phi, rho + double _theta; // bend angle with respect to ray from (0,0,0). // NOT USED + }; + +} // namespace L1TMuon + +#endif diff --git a/L1Trigger/L1TMuon/src/GeometryTranslator.cc b/L1Trigger/L1TMuon/src/GeometryTranslator.cc index f45ad058fb03a..711508c704367 100644 --- a/L1Trigger/L1TMuon/src/GeometryTranslator.cc +++ b/L1Trigger/L1TMuon/src/GeometryTranslator.cc @@ -13,6 +13,7 @@ #include "L1Trigger/DTUtilities/interface/DTTrigGeom.h" #include "Geometry/RPCGeometry/interface/RPCGeometry.h" #include "Geometry/GEMGeometry/interface/GEMGeometry.h" +#include "Geometry/GEMGeometry/interface/ME0Geometry.h" #include "MagneticField/Engine/interface/MagneticField.h" #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" @@ -117,6 +118,7 @@ void GeometryTranslator::checkAndUpdateGeometry(const edm::EventSetup& es) { const MuonGeometryRecord& geom = es.get(); unsigned long long geomid = geom.cacheIdentifier(); if( _geom_cache_id != geomid ) { + geom.get(_geome0); geom.get(_geogem); geom.get(_georpc); geom.get(_geocsc); @@ -134,11 +136,31 @@ void GeometryTranslator::checkAndUpdateGeometry(const edm::EventSetup& es) { GlobalPoint GeometryTranslator::getGEMSpecificPoint(const TriggerPrimitive& tp) const { - const GEMDetId id(tp.detId()); - const GEMEtaPartition * roll = _geogem->etaPartition(id); - const uint16_t pad = tp.getGEMData().pad; - const LocalPoint lp = roll->centreOfPad(pad); - const GlobalPoint gp = roll->toGlobal(lp); + LocalPoint lp; + GlobalPoint gp; + + if (!tp.getGEMData().isME0) { // use GEM geometry + const GEMDetId id(tp.detId()); + const GEMEtaPartition * roll = _geogem->etaPartition(id); + assert(roll); + //const uint16_t pad = tp.getGEMData().pad; + // Use half-strip precision, - 0.5 at the end to get the center of the strip + const float pad = (0.5 * static_cast(tp.getGEMData().pad_low + tp.getGEMData().pad_hi)) - 0.5; + lp = roll->centreOfPad(pad); + gp = roll->surface().toGlobal(lp); + + } else { // use ME0 geometry + const ME0DetId id(tp.detId()); + const ME0EtaPartition * roll = _geome0->etaPartition(id); + assert(roll); + //const uint16_t pad = tp.getGEMData().pad; + // Use half-strip precision, - 0.5 at the end to get the center of the strip + const float pad = (0.5 * static_cast(tp.getGEMData().pad_low + tp.getGEMData().pad_hi)) - 0.5; + //lp = roll->centreOfPad(pad); // does not work + const float strip = 2.0 * pad; + lp = roll->centreOfStrip(strip); + gp = roll->surface().toGlobal(lp); + } //roll.release(); @@ -155,11 +177,9 @@ GeometryTranslator::calcGEMSpecificPhi(const TriggerPrimitive& tp) const { return getGEMSpecificPoint(tp).phi(); } -// this function actually does nothing since GEM -// hits are point-like objects double GeometryTranslator::calcGEMSpecificBend(const TriggerPrimitive& tp) const { - return 0.0; + return tp.getGEMData().bend; } @@ -167,12 +187,13 @@ GlobalPoint GeometryTranslator::getRPCSpecificPoint(const TriggerPrimitive& tp) const { const RPCDetId id(tp.detId()); const RPCRoll * roll = _georpc->roll(id); + assert(roll); //const int strip = static_cast(tp.getRPCData().strip); // Use half-strip precision, - 0.5 at the end to get the center of the strip const float strip = (0.5 * static_cast(tp.getRPCData().strip_low + tp.getRPCData().strip_hi)) - 0.5; const LocalPoint lp = roll->centreOfStrip(strip); - const GlobalPoint gp = roll->toGlobal(lp); - + const GlobalPoint gp = roll->surface().toGlobal(lp); + //roll.release(); return gp; diff --git a/L1Trigger/L1TMuon/src/MuonTriggerPrimitive.cc b/L1Trigger/L1TMuon/src/MuonTriggerPrimitive.cc index 5407c2dcda552..f8d6be8e23af2 100644 --- a/L1Trigger/L1TMuon/src/MuonTriggerPrimitive.cc +++ b/L1Trigger/L1TMuon/src/MuonTriggerPrimitive.cc @@ -4,14 +4,16 @@ #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigi.h" #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhDigi.h" #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambThDigi.h" -#include "DataFormats/RPCDigi/interface/RPCDigiL1Link.h" +#include "DataFormats/RPCDigi/interface/RPCDigi.h" #include "DataFormats/GEMDigi/interface/GEMPadDigi.h" +#include "DataFormats/GEMDigi/interface/ME0PadDigi.h" // detector ID types #include "DataFormats/MuonDetId/interface/DTChamberId.h" #include "DataFormats/MuonDetId/interface/CSCDetId.h" #include "DataFormats/MuonDetId/interface/RPCDetId.h" #include "DataFormats/MuonDetId/interface/GEMDetId.h" +#include "DataFormats/MuonDetId/interface/ME0DetId.h" using namespace L1TMuon; @@ -25,7 +27,7 @@ TriggerPrimitive::TriggerPrimitive(const DTChamberId& detid, const int segment_number): _id(detid), _subsystem(TriggerPrimitive::kDT) { - calculateDTGlobalSector(detid,_globalsector,_subsector); + calculateGlobalSector(detid,_globalsector,_subsector); // fill in information from theta trigger _dt.theta_bti_group = -1; _dt.segment_number = segment_number; @@ -48,7 +50,7 @@ TriggerPrimitive::TriggerPrimitive(const DTChamberId& detid, const int theta_bti_group): _id(detid), _subsystem(TriggerPrimitive::kDT) { - calculateDTGlobalSector(detid,_globalsector,_subsector); + calculateGlobalSector(detid,_globalsector,_subsector); // fill in information from theta trigger _dt.theta_bti_group = theta_bti_group; _dt.segment_number = digi_th.position(theta_bti_group); @@ -72,7 +74,7 @@ TriggerPrimitive::TriggerPrimitive(const DTChamberId& detid, const int theta_bti_group): _id(detid), _subsystem(TriggerPrimitive::kDT) { - calculateDTGlobalSector(detid,_globalsector,_subsector); + calculateGlobalSector(detid,_globalsector,_subsector); // fill in information from theta trigger _dt.theta_bti_group = theta_bti_group; _dt.segment_number = digi_th.position(theta_bti_group); @@ -95,7 +97,7 @@ TriggerPrimitive::TriggerPrimitive(const CSCDetId& detid, const CSCCorrelatedLCTDigi& digi): _id(detid), _subsystem(TriggerPrimitive::kCSC) { - calculateCSCGlobalSector(detid,_globalsector,_subsector); + calculateGlobalSector(detid,_globalsector,_subsector); _csc.trknmb = digi.getTrknmb(); _csc.valid = digi.isValid(); _csc.quality = digi.getQuality(); @@ -118,19 +120,34 @@ TriggerPrimitive::TriggerPrimitive(const CSCDetId& detid, // constructor from RPC data +TriggerPrimitive::TriggerPrimitive(const RPCDetId& detid, + const RPCDigi& digi): + _id(detid), + _subsystem(TriggerPrimitive::kRPC) { + calculateGlobalSector(detid,_globalsector,_subsector); + _rpc.strip = digi.strip(); + _rpc.strip_low = digi.strip(); + _rpc.strip_hi = digi.strip(); + _rpc.layer = detid.layer(); + _rpc.bx = digi.bx(); + _rpc.valid = 1; + _rpc.time = digi.time(); +} + TriggerPrimitive::TriggerPrimitive(const RPCDetId& detid, const unsigned strip, const unsigned layer, const int bx): _id(detid), _subsystem(TriggerPrimitive::kRPC) { - calculateRPCGlobalSector(detid,_globalsector,_subsector); + calculateGlobalSector(detid,_globalsector,_subsector); _rpc.strip = strip; _rpc.strip_low = strip; _rpc.strip_hi = strip; _rpc.layer = layer; _rpc.bx = bx; _rpc.valid = 1; + _rpc.time = -999999.; } @@ -139,11 +156,26 @@ TriggerPrimitive::TriggerPrimitive(const GEMDetId& detid, const GEMPadDigi& digi): _id(detid), _subsystem(TriggerPrimitive::kGEM) { - calculateGEMGlobalSector(detid,_globalsector,_subsector); + calculateGlobalSector(detid,_globalsector,_subsector); + _gem.pad = digi.pad(); + _gem.pad_low = digi.pad(); + _gem.pad_hi = digi.pad(); + _gem.bx = digi.bx(); + _gem.bend = 0; + _gem.isME0 = false; +} + +TriggerPrimitive::TriggerPrimitive(const ME0DetId& detid, + const ME0PadDigi& digi): + _id(detid), + _subsystem(TriggerPrimitive::kGEM) { + calculateGlobalSector(detid,_globalsector,_subsector); _gem.pad = digi.pad(); _gem.pad_low = digi.pad(); _gem.pad_hi = digi.pad(); _gem.bx = digi.bx(); + _gem.bend = 0; + _gem.isME0 = true; } TriggerPrimitive::TriggerPrimitive(const TriggerPrimitive& tp): @@ -209,10 +241,13 @@ bool TriggerPrimitive::operator==(const TriggerPrimitive& tp) const { this->_rpc.layer == tp._rpc.layer && this->_rpc.bx == tp._rpc.bx && this->_rpc.valid == tp._rpc.valid && + //this->_rpc.time == tp._rpc.time && this->_gem.pad == tp._gem.pad && this->_gem.pad_low == tp._gem.pad_low && this->_gem.pad_hi == tp._gem.pad_hi && this->_gem.bx == tp._gem.bx && + this->_gem.bend == tp._gem.bend && + this->_gem.isME0 == tp._gem.isME0 && this->_id == tp._id && this->_subsystem == tp._subsystem && this->_globalsector == tp._globalsector && @@ -291,39 +326,11 @@ const int TriggerPrimitive::getPattern() const { return -1; } -void TriggerPrimitive::calculateDTGlobalSector(const DTChamberId& chid, - unsigned& global_sector, - unsigned& subsector ) { - global_sector = 0; - subsector = 0; -} - -void TriggerPrimitive::calculateCSCGlobalSector(const CSCDetId& chid, - unsigned& global_sector, - unsigned& subsector ) { - global_sector = 0; - subsector = 0; -} - -void TriggerPrimitive::calculateRPCGlobalSector(const RPCDetId& chid, - unsigned& global_sector, - unsigned& subsector ) { - global_sector = 0; - subsector = 0; -} - -void TriggerPrimitive::calculateGEMGlobalSector(const GEMDetId& chid, - unsigned& global_sector, - unsigned& subsector ) { - global_sector = 0; - subsector = 0; -} - void TriggerPrimitive::print(std::ostream& out) const { unsigned idx = (unsigned) _subsystem; out << subsystem_names[idx] << " Trigger Primitive" << std::endl; - out << "eta: " << _eta << " phi: " << _phi - << " bend: " << _theta << std::endl; + out << "eta: " << _eta << " phi: " << _phi << " rho: " << _rho + << " theta: " << _theta << std::endl; switch(_subsystem) { case kDT: out << detId() << std::endl; @@ -361,13 +368,19 @@ void TriggerPrimitive::print(std::ostream& out) const { out << "Strip High : " << _rpc.strip_hi << std::endl; out << "Layer : " << _rpc.layer << std::endl; out << "Valid : " << _rpc.valid << std::endl; + out << "Time : " << _rpc.time << std::endl; break; case kGEM: - out << detId() << std::endl; + if (!_gem.isME0) + out << detId() << std::endl; + else + out << detId() << std::endl; out << "Local BX : " << _gem.bx << std::endl; out << "Pad : " << _gem.pad << std::endl; out << "Pad Low : " << _gem.pad_low << std::endl; out << "Pad High : " << _gem.pad_hi << std::endl; + out << "Packed Bend : " << _gem.bend << std::endl; + out << "Is ME0 : " << _gem.isME0 << std::endl; break; default: throw cms::Exception("Invalid Subsytem") diff --git a/L1Trigger/L1TMuon/src/TTGeometryTranslator.cc b/L1Trigger/L1TMuon/src/TTGeometryTranslator.cc new file mode 100644 index 0000000000000..dff19506bd3f9 --- /dev/null +++ b/L1Trigger/L1TMuon/src/TTGeometryTranslator.cc @@ -0,0 +1,195 @@ +#include "L1Trigger/L1TMuon/interface/TTGeometryTranslator.h" +#include "L1Trigger/L1TMuon/interface/TTMuonTriggerPrimitive.h" + +// event setup stuff / geometries +#include "FWCore/Framework/interface/EventSetup.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" + +#include "Geometry/CommonTopologies/interface/PixelTopology.h" +#include "Geometry/TrackerGeometryBuilder/interface/PixelGeomDetUnit.h" +#include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h" + +#include "MagneticField/Engine/interface/MagneticField.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" + +using Phase2TrackerGeomDetUnit = PixelGeomDetUnit; +using Phase2TrackerTopology = PixelTopology; + +using namespace L1TMuon; + + +TTGeometryTranslator::TTGeometryTranslator(): + _geom_cache_id(0ULL), _topo_cache_id(0ULL), _magfield_cache_id(0ULL) { +} + +TTGeometryTranslator::~TTGeometryTranslator() { +} + +bool TTGeometryTranslator::isBarrel(const TTTriggerPrimitive& tp) const { + const DetId detId = tp.detId(); + bool isBarrel = (detId.subdetId() == StripSubdetector::TOB); + //bool isEndcap = (detId.subdetId() == StripSubdetector::TID); + return isBarrel; +} + +bool TTGeometryTranslator::isPSModule(const TTTriggerPrimitive& tp) const { + const DetId detId = tp.detId(); + const TrackerGeometry::ModuleType moduleType = _geom->getDetectorType(detId); + bool isPSModule = (moduleType == TrackerGeometry::ModuleType::Ph2PSP) || (moduleType == TrackerGeometry::ModuleType::Ph2PSS); + //bool isSSModule = (moduleType == TrackerGeometry::ModuleType::Ph2SS); + return isPSModule; +} + +int TTGeometryTranslator::region(const TTTriggerPrimitive& tp) const { + int region = 0; + + const DetId detId = tp.detId(); + if (detId.subdetId() == StripSubdetector::TOB) { // barrel + region = 0; + } else if (detId.subdetId() == StripSubdetector::TID) { // endcap + int type = _topo->tidSide(detId); // 1=-ve 2=+ve + if (type == 1) { + region = -1; + } else if (type == 2) { + region = +1; + } + } + return region; +} + +int TTGeometryTranslator::layer(const TTTriggerPrimitive& tp) const { + int layer = 0; + + const DetId detId = tp.detId(); + if (detId.subdetId() == StripSubdetector::TOB) { // barrel + layer = static_cast(_topo->layer(detId)); + } else if (detId.subdetId() == StripSubdetector::TID) { // endcap + layer = static_cast(_topo->layer(detId)); + } + return layer; +} + +int TTGeometryTranslator::ring(const TTTriggerPrimitive& tp) const { + int ring = 0; + + const DetId detId = tp.detId(); + if (detId.subdetId() == StripSubdetector::TOB) { // barrel + ring = static_cast(_topo->tobRod(detId)); + } else if (detId.subdetId() == StripSubdetector::TID) { // endcap + ring = static_cast(_topo->tidRing(detId)); + } + return ring; +} + +int TTGeometryTranslator::module(const TTTriggerPrimitive& tp) const { + int module = 0; + + const DetId detId = tp.detId(); + if (detId.subdetId() == StripSubdetector::TOB) { // barrel + module = static_cast(_topo->module(detId)); + } else if (detId.subdetId() == StripSubdetector::TID) { // endcap + module = static_cast(_topo->module(detId)); + } + return module; +} + +double +TTGeometryTranslator::calculateGlobalEta(const TTTriggerPrimitive& tp) const { + switch(tp.subsystem()) { + case TTTriggerPrimitive::kTT: + return calcTTSpecificEta(tp); + break; + default: + return std::nan("Invalid TP type!"); + break; + } +} + +double +TTGeometryTranslator::calculateGlobalPhi(const TTTriggerPrimitive& tp) const { + switch(tp.subsystem()) { + case TTTriggerPrimitive::kTT: + return calcTTSpecificPhi(tp); + break; + default: + return std::nan("Invalid TP type!"); + break; + } +} + +double +TTGeometryTranslator::calculateBendAngle(const TTTriggerPrimitive& tp) const { + switch(tp.subsystem()) { + case TTTriggerPrimitive::kTT: + return calcTTSpecificBend(tp); + break; + default: + return std::nan("Invalid TP type!"); + break; + } +} + +GlobalPoint +TTGeometryTranslator::getGlobalPoint(const TTTriggerPrimitive& tp) const { + switch(tp.subsystem()) { + case TTTriggerPrimitive::kTT: + return getTTSpecificPoint(tp); + break; + default: + GlobalPoint ret(GlobalPoint::Polar(std::nan("Invalid TP type!"), std::nan("Invalid TP type!"), std::nan("Invalid TP type!"))); + return ret; + break; + } +} + +void TTGeometryTranslator::checkAndUpdateGeometry(const edm::EventSetup& es) { + const TrackerDigiGeometryRecord& geom = es.get(); + unsigned long long geomid = geom.cacheIdentifier(); + if( _geom_cache_id != geomid ) { + geom.get(_geom); + _geom_cache_id = geomid; + } + + const TrackerTopologyRcd& topo = es.get(); + unsigned long long topoid = topo.cacheIdentifier(); + if( _topo_cache_id != topoid ) { + topo.get(_topo); + _topo_cache_id = topoid; + } + + const IdealMagneticFieldRecord& magfield = es.get(); + unsigned long long magfieldid = magfield.cacheIdentifier(); + if( _magfield_cache_id != magfieldid ) { + magfield.get(_magfield); + _magfield_cache_id = magfieldid; + } +} + +GlobalPoint +TTGeometryTranslator::getTTSpecificPoint(const TTTriggerPrimitive& tp) const { + // Check L1Trigger/TrackTrigger/src/TTStubAlgorithm_official.cc + const DetId detId = tp.detId(); + const GeomDetUnit* geoUnit = _geom->idToDetUnit(detId+1); // det0 + //const GeomDetUnit* geoUnit = _geom->idToDetUnit(detId+2); // det1 + const Phase2TrackerGeomDetUnit* ph2TkGeoUnit = dynamic_cast(geoUnit); + const MeasurementPoint mp(tp.getTTData().row_f, tp.getTTData().col_f); + const GlobalPoint gp = ph2TkGeoUnit->surface().toGlobal(ph2TkGeoUnit->specificTopology().localPosition(mp)); + return gp; +} + +double +TTGeometryTranslator::calcTTSpecificEta(const TTTriggerPrimitive& tp) const { + return getTTSpecificPoint(tp).eta(); +} + +double +TTGeometryTranslator::calcTTSpecificPhi(const TTTriggerPrimitive& tp) const { + return getTTSpecificPoint(tp).phi(); +} + +double +TTGeometryTranslator::calcTTSpecificBend(const TTTriggerPrimitive& tp) const { + return tp.getTTData().bend; +} diff --git a/L1Trigger/L1TMuon/src/TTMuonTriggerPrimitive.cc b/L1Trigger/L1TMuon/src/TTMuonTriggerPrimitive.cc new file mode 100644 index 0000000000000..8fa46c5b1eefa --- /dev/null +++ b/L1Trigger/L1TMuon/src/TTMuonTriggerPrimitive.cc @@ -0,0 +1,142 @@ +#include "L1Trigger/L1TMuon/interface/TTMuonTriggerPrimitive.h" + +#include + +using namespace L1TMuon; + +namespace { + const char subsystem_names[][3] = {"TT"}; +} + +// Constructor from track trigger digi +TTTriggerPrimitive::TTTriggerPrimitive(const TTDetId& detid, const TTDigi& digi): + _id(detid), + _subsystem(kTT) { + calculateTTGlobalSector(detid,_globalsector,_subsector); + + const MeasurementPoint& mp = digi.getClusterRef(0)->findAverageLocalCoordinatesCentered(); + _data.row_f = mp.x(); + _data.col_f = mp.y(); + _data.bend = digi.getTriggerBend(); + _data.bx = 0; +} + +// Copy constructor +TTTriggerPrimitive::TTTriggerPrimitive(const TTTriggerPrimitive& tp): + _data(tp._data), + _id(tp._id), + _subsystem(tp._subsystem), + _globalsector(tp._globalsector), + _subsector(tp._subsector), + _eta(tp._eta), + _phi(tp._phi), + _rho(tp._rho), + _theta(tp._theta){ +} + +// Assignment operator +TTTriggerPrimitive& TTTriggerPrimitive::operator=(const TTTriggerPrimitive& tp) { + this->_data = tp._data; + this->_id = tp._id; + this->_subsystem = tp._subsystem; + this->_globalsector = tp._globalsector; + this->_subsector = tp._subsector; + this->_eta = tp._eta; + this->_phi = tp._phi; + this->_rho = tp._rho; + this->_theta = tp._theta; + return *this; +} + +// Equality operator +bool TTTriggerPrimitive::operator==(const TTTriggerPrimitive& tp) const { + return ( static_cast(this->_data.row_f) == static_cast(tp._data.row_f) && + static_cast(this->_data.col_f) == static_cast(tp._data.col_f) && + this->_data.bend == tp._data.bend && + this->_data.bx == tp._data.bx && + this->_id == tp._id && + this->_subsystem == tp._subsystem && + this->_globalsector == tp._globalsector && + this->_subsector == tp._subsector ); +} + +const int TTTriggerPrimitive::getBX() const { + switch(_subsystem) { + case kTT: + return _data.bx; + default: + throw cms::Exception("Invalid Subsytem") + << "The specified subsystem for this track stub is out of range" + << std::endl; + } + return -1; +} + +const int TTTriggerPrimitive::getStrip() const { + switch(_subsystem) { + case kTT: + return static_cast(_data.row_f); + default: + throw cms::Exception("Invalid Subsytem") + << "The specified subsystem for this track stub is out of range" + << std::endl; + } + return -1; +} + +const int TTTriggerPrimitive::getSegment() const { + switch(_subsystem) { + case kTT: + return static_cast(_data.col_f); + default: + throw cms::Exception("Invalid Subsytem") + << "The specified subsystem for this track stub is out of range" + << std::endl; + } + return -1; +} + +const int TTTriggerPrimitive::getBend() const { + switch(_subsystem) { + case kTT: + return static_cast(_data.bend); + default: + throw cms::Exception("Invalid Subsytem") + << "The specified subsystem for this track stub is out of range" + << std::endl; + } + return -1; +} + +void TTTriggerPrimitive::calculateTTGlobalSector(const TTDetId& detid, + unsigned& globalsector, + unsigned& subsector ) { + globalsector = 0; + subsector = 0; +} + +std::ostream& operator<<(std::ostream& os, const TTTriggerPrimitive::TTDetId& detid) { + // Note that there is no endl to end the output + os << " undefined"; + return os; +} + +void TTTriggerPrimitive::print(std::ostream& out) const { + unsigned idx = (unsigned) _subsystem; + out << subsystem_names[idx] << " Trigger Primitive" << std::endl; + out << "eta: " << _eta << " phi: " << _phi << " rho: " << _rho + << " bend: " << _theta << std::endl; + switch(_subsystem) { + case kTT: + out << detId() << std::endl; + out << "Strip : " << static_cast(_data.row_f) << std::endl; + out << "Segment : " << static_cast(_data.col_f) << std::endl; + out << "Bend : " << _data.bend << std::endl; + out << "BX : " << _data.bx << std::endl; + break; + default: + throw cms::Exception("Invalid Subsytem") + << "The specified subsystem for this track stub is out of range" + << std::endl; + } +} From 511ac123c11a985804e6f5a492f3067df833313d Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Mon, 2 Apr 2018 17:49:44 +0200 Subject: [PATCH 301/426] Remove using statement as this is an actual bug. --- RecoMuon/MuonIsolation/plugins/ExtractorFromDeposits.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoMuon/MuonIsolation/plugins/ExtractorFromDeposits.h b/RecoMuon/MuonIsolation/plugins/ExtractorFromDeposits.h index fb394b668f4d0..84151f5192041 100644 --- a/RecoMuon/MuonIsolation/plugins/ExtractorFromDeposits.h +++ b/RecoMuon/MuonIsolation/plugins/ExtractorFromDeposits.h @@ -26,7 +26,7 @@ class ExtractorFromDeposits : public reco::isodeposit::IsoDepositExtractor { const reco::TrackCollection & tracks) override; reco::IsoDeposit deposit (const edm::Event & ev, const edm::EventSetup & evSetup, const reco::Track & track) const override; - using reco::isodeposit::IsoDepositExtractor::deposit; + virtual reco::IsoDeposit deposit (const edm::Event & ev, const edm::EventSetup & evSetup, const reco::TrackRef & track) const; From f3059c72879c8861685cd722dc4ef1e89e3fe285 Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Mon, 2 Apr 2018 17:59:52 +0200 Subject: [PATCH 302/426] spaces --- RecoMuon/MuonIsolation/plugins/ExtractorFromDeposits.h | 1 - 1 file changed, 1 deletion(-) diff --git a/RecoMuon/MuonIsolation/plugins/ExtractorFromDeposits.h b/RecoMuon/MuonIsolation/plugins/ExtractorFromDeposits.h index 84151f5192041..acd03f2cff1a9 100644 --- a/RecoMuon/MuonIsolation/plugins/ExtractorFromDeposits.h +++ b/RecoMuon/MuonIsolation/plugins/ExtractorFromDeposits.h @@ -26,7 +26,6 @@ class ExtractorFromDeposits : public reco::isodeposit::IsoDepositExtractor { const reco::TrackCollection & tracks) override; reco::IsoDeposit deposit (const edm::Event & ev, const edm::EventSetup & evSetup, const reco::Track & track) const override; - virtual reco::IsoDeposit deposit (const edm::Event & ev, const edm::EventSetup & evSetup, const reco::TrackRef & track) const; From 3e23bdf73f9ee04171d08018c57cadc0a6b0dec1 Mon Sep 17 00:00:00 2001 From: Slava Krutelyov Date: Mon, 2 Apr 2018 18:35:02 +0200 Subject: [PATCH 303/426] remove ExtractorFromDeposits --- RecoMuon/MuonIsolation/doc/MuonIsolation.doc | 1 - .../plugins/ExtractorFromDeposits.cc | 56 ------------------- .../plugins/ExtractorFromDeposits.h | 39 ------------- RecoMuon/MuonIsolation/plugins/module.cc | 2 - 4 files changed, 98 deletions(-) delete mode 100644 RecoMuon/MuonIsolation/plugins/ExtractorFromDeposits.cc delete mode 100644 RecoMuon/MuonIsolation/plugins/ExtractorFromDeposits.h diff --git a/RecoMuon/MuonIsolation/doc/MuonIsolation.doc b/RecoMuon/MuonIsolation/doc/MuonIsolation.doc index 1e38bb827600d..ad7b641d9f963 100644 --- a/RecoMuon/MuonIsolation/doc/MuonIsolation.doc +++ b/RecoMuon/MuonIsolation/doc/MuonIsolation.doc @@ -42,7 +42,6 @@ Concrete isolation algorithm: extract IsoDeposit using extractor and get sumPt i - Range: helper class implementation of (min, max) range for ordered types. \subsection plugins Plugins -- ExtractorFromDeposits: finds IsoDeposit of the input track in the event record. - TrackExtractor: make IsoDeposit using "other" tracks within "DR_Veto" to "DR_Max", with |dZ|< "Diff_z" and |dr_xy| < "Diff_r" from the muon track. - CaloExtractorByAssociator: with CaloTowers or recHits on input would provide MuIsoDeposits for ecal, hcal and ho separately (3 cts) using TrackDetectorAssociator. The deposit values are hit/tower et; each hit/tower with energy>3*sigmaNoise and et> threshold, being within "DR_Max" and excluding "DR_Veto" gets an entry. diff --git a/RecoMuon/MuonIsolation/plugins/ExtractorFromDeposits.cc b/RecoMuon/MuonIsolation/plugins/ExtractorFromDeposits.cc deleted file mode 100644 index f8f88086a2341..0000000000000 --- a/RecoMuon/MuonIsolation/plugins/ExtractorFromDeposits.cc +++ /dev/null @@ -1,56 +0,0 @@ -#include "ExtractorFromDeposits.h" - -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "DataFormats/RecoCandidate/interface/IsoDepositDirection.h" - -using namespace edm; -using namespace std; -using namespace reco; -using namespace muonisolation; -using reco::isodeposit::Direction; - -ExtractorFromDeposits::ExtractorFromDeposits( const ParameterSet& par, edm::ConsumesCollector && iC ) : - theCollectionToken(iC.consumes(par.getParameter("IsolationCollectionTag"))) -{ } - -void ExtractorFromDeposits::fillVetos (const edm::Event & ev, - const edm::EventSetup & evSetup, const reco::TrackCollection & muons) -{ } - -IsoDeposit ExtractorFromDeposits::deposit(const Event & event, - const EventSetup & eventSetup, const Track & muon) const -{ - static const std::string metname = "RecoMuon|ExtractorFromDeposits"; - Handle depMap; - event.getByToken(theCollectionToken, depMap); - - LogWarning(metname)<<"Call this method only if the original muon track collection is lost"; - - // double vtx_z = muon.vz(); - reco::isodeposit::Direction muonDir(muon.eta(), muon.phi()); - - typedef reco::IsoDepositMap::const_iterator iterator_i; - typedef reco::IsoDepositMap::container::const_iterator iterator_ii; - iterator_i depI = depMap->begin(); - iterator_i depIEnd = depMap->end(); - for (; depI != depIEnd; ++depI){ - iterator_ii depII = depI.begin(); - iterator_ii depIIEnd = depI.end(); - for (; depII != depIIEnd; ++depII){ - reco::isodeposit::Direction depDir(depII->direction()); - if (muonDir.deltaR(depDir) < 1.e-6) return *depII; - } - } - - return IsoDeposit(); -} - -IsoDeposit ExtractorFromDeposits::deposit(const Event & event, - const EventSetup & eventSetup, const TrackRef & muon) const -{ - Handle depMap; - event.getByToken(theCollectionToken, depMap); - - return (*depMap)[muon]; -} diff --git a/RecoMuon/MuonIsolation/plugins/ExtractorFromDeposits.h b/RecoMuon/MuonIsolation/plugins/ExtractorFromDeposits.h deleted file mode 100644 index acd03f2cff1a9..0000000000000 --- a/RecoMuon/MuonIsolation/plugins/ExtractorFromDeposits.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef MuonIsolation_ExtractorFromDeposits_H -#define MuonIsolation_ExtractorFromDeposits_H - -#include "FWCore/Framework/interface/ConsumesCollector.h" - -#include "PhysicsTools/IsolationAlgos/interface/IsoDepositExtractor.h" - -#include "DataFormats/RecoCandidate/interface/IsoDeposit.h" -#include "DataFormats/RecoCandidate/interface/IsoDepositFwd.h" -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/TrackReco/interface/TrackFwd.h" -#include - -namespace muonisolation { - -class ExtractorFromDeposits : public reco::isodeposit::IsoDepositExtractor { - -public: - - ExtractorFromDeposits(){}; - ExtractorFromDeposits(const edm::ParameterSet& par, edm::ConsumesCollector && iC); - - ~ExtractorFromDeposits() override{} - - void fillVetos ( const edm::Event & ev, const edm::EventSetup & evSetup, - const reco::TrackCollection & tracks) override; - reco::IsoDeposit deposit (const edm::Event & ev, const edm::EventSetup & evSetup, - const reco::Track & track) const override; - virtual reco::IsoDeposit deposit (const edm::Event & ev, const edm::EventSetup & evSetup, - const reco::TrackRef & track) const; - -private: - edm::EDGetTokenT theCollectionToken; -}; - -} - -#endif - diff --git a/RecoMuon/MuonIsolation/plugins/module.cc b/RecoMuon/MuonIsolation/plugins/module.cc index 8256b8c3e35ef..94b07e33d530e 100755 --- a/RecoMuon/MuonIsolation/plugins/module.cc +++ b/RecoMuon/MuonIsolation/plugins/module.cc @@ -9,13 +9,11 @@ #include "CaloExtractor.h" #include "CaloExtractorByAssociator.h" #include "JetExtractor.h" -#include "ExtractorFromDeposits.h" DEFINE_EDM_PLUGIN(IsoDepositExtractorFactory, muonisolation::TrackExtractor, "TrackExtractor"); DEFINE_EDM_PLUGIN(IsoDepositExtractorFactory, muonisolation::PixelTrackExtractor, "PixelTrackExtractor"); DEFINE_EDM_PLUGIN(IsoDepositExtractorFactory, muonisolation::CaloExtractor, "CaloExtractor"); DEFINE_EDM_PLUGIN(IsoDepositExtractorFactory, muonisolation::CaloExtractorByAssociator, "CaloExtractorByAssociator"); DEFINE_EDM_PLUGIN(IsoDepositExtractorFactory, muonisolation::JetExtractor, "JetExtractor"); -DEFINE_EDM_PLUGIN(IsoDepositExtractorFactory, muonisolation::ExtractorFromDeposits, "ExtractorFromDeposits"); #include "RecoMuon/MuonIsolation/interface/MuonIsolatorFactory.h" #include "RecoMuon/MuonIsolation/interface/SimpleCutsIsolator.h" From 35f7ea407021de25fa92a50bac0fa588357a8f61 Mon Sep 17 00:00:00 2001 From: Martin Grunewald Date: Tue, 3 Apr 2018 12:59:05 +0200 Subject: [PATCH 304/426] Migration to 1010 template --- .../Configuration/python/HLT_FULL_cff.py | 111 +++--- .../Configuration/python/HLT_Fake1_cff.py | 6 +- .../Configuration/python/HLT_Fake2_cff.py | 6 +- .../Configuration/python/HLT_Fake_cff.py | 6 +- .../Configuration/python/HLT_GRun_cff.py | 286 ++++++++++++---- .../Configuration/python/HLT_HIon_cff.py | 34 +- .../Configuration/python/HLT_PIon_cff.py | 34 +- .../Configuration/python/HLT_PRef_cff.py | 56 ++-- .../python/HLTrigger_Datasets_GRun_cff.py | 4 +- .../python/HLTrigger_Datasets_HIon_cff.py | 2 +- .../python/HLTrigger_Datasets_PIon_cff.py | 2 +- .../python/HLTrigger_Datasets_PRef_cff.py | 2 +- .../python/customizeHLTforCMSSW.py | 30 -- HLTrigger/Configuration/tables/GRun.txt | 4 + HLTrigger/Configuration/tables/makeOnlineGRun | 2 +- HLTrigger/Configuration/tables/makeSubTables | 4 +- .../Configuration/tables/online_grun.txt | 4 + .../Configuration/test/OnLine_HLT_FULL.py | 111 +++--- .../Configuration/test/OnLine_HLT_Fake.py | 6 +- .../Configuration/test/OnLine_HLT_Fake1.py | 6 +- .../Configuration/test/OnLine_HLT_Fake2.py | 6 +- .../Configuration/test/OnLine_HLT_GRun.py | 316 +++++++++++++----- .../Configuration/test/OnLine_HLT_HIon.py | 34 +- .../Configuration/test/OnLine_HLT_PIon.py | 34 +- .../Configuration/test/OnLine_HLT_PRef.py | 56 ++-- HLTrigger/Configuration/test/getFrozenHLT.sh | 6 +- HLTrigger/Configuration/test/getHLT.sh | 4 +- 27 files changed, 766 insertions(+), 406 deletions(-) diff --git a/HLTrigger/Configuration/python/HLT_FULL_cff.py b/HLTrigger/Configuration/python/HLT_FULL_cff.py index f40cc23ced2cf..121aef682e173 100644 --- a/HLTrigger/Configuration/python/HLT_FULL_cff.py +++ b/HLTrigger/Configuration/python/HLT_FULL_cff.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --cff --data /dev/CMSSW_10_0_0/HLT --type FULL +# hltGetConfiguration --cff --data /dev/CMSSW_10_1_0/HLT --type FULL -# /dev/CMSSW_10_0_0/HLT/V140 (CMSSW_10_0_4) +# /dev/CMSSW_10_1_0/HLT/V3 (CMSSW_10_1_0) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_10_0_0/HLT/V140') + tableName = cms.string('/dev/CMSSW_10_1_0/HLT/V3') ) fragment.transferSystem = cms.PSet( @@ -4377,13 +4377,13 @@ 'HcalCellDead' ) ) fragment.hltCombinedSecondaryVertex = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -4396,7 +4396,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( -99999.9 ), + sip2dSigMin = cms.double( 2.0 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -4405,12 +4405,12 @@ 'CombinedSVPseudoVertex', 'CombinedSVNoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -4423,7 +4423,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( 2.0 ), + sip2dSigMin = cms.double( -99999.9 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -4433,13 +4433,13 @@ trackFlip = cms.bool( False ) ) fragment.hltCombinedSecondaryVertexV2 = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -4465,18 +4465,18 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( -99999.9 ) + sip2dSigMin = cms.double( 2.0 ) ), calibrationRecords = cms.vstring( 'CombinedSVIVFV2RecoVertex', 'CombinedSVIVFV2PseudoVertex', 'CombinedSVIVFV2NoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -4502,7 +4502,7 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( 2.0 ) + sip2dSigMin = cms.double( -99999.9 ) ), trackSort = cms.string( "sip2dSig" ), SoftLeptonFlip = cms.bool( False ), @@ -5952,9 +5952,11 @@ logWarningEtThreshold_EE_FE = cms.double( 50.0 ) ) fragment.hltHcalDigis = cms.EDProducer( "HcalRawToDigi", + saveQIE10DataNSamples = cms.untracked.vint32( ), ExpectedOrbitMessageTime = cms.untracked.int32( -1 ), FilterDataQuality = cms.bool( True ), silent = cms.untracked.bool( True ), + saveQIE11DataNSamples = cms.untracked.vint32( ), HcalFirstFED = cms.untracked.int32( 700 ), InputLabel = cms.InputTag( "rawDataCollector" ), ComplainEmptyData = cms.untracked.bool( False ), @@ -5962,10 +5964,12 @@ UnpackCalib = cms.untracked.bool( True ), UnpackUMNio = cms.untracked.bool( True ), FEDs = cms.untracked.vint32( ), - UnpackerMode = cms.untracked.int32( 0 ), + saveQIE11DataTags = cms.untracked.vstring( ), UnpackTTP = cms.untracked.bool( False ), - lastSample = cms.int32( 9 ), UnpackZDC = cms.untracked.bool( True ), + saveQIE10DataTags = cms.untracked.vstring( ), + lastSample = cms.int32( 9 ), + UnpackerMode = cms.untracked.int32( 0 ), firstSample = cms.int32( 0 ) ) fragment.hltHbhePhase1Reco = cms.EDProducer( "HBHEPhase1Reconstructor", @@ -12752,11 +12756,13 @@ GsfTrackProducer = cms.InputTag( "hltEgammaGsfTracks" ) ) fragment.hltEgammaGsfTrackVars = cms.EDProducer( "EgammaHLTGsfTrackVarProducer", - recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidates" ), - beamSpotProducer = cms.InputTag( "hltOnlineBeamSpot" ), upperTrackNrToRemoveCut = cms.int32( 9999 ), + useDefaultValuesForEndcap = cms.bool( False ), lowerTrackNrToRemoveCut = cms.int32( -1 ), - inputCollection = cms.InputTag( "hltEgammaGsfTracks" ) + inputCollection = cms.InputTag( "hltEgammaGsfTracks" ), + recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidates" ), + beamSpotProducer = cms.InputTag( "hltOnlineBeamSpot" ), + useDefaultValuesForBarrel = cms.bool( False ) ) fragment.hltDiMu5Ele3CaloIdLTrackIdLElectronlegOneOEMinusOneOPFilter = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), @@ -38605,6 +38611,7 @@ lMinHighEHitTime = cms.double( -9999.0 ), fillLaserMonitor = cms.bool( True ), tMinHPDHits = cms.int32( 16 ), + tRBXRecHitR45Cuts = cms.vdouble( 0.0, 1.0, 0.0, -0.2, 0.0, 0.0, 1.0, -0.2 ), minRecHitE = cms.double( 1.5 ), pMaxHighEHitTime = cms.double( 5.0 ), lRBXRecHitR45Cuts = cms.vdouble( 0.0, 1.0, 0.0, -0.5, 0.0, 0.0, 1.0, -0.5 ), @@ -38618,12 +38625,13 @@ maxNHF = cms.double( 0.9 ), minHighHitE = cms.double( 25.0 ), minR45HitE = cms.double( 5.0 ), - tRBXRecHitR45Cuts = cms.vdouble( 0.0, 1.0, 0.0, -0.2, 0.0, 0.0, 1.0, -0.2 ), + lasermonDigis = cms.InputTag( 'hltHcalDigis','LASERMON' ), lMinZeros = cms.int32( 10 ), lMinRBXHits = cms.int32( 999 ), fillRecHits = cms.bool( True ), minERatio = cms.double( 50.0 ), TS4TS5LowerThreshold = cms.vdouble( 100.0, 120.0, 150.0, 200.0, 300.0, 400.0, 500.0 ), + hlMaxRBXEMF = cms.double( 0.01 ), lMinHPDNoOtherHits = cms.int32( 10 ), pMinRBXRechitR45EnergyFraction = cms.double( 0.1 ), hlMaxHPDEMF = cms.double( -9999.0 ), @@ -38633,7 +38641,6 @@ laserMonIEtaList = cms.vint32( 0, 0, 0, 0, 0, 0, 0, 0 ), laserMonIPhiList = cms.vint32( 23, 17, 11, 5, 29, 35, 41, 47 ), pMinRatio = cms.double( 0.75 ), - tMinLowEHitTime = cms.double( -9999.0 ), HcalAcceptSeverityLevel = cms.uint32( 9 ), pMaxRBXEMF = cms.double( 0.02 ), tMaxRatio = cms.double( 0.92 ), @@ -38666,7 +38673,7 @@ tMinHPDNoOtherHits = cms.int32( 9 ), pMaxHPDEMF = cms.double( 0.02 ), jetCollName = cms.string( "" ), - hlMaxRBXEMF = cms.double( 0.01 ), + tMinLowEHitTime = cms.double( -9999.0 ), tMaxHighEHitTime = cms.double( 6.0 ), pMaxLowEHitTime = cms.double( 6.0 ), lMinHPDHits = cms.int32( 17 ), @@ -55189,6 +55196,7 @@ MinPt = cms.double( 110.0 ) ) fragment.hltL1TPFJetsMatching = cms.EDProducer( "L1TPFJetsMatching", + pt3Min = cms.double( 110.0 ), matchingR = cms.double( 0.5 ), pt2Min = cms.double( 35.0 ), mjjMin = cms.double( 650.0 ), @@ -56783,6 +56791,7 @@ MinPt = cms.double( 20.0 ) ) fragment.hltVBFL1TLooseIDPFJetsMatching = cms.EDProducer( "L1TPFJetsMatching", + pt3Min = cms.double( 110.0 ), matchingR = cms.double( 0.5 ), pt2Min = cms.double( 40.0 ), mjjMin = cms.double( 650.0 ), @@ -65973,13 +65982,13 @@ minimumTransverseMomentum = cms.double( 1.0 ), primaryVertex = cms.InputTag( "hltVerticesPFFilter" ), maximumLongitudinalImpactParameter = cms.double( 17.0 ), - computeGhostTrack = cms.bool( True ), + jets = cms.InputTag( "hltPFJetForBtag" ), maxDeltaR = cms.double( 0.4 ), candidates = cms.InputTag( "hltParticleFlow" ), jetDirectionUsingGhostTrack = cms.bool( False ), minimumNumberOfPixelHits = cms.int32( 2 ), jetDirectionUsingTracks = cms.bool( False ), - jets = cms.InputTag( "hltPFJetForBtag" ), + computeGhostTrack = cms.bool( True ), useTrackQuality = cms.bool( False ), ghostTrackPriorDeltaR = cms.double( 0.03 ), maximumChiSquared = cms.double( 5.0 ), @@ -77619,15 +77628,15 @@ ) fragment.hltSiPixelClustersAfterSplittingForRefPP = cms.EDProducer( "JetCoreClusterSplitter", verbose = cms.bool( False ), - deltaRmax = cms.double( 0.05 ), + chargeFractionMin = cms.double( 2.0 ), forceXError = cms.double( 100.0 ), vertices = cms.InputTag( "hltFullIter0PrimaryVerticesPreSplittingForRefPP" ), chargePerUnit = cms.double( 2000.0 ), - forceYError = cms.double( 150.0 ), centralMIPCharge = cms.double( 26000.0 ), + forceYError = cms.double( 150.0 ), pixelClusters = cms.InputTag( "hltSiPixelClustersForRefPP" ), ptMin = cms.double( 200.0 ), - chargeFractionMin = cms.double( 2.0 ), + deltaRmax = cms.double( 0.05 ), cores = cms.InputTag( "hltJetsForCoreTracking" ), fractionalWidth = cms.double( 0.4 ), pixelCPE = cms.string( "hltESPPixelCPEGeneric" ) @@ -85913,20 +85922,27 @@ filterTrackEnergy = cms.bool( True ) ) fragment.hltIsolEcalPixelTrackProdHB = cms.EDProducer( "IsolatedEcalPixelTrackCandidateProducer", - ECHitEnergyThreshold = cms.double( 0.05 ), - filterLabel = cms.InputTag( "hltIsolPixelTrackL2FilterHB" ), + EEHitEnergyThreshold3 = cms.double( 3.52151 ), + EEHitEnergyThreshold2 = cms.double( -19.0741 ), + EEHitEnergyThreshold1 = cms.double( 34.3975 ), + EEHitEnergyThreshold0 = cms.double( -20.5332 ), + EBHitCountEnergyThreshold = cms.double( 0.5 ), + EBHitEnergyThreshold = cms.double( 0.1 ), EBRecHitSource = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEB' ), - ECHitCountEnergyThreshold = cms.double( 0.5 ), + filterLabel = cms.InputTag( "hltIsolPixelTrackL2FilterHB" ), + EcalConeSizeEta1 = cms.double( 0.14 ), EcalConeSizeEta0 = cms.double( 0.09 ), EERecHitSource = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEE' ), - EcalConeSizeEta1 = cms.double( 0.14 ) + EEFacHitCountEnergyThreshold = cms.double( 10.0 ) ) fragment.hltEcalIsolPixelTrackL2FilterHB = cms.EDFilter( "HLTEcalPixelIsolTrackFilter", saveTags = cms.bool( True ), DropMultiL2Event = cms.bool( False ), - MaxEnergyIn = cms.double( 1.2 ), - MaxEnergyOut = cms.double( 1.2 ), + MaxEnergyInEB = cms.double( 2.0 ), + MaxEnergyInEE = cms.double( 2.0 ), + MaxEnergyOutEB = cms.double( 1.2 ), NMaxTrackCandidates = cms.int32( 10 ), + MaxEnergyOutEE = cms.double( 1.2 ), candTag = cms.InputTag( "hltIsolEcalPixelTrackProdHB" ) ) fragment.hltHcalITIPTCorrectorHB = cms.EDProducer( "IPTCorrector", @@ -85983,20 +85999,27 @@ filterTrackEnergy = cms.bool( True ) ) fragment.hltIsolEcalPixelTrackProdHE = cms.EDProducer( "IsolatedEcalPixelTrackCandidateProducer", - ECHitEnergyThreshold = cms.double( 0.05 ), - filterLabel = cms.InputTag( "hltIsolPixelTrackL2FilterHE" ), + EEHitEnergyThreshold3 = cms.double( 3.52151 ), + EEHitEnergyThreshold2 = cms.double( -19.0741 ), + EEHitEnergyThreshold1 = cms.double( 34.3975 ), + EEHitEnergyThreshold0 = cms.double( -20.5332 ), + EBHitCountEnergyThreshold = cms.double( 0.5 ), + EBHitEnergyThreshold = cms.double( 0.1 ), EBRecHitSource = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEB' ), - ECHitCountEnergyThreshold = cms.double( 0.5 ), + filterLabel = cms.InputTag( "hltIsolPixelTrackL2FilterHE" ), + EcalConeSizeEta1 = cms.double( 0.14 ), EcalConeSizeEta0 = cms.double( 0.09 ), EERecHitSource = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEE' ), - EcalConeSizeEta1 = cms.double( 0.14 ) + EEFacHitCountEnergyThreshold = cms.double( 10.0 ) ) fragment.hltEcalIsolPixelTrackL2FilterHE = cms.EDFilter( "HLTEcalPixelIsolTrackFilter", saveTags = cms.bool( True ), DropMultiL2Event = cms.bool( False ), - MaxEnergyIn = cms.double( 1.2 ), - MaxEnergyOut = cms.double( 1.2 ), + MaxEnergyInEB = cms.double( 2.0 ), + MaxEnergyInEE = cms.double( 2.0 ), + MaxEnergyOutEB = cms.double( 1.2 ), NMaxTrackCandidates = cms.int32( 10 ), + MaxEnergyOutEE = cms.double( 1.2 ), candTag = cms.InputTag( "hltIsolEcalPixelTrackProdHE" ) ) fragment.hltHcalITIPTCorrectorHE = cms.EDProducer( "IPTCorrector", @@ -100666,13 +100689,13 @@ minimumTransverseMomentum = cms.double( 1.0 ), primaryVertex = cms.InputTag( "hltVerticesPFFilter" ), maximumLongitudinalImpactParameter = cms.double( 17.0 ), - computeGhostTrack = cms.bool( True ), + jets = cms.InputTag( "hltPFJetForDBtagAK8" ), maxDeltaR = cms.double( 0.4 ), candidates = cms.InputTag( "hltParticleFlow" ), jetDirectionUsingGhostTrack = cms.bool( False ), minimumNumberOfPixelHits = cms.int32( 2 ), jetDirectionUsingTracks = cms.bool( False ), - jets = cms.InputTag( "hltPFJetForDBtagAK8" ), + computeGhostTrack = cms.bool( True ), useTrackQuality = cms.bool( False ), ghostTrackPriorDeltaR = cms.double( 0.03 ), maximumChiSquared = cms.double( 5.0 ), diff --git a/HLTrigger/Configuration/python/HLT_Fake1_cff.py b/HLTrigger/Configuration/python/HLT_Fake1_cff.py index aeb73000534a7..1c5629f5b4b3d 100644 --- a/HLTrigger/Configuration/python/HLT_Fake1_cff.py +++ b/HLTrigger/Configuration/python/HLT_Fake1_cff.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --cff --data /dev/CMSSW_10_0_0/Fake1 --type Fake1 +# hltGetConfiguration --cff --data /dev/CMSSW_10_1_0/Fake1 --type Fake1 -# /dev/CMSSW_10_0_0/Fake1/V7 (CMSSW_10_0_4) +# /dev/CMSSW_10_1_0/Fake1/V2 (CMSSW_10_1_0) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_10_0_0/Fake1/V7') + tableName = cms.string('/dev/CMSSW_10_1_0/Fake1/V2') ) fragment.streams = cms.PSet( A = cms.vstring( 'InitialPD' ) ) diff --git a/HLTrigger/Configuration/python/HLT_Fake2_cff.py b/HLTrigger/Configuration/python/HLT_Fake2_cff.py index 99f8c8284ed0e..00ca7fe566544 100644 --- a/HLTrigger/Configuration/python/HLT_Fake2_cff.py +++ b/HLTrigger/Configuration/python/HLT_Fake2_cff.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --cff --data /dev/CMSSW_10_0_0/Fake2 --type Fake2 +# hltGetConfiguration --cff --data /dev/CMSSW_10_1_0/Fake2 --type Fake2 -# /dev/CMSSW_10_0_0/Fake2/V8 (CMSSW_10_0_4) +# /dev/CMSSW_10_1_0/Fake2/V2 (CMSSW_10_1_0) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_10_0_0/Fake2/V8') + tableName = cms.string('/dev/CMSSW_10_1_0/Fake2/V2') ) fragment.streams = cms.PSet( A = cms.vstring( 'InitialPD' ) ) diff --git a/HLTrigger/Configuration/python/HLT_Fake_cff.py b/HLTrigger/Configuration/python/HLT_Fake_cff.py index 0b4636f5bee96..0603f8020ab93 100644 --- a/HLTrigger/Configuration/python/HLT_Fake_cff.py +++ b/HLTrigger/Configuration/python/HLT_Fake_cff.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --cff --data /dev/CMSSW_10_0_0/Fake --type Fake +# hltGetConfiguration --cff --data /dev/CMSSW_10_1_0/Fake --type Fake -# /dev/CMSSW_10_0_0/Fake/V7 (CMSSW_10_0_4) +# /dev/CMSSW_10_1_0/Fake/V2 (CMSSW_10_1_0) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_10_0_0/Fake/V7') + tableName = cms.string('/dev/CMSSW_10_1_0/Fake/V2') ) fragment.streams = cms.PSet( A = cms.vstring( 'InitialPD' ) ) diff --git a/HLTrigger/Configuration/python/HLT_GRun_cff.py b/HLTrigger/Configuration/python/HLT_GRun_cff.py index 7263b475183c4..615c1346e84a8 100644 --- a/HLTrigger/Configuration/python/HLT_GRun_cff.py +++ b/HLTrigger/Configuration/python/HLT_GRun_cff.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --cff --data /dev/CMSSW_10_0_0/GRun --type GRun +# hltGetConfiguration --cff --data /dev/CMSSW_10_1_0/GRun --type GRun -# /dev/CMSSW_10_0_0/GRun/V42 (CMSSW_10_0_4) +# /dev/CMSSW_10_1_0/GRun/V1 (CMSSW_10_1_0) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_10_0_0/GRun/V42') + tableName = cms.string('/dev/CMSSW_10_1_0/GRun/V1') ) fragment.transferSystem = cms.PSet( @@ -2263,6 +2263,8 @@ 'HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_v1', 'HLT_DoubleL2Mu25NoVtx_2Cha_Eta2p4_v1', 'HLT_DoubleL2Mu25NoVtx_2Cha_v1', + 'HLT_DoubleL2Mu30NoVtx_2Cha_CosmicSeed_Eta2p4_v1', + 'HLT_DoubleL2Mu30NoVtx_2Cha_Eta2p4_v1', 'HLT_DoubleL2Mu50_v2', 'HLT_DoubleMu3_DCA_PFMET50_PFMHT60_v8', 'HLT_DoubleMu3_DZ_PFMET50_PFMHT60_v8', @@ -2785,6 +2787,8 @@ 'HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_v1', 'HLT_DoubleL2Mu25NoVtx_2Cha_Eta2p4_v1', 'HLT_DoubleL2Mu25NoVtx_2Cha_v1', + 'HLT_DoubleL2Mu30NoVtx_2Cha_CosmicSeed_Eta2p4_v1', + 'HLT_DoubleL2Mu30NoVtx_2Cha_Eta2p4_v1', 'HLT_DoubleL2Mu50_v2', 'HLT_DoubleMediumChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_v10', 'HLT_DoubleMediumChargedIsoPFTau35_Trk1_eta2p1_Reg_v10', @@ -2886,9 +2890,9 @@ 'HLT_HT500_DisplacedDijet40_DisplacedTrack_v11', 'HLT_HT550_DisplacedDijet60_Inclusive_v11', 'HLT_HT650_DisplacedDijet60_Inclusive_v11', - 'HLT_HcalNZS_v12', - 'HLT_HcalPhiSym_v14', - 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_CrossL1_v10')+cms.vstring( 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10', + 'HLT_HcalNZS_v12')+cms.vstring( 'HLT_HcalPhiSym_v14', + 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_CrossL1_v10', + 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10', 'HLT_IsoMu20_eta2p1_MediumChargedIsoPFTau27_eta2p1_CrossL1_v10', 'HLT_IsoMu20_eta2p1_MediumChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10', 'HLT_IsoMu20_eta2p1_TightChargedIsoPFTau27_eta2p1_CrossL1_v10', @@ -3140,9 +3144,9 @@ 'HLT_Tau3Mu_Mu7_Mu1_TkMu1_Tau15_Charge1_v2', 'HLT_Tau3Mu_Mu7_Mu1_TkMu1_Tau15_v2', 'HLT_TkMu100_v2', - 'HLT_Trimuon5_3p5_2_Upsilon_Muon_v4', - 'HLT_TrimuonOpen_5_3p5_2_Upsilon_Muon_v2', - 'HLT_TripleJet110_35_35_Mjj650_PFMET110_v7')+cms.vstring( 'HLT_TripleJet110_35_35_Mjj650_PFMET120_v7', + 'HLT_Trimuon5_3p5_2_Upsilon_Muon_v4')+cms.vstring( 'HLT_TrimuonOpen_5_3p5_2_Upsilon_Muon_v2', + 'HLT_TripleJet110_35_35_Mjj650_PFMET110_v7', + 'HLT_TripleJet110_35_35_Mjj650_PFMET120_v7', 'HLT_TripleJet110_35_35_Mjj650_PFMET130_v7', 'HLT_TripleMu_10_5_5_DZ_v9', 'HLT_TripleMu_12_10_5_v9', @@ -3757,13 +3761,13 @@ 'HcalCellDead' ) ) fragment.hltCombinedSecondaryVertex = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -3776,7 +3780,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( -99999.9 ), + sip2dSigMin = cms.double( 2.0 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -3785,12 +3789,12 @@ 'CombinedSVPseudoVertex', 'CombinedSVNoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -3803,7 +3807,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( 2.0 ), + sip2dSigMin = cms.double( -99999.9 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -3813,13 +3817,13 @@ trackFlip = cms.bool( False ) ) fragment.hltCombinedSecondaryVertexV2 = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -3845,18 +3849,18 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( -99999.9 ) + sip2dSigMin = cms.double( 2.0 ) ), calibrationRecords = cms.vstring( 'CombinedSVIVFV2RecoVertex', 'CombinedSVIVFV2PseudoVertex', 'CombinedSVIVFV2NoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -3882,7 +3886,7 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( 2.0 ) + sip2dSigMin = cms.double( -99999.9 ) ), trackSort = cms.string( "sip2dSig" ), SoftLeptonFlip = cms.bool( False ), @@ -5332,9 +5336,11 @@ logWarningEtThreshold_EE_FE = cms.double( 50.0 ) ) fragment.hltHcalDigis = cms.EDProducer( "HcalRawToDigi", + saveQIE10DataNSamples = cms.untracked.vint32( ), ExpectedOrbitMessageTime = cms.untracked.int32( -1 ), FilterDataQuality = cms.bool( True ), silent = cms.untracked.bool( True ), + saveQIE11DataNSamples = cms.untracked.vint32( ), HcalFirstFED = cms.untracked.int32( 700 ), InputLabel = cms.InputTag( "rawDataCollector" ), ComplainEmptyData = cms.untracked.bool( False ), @@ -5342,10 +5348,12 @@ UnpackCalib = cms.untracked.bool( True ), UnpackUMNio = cms.untracked.bool( True ), FEDs = cms.untracked.vint32( ), - UnpackerMode = cms.untracked.int32( 0 ), + saveQIE11DataTags = cms.untracked.vstring( ), UnpackTTP = cms.untracked.bool( False ), - lastSample = cms.int32( 9 ), UnpackZDC = cms.untracked.bool( True ), + saveQIE10DataTags = cms.untracked.vstring( ), + lastSample = cms.int32( 9 ), + UnpackerMode = cms.untracked.int32( 0 ), firstSample = cms.int32( 0 ) ) fragment.hltHbhePhase1Reco = cms.EDProducer( "HBHEPhase1Reconstructor", @@ -12084,11 +12092,13 @@ GsfTrackProducer = cms.InputTag( "hltEgammaGsfTracks" ) ) fragment.hltEgammaGsfTrackVars = cms.EDProducer( "EgammaHLTGsfTrackVarProducer", - recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidates" ), - beamSpotProducer = cms.InputTag( "hltOnlineBeamSpot" ), upperTrackNrToRemoveCut = cms.int32( 9999 ), + useDefaultValuesForEndcap = cms.bool( False ), lowerTrackNrToRemoveCut = cms.int32( -1 ), - inputCollection = cms.InputTag( "hltEgammaGsfTracks" ) + inputCollection = cms.InputTag( "hltEgammaGsfTracks" ), + recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidates" ), + beamSpotProducer = cms.InputTag( "hltOnlineBeamSpot" ), + useDefaultValuesForBarrel = cms.bool( False ) ) fragment.hltDiMu5Ele3CaloIdLTrackIdLElectronlegOneOEMinusOneOPFilter = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), @@ -31798,7 +31808,7 @@ L1MuonInputTag = cms.InputTag( 'hltGtStage2Digis','Muon' ), L1GlobalInputTag = cms.InputTag( "hltGtStage2Digis" ) ) -fragment.hltPreDoubleL2Mu50 = cms.EDFilter( "HLTPrescaler", +fragment.hltPreL2Mu23NoVtx2Cha = cms.EDFilter( "HLTPrescaler", L1GtReadoutRecordTag = cms.InputTag( "hltGtStage2Digis" ), offset = cms.uint32( 0 ) ) @@ -31812,26 +31822,54 @@ SelectQualities = cms.vint32( ), CandTag = cms.InputTag( 'hltGtStage2Digis','Muon' ) ) -fragment.hltL2fL1sMuORL1f0DoubleL2AllBxFiltered50Q = cms.EDFilter( "HLTMuonL2FromL1TPreFilter", +fragment.hltL2MuonCandidatesNoVtx = cms.EDProducer( "L2MuonCandidateProducer", + InputObjects = cms.InputTag( "hltL2Muons" ) +) +fragment.hltL2fL1sMuORL1f0L2NoVtx23Q2Cha = cms.EDFilter( "HLTMuonL2FromL1TPreFilter", saveTags = cms.bool( True ), MaxDr = cms.double( 9999.0 ), - CutOnChambers = cms.bool( False ), + CutOnChambers = cms.bool( True ), PreviousCandTag = cms.InputTag( "hltL1fL1sMuORL1Filtered0" ), - MinPt = cms.double( 50.0 ), - MinN = cms.int32( 2 ), - SeedMapTag = cms.InputTag( "hltL2MuonsAllBx" ), - MaxEta = cms.double( 2.5 ), - MinNhits = cms.vint32( 0, 1, 0, 1 ), + MinPt = cms.double( 23.0 ), + MinN = cms.int32( 1 ), + SeedMapTag = cms.InputTag( "hltL2Muons" ), + MaxEta = cms.double( 2.0 ), + MinNhits = cms.vint32( 0 ), MinDxySig = cms.double( -1.0 ), - MinNchambers = cms.vint32( 0 ), - AbsEtaBins = cms.vdouble( 0.9, 1.5, 2.1, 5.0 ), + MinNchambers = cms.vint32( 2 ), + AbsEtaBins = cms.vdouble( 5.0 ), MaxDz = cms.double( 9999.0 ), MatchToPreviousCand = cms.bool( False ), - CandTag = cms.InputTag( "hltL2MuonCandidatesAllBx" ), + CandTag = cms.InputTag( "hltL2MuonCandidatesNoVtx" ), BeamSpotTag = cms.InputTag( "hltOnlineBeamSpot" ), MinDr = cms.double( -1.0 ), NSigmaPt = cms.double( 0.0 ), - MinNstations = cms.vint32( 0, 2, 0, 2 ) + MinNstations = cms.vint32( 0 ) +) +fragment.hltPreL2Mu23NoVtx2ChaCosmicSeed = cms.EDFilter( "HLTPrescaler", + L1GtReadoutRecordTag = cms.InputTag( "hltGtStage2Digis" ), + offset = cms.uint32( 0 ) +) +fragment.hltL2fL1sMuORL1f0L2NoVtx23Q2ChaCosmicSeed = cms.EDFilter( "HLTMuonL2FromL1TPreFilter", + saveTags = cms.bool( True ), + MaxDr = cms.double( 9999.0 ), + CutOnChambers = cms.bool( True ), + PreviousCandTag = cms.InputTag( "hltL1fL1sMuORL1Filtered0" ), + MinPt = cms.double( 23.0 ), + MinN = cms.int32( 1 ), + SeedMapTag = cms.InputTag( "hltL2CosmicMuons" ), + MaxEta = cms.double( 2.0 ), + MinNhits = cms.vint32( 0 ), + MinDxySig = cms.double( -1.0 ), + MinNchambers = cms.vint32( 2 ), + AbsEtaBins = cms.vdouble( 5.0 ), + MaxDz = cms.double( 9999.0 ), + MatchToPreviousCand = cms.bool( False ), + CandTag = cms.InputTag( "hltL2MuonCandidatesNoVtxMeanTimerCosmicSeed" ), + BeamSpotTag = cms.InputTag( "hltOnlineBeamSpot" ), + MinDr = cms.double( -1.0 ), + NSigmaPt = cms.double( 0.0 ), + MinNstations = cms.vint32( 0 ) ) fragment.hltL1sDoubleMu125to157ORTripleMu444 = cms.EDFilter( "HLTL1TSeed", L1SeedsLogicalExpression = cms.string( "L1_DoubleMu_12_5 OR L1_DoubleMu_15_5_SQ OR L1_DoubleMu_15_7 OR L1_TripleMu_4_4_4" ), @@ -31844,7 +31882,7 @@ L1MuonInputTag = cms.InputTag( 'hltGtStage2Digis','Muon' ), L1GlobalInputTag = cms.InputTag( "hltGtStage2Digis" ) ) -fragment.hltPreDoubleL2Mu23NoVtx2ChaCosmicSeed = cms.EDFilter( "HLTPrescaler", +fragment.hltPreDoubleL2Mu30NoVtx2ChaCosmicSeedEta2p4 = cms.EDFilter( "HLTPrescaler", L1GtReadoutRecordTag = cms.InputTag( "hltGtStage2Digis" ), offset = cms.uint32( 0 ) ) @@ -31858,6 +31896,108 @@ SelectQualities = cms.vint32( ), CandTag = cms.InputTag( 'hltGtStage2Digis','Muon' ) ) +fragment.hltL2fL1sMuORL1f0DoubleL2NoVtx30Q2ChaCosmicSeedEta2p4 = cms.EDFilter( "HLTMuonL2FromL1TPreFilter", + saveTags = cms.bool( True ), + MaxDr = cms.double( 9999.0 ), + CutOnChambers = cms.bool( True ), + PreviousCandTag = cms.InputTag( "hltL1fL1sDoubleMu155ORTripleMu444L1Filtered0" ), + MinPt = cms.double( 30.0 ), + MinN = cms.int32( 2 ), + SeedMapTag = cms.InputTag( "hltL2CosmicMuons" ), + MaxEta = cms.double( 2.4 ), + MinNhits = cms.vint32( 0 ), + MinDxySig = cms.double( -1.0 ), + MinNchambers = cms.vint32( 2 ), + AbsEtaBins = cms.vdouble( 5.0 ), + MaxDz = cms.double( 9999.0 ), + MatchToPreviousCand = cms.bool( False ), + CandTag = cms.InputTag( "hltL2MuonCandidatesNoVtxMeanTimerCosmicSeed" ), + BeamSpotTag = cms.InputTag( "hltOnlineBeamSpot" ), + MinDr = cms.double( -1.0 ), + NSigmaPt = cms.double( 0.0 ), + MinNstations = cms.vint32( 0 ) +) +fragment.hltPreDoubleL2Mu30NoVtx2ChaEta2p4 = cms.EDFilter( "HLTPrescaler", + L1GtReadoutRecordTag = cms.InputTag( "hltGtStage2Digis" ), + offset = cms.uint32( 0 ) +) +fragment.hltL2fL1sMuORL1f0DoubleL2NoVtx30Q = cms.EDFilter( "HLTMuonL2FromL1TPreFilter", + saveTags = cms.bool( True ), + MaxDr = cms.double( 9999.0 ), + CutOnChambers = cms.bool( False ), + PreviousCandTag = cms.InputTag( "hltL1fL1sDoubleMu155ORTripleMu444L1Filtered0" ), + MinPt = cms.double( 30.0 ), + MinN = cms.int32( 2 ), + SeedMapTag = cms.InputTag( "hltL2Muons" ), + MaxEta = cms.double( 2.5 ), + MinNhits = cms.vint32( 0, 1, 0, 1 ), + MinDxySig = cms.double( -1.0 ), + MinNchambers = cms.vint32( 0 ), + AbsEtaBins = cms.vdouble( 0.9, 1.5, 2.1, 5.0 ), + MaxDz = cms.double( 9999.0 ), + MatchToPreviousCand = cms.bool( False ), + CandTag = cms.InputTag( "hltL2MuonCandidatesNoVtx" ), + BeamSpotTag = cms.InputTag( "hltOnlineBeamSpot" ), + MinDr = cms.double( -1.0 ), + NSigmaPt = cms.double( 0.0 ), + MinNstations = cms.vint32( 0, 2, 0, 2 ) +) +fragment.hltL2DoubleMu30NoVtxFiltered2ChaEta2p4 = cms.EDFilter( "HLTMuonDimuonL2FromL1TFilter", + saveTags = cms.bool( True ), + ChargeOpt = cms.int32( 0 ), + SeedMapTag = cms.InputTag( "hltL2Muons" ), + MinNchambers = cms.int32( 2 ), + FastAccept = cms.bool( False ), + CandTag = cms.InputTag( "hltL2MuonCandidatesNoVtx" ), + PreviousCandTag = cms.InputTag( "hltL1sDoubleMu125to157ORTripleMu444" ), + MinAngle = cms.double( -999.0 ), + MaxPtBalance = cms.double( 999999.0 ), + MaxAcop = cms.double( 3.15 ), + MinPtMin = cms.double( 30.0 ), + MaxInvMass = cms.double( 999999.0 ), + MinPtMax = cms.double( 30.0 ), + BeamSpotTag = cms.InputTag( "hltOnlineBeamSpot" ), + MaxAngle = cms.double( 9999.0 ), + MaxDz = cms.double( 9999.0 ), + MinPtPair = cms.double( 0.0 ), + MaxDr = cms.double( 100.0 ), + MinAcop = cms.double( -1.0 ), + MinNstations = cms.int32( 0 ), + MinNhits = cms.int32( 0 ), + NSigmaPt = cms.double( 0.0 ), + MinPtBalance = cms.double( -1.0 ), + MaxEta = cms.double( 2.4 ), + MinInvMass = cms.double( -999999.0 ) +) +fragment.hltPreDoubleL2Mu50 = cms.EDFilter( "HLTPrescaler", + L1GtReadoutRecordTag = cms.InputTag( "hltGtStage2Digis" ), + offset = cms.uint32( 0 ) +) +fragment.hltL2fL1sMuORL1f0DoubleL2AllBxFiltered50Q = cms.EDFilter( "HLTMuonL2FromL1TPreFilter", + saveTags = cms.bool( True ), + MaxDr = cms.double( 9999.0 ), + CutOnChambers = cms.bool( False ), + PreviousCandTag = cms.InputTag( "hltL1fL1sMuORL1Filtered0" ), + MinPt = cms.double( 50.0 ), + MinN = cms.int32( 2 ), + SeedMapTag = cms.InputTag( "hltL2MuonsAllBx" ), + MaxEta = cms.double( 2.5 ), + MinNhits = cms.vint32( 0, 1, 0, 1 ), + MinDxySig = cms.double( -1.0 ), + MinNchambers = cms.vint32( 0 ), + AbsEtaBins = cms.vdouble( 0.9, 1.5, 2.1, 5.0 ), + MaxDz = cms.double( 9999.0 ), + MatchToPreviousCand = cms.bool( False ), + CandTag = cms.InputTag( "hltL2MuonCandidatesAllBx" ), + BeamSpotTag = cms.InputTag( "hltOnlineBeamSpot" ), + MinDr = cms.double( -1.0 ), + NSigmaPt = cms.double( 0.0 ), + MinNstations = cms.vint32( 0, 2, 0, 2 ) +) +fragment.hltPreDoubleL2Mu23NoVtx2ChaCosmicSeed = cms.EDFilter( "HLTPrescaler", + L1GtReadoutRecordTag = cms.InputTag( "hltGtStage2Digis" ), + offset = cms.uint32( 0 ) +) fragment.hltL2fL1sMuORL1f0DoubleL2NoVtx23Q2ChaCosmicSeed = cms.EDFilter( "HLTMuonL2FromL1TPreFilter", saveTags = cms.bool( True ), MaxDr = cms.double( 9999.0 ), @@ -31933,9 +32073,6 @@ L1GtReadoutRecordTag = cms.InputTag( "hltGtStage2Digis" ), offset = cms.uint32( 0 ) ) -fragment.hltL2MuonCandidatesNoVtx = cms.EDProducer( "L2MuonCandidateProducer", - InputObjects = cms.InputTag( "hltL2Muons" ) -) fragment.hltL2pfL1sDoubleMu155ORTripleMu444L1f0L2PreFiltered0NoVtx = cms.EDFilter( "HLTMuonL2FromL1TPreFilter", saveTags = cms.bool( True ), MaxDr = cms.double( 9999.0 ), @@ -37305,6 +37442,7 @@ lMinHighEHitTime = cms.double( -9999.0 ), fillLaserMonitor = cms.bool( True ), tMinHPDHits = cms.int32( 16 ), + tRBXRecHitR45Cuts = cms.vdouble( 0.0, 1.0, 0.0, -0.2, 0.0, 0.0, 1.0, -0.2 ), minRecHitE = cms.double( 1.5 ), pMaxHighEHitTime = cms.double( 5.0 ), lRBXRecHitR45Cuts = cms.vdouble( 0.0, 1.0, 0.0, -0.5, 0.0, 0.0, 1.0, -0.5 ), @@ -37318,12 +37456,13 @@ maxNHF = cms.double( 0.9 ), minHighHitE = cms.double( 25.0 ), minR45HitE = cms.double( 5.0 ), - tRBXRecHitR45Cuts = cms.vdouble( 0.0, 1.0, 0.0, -0.2, 0.0, 0.0, 1.0, -0.2 ), + lasermonDigis = cms.InputTag( 'hltHcalDigis','LASERMON' ), lMinZeros = cms.int32( 10 ), lMinRBXHits = cms.int32( 999 ), fillRecHits = cms.bool( True ), minERatio = cms.double( 50.0 ), TS4TS5LowerThreshold = cms.vdouble( 100.0, 120.0, 150.0, 200.0, 300.0, 400.0, 500.0 ), + hlMaxRBXEMF = cms.double( 0.01 ), lMinHPDNoOtherHits = cms.int32( 10 ), pMinRBXRechitR45EnergyFraction = cms.double( 0.1 ), hlMaxHPDEMF = cms.double( -9999.0 ), @@ -37333,7 +37472,6 @@ laserMonIEtaList = cms.vint32( 0, 0, 0, 0, 0, 0, 0, 0 ), laserMonIPhiList = cms.vint32( 23, 17, 11, 5, 29, 35, 41, 47 ), pMinRatio = cms.double( 0.75 ), - tMinLowEHitTime = cms.double( -9999.0 ), HcalAcceptSeverityLevel = cms.uint32( 9 ), pMaxRBXEMF = cms.double( 0.02 ), tMaxRatio = cms.double( 0.92 ), @@ -37366,7 +37504,7 @@ tMinHPDNoOtherHits = cms.int32( 9 ), pMaxHPDEMF = cms.double( 0.02 ), jetCollName = cms.string( "" ), - hlMaxRBXEMF = cms.double( 0.01 ), + tMinLowEHitTime = cms.double( -9999.0 ), tMaxHighEHitTime = cms.double( 6.0 ), pMaxLowEHitTime = cms.double( 6.0 ), lMinHPDHits = cms.int32( 17 ), @@ -53386,6 +53524,7 @@ MinPt = cms.double( 110.0 ) ) fragment.hltL1TPFJetsMatching = cms.EDProducer( "L1TPFJetsMatching", + pt3Min = cms.double( 110.0 ), matchingR = cms.double( 0.5 ), pt2Min = cms.double( 35.0 ), mjjMin = cms.double( 650.0 ), @@ -54980,6 +55119,7 @@ MinPt = cms.double( 20.0 ) ) fragment.hltVBFL1TLooseIDPFJetsMatching = cms.EDProducer( "L1TPFJetsMatching", + pt3Min = cms.double( 110.0 ), matchingR = cms.double( 0.5 ), pt2Min = cms.double( 40.0 ), mjjMin = cms.double( 650.0 ), @@ -64022,13 +64162,13 @@ minimumTransverseMomentum = cms.double( 1.0 ), primaryVertex = cms.InputTag( "hltVerticesPFFilter" ), maximumLongitudinalImpactParameter = cms.double( 17.0 ), - computeGhostTrack = cms.bool( True ), + jets = cms.InputTag( "hltPFJetForBtag" ), maxDeltaR = cms.double( 0.4 ), candidates = cms.InputTag( "hltParticleFlow" ), jetDirectionUsingGhostTrack = cms.bool( False ), minimumNumberOfPixelHits = cms.int32( 2 ), jetDirectionUsingTracks = cms.bool( False ), - jets = cms.InputTag( "hltPFJetForBtag" ), + computeGhostTrack = cms.bool( True ), useTrackQuality = cms.bool( False ), ghostTrackPriorDeltaR = cms.double( 0.03 ), maximumChiSquared = cms.double( 5.0 ), @@ -69986,20 +70126,27 @@ filterTrackEnergy = cms.bool( True ) ) fragment.hltIsolEcalPixelTrackProdHB = cms.EDProducer( "IsolatedEcalPixelTrackCandidateProducer", - ECHitEnergyThreshold = cms.double( 0.05 ), - filterLabel = cms.InputTag( "hltIsolPixelTrackL2FilterHB" ), + EEHitEnergyThreshold3 = cms.double( 3.52151 ), + EEHitEnergyThreshold2 = cms.double( -19.0741 ), + EEHitEnergyThreshold1 = cms.double( 34.3975 ), + EEHitEnergyThreshold0 = cms.double( -20.5332 ), + EBHitCountEnergyThreshold = cms.double( 0.5 ), + EBHitEnergyThreshold = cms.double( 0.1 ), EBRecHitSource = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEB' ), - ECHitCountEnergyThreshold = cms.double( 0.5 ), + filterLabel = cms.InputTag( "hltIsolPixelTrackL2FilterHB" ), + EcalConeSizeEta1 = cms.double( 0.14 ), EcalConeSizeEta0 = cms.double( 0.09 ), EERecHitSource = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEE' ), - EcalConeSizeEta1 = cms.double( 0.14 ) + EEFacHitCountEnergyThreshold = cms.double( 10.0 ) ) fragment.hltEcalIsolPixelTrackL2FilterHB = cms.EDFilter( "HLTEcalPixelIsolTrackFilter", saveTags = cms.bool( True ), DropMultiL2Event = cms.bool( False ), - MaxEnergyIn = cms.double( 1.2 ), - MaxEnergyOut = cms.double( 1.2 ), + MaxEnergyInEB = cms.double( 2.0 ), + MaxEnergyInEE = cms.double( 2.0 ), + MaxEnergyOutEB = cms.double( 1.2 ), NMaxTrackCandidates = cms.int32( 10 ), + MaxEnergyOutEE = cms.double( 1.2 ), candTag = cms.InputTag( "hltIsolEcalPixelTrackProdHB" ) ) fragment.hltHcalITIPTCorrectorHB = cms.EDProducer( "IPTCorrector", @@ -70056,20 +70203,27 @@ filterTrackEnergy = cms.bool( True ) ) fragment.hltIsolEcalPixelTrackProdHE = cms.EDProducer( "IsolatedEcalPixelTrackCandidateProducer", - ECHitEnergyThreshold = cms.double( 0.05 ), - filterLabel = cms.InputTag( "hltIsolPixelTrackL2FilterHE" ), + EEHitEnergyThreshold3 = cms.double( 3.52151 ), + EEHitEnergyThreshold2 = cms.double( -19.0741 ), + EEHitEnergyThreshold1 = cms.double( 34.3975 ), + EEHitEnergyThreshold0 = cms.double( -20.5332 ), + EBHitCountEnergyThreshold = cms.double( 0.5 ), + EBHitEnergyThreshold = cms.double( 0.1 ), EBRecHitSource = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEB' ), - ECHitCountEnergyThreshold = cms.double( 0.5 ), + filterLabel = cms.InputTag( "hltIsolPixelTrackL2FilterHE" ), + EcalConeSizeEta1 = cms.double( 0.14 ), EcalConeSizeEta0 = cms.double( 0.09 ), EERecHitSource = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEE' ), - EcalConeSizeEta1 = cms.double( 0.14 ) + EEFacHitCountEnergyThreshold = cms.double( 10.0 ) ) fragment.hltEcalIsolPixelTrackL2FilterHE = cms.EDFilter( "HLTEcalPixelIsolTrackFilter", saveTags = cms.bool( True ), DropMultiL2Event = cms.bool( False ), - MaxEnergyIn = cms.double( 1.2 ), - MaxEnergyOut = cms.double( 1.2 ), + MaxEnergyInEB = cms.double( 2.0 ), + MaxEnergyInEE = cms.double( 2.0 ), + MaxEnergyOutEB = cms.double( 1.2 ), NMaxTrackCandidates = cms.int32( 10 ), + MaxEnergyOutEE = cms.double( 1.2 ), candTag = cms.InputTag( "hltIsolEcalPixelTrackProdHE" ) ) fragment.hltHcalITIPTCorrectorHE = cms.EDProducer( "IPTCorrector", @@ -82952,13 +83106,13 @@ minimumTransverseMomentum = cms.double( 1.0 ), primaryVertex = cms.InputTag( "hltVerticesPFFilter" ), maximumLongitudinalImpactParameter = cms.double( 17.0 ), - computeGhostTrack = cms.bool( True ), + jets = cms.InputTag( "hltPFJetForDBtagAK8" ), maxDeltaR = cms.double( 0.4 ), candidates = cms.InputTag( "hltParticleFlow" ), jetDirectionUsingGhostTrack = cms.bool( False ), minimumNumberOfPixelHits = cms.int32( 2 ), jetDirectionUsingTracks = cms.bool( False ), - jets = cms.InputTag( "hltPFJetForDBtagAK8" ), + computeGhostTrack = cms.bool( True ), useTrackQuality = cms.bool( False ), ghostTrackPriorDeltaR = cms.double( 0.03 ), maximumChiSquared = cms.double( 5.0 ), @@ -84215,6 +84369,10 @@ fragment.HLT_L2Mu10_v7 = cms.Path( fragment.HLTBeginSequence + fragment.hltL1sSingleMu22or25 + fragment.hltPreL2Mu10 + fragment.hltL1fL1sMu22or25L1Filtered0 + fragment.HLTL2muonrecoSequence + fragment.hltL2fL1sMu22or25L1f0L2FilteredQ + fragment.HLTEndSequence ) fragment.HLT_L2Mu10_NoVertex_NoBPTX_v6 = cms.Path( fragment.HLTBeginSequence + fragment.hltL1sSingleMuOpenNotBptxOR + fragment.hltPreL2Mu10NoVertexNoBPTX + fragment.hltL1fL1sMuOpenNotBptxORL1Filtered0 + fragment.HLTL2muonrecoSequenceNoVtxCosmicSeedMeanTimer + fragment.hltL2fL1sMuOpenNotBptxORL1f0NoVtxCosmicSeedMeanTimerL2Filtered10 + fragment.HLTEndSequence ) fragment.HLT_L2Mu50_v2 = cms.Path( fragment.HLTBeginSequence + fragment.hltL1sSingleMu22or25 + fragment.hltPreL2Mu50 + fragment.hltL1fL1sMu22or25L1Filtered0 + fragment.HLTL2muonrecoSequenceAllBx + fragment.hltL2fL1sMu22or25L1f0L2AllBxFiltered50Q + fragment.HLTEndSequence ) +fragment.HLT_L2Mu23NoVtx_2Cha_v1 = cms.Path( fragment.HLTBeginSequence + fragment.hltL1sSingleMuOR + fragment.hltPreL2Mu23NoVtx2Cha + fragment.hltL1fL1sMuORL1Filtered0 + fragment.HLTL2muonrecoSequenceNoVtx + fragment.hltL2fL1sMuORL1f0L2NoVtx23Q2Cha + fragment.HLTEndSequence ) +fragment.HLT_L2Mu23NoVtx_2Cha_CosmicSeed_v1 = cms.Path( fragment.HLTBeginSequence + fragment.hltL1sSingleMuOR + fragment.hltPreL2Mu23NoVtx2ChaCosmicSeed + fragment.hltL1fL1sMuORL1Filtered0 + fragment.HLTL2muonrecoSequenceNoVtxCosmicSeedMeanTimer + fragment.hltL2fL1sMuORL1f0L2NoVtx23Q2ChaCosmicSeed + fragment.HLTEndSequence ) +fragment.HLT_DoubleL2Mu30NoVtx_2Cha_CosmicSeed_Eta2p4_v1 = cms.Path( fragment.HLTBeginSequence + fragment.hltL1sDoubleMu125to157ORTripleMu444 + fragment.hltPreDoubleL2Mu30NoVtx2ChaCosmicSeedEta2p4 + fragment.hltL1fL1sDoubleMu155ORTripleMu444L1Filtered0 + fragment.HLTL2muonrecoSequenceNoVtxCosmicSeedMeanTimer + fragment.hltL2fL1sMuORL1f0DoubleL2NoVtx30Q2ChaCosmicSeedEta2p4 + fragment.HLTEndSequence ) +fragment.HLT_DoubleL2Mu30NoVtx_2Cha_Eta2p4_v1 = cms.Path( fragment.HLTBeginSequence + fragment.hltL1sDoubleMu125to157ORTripleMu444 + fragment.hltPreDoubleL2Mu30NoVtx2ChaEta2p4 + fragment.hltL1fL1sDoubleMu155ORTripleMu444L1Filtered0 + fragment.HLTL2muonrecoSequenceNoVtx + fragment.hltL2fL1sMuORL1f0DoubleL2NoVtx30Q + fragment.hltL2DoubleMu30NoVtxFiltered2ChaEta2p4 + fragment.HLTEndSequence ) fragment.HLT_DoubleL2Mu50_v2 = cms.Path( fragment.HLTBeginSequence + fragment.hltL1sSingleMuOR + fragment.hltPreDoubleL2Mu50 + fragment.hltL1fL1sMuORL1Filtered0 + fragment.HLTL2muonrecoSequenceAllBx + fragment.hltL2fL1sMuORL1f0DoubleL2AllBxFiltered50Q + fragment.HLTEndSequence ) fragment.HLT_DoubleL2Mu23NoVtx_2Cha_CosmicSeed_v1 = cms.Path( fragment.HLTBeginSequence + fragment.hltL1sDoubleMu125to157ORTripleMu444 + fragment.hltPreDoubleL2Mu23NoVtx2ChaCosmicSeed + fragment.hltL1fL1sDoubleMu155ORTripleMu444L1Filtered0 + fragment.HLTL2muonrecoSequenceNoVtxCosmicSeedMeanTimer + fragment.hltL2fL1sMuORL1f0DoubleL2NoVtx23Q2ChaCosmicSeed + fragment.HLTEndSequence ) fragment.HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_v1 = cms.Path( fragment.HLTBeginSequence + fragment.hltL1sDoubleMu125to157ORTripleMu444 + fragment.hltPreDoubleL2Mu25NoVtx2ChaCosmicSeed + fragment.hltL1fL1sDoubleMu155ORTripleMu444L1Filtered0 + fragment.HLTL2muonrecoSequenceNoVtxCosmicSeedMeanTimer + fragment.hltL2fL1sMuORL1f0DoubleL2NoVtx25Q2ChaCosmicSeed + fragment.HLTEndSequence ) @@ -84766,7 +84924,7 @@ fragment.ScoutingCaloMuonOutput = cms.Path( fragment.hltGtStage2Digis + fragment.hltPreScoutingCaloMuonOutput + fragment.hltFEDSelectorL1 + fragment.hltScoutingCaloPacker + fragment.hltScoutingMuonPackerCalo + fragment.hltScoutingPrimaryVertexPacker + fragment.hltScoutingPrimaryVertexPackerCaloMuon ) -fragment.HLTSchedule = cms.Schedule( *(fragment.HLTriggerFirstPath, fragment.HLT_AK8PFJet360_TrimMass30_v16, fragment.HLT_AK8PFJet380_TrimMass30_v9, fragment.HLT_AK8PFJet400_TrimMass30_v10, fragment.HLT_AK8PFJet420_TrimMass30_v9, fragment.HLT_AK8PFHT750_TrimMass50_v10, fragment.HLT_AK8PFHT800_TrimMass50_v10, fragment.HLT_AK8PFHT850_TrimMass50_v9, fragment.HLT_AK8PFHT900_TrimMass50_v9, fragment.HLT_CaloJet500_NoJetID_v11, fragment.HLT_CaloJet550_NoJetID_v6, fragment.HLT_DoubleMu5_Upsilon_DoubleEle3_CaloIdL_TrackIdL_v2, fragment.HLT_DoubleMu3_DoubleEle7p5_CaloIdL_TrackIdL_Upsilon_v2, fragment.HLT_Trimuon5_3p5_2_Upsilon_Muon_v4, fragment.HLT_TrimuonOpen_5_3p5_2_Upsilon_Muon_v2, fragment.HLT_DoubleEle25_CaloIdL_MW_v2, fragment.HLT_DoubleEle27_CaloIdL_MW_v2, fragment.HLT_DoubleEle33_CaloIdL_MW_v15, fragment.HLT_DoubleEle24_eta2p1_WPTight_Gsf_v5, fragment.HLT_DoubleEle8_CaloIdM_TrackIdM_Mass8_DZ_PFHT350_v18, fragment.HLT_DoubleEle8_CaloIdM_TrackIdM_Mass8_PFHT350_v18, fragment.HLT_Ele27_Ele37_CaloIdL_MW_v2, fragment.HLT_Mu27_Ele37_CaloIdL_MW_v3, fragment.HLT_Mu37_Ele27_CaloIdL_MW_v3, fragment.HLT_Mu37_TkMu27_v3, fragment.HLT_DoubleMu4_3_Bs_v13, fragment.HLT_DoubleMu4_3_Jpsi_v1, fragment.HLT_DoubleMu4_JpsiTrk_Displaced_v14, fragment.HLT_DoubleMu4_LowMassNonResonantTrk_Displaced_v14, fragment.HLT_DoubleMu3_Trk_Tau3mu_v11, fragment.HLT_DoubleMu3_TkMu_DsTau3Mu_v2, fragment.HLT_DoubleMu4_PsiPrimeTrk_Displaced_v14, fragment.HLT_DoubleMu4_Mass8_DZ_PFHT350_v7, fragment.HLT_DoubleMu8_Mass8_PFHT350_v7, fragment.HLT_Mu3_PFJet40_v14, fragment.HLT_Mu7p5_L2Mu2_Jpsi_v9, fragment.HLT_Mu7p5_L2Mu2_Upsilon_v9, fragment.HLT_Mu7p5_Track2_Jpsi_v10, fragment.HLT_Mu7p5_Track3p5_Jpsi_v10, fragment.HLT_Mu7p5_Track7_Jpsi_v10, fragment.HLT_Mu7p5_Track2_Upsilon_v10, fragment.HLT_Mu7p5_Track3p5_Upsilon_v10, fragment.HLT_Mu7p5_Track7_Upsilon_v10, fragment.HLT_DoublePhoton33_CaloIdL_v5, fragment.HLT_DoublePhoton70_v5, fragment.HLT_DoublePhoton85_v13, fragment.HLT_Ele20_WPTight_Gsf_v4, fragment.HLT_Ele15_WPLoose_Gsf_v1, fragment.HLT_Ele17_WPLoose_Gsf_v1, fragment.HLT_Ele20_WPLoose_Gsf_v4, fragment.HLT_Ele20_eta2p1_WPLoose_Gsf_v4, fragment.HLT_DiEle27_WPTightCaloOnly_L1DoubleEG_v3, fragment.HLT_Ele27_WPTight_Gsf_v14, fragment.HLT_Ele32_WPTight_Gsf_v13, fragment.HLT_Ele35_WPTight_Gsf_v7, fragment.HLT_Ele35_WPTight_Gsf_L1EGMT_v3, fragment.HLT_Ele38_WPTight_Gsf_v7, fragment.HLT_Ele40_WPTight_Gsf_v7, fragment.HLT_Ele32_WPTight_Gsf_L1DoubleEG_v7, fragment.HLT_HT450_Beamspot_v9, fragment.HLT_HT300_Beamspot_v9, fragment.HLT_ZeroBias_Beamspot_v2, fragment.HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_CrossL1_v10, fragment.HLT_IsoMu20_eta2p1_MediumChargedIsoPFTau27_eta2p1_CrossL1_v10, fragment.HLT_IsoMu20_eta2p1_TightChargedIsoPFTau27_eta2p1_CrossL1_v10, fragment.HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10, fragment.HLT_IsoMu20_eta2p1_MediumChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10, fragment.HLT_IsoMu20_eta2p1_TightChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10, fragment.HLT_IsoMu20_v13, fragment.HLT_IsoMu24_v11, fragment.HLT_IsoMu24_eta2p1_v13, fragment.HLT_IsoMu27_v14, fragment.HLT_IsoMu30_v2, fragment.HLT_UncorrectedJetE30_NoBPTX_v5, fragment.HLT_UncorrectedJetE30_NoBPTX3BX_v5, fragment.HLT_UncorrectedJetE60_NoBPTX3BX_v5, fragment.HLT_UncorrectedJetE70_NoBPTX3BX_v5, fragment.HLT_L1SingleMu18_v3, fragment.HLT_L1SingleMu25_v2, fragment.HLT_L2Mu10_v7, fragment.HLT_L2Mu10_NoVertex_NoBPTX_v6, fragment.HLT_L2Mu50_v2, fragment.HLT_DoubleL2Mu50_v2, fragment.HLT_DoubleL2Mu23NoVtx_2Cha_CosmicSeed_v1, fragment.HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_v1, fragment.HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_Eta2p4_v1, fragment.HLT_DoubleL2Mu23NoVtx_2Cha_v1, fragment.HLT_DoubleL2Mu25NoVtx_2Cha_v1, fragment.HLT_DoubleL2Mu25NoVtx_2Cha_Eta2p4_v1, fragment.HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_v13, fragment.HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_v2, fragment.HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_v14, fragment.HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_v2, fragment.HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_Mass8_v4, fragment.HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_Mass8_v2, fragment.HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_Mass3p8_v4, fragment.HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_Mass3p8_v2, fragment.HLT_Mu25_TkMu0_Onia_v6, fragment.HLT_Mu30_TkMu0_Onia_v6, fragment.HLT_Mu20_TkMu0_Phi_v6, fragment.HLT_Mu25_TkMu0_Phi_v6, fragment.HLT_Mu12_v1, fragment.HLT_Mu15_v1, fragment.HLT_Mu20_v11, fragment.HLT_Mu27_v12, fragment.HLT_Mu50_v12, fragment.HLT_Mu55_v2, fragment.HLT_OldMu100_v3, fragment.HLT_TkMu100_v2, fragment.HLT_DiPFJet15_NoCaloMatched_v14, fragment.HLT_DiPFJet25_NoCaloMatched_v14, fragment.HLT_DiPFJet15_FBEta3_NoCaloMatched_v15, fragment.HLT_DiPFJet25_FBEta3_NoCaloMatched_v15, fragment.HLT_DiPFJetAve40_v12, fragment.HLT_DiPFJetAve60_v12, fragment.HLT_DiPFJetAve80_v11, fragment.HLT_DiPFJetAve140_v11, fragment.HLT_DiPFJetAve200_v11, fragment.HLT_DiPFJetAve260_v12, fragment.HLT_DiPFJetAve320_v12, fragment.HLT_DiPFJetAve400_v12, fragment.HLT_DiPFJetAve500_v12, fragment.HLT_DiPFJetAve15_HFJEC_v15, fragment.HLT_DiPFJetAve25_HFJEC_v15, fragment.HLT_DiPFJetAve35_HFJEC_v15, fragment.HLT_DiPFJetAve60_HFJEC_v13, fragment.HLT_DiPFJetAve80_HFJEC_v13, fragment.HLT_DiPFJetAve100_HFJEC_v13, fragment.HLT_DiPFJetAve160_HFJEC_v13, fragment.HLT_DiPFJetAve220_HFJEC_v14, fragment.HLT_DiPFJetAve300_HFJEC_v14, fragment.HLT_AK8PFJet15_v1, fragment.HLT_AK8PFJet25_v1, fragment.HLT_AK8PFJet40_v14, fragment.HLT_AK8PFJet60_v13, fragment.HLT_AK8PFJet80_v13, fragment.HLT_AK8PFJet140_v13, fragment.HLT_AK8PFJet200_v13, fragment.HLT_AK8PFJet260_v14, fragment.HLT_AK8PFJet320_v14, fragment.HLT_AK8PFJet400_v14, fragment.HLT_AK8PFJet450_v14, fragment.HLT_AK8PFJet500_v14, fragment.HLT_AK8PFJet550_v9, fragment.HLT_PFJet15_v1, fragment.HLT_PFJet25_v1, fragment.HLT_PFJet40_v19, fragment.HLT_PFJet60_v19, fragment.HLT_PFJet80_v18, fragment.HLT_PFJet140_v17, fragment.HLT_PFJet200_v17, fragment.HLT_PFJet260_v18, fragment.HLT_PFJet320_v18, fragment.HLT_PFJet400_v18, fragment.HLT_PFJet450_v19, fragment.HLT_PFJet500_v19, fragment.HLT_PFJet550_v9, fragment.HLT_PFJetFwd15_v1, fragment.HLT_PFJetFwd25_v1, fragment.HLT_PFJetFwd40_v17, fragment.HLT_PFJetFwd60_v17, fragment.HLT_PFJetFwd80_v16, fragment.HLT_PFJetFwd140_v16, fragment.HLT_PFJetFwd200_v16, fragment.HLT_PFJetFwd260_v17, fragment.HLT_PFJetFwd320_v17, fragment.HLT_PFJetFwd400_v17, fragment.HLT_PFJetFwd450_v17, fragment.HLT_PFJetFwd500_v17, fragment.HLT_AK8PFJetFwd15_v1, fragment.HLT_AK8PFJetFwd25_v1, fragment.HLT_AK8PFJetFwd40_v13, fragment.HLT_AK8PFJetFwd60_v12, fragment.HLT_AK8PFJetFwd80_v12, fragment.HLT_AK8PFJetFwd140_v12, fragment.HLT_AK8PFJetFwd200_v12, fragment.HLT_AK8PFJetFwd260_v13, fragment.HLT_AK8PFJetFwd320_v13, fragment.HLT_AK8PFJetFwd400_v13, fragment.HLT_AK8PFJetFwd450_v13, fragment.HLT_AK8PFJetFwd500_v13, fragment.HLT_PFHT180_v15, fragment.HLT_PFHT250_v15, fragment.HLT_PFHT370_v15, fragment.HLT_PFHT430_v15, fragment.HLT_PFHT510_v15, fragment.HLT_PFHT590_v15, fragment.HLT_PFHT680_v15, fragment.HLT_PFHT780_v15, fragment.HLT_PFHT890_v15, fragment.HLT_PFHT1050_v16, fragment.HLT_PFHT500_PFMET100_PFMHT100_IDTight_v10, fragment.HLT_PFHT500_PFMET110_PFMHT110_IDTight_v10, fragment.HLT_PFHT700_PFMET85_PFMHT85_IDTight_v10, fragment.HLT_PFHT700_PFMET95_PFMHT95_IDTight_v10, fragment.HLT_PFHT800_PFMET75_PFMHT75_IDTight_v10, fragment.HLT_PFHT800_PFMET85_PFMHT85_IDTight_v10, fragment.HLT_PFMET110_PFMHT110_IDTight_v18, fragment.HLT_PFMET120_PFMHT120_IDTight_v18, fragment.HLT_PFMET130_PFMHT130_IDTight_v18, fragment.HLT_PFMET140_PFMHT140_IDTight_v18, fragment.HLT_PFMET100_PFMHT100_IDTight_CaloBTagCSV_3p1_v7, fragment.HLT_PFMET110_PFMHT110_IDTight_CaloBTagCSV_3p1_v7, fragment.HLT_PFMET120_PFMHT120_IDTight_CaloBTagCSV_3p1_v7, fragment.HLT_PFMET130_PFMHT130_IDTight_CaloBTagCSV_3p1_v7, fragment.HLT_PFMET140_PFMHT140_IDTight_CaloBTagCSV_3p1_v7, fragment.HLT_PFMET120_PFMHT120_IDTight_PFHT60_v7, fragment.HLT_PFMETNoMu120_PFMHTNoMu120_IDTight_PFHT60_v7, fragment.HLT_PFMETTypeOne120_PFMHT120_IDTight_PFHT60_v7, fragment.HLT_PFMETTypeOne110_PFMHT110_IDTight_v10, fragment.HLT_PFMETTypeOne120_PFMHT120_IDTight_v10, fragment.HLT_PFMETTypeOne130_PFMHT130_IDTight_v10, fragment.HLT_PFMETTypeOne140_PFMHT140_IDTight_v9, fragment.HLT_PFMETNoMu110_PFMHTNoMu110_IDTight_v18, fragment.HLT_PFMETNoMu120_PFMHTNoMu120_IDTight_v18, fragment.HLT_PFMETNoMu130_PFMHTNoMu130_IDTight_v17, fragment.HLT_PFMETNoMu140_PFMHTNoMu140_IDTight_v17, fragment.HLT_MonoCentralPFJet80_PFMETNoMu110_PFMHTNoMu110_IDTight_v18, fragment.HLT_MonoCentralPFJet80_PFMETNoMu120_PFMHTNoMu120_IDTight_v18, fragment.HLT_MonoCentralPFJet80_PFMETNoMu130_PFMHTNoMu130_IDTight_v17, fragment.HLT_MonoCentralPFJet80_PFMETNoMu140_PFMHTNoMu140_IDTight_v17, fragment.HLT_L1ETMHadSeeds_v1, fragment.HLT_CaloMHT90_v3, fragment.HLT_CaloMET80_NotCleaned_v3, fragment.HLT_CaloMET90_NotCleaned_v3, fragment.HLT_CaloMET100_NotCleaned_v3, fragment.HLT_CaloMET110_NotCleaned_v3, fragment.HLT_CaloMET250_NotCleaned_v3, fragment.HLT_CaloMET70_HBHECleaned_v3, fragment.HLT_CaloMET80_HBHECleaned_v3, fragment.HLT_CaloMET90_HBHECleaned_v3, fragment.HLT_CaloMET100_HBHECleaned_v3, fragment.HLT_CaloMET250_HBHECleaned_v3, fragment.HLT_CaloMET300_HBHECleaned_v3, fragment.HLT_CaloMET350_HBHECleaned_v3, fragment.HLT_PFMET200_NotCleaned_v7, fragment.HLT_PFMET200_HBHECleaned_v7, fragment.HLT_PFMET250_HBHECleaned_v7, fragment.HLT_PFMET300_HBHECleaned_v7, fragment.HLT_PFMET200_HBHE_BeamHaloCleaned_v7, fragment.HLT_PFMETTypeOne200_HBHE_BeamHaloCleaned_v7, fragment.HLT_MET105_IsoTrk50_v8, fragment.HLT_MET120_IsoTrk50_v8, fragment.HLT_SingleJet30_Mu12_SinglePFJet40_v9, fragment.HLT_Mu12_DoublePFJets40_CaloBTagCSV_p79_v1, fragment.HLT_Mu12_DoublePFJets100_CaloBTagCSV_p79_v1, fragment.HLT_Mu12_DoublePFJets200_CaloBTagCSV_p79_v1, fragment.HLT_Mu12_DoublePFJets350_CaloBTagCSV_p79_v1, fragment.HLT_Mu12_DoublePFJets40MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, fragment.HLT_Mu12_DoublePFJets54MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, fragment.HLT_Mu12_DoublePFJets62MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, fragment.HLT_DoublePFJets40_CaloBTagCSV_p79_v1, fragment.HLT_DoublePFJets100_CaloBTagCSV_p79_v1, fragment.HLT_DoublePFJets200_CaloBTagCSV_p79_v1, fragment.HLT_DoublePFJets350_CaloBTagCSV_p79_v1, fragment.HLT_DoublePFJets116MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, fragment.HLT_DoublePFJets128MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, fragment.HLT_Photon300_NoHE_v11, fragment.HLT_Mu8_TrkIsoVVL_v11, fragment.HLT_Mu8_DiEle12_CaloIdL_TrackIdL_DZ_v16, fragment.HLT_Mu8_DiEle12_CaloIdL_TrackIdL_v16, fragment.HLT_Mu8_Ele8_CaloIdM_TrackIdM_Mass8_PFHT350_DZ_v17, fragment.HLT_Mu8_Ele8_CaloIdM_TrackIdM_Mass8_PFHT350_v17, fragment.HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_v11, fragment.HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_v9, fragment.HLT_Mu17_TrkIsoVVL_v11, fragment.HLT_Mu19_TrkIsoVVL_v2, fragment.HLT_BTagMu_AK4DiJet20_Mu5_v11, fragment.HLT_BTagMu_AK4DiJet40_Mu5_v11, fragment.HLT_BTagMu_AK4DiJet70_Mu5_v11, fragment.HLT_BTagMu_AK4DiJet110_Mu5_v11, fragment.HLT_BTagMu_AK4DiJet170_Mu5_v10, fragment.HLT_BTagMu_AK4Jet300_Mu5_v11, fragment.HLT_BTagMu_AK8DiJet170_Mu5_v7, fragment.HLT_BTagMu_AK8Jet300_Mu5_v11, fragment.HLT_Ele15_Ele8_CaloIdL_TrackIdL_IsoVL_v1, fragment.HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_v17, fragment.HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_v17, fragment.HLT_Mu23_TrkIsoVVL_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_v13, fragment.HLT_Mu23_TrkIsoVVL_Ele12_CaloIdL_TrackIdL_IsoVL_v5, fragment.HLT_Mu12_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_v5, fragment.HLT_Mu12_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_v13, fragment.HLT_Mu12_DoublePhoton20_v3, fragment.HLT_TriplePhoton_20_20_20_CaloIdLV2_v2, fragment.HLT_TriplePhoton_20_20_20_CaloIdLV2_R9IdVL_v2, fragment.HLT_TriplePhoton_30_30_10_CaloIdLV2_v3, fragment.HLT_TriplePhoton_30_30_10_CaloIdLV2_R9IdVL_v3, fragment.HLT_TriplePhoton_35_35_5_CaloIdLV2_R9IdVL_v3, fragment.HLT_Photon20_v1, fragment.HLT_Photon33_v4, fragment.HLT_Photon50_v12, fragment.HLT_Photon75_v12, fragment.HLT_Photon90_v12, fragment.HLT_Photon120_v12, fragment.HLT_Photon150_v5, fragment.HLT_Photon175_v13, fragment.HLT_Photon200_v12, fragment.HLT_Photon50_R9Id90_HE10_IsoM_v13, fragment.HLT_Photon75_R9Id90_HE10_IsoM_v13, fragment.HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_CaloMJJ300_PFJetsMJJ400DEta3_v3, fragment.HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_CaloMJJ400_PFJetsMJJ600DEta3_v3, fragment.HLT_Photon90_R9Id90_HE10_IsoM_v13, fragment.HLT_Photon120_R9Id90_HE10_IsoM_v13, fragment.HLT_Photon165_R9Id90_HE10_IsoM_v14, fragment.HLT_Photon90_CaloIdL_PFHT700_v14, fragment.HLT_Diphoton30_22_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass90_v12, fragment.HLT_Diphoton30_22_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass95_v12, fragment.HLT_Diphoton30PV_18PV_R9Id_AND_IsoCaloId_AND_HE_R9Id_PixelVeto_Mass55_v13, fragment.HLT_Diphoton30PV_18PV_R9Id_AND_IsoCaloId_AND_HE_R9Id_NoPixelVeto_Mass55_v12, fragment.HLT_Diphoton30EB_18EB_R9Id_OR_IsoCaloId_AND_HE_R9Id_NoPixelVeto_Mass55_v12, fragment.HLT_Diphoton30EB_18EB_R9Id_OR_IsoCaloId_AND_HE_R9Id_PixelVeto_Mass55_v13, fragment.HLT_Dimuon0_Jpsi_L1_NoOS_v6, fragment.HLT_Dimuon0_Jpsi_NoVertexing_NoOS_v6, fragment.HLT_Dimuon0_Jpsi_v7, fragment.HLT_Dimuon0_Jpsi_NoVertexing_v7, fragment.HLT_Dimuon0_Jpsi_L1_4R_0er1p5R_v6, fragment.HLT_Dimuon0_Jpsi_NoVertexing_L1_4R_0er1p5R_v6, fragment.HLT_Dimuon0_Jpsi3p5_Muon2_v5, fragment.HLT_Dimuon0_Upsilon_L1_4p5_v7, fragment.HLT_Dimuon0_Upsilon_L1_5_v7, fragment.HLT_Dimuon0_Upsilon_L1_4p5NoOS_v6, fragment.HLT_Dimuon0_Upsilon_L1_4p5er2p0_v7, fragment.HLT_Dimuon0_Upsilon_L1_4p5er2p0M_v6, fragment.HLT_Dimuon0_Upsilon_NoVertexing_v6, fragment.HLT_Dimuon0_Upsilon_L1_5M_v6, fragment.HLT_Dimuon0_LowMass_L1_0er1p5R_v6, fragment.HLT_Dimuon0_LowMass_L1_0er1p5_v7, fragment.HLT_Dimuon0_LowMass_v7, fragment.HLT_Dimuon0_LowMass_L1_4_v7, fragment.HLT_Dimuon0_LowMass_L1_4R_v6, fragment.HLT_Dimuon0_LowMass_L1_TM530_v5, fragment.HLT_Dimuon0_Upsilon_Muon_L1_TM0_v5, fragment.HLT_Dimuon0_Upsilon_Muon_NoL1Mass_v5, fragment.HLT_TripleMu_5_3_3_Mass3p8to60_DZ_v7, fragment.HLT_TripleMu_10_5_5_DZ_v9, fragment.HLT_TripleMu_12_10_5_v9, fragment.HLT_Tau3Mu_Mu7_Mu1_TkMu1_Tau15_v2, fragment.HLT_Tau3Mu_Mu7_Mu1_TkMu1_Tau15_Charge1_v2, fragment.HLT_Tau3Mu_Mu7_Mu1_TkMu1_IsoTau15_v2, fragment.HLT_Tau3Mu_Mu7_Mu1_TkMu1_IsoTau15_Charge1_v2, fragment.HLT_DoubleMu3_DZ_PFMET50_PFMHT60_v8, fragment.HLT_DoubleMu3_DZ_PFMET70_PFMHT70_v8, fragment.HLT_DoubleMu3_DZ_PFMET90_PFMHT90_v8, fragment.HLT_DoubleMu3_Trk_Tau3mu_NoL1Mass_v5, fragment.HLT_DoubleMu4_Jpsi_Displaced_v6, fragment.HLT_DoubleMu4_Jpsi_NoVertexing_v6, fragment.HLT_DoubleMu4_JpsiTrkTrk_Displaced_v6, fragment.HLT_DoubleMu43NoFiltersNoVtx_v3, fragment.HLT_DoubleMu48NoFiltersNoVtx_v3, fragment.HLT_Mu43NoFiltersNoVtx_Photon43_CaloIdL_v4, fragment.HLT_Mu48NoFiltersNoVtx_Photon48_CaloIdL_v4, fragment.HLT_DoubleMu20_7_Mass0to30_L1_DM4_v6, fragment.HLT_DoubleMu20_7_Mass0to30_L1_DM4EG_v6, fragment.HLT_HT425_v8, fragment.HLT_HT430_DisplacedDijet40_DisplacedTrack_v11, fragment.HLT_HT500_DisplacedDijet40_DisplacedTrack_v11, fragment.HLT_HT430_DisplacedDijet60_DisplacedTrack_v11, fragment.HLT_HT400_DisplacedDijet40_DisplacedTrack_v11, fragment.HLT_HT650_DisplacedDijet60_Inclusive_v11, fragment.HLT_HT550_DisplacedDijet60_Inclusive_v11, fragment.HLT_DiJet110_35_Mjj650_PFMET110_v7, fragment.HLT_DiJet110_35_Mjj650_PFMET120_v7, fragment.HLT_DiJet110_35_Mjj650_PFMET130_v7, fragment.HLT_TripleJet110_35_35_Mjj650_PFMET110_v7, fragment.HLT_TripleJet110_35_35_Mjj650_PFMET120_v7, fragment.HLT_TripleJet110_35_35_Mjj650_PFMET130_v7, fragment.HLT_VBF_DoubleLooseChargedIsoPFTau20_Trk1_eta2p1_v1, fragment.HLT_VBF_DoubleMediumChargedIsoPFTau20_Trk1_eta2p1_v1, fragment.HLT_VBF_DoubleTightChargedIsoPFTau20_Trk1_eta2p1_v1, fragment.HLT_Ele30_eta2p1_WPTight_Gsf_CentralPFJet35_EleCleaned_v11, fragment.HLT_Ele28_eta2p1_WPTight_Gsf_HT150_v11, fragment.HLT_Ele28_HighEta_SC20_Mass55_v11, fragment.HLT_DoubleMu20_7_Mass0to30_Photon23_v6, fragment.HLT_Ele15_IsoVVVL_PFHT450_CaloBTagCSV_4p5_v7, fragment.HLT_Ele15_IsoVVVL_PFHT450_PFMET50_v14, fragment.HLT_Ele15_IsoVVVL_PFHT450_v14, fragment.HLT_Ele50_IsoVVVL_PFHT450_v14, fragment.HLT_Ele15_IsoVVVL_PFHT600_v18, fragment.HLT_Mu8_TrkIsoVVL_DiPFJet40_DEta3p5_MJJ750_HTT300_PFMETNoMu60_v13, fragment.HLT_Mu10_TrkIsoVVL_DiPFJet40_DEta3p5_MJJ750_HTT350_PFMETNoMu60_v12, fragment.HLT_Mu15_IsoVVVL_PFHT450_CaloBTagCSV_4p5_v7, fragment.HLT_Mu15_IsoVVVL_PFHT450_PFMET50_v13, fragment.HLT_Mu15_IsoVVVL_PFHT450_v13, fragment.HLT_Mu50_IsoVVVL_PFHT450_v13, fragment.HLT_Mu15_IsoVVVL_PFHT600_v17, fragment.HLT_Dimuon10_PsiPrime_Barrel_Seagulls_v6, fragment.HLT_Dimuon20_Jpsi_Barrel_Seagulls_v6, fragment.HLT_Dimuon10_Upsilon_Barrel_Seagulls_v6, fragment.HLT_Dimuon12_Upsilon_eta1p5_v13, fragment.HLT_Dimuon14_Phi_Barrel_Seagulls_v6, fragment.HLT_Dimuon18_PsiPrime_v13, fragment.HLT_Dimuon25_Jpsi_v13, fragment.HLT_Dimuon18_PsiPrime_noCorrL1_v4, fragment.HLT_Dimuon24_Upsilon_noCorrL1_v4, fragment.HLT_Dimuon24_Phi_noCorrL1_v4, fragment.HLT_Dimuon25_Jpsi_noCorrL1_v4, fragment.HLT_DiMu9_Ele9_CaloIdL_TrackIdL_DZ_v15, fragment.HLT_DiMu9_Ele9_CaloIdL_TrackIdL_v15, fragment.HLT_DoubleIsoMu20_eta2p1_v5, fragment.HLT_DoubleIsoMu24_eta2p1_v5, fragment.HLT_TrkMu12_DoubleTrkMu5NoFiltersNoVtx_v5, fragment.HLT_TrkMu16_DoubleTrkMu6NoFiltersNoVtx_v11, fragment.HLT_TrkMu17_DoubleTrkMu8NoFiltersNoVtx_v12, fragment.HLT_Mu8_v11, fragment.HLT_Mu17_v11, fragment.HLT_Mu19_v2, fragment.HLT_Mu17_Photon30_IsoCaloId_v4, fragment.HLT_Ele8_CaloIdL_TrackIdL_IsoVL_PFJet30_v14, fragment.HLT_Ele12_CaloIdL_TrackIdL_IsoVL_PFJet30_v16, fragment.HLT_Ele15_CaloIdL_TrackIdL_IsoVL_PFJet30_v1, fragment.HLT_Ele23_CaloIdL_TrackIdL_IsoVL_PFJet30_v16, fragment.HLT_Ele8_CaloIdM_TrackIdM_PFJet30_v16, fragment.HLT_Ele17_CaloIdM_TrackIdM_PFJet30_v14, fragment.HLT_Ele23_CaloIdM_TrackIdM_PFJet30_v16, fragment.HLT_Ele50_CaloIdVT_GsfTrkIdT_PFJet165_v16, fragment.HLT_Ele115_CaloIdVT_GsfTrkIdT_v12, fragment.HLT_Ele135_CaloIdVT_GsfTrkIdT_v5, fragment.HLT_Ele145_CaloIdVT_GsfTrkIdT_v6, fragment.HLT_Ele200_CaloIdVT_GsfTrkIdT_v6, fragment.HLT_Ele250_CaloIdVT_GsfTrkIdT_v11, fragment.HLT_Ele300_CaloIdVT_GsfTrkIdT_v11, fragment.HLT_PFHT330PT30_QuadPFJet_75_60_45_40_TriplePFBTagDeepCSV_4p5_v1, fragment.HLT_PFHT330PT30_QuadPFJet_75_60_45_40_v7, fragment.HLT_PFHT380_SixPFJet32_DoublePFBTagCSV_2p2_v7, fragment.HLT_PFHT380_SixPFJet32_DoublePFBTagDeepCSV_2p2_v6, fragment.HLT_PFHT380_SixPFJet32_v7, fragment.HLT_PFHT430_SixPFJet40_PFBTagCSV_1p5_v7, fragment.HLT_PFHT430_SixPFJet40_v9, fragment.HLT_PFHT350_v17, fragment.HLT_PFHT350MinPFJet15_v7, fragment.HLT_Photon60_R9Id90_CaloIdL_IsoL_v4, fragment.HLT_Photon60_R9Id90_CaloIdL_IsoL_DisplacedIdL_v4, fragment.HLT_Photon60_R9Id90_CaloIdL_IsoL_DisplacedIdL_PFHT350MinPFJet15_v9, fragment.HLT_FullTrack_Multiplicity85_v3, fragment.HLT_FullTrack_Multiplicity100_v2, fragment.HLT_FullTrack_Multiplicity130_v2, fragment.HLT_FullTrack_Multiplicity155_v3, fragment.HLT_ECALHT800_v9, fragment.HLT_DiSC30_18_EIso_AND_HE_Mass70_v12, fragment.HLT_Physics_v7, fragment.HLT_Physics_part0_v7, fragment.HLT_Physics_part1_v7, fragment.HLT_Physics_part2_v7, fragment.HLT_Physics_part3_v7, fragment.HLT_Physics_part4_v7, fragment.HLT_Physics_part5_v7, fragment.HLT_Physics_part6_v7, fragment.HLT_Physics_part7_v7, fragment.DST_Physics_v7, fragment.HLT_Random_v3, fragment.HLT_ZeroBias_v6, fragment.HLT_ZeroBias_part0_v6, fragment.HLT_ZeroBias_part1_v6, fragment.HLT_ZeroBias_part2_v6, fragment.HLT_ZeroBias_part3_v6, fragment.HLT_ZeroBias_part4_v6, fragment.HLT_ZeroBias_part5_v6, fragment.HLT_ZeroBias_part6_v6, fragment.HLT_ZeroBias_part7_v6, fragment.DST_ZeroBias_v2, fragment.DST_HT250_CaloScouting_v9, fragment.DST_HT250_CaloBTagScouting_v8, fragment.DST_HT410_PFScouting_v14, fragment.DST_HT410_BTagScouting_v14, fragment.DST_ZeroBias_BTagScouting_v13, fragment.DST_ZeroBias_CaloScouting_PFScouting_v12, fragment.DST_CaloJet40_BTagScouting_v13, fragment.DST_CaloJet40_CaloScouting_PFScouting_v13, fragment.DST_CaloJet40_CaloBTagScouting_v12, fragment.DST_L1HTT_BTagScouting_v13, fragment.DST_L1HTT_CaloScouting_PFScouting_v13, fragment.DST_L1HTT_CaloBTagScouting_v12, fragment.DST_L1DoubleMu_BTagScouting_v14, fragment.DST_L1DoubleMu_CaloScouting_PFScouting_v13, fragment.DST_DoubleMu3_noVtx_CaloScouting_Monitoring_v5, fragment.DST_DoubleMu3_noVtx_CaloScouting_v5, fragment.DST_DoubleMu1_noVtx_CaloScouting_v1, fragment.DST_DoubleMu3_noVtx_Mass10_PFScouting_v1, fragment.HLT_AK4CaloJet30_v11, fragment.HLT_AK4CaloJet40_v10, fragment.HLT_AK4CaloJet50_v10, fragment.HLT_AK4CaloJet80_v10, fragment.HLT_AK4CaloJet100_v10, fragment.HLT_AK4CaloJet120_v9, fragment.HLT_AK4PFJet30_v17, fragment.HLT_AK4PFJet50_v17, fragment.HLT_AK4PFJet80_v17, fragment.HLT_AK4PFJet100_v17, fragment.HLT_AK4PFJet120_v16, fragment.HLT_SinglePhoton10_Eta3p1ForPPRef_v8, fragment.HLT_SinglePhoton20_Eta3p1ForPPRef_v8, fragment.HLT_SinglePhoton30_Eta3p1ForPPRef_v8, fragment.HLT_Photon20_HoverELoose_v9, fragment.HLT_Photon30_HoverELoose_v9, fragment.HLT_EcalCalibration_v4, fragment.HLT_HcalCalibration_v5, fragment.AlCa_EcalPhiSym_v8, fragment.HLT_L1UnpairedBunchBptxMinus_v2, fragment.HLT_L1UnpairedBunchBptxPlus_v2, fragment.HLT_L1NotBptxOR_v3, fragment.HLT_L1MinimumBiasHF_OR_v2, fragment.HLT_L1MinimumBiasHF0OR_v3, fragment.HLT_L1_CDC_SingleMu_3_er1p2_TOP120_DPHI2p618_3p142_v2, fragment.HLT_HcalNZS_v12, fragment.HLT_HcalPhiSym_v14, fragment.HLT_HcalIsolatedbunch_v4, fragment.HLT_IsoTrackHB_v3, fragment.HLT_IsoTrackHE_v3, fragment.HLT_ZeroBias_FirstCollisionAfterAbortGap_v5, fragment.HLT_ZeroBias_IsolatedBunches_v5, fragment.HLT_ZeroBias_FirstCollisionInTrain_v4, fragment.HLT_ZeroBias_LastCollisionInTrain_v3, fragment.HLT_ZeroBias_FirstBXAfterTrain_v3, fragment.AlCa_RPCMuonNormalisation_v13, fragment.AlCa_LumiPixels_Random_v4, fragment.AlCa_LumiPixels_ZeroBias_v8, fragment.MC_ReducedIterativeTracking_v11, fragment.MC_PFMET_v15, fragment.MC_AK4PFJets_v15, fragment.MC_PFBTagCSV_v9, fragment.MC_PFHT_v14, fragment.MC_PFMHT_v14, fragment.MC_CaloMET_v8, fragment.MC_CaloMET_JetIdCleaned_v9, fragment.MC_AK4CaloJets_v9, fragment.MC_AK4CaloJetsFromPV_v7, fragment.MC_CaloBTagCSV_v7, fragment.MC_CaloHT_v8, fragment.MC_CaloMHT_v8, fragment.MC_AK8PFJets_v15, fragment.MC_AK8TrimPFJets_v15, fragment.MC_AK8PFHT_v14, fragment.MC_AK8CaloHT_v8, fragment.MC_Diphoton10_10_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass10_v12, fragment.MC_DoubleEle5_CaloIdL_MW_v13, fragment.MC_Ele5_WPTight_Gsf_v6, fragment.MC_Ele15_Ele10_CaloIdL_TrackIdL_IsoVL_DZ_v13, fragment.MC_IsoMu_v13, fragment.MC_DoubleMu_TrkIsoVVL_DZ_v10, fragment.MC_DoubleMuNoFiltersNoVtx_v7, fragment.AlCa_EcalPi0EBonly_v12, fragment.AlCa_EcalPi0EEonly_v12, fragment.AlCa_EcalEtaEBonly_v12, fragment.AlCa_EcalEtaEEonly_v12, fragment.HLT_Ele24_eta2p1_WPTight_Gsf_LooseChargedIsoPFTau30_eta2p1_CrossL1_v11, fragment.HLT_Ele24_eta2p1_WPTight_Gsf_MediumChargedIsoPFTau30_eta2p1_CrossL1_v11, fragment.HLT_Ele24_eta2p1_WPTight_Gsf_TightChargedIsoPFTau30_eta2p1_CrossL1_v11, fragment.HLT_Ele24_eta2p1_WPTight_Gsf_LooseChargedIsoPFTau30_eta2p1_TightID_CrossL1_v11, fragment.HLT_Ele24_eta2p1_WPTight_Gsf_MediumChargedIsoPFTau30_eta2p1_TightID_CrossL1_v11, fragment.HLT_Ele24_eta2p1_WPTight_Gsf_TightChargedIsoPFTau30_eta2p1_TightID_CrossL1_v11, fragment.HLT_DoubleMediumChargedIsoPFTau35_Trk1_eta2p1_Reg_v10, fragment.HLT_DoubleMediumChargedIsoPFTau40_Trk1_eta2p1_Reg_v10, fragment.HLT_DoubleTightChargedIsoPFTau35_Trk1_eta2p1_Reg_v10, fragment.HLT_DoubleTightChargedIsoPFTau40_Trk1_eta2p1_Reg_v10, fragment.HLT_DoubleMediumChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_v10, fragment.HLT_DoubleMediumChargedIsoPFTau40_Trk1_TightID_eta2p1_Reg_v10, fragment.HLT_DoubleTightChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_v10, fragment.HLT_DoubleTightChargedIsoPFTau40_Trk1_TightID_eta2p1_Reg_v10, fragment.HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_v10, fragment.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET90_v10, fragment.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET100_v10, fragment.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET110_v6, fragment.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET120_v6, fragment.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET130_v6, fragment.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET140_v1, fragment.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_v10, fragment.HLT_MediumChargedIsoPFTau180HighPtRelaxedIso_Trk50_eta2p1_1pr_v9, fragment.HLT_MediumChargedIsoPFTau180HighPtRelaxedIso_Trk50_eta2p1_v10, fragment.HLT_MediumChargedIsoPFTau200HighPtRelaxedIso_Trk50_eta2p1_v10, fragment.HLT_MediumChargedIsoPFTau220HighPtRelaxedIso_Trk50_eta2p1_v10, fragment.HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau35_Trk1_eta2p1_Reg_CrossL1_v10, fragment.HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_CrossL1_v10, fragment.HLT_IsoMu24_eta2p1_TightChargedIsoPFTau35_Trk1_eta2p1_Reg_CrossL1_v10, fragment.HLT_IsoMu24_eta2p1_TightChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_CrossL1_v10, fragment.HLT_Ele16_Ele12_Ele8_CaloIdL_TrackIdL_v7, fragment.HLT_Rsq0p35_v13, fragment.HLT_Rsq0p40_v13, fragment.HLT_RsqMR300_Rsq0p09_MR200_v13, fragment.HLT_RsqMR320_Rsq0p09_MR200_v13, fragment.HLT_RsqMR300_Rsq0p09_MR200_4jet_v13, fragment.HLT_RsqMR320_Rsq0p09_MR200_4jet_v13, fragment.HLT_IsoMu27_LooseChargedIsoPFTau20_Trk1_eta2p1_SingleL1_v3, fragment.HLT_IsoMu27_MediumChargedIsoPFTau20_Trk1_eta2p1_SingleL1_v3, fragment.HLT_IsoMu27_TightChargedIsoPFTau20_Trk1_eta2p1_SingleL1_v3, fragment.HLT_IsoMu27_MET90_v1, fragment.HLT_IsoMu20_eta2p1_LooseChargedIsoPFTauHPS27_eta2p1_CrossL1_v1, fragment.HLT_IsoMu24_eta2p1_MediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_CrossL1_v1, fragment.HLT_DoubleMediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_v1, fragment.HLT_Photon50_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ300DEta3_PFMET50_v3, fragment.HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ300DEta3_v3, fragment.HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ600DEta3_v3, fragment.HLT_PFMET100_PFMHT100_IDTight_PFHT60_v7, fragment.HLT_PFMETNoMu100_PFMHTNoMu100_IDTight_PFHT60_v7, fragment.HLT_PFMETTypeOne100_PFMHT100_IDTight_PFHT60_v7, fragment.HLT_Mu18_Mu9_SameSign_v3, fragment.HLT_Mu18_Mu9_SameSign_DZ_v3, fragment.HLT_Mu18_Mu9_v3, fragment.HLT_Mu18_Mu9_DZ_v3, fragment.HLT_Mu20_Mu10_SameSign_v3, fragment.HLT_Mu20_Mu10_SameSign_DZ_v3, fragment.HLT_Mu20_Mu10_v3, fragment.HLT_Mu20_Mu10_DZ_v3, fragment.HLT_Mu23_Mu12_SameSign_v3, fragment.HLT_Mu23_Mu12_SameSign_DZ_v3, fragment.HLT_Mu23_Mu12_v3, fragment.HLT_Mu23_Mu12_DZ_v3, fragment.HLT_DoubleMu2_Jpsi_DoubleTrk1_Phi1p05_v5, fragment.HLT_DoubleMu2_Jpsi_DoubleTkMu0_Phi_v3, fragment.HLT_DoubleMu3_DCA_PFMET50_PFMHT60_v8, fragment.HLT_TripleMu_5_3_3_Mass3p8to60_DCA_v2, fragment.HLT_QuadPFJet98_83_71_15_DoubleBTagCSV_p013_p08_VBF1_v7, fragment.HLT_QuadPFJet103_88_75_15_DoubleBTagCSV_p013_p08_VBF1_v7, fragment.HLT_QuadPFJet105_90_76_15_DoubleBTagCSV_p013_p08_VBF1_v7, fragment.HLT_QuadPFJet111_90_80_15_DoubleBTagCSV_p013_p08_VBF1_v7, fragment.HLT_QuadPFJet98_83_71_15_BTagCSV_p013_VBF2_v7, fragment.HLT_QuadPFJet103_88_75_15_BTagCSV_p013_VBF2_v7, fragment.HLT_QuadPFJet105_88_76_15_BTagCSV_p013_VBF2_v7, fragment.HLT_QuadPFJet111_90_80_15_BTagCSV_p013_VBF2_v7, fragment.HLT_QuadPFJet98_83_71_15_v3, fragment.HLT_QuadPFJet103_88_75_15_v3, fragment.HLT_QuadPFJet105_88_76_15_v3, fragment.HLT_QuadPFJet111_90_80_15_v3, fragment.HLT_AK8PFJet330_TrimMass30_PFAK8BTagCSV_p17_v1, fragment.HLT_AK8PFJet330_TrimMass30_PFAK8BTagCSV_p1_v1, fragment.HLT_AK8PFJet330_TrimMass30_PFAK8BoostedDoubleB_p02_v1, fragment.HLT_Diphoton30_18_PVrealAND_R9Id_AND_IsoCaloId_AND_HE_R9Id_PixelVeto_Mass55_v8, fragment.HLT_Diphoton30_18_PVrealAND_R9Id_AND_IsoCaloId_AND_HE_R9Id_NoPixelVeto_Mass55_v8, fragment.HLTriggerFinalPath, fragment.HLTAnalyzerEndpath, fragment.ScoutingPFOutput, fragment.ScoutingCaloMuonOutput )) +fragment.HLTSchedule = cms.Schedule( *(fragment.HLTriggerFirstPath, fragment.HLT_AK8PFJet360_TrimMass30_v16, fragment.HLT_AK8PFJet380_TrimMass30_v9, fragment.HLT_AK8PFJet400_TrimMass30_v10, fragment.HLT_AK8PFJet420_TrimMass30_v9, fragment.HLT_AK8PFHT750_TrimMass50_v10, fragment.HLT_AK8PFHT800_TrimMass50_v10, fragment.HLT_AK8PFHT850_TrimMass50_v9, fragment.HLT_AK8PFHT900_TrimMass50_v9, fragment.HLT_CaloJet500_NoJetID_v11, fragment.HLT_CaloJet550_NoJetID_v6, fragment.HLT_DoubleMu5_Upsilon_DoubleEle3_CaloIdL_TrackIdL_v2, fragment.HLT_DoubleMu3_DoubleEle7p5_CaloIdL_TrackIdL_Upsilon_v2, fragment.HLT_Trimuon5_3p5_2_Upsilon_Muon_v4, fragment.HLT_TrimuonOpen_5_3p5_2_Upsilon_Muon_v2, fragment.HLT_DoubleEle25_CaloIdL_MW_v2, fragment.HLT_DoubleEle27_CaloIdL_MW_v2, fragment.HLT_DoubleEle33_CaloIdL_MW_v15, fragment.HLT_DoubleEle24_eta2p1_WPTight_Gsf_v5, fragment.HLT_DoubleEle8_CaloIdM_TrackIdM_Mass8_DZ_PFHT350_v18, fragment.HLT_DoubleEle8_CaloIdM_TrackIdM_Mass8_PFHT350_v18, fragment.HLT_Ele27_Ele37_CaloIdL_MW_v2, fragment.HLT_Mu27_Ele37_CaloIdL_MW_v3, fragment.HLT_Mu37_Ele27_CaloIdL_MW_v3, fragment.HLT_Mu37_TkMu27_v3, fragment.HLT_DoubleMu4_3_Bs_v13, fragment.HLT_DoubleMu4_3_Jpsi_v1, fragment.HLT_DoubleMu4_JpsiTrk_Displaced_v14, fragment.HLT_DoubleMu4_LowMassNonResonantTrk_Displaced_v14, fragment.HLT_DoubleMu3_Trk_Tau3mu_v11, fragment.HLT_DoubleMu3_TkMu_DsTau3Mu_v2, fragment.HLT_DoubleMu4_PsiPrimeTrk_Displaced_v14, fragment.HLT_DoubleMu4_Mass8_DZ_PFHT350_v7, fragment.HLT_DoubleMu8_Mass8_PFHT350_v7, fragment.HLT_Mu3_PFJet40_v14, fragment.HLT_Mu7p5_L2Mu2_Jpsi_v9, fragment.HLT_Mu7p5_L2Mu2_Upsilon_v9, fragment.HLT_Mu7p5_Track2_Jpsi_v10, fragment.HLT_Mu7p5_Track3p5_Jpsi_v10, fragment.HLT_Mu7p5_Track7_Jpsi_v10, fragment.HLT_Mu7p5_Track2_Upsilon_v10, fragment.HLT_Mu7p5_Track3p5_Upsilon_v10, fragment.HLT_Mu7p5_Track7_Upsilon_v10, fragment.HLT_DoublePhoton33_CaloIdL_v5, fragment.HLT_DoublePhoton70_v5, fragment.HLT_DoublePhoton85_v13, fragment.HLT_Ele20_WPTight_Gsf_v4, fragment.HLT_Ele15_WPLoose_Gsf_v1, fragment.HLT_Ele17_WPLoose_Gsf_v1, fragment.HLT_Ele20_WPLoose_Gsf_v4, fragment.HLT_Ele20_eta2p1_WPLoose_Gsf_v4, fragment.HLT_DiEle27_WPTightCaloOnly_L1DoubleEG_v3, fragment.HLT_Ele27_WPTight_Gsf_v14, fragment.HLT_Ele32_WPTight_Gsf_v13, fragment.HLT_Ele35_WPTight_Gsf_v7, fragment.HLT_Ele35_WPTight_Gsf_L1EGMT_v3, fragment.HLT_Ele38_WPTight_Gsf_v7, fragment.HLT_Ele40_WPTight_Gsf_v7, fragment.HLT_Ele32_WPTight_Gsf_L1DoubleEG_v7, fragment.HLT_HT450_Beamspot_v9, fragment.HLT_HT300_Beamspot_v9, fragment.HLT_ZeroBias_Beamspot_v2, fragment.HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_CrossL1_v10, fragment.HLT_IsoMu20_eta2p1_MediumChargedIsoPFTau27_eta2p1_CrossL1_v10, fragment.HLT_IsoMu20_eta2p1_TightChargedIsoPFTau27_eta2p1_CrossL1_v10, fragment.HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10, fragment.HLT_IsoMu20_eta2p1_MediumChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10, fragment.HLT_IsoMu20_eta2p1_TightChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10, fragment.HLT_IsoMu20_v13, fragment.HLT_IsoMu24_v11, fragment.HLT_IsoMu24_eta2p1_v13, fragment.HLT_IsoMu27_v14, fragment.HLT_IsoMu30_v2, fragment.HLT_UncorrectedJetE30_NoBPTX_v5, fragment.HLT_UncorrectedJetE30_NoBPTX3BX_v5, fragment.HLT_UncorrectedJetE60_NoBPTX3BX_v5, fragment.HLT_UncorrectedJetE70_NoBPTX3BX_v5, fragment.HLT_L1SingleMu18_v3, fragment.HLT_L1SingleMu25_v2, fragment.HLT_L2Mu10_v7, fragment.HLT_L2Mu10_NoVertex_NoBPTX_v6, fragment.HLT_L2Mu50_v2, fragment.HLT_L2Mu23NoVtx_2Cha_v1, fragment.HLT_L2Mu23NoVtx_2Cha_CosmicSeed_v1, fragment.HLT_DoubleL2Mu30NoVtx_2Cha_CosmicSeed_Eta2p4_v1, fragment.HLT_DoubleL2Mu30NoVtx_2Cha_Eta2p4_v1, fragment.HLT_DoubleL2Mu50_v2, fragment.HLT_DoubleL2Mu23NoVtx_2Cha_CosmicSeed_v1, fragment.HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_v1, fragment.HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_Eta2p4_v1, fragment.HLT_DoubleL2Mu23NoVtx_2Cha_v1, fragment.HLT_DoubleL2Mu25NoVtx_2Cha_v1, fragment.HLT_DoubleL2Mu25NoVtx_2Cha_Eta2p4_v1, fragment.HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_v13, fragment.HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_v2, fragment.HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_v14, fragment.HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_v2, fragment.HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_Mass8_v4, fragment.HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_Mass8_v2, fragment.HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_Mass3p8_v4, fragment.HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_Mass3p8_v2, fragment.HLT_Mu25_TkMu0_Onia_v6, fragment.HLT_Mu30_TkMu0_Onia_v6, fragment.HLT_Mu20_TkMu0_Phi_v6, fragment.HLT_Mu25_TkMu0_Phi_v6, fragment.HLT_Mu12_v1, fragment.HLT_Mu15_v1, fragment.HLT_Mu20_v11, fragment.HLT_Mu27_v12, fragment.HLT_Mu50_v12, fragment.HLT_Mu55_v2, fragment.HLT_OldMu100_v3, fragment.HLT_TkMu100_v2, fragment.HLT_DiPFJet15_NoCaloMatched_v14, fragment.HLT_DiPFJet25_NoCaloMatched_v14, fragment.HLT_DiPFJet15_FBEta3_NoCaloMatched_v15, fragment.HLT_DiPFJet25_FBEta3_NoCaloMatched_v15, fragment.HLT_DiPFJetAve40_v12, fragment.HLT_DiPFJetAve60_v12, fragment.HLT_DiPFJetAve80_v11, fragment.HLT_DiPFJetAve140_v11, fragment.HLT_DiPFJetAve200_v11, fragment.HLT_DiPFJetAve260_v12, fragment.HLT_DiPFJetAve320_v12, fragment.HLT_DiPFJetAve400_v12, fragment.HLT_DiPFJetAve500_v12, fragment.HLT_DiPFJetAve15_HFJEC_v15, fragment.HLT_DiPFJetAve25_HFJEC_v15, fragment.HLT_DiPFJetAve35_HFJEC_v15, fragment.HLT_DiPFJetAve60_HFJEC_v13, fragment.HLT_DiPFJetAve80_HFJEC_v13, fragment.HLT_DiPFJetAve100_HFJEC_v13, fragment.HLT_DiPFJetAve160_HFJEC_v13, fragment.HLT_DiPFJetAve220_HFJEC_v14, fragment.HLT_DiPFJetAve300_HFJEC_v14, fragment.HLT_AK8PFJet15_v1, fragment.HLT_AK8PFJet25_v1, fragment.HLT_AK8PFJet40_v14, fragment.HLT_AK8PFJet60_v13, fragment.HLT_AK8PFJet80_v13, fragment.HLT_AK8PFJet140_v13, fragment.HLT_AK8PFJet200_v13, fragment.HLT_AK8PFJet260_v14, fragment.HLT_AK8PFJet320_v14, fragment.HLT_AK8PFJet400_v14, fragment.HLT_AK8PFJet450_v14, fragment.HLT_AK8PFJet500_v14, fragment.HLT_AK8PFJet550_v9, fragment.HLT_PFJet15_v1, fragment.HLT_PFJet25_v1, fragment.HLT_PFJet40_v19, fragment.HLT_PFJet60_v19, fragment.HLT_PFJet80_v18, fragment.HLT_PFJet140_v17, fragment.HLT_PFJet200_v17, fragment.HLT_PFJet260_v18, fragment.HLT_PFJet320_v18, fragment.HLT_PFJet400_v18, fragment.HLT_PFJet450_v19, fragment.HLT_PFJet500_v19, fragment.HLT_PFJet550_v9, fragment.HLT_PFJetFwd15_v1, fragment.HLT_PFJetFwd25_v1, fragment.HLT_PFJetFwd40_v17, fragment.HLT_PFJetFwd60_v17, fragment.HLT_PFJetFwd80_v16, fragment.HLT_PFJetFwd140_v16, fragment.HLT_PFJetFwd200_v16, fragment.HLT_PFJetFwd260_v17, fragment.HLT_PFJetFwd320_v17, fragment.HLT_PFJetFwd400_v17, fragment.HLT_PFJetFwd450_v17, fragment.HLT_PFJetFwd500_v17, fragment.HLT_AK8PFJetFwd15_v1, fragment.HLT_AK8PFJetFwd25_v1, fragment.HLT_AK8PFJetFwd40_v13, fragment.HLT_AK8PFJetFwd60_v12, fragment.HLT_AK8PFJetFwd80_v12, fragment.HLT_AK8PFJetFwd140_v12, fragment.HLT_AK8PFJetFwd200_v12, fragment.HLT_AK8PFJetFwd260_v13, fragment.HLT_AK8PFJetFwd320_v13, fragment.HLT_AK8PFJetFwd400_v13, fragment.HLT_AK8PFJetFwd450_v13, fragment.HLT_AK8PFJetFwd500_v13, fragment.HLT_PFHT180_v15, fragment.HLT_PFHT250_v15, fragment.HLT_PFHT370_v15, fragment.HLT_PFHT430_v15, fragment.HLT_PFHT510_v15, fragment.HLT_PFHT590_v15, fragment.HLT_PFHT680_v15, fragment.HLT_PFHT780_v15, fragment.HLT_PFHT890_v15, fragment.HLT_PFHT1050_v16, fragment.HLT_PFHT500_PFMET100_PFMHT100_IDTight_v10, fragment.HLT_PFHT500_PFMET110_PFMHT110_IDTight_v10, fragment.HLT_PFHT700_PFMET85_PFMHT85_IDTight_v10, fragment.HLT_PFHT700_PFMET95_PFMHT95_IDTight_v10, fragment.HLT_PFHT800_PFMET75_PFMHT75_IDTight_v10, fragment.HLT_PFHT800_PFMET85_PFMHT85_IDTight_v10, fragment.HLT_PFMET110_PFMHT110_IDTight_v18, fragment.HLT_PFMET120_PFMHT120_IDTight_v18, fragment.HLT_PFMET130_PFMHT130_IDTight_v18, fragment.HLT_PFMET140_PFMHT140_IDTight_v18, fragment.HLT_PFMET100_PFMHT100_IDTight_CaloBTagCSV_3p1_v7, fragment.HLT_PFMET110_PFMHT110_IDTight_CaloBTagCSV_3p1_v7, fragment.HLT_PFMET120_PFMHT120_IDTight_CaloBTagCSV_3p1_v7, fragment.HLT_PFMET130_PFMHT130_IDTight_CaloBTagCSV_3p1_v7, fragment.HLT_PFMET140_PFMHT140_IDTight_CaloBTagCSV_3p1_v7, fragment.HLT_PFMET120_PFMHT120_IDTight_PFHT60_v7, fragment.HLT_PFMETNoMu120_PFMHTNoMu120_IDTight_PFHT60_v7, fragment.HLT_PFMETTypeOne120_PFMHT120_IDTight_PFHT60_v7, fragment.HLT_PFMETTypeOne110_PFMHT110_IDTight_v10, fragment.HLT_PFMETTypeOne120_PFMHT120_IDTight_v10, fragment.HLT_PFMETTypeOne130_PFMHT130_IDTight_v10, fragment.HLT_PFMETTypeOne140_PFMHT140_IDTight_v9, fragment.HLT_PFMETNoMu110_PFMHTNoMu110_IDTight_v18, fragment.HLT_PFMETNoMu120_PFMHTNoMu120_IDTight_v18, fragment.HLT_PFMETNoMu130_PFMHTNoMu130_IDTight_v17, fragment.HLT_PFMETNoMu140_PFMHTNoMu140_IDTight_v17, fragment.HLT_MonoCentralPFJet80_PFMETNoMu110_PFMHTNoMu110_IDTight_v18, fragment.HLT_MonoCentralPFJet80_PFMETNoMu120_PFMHTNoMu120_IDTight_v18, fragment.HLT_MonoCentralPFJet80_PFMETNoMu130_PFMHTNoMu130_IDTight_v17, fragment.HLT_MonoCentralPFJet80_PFMETNoMu140_PFMHTNoMu140_IDTight_v17, fragment.HLT_L1ETMHadSeeds_v1, fragment.HLT_CaloMHT90_v3, fragment.HLT_CaloMET80_NotCleaned_v3, fragment.HLT_CaloMET90_NotCleaned_v3, fragment.HLT_CaloMET100_NotCleaned_v3, fragment.HLT_CaloMET110_NotCleaned_v3, fragment.HLT_CaloMET250_NotCleaned_v3, fragment.HLT_CaloMET70_HBHECleaned_v3, fragment.HLT_CaloMET80_HBHECleaned_v3, fragment.HLT_CaloMET90_HBHECleaned_v3, fragment.HLT_CaloMET100_HBHECleaned_v3, fragment.HLT_CaloMET250_HBHECleaned_v3, fragment.HLT_CaloMET300_HBHECleaned_v3, fragment.HLT_CaloMET350_HBHECleaned_v3, fragment.HLT_PFMET200_NotCleaned_v7, fragment.HLT_PFMET200_HBHECleaned_v7, fragment.HLT_PFMET250_HBHECleaned_v7, fragment.HLT_PFMET300_HBHECleaned_v7, fragment.HLT_PFMET200_HBHE_BeamHaloCleaned_v7, fragment.HLT_PFMETTypeOne200_HBHE_BeamHaloCleaned_v7, fragment.HLT_MET105_IsoTrk50_v8, fragment.HLT_MET120_IsoTrk50_v8, fragment.HLT_SingleJet30_Mu12_SinglePFJet40_v9, fragment.HLT_Mu12_DoublePFJets40_CaloBTagCSV_p79_v1, fragment.HLT_Mu12_DoublePFJets100_CaloBTagCSV_p79_v1, fragment.HLT_Mu12_DoublePFJets200_CaloBTagCSV_p79_v1, fragment.HLT_Mu12_DoublePFJets350_CaloBTagCSV_p79_v1, fragment.HLT_Mu12_DoublePFJets40MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, fragment.HLT_Mu12_DoublePFJets54MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, fragment.HLT_Mu12_DoublePFJets62MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, fragment.HLT_DoublePFJets40_CaloBTagCSV_p79_v1, fragment.HLT_DoublePFJets100_CaloBTagCSV_p79_v1, fragment.HLT_DoublePFJets200_CaloBTagCSV_p79_v1, fragment.HLT_DoublePFJets350_CaloBTagCSV_p79_v1, fragment.HLT_DoublePFJets116MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, fragment.HLT_DoublePFJets128MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, fragment.HLT_Photon300_NoHE_v11, fragment.HLT_Mu8_TrkIsoVVL_v11, fragment.HLT_Mu8_DiEle12_CaloIdL_TrackIdL_DZ_v16, fragment.HLT_Mu8_DiEle12_CaloIdL_TrackIdL_v16, fragment.HLT_Mu8_Ele8_CaloIdM_TrackIdM_Mass8_PFHT350_DZ_v17, fragment.HLT_Mu8_Ele8_CaloIdM_TrackIdM_Mass8_PFHT350_v17, fragment.HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_v11, fragment.HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_v9, fragment.HLT_Mu17_TrkIsoVVL_v11, fragment.HLT_Mu19_TrkIsoVVL_v2, fragment.HLT_BTagMu_AK4DiJet20_Mu5_v11, fragment.HLT_BTagMu_AK4DiJet40_Mu5_v11, fragment.HLT_BTagMu_AK4DiJet70_Mu5_v11, fragment.HLT_BTagMu_AK4DiJet110_Mu5_v11, fragment.HLT_BTagMu_AK4DiJet170_Mu5_v10, fragment.HLT_BTagMu_AK4Jet300_Mu5_v11, fragment.HLT_BTagMu_AK8DiJet170_Mu5_v7, fragment.HLT_BTagMu_AK8Jet300_Mu5_v11, fragment.HLT_Ele15_Ele8_CaloIdL_TrackIdL_IsoVL_v1, fragment.HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_v17, fragment.HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_v17, fragment.HLT_Mu23_TrkIsoVVL_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_v13, fragment.HLT_Mu23_TrkIsoVVL_Ele12_CaloIdL_TrackIdL_IsoVL_v5, fragment.HLT_Mu12_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_v5, fragment.HLT_Mu12_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_v13, fragment.HLT_Mu12_DoublePhoton20_v3, fragment.HLT_TriplePhoton_20_20_20_CaloIdLV2_v2, fragment.HLT_TriplePhoton_20_20_20_CaloIdLV2_R9IdVL_v2, fragment.HLT_TriplePhoton_30_30_10_CaloIdLV2_v3, fragment.HLT_TriplePhoton_30_30_10_CaloIdLV2_R9IdVL_v3, fragment.HLT_TriplePhoton_35_35_5_CaloIdLV2_R9IdVL_v3, fragment.HLT_Photon20_v1, fragment.HLT_Photon33_v4, fragment.HLT_Photon50_v12, fragment.HLT_Photon75_v12, fragment.HLT_Photon90_v12, fragment.HLT_Photon120_v12, fragment.HLT_Photon150_v5, fragment.HLT_Photon175_v13, fragment.HLT_Photon200_v12, fragment.HLT_Photon50_R9Id90_HE10_IsoM_v13, fragment.HLT_Photon75_R9Id90_HE10_IsoM_v13, fragment.HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_CaloMJJ300_PFJetsMJJ400DEta3_v3, fragment.HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_CaloMJJ400_PFJetsMJJ600DEta3_v3, fragment.HLT_Photon90_R9Id90_HE10_IsoM_v13, fragment.HLT_Photon120_R9Id90_HE10_IsoM_v13, fragment.HLT_Photon165_R9Id90_HE10_IsoM_v14, fragment.HLT_Photon90_CaloIdL_PFHT700_v14, fragment.HLT_Diphoton30_22_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass90_v12, fragment.HLT_Diphoton30_22_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass95_v12, fragment.HLT_Diphoton30PV_18PV_R9Id_AND_IsoCaloId_AND_HE_R9Id_PixelVeto_Mass55_v13, fragment.HLT_Diphoton30PV_18PV_R9Id_AND_IsoCaloId_AND_HE_R9Id_NoPixelVeto_Mass55_v12, fragment.HLT_Diphoton30EB_18EB_R9Id_OR_IsoCaloId_AND_HE_R9Id_NoPixelVeto_Mass55_v12, fragment.HLT_Diphoton30EB_18EB_R9Id_OR_IsoCaloId_AND_HE_R9Id_PixelVeto_Mass55_v13, fragment.HLT_Dimuon0_Jpsi_L1_NoOS_v6, fragment.HLT_Dimuon0_Jpsi_NoVertexing_NoOS_v6, fragment.HLT_Dimuon0_Jpsi_v7, fragment.HLT_Dimuon0_Jpsi_NoVertexing_v7, fragment.HLT_Dimuon0_Jpsi_L1_4R_0er1p5R_v6, fragment.HLT_Dimuon0_Jpsi_NoVertexing_L1_4R_0er1p5R_v6, fragment.HLT_Dimuon0_Jpsi3p5_Muon2_v5, fragment.HLT_Dimuon0_Upsilon_L1_4p5_v7, fragment.HLT_Dimuon0_Upsilon_L1_5_v7, fragment.HLT_Dimuon0_Upsilon_L1_4p5NoOS_v6, fragment.HLT_Dimuon0_Upsilon_L1_4p5er2p0_v7, fragment.HLT_Dimuon0_Upsilon_L1_4p5er2p0M_v6, fragment.HLT_Dimuon0_Upsilon_NoVertexing_v6, fragment.HLT_Dimuon0_Upsilon_L1_5M_v6, fragment.HLT_Dimuon0_LowMass_L1_0er1p5R_v6, fragment.HLT_Dimuon0_LowMass_L1_0er1p5_v7, fragment.HLT_Dimuon0_LowMass_v7, fragment.HLT_Dimuon0_LowMass_L1_4_v7, fragment.HLT_Dimuon0_LowMass_L1_4R_v6, fragment.HLT_Dimuon0_LowMass_L1_TM530_v5, fragment.HLT_Dimuon0_Upsilon_Muon_L1_TM0_v5, fragment.HLT_Dimuon0_Upsilon_Muon_NoL1Mass_v5, fragment.HLT_TripleMu_5_3_3_Mass3p8to60_DZ_v7, fragment.HLT_TripleMu_10_5_5_DZ_v9, fragment.HLT_TripleMu_12_10_5_v9, fragment.HLT_Tau3Mu_Mu7_Mu1_TkMu1_Tau15_v2, fragment.HLT_Tau3Mu_Mu7_Mu1_TkMu1_Tau15_Charge1_v2, fragment.HLT_Tau3Mu_Mu7_Mu1_TkMu1_IsoTau15_v2, fragment.HLT_Tau3Mu_Mu7_Mu1_TkMu1_IsoTau15_Charge1_v2, fragment.HLT_DoubleMu3_DZ_PFMET50_PFMHT60_v8, fragment.HLT_DoubleMu3_DZ_PFMET70_PFMHT70_v8, fragment.HLT_DoubleMu3_DZ_PFMET90_PFMHT90_v8, fragment.HLT_DoubleMu3_Trk_Tau3mu_NoL1Mass_v5, fragment.HLT_DoubleMu4_Jpsi_Displaced_v6, fragment.HLT_DoubleMu4_Jpsi_NoVertexing_v6, fragment.HLT_DoubleMu4_JpsiTrkTrk_Displaced_v6, fragment.HLT_DoubleMu43NoFiltersNoVtx_v3, fragment.HLT_DoubleMu48NoFiltersNoVtx_v3, fragment.HLT_Mu43NoFiltersNoVtx_Photon43_CaloIdL_v4, fragment.HLT_Mu48NoFiltersNoVtx_Photon48_CaloIdL_v4, fragment.HLT_DoubleMu20_7_Mass0to30_L1_DM4_v6, fragment.HLT_DoubleMu20_7_Mass0to30_L1_DM4EG_v6, fragment.HLT_HT425_v8, fragment.HLT_HT430_DisplacedDijet40_DisplacedTrack_v11, fragment.HLT_HT500_DisplacedDijet40_DisplacedTrack_v11, fragment.HLT_HT430_DisplacedDijet60_DisplacedTrack_v11, fragment.HLT_HT400_DisplacedDijet40_DisplacedTrack_v11, fragment.HLT_HT650_DisplacedDijet60_Inclusive_v11, fragment.HLT_HT550_DisplacedDijet60_Inclusive_v11, fragment.HLT_DiJet110_35_Mjj650_PFMET110_v7, fragment.HLT_DiJet110_35_Mjj650_PFMET120_v7, fragment.HLT_DiJet110_35_Mjj650_PFMET130_v7, fragment.HLT_TripleJet110_35_35_Mjj650_PFMET110_v7, fragment.HLT_TripleJet110_35_35_Mjj650_PFMET120_v7, fragment.HLT_TripleJet110_35_35_Mjj650_PFMET130_v7, fragment.HLT_VBF_DoubleLooseChargedIsoPFTau20_Trk1_eta2p1_v1, fragment.HLT_VBF_DoubleMediumChargedIsoPFTau20_Trk1_eta2p1_v1, fragment.HLT_VBF_DoubleTightChargedIsoPFTau20_Trk1_eta2p1_v1, fragment.HLT_Ele30_eta2p1_WPTight_Gsf_CentralPFJet35_EleCleaned_v11, fragment.HLT_Ele28_eta2p1_WPTight_Gsf_HT150_v11, fragment.HLT_Ele28_HighEta_SC20_Mass55_v11, fragment.HLT_DoubleMu20_7_Mass0to30_Photon23_v6, fragment.HLT_Ele15_IsoVVVL_PFHT450_CaloBTagCSV_4p5_v7, fragment.HLT_Ele15_IsoVVVL_PFHT450_PFMET50_v14, fragment.HLT_Ele15_IsoVVVL_PFHT450_v14, fragment.HLT_Ele50_IsoVVVL_PFHT450_v14, fragment.HLT_Ele15_IsoVVVL_PFHT600_v18, fragment.HLT_Mu8_TrkIsoVVL_DiPFJet40_DEta3p5_MJJ750_HTT300_PFMETNoMu60_v13, fragment.HLT_Mu10_TrkIsoVVL_DiPFJet40_DEta3p5_MJJ750_HTT350_PFMETNoMu60_v12, fragment.HLT_Mu15_IsoVVVL_PFHT450_CaloBTagCSV_4p5_v7, fragment.HLT_Mu15_IsoVVVL_PFHT450_PFMET50_v13, fragment.HLT_Mu15_IsoVVVL_PFHT450_v13, fragment.HLT_Mu50_IsoVVVL_PFHT450_v13, fragment.HLT_Mu15_IsoVVVL_PFHT600_v17, fragment.HLT_Dimuon10_PsiPrime_Barrel_Seagulls_v6, fragment.HLT_Dimuon20_Jpsi_Barrel_Seagulls_v6, fragment.HLT_Dimuon10_Upsilon_Barrel_Seagulls_v6, fragment.HLT_Dimuon12_Upsilon_eta1p5_v13, fragment.HLT_Dimuon14_Phi_Barrel_Seagulls_v6, fragment.HLT_Dimuon18_PsiPrime_v13, fragment.HLT_Dimuon25_Jpsi_v13, fragment.HLT_Dimuon18_PsiPrime_noCorrL1_v4, fragment.HLT_Dimuon24_Upsilon_noCorrL1_v4, fragment.HLT_Dimuon24_Phi_noCorrL1_v4, fragment.HLT_Dimuon25_Jpsi_noCorrL1_v4, fragment.HLT_DiMu9_Ele9_CaloIdL_TrackIdL_DZ_v15, fragment.HLT_DiMu9_Ele9_CaloIdL_TrackIdL_v15, fragment.HLT_DoubleIsoMu20_eta2p1_v5, fragment.HLT_DoubleIsoMu24_eta2p1_v5, fragment.HLT_TrkMu12_DoubleTrkMu5NoFiltersNoVtx_v5, fragment.HLT_TrkMu16_DoubleTrkMu6NoFiltersNoVtx_v11, fragment.HLT_TrkMu17_DoubleTrkMu8NoFiltersNoVtx_v12, fragment.HLT_Mu8_v11, fragment.HLT_Mu17_v11, fragment.HLT_Mu19_v2, fragment.HLT_Mu17_Photon30_IsoCaloId_v4, fragment.HLT_Ele8_CaloIdL_TrackIdL_IsoVL_PFJet30_v14, fragment.HLT_Ele12_CaloIdL_TrackIdL_IsoVL_PFJet30_v16, fragment.HLT_Ele15_CaloIdL_TrackIdL_IsoVL_PFJet30_v1, fragment.HLT_Ele23_CaloIdL_TrackIdL_IsoVL_PFJet30_v16, fragment.HLT_Ele8_CaloIdM_TrackIdM_PFJet30_v16, fragment.HLT_Ele17_CaloIdM_TrackIdM_PFJet30_v14, fragment.HLT_Ele23_CaloIdM_TrackIdM_PFJet30_v16, fragment.HLT_Ele50_CaloIdVT_GsfTrkIdT_PFJet165_v16, fragment.HLT_Ele115_CaloIdVT_GsfTrkIdT_v12, fragment.HLT_Ele135_CaloIdVT_GsfTrkIdT_v5, fragment.HLT_Ele145_CaloIdVT_GsfTrkIdT_v6, fragment.HLT_Ele200_CaloIdVT_GsfTrkIdT_v6, fragment.HLT_Ele250_CaloIdVT_GsfTrkIdT_v11, fragment.HLT_Ele300_CaloIdVT_GsfTrkIdT_v11, fragment.HLT_PFHT330PT30_QuadPFJet_75_60_45_40_TriplePFBTagDeepCSV_4p5_v1, fragment.HLT_PFHT330PT30_QuadPFJet_75_60_45_40_v7, fragment.HLT_PFHT380_SixPFJet32_DoublePFBTagCSV_2p2_v7, fragment.HLT_PFHT380_SixPFJet32_DoublePFBTagDeepCSV_2p2_v6, fragment.HLT_PFHT380_SixPFJet32_v7, fragment.HLT_PFHT430_SixPFJet40_PFBTagCSV_1p5_v7, fragment.HLT_PFHT430_SixPFJet40_v9, fragment.HLT_PFHT350_v17, fragment.HLT_PFHT350MinPFJet15_v7, fragment.HLT_Photon60_R9Id90_CaloIdL_IsoL_v4, fragment.HLT_Photon60_R9Id90_CaloIdL_IsoL_DisplacedIdL_v4, fragment.HLT_Photon60_R9Id90_CaloIdL_IsoL_DisplacedIdL_PFHT350MinPFJet15_v9, fragment.HLT_FullTrack_Multiplicity85_v3, fragment.HLT_FullTrack_Multiplicity100_v2, fragment.HLT_FullTrack_Multiplicity130_v2, fragment.HLT_FullTrack_Multiplicity155_v3, fragment.HLT_ECALHT800_v9, fragment.HLT_DiSC30_18_EIso_AND_HE_Mass70_v12, fragment.HLT_Physics_v7, fragment.HLT_Physics_part0_v7, fragment.HLT_Physics_part1_v7, fragment.HLT_Physics_part2_v7, fragment.HLT_Physics_part3_v7, fragment.HLT_Physics_part4_v7, fragment.HLT_Physics_part5_v7, fragment.HLT_Physics_part6_v7, fragment.HLT_Physics_part7_v7, fragment.DST_Physics_v7, fragment.HLT_Random_v3, fragment.HLT_ZeroBias_v6, fragment.HLT_ZeroBias_part0_v6, fragment.HLT_ZeroBias_part1_v6, fragment.HLT_ZeroBias_part2_v6, fragment.HLT_ZeroBias_part3_v6, fragment.HLT_ZeroBias_part4_v6, fragment.HLT_ZeroBias_part5_v6, fragment.HLT_ZeroBias_part6_v6, fragment.HLT_ZeroBias_part7_v6, fragment.DST_ZeroBias_v2, fragment.DST_HT250_CaloScouting_v9, fragment.DST_HT250_CaloBTagScouting_v8, fragment.DST_HT410_PFScouting_v14, fragment.DST_HT410_BTagScouting_v14, fragment.DST_ZeroBias_BTagScouting_v13, fragment.DST_ZeroBias_CaloScouting_PFScouting_v12, fragment.DST_CaloJet40_BTagScouting_v13, fragment.DST_CaloJet40_CaloScouting_PFScouting_v13, fragment.DST_CaloJet40_CaloBTagScouting_v12, fragment.DST_L1HTT_BTagScouting_v13, fragment.DST_L1HTT_CaloScouting_PFScouting_v13, fragment.DST_L1HTT_CaloBTagScouting_v12, fragment.DST_L1DoubleMu_BTagScouting_v14, fragment.DST_L1DoubleMu_CaloScouting_PFScouting_v13, fragment.DST_DoubleMu3_noVtx_CaloScouting_Monitoring_v5, fragment.DST_DoubleMu3_noVtx_CaloScouting_v5, fragment.DST_DoubleMu1_noVtx_CaloScouting_v1, fragment.DST_DoubleMu3_noVtx_Mass10_PFScouting_v1, fragment.HLT_AK4CaloJet30_v11, fragment.HLT_AK4CaloJet40_v10, fragment.HLT_AK4CaloJet50_v10, fragment.HLT_AK4CaloJet80_v10, fragment.HLT_AK4CaloJet100_v10, fragment.HLT_AK4CaloJet120_v9, fragment.HLT_AK4PFJet30_v17, fragment.HLT_AK4PFJet50_v17, fragment.HLT_AK4PFJet80_v17, fragment.HLT_AK4PFJet100_v17, fragment.HLT_AK4PFJet120_v16, fragment.HLT_SinglePhoton10_Eta3p1ForPPRef_v8, fragment.HLT_SinglePhoton20_Eta3p1ForPPRef_v8, fragment.HLT_SinglePhoton30_Eta3p1ForPPRef_v8, fragment.HLT_Photon20_HoverELoose_v9, fragment.HLT_Photon30_HoverELoose_v9, fragment.HLT_EcalCalibration_v4, fragment.HLT_HcalCalibration_v5, fragment.AlCa_EcalPhiSym_v8, fragment.HLT_L1UnpairedBunchBptxMinus_v2, fragment.HLT_L1UnpairedBunchBptxPlus_v2, fragment.HLT_L1NotBptxOR_v3, fragment.HLT_L1MinimumBiasHF_OR_v2, fragment.HLT_L1MinimumBiasHF0OR_v3, fragment.HLT_L1_CDC_SingleMu_3_er1p2_TOP120_DPHI2p618_3p142_v2, fragment.HLT_HcalNZS_v12, fragment.HLT_HcalPhiSym_v14, fragment.HLT_HcalIsolatedbunch_v4, fragment.HLT_IsoTrackHB_v3, fragment.HLT_IsoTrackHE_v3, fragment.HLT_ZeroBias_FirstCollisionAfterAbortGap_v5, fragment.HLT_ZeroBias_IsolatedBunches_v5, fragment.HLT_ZeroBias_FirstCollisionInTrain_v4, fragment.HLT_ZeroBias_LastCollisionInTrain_v3, fragment.HLT_ZeroBias_FirstBXAfterTrain_v3, fragment.AlCa_RPCMuonNormalisation_v13, fragment.AlCa_LumiPixels_Random_v4, fragment.AlCa_LumiPixels_ZeroBias_v8, fragment.MC_ReducedIterativeTracking_v11, fragment.MC_PFMET_v15, fragment.MC_AK4PFJets_v15, fragment.MC_PFBTagCSV_v9, fragment.MC_PFHT_v14, fragment.MC_PFMHT_v14, fragment.MC_CaloMET_v8, fragment.MC_CaloMET_JetIdCleaned_v9, fragment.MC_AK4CaloJets_v9, fragment.MC_AK4CaloJetsFromPV_v7, fragment.MC_CaloBTagCSV_v7, fragment.MC_CaloHT_v8, fragment.MC_CaloMHT_v8, fragment.MC_AK8PFJets_v15, fragment.MC_AK8TrimPFJets_v15, fragment.MC_AK8PFHT_v14, fragment.MC_AK8CaloHT_v8, fragment.MC_Diphoton10_10_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass10_v12, fragment.MC_DoubleEle5_CaloIdL_MW_v13, fragment.MC_Ele5_WPTight_Gsf_v6, fragment.MC_Ele15_Ele10_CaloIdL_TrackIdL_IsoVL_DZ_v13, fragment.MC_IsoMu_v13, fragment.MC_DoubleMu_TrkIsoVVL_DZ_v10, fragment.MC_DoubleMuNoFiltersNoVtx_v7, fragment.AlCa_EcalPi0EBonly_v12, fragment.AlCa_EcalPi0EEonly_v12, fragment.AlCa_EcalEtaEBonly_v12, fragment.AlCa_EcalEtaEEonly_v12, fragment.HLT_Ele24_eta2p1_WPTight_Gsf_LooseChargedIsoPFTau30_eta2p1_CrossL1_v11, fragment.HLT_Ele24_eta2p1_WPTight_Gsf_MediumChargedIsoPFTau30_eta2p1_CrossL1_v11, fragment.HLT_Ele24_eta2p1_WPTight_Gsf_TightChargedIsoPFTau30_eta2p1_CrossL1_v11, fragment.HLT_Ele24_eta2p1_WPTight_Gsf_LooseChargedIsoPFTau30_eta2p1_TightID_CrossL1_v11, fragment.HLT_Ele24_eta2p1_WPTight_Gsf_MediumChargedIsoPFTau30_eta2p1_TightID_CrossL1_v11, fragment.HLT_Ele24_eta2p1_WPTight_Gsf_TightChargedIsoPFTau30_eta2p1_TightID_CrossL1_v11, fragment.HLT_DoubleMediumChargedIsoPFTau35_Trk1_eta2p1_Reg_v10, fragment.HLT_DoubleMediumChargedIsoPFTau40_Trk1_eta2p1_Reg_v10, fragment.HLT_DoubleTightChargedIsoPFTau35_Trk1_eta2p1_Reg_v10, fragment.HLT_DoubleTightChargedIsoPFTau40_Trk1_eta2p1_Reg_v10, fragment.HLT_DoubleMediumChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_v10, fragment.HLT_DoubleMediumChargedIsoPFTau40_Trk1_TightID_eta2p1_Reg_v10, fragment.HLT_DoubleTightChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_v10, fragment.HLT_DoubleTightChargedIsoPFTau40_Trk1_TightID_eta2p1_Reg_v10, fragment.HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_v10, fragment.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET90_v10, fragment.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET100_v10, fragment.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET110_v6, fragment.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET120_v6, fragment.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET130_v6, fragment.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET140_v1, fragment.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_v10, fragment.HLT_MediumChargedIsoPFTau180HighPtRelaxedIso_Trk50_eta2p1_1pr_v9, fragment.HLT_MediumChargedIsoPFTau180HighPtRelaxedIso_Trk50_eta2p1_v10, fragment.HLT_MediumChargedIsoPFTau200HighPtRelaxedIso_Trk50_eta2p1_v10, fragment.HLT_MediumChargedIsoPFTau220HighPtRelaxedIso_Trk50_eta2p1_v10, fragment.HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau35_Trk1_eta2p1_Reg_CrossL1_v10, fragment.HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_CrossL1_v10, fragment.HLT_IsoMu24_eta2p1_TightChargedIsoPFTau35_Trk1_eta2p1_Reg_CrossL1_v10, fragment.HLT_IsoMu24_eta2p1_TightChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_CrossL1_v10, fragment.HLT_Ele16_Ele12_Ele8_CaloIdL_TrackIdL_v7, fragment.HLT_Rsq0p35_v13, fragment.HLT_Rsq0p40_v13, fragment.HLT_RsqMR300_Rsq0p09_MR200_v13, fragment.HLT_RsqMR320_Rsq0p09_MR200_v13, fragment.HLT_RsqMR300_Rsq0p09_MR200_4jet_v13, fragment.HLT_RsqMR320_Rsq0p09_MR200_4jet_v13, fragment.HLT_IsoMu27_LooseChargedIsoPFTau20_Trk1_eta2p1_SingleL1_v3, fragment.HLT_IsoMu27_MediumChargedIsoPFTau20_Trk1_eta2p1_SingleL1_v3, fragment.HLT_IsoMu27_TightChargedIsoPFTau20_Trk1_eta2p1_SingleL1_v3, fragment.HLT_IsoMu27_MET90_v1, fragment.HLT_IsoMu20_eta2p1_LooseChargedIsoPFTauHPS27_eta2p1_CrossL1_v1, fragment.HLT_IsoMu24_eta2p1_MediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_CrossL1_v1, fragment.HLT_DoubleMediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_v1, fragment.HLT_Photon50_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ300DEta3_PFMET50_v3, fragment.HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ300DEta3_v3, fragment.HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ600DEta3_v3, fragment.HLT_PFMET100_PFMHT100_IDTight_PFHT60_v7, fragment.HLT_PFMETNoMu100_PFMHTNoMu100_IDTight_PFHT60_v7, fragment.HLT_PFMETTypeOne100_PFMHT100_IDTight_PFHT60_v7, fragment.HLT_Mu18_Mu9_SameSign_v3, fragment.HLT_Mu18_Mu9_SameSign_DZ_v3, fragment.HLT_Mu18_Mu9_v3, fragment.HLT_Mu18_Mu9_DZ_v3, fragment.HLT_Mu20_Mu10_SameSign_v3, fragment.HLT_Mu20_Mu10_SameSign_DZ_v3, fragment.HLT_Mu20_Mu10_v3, fragment.HLT_Mu20_Mu10_DZ_v3, fragment.HLT_Mu23_Mu12_SameSign_v3, fragment.HLT_Mu23_Mu12_SameSign_DZ_v3, fragment.HLT_Mu23_Mu12_v3, fragment.HLT_Mu23_Mu12_DZ_v3, fragment.HLT_DoubleMu2_Jpsi_DoubleTrk1_Phi1p05_v5, fragment.HLT_DoubleMu2_Jpsi_DoubleTkMu0_Phi_v3, fragment.HLT_DoubleMu3_DCA_PFMET50_PFMHT60_v8, fragment.HLT_TripleMu_5_3_3_Mass3p8to60_DCA_v2, fragment.HLT_QuadPFJet98_83_71_15_DoubleBTagCSV_p013_p08_VBF1_v7, fragment.HLT_QuadPFJet103_88_75_15_DoubleBTagCSV_p013_p08_VBF1_v7, fragment.HLT_QuadPFJet105_90_76_15_DoubleBTagCSV_p013_p08_VBF1_v7, fragment.HLT_QuadPFJet111_90_80_15_DoubleBTagCSV_p013_p08_VBF1_v7, fragment.HLT_QuadPFJet98_83_71_15_BTagCSV_p013_VBF2_v7, fragment.HLT_QuadPFJet103_88_75_15_BTagCSV_p013_VBF2_v7, fragment.HLT_QuadPFJet105_88_76_15_BTagCSV_p013_VBF2_v7, fragment.HLT_QuadPFJet111_90_80_15_BTagCSV_p013_VBF2_v7, fragment.HLT_QuadPFJet98_83_71_15_v3, fragment.HLT_QuadPFJet103_88_75_15_v3, fragment.HLT_QuadPFJet105_88_76_15_v3, fragment.HLT_QuadPFJet111_90_80_15_v3, fragment.HLT_AK8PFJet330_TrimMass30_PFAK8BTagCSV_p17_v1, fragment.HLT_AK8PFJet330_TrimMass30_PFAK8BTagCSV_p1_v1, fragment.HLT_AK8PFJet330_TrimMass30_PFAK8BoostedDoubleB_p02_v1, fragment.HLT_Diphoton30_18_PVrealAND_R9Id_AND_IsoCaloId_AND_HE_R9Id_PixelVeto_Mass55_v8, fragment.HLT_Diphoton30_18_PVrealAND_R9Id_AND_IsoCaloId_AND_HE_R9Id_NoPixelVeto_Mass55_v8, fragment.HLTriggerFinalPath, fragment.HLTAnalyzerEndpath, fragment.ScoutingPFOutput, fragment.ScoutingCaloMuonOutput )) # dummyfy hltGetConditions in cff's diff --git a/HLTrigger/Configuration/python/HLT_HIon_cff.py b/HLTrigger/Configuration/python/HLT_HIon_cff.py index b23a10740e669..90e9591689b0d 100644 --- a/HLTrigger/Configuration/python/HLT_HIon_cff.py +++ b/HLTrigger/Configuration/python/HLT_HIon_cff.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --cff --data /dev/CMSSW_10_0_0/HIon --type HIon +# hltGetConfiguration --cff --data /dev/CMSSW_10_1_0/HIon --type HIon -# /dev/CMSSW_10_0_0/HIon/V42 (CMSSW_10_0_4) +# /dev/CMSSW_10_1_0/HIon/V1 (CMSSW_10_1_0) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_10_0_0/HIon/V42') + tableName = cms.string('/dev/CMSSW_10_1_0/HIon/V1') ) fragment.transferSystem = cms.PSet( @@ -2477,13 +2477,13 @@ 'HcalCellDead' ) ) fragment.hltCombinedSecondaryVertex = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -2496,7 +2496,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( -99999.9 ), + sip2dSigMin = cms.double( 2.0 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -2505,12 +2505,12 @@ 'CombinedSVPseudoVertex', 'CombinedSVNoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -2523,7 +2523,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( 2.0 ), + sip2dSigMin = cms.double( -99999.9 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -2533,13 +2533,13 @@ trackFlip = cms.bool( False ) ) fragment.hltCombinedSecondaryVertexV2 = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -2565,18 +2565,18 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( -99999.9 ) + sip2dSigMin = cms.double( 2.0 ) ), calibrationRecords = cms.vstring( 'CombinedSVIVFV2RecoVertex', 'CombinedSVIVFV2PseudoVertex', 'CombinedSVIVFV2NoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -2602,7 +2602,7 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( 2.0 ) + sip2dSigMin = cms.double( -99999.9 ) ), trackSort = cms.string( "sip2dSig" ), SoftLeptonFlip = cms.bool( False ), diff --git a/HLTrigger/Configuration/python/HLT_PIon_cff.py b/HLTrigger/Configuration/python/HLT_PIon_cff.py index c3185df64dd82..9afccc5baa389 100644 --- a/HLTrigger/Configuration/python/HLT_PIon_cff.py +++ b/HLTrigger/Configuration/python/HLT_PIon_cff.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --cff --data /dev/CMSSW_10_0_0/PIon --type PIon +# hltGetConfiguration --cff --data /dev/CMSSW_10_1_0/PIon --type PIon -# /dev/CMSSW_10_0_0/PIon/V42 (CMSSW_10_0_4) +# /dev/CMSSW_10_1_0/PIon/V1 (CMSSW_10_1_0) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_10_0_0/PIon/V42') + tableName = cms.string('/dev/CMSSW_10_1_0/PIon/V1') ) fragment.transferSystem = cms.PSet( @@ -2477,13 +2477,13 @@ 'HcalCellDead' ) ) fragment.hltCombinedSecondaryVertex = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -2496,7 +2496,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( -99999.9 ), + sip2dSigMin = cms.double( 2.0 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -2505,12 +2505,12 @@ 'CombinedSVPseudoVertex', 'CombinedSVNoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -2523,7 +2523,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( 2.0 ), + sip2dSigMin = cms.double( -99999.9 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -2533,13 +2533,13 @@ trackFlip = cms.bool( False ) ) fragment.hltCombinedSecondaryVertexV2 = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -2565,18 +2565,18 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( -99999.9 ) + sip2dSigMin = cms.double( 2.0 ) ), calibrationRecords = cms.vstring( 'CombinedSVIVFV2RecoVertex', 'CombinedSVIVFV2PseudoVertex', 'CombinedSVIVFV2NoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -2602,7 +2602,7 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( 2.0 ) + sip2dSigMin = cms.double( -99999.9 ) ), trackSort = cms.string( "sip2dSig" ), SoftLeptonFlip = cms.bool( False ), diff --git a/HLTrigger/Configuration/python/HLT_PRef_cff.py b/HLTrigger/Configuration/python/HLT_PRef_cff.py index aab428df316d9..866ed65e78eb1 100644 --- a/HLTrigger/Configuration/python/HLT_PRef_cff.py +++ b/HLTrigger/Configuration/python/HLT_PRef_cff.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --cff --data /dev/CMSSW_10_0_0/PRef --type PRef +# hltGetConfiguration --cff --data /dev/CMSSW_10_1_0/PRef --type PRef -# /dev/CMSSW_10_0_0/PRef/V42 (CMSSW_10_0_4) +# /dev/CMSSW_10_1_0/PRef/V1 (CMSSW_10_1_0) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_10_0_0/PRef/V42') + tableName = cms.string('/dev/CMSSW_10_1_0/PRef/V1') ) fragment.transferSystem = cms.PSet( @@ -2842,13 +2842,13 @@ 'HcalCellDead' ) ) fragment.hltCombinedSecondaryVertex = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -2861,7 +2861,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( -99999.9 ), + sip2dSigMin = cms.double( 2.0 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -2870,12 +2870,12 @@ 'CombinedSVPseudoVertex', 'CombinedSVNoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -2888,7 +2888,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( 2.0 ), + sip2dSigMin = cms.double( -99999.9 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -2898,13 +2898,13 @@ trackFlip = cms.bool( False ) ) fragment.hltCombinedSecondaryVertexV2 = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -2930,18 +2930,18 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( -99999.9 ) + sip2dSigMin = cms.double( 2.0 ) ), calibrationRecords = cms.vstring( 'CombinedSVIVFV2RecoVertex', 'CombinedSVIVFV2PseudoVertex', 'CombinedSVIVFV2NoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -2967,7 +2967,7 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( 2.0 ) + sip2dSigMin = cms.double( -99999.9 ) ), trackSort = cms.string( "sip2dSig" ), SoftLeptonFlip = cms.bool( False ), @@ -4417,9 +4417,11 @@ logWarningEtThreshold_EE_FE = cms.double( 50.0 ) ) fragment.hltHcalDigis = cms.EDProducer( "HcalRawToDigi", + saveQIE10DataNSamples = cms.untracked.vint32( ), ExpectedOrbitMessageTime = cms.untracked.int32( -1 ), FilterDataQuality = cms.bool( True ), silent = cms.untracked.bool( True ), + saveQIE11DataNSamples = cms.untracked.vint32( ), HcalFirstFED = cms.untracked.int32( 700 ), InputLabel = cms.InputTag( "rawDataCollector" ), ComplainEmptyData = cms.untracked.bool( False ), @@ -4427,10 +4429,12 @@ UnpackCalib = cms.untracked.bool( True ), UnpackUMNio = cms.untracked.bool( True ), FEDs = cms.untracked.vint32( ), - UnpackerMode = cms.untracked.int32( 0 ), + saveQIE11DataTags = cms.untracked.vstring( ), UnpackTTP = cms.untracked.bool( False ), - lastSample = cms.int32( 9 ), UnpackZDC = cms.untracked.bool( True ), + saveQIE10DataTags = cms.untracked.vstring( ), + lastSample = cms.int32( 9 ), + UnpackerMode = cms.untracked.int32( 0 ), firstSample = cms.int32( 0 ) ) fragment.hltHbhePhase1Reco = cms.EDProducer( "HBHEPhase1Reconstructor", @@ -12373,15 +12377,15 @@ ) fragment.hltSiPixelClustersAfterSplittingForRefPP = cms.EDProducer( "JetCoreClusterSplitter", verbose = cms.bool( False ), - deltaRmax = cms.double( 0.05 ), + chargeFractionMin = cms.double( 2.0 ), forceXError = cms.double( 100.0 ), vertices = cms.InputTag( "hltFullIter0PrimaryVerticesPreSplittingForRefPP" ), chargePerUnit = cms.double( 2000.0 ), - forceYError = cms.double( 150.0 ), centralMIPCharge = cms.double( 26000.0 ), + forceYError = cms.double( 150.0 ), pixelClusters = cms.InputTag( "hltSiPixelClustersForRefPP" ), ptMin = cms.double( 200.0 ), - chargeFractionMin = cms.double( 2.0 ), + deltaRmax = cms.double( 0.05 ), cores = cms.InputTag( "hltJetsForCoreTracking" ), fractionalWidth = cms.double( 0.4 ), pixelCPE = cms.string( "hltESPPixelCPEGeneric" ) @@ -17189,11 +17193,13 @@ GsfTrackProducer = cms.InputTag( "hltEgammaGsfTracks" ) ) fragment.hltEgammaGsfTrackVars = cms.EDProducer( "EgammaHLTGsfTrackVarProducer", - recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidates" ), - beamSpotProducer = cms.InputTag( "hltOnlineBeamSpot" ), upperTrackNrToRemoveCut = cms.int32( 9999 ), + useDefaultValuesForEndcap = cms.bool( False ), lowerTrackNrToRemoveCut = cms.int32( -1 ), - inputCollection = cms.InputTag( "hltEgammaGsfTracks" ) + inputCollection = cms.InputTag( "hltEgammaGsfTracks" ), + recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidates" ), + beamSpotProducer = cms.InputTag( "hltOnlineBeamSpot" ), + useDefaultValuesForBarrel = cms.bool( False ) ) fragment.hltEle10WPLoose1GsfOneOEMinusOneOPFilterForHI = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), diff --git a/HLTrigger/Configuration/python/HLTrigger_Datasets_GRun_cff.py b/HLTrigger/Configuration/python/HLTrigger_Datasets_GRun_cff.py index b665efed5c9fd..71d6d6843a6e2 100644 --- a/HLTrigger/Configuration/python/HLTrigger_Datasets_GRun_cff.py +++ b/HLTrigger/Configuration/python/HLTrigger_Datasets_GRun_cff.py @@ -1,4 +1,4 @@ -# /dev/CMSSW_10_0_0/GRun +# /dev/CMSSW_10_1_0/GRun import FWCore.ParameterSet.Config as cms @@ -733,6 +733,8 @@ 'HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_v1', 'HLT_DoubleL2Mu25NoVtx_2Cha_Eta2p4_v1', 'HLT_DoubleL2Mu25NoVtx_2Cha_v1', + 'HLT_DoubleL2Mu30NoVtx_2Cha_CosmicSeed_Eta2p4_v1', + 'HLT_DoubleL2Mu30NoVtx_2Cha_Eta2p4_v1', 'HLT_DoubleL2Mu50_v2', 'HLT_DoubleMu3_DCA_PFMET50_PFMHT60_v8', 'HLT_DoubleMu3_DZ_PFMET50_PFMHT60_v8', diff --git a/HLTrigger/Configuration/python/HLTrigger_Datasets_HIon_cff.py b/HLTrigger/Configuration/python/HLTrigger_Datasets_HIon_cff.py index 278cb00d53f18..1985e34c4bee7 100644 --- a/HLTrigger/Configuration/python/HLTrigger_Datasets_HIon_cff.py +++ b/HLTrigger/Configuration/python/HLTrigger_Datasets_HIon_cff.py @@ -1,4 +1,4 @@ -# /dev/CMSSW_10_0_0/HIon +# /dev/CMSSW_10_1_0/HIon import FWCore.ParameterSet.Config as cms diff --git a/HLTrigger/Configuration/python/HLTrigger_Datasets_PIon_cff.py b/HLTrigger/Configuration/python/HLTrigger_Datasets_PIon_cff.py index 8751a3b1b2ad0..6b7d12db93cd8 100644 --- a/HLTrigger/Configuration/python/HLTrigger_Datasets_PIon_cff.py +++ b/HLTrigger/Configuration/python/HLTrigger_Datasets_PIon_cff.py @@ -1,4 +1,4 @@ -# /dev/CMSSW_10_0_0/PIon +# /dev/CMSSW_10_1_0/PIon import FWCore.ParameterSet.Config as cms diff --git a/HLTrigger/Configuration/python/HLTrigger_Datasets_PRef_cff.py b/HLTrigger/Configuration/python/HLTrigger_Datasets_PRef_cff.py index 71fb8fb036b3c..50ae0168627a5 100644 --- a/HLTrigger/Configuration/python/HLTrigger_Datasets_PRef_cff.py +++ b/HLTrigger/Configuration/python/HLTrigger_Datasets_PRef_cff.py @@ -1,4 +1,4 @@ -# /dev/CMSSW_10_0_0/PRef +# /dev/CMSSW_10_1_0/PRef import FWCore.ParameterSet.Config as cms diff --git a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py index 677eb44aba50f..c1dc21197ea2f 100644 --- a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py +++ b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py @@ -55,36 +55,6 @@ def customiseForUncollapsed(process): return process -def customiseFor22621_forIsoTrackHBHE(process): - """Adapt the HLT to run with different setting - of thresholds for EB/EE in """ - - for producer in producers_by_type(process, "IsolatedEcalPixelTrackCandidateProducer"): - del producer.ECHitEnergyThreshold - del producer.ECHitCountEnergyThreshold - del producer.EcalConeSizeEta0 - del producer.EcalConeSizeEta1 - producer.EBHitEnergyThreshold = cms.double(0.10) - producer.EBHitCountEnergyThreshold = cms.double(0.5) - producer.EEHitEnergyThreshold0 = cms.double(-20.5332) - producer.EEHitEnergyThreshold1 = cms.double(34.3975) - producer.EEHitEnergyThreshold2 = cms.double(-19.0741) - producer.EEHitEnergyThreshold3 = cms.double(3.52151) - producer.EEFacHitCountEnergyThreshold= cms.double(10.0) - producer.EcalConeSizeEta0 = cms.double(0.09) - producer.EcalConeSizeEta1 = cms.double(0.14) - - for filter in filters_by_type(process, "HLTEcalPixelIsolTrackFilter"): - del filter.MaxEnergyIn - del filter.MaxEnergyOut - filter.MaxEnergyInEB = cms.double( 2.0 ) - filter.MaxEnergyOutEB = cms.double( 1.2 ) - filter.MaxEnergyInEE = cms.double( 2.0 ) - filter.MaxEnergyOutEE = cms.double( 1.2 ) - - return process - - def customiseFor21664_forMahiOn(process): for producer in producers_by_type(process, "HBHEPhase1Reconstructor"): producer.algorithm.useMahi = cms.bool(True) diff --git a/HLTrigger/Configuration/tables/GRun.txt b/HLTrigger/Configuration/tables/GRun.txt index edb0621876402..d3f04564e0e58 100644 --- a/HLTrigger/Configuration/tables/GRun.txt +++ b/HLTrigger/Configuration/tables/GRun.txt @@ -612,6 +612,10 @@ HLT_DoubleL2Mu25NoVtx_2Cha_v* # CMSHLT-1727 HLT_DoubleL2Mu25NoVtx_2Cha_Eta2p4_v* # CMSHLT-1727 HLT_PFHT330PT30_QuadPFJet_75_60_45_40_TriplePFBTagDeepCSV_4p5_v* # CMSHLT-1743 HLT_PFHT330PT30_QuadPFJet_75_60_45_40_v* # CMSHLT-1743 +HLT_L2Mu23NoVtx_2Cha_v* # CMSHLT-1727 +HLT_L2Mu23NoVtx_2Cha_CosmicSeed_v* # CMSHLT-1727 +HLT_DoubleL2Mu30NoVtx_2Cha_CosmicSeed_Eta2p4_v* # CMSHLT-1727 +HLT_DoubleL2Mu30NoVtx_2Cha_Eta2p4_v* # CMSHLT-1727 ## EndPath ## diff --git a/HLTrigger/Configuration/tables/makeOnlineGRun b/HLTrigger/Configuration/tables/makeOnlineGRun index ac547e3096f29..082e3d0576595 100755 --- a/HLTrigger/Configuration/tables/makeOnlineGRun +++ b/HLTrigger/Configuration/tables/makeOnlineGRun @@ -4,7 +4,7 @@ # MASTER="/dev/CMSSW_9_2_0/HLT" # no version, take the latest one -TARGET="/online/collisions/2017/2e34/v4.0/HLT" # where to store the online-compliant menu +TARGET="/online/collisions/2018/2e34/v1.0/HLT" # where to store the online-compliant menu TABLES="online_grun" source subtables.sh diff --git a/HLTrigger/Configuration/tables/makeSubTables b/HLTrigger/Configuration/tables/makeSubTables index b935eca6b3da9..b85551263028e 100755 --- a/HLTrigger/Configuration/tables/makeSubTables +++ b/HLTrigger/Configuration/tables/makeSubTables @@ -3,9 +3,9 @@ # generate HLT tables from master table in ConfDB # -MASTER="/dev/CMSSW_10_0_0/HLT" # no version, take the latest one +MASTER="/dev/CMSSW_10_1_0/HLT" # no version, take the latest one #MASTER="/users/sdonato/STORM/menuV1p1/HLT" -TARGET="/dev/CMSSW_10_0_0/TABLE" # directory where to store the sub-tables +TARGET="/dev/CMSSW_10_1_0/TABLE" # directory where to store the sub-tables TABLES="GRun HIon PIon PRef" # which sub-tables to create source subtables.sh diff --git a/HLTrigger/Configuration/tables/online_grun.txt b/HLTrigger/Configuration/tables/online_grun.txt index d83cf526d79ad..20e9e20c20e87 100644 --- a/HLTrigger/Configuration/tables/online_grun.txt +++ b/HLTrigger/Configuration/tables/online_grun.txt @@ -614,6 +614,10 @@ HLT_DoubleL2Mu25NoVtx_2Cha_v* # CMSHLT-1727 HLT_DoubleL2Mu25NoVtx_2Cha_Eta2p4_v* # CMSHLT-1727 HLT_PFHT330PT30_QuadPFJet_75_60_45_40_TriplePFBTagDeepCSV_4p5_v* # CMSHLT-1743 HLT_PFHT330PT30_QuadPFJet_75_60_45_40_v* # CMSHLT-1743 +HLT_L2Mu23NoVtx_2Cha_v* # CMSHLT-1727 +HLT_L2Mu23NoVtx_2Cha_CosmicSeed_v* # CMSHLT-1727 +HLT_DoubleL2Mu30NoVtx_2Cha_CosmicSeed_Eta2p4_v* # CMSHLT-1727 +HLT_DoubleL2Mu30NoVtx_2Cha_Eta2p4_v* # CMSHLT-1727 ## EndPath ## diff --git a/HLTrigger/Configuration/test/OnLine_HLT_FULL.py b/HLTrigger/Configuration/test/OnLine_HLT_FULL.py index 07046c6fd9842..6396da0f67543 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_FULL.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_FULL.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --full --data /dev/CMSSW_10_0_0/HLT --type FULL --unprescale --process HLTFULL --globaltag auto:run2_hlt_FULL --input file:RelVal_Raw_FULL_DATA.root +# hltGetConfiguration --full --data /dev/CMSSW_10_1_0/HLT --type FULL --unprescale --process HLTFULL --globaltag auto:run2_hlt_FULL --input file:RelVal_Raw_FULL_DATA.root -# /dev/CMSSW_10_0_0/HLT/V140 (CMSSW_10_0_4) +# /dev/CMSSW_10_1_0/HLT/V3 (CMSSW_10_1_0) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTFULL" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_10_0_0/HLT/V140') + tableName = cms.string('/dev/CMSSW_10_1_0/HLT/V3') ) process.transferSystem = cms.PSet( @@ -4532,13 +4532,13 @@ ) process.hcal_db_producer = cms.ESProducer( "HcalDbProducer" ) process.hltCombinedSecondaryVertex = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -4551,7 +4551,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( -99999.9 ), + sip2dSigMin = cms.double( 2.0 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -4560,12 +4560,12 @@ 'CombinedSVPseudoVertex', 'CombinedSVNoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -4578,7 +4578,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( 2.0 ), + sip2dSigMin = cms.double( -99999.9 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -4588,13 +4588,13 @@ trackFlip = cms.bool( False ) ) process.hltCombinedSecondaryVertexV2 = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -4620,18 +4620,18 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( -99999.9 ) + sip2dSigMin = cms.double( 2.0 ) ), calibrationRecords = cms.vstring( 'CombinedSVIVFV2RecoVertex', 'CombinedSVIVFV2PseudoVertex', 'CombinedSVIVFV2NoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -4657,7 +4657,7 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( 2.0 ) + sip2dSigMin = cms.double( -99999.9 ) ), trackSort = cms.string( "sip2dSig" ), SoftLeptonFlip = cms.bool( False ), @@ -6252,9 +6252,11 @@ logWarningEtThreshold_EE_FE = cms.double( 50.0 ) ) process.hltHcalDigis = cms.EDProducer( "HcalRawToDigi", + saveQIE10DataNSamples = cms.untracked.vint32( ), ExpectedOrbitMessageTime = cms.untracked.int32( -1 ), FilterDataQuality = cms.bool( True ), silent = cms.untracked.bool( True ), + saveQIE11DataNSamples = cms.untracked.vint32( ), HcalFirstFED = cms.untracked.int32( 700 ), InputLabel = cms.InputTag( "rawDataCollector" ), ComplainEmptyData = cms.untracked.bool( False ), @@ -6262,10 +6264,12 @@ UnpackCalib = cms.untracked.bool( True ), UnpackUMNio = cms.untracked.bool( True ), FEDs = cms.untracked.vint32( ), - UnpackerMode = cms.untracked.int32( 0 ), + saveQIE11DataTags = cms.untracked.vstring( ), UnpackTTP = cms.untracked.bool( False ), - lastSample = cms.int32( 9 ), UnpackZDC = cms.untracked.bool( True ), + saveQIE10DataTags = cms.untracked.vstring( ), + lastSample = cms.int32( 9 ), + UnpackerMode = cms.untracked.int32( 0 ), firstSample = cms.int32( 0 ) ) process.hltHbhePhase1Reco = cms.EDProducer( "HBHEPhase1Reconstructor", @@ -13052,11 +13056,13 @@ GsfTrackProducer = cms.InputTag( "hltEgammaGsfTracks" ) ) process.hltEgammaGsfTrackVars = cms.EDProducer( "EgammaHLTGsfTrackVarProducer", - recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidates" ), - beamSpotProducer = cms.InputTag( "hltOnlineBeamSpot" ), upperTrackNrToRemoveCut = cms.int32( 9999 ), + useDefaultValuesForEndcap = cms.bool( False ), lowerTrackNrToRemoveCut = cms.int32( -1 ), - inputCollection = cms.InputTag( "hltEgammaGsfTracks" ) + inputCollection = cms.InputTag( "hltEgammaGsfTracks" ), + recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidates" ), + beamSpotProducer = cms.InputTag( "hltOnlineBeamSpot" ), + useDefaultValuesForBarrel = cms.bool( False ) ) process.hltDiMu5Ele3CaloIdLTrackIdLElectronlegOneOEMinusOneOPFilter = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), @@ -38905,6 +38911,7 @@ lMinHighEHitTime = cms.double( -9999.0 ), fillLaserMonitor = cms.bool( True ), tMinHPDHits = cms.int32( 16 ), + tRBXRecHitR45Cuts = cms.vdouble( 0.0, 1.0, 0.0, -0.2, 0.0, 0.0, 1.0, -0.2 ), minRecHitE = cms.double( 1.5 ), pMaxHighEHitTime = cms.double( 5.0 ), lRBXRecHitR45Cuts = cms.vdouble( 0.0, 1.0, 0.0, -0.5, 0.0, 0.0, 1.0, -0.5 ), @@ -38918,12 +38925,13 @@ maxNHF = cms.double( 0.9 ), minHighHitE = cms.double( 25.0 ), minR45HitE = cms.double( 5.0 ), - tRBXRecHitR45Cuts = cms.vdouble( 0.0, 1.0, 0.0, -0.2, 0.0, 0.0, 1.0, -0.2 ), + lasermonDigis = cms.InputTag( 'hltHcalDigis','LASERMON' ), lMinZeros = cms.int32( 10 ), lMinRBXHits = cms.int32( 999 ), fillRecHits = cms.bool( True ), minERatio = cms.double( 50.0 ), TS4TS5LowerThreshold = cms.vdouble( 100.0, 120.0, 150.0, 200.0, 300.0, 400.0, 500.0 ), + hlMaxRBXEMF = cms.double( 0.01 ), lMinHPDNoOtherHits = cms.int32( 10 ), pMinRBXRechitR45EnergyFraction = cms.double( 0.1 ), hlMaxHPDEMF = cms.double( -9999.0 ), @@ -38933,7 +38941,6 @@ laserMonIEtaList = cms.vint32( 0, 0, 0, 0, 0, 0, 0, 0 ), laserMonIPhiList = cms.vint32( 23, 17, 11, 5, 29, 35, 41, 47 ), pMinRatio = cms.double( 0.75 ), - tMinLowEHitTime = cms.double( -9999.0 ), HcalAcceptSeverityLevel = cms.uint32( 9 ), pMaxRBXEMF = cms.double( 0.02 ), tMaxRatio = cms.double( 0.92 ), @@ -38966,7 +38973,7 @@ tMinHPDNoOtherHits = cms.int32( 9 ), pMaxHPDEMF = cms.double( 0.02 ), jetCollName = cms.string( "" ), - hlMaxRBXEMF = cms.double( 0.01 ), + tMinLowEHitTime = cms.double( -9999.0 ), tMaxHighEHitTime = cms.double( 6.0 ), pMaxLowEHitTime = cms.double( 6.0 ), lMinHPDHits = cms.int32( 17 ), @@ -55489,6 +55496,7 @@ MinPt = cms.double( 110.0 ) ) process.hltL1TPFJetsMatching = cms.EDProducer( "L1TPFJetsMatching", + pt3Min = cms.double( 110.0 ), matchingR = cms.double( 0.5 ), pt2Min = cms.double( 35.0 ), mjjMin = cms.double( 650.0 ), @@ -57083,6 +57091,7 @@ MinPt = cms.double( 20.0 ) ) process.hltVBFL1TLooseIDPFJetsMatching = cms.EDProducer( "L1TPFJetsMatching", + pt3Min = cms.double( 110.0 ), matchingR = cms.double( 0.5 ), pt2Min = cms.double( 40.0 ), mjjMin = cms.double( 650.0 ), @@ -66273,13 +66282,13 @@ minimumTransverseMomentum = cms.double( 1.0 ), primaryVertex = cms.InputTag( "hltVerticesPFFilter" ), maximumLongitudinalImpactParameter = cms.double( 17.0 ), - computeGhostTrack = cms.bool( True ), + jets = cms.InputTag( "hltPFJetForBtag" ), maxDeltaR = cms.double( 0.4 ), candidates = cms.InputTag( "hltParticleFlow" ), jetDirectionUsingGhostTrack = cms.bool( False ), minimumNumberOfPixelHits = cms.int32( 2 ), jetDirectionUsingTracks = cms.bool( False ), - jets = cms.InputTag( "hltPFJetForBtag" ), + computeGhostTrack = cms.bool( True ), useTrackQuality = cms.bool( False ), ghostTrackPriorDeltaR = cms.double( 0.03 ), maximumChiSquared = cms.double( 5.0 ), @@ -77919,15 +77928,15 @@ ) process.hltSiPixelClustersAfterSplittingForRefPP = cms.EDProducer( "JetCoreClusterSplitter", verbose = cms.bool( False ), - deltaRmax = cms.double( 0.05 ), + chargeFractionMin = cms.double( 2.0 ), forceXError = cms.double( 100.0 ), vertices = cms.InputTag( "hltFullIter0PrimaryVerticesPreSplittingForRefPP" ), chargePerUnit = cms.double( 2000.0 ), - forceYError = cms.double( 150.0 ), centralMIPCharge = cms.double( 26000.0 ), + forceYError = cms.double( 150.0 ), pixelClusters = cms.InputTag( "hltSiPixelClustersForRefPP" ), ptMin = cms.double( 200.0 ), - chargeFractionMin = cms.double( 2.0 ), + deltaRmax = cms.double( 0.05 ), cores = cms.InputTag( "hltJetsForCoreTracking" ), fractionalWidth = cms.double( 0.4 ), pixelCPE = cms.string( "hltESPPixelCPEGeneric" ) @@ -86213,20 +86222,27 @@ filterTrackEnergy = cms.bool( True ) ) process.hltIsolEcalPixelTrackProdHB = cms.EDProducer( "IsolatedEcalPixelTrackCandidateProducer", - ECHitEnergyThreshold = cms.double( 0.05 ), - filterLabel = cms.InputTag( "hltIsolPixelTrackL2FilterHB" ), + EEHitEnergyThreshold3 = cms.double( 3.52151 ), + EEHitEnergyThreshold2 = cms.double( -19.0741 ), + EEHitEnergyThreshold1 = cms.double( 34.3975 ), + EEHitEnergyThreshold0 = cms.double( -20.5332 ), + EBHitCountEnergyThreshold = cms.double( 0.5 ), + EBHitEnergyThreshold = cms.double( 0.1 ), EBRecHitSource = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEB' ), - ECHitCountEnergyThreshold = cms.double( 0.5 ), + filterLabel = cms.InputTag( "hltIsolPixelTrackL2FilterHB" ), + EcalConeSizeEta1 = cms.double( 0.14 ), EcalConeSizeEta0 = cms.double( 0.09 ), EERecHitSource = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEE' ), - EcalConeSizeEta1 = cms.double( 0.14 ) + EEFacHitCountEnergyThreshold = cms.double( 10.0 ) ) process.hltEcalIsolPixelTrackL2FilterHB = cms.EDFilter( "HLTEcalPixelIsolTrackFilter", saveTags = cms.bool( True ), DropMultiL2Event = cms.bool( False ), - MaxEnergyIn = cms.double( 1.2 ), - MaxEnergyOut = cms.double( 1.2 ), + MaxEnergyInEB = cms.double( 2.0 ), + MaxEnergyInEE = cms.double( 2.0 ), + MaxEnergyOutEB = cms.double( 1.2 ), NMaxTrackCandidates = cms.int32( 10 ), + MaxEnergyOutEE = cms.double( 1.2 ), candTag = cms.InputTag( "hltIsolEcalPixelTrackProdHB" ) ) process.hltHcalITIPTCorrectorHB = cms.EDProducer( "IPTCorrector", @@ -86283,20 +86299,27 @@ filterTrackEnergy = cms.bool( True ) ) process.hltIsolEcalPixelTrackProdHE = cms.EDProducer( "IsolatedEcalPixelTrackCandidateProducer", - ECHitEnergyThreshold = cms.double( 0.05 ), - filterLabel = cms.InputTag( "hltIsolPixelTrackL2FilterHE" ), + EEHitEnergyThreshold3 = cms.double( 3.52151 ), + EEHitEnergyThreshold2 = cms.double( -19.0741 ), + EEHitEnergyThreshold1 = cms.double( 34.3975 ), + EEHitEnergyThreshold0 = cms.double( -20.5332 ), + EBHitCountEnergyThreshold = cms.double( 0.5 ), + EBHitEnergyThreshold = cms.double( 0.1 ), EBRecHitSource = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEB' ), - ECHitCountEnergyThreshold = cms.double( 0.5 ), + filterLabel = cms.InputTag( "hltIsolPixelTrackL2FilterHE" ), + EcalConeSizeEta1 = cms.double( 0.14 ), EcalConeSizeEta0 = cms.double( 0.09 ), EERecHitSource = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEE' ), - EcalConeSizeEta1 = cms.double( 0.14 ) + EEFacHitCountEnergyThreshold = cms.double( 10.0 ) ) process.hltEcalIsolPixelTrackL2FilterHE = cms.EDFilter( "HLTEcalPixelIsolTrackFilter", saveTags = cms.bool( True ), DropMultiL2Event = cms.bool( False ), - MaxEnergyIn = cms.double( 1.2 ), - MaxEnergyOut = cms.double( 1.2 ), + MaxEnergyInEB = cms.double( 2.0 ), + MaxEnergyInEE = cms.double( 2.0 ), + MaxEnergyOutEB = cms.double( 1.2 ), NMaxTrackCandidates = cms.int32( 10 ), + MaxEnergyOutEE = cms.double( 1.2 ), candTag = cms.InputTag( "hltIsolEcalPixelTrackProdHE" ) ) process.hltHcalITIPTCorrectorHE = cms.EDProducer( "IPTCorrector", @@ -100966,13 +100989,13 @@ minimumTransverseMomentum = cms.double( 1.0 ), primaryVertex = cms.InputTag( "hltVerticesPFFilter" ), maximumLongitudinalImpactParameter = cms.double( 17.0 ), - computeGhostTrack = cms.bool( True ), + jets = cms.InputTag( "hltPFJetForDBtagAK8" ), maxDeltaR = cms.double( 0.4 ), candidates = cms.InputTag( "hltParticleFlow" ), jetDirectionUsingGhostTrack = cms.bool( False ), minimumNumberOfPixelHits = cms.int32( 2 ), jetDirectionUsingTracks = cms.bool( False ), - jets = cms.InputTag( "hltPFJetForDBtagAK8" ), + computeGhostTrack = cms.bool( True ), useTrackQuality = cms.bool( False ), ghostTrackPriorDeltaR = cms.double( 0.03 ), maximumChiSquared = cms.double( 5.0 ), diff --git a/HLTrigger/Configuration/test/OnLine_HLT_Fake.py b/HLTrigger/Configuration/test/OnLine_HLT_Fake.py index 5f31777cba5f4..2b641a242a976 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_Fake.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_Fake.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --full --data /dev/CMSSW_10_0_0/Fake --type Fake --unprescale --process HLTFake --globaltag auto:run1_hlt_Fake --input file:RelVal_Raw_Fake_DATA.root +# hltGetConfiguration --full --data /dev/CMSSW_10_1_0/Fake --type Fake --unprescale --process HLTFake --globaltag auto:run1_hlt_Fake --input file:RelVal_Raw_Fake_DATA.root -# /dev/CMSSW_10_0_0/Fake/V7 (CMSSW_10_0_4) +# /dev/CMSSW_10_1_0/Fake/V2 (CMSSW_10_1_0) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTFake" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_10_0_0/Fake/V7') + tableName = cms.string('/dev/CMSSW_10_1_0/Fake/V2') ) process.streams = cms.PSet( A = cms.vstring( 'InitialPD' ) ) diff --git a/HLTrigger/Configuration/test/OnLine_HLT_Fake1.py b/HLTrigger/Configuration/test/OnLine_HLT_Fake1.py index c60f7d0e41a0a..ebf21f3ea9123 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_Fake1.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_Fake1.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --full --data /dev/CMSSW_10_0_0/Fake1 --type Fake1 --unprescale --process HLTFake1 --globaltag auto:run2_hlt_Fake1 --input file:RelVal_Raw_Fake1_DATA.root +# hltGetConfiguration --full --data /dev/CMSSW_10_1_0/Fake1 --type Fake1 --unprescale --process HLTFake1 --globaltag auto:run2_hlt_Fake1 --input file:RelVal_Raw_Fake1_DATA.root -# /dev/CMSSW_10_0_0/Fake1/V7 (CMSSW_10_0_4) +# /dev/CMSSW_10_1_0/Fake1/V2 (CMSSW_10_1_0) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTFake1" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_10_0_0/Fake1/V7') + tableName = cms.string('/dev/CMSSW_10_1_0/Fake1/V2') ) process.streams = cms.PSet( A = cms.vstring( 'InitialPD' ) ) diff --git a/HLTrigger/Configuration/test/OnLine_HLT_Fake2.py b/HLTrigger/Configuration/test/OnLine_HLT_Fake2.py index e162c8aec8e5a..4dace6c067da4 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_Fake2.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_Fake2.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --full --data /dev/CMSSW_10_0_0/Fake2 --type Fake2 --unprescale --process HLTFake2 --globaltag auto:run2_hlt_Fake2 --input file:RelVal_Raw_Fake2_DATA.root +# hltGetConfiguration --full --data /dev/CMSSW_10_1_0/Fake2 --type Fake2 --unprescale --process HLTFake2 --globaltag auto:run2_hlt_Fake2 --input file:RelVal_Raw_Fake2_DATA.root -# /dev/CMSSW_10_0_0/Fake2/V8 (CMSSW_10_0_4) +# /dev/CMSSW_10_1_0/Fake2/V2 (CMSSW_10_1_0) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTFake2" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_10_0_0/Fake2/V8') + tableName = cms.string('/dev/CMSSW_10_1_0/Fake2/V2') ) process.streams = cms.PSet( A = cms.vstring( 'InitialPD' ) ) diff --git a/HLTrigger/Configuration/test/OnLine_HLT_GRun.py b/HLTrigger/Configuration/test/OnLine_HLT_GRun.py index f9a3053ab79eb..1c64b1d61dd31 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_GRun.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_GRun.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --full --data /dev/CMSSW_10_0_0/GRun --type GRun --unprescale --process HLTGRun --globaltag auto:run2_hlt_GRun --input file:RelVal_Raw_GRun_DATA.root +# hltGetConfiguration --full --data /dev/CMSSW_10_1_0/GRun --type GRun --unprescale --process HLTGRun --globaltag auto:run2_hlt_GRun --input file:RelVal_Raw_GRun_DATA.root -# /dev/CMSSW_10_0_0/GRun/V42 (CMSSW_10_0_4) +# /dev/CMSSW_10_1_0/GRun/V1 (CMSSW_10_1_0) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTGRun" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_10_0_0/GRun/V42') + tableName = cms.string('/dev/CMSSW_10_1_0/GRun/V1') ) process.transferSystem = cms.PSet( @@ -2263,6 +2263,8 @@ 'HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_v1', 'HLT_DoubleL2Mu25NoVtx_2Cha_Eta2p4_v1', 'HLT_DoubleL2Mu25NoVtx_2Cha_v1', + 'HLT_DoubleL2Mu30NoVtx_2Cha_CosmicSeed_Eta2p4_v1', + 'HLT_DoubleL2Mu30NoVtx_2Cha_Eta2p4_v1', 'HLT_DoubleL2Mu50_v2', 'HLT_DoubleMu3_DCA_PFMET50_PFMHT60_v8', 'HLT_DoubleMu3_DZ_PFMET50_PFMHT60_v8', @@ -2785,6 +2787,8 @@ 'HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_v1', 'HLT_DoubleL2Mu25NoVtx_2Cha_Eta2p4_v1', 'HLT_DoubleL2Mu25NoVtx_2Cha_v1', + 'HLT_DoubleL2Mu30NoVtx_2Cha_CosmicSeed_Eta2p4_v1', + 'HLT_DoubleL2Mu30NoVtx_2Cha_Eta2p4_v1', 'HLT_DoubleL2Mu50_v2', 'HLT_DoubleMediumChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_v10', 'HLT_DoubleMediumChargedIsoPFTau35_Trk1_eta2p1_Reg_v10', @@ -2886,9 +2890,9 @@ 'HLT_HT500_DisplacedDijet40_DisplacedTrack_v11', 'HLT_HT550_DisplacedDijet60_Inclusive_v11', 'HLT_HT650_DisplacedDijet60_Inclusive_v11', - 'HLT_HcalNZS_v12', - 'HLT_HcalPhiSym_v14', - 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_CrossL1_v10')+cms.vstring( 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10', + 'HLT_HcalNZS_v12')+cms.vstring( 'HLT_HcalPhiSym_v14', + 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_CrossL1_v10', + 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10', 'HLT_IsoMu20_eta2p1_MediumChargedIsoPFTau27_eta2p1_CrossL1_v10', 'HLT_IsoMu20_eta2p1_MediumChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10', 'HLT_IsoMu20_eta2p1_TightChargedIsoPFTau27_eta2p1_CrossL1_v10', @@ -3140,9 +3144,9 @@ 'HLT_Tau3Mu_Mu7_Mu1_TkMu1_Tau15_Charge1_v2', 'HLT_Tau3Mu_Mu7_Mu1_TkMu1_Tau15_v2', 'HLT_TkMu100_v2', - 'HLT_Trimuon5_3p5_2_Upsilon_Muon_v4', - 'HLT_TrimuonOpen_5_3p5_2_Upsilon_Muon_v2', - 'HLT_TripleJet110_35_35_Mjj650_PFMET110_v7')+cms.vstring( 'HLT_TripleJet110_35_35_Mjj650_PFMET120_v7', + 'HLT_Trimuon5_3p5_2_Upsilon_Muon_v4')+cms.vstring( 'HLT_TrimuonOpen_5_3p5_2_Upsilon_Muon_v2', + 'HLT_TripleJet110_35_35_Mjj650_PFMET110_v7', + 'HLT_TripleJet110_35_35_Mjj650_PFMET120_v7', 'HLT_TripleJet110_35_35_Mjj650_PFMET130_v7', 'HLT_TripleMu_10_5_5_DZ_v9', 'HLT_TripleMu_12_10_5_v9', @@ -3912,13 +3916,13 @@ ) process.hcal_db_producer = cms.ESProducer( "HcalDbProducer" ) process.hltCombinedSecondaryVertex = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -3931,7 +3935,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( -99999.9 ), + sip2dSigMin = cms.double( 2.0 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -3940,12 +3944,12 @@ 'CombinedSVPseudoVertex', 'CombinedSVNoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -3958,7 +3962,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( 2.0 ), + sip2dSigMin = cms.double( -99999.9 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -3968,13 +3972,13 @@ trackFlip = cms.bool( False ) ) process.hltCombinedSecondaryVertexV2 = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -4000,18 +4004,18 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( -99999.9 ) + sip2dSigMin = cms.double( 2.0 ) ), calibrationRecords = cms.vstring( 'CombinedSVIVFV2RecoVertex', 'CombinedSVIVFV2PseudoVertex', 'CombinedSVIVFV2NoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -4037,7 +4041,7 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( 2.0 ) + sip2dSigMin = cms.double( -99999.9 ) ), trackSort = cms.string( "sip2dSig" ), SoftLeptonFlip = cms.bool( False ), @@ -5632,9 +5636,11 @@ logWarningEtThreshold_EE_FE = cms.double( 50.0 ) ) process.hltHcalDigis = cms.EDProducer( "HcalRawToDigi", + saveQIE10DataNSamples = cms.untracked.vint32( ), ExpectedOrbitMessageTime = cms.untracked.int32( -1 ), FilterDataQuality = cms.bool( True ), silent = cms.untracked.bool( True ), + saveQIE11DataNSamples = cms.untracked.vint32( ), HcalFirstFED = cms.untracked.int32( 700 ), InputLabel = cms.InputTag( "rawDataCollector" ), ComplainEmptyData = cms.untracked.bool( False ), @@ -5642,10 +5648,12 @@ UnpackCalib = cms.untracked.bool( True ), UnpackUMNio = cms.untracked.bool( True ), FEDs = cms.untracked.vint32( ), - UnpackerMode = cms.untracked.int32( 0 ), + saveQIE11DataTags = cms.untracked.vstring( ), UnpackTTP = cms.untracked.bool( False ), - lastSample = cms.int32( 9 ), UnpackZDC = cms.untracked.bool( True ), + saveQIE10DataTags = cms.untracked.vstring( ), + lastSample = cms.int32( 9 ), + UnpackerMode = cms.untracked.int32( 0 ), firstSample = cms.int32( 0 ) ) process.hltHbhePhase1Reco = cms.EDProducer( "HBHEPhase1Reconstructor", @@ -12384,11 +12392,13 @@ GsfTrackProducer = cms.InputTag( "hltEgammaGsfTracks" ) ) process.hltEgammaGsfTrackVars = cms.EDProducer( "EgammaHLTGsfTrackVarProducer", - recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidates" ), - beamSpotProducer = cms.InputTag( "hltOnlineBeamSpot" ), upperTrackNrToRemoveCut = cms.int32( 9999 ), + useDefaultValuesForEndcap = cms.bool( False ), lowerTrackNrToRemoveCut = cms.int32( -1 ), - inputCollection = cms.InputTag( "hltEgammaGsfTracks" ) + inputCollection = cms.InputTag( "hltEgammaGsfTracks" ), + recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidates" ), + beamSpotProducer = cms.InputTag( "hltOnlineBeamSpot" ), + useDefaultValuesForBarrel = cms.bool( False ) ) process.hltDiMu5Ele3CaloIdLTrackIdLElectronlegOneOEMinusOneOPFilter = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), @@ -32098,7 +32108,7 @@ L1MuonInputTag = cms.InputTag( 'hltGtStage2Digis','Muon' ), L1GlobalInputTag = cms.InputTag( "hltGtStage2Digis" ) ) -process.hltPreDoubleL2Mu50 = cms.EDFilter( "HLTPrescaler", +process.hltPreL2Mu23NoVtx2Cha = cms.EDFilter( "HLTPrescaler", L1GtReadoutRecordTag = cms.InputTag( "hltGtStage2Digis" ), offset = cms.uint32( 0 ) ) @@ -32112,26 +32122,54 @@ SelectQualities = cms.vint32( ), CandTag = cms.InputTag( 'hltGtStage2Digis','Muon' ) ) -process.hltL2fL1sMuORL1f0DoubleL2AllBxFiltered50Q = cms.EDFilter( "HLTMuonL2FromL1TPreFilter", +process.hltL2MuonCandidatesNoVtx = cms.EDProducer( "L2MuonCandidateProducer", + InputObjects = cms.InputTag( "hltL2Muons" ) +) +process.hltL2fL1sMuORL1f0L2NoVtx23Q2Cha = cms.EDFilter( "HLTMuonL2FromL1TPreFilter", saveTags = cms.bool( True ), MaxDr = cms.double( 9999.0 ), - CutOnChambers = cms.bool( False ), + CutOnChambers = cms.bool( True ), PreviousCandTag = cms.InputTag( "hltL1fL1sMuORL1Filtered0" ), - MinPt = cms.double( 50.0 ), - MinN = cms.int32( 2 ), - SeedMapTag = cms.InputTag( "hltL2MuonsAllBx" ), - MaxEta = cms.double( 2.5 ), - MinNhits = cms.vint32( 0, 1, 0, 1 ), + MinPt = cms.double( 23.0 ), + MinN = cms.int32( 1 ), + SeedMapTag = cms.InputTag( "hltL2Muons" ), + MaxEta = cms.double( 2.0 ), + MinNhits = cms.vint32( 0 ), MinDxySig = cms.double( -1.0 ), - MinNchambers = cms.vint32( 0 ), - AbsEtaBins = cms.vdouble( 0.9, 1.5, 2.1, 5.0 ), + MinNchambers = cms.vint32( 2 ), + AbsEtaBins = cms.vdouble( 5.0 ), MaxDz = cms.double( 9999.0 ), MatchToPreviousCand = cms.bool( False ), - CandTag = cms.InputTag( "hltL2MuonCandidatesAllBx" ), + CandTag = cms.InputTag( "hltL2MuonCandidatesNoVtx" ), BeamSpotTag = cms.InputTag( "hltOnlineBeamSpot" ), MinDr = cms.double( -1.0 ), NSigmaPt = cms.double( 0.0 ), - MinNstations = cms.vint32( 0, 2, 0, 2 ) + MinNstations = cms.vint32( 0 ) +) +process.hltPreL2Mu23NoVtx2ChaCosmicSeed = cms.EDFilter( "HLTPrescaler", + L1GtReadoutRecordTag = cms.InputTag( "hltGtStage2Digis" ), + offset = cms.uint32( 0 ) +) +process.hltL2fL1sMuORL1f0L2NoVtx23Q2ChaCosmicSeed = cms.EDFilter( "HLTMuonL2FromL1TPreFilter", + saveTags = cms.bool( True ), + MaxDr = cms.double( 9999.0 ), + CutOnChambers = cms.bool( True ), + PreviousCandTag = cms.InputTag( "hltL1fL1sMuORL1Filtered0" ), + MinPt = cms.double( 23.0 ), + MinN = cms.int32( 1 ), + SeedMapTag = cms.InputTag( "hltL2CosmicMuons" ), + MaxEta = cms.double( 2.0 ), + MinNhits = cms.vint32( 0 ), + MinDxySig = cms.double( -1.0 ), + MinNchambers = cms.vint32( 2 ), + AbsEtaBins = cms.vdouble( 5.0 ), + MaxDz = cms.double( 9999.0 ), + MatchToPreviousCand = cms.bool( False ), + CandTag = cms.InputTag( "hltL2MuonCandidatesNoVtxMeanTimerCosmicSeed" ), + BeamSpotTag = cms.InputTag( "hltOnlineBeamSpot" ), + MinDr = cms.double( -1.0 ), + NSigmaPt = cms.double( 0.0 ), + MinNstations = cms.vint32( 0 ) ) process.hltL1sDoubleMu125to157ORTripleMu444 = cms.EDFilter( "HLTL1TSeed", L1SeedsLogicalExpression = cms.string( "L1_DoubleMu_12_5 OR L1_DoubleMu_15_5_SQ OR L1_DoubleMu_15_7 OR L1_TripleMu_4_4_4" ), @@ -32144,7 +32182,7 @@ L1MuonInputTag = cms.InputTag( 'hltGtStage2Digis','Muon' ), L1GlobalInputTag = cms.InputTag( "hltGtStage2Digis" ) ) -process.hltPreDoubleL2Mu23NoVtx2ChaCosmicSeed = cms.EDFilter( "HLTPrescaler", +process.hltPreDoubleL2Mu30NoVtx2ChaCosmicSeedEta2p4 = cms.EDFilter( "HLTPrescaler", L1GtReadoutRecordTag = cms.InputTag( "hltGtStage2Digis" ), offset = cms.uint32( 0 ) ) @@ -32158,6 +32196,108 @@ SelectQualities = cms.vint32( ), CandTag = cms.InputTag( 'hltGtStage2Digis','Muon' ) ) +process.hltL2fL1sMuORL1f0DoubleL2NoVtx30Q2ChaCosmicSeedEta2p4 = cms.EDFilter( "HLTMuonL2FromL1TPreFilter", + saveTags = cms.bool( True ), + MaxDr = cms.double( 9999.0 ), + CutOnChambers = cms.bool( True ), + PreviousCandTag = cms.InputTag( "hltL1fL1sDoubleMu155ORTripleMu444L1Filtered0" ), + MinPt = cms.double( 30.0 ), + MinN = cms.int32( 2 ), + SeedMapTag = cms.InputTag( "hltL2CosmicMuons" ), + MaxEta = cms.double( 2.4 ), + MinNhits = cms.vint32( 0 ), + MinDxySig = cms.double( -1.0 ), + MinNchambers = cms.vint32( 2 ), + AbsEtaBins = cms.vdouble( 5.0 ), + MaxDz = cms.double( 9999.0 ), + MatchToPreviousCand = cms.bool( False ), + CandTag = cms.InputTag( "hltL2MuonCandidatesNoVtxMeanTimerCosmicSeed" ), + BeamSpotTag = cms.InputTag( "hltOnlineBeamSpot" ), + MinDr = cms.double( -1.0 ), + NSigmaPt = cms.double( 0.0 ), + MinNstations = cms.vint32( 0 ) +) +process.hltPreDoubleL2Mu30NoVtx2ChaEta2p4 = cms.EDFilter( "HLTPrescaler", + L1GtReadoutRecordTag = cms.InputTag( "hltGtStage2Digis" ), + offset = cms.uint32( 0 ) +) +process.hltL2fL1sMuORL1f0DoubleL2NoVtx30Q = cms.EDFilter( "HLTMuonL2FromL1TPreFilter", + saveTags = cms.bool( True ), + MaxDr = cms.double( 9999.0 ), + CutOnChambers = cms.bool( False ), + PreviousCandTag = cms.InputTag( "hltL1fL1sDoubleMu155ORTripleMu444L1Filtered0" ), + MinPt = cms.double( 30.0 ), + MinN = cms.int32( 2 ), + SeedMapTag = cms.InputTag( "hltL2Muons" ), + MaxEta = cms.double( 2.5 ), + MinNhits = cms.vint32( 0, 1, 0, 1 ), + MinDxySig = cms.double( -1.0 ), + MinNchambers = cms.vint32( 0 ), + AbsEtaBins = cms.vdouble( 0.9, 1.5, 2.1, 5.0 ), + MaxDz = cms.double( 9999.0 ), + MatchToPreviousCand = cms.bool( False ), + CandTag = cms.InputTag( "hltL2MuonCandidatesNoVtx" ), + BeamSpotTag = cms.InputTag( "hltOnlineBeamSpot" ), + MinDr = cms.double( -1.0 ), + NSigmaPt = cms.double( 0.0 ), + MinNstations = cms.vint32( 0, 2, 0, 2 ) +) +process.hltL2DoubleMu30NoVtxFiltered2ChaEta2p4 = cms.EDFilter( "HLTMuonDimuonL2FromL1TFilter", + saveTags = cms.bool( True ), + ChargeOpt = cms.int32( 0 ), + SeedMapTag = cms.InputTag( "hltL2Muons" ), + MinNchambers = cms.int32( 2 ), + FastAccept = cms.bool( False ), + CandTag = cms.InputTag( "hltL2MuonCandidatesNoVtx" ), + PreviousCandTag = cms.InputTag( "hltL1sDoubleMu125to157ORTripleMu444" ), + MinAngle = cms.double( -999.0 ), + MaxPtBalance = cms.double( 999999.0 ), + MaxAcop = cms.double( 3.15 ), + MinPtMin = cms.double( 30.0 ), + MaxInvMass = cms.double( 999999.0 ), + MinPtMax = cms.double( 30.0 ), + BeamSpotTag = cms.InputTag( "hltOnlineBeamSpot" ), + MaxAngle = cms.double( 9999.0 ), + MaxDz = cms.double( 9999.0 ), + MinPtPair = cms.double( 0.0 ), + MaxDr = cms.double( 100.0 ), + MinAcop = cms.double( -1.0 ), + MinNstations = cms.int32( 0 ), + MinNhits = cms.int32( 0 ), + NSigmaPt = cms.double( 0.0 ), + MinPtBalance = cms.double( -1.0 ), + MaxEta = cms.double( 2.4 ), + MinInvMass = cms.double( -999999.0 ) +) +process.hltPreDoubleL2Mu50 = cms.EDFilter( "HLTPrescaler", + L1GtReadoutRecordTag = cms.InputTag( "hltGtStage2Digis" ), + offset = cms.uint32( 0 ) +) +process.hltL2fL1sMuORL1f0DoubleL2AllBxFiltered50Q = cms.EDFilter( "HLTMuonL2FromL1TPreFilter", + saveTags = cms.bool( True ), + MaxDr = cms.double( 9999.0 ), + CutOnChambers = cms.bool( False ), + PreviousCandTag = cms.InputTag( "hltL1fL1sMuORL1Filtered0" ), + MinPt = cms.double( 50.0 ), + MinN = cms.int32( 2 ), + SeedMapTag = cms.InputTag( "hltL2MuonsAllBx" ), + MaxEta = cms.double( 2.5 ), + MinNhits = cms.vint32( 0, 1, 0, 1 ), + MinDxySig = cms.double( -1.0 ), + MinNchambers = cms.vint32( 0 ), + AbsEtaBins = cms.vdouble( 0.9, 1.5, 2.1, 5.0 ), + MaxDz = cms.double( 9999.0 ), + MatchToPreviousCand = cms.bool( False ), + CandTag = cms.InputTag( "hltL2MuonCandidatesAllBx" ), + BeamSpotTag = cms.InputTag( "hltOnlineBeamSpot" ), + MinDr = cms.double( -1.0 ), + NSigmaPt = cms.double( 0.0 ), + MinNstations = cms.vint32( 0, 2, 0, 2 ) +) +process.hltPreDoubleL2Mu23NoVtx2ChaCosmicSeed = cms.EDFilter( "HLTPrescaler", + L1GtReadoutRecordTag = cms.InputTag( "hltGtStage2Digis" ), + offset = cms.uint32( 0 ) +) process.hltL2fL1sMuORL1f0DoubleL2NoVtx23Q2ChaCosmicSeed = cms.EDFilter( "HLTMuonL2FromL1TPreFilter", saveTags = cms.bool( True ), MaxDr = cms.double( 9999.0 ), @@ -32233,9 +32373,6 @@ L1GtReadoutRecordTag = cms.InputTag( "hltGtStage2Digis" ), offset = cms.uint32( 0 ) ) -process.hltL2MuonCandidatesNoVtx = cms.EDProducer( "L2MuonCandidateProducer", - InputObjects = cms.InputTag( "hltL2Muons" ) -) process.hltL2pfL1sDoubleMu155ORTripleMu444L1f0L2PreFiltered0NoVtx = cms.EDFilter( "HLTMuonL2FromL1TPreFilter", saveTags = cms.bool( True ), MaxDr = cms.double( 9999.0 ), @@ -37605,6 +37742,7 @@ lMinHighEHitTime = cms.double( -9999.0 ), fillLaserMonitor = cms.bool( True ), tMinHPDHits = cms.int32( 16 ), + tRBXRecHitR45Cuts = cms.vdouble( 0.0, 1.0, 0.0, -0.2, 0.0, 0.0, 1.0, -0.2 ), minRecHitE = cms.double( 1.5 ), pMaxHighEHitTime = cms.double( 5.0 ), lRBXRecHitR45Cuts = cms.vdouble( 0.0, 1.0, 0.0, -0.5, 0.0, 0.0, 1.0, -0.5 ), @@ -37618,12 +37756,13 @@ maxNHF = cms.double( 0.9 ), minHighHitE = cms.double( 25.0 ), minR45HitE = cms.double( 5.0 ), - tRBXRecHitR45Cuts = cms.vdouble( 0.0, 1.0, 0.0, -0.2, 0.0, 0.0, 1.0, -0.2 ), + lasermonDigis = cms.InputTag( 'hltHcalDigis','LASERMON' ), lMinZeros = cms.int32( 10 ), lMinRBXHits = cms.int32( 999 ), fillRecHits = cms.bool( True ), minERatio = cms.double( 50.0 ), TS4TS5LowerThreshold = cms.vdouble( 100.0, 120.0, 150.0, 200.0, 300.0, 400.0, 500.0 ), + hlMaxRBXEMF = cms.double( 0.01 ), lMinHPDNoOtherHits = cms.int32( 10 ), pMinRBXRechitR45EnergyFraction = cms.double( 0.1 ), hlMaxHPDEMF = cms.double( -9999.0 ), @@ -37633,7 +37772,6 @@ laserMonIEtaList = cms.vint32( 0, 0, 0, 0, 0, 0, 0, 0 ), laserMonIPhiList = cms.vint32( 23, 17, 11, 5, 29, 35, 41, 47 ), pMinRatio = cms.double( 0.75 ), - tMinLowEHitTime = cms.double( -9999.0 ), HcalAcceptSeverityLevel = cms.uint32( 9 ), pMaxRBXEMF = cms.double( 0.02 ), tMaxRatio = cms.double( 0.92 ), @@ -37666,7 +37804,7 @@ tMinHPDNoOtherHits = cms.int32( 9 ), pMaxHPDEMF = cms.double( 0.02 ), jetCollName = cms.string( "" ), - hlMaxRBXEMF = cms.double( 0.01 ), + tMinLowEHitTime = cms.double( -9999.0 ), tMaxHighEHitTime = cms.double( 6.0 ), pMaxLowEHitTime = cms.double( 6.0 ), lMinHPDHits = cms.int32( 17 ), @@ -53686,6 +53824,7 @@ MinPt = cms.double( 110.0 ) ) process.hltL1TPFJetsMatching = cms.EDProducer( "L1TPFJetsMatching", + pt3Min = cms.double( 110.0 ), matchingR = cms.double( 0.5 ), pt2Min = cms.double( 35.0 ), mjjMin = cms.double( 650.0 ), @@ -55280,6 +55419,7 @@ MinPt = cms.double( 20.0 ) ) process.hltVBFL1TLooseIDPFJetsMatching = cms.EDProducer( "L1TPFJetsMatching", + pt3Min = cms.double( 110.0 ), matchingR = cms.double( 0.5 ), pt2Min = cms.double( 40.0 ), mjjMin = cms.double( 650.0 ), @@ -64322,13 +64462,13 @@ minimumTransverseMomentum = cms.double( 1.0 ), primaryVertex = cms.InputTag( "hltVerticesPFFilter" ), maximumLongitudinalImpactParameter = cms.double( 17.0 ), - computeGhostTrack = cms.bool( True ), + jets = cms.InputTag( "hltPFJetForBtag" ), maxDeltaR = cms.double( 0.4 ), candidates = cms.InputTag( "hltParticleFlow" ), jetDirectionUsingGhostTrack = cms.bool( False ), minimumNumberOfPixelHits = cms.int32( 2 ), jetDirectionUsingTracks = cms.bool( False ), - jets = cms.InputTag( "hltPFJetForBtag" ), + computeGhostTrack = cms.bool( True ), useTrackQuality = cms.bool( False ), ghostTrackPriorDeltaR = cms.double( 0.03 ), maximumChiSquared = cms.double( 5.0 ), @@ -70286,20 +70426,27 @@ filterTrackEnergy = cms.bool( True ) ) process.hltIsolEcalPixelTrackProdHB = cms.EDProducer( "IsolatedEcalPixelTrackCandidateProducer", - ECHitEnergyThreshold = cms.double( 0.05 ), - filterLabel = cms.InputTag( "hltIsolPixelTrackL2FilterHB" ), + EEHitEnergyThreshold3 = cms.double( 3.52151 ), + EEHitEnergyThreshold2 = cms.double( -19.0741 ), + EEHitEnergyThreshold1 = cms.double( 34.3975 ), + EEHitEnergyThreshold0 = cms.double( -20.5332 ), + EBHitCountEnergyThreshold = cms.double( 0.5 ), + EBHitEnergyThreshold = cms.double( 0.1 ), EBRecHitSource = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEB' ), - ECHitCountEnergyThreshold = cms.double( 0.5 ), + filterLabel = cms.InputTag( "hltIsolPixelTrackL2FilterHB" ), + EcalConeSizeEta1 = cms.double( 0.14 ), EcalConeSizeEta0 = cms.double( 0.09 ), EERecHitSource = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEE' ), - EcalConeSizeEta1 = cms.double( 0.14 ) + EEFacHitCountEnergyThreshold = cms.double( 10.0 ) ) process.hltEcalIsolPixelTrackL2FilterHB = cms.EDFilter( "HLTEcalPixelIsolTrackFilter", saveTags = cms.bool( True ), DropMultiL2Event = cms.bool( False ), - MaxEnergyIn = cms.double( 1.2 ), - MaxEnergyOut = cms.double( 1.2 ), + MaxEnergyInEB = cms.double( 2.0 ), + MaxEnergyInEE = cms.double( 2.0 ), + MaxEnergyOutEB = cms.double( 1.2 ), NMaxTrackCandidates = cms.int32( 10 ), + MaxEnergyOutEE = cms.double( 1.2 ), candTag = cms.InputTag( "hltIsolEcalPixelTrackProdHB" ) ) process.hltHcalITIPTCorrectorHB = cms.EDProducer( "IPTCorrector", @@ -70356,20 +70503,27 @@ filterTrackEnergy = cms.bool( True ) ) process.hltIsolEcalPixelTrackProdHE = cms.EDProducer( "IsolatedEcalPixelTrackCandidateProducer", - ECHitEnergyThreshold = cms.double( 0.05 ), - filterLabel = cms.InputTag( "hltIsolPixelTrackL2FilterHE" ), + EEHitEnergyThreshold3 = cms.double( 3.52151 ), + EEHitEnergyThreshold2 = cms.double( -19.0741 ), + EEHitEnergyThreshold1 = cms.double( 34.3975 ), + EEHitEnergyThreshold0 = cms.double( -20.5332 ), + EBHitCountEnergyThreshold = cms.double( 0.5 ), + EBHitEnergyThreshold = cms.double( 0.1 ), EBRecHitSource = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEB' ), - ECHitCountEnergyThreshold = cms.double( 0.5 ), + filterLabel = cms.InputTag( "hltIsolPixelTrackL2FilterHE" ), + EcalConeSizeEta1 = cms.double( 0.14 ), EcalConeSizeEta0 = cms.double( 0.09 ), EERecHitSource = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEE' ), - EcalConeSizeEta1 = cms.double( 0.14 ) + EEFacHitCountEnergyThreshold = cms.double( 10.0 ) ) process.hltEcalIsolPixelTrackL2FilterHE = cms.EDFilter( "HLTEcalPixelIsolTrackFilter", saveTags = cms.bool( True ), DropMultiL2Event = cms.bool( False ), - MaxEnergyIn = cms.double( 1.2 ), - MaxEnergyOut = cms.double( 1.2 ), + MaxEnergyInEB = cms.double( 2.0 ), + MaxEnergyInEE = cms.double( 2.0 ), + MaxEnergyOutEB = cms.double( 1.2 ), NMaxTrackCandidates = cms.int32( 10 ), + MaxEnergyOutEE = cms.double( 1.2 ), candTag = cms.InputTag( "hltIsolEcalPixelTrackProdHE" ) ) process.hltHcalITIPTCorrectorHE = cms.EDProducer( "IPTCorrector", @@ -83252,13 +83406,13 @@ minimumTransverseMomentum = cms.double( 1.0 ), primaryVertex = cms.InputTag( "hltVerticesPFFilter" ), maximumLongitudinalImpactParameter = cms.double( 17.0 ), - computeGhostTrack = cms.bool( True ), + jets = cms.InputTag( "hltPFJetForDBtagAK8" ), maxDeltaR = cms.double( 0.4 ), candidates = cms.InputTag( "hltParticleFlow" ), jetDirectionUsingGhostTrack = cms.bool( False ), minimumNumberOfPixelHits = cms.int32( 2 ), jetDirectionUsingTracks = cms.bool( False ), - jets = cms.InputTag( "hltPFJetForDBtagAK8" ), + computeGhostTrack = cms.bool( True ), useTrackQuality = cms.bool( False ), ghostTrackPriorDeltaR = cms.double( 0.03 ), maximumChiSquared = cms.double( 5.0 ), @@ -83978,6 +84132,8 @@ 'HLT_L2Mu10_v7 / 3', 'HLT_L2Mu10_NoVertex_NoBPTX_v6 / 3', 'HLT_L2Mu50_v2 / 3', + 'HLT_DoubleL2Mu30NoVtx_2Cha_CosmicSeed_Eta2p4_v1 / 3', + 'HLT_DoubleL2Mu30NoVtx_2Cha_Eta2p4_v1 / 3', 'HLT_DoubleL2Mu50_v2 / 3', 'HLT_DoubleL2Mu23NoVtx_2Cha_CosmicSeed_v1 / 3', 'HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_v1 / 3', @@ -84152,9 +84308,9 @@ 'HLT_DoublePFJets200_CaloBTagCSV_p79_v1 / 3', 'HLT_DoublePFJets350_CaloBTagCSV_p79_v1 / 3', 'HLT_DoublePFJets116MaxDeta1p6_DoubleCaloBTagCSV_p79_v1 / 3', - 'HLT_DoublePFJets128MaxDeta1p6_DoubleCaloBTagCSV_p79_v1 / 3', - 'HLT_Photon300_NoHE_v11 / 3', - 'HLT_Mu8_TrkIsoVVL_v11 / 3')+cms.vstring( 'HLT_Mu8_DiEle12_CaloIdL_TrackIdL_DZ_v16 / 3', + 'HLT_DoublePFJets128MaxDeta1p6_DoubleCaloBTagCSV_p79_v1 / 3')+cms.vstring( 'HLT_Photon300_NoHE_v11 / 3', + 'HLT_Mu8_TrkIsoVVL_v11 / 3', + 'HLT_Mu8_DiEle12_CaloIdL_TrackIdL_DZ_v16 / 3', 'HLT_Mu8_DiEle12_CaloIdL_TrackIdL_v16 / 3', 'HLT_Mu8_Ele8_CaloIdM_TrackIdM_Mass8_PFHT350_DZ_v17 / 3', 'HLT_Mu8_Ele8_CaloIdM_TrackIdM_Mass8_PFHT350_v17 / 3', @@ -84406,9 +84562,9 @@ 'HLT_PFMETTypeOne100_PFMHT100_IDTight_PFHT60_v7 / 3', 'HLT_Mu18_Mu9_SameSign_v3 / 3', 'HLT_Mu18_Mu9_SameSign_DZ_v3 / 3', - 'HLT_Mu18_Mu9_v3 / 3', - 'HLT_Mu18_Mu9_DZ_v3 / 3', - 'HLT_Mu20_Mu10_SameSign_v3 / 3')+cms.vstring( 'HLT_Mu20_Mu10_SameSign_DZ_v3 / 3', + 'HLT_Mu18_Mu9_v3 / 3')+cms.vstring( 'HLT_Mu18_Mu9_DZ_v3 / 3', + 'HLT_Mu20_Mu10_SameSign_v3 / 3', + 'HLT_Mu20_Mu10_SameSign_DZ_v3 / 3', 'HLT_Mu20_Mu10_v3 / 3', 'HLT_Mu20_Mu10_DZ_v3 / 3', 'HLT_Mu23_Mu12_SameSign_v3 / 3', @@ -85202,6 +85358,8 @@ 'HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_v1', 'HLT_DoubleL2Mu25NoVtx_2Cha_Eta2p4_v1', 'HLT_DoubleL2Mu25NoVtx_2Cha_v1', + 'HLT_DoubleL2Mu30NoVtx_2Cha_CosmicSeed_Eta2p4_v1', + 'HLT_DoubleL2Mu30NoVtx_2Cha_Eta2p4_v1', 'HLT_DoubleL2Mu50_v2', 'HLT_DoubleMu20_7_Mass0to30_L1_DM4EG_v6', 'HLT_DoubleMu20_7_Mass0to30_L1_DM4_v6', @@ -85527,6 +85685,8 @@ 'HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_v1', 'HLT_DoubleL2Mu25NoVtx_2Cha_Eta2p4_v1', 'HLT_DoubleL2Mu25NoVtx_2Cha_v1', + 'HLT_DoubleL2Mu30NoVtx_2Cha_CosmicSeed_Eta2p4_v1', + 'HLT_DoubleL2Mu30NoVtx_2Cha_Eta2p4_v1', 'HLT_DoubleL2Mu50_v2', 'HLT_DoubleMediumChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_v10', 'HLT_DoubleMediumChargedIsoPFTau35_Trk1_eta2p1_Reg_v10', @@ -85628,9 +85788,9 @@ 'HLT_HT500_DisplacedDijet40_DisplacedTrack_v11', 'HLT_HT550_DisplacedDijet60_Inclusive_v11', 'HLT_HT650_DisplacedDijet60_Inclusive_v11', - 'HLT_HcalNZS_v12', - 'HLT_HcalPhiSym_v14', - 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_CrossL1_v10')+cms.vstring( 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10', + 'HLT_HcalNZS_v12')+cms.vstring( 'HLT_HcalPhiSym_v14', + 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_CrossL1_v10', + 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10', 'HLT_IsoMu20_eta2p1_MediumChargedIsoPFTau27_eta2p1_CrossL1_v10', 'HLT_IsoMu20_eta2p1_MediumChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10', 'HLT_IsoMu20_eta2p1_TightChargedIsoPFTau27_eta2p1_CrossL1_v10', @@ -85882,9 +86042,9 @@ 'HLT_Tau3Mu_Mu7_Mu1_TkMu1_Tau15_Charge1_v2', 'HLT_Tau3Mu_Mu7_Mu1_TkMu1_Tau15_v2', 'HLT_TkMu100_v2', - 'HLT_Trimuon5_3p5_2_Upsilon_Muon_v4', - 'HLT_TrimuonOpen_5_3p5_2_Upsilon_Muon_v2', - 'HLT_TripleJet110_35_35_Mjj650_PFMET110_v7')+cms.vstring( 'HLT_TripleJet110_35_35_Mjj650_PFMET120_v7', + 'HLT_Trimuon5_3p5_2_Upsilon_Muon_v4')+cms.vstring( 'HLT_TrimuonOpen_5_3p5_2_Upsilon_Muon_v2', + 'HLT_TripleJet110_35_35_Mjj650_PFMET110_v7', + 'HLT_TripleJet110_35_35_Mjj650_PFMET120_v7', 'HLT_TripleJet110_35_35_Mjj650_PFMET130_v7', 'HLT_TripleMu_10_5_5_DZ_v9', 'HLT_TripleMu_12_10_5_v9', @@ -86989,6 +87149,10 @@ process.HLT_L2Mu10_v7 = cms.Path( process.HLTBeginSequence + process.hltL1sSingleMu22or25 + process.hltPreL2Mu10 + process.hltL1fL1sMu22or25L1Filtered0 + process.HLTL2muonrecoSequence + process.hltL2fL1sMu22or25L1f0L2FilteredQ + process.HLTEndSequence ) process.HLT_L2Mu10_NoVertex_NoBPTX_v6 = cms.Path( process.HLTBeginSequence + process.hltL1sSingleMuOpenNotBptxOR + process.hltPreL2Mu10NoVertexNoBPTX + process.hltL1fL1sMuOpenNotBptxORL1Filtered0 + process.HLTL2muonrecoSequenceNoVtxCosmicSeedMeanTimer + process.hltL2fL1sMuOpenNotBptxORL1f0NoVtxCosmicSeedMeanTimerL2Filtered10 + process.HLTEndSequence ) process.HLT_L2Mu50_v2 = cms.Path( process.HLTBeginSequence + process.hltL1sSingleMu22or25 + process.hltPreL2Mu50 + process.hltL1fL1sMu22or25L1Filtered0 + process.HLTL2muonrecoSequenceAllBx + process.hltL2fL1sMu22or25L1f0L2AllBxFiltered50Q + process.HLTEndSequence ) +process.HLT_L2Mu23NoVtx_2Cha_v1 = cms.Path( process.HLTBeginSequence + process.hltL1sSingleMuOR + process.hltPreL2Mu23NoVtx2Cha + process.hltL1fL1sMuORL1Filtered0 + process.HLTL2muonrecoSequenceNoVtx + process.hltL2fL1sMuORL1f0L2NoVtx23Q2Cha + process.HLTEndSequence ) +process.HLT_L2Mu23NoVtx_2Cha_CosmicSeed_v1 = cms.Path( process.HLTBeginSequence + process.hltL1sSingleMuOR + process.hltPreL2Mu23NoVtx2ChaCosmicSeed + process.hltL1fL1sMuORL1Filtered0 + process.HLTL2muonrecoSequenceNoVtxCosmicSeedMeanTimer + process.hltL2fL1sMuORL1f0L2NoVtx23Q2ChaCosmicSeed + process.HLTEndSequence ) +process.HLT_DoubleL2Mu30NoVtx_2Cha_CosmicSeed_Eta2p4_v1 = cms.Path( process.HLTBeginSequence + process.hltL1sDoubleMu125to157ORTripleMu444 + process.hltPreDoubleL2Mu30NoVtx2ChaCosmicSeedEta2p4 + process.hltL1fL1sDoubleMu155ORTripleMu444L1Filtered0 + process.HLTL2muonrecoSequenceNoVtxCosmicSeedMeanTimer + process.hltL2fL1sMuORL1f0DoubleL2NoVtx30Q2ChaCosmicSeedEta2p4 + process.HLTEndSequence ) +process.HLT_DoubleL2Mu30NoVtx_2Cha_Eta2p4_v1 = cms.Path( process.HLTBeginSequence + process.hltL1sDoubleMu125to157ORTripleMu444 + process.hltPreDoubleL2Mu30NoVtx2ChaEta2p4 + process.hltL1fL1sDoubleMu155ORTripleMu444L1Filtered0 + process.HLTL2muonrecoSequenceNoVtx + process.hltL2fL1sMuORL1f0DoubleL2NoVtx30Q + process.hltL2DoubleMu30NoVtxFiltered2ChaEta2p4 + process.HLTEndSequence ) process.HLT_DoubleL2Mu50_v2 = cms.Path( process.HLTBeginSequence + process.hltL1sSingleMuOR + process.hltPreDoubleL2Mu50 + process.hltL1fL1sMuORL1Filtered0 + process.HLTL2muonrecoSequenceAllBx + process.hltL2fL1sMuORL1f0DoubleL2AllBxFiltered50Q + process.HLTEndSequence ) process.HLT_DoubleL2Mu23NoVtx_2Cha_CosmicSeed_v1 = cms.Path( process.HLTBeginSequence + process.hltL1sDoubleMu125to157ORTripleMu444 + process.hltPreDoubleL2Mu23NoVtx2ChaCosmicSeed + process.hltL1fL1sDoubleMu155ORTripleMu444L1Filtered0 + process.HLTL2muonrecoSequenceNoVtxCosmicSeedMeanTimer + process.hltL2fL1sMuORL1f0DoubleL2NoVtx23Q2ChaCosmicSeed + process.HLTEndSequence ) process.HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_v1 = cms.Path( process.HLTBeginSequence + process.hltL1sDoubleMu125to157ORTripleMu444 + process.hltPreDoubleL2Mu25NoVtx2ChaCosmicSeed + process.hltL1fL1sDoubleMu155ORTripleMu444L1Filtered0 + process.HLTL2muonrecoSequenceNoVtxCosmicSeedMeanTimer + process.hltL2fL1sMuORL1f0DoubleL2NoVtx25Q2ChaCosmicSeed + process.HLTEndSequence ) @@ -87579,7 +87743,7 @@ process.PhysicsZeroBias4Output = cms.EndPath( process.hltGtStage2Digis + process.hltPrePhysicsZeroBias4Output + process.hltOutputPhysicsZeroBias4 ) -process.HLTSchedule = cms.Schedule( *(process.HLTriggerFirstPath, process.HLT_AK8PFJet360_TrimMass30_v16, process.HLT_AK8PFJet380_TrimMass30_v9, process.HLT_AK8PFJet400_TrimMass30_v10, process.HLT_AK8PFJet420_TrimMass30_v9, process.HLT_AK8PFHT750_TrimMass50_v10, process.HLT_AK8PFHT800_TrimMass50_v10, process.HLT_AK8PFHT850_TrimMass50_v9, process.HLT_AK8PFHT900_TrimMass50_v9, process.HLT_CaloJet500_NoJetID_v11, process.HLT_CaloJet550_NoJetID_v6, process.HLT_DoubleMu5_Upsilon_DoubleEle3_CaloIdL_TrackIdL_v2, process.HLT_DoubleMu3_DoubleEle7p5_CaloIdL_TrackIdL_Upsilon_v2, process.HLT_Trimuon5_3p5_2_Upsilon_Muon_v4, process.HLT_TrimuonOpen_5_3p5_2_Upsilon_Muon_v2, process.HLT_DoubleEle25_CaloIdL_MW_v2, process.HLT_DoubleEle27_CaloIdL_MW_v2, process.HLT_DoubleEle33_CaloIdL_MW_v15, process.HLT_DoubleEle24_eta2p1_WPTight_Gsf_v5, process.HLT_DoubleEle8_CaloIdM_TrackIdM_Mass8_DZ_PFHT350_v18, process.HLT_DoubleEle8_CaloIdM_TrackIdM_Mass8_PFHT350_v18, process.HLT_Ele27_Ele37_CaloIdL_MW_v2, process.HLT_Mu27_Ele37_CaloIdL_MW_v3, process.HLT_Mu37_Ele27_CaloIdL_MW_v3, process.HLT_Mu37_TkMu27_v3, process.HLT_DoubleMu4_3_Bs_v13, process.HLT_DoubleMu4_3_Jpsi_v1, process.HLT_DoubleMu4_JpsiTrk_Displaced_v14, process.HLT_DoubleMu4_LowMassNonResonantTrk_Displaced_v14, process.HLT_DoubleMu3_Trk_Tau3mu_v11, process.HLT_DoubleMu3_TkMu_DsTau3Mu_v2, process.HLT_DoubleMu4_PsiPrimeTrk_Displaced_v14, process.HLT_DoubleMu4_Mass8_DZ_PFHT350_v7, process.HLT_DoubleMu8_Mass8_PFHT350_v7, process.HLT_Mu3_PFJet40_v14, process.HLT_Mu7p5_L2Mu2_Jpsi_v9, process.HLT_Mu7p5_L2Mu2_Upsilon_v9, process.HLT_Mu7p5_Track2_Jpsi_v10, process.HLT_Mu7p5_Track3p5_Jpsi_v10, process.HLT_Mu7p5_Track7_Jpsi_v10, process.HLT_Mu7p5_Track2_Upsilon_v10, process.HLT_Mu7p5_Track3p5_Upsilon_v10, process.HLT_Mu7p5_Track7_Upsilon_v10, process.HLT_DoublePhoton33_CaloIdL_v5, process.HLT_DoublePhoton70_v5, process.HLT_DoublePhoton85_v13, process.HLT_Ele20_WPTight_Gsf_v4, process.HLT_Ele15_WPLoose_Gsf_v1, process.HLT_Ele17_WPLoose_Gsf_v1, process.HLT_Ele20_WPLoose_Gsf_v4, process.HLT_Ele20_eta2p1_WPLoose_Gsf_v4, process.HLT_DiEle27_WPTightCaloOnly_L1DoubleEG_v3, process.HLT_Ele27_WPTight_Gsf_v14, process.HLT_Ele32_WPTight_Gsf_v13, process.HLT_Ele35_WPTight_Gsf_v7, process.HLT_Ele35_WPTight_Gsf_L1EGMT_v3, process.HLT_Ele38_WPTight_Gsf_v7, process.HLT_Ele40_WPTight_Gsf_v7, process.HLT_Ele32_WPTight_Gsf_L1DoubleEG_v7, process.HLT_HT450_Beamspot_v9, process.HLT_HT300_Beamspot_v9, process.HLT_ZeroBias_Beamspot_v2, process.HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_CrossL1_v10, process.HLT_IsoMu20_eta2p1_MediumChargedIsoPFTau27_eta2p1_CrossL1_v10, process.HLT_IsoMu20_eta2p1_TightChargedIsoPFTau27_eta2p1_CrossL1_v10, process.HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10, process.HLT_IsoMu20_eta2p1_MediumChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10, process.HLT_IsoMu20_eta2p1_TightChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10, process.HLT_IsoMu20_v13, process.HLT_IsoMu24_v11, process.HLT_IsoMu24_eta2p1_v13, process.HLT_IsoMu27_v14, process.HLT_IsoMu30_v2, process.HLT_UncorrectedJetE30_NoBPTX_v5, process.HLT_UncorrectedJetE30_NoBPTX3BX_v5, process.HLT_UncorrectedJetE60_NoBPTX3BX_v5, process.HLT_UncorrectedJetE70_NoBPTX3BX_v5, process.HLT_L1SingleMu18_v3, process.HLT_L1SingleMu25_v2, process.HLT_L2Mu10_v7, process.HLT_L2Mu10_NoVertex_NoBPTX_v6, process.HLT_L2Mu50_v2, process.HLT_DoubleL2Mu50_v2, process.HLT_DoubleL2Mu23NoVtx_2Cha_CosmicSeed_v1, process.HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_v1, process.HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_Eta2p4_v1, process.HLT_DoubleL2Mu23NoVtx_2Cha_v1, process.HLT_DoubleL2Mu25NoVtx_2Cha_v1, process.HLT_DoubleL2Mu25NoVtx_2Cha_Eta2p4_v1, process.HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_v13, process.HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_v2, process.HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_v14, process.HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_v2, process.HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_Mass8_v4, process.HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_Mass8_v2, process.HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_Mass3p8_v4, process.HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_Mass3p8_v2, process.HLT_Mu25_TkMu0_Onia_v6, process.HLT_Mu30_TkMu0_Onia_v6, process.HLT_Mu20_TkMu0_Phi_v6, process.HLT_Mu25_TkMu0_Phi_v6, process.HLT_Mu12_v1, process.HLT_Mu15_v1, process.HLT_Mu20_v11, process.HLT_Mu27_v12, process.HLT_Mu50_v12, process.HLT_Mu55_v2, process.HLT_OldMu100_v3, process.HLT_TkMu100_v2, process.HLT_DiPFJet15_NoCaloMatched_v14, process.HLT_DiPFJet25_NoCaloMatched_v14, process.HLT_DiPFJet15_FBEta3_NoCaloMatched_v15, process.HLT_DiPFJet25_FBEta3_NoCaloMatched_v15, process.HLT_DiPFJetAve40_v12, process.HLT_DiPFJetAve60_v12, process.HLT_DiPFJetAve80_v11, process.HLT_DiPFJetAve140_v11, process.HLT_DiPFJetAve200_v11, process.HLT_DiPFJetAve260_v12, process.HLT_DiPFJetAve320_v12, process.HLT_DiPFJetAve400_v12, process.HLT_DiPFJetAve500_v12, process.HLT_DiPFJetAve15_HFJEC_v15, process.HLT_DiPFJetAve25_HFJEC_v15, process.HLT_DiPFJetAve35_HFJEC_v15, process.HLT_DiPFJetAve60_HFJEC_v13, process.HLT_DiPFJetAve80_HFJEC_v13, process.HLT_DiPFJetAve100_HFJEC_v13, process.HLT_DiPFJetAve160_HFJEC_v13, process.HLT_DiPFJetAve220_HFJEC_v14, process.HLT_DiPFJetAve300_HFJEC_v14, process.HLT_AK8PFJet15_v1, process.HLT_AK8PFJet25_v1, process.HLT_AK8PFJet40_v14, process.HLT_AK8PFJet60_v13, process.HLT_AK8PFJet80_v13, process.HLT_AK8PFJet140_v13, process.HLT_AK8PFJet200_v13, process.HLT_AK8PFJet260_v14, process.HLT_AK8PFJet320_v14, process.HLT_AK8PFJet400_v14, process.HLT_AK8PFJet450_v14, process.HLT_AK8PFJet500_v14, process.HLT_AK8PFJet550_v9, process.HLT_PFJet15_v1, process.HLT_PFJet25_v1, process.HLT_PFJet40_v19, process.HLT_PFJet60_v19, process.HLT_PFJet80_v18, process.HLT_PFJet140_v17, process.HLT_PFJet200_v17, process.HLT_PFJet260_v18, process.HLT_PFJet320_v18, process.HLT_PFJet400_v18, process.HLT_PFJet450_v19, process.HLT_PFJet500_v19, process.HLT_PFJet550_v9, process.HLT_PFJetFwd15_v1, process.HLT_PFJetFwd25_v1, process.HLT_PFJetFwd40_v17, process.HLT_PFJetFwd60_v17, process.HLT_PFJetFwd80_v16, process.HLT_PFJetFwd140_v16, process.HLT_PFJetFwd200_v16, process.HLT_PFJetFwd260_v17, process.HLT_PFJetFwd320_v17, process.HLT_PFJetFwd400_v17, process.HLT_PFJetFwd450_v17, process.HLT_PFJetFwd500_v17, process.HLT_AK8PFJetFwd15_v1, process.HLT_AK8PFJetFwd25_v1, process.HLT_AK8PFJetFwd40_v13, process.HLT_AK8PFJetFwd60_v12, process.HLT_AK8PFJetFwd80_v12, process.HLT_AK8PFJetFwd140_v12, process.HLT_AK8PFJetFwd200_v12, process.HLT_AK8PFJetFwd260_v13, process.HLT_AK8PFJetFwd320_v13, process.HLT_AK8PFJetFwd400_v13, process.HLT_AK8PFJetFwd450_v13, process.HLT_AK8PFJetFwd500_v13, process.HLT_PFHT180_v15, process.HLT_PFHT250_v15, process.HLT_PFHT370_v15, process.HLT_PFHT430_v15, process.HLT_PFHT510_v15, process.HLT_PFHT590_v15, process.HLT_PFHT680_v15, process.HLT_PFHT780_v15, process.HLT_PFHT890_v15, process.HLT_PFHT1050_v16, process.HLT_PFHT500_PFMET100_PFMHT100_IDTight_v10, process.HLT_PFHT500_PFMET110_PFMHT110_IDTight_v10, process.HLT_PFHT700_PFMET85_PFMHT85_IDTight_v10, process.HLT_PFHT700_PFMET95_PFMHT95_IDTight_v10, process.HLT_PFHT800_PFMET75_PFMHT75_IDTight_v10, process.HLT_PFHT800_PFMET85_PFMHT85_IDTight_v10, process.HLT_PFMET110_PFMHT110_IDTight_v18, process.HLT_PFMET120_PFMHT120_IDTight_v18, process.HLT_PFMET130_PFMHT130_IDTight_v18, process.HLT_PFMET140_PFMHT140_IDTight_v18, process.HLT_PFMET100_PFMHT100_IDTight_CaloBTagCSV_3p1_v7, process.HLT_PFMET110_PFMHT110_IDTight_CaloBTagCSV_3p1_v7, process.HLT_PFMET120_PFMHT120_IDTight_CaloBTagCSV_3p1_v7, process.HLT_PFMET130_PFMHT130_IDTight_CaloBTagCSV_3p1_v7, process.HLT_PFMET140_PFMHT140_IDTight_CaloBTagCSV_3p1_v7, process.HLT_PFMET120_PFMHT120_IDTight_PFHT60_v7, process.HLT_PFMETNoMu120_PFMHTNoMu120_IDTight_PFHT60_v7, process.HLT_PFMETTypeOne120_PFMHT120_IDTight_PFHT60_v7, process.HLT_PFMETTypeOne110_PFMHT110_IDTight_v10, process.HLT_PFMETTypeOne120_PFMHT120_IDTight_v10, process.HLT_PFMETTypeOne130_PFMHT130_IDTight_v10, process.HLT_PFMETTypeOne140_PFMHT140_IDTight_v9, process.HLT_PFMETNoMu110_PFMHTNoMu110_IDTight_v18, process.HLT_PFMETNoMu120_PFMHTNoMu120_IDTight_v18, process.HLT_PFMETNoMu130_PFMHTNoMu130_IDTight_v17, process.HLT_PFMETNoMu140_PFMHTNoMu140_IDTight_v17, process.HLT_MonoCentralPFJet80_PFMETNoMu110_PFMHTNoMu110_IDTight_v18, process.HLT_MonoCentralPFJet80_PFMETNoMu120_PFMHTNoMu120_IDTight_v18, process.HLT_MonoCentralPFJet80_PFMETNoMu130_PFMHTNoMu130_IDTight_v17, process.HLT_MonoCentralPFJet80_PFMETNoMu140_PFMHTNoMu140_IDTight_v17, process.HLT_L1ETMHadSeeds_v1, process.HLT_CaloMHT90_v3, process.HLT_CaloMET80_NotCleaned_v3, process.HLT_CaloMET90_NotCleaned_v3, process.HLT_CaloMET100_NotCleaned_v3, process.HLT_CaloMET110_NotCleaned_v3, process.HLT_CaloMET250_NotCleaned_v3, process.HLT_CaloMET70_HBHECleaned_v3, process.HLT_CaloMET80_HBHECleaned_v3, process.HLT_CaloMET90_HBHECleaned_v3, process.HLT_CaloMET100_HBHECleaned_v3, process.HLT_CaloMET250_HBHECleaned_v3, process.HLT_CaloMET300_HBHECleaned_v3, process.HLT_CaloMET350_HBHECleaned_v3, process.HLT_PFMET200_NotCleaned_v7, process.HLT_PFMET200_HBHECleaned_v7, process.HLT_PFMET250_HBHECleaned_v7, process.HLT_PFMET300_HBHECleaned_v7, process.HLT_PFMET200_HBHE_BeamHaloCleaned_v7, process.HLT_PFMETTypeOne200_HBHE_BeamHaloCleaned_v7, process.HLT_MET105_IsoTrk50_v8, process.HLT_MET120_IsoTrk50_v8, process.HLT_SingleJet30_Mu12_SinglePFJet40_v9, process.HLT_Mu12_DoublePFJets40_CaloBTagCSV_p79_v1, process.HLT_Mu12_DoublePFJets100_CaloBTagCSV_p79_v1, process.HLT_Mu12_DoublePFJets200_CaloBTagCSV_p79_v1, process.HLT_Mu12_DoublePFJets350_CaloBTagCSV_p79_v1, process.HLT_Mu12_DoublePFJets40MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, process.HLT_Mu12_DoublePFJets54MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, process.HLT_Mu12_DoublePFJets62MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, process.HLT_DoublePFJets40_CaloBTagCSV_p79_v1, process.HLT_DoublePFJets100_CaloBTagCSV_p79_v1, process.HLT_DoublePFJets200_CaloBTagCSV_p79_v1, process.HLT_DoublePFJets350_CaloBTagCSV_p79_v1, process.HLT_DoublePFJets116MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, process.HLT_DoublePFJets128MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, process.HLT_Photon300_NoHE_v11, process.HLT_Mu8_TrkIsoVVL_v11, process.HLT_Mu8_DiEle12_CaloIdL_TrackIdL_DZ_v16, process.HLT_Mu8_DiEle12_CaloIdL_TrackIdL_v16, process.HLT_Mu8_Ele8_CaloIdM_TrackIdM_Mass8_PFHT350_DZ_v17, process.HLT_Mu8_Ele8_CaloIdM_TrackIdM_Mass8_PFHT350_v17, process.HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_v11, process.HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_v9, process.HLT_Mu17_TrkIsoVVL_v11, process.HLT_Mu19_TrkIsoVVL_v2, process.HLT_BTagMu_AK4DiJet20_Mu5_v11, process.HLT_BTagMu_AK4DiJet40_Mu5_v11, process.HLT_BTagMu_AK4DiJet70_Mu5_v11, process.HLT_BTagMu_AK4DiJet110_Mu5_v11, process.HLT_BTagMu_AK4DiJet170_Mu5_v10, process.HLT_BTagMu_AK4Jet300_Mu5_v11, process.HLT_BTagMu_AK8DiJet170_Mu5_v7, process.HLT_BTagMu_AK8Jet300_Mu5_v11, process.HLT_Ele15_Ele8_CaloIdL_TrackIdL_IsoVL_v1, process.HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_v17, process.HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_v17, process.HLT_Mu23_TrkIsoVVL_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_v13, process.HLT_Mu23_TrkIsoVVL_Ele12_CaloIdL_TrackIdL_IsoVL_v5, process.HLT_Mu12_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_v5, process.HLT_Mu12_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_v13, process.HLT_Mu12_DoublePhoton20_v3, process.HLT_TriplePhoton_20_20_20_CaloIdLV2_v2, process.HLT_TriplePhoton_20_20_20_CaloIdLV2_R9IdVL_v2, process.HLT_TriplePhoton_30_30_10_CaloIdLV2_v3, process.HLT_TriplePhoton_30_30_10_CaloIdLV2_R9IdVL_v3, process.HLT_TriplePhoton_35_35_5_CaloIdLV2_R9IdVL_v3, process.HLT_Photon20_v1, process.HLT_Photon33_v4, process.HLT_Photon50_v12, process.HLT_Photon75_v12, process.HLT_Photon90_v12, process.HLT_Photon120_v12, process.HLT_Photon150_v5, process.HLT_Photon175_v13, process.HLT_Photon200_v12, process.HLT_Photon50_R9Id90_HE10_IsoM_v13, process.HLT_Photon75_R9Id90_HE10_IsoM_v13, process.HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_CaloMJJ300_PFJetsMJJ400DEta3_v3, process.HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_CaloMJJ400_PFJetsMJJ600DEta3_v3, process.HLT_Photon90_R9Id90_HE10_IsoM_v13, process.HLT_Photon120_R9Id90_HE10_IsoM_v13, process.HLT_Photon165_R9Id90_HE10_IsoM_v14, process.HLT_Photon90_CaloIdL_PFHT700_v14, process.HLT_Diphoton30_22_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass90_v12, process.HLT_Diphoton30_22_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass95_v12, process.HLT_Diphoton30PV_18PV_R9Id_AND_IsoCaloId_AND_HE_R9Id_PixelVeto_Mass55_v13, process.HLT_Diphoton30PV_18PV_R9Id_AND_IsoCaloId_AND_HE_R9Id_NoPixelVeto_Mass55_v12, process.HLT_Diphoton30EB_18EB_R9Id_OR_IsoCaloId_AND_HE_R9Id_NoPixelVeto_Mass55_v12, process.HLT_Diphoton30EB_18EB_R9Id_OR_IsoCaloId_AND_HE_R9Id_PixelVeto_Mass55_v13, process.HLT_Dimuon0_Jpsi_L1_NoOS_v6, process.HLT_Dimuon0_Jpsi_NoVertexing_NoOS_v6, process.HLT_Dimuon0_Jpsi_v7, process.HLT_Dimuon0_Jpsi_NoVertexing_v7, process.HLT_Dimuon0_Jpsi_L1_4R_0er1p5R_v6, process.HLT_Dimuon0_Jpsi_NoVertexing_L1_4R_0er1p5R_v6, process.HLT_Dimuon0_Jpsi3p5_Muon2_v5, process.HLT_Dimuon0_Upsilon_L1_4p5_v7, process.HLT_Dimuon0_Upsilon_L1_5_v7, process.HLT_Dimuon0_Upsilon_L1_4p5NoOS_v6, process.HLT_Dimuon0_Upsilon_L1_4p5er2p0_v7, process.HLT_Dimuon0_Upsilon_L1_4p5er2p0M_v6, process.HLT_Dimuon0_Upsilon_NoVertexing_v6, process.HLT_Dimuon0_Upsilon_L1_5M_v6, process.HLT_Dimuon0_LowMass_L1_0er1p5R_v6, process.HLT_Dimuon0_LowMass_L1_0er1p5_v7, process.HLT_Dimuon0_LowMass_v7, process.HLT_Dimuon0_LowMass_L1_4_v7, process.HLT_Dimuon0_LowMass_L1_4R_v6, process.HLT_Dimuon0_LowMass_L1_TM530_v5, process.HLT_Dimuon0_Upsilon_Muon_L1_TM0_v5, process.HLT_Dimuon0_Upsilon_Muon_NoL1Mass_v5, process.HLT_TripleMu_5_3_3_Mass3p8to60_DZ_v7, process.HLT_TripleMu_10_5_5_DZ_v9, process.HLT_TripleMu_12_10_5_v9, process.HLT_Tau3Mu_Mu7_Mu1_TkMu1_Tau15_v2, process.HLT_Tau3Mu_Mu7_Mu1_TkMu1_Tau15_Charge1_v2, process.HLT_Tau3Mu_Mu7_Mu1_TkMu1_IsoTau15_v2, process.HLT_Tau3Mu_Mu7_Mu1_TkMu1_IsoTau15_Charge1_v2, process.HLT_DoubleMu3_DZ_PFMET50_PFMHT60_v8, process.HLT_DoubleMu3_DZ_PFMET70_PFMHT70_v8, process.HLT_DoubleMu3_DZ_PFMET90_PFMHT90_v8, process.HLT_DoubleMu3_Trk_Tau3mu_NoL1Mass_v5, process.HLT_DoubleMu4_Jpsi_Displaced_v6, process.HLT_DoubleMu4_Jpsi_NoVertexing_v6, process.HLT_DoubleMu4_JpsiTrkTrk_Displaced_v6, process.HLT_DoubleMu43NoFiltersNoVtx_v3, process.HLT_DoubleMu48NoFiltersNoVtx_v3, process.HLT_Mu43NoFiltersNoVtx_Photon43_CaloIdL_v4, process.HLT_Mu48NoFiltersNoVtx_Photon48_CaloIdL_v4, process.HLT_DoubleMu20_7_Mass0to30_L1_DM4_v6, process.HLT_DoubleMu20_7_Mass0to30_L1_DM4EG_v6, process.HLT_HT425_v8, process.HLT_HT430_DisplacedDijet40_DisplacedTrack_v11, process.HLT_HT500_DisplacedDijet40_DisplacedTrack_v11, process.HLT_HT430_DisplacedDijet60_DisplacedTrack_v11, process.HLT_HT400_DisplacedDijet40_DisplacedTrack_v11, process.HLT_HT650_DisplacedDijet60_Inclusive_v11, process.HLT_HT550_DisplacedDijet60_Inclusive_v11, process.HLT_DiJet110_35_Mjj650_PFMET110_v7, process.HLT_DiJet110_35_Mjj650_PFMET120_v7, process.HLT_DiJet110_35_Mjj650_PFMET130_v7, process.HLT_TripleJet110_35_35_Mjj650_PFMET110_v7, process.HLT_TripleJet110_35_35_Mjj650_PFMET120_v7, process.HLT_TripleJet110_35_35_Mjj650_PFMET130_v7, process.HLT_VBF_DoubleLooseChargedIsoPFTau20_Trk1_eta2p1_v1, process.HLT_VBF_DoubleMediumChargedIsoPFTau20_Trk1_eta2p1_v1, process.HLT_VBF_DoubleTightChargedIsoPFTau20_Trk1_eta2p1_v1, process.HLT_Ele30_eta2p1_WPTight_Gsf_CentralPFJet35_EleCleaned_v11, process.HLT_Ele28_eta2p1_WPTight_Gsf_HT150_v11, process.HLT_Ele28_HighEta_SC20_Mass55_v11, process.HLT_DoubleMu20_7_Mass0to30_Photon23_v6, process.HLT_Ele15_IsoVVVL_PFHT450_CaloBTagCSV_4p5_v7, process.HLT_Ele15_IsoVVVL_PFHT450_PFMET50_v14, process.HLT_Ele15_IsoVVVL_PFHT450_v14, process.HLT_Ele50_IsoVVVL_PFHT450_v14, process.HLT_Ele15_IsoVVVL_PFHT600_v18, process.HLT_Mu8_TrkIsoVVL_DiPFJet40_DEta3p5_MJJ750_HTT300_PFMETNoMu60_v13, process.HLT_Mu10_TrkIsoVVL_DiPFJet40_DEta3p5_MJJ750_HTT350_PFMETNoMu60_v12, process.HLT_Mu15_IsoVVVL_PFHT450_CaloBTagCSV_4p5_v7, process.HLT_Mu15_IsoVVVL_PFHT450_PFMET50_v13, process.HLT_Mu15_IsoVVVL_PFHT450_v13, process.HLT_Mu50_IsoVVVL_PFHT450_v13, process.HLT_Mu15_IsoVVVL_PFHT600_v17, process.HLT_Dimuon10_PsiPrime_Barrel_Seagulls_v6, process.HLT_Dimuon20_Jpsi_Barrel_Seagulls_v6, process.HLT_Dimuon10_Upsilon_Barrel_Seagulls_v6, process.HLT_Dimuon12_Upsilon_eta1p5_v13, process.HLT_Dimuon14_Phi_Barrel_Seagulls_v6, process.HLT_Dimuon18_PsiPrime_v13, process.HLT_Dimuon25_Jpsi_v13, process.HLT_Dimuon18_PsiPrime_noCorrL1_v4, process.HLT_Dimuon24_Upsilon_noCorrL1_v4, process.HLT_Dimuon24_Phi_noCorrL1_v4, process.HLT_Dimuon25_Jpsi_noCorrL1_v4, process.HLT_DiMu9_Ele9_CaloIdL_TrackIdL_DZ_v15, process.HLT_DiMu9_Ele9_CaloIdL_TrackIdL_v15, process.HLT_DoubleIsoMu20_eta2p1_v5, process.HLT_DoubleIsoMu24_eta2p1_v5, process.HLT_TrkMu12_DoubleTrkMu5NoFiltersNoVtx_v5, process.HLT_TrkMu16_DoubleTrkMu6NoFiltersNoVtx_v11, process.HLT_TrkMu17_DoubleTrkMu8NoFiltersNoVtx_v12, process.HLT_Mu8_v11, process.HLT_Mu17_v11, process.HLT_Mu19_v2, process.HLT_Mu17_Photon30_IsoCaloId_v4, process.HLT_Ele8_CaloIdL_TrackIdL_IsoVL_PFJet30_v14, process.HLT_Ele12_CaloIdL_TrackIdL_IsoVL_PFJet30_v16, process.HLT_Ele15_CaloIdL_TrackIdL_IsoVL_PFJet30_v1, process.HLT_Ele23_CaloIdL_TrackIdL_IsoVL_PFJet30_v16, process.HLT_Ele8_CaloIdM_TrackIdM_PFJet30_v16, process.HLT_Ele17_CaloIdM_TrackIdM_PFJet30_v14, process.HLT_Ele23_CaloIdM_TrackIdM_PFJet30_v16, process.HLT_Ele50_CaloIdVT_GsfTrkIdT_PFJet165_v16, process.HLT_Ele115_CaloIdVT_GsfTrkIdT_v12, process.HLT_Ele135_CaloIdVT_GsfTrkIdT_v5, process.HLT_Ele145_CaloIdVT_GsfTrkIdT_v6, process.HLT_Ele200_CaloIdVT_GsfTrkIdT_v6, process.HLT_Ele250_CaloIdVT_GsfTrkIdT_v11, process.HLT_Ele300_CaloIdVT_GsfTrkIdT_v11, process.HLT_PFHT330PT30_QuadPFJet_75_60_45_40_TriplePFBTagDeepCSV_4p5_v1, process.HLT_PFHT330PT30_QuadPFJet_75_60_45_40_v7, process.HLT_PFHT380_SixPFJet32_DoublePFBTagCSV_2p2_v7, process.HLT_PFHT380_SixPFJet32_DoublePFBTagDeepCSV_2p2_v6, process.HLT_PFHT380_SixPFJet32_v7, process.HLT_PFHT430_SixPFJet40_PFBTagCSV_1p5_v7, process.HLT_PFHT430_SixPFJet40_v9, process.HLT_PFHT350_v17, process.HLT_PFHT350MinPFJet15_v7, process.HLT_Photon60_R9Id90_CaloIdL_IsoL_v4, process.HLT_Photon60_R9Id90_CaloIdL_IsoL_DisplacedIdL_v4, process.HLT_Photon60_R9Id90_CaloIdL_IsoL_DisplacedIdL_PFHT350MinPFJet15_v9, process.HLT_FullTrack_Multiplicity85_v3, process.HLT_FullTrack_Multiplicity100_v2, process.HLT_FullTrack_Multiplicity130_v2, process.HLT_FullTrack_Multiplicity155_v3, process.HLT_ECALHT800_v9, process.HLT_DiSC30_18_EIso_AND_HE_Mass70_v12, process.HLT_Physics_v7, process.HLT_Physics_part0_v7, process.HLT_Physics_part1_v7, process.HLT_Physics_part2_v7, process.HLT_Physics_part3_v7, process.HLT_Physics_part4_v7, process.HLT_Physics_part5_v7, process.HLT_Physics_part6_v7, process.HLT_Physics_part7_v7, process.DST_Physics_v7, process.HLT_Random_v3, process.HLT_ZeroBias_v6, process.HLT_ZeroBias_part0_v6, process.HLT_ZeroBias_part1_v6, process.HLT_ZeroBias_part2_v6, process.HLT_ZeroBias_part3_v6, process.HLT_ZeroBias_part4_v6, process.HLT_ZeroBias_part5_v6, process.HLT_ZeroBias_part6_v6, process.HLT_ZeroBias_part7_v6, process.DST_ZeroBias_v2, process.DST_HT250_CaloScouting_v9, process.DST_HT250_CaloBTagScouting_v8, process.DST_HT410_PFScouting_v14, process.DST_HT410_BTagScouting_v14, process.DST_ZeroBias_BTagScouting_v13, process.DST_ZeroBias_CaloScouting_PFScouting_v12, process.DST_CaloJet40_BTagScouting_v13, process.DST_CaloJet40_CaloScouting_PFScouting_v13, process.DST_CaloJet40_CaloBTagScouting_v12, process.DST_L1HTT_BTagScouting_v13, process.DST_L1HTT_CaloScouting_PFScouting_v13, process.DST_L1HTT_CaloBTagScouting_v12, process.DST_L1DoubleMu_BTagScouting_v14, process.DST_L1DoubleMu_CaloScouting_PFScouting_v13, process.DST_DoubleMu3_noVtx_CaloScouting_Monitoring_v5, process.DST_DoubleMu3_noVtx_CaloScouting_v5, process.DST_DoubleMu1_noVtx_CaloScouting_v1, process.DST_DoubleMu3_noVtx_Mass10_PFScouting_v1, process.HLT_AK4CaloJet30_v11, process.HLT_AK4CaloJet40_v10, process.HLT_AK4CaloJet50_v10, process.HLT_AK4CaloJet80_v10, process.HLT_AK4CaloJet100_v10, process.HLT_AK4CaloJet120_v9, process.HLT_AK4PFJet30_v17, process.HLT_AK4PFJet50_v17, process.HLT_AK4PFJet80_v17, process.HLT_AK4PFJet100_v17, process.HLT_AK4PFJet120_v16, process.HLT_SinglePhoton10_Eta3p1ForPPRef_v8, process.HLT_SinglePhoton20_Eta3p1ForPPRef_v8, process.HLT_SinglePhoton30_Eta3p1ForPPRef_v8, process.HLT_Photon20_HoverELoose_v9, process.HLT_Photon30_HoverELoose_v9, process.HLT_EcalCalibration_v4, process.HLT_HcalCalibration_v5, process.AlCa_EcalPhiSym_v8, process.HLT_L1UnpairedBunchBptxMinus_v2, process.HLT_L1UnpairedBunchBptxPlus_v2, process.HLT_L1NotBptxOR_v3, process.HLT_L1MinimumBiasHF_OR_v2, process.HLT_L1MinimumBiasHF0OR_v3, process.HLT_L1_CDC_SingleMu_3_er1p2_TOP120_DPHI2p618_3p142_v2, process.HLT_HcalNZS_v12, process.HLT_HcalPhiSym_v14, process.HLT_HcalIsolatedbunch_v4, process.HLT_IsoTrackHB_v3, process.HLT_IsoTrackHE_v3, process.HLT_ZeroBias_FirstCollisionAfterAbortGap_v5, process.HLT_ZeroBias_IsolatedBunches_v5, process.HLT_ZeroBias_FirstCollisionInTrain_v4, process.HLT_ZeroBias_LastCollisionInTrain_v3, process.HLT_ZeroBias_FirstBXAfterTrain_v3, process.AlCa_RPCMuonNormalisation_v13, process.AlCa_LumiPixels_Random_v4, process.AlCa_LumiPixels_ZeroBias_v8, process.MC_ReducedIterativeTracking_v11, process.MC_PFMET_v15, process.MC_AK4PFJets_v15, process.MC_PFBTagCSV_v9, process.MC_PFHT_v14, process.MC_PFMHT_v14, process.MC_CaloMET_v8, process.MC_CaloMET_JetIdCleaned_v9, process.MC_AK4CaloJets_v9, process.MC_AK4CaloJetsFromPV_v7, process.MC_CaloBTagCSV_v7, process.MC_CaloHT_v8, process.MC_CaloMHT_v8, process.MC_AK8PFJets_v15, process.MC_AK8TrimPFJets_v15, process.MC_AK8PFHT_v14, process.MC_AK8CaloHT_v8, process.MC_Diphoton10_10_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass10_v12, process.MC_DoubleEle5_CaloIdL_MW_v13, process.MC_Ele5_WPTight_Gsf_v6, process.MC_Ele15_Ele10_CaloIdL_TrackIdL_IsoVL_DZ_v13, process.MC_IsoMu_v13, process.MC_DoubleMu_TrkIsoVVL_DZ_v10, process.MC_DoubleMuNoFiltersNoVtx_v7, process.AlCa_EcalPi0EBonly_v12, process.AlCa_EcalPi0EEonly_v12, process.AlCa_EcalEtaEBonly_v12, process.AlCa_EcalEtaEEonly_v12, process.HLT_Ele24_eta2p1_WPTight_Gsf_LooseChargedIsoPFTau30_eta2p1_CrossL1_v11, process.HLT_Ele24_eta2p1_WPTight_Gsf_MediumChargedIsoPFTau30_eta2p1_CrossL1_v11, process.HLT_Ele24_eta2p1_WPTight_Gsf_TightChargedIsoPFTau30_eta2p1_CrossL1_v11, process.HLT_Ele24_eta2p1_WPTight_Gsf_LooseChargedIsoPFTau30_eta2p1_TightID_CrossL1_v11, process.HLT_Ele24_eta2p1_WPTight_Gsf_MediumChargedIsoPFTau30_eta2p1_TightID_CrossL1_v11, process.HLT_Ele24_eta2p1_WPTight_Gsf_TightChargedIsoPFTau30_eta2p1_TightID_CrossL1_v11, process.HLT_DoubleMediumChargedIsoPFTau35_Trk1_eta2p1_Reg_v10, process.HLT_DoubleMediumChargedIsoPFTau40_Trk1_eta2p1_Reg_v10, process.HLT_DoubleTightChargedIsoPFTau35_Trk1_eta2p1_Reg_v10, process.HLT_DoubleTightChargedIsoPFTau40_Trk1_eta2p1_Reg_v10, process.HLT_DoubleMediumChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_v10, process.HLT_DoubleMediumChargedIsoPFTau40_Trk1_TightID_eta2p1_Reg_v10, process.HLT_DoubleTightChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_v10, process.HLT_DoubleTightChargedIsoPFTau40_Trk1_TightID_eta2p1_Reg_v10, process.HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_v10, process.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET90_v10, process.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET100_v10, process.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET110_v6, process.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET120_v6, process.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET130_v6, process.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET140_v1, process.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_v10, process.HLT_MediumChargedIsoPFTau180HighPtRelaxedIso_Trk50_eta2p1_1pr_v9, process.HLT_MediumChargedIsoPFTau180HighPtRelaxedIso_Trk50_eta2p1_v10, process.HLT_MediumChargedIsoPFTau200HighPtRelaxedIso_Trk50_eta2p1_v10, process.HLT_MediumChargedIsoPFTau220HighPtRelaxedIso_Trk50_eta2p1_v10, process.HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau35_Trk1_eta2p1_Reg_CrossL1_v10, process.HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_CrossL1_v10, process.HLT_IsoMu24_eta2p1_TightChargedIsoPFTau35_Trk1_eta2p1_Reg_CrossL1_v10, process.HLT_IsoMu24_eta2p1_TightChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_CrossL1_v10, process.HLT_Ele16_Ele12_Ele8_CaloIdL_TrackIdL_v7, process.HLT_Rsq0p35_v13, process.HLT_Rsq0p40_v13, process.HLT_RsqMR300_Rsq0p09_MR200_v13, process.HLT_RsqMR320_Rsq0p09_MR200_v13, process.HLT_RsqMR300_Rsq0p09_MR200_4jet_v13, process.HLT_RsqMR320_Rsq0p09_MR200_4jet_v13, process.HLT_IsoMu27_LooseChargedIsoPFTau20_Trk1_eta2p1_SingleL1_v3, process.HLT_IsoMu27_MediumChargedIsoPFTau20_Trk1_eta2p1_SingleL1_v3, process.HLT_IsoMu27_TightChargedIsoPFTau20_Trk1_eta2p1_SingleL1_v3, process.HLT_IsoMu27_MET90_v1, process.HLT_IsoMu20_eta2p1_LooseChargedIsoPFTauHPS27_eta2p1_CrossL1_v1, process.HLT_IsoMu24_eta2p1_MediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_CrossL1_v1, process.HLT_DoubleMediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_v1, process.HLT_Photon50_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ300DEta3_PFMET50_v3, process.HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ300DEta3_v3, process.HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ600DEta3_v3, process.HLT_PFMET100_PFMHT100_IDTight_PFHT60_v7, process.HLT_PFMETNoMu100_PFMHTNoMu100_IDTight_PFHT60_v7, process.HLT_PFMETTypeOne100_PFMHT100_IDTight_PFHT60_v7, process.HLT_Mu18_Mu9_SameSign_v3, process.HLT_Mu18_Mu9_SameSign_DZ_v3, process.HLT_Mu18_Mu9_v3, process.HLT_Mu18_Mu9_DZ_v3, process.HLT_Mu20_Mu10_SameSign_v3, process.HLT_Mu20_Mu10_SameSign_DZ_v3, process.HLT_Mu20_Mu10_v3, process.HLT_Mu20_Mu10_DZ_v3, process.HLT_Mu23_Mu12_SameSign_v3, process.HLT_Mu23_Mu12_SameSign_DZ_v3, process.HLT_Mu23_Mu12_v3, process.HLT_Mu23_Mu12_DZ_v3, process.HLT_DoubleMu2_Jpsi_DoubleTrk1_Phi1p05_v5, process.HLT_DoubleMu2_Jpsi_DoubleTkMu0_Phi_v3, process.HLT_DoubleMu3_DCA_PFMET50_PFMHT60_v8, process.HLT_TripleMu_5_3_3_Mass3p8to60_DCA_v2, process.HLT_QuadPFJet98_83_71_15_DoubleBTagCSV_p013_p08_VBF1_v7, process.HLT_QuadPFJet103_88_75_15_DoubleBTagCSV_p013_p08_VBF1_v7, process.HLT_QuadPFJet105_90_76_15_DoubleBTagCSV_p013_p08_VBF1_v7, process.HLT_QuadPFJet111_90_80_15_DoubleBTagCSV_p013_p08_VBF1_v7, process.HLT_QuadPFJet98_83_71_15_BTagCSV_p013_VBF2_v7, process.HLT_QuadPFJet103_88_75_15_BTagCSV_p013_VBF2_v7, process.HLT_QuadPFJet105_88_76_15_BTagCSV_p013_VBF2_v7, process.HLT_QuadPFJet111_90_80_15_BTagCSV_p013_VBF2_v7, process.HLT_QuadPFJet98_83_71_15_v3, process.HLT_QuadPFJet103_88_75_15_v3, process.HLT_QuadPFJet105_88_76_15_v3, process.HLT_QuadPFJet111_90_80_15_v3, process.HLT_AK8PFJet330_TrimMass30_PFAK8BTagCSV_p17_v1, process.HLT_AK8PFJet330_TrimMass30_PFAK8BTagCSV_p1_v1, process.HLT_AK8PFJet330_TrimMass30_PFAK8BoostedDoubleB_p02_v1, process.HLT_Diphoton30_18_PVrealAND_R9Id_AND_IsoCaloId_AND_HE_R9Id_PixelVeto_Mass55_v8, process.HLT_Diphoton30_18_PVrealAND_R9Id_AND_IsoCaloId_AND_HE_R9Id_NoPixelVeto_Mass55_v8, process.HLTriggerFinalPath, process.HLTAnalyzerEndpath, process.ParkingHLTPhysicsOutput, process.ParkingZeroBiasOutput, process.PhysicsCommissioningOutput, process.PhysicsEGammaOutput, process.PhysicsEndOfFillOutput, process.PhysicsHadronsTausOutput, process.PhysicsMuonsOutput, process.ParkingOutput, process.DQMOutput, process.DQMOnlineBeamspotOutput, process.DQMCalibrationOutput, process.DQMEventDisplayOutput, process.HLTMonitorOutput, process.RPCMONOutput, process.CalibrationOutput, process.EcalCalibrationOutput, process.ALCAPHISYMOutput, process.ALCALUMIPIXELSOutput, process.ALCAP0Output, process.ExpressOutput, process.ExpressAlignmentOutput, process.NanoDSTOutput, process.ScoutingPFOutput, process.ScoutingCaloMuonOutput, process.PhysicsParkingScoutingMonitorOutput, process.PhysicsHLTPhysics1Output, process.PhysicsHLTPhysics2Output, process.PhysicsHLTPhysics3Output, process.PhysicsHLTPhysics4Output, process.PhysicsZeroBias1Output, process.PhysicsZeroBias2Output, process.PhysicsZeroBias3Output, process.PhysicsZeroBias4Output )) +process.HLTSchedule = cms.Schedule( *(process.HLTriggerFirstPath, process.HLT_AK8PFJet360_TrimMass30_v16, process.HLT_AK8PFJet380_TrimMass30_v9, process.HLT_AK8PFJet400_TrimMass30_v10, process.HLT_AK8PFJet420_TrimMass30_v9, process.HLT_AK8PFHT750_TrimMass50_v10, process.HLT_AK8PFHT800_TrimMass50_v10, process.HLT_AK8PFHT850_TrimMass50_v9, process.HLT_AK8PFHT900_TrimMass50_v9, process.HLT_CaloJet500_NoJetID_v11, process.HLT_CaloJet550_NoJetID_v6, process.HLT_DoubleMu5_Upsilon_DoubleEle3_CaloIdL_TrackIdL_v2, process.HLT_DoubleMu3_DoubleEle7p5_CaloIdL_TrackIdL_Upsilon_v2, process.HLT_Trimuon5_3p5_2_Upsilon_Muon_v4, process.HLT_TrimuonOpen_5_3p5_2_Upsilon_Muon_v2, process.HLT_DoubleEle25_CaloIdL_MW_v2, process.HLT_DoubleEle27_CaloIdL_MW_v2, process.HLT_DoubleEle33_CaloIdL_MW_v15, process.HLT_DoubleEle24_eta2p1_WPTight_Gsf_v5, process.HLT_DoubleEle8_CaloIdM_TrackIdM_Mass8_DZ_PFHT350_v18, process.HLT_DoubleEle8_CaloIdM_TrackIdM_Mass8_PFHT350_v18, process.HLT_Ele27_Ele37_CaloIdL_MW_v2, process.HLT_Mu27_Ele37_CaloIdL_MW_v3, process.HLT_Mu37_Ele27_CaloIdL_MW_v3, process.HLT_Mu37_TkMu27_v3, process.HLT_DoubleMu4_3_Bs_v13, process.HLT_DoubleMu4_3_Jpsi_v1, process.HLT_DoubleMu4_JpsiTrk_Displaced_v14, process.HLT_DoubleMu4_LowMassNonResonantTrk_Displaced_v14, process.HLT_DoubleMu3_Trk_Tau3mu_v11, process.HLT_DoubleMu3_TkMu_DsTau3Mu_v2, process.HLT_DoubleMu4_PsiPrimeTrk_Displaced_v14, process.HLT_DoubleMu4_Mass8_DZ_PFHT350_v7, process.HLT_DoubleMu8_Mass8_PFHT350_v7, process.HLT_Mu3_PFJet40_v14, process.HLT_Mu7p5_L2Mu2_Jpsi_v9, process.HLT_Mu7p5_L2Mu2_Upsilon_v9, process.HLT_Mu7p5_Track2_Jpsi_v10, process.HLT_Mu7p5_Track3p5_Jpsi_v10, process.HLT_Mu7p5_Track7_Jpsi_v10, process.HLT_Mu7p5_Track2_Upsilon_v10, process.HLT_Mu7p5_Track3p5_Upsilon_v10, process.HLT_Mu7p5_Track7_Upsilon_v10, process.HLT_DoublePhoton33_CaloIdL_v5, process.HLT_DoublePhoton70_v5, process.HLT_DoublePhoton85_v13, process.HLT_Ele20_WPTight_Gsf_v4, process.HLT_Ele15_WPLoose_Gsf_v1, process.HLT_Ele17_WPLoose_Gsf_v1, process.HLT_Ele20_WPLoose_Gsf_v4, process.HLT_Ele20_eta2p1_WPLoose_Gsf_v4, process.HLT_DiEle27_WPTightCaloOnly_L1DoubleEG_v3, process.HLT_Ele27_WPTight_Gsf_v14, process.HLT_Ele32_WPTight_Gsf_v13, process.HLT_Ele35_WPTight_Gsf_v7, process.HLT_Ele35_WPTight_Gsf_L1EGMT_v3, process.HLT_Ele38_WPTight_Gsf_v7, process.HLT_Ele40_WPTight_Gsf_v7, process.HLT_Ele32_WPTight_Gsf_L1DoubleEG_v7, process.HLT_HT450_Beamspot_v9, process.HLT_HT300_Beamspot_v9, process.HLT_ZeroBias_Beamspot_v2, process.HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_CrossL1_v10, process.HLT_IsoMu20_eta2p1_MediumChargedIsoPFTau27_eta2p1_CrossL1_v10, process.HLT_IsoMu20_eta2p1_TightChargedIsoPFTau27_eta2p1_CrossL1_v10, process.HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10, process.HLT_IsoMu20_eta2p1_MediumChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10, process.HLT_IsoMu20_eta2p1_TightChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10, process.HLT_IsoMu20_v13, process.HLT_IsoMu24_v11, process.HLT_IsoMu24_eta2p1_v13, process.HLT_IsoMu27_v14, process.HLT_IsoMu30_v2, process.HLT_UncorrectedJetE30_NoBPTX_v5, process.HLT_UncorrectedJetE30_NoBPTX3BX_v5, process.HLT_UncorrectedJetE60_NoBPTX3BX_v5, process.HLT_UncorrectedJetE70_NoBPTX3BX_v5, process.HLT_L1SingleMu18_v3, process.HLT_L1SingleMu25_v2, process.HLT_L2Mu10_v7, process.HLT_L2Mu10_NoVertex_NoBPTX_v6, process.HLT_L2Mu50_v2, process.HLT_L2Mu23NoVtx_2Cha_v1, process.HLT_L2Mu23NoVtx_2Cha_CosmicSeed_v1, process.HLT_DoubleL2Mu30NoVtx_2Cha_CosmicSeed_Eta2p4_v1, process.HLT_DoubleL2Mu30NoVtx_2Cha_Eta2p4_v1, process.HLT_DoubleL2Mu50_v2, process.HLT_DoubleL2Mu23NoVtx_2Cha_CosmicSeed_v1, process.HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_v1, process.HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_Eta2p4_v1, process.HLT_DoubleL2Mu23NoVtx_2Cha_v1, process.HLT_DoubleL2Mu25NoVtx_2Cha_v1, process.HLT_DoubleL2Mu25NoVtx_2Cha_Eta2p4_v1, process.HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_v13, process.HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_v2, process.HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_v14, process.HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_v2, process.HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_Mass8_v4, process.HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_Mass8_v2, process.HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_Mass3p8_v4, process.HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_Mass3p8_v2, process.HLT_Mu25_TkMu0_Onia_v6, process.HLT_Mu30_TkMu0_Onia_v6, process.HLT_Mu20_TkMu0_Phi_v6, process.HLT_Mu25_TkMu0_Phi_v6, process.HLT_Mu12_v1, process.HLT_Mu15_v1, process.HLT_Mu20_v11, process.HLT_Mu27_v12, process.HLT_Mu50_v12, process.HLT_Mu55_v2, process.HLT_OldMu100_v3, process.HLT_TkMu100_v2, process.HLT_DiPFJet15_NoCaloMatched_v14, process.HLT_DiPFJet25_NoCaloMatched_v14, process.HLT_DiPFJet15_FBEta3_NoCaloMatched_v15, process.HLT_DiPFJet25_FBEta3_NoCaloMatched_v15, process.HLT_DiPFJetAve40_v12, process.HLT_DiPFJetAve60_v12, process.HLT_DiPFJetAve80_v11, process.HLT_DiPFJetAve140_v11, process.HLT_DiPFJetAve200_v11, process.HLT_DiPFJetAve260_v12, process.HLT_DiPFJetAve320_v12, process.HLT_DiPFJetAve400_v12, process.HLT_DiPFJetAve500_v12, process.HLT_DiPFJetAve15_HFJEC_v15, process.HLT_DiPFJetAve25_HFJEC_v15, process.HLT_DiPFJetAve35_HFJEC_v15, process.HLT_DiPFJetAve60_HFJEC_v13, process.HLT_DiPFJetAve80_HFJEC_v13, process.HLT_DiPFJetAve100_HFJEC_v13, process.HLT_DiPFJetAve160_HFJEC_v13, process.HLT_DiPFJetAve220_HFJEC_v14, process.HLT_DiPFJetAve300_HFJEC_v14, process.HLT_AK8PFJet15_v1, process.HLT_AK8PFJet25_v1, process.HLT_AK8PFJet40_v14, process.HLT_AK8PFJet60_v13, process.HLT_AK8PFJet80_v13, process.HLT_AK8PFJet140_v13, process.HLT_AK8PFJet200_v13, process.HLT_AK8PFJet260_v14, process.HLT_AK8PFJet320_v14, process.HLT_AK8PFJet400_v14, process.HLT_AK8PFJet450_v14, process.HLT_AK8PFJet500_v14, process.HLT_AK8PFJet550_v9, process.HLT_PFJet15_v1, process.HLT_PFJet25_v1, process.HLT_PFJet40_v19, process.HLT_PFJet60_v19, process.HLT_PFJet80_v18, process.HLT_PFJet140_v17, process.HLT_PFJet200_v17, process.HLT_PFJet260_v18, process.HLT_PFJet320_v18, process.HLT_PFJet400_v18, process.HLT_PFJet450_v19, process.HLT_PFJet500_v19, process.HLT_PFJet550_v9, process.HLT_PFJetFwd15_v1, process.HLT_PFJetFwd25_v1, process.HLT_PFJetFwd40_v17, process.HLT_PFJetFwd60_v17, process.HLT_PFJetFwd80_v16, process.HLT_PFJetFwd140_v16, process.HLT_PFJetFwd200_v16, process.HLT_PFJetFwd260_v17, process.HLT_PFJetFwd320_v17, process.HLT_PFJetFwd400_v17, process.HLT_PFJetFwd450_v17, process.HLT_PFJetFwd500_v17, process.HLT_AK8PFJetFwd15_v1, process.HLT_AK8PFJetFwd25_v1, process.HLT_AK8PFJetFwd40_v13, process.HLT_AK8PFJetFwd60_v12, process.HLT_AK8PFJetFwd80_v12, process.HLT_AK8PFJetFwd140_v12, process.HLT_AK8PFJetFwd200_v12, process.HLT_AK8PFJetFwd260_v13, process.HLT_AK8PFJetFwd320_v13, process.HLT_AK8PFJetFwd400_v13, process.HLT_AK8PFJetFwd450_v13, process.HLT_AK8PFJetFwd500_v13, process.HLT_PFHT180_v15, process.HLT_PFHT250_v15, process.HLT_PFHT370_v15, process.HLT_PFHT430_v15, process.HLT_PFHT510_v15, process.HLT_PFHT590_v15, process.HLT_PFHT680_v15, process.HLT_PFHT780_v15, process.HLT_PFHT890_v15, process.HLT_PFHT1050_v16, process.HLT_PFHT500_PFMET100_PFMHT100_IDTight_v10, process.HLT_PFHT500_PFMET110_PFMHT110_IDTight_v10, process.HLT_PFHT700_PFMET85_PFMHT85_IDTight_v10, process.HLT_PFHT700_PFMET95_PFMHT95_IDTight_v10, process.HLT_PFHT800_PFMET75_PFMHT75_IDTight_v10, process.HLT_PFHT800_PFMET85_PFMHT85_IDTight_v10, process.HLT_PFMET110_PFMHT110_IDTight_v18, process.HLT_PFMET120_PFMHT120_IDTight_v18, process.HLT_PFMET130_PFMHT130_IDTight_v18, process.HLT_PFMET140_PFMHT140_IDTight_v18, process.HLT_PFMET100_PFMHT100_IDTight_CaloBTagCSV_3p1_v7, process.HLT_PFMET110_PFMHT110_IDTight_CaloBTagCSV_3p1_v7, process.HLT_PFMET120_PFMHT120_IDTight_CaloBTagCSV_3p1_v7, process.HLT_PFMET130_PFMHT130_IDTight_CaloBTagCSV_3p1_v7, process.HLT_PFMET140_PFMHT140_IDTight_CaloBTagCSV_3p1_v7, process.HLT_PFMET120_PFMHT120_IDTight_PFHT60_v7, process.HLT_PFMETNoMu120_PFMHTNoMu120_IDTight_PFHT60_v7, process.HLT_PFMETTypeOne120_PFMHT120_IDTight_PFHT60_v7, process.HLT_PFMETTypeOne110_PFMHT110_IDTight_v10, process.HLT_PFMETTypeOne120_PFMHT120_IDTight_v10, process.HLT_PFMETTypeOne130_PFMHT130_IDTight_v10, process.HLT_PFMETTypeOne140_PFMHT140_IDTight_v9, process.HLT_PFMETNoMu110_PFMHTNoMu110_IDTight_v18, process.HLT_PFMETNoMu120_PFMHTNoMu120_IDTight_v18, process.HLT_PFMETNoMu130_PFMHTNoMu130_IDTight_v17, process.HLT_PFMETNoMu140_PFMHTNoMu140_IDTight_v17, process.HLT_MonoCentralPFJet80_PFMETNoMu110_PFMHTNoMu110_IDTight_v18, process.HLT_MonoCentralPFJet80_PFMETNoMu120_PFMHTNoMu120_IDTight_v18, process.HLT_MonoCentralPFJet80_PFMETNoMu130_PFMHTNoMu130_IDTight_v17, process.HLT_MonoCentralPFJet80_PFMETNoMu140_PFMHTNoMu140_IDTight_v17, process.HLT_L1ETMHadSeeds_v1, process.HLT_CaloMHT90_v3, process.HLT_CaloMET80_NotCleaned_v3, process.HLT_CaloMET90_NotCleaned_v3, process.HLT_CaloMET100_NotCleaned_v3, process.HLT_CaloMET110_NotCleaned_v3, process.HLT_CaloMET250_NotCleaned_v3, process.HLT_CaloMET70_HBHECleaned_v3, process.HLT_CaloMET80_HBHECleaned_v3, process.HLT_CaloMET90_HBHECleaned_v3, process.HLT_CaloMET100_HBHECleaned_v3, process.HLT_CaloMET250_HBHECleaned_v3, process.HLT_CaloMET300_HBHECleaned_v3, process.HLT_CaloMET350_HBHECleaned_v3, process.HLT_PFMET200_NotCleaned_v7, process.HLT_PFMET200_HBHECleaned_v7, process.HLT_PFMET250_HBHECleaned_v7, process.HLT_PFMET300_HBHECleaned_v7, process.HLT_PFMET200_HBHE_BeamHaloCleaned_v7, process.HLT_PFMETTypeOne200_HBHE_BeamHaloCleaned_v7, process.HLT_MET105_IsoTrk50_v8, process.HLT_MET120_IsoTrk50_v8, process.HLT_SingleJet30_Mu12_SinglePFJet40_v9, process.HLT_Mu12_DoublePFJets40_CaloBTagCSV_p79_v1, process.HLT_Mu12_DoublePFJets100_CaloBTagCSV_p79_v1, process.HLT_Mu12_DoublePFJets200_CaloBTagCSV_p79_v1, process.HLT_Mu12_DoublePFJets350_CaloBTagCSV_p79_v1, process.HLT_Mu12_DoublePFJets40MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, process.HLT_Mu12_DoublePFJets54MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, process.HLT_Mu12_DoublePFJets62MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, process.HLT_DoublePFJets40_CaloBTagCSV_p79_v1, process.HLT_DoublePFJets100_CaloBTagCSV_p79_v1, process.HLT_DoublePFJets200_CaloBTagCSV_p79_v1, process.HLT_DoublePFJets350_CaloBTagCSV_p79_v1, process.HLT_DoublePFJets116MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, process.HLT_DoublePFJets128MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, process.HLT_Photon300_NoHE_v11, process.HLT_Mu8_TrkIsoVVL_v11, process.HLT_Mu8_DiEle12_CaloIdL_TrackIdL_DZ_v16, process.HLT_Mu8_DiEle12_CaloIdL_TrackIdL_v16, process.HLT_Mu8_Ele8_CaloIdM_TrackIdM_Mass8_PFHT350_DZ_v17, process.HLT_Mu8_Ele8_CaloIdM_TrackIdM_Mass8_PFHT350_v17, process.HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_v11, process.HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_v9, process.HLT_Mu17_TrkIsoVVL_v11, process.HLT_Mu19_TrkIsoVVL_v2, process.HLT_BTagMu_AK4DiJet20_Mu5_v11, process.HLT_BTagMu_AK4DiJet40_Mu5_v11, process.HLT_BTagMu_AK4DiJet70_Mu5_v11, process.HLT_BTagMu_AK4DiJet110_Mu5_v11, process.HLT_BTagMu_AK4DiJet170_Mu5_v10, process.HLT_BTagMu_AK4Jet300_Mu5_v11, process.HLT_BTagMu_AK8DiJet170_Mu5_v7, process.HLT_BTagMu_AK8Jet300_Mu5_v11, process.HLT_Ele15_Ele8_CaloIdL_TrackIdL_IsoVL_v1, process.HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_v17, process.HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_v17, process.HLT_Mu23_TrkIsoVVL_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_v13, process.HLT_Mu23_TrkIsoVVL_Ele12_CaloIdL_TrackIdL_IsoVL_v5, process.HLT_Mu12_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_v5, process.HLT_Mu12_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_v13, process.HLT_Mu12_DoublePhoton20_v3, process.HLT_TriplePhoton_20_20_20_CaloIdLV2_v2, process.HLT_TriplePhoton_20_20_20_CaloIdLV2_R9IdVL_v2, process.HLT_TriplePhoton_30_30_10_CaloIdLV2_v3, process.HLT_TriplePhoton_30_30_10_CaloIdLV2_R9IdVL_v3, process.HLT_TriplePhoton_35_35_5_CaloIdLV2_R9IdVL_v3, process.HLT_Photon20_v1, process.HLT_Photon33_v4, process.HLT_Photon50_v12, process.HLT_Photon75_v12, process.HLT_Photon90_v12, process.HLT_Photon120_v12, process.HLT_Photon150_v5, process.HLT_Photon175_v13, process.HLT_Photon200_v12, process.HLT_Photon50_R9Id90_HE10_IsoM_v13, process.HLT_Photon75_R9Id90_HE10_IsoM_v13, process.HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_CaloMJJ300_PFJetsMJJ400DEta3_v3, process.HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_CaloMJJ400_PFJetsMJJ600DEta3_v3, process.HLT_Photon90_R9Id90_HE10_IsoM_v13, process.HLT_Photon120_R9Id90_HE10_IsoM_v13, process.HLT_Photon165_R9Id90_HE10_IsoM_v14, process.HLT_Photon90_CaloIdL_PFHT700_v14, process.HLT_Diphoton30_22_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass90_v12, process.HLT_Diphoton30_22_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass95_v12, process.HLT_Diphoton30PV_18PV_R9Id_AND_IsoCaloId_AND_HE_R9Id_PixelVeto_Mass55_v13, process.HLT_Diphoton30PV_18PV_R9Id_AND_IsoCaloId_AND_HE_R9Id_NoPixelVeto_Mass55_v12, process.HLT_Diphoton30EB_18EB_R9Id_OR_IsoCaloId_AND_HE_R9Id_NoPixelVeto_Mass55_v12, process.HLT_Diphoton30EB_18EB_R9Id_OR_IsoCaloId_AND_HE_R9Id_PixelVeto_Mass55_v13, process.HLT_Dimuon0_Jpsi_L1_NoOS_v6, process.HLT_Dimuon0_Jpsi_NoVertexing_NoOS_v6, process.HLT_Dimuon0_Jpsi_v7, process.HLT_Dimuon0_Jpsi_NoVertexing_v7, process.HLT_Dimuon0_Jpsi_L1_4R_0er1p5R_v6, process.HLT_Dimuon0_Jpsi_NoVertexing_L1_4R_0er1p5R_v6, process.HLT_Dimuon0_Jpsi3p5_Muon2_v5, process.HLT_Dimuon0_Upsilon_L1_4p5_v7, process.HLT_Dimuon0_Upsilon_L1_5_v7, process.HLT_Dimuon0_Upsilon_L1_4p5NoOS_v6, process.HLT_Dimuon0_Upsilon_L1_4p5er2p0_v7, process.HLT_Dimuon0_Upsilon_L1_4p5er2p0M_v6, process.HLT_Dimuon0_Upsilon_NoVertexing_v6, process.HLT_Dimuon0_Upsilon_L1_5M_v6, process.HLT_Dimuon0_LowMass_L1_0er1p5R_v6, process.HLT_Dimuon0_LowMass_L1_0er1p5_v7, process.HLT_Dimuon0_LowMass_v7, process.HLT_Dimuon0_LowMass_L1_4_v7, process.HLT_Dimuon0_LowMass_L1_4R_v6, process.HLT_Dimuon0_LowMass_L1_TM530_v5, process.HLT_Dimuon0_Upsilon_Muon_L1_TM0_v5, process.HLT_Dimuon0_Upsilon_Muon_NoL1Mass_v5, process.HLT_TripleMu_5_3_3_Mass3p8to60_DZ_v7, process.HLT_TripleMu_10_5_5_DZ_v9, process.HLT_TripleMu_12_10_5_v9, process.HLT_Tau3Mu_Mu7_Mu1_TkMu1_Tau15_v2, process.HLT_Tau3Mu_Mu7_Mu1_TkMu1_Tau15_Charge1_v2, process.HLT_Tau3Mu_Mu7_Mu1_TkMu1_IsoTau15_v2, process.HLT_Tau3Mu_Mu7_Mu1_TkMu1_IsoTau15_Charge1_v2, process.HLT_DoubleMu3_DZ_PFMET50_PFMHT60_v8, process.HLT_DoubleMu3_DZ_PFMET70_PFMHT70_v8, process.HLT_DoubleMu3_DZ_PFMET90_PFMHT90_v8, process.HLT_DoubleMu3_Trk_Tau3mu_NoL1Mass_v5, process.HLT_DoubleMu4_Jpsi_Displaced_v6, process.HLT_DoubleMu4_Jpsi_NoVertexing_v6, process.HLT_DoubleMu4_JpsiTrkTrk_Displaced_v6, process.HLT_DoubleMu43NoFiltersNoVtx_v3, process.HLT_DoubleMu48NoFiltersNoVtx_v3, process.HLT_Mu43NoFiltersNoVtx_Photon43_CaloIdL_v4, process.HLT_Mu48NoFiltersNoVtx_Photon48_CaloIdL_v4, process.HLT_DoubleMu20_7_Mass0to30_L1_DM4_v6, process.HLT_DoubleMu20_7_Mass0to30_L1_DM4EG_v6, process.HLT_HT425_v8, process.HLT_HT430_DisplacedDijet40_DisplacedTrack_v11, process.HLT_HT500_DisplacedDijet40_DisplacedTrack_v11, process.HLT_HT430_DisplacedDijet60_DisplacedTrack_v11, process.HLT_HT400_DisplacedDijet40_DisplacedTrack_v11, process.HLT_HT650_DisplacedDijet60_Inclusive_v11, process.HLT_HT550_DisplacedDijet60_Inclusive_v11, process.HLT_DiJet110_35_Mjj650_PFMET110_v7, process.HLT_DiJet110_35_Mjj650_PFMET120_v7, process.HLT_DiJet110_35_Mjj650_PFMET130_v7, process.HLT_TripleJet110_35_35_Mjj650_PFMET110_v7, process.HLT_TripleJet110_35_35_Mjj650_PFMET120_v7, process.HLT_TripleJet110_35_35_Mjj650_PFMET130_v7, process.HLT_VBF_DoubleLooseChargedIsoPFTau20_Trk1_eta2p1_v1, process.HLT_VBF_DoubleMediumChargedIsoPFTau20_Trk1_eta2p1_v1, process.HLT_VBF_DoubleTightChargedIsoPFTau20_Trk1_eta2p1_v1, process.HLT_Ele30_eta2p1_WPTight_Gsf_CentralPFJet35_EleCleaned_v11, process.HLT_Ele28_eta2p1_WPTight_Gsf_HT150_v11, process.HLT_Ele28_HighEta_SC20_Mass55_v11, process.HLT_DoubleMu20_7_Mass0to30_Photon23_v6, process.HLT_Ele15_IsoVVVL_PFHT450_CaloBTagCSV_4p5_v7, process.HLT_Ele15_IsoVVVL_PFHT450_PFMET50_v14, process.HLT_Ele15_IsoVVVL_PFHT450_v14, process.HLT_Ele50_IsoVVVL_PFHT450_v14, process.HLT_Ele15_IsoVVVL_PFHT600_v18, process.HLT_Mu8_TrkIsoVVL_DiPFJet40_DEta3p5_MJJ750_HTT300_PFMETNoMu60_v13, process.HLT_Mu10_TrkIsoVVL_DiPFJet40_DEta3p5_MJJ750_HTT350_PFMETNoMu60_v12, process.HLT_Mu15_IsoVVVL_PFHT450_CaloBTagCSV_4p5_v7, process.HLT_Mu15_IsoVVVL_PFHT450_PFMET50_v13, process.HLT_Mu15_IsoVVVL_PFHT450_v13, process.HLT_Mu50_IsoVVVL_PFHT450_v13, process.HLT_Mu15_IsoVVVL_PFHT600_v17, process.HLT_Dimuon10_PsiPrime_Barrel_Seagulls_v6, process.HLT_Dimuon20_Jpsi_Barrel_Seagulls_v6, process.HLT_Dimuon10_Upsilon_Barrel_Seagulls_v6, process.HLT_Dimuon12_Upsilon_eta1p5_v13, process.HLT_Dimuon14_Phi_Barrel_Seagulls_v6, process.HLT_Dimuon18_PsiPrime_v13, process.HLT_Dimuon25_Jpsi_v13, process.HLT_Dimuon18_PsiPrime_noCorrL1_v4, process.HLT_Dimuon24_Upsilon_noCorrL1_v4, process.HLT_Dimuon24_Phi_noCorrL1_v4, process.HLT_Dimuon25_Jpsi_noCorrL1_v4, process.HLT_DiMu9_Ele9_CaloIdL_TrackIdL_DZ_v15, process.HLT_DiMu9_Ele9_CaloIdL_TrackIdL_v15, process.HLT_DoubleIsoMu20_eta2p1_v5, process.HLT_DoubleIsoMu24_eta2p1_v5, process.HLT_TrkMu12_DoubleTrkMu5NoFiltersNoVtx_v5, process.HLT_TrkMu16_DoubleTrkMu6NoFiltersNoVtx_v11, process.HLT_TrkMu17_DoubleTrkMu8NoFiltersNoVtx_v12, process.HLT_Mu8_v11, process.HLT_Mu17_v11, process.HLT_Mu19_v2, process.HLT_Mu17_Photon30_IsoCaloId_v4, process.HLT_Ele8_CaloIdL_TrackIdL_IsoVL_PFJet30_v14, process.HLT_Ele12_CaloIdL_TrackIdL_IsoVL_PFJet30_v16, process.HLT_Ele15_CaloIdL_TrackIdL_IsoVL_PFJet30_v1, process.HLT_Ele23_CaloIdL_TrackIdL_IsoVL_PFJet30_v16, process.HLT_Ele8_CaloIdM_TrackIdM_PFJet30_v16, process.HLT_Ele17_CaloIdM_TrackIdM_PFJet30_v14, process.HLT_Ele23_CaloIdM_TrackIdM_PFJet30_v16, process.HLT_Ele50_CaloIdVT_GsfTrkIdT_PFJet165_v16, process.HLT_Ele115_CaloIdVT_GsfTrkIdT_v12, process.HLT_Ele135_CaloIdVT_GsfTrkIdT_v5, process.HLT_Ele145_CaloIdVT_GsfTrkIdT_v6, process.HLT_Ele200_CaloIdVT_GsfTrkIdT_v6, process.HLT_Ele250_CaloIdVT_GsfTrkIdT_v11, process.HLT_Ele300_CaloIdVT_GsfTrkIdT_v11, process.HLT_PFHT330PT30_QuadPFJet_75_60_45_40_TriplePFBTagDeepCSV_4p5_v1, process.HLT_PFHT330PT30_QuadPFJet_75_60_45_40_v7, process.HLT_PFHT380_SixPFJet32_DoublePFBTagCSV_2p2_v7, process.HLT_PFHT380_SixPFJet32_DoublePFBTagDeepCSV_2p2_v6, process.HLT_PFHT380_SixPFJet32_v7, process.HLT_PFHT430_SixPFJet40_PFBTagCSV_1p5_v7, process.HLT_PFHT430_SixPFJet40_v9, process.HLT_PFHT350_v17, process.HLT_PFHT350MinPFJet15_v7, process.HLT_Photon60_R9Id90_CaloIdL_IsoL_v4, process.HLT_Photon60_R9Id90_CaloIdL_IsoL_DisplacedIdL_v4, process.HLT_Photon60_R9Id90_CaloIdL_IsoL_DisplacedIdL_PFHT350MinPFJet15_v9, process.HLT_FullTrack_Multiplicity85_v3, process.HLT_FullTrack_Multiplicity100_v2, process.HLT_FullTrack_Multiplicity130_v2, process.HLT_FullTrack_Multiplicity155_v3, process.HLT_ECALHT800_v9, process.HLT_DiSC30_18_EIso_AND_HE_Mass70_v12, process.HLT_Physics_v7, process.HLT_Physics_part0_v7, process.HLT_Physics_part1_v7, process.HLT_Physics_part2_v7, process.HLT_Physics_part3_v7, process.HLT_Physics_part4_v7, process.HLT_Physics_part5_v7, process.HLT_Physics_part6_v7, process.HLT_Physics_part7_v7, process.DST_Physics_v7, process.HLT_Random_v3, process.HLT_ZeroBias_v6, process.HLT_ZeroBias_part0_v6, process.HLT_ZeroBias_part1_v6, process.HLT_ZeroBias_part2_v6, process.HLT_ZeroBias_part3_v6, process.HLT_ZeroBias_part4_v6, process.HLT_ZeroBias_part5_v6, process.HLT_ZeroBias_part6_v6, process.HLT_ZeroBias_part7_v6, process.DST_ZeroBias_v2, process.DST_HT250_CaloScouting_v9, process.DST_HT250_CaloBTagScouting_v8, process.DST_HT410_PFScouting_v14, process.DST_HT410_BTagScouting_v14, process.DST_ZeroBias_BTagScouting_v13, process.DST_ZeroBias_CaloScouting_PFScouting_v12, process.DST_CaloJet40_BTagScouting_v13, process.DST_CaloJet40_CaloScouting_PFScouting_v13, process.DST_CaloJet40_CaloBTagScouting_v12, process.DST_L1HTT_BTagScouting_v13, process.DST_L1HTT_CaloScouting_PFScouting_v13, process.DST_L1HTT_CaloBTagScouting_v12, process.DST_L1DoubleMu_BTagScouting_v14, process.DST_L1DoubleMu_CaloScouting_PFScouting_v13, process.DST_DoubleMu3_noVtx_CaloScouting_Monitoring_v5, process.DST_DoubleMu3_noVtx_CaloScouting_v5, process.DST_DoubleMu1_noVtx_CaloScouting_v1, process.DST_DoubleMu3_noVtx_Mass10_PFScouting_v1, process.HLT_AK4CaloJet30_v11, process.HLT_AK4CaloJet40_v10, process.HLT_AK4CaloJet50_v10, process.HLT_AK4CaloJet80_v10, process.HLT_AK4CaloJet100_v10, process.HLT_AK4CaloJet120_v9, process.HLT_AK4PFJet30_v17, process.HLT_AK4PFJet50_v17, process.HLT_AK4PFJet80_v17, process.HLT_AK4PFJet100_v17, process.HLT_AK4PFJet120_v16, process.HLT_SinglePhoton10_Eta3p1ForPPRef_v8, process.HLT_SinglePhoton20_Eta3p1ForPPRef_v8, process.HLT_SinglePhoton30_Eta3p1ForPPRef_v8, process.HLT_Photon20_HoverELoose_v9, process.HLT_Photon30_HoverELoose_v9, process.HLT_EcalCalibration_v4, process.HLT_HcalCalibration_v5, process.AlCa_EcalPhiSym_v8, process.HLT_L1UnpairedBunchBptxMinus_v2, process.HLT_L1UnpairedBunchBptxPlus_v2, process.HLT_L1NotBptxOR_v3, process.HLT_L1MinimumBiasHF_OR_v2, process.HLT_L1MinimumBiasHF0OR_v3, process.HLT_L1_CDC_SingleMu_3_er1p2_TOP120_DPHI2p618_3p142_v2, process.HLT_HcalNZS_v12, process.HLT_HcalPhiSym_v14, process.HLT_HcalIsolatedbunch_v4, process.HLT_IsoTrackHB_v3, process.HLT_IsoTrackHE_v3, process.HLT_ZeroBias_FirstCollisionAfterAbortGap_v5, process.HLT_ZeroBias_IsolatedBunches_v5, process.HLT_ZeroBias_FirstCollisionInTrain_v4, process.HLT_ZeroBias_LastCollisionInTrain_v3, process.HLT_ZeroBias_FirstBXAfterTrain_v3, process.AlCa_RPCMuonNormalisation_v13, process.AlCa_LumiPixels_Random_v4, process.AlCa_LumiPixels_ZeroBias_v8, process.MC_ReducedIterativeTracking_v11, process.MC_PFMET_v15, process.MC_AK4PFJets_v15, process.MC_PFBTagCSV_v9, process.MC_PFHT_v14, process.MC_PFMHT_v14, process.MC_CaloMET_v8, process.MC_CaloMET_JetIdCleaned_v9, process.MC_AK4CaloJets_v9, process.MC_AK4CaloJetsFromPV_v7, process.MC_CaloBTagCSV_v7, process.MC_CaloHT_v8, process.MC_CaloMHT_v8, process.MC_AK8PFJets_v15, process.MC_AK8TrimPFJets_v15, process.MC_AK8PFHT_v14, process.MC_AK8CaloHT_v8, process.MC_Diphoton10_10_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass10_v12, process.MC_DoubleEle5_CaloIdL_MW_v13, process.MC_Ele5_WPTight_Gsf_v6, process.MC_Ele15_Ele10_CaloIdL_TrackIdL_IsoVL_DZ_v13, process.MC_IsoMu_v13, process.MC_DoubleMu_TrkIsoVVL_DZ_v10, process.MC_DoubleMuNoFiltersNoVtx_v7, process.AlCa_EcalPi0EBonly_v12, process.AlCa_EcalPi0EEonly_v12, process.AlCa_EcalEtaEBonly_v12, process.AlCa_EcalEtaEEonly_v12, process.HLT_Ele24_eta2p1_WPTight_Gsf_LooseChargedIsoPFTau30_eta2p1_CrossL1_v11, process.HLT_Ele24_eta2p1_WPTight_Gsf_MediumChargedIsoPFTau30_eta2p1_CrossL1_v11, process.HLT_Ele24_eta2p1_WPTight_Gsf_TightChargedIsoPFTau30_eta2p1_CrossL1_v11, process.HLT_Ele24_eta2p1_WPTight_Gsf_LooseChargedIsoPFTau30_eta2p1_TightID_CrossL1_v11, process.HLT_Ele24_eta2p1_WPTight_Gsf_MediumChargedIsoPFTau30_eta2p1_TightID_CrossL1_v11, process.HLT_Ele24_eta2p1_WPTight_Gsf_TightChargedIsoPFTau30_eta2p1_TightID_CrossL1_v11, process.HLT_DoubleMediumChargedIsoPFTau35_Trk1_eta2p1_Reg_v10, process.HLT_DoubleMediumChargedIsoPFTau40_Trk1_eta2p1_Reg_v10, process.HLT_DoubleTightChargedIsoPFTau35_Trk1_eta2p1_Reg_v10, process.HLT_DoubleTightChargedIsoPFTau40_Trk1_eta2p1_Reg_v10, process.HLT_DoubleMediumChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_v10, process.HLT_DoubleMediumChargedIsoPFTau40_Trk1_TightID_eta2p1_Reg_v10, process.HLT_DoubleTightChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_v10, process.HLT_DoubleTightChargedIsoPFTau40_Trk1_TightID_eta2p1_Reg_v10, process.HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_v10, process.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET90_v10, process.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET100_v10, process.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET110_v6, process.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET120_v6, process.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET130_v6, process.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET140_v1, process.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_v10, process.HLT_MediumChargedIsoPFTau180HighPtRelaxedIso_Trk50_eta2p1_1pr_v9, process.HLT_MediumChargedIsoPFTau180HighPtRelaxedIso_Trk50_eta2p1_v10, process.HLT_MediumChargedIsoPFTau200HighPtRelaxedIso_Trk50_eta2p1_v10, process.HLT_MediumChargedIsoPFTau220HighPtRelaxedIso_Trk50_eta2p1_v10, process.HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau35_Trk1_eta2p1_Reg_CrossL1_v10, process.HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_CrossL1_v10, process.HLT_IsoMu24_eta2p1_TightChargedIsoPFTau35_Trk1_eta2p1_Reg_CrossL1_v10, process.HLT_IsoMu24_eta2p1_TightChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_CrossL1_v10, process.HLT_Ele16_Ele12_Ele8_CaloIdL_TrackIdL_v7, process.HLT_Rsq0p35_v13, process.HLT_Rsq0p40_v13, process.HLT_RsqMR300_Rsq0p09_MR200_v13, process.HLT_RsqMR320_Rsq0p09_MR200_v13, process.HLT_RsqMR300_Rsq0p09_MR200_4jet_v13, process.HLT_RsqMR320_Rsq0p09_MR200_4jet_v13, process.HLT_IsoMu27_LooseChargedIsoPFTau20_Trk1_eta2p1_SingleL1_v3, process.HLT_IsoMu27_MediumChargedIsoPFTau20_Trk1_eta2p1_SingleL1_v3, process.HLT_IsoMu27_TightChargedIsoPFTau20_Trk1_eta2p1_SingleL1_v3, process.HLT_IsoMu27_MET90_v1, process.HLT_IsoMu20_eta2p1_LooseChargedIsoPFTauHPS27_eta2p1_CrossL1_v1, process.HLT_IsoMu24_eta2p1_MediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_CrossL1_v1, process.HLT_DoubleMediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_v1, process.HLT_Photon50_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ300DEta3_PFMET50_v3, process.HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ300DEta3_v3, process.HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ600DEta3_v3, process.HLT_PFMET100_PFMHT100_IDTight_PFHT60_v7, process.HLT_PFMETNoMu100_PFMHTNoMu100_IDTight_PFHT60_v7, process.HLT_PFMETTypeOne100_PFMHT100_IDTight_PFHT60_v7, process.HLT_Mu18_Mu9_SameSign_v3, process.HLT_Mu18_Mu9_SameSign_DZ_v3, process.HLT_Mu18_Mu9_v3, process.HLT_Mu18_Mu9_DZ_v3, process.HLT_Mu20_Mu10_SameSign_v3, process.HLT_Mu20_Mu10_SameSign_DZ_v3, process.HLT_Mu20_Mu10_v3, process.HLT_Mu20_Mu10_DZ_v3, process.HLT_Mu23_Mu12_SameSign_v3, process.HLT_Mu23_Mu12_SameSign_DZ_v3, process.HLT_Mu23_Mu12_v3, process.HLT_Mu23_Mu12_DZ_v3, process.HLT_DoubleMu2_Jpsi_DoubleTrk1_Phi1p05_v5, process.HLT_DoubleMu2_Jpsi_DoubleTkMu0_Phi_v3, process.HLT_DoubleMu3_DCA_PFMET50_PFMHT60_v8, process.HLT_TripleMu_5_3_3_Mass3p8to60_DCA_v2, process.HLT_QuadPFJet98_83_71_15_DoubleBTagCSV_p013_p08_VBF1_v7, process.HLT_QuadPFJet103_88_75_15_DoubleBTagCSV_p013_p08_VBF1_v7, process.HLT_QuadPFJet105_90_76_15_DoubleBTagCSV_p013_p08_VBF1_v7, process.HLT_QuadPFJet111_90_80_15_DoubleBTagCSV_p013_p08_VBF1_v7, process.HLT_QuadPFJet98_83_71_15_BTagCSV_p013_VBF2_v7, process.HLT_QuadPFJet103_88_75_15_BTagCSV_p013_VBF2_v7, process.HLT_QuadPFJet105_88_76_15_BTagCSV_p013_VBF2_v7, process.HLT_QuadPFJet111_90_80_15_BTagCSV_p013_VBF2_v7, process.HLT_QuadPFJet98_83_71_15_v3, process.HLT_QuadPFJet103_88_75_15_v3, process.HLT_QuadPFJet105_88_76_15_v3, process.HLT_QuadPFJet111_90_80_15_v3, process.HLT_AK8PFJet330_TrimMass30_PFAK8BTagCSV_p17_v1, process.HLT_AK8PFJet330_TrimMass30_PFAK8BTagCSV_p1_v1, process.HLT_AK8PFJet330_TrimMass30_PFAK8BoostedDoubleB_p02_v1, process.HLT_Diphoton30_18_PVrealAND_R9Id_AND_IsoCaloId_AND_HE_R9Id_PixelVeto_Mass55_v8, process.HLT_Diphoton30_18_PVrealAND_R9Id_AND_IsoCaloId_AND_HE_R9Id_NoPixelVeto_Mass55_v8, process.HLTriggerFinalPath, process.HLTAnalyzerEndpath, process.ParkingHLTPhysicsOutput, process.ParkingZeroBiasOutput, process.PhysicsCommissioningOutput, process.PhysicsEGammaOutput, process.PhysicsEndOfFillOutput, process.PhysicsHadronsTausOutput, process.PhysicsMuonsOutput, process.ParkingOutput, process.DQMOutput, process.DQMOnlineBeamspotOutput, process.DQMCalibrationOutput, process.DQMEventDisplayOutput, process.HLTMonitorOutput, process.RPCMONOutput, process.CalibrationOutput, process.EcalCalibrationOutput, process.ALCAPHISYMOutput, process.ALCALUMIPIXELSOutput, process.ALCAP0Output, process.ExpressOutput, process.ExpressAlignmentOutput, process.NanoDSTOutput, process.ScoutingPFOutput, process.ScoutingCaloMuonOutput, process.PhysicsParkingScoutingMonitorOutput, process.PhysicsHLTPhysics1Output, process.PhysicsHLTPhysics2Output, process.PhysicsHLTPhysics3Output, process.PhysicsHLTPhysics4Output, process.PhysicsZeroBias1Output, process.PhysicsZeroBias2Output, process.PhysicsZeroBias3Output, process.PhysicsZeroBias4Output )) process.source = cms.Source( "PoolSource", diff --git a/HLTrigger/Configuration/test/OnLine_HLT_HIon.py b/HLTrigger/Configuration/test/OnLine_HLT_HIon.py index 7f322125961b0..935a2a40861bd 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_HIon.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_HIon.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --full --data /dev/CMSSW_10_0_0/HIon --type HIon --unprescale --process HLTHIon --globaltag auto:run2_hlt_HIon --input file:RelVal_Raw_HIon_DATA.root +# hltGetConfiguration --full --data /dev/CMSSW_10_1_0/HIon --type HIon --unprescale --process HLTHIon --globaltag auto:run2_hlt_HIon --input file:RelVal_Raw_HIon_DATA.root -# /dev/CMSSW_10_0_0/HIon/V42 (CMSSW_10_0_4) +# /dev/CMSSW_10_1_0/HIon/V1 (CMSSW_10_1_0) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTHIon" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_10_0_0/HIon/V42') + tableName = cms.string('/dev/CMSSW_10_1_0/HIon/V1') ) process.transferSystem = cms.PSet( @@ -2632,13 +2632,13 @@ ) process.hcal_db_producer = cms.ESProducer( "HcalDbProducer" ) process.hltCombinedSecondaryVertex = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -2651,7 +2651,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( -99999.9 ), + sip2dSigMin = cms.double( 2.0 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -2660,12 +2660,12 @@ 'CombinedSVPseudoVertex', 'CombinedSVNoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -2678,7 +2678,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( 2.0 ), + sip2dSigMin = cms.double( -99999.9 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -2688,13 +2688,13 @@ trackFlip = cms.bool( False ) ) process.hltCombinedSecondaryVertexV2 = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -2720,18 +2720,18 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( -99999.9 ) + sip2dSigMin = cms.double( 2.0 ) ), calibrationRecords = cms.vstring( 'CombinedSVIVFV2RecoVertex', 'CombinedSVIVFV2PseudoVertex', 'CombinedSVIVFV2NoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -2757,7 +2757,7 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( 2.0 ) + sip2dSigMin = cms.double( -99999.9 ) ), trackSort = cms.string( "sip2dSig" ), SoftLeptonFlip = cms.bool( False ), diff --git a/HLTrigger/Configuration/test/OnLine_HLT_PIon.py b/HLTrigger/Configuration/test/OnLine_HLT_PIon.py index 558aaddc6443d..4b8b1b50fa19c 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_PIon.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_PIon.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --full --data /dev/CMSSW_10_0_0/PIon --type PIon --unprescale --process HLTPIon --globaltag auto:run2_hlt_PIon --input file:RelVal_Raw_PIon_DATA.root +# hltGetConfiguration --full --data /dev/CMSSW_10_1_0/PIon --type PIon --unprescale --process HLTPIon --globaltag auto:run2_hlt_PIon --input file:RelVal_Raw_PIon_DATA.root -# /dev/CMSSW_10_0_0/PIon/V42 (CMSSW_10_0_4) +# /dev/CMSSW_10_1_0/PIon/V1 (CMSSW_10_1_0) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTPIon" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_10_0_0/PIon/V42') + tableName = cms.string('/dev/CMSSW_10_1_0/PIon/V1') ) process.transferSystem = cms.PSet( @@ -2632,13 +2632,13 @@ ) process.hcal_db_producer = cms.ESProducer( "HcalDbProducer" ) process.hltCombinedSecondaryVertex = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -2651,7 +2651,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( -99999.9 ), + sip2dSigMin = cms.double( 2.0 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -2660,12 +2660,12 @@ 'CombinedSVPseudoVertex', 'CombinedSVNoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -2678,7 +2678,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( 2.0 ), + sip2dSigMin = cms.double( -99999.9 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -2688,13 +2688,13 @@ trackFlip = cms.bool( False ) ) process.hltCombinedSecondaryVertexV2 = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -2720,18 +2720,18 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( -99999.9 ) + sip2dSigMin = cms.double( 2.0 ) ), calibrationRecords = cms.vstring( 'CombinedSVIVFV2RecoVertex', 'CombinedSVIVFV2PseudoVertex', 'CombinedSVIVFV2NoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -2757,7 +2757,7 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( 2.0 ) + sip2dSigMin = cms.double( -99999.9 ) ), trackSort = cms.string( "sip2dSig" ), SoftLeptonFlip = cms.bool( False ), diff --git a/HLTrigger/Configuration/test/OnLine_HLT_PRef.py b/HLTrigger/Configuration/test/OnLine_HLT_PRef.py index 92d95c58bebe8..c3b622fc54db2 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_PRef.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_PRef.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --full --data /dev/CMSSW_10_0_0/PRef --type PRef --unprescale --process HLTPRef --globaltag auto:run2_hlt_PRef --input file:RelVal_Raw_PRef_DATA.root +# hltGetConfiguration --full --data /dev/CMSSW_10_1_0/PRef --type PRef --unprescale --process HLTPRef --globaltag auto:run2_hlt_PRef --input file:RelVal_Raw_PRef_DATA.root -# /dev/CMSSW_10_0_0/PRef/V42 (CMSSW_10_0_4) +# /dev/CMSSW_10_1_0/PRef/V1 (CMSSW_10_1_0) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTPRef" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_10_0_0/PRef/V42') + tableName = cms.string('/dev/CMSSW_10_1_0/PRef/V1') ) process.transferSystem = cms.PSet( @@ -2997,13 +2997,13 @@ ) process.hcal_db_producer = cms.ESProducer( "HcalDbProducer" ) process.hltCombinedSecondaryVertex = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -3016,7 +3016,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( -99999.9 ), + sip2dSigMin = cms.double( 2.0 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -3025,12 +3025,12 @@ 'CombinedSVPseudoVertex', 'CombinedSVNoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -3043,7 +3043,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( 2.0 ), + sip2dSigMin = cms.double( -99999.9 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -3053,13 +3053,13 @@ trackFlip = cms.bool( False ) ) process.hltCombinedSecondaryVertexV2 = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -3085,18 +3085,18 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( -99999.9 ) + sip2dSigMin = cms.double( 2.0 ) ), calibrationRecords = cms.vstring( 'CombinedSVIVFV2RecoVertex', 'CombinedSVIVFV2PseudoVertex', 'CombinedSVIVFV2NoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -3122,7 +3122,7 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( 2.0 ) + sip2dSigMin = cms.double( -99999.9 ) ), trackSort = cms.string( "sip2dSig" ), SoftLeptonFlip = cms.bool( False ), @@ -4717,9 +4717,11 @@ logWarningEtThreshold_EE_FE = cms.double( 50.0 ) ) process.hltHcalDigis = cms.EDProducer( "HcalRawToDigi", + saveQIE10DataNSamples = cms.untracked.vint32( ), ExpectedOrbitMessageTime = cms.untracked.int32( -1 ), FilterDataQuality = cms.bool( True ), silent = cms.untracked.bool( True ), + saveQIE11DataNSamples = cms.untracked.vint32( ), HcalFirstFED = cms.untracked.int32( 700 ), InputLabel = cms.InputTag( "rawDataCollector" ), ComplainEmptyData = cms.untracked.bool( False ), @@ -4727,10 +4729,12 @@ UnpackCalib = cms.untracked.bool( True ), UnpackUMNio = cms.untracked.bool( True ), FEDs = cms.untracked.vint32( ), - UnpackerMode = cms.untracked.int32( 0 ), + saveQIE11DataTags = cms.untracked.vstring( ), UnpackTTP = cms.untracked.bool( False ), - lastSample = cms.int32( 9 ), UnpackZDC = cms.untracked.bool( True ), + saveQIE10DataTags = cms.untracked.vstring( ), + lastSample = cms.int32( 9 ), + UnpackerMode = cms.untracked.int32( 0 ), firstSample = cms.int32( 0 ) ) process.hltHbhePhase1Reco = cms.EDProducer( "HBHEPhase1Reconstructor", @@ -12673,15 +12677,15 @@ ) process.hltSiPixelClustersAfterSplittingForRefPP = cms.EDProducer( "JetCoreClusterSplitter", verbose = cms.bool( False ), - deltaRmax = cms.double( 0.05 ), + chargeFractionMin = cms.double( 2.0 ), forceXError = cms.double( 100.0 ), vertices = cms.InputTag( "hltFullIter0PrimaryVerticesPreSplittingForRefPP" ), chargePerUnit = cms.double( 2000.0 ), - forceYError = cms.double( 150.0 ), centralMIPCharge = cms.double( 26000.0 ), + forceYError = cms.double( 150.0 ), pixelClusters = cms.InputTag( "hltSiPixelClustersForRefPP" ), ptMin = cms.double( 200.0 ), - chargeFractionMin = cms.double( 2.0 ), + deltaRmax = cms.double( 0.05 ), cores = cms.InputTag( "hltJetsForCoreTracking" ), fractionalWidth = cms.double( 0.4 ), pixelCPE = cms.string( "hltESPPixelCPEGeneric" ) @@ -17489,11 +17493,13 @@ GsfTrackProducer = cms.InputTag( "hltEgammaGsfTracks" ) ) process.hltEgammaGsfTrackVars = cms.EDProducer( "EgammaHLTGsfTrackVarProducer", - recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidates" ), - beamSpotProducer = cms.InputTag( "hltOnlineBeamSpot" ), upperTrackNrToRemoveCut = cms.int32( 9999 ), + useDefaultValuesForEndcap = cms.bool( False ), lowerTrackNrToRemoveCut = cms.int32( -1 ), - inputCollection = cms.InputTag( "hltEgammaGsfTracks" ) + inputCollection = cms.InputTag( "hltEgammaGsfTracks" ), + recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidates" ), + beamSpotProducer = cms.InputTag( "hltOnlineBeamSpot" ), + useDefaultValuesForBarrel = cms.bool( False ) ) process.hltEle10WPLoose1GsfOneOEMinusOneOPFilterForHI = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), diff --git a/HLTrigger/Configuration/test/getFrozenHLT.sh b/HLTrigger/Configuration/test/getFrozenHLT.sh index 95443e5c7e9d3..a299b4e21c826 100755 --- a/HLTrigger/Configuration/test/getFrozenHLT.sh +++ b/HLTrigger/Configuration/test/getFrozenHLT.sh @@ -2,9 +2,9 @@ # ConfDB configurations to use TABLES="Fake Fake1 Fake2" -HLT_Fake="/dev/CMSSW_10_0_0/Fake" -HLT_Fake1="/dev/CMSSW_10_0_0/Fake1" -HLT_Fake2="/dev/CMSSW_10_0_0/Fake2" +HLT_Fake="/dev/CMSSW_10_1_0/Fake" +HLT_Fake1="/dev/CMSSW_10_1_0/Fake1" +HLT_Fake2="/dev/CMSSW_10_1_0/Fake2" # print extra messages ? VERBOSE=false diff --git a/HLTrigger/Configuration/test/getHLT.sh b/HLTrigger/Configuration/test/getHLT.sh index a32c3f8583135..60e2c0dbcc2ea 100755 --- a/HLTrigger/Configuration/test/getHLT.sh +++ b/HLTrigger/Configuration/test/getHLT.sh @@ -1,8 +1,8 @@ #! /bin/bash # ConfDB configurations to use -MASTER="/dev/CMSSW_10_0_0/HLT" # no explicit version, take the most recent -TARGET="/dev/CMSSW_10_0_0/\$TABLE" # no explicit version, take the most recent +MASTER="/dev/CMSSW_10_1_0/HLT" # no explicit version, take the most recent +TARGET="/dev/CMSSW_10_1_0/\$TABLE" # no explicit version, take the most recent TABLES="GRun HIon PIon PRef" # $TABLE in the above variable will be expanded to these TABLES From 409d0bda4bcf81d9cb5ee76337e36784952b3c8a Mon Sep 17 00:00:00 2001 From: Martin Grunewald Date: Tue, 3 Apr 2018 13:08:10 +0200 Subject: [PATCH 305/426] Fix online script --- HLTrigger/Configuration/tables/makeOnlineGRun | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HLTrigger/Configuration/tables/makeOnlineGRun b/HLTrigger/Configuration/tables/makeOnlineGRun index 082e3d0576595..05dcf42b886cb 100755 --- a/HLTrigger/Configuration/tables/makeOnlineGRun +++ b/HLTrigger/Configuration/tables/makeOnlineGRun @@ -3,7 +3,7 @@ # generate HLT tables from master table in ConfDB # -MASTER="/dev/CMSSW_9_2_0/HLT" # no version, take the latest one +MASTER="/dev/CMSSW_10_1_0/HLT" # no version, take the latest one TARGET="/online/collisions/2018/2e34/v1.0/HLT" # where to store the online-compliant menu TABLES="online_grun" From 8cdc4cdc5838f186f4c0176a950c4a94dd75f05e Mon Sep 17 00:00:00 2001 From: Martin Grunewald Date: Tue, 3 Apr 2018 13:22:35 +0200 Subject: [PATCH 306/426] Fix custom script --- HLTrigger/Configuration/python/customizeHLTforCMSSW.py | 1 - 1 file changed, 1 deletion(-) diff --git a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py index c1dc21197ea2f..0d6851377cf49 100644 --- a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py +++ b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py @@ -194,6 +194,5 @@ def customizeHLTforCMSSW(process, menuType="GRun"): # add call to action function in proper order: newest last! # process = customiseFor12718(process) - process = customiseFor22621_forIsoTrackHBHE(process) return process From 04c95a2dd0f2ac866eb0a4c53bde7cd0a7817a59 Mon Sep 17 00:00:00 2001 From: Andrew Brinkerhoff Date: Tue, 3 Apr 2018 13:56:02 +0200 Subject: [PATCH 307/426] EMTF emulator data formats for upgrade trigger primitives (2) --- L1Trigger/L1TMuonEndCap/interface/Common.h | 26 ++-- .../L1TMuonEndCap/interface/EMTFGEMDetId.h | 44 ++++++ .../interface/EMTFGEMDetIdImpl.h | 24 ++++ .../interface/EMTFSubsystemTag.h | 19 +++ .../interface/TTPrimitiveConversion.h | 44 ++++++ .../python/customise_Phase2C2.py | 37 +++++ L1Trigger/L1TMuonEndCap/src/EMTFGEMDetId.cc | 82 +++++++++++ .../src/TTPrimitiveConversion.cc | 133 ++++++++++++++++++ 8 files changed, 400 insertions(+), 9 deletions(-) create mode 100644 L1Trigger/L1TMuonEndCap/interface/EMTFGEMDetId.h create mode 100644 L1Trigger/L1TMuonEndCap/interface/EMTFGEMDetIdImpl.h create mode 100644 L1Trigger/L1TMuonEndCap/interface/TTPrimitiveConversion.h create mode 100644 L1Trigger/L1TMuonEndCap/python/customise_Phase2C2.py create mode 100644 L1Trigger/L1TMuonEndCap/src/EMTFGEMDetId.cc create mode 100644 L1Trigger/L1TMuonEndCap/src/TTPrimitiveConversion.cc diff --git a/L1Trigger/L1TMuonEndCap/interface/Common.h b/L1Trigger/L1TMuonEndCap/interface/Common.h index b22055b7da9b2..8bd95ecc70330 100644 --- a/L1Trigger/L1TMuonEndCap/interface/Common.h +++ b/L1Trigger/L1TMuonEndCap/interface/Common.h @@ -9,6 +9,9 @@ #include "L1Trigger/L1TMuon/interface/MuonTriggerPrimitive.h" #include "L1Trigger/L1TMuon/interface/MuonTriggerPrimitiveFwd.h" +#include "L1Trigger/L1TMuon/interface/TTGeometryTranslator.h" +#include "L1Trigger/L1TMuon/interface/TTMuonTriggerPrimitive.h" + #include "L1Trigger/L1TMuonEndCap/interface/EMTFSubsystemTag.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -29,21 +32,26 @@ typedef L1TMuon::GeometryTranslator GeometryTranslator; typedef L1TMuon::TriggerPrimitive TriggerPrimitive; typedef L1TMuon::TriggerPrimitiveCollection TriggerPrimitiveCollection; -typedef TriggerPrimitive::CSCData CSCData; -typedef TriggerPrimitive::RPCData RPCData; -typedef TriggerPrimitive::GEMData GEMData; +typedef L1TMuon::TTGeometryTranslator TTGeometryTranslator; +typedef L1TMuon::TTTriggerPrimitive TTTriggerPrimitive; +typedef L1TMuon::TTTriggerPrimitiveCollection TTTriggerPrimitiveCollection; + +typedef TriggerPrimitive::CSCData CSCData; +typedef TriggerPrimitive::RPCData RPCData; +typedef TriggerPrimitive::GEMData GEMData; +typedef TTTriggerPrimitive::TTData TTData; -typedef emtf::CSCTag CSCTag; -typedef emtf::RPCTag RPCTag; -typedef emtf::GEMTag GEMTag; +typedef emtf::CSCTag CSCTag; +typedef emtf::RPCTag RPCTag; +typedef emtf::GEMTag GEMTag; +typedef emtf::IRPCTag IRPCTag; +typedef emtf::ME0Tag ME0Tag; +typedef emtf::TTTag TTTag; namespace emtf { // Constants - // Phase 2 Geometry a.k.a. HL-LHC - constexpr int PHASE_TWO_GEOMETRY = 0; - // from DataFormats/MuonDetId/interface/CSCDetId.h constexpr int MIN_ENDCAP = 1; constexpr int MAX_ENDCAP = 2; diff --git a/L1Trigger/L1TMuonEndCap/interface/EMTFGEMDetId.h b/L1Trigger/L1TMuonEndCap/interface/EMTFGEMDetId.h new file mode 100644 index 0000000000000..0ec50a2eee430 --- /dev/null +++ b/L1Trigger/L1TMuonEndCap/interface/EMTFGEMDetId.h @@ -0,0 +1,44 @@ +#ifndef L1TMuonEndCap_EMTFGEMDetId_h +#define L1TMuonEndCap_EMTFGEMDetId_h + +#include "DataFormats/MuonDetId/interface/GEMDetId.h" +#include "DataFormats/MuonDetId/interface/ME0DetId.h" + +#include +#include + + +class GEMDetId; +class ME0DetId; + +class EMTFGEMDetId { +public: + explicit EMTFGEMDetId(const GEMDetId& id); + explicit EMTFGEMDetId(const ME0DetId& id); + + /// Sort Operator based on the raw detector id + bool operator < (const EMTFGEMDetId& r) const; + + /// The identifiers + int region() const; + int ring() const; // NOTE: use ME0 --> ring 4 convention + int station() const; // NOTE: use ME0 --> station 1 convention + int layer() const; + int chamber() const; + int roll() const; + + bool isME0() const { return isME0_; } + + GEMDetId getGEMDetId() const { return gemDetId_; } + + ME0DetId getME0DetId() const { return me0DetId_; } + +private: + GEMDetId gemDetId_; + ME0DetId me0DetId_; + bool isME0_; +}; + +std::ostream& operator<<( std::ostream& os, const EMTFGEMDetId& id ); + +#endif diff --git a/L1Trigger/L1TMuonEndCap/interface/EMTFGEMDetIdImpl.h b/L1Trigger/L1TMuonEndCap/interface/EMTFGEMDetIdImpl.h new file mode 100644 index 0000000000000..459686d57ec3e --- /dev/null +++ b/L1Trigger/L1TMuonEndCap/interface/EMTFGEMDetIdImpl.h @@ -0,0 +1,24 @@ +#ifndef L1TMuonEndCap_EMTFGEMDetIdImpl_h +#define L1TMuonEndCap_EMTFGEMDetIdImpl_h + +#include "DataFormats/MuonDetId/interface/GEMDetId.h" +#include "DataFormats/MuonDetId/interface/ME0DetId.h" + +//#include "L1Trigger/L1TMuonEndCap/interface/EMTFGEMDetId.h" + +namespace emtf { + + template + EMTFGEMDetId construct_EMTFGEMDetId(const TriggerPrimitive& tp) { + if (!tp.getGEMData().isME0) { + GEMDetId id(tp.detId()); + return EMTFGEMDetId(id); + } else { + ME0DetId id(tp.detId()); + return EMTFGEMDetId(id); + } + }; + +} // namespace emtf + +#endif diff --git a/L1Trigger/L1TMuonEndCap/interface/EMTFSubsystemTag.h b/L1Trigger/L1TMuonEndCap/interface/EMTFSubsystemTag.h index 1c1f8a9135e6b..cda8a38e8b9af 100644 --- a/L1Trigger/L1TMuonEndCap/interface/EMTFSubsystemTag.h +++ b/L1Trigger/L1TMuonEndCap/interface/EMTFSubsystemTag.h @@ -7,6 +7,9 @@ #include "DataFormats/RPCDigi/interface/RPCDigiCollection.h" #include "DataFormats/GEMDigi/interface/GEMPadDigi.h" #include "DataFormats/GEMDigi/interface/GEMPadDigiCollection.h" +#include "DataFormats/GEMDigi/interface/ME0PadDigi.h" +#include "DataFormats/GEMDigi/interface/ME0PadDigiCollection.h" +#include "DataFormats/L1TrackTrigger/interface/TTTypes.h" namespace emtf { @@ -26,6 +29,22 @@ namespace emtf { typedef GEMPadDigiCollection digi_collection; }; + struct IRPCTag { + typedef RPCDigi digi_type; + typedef RPCDigiCollection digi_collection; + }; + + struct ME0Tag { + typedef ME0PadDigi digi_type; + typedef ME0PadDigiCollection digi_collection; + }; + + struct TTTag { + typedef Ref_Phase2TrackerDigi_ digi_ref; + typedef TTStub digi_type; + typedef edmNew::DetSetVector digi_collection; + }; + } // namespace emtf #endif diff --git a/L1Trigger/L1TMuonEndCap/interface/TTPrimitiveConversion.h b/L1Trigger/L1TMuonEndCap/interface/TTPrimitiveConversion.h new file mode 100644 index 0000000000000..60e041ef955ca --- /dev/null +++ b/L1Trigger/L1TMuonEndCap/interface/TTPrimitiveConversion.h @@ -0,0 +1,44 @@ +#ifndef L1TMuonEndCap_TTPrimitiveConversion_h +#define L1TMuonEndCap_TTPrimitiveConversion_h + +#include "L1Trigger/L1TMuonEndCap/interface/Common.h" + + +class SectorProcessorLUT; + +class TTPrimitiveConversion { +public: + void configure( + const TTGeometryTranslator* tp_ttgeom, + const SectorProcessorLUT* lut, + int verbose, int endcap, int sector, int bx + ); + + void process( + const std::map& selected_ttprim_map, + EMTFHitCollection& conv_hits + ) const; + + void process_no_prim_sel( + const TTTriggerPrimitiveCollection& ttmuon_primitives, + EMTFHitCollection& conv_hits + ) const; + + const SectorProcessorLUT& lut() const { return *lut_; } + + // TT functions + void convert_tt( + const TTTriggerPrimitive& ttmuon_primitive, + EMTFHit& conv_hit + ) const; + +private: + const TTGeometryTranslator* tp_ttgeom_; + + const SectorProcessorLUT* lut_; + + int verbose_, endcap_, sector_, bx_; +}; + +#endif + diff --git a/L1Trigger/L1TMuonEndCap/python/customise_Phase2C2.py b/L1Trigger/L1TMuonEndCap/python/customise_Phase2C2.py new file mode 100644 index 0000000000000..51f27e76bd700 --- /dev/null +++ b/L1Trigger/L1TMuonEndCap/python/customise_Phase2C2.py @@ -0,0 +1,37 @@ +import FWCore.ParameterSet.Config as cms + +def customise(process): + + # From python/simEmtfDigis_cfi.py + if hasattr(process, 'simEmtfDigis'): + process.simEmtfDigis.spPCParams16.ZoneBoundaries = [0,36,54,96,127] + process.simEmtfDigis.spPCParams16.UseNewZones = True + process.simEmtfDigis.RPCEnable = True + process.simEmtfDigis.GEMEnable = True + process.simEmtfDigis.IRPCEnable = True + process.simEmtfDigis.ME0Enable = True + process.simEmtfDigis.TTEnable = False + process.simEmtfDigis.ME0Input = cms.InputTag('fakeSimMuonME0PadDigis') + process.simEmtfDigis.Era = cms.string('Phase2C2') + process.simEmtfDigis.spPAParams16.PtLUTVersion = cms.int32(7) + + # From python/fakeEmtfParams_cff.py + if hasattr(process, 'emtfParams'): + process.emtfParams.PtAssignVersion = cms.int32(7) + + if hasattr(process, 'emtfForestsDB'): + process.emtfForestsDB = cms.ESSource( + "EmptyESSource", + recordName = cms.string('L1TMuonEndCapForestRcd'), + iovIsRunNotTime = cms.bool(True), + firstValid = cms.vuint32(1) + ) + + process.emtfForests = cms.ESProducer( + "L1TMuonEndCapForestESProducer", + PtAssignVersion = cms.int32(7), + bdtXMLDir = cms.string("2017_v7") + ) + + return process + diff --git a/L1Trigger/L1TMuonEndCap/src/EMTFGEMDetId.cc b/L1Trigger/L1TMuonEndCap/src/EMTFGEMDetId.cc new file mode 100644 index 0000000000000..16352ccfaf256 --- /dev/null +++ b/L1Trigger/L1TMuonEndCap/src/EMTFGEMDetId.cc @@ -0,0 +1,82 @@ +#include "L1Trigger/L1TMuonEndCap/interface/EMTFGEMDetId.h" + + +EMTFGEMDetId::EMTFGEMDetId(const GEMDetId& id) : + gemDetId_(id), + me0DetId_(), + isME0_(false) +{ + +} + +EMTFGEMDetId::EMTFGEMDetId(const ME0DetId& id) : + gemDetId_(), + me0DetId_(id), + isME0_(true) +{ + +} + +/// Sort Operator based on the raw detector id +bool EMTFGEMDetId::operator < (const EMTFGEMDetId& r) const { + if (!isME0() && !r.isME0()) { + return getGEMDetId() < r.getGEMDetId(); // compare GEM with GEM + } else if (r.isME0() && r.isME0()) { + return getME0DetId() < r.getME0DetId(); // compare ME0 with ME0 + } else { + return !r.isME0(); // compare GEM with ME0 + } +} + +/// The identifiers +int EMTFGEMDetId::region() const { + if (!isME0()) + return getGEMDetId().region(); + else + return getME0DetId().region(); +} + +int EMTFGEMDetId::ring() const { + if (!isME0()) + return getGEMDetId().ring(); + else + //return getME0DetId().ring(); + return 4; // NOTE: use ME0 --> ring 4 convention +} + +int EMTFGEMDetId::station() const { + if (!isME0()) + return getGEMDetId().station(); + else + //return getME0DetId().station(); + return 1; // use ME0 --> station 1 convention +} + +int EMTFGEMDetId::layer() const { + if (!isME0()) + return getGEMDetId().layer(); + else + return getME0DetId().layer(); +} + +int EMTFGEMDetId::chamber() const { + if (!isME0()) + return getGEMDetId().chamber(); + else + return getME0DetId().chamber(); +} + +int EMTFGEMDetId::roll() const { + if (!isME0()) + return getGEMDetId().roll(); + else + return getME0DetId().roll(); +} + +std::ostream& operator<<( std::ostream& os, const EMTFGEMDetId& id ) { + if (!id.isME0()) + os << id.getGEMDetId(); + else + os << id.getME0DetId(); + return os; +} diff --git a/L1Trigger/L1TMuonEndCap/src/TTPrimitiveConversion.cc b/L1Trigger/L1TMuonEndCap/src/TTPrimitiveConversion.cc new file mode 100644 index 0000000000000..c81c729ea9269 --- /dev/null +++ b/L1Trigger/L1TMuonEndCap/src/TTPrimitiveConversion.cc @@ -0,0 +1,133 @@ +#include "L1Trigger/L1TMuonEndCap/interface/TTPrimitiveConversion.h" + +#include "L1Trigger/L1TMuonEndCap/interface/SectorProcessorLUT.h" +#include "L1Trigger/L1TMuonEndCap/interface/TrackTools.h" + + +void TTPrimitiveConversion::configure( + const TTGeometryTranslator* tp_ttgeom, + const SectorProcessorLUT* lut, + int verbose, int endcap, int sector, int bx +) { + assert(tp_ttgeom != nullptr); + assert(lut != nullptr); + + tp_ttgeom_ = tp_ttgeom; + lut_ = lut; // not used + + verbose_ = verbose; + endcap_ = endcap; // 1 for ME+, 2 for ME- + sector_ = sector; + bx_ = bx; +} + +void TTPrimitiveConversion::process( + const std::map& selected_ttprim_map, + EMTFHitCollection& conv_hits +) const { + std::map::const_iterator map_tp_it = selected_ttprim_map.begin(); + std::map::const_iterator map_tp_end = selected_ttprim_map.end(); + + for (; map_tp_it != map_tp_end; ++map_tp_it) { + TTTriggerPrimitiveCollection::const_iterator tp_it = map_tp_it->second.begin(); + TTTriggerPrimitiveCollection::const_iterator tp_end = map_tp_it->second.end(); + + for (; tp_it != tp_end; ++tp_it) { + EMTFHit conv_hit; + convert_tt(*tp_it, conv_hit); + conv_hits.push_back(conv_hit); + } + } +} + +void TTPrimitiveConversion::process_no_prim_sel( + const TTTriggerPrimitiveCollection& ttmuon_primitives, + EMTFHitCollection& conv_hits +) const { + TTTriggerPrimitiveCollection::const_iterator tp_it = ttmuon_primitives.begin(); + TTTriggerPrimitiveCollection::const_iterator tp_end = ttmuon_primitives.end(); + + for (; tp_it != tp_end; ++tp_it) { + if (endcap_ == 1 && sector_ == 1 && bx_ == tp_it->getTTData().bx) { //FIXME: stupidly put everything into sector +1, to be fixed. + EMTFHit conv_hit; + convert_tt(*tp_it, conv_hit); + conv_hits.push_back(conv_hit); + } + } +} + + +// _____________________________________________________________________________ +// TT functions +void TTPrimitiveConversion::convert_tt( + const TTTriggerPrimitive& ttmuon_primitive, + EMTFHit& conv_hit +) const { + //const DetId& tp_detId = ttmuon_primitive.detId(); + const TTData& tp_data = ttmuon_primitive.getTTData(); + + int tp_region = tp_ttgeom_->region(ttmuon_primitive); // 0 for Barrel, +/-1 for +/- Endcap + int tp_endcap = (tp_region == -1) ? 2 : tp_region; + int tp_station = tp_ttgeom_->layer(ttmuon_primitive); + int tp_ring = tp_ttgeom_->ring(ttmuon_primitive); + int tp_chamber = tp_ttgeom_->module(ttmuon_primitive); + int tp_sector = 1; //FIXME + int tp_subsector = 0; //FIXME + + const bool is_neighbor = false; //FIXME + + // Set properties + //conv_hit.SetTTDetId ( tp_detId ); + + conv_hit.set_endcap ( (tp_endcap == 2) ? -1 : tp_endcap ); + conv_hit.set_station ( tp_station ); + conv_hit.set_ring ( tp_ring ); + //conv_hit.set_roll ( tp_roll ); + conv_hit.set_chamber ( tp_chamber ); + conv_hit.set_sector ( tp_sector ); + conv_hit.set_subsector ( tp_subsector ); + //conv_hit.set_csc_ID ( tp_csc_ID ); + //conv_hit.set_csc_nID ( csc_nID ); + //conv_hit.set_track_num ( tp_data.trknmb ); + //conv_hit.set_sync_err ( tp_data.syncErr ); + + conv_hit.set_bx ( tp_data.bx ); + conv_hit.set_subsystem ( TTTriggerPrimitive::kTT ); + conv_hit.set_is_CSC ( false ); + conv_hit.set_is_RPC ( false ); + conv_hit.set_is_GEM ( false ); + + //conv_hit.set_pc_sector ( pc_sector ); + //conv_hit.set_pc_station ( pc_station ); + //conv_hit.set_pc_chamber ( pc_chamber ); + //conv_hit.set_pc_segment ( pc_segment ); + + conv_hit.set_valid ( true ); + conv_hit.set_strip ( static_cast(tp_data.row_f) ); + //conv_hit.set_strip_low ( tp_data.strip_low ); + //conv_hit.set_strip_hi ( tp_data.strip_hi ); + conv_hit.set_wire ( static_cast(tp_data.col_f) ); + //conv_hit.set_quality ( tp_data.quality ); + //conv_hit.set_pattern ( tp_data.pattern ); + conv_hit.set_bend ( tp_data.bend ); + //conv_hit.set_time ( tp_data.time ); + + conv_hit.set_neighbor ( is_neighbor ); + conv_hit.set_sector_idx ( (endcap_ == 1) ? sector_ - 1 : sector_ + 5 ); + + // Add coordinates from fullsim + { + const GlobalPoint& gp = tp_ttgeom_->getGlobalPoint(ttmuon_primitive); + double glob_phi = emtf::rad_to_deg(gp.phi().value()); + double glob_theta = emtf::rad_to_deg(gp.theta()); + double glob_eta = gp.eta(); + double glob_rho = gp.perp(); + double glob_z = gp.z(); + + conv_hit.set_phi_sim ( glob_phi ); + conv_hit.set_theta_sim ( glob_theta ); + conv_hit.set_eta_sim ( glob_eta ); + conv_hit.set_rho_sim ( glob_rho ); + conv_hit.set_z_sim ( glob_z ); + } +} From 5e0e39a354dbcdc286115419f68ad74602fc2143 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Ehat=C3=A4ht?= Date: Sat, 31 Mar 2018 01:00:43 +0300 Subject: [PATCH 308/426] Use correct JEC to compute lepton-to-jet variables --- PhysicsTools/NanoAOD/python/electrons_cff.py | 2 +- PhysicsTools/NanoAOD/python/muons_cff.py | 2 +- PhysicsTools/NanoAOD/python/nano_cff.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/electrons_cff.py b/PhysicsTools/NanoAOD/python/electrons_cff.py index be84aacf37794..2e2dbee7659f7 100644 --- a/PhysicsTools/NanoAOD/python/electrons_cff.py +++ b/PhysicsTools/NanoAOD/python/electrons_cff.py @@ -94,7 +94,7 @@ run2_nanoAOD_92X.toModify(isoForEle, src = "slimmedElectronsUpdated") ptRatioRelForEle = cms.EDProducer("ElectronJetVarProducer", - srcJet = cms.InputTag("slimmedJets"), + srcJet = cms.InputTag("updatedJets"), srcLep = cms.InputTag("slimmedElectrons"), srcVtx = cms.InputTag("offlineSlimmedPrimaryVertices"), ) diff --git a/PhysicsTools/NanoAOD/python/muons_cff.py b/PhysicsTools/NanoAOD/python/muons_cff.py index c7ee94b1743f7..1b79bf6cda8ba 100644 --- a/PhysicsTools/NanoAOD/python/muons_cff.py +++ b/PhysicsTools/NanoAOD/python/muons_cff.py @@ -26,7 +26,7 @@ run2_nanoAOD_92X.toModify(isoForMu, src = "slimmedMuonsUpdated") ptRatioRelForMu = cms.EDProducer("MuonJetVarProducer", - srcJet = cms.InputTag("slimmedJets"), + srcJet = cms.InputTag("updatedJets"), srcLep = cms.InputTag("slimmedMuons"), srcVtx = cms.InputTag("offlineSlimmedPrimaryVertices"), ) diff --git a/PhysicsTools/NanoAOD/python/nano_cff.py b/PhysicsTools/NanoAOD/python/nano_cff.py index bb9b547b0f8b7..73d27b607f65b 100644 --- a/PhysicsTools/NanoAOD/python/nano_cff.py +++ b/PhysicsTools/NanoAOD/python/nano_cff.py @@ -72,7 +72,7 @@ l1bits=cms.EDProducer("L1TriggerResultsConverter", src=cms.InputTag("gtStage2Digis"), legacyL1=cms.bool(False)) nanoSequence = cms.Sequence( - nanoMetadata + muonSequence + jetSequence + tauSequence + electronSequence+photonSequence+vertexSequence+metSequence+ + nanoMetadata + jetSequence + muonSequence + tauSequence + electronSequence+photonSequence+vertexSequence+metSequence+ isoTrackSequence + # must be after all the leptons linkedObjects + jetTables + muonTables + tauTables + electronTables + photonTables + globalTables +vertexTables+ metTables+simpleCleanerTable + triggerObjectTables + isoTrackTables + From f55eaccbc550970f577abd88c366fbafd80123f1 Mon Sep 17 00:00:00 2001 From: Gianluca Date: Tue, 3 Apr 2018 14:32:44 +0200 Subject: [PATCH 309/426] fix the product name for the new HP workflow --- Configuration/StandardSequences/python/AlCaHarvesting_cff.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Configuration/StandardSequences/python/AlCaHarvesting_cff.py b/Configuration/StandardSequences/python/AlCaHarvesting_cff.py index 2c8e3c9b2cba5..46734557337e6 100644 --- a/Configuration/StandardSequences/python/AlCaHarvesting_cff.py +++ b/Configuration/StandardSequences/python/AlCaHarvesting_cff.py @@ -63,6 +63,7 @@ ALCAHARVESTBeamSpotHPByRun = alcaBeamSpotHarvester.clone() ALCAHARVESTBeamSpotHPByRun.AlcaBeamSpotHarvesterParameters.BeamSpotOutputBase = cms.untracked.string("runbased") ALCAHARVESTBeamSpotHPByRun.AlcaBeamSpotHarvesterParameters.outputRecordName = cms.untracked.string("BeamSpotObjectsRcdHPByRun") +ALCAHARVESTBeamSpotHPByRun.AlcaBeamSpotHarvesterParameters.BeamSpotModuleName = cms.untracked.string('alcaBeamSpotProducerHP') ALCAHARVESTBeamSpotHPByRun_metadata = cms.PSet(record = cms.untracked.string('BeamSpotObjectsRcdHPByRun')) @@ -76,6 +77,7 @@ ALCAHARVESTBeamSpotHPByLumi = alcaBeamSpotHarvester.clone() ALCAHARVESTBeamSpotHPByLumi.AlcaBeamSpotHarvesterParameters.BeamSpotOutputBase = cms.untracked.string("lumibased") ALCAHARVESTBeamSpotHPByLumi.AlcaBeamSpotHarvesterParameters.outputRecordName = cms.untracked.string("BeamSpotObjectsRcdHPByLumi") +ALCAHARVESTBeamSpotHPByLumi.AlcaBeamSpotHarvesterParameters.BeamSpotModuleName = cms.untracked.string('alcaBeamSpotProducerHP') ALCAHARVESTBeamSpotHPByLumi.AlcaBeamSpotHarvesterParameters.DumpTxt = cms.untracked.bool(True) # configuration of DropBox metadata and DB output From 10c11c0b1cfe37f96ed40a40c52baaf0653567d8 Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Tue, 3 Apr 2018 09:00:52 -0500 Subject: [PATCH 310/426] Make Timing Service work with SubProcess (try again) The problem causing the timeout in the previous version of this PR was in the two parts at the very bottom of code changes. It should be fixed now. See PR #22622 for the original PR. --- FWCore/Services/plugins/Timing.cc | 150 ++++++++++++++++++++++++------ 1 file changed, 121 insertions(+), 29 deletions(-) diff --git a/FWCore/Services/plugins/Timing.cc b/FWCore/Services/plugins/Timing.cc index d95ac557d6aaa..0266bd0e1ebd6 100644 --- a/FWCore/Services/plugins/Timing.cc +++ b/FWCore/Services/plugins/Timing.cc @@ -18,11 +18,14 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/ServiceRegistry/interface/ActivityRegistry.h" +#include "FWCore/ServiceRegistry/interface/GlobalContext.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/ServiceRegistry/interface/StreamContext.h" #include "FWCore/ServiceRegistry/interface/ModuleCallingContext.h" +#include "FWCore/ServiceRegistry/interface/ProcessContext.h" #include "FWCore/ServiceRegistry/interface/SystemBounds.h" #include "FWCore/Utilities/interface/Exception.h" +#include "FWCore/Utilities/interface/thread_safety_macros.h" #include #include @@ -52,11 +55,13 @@ namespace edm { private: + void preBeginJob(PathsAndConsumesOfModulesBase const&, ProcessContext const&); void postBeginJob(); void postEndJob(); void preEvent(StreamContext const&); void postEvent(StreamContext const&); + void lastPostEvent(double curr_event_time, unsigned int index, StreamContext const& iStream); void postModuleEvent(StreamContext const&, ModuleCallingContext const&); @@ -133,10 +138,16 @@ namespace edm { CountAndTime countAndTimeZero_; std::atomic countAndTimeForLock_; - double accumulatedTimeForLock_; + CMS_THREAD_GUARD(countAndTimeForLock_) double accumulatedTimeForLock_; std::atomic countAndTimeForGet_; - double accumulatedTimeForGet_; + CMS_THREAD_GUARD(countAndTimeForGet_) double accumulatedTimeForGet_; + + std::vector>> countSubProcessesPreEvent_; + std::vector>> countSubProcessesPostEvent_; + + bool configuredInTopLevelProcess_; + unsigned int nSubProcesses_; }; } } @@ -202,7 +213,10 @@ namespace edm { } static - void pushStack() { + void pushStack(bool configuredInTopLevelProcess) { + if (!configuredInTopLevelProcess) { + return; + } auto& modStack = moduleTimeStack(); modStack.push_back(getTime()); } @@ -226,8 +240,11 @@ namespace edm { countAndTimeForLock_{&countAndTimeZero_}, accumulatedTimeForLock_{0.0}, countAndTimeForGet_{&countAndTimeZero_}, - accumulatedTimeForGet_{0.0} { + accumulatedTimeForGet_{0.0}, + configuredInTopLevelProcess_{false}, + nSubProcesses_{0} { + iRegistry.watchPreBeginJob(this, &Timing::preBeginJob); iRegistry.watchPostBeginJob(this, &Timing::postBeginJob); iRegistry.watchPostEndJob(this, &Timing::postEndJob); @@ -308,9 +325,12 @@ namespace edm { sum_events_time_.resize(nStreams_,0.); max_events_time_.resize(nStreams_,0.); min_events_time_.resize(nStreams_,1.E6); - + for (unsigned int i = 0; i < nStreams_; ++i) { + countSubProcessesPreEvent_.emplace_back(std::make_unique>(0)); + countSubProcessesPostEvent_.emplace_back(std::make_unique>(0)); + } }); - + iRegistry.postGlobalEndRunSignal_.connect([this](edm::GlobalContext const&) { last_run_time_ = getTime(); last_run_cpu_ = getCPU(); @@ -343,7 +363,18 @@ namespace edm { "This service reports the time it takes to run each module in a job."); } + void Timing::preBeginJob(PathsAndConsumesOfModulesBase const& pathsAndConsumes, ProcessContext const& pc) { + if (pc.isSubProcess()) { + ++nSubProcesses_; + } else { + configuredInTopLevelProcess_ = true; + } + } + void Timing::postBeginJob() { + if (!configuredInTopLevelProcess_) { + return; + } curr_job_time_ = getTime(); curr_job_cpu_ = getCPU(); @@ -359,6 +390,14 @@ namespace edm { } void Timing::postEndJob() { + + if (!configuredInTopLevelProcess_) { + LogImportant("TimeReport") << "\nTimeReport> This instance of the Timing Service will be disabled because it is configured in a SubProcess.\n" + << "If multiple instances of the TimingService were configured only the one in the top level process will function.\n" + << "The other instance(s) will simply print this message and do nothing.\n\n"; + return; + } + const double job_end_time =getTime(); const double job_end_cpu =getCPU(); double total_job_time = job_end_time - jobStartTime(); @@ -453,23 +492,48 @@ namespace edm { } void Timing::preEvent(StreamContext const& iStream) { + if (!configuredInTopLevelProcess_) { + return; + } auto index = iStream.streamID().value(); - curr_events_time_[index] = getTime(); + if (nSubProcesses_ == 0u) { + curr_events_time_[index] = getTime(); + } else { + unsigned int count = ++(*countSubProcessesPreEvent_[index]); + if (count == 1) { + curr_events_time_[index] = getTime(); + } else if (count == (nSubProcesses_ + 1)) { + *countSubProcessesPreEvent_[index] = 0; + } + } } void Timing::postEvent(StreamContext const& iStream) { + if (!configuredInTopLevelProcess_) { + return; + } auto index = iStream.streamID().value(); + if (nSubProcesses_ == 0u) { + lastPostEvent(getTime() - curr_events_time_[index], index, iStream); + } else { + unsigned int count = ++(*countSubProcessesPostEvent_[index]); + if (count == (nSubProcesses_ + 1)) { + lastPostEvent(getTime() - curr_events_time_[index], index, iStream); + *countSubProcessesPostEvent_[index] = 0; + } + } + } - double curr_event_time = getTime() - curr_events_time_[index]; + void Timing::lastPostEvent(double curr_event_time, unsigned int index, StreamContext const& iStream) { sum_events_time_[index] +=curr_event_time; if(not summary_only_) { auto const & eventID = iStream.eventID(); LogPrint("TimeEvent") - << "TimeEvent> " - << eventID.event() << " " - << eventID.run() << " " - << curr_event_time ; + << "TimeEvent> " + << eventID.event() << " " + << eventID.run() << " " + << curr_event_time ; } if(curr_event_time > max_events_time_[index]) max_events_time_[index] = curr_event_time; if(curr_event_time < min_events_time_[index]) min_events_time_[index] = curr_event_time; @@ -477,6 +541,9 @@ namespace edm { } void Timing::postModuleEvent(StreamContext const& iStream, ModuleCallingContext const& iModule) { + if (!configuredInTopLevelProcess_) { + return; + } auto const & eventID = iStream.eventID(); auto const & desc = *(iModule.moduleDescription()); double t = postCommon(); @@ -491,7 +558,7 @@ namespace edm { } void Timing::preSourceEvent(StreamID sid) { - pushStack(); + pushStack(configuredInTopLevelProcess_); } void Timing::postSourceEvent(StreamID sid) { @@ -499,7 +566,7 @@ namespace edm { } void Timing::preSourceLumi(LuminosityBlockIndex index) { - pushStack(); + pushStack(configuredInTopLevelProcess_); } void Timing::postSourceLumi(LuminosityBlockIndex index) { @@ -507,7 +574,7 @@ namespace edm { } void Timing::preSourceRun(RunIndex index) { - pushStack(); + pushStack(configuredInTopLevelProcess_); } void Timing::postSourceRun(RunIndex index) { @@ -515,7 +582,7 @@ namespace edm { } void Timing::preOpenFile(std::string const& lfn, bool b) { - pushStack(); + pushStack(configuredInTopLevelProcess_); } void Timing::postOpenFile(std::string const& lfn, bool b) { @@ -524,7 +591,7 @@ namespace edm { void Timing::preModule(ModuleDescription const&) { - pushStack(); + pushStack(configuredInTopLevelProcess_); } void @@ -534,7 +601,7 @@ namespace edm { void Timing::preModuleGlobal(GlobalContext const&, ModuleCallingContext const&) { - pushStack(); + pushStack(configuredInTopLevelProcess_); } void @@ -543,18 +610,28 @@ namespace edm { } void - Timing::postGlobalBeginRun(GlobalContext const&) { - ++begin_run_count_; + Timing::postGlobalBeginRun(GlobalContext const& gc) { + if (!configuredInTopLevelProcess_) { + return; + } + if (!gc.processContext()->isSubProcess()) { + ++begin_run_count_; + } } void - Timing::postGlobalBeginLumi(GlobalContext const&) { - ++begin_lumi_count_; + Timing::postGlobalBeginLumi(GlobalContext const& gc) { + if (!configuredInTopLevelProcess_) { + return; + } + if (!gc.processContext()->isSubProcess()) { + ++begin_lumi_count_; + } } void Timing::preModuleStream(StreamContext const&, ModuleCallingContext const&) { - pushStack(); + pushStack(configuredInTopLevelProcess_); } void @@ -564,6 +641,9 @@ namespace edm { double Timing::postCommon() const { + if (!configuredInTopLevelProcess_) { + return 0.0; + } double t = popStack(); if(t > threshold_) { LogError("ExcessiveTime") @@ -579,6 +659,9 @@ namespace edm { eventsetup::EventSetupRecordKey const&, eventsetup::DataKey const&) { + if (!configuredInTopLevelProcess_) { + return; + } accumulateTimeBegin(countAndTimeForLock_, accumulatedTimeForLock_); } @@ -587,6 +670,9 @@ namespace edm { eventsetup::EventSetupRecordKey const&, eventsetup::DataKey const&) { + if (!configuredInTopLevelProcess_) { + return; + } accumulateTimeEnd(countAndTimeForLock_, accumulatedTimeForLock_); accumulateTimeBegin(countAndTimeForGet_, accumulatedTimeForGet_); } @@ -606,9 +692,12 @@ namespace edm { auto newStat = std::make_unique(0, newTime); CountAndTime* oldStat = countAndTime.load(); - while (oldStat == nullptr || - !countAndTime.compare_exchange_strong(oldStat, nullptr)) { - oldStat = countAndTime.load(); + while (true) { + if (oldStat == nullptr) { + oldStat = countAndTime.load(); + } else if (countAndTime.compare_exchange_strong(oldStat, nullptr)) { + break; + } } newStat->count_ = oldStat->count_ + 1; @@ -627,9 +716,12 @@ namespace edm { double newTime = getTime(); CountAndTime* oldStat = countAndTime.load(); - while (oldStat == nullptr || - !countAndTime.compare_exchange_strong(oldStat, nullptr)) { - oldStat = countAndTime.load(); + while (true) { + if (oldStat == nullptr) { + oldStat = countAndTime.load(); + } else if (countAndTime.compare_exchange_strong(oldStat, nullptr)) { + break; + } } if (oldStat->count_ == 1) { From a15fda84ac7cad74a78ab307ba89c0be81c4dd7c Mon Sep 17 00:00:00 2001 From: Heiner Tholen Date: Tue, 3 Apr 2018 17:24:09 +0200 Subject: [PATCH 311/426] whitespace --- DQMOffline/Trigger/python/BTVHLTOfflineSource_cfi.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/DQMOffline/Trigger/python/BTVHLTOfflineSource_cfi.py b/DQMOffline/Trigger/python/BTVHLTOfflineSource_cfi.py index 3345a1a5b21da..18f4933bb976c 100644 --- a/DQMOffline/Trigger/python/BTVHLTOfflineSource_cfi.py +++ b/DQMOffline/Trigger/python/BTVHLTOfflineSource_cfi.py @@ -4,7 +4,7 @@ "BTVHLTOfflineSource", # dirname = cms.untracked.string("HLT/BTV"), - processname = cms.string("HLT"), + processname = cms.string("HLT"), verbose = cms.untracked.bool(False), # triggerSummaryLabel = cms.InputTag("hltTriggerSummaryAOD","","HLT"), @@ -13,9 +13,9 @@ offlineCSVLabelCalo = cms.InputTag("pfCombinedInclusiveSecondaryVertexV2BJetTags"), hltFastPVLabel = cms.InputTag("hltFastPrimaryVertex"), hltPFPVLabel = cms.InputTag("hltVerticesPFSelector"), - hltCaloPVLabel = cms.InputTag("hltVerticesL3"), - offlinePVLabel = cms.InputTag("offlinePrimaryVertices"), - + hltCaloPVLabel = cms.InputTag("hltVerticesL3"), + offlinePVLabel = cms.InputTag("offlinePrimaryVertices"), + # pathPairs = cms.VPSet( cms.PSet( @@ -25,8 +25,8 @@ cms.PSet( #pathname = cms.string("HLT_PFMET120_NoiseCleaned_BTagCSV07"), pathname = cms.string("HLT_PFMET120_"), - pathtype = cms.string("Calo"), - ) + pathtype = cms.string("Calo"), + ) ) ) From 4d13ae27b2ec946de64a2e5acae1d7491756e128 Mon Sep 17 00:00:00 2001 From: Heiner Tholen Date: Tue, 3 Apr 2018 17:24:47 +0200 Subject: [PATCH 312/426] adding monitored trigger paths to config --- DQMOffline/Trigger/python/BTVHLTOfflineSource_cfi.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/DQMOffline/Trigger/python/BTVHLTOfflineSource_cfi.py b/DQMOffline/Trigger/python/BTVHLTOfflineSource_cfi.py index 18f4933bb976c..10028cdc40769 100644 --- a/DQMOffline/Trigger/python/BTVHLTOfflineSource_cfi.py +++ b/DQMOffline/Trigger/python/BTVHLTOfflineSource_cfi.py @@ -19,12 +19,11 @@ # pathPairs = cms.VPSet( cms.PSet( - pathname = cms.string("HLT_QuadPFJet_BTagCSV"), + pathname = cms.string("HLT_PFHT380_SixPFJet32_DoublePFBTagDeepCSV_"), pathtype = cms.string("PF"), ), cms.PSet( - #pathname = cms.string("HLT_PFMET120_NoiseCleaned_BTagCSV07"), - pathname = cms.string("HLT_PFMET120_"), + pathname = cms.string("HLT_PFHT380_SixPFJet32_DoublePFBTagDeepCSV_"), pathtype = cms.string("Calo"), ) ) From e202cab445ec36b40ff4023e306e2f1cdd358c88 Mon Sep 17 00:00:00 2001 From: Leonard Apanasevich Date: Tue, 3 Apr 2018 14:20:59 -0500 Subject: [PATCH 313/426] Add option to use prescale column from unpacked GlobalAlgBlk in emulator --- L1Trigger/L1TGlobal/interface/GlobalBoard.h | 1 + .../L1TGlobal/plugins/L1TGlobalProducer.cc | 25 ++++++++++++++++++- .../L1TGlobal/plugins/L1TGlobalProducer.h | 8 +++++- L1Trigger/L1TGlobal/src/GlobalBoard.cc | 7 +++++- 4 files changed, 38 insertions(+), 3 deletions(-) diff --git a/L1Trigger/L1TGlobal/interface/GlobalBoard.h b/L1Trigger/L1TGlobal/interface/GlobalBoard.h index 1e2273308a0fb..648eee298057d 100644 --- a/L1Trigger/L1TGlobal/interface/GlobalBoard.h +++ b/L1Trigger/L1TGlobal/interface/GlobalBoard.h @@ -259,6 +259,7 @@ class GlobalBoard bool m_firstEv; bool m_firstEvLumiSegment; + uint m_currentLumi; private: diff --git a/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.cc b/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.cc index 05e7945aff827..fdc2e531b5e09 100644 --- a/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.cc +++ b/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.cc @@ -51,6 +51,8 @@ void L1TGlobalProducer::fillDescriptions(edm::ConfigurationDescriptions& descrip desc.add ("JetInputTag", edm::InputTag(""))->setComment("InputTag for Calo Trigger Jet (required parameter: default value is invalid)"); desc.add ("EtSumInputTag", edm::InputTag(""))->setComment("InputTag for Calo Trigger EtSum (required parameter: default value is invalid)"); desc.add ("ExtInputTag", edm::InputTag(""))->setComment("InputTag for external conditions (not required, but recommend to specify explicitly in config)"); + desc.add ("AlgoBlkInputTag", edm::InputTag("gtDigis"))->setComment("InputTag for unpacked Algblk (required only if GetPrescaleColumnFromData set to true)"); + desc.add ("GetPrescaleColumnFromData",false)->setComment("Get prescale column from unpacked GlobalAlgBck. Otherwise use value specified in PrescaleSet"); desc.add ("AlgorithmTriggersUnprescaled", false)->setComment("not required, but recommend to specify explicitly in config"); desc.add ("AlgorithmTriggersUnmasked", false)->setComment("not required, but recommend to specify explicitly in config"); // These parameters have well defined default values and are not currently @@ -97,7 +99,9 @@ L1TGlobalProducer::L1TGlobalProducer(const edm::ParameterSet& parSet) : m_verbosity(parSet.getUntrackedParameter("Verbosity")), m_printL1Menu(parSet.getUntrackedParameter("PrintL1Menu")), - m_isDebugEnabled(edm::isDebugEnabled()) + m_isDebugEnabled(edm::isDebugEnabled()), + m_getPrescaleColumnFromData(parSet.getParameter("GetPrescaleColumnFromData")), + m_algoblkInputTag(parSet.getParameter("AlgoBlkInputTag")) { m_egInputToken = consumes > (m_egInputTag); @@ -106,6 +110,7 @@ L1TGlobalProducer::L1TGlobalProducer(const edm::ParameterSet& parSet) : m_sumInputToken = consumes > (m_sumInputTag); m_muInputToken = consumes > (m_muInputTag); m_extInputToken = consumes > (m_extInputTag); + m_algoblkInputToken = consumes > (m_algoblkInputTag); if (m_verbosity) { @@ -222,6 +227,7 @@ L1TGlobalProducer::L1TGlobalProducer(const edm::ParameterSet& parSet) : m_l1GtTmVetoAlgoCacheID = 0ULL; + m_currentLumi = 0; // Set default, initial, dummy prescale factor table std::vector > temp_prescaleTable; @@ -396,6 +402,23 @@ void L1TGlobalProducer::produce(edm::Event& iEvent, const edm::EventSetup& evSet m_l1GtPfAlgoCacheID = l1GtPfAlgoCacheID; } + if (m_getPrescaleColumnFromData && (m_currentLumi != iEvent.luminosityBlock()) ){ // get prescale column from unpacked data + + std::cout << "CCLA L1TGlobalProducer -- Lumi Block Changed: " << m_currentLumi << "\t" << iEvent.luminosityBlock() << std::endl; + m_currentLumi=iEvent.luminosityBlock(); + + edm::Handle> m_uGtAlgBlk; + iEvent.getByToken(m_algoblkInputToken, m_uGtAlgBlk); + + if(m_uGtAlgBlk.isValid()) { + std::vector::const_iterator algBlk = m_uGtAlgBlk->begin(0); + m_prescaleSet=static_cast(algBlk->getPreScColumn()); + std::cout << "CCLA L1TGlobalProducer -- Getting prescale column from algoblk " << m_prescaleSet << std::endl; + }else{ + m_prescaleSet=1; + std::cout << "CCLA L1TGlobalProducer -- Could not find valid algo block. Setting prescale column to 1" << std::endl; + } + } } else{ // Set Prescale factors to initial dummy values diff --git a/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.h b/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.h index f287ab7543194..943661b4ac171 100644 --- a/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.h +++ b/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.h @@ -99,6 +99,8 @@ class L1TGlobalProducer : public edm::stream::EDProducer<> /// CSV file for prescales std::string m_prescalesFile; + uint m_currentLumi; + /// trigger masks & veto masks const L1GtTriggerMask* m_l1GtTmAlgo; unsigned long long m_l1GtTmAlgoCacheID; @@ -173,7 +175,11 @@ class L1TGlobalProducer : public edm::stream::EDProducer<> int m_verbosity; bool m_printL1Menu; bool m_isDebugEnabled; - + + bool m_getPrescaleColumnFromData; + edm::InputTag m_algoblkInputTag; + edm::EDGetToken m_algoblkInputToken; + }; diff --git a/L1Trigger/L1TGlobal/src/GlobalBoard.cc b/L1Trigger/L1TGlobal/src/GlobalBoard.cc index f2f2c0f74a6ef..1220695533b26 100644 --- a/L1Trigger/L1TGlobal/src/GlobalBoard.cc +++ b/L1Trigger/L1TGlobal/src/GlobalBoard.cc @@ -67,6 +67,7 @@ l1t::GlobalBoard::GlobalBoard() : m_candL1External( new BXVector), m_firstEv(true), m_firstEvLumiSegment(true), + m_currentLumi(0), m_isDebugEnabled(edm::isDebugEnabled()) { @@ -957,10 +958,13 @@ void l1t::GlobalBoard::runFDL(edm::Event& iEvent, m_prescaleCounterAlgoTrig.push_back(prescaleFactorsAlgoTrig); } m_firstEv = false; + m_currentLumi=iEvent.luminosityBlock(); + std::cout << "CCLA GlobalBoard -- First event. Lumi block: " << iEvent.luminosityBlock() << std::endl; } // TODO FIXME find the beginning of the luminosity segment - if( m_firstEvLumiSegment ){ + if( m_firstEvLumiSegment || m_currentLumi != iEvent.luminosityBlock() ){ + std::cout << "CCLA GlobalBoard -- New Lumi Segment: " << iEvent.luminosityBlock() << std::endl; m_prescaleCounterAlgoTrig.clear(); for( int iBxInEvent = 0; iBxInEvent <= totalBxInEvent; ++iBxInEvent ){ @@ -968,6 +972,7 @@ void l1t::GlobalBoard::runFDL(edm::Event& iEvent, } m_firstEvLumiSegment = false; + m_currentLumi=iEvent.luminosityBlock(); } // Copy Algorithm bits to Prescaled word From a17172b8ecb30f8989039a7a73759f6ba6bbadc7 Mon Sep 17 00:00:00 2001 From: tocheng Date: Tue, 3 Apr 2018 23:45:10 +0200 Subject: [PATCH 314/426] Reduce SiPixelDetectorStatus data size and change the SiPixelStatusProducer accordingly --- .../interface/SiPixelDetectorStatus.h | 11 +-- .../interface/SiPixelModuleStatus.h | 15 ++-- .../interface/SiPixelRocStatus.h | 25 ++---- .../plugins/SiPixelStatusProducer.cc | 88 +++++++------------ .../plugins/SiPixelStatusProducer.h | 5 -- .../python/SiPixelStatusProducer_cfi.py | 1 - .../src/SiPixelDetectorStatus.cc | 61 ++++++------- .../SiPixelQuality/src/SiPixelModuleStatus.cc | 60 ++++++------- .../SiPixelQuality/src/SiPixelRocStatus.cc | 48 ++-------- .../SiPixelQuality/src/classes_def.xml | 8 +- 10 files changed, 110 insertions(+), 212 deletions(-) diff --git a/CalibTracker/SiPixelQuality/interface/SiPixelDetectorStatus.h b/CalibTracker/SiPixelQuality/interface/SiPixelDetectorStatus.h index dde44c835e9ce..51cdc0849dfef 100644 --- a/CalibTracker/SiPixelQuality/interface/SiPixelDetectorStatus.h +++ b/CalibTracker/SiPixelQuality/interface/SiPixelDetectorStatus.h @@ -25,9 +25,9 @@ class SiPixelDetectorStatus { void addModule(int detid, SiPixelModuleStatus a); // fill hit in double idc in ROC roc into module detid - void fillDIGI(int detid, int roc, int idc); + void fillDIGI(int detid, int roc); // fill stuck TBM info - void fillStuckTBM(int detid, PixelFEDChannel ch, std::time_t time); + void fillStuckTBM(int detid, PixelFEDChannel ch); std::map> getStuckTBMsRocs(); @@ -54,8 +54,6 @@ class SiPixelDetectorStatus { std::pair getRunRange() {return std::make_pair(fRun0,fRun1);} void setLSRange(int ls0, int ls1) {fLS0 = ls0; fLS1 = ls1;} std::pair getLSRange() {return std::make_pair(fLS0,fLS1);} - void setRefTime(std::time_t refTime0, std::time_t refTime1) {fTime0 = refTime0; fTime1 = refTime1;} - std::pair getRefTime() {return std::make_pair(fTime0,fTime1);} // total processed events void setNevents(unsigned long int N){ fNevents = N; } @@ -63,12 +61,10 @@ class SiPixelDetectorStatus { void resetDetectorStatus() { fModules.clear(); fDetAverage=0; fDetSigma=0; fDetHits=0; fNevents=0; fRun0 = 99999999; fRun1 = 0; fLS0 = 99999999; fLS1 = 0; - fTime0 = 0; fTime1 = 0; } // combine detector status void updateDetectorStatus(SiPixelDetectorStatus newData); - SiPixelDetectorStatus combineDetectorStatus(SiPixelDetectorStatus newData); // detector status std::map getDetectorStatus(){ return fModules; } @@ -83,9 +79,6 @@ class SiPixelDetectorStatus { // first and last run seen in this instance (likely to be the same number!) int fRun0, fRun1; - // being and end time stamp - std::time_t fTime0, fTime1; - // number of events processed unsigned long int fNevents; diff --git a/CalibTracker/SiPixelQuality/interface/SiPixelModuleStatus.h b/CalibTracker/SiPixelQuality/interface/SiPixelModuleStatus.h index f8791ce030930..21b653d75ac54 100644 --- a/CalibTracker/SiPixelQuality/interface/SiPixelModuleStatus.h +++ b/CalibTracker/SiPixelQuality/interface/SiPixelModuleStatus.h @@ -16,22 +16,19 @@ class SiPixelModuleStatus { ~SiPixelModuleStatus(); /// fill with online coordinates - void fillDIGI(int iroc, int idc); + void fillDIGI(int iroc); /// fill with online coordinates (nhit > 1) - void updateDIGI(int iroc, int idc, unsigned long nhit); + void updateDIGI(int iroc, unsigned int nhit); /// fill stuck TBM - void fillStuckTBM( PixelFEDChannel ch, std::time_t time ); - - /// return DC status of a ROC (=hits on DC idc on ROC iroc) - unsigned long int digiOccDC(int iroc, int idc); + void fillStuckTBM( PixelFEDChannel ch ); /// return ROC status (= hits on ROC iroc) - unsigned long int digiOccROC(int iroc); + unsigned int digiOccROC(int iroc); /// return module status (= hits on module) - unsigned long int digiOccMOD(); + unsigned int digiOccMOD(); /// get a ROC SiPixelRocStatus* getRoc(int i); @@ -47,7 +44,7 @@ class SiPixelModuleStatus { double perRocDigiOccVar(); /// combine new data to update(topup) module status - void updateModuleDIGI(int roc, int dc, unsigned long int nhits); + void updateModuleDIGI(int roc, unsigned int nhits); void updateModuleStatus(SiPixelModuleStatus newData); private: diff --git a/CalibTracker/SiPixelQuality/interface/SiPixelRocStatus.h b/CalibTracker/SiPixelQuality/interface/SiPixelRocStatus.h index 910ef7242b5bb..52cc495dce097 100644 --- a/CalibTracker/SiPixelQuality/interface/SiPixelRocStatus.h +++ b/CalibTracker/SiPixelQuality/interface/SiPixelRocStatus.h @@ -8,35 +8,20 @@ class SiPixelRocStatus { public: SiPixelRocStatus(); ~SiPixelRocStatus(); - void fillDIGI(int idc); - void updateDIGI(int idc, unsigned long int hits); - - void fillStuckTBM(unsigned int fed, unsigned int link, std::time_t time); - void updateStuckTBM(unsigned int fed, unsigned int link, std::time_t time, unsigned long int freq); + void fillDIGI(); + void updateDIGI(unsigned int hits); + void fillStuckTBM(); // stuckTBM bool isStuckTBM(){ return isStuckTBM_; } - unsigned int getBadFed(){ return badFed_; } - unsigned int getBadLink(){ return badLink_; } - std::time_t getStartBadTime(){ return startBadTime_; } - unsigned long int getBadFreq(){ return badFreq_; } // occpancy - unsigned long int digiOccDC(int idc); - unsigned long int digiOccROC(); - - int nDC(){ return nDC_;} - + unsigned int digiOccROC(); private: - const int nDC_ = 26; - unsigned long int fDC[26]; + unsigned int fDC; bool isStuckTBM_; - unsigned int badFed_; - unsigned int badLink_; - std::time_t startBadTime_; - unsigned long int badFreq_; }; diff --git a/CalibTracker/SiPixelQuality/plugins/SiPixelStatusProducer.cc b/CalibTracker/SiPixelQuality/plugins/SiPixelStatusProducer.cc index 6184e9df60d69..b00cb9b96111f 100644 --- a/CalibTracker/SiPixelQuality/plugins/SiPixelStatusProducer.cc +++ b/CalibTracker/SiPixelQuality/plugins/SiPixelStatusProducer.cc @@ -62,7 +62,6 @@ SiPixelStatusProducer::SiPixelStatusProducer(const edm::ParameterSet& iConfig){ fPixelClusterLabel_ = iConfig.getParameter("SiPixelStatusProducerParameters").getUntrackedParameter("pixelClusterLabel"); fSiPixelClusterToken_ = consumes>(fPixelClusterLabel_); - monitorOnDoubleColumn_ = iConfig.getParameter("SiPixelStatusProducerParameters").getUntrackedParameter("monitorOnDoubleColumn",false); resetNLumi_ = iConfig.getParameter("SiPixelStatusProducerParameters").getUntrackedParameter("resetEveryNLumi",1); ftotalevents = 0; @@ -85,14 +84,10 @@ void SiPixelStatusProducer::beginLuminosityBlock(edm::LuminosityBlock const& lum edm::LogInfo("SiPixelStatusProducer") << "beginlumi setup "<> 32; - if ( countLumi_ == 0 && resetNLumi_ > 0 ) { beginLumi_ = lumiSeg.luminosityBlock(); beginRun_ = lumiSeg.run(); - refTime_[0] = ftmptime; ftotalevents = 0; } @@ -129,6 +124,7 @@ void SiPixelStatusProducer::beginLuminosityBlock(edm::LuminosityBlock const& lum int nrocs = nROCrows*nROCcolumns; fDet.addModule(detid, nrocs); + fSensors[detid] = std::make_pair(rowsperroc,colsperroc); fSensorLayout[detid] = std::make_pair(nROCrows,nROCcolumns); @@ -152,7 +148,6 @@ void SiPixelStatusProducer::beginLuminosityBlock(edm::LuminosityBlock const& lum } fRocIds[detid] = rocIdMap; - } } // init when countLumi = 0 @@ -174,66 +169,50 @@ void SiPixelStatusProducer::accumulate(edm::Event const& iEvent, const edm::Even // ---------------------------------------------------------------------- edm::Handle > hClusterColl; - iEvent.getByToken(fSiPixelClusterToken_, hClusterColl); - //const edmNew::DetSetVector *clustColl(0); - //clustColl = hClusterColl.product(); - - for (const auto& clusters: *hClusterColl) { - //loop over different clusters in a clusters vector (module) - for(const auto& clu: clusters) { - // loop over cluster in a given detId (module) - int detid = clusters.detId(); - DetId detId = DetId(detid); - int rowsperroc = fSensors[detid].first; - int colsperroc = fSensors[detid].second; - int nROCcolumns = fSensorLayout[detid].second; + if (iEvent.getByToken(fSiPixelClusterToken_, hClusterColl)){ - //const SiPixelCluster* siPixelCluster = dynamic_cast(&clu); - int roc(-1), rocC(-1), rocR(-1); + for (const auto& clusters: *hClusterColl) { + //loop over different clusters in a clusters vector (module) + for(const auto& clu: clusters) { + // loop over cluster in a given detId (module) + int detid = clusters.detId(); + int rowsperroc = fSensors[detid].first; + int colsperroc = fSensors[detid].second; - std::map fRocIds_detid; - if(fRocIds.find(detid)!=fRocIds.end()){ - fRocIds_detid = fRocIds[detid]; - } + int nROCcolumns = fSensorLayout[detid].second; - const vector& pixvector = clu.pixels(); - for (unsigned int i = 0; i < pixvector.size(); ++i) { + int roc(-1); + std::map fRocIds_detid; + if(fRocIds.find(detid)!=fRocIds.end()){ + fRocIds_detid = fRocIds[detid]; + } - int mr0 = pixvector[i].x; // constant column direction is along x-axis, - int mc0 = pixvector[i].y; // constant row direction is along y-axis + const vector& pixvector = clu.pixels(); + for (unsigned int i = 0; i < pixvector.size(); ++i) { - if(monitorOnDoubleColumn_) onlineRocColRow(detId, mr0, mc0, roc, rocR, rocC); - else { + int mr0 = pixvector[i].x; // constant column direction is along x-axis, + int mc0 = pixvector[i].y; // constant row direction is along y-axis - int irow = mr0/rowsperroc; - int icol = mc0/colsperroc; + int irow = mr0/rowsperroc; + int icol = mc0/colsperroc; - int key = indexROC(irow,icol,nROCcolumns); - if(fRocIds_detid.find(key)!=fRocIds_detid.end()){ - roc = fRocIds_detid[key]; - } + int key = indexROC(irow,icol,nROCcolumns); + if(fRocIds_detid.find(key)!=fRocIds_detid.end()){ + roc = fRocIds_detid[key]; + } - // if monitor on whole ROC DIGI occupancy, so pixel column and row are nuisances - // just use the "center" of the ROC as a dummy local row/column - rocR = rowsperroc/2-1; - rocC = colsperroc/2-1; + fDet.fillDIGI(detid, roc); - } + }// loop over pixels in a given cluster - fDet.fillDIGI(detid, roc, rocC/2); + }// loop over cluster in a given detId (module) - }// loop over pixels in a given cluster - - }// loop over cluster in a given detId (module) - - }// loop over detId-grouped clusters in cluster detId-grouped clusters-vector + }// loop over detId-grouped clusters in cluster detId-grouped clusters-vector + } // ////////////////////////////////////////////////////////////////////// - const edm::TimeValue_t ftimestamp = iEvent.time().value(); - std::time_t ftmptime = ftimestamp >> 32; - // the error given by FED due to stuck TBM edm::Handle pixelFEDChannelCollectionHandle; @@ -249,7 +228,7 @@ void SiPixelStatusProducer::accumulate(edm::Event const& iEvent, const edm::Even DetId detId = disabledChannels.detId(); int detid = detId.rawId(); - fDet.fillStuckTBM(detid,ch,ftmptime); + fDet.fillStuckTBM(detid,ch); } // loop over different PixelFED in a PixelFED vector (different channel for a given module) @@ -275,10 +254,6 @@ void SiPixelStatusProducer::endLuminosityBlockProduce(edm::LuminosityBlock& lumi edm::LogInfo("SiPixelStatusProducer") << "endlumi producer "<> 32; - refTime_[1] = fendtime; - endLumi_ = lumiSeg.luminosityBlock(); endRun_ = lumiSeg.run(); @@ -288,7 +263,6 @@ void SiPixelStatusProducer::endLuminosityBlockProduce(edm::LuminosityBlock& lumi fDet.setRunRange(beginRun_,endRun_); fDet.setLSRange(beginLumi_,endLumi_); - fDet.setRefTime(refTime_[0],refTime_[1]); fDet.setNevents(ftotalevents); // save result diff --git a/CalibTracker/SiPixelQuality/plugins/SiPixelStatusProducer.h b/CalibTracker/SiPixelQuality/plugins/SiPixelStatusProducer.h index 8176be2446b0f..4a30c2949a28a 100644 --- a/CalibTracker/SiPixelQuality/plugins/SiPixelStatusProducer.h +++ b/CalibTracker/SiPixelQuality/plugins/SiPixelStatusProducer.h @@ -42,8 +42,6 @@ class SiPixelStatusProducer : public edm::one::EDProducer siPixelFedCablingMapWatcher_; @@ -58,7 +56,6 @@ class SiPixelStatusProducer : public edm::one::EDProduceronline conversion // -- map (for each detid) of the map from offline col/row to the online roc/col/row - bool monitorOnDoubleColumn_; // whether to use CablingMap to get the roc/ pixel local coordinate SiPixelCoordinates coord_; // ROC size (number of row, number of columns for each det id) @@ -71,8 +68,6 @@ class SiPixelStatusProducer : public edm::one::EDProducer >fRocIds; // Producer inputs / controls - int fVerbose; - std::string fFileName; edm::InputTag fPixelClusterLabel_; edm::EDGetTokenT> fSiPixelClusterToken_; std::vector > theBadPixelFEDChannelsTokens_; diff --git a/CalibTracker/SiPixelQuality/python/SiPixelStatusProducer_cfi.py b/CalibTracker/SiPixelQuality/python/SiPixelStatusProducer_cfi.py index dcbd3b366bb67..e9f339cdb94f7 100644 --- a/CalibTracker/SiPixelQuality/python/SiPixelStatusProducer_cfi.py +++ b/CalibTracker/SiPixelQuality/python/SiPixelStatusProducer_cfi.py @@ -4,7 +4,6 @@ SiPixelStatusProducerParameters = cms.PSet( badPixelFEDChannelCollections = cms.VInputTag(cms.InputTag('siPixelDigis')), pixelClusterLabel = cms.untracked.InputTag("siPixelClusters::RECO"), - monitorOnDoubleColumn = cms.untracked.bool(False), resetEveryNLumi = cms.untracked.int32( 1 ) ) ) diff --git a/CalibTracker/SiPixelQuality/src/SiPixelDetectorStatus.cc b/CalibTracker/SiPixelQuality/src/SiPixelDetectorStatus.cc index 33431ca3c5643..e99f071282f20 100644 --- a/CalibTracker/SiPixelQuality/src/SiPixelDetectorStatus.cc +++ b/CalibTracker/SiPixelQuality/src/SiPixelDetectorStatus.cc @@ -18,8 +18,6 @@ using namespace std; SiPixelDetectorStatus::SiPixelDetectorStatus(): fLS0(99999999), fLS1(0), fRun0(99999999), fRun1(0), fDetHits(0) { fDetAverage = fDetSigma = 0.; - - fTime0 = fTime1 = 0; fNevents = 0; } @@ -38,7 +36,7 @@ void SiPixelDetectorStatus::readFromFile(std::string filename) { INS.open(filename.c_str()); int oldDetId(-1); - int detid(0), roc(0), dc(0), hits(0), nroc(0); + int detid(0), roc(0), hits(0), nroc(0); SiPixelModuleStatus *pMod(nullptr); bool readOK(false); while (getline(INS, sline)) { @@ -67,7 +65,7 @@ void SiPixelDetectorStatus::readFromFile(std::string filename) { continue; } - sscanf(sline.c_str(), "%d %d %d %d", &detid, &roc, &dc, &hits); + sscanf(sline.c_str(), "%d %d %d", &detid, &roc, &hits); if (roc > nroc) nroc = roc; if (detid != oldDetId) { if (pMod) { @@ -75,7 +73,7 @@ void SiPixelDetectorStatus::readFromFile(std::string filename) { } oldDetId = detid; - if (nullptr == getModule(detid)) { + if (getModule(detid) == nullptr) { addModule(detid,nroc+1); } @@ -84,7 +82,7 @@ void SiPixelDetectorStatus::readFromFile(std::string filename) { } if (pMod) { fDetHits += hits; - pMod->updateModuleDIGI(roc, dc, hits); + pMod->updateModuleDIGI(roc, hits); } } @@ -106,7 +104,7 @@ void SiPixelDetectorStatus::dumpToFile(std::string filename) { for (map::iterator it = begin(); it != itEnd; ++it) { for (int iroc = 0; iroc < it->second.nrocs(); ++iroc) { for (int idc = 0; idc < 26; ++idc) { - OD << Form("%10d %2d %2d %3d", it->first, iroc, idc, int(it->second.getRoc(iroc)->digiOccDC(idc))) << endl; + OD << Form("%10d %2d %3d", it->first, iroc, int(it->second.getRoc(iroc)->digiOccROC())) << endl; } } } @@ -118,26 +116,33 @@ void SiPixelDetectorStatus::dumpToFile(std::string filename) { // ---------------------------------------------------------------------- void SiPixelDetectorStatus::addModule(int detid, int nrocs) { + SiPixelModuleStatus a(detid, nrocs); fModules.insert(make_pair(detid, a)); + } + // ---------------------------------------------------------------------- void SiPixelDetectorStatus::addModule(int detid, SiPixelModuleStatus a) { + fModules.insert(make_pair(detid, a)); + } // ---------------------------------------------------------------------- -void SiPixelDetectorStatus::fillDIGI(int detid, int roc, int idc) { +void SiPixelDetectorStatus::fillDIGI(int detid, int roc) { + ++fDetHits; - fModules[detid].fillDIGI(roc, idc); + fModules[detid].fillDIGI(roc); + } // ---------------------------------------------------------------------- -void SiPixelDetectorStatus::fillStuckTBM(int detid,PixelFEDChannel ch, std::time_t time){ +void SiPixelDetectorStatus::fillStuckTBM(int detid,PixelFEDChannel ch){ if (fModules.find(detid) != fModules.end()){ - fModules[detid].fillStuckTBM(ch,time); + fModules[detid].fillStuckTBM(ch); } } @@ -169,8 +174,10 @@ std::map> SiPixelDetectorStatus::getStuckTBMsRocs(){ } // ---------------------------------------------------------------------- -map::iterator SiPixelDetectorStatus::begin() { +std::map::iterator SiPixelDetectorStatus::begin() { + return fModules.begin(); + } // ---------------------------------------------------------------------- @@ -180,12 +187,16 @@ map::iterator SiPixelDetectorStatus::begin() { // ---------------------------------------------------------------------- std::map::iterator SiPixelDetectorStatus::end() { + return fModules.end(); + } // ---------------------------------------------------------------------- int SiPixelDetectorStatus::nmodules() { + return static_cast(fModules.size()); + } // ---------------------------------------------------------------------- @@ -195,6 +206,7 @@ SiPixelModuleStatus* SiPixelDetectorStatus::getModule(int detid) { return nullptr; } return &(fModules[detid]); + } bool SiPixelDetectorStatus::findModule(int detid) { @@ -241,6 +253,9 @@ void SiPixelDetectorStatus::updateDetectorStatus(SiPixelDetectorStatus newData){ if(fModules.find(detid) != fModules.end()){// if the detid is in the module lists fModules[detid].updateModuleStatus( *(newData.getModule(detid)) ); } + else{ + fModules.insert(make_pair(detid, *(newData.getModule(detid)))); + } } @@ -248,25 +263,3 @@ void SiPixelDetectorStatus::updateDetectorStatus(SiPixelDetectorStatus newData){ fNevents = fNevents + newData.getNevents(); } - -SiPixelDetectorStatus SiPixelDetectorStatus::combineDetectorStatus(SiPixelDetectorStatus newData){ - - SiPixelDetectorStatus combine; - - // loop over current module status - std::map::iterator itEnd = end(); - for (map::iterator it = begin(); it != itEnd; ++it) { - - int detid = it->first; - combine.addModule(detid, fModules[detid]); - - if(newData.findModule(detid)){ // the detid in current data is also in new data - // then update the module status - SiPixelModuleStatus* moduleStatus = combine.getModule(detid); - moduleStatus->updateModuleStatus(*(newData.getModule(detid))); - } - } - - return combine; - -} diff --git a/CalibTracker/SiPixelQuality/src/SiPixelModuleStatus.cc b/CalibTracker/SiPixelQuality/src/SiPixelModuleStatus.cc index 6660d464462d6..574104d21245a 100644 --- a/CalibTracker/SiPixelQuality/src/SiPixelModuleStatus.cc +++ b/CalibTracker/SiPixelQuality/src/SiPixelModuleStatus.cc @@ -28,55 +28,44 @@ SiPixelModuleStatus::~SiPixelModuleStatus() {}; // ---------------------------------------------------------------------- -void SiPixelModuleStatus::fillDIGI(int iroc, int idc) { +void SiPixelModuleStatus::fillDIGI(int iroc) { if (iroc < fNrocs) - fRocs[iroc].fillDIGI(idc); + fRocs[iroc].fillDIGI(); } // ---------------------------------------------------------------------- -void SiPixelModuleStatus::updateDIGI(int iroc, int idc, unsigned long int nhit) { +void SiPixelModuleStatus::updateDIGI(int iroc, unsigned int nhit) { if (iroc < fNrocs) - fRocs[iroc].updateDIGI(idc, nhit); + fRocs[iroc].updateDIGI(nhit); } // ---------------------------------------------------------------------- -void SiPixelModuleStatus::fillStuckTBM( PixelFEDChannel ch, std::time_t time ){ +void SiPixelModuleStatus::fillStuckTBM( PixelFEDChannel ch){ - int fed = int(ch.fed); - int link = int(ch.link); int roc_first = int(ch.roc_first); int roc_last = int(ch.roc_last); for (int iroc = 0; iroc < fNrocs; iroc++){ if(iroc>=roc_first && iroc<=roc_last){ - fRocs[iroc].fillStuckTBM(fed,link,time); + fRocs[iroc].fillStuckTBM(); } } } // ---------------------------------------------------------------------- -unsigned long int SiPixelModuleStatus::digiOccDC(int iroc, int idc) { - - return (iroc < fNrocs ? fRocs[iroc].digiOccDC(idc) : -1); - -} - - -// ---------------------------------------------------------------------- -unsigned long int SiPixelModuleStatus::digiOccROC(int iroc) { +unsigned int SiPixelModuleStatus::digiOccROC(int iroc) { return (iroc < fNrocs ? fRocs[iroc].digiOccROC() : -1); } - // ---------------------------------------------------------------------- -unsigned long int SiPixelModuleStatus::digiOccMOD() { +unsigned int SiPixelModuleStatus::digiOccMOD() { - unsigned long int count(0); + unsigned int count(0); for (int iroc = 0; iroc < fNrocs; ++iroc) { count += digiOccROC(iroc); } @@ -84,7 +73,6 @@ unsigned long int SiPixelModuleStatus::digiOccMOD() { } - // ---------------------------------------------------------------------- int SiPixelModuleStatus::detid() { @@ -92,22 +80,27 @@ int SiPixelModuleStatus::detid() { } - // ---------------------------------------------------------------------- int SiPixelModuleStatus::nrocs() { + return fNrocs; + } // ---------------------------------------------------------------------- void SiPixelModuleStatus::setNrocs(int iroc) { + fNrocs = iroc; + } // ---------------------------------------------------------------------- double SiPixelModuleStatus::perRocDigiOcc() { + digiOccupancy(); return fModAverage; + } @@ -116,21 +109,22 @@ double SiPixelModuleStatus::perRocDigiOccVar() { digiOccupancy(); return fModSigma; + } // ---------------------------------------------------------------------- void SiPixelModuleStatus::digiOccupancy() { fModAverage = fModSigma = 0.; - unsigned long int ave(0.), sig(0.); + unsigned int ave(0), sig(0); for (int iroc = 0; iroc < fNrocs; ++iroc) { - unsigned long int inc = digiOccROC(iroc); + unsigned int inc = digiOccROC(iroc); ave += inc; } fModAverage = (1.0*ave)/fNrocs; for (int iroc = 0; iroc < fNrocs; ++iroc) { - unsigned long int inc = digiOccROC(iroc); + unsigned int inc = digiOccROC(iroc); sig += (fModAverage-inc)*(fModAverage-inc); } @@ -139,16 +133,19 @@ void SiPixelModuleStatus::digiOccupancy() { } - // ---------------------------------------------------------------------- // Be careful : return the address not the value of ROC status SiPixelRocStatus* SiPixelModuleStatus::getRoc(int i) { + return &fRocs[i]; + } // ---------------------------------------------------------------------- -void SiPixelModuleStatus::updateModuleDIGI(int iroc, int idc, unsigned long int nhits) { - fRocs[iroc].updateDIGI(idc,nhits); +void SiPixelModuleStatus::updateModuleDIGI(int iroc, unsigned int nhits) { + + fRocs[iroc].updateDIGI(nhits); + } void SiPixelModuleStatus::updateModuleStatus(SiPixelModuleStatus newData) { @@ -161,15 +158,12 @@ void SiPixelModuleStatus::updateModuleStatus(SiPixelModuleStatus newData) { if(isSameModule){ for (int iroc = 0; iroc < fNrocs; ++iroc) { - int nDC = fRocs[iroc].nDC(); //update occupancy - for(int idc = 0; idc < nDC; ++idc) { - fRocs[iroc].updateDIGI(idc,newData.digiOccDC(iroc,idc)); - } + fRocs[iroc].updateDIGI(newData.digiOccROC(iroc)); //update stuckTBM SiPixelRocStatus* rocStatus = newData.getRoc(iroc); if(rocStatus->isStuckTBM()){ - fRocs[iroc].updateStuckTBM(rocStatus->getBadFed(), rocStatus->getBadLink(),rocStatus->getStartBadTime(), rocStatus->getBadFreq()); + fRocs[iroc].fillStuckTBM(); } } diff --git a/CalibTracker/SiPixelQuality/src/SiPixelRocStatus.cc b/CalibTracker/SiPixelQuality/src/SiPixelRocStatus.cc index 7c39675ef4269..97ae0cef97da0 100644 --- a/CalibTracker/SiPixelQuality/src/SiPixelRocStatus.cc +++ b/CalibTracker/SiPixelQuality/src/SiPixelRocStatus.cc @@ -9,15 +9,8 @@ using namespace std; // ---------------------------------------------------------------------- SiPixelRocStatus::SiPixelRocStatus() { - - for (int i = 0; i < nDC_; ++i) { - fDC[i] = 0; - } + fDC = 0; isStuckTBM_ = false; - badFed_ = -1; - badLink_ = -1; - startBadTime_ = -1; - badFreq_ = 0; } @@ -27,54 +20,29 @@ SiPixelRocStatus::~SiPixelRocStatus() { } // ---------------------------------------------------------------------- -void SiPixelRocStatus::fillDIGI(int idc) { +void SiPixelRocStatus::fillDIGI() { - if (idc - - + + @@ -8,8 +8,8 @@ - - + + From 2ea08437c6b0ee6280bb0dfa96d1867821810b56 Mon Sep 17 00:00:00 2001 From: tocheng Date: Tue, 3 Apr 2018 23:56:44 +0200 Subject: [PATCH 315/426] fix the bug in the harvester that stuckTBM payloads stop pending when new stuckTBM payload is triggered --- CalibTracker/SiPixelQuality/src/SiPixelStatusManager.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CalibTracker/SiPixelQuality/src/SiPixelStatusManager.cc b/CalibTracker/SiPixelQuality/src/SiPixelStatusManager.cc index 4bd1cfed4067b..022fecbf0de47 100644 --- a/CalibTracker/SiPixelQuality/src/SiPixelStatusManager.cc +++ b/CalibTracker/SiPixelQuality/src/SiPixelStatusManager.cc @@ -248,15 +248,16 @@ void SiPixelStatusManager::createStuckTBMs(){ // if the badroc list differs for any detid, update the payload if(tmpBadRocLists[detid]!=(stuckTBMsMap_[previousLumi])[detid]){ sameAsLastIOV = false; - return; + break; // jump out of the loop once a new payload is found } } if(sameAsLastIOV==false){ //only write new IOV when this Lumi is not equal to the previous one - stuckTBMsMap_[tmpLumi] = tmpBadRocLists; + // and reset previousLumi = tmpLumi; + sameAsLastIOV = true; } From e33d5ad14f3bb2e4d4125943a3ffa9e115576cc8 Mon Sep 17 00:00:00 2001 From: Luca Date: Wed, 4 Apr 2018 03:05:12 +0200 Subject: [PATCH 316/426] new 2018conditions --- Configuration/AlCa/python/autoCond.py | 42 +++++++++++++-------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/Configuration/AlCa/python/autoCond.py b/Configuration/AlCa/python/autoCond.py index d5864890f72a8..eda421e463130 100644 --- a/Configuration/AlCa/python/autoCond.py +++ b/Configuration/AlCa/python/autoCond.py @@ -2,27 +2,27 @@ ### NEW KEYS ### # GlobalTag for MC production with perfectly aligned and calibrated detector for Run1 - 'run1_design' : '101X_mcRun1_design_v2', + 'run1_design' : '101X_mcRun1_design_v3', # GlobalTag for MC production (pp collisions) with realistic alignment and calibrations for Run1 - 'run1_mc' : '101X_mcRun1_realistic_v2', + 'run1_mc' : '101X_mcRun1_realistic_v3', # GlobalTag for MC production (Heavy Ions collisions) with realistic alignment and calibrations for Run1 - 'run1_mc_hi' : '101X_mcRun1_HeavyIon_v2', + 'run1_mc_hi' : '101X_mcRun1_HeavyIon_v3', # GlobalTag for MC production (p-Pb collisions) with realistic alignment and calibrations for Run1 - 'run1_mc_pa' : '101X_mcRun1_pA_v2', + 'run1_mc_pa' : '101X_mcRun1_pA_v3', # GlobalTag for MC production with perfectly aligned and calibrated detector for Run2 - 'run2_design' : '101X_mcRun2_design_v3', + 'run2_design' : '101X_mcRun2_design_v4', # GlobalTag for MC production with pessimistic alignment and calibrations for Run2 - 'run2_mc_50ns' : '101X_mcRun2_startup_v3', + 'run2_mc_50ns' : '101X_mcRun2_startup_v4', #GlobalTag for MC production with optimistic alignment and calibrations for Run2 - 'run2_mc' : '101X_mcRun2_asymptotic_v3', + 'run2_mc' : '101X_mcRun2_asymptotic_v4', # GlobalTag for MC production (L1 Trigger Stage1) with starup-like alignment and calibrations for Run2, L1 trigger in Stage1 mode - 'run2_mc_l1stage1' : '93X_mcRun2_asymptotic_v4', + 'run2_mc_l1stage1' : '93X_mcRun2_asymptotic_v5', # GlobalTag for MC production (cosmics) with starup-like alignment and calibrations for Run2, Strip tracker in peak mode - 'run2_mc_cosmics' : '101X_mcRun2cosmics_startup_deco_v3', + 'run2_mc_cosmics' : '101X_mcRun2cosmics_startup_deco_v4', # GlobalTag for MC production (Heavy Ions collisions) with optimistic alignment and calibrations for Run2 - 'run2_mc_hi' : '101X_mcRun2_HeavyIon_v4', + 'run2_mc_hi' : '101X_mcRun2_HeavyIon_v5', # GlobalTag for MC production (p-Pb collisions) with realistic alignment and calibrations for Run2 - 'run2_mc_pa' : '101X_mcRun2_pA_v3', + 'run2_mc_pa' : '101X_mcRun2_pA_v4', # GlobalTag for Run1 data reprocessing 'run1_data' : '101X_dataRun2_v7', # GlobalTag for Run2 data reprocessing @@ -40,25 +40,25 @@ # GlobalTag for Run2 HLT for HI: it points to the online GT 'run2_hlt_hi' : '101X_dataRun2_HLTHI_frozen_v6', # GlobalTag for MC production with perfectly aligned and calibrated detector for Phase1 2017 (and 0,0,~0-centred beamspot) - 'phase1_2017_design' : '101X_mc2017_design_IdealBS_v5', + 'phase1_2017_design' : '101X_mc2017_design_IdealBS_v6', # GlobalTag for MC production with realistic conditions for Phase1 2017 detector - 'phase1_2017_realistic' : '101X_mc2017_realistic_v5', + 'phase1_2017_realistic' : '101X_mc2017_realistic_v6', # GlobalTag for MC production (cosmics) with realistic alignment and calibrations for Phase1 2017 detector, Strip tracker in DECO mode - 'phase1_2017_cosmics' : '101X_mc2017cosmics_realistic_deco_v5', + 'phase1_2017_cosmics' : '101X_mc2017cosmics_realistic_deco_v6', # GlobalTag for MC production (cosmics) with realistic alignment and calibrations for Phase1 2017 detector, Strip tracker in PEAK mode - 'phase1_2017_cosmics_peak' : '101X_mc2017cosmics_realistic_peak_v5', + 'phase1_2017_cosmics_peak' : '101X_mc2017cosmics_realistic_peak_v6', # GlobalTag for MC production with perfectly aligned and calibrated detector for full Phase1 2018 (and 0,0,0-centred beamspot) - 'phase1_2018_design' : '101X_upgrade2018_design_v7', + 'phase1_2018_design' : '101X_upgrade2018_design_v8', # GlobalTag for MC production with realistic conditions for full Phase1 2018 detector - 'phase1_2018_realistic' : '101X_upgrade2018_realistic_v6', + 'phase1_2018_realistic' : '101X_upgrade2018_realistic_v7', # GlobalTag for MC production (cosmics) with realistic conditions for full Phase1 2018 detector, Strip tracker in DECO mode - 'phase1_2018_cosmics' : '101X_upgrade2018cosmics_realistic_deco_v7', + 'phase1_2018_cosmics' : '101X_upgrade2018cosmics_realistic_deco_v8', # GlobalTag for MC production with perfectly aligned and calibrated detector for Phase1 2019 - 'phase1_2019_design' : '101X_postLS2_design_v4', # GT containing design conditions for postLS2 + 'phase1_2019_design' : '101X_postLS2_design_v5', # GT containing design conditions for postLS2 # GlobalTag for MC production with perfectly aligned and calibrated detector for Phase1 2019 - 'phase1_2019_realistic' : '101X_postLS2_realistic_v4', # GT containing realistic conditions for postLS2 + 'phase1_2019_realistic' : '101X_postLS2_realistic_v5', # GT containing realistic conditions for postLS2 # GlobalTag for MC production with realistic conditions for Phase2 2023 - 'phase2_realistic' : '101X_upgrade2023_realistic_v4' + 'phase2_realistic' : '101X_upgrade2023_realistic_v5' } aliases = { From 94f446619e51af33313b05ba5592e8f98912a9b0 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Wed, 4 Apr 2018 09:00:39 +0200 Subject: [PATCH 317/426] Modify 2 scripts for AlCaReco --- .../python/ALCARECOHcalCalMinBiasNoise_cff.py | 5 +++-- .../python/ALCARECOHcalCalMinBias_cff.py | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalMinBiasNoise_cff.py b/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalMinBiasNoise_cff.py index d5be8e928e221..5581e4b98451f 100644 --- a/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalMinBiasNoise_cff.py +++ b/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalMinBiasNoise_cff.py @@ -40,13 +40,14 @@ ) hbherecoNoise.algorithm.firstSample = 0 -hbherecoNoise.algorithm.samplesToAdd = 4 +hbherecoNoise.algorithm.firstSampleShift = -3 +hbherecoNoise.algorithm.samplesToAdd = 3 import RecoLocalCalo.HcalRecProducers.hosimplereco_cfi horecoNoise = RecoLocalCalo.HcalRecProducers.hosimplereco_cfi.hosimplereco.clone() horecoNoise.firstSample = 0 -horecoNoise.samplesToAdd = 4 +horecoNoise.samplesToAdd = 3 horecoNoise.digiLabel = 'hcalDigiAlCaMB' horecoNoise.tsFromDB = cms.bool(False) horecoNoise.dropZSmarkedPassed = cms.bool(False) diff --git a/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalMinBias_cff.py b/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalMinBias_cff.py index 18dc31b3e7c65..eca4b8dc1e75d 100644 --- a/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalMinBias_cff.py +++ b/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalMinBias_cff.py @@ -35,13 +35,14 @@ setLegacyFlagsQIE11 = cms.bool(False), ) -hbherecoMBNZS.algorithm.firstSample = 4 -hbherecoMBNZS.algorithm.samplesToAdd = 4 +hbherecoMBNZS.algorithm.firstSample = 3 +hbherecoMBNZS.algorithm.firstSampleShift = 0 +hbherecoMBNZS.algorithm.samplesToAdd = 3 import RecoLocalCalo.HcalRecProducers.hosimplereco_cfi horecoMBNZS = RecoLocalCalo.HcalRecProducers.hosimplereco_cfi.hosimplereco.clone() -horecoMBNZS.firstSample = 4 +horecoMBNZS.firstSample = 3 horecoMBNZS.samplesToAdd = 4 horecoMBNZS.digiLabel = 'hcalDigiAlCaMB' horecoMBNZS.tsFromDB = cms.bool(False) From 58eb79ec38a0125819d966f521464d699798e066 Mon Sep 17 00:00:00 2001 From: tocheng Date: Wed, 4 Apr 2018 09:17:27 +0200 Subject: [PATCH 318/426] Rename stuckTBM in the SiPixelDetectorStatus as FEDerror25 to avoid confusion --- .../interface/SiPixelDetectorStatus.h | 6 ++--- .../interface/SiPixelModuleStatus.h | 4 +-- .../interface/SiPixelRocStatus.h | 6 ++--- .../interface/SiPixelStatusManager.h | 14 +++++----- .../plugins/SiPixelStatusHarvester.cc | 27 ++++++++++--------- .../plugins/SiPixelStatusProducer.cc | 6 ++--- .../src/SiPixelDetectorStatus.cc | 12 ++++----- .../SiPixelQuality/src/SiPixelModuleStatus.cc | 10 +++---- .../SiPixelQuality/src/SiPixelRocStatus.cc | 6 ++--- .../src/SiPixelStatusManager.cc | 18 ++++++------- .../SiPixelQuality/src/classes_def.xml | 4 +-- 11 files changed, 57 insertions(+), 56 deletions(-) diff --git a/CalibTracker/SiPixelQuality/interface/SiPixelDetectorStatus.h b/CalibTracker/SiPixelQuality/interface/SiPixelDetectorStatus.h index 51cdc0849dfef..d2dd3fbd6190f 100644 --- a/CalibTracker/SiPixelQuality/interface/SiPixelDetectorStatus.h +++ b/CalibTracker/SiPixelQuality/interface/SiPixelDetectorStatus.h @@ -26,10 +26,10 @@ class SiPixelDetectorStatus { // fill hit in double idc in ROC roc into module detid void fillDIGI(int detid, int roc); - // fill stuck TBM info - void fillStuckTBM(int detid, PixelFEDChannel ch); + // fill FEDerror25 info + void fillFEDerror25(int detid, PixelFEDChannel ch); - std::map> getStuckTBMsRocs(); + std::map> getFEDerror25Rocs(); // determine detector average nhits and RMS void digiOccupancy(); diff --git a/CalibTracker/SiPixelQuality/interface/SiPixelModuleStatus.h b/CalibTracker/SiPixelQuality/interface/SiPixelModuleStatus.h index 21b653d75ac54..d891122bcd450 100644 --- a/CalibTracker/SiPixelQuality/interface/SiPixelModuleStatus.h +++ b/CalibTracker/SiPixelQuality/interface/SiPixelModuleStatus.h @@ -21,8 +21,8 @@ class SiPixelModuleStatus { /// fill with online coordinates (nhit > 1) void updateDIGI(int iroc, unsigned int nhit); - /// fill stuck TBM - void fillStuckTBM( PixelFEDChannel ch ); + /// fill FEDerror25 + void fillFEDerror25( PixelFEDChannel ch ); /// return ROC status (= hits on ROC iroc) unsigned int digiOccROC(int iroc); diff --git a/CalibTracker/SiPixelQuality/interface/SiPixelRocStatus.h b/CalibTracker/SiPixelQuality/interface/SiPixelRocStatus.h index 52cc495dce097..1f79df0199352 100644 --- a/CalibTracker/SiPixelQuality/interface/SiPixelRocStatus.h +++ b/CalibTracker/SiPixelQuality/interface/SiPixelRocStatus.h @@ -10,10 +10,10 @@ class SiPixelRocStatus { ~SiPixelRocStatus(); void fillDIGI(); void updateDIGI(unsigned int hits); - void fillStuckTBM(); + void fillFEDerror25(); // stuckTBM - bool isStuckTBM(){ return isStuckTBM_; } + bool isFEDerror25(){ return isFEDerror25_; } // occpancy unsigned int digiOccROC(); @@ -21,7 +21,7 @@ class SiPixelRocStatus { private: unsigned int fDC; - bool isStuckTBM_; + bool isFEDerror25_; }; diff --git a/CalibTracker/SiPixelQuality/interface/SiPixelStatusManager.h b/CalibTracker/SiPixelQuality/interface/SiPixelStatusManager.h index 882845ef2e2a1..a52c3dd2d2d31 100644 --- a/CalibTracker/SiPixelQuality/interface/SiPixelStatusManager.h +++ b/CalibTracker/SiPixelQuality/interface/SiPixelStatusManager.h @@ -29,24 +29,24 @@ class SiPixelStatusManager { void reset(); void readLumi(const edm::LuminosityBlock&); - void createStuckTBMs(); - void createBadComponents(); - void createPayloads(){ - createStuckTBMs(); + createFEDerror25(); createBadComponents(); } const std::map& getBadComponents(){return siPixelStatusMap_; } - const std::map> >& getStuckTBMsRocs(){return stuckTBMsMap_;} + const std::map> >& getFEDerror25Rocs(){return FEDerror25Map_;} typedef std::map::iterator siPixelStatusMap_iterator; - typedef std::map> >::iterator stuckTBMsMap_iterator; + typedef std::map> >::iterator FEDerror25Map_iterator; private: + void createFEDerror25(); + void createBadComponents(); + std::map siPixelStatusMap_; - std::map> > stuckTBMsMap_; + std::map> > FEDerror25Map_; std::string outputBase_; int aveDigiOcc_; diff --git a/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.cc b/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.cc index fe7cd4d8d9529..ce9d7f04646e3 100644 --- a/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.cc +++ b/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.cc @@ -86,7 +86,7 @@ void SiPixelStatusHarvester::endRun(const edm::Run& iRun, const edm::EventSetup& siPixelStatusManager_.createPayloads(); - std::map> > stuckTBMsMap = siPixelStatusManager_.getStuckTBMsRocs(); + std::map> > FEDerror25Map = siPixelStatusManager_.getFEDerror25Rocs(); std::map siPixelStatusMap = siPixelStatusManager_.getBadComponents(); edm::Service poolDbService; @@ -101,7 +101,7 @@ void SiPixelStatusHarvester::endRun(const edm::Run& iRun, const edm::EventSetup& } // stuckTBM tag from FED error 25 with permanent component removed - for(SiPixelStatusManager::stuckTBMsMap_iterator it=stuckTBMsMap.begin(); it!=stuckTBMsMap.end();it++){ + for(SiPixelStatusManager::FEDerror25Map_iterator it=FEDerror25Map.begin(); it!=FEDerror25Map.end();it++){ cond::Time_t thisIOV = 1; edm::LuminosityBlockID lu(iRun.id().run(),it->first); @@ -109,8 +109,8 @@ void SiPixelStatusHarvester::endRun(const edm::Run& iRun, const edm::EventSetup& SiPixelQuality *siPixelQuality = new SiPixelQuality(); - std::map > tmpStuckTBMs = it->second; - for(std::map >::iterator ilist = tmpStuckTBMs.begin(); ilist!=tmpStuckTBMs.end();ilist++){ + std::map > tmpFEDerror25 = it->second; + for(std::map >::iterator ilist = tmpFEDerror25.begin(); ilist!=tmpFEDerror25.end();ilist++){ int detid = ilist->first; @@ -195,15 +195,15 @@ void SiPixelStatusHarvester::endRun(const edm::Run& iRun, const edm::EventSetup& /////////////////////////////////////////////////////////////////////////////////////////////////// // create the DB object - // payload including all : permanent bad + other + stuckTBM + // payload including all : PCL = permanent bad + other + stuckTBM SiPixelQuality *siPixelQualityPCL = new SiPixelQuality(); // payload for prompt reco : permanent bad + other sources of bad components SiPixelQuality *siPixelQualityPrompt = new SiPixelQuality(); // payload for : other sources of bad components SiPixelQuality *siPixelQualityOther = new SiPixelQuality(); - // get badROC list due to stuck TBM - std::map > tmpStuckTBMs = tmpSiPixelStatus.getStuckTBMsRocs(); + // get badROC list due to FEDerror25 = stuckTBM + permanent bad components + std::map > tmpFEDerror25 = tmpSiPixelStatus.getFEDerror25Rocs(); std::map detectorStatus = tmpSiPixelStatus.getDetectorStatus(); std::map::iterator itModEnd = detectorStatus.end(); @@ -225,7 +225,7 @@ void SiPixelStatusHarvester::endRun(const edm::Run& iRun, const edm::EventSetup& std::vector BadRocListPCL, BadRocListPrompt, BadRocListOther; SiPixelModuleStatus modStatus = itMod->second; - std::vector listStuckTBM = tmpStuckTBMs[detid]; + std::vector listFEDerror25 = tmpFEDerror25[detid]; for (int iroc = 0; iroc < modStatus.nrocs(); ++iroc) { @@ -235,16 +235,16 @@ void SiPixelStatusHarvester::endRun(const edm::Run& iRun, const edm::EventSetup& if(rocOccupancy<1.e-4*DetAverage){ BadRocListPCL.push_back(uint32_t(iroc)); - std::vector::iterator it = std::find(listStuckTBM.begin(), listStuckTBM.end(),iroc); + std::vector::iterator it = std::find(listFEDerror25.begin(), listFEDerror25.end(),iroc); // from prompt = permanent bad + other - if(it==listStuckTBM.end() || badPixelInfo_->IsRocBad(detid, iroc)) - // if permanent or not stuck TBM( in the stuckTBM list but not permanent) + if(it==listFEDerror25.end() || badPixelInfo_->IsRocBad(detid, iroc)) + // if permanent or not stuck TBM( this is to say either in the FEDerror25 list or permanent bdd) BadRocListPrompt.push_back(uint32_t(iroc)); // other source of bad components - if(it==listStuckTBM.end() && !(badPixelInfo_->IsRocBad(detid, iroc))) - // if not permanent and not stuck TBM + if(it==listFEDerror25.end() && !(badPixelInfo_->IsRocBad(detid, iroc))) + // if not permanent and not stuck TBM( this is to say either in the FEDerror25 list or permanent bdd) BadRocListOther.push_back(uint32_t(iroc)); } @@ -343,6 +343,7 @@ void SiPixelStatusHarvester::beginLuminosityBlock(const edm::LuminosityBlock& iL //-------------------------------------------------------------------------------------------------- void SiPixelStatusHarvester::endLuminosityBlock(const edm::LuminosityBlock& iLumi, const edm::EventSetup& iEVentSetup) { + std::cout<<"lumi "< pixelFEDChannelCollectionHandle; // look over different resouces of takens @@ -228,7 +228,7 @@ void SiPixelStatusProducer::accumulate(edm::Event const& iEvent, const edm::Even DetId detId = disabledChannels.detId(); int detid = detId.rawId(); - fDet.fillStuckTBM(detid,ch); + fDet.fillFEDerror25(detid,ch); } // loop over different PixelFED in a PixelFED vector (different channel for a given module) diff --git a/CalibTracker/SiPixelQuality/src/SiPixelDetectorStatus.cc b/CalibTracker/SiPixelQuality/src/SiPixelDetectorStatus.cc index e99f071282f20..54245569ff683 100644 --- a/CalibTracker/SiPixelQuality/src/SiPixelDetectorStatus.cc +++ b/CalibTracker/SiPixelQuality/src/SiPixelDetectorStatus.cc @@ -139,16 +139,16 @@ void SiPixelDetectorStatus::fillDIGI(int detid, int roc) { } // ---------------------------------------------------------------------- -void SiPixelDetectorStatus::fillStuckTBM(int detid,PixelFEDChannel ch){ +void SiPixelDetectorStatus::fillFEDerror25(int detid,PixelFEDChannel ch){ if (fModules.find(detid) != fModules.end()){ - fModules[detid].fillStuckTBM(ch); + fModules[detid].fillFEDerror25(ch); } } -// stuck TBM effected ROCs in for each module -std::map> SiPixelDetectorStatus::getStuckTBMsRocs(){ +// FEDerror25 effected ROCs in for each module +std::map> SiPixelDetectorStatus::getFEDerror25Rocs(){ std::map> badRocLists_; @@ -156,13 +156,13 @@ std::map> SiPixelDetectorStatus::getStuckTBMsRocs(){ for (std::map::iterator itMod = begin(); itMod != itModEnd; ++itMod) { int detid = itMod->first; - // stuck TBM effected ROCs in a given module + // FEDerror25 effected ROCs in a given module std::vector list; SiPixelModuleStatus modStatus = itMod->second; for (int iroc = 0; iroc < modStatus.nrocs(); ++iroc) { SiPixelRocStatus* roc = modStatus.getRoc(iroc); - if(roc->isStuckTBM()){ + if(roc->isFEDerror25()){ list.push_back(iroc); } badRocLists_[detid]=list; diff --git a/CalibTracker/SiPixelQuality/src/SiPixelModuleStatus.cc b/CalibTracker/SiPixelQuality/src/SiPixelModuleStatus.cc index 574104d21245a..c3c982b755773 100644 --- a/CalibTracker/SiPixelQuality/src/SiPixelModuleStatus.cc +++ b/CalibTracker/SiPixelQuality/src/SiPixelModuleStatus.cc @@ -44,12 +44,12 @@ void SiPixelModuleStatus::updateDIGI(int iroc, unsigned int nhit) { } // ---------------------------------------------------------------------- -void SiPixelModuleStatus::fillStuckTBM( PixelFEDChannel ch){ +void SiPixelModuleStatus::fillFEDerror25( PixelFEDChannel ch){ int roc_first = int(ch.roc_first); int roc_last = int(ch.roc_last); for (int iroc = 0; iroc < fNrocs; iroc++){ if(iroc>=roc_first && iroc<=roc_last){ - fRocs[iroc].fillStuckTBM(); + fRocs[iroc].fillFEDerror25(); } } @@ -160,10 +160,10 @@ void SiPixelModuleStatus::updateModuleStatus(SiPixelModuleStatus newData) { for (int iroc = 0; iroc < fNrocs; ++iroc) { //update occupancy fRocs[iroc].updateDIGI(newData.digiOccROC(iroc)); - //update stuckTBM + //update FEDerror25 SiPixelRocStatus* rocStatus = newData.getRoc(iroc); - if(rocStatus->isStuckTBM()){ - fRocs[iroc].fillStuckTBM(); + if(rocStatus->isFEDerror25()){ + fRocs[iroc].fillFEDerror25(); } } diff --git a/CalibTracker/SiPixelQuality/src/SiPixelRocStatus.cc b/CalibTracker/SiPixelQuality/src/SiPixelRocStatus.cc index 97ae0cef97da0..10a5ee8fcc2b9 100644 --- a/CalibTracker/SiPixelQuality/src/SiPixelRocStatus.cc +++ b/CalibTracker/SiPixelQuality/src/SiPixelRocStatus.cc @@ -10,7 +10,7 @@ using namespace std; // ---------------------------------------------------------------------- SiPixelRocStatus::SiPixelRocStatus() { fDC = 0; - isStuckTBM_ = false; + isFEDerror25_ = false; } @@ -34,9 +34,9 @@ void SiPixelRocStatus::updateDIGI(unsigned int hits) { } // ---------------------------------------------------------------------- -void SiPixelRocStatus::fillStuckTBM(){ +void SiPixelRocStatus::fillFEDerror25(){ - isStuckTBM_ = true; + isFEDerror25_ = true; } diff --git a/CalibTracker/SiPixelQuality/src/SiPixelStatusManager.cc b/CalibTracker/SiPixelQuality/src/SiPixelStatusManager.cc index 022fecbf0de47..9a4013d96a35f 100644 --- a/CalibTracker/SiPixelQuality/src/SiPixelStatusManager.cc +++ b/CalibTracker/SiPixelQuality/src/SiPixelStatusManager.cc @@ -221,13 +221,13 @@ void SiPixelStatusManager::createBadComponents(){ } -void SiPixelStatusManager::createStuckTBMs(){ +void SiPixelStatusManager::createFEDerror25(){ // initialize the first IOV and SiPixelDetector status (in the first IOV) siPixelStatusMap_iterator firstStatus = siPixelStatusMap_.begin(); LuminosityBlockNumber_t firstLumi = firstStatus->first; - SiPixelDetectorStatus firstStuckTBMs = firstStatus->second; - stuckTBMsMap_[firstLumi] = firstStuckTBMs.getStuckTBMsRocs(); + SiPixelDetectorStatus firstFEDerror25 = firstStatus->second; + FEDerror25Map_[firstLumi] = firstFEDerror25.getFEDerror25Rocs(); siPixelStatusMap_iterator lastStatus = siPixelStatusMap_.end(); @@ -238,15 +238,15 @@ void SiPixelStatusManager::createStuckTBMs(){ for (siPixelStatusMap_iterator it = secondStatus; it != lastStatus; it++) { LuminosityBlockNumber_t tmpLumi = it->first; - SiPixelDetectorStatus tmpStuckTBMs = it->second; - std::map >tmpBadRocLists = tmpStuckTBMs.getStuckTBMsRocs(); + SiPixelDetectorStatus tmpFEDerror25 = it->second; + std::map >tmpBadRocLists = tmpFEDerror25.getFEDerror25Rocs(); - std::map::iterator itModEnd = tmpStuckTBMs.end(); - for (std::map::iterator itMod = tmpStuckTBMs.begin(); itMod != itModEnd; ++itMod) + std::map::iterator itModEnd = tmpFEDerror25.end(); + for (std::map::iterator itMod = tmpFEDerror25.begin(); itMod != itModEnd; ++itMod) { int detid = itMod->first; // if the badroc list differs for any detid, update the payload - if(tmpBadRocLists[detid]!=(stuckTBMsMap_[previousLumi])[detid]){ + if(tmpBadRocLists[detid]!=(FEDerror25Map_[previousLumi])[detid]){ sameAsLastIOV = false; break; // jump out of the loop once a new payload is found } @@ -254,7 +254,7 @@ void SiPixelStatusManager::createStuckTBMs(){ if(sameAsLastIOV==false){ //only write new IOV when this Lumi is not equal to the previous one - stuckTBMsMap_[tmpLumi] = tmpBadRocLists; + FEDerror25Map_[tmpLumi] = tmpBadRocLists; // and reset previousLumi = tmpLumi; sameAsLastIOV = true; diff --git a/CalibTracker/SiPixelQuality/src/classes_def.xml b/CalibTracker/SiPixelQuality/src/classes_def.xml index 29f3337f47122..7b17355ed9170 100644 --- a/CalibTracker/SiPixelQuality/src/classes_def.xml +++ b/CalibTracker/SiPixelQuality/src/classes_def.xml @@ -1,6 +1,6 @@ - - + + From 46f9af7c2f41689f902c5007dee9457f90312cc4 Mon Sep 17 00:00:00 2001 From: "S. Lehti" Date: Wed, 4 Apr 2018 09:46:13 +0200 Subject: [PATCH 319/426] HLTTauDQM: removed commented (obsolete) code --- DQMOffline/Trigger/interface/HLTTauDQMOfflineSource.h | 3 --- .../Trigger/interface/HLTTauDQMTagAndProbePlotter.h | 5 ----- DQMOffline/Trigger/src/HLTTauDQMOfflineSource.cc | 6 ------ DQMOffline/Trigger/src/HLTTauDQMTagAndProbePlotter.cc | 9 --------- 4 files changed, 23 deletions(-) diff --git a/DQMOffline/Trigger/interface/HLTTauDQMOfflineSource.h b/DQMOffline/Trigger/interface/HLTTauDQMOfflineSource.h index 6678db94b4e45..8e1af9480408f 100644 --- a/DQMOffline/Trigger/interface/HLTTauDQMOfflineSource.h +++ b/DQMOffline/Trigger/interface/HLTTauDQMOfflineSource.h @@ -61,9 +61,6 @@ class HLTTauDQMOfflineSource : public DQMEDAnalyzer { bool tagAndProbe_; std::vector tagAndProbePaths; - //std::vector > num_genTriggerEventFlag_; - //std::vector > den_genTriggerEventFlag_; - //DQM Prescaler int counterEvt_; //counter const int prescaleEvt_; //every n events diff --git a/DQMOffline/Trigger/interface/HLTTauDQMTagAndProbePlotter.h b/DQMOffline/Trigger/interface/HLTTauDQMTagAndProbePlotter.h index 00e4c29d715ff..bf64920d24a01 100644 --- a/DQMOffline/Trigger/interface/HLTTauDQMTagAndProbePlotter.h +++ b/DQMOffline/Trigger/interface/HLTTauDQMTagAndProbePlotter.h @@ -12,7 +12,6 @@ namespace edm { class Event; class EventSetup; -// class TriggerResults; } namespace trigger { @@ -23,7 +22,6 @@ class HLTConfigProvider; class HLTTauDQMTagAndProbePlotter: private HLTTauDQMPlotter { public: -// HLTTauDQMTagAndProbePlotter(const edm::ParameterSet& iConfig, std::unique_ptr numFlag, std::unique_ptr denFlag, const std::string& dqmBaseFolder); HLTTauDQMTagAndProbePlotter(const edm::ParameterSet& iConfig, const std::vector& modLabels, const std::string& dqmBaseFolder); ~HLTTauDQMTagAndProbePlotter(); @@ -31,7 +29,6 @@ class HLTTauDQMTagAndProbePlotter: private HLTTauDQMPlotter { void bookHistograms(DQMStore::IBooker &iBooker, edm::Run const &iRun, edm::EventSetup const &iSetup); - //void analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup, const HLTTauDQMOfflineObjects& refCollection); void analyze(edm::Event const& iEvent, const edm::TriggerResults& triggerResults, const trigger::TriggerEvent& triggerEvent, const HLTTauDQMOfflineObjects& refCollection); @@ -46,8 +43,6 @@ class HLTTauDQMTagAndProbePlotter: private HLTTauDQMPlotter { const double phimin_,phimax_; std::string xvariable; - //std::unique_ptr num_genTriggerEventFlag_; - //std::unique_ptr den_genTriggerEventFlag_; std::vector numTriggers; std::vector denTriggers; diff --git a/DQMOffline/Trigger/src/HLTTauDQMOfflineSource.cc b/DQMOffline/Trigger/src/HLTTauDQMOfflineSource.cc index 6bc9b7a64b464..d88acae907cf5 100644 --- a/DQMOffline/Trigger/src/HLTTauDQMOfflineSource.cc +++ b/DQMOffline/Trigger/src/HLTTauDQMOfflineSource.cc @@ -45,12 +45,6 @@ HLTTauDQMOfflineSource::HLTTauDQMOfflineSource( const edm::ParameterSet& ps ): if(ps.exists("TagAndProbe")) { tagAndProbePaths = ps.getUntrackedParameter >("TagAndProbe"); tagAndProbe_ = true; - // tagandprobePlotters_.reserve(tagAndProbePaths.size()); - //for(const edm::ParameterSet& tpset: tagAndProbePaths) { - // num_genTriggerEventFlag_.emplace_back(new GenericTriggerEventFlag(tpset.getParameter("numerator"),consumesCollector(), *this)); - // den_genTriggerEventFlag_.emplace_back(new GenericTriggerEventFlag(tpset.getParameter("denominator"),consumesCollector(), *this)); - // tagandprobePlotters_.emplace_back( new HLTTauDQMTagAndProbePlotter(tpset,std::move(num_genTriggerEventFlag_.back()),std::move(den_genTriggerEventFlag_.back()),dqmBaseFolder_)); - //} } if(doRefAnalysis_) { diff --git a/DQMOffline/Trigger/src/HLTTauDQMTagAndProbePlotter.cc b/DQMOffline/Trigger/src/HLTTauDQMTagAndProbePlotter.cc index f5d5fbf3344a2..40e4a55a9a65f 100644 --- a/DQMOffline/Trigger/src/HLTTauDQMTagAndProbePlotter.cc +++ b/DQMOffline/Trigger/src/HLTTauDQMTagAndProbePlotter.cc @@ -21,16 +21,11 @@ HLTTauDQMTagAndProbePlotter::HLTTauDQMTagAndProbePlotter(const edm::ParameterSet nbinsPt_(iConfig.getParameter("nPtBins")), ptmin_(iConfig.getParameter("ptmin")), ptmax_(iConfig.getParameter("ptmax")), -// nbinsEta_(iConfig.getParameter("nEtaBins")), -// etamin_(iConfig.getParameter("etamin")), -// etamax_(iConfig.getParameter("etamax")), nbinsPhi_(iConfig.getParameter("nPhiBins")), phimin_(iConfig.getParameter("phimin")), phimax_(iConfig.getParameter("phimax")), xvariable(iConfig.getParameter("xvariable")) { - //num_genTriggerEventFlag_ = std::move(numFlag); - //den_genTriggerEventFlag_ = std::move(denFlag); numTriggers = iConfig.getParameter("numerator").getParameter >("hltPaths"); denTriggers = iConfig.getParameter("denominator").getParameter >("hltPaths"); @@ -52,10 +47,6 @@ void HLTTauDQMTagAndProbePlotter::bookHistograms(DQMStore::IBooker &iBooker,edm: if(!isValid()) return; - // Initialize the GenericTriggerEventFlag - //if ( num_genTriggerEventFlag_ && num_genTriggerEventFlag_->on() ) num_genTriggerEventFlag_->initRun( iRun, iSetup ); - //if ( den_genTriggerEventFlag_ && den_genTriggerEventFlag_->on() ) den_genTriggerEventFlag_->initRun( iRun, iSetup ); - // Efficiency helpers iBooker.setCurrentFolder(triggerTag()+"/helpers"); h_num_pt = iBooker.book1D(xvariable+"EtEffNum", "", nbinsPt_, ptmin_, ptmax_); From afbebc304126409e77d0af25bc48fb4aada84dd8 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 4 Apr 2018 10:51:10 +0200 Subject: [PATCH 320/426] Typographic changes --- .../CTPPSDigi/interface/TotemTimingDigi.h | 189 +++++++++-------- DataFormats/CTPPSDigi/src/TotemTimingDigi.cc | 36 ++-- DataFormats/CTPPSDigi/src/classes_def.xml | 16 +- .../interface/TotemSampicFrame.h | 200 +++++++++--------- .../plugins/TotemVFATRawToDigi.cc | 20 +- .../CTPPSRawToDigi/src/RawToDigiConverter.cc | 8 +- 6 files changed, 237 insertions(+), 232 deletions(-) diff --git a/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h b/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h index 14fa5ccf72f40..2c0707e8de0f5 100644 --- a/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h +++ b/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h @@ -4,7 +4,7 @@ /** \class TotemTimingDigi * * Digi Class for CTPPS Timing Detector - * + * * \author Mirko Berretti * \author Nicola Minafra * March 2018 @@ -17,151 +17,152 @@ class TotemTimingDigi { - public: - TotemTimingDigi(const uint8_t hwId, const uint64_t FPGATimeStamp, const uint16_t TimeStampA, const uint16_t TimeStampB, const uint16_t CellInfo, const std::vector< uint8_t>& Samples, const TotemTimingEventInfo& totemTimingEventInfo); - TotemTimingDigi(const TotemTimingDigi& digi); + public: + TotemTimingDigi( const uint8_t hwId, const uint64_t fpgaTimestamp, const uint16_t timestampA, const uint16_t timestampB, const uint16_t cellInfo, const std::vector& samples, const TotemTimingEventInfo& totemTimingEventInfo ); + TotemTimingDigi( const TotemTimingDigi& digi ); TotemTimingDigi(); ~TotemTimingDigi() {}; - + /// Digis are equal if they have all the same values, NOT checking the samples! - bool operator==(const TotemTimingDigi& digi) const; + bool operator==( const TotemTimingDigi& digi ) const; /// Return digi values number - + /// Hardware Id formatted as: bits 0-3 Channel Id, bit 4 Sampic Id, bits 5-7 Digitizer Board Id - inline unsigned int getHardwareId() const - { - return hwId_; + inline unsigned int getHardwareId() const + { + return hwId_; } - + inline unsigned int getHardwareBoardId() const { - return (hwId_&0xE0)>>5; + return ( hwId_ & 0xE0 ) >> 5; } - + inline unsigned int getHardwareSampicId() const { - return (hwId_&0x10)>>4; + return ( hwId_ & 0x10 ) >> 4; } - + inline unsigned int getHardwareChannelId() const { - return (hwId_&0x0F); + return ( hwId_ & 0x0F ); } - - inline unsigned int getFPGATimeStamp() const + + inline unsigned int getFPGATimestamp() const { - return FPGATimeStamp_; + return fpgaTimestamp_; } - - inline unsigned int getTimeStampA() const + + inline unsigned int getTimestampA() const { - return TimeStampA_; + return timestampA_; } - - inline unsigned int getTimeStampB() const + + inline unsigned int getTimestampB() const { - return TimeStampB_; + return timestampB_; } - + inline unsigned int getCellInfo() const { - return CellInfo_; + return cellInfo_; } - - inline std::vector< uint8_t > getSamples() const + + inline std::vector getSamples() const { return samples_; } - - inline std::vector< uint8_t >::const_iterator getSamplesBegin() const + + inline std::vector::const_iterator getSamplesBegin() const { return samples_.cbegin(); } - - inline std::vector< uint8_t >::const_iterator getSamplesEnd() const + + inline std::vector::const_iterator getSamplesEnd() const { return samples_.cend(); } - + inline unsigned int getNumberOfSamples() const { return samples_.size(); } - + inline int getSampleAt( const unsigned int i ) const { int sampleValue = -1; - if ( i < samples_.size() ) sampleValue = (int) samples_.at(i); + if ( i < samples_.size() ) + sampleValue = (int) samples_.at( i ); return sampleValue; } - + inline TotemTimingEventInfo getEventInfo() const { return totemTimingEventInfo_; } - /// Set digi values /// Hardware Id formatted as: bits 0-3 Channel Id, bit 4 Sampic Id, bits 5-7 Digitizer Board Id - inline void setHardwareId(const uint8_t hwId) - { - hwId_ = hwId; + inline void setHardwareId( const uint8_t hwId ) + { + hwId_ = hwId; } - - inline void setHardwareBoardId(const unsigned int BoardId) + + inline void setHardwareBoardId( const unsigned int boardId ) { - hwId_ &= 0x1F; // Set board bits to 0 - hwId_ |= ((BoardId&0x07)<<5) & 0xE0; + hwId_ &= 0x1F; // set board bits to 0 + hwId_ |= ( ( boardId & 0x07 ) << 5 ) & 0xE0; } - - inline void setHardwareSampicId(const unsigned int SampicId) + + inline void setHardwareSampicId( const unsigned int sampicId ) { - hwId_ &= 0xEF; // Set sampic bit to 0 - hwId_ |= ((SampicId&0x01)<<4) & 0x10; + hwId_ &= 0xEF; // set Sampic bit to 0 + hwId_ |= ( ( sampicId & 0x01 ) << 4 ) & 0x10; } - - inline void setHardwareChannelId(const unsigned int ChannelId) + + inline void setHardwareChannelId( const unsigned int channelId ) { - hwId_ &= 0xF0; // Set sampic bit to 0 - hwId_ |= (ChannelId&0x0F) & 0x0F; + hwId_ &= 0xF0; // Set Sampic bit to 0 + hwId_ |= ( channelId & 0x0F ) & 0x0F; } - - inline void setFPGATimeStamp(const uint64_t FPGATimeStamp) + + inline void setFPGATimestamp( const uint64_t fpgaTimestamp ) { - FPGATimeStamp_ = FPGATimeStamp; + fpgaTimestamp_ = fpgaTimestamp; } - - inline void setTimeStampA(const uint16_t TimeStampA) + + inline void setTimestampA( const uint16_t timestampA ) { - TimeStampA_ = TimeStampA; + timestampA_ = timestampA; } - - inline void setTimeStampB(const uint16_t TimeStampB) + + inline void setTimestampB( const uint16_t timestampB ) { - TimeStampB_ = TimeStampB; + timestampB_ = timestampB; } - - inline void setCellInfo(const uint16_t CellInfo) + + inline void setCellInfo( const uint16_t cellInfo ) { - CellInfo_ = CellInfo & 0x3F; + cellInfo_ = cellInfo & 0x3F; } - - inline void setSamples(const std::vector< uint8_t >& samples) + + inline void setSamples( const std::vector& samples ) { samples_ = samples; } - - inline void addSample(const uint8_t sampleValue) + + inline void addSample( const uint8_t sampleValue ) { - samples_.emplace_back(sampleValue); + samples_.emplace_back( sampleValue ); } - + inline void setSampleAt( const unsigned int i, const uint8_t sampleValue ) { - if ( i < samples_.size() ) samples_.at(i) = sampleValue; + if ( i < samples_.size() ) + samples_.at(i) = sampleValue; } - + inline void setEventInfo( const TotemTimingEventInfo& totemTimingEventInfo ) { totemTimingEventInfo_ = totemTimingEventInfo; @@ -169,38 +170,38 @@ class TotemTimingDigi private: uint8_t hwId_; - uint64_t FPGATimeStamp_; - uint16_t TimeStampA_; - uint16_t TimeStampB_; - uint16_t CellInfo_; - - std::vector< uint8_t > samples_; - + uint64_t fpgaTimestamp_; + uint16_t timestampA_; + uint16_t timestampB_; + uint16_t cellInfo_; + + std::vector samples_; + TotemTimingEventInfo totemTimingEventInfo_; }; #include -inline bool operator< (const TotemTimingDigi& one, const TotemTimingDigi& other) +inline bool operator<( const TotemTimingDigi& one, const TotemTimingDigi& other ) { if ( one.getEventInfo() < other.getEventInfo() ) return true; - if ( one.getHardwareId() < other.getHardwareId() ) - return true; + if ( one.getHardwareId() < other.getHardwareId() ) + return true; return false; -} +} -inline std::ostream & operator<<(std::ostream & o, const TotemTimingDigi& digi) +inline std::ostream& operator<<( std::ostream& os, const TotemTimingDigi& digi ) { - return o << "TotemTimingDigi:" - << "\nHardwareId:\t" << std::hex << digi.getHardwareId() - << "\nDB: " << std::dec << digi.getHardwareBoardId() << "\tSampic: " << digi.getHardwareSampicId() << "\tChannel: " << digi.getHardwareChannelId() - << "\nFPGATimeStamp:\t" << std::hex << digi.getFPGATimeStamp() - << "\nTimeStampA:\t" << std::hex << digi.getTimeStampA() - << "\nTimeStampA:\t" << std::hex << digi.getTimeStampA() - << "\nCellInfo:\t" << std::hex << digi.getCellInfo() - << "\nNumberOfSamples:\t" << std::dec << digi.getNumberOfSamples() - << std::endl << digi.getEventInfo() << std::endl; + return os << "TotemTimingDigi:" + << "\nHardwareId:\t" << std::hex << digi.getHardwareId() + << "\nDB: " << std::dec << digi.getHardwareBoardId() << "\tSampic: " << digi.getHardwareSampicId() << "\tChannel: " << digi.getHardwareChannelId() + << "\nFPGATimestamp:\t" << std::hex << digi.getFPGATimestamp() + << "\nTimestampA:\t" << std::hex << digi.getTimestampA() + << "\nTimestampA:\t" << std::hex << digi.getTimestampA() + << "\nCellInfo:\t" << std::hex << digi.getCellInfo() + << "\nNumberOfSamples:\t" << std::dec << digi.getNumberOfSamples() + << std::endl << digi.getEventInfo() << std::endl; } #endif diff --git a/DataFormats/CTPPSDigi/src/TotemTimingDigi.cc b/DataFormats/CTPPSDigi/src/TotemTimingDigi.cc index 6f3e8a0fde658..22be241be9a55 100644 --- a/DataFormats/CTPPSDigi/src/TotemTimingDigi.cc +++ b/DataFormats/CTPPSDigi/src/TotemTimingDigi.cc @@ -1,5 +1,5 @@ /** \file - * + * * * \author Mirko Berretti * \author Nicola Minafra @@ -7,30 +7,34 @@ #include "DataFormats/CTPPSDigi/interface/TotemTimingDigi.h" -TotemTimingDigi::TotemTimingDigi(const uint8_t hwId, const uint64_t FPGATimeStamp, const uint16_t TimeStampA, const uint16_t TimeStampB, const uint16_t CellInfo, const std::vector& Samples, const TotemTimingEventInfo& totemTimingEventInfo ) : - hwId_(hwId), FPGATimeStamp_(FPGATimeStamp), TimeStampA_(TimeStampA), TimeStampB_(TimeStampB), CellInfo_(CellInfo), samples_(Samples), totemTimingEventInfo_(totemTimingEventInfo) +TotemTimingDigi::TotemTimingDigi( const uint8_t hwId, + const uint64_t fpgaTimestamp, const uint16_t timestampA, const uint16_t timestampB, + const uint16_t cellInfo, const std::vector& samples, + const TotemTimingEventInfo& totemTimingEventInfo ) : + hwId_( hwId ), fpgaTimestamp_( fpgaTimestamp ), timestampA_( timestampA ), timestampB_( timestampB ), + cellInfo_( cellInfo ), samples_( samples ), totemTimingEventInfo_( totemTimingEventInfo ) {} -TotemTimingDigi::TotemTimingDigi(const TotemTimingDigi& digi) : - hwId_(digi.getHardwareId()), FPGATimeStamp_(digi.getFPGATimeStamp()), TimeStampA_(digi.getTimeStampA()), TimeStampB_(digi.getTimeStampB()), CellInfo_(digi.getCellInfo()), samples_(digi.getSamples()), totemTimingEventInfo_(digi.getEventInfo()) +TotemTimingDigi::TotemTimingDigi( const TotemTimingDigi& digi ) : + hwId_( digi.hwId_ ), fpgaTimestamp_( digi.fpgaTimestamp_ ), timestampA_( digi.timestampA_ ), timestampB_( digi.timestampB_ ), + cellInfo_( digi.cellInfo_ ), samples_( digi.samples_ ), totemTimingEventInfo_( digi.totemTimingEventInfo_ ) {} TotemTimingDigi::TotemTimingDigi() : - hwId_(0), FPGATimeStamp_(0), TimeStampA_(0), TimeStampB_(0), CellInfo_(0) + hwId_( 0 ), fpgaTimestamp_( 0 ), timestampA_( 0 ), timestampB_( 0 ), cellInfo_( 0 ) {} // Comparison bool -TotemTimingDigi::operator==(const TotemTimingDigi& digi) const +TotemTimingDigi::operator==( const TotemTimingDigi& digi ) const { - if ( hwId_ != digi.getHardwareId() - || FPGATimeStamp_ != digi.getFPGATimeStamp() - || TimeStampA_ != digi.getTimeStampA() - || TimeStampB_ != digi.getTimeStampB() - || CellInfo_ != digi.getCellInfo() - || samples_ != digi.getSamples() + if ( hwId_ != digi.hwId_ + || fpgaTimestamp_ != digi.fpgaTimestamp_ + || timestampA_ != digi.timestampA_ + || timestampB_ != digi.timestampB_ + || cellInfo_ != digi.cellInfo_ + || samples_ != digi.samples_ ) return false; - else - return true; -} + return true; +} diff --git a/DataFormats/CTPPSDigi/src/classes_def.xml b/DataFormats/CTPPSDigi/src/classes_def.xml index 420b3ff58e573..bf1bad181fdf7 100644 --- a/DataFormats/CTPPSDigi/src/classes_def.xml +++ b/DataFormats/CTPPSDigi/src/classes_def.xml @@ -8,7 +8,7 @@ - + @@ -28,7 +28,7 @@ - + @@ -38,7 +38,7 @@ - + @@ -46,9 +46,9 @@ - + - + @@ -56,7 +56,7 @@ - + @@ -66,11 +66,11 @@ - + - + diff --git a/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h b/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h index 1976795447223..3a636079b1316 100644 --- a/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h +++ b/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h @@ -15,107 +15,113 @@ #include #include -#include "EventFilter/CTPPSRawToDigi/interface/VFATFrame.h" +#include "EventFilter/CTPPSRawToDigi/interface/VFATFrame.h" -enum TotemSampicConstant { - NumberOfSamples = 24, +enum TotemSampicConstant +{ + numberOfSamples = 24, }; #pragma pack(push,1) -struct TotemSampicData{ - uint8_t samples[TotemSampicConstant::NumberOfSamples]; - +struct TotemSampicData +{ + uint8_t samples[TotemSampicConstant::numberOfSamples]; + TotemSampicData() {} }; #pragma pack(pop) #pragma pack(push,1) -struct TotemSampicInfo{ +struct TotemSampicInfo +{ uint8_t hwId; uint8_t controlBits[6]; - uint8_t FPGATime[5]; - uint16_t TimeStampA; - uint16_t TimeStampB; - uint16_t CellInfo; - uint8_t PlaneChannelId; + uint8_t fpgaTime[5]; + uint16_t timestampA; + uint16_t timestampB; + uint16_t cellInfo; + uint8_t planeChannelId; uint8_t reserved[5]; - + TotemSampicInfo() {} }; #pragma pack(pop) #pragma pack(push,1) -struct TotemSampicEventInfo{ +struct TotemSampicEventInfo +{ uint8_t hwId; - uint8_t L1ATimeStamp[5]; + uint8_t l1ATimestamp[5]; uint16_t bunchNumber; uint32_t orbitNumber; uint32_t eventNumber; uint16_t channelMap; - uint16_t L1ALatency; + uint16_t l1ALatency; uint8_t numberOfSamples; uint8_t offsetOfSamples; - uint8_t FWVersion; - uint8_t PLLInfo; - + uint8_t fwVersion; + uint8_t pllInfo; + TotemSampicEventInfo() {} }; #pragma pack(pop) -uint8_t GrayToBinary_8bit(const uint8_t &gcode_data) +uint8_t grayToBinary_8bit( const uint8_t &gcode_data ) { - //b[0] = g[0] - uint8_t binary_byte=(gcode_data & 0x80); //MSB is the same + //b[0] = g[0] + uint8_t binary_byte = gcode_data & 0x80; // MSB is the same //b[i] = g[i] xor b[i-1] - binary_byte |= (gcode_data ^ (binary_byte >> 1)) & 0x40; - binary_byte |= (gcode_data ^ (binary_byte >> 1)) & 0x20; - binary_byte |= (gcode_data ^ (binary_byte >> 1)) & 0x10; - binary_byte |= (gcode_data ^ (binary_byte >> 1)) & 0x08; - binary_byte |= (gcode_data ^ (binary_byte >> 1)) & 0x04; - binary_byte |= (gcode_data ^ (binary_byte >> 1)) & 0x02; - binary_byte |= (gcode_data ^ (binary_byte >> 1)) & 0x01; + binary_byte |= ( gcode_data ^ ( binary_byte >> 1 ) ) & 0x40; + binary_byte |= ( gcode_data ^ ( binary_byte >> 1 ) ) & 0x20; + binary_byte |= ( gcode_data ^ ( binary_byte >> 1 ) ) & 0x10; + binary_byte |= ( gcode_data ^ ( binary_byte >> 1 ) ) & 0x08; + binary_byte |= ( gcode_data ^ ( binary_byte >> 1 ) ) & 0x04; + binary_byte |= ( gcode_data ^ ( binary_byte >> 1 ) ) & 0x02; + binary_byte |= ( gcode_data ^ ( binary_byte >> 1 ) ) & 0x01; return binary_byte; } -/** +/** * This class is intended to handle the timing infromation of SAMPIC in the TOTEM implementation **/ class TotemSampicFrame { public: - TotemSampicFrame(const uint8_t* chInfoPtr, const uint8_t* chDataPtr, const uint8_t* eventInfoPtr) : - TotemSampicInfo_(nullptr), TotemSampicData_(nullptr), TotemSampicEventInfo_(nullptr), status_(0) { - if ( chInfoPtr!=nullptr && chDataPtr!=nullptr && eventInfoPtr!=nullptr) { - TotemSampicInfo_ = (TotemSampicInfo*) chInfoPtr; - TotemSampicData_ = (TotemSampicData*) chDataPtr; - TotemSampicEventInfo_ = (TotemSampicEventInfo*) eventInfoPtr; + TotemSampicFrame( const uint8_t* chInfoPtr, const uint8_t* chDataPtr, const uint8_t* eventInfoPtr ) : + totemSampicInfo_( nullptr ), totemSampicData_( nullptr ), totemSampicEventInfo_( nullptr ), + status_( 0 ) { + if ( chInfoPtr != nullptr && chDataPtr != nullptr && eventInfoPtr != nullptr) { + totemSampicInfo_ = (TotemSampicInfo*) chInfoPtr; + totemSampicData_ = (TotemSampicData*) chDataPtr; + totemSampicEventInfo_ = (TotemSampicEventInfo*) eventInfoPtr; } - if ( TotemSampicEventInfo_->numberOfSamples == TotemSampicConstant::NumberOfSamples || TotemSampicInfo_->controlBits[3] == 0x69 ) + if ( totemSampicEventInfo_->numberOfSamples == TotemSampicConstant::numberOfSamples + || totemSampicInfo_->controlBits[3] == 0x69 ) status_ = 1; } ~TotemSampicFrame() {} /// Prints the frame. /// If binary is true, binary format is used. - void PrintRaw(bool binary = false) const { + void printRaw( bool binary = false ) const { std::cout << "Event Info: " << std::endl; - PrintRawBuffer( (uint16_t*) TotemSampicEventInfo_ ); - + printRawBuffer( (uint16_t*) totemSampicEventInfo_ ); + std::cout << "Channel Info: " << std::endl; - PrintRawBuffer( (uint16_t*) TotemSampicInfo_ ); - + printRawBuffer( (uint16_t*) totemSampicInfo_ ); + std::cout << "Channel Data: " << std::endl; - PrintRawBuffer( (uint16_t*) TotemSampicData_ ); + printRawBuffer( (uint16_t*) totemSampicData_ ); } - void Print() const { + void print() const { std::bitset<16> bitsChannelMap( getChannelMap() ); std::bitset<16> bitsPLLInfo( getPLLInfo() ); std::cout << "TotemSampicFrame:\nEvent:" << "\nHardwareId (Event):\t" << std::hex << (unsigned int) getEventHardwareId() - << "\nL1A Time Stamp:\t" << std::dec << getL1ATimeStamp() + << "\nL1A Timestamp:\t" << std::dec << getL1ATimestamp() << "\nL1A Latency:\t" << std::dec << getL1ALatency() << "\nBunch Number:\t" << std::dec << getBunchNumber() << "\nOrbit Number:\t" << std::dec << getOrbitNumber() @@ -125,139 +131,139 @@ class TotemSampicFrame << "\nOffset of Samples:\t" << std::dec << (int) getOffsetOfSamples() << "\nFW Version:\t" << std::hex << (int) getFWVersion() << "\nChannel:\nHardwareId:\t" << std::hex << (unsigned int) getHardwareId() - << "\nFPGATimeStamp:\t" << std::dec << getFPGATimeStamp() - << "\nTimeStampA:\t" << std::dec << getTimeStampA() - << "\nTimeStampA:\t" << std::dec << getTimeStampA() + << "\nFPGATimestamp:\t" << std::dec << getFPGATimestamp() + << "\nTimestampA:\t" << std::dec << getTimestampA() + << "\nTimestampA:\t" << std::dec << getTimestampA() << "\nCellInfo:\t" << std::dec << getCellInfo() << "\nPlane:\t" << std::dec << getDetPlane() << "\nChannel:\t" << std::dec << getDetChannel() << "\\nPLL Info:\t" << bitsPLLInfo.to_string() - << std::endl << std::endl; + << std::endl << std::endl; } // All getters - inline uint8_t getHardwareId() const { - return status_ * TotemSampicInfo_->hwId; + inline uint8_t getHardwareId() const { + return status_ * totemSampicInfo_->hwId; } - inline uint64_t getFPGATimeStamp() const { + inline uint64_t getFPGATimestamp() const { uint64_t time = 0; - for (int i=0; i<5; ++i) - time += TotemSampicInfo_->FPGATime[i] << 8*1; + for ( unsigned short i = 0; i < 5; ++i ) + time += totemSampicInfo_->fpgaTime[i] << 8*1; return status_ * time; } - inline uint16_t getTimeStampA() const { - return status_ * GrayToBinary_8bit(TotemSampicInfo_->TimeStampA); + inline uint16_t getTimestampA() const { + return status_ * grayToBinary_8bit( totemSampicInfo_->timestampA ); } - inline uint16_t getTimeStampB() const { - return status_ * GrayToBinary_8bit(TotemSampicInfo_->TimeStampB); + inline uint16_t getTimestampB() const { + return status_ * grayToBinary_8bit( totemSampicInfo_->timestampB ); } inline uint16_t getCellInfo() const { - return status_ * (TotemSampicInfo_->CellInfo & 0x3F); + return status_ * ( totemSampicInfo_->cellInfo & 0x3F ); } inline int getDetPlane() const { - return status_ * ((TotemSampicInfo_->PlaneChannelId & 0xF0)>>4); + return status_ * ( ( totemSampicInfo_->planeChannelId & 0xF0 ) >> 4 ); } inline int getDetChannel() const { - return status_ * (TotemSampicInfo_->PlaneChannelId & 0xF0); + return status_ * ( totemSampicInfo_->planeChannelId & 0xF0 ); } inline int getPLLInfo() const { - return status_ * TotemSampicEventInfo_->PLLInfo; + return status_ * totemSampicEventInfo_->pllInfo; } inline int getFWVersion() const { - return status_ * TotemSampicEventInfo_->FWVersion; + return status_ * totemSampicEventInfo_->fwVersion; } - const std::vector< uint8_t > getSamples() const { + const std::vector getSamples() const { std::vector samples; - if (status_) { - samples.assign( TotemSampicData_->samples, TotemSampicData_->samples + TotemSampicConstant::NumberOfSamples); - std::for_each(samples.begin(), samples.end(), &GrayToBinary_8bit); + if ( status_ ) { + samples.assign( totemSampicData_->samples, totemSampicData_->samples + TotemSampicConstant::numberOfSamples ); + std::for_each( samples.begin(), samples.end(), &grayToBinary_8bit ); } return samples; } inline unsigned int getNumberOfSamples() const { - return status_ * TotemSampicConstant::NumberOfSamples; + return status_ * TotemSampicConstant::numberOfSamples; } // Event Info - inline uint8_t getEventHardwareId() const { - return status_ * TotemSampicEventInfo_->hwId; + inline uint8_t getEventHardwareId() const { + return status_ * totemSampicEventInfo_->hwId; } - inline uint64_t getL1ATimeStamp() const { + inline uint64_t getL1ATimestamp() const { uint64_t time = 0; - for (int i=0; i<5; ++i) - time += TotemSampicEventInfo_->L1ATimeStamp[i] << 8*1; + for ( unsigned short i = 0; i < 5; ++i ) + time += totemSampicEventInfo_->l1ATimestamp[i] << 8*1; return status_ * time; } inline uint16_t getBunchNumber() const { - return status_ * TotemSampicEventInfo_->bunchNumber; + return status_ * totemSampicEventInfo_->bunchNumber; } - + inline uint32_t getOrbitNumber() const { - return status_ * TotemSampicEventInfo_->orbitNumber; + return status_ * totemSampicEventInfo_->orbitNumber; } - + inline uint32_t getEventNumber() const { - return status_ * TotemSampicEventInfo_->eventNumber; + return status_ * totemSampicEventInfo_->eventNumber; } - + inline uint16_t getChannelMap() const { - return status_ * TotemSampicEventInfo_->channelMap; + return status_ * totemSampicEventInfo_->channelMap; } - + inline uint16_t getL1ALatency() const { - return status_ *TotemSampicEventInfo_->L1ALatency; + return status_ * totemSampicEventInfo_->l1ALatency; } - + inline uint8_t getNumberOfSentSamples() const { - return status_ * TotemSampicEventInfo_->numberOfSamples; + return status_ * totemSampicEventInfo_->numberOfSamples; } - + inline uint8_t getOffsetOfSamples() const { - return status_ * TotemSampicEventInfo_->offsetOfSamples; + return status_ * totemSampicEventInfo_->offsetOfSamples; } - inline bool isOK() const { - return status_; + inline bool valid() const { + return status_ != 0; } protected: - const TotemSampicInfo* TotemSampicInfo_; - const TotemSampicData* TotemSampicData_; - const TotemSampicEventInfo* TotemSampicEventInfo_; + const TotemSampicInfo* totemSampicInfo_; + const TotemSampicData* totemSampicData_; + const TotemSampicEventInfo* totemSampicEventInfo_; int status_; - inline void PrintRawBuffer(uint16_t const* buffer, const bool binary=false, const unsigned int size=12) const { - for (unsigned int i = 0; i < size; i++) { - if (binary) { - std::bitset<16> bits( *(buffer++) ); + inline void printRawBuffer( const uint16_t* buffer, const bool binary = false, const unsigned int size = 12 ) const { + for ( unsigned int i = 0; i < size; i++ ) { + if ( binary ) { + std::bitset<16> bits( *( buffer++ ) ); std::cout << bits.to_string() << std::endl; } else - std::cout << std::setfill('0') << std::setw(4) << std::hex << *(buffer++) << std::endl; + std::cout << std::setfill( '0' ) << std::setw( 4 ) << std::hex << *( buffer++ ) << std::endl; } std::cout << std::endl; } -}; +}; #endif diff --git a/EventFilter/CTPPSRawToDigi/plugins/TotemVFATRawToDigi.cc b/EventFilter/CTPPSRawToDigi/plugins/TotemVFATRawToDigi.cc index b949d3bea29ce..1a555be0f5b69 100644 --- a/EventFilter/CTPPSRawToDigi/plugins/TotemVFATRawToDigi.cc +++ b/EventFilter/CTPPSRawToDigi/plugins/TotemVFATRawToDigi.cc @@ -81,9 +81,9 @@ TotemVFATRawToDigi::TotemVFATRawToDigi(const edm::ParameterSet &conf): // validate chosen subSystem if (subSystemName == "TrackingStrip") subSystem = ssTrackingStrip; - if (subSystemName == "TimingDiamond") + else if (subSystemName == "TimingDiamond") subSystem = ssTimingDiamond; - if (subSystemName == "TotemTiming") + else if (subSystemName == "TotemTiming") subSystem = ssTotemTiming; if (subSystem == ssUndefined) @@ -103,10 +103,8 @@ TotemVFATRawToDigi::TotemVFATRawToDigi(const edm::ParameterSet &conf): produces< DetSetVector >(subSystemName); // set default IDs - if (fedIds.empty()) - { - if (subSystem == ssTrackingStrip) - { + if (fedIds.empty()) { + if (subSystem == ssTrackingStrip) { for (int id = FEDNumbering::MINTotemRPHorizontalFEDID; id <= FEDNumbering::MAXTotemRPHorizontalFEDID; ++id) fedIds.push_back(id); @@ -114,14 +112,12 @@ TotemVFATRawToDigi::TotemVFATRawToDigi(const edm::ParameterSet &conf): fedIds.push_back(id); } - if (subSystem == ssTimingDiamond) - { + else if (subSystem == ssTimingDiamond) { for (int id = FEDNumbering::MINCTPPSDiamondFEDID; id <= FEDNumbering::MAXCTPPSDiamondFEDID; ++id) fedIds.push_back(id); } - if (subSystem == ssTotemTiming) - { + else if (subSystem == ssTotemTiming) { for (int id = FEDNumbering::MINTotemRPTimingVerticalFEDID; id <= FEDNumbering::MAXTotemRPTimingVerticalFEDID; ++id) fedIds.push_back(id); } @@ -144,10 +140,10 @@ void TotemVFATRawToDigi::produce(edm::Event& event, const edm::EventSetup &es) if (subSystem == ssTrackingStrip) run< DetSetVector >(event, es); - if (subSystem == ssTimingDiamond) + else if (subSystem == ssTimingDiamond) run< DetSetVector >(event, es); - if (subSystem == ssTotemTiming) + else if (subSystem == ssTotemTiming) run< DetSetVector >(event, es); } diff --git a/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc b/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc index c975ad55b253e..6326ea2dafc2a 100644 --- a/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc +++ b/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc @@ -334,13 +334,11 @@ void RawToDigiConverter::Run(const VFATFrameCollection &coll, const TotemDAQMapp // Extract all the waveform information from the raw data TotemSampicFrame totemSampicFrame((uint8_t*) record.frame->getData(), (uint8_t*) channelwaveform.frame->getData(), (uint8_t*) eventInfo.frame->getData()); -// if (totemSampicFrame.isOK()) totemSampicFrame.Print(); - - if (totemSampicFrame.isOK()) + if (totemSampicFrame.valid()) { // create the digi - TotemTimingEventInfo eventInfoTmp( totemSampicFrame.getEventHardwareId(), totemSampicFrame.getL1ATimeStamp(), totemSampicFrame.getBunchNumber(), totemSampicFrame.getOrbitNumber(), totemSampicFrame.getEventNumber(), totemSampicFrame.getChannelMap(), totemSampicFrame.getL1ALatency(), totemSampicFrame.getNumberOfSentSamples(), totemSampicFrame.getOffsetOfSamples() ); - TotemTimingDigi digiTmp( totemSampicFrame.getHardwareId(), totemSampicFrame.getFPGATimeStamp(), totemSampicFrame.getTimeStampA(), totemSampicFrame.getTimeStampB(), totemSampicFrame.getCellInfo(), totemSampicFrame.getSamples(), eventInfoTmp); + TotemTimingEventInfo eventInfoTmp( totemSampicFrame.getEventHardwareId(), totemSampicFrame.getL1ATimestamp(), totemSampicFrame.getBunchNumber(), totemSampicFrame.getOrbitNumber(), totemSampicFrame.getEventNumber(), totemSampicFrame.getChannelMap(), totemSampicFrame.getL1ALatency(), totemSampicFrame.getNumberOfSentSamples(), totemSampicFrame.getOffsetOfSamples() ); + TotemTimingDigi digiTmp( totemSampicFrame.getHardwareId(), totemSampicFrame.getFPGATimestamp(), totemSampicFrame.getTimestampA(), totemSampicFrame.getTimestampB(), totemSampicFrame.getCellInfo(), totemSampicFrame.getSamples(), eventInfoTmp); // calculate ids TotemTimingDetId detId(record.info->symbolicID.symbolicID); From 99db2136b2b1fbc25cbb09932c7e982bd3ef6394 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 4 Apr 2018 11:13:36 +0200 Subject: [PATCH 321/426] Removed unnecessary couts/printf, some replaced with LogDebug/LogWarning statements --- .../plugins/TotemDAQMappingESSourceXML.cc | 110 +++++++------- .../CTPPSRawToDigi/src/RawDataUnpacker.cc | 139 ++++++++---------- 2 files changed, 120 insertions(+), 129 deletions(-) diff --git a/CondFormats/CTPPSReadoutObjects/plugins/TotemDAQMappingESSourceXML.cc b/CondFormats/CTPPSReadoutObjects/plugins/TotemDAQMappingESSourceXML.cc index c74d7903014b5..1b3c0c4dc853c 100644 --- a/CondFormats/CTPPSReadoutObjects/plugins/TotemDAQMappingESSourceXML.cc +++ b/CondFormats/CTPPSReadoutObjects/plugins/TotemDAQMappingESSourceXML.cc @@ -66,11 +66,11 @@ class TotemDAQMappingESSourceXML: public edm::ESProducer, public edm::EventSetup /// COMMON Chip XML tags static const std::string tagChip1; static const std::string tagChip2; - + /// diamond specific tags static const std::string tagDiamondPlane; - static const std::string tagDiamondCh; - + static const std::string tagDiamondCh; + /// totem timing specific tags static const std::string tagSampicBoard; static const std::string tagSampicCh; @@ -128,7 +128,7 @@ class TotemDAQMappingESSourceXML: public edm::ESProducer, public edm::EventSetup /// recursive method to extract RP-related information from the DOM tree void ParseTreeDiamond(ParseType, xercesc::DOMNode *, NodeType, unsigned int parentID, const std::shared_ptr&, const std::shared_ptr&); - + /// recursive method to extract RP-related information from the DOM tree void ParseTreeTotemTiming(ParseType, xercesc::DOMNode *, NodeType, unsigned int parentID, const std::shared_ptr&, const std::shared_ptr&); @@ -172,12 +172,12 @@ class TotemDAQMappingESSourceXML: public edm::ESProducer, public edm::EventSetup { return ((type == nArm)||(type == nRPStation)||(type == nRPPot)||(type == nDiamondPlane)||(type == nDiamondCh)); } - + bool TotemTimingNode(NodeType type) { return ((type == nArm)||(type == nRPStation)||(type == nRPPot)||(type == nSampicBoard)||(type == nSampicChannel)||(type == nTotemTimingPlane)||(type == nTotemTimingCh)); } - + bool CommonNode(NodeType type) { return ((type==nChip)||(type==nArm)); @@ -269,11 +269,11 @@ void TotemDAQMappingESSourceXML::setIntervalFor(const edm::eventsetup::EventSetu { currentBlockValid = true; currentBlock = idx; - + const IOVSyncValue begin(range.startEventID()); const IOVSyncValue end(range.endEventID()); oValidity = edm::ValidityInterval(begin, end); - + LogVerbatim("TotemDAQMappingESSourceXML") << " block found: index=" << currentBlock << ", interval=(" << range.startEventID() << " - " << range.endEventID() << ")"; @@ -292,7 +292,7 @@ void TotemDAQMappingESSourceXML::setIntervalFor(const edm::eventsetup::EventSetu //---------------------------------------------------------------------------------------------------- TotemDAQMappingESSourceXML::~TotemDAQMappingESSourceXML() -{ +{ } //---------------------------------------------------------------------------------------------------- @@ -350,18 +350,18 @@ void TotemDAQMappingESSourceXML::ParseXML(ParseType pType, const string &file, if (!domDoc) throw cms::Exception("TotemDAQMappingESSourceXML::ParseXML") << "Cannot parse file `" << file - << "' (domDoc = NULL)." << endl; + << "' (domDoc = NULL)."; DOMElement* elementRoot = domDoc->getDocumentElement(); if (!elementRoot) throw cms::Exception("TotemDAQMappingESSourceXML::ParseXML") << "File `" << - file << "' is empty." << endl; + file << "' is empty."; ParseTreeRP(pType, elementRoot, nTop, 0, mapping, mask); ParseTreeDiamond(pType, elementRoot, nTop, 0, mapping, mask); - + ParseTreeTotemTiming(pType, elementRoot, nTop, 0, mapping, mask); } @@ -393,7 +393,7 @@ void TotemDAQMappingESSourceXML::ParseTreeRP(ParseType pType, xercesc::DOMNode * // structure control if (!RPNode(type)) continue; - + NodeType expectedParentType; switch (type) { @@ -441,15 +441,15 @@ void TotemDAQMappingESSourceXML::ParseTreeRP(ParseType pType, xercesc::DOMNode * // content control if (!id_set) throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeRP") << "id not given for element `" - << cms::xerces::toString(n->getNodeName()) << "'" << endl; + << cms::xerces::toString(n->getNodeName()) << "'"; if (!hw_id_set && type == nChip && pType == pMapping) throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeRP") << "hw_id not given for element `" - << cms::xerces::toString(n->getNodeName()) << "'" << endl; + << cms::xerces::toString(n->getNodeName()) << "'"; if (type == nRPPlane && id > 9) throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeRP") << - "Plane IDs range from 0 to 9. id = " << id << " is invalid." << endl; + "Plane IDs range from 0 to 9. id = " << id << " is invalid."; #ifdef DEBUG printf("\tID found: 0x%x\n", id); @@ -462,10 +462,10 @@ void TotemDAQMappingESSourceXML::ParseTreeRP(ParseType pType, xercesc::DOMNode * TotemVFATInfo vfatInfo; vfatInfo.hwID = hw_id; - const unsigned int armIdx = (parentID / 1000) % 10; - const unsigned int stIdx = (parentID / 100) % 10; - const unsigned int rpIdx = (parentID / 10) % 10; - const unsigned int plIdx = parentID % 10; + const unsigned int armIdx = (parentID / 1000) % 10; + const unsigned int stIdx = (parentID / 100) % 10; + const unsigned int rpIdx = (parentID / 10) % 10; + const unsigned int plIdx = parentID % 10; vfatInfo.symbolicID.symbolicID = TotemRPDetId(armIdx, stIdx, rpIdx, plIdx, id); @@ -477,10 +477,10 @@ void TotemDAQMappingESSourceXML::ParseTreeRP(ParseType pType, xercesc::DOMNode * // store mask data if (pType == pMask && type == nChip) { - const unsigned int armIdx = (parentID / 1000) % 10; - const unsigned int stIdx = (parentID / 100) % 10; - const unsigned int rpIdx = (parentID / 10) % 10; - const unsigned int plIdx = parentID % 10; + const unsigned int armIdx = (parentID / 1000) % 10; + const unsigned int stIdx = (parentID / 100) % 10; + const unsigned int rpIdx = (parentID / 10) % 10; + const unsigned int plIdx = parentID % 10; TotemSymbID symbId; symbId.symbolicID = TotemRPDetId(armIdx, stIdx, rpIdx, plIdx, id); @@ -514,11 +514,11 @@ void TotemDAQMappingESSourceXML::ParseTreeDiamond(ParseType pType, xercesc::DOMN DOMNodeList *children = parent->getChildNodes(); for (unsigned int i = 0; i < children->getLength(); i++) - { + { DOMNode *n = children->item(i); if (n->getNodeType() != DOMNode::ELEMENT_NODE) continue; - + NodeType type = GetNodeType(n); #ifdef DEBUG printf("\tname = %s, type = %u\n", cms::xerces::toString(n->getNodeName()), type); @@ -546,8 +546,8 @@ void TotemDAQMappingESSourceXML::ParseTreeDiamond(ParseType pType, xercesc::DOMN } // parse tag attributes - unsigned int id =0,hw_id = 0; - bool id_set = false,hw_id_set = false; + unsigned int id =0,hw_id = 0; + bool id_set = false,hw_id_set = false; DOMNamedNodeMap* attr = n->getAttributes(); for (unsigned int j = 0; j < attr->getLength(); j++) @@ -569,17 +569,17 @@ void TotemDAQMappingESSourceXML::ParseTreeDiamond(ParseType pType, xercesc::DOMN } // content control - if (!id_set) + if (!id_set) throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeDiamond") << "id not given for element `" - << cms::xerces::toString(n->getNodeName()) << "'" << endl; + << cms::xerces::toString(n->getNodeName()) << "'"; if (!hw_id_set && type == nDiamondCh && pType == pMapping) throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeDiamond") << "hw_id not given for element `" - << cms::xerces::toString(n->getNodeName()) << "'" << endl; - + << cms::xerces::toString(n->getNodeName()) << "'"; + if (type == nDiamondPlane && id > 3) throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeDiamond") << - "Plane IDs range from 0 to 3. id = " << id << " is invalid." << endl; + "Plane IDs range from 0 to 3. id = " << id << " is invalid."; #ifdef DEBUG printf("\tID found: 0x%x\n", id); @@ -590,16 +590,16 @@ void TotemDAQMappingESSourceXML::ParseTreeDiamond(ParseType pType, xercesc::DOMN { const TotemFramePosition &framepos = ChipFramePosition(n); - + TotemVFATInfo vfatInfo; - vfatInfo.hwID = hw_id; + vfatInfo.hwID = hw_id; if (type == nDiamondCh) { unsigned int ArmNum = (parentID/ 10000) % 10; unsigned int StationNum = (parentID / 1000) % 10; unsigned int RpNum = (parentID/ 100) % 10; - unsigned int PlaneNum = (parentID % 100) ; + unsigned int PlaneNum = (parentID % 100) ; vfatInfo.symbolicID.symbolicID = CTPPSDiamondDetId(ArmNum, StationNum, RpNum, PlaneNum, id); @@ -619,7 +619,7 @@ void TotemDAQMappingESSourceXML::ParseTreeDiamond(ParseType pType, xercesc::DOMN childId = parentID * 10 + id; ParseTreeDiamond(pType,n ,type ,childId ,mapping ,mask); - + } } @@ -632,14 +632,14 @@ void TotemDAQMappingESSourceXML::ParseTreeTotemTiming(ParseType pType, xercesc:: const std::shared_ptr& mask) { DOMNodeList *children = parent->getChildNodes(); - + // Fill map hwId -> TotemTimingPlaneChannelPair for (unsigned int i = 0; i < children->getLength(); i++) - { + { DOMNode *child = children->item(i); if ( (child->getNodeType() != DOMNode::ELEMENT_NODE) || (GetNodeType(child)!=nTotemTimingCh) ) continue; - + int plane = -1; DOMNamedNodeMap* attr = parent->getAttributes(); for (unsigned int j = 0; j < attr->getLength(); j++) @@ -649,7 +649,7 @@ void TotemDAQMappingESSourceXML::ParseTreeTotemTiming(ParseType pType, xercesc:: if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "id")) sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%d", &plane); } - + int channel = -1; unsigned int hwId = 0; @@ -663,16 +663,16 @@ void TotemDAQMappingESSourceXML::ParseTreeTotemTiming(ParseType pType, xercesc:: if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "hwId")) sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%x", &hwId); } - - mapping->totemTimingChannelMap[ (uint8_t) hwId ] = TotemDAQMapping::TotemTimingPlaneChannelPair(plane, channel); + + mapping->totemTimingChannelMap[ (uint8_t) hwId ] = TotemDAQMapping::TotemTimingPlaneChannelPair(plane, channel); } for (unsigned int i = 0; i < children->getLength(); i++) - { + { DOMNode *n = children->item(i); if (n->getNodeType() != DOMNode::ELEMENT_NODE) continue; - + NodeType type = GetNodeType(n); // structure control @@ -699,10 +699,10 @@ void TotemDAQMappingESSourceXML::ParseTreeTotemTiming(ParseType pType, xercesc:: } // parse tag attributes - unsigned int id =0; + unsigned int id =0; bool id_set = false; DOMNamedNodeMap* attr = n->getAttributes(); - + for (unsigned int j = 0; j < attr->getLength(); j++) { @@ -717,19 +717,19 @@ void TotemDAQMappingESSourceXML::ParseTreeTotemTiming(ParseType pType, xercesc:: } // content control - if (!id_set) + if (!id_set) throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeTotemTiming") << "id not given for element `" - << cms::xerces::toString(n->getNodeName()) << "'" << endl; + << cms::xerces::toString(n->getNodeName()) << "'"; if (type == nSampicBoard && id > 5) throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeTotemTiming") << - "SampicBoard IDs range from 0 to 5. id = " << id << " is invalid." << endl; + "SampicBoard IDs range from 0 to 5. id = " << id << " is invalid."; // store mapping data if (pType == pMapping &&type == nSampicChannel) { const TotemFramePosition &framepos = ChipFramePosition(n); - + TotemVFATInfo vfatInfo; unsigned int ArmNum = (parentID/ 10000) % 10; unsigned int StationNum = (parentID / 1000) % 10; @@ -749,7 +749,7 @@ void TotemDAQMappingESSourceXML::ParseTreeTotemTiming(ParseType pType, xercesc:: childId = parentID * 10 + id; ParseTreeTotemTiming(pType,n ,type ,childId ,mapping ,mask); - + } } @@ -769,14 +769,14 @@ TotemFramePosition TotemDAQMappingESSourceXML::ChipFramePosition(xercesc::DOMNod throw cms::Exception("TotemDAQMappingESSourceXML") << "Unrecognized tag `" << cms::xerces::toString(a->getNodeName()) << "' or incompatible value `" << cms::xerces::toString(a->getNodeValue()) << - "'." << endl; + "'."; } } if (!fp.checkXMLAttributeFlag(attributeFlag)) { throw cms::Exception("TotemDAQMappingESSourceXML") << - "Wrong/incomplete DAQ channel specification (attributeFlag = " << attributeFlag << ")." << endl; + "Wrong/incomplete DAQ channel specification (attributeFlag = " << attributeFlag << ")."; } return fp; @@ -799,7 +799,7 @@ TotemDAQMappingESSourceXML::NodeType TotemDAQMappingESSourceXML::GetNodeType(xer //diamond specifics if (Test(n, tagDiamondCh)) return nDiamondCh; if (Test(n, tagDiamondPlane)) return nDiamondPlane; - + //totem timing specifics if (Test(n, tagSampicBoard)) return nSampicBoard; if (Test(n, tagSampicCh)) return nSampicChannel; diff --git a/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc b/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc index 2f589d90eed5e..36c8895ed144e 100644 --- a/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc +++ b/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc @@ -1,7 +1,7 @@ /**************************************************************************** * * This is a part of TOTEM offline software. -* Authors: +* Authors: * Jan Kašpar (jan.kaspar@gmail.com) * Nicola Minafra * @@ -52,44 +52,40 @@ int RawDataUnpacker::ProcessOptoRxFrame(const word *buf, unsigned int frameSize, fedInfo.setHeader(head); fedInfo.setFooter(foot); - unsigned int BOE = (head >> 60) & 0xF; - unsigned int H0 = (head >> 0) & 0xF; + unsigned int boe = (head >> 60) & 0xF; + unsigned int h0 = (head >> 0) & 0xF; - #ifdef DEBUG - unsigned long LV1 = (head >> 32) & 0xFFFFFF; - unsigned long BX = (head >> 20) & 0xFFF; - #endif - unsigned int OptoRxId = (head >> 8) & 0xFFF; - unsigned int FOV = (head >> 4) & 0xF; + unsigned long lv1 = (head >> 32) & 0xFFFFFF; + unsigned long bx = (head >> 20) & 0xFFF; + unsigned int optoRxId = (head >> 8) & 0xFFF; + unsigned int fov = (head >> 4) & 0xF; - unsigned int EOE = (foot >> 60) & 0xF; - unsigned int F0 = (foot >> 0) & 0xF; - unsigned int FSize = (foot >> 32) & 0x3FF; + unsigned int eoe = (foot >> 60) & 0xF; + unsigned int f0 = (foot >> 0) & 0xF; + unsigned int fSize = (foot >> 32) & 0x3FF; // check header and footer structure - if (BOE != 5 || H0 != 0 || EOE != 10 || F0 != 0 || FSize != frameSize) + if (boe != 5 || h0 != 0 || eoe != 10 || f0 != 0 || fSize != frameSize) { if (verbosity) LogWarning("Totem") << "Error in RawDataUnpacker::ProcessOptoRxFrame > " << "Wrong structure of OptoRx header/footer: " - << "BOE=" << BOE << ", H0=" << H0 << ", EOE=" << EOE << ", F0=" << F0 - << ", size (OptoRx)=" << FSize << ", size (DATE)=" << frameSize - << ". OptoRxID=" << OptoRxId << ". Skipping frame." << endl; + << "BOE=" << boe << ", H0=" << h0 << ", EOE=" << eoe << ", F0=" << f0 + << ", size (OptoRx)=" << fSize << ", size (DATE)=" << frameSize + << ". OptoRxID=" << optoRxId << ". Skipping frame." << endl; return 0; } - - #ifdef DEBUG - printf(">> RawDataUnpacker::ProcessOptoRxFrame > OptoRxId = %u, BX = %lu, LV1 = %lu, frameSize = %u)\n", - OptoRxId, BX, LV1, frameSize); - #endif + LogDebug( "Totem" ) << "RawDataUnpacker::ProcessOptoRxFrame: " + << "OptoRxId = " << optoRxId << ", BX = " << bx << ", LV1 = " << lv1 << ", frameSize = " << frameSize; - if (OptoRxId >= FEDNumbering::MINTotemRPTimingVerticalFEDID && OptoRxId <= FEDNumbering::MAXTotemRPTimingVerticalFEDID) { + if (optoRxId >= FEDNumbering::MINTotemRPTimingVerticalFEDID && optoRxId <= FEDNumbering::MAXTotemRPTimingVerticalFEDID) + { ProcessOptoRxFrameSampic(buf, frameSize, fedInfo, fc); return 0; } - + // parallel or serial transmission? - switch (FOV) { + switch (fov) { case 1: return ProcessOptoRxFrameSerial(buf, frameSize, fc); case 2: @@ -99,7 +95,7 @@ int RawDataUnpacker::ProcessOptoRxFrame(const word *buf, unsigned int frameSize, } if (verbosity) - LogWarning("Totem") << "Error in RawDataUnpacker::ProcessOptoRxFrame > " << "Unknown FOV = " << FOV << endl; + LogWarning("Totem") << "Error in RawDataUnpacker::ProcessOptoRxFrame > " << "Unknown FOV = " << fov << endl; return 0; } @@ -109,7 +105,7 @@ int RawDataUnpacker::ProcessOptoRxFrame(const word *buf, unsigned int frameSize, int RawDataUnpacker::ProcessOptoRxFrameSerial(const word *buf, unsigned int frameSize, SimpleVFATFrameCollection *fc) const { // get OptoRx metadata - unsigned int OptoRxId = (buf[0] >> 8) & 0xFFF; + unsigned int optoRxId = (buf[0] >> 8) & 0xFFF; // get number of subframes unsigned int subFrames = (frameSize - 2) / 194; @@ -123,33 +119,32 @@ int RawDataUnpacker::ProcessOptoRxFrameSerial(const word *buf, unsigned int fram unsigned int head = (buf[1 + 194 * r] >> (16 * c)) & 0xFFFF; unsigned int foot = (buf[194 + 194 * r] >> (16 * c)) & 0xFFFF; - #ifdef DEBUG - printf(">>>> r = %i, c = %i: S = %i, BOF = %i, EOF = %i, ID = %i, ID' = %i\n", r, c, head & 0x1, head >> 12, foot >> 12, (head >> 8) & 0xF, (foot >> 8) & 0xF); - #endif + LogDebug( "Totem" ) + << "r = " << r << ", c = " << c << ": " + << "S = " << ( head & 0x1 ) << ", BOF = " << ( head >> 12 ) << ", EOF = " << ( foot >> 12 ) + << ", ID = " << ( ( head >> 8 ) & 0xF ) << ", ID' = " << ( ( foot >> 8) & 0xF ); // stop if this GOH is NOT active if ((head & 0x1) == 0) continue; - #ifdef DEBUG - printf("\tHeader active (%04x -> %x).\n", head, head & 0x1); - #endif + LogDebug( "Totem" ) + << "Header active (" << head << " -> " << ( head & 0x1 ) << ")."; // check structure if (head >> 12 != 0x4 || foot >> 12 != 0xB || ((head >> 8) & 0xF) != ((foot >> 8) & 0xF)) { - char ss[500]; + std::ostringstream oss; if (head >> 12 != 0x4) - sprintf(ss, "\n\tHeader is not 0x4 as expected (%x).", head); + oss << "\n\tHeader is not 0x4 as expected (0x" << std::hex << head << ")."; if (foot >> 12 != 0xB) - sprintf(ss, "\n\tFooter is not 0xB as expected (%x).", foot); + oss << "\n\tFooter is not 0xB as expected (0x" << std::hex << foot << ")."; if (((head >> 8) & 0xF) != ((foot >> 8) & 0xF)) - sprintf(ss, "\n\tIncompatible GOH IDs in header (%x) and footer (%x).", ((head >> 8) & 0xF), - ((foot >> 8) & 0xF)); + oss << "\n\tIncompatible GOH IDs in header (0x" << std::hex << ( ( head >> 8 ) & 0xF ) << ") and footer (0x" << std::hex << ( ( foot >> 8 ) & 0xF ) << ")."; if (verbosity) LogWarning("Totem") << "Error in RawDataUnpacker::ProcessOptoRxFrame > " << "Wrong payload structure (in GOH block row " << r << - " and column " << c << ") in OptoRx frame ID " << OptoRxId << ". GOH block omitted." << ss << endl; + " and column " << c << ") in OptoRx frame ID " << optoRxId << ". GOH block omitted." << oss.str() << endl; errorCounter++; continue; @@ -160,13 +155,12 @@ int RawDataUnpacker::ProcessOptoRxFrameSerial(const word *buf, unsigned int fram vector dataPtrs; for (unsigned int fi = 0; fi < 16; fi++) { - TotemFramePosition fp(0, 0, OptoRxId, goh, fi); + TotemFramePosition fp(0, 0, optoRxId, goh, fi); dataPtrs.push_back( fc->InsertEmptyFrame(fp)->getData() ); } - #ifdef DEBUG - printf(">>>> transposing GOH block at prefix: %i, dataPtrs = %p\n", OptoRxId*192 + goh*16, dataPtrs); - #endif + LogDebug( "Totem" ) + << "transposing GOH block at prefix: " << ( optoRxId*192+goh*16 ) << ", dataPtrs = " << dataPtrs; // deserialization for (int i = 0; i < 192; i++) @@ -194,7 +188,7 @@ int RawDataUnpacker::ProcessOptoRxFrameParallel(const word *buf, unsigned int fr { // get OptoRx metadata unsigned long long head = buf[0]; - unsigned int OptoRxId = (head >> 8) & 0xFFF; + unsigned int optoRxId = (head >> 8) & 0xFFF; // recast data as buffer or 16bit words, skip header const uint16_t *payload = (const uint16_t *) (buf + 1); @@ -210,7 +204,7 @@ int RawDataUnpacker::ProcessOptoRxFrameParallel(const word *buf, unsigned int fr // process all VFAT data for (unsigned int offset = 0; offset < nWords;) { - unsigned int wordsProcessed = ProcessVFATDataParallel(payload + offset, nWords, OptoRxId, fc); + unsigned int wordsProcessed = ProcessVFATDataParallel(payload + offset, nWords, optoRxId, fc); offset += wordsProcessed; } @@ -219,7 +213,7 @@ int RawDataUnpacker::ProcessOptoRxFrameParallel(const word *buf, unsigned int fr //---------------------------------------------------------------------------------------------------- -int RawDataUnpacker::ProcessVFATDataParallel(const uint16_t *buf, unsigned int maxWords, unsigned int OptoRxId, SimpleVFATFrameCollection *fc) const +int RawDataUnpacker::ProcessVFATDataParallel(const uint16_t *buf, unsigned int maxWords, unsigned int optoRxId, SimpleVFATFrameCollection *fc) const { // start counting processed words unsigned int wordsProcessed = 1; @@ -242,7 +236,7 @@ int RawDataUnpacker::ProcessVFATDataParallel(const uint16_t *buf, unsigned int m // NOTE: DAQ group uses terms GOH and fiber in the other way unsigned int gohIdx = (buf[0] >> 4) & 0xF; unsigned int fiberIdx = (buf[0] >> 0) & 0xF; - TotemFramePosition fp(0, 0, OptoRxId, gohIdx, fiberIdx); + TotemFramePosition fp(0, 0, optoRxId, gohIdx, fiberIdx); // prepare temporary VFAT frame VFATFrame f; @@ -389,7 +383,7 @@ int RawDataUnpacker::ProcessVFATDataParallel(const uint16_t *buf, unsigned int m presenceFlags |= 0x8; fd[0] = buf[dataOffset + 8]; } - + // get channel data for diamond compact mode if (hFlag == vmDiamondCompact) { @@ -438,50 +432,47 @@ int RawDataUnpacker::ProcessVFATDataParallel(const uint16_t *buf, unsigned int m int RawDataUnpacker::ProcessOptoRxFrameSampic(const word *buf, unsigned int frameSize, TotemFEDInfo &fedInfo, SimpleVFATFrameCollection *fc) const { - - - unsigned int OptoRxId = (buf[0] >> 8) & 0xFFF; -// std::cout<< "Processing sampic frame: OptoRx " << OptoRxId << " GOH " << gohIdx << " Idx " << fiberIdx << " framesize: " << frameSize << std::endl; + unsigned int optoRxId = (buf[0] >> 8) & 0xFFF; + + LogDebug( "RawDataUnpacker::ProcessOptoRxFrameSampic" ) + << "Processing sampic frame: OptoRx " << optoRxId << " framesize: " << frameSize; unsigned int orbitCounterVFATFrameWords = 6; unsigned int sizeofVFATPayload = 12; - + VFATFrame::word *VFATFrameWordPtr = (VFATFrame::word *) buf; VFATFrameWordPtr += orbitCounterVFATFrameWords - 1; - -// std::cout << "Framesize: " << frameSize << " frames: " << frameSize/(sizeofVFATPayload+2) << std::endl; - + + LogDebug( "RawDataUnpacker::ProcessOptoRxFrameSampic" ) + << "Framesize: " << frameSize << "\tframes: " << frameSize/(sizeofVFATPayload+2); + unsigned int nWords = (frameSize-2) * 4 - 2; - + for (unsigned int i=1; i*(sizeofVFATPayload+2)> 4) & 0xF; - TotemFramePosition fp(0, 0, OptoRxId, gohIdx, fiberIdx); -// std::cout << "OptoRx: " << OptoRxId << " Goh: " << gohIdx << " Idx: " << fiberIdx << std::endl; - + TotemFramePosition fp(0, 0, optoRxId, gohIdx, fiberIdx); + + LogDebug( "RawDataUnpacker::ProcessOptoRxFrameSampic" ) + << "OptoRx: " << optoRxId << " Goh: " << gohIdx << " Idx: " << fiberIdx; + // prepare temporary VFAT frame VFATFrame frame(++VFATFrameWordPtr); VFATFrameWordPtr += sizeofVFATPayload; - -// VFATFrame::word *fd = frame.getData(); -// for (unsigned int j = 0; j < sizeofVFATPayload; j++) { -// std::cout << j << "\t" << std::hex<< fd[sizeofVFATPayload - j - 1] << std::endl; -// } - + if ( *(VFATFrameWordPtr) != 0xf00e ) { - std::cout<<"!!!!Wrong trailer!!!! " << *VFATFrameWordPtr << std::endl; + edm::LogError( "RawDataUnpacker::ProcessOptoRxFrameSampic" ) + << "Wrong trailer " << *VFATFrameWordPtr; continue; } - else { - // save frame to output - frame.setPresenceFlags(1); - fc->Insert(fp, frame); - } -// std::cout << "Trailer: " << std::hex << *VFATFrameWordPtr << std::endl; -// std::cout << std::endl; - + // save frame to output + frame.setPresenceFlags(1); + fc->Insert(fp, frame); + + LogDebug( "RawDataUnpacker::ProcessOptoRxFrameSampic" ) + << "Trailer: " << std::hex << *VFATFrameWordPtr; } return 0; From 4e465f94b28e6af11e6acd75568297df20498c37 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 4 Apr 2018 11:19:33 +0200 Subject: [PATCH 322/426] More CMS conventions used --- .../interface/RawDataUnpacker.h | 18 +++---- .../interface/RawToDigiConverter.h | 16 +++--- .../plugins/TotemVFATRawToDigi.cc | 14 ++--- .../CTPPSRawToDigi/src/RawDataUnpacker.cc | 48 ++++++++--------- .../CTPPSRawToDigi/src/RawToDigiConverter.cc | 51 +++++++++---------- .../test/TotemVFATFrameAnalyzer.cc | 4 +- 6 files changed, 75 insertions(+), 76 deletions(-) diff --git a/EventFilter/CTPPSRawToDigi/interface/RawDataUnpacker.h b/EventFilter/CTPPSRawToDigi/interface/RawDataUnpacker.h index 90075343a1cf6..3d94f596e8244 100644 --- a/EventFilter/CTPPSRawToDigi/interface/RawDataUnpacker.h +++ b/EventFilter/CTPPSRawToDigi/interface/RawDataUnpacker.h @@ -1,7 +1,7 @@ /**************************************************************************** * * This is a part of the TOTEM offline software. -* Authors: +* Authors: * Jan Kašpar (jan.kaspar@gmail.com) * Nicola Minafra * @@ -39,26 +39,26 @@ namespace ctpps static constexpr unsigned int VFAT_HEADER_OF_EC = 0xC000; RawDataUnpacker() {} - + RawDataUnpacker(const edm::ParameterSet &conf); /// Unpack data from FED with fedId into `coll' collection. - int Run(int fedId, const FEDRawData &data, std::vector &fedInfoColl, SimpleVFATFrameCollection &coll) const; + int run(int fedId, const FEDRawData &data, std::vector &fedInfoColl, SimpleVFATFrameCollection &coll) const; /// Process one Opto-Rx (or LoneG) frame. - int ProcessOptoRxFrame(const word *buf, unsigned int frameSize, TotemFEDInfo &fedInfo, SimpleVFATFrameCollection *fc) const; + int processOptoRxFrame(const word *buf, unsigned int frameSize, TotemFEDInfo &fedInfo, SimpleVFATFrameCollection *fc) const; /// Process one Opto-Rx frame in serial (old) format - int ProcessOptoRxFrameSerial(const word *buffer, unsigned int frameSize, SimpleVFATFrameCollection *fc) const; + int processOptoRxFrameSerial(const word *buffer, unsigned int frameSize, SimpleVFATFrameCollection *fc) const; /// Process one Opto-Rx frame in parallel (new) format - int ProcessOptoRxFrameParallel(const word *buffer, unsigned int frameSize, TotemFEDInfo &fedInfo, SimpleVFATFrameCollection *fc) const; - + int processOptoRxFrameParallel(const word *buffer, unsigned int frameSize, TotemFEDInfo &fedInfo, SimpleVFATFrameCollection *fc) const; + /// Process one Opto-Rx frame that contains SAMPIC frames - int ProcessOptoRxFrameSampic(const word *buffer, unsigned int frameSize, TotemFEDInfo &fedInfo, SimpleVFATFrameCollection *fc) const; + int processOptoRxFrameSampic(const word *buffer, unsigned int frameSize, TotemFEDInfo &fedInfo, SimpleVFATFrameCollection *fc) const; /// Process data from one VFAT in parallel (new) format - int ProcessVFATDataParallel(const uint16_t *buf, unsigned int maxWords, unsigned int OptoRxId, SimpleVFATFrameCollection *fc) const; + int processVFATDataParallel(const uint16_t *buf, unsigned int maxWords, unsigned int OptoRxId, SimpleVFATFrameCollection *fc) const; private: unsigned char verbosity; diff --git a/EventFilter/CTPPSRawToDigi/interface/RawToDigiConverter.h b/EventFilter/CTPPSRawToDigi/interface/RawToDigiConverter.h index 944edc9062e43..575594a52bcb0 100644 --- a/EventFilter/CTPPSRawToDigi/interface/RawToDigiConverter.h +++ b/EventFilter/CTPPSRawToDigi/interface/RawToDigiConverter.h @@ -1,7 +1,7 @@ /**************************************************************************** * * This is a part of the TOTEM offline software. -* Authors: +* Authors: * Jan Kašpar (jan.kaspar@gmail.com) * ****************************************************************************/ @@ -29,19 +29,19 @@ class RawToDigiConverter RawToDigiConverter(const edm::ParameterSet &conf); /// Creates RP digi. - void Run(const VFATFrameCollection &coll, const TotemDAQMapping &mapping, const TotemAnalysisMask &mask, + void run(const VFATFrameCollection &coll, const TotemDAQMapping &mapping, const TotemAnalysisMask &mask, edm::DetSetVector &digi, edm::DetSetVector &status); /// Creates Diamond digi. - void Run(const VFATFrameCollection &coll, const TotemDAQMapping &mapping, const TotemAnalysisMask &mask, + void run(const VFATFrameCollection &coll, const TotemDAQMapping &mapping, const TotemAnalysisMask &mask, edm::DetSetVector &digi, edm::DetSetVector &status); - + /// Creates Totem Timing digi. - void Run(const VFATFrameCollection &coll, const TotemDAQMapping &mapping, const TotemAnalysisMask &mask, + void run(const VFATFrameCollection &coll, const TotemDAQMapping &mapping, const TotemAnalysisMask &mask, edm::DetSetVector &digi, edm::DetSetVector &status); /// Print error summaries. - void PrintSummaries() const; + void printSummaries() const; private: struct Record @@ -52,7 +52,7 @@ class RawToDigiConverter }; unsigned char verbosity; - + unsigned int printErrorSummary; unsigned int printUnknownFrameSummary; @@ -78,7 +78,7 @@ class RawToDigiConverter std::map unknownSummary; /// Common processing for all VFAT based sub-systems. - void RunCommon(const VFATFrameCollection &input, const TotemDAQMapping &mapping, + void runCommon(const VFATFrameCollection &input, const TotemDAQMapping &mapping, std::map &records); }; diff --git a/EventFilter/CTPPSRawToDigi/plugins/TotemVFATRawToDigi.cc b/EventFilter/CTPPSRawToDigi/plugins/TotemVFATRawToDigi.cc index 1a555be0f5b69..37d0510dac9f4 100644 --- a/EventFilter/CTPPSRawToDigi/plugins/TotemVFATRawToDigi.cc +++ b/EventFilter/CTPPSRawToDigi/plugins/TotemVFATRawToDigi.cc @@ -1,7 +1,7 @@ /**************************************************************************** * * This is a part of TOTEM offline software. -* Authors: +* Authors: * Jan Kašpar (jan.kaspar@gmail.com) * ****************************************************************************/ @@ -98,7 +98,7 @@ TotemVFATRawToDigi::TotemVFATRawToDigi(const edm::ParameterSet &conf): if (subSystem == ssTimingDiamond) produces< DetSetVector >(subSystemName); - + if (subSystem == ssTotemTiming) produces< DetSetVector >(subSystemName); @@ -116,7 +116,7 @@ TotemVFATRawToDigi::TotemVFATRawToDigi(const edm::ParameterSet &conf): for (int id = FEDNumbering::MINCTPPSDiamondFEDID; id <= FEDNumbering::MAXCTPPSDiamondFEDID; ++id) fedIds.push_back(id); } - + else if (subSystem == ssTotemTiming) { for (int id = FEDNumbering::MINTotemRPTimingVerticalFEDID; id <= FEDNumbering::MAXTotemRPTimingVerticalFEDID; ++id) fedIds.push_back(id); @@ -142,7 +142,7 @@ void TotemVFATRawToDigi::produce(edm::Event& event, const edm::EventSetup &es) else if (subSystem == ssTimingDiamond) run< DetSetVector >(event, es); - + else if (subSystem == ssTotemTiming) run< DetSetVector >(event, es); } @@ -175,11 +175,11 @@ void TotemVFATRawToDigi::run(edm::Event& event, const edm::EventSetup &es) { const FEDRawData &data = rawData->FEDData(fedId); if (data.size() > 0) - rawDataUnpacker.Run(fedId, data, fedInfo, vfatCollection); + rawDataUnpacker.run(fedId, data, fedInfo, vfatCollection); } // raw-to-digi conversion - rawToDigiConverter.Run(vfatCollection, *mapping, *analysisMask, digi, conversionStatus); + rawToDigiConverter.run(vfatCollection, *mapping, *analysisMask, digi, conversionStatus); // commit products to event event.put(make_unique>(fedInfo), subSystemName); @@ -191,7 +191,7 @@ void TotemVFATRawToDigi::run(edm::Event& event, const edm::EventSetup &es) void TotemVFATRawToDigi::endStream() { - rawToDigiConverter.PrintSummaries(); + rawToDigiConverter.printSummaries(); } DEFINE_FWK_MODULE(TotemVFATRawToDigi); diff --git a/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc b/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc index 36c8895ed144e..724e71921d69d 100644 --- a/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc +++ b/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc @@ -25,25 +25,25 @@ RawDataUnpacker::RawDataUnpacker(const edm::ParameterSet& iConfig) : //---------------------------------------------------------------------------------------------------- -int RawDataUnpacker::Run(int fedId, const FEDRawData &data, vector &fedInfoColl, SimpleVFATFrameCollection &coll) const +int RawDataUnpacker::run(int fedId, const FEDRawData &data, vector &fedInfoColl, SimpleVFATFrameCollection &coll) const { unsigned int size_in_words = data.size() / 8; // bytes -> words if (size_in_words < 2) { if (verbosity) - LogWarning("Totem") << "Error in RawDataUnpacker::Run > " << + LogWarning("Totem") << "Error in RawDataUnpacker::run > " << "Data in FED " << fedId << " too short (size = " << size_in_words << " words)."; return 1; } fedInfoColl.push_back(TotemFEDInfo(fedId)); - return ProcessOptoRxFrame((const word *) data.data(), size_in_words, fedInfoColl.back(), &coll); + return processOptoRxFrame((const word *) data.data(), size_in_words, fedInfoColl.back(), &coll); } //---------------------------------------------------------------------------------------------------- -int RawDataUnpacker::ProcessOptoRxFrame(const word *buf, unsigned int frameSize, TotemFEDInfo &fedInfo, SimpleVFATFrameCollection *fc) const +int RawDataUnpacker::processOptoRxFrame(const word *buf, unsigned int frameSize, TotemFEDInfo &fedInfo, SimpleVFATFrameCollection *fc) const { // get OptoRx metadata unsigned long long head = buf[0]; @@ -68,41 +68,41 @@ int RawDataUnpacker::ProcessOptoRxFrame(const word *buf, unsigned int frameSize, if (boe != 5 || h0 != 0 || eoe != 10 || f0 != 0 || fSize != frameSize) { if (verbosity) - LogWarning("Totem") << "Error in RawDataUnpacker::ProcessOptoRxFrame > " << "Wrong structure of OptoRx header/footer: " + LogWarning("Totem") << "Error in RawDataUnpacker::processOptoRxFrame > " << "Wrong structure of OptoRx header/footer: " << "BOE=" << boe << ", H0=" << h0 << ", EOE=" << eoe << ", F0=" << f0 << ", size (OptoRx)=" << fSize << ", size (DATE)=" << frameSize << ". OptoRxID=" << optoRxId << ". Skipping frame." << endl; return 0; } - LogDebug( "Totem" ) << "RawDataUnpacker::ProcessOptoRxFrame: " + LogDebug( "Totem" ) << "RawDataUnpacker::processOptoRxFrame: " << "OptoRxId = " << optoRxId << ", BX = " << bx << ", LV1 = " << lv1 << ", frameSize = " << frameSize; if (optoRxId >= FEDNumbering::MINTotemRPTimingVerticalFEDID && optoRxId <= FEDNumbering::MAXTotemRPTimingVerticalFEDID) { - ProcessOptoRxFrameSampic(buf, frameSize, fedInfo, fc); + processOptoRxFrameSampic(buf, frameSize, fedInfo, fc); return 0; } // parallel or serial transmission? switch (fov) { case 1: - return ProcessOptoRxFrameSerial(buf, frameSize, fc); + return processOptoRxFrameSerial(buf, frameSize, fc); case 2: case 3: - return ProcessOptoRxFrameParallel(buf, frameSize, fedInfo, fc); + return processOptoRxFrameParallel(buf, frameSize, fedInfo, fc); default: break; } if (verbosity) - LogWarning("Totem") << "Error in RawDataUnpacker::ProcessOptoRxFrame > " << "Unknown FOV = " << fov << endl; + LogWarning("Totem") << "Error in RawDataUnpacker::processOptoRxFrame > " << "Unknown FOV = " << fov << endl; return 0; } //---------------------------------------------------------------------------------------------------- -int RawDataUnpacker::ProcessOptoRxFrameSerial(const word *buf, unsigned int frameSize, SimpleVFATFrameCollection *fc) const +int RawDataUnpacker::processOptoRxFrameSerial(const word *buf, unsigned int frameSize, SimpleVFATFrameCollection *fc) const { // get OptoRx metadata unsigned int optoRxId = (buf[0] >> 8) & 0xFFF; @@ -143,7 +143,7 @@ int RawDataUnpacker::ProcessOptoRxFrameSerial(const word *buf, unsigned int fram oss << "\n\tIncompatible GOH IDs in header (0x" << std::hex << ( ( head >> 8 ) & 0xF ) << ") and footer (0x" << std::hex << ( ( foot >> 8 ) & 0xF ) << ")."; if (verbosity) - LogWarning("Totem") << "Error in RawDataUnpacker::ProcessOptoRxFrame > " << "Wrong payload structure (in GOH block row " << r << + LogWarning("Totem") << "Error in RawDataUnpacker::processOptoRxFrame > " << "Wrong payload structure (in GOH block row " << r << " and column " << c << ") in OptoRx frame ID " << optoRxId << ". GOH block omitted." << oss.str() << endl; errorCounter++; @@ -184,7 +184,7 @@ int RawDataUnpacker::ProcessOptoRxFrameSerial(const word *buf, unsigned int fram //---------------------------------------------------------------------------------------------------- -int RawDataUnpacker::ProcessOptoRxFrameParallel(const word *buf, unsigned int frameSize, TotemFEDInfo &fedInfo, SimpleVFATFrameCollection *fc) const +int RawDataUnpacker::processOptoRxFrameParallel(const word *buf, unsigned int frameSize, TotemFEDInfo &fedInfo, SimpleVFATFrameCollection *fc) const { // get OptoRx metadata unsigned long long head = buf[0]; @@ -204,7 +204,7 @@ int RawDataUnpacker::ProcessOptoRxFrameParallel(const word *buf, unsigned int fr // process all VFAT data for (unsigned int offset = 0; offset < nWords;) { - unsigned int wordsProcessed = ProcessVFATDataParallel(payload + offset, nWords, optoRxId, fc); + unsigned int wordsProcessed = processVFATDataParallel(payload + offset, nWords, optoRxId, fc); offset += wordsProcessed; } @@ -213,7 +213,7 @@ int RawDataUnpacker::ProcessOptoRxFrameParallel(const word *buf, unsigned int fr //---------------------------------------------------------------------------------------------------- -int RawDataUnpacker::ProcessVFATDataParallel(const uint16_t *buf, unsigned int maxWords, unsigned int optoRxId, SimpleVFATFrameCollection *fc) const +int RawDataUnpacker::processVFATDataParallel(const uint16_t *buf, unsigned int maxWords, unsigned int optoRxId, SimpleVFATFrameCollection *fc) const { // start counting processed words unsigned int wordsProcessed = 1; @@ -227,7 +227,7 @@ int RawDataUnpacker::ProcessVFATDataParallel(const uint16_t *buf, unsigned int m if (hFlag != vmCluster && hFlag != vmRaw && hFlag != vmDiamondCompact) { if (verbosity) - LogWarning("Totem") << "Error in RawDataUnpacker::ProcessVFATDataParallel > " + LogWarning("Totem") << "Error in RawDataUnpacker::processVFATDataParallel > " << "Unknown header flag " << hFlag << ". Skipping this word." << endl; return wordsProcessed; } @@ -322,7 +322,7 @@ int RawDataUnpacker::ProcessVFATDataParallel(const uint16_t *buf, unsigned int m if (skipFrame) { if (verbosity) - LogWarning("Totem") << "Error in RawDataUnpacker::ProcessVFATDataParallel > Frame at " << fp + LogWarning("Totem") << "Error in RawDataUnpacker::processVFATDataParallel > Frame at " << fp << " has the following problems and will be skipped.\n" << endl << ess.rdbuf(); return wordsProcessed; @@ -357,7 +357,7 @@ int RawDataUnpacker::ProcessVFATDataParallel(const uint16_t *buf, unsigned int m if (chMax < 0 || chMax > 127 || chMin < 0 || chMin > 127 || chMin > chMax) { if (verbosity) - LogWarning("Totem") << "Error in RawDataUnpacker::ProcessVFATDataParallel > " + LogWarning("Totem") << "Error in RawDataUnpacker::processVFATDataParallel > " << "Invalid cluster (pos=" << clPos << ", size=" << clSize << ", min=" << chMin << ", max=" << chMax << ") at " << fp <<". Skipping this cluster." << endl; @@ -430,11 +430,11 @@ int RawDataUnpacker::ProcessVFATDataParallel(const uint16_t *buf, unsigned int m //---------------------------------------------------------------------------------------------------- -int RawDataUnpacker::ProcessOptoRxFrameSampic(const word *buf, unsigned int frameSize, TotemFEDInfo &fedInfo, SimpleVFATFrameCollection *fc) const +int RawDataUnpacker::processOptoRxFrameSampic(const word *buf, unsigned int frameSize, TotemFEDInfo &fedInfo, SimpleVFATFrameCollection *fc) const { unsigned int optoRxId = (buf[0] >> 8) & 0xFFF; - LogDebug( "RawDataUnpacker::ProcessOptoRxFrameSampic" ) + LogDebug( "RawDataUnpacker::processOptoRxFrameSampic" ) << "Processing sampic frame: OptoRx " << optoRxId << " framesize: " << frameSize; unsigned int orbitCounterVFATFrameWords = 6; @@ -443,7 +443,7 @@ int RawDataUnpacker::ProcessOptoRxFrameSampic(const word *buf, unsigned int fram VFATFrame::word *VFATFrameWordPtr = (VFATFrame::word *) buf; VFATFrameWordPtr += orbitCounterVFATFrameWords - 1; - LogDebug( "RawDataUnpacker::ProcessOptoRxFrameSampic" ) + LogDebug( "RawDataUnpacker::processOptoRxFrameSampic" ) << "Framesize: " << frameSize << "\tframes: " << frameSize/(sizeofVFATPayload+2); unsigned int nWords = (frameSize-2) * 4 - 2; @@ -455,7 +455,7 @@ int RawDataUnpacker::ProcessOptoRxFrameSampic(const word *buf, unsigned int fram unsigned int gohIdx = (*VFATFrameWordPtr >> 4) & 0xF; TotemFramePosition fp(0, 0, optoRxId, gohIdx, fiberIdx); - LogDebug( "RawDataUnpacker::ProcessOptoRxFrameSampic" ) + LogDebug( "RawDataUnpacker::processOptoRxFrameSampic" ) << "OptoRx: " << optoRxId << " Goh: " << gohIdx << " Idx: " << fiberIdx; // prepare temporary VFAT frame @@ -463,7 +463,7 @@ int RawDataUnpacker::ProcessOptoRxFrameSampic(const word *buf, unsigned int fram VFATFrameWordPtr += sizeofVFATPayload; if ( *(VFATFrameWordPtr) != 0xf00e ) { - edm::LogError( "RawDataUnpacker::ProcessOptoRxFrameSampic" ) + edm::LogError( "RawDataUnpacker::processOptoRxFrameSampic" ) << "Wrong trailer " << *VFATFrameWordPtr; continue; } @@ -471,7 +471,7 @@ int RawDataUnpacker::ProcessOptoRxFrameSampic(const word *buf, unsigned int fram frame.setPresenceFlags(1); fc->Insert(fp, frame); - LogDebug( "RawDataUnpacker::ProcessOptoRxFrameSampic" ) + LogDebug( "RawDataUnpacker::processOptoRxFrameSampic" ) << "Trailer: " << std::hex << *VFATFrameWordPtr; } diff --git a/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc b/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc index 6326ea2dafc2a..e3a6f5f9904e9 100644 --- a/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc +++ b/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc @@ -11,7 +11,7 @@ #include "EventFilter/CTPPSRawToDigi/interface/RawToDigiConverter.h" #include "EventFilter/CTPPSRawToDigi/interface/CounterChecker.h" #include "EventFilter/CTPPSRawToDigi/interface/DiamondVFATFrame.h" -#include "EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h" +#include "EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h" #include "DataFormats/CTPPSDetId/interface/TotemRPDetId.h" #include "DataFormats/CTPPSDetId/interface/CTPPSDiamondDetId.h" @@ -45,7 +45,7 @@ RawToDigiConverter::RawToDigiConverter(const edm::ParameterSet &conf) : //---------------------------------------------------------------------------------------------------- -void RawToDigiConverter::RunCommon(const VFATFrameCollection &input, const TotemDAQMapping &mapping, +void RawToDigiConverter::runCommon(const VFATFrameCollection &input, const TotemDAQMapping &mapping, map &records) { // EC and BC checks (wrt. the most frequent value), BC checks per subsystem @@ -175,9 +175,9 @@ void RawToDigiConverter::RunCommon(const VFATFrameCollection &input, const Totem if (verbosity > 0 && !ees.rdbuf()->str().empty()) { if (verbosity > 1) - LogWarning("Totem") << "Error in RawToDigiConverter::RunCommon > " << "event contains the following problems:" << endl << ees.rdbuf() << endl; + LogWarning("Totem") << "Error in RawToDigiConverter::runCommon > " << "event contains the following problems:" << endl << ees.rdbuf() << endl; else - LogWarning("Totem") << "Error in RawToDigiConverter::RunCommon > " << "event contains problems." << endl; + LogWarning("Totem") << "Error in RawToDigiConverter::runCommon > " << "event contains problems." << endl; } // increase error counters @@ -196,7 +196,7 @@ void RawToDigiConverter::RunCommon(const VFATFrameCollection &input, const Totem //---------------------------------------------------------------------------------------------------- -void RawToDigiConverter::Run(const VFATFrameCollection &input, +void RawToDigiConverter::run(const VFATFrameCollection &input, const TotemDAQMapping &mapping, const TotemAnalysisMask &analysisMask, DetSetVector &rpData, DetSetVector &finalStatus) { @@ -204,7 +204,7 @@ void RawToDigiConverter::Run(const VFATFrameCollection &input, map records; // common processing - frame validation - RunCommon(input, mapping, records); + runCommon(input, mapping, records); // second loop over data for (auto &p : records) @@ -260,14 +260,14 @@ void RawToDigiConverter::Run(const VFATFrameCollection &input, //---------------------------------------------------------------------------------------------------- -void RawToDigiConverter::Run(const VFATFrameCollection &coll, const TotemDAQMapping &mapping, const TotemAnalysisMask &mask, +void RawToDigiConverter::run(const VFATFrameCollection &coll, const TotemDAQMapping &mapping, const TotemAnalysisMask &mask, edm::DetSetVector &digi, edm::DetSetVector &status) { // structure merging vfat frame data with the mapping map records; // common processing - frame validation - RunCommon(coll, mapping, records); + runCommon(coll, mapping, records); // second loop over data for (auto &p : records) @@ -298,21 +298,21 @@ void RawToDigiConverter::Run(const VFATFrameCollection &coll, const TotemDAQMapp //---------------------------------------------------------------------------------------------------- -void RawToDigiConverter::Run(const VFATFrameCollection &coll, const TotemDAQMapping &mapping, const TotemAnalysisMask &mask, +void RawToDigiConverter::run(const VFATFrameCollection &coll, const TotemDAQMapping &mapping, const TotemAnalysisMask &mask, edm::DetSetVector &digi, edm::DetSetVector &status) { // structure merging vfat frame data with the mapping map records; - // common processing - frame validation - RunCommon(coll, mapping, records); - + // common processing - frame validation + runCommon(coll, mapping, records); + // second loop over data for (auto &p : records) { Record &record = p.second; if (!record.status.isOK()) continue; - + const TotemFramePosition* framepos = &p.first; if(((framepos->getIdxInFiber()%2)==0)&&(framepos->getIdxInFiber()<14)) @@ -324,16 +324,15 @@ void RawToDigiConverter::Run(const VFATFrameCollection &coll, const TotemDAQMapp auto channelwaveformPtr = records.find(frameposdata); auto eventInfoPtr = records.find(frameposEvtInfo); - - if ( channelwaveformPtr != records.end() && eventInfoPtr != records.end() ) + + if ( channelwaveformPtr != records.end() && eventInfoPtr != records.end() ) { Record &channelwaveform = records[frameposdata]; - Record &eventInfo = records[frameposEvtInfo]; - + Record &eventInfo = records[frameposEvtInfo]; // Extract all the waveform information from the raw data TotemSampicFrame totemSampicFrame((uint8_t*) record.frame->getData(), (uint8_t*) channelwaveform.frame->getData(), (uint8_t*) eventInfo.frame->getData()); - + if (totemSampicFrame.valid()) { // create the digi @@ -341,17 +340,17 @@ void RawToDigiConverter::Run(const VFATFrameCollection &coll, const TotemDAQMapp TotemTimingDigi digiTmp( totemSampicFrame.getHardwareId(), totemSampicFrame.getFPGATimestamp(), totemSampicFrame.getTimestampA(), totemSampicFrame.getTimestampB(), totemSampicFrame.getCellInfo(), totemSampicFrame.getSamples(), eventInfoTmp); // calculate ids TotemTimingDetId detId(record.info->symbolicID.symbolicID); - + const TotemDAQMapping::TotemTimingPlaneChannelPair SWpair = mapping.getTimingChannel( totemSampicFrame.getHardwareId() ); // for FW Version > 0 plane and channel are encoded in the dataframe if ( totemSampicFrame.getFWVersion() == 0 ) // Mapping not present in HW, read from SW { - if ( SWpair.plane == -1 || SWpair.channel == -1 ) + if ( SWpair.plane == -1 || SWpair.channel == -1 ) { if (verbosity>0) LogWarning("Totem") << "Error in RawToDigiConverter::TotemTiming > " << "HwId not recognized! hwId: " << std::hex << (unsigned int) totemSampicFrame.getHardwareId() << endl; } - else + else { detId.setPlane( SWpair.plane % 4); detId.setChannel( SWpair.channel ); @@ -362,13 +361,13 @@ void RawToDigiConverter::Run(const VFATFrameCollection &coll, const TotemDAQMapp { const int HWplane = totemSampicFrame.getDetPlane() % 16; const int HWchannel = totemSampicFrame.getDetChannel() % 16; - - if ( SWpair.plane == -1 || SWpair.channel == -1 ) + + if ( SWpair.plane == -1 || SWpair.channel == -1 ) { if ( verbosity>0 ) LogWarning("Totem") << "Warning in RawToDigiConverter::TotemTiming > " << "HwId not recognized! hwId: " << std::hex << (unsigned int) totemSampicFrame.getHardwareId() << "\tUsing plane and ch from HW without check!" << endl; } - else + else { if ( verbosity>0 && ( SWpair.plane != HWplane || SWpair.channel != HWchannel ) ) LogWarning("Totem") << "Warning in RawToDigiConverter::TotemTiming > " << "Hw mapping different from SW mapping. hwId: " << std::hex << (unsigned int) totemSampicFrame.getHardwareId() << "HW: " << std::dec << HWplane << ":" << HWchannel << "\tSW " << SWpair.plane << ":" << SWpair.channel << "\tUsing plane and ch from HW!" << endl; @@ -377,7 +376,7 @@ void RawToDigiConverter::Run(const VFATFrameCollection &coll, const TotemDAQMapp detId.setChannel( HWchannel ); detId.setRP( HWplane / 4 ); // Top:0 or Bottom:1 } - + DetSet &digiDetSet = digi.find_or_insert(detId); digiDetSet.push_back(digiTmp); } @@ -389,7 +388,7 @@ void RawToDigiConverter::Run(const VFATFrameCollection &coll, const TotemDAQMapp //---------------------------------------------------------------------------------------------------- -void RawToDigiConverter::PrintSummaries() const +void RawToDigiConverter::printSummaries() const { // print error summary if (printErrorSummary) diff --git a/EventFilter/CTPPSRawToDigi/test/TotemVFATFrameAnalyzer.cc b/EventFilter/CTPPSRawToDigi/test/TotemVFATFrameAnalyzer.cc index 1831eccd4f723..a3754f40e58c1 100644 --- a/EventFilter/CTPPSRawToDigi/test/TotemVFATFrameAnalyzer.cc +++ b/EventFilter/CTPPSRawToDigi/test/TotemVFATFrameAnalyzer.cc @@ -1,7 +1,7 @@ /**************************************************************************** * * This is a part of TOTEM offline software. -* Authors: +* Authors: * Jan Kašpar (jan.kaspar@gmail.com) * ****************************************************************************/ @@ -80,7 +80,7 @@ void TotemVFATFrameAnalyzer::analyze(edm::StreamID, const edm::Event& event, con { const FEDRawData &data = rawData->FEDData(fedId); if (data.size() > 0) - rawDataUnpacker.Run(fedId, data, fedInfo, vfatCollection); + rawDataUnpacker.run(fedId, data, fedInfo, vfatCollection); } // print VFAT frames From 62a8e906e6cb5d16cf0eb7a776846ac7abd1b542 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 4 Apr 2018 11:22:00 +0200 Subject: [PATCH 323/426] Retrieving a const-qualified frame word --- EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc b/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc index 724e71921d69d..a6c55f8139bb8 100644 --- a/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc +++ b/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc @@ -440,7 +440,7 @@ int RawDataUnpacker::processOptoRxFrameSampic(const word *buf, unsigned int fram unsigned int orbitCounterVFATFrameWords = 6; unsigned int sizeofVFATPayload = 12; - VFATFrame::word *VFATFrameWordPtr = (VFATFrame::word *) buf; + const VFATFrame::word *VFATFrameWordPtr = (const VFATFrame::word *) buf; VFATFrameWordPtr += orbitCounterVFATFrameWords - 1; LogDebug( "RawDataUnpacker::processOptoRxFrameSampic" ) From 98db768434b3cfb7a9847400c0a925672ae62671 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 4 Apr 2018 11:23:08 +0200 Subject: [PATCH 324/426] Retrieving a const-qualified frame --- EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc b/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc index e3a6f5f9904e9..a7cd268612ed9 100644 --- a/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc +++ b/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc @@ -331,7 +331,7 @@ void RawToDigiConverter::run(const VFATFrameCollection &coll, const TotemDAQMapp Record &eventInfo = records[frameposEvtInfo]; // Extract all the waveform information from the raw data - TotemSampicFrame totemSampicFrame((uint8_t*) record.frame->getData(), (uint8_t*) channelwaveform.frame->getData(), (uint8_t*) eventInfo.frame->getData()); + TotemSampicFrame totemSampicFrame((const uint8_t*) record.frame->getData(), (uint8_t*) channelwaveform.frame->getData(), (uint8_t*) eventInfo.frame->getData()); if (totemSampicFrame.valid()) { From f7568f50e67b700ee6197432cb1e65337660a8e9 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 4 Apr 2018 11:29:59 +0200 Subject: [PATCH 325/426] Subscribing the digis to the CTPPS event content --- RecoCTPPS/Configuration/python/RecoCTPPS_EventContent_cff.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/RecoCTPPS/Configuration/python/RecoCTPPS_EventContent_cff.py b/RecoCTPPS/Configuration/python/RecoCTPPS_EventContent_cff.py index cb559224f862c..43129a3bb8b82 100644 --- a/RecoCTPPS/Configuration/python/RecoCTPPS_EventContent_cff.py +++ b/RecoCTPPS/Configuration/python/RecoCTPPS_EventContent_cff.py @@ -21,7 +21,10 @@ 'keep CTPPSDiamondRecHitedmDetSetVector_ctppsDiamondRecHits_*_*', 'keep CTPPSDiamondLocalTrackedmDetSetVector_ctppsDiamondLocalTracks_*_*', - #tracking pixels + # TOTEM timing + 'keep TotemTimingDigiedmDetSetVector_totemTimingRawToDigi_*_*', + + # tracking pixels 'keep CTPPSPixelDigiedmDetSetVector_ctppsPixelDigis_*_*', 'keep CTPPSPixelDataErroredmDetSetVector_ctppsPixelDigis_*_*', 'keep CTPPSPixelClusteredmDetSetVector_ctppsPixelClusters_*_*', From e0f30efeb38067c108c39c02705a67c93d83b667 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 4 Apr 2018 11:37:28 +0200 Subject: [PATCH 326/426] Forgot two const-qualifiers --- EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc b/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc index a7cd268612ed9..2964e12194527 100644 --- a/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc +++ b/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc @@ -331,7 +331,7 @@ void RawToDigiConverter::run(const VFATFrameCollection &coll, const TotemDAQMapp Record &eventInfo = records[frameposEvtInfo]; // Extract all the waveform information from the raw data - TotemSampicFrame totemSampicFrame((const uint8_t*) record.frame->getData(), (uint8_t*) channelwaveform.frame->getData(), (uint8_t*) eventInfo.frame->getData()); + TotemSampicFrame totemSampicFrame((const uint8_t*) record.frame->getData(), (const uint8_t*) channelwaveform.frame->getData(), (const uint8_t*) eventInfo.frame->getData()); if (totemSampicFrame.valid()) { From 1fccb1e6593732061e71f21b4128a878571029a1 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 4 Apr 2018 11:43:41 +0200 Subject: [PATCH 327/426] Fallback test --- .../test/test_standard_sequence_cfg.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/EventFilter/CTPPSRawToDigi/test/test_standard_sequence_cfg.py b/EventFilter/CTPPSRawToDigi/test/test_standard_sequence_cfg.py index bffe53cea52a3..f5f13db4eddde 100644 --- a/EventFilter/CTPPSRawToDigi/test/test_standard_sequence_cfg.py +++ b/EventFilter/CTPPSRawToDigi/test/test_standard_sequence_cfg.py @@ -12,19 +12,15 @@ ) # raw data source -process.source = cms.Source("NewEventStreamFileReader", +process.source = cms.Source("PoolSource", fileNames = cms.untracked.vstring( # '/store/express/Run2016H/ExpressPhysics/FEVT/Express-v2/000/283/877/00000/4EE44B0E-2499-E611-A155-02163E011938.root' - 'file:/eos/cms/store/group/dpg_ctpps/comm_ctpps/TotemTiming/Minidaq/519/run312519_ls0002_streamA_StorageManager.dat' + '/store/data/Run2016H/ZeroBias/RAW/v1/000/283/820/00000/462D2A5B-B19A-E611-B100-02163E01382E.root' ) ) process.maxEvents = cms.untracked.PSet( - input = cms.untracked.int32(10) -) - -process.verbosity = cms.untracked.PSet( - input = cms.untracked.int32(10) + input = cms.untracked.int32(100) ) # raw-to-digi conversion @@ -40,9 +36,8 @@ fileName = cms.untracked.string("file:./reco_digi.root"), outputCommands = cms.untracked.vstring( 'drop *', - 'keep *_*totemTimingRawToDigi_*_*', + 'keep *_*RawToDigi_*_*', ) ) process.outpath = cms.EndPath(process.output) - From 4e577e6757e43bd711930743013472124fb8fc9a Mon Sep 17 00:00:00 2001 From: Suchandra Date: Wed, 4 Apr 2018 11:57:54 +0200 Subject: [PATCH 328/426] Updating Phase2Digitizer code with HepRandomEngine in per-event mode --- .../plugins/PSPDigitizerAlgorithm.cc | 5 +-- .../plugins/PSPDigitizerAlgorithm.h | 2 +- .../plugins/PSSDigitizerAlgorithm.cc | 5 +-- .../plugins/PSSDigitizerAlgorithm.h | 2 +- .../plugins/Phase2TrackerDigitizer.cc | 38 +++++++++---------- .../plugins/Phase2TrackerDigitizer.h | 1 - .../Phase2TrackerDigitizerAlgorithm.cc | 31 ++++++++++----- .../plugins/Phase2TrackerDigitizerAlgorithm.h | 14 +++---- .../plugins/PixelDigitizerAlgorithm.cc | 5 +-- .../plugins/PixelDigitizerAlgorithm.h | 2 +- .../plugins/SSDigitizerAlgorithm.cc | 5 +-- .../plugins/SSDigitizerAlgorithm.h | 2 +- 12 files changed, 59 insertions(+), 53 deletions(-) diff --git a/SimTracker/SiPhase2Digitizer/plugins/PSPDigitizerAlgorithm.cc b/SimTracker/SiPhase2Digitizer/plugins/PSPDigitizerAlgorithm.cc index 0b05bba3228a4..4c7f6734b926a 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/PSPDigitizerAlgorithm.cc +++ b/SimTracker/SiPhase2Digitizer/plugins/PSPDigitizerAlgorithm.cc @@ -27,10 +27,9 @@ using namespace edm; void PSPDigitizerAlgorithm::init(const edm::EventSetup& es) { es.get().get(geom_); } -PSPDigitizerAlgorithm::PSPDigitizerAlgorithm(const edm::ParameterSet& conf, CLHEP::HepRandomEngine& eng): +PSPDigitizerAlgorithm::PSPDigitizerAlgorithm(const edm::ParameterSet& conf): Phase2TrackerDigitizerAlgorithm(conf.getParameter("AlgorithmCommon"), - conf.getParameter("PSPDigitizerAlgorithm"), - eng) + conf.getParameter("PSPDigitizerAlgorithm")) { pixelFlag = false; LogInfo("PSPDigitizerAlgorithm") << "Algorithm constructed " diff --git a/SimTracker/SiPhase2Digitizer/plugins/PSPDigitizerAlgorithm.h b/SimTracker/SiPhase2Digitizer/plugins/PSPDigitizerAlgorithm.h index 8424f8c2e2208..fad05e7e27b63 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/PSPDigitizerAlgorithm.h +++ b/SimTracker/SiPhase2Digitizer/plugins/PSPDigitizerAlgorithm.h @@ -9,7 +9,7 @@ class TrackerTopology; class PSPDigitizerAlgorithm: public Phase2TrackerDigitizerAlgorithm { public: - PSPDigitizerAlgorithm(const edm::ParameterSet& conf, CLHEP::HepRandomEngine&); + PSPDigitizerAlgorithm(const edm::ParameterSet& conf); ~PSPDigitizerAlgorithm() override; // initialization that cannot be done in the constructor diff --git a/SimTracker/SiPhase2Digitizer/plugins/PSSDigitizerAlgorithm.cc b/SimTracker/SiPhase2Digitizer/plugins/PSSDigitizerAlgorithm.cc index c27e7d9af5999..583da03882f1a 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/PSSDigitizerAlgorithm.cc +++ b/SimTracker/SiPhase2Digitizer/plugins/PSSDigitizerAlgorithm.cc @@ -28,10 +28,9 @@ using namespace edm; void PSSDigitizerAlgorithm::init(const edm::EventSetup& es) { es.get().get(geom_); } -PSSDigitizerAlgorithm::PSSDigitizerAlgorithm(const edm::ParameterSet& conf, CLHEP::HepRandomEngine& eng): +PSSDigitizerAlgorithm::PSSDigitizerAlgorithm(const edm::ParameterSet& conf): Phase2TrackerDigitizerAlgorithm(conf.getParameter("AlgorithmCommon"), - conf.getParameter("PSSDigitizerAlgorithm"), - eng) + conf.getParameter("PSSDigitizerAlgorithm")) { pixelFlag = false; LogInfo("PSSDigitizerAlgorithm") << "Algorithm constructed " diff --git a/SimTracker/SiPhase2Digitizer/plugins/PSSDigitizerAlgorithm.h b/SimTracker/SiPhase2Digitizer/plugins/PSSDigitizerAlgorithm.h index a70f9e573b81e..b5f6fc77e1114 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/PSSDigitizerAlgorithm.h +++ b/SimTracker/SiPhase2Digitizer/plugins/PSSDigitizerAlgorithm.h @@ -8,7 +8,7 @@ class TrackerTopology; class PSSDigitizerAlgorithm :public Phase2TrackerDigitizerAlgorithm { public: - PSSDigitizerAlgorithm(const edm::ParameterSet& conf, CLHEP::HepRandomEngine&); + PSSDigitizerAlgorithm(const edm::ParameterSet& conf); ~PSSDigitizerAlgorithm() override; // initialization that cannot be done in the constructor diff --git a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.cc b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.cc index 40a0b768a547d..b79e4d7ed6d44 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.cc +++ b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.cc @@ -93,17 +93,14 @@ namespace cms mixMod.produces >("Tracker").setBranchAlias(alias2); mixMod.produces >("Tracker").setBranchAlias(alias2); + // creating algorithm objects and pushing them into the map + algomap_[AlgorithmType::InnerPixel] = std::unique_ptr(new PixelDigitizerAlgorithm(iconfig_)); + algomap_[AlgorithmType::PixelinPS] = std::unique_ptr(new PSPDigitizerAlgorithm(iconfig_)); + algomap_[AlgorithmType::StripinPS] = std::unique_ptr(new PSSDigitizerAlgorithm(iconfig_)); + algomap_[AlgorithmType::TwoStrip] = std::unique_ptr(new SSDigitizerAlgorithm(iconfig_)); } void Phase2TrackerDigitizer::beginLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const& iSetup) { - edm::Service rng; - if (!rng.isAvailable()) { - throw cms::Exception("Configuration") - << "Phase2TrackerDigitizer requires the RandomNumberGeneratorService\n" - "which is not present in the configuration file. You must add the service\n" - "in the configuration file or remove the modules that require it."; - } - rndEngine_ = &(rng->getEngine(lumi.index())); iSetup.get().get(pSetup_); iSetup.get().get(tTopoHand); @@ -123,21 +120,14 @@ namespace cms } } } - - // one type of Digi and DigiSimLink suffices - // changes in future: InnerPixel -> Tracker - // creating algorithm objects and pushing them into the map - algomap_[AlgorithmType::InnerPixel] = std::unique_ptr(new PixelDigitizerAlgorithm(iconfig_, (*rndEngine_))); - algomap_[AlgorithmType::PixelinPS] = std::unique_ptr(new PSPDigitizerAlgorithm(iconfig_, (*rndEngine_))); - algomap_[AlgorithmType::StripinPS] = std::unique_ptr(new PSSDigitizerAlgorithm(iconfig_, (*rndEngine_))); - algomap_[AlgorithmType::TwoStrip] = std::unique_ptr(new SSDigitizerAlgorithm(iconfig_, (*rndEngine_))); } - void Phase2TrackerDigitizer::endLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const& iSetup) { - algomap_.clear(); + edm::LogInfo("Phase2TrackerDigitizer") << "End Luminosity Block"; } + Phase2TrackerDigitizer::~Phase2TrackerDigitizer() { edm::LogInfo("Phase2TrackerDigitizer") << "Destroying the Digitizer"; + algomap_.clear(); } void Phase2TrackerDigitizer::accumulatePixelHits(edm::Handle > hSimHits, @@ -170,10 +160,20 @@ namespace cms void Phase2TrackerDigitizer::initializeEvent(edm::Event const& e, edm::EventSetup const& iSetup) { + edm::Service rng; + if (!rng.isAvailable()) { + throw cms::Exception("Configuration") + << "Phase2TrackerDigitizer requires the RandomNumberGeneratorService\n" + "which is not present in the configuration file. You must add the service\n" + "in the configuration file or remove the modules that require it."; + } + CLHEP::HepRandomEngine* rnd_engine = &(rng->getEngine(e.streamID())); + // Must initialize all the algorithms for (auto const & el : algomap_) { if (first_) el.second->init(iSetup); - el.second->initializeEvent(); + + el.second->initializeEvent(rnd_engine); } first_ = false; // Make sure that the first crossing processed starts indexing the sim hits from zero. diff --git a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.h b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.h index 549c72339c653..72296163b5e34 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.h +++ b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.h @@ -104,7 +104,6 @@ namespace cms edm::ESHandle pDD_; edm::ESHandle pSetup_; std::map detectorUnits_; - CLHEP::HepRandomEngine* rndEngine_; edm::ESHandle tTopoHand; edm::ESWatcher theTkDigiGeomWatcher; const edm::ParameterSet& iconfig_; diff --git a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.cc b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.cc index dae9be3e166bf..ca4fdfadbcdf8 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.cc +++ b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.cc @@ -57,8 +57,7 @@ using namespace edm; using namespace sipixelobjects; Phase2TrackerDigitizerAlgorithm::Phase2TrackerDigitizerAlgorithm(const edm::ParameterSet& conf_common, - const edm::ParameterSet& conf_specific, - CLHEP::HepRandomEngine& eng): + const edm::ParameterSet& conf_specific): _signal(), makeDigiSimLinks_(conf_specific.getUntrackedParameter("makeDigiSimLinks", true)), use_ineff_from_db_(conf_specific.getParameter("Inefficiency_DB")), @@ -152,14 +151,13 @@ Phase2TrackerDigitizerAlgorithm::Phase2TrackerDigitizerAlgorithm(const edm::Para fluctuate(fluctuateCharge ? new SiG4UniversalFluctuation() : nullptr), theNoiser(addNoise ? new GaussianTailNoiseGenerator() : nullptr), theSiPixelGainCalibrationService_(use_ineff_from_db_ ? new SiPixelGainCalibrationOfflineSimService(conf_specific) : nullptr), - subdetEfficiencies_(conf_specific), - flatDistribution_((addNoise || AddPixelInefficiency || fluctuateCharge || addThresholdSmearing) ? new CLHEP::RandFlat(eng, 0., 1.) : nullptr), - gaussDistribution_((addNoise || AddPixelInefficiency || fluctuateCharge || addThresholdSmearing) ? new CLHEP::RandGaussQ(eng, 0., theReadoutNoise) : nullptr), - // Threshold smearing with gaussian distribution: - smearedThreshold_Endcap_(addThresholdSmearing ? new CLHEP::RandGaussQ(eng, theThresholdInE_Endcap , theThresholdSmearing_Endcap) : nullptr), - smearedThreshold_Barrel_(addThresholdSmearing ? new CLHEP::RandGaussQ(eng, theThresholdInE_Barrel , theThresholdSmearing_Barrel) : nullptr), - rengine_(&eng) + subdetEfficiencies_(conf_specific) { + flatDistribution_.reset(nullptr); + gaussDistribution_.reset(nullptr); + smearedThreshold_Endcap_.reset(nullptr); + smearedThreshold_Barrel_.reset(nullptr); + LogInfo("Phase2TrackerDigitizerAlgorithm") << "Phase2TrackerDigitizerAlgorithm constructed\n" << "Configuration parameters:\n" << "Threshold/Gain = " @@ -726,6 +724,21 @@ void Phase2TrackerDigitizerAlgorithm::pixel_inefficiency(const SubdetEfficiencie } } } +void Phase2TrackerDigitizerAlgorithm::initializeEvent(CLHEP::HepRandomEngine* eng) { + if (addNoise || AddPixelInefficiency || fluctuateCharge || addThresholdSmearing) { + + flatDistribution_ = std::unique_ptr(new CLHEP::RandFlat(*eng, 0., 1.)); + gaussDistribution_ = std::unique_ptr(new CLHEP::RandGaussQ(eng, 0., theReadoutNoise)); + } + // Threshold smearing with gaussian distribution: + if (addThresholdSmearing) { + smearedThreshold_Endcap_ = std::unique_ptr (new CLHEP::RandGaussQ(eng, theThresholdInE_Endcap , theThresholdSmearing_Endcap)); + smearedThreshold_Barrel_ = std::unique_ptr (new CLHEP::RandGaussQ(eng, theThresholdInE_Barrel , theThresholdSmearing_Barrel)); + } + rengine_ = eng; + _signal.clear(); +} + // ======================================================================================= // // Set the drift direction accoring to the Bfield in local det-unit frame diff --git a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.h b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.h index 72cebc2ff736f..dff2fa1c91777 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.h +++ b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.h @@ -44,14 +44,12 @@ class TrackerTopology; class Phase2TrackerDigitizerAlgorithm { public: - Phase2TrackerDigitizerAlgorithm(const edm::ParameterSet& conf_common, const edm::ParameterSet& conf_specific, CLHEP::HepRandomEngine&); + Phase2TrackerDigitizerAlgorithm(const edm::ParameterSet& conf_common, const edm::ParameterSet& conf_specific); virtual ~Phase2TrackerDigitizerAlgorithm(); // initialization that cannot be done in the constructor virtual void init(const edm::EventSetup& es) = 0; - virtual void initializeEvent() { - _signal.clear(); - } + virtual void initializeEvent(CLHEP::HepRandomEngine* eng); // run the algorithm to digitize a single det virtual void accumulateSimHits(const std::vector::const_iterator inputBegin, const std::vector::const_iterator inputEnd, @@ -200,12 +198,12 @@ class Phase2TrackerDigitizerAlgorithm { const SubdetEfficiencies subdetEfficiencies_; // For random numbers - const std::unique_ptr flatDistribution_; - const std::unique_ptr gaussDistribution_; + std::unique_ptr flatDistribution_; + std::unique_ptr gaussDistribution_; // Threshold gaussian smearing: - const std::unique_ptr smearedThreshold_Endcap_; - const std::unique_ptr smearedThreshold_Barrel_; + std::unique_ptr smearedThreshold_Endcap_; + std::unique_ptr smearedThreshold_Barrel_; //for engine passed into the constructor from Digitizer CLHEP::HepRandomEngine* rengine_; diff --git a/SimTracker/SiPhase2Digitizer/plugins/PixelDigitizerAlgorithm.cc b/SimTracker/SiPhase2Digitizer/plugins/PixelDigitizerAlgorithm.cc index 5abe2592ff2d8..d231a2864a16f 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/PixelDigitizerAlgorithm.cc +++ b/SimTracker/SiPhase2Digitizer/plugins/PixelDigitizerAlgorithm.cc @@ -61,10 +61,9 @@ void PixelDigitizerAlgorithm::init(const edm::EventSetup& es) { es.get().get(geom_); } -PixelDigitizerAlgorithm::PixelDigitizerAlgorithm(const edm::ParameterSet& conf, CLHEP::HepRandomEngine& eng) : +PixelDigitizerAlgorithm::PixelDigitizerAlgorithm(const edm::ParameterSet& conf) : Phase2TrackerDigitizerAlgorithm(conf.getParameter("AlgorithmCommon"), - conf.getParameter("PixelDigitizerAlgorithm"), - eng) + conf.getParameter("PixelDigitizerAlgorithm")) { pixelFlag = true; LogInfo("PixelDigitizerAlgorithm") << "Algorithm constructed " diff --git a/SimTracker/SiPhase2Digitizer/plugins/PixelDigitizerAlgorithm.h b/SimTracker/SiPhase2Digitizer/plugins/PixelDigitizerAlgorithm.h index a1f8aaa75815b..487c8cf9804d7 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/PixelDigitizerAlgorithm.h +++ b/SimTracker/SiPhase2Digitizer/plugins/PixelDigitizerAlgorithm.h @@ -8,7 +8,7 @@ class TrackerTopology; class PixelDigitizerAlgorithm: public Phase2TrackerDigitizerAlgorithm { public: - PixelDigitizerAlgorithm(const edm::ParameterSet& conf, CLHEP::HepRandomEngine&); + PixelDigitizerAlgorithm(const edm::ParameterSet& conf); ~PixelDigitizerAlgorithm() override; // initialization that cannot be done in the constructor diff --git a/SimTracker/SiPhase2Digitizer/plugins/SSDigitizerAlgorithm.cc b/SimTracker/SiPhase2Digitizer/plugins/SSDigitizerAlgorithm.cc index 348a13e56e9d2..29a6c2c455c65 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/SSDigitizerAlgorithm.cc +++ b/SimTracker/SiPhase2Digitizer/plugins/SSDigitizerAlgorithm.cc @@ -29,10 +29,9 @@ using namespace edm; void SSDigitizerAlgorithm::init(const edm::EventSetup& es) { es.get().get(geom_); } -SSDigitizerAlgorithm::SSDigitizerAlgorithm(const edm::ParameterSet& conf, CLHEP::HepRandomEngine& eng) : +SSDigitizerAlgorithm::SSDigitizerAlgorithm(const edm::ParameterSet& conf) : Phase2TrackerDigitizerAlgorithm(conf.getParameter("AlgorithmCommon"), - conf.getParameter("SSDigitizerAlgorithm"), - eng) + conf.getParameter("SSDigitizerAlgorithm")) { pixelFlag = false; LogInfo("SSDigitizerAlgorithm ") << "SSDigitizerAlgorithm constructed " diff --git a/SimTracker/SiPhase2Digitizer/plugins/SSDigitizerAlgorithm.h b/SimTracker/SiPhase2Digitizer/plugins/SSDigitizerAlgorithm.h index 3ab44bcbf03d2..27c704141009c 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/SSDigitizerAlgorithm.h +++ b/SimTracker/SiPhase2Digitizer/plugins/SSDigitizerAlgorithm.h @@ -9,7 +9,7 @@ class TrackerTopology; class SSDigitizerAlgorithm :public Phase2TrackerDigitizerAlgorithm { public: - SSDigitizerAlgorithm(const edm::ParameterSet& conf, CLHEP::HepRandomEngine&); + SSDigitizerAlgorithm(const edm::ParameterSet& conf); ~SSDigitizerAlgorithm() override; // initialization that cannot be done in the constructor From c3e7c2815cb45b9e8caa358fc84dd6621aec1f0a Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 4 Apr 2018 11:59:43 +0200 Subject: [PATCH 329/426] CMS naming conventions --- .../CTPPSDetId/interface/TotemTimingDetId.h | 18 +-- .../interface/TotemTimingEventInfo.h | 104 +++++++++--------- .../CTPPSDigi/src/TotemTimingEventInfo.cc | 49 +++++---- DataFormats/CTPPSDigi/src/classes_def.xml | 2 +- 4 files changed, 90 insertions(+), 83 deletions(-) diff --git a/DataFormats/CTPPSDetId/interface/TotemTimingDetId.h b/DataFormats/CTPPSDetId/interface/TotemTimingDetId.h index 51cabb522285e..ba8136aed1897 100644 --- a/DataFormats/CTPPSDetId/interface/TotemTimingDetId.h +++ b/DataFormats/CTPPSDetId/interface/TotemTimingDetId.h @@ -17,25 +17,25 @@ /** *\brief Detector ID class for CTPPS Totem Timing detectors. * Bits [19:31] : Assigend in CTPPSDetId Calss - * Bits [17:18] : 2 bits for UFSD plane 0,1,2,3 + * Bits [17:18] : 2 bits for UFSD plane 0,1,2,3 * Bits [12:16] : 5 bits for UFSD channel numbers 1,2,3,..16 * Bits [0:11] : unspecified yet - * + * * This class is very similar to CTPPSDiamondDetId; however the detector is completely separated, therefore it is useful to keep them separate and independent. **/ class TotemTimingDetId : public CTPPSDetId -{ +{ public: - enum { ID_NOT_SET = 28 }; - + enum { ID_NOT_SET = 28 }; + /// Construct from a raw id explicit TotemTimingDetId(uint32_t id); TotemTimingDetId(const CTPPSDetId &id) : CTPPSDetId(id) { } - + /// Construct from hierarchy indeces. TotemTimingDetId(uint32_t Arm, uint32_t Station, uint32_t RomanPot=0, uint32_t Plane=0, uint32_t Channel=0); @@ -47,9 +47,9 @@ class TotemTimingDetId : public CTPPSDetId { return (((raw >>DetId::kDetOffset) & 0xF) == DetId::VeryForward && ((raw >> DetId::kSubdetOffset) & 0x7) == sdTimingFastSilicon); - } + } //-------------------- getting and setting methods -------------------- - + uint32_t plane() const { return ((id_>>startPlaneBit) & maskPlane); @@ -108,4 +108,4 @@ class TotemTimingDetId : public CTPPSDetId std::ostream& operator<<(std::ostream& os, const TotemTimingDetId& id); -#endif +#endif diff --git a/DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h b/DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h index 5ecf6dd0f73a4..eee6d4d574286 100644 --- a/DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h +++ b/DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h @@ -4,7 +4,7 @@ /** \class TotemTimingEventInfo * * Event Info Class for CTPPS Timing Detector - * + * * \author Mirko Berretti * \author Nicola Minafra * \date March 2018 @@ -15,41 +15,41 @@ class TotemTimingEventInfo { - public: - TotemTimingEventInfo(const uint8_t hwId, const uint64_t L1ATimeStamp, const uint16_t bunchNumber, const uint32_t orbitNumber, const uint32_t eventNumber, const uint16_t channelMap, const uint16_t L1ALatency, const uint8_t numberOfSamples, const uint8_t offsetOfSamples ); - TotemTimingEventInfo(const TotemTimingEventInfo& eventInfo); + public: + TotemTimingEventInfo( const uint8_t hwId, const uint64_t l1ATimestamp, const uint16_t bunchNumber, const uint32_t orbitNumber, const uint32_t eventNumber, const uint16_t channelMap, const uint16_t l1ALatency, const uint8_t numberOfSamples, const uint8_t offsetOfSamples ); + TotemTimingEventInfo( const TotemTimingEventInfo& eventInfo ); TotemTimingEventInfo(); ~TotemTimingEventInfo() {}; - + /// Digis are equal if they have all the same values, NOT checking the samples! - bool operator==(const TotemTimingEventInfo& eventInfo) const; + bool operator==( const TotemTimingEventInfo& eventInfo ) const; /// Return digi values number - + /// Hardware Id formatted as: bits 0-3 Channel Id, bit 4 Sampic Id, bits 5-7 Digitizer Board Id - inline unsigned int getHardwareId() const - { - return hwId_; + inline unsigned int getHardwareId() const + { + return hwId_; } inline unsigned int getHardwareBoardId() const { - return (hwId_&0xE0)>>5; + return ( hwId_ & 0xE0 ) >> 5; } inline unsigned int getHardwareSampicId() const { - return (hwId_&0x10)>>4; + return ( hwId_ & 0x10 ) >> 4; } inline unsigned int getHardwareChannelId() const { - return (hwId_&0x0F); + return ( hwId_ & 0x0F ); } - inline unsigned int getL1ATimeStamp() const + inline unsigned int getL1ATimestamp() const { - return L1ATimeStamp_; + return l1ATimestamp_; } inline unsigned int getBunchNumber() const @@ -74,7 +74,7 @@ class TotemTimingEventInfo inline unsigned int getL1ALatency() const { - return L1ALatency_; + return l1ALatency_; } inline unsigned int getNumberOfSamples() const @@ -89,112 +89,112 @@ class TotemTimingEventInfo inline uint8_t getPLLInfo() const { - return PLLInfo_; + return pllInfo_; } /// Set digi values /// Hardware Id formatted as: bits 0-3 Channel Id, bit 4 Sampic Id, bits 5-7 Digitizer Board Id - inline void setHardwareId(const uint8_t hwId) - { - hwId_ = hwId; + inline void setHardwareId( const uint8_t hwId ) + { + hwId_ = hwId; } - inline void setHardwareBoardId(const unsigned int BoardId) + inline void setHardwareBoardId( const unsigned int boardId ) { hwId_ &= 0x1F; // Set board bits to 0 - hwId_ |= ((BoardId&0x07)<<5) & 0xE0; + hwId_ |= ( ( boardId & 0x07 ) << 5 ) & 0xE0; } - inline void setHardwareSampicId(const unsigned int SampicId) + inline void setHardwareSampicId( const unsigned int sampicId ) { - hwId_ &= 0xEF; // Set sampic bit to 0 - hwId_ |= ((SampicId&0x01)<<4) & 0x10; + hwId_ &= 0xEF; // set Sampic bit to 0 + hwId_ |= ( ( sampicId & 0x01 ) << 4 ) & 0x10; } - inline void setHardwareChannelId(const unsigned int ChannelId) + inline void setHardwareChannelId( const unsigned int channelId ) { - hwId_ &= 0xF0; // Set sampic bit to 0 - hwId_ |= (ChannelId&0x0F) & 0x0F; + hwId_ &= 0xF0; // set Sampic bit to 0 + hwId_ |= ( channelId & 0x0F ) & 0x0F; } - inline void setL1ATimeStamp(const uint64_t L1ATimeStamp) + inline void setL1ATimestamp( const uint64_t l1ATimestamp ) { - L1ATimeStamp_ = L1ATimeStamp; + l1ATimestamp_ = l1ATimestamp; } - inline void setBunchNumber(const uint16_t bunchNumber) + inline void setBunchNumber( const uint16_t bunchNumber ) { bunchNumber_ = bunchNumber; } - inline void setOrbitNumber(const uint32_t orbitNumber) + inline void setOrbitNumber( const uint32_t orbitNumber ) { orbitNumber_ = orbitNumber; } - inline void setEventNumber(const uint32_t eventNumber) + inline void setEventNumber( const uint32_t eventNumber ) { eventNumber_ = eventNumber; } - inline void setChannelMap(const uint16_t channelMap) + inline void setChannelMap( const uint16_t channelMap ) { channelMap_ = channelMap; } - inline void setL1ALatency(const uint16_t L1ALatency) + inline void setL1ALatency( const uint16_t l1ALatency ) { - L1ALatency_ = L1ALatency; + l1ALatency_ = l1ALatency; } - inline void setNumberOfSamples(const uint8_t numberOfSamples) + inline void setNumberOfSamples( const uint8_t numberOfSamples ) { numberOfSamples_ = numberOfSamples; } - inline void setOffsetOfSamples(const uint8_t offsetOfSamples) + inline void setOffsetOfSamples( const uint8_t offsetOfSamples ) { offsetOfSamples_ = offsetOfSamples; } - inline void setPLLInfo(const uint8_t PLLInfo) + inline void setPLLInfo( const uint8_t pllInfo ) { - PLLInfo_ = PLLInfo; + pllInfo_ = pllInfo; } private: uint8_t hwId_; - uint64_t L1ATimeStamp_; + uint64_t l1ATimestamp_; uint16_t bunchNumber_; uint32_t orbitNumber_; uint32_t eventNumber_; uint16_t channelMap_; - uint16_t L1ALatency_; + uint16_t l1ALatency_; uint8_t numberOfSamples_; uint8_t offsetOfSamples_; - uint8_t PLLInfo_; + uint8_t pllInfo_; }; #include -inline bool operator< (const TotemTimingEventInfo& one, const TotemTimingEventInfo& other) +inline bool operator<( const TotemTimingEventInfo& one, const TotemTimingEventInfo& other ) { if ( one.getEventNumber() < other.getEventNumber() ) return true; - if ( one.getL1ATimeStamp() < other.getL1ATimeStamp() ) + if ( one.getL1ATimestamp() < other.getL1ATimestamp() ) + return true; + if ( one.getHardwareId() < other.getHardwareId() ) return true; - if ( one.getHardwareId() < other.getHardwareId() ) - return true; return false; -} +} -inline std::ostream & operator<<(std::ostream & o, const TotemTimingEventInfo& digi) +inline std::ostream& operator<<( std::ostream& o, const TotemTimingEventInfo& digi ) { std::bitset<16> bitsPLLInfo( digi.getPLLInfo() ); return o << "TotemTimingEventInfo:" - << "\nHardwareId:\t" << std::hex << digi.getHardwareId() - << "\nDB: " << std::dec << digi.getHardwareBoardId() << "\tSampic: " << digi.getHardwareSampicId() << "\tChannel: " << digi.getHardwareChannelId() - << "\nL1A Time Stamp:\t" << std::dec << digi.getL1ATimeStamp() + << "\nHardwareId:\t" << std::hex << digi.getHardwareId() + << "\nDB: " << std::dec << digi.getHardwareBoardId() << "\tSampic: " << digi.getHardwareSampicId() << "\tChannel: " << digi.getHardwareChannelId() + << "\nL1A Timestamp:\t" << std::dec << digi.getL1ATimestamp() << "\nL1A Latency:\t" << std::dec << digi.getL1ALatency() << "\nBunch Number:\t" << std::dec << digi.getBunchNumber() << "\nOrbit Number:\t" << std::dec << digi.getOrbitNumber() diff --git a/DataFormats/CTPPSDigi/src/TotemTimingEventInfo.cc b/DataFormats/CTPPSDigi/src/TotemTimingEventInfo.cc index 234d31155c8c2..28459ca24c6c6 100644 --- a/DataFormats/CTPPSDigi/src/TotemTimingEventInfo.cc +++ b/DataFormats/CTPPSDigi/src/TotemTimingEventInfo.cc @@ -1,5 +1,4 @@ /** \file - * * * \author Mirko Berretti * \author Nicola Minafra @@ -7,36 +6,44 @@ #include -using namespace std; - -TotemTimingEventInfo::TotemTimingEventInfo(const uint8_t hwId, const uint64_t L1ATimeStamp, const uint16_t bunchNumber, const uint32_t orbitNumber, const uint32_t eventNumber, const uint16_t channelMap, const uint16_t L1ALatency, const uint8_t numberOfSamples, const uint8_t offsetOfSamples ) : - hwId_(hwId), L1ATimeStamp_(L1ATimeStamp), bunchNumber_(bunchNumber), orbitNumber_(orbitNumber), eventNumber_(eventNumber), channelMap_(channelMap), L1ALatency_(L1ALatency), numberOfSamples_(numberOfSamples), offsetOfSamples_(offsetOfSamples) +TotemTimingEventInfo::TotemTimingEventInfo( const uint8_t hwId, const uint64_t l1ATimestamp, + const uint16_t bunchNumber, const uint32_t orbitNumber, const uint32_t eventNumber, + const uint16_t channelMap, const uint16_t l1ALatency, + const uint8_t numberOfSamples, const uint8_t offsetOfSamples ) : + hwId_( hwId ), l1ATimestamp_( l1ATimestamp ), + bunchNumber_( bunchNumber ), orbitNumber_( orbitNumber ), eventNumber_( eventNumber ), + channelMap_( channelMap ), l1ALatency_( l1ALatency ), + numberOfSamples_( numberOfSamples ), offsetOfSamples_( offsetOfSamples ) {} -TotemTimingEventInfo::TotemTimingEventInfo(const TotemTimingEventInfo& eventInfo) : - hwId_(eventInfo.getHardwareId()), L1ATimeStamp_(eventInfo.getL1ATimeStamp()), bunchNumber_(eventInfo.getBunchNumber()), orbitNumber_(eventInfo.getOrbitNumber()), eventNumber_(eventInfo.getEventNumber()), channelMap_(eventInfo.getChannelMap()), L1ALatency_(eventInfo.getL1ALatency()), numberOfSamples_(eventInfo.getNumberOfSamples()), offsetOfSamples_(eventInfo.getOffsetOfSamples()) +TotemTimingEventInfo::TotemTimingEventInfo( const TotemTimingEventInfo& eventInfo ) : + hwId_( eventInfo.hwId_ ), l1ATimestamp_( eventInfo.l1ATimestamp_ ), + bunchNumber_( eventInfo.bunchNumber_ ), orbitNumber_( eventInfo.orbitNumber_ ), eventNumber_( eventInfo.eventNumber_ ), + channelMap_( eventInfo.channelMap_ ), l1ALatency_( eventInfo.l1ALatency_ ), + numberOfSamples_( eventInfo.numberOfSamples_ ), offsetOfSamples_( eventInfo.offsetOfSamples_ ) {} TotemTimingEventInfo::TotemTimingEventInfo() : - hwId_(0), L1ATimeStamp_(0), bunchNumber_(0), orbitNumber_(0), eventNumber_(0), channelMap_(0), L1ALatency_(0), numberOfSamples_(0), offsetOfSamples_(0) + hwId_( 0 ), l1ATimestamp_( 0 ), + bunchNumber_( 0 ), orbitNumber_( 0 ), eventNumber_( 0 ), + channelMap_( 0 ), l1ALatency_( 0 ), + numberOfSamples_( 0 ), offsetOfSamples_( 0 ) {} - // Comparison bool TotemTimingEventInfo::operator==(const TotemTimingEventInfo& eventInfo) const { - if ( hwId_ != eventInfo.getHardwareId() - || L1ATimeStamp_ != eventInfo.getL1ATimeStamp() - || bunchNumber_ != eventInfo.getBunchNumber() - || orbitNumber_ != eventInfo.getOrbitNumber() - || eventNumber_ != eventInfo.getEventNumber() - || channelMap_ != eventInfo.getChannelMap() - || L1ALatency_ != eventInfo.getL1ALatency() - || numberOfSamples_ != eventInfo.getNumberOfSamples() - || offsetOfSamples_ != eventInfo.getOffsetOfSamples() + if ( hwId_ != eventInfo.hwId_ + || l1ATimestamp_ != eventInfo.l1ATimestamp_ + || bunchNumber_ != eventInfo.bunchNumber_ + || orbitNumber_ != eventInfo.orbitNumber_ + || eventNumber_ != eventInfo.eventNumber_ + || channelMap_ != eventInfo.channelMap_ + || l1ALatency_ != eventInfo.l1ALatency_ + || numberOfSamples_ != eventInfo.numberOfSamples_ + || offsetOfSamples_ != eventInfo.offsetOfSamples_ ) return false; - else - return true; -} + return true; +} diff --git a/DataFormats/CTPPSDigi/src/classes_def.xml b/DataFormats/CTPPSDigi/src/classes_def.xml index bf1bad181fdf7..c39918dd19aed 100644 --- a/DataFormats/CTPPSDigi/src/classes_def.xml +++ b/DataFormats/CTPPSDigi/src/classes_def.xml @@ -58,7 +58,7 @@ - + From 95d467a27100fe86e963815a537cffcbf325b8a1 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 4 Apr 2018 12:10:04 +0200 Subject: [PATCH 330/426] More CMS naming conventions --- .../CTPPSDetId/interface/TotemTimingDetId.h | 78 +++++++++---------- .../CTPPSDetId/src/TotemTimingDetId.cc | 73 ++++++++--------- 2 files changed, 68 insertions(+), 83 deletions(-) diff --git a/DataFormats/CTPPSDetId/interface/TotemTimingDetId.h b/DataFormats/CTPPSDetId/interface/TotemTimingDetId.h index ba8136aed1897..b9348a647112b 100644 --- a/DataFormats/CTPPSDetId/interface/TotemTimingDetId.h +++ b/DataFormats/CTPPSDetId/interface/TotemTimingDetId.h @@ -30,82 +30,76 @@ class TotemTimingDetId : public CTPPSDetId enum { ID_NOT_SET = 28 }; /// Construct from a raw id - explicit TotemTimingDetId(uint32_t id); + explicit TotemTimingDetId( uint32_t id ); + TotemTimingDetId( const CTPPSDetId&id ) : CTPPSDetId( id ) {} - TotemTimingDetId(const CTPPSDetId &id) : CTPPSDetId(id) - { - } - - /// Construct from hierarchy indeces. - TotemTimingDetId(uint32_t Arm, uint32_t Station, uint32_t RomanPot=0, uint32_t Plane=0, uint32_t Channel=0); + /// Construct from hierarchy indices. + TotemTimingDetId( uint32_t arm, uint32_t station, uint32_t romanPot = 0, uint32_t plane = 0, uint32_t channel = 0 ); - static const uint32_t startPlaneBit, maskPlane, maxPlane, lowMaskPlane; - static const uint32_t startDetBit, maskChannel, maxChannel, lowMaskChannel; + static constexpr uint32_t startPlaneBit = 17, maskPlane = 0x3, maxPlane = 3, lowMaskPlane = 0x1FFFF; + static constexpr uint32_t startDetBit = 12, maskChannel = 0x1F, maxChannel = 31, lowMaskChannel = 0xFFF; /// returns true if the raw ID is a PPS-timing one - static bool check(unsigned int raw) + static bool check( unsigned int raw ) { - return (((raw >>DetId::kDetOffset) & 0xF) == DetId::VeryForward && - ((raw >> DetId::kSubdetOffset) & 0x7) == sdTimingFastSilicon); + return ( ( ( raw >> DetId::kDetOffset ) & 0xF ) == DetId::VeryForward + && ( ( raw >> DetId::kSubdetOffset ) & 0x7 ) == sdTimingFastSilicon ); } //-------------------- getting and setting methods -------------------- uint32_t plane() const { - return ((id_>>startPlaneBit) & maskPlane); + return ( ( id_ >> startPlaneBit ) & maskPlane ); } - void setPlane(uint32_t channel) + void setPlane( uint32_t channel ) { - id_ &= ~(maskPlane << startPlaneBit); - id_ |= ((channel & maskPlane) << startPlaneBit); + id_ &= ~( maskPlane << startPlaneBit ); + id_ |= ( ( channel & maskPlane ) << startPlaneBit ); } uint32_t channel() const { - return ((id_>>startDetBit) & maskChannel); + return ( ( id_ >> startDetBit ) & maskChannel ); } - void setChannel(uint32_t channel) + void setChannel( uint32_t channel ) { - id_ &= ~(maskChannel << startDetBit); - id_ |= ((channel & maskChannel) << startDetBit); + id_ &= ~( maskChannel << startDetBit ); + id_ |= ( ( channel & maskChannel ) << startDetBit ); } //-------------------- id getters for higher-level objects -------------------- TotemTimingDetId getPlaneId() const { - return TotemTimingDetId( rawId() & (~lowMaskPlane) ); + return TotemTimingDetId( rawId() & ( ~lowMaskPlane ) ); } //-------------------- name methods -------------------- - inline void planeName(std::string &name, NameFlag flag = nFull) const - { - switch (flag) - { - case nShort: name = ""; break; - case nFull: rpName(name, flag); name += "_"; break; - case nPath: rpName(name, flag); name += "/plane "; break; - } - - name += std::to_string(plane()); + inline void planeName( std::string& name, NameFlag flag = nFull ) const + { + switch ( flag ) { + case nShort: name = ""; break; + case nFull: rpName( name, flag ); name += "_"; break; + case nPath: rpName( name, flag ); name += "/plane "; break; } + name += std::to_string( plane() ); + } - inline void channelName(std::string &name, NameFlag flag = nFull) const - { - switch (flag) - { - case nShort: name = ""; break; - case nFull: planeName(name, flag); name += "_"; break; - case nPath: planeName(name, flag); name += "/channel "; break; - } - - name += std::to_string(channel()); + inline void channelName( std::string& name, NameFlag flag = nFull ) const + { + switch ( flag ) { + case nShort: name = ""; break; + case nFull: planeName( name, flag ); name += "_"; break; + case nPath: planeName( name, flag ); name += "/channel "; break; } + name += std::to_string( channel() ); + } }; -std::ostream& operator<<(std::ostream& os, const TotemTimingDetId& id); +std::ostream& operator<<( std::ostream& os, const TotemTimingDetId& id ); #endif + diff --git a/DataFormats/CTPPSDetId/src/TotemTimingDetId.cc b/DataFormats/CTPPSDetId/src/TotemTimingDetId.cc index b3b9057ce5a06..e9fff959ff21a 100644 --- a/DataFormats/CTPPSDetId/src/TotemTimingDetId.cc +++ b/DataFormats/CTPPSDetId/src/TotemTimingDetId.cc @@ -3,67 +3,58 @@ * March 2018 ****************************************************************************/ - #include "DataFormats/CTPPSDetId/interface/TotemTimingDetId.h" - #include "FWCore/Utilities/interface/Exception.h" -using namespace std; - -//---------------------------------------------------------------------------------------------------- - -const uint32_t TotemTimingDetId::startPlaneBit = 17, TotemTimingDetId::maskPlane = 0x3, TotemTimingDetId::maxPlane = 3, TotemTimingDetId::lowMaskPlane = 0x1FFFF; -const uint32_t TotemTimingDetId::startDetBit = 12, TotemTimingDetId::maskChannel = 0x1F, TotemTimingDetId::maxChannel = 31, TotemTimingDetId::lowMaskChannel = 0xFFF; - //---------------------------------------------------------------------------------------------------- -TotemTimingDetId::TotemTimingDetId(uint32_t id) : CTPPSDetId(id) +TotemTimingDetId::TotemTimingDetId( uint32_t id ) : + CTPPSDetId( id ) { - if (! check(id)) - { - throw cms::Exception("InvalidDetId") << "TotemTimingDetId ctor:" - << " channel: " << channel() - << " subdet: " << subdetId() - << " is not a valid Totem Timing id"; - } + if ( !check( id ) ) { + throw cms::Exception( "InvalidDetId" ) + << "TotemTimingDetId ctor:" + << " channel: " << channel() + << " subdet: " << subdetId() + << " is not a valid Totem Timing id"; + } } //---------------------------------------------------------------------------------------------------- -TotemTimingDetId::TotemTimingDetId(uint32_t Arm, uint32_t Station, uint32_t RomanPot, uint32_t Plane, uint32_t Channel) : - CTPPSDetId(sdTimingFastSilicon, Arm, Station, RomanPot) +TotemTimingDetId::TotemTimingDetId( uint32_t arm, uint32_t station, uint32_t romanPot, uint32_t plane, uint32_t channel ) : + CTPPSDetId( sdTimingFastSilicon, arm, station, romanPot ) { - if (Arm > maxArm || Station > maxStation || RomanPot > maxRP || Plane > maxPlane || Channel > maxChannel) - { - throw cms::Exception("InvalidDetId") << "TotemTimingDetId ctor:" - << " Invalid parameters:" - << " arm=" << Arm - << " station=" << Station - << " rp=" << RomanPot - << " plane=" << Plane - << " detector=" << Channel - << std::endl; - } - - uint32_t ok=0xfe000000; + if ( arm > maxArm || station > maxStation || romanPot > maxRP || plane > maxPlane || channel > maxChannel ) { + throw cms::Exception( "InvalidDetId" ) + << "TotemTimingDetId ctor:" + << " Invalid parameters:" + << " arm=" << arm + << " station=" << station + << " rp=" << romanPot + << " plane=" << plane + << " detector=" << channel + << std::endl; + } + + uint32_t ok = 0xfe000000; id_ &= ok; - id_ |= ((Arm & maskArm) << startArmBit); - id_ |= ((Station & maskStation) << startStationBit); - id_ |= ((RomanPot & maskRP) << startRPBit); - id_ |= ((Plane & maskPlane) << startPlaneBit); - id_ |= ((Channel & maskChannel) << startDetBit); + id_ |= ( ( arm & maskArm ) << startArmBit ); + id_ |= ( ( station & maskStation ) << startStationBit ); + id_ |= ( ( romanPot & maskRP ) << startRPBit ); + id_ |= ( ( plane & maskPlane ) << startPlaneBit ); + id_ |= ( ( channel & maskChannel ) << startDetBit ); } //---------------------------------------------------------------------------------------------------- -std::ostream& operator << (std::ostream& os, const TotemTimingDetId& id) +std::ostream& operator<<( std::ostream& os, const TotemTimingDetId& id ) { - os << "arm=" << id.arm() + return os + << "arm=" << id.arm() << " station=" << id.station() << " rp=" << id.rp() << " plane=" << id.plane() << " Detector=" << id.channel(); - - return os; } From 6582b9dbc2f83b12d9bdd1d5595230912efda775 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 4 Apr 2018 12:14:58 +0200 Subject: [PATCH 331/426] Forgot two else-if --- EventFilter/CTPPSRawToDigi/plugins/TotemVFATRawToDigi.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/EventFilter/CTPPSRawToDigi/plugins/TotemVFATRawToDigi.cc b/EventFilter/CTPPSRawToDigi/plugins/TotemVFATRawToDigi.cc index 37d0510dac9f4..735a2024a0b54 100644 --- a/EventFilter/CTPPSRawToDigi/plugins/TotemVFATRawToDigi.cc +++ b/EventFilter/CTPPSRawToDigi/plugins/TotemVFATRawToDigi.cc @@ -96,10 +96,10 @@ TotemVFATRawToDigi::TotemVFATRawToDigi(const edm::ParameterSet &conf): if (subSystem == ssTrackingStrip) produces< DetSetVector >(subSystemName); - if (subSystem == ssTimingDiamond) + else if (subSystem == ssTimingDiamond) produces< DetSetVector >(subSystemName); - if (subSystem == ssTotemTiming) + else if (subSystem == ssTotemTiming) produces< DetSetVector >(subSystemName); // set default IDs From 7c909051bd60c5765803ba62858b7c0189b018bf Mon Sep 17 00:00:00 2001 From: vladimir Date: Wed, 4 Apr 2018 14:11:18 +0200 Subject: [PATCH 332/426] remove some 2d histograms --- DQM/CTPPS/plugins/CTPPSPixelDQMSource.cc | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/DQM/CTPPS/plugins/CTPPSPixelDQMSource.cc b/DQM/CTPPS/plugins/CTPPSPixelDQMSource.cc index 334c52b552e25..aeb4702f59555 100644 --- a/DQM/CTPPS/plugins/CTPPSPixelDQMSource.cc +++ b/DQM/CTPPS/plugins/CTPPSPixelDQMSource.cc @@ -53,6 +53,7 @@ class CTPPSPixelDQMSource: public DQMEDAnalyzer static constexpr int NplaneMAX=6; // per RPot static constexpr int NROCsMAX = 6; // per plane static constexpr int RPn_first = 3, RPn_last = 4; + static constexpr int ADCMax = 256; const int hitMultMAX = 300; // tuned const int ClusMultMAX = 10; // tuned @@ -86,7 +87,7 @@ class CTPPSPixelDQMSource: public DQMEDAnalyzer MonitorElement *h2xyHits[RPotsTotalNumber][NplaneMAX]; MonitorElement *hp2xyADC[RPotsTotalNumber][NplaneMAX]; MonitorElement *h2xyROCHits[RPotsTotalNumber*NplaneMAX][NROCsMAX]; - MonitorElement *h2xyROCadc[RPotsTotalNumber*NplaneMAX][NROCsMAX]; + MonitorElement *hROCadc[RPotsTotalNumber*NplaneMAX][NROCsMAX]; MonitorElement *hRPotActivBXall[RPotsTotalNumber]; int HitsMultROC[RPotsTotalNumber*NplaneMAX][NROCsMAX]; int HitsMultPlane[RPotsTotalNumber][NplaneMAX]; @@ -357,11 +358,8 @@ edm::EventSetup const &) h2xyROCHits[index][roc]=ibooker.book2DD("hits",st2+";pix col;pix row", ROCSizeInY,0,ROCSizeInY, ROCSizeInX,0,ROCSizeInX); h2xyROCHits[index][roc]->getTH2D()->SetOption("colz"); - - string st = "adc average value"; - h2xyROCadc[index][roc]=ibooker.bookProfile2D(st,st2+";pix col;pix row", - ROCSizeInY,0,ROCSizeInY,ROCSizeInX,0,ROCSizeInX, 0.,512.,""); - h2xyROCadc[index][roc]->getTProfile2D()->SetOption("colz"); + hROCadc[index][roc]=ibooker.book1D("adc value",st2+";ADC;number of ROCs", + ADCMax, 0.,float(ADCMax)); } } // end of for(int p=0; p=0 && trocIdFill(colROC,rowROC); - h2xyROCadc[rocHistIndex][trocId]->Fill(colROC,rowROC,adc); + hROCadc[rocHistIndex][trocId]->Fill(adc); ++HitsMultROC[rocHistIndex][trocId]; } } From 2f3e01e4dc2c627f0d85d1894b98736a4cf9392c Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Sat, 31 Mar 2018 19:13:09 +0200 Subject: [PATCH 333/426] Add tests for 16-bit packing with smaller than 15-bit base --- .../PatCandidates/test/testlogintpack.cpp | 109 +++++++++++++++++- 1 file changed, 106 insertions(+), 3 deletions(-) diff --git a/DataFormats/PatCandidates/test/testlogintpack.cpp b/DataFormats/PatCandidates/test/testlogintpack.cpp index e8fe375a20db3..84c4187225a67 100644 --- a/DataFormats/PatCandidates/test/testlogintpack.cpp +++ b/DataFormats/PatCandidates/test/testlogintpack.cpp @@ -8,19 +8,27 @@ class testlogintpack : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(testlogintpack); - CPPUNIT_TEST(test); + CPPUNIT_TEST(test16base11); + CPPUNIT_TEST(test8); CPPUNIT_TEST_SUITE_END(); public: void setUp() {} void tearDown() {} - void test(); + void test16base11(); + void test8(); private: }; namespace { + int16_t pack16base11(double x) { return logintpack::pack16log (x, -15, 0, 1<<11); } + int16_t pack16base11ceil(double x) { return logintpack::pack16logCeil (x, -15, 0, 1<<11); } + int16_t pack16base11closed(double x) { return logintpack::pack16logClosed (x, -15, 0, 1<<11); } + double unpack16base11(int16_t x) { return logintpack::unpack16log (x, -15, 0, 1<<11); } + double unpack16base11closed(int16_t x) { return logintpack::unpack16logClosed(x, -15, 0, 1<<11); } + int8_t pack(double x) { return logintpack::pack8log (x, -15, 0); } int8_t packceil(double x) { return logintpack::pack8logCeil (x, -15, 0); } int8_t packclosed(double x) { return logintpack::pack8log (x, -15, 0); } @@ -28,7 +36,102 @@ namespace { double unpackclosed(int8_t x) { return logintpack::unpack8logClosed(x, -15, 0); } } -void testlogintpack::test() { +void testlogintpack::test16base11() { + constexpr uint16_t base = 1<<11; // 2^11 = 2048 + + constexpr int16_t smallestPositive = 0; + constexpr int16_t smallestNegative = -1; + constexpr int16_t largestPositive = base-1; + constexpr int16_t largestNegative = -largestPositive; + + union { float flt; uint32_t i32; } conv32; + union { double flt; uint64_t i64; } conv64; + + const double smallestValuePos = std::exp(-15.); + const double smallestValueNeg = -std::exp(-15. + 1./base*15.); + const double smallestValueNegForClosed = -std::exp(-15. + 1./(base-1)*15.); + CPPUNIT_ASSERT(pack16base11(smallestValuePos) == smallestPositive); + CPPUNIT_ASSERT(pack16base11ceil(smallestValuePos) == smallestPositive); + CPPUNIT_ASSERT(pack16base11closed(smallestValuePos) == smallestPositive); + CPPUNIT_ASSERT(unpack16base11(smallestPositive) == smallestValuePos); + CPPUNIT_ASSERT(unpack16base11closed(smallestPositive) == smallestValuePos); + + CPPUNIT_ASSERT(pack16base11(smallestValueNeg) == smallestNegative); + CPPUNIT_ASSERT(pack16base11ceil(smallestValueNeg) == smallestNegative); + CPPUNIT_ASSERT(unpack16base11(smallestNegative) == smallestValueNeg); + CPPUNIT_ASSERT(unpack16base11(pack16base11(smallestValueNeg)) == smallestValueNeg); + CPPUNIT_ASSERT(unpack16base11(pack16base11ceil(smallestValueNeg)) == smallestValueNeg); + CPPUNIT_ASSERT(unpack16base11closed(pack16base11closed(smallestValueNegForClosed)) == smallestValueNegForClosed); + + CPPUNIT_ASSERT(pack16base11(smallestValuePos-std::exp(-16.)) == smallestPositive); + CPPUNIT_ASSERT(pack16base11ceil(smallestValuePos-std::exp(-16.)) == smallestPositive); + CPPUNIT_ASSERT(pack16base11closed(smallestValuePos-std::exp(-16.)) == smallestPositive); + conv64.flt = smallestValuePos; + conv64.i64 -= 1; + const double smallestValuePosMinus1Ulp64 = conv64.flt; + CPPUNIT_ASSERT(pack16base11(smallestValuePosMinus1Ulp64) == smallestPositive); + CPPUNIT_ASSERT(pack16base11ceil(smallestValuePosMinus1Ulp64) == smallestPositive); + CPPUNIT_ASSERT(pack16base11closed(smallestValuePosMinus1Ulp64) == smallestPositive); + + CPPUNIT_ASSERT(pack16base11(smallestValueNeg+std::exp(-16.)) == smallestNegative); + CPPUNIT_ASSERT(pack16base11ceil(smallestValueNeg+std::exp(-16.)) == smallestNegative); + CPPUNIT_ASSERT(unpack16base11(pack16base11(smallestValueNeg+std::exp(-16.))) == smallestValueNeg); + CPPUNIT_ASSERT(unpack16base11(pack16base11ceil(smallestValueNeg+std::exp(-16.))) == smallestValueNeg); + CPPUNIT_ASSERT(unpack16base11closed(pack16base11closed(smallestValueNegForClosed+std::exp(-16.))) == smallestValueNegForClosed); + conv64.flt = smallestValueNeg; + conv64.i64 += 1; + const double smallestValueNegPlusUlp64 = conv64.flt; + CPPUNIT_ASSERT(pack16base11(smallestValueNegPlusUlp64) == smallestNegative); + CPPUNIT_ASSERT(pack16base11ceil(smallestValueNegPlusUlp64) == smallestNegative); + CPPUNIT_ASSERT(unpack16base11(pack16base11(smallestValueNegPlusUlp64)) == smallestValueNeg); + CPPUNIT_ASSERT(unpack16base11(pack16base11ceil(smallestValueNegPlusUlp64)) == smallestValueNeg); + CPPUNIT_ASSERT(unpack16base11closed(pack16base11closed(smallestValueNegPlusUlp64)) == smallestValueNegForClosed); + + + const double largestValuePos = std::exp(-15. + double(base-1)/base * 15.); + const double largestValueNeg = -largestValuePos; + CPPUNIT_ASSERT(pack16base11(largestValuePos) == largestPositive); + CPPUNIT_ASSERT(pack16base11ceil(largestValuePos) == largestPositive); + CPPUNIT_ASSERT(unpack16base11(largestPositive) == largestValuePos); + + CPPUNIT_ASSERT(pack16base11(largestValueNeg) == largestNegative); + CPPUNIT_ASSERT(pack16base11ceil(largestValueNeg) == largestNegative); + CPPUNIT_ASSERT(unpack16base11(largestNegative) == largestValueNeg); + + CPPUNIT_ASSERT(pack16base11(largestValuePos+0.1) == largestPositive); + CPPUNIT_ASSERT(pack16base11ceil(largestValuePos+0.1) == largestPositive); + + CPPUNIT_ASSERT(pack16base11(largestValueNeg-0.1) == largestNegative); + CPPUNIT_ASSERT(pack16base11ceil(largestValueNeg-0.1) == largestNegative); + + + const double largestValueClosedPos = std::exp(0.); + const double largestValueClosedNeg = -largestValueClosedPos; + CPPUNIT_ASSERT(pack16base11closed(largestValueClosedPos) == largestPositive); + CPPUNIT_ASSERT(unpack16base11closed(largestPositive) == largestValueClosedPos); + CPPUNIT_ASSERT(pack16base11closed(largestValueClosedNeg) == largestNegative); + CPPUNIT_ASSERT(unpack16base11closed(largestNegative) == largestValueClosedNeg); + + CPPUNIT_ASSERT(pack16base11closed(largestValueClosedPos+0.1) == largestPositive); + CPPUNIT_ASSERT(pack16base11closed(largestValueClosedNeg-0.1) == largestNegative); + + const double someValue = std::exp(-15. + 1./base*15.); + const float someValueFloat = std::exp(-15.f + 1.f/float(base)*15.f); + CPPUNIT_ASSERT(unpack16base11(pack16base11ceil(someValue)) == someValue); + CPPUNIT_ASSERT(static_cast(unpack16base11(pack16base11ceil(someValue))) == someValueFloat); + + conv32.flt = someValueFloat; + conv32.i32 += 1; + const float someValuePlus1Ulp32 = conv32.flt; + CPPUNIT_ASSERT(static_cast(unpack16base11(pack16base11ceil(someValuePlus1Ulp32))) >= someValuePlus1Ulp32); + + conv64.flt = someValue; + conv64.i64 += 1; + const float someValuePlus1Ulp64 = conv64.flt; + CPPUNIT_ASSERT(unpack16base11(pack16base11ceil(someValuePlus1Ulp64)) >= someValuePlus1Ulp64); +} + +void testlogintpack::test8() { using logintpack::smallestPositive; using logintpack::smallestNegative; constexpr int8_t largestPositive = 127; From 3a768b981d7842629fcaf60f53a15107634dccf9 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Thu, 15 Mar 2018 17:08:54 +0100 Subject: [PATCH 334/426] Small simplifications to HGCDigiProducer --- .../plugins/HGCDigiProducer.cc | 34 ++++++++----------- .../plugins/HGCDigiProducer.h | 5 ++- 2 files changed, 16 insertions(+), 23 deletions(-) diff --git a/SimCalorimetry/HGCalSimProducers/plugins/HGCDigiProducer.cc b/SimCalorimetry/HGCalSimProducers/plugins/HGCDigiProducer.cc index c7abb517f098d..ecf822332241b 100644 --- a/SimCalorimetry/HGCalSimProducers/plugins/HGCDigiProducer.cc +++ b/SimCalorimetry/HGCalSimProducers/plugins/HGCDigiProducer.cc @@ -10,60 +10,54 @@ // HGCDigiProducer::HGCDigiProducer(edm::ParameterSet const& pset, edm::ProducerBase& mixMod, edm::ConsumesCollector& iC) : - DigiAccumulatorMixMod(), - theDigitizer_(new HGCDigitizer(pset, iC) ) + HGCDigiProducer(pset, iC) { - if( theDigitizer_->producesEEDigis() ) - mixMod.produces(theDigitizer_->digiCollection()); - if( theDigitizer_->producesHEfrontDigis() ) - mixMod.produces(theDigitizer_->digiCollection()); - if( theDigitizer_->producesHEbackDigis() ) - mixMod.produces(theDigitizer_->digiCollection()); + if( theDigitizer_.producesEEDigis() ) + mixMod.produces(theDigitizer_.digiCollection()); + if( theDigitizer_.producesHEfrontDigis() ) + mixMod.produces(theDigitizer_.digiCollection()); + if( theDigitizer_.producesHEbackDigis() ) + mixMod.produces(theDigitizer_.digiCollection()); } HGCDigiProducer::HGCDigiProducer(edm::ParameterSet const& pset, edm::ConsumesCollector& iC) : DigiAccumulatorMixMod(), - theDigitizer_(new HGCDigitizer(pset, iC)) { -} - -// -HGCDigiProducer::~HGCDigiProducer() -{ + theDigitizer_(pset, iC) { } // void HGCDigiProducer::initializeEvent(edm::Event const& event, edm::EventSetup const& es) { - theDigitizer_->initializeEvent(event, es); + theDigitizer_.initializeEvent(event, es); } // void HGCDigiProducer::finalizeEvent(edm::Event& event, edm::EventSetup const& es) { - theDigitizer_->finalizeEvent(event, es, randomEngine(event.streamID())); + theDigitizer_.finalizeEvent(event, es, randomEngine(event.streamID())); } // void HGCDigiProducer::accumulate(edm::Event const& event, edm::EventSetup const& es) { - theDigitizer_->accumulate(event, es, randomEngine(event.streamID())); + theDigitizer_.accumulate(event, es, randomEngine(event.streamID())); } void HGCDigiProducer::accumulate(PileUpEventPrincipal const& event, edm::EventSetup const& es, edm::StreamID const& streamID) { - theDigitizer_->accumulate(event, es, randomEngine(streamID)); + theDigitizer_.accumulate(event, es, randomEngine(streamID)); } // void HGCDigiProducer::beginRun(edm::Run const&, edm::EventSetup const& es) { - theDigitizer_->beginRun(es); + theDigitizer_.beginRun(es); } // void HGCDigiProducer::endRun(edm::Run const&, edm::EventSetup const&) { - theDigitizer_->endRun(); + theDigitizer_.endRun(); } CLHEP::HepRandomEngine* HGCDigiProducer::randomEngine(edm::StreamID const& streamID) { diff --git a/SimCalorimetry/HGCalSimProducers/plugins/HGCDigiProducer.h b/SimCalorimetry/HGCalSimProducers/plugins/HGCDigiProducer.h index 5d64f1558d2b5..f2c7aa8be0121 100644 --- a/SimCalorimetry/HGCalSimProducers/plugins/HGCDigiProducer.h +++ b/SimCalorimetry/HGCalSimProducers/plugins/HGCDigiProducer.h @@ -4,7 +4,6 @@ #include "SimGeneral/MixingModule/interface/DigiAccumulatorMixMod.h" #include "SimCalorimetry/HGCalSimProducers/interface/HGCDigitizer.h" -#include #include namespace edm { @@ -31,11 +30,11 @@ class HGCDigiProducer : public DigiAccumulatorMixMod { void accumulate(PileUpEventPrincipal const&, edm::EventSetup const&, edm::StreamID const&) override; void beginRun(edm::Run const&, edm::EventSetup const&) override; void endRun(edm::Run const&, edm::EventSetup const&) override; - ~HGCDigiProducer() override; + ~HGCDigiProducer() override = default; private: CLHEP::HepRandomEngine* randomEngine(edm::StreamID const& streamID); //the digitizer - std::unique_ptr theDigitizer_; + HGCDigitizer theDigitizer_; std::vector randomEngines_; }; From 9704c019ff1158b9e010a1c12df1455eb02870b7 Mon Sep 17 00:00:00 2001 From: Heiner Tholen Date: Wed, 4 Apr 2018 15:13:49 +0200 Subject: [PATCH 335/426] move from CSV to DeepCSV / remove histogram that are never filled / remove normal tag info dependency --- .../Trigger/interface/BTVHLTOfflineSource.h | 82 +++---- .../Trigger/python/BTVHLTOfflineSource_cfi.py | 26 +-- DQMOffline/Trigger/src/BTVHLTOfflineSource.cc | 200 +++++++++--------- 3 files changed, 160 insertions(+), 148 deletions(-) diff --git a/DQMOffline/Trigger/interface/BTVHLTOfflineSource.h b/DQMOffline/Trigger/interface/BTVHLTOfflineSource.h index 681f727fe25b5..428a68a96dca0 100644 --- a/DQMOffline/Trigger/interface/BTVHLTOfflineSource.h +++ b/DQMOffline/Trigger/interface/BTVHLTOfflineSource.h @@ -61,8 +61,12 @@ class BTVHLTOfflineSource : public DQMEDAnalyzer { edm::InputTag triggerSummaryLabel_; edm::InputTag triggerResultsLabel_; - edm::EDGetTokenT offlineCSVTokenPF_; - edm::EDGetTokenT offlineCSVTokenCalo_; + float turnon_threshold_low_; + float turnon_threshold_medium_; + float turnon_threshold_high_; + + edm::EDGetTokenT offlineDiscrTokenPF_; + edm::EDGetTokenT offlineDiscrTokenCalo_; edm::EDGetTokenT > hltFastPVToken_; edm::EDGetTokenT > hltPFPVToken_; @@ -80,20 +84,20 @@ class BTVHLTOfflineSource : public DQMEDAnalyzer { edm::Handle > shallowTagInfosCalo; edm::Handle > shallowTagInfosPf; - edm::EDGetTokenT,reco::Track,edm::refhelper::FindUsingAdvance,reco::Track> >,reco::JTATagInfo>,reco::Vertex> > > - csvCaloTagInfosToken_; - edm::EDGetTokenT,reco::Track,edm::refhelper::FindUsingAdvance,reco::Track> >,reco::JTATagInfo>,reco::Vertex> > > - csvPfTagInfosToken_; + // edm::EDGetTokenT,reco::Track,edm::refhelper::FindUsingAdvance,reco::Track> >,reco::JTATagInfo>,reco::Vertex> > > + // caloTagInfosToken_; + // edm::EDGetTokenT,reco::Track,edm::refhelper::FindUsingAdvance,reco::Track> >,reco::JTATagInfo>,reco::Vertex> > > + // pfTagInfosToken_; edm::Handle,reco::Track,edm::refhelper::FindUsingAdvance,reco::Track> >,reco::JTATagInfo>,reco::Vertex> > > - csvCaloTagInfos; + caloTagInfos; edm::Handle,reco::Track,edm::refhelper::FindUsingAdvance,reco::Track> >,reco::JTATagInfo>,reco::Vertex> > > - csvPfTagInfos; + pfTagInfos; - edm::EDGetTokenT csvCaloTagsToken_; - edm::EDGetTokenT csvPfTagsToken_; - edm::Handle csvCaloTags; - edm::Handle csvPfTags; + edm::EDGetTokenT caloTagsToken_; + edm::EDGetTokenT pfTagsToken_; + edm::Handle caloTags; + edm::Handle pfTags; HLTConfigProvider hltConfig_; edm::Handle triggerResults_; @@ -112,20 +116,20 @@ class BTVHLTOfflineSource : public DQMEDAnalyzer { public: void setHistos( - MonitorElement* const CSV, MonitorElement* const Pt, MonitorElement* const Eta, - MonitorElement* const CSV_RECOvsHLT, MonitorElement* const PVz, MonitorElement* const fastPVz, + MonitorElement* const Discr, MonitorElement* const Pt, MonitorElement* const Eta, + MonitorElement* const Discr_HLTvsRECO, MonitorElement* const PVz, MonitorElement* const fastPVz, MonitorElement* const PVz_HLTMinusRECO, MonitorElement* const fastPVz_HLTMinusRECO, MonitorElement* const n_vtx, MonitorElement* const vtx_mass, MonitorElement* const n_vtx_trks, MonitorElement* const n_sel_tracks, MonitorElement* const h_3d_ip_distance, - MonitorElement* const h_3d_ip_error, MonitorElement* const h_3d_ip_sig, - MonitorElement* const n_pixel_hits, MonitorElement* const n_total_hits + MonitorElement* const h_3d_ip_error, MonitorElement* const h_3d_ip_sig // , + // MonitorElement* const n_pixel_hits, MonitorElement* const n_total_hits ) - { CSV_ = CSV; Pt_ = Pt; Eta_ = Eta; CSV_RECOvsHLT_ = CSV_RECOvsHLT; PVz_ = PVz; fastPVz_ = fastPVz; + { Discr_ = Discr; Pt_ = Pt; Eta_ = Eta; Discr_HLTvsRECO_ = Discr_HLTvsRECO; PVz_ = PVz; fastPVz_ = fastPVz; PVz_HLTMinusRECO_ = PVz_HLTMinusRECO; fastPVz_HLTMinusRECO_ = fastPVz_HLTMinusRECO; n_vtx_ = n_vtx; vtx_mass_ = vtx_mass; n_vtx_trks_ = n_vtx_trks; n_sel_tracks_ = n_sel_tracks; h_3d_ip_distance_ = h_3d_ip_distance; h_3d_ip_error_ = h_3d_ip_error; h_3d_ip_sig_ = h_3d_ip_sig; - n_pixel_hits_ = n_pixel_hits; n_total_hits_ = n_total_hits; + // n_pixel_hits_ = n_pixel_hits; n_total_hits_ = n_total_hits; }; @@ -145,23 +149,23 @@ class BTVHLTOfflineSource : public DQMEDAnalyzer { { } - MonitorElement * getMEhisto_CSV() { return CSV_;} - MonitorElement * getMEhisto_Pt() { return Pt_; } - MonitorElement * getMEhisto_Eta() { return Eta_;} - MonitorElement * getMEhisto_CSV_RECOvsHLT() { return CSV_RECOvsHLT_;} - MonitorElement * getMEhisto_PVz() { return PVz_;} - MonitorElement * getMEhisto_fastPVz() { return fastPVz_;} + MonitorElement * getMEhisto_Discr() { return Discr_;} + MonitorElement * getMEhisto_Pt() { return Pt_; } + MonitorElement * getMEhisto_Eta() { return Eta_;} + MonitorElement * getMEhisto_Discr_HLTvsRECO() { return Discr_HLTvsRECO_;} + MonitorElement * getMEhisto_PVz() { return PVz_;} + MonitorElement * getMEhisto_fastPVz() { return fastPVz_;} MonitorElement * getMEhisto_PVz_HLTMinusRECO() { return PVz_HLTMinusRECO_;} MonitorElement * getMEhisto_fastPVz_HLTMinusRECO() { return fastPVz_HLTMinusRECO_;} - MonitorElement * getMEhisto_n_vtx() { return n_vtx_; } - MonitorElement * getMEhisto_vtx_mass() { return vtx_mass_; } - MonitorElement * getMEhisto_n_vtx_trks() { return n_vtx_trks_; } - MonitorElement * getMEhisto_n_sel_tracks() { return n_sel_tracks_; } - MonitorElement * getMEhisto_h_3d_ip_distance() { return h_3d_ip_distance_; } - MonitorElement * getMEhisto_h_3d_ip_error() { return h_3d_ip_error_; } - MonitorElement * getMEhisto_h_3d_ip_sig() { return h_3d_ip_sig_; } - MonitorElement * getMEhisto_n_pixel_hits() { return n_pixel_hits_; } - MonitorElement * getMEhisto_n_total_hits() { return n_total_hits_; } + MonitorElement * getMEhisto_n_vtx() { return n_vtx_; } + MonitorElement * getMEhisto_vtx_mass() { return vtx_mass_; } + MonitorElement * getMEhisto_n_vtx_trks() { return n_vtx_trks_; } + MonitorElement * getMEhisto_n_sel_tracks() { return n_sel_tracks_; } + MonitorElement * getMEhisto_h_3d_ip_distance() { return h_3d_ip_distance_; } + MonitorElement * getMEhisto_h_3d_ip_error() { return h_3d_ip_error_; } + MonitorElement * getMEhisto_h_3d_ip_sig() { return h_3d_ip_sig_; } + // MonitorElement * getMEhisto_n_pixel_hits() { return n_pixel_hits_; } + // MonitorElement * getMEhisto_n_total_hits() { return n_total_hits_; } const std::string getLabel( ) const { return filterName_; @@ -203,10 +207,14 @@ class BTVHLTOfflineSource : public DQMEDAnalyzer { int objectType_; std::string triggerType_; - MonitorElement* CSV_; + MonitorElement* Discr_; MonitorElement* Pt_; MonitorElement* Eta_; - MonitorElement* CSV_RECOvsHLT_; + MonitorElement* Discr_HLTvsRECO_; + MonitorElement* Discr_HLTMinusRECO_; + MonitorElement* Discr_turnon_low_; + MonitorElement* Discr_turnon_medium_; + MonitorElement* Discr_turnon_tight_; MonitorElement* PVz_; MonitorElement* fastPVz_; MonitorElement* PVz_HLTMinusRECO_; @@ -218,8 +226,8 @@ class BTVHLTOfflineSource : public DQMEDAnalyzer { MonitorElement* h_3d_ip_distance_; MonitorElement* h_3d_ip_error_; MonitorElement* h_3d_ip_sig_; - MonitorElement* n_pixel_hits_; - MonitorElement* n_total_hits_; + // MonitorElement* n_pixel_hits_; + // MonitorElement* n_total_hits_; }; diff --git a/DQMOffline/Trigger/python/BTVHLTOfflineSource_cfi.py b/DQMOffline/Trigger/python/BTVHLTOfflineSource_cfi.py index 10028cdc40769..71982585c2ed8 100644 --- a/DQMOffline/Trigger/python/BTVHLTOfflineSource_cfi.py +++ b/DQMOffline/Trigger/python/BTVHLTOfflineSource_cfi.py @@ -3,19 +3,21 @@ BTVHLTOfflineSource = cms.EDAnalyzer( "BTVHLTOfflineSource", # - dirname = cms.untracked.string("HLT/BTV"), - processname = cms.string("HLT"), - verbose = cms.untracked.bool(False), + dirname = cms.untracked.string("HLT/BTV"), + processname = cms.string("HLT"), + verbose = cms.untracked.bool(False), # - triggerSummaryLabel = cms.InputTag("hltTriggerSummaryAOD","","HLT"), - triggerResultsLabel = cms.InputTag("TriggerResults","","HLT"), - offlineCSVLabelPF = cms.InputTag("pfCombinedInclusiveSecondaryVertexV2BJetTags"), - offlineCSVLabelCalo = cms.InputTag("pfCombinedInclusiveSecondaryVertexV2BJetTags"), - hltFastPVLabel = cms.InputTag("hltFastPrimaryVertex"), - hltPFPVLabel = cms.InputTag("hltVerticesPFSelector"), - hltCaloPVLabel = cms.InputTag("hltVerticesL3"), - offlinePVLabel = cms.InputTag("offlinePrimaryVertices"), - + triggerSummaryLabel = cms.InputTag("hltTriggerSummaryAOD","","HLT"), + triggerResultsLabel = cms.InputTag("TriggerResults","","HLT"), + offlineDiscrLabelPF = cms.InputTag("pfDeepCSVJetTags", "probb"), + offlineDiscrLabelCalo = cms.InputTag("pfDeepCSVJetTags", "probb"), + hltFastPVLabel = cms.InputTag("hltFastPrimaryVertex"), + hltPFPVLabel = cms.InputTag("hltVerticesPFSelector"), + hltCaloPVLabel = cms.InputTag("hltVerticesL3"), + offlinePVLabel = cms.InputTag("offlinePrimaryVertices"), + turnon_threshold_low = cms.float32(0.2), + turnon_threshold_medium = cms.float32(0.5), + turnon_threshold_high = cms.float32(0.8), # pathPairs = cms.VPSet( cms.PSet( diff --git a/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc b/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc index 102af472b32c8..1856eaa35d0f1 100644 --- a/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc +++ b/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc @@ -40,29 +40,32 @@ BTVHLTOfflineSource::BTVHLTOfflineSource(const edm::ParameterSet& iConfig) { LogDebug("BTVHLTOfflineSource") << "constructor...."; - dirname_ = iConfig.getUntrackedParameter("dirname",std::string("HLT/BTV/")); - processname_ = iConfig.getParameter("processname"); - verbose_ = iConfig.getUntrackedParameter< bool >("verbose", false); - triggerSummaryLabel_ = iConfig.getParameter("triggerSummaryLabel"); - triggerResultsLabel_ = iConfig.getParameter("triggerResultsLabel"); - triggerSummaryToken = consumes (triggerSummaryLabel_); - triggerResultsToken = consumes (triggerResultsLabel_); - triggerSummaryFUToken = consumes (edm::InputTag(triggerSummaryLabel_.label(),triggerSummaryLabel_.instance(),std::string("FU"))); - triggerResultsFUToken = consumes (edm::InputTag(triggerResultsLabel_.label(),triggerResultsLabel_.instance(),std::string("FU"))); + dirname_ = iConfig.getUntrackedParameter("dirname",std::string("HLT/BTV/")); + processname_ = iConfig.getParameter("processname"); + verbose_ = iConfig.getUntrackedParameter< bool >("verbose", false); + triggerSummaryLabel_ = iConfig.getParameter("triggerSummaryLabel"); + triggerResultsLabel_ = iConfig.getParameter("triggerResultsLabel"); + turnon_threshold_low_ = iConfig.getParameter("turnon_threshold_low"); + turnon_threshold_medium_ = iConfig.getParameter("turnon_threshold_medium"); + turnon_threshold_high_ = iConfig.getParameter("turnon_threshold_high"); + triggerSummaryToken = consumes (triggerSummaryLabel_); + triggerResultsToken = consumes (triggerResultsLabel_); + triggerSummaryFUToken = consumes (edm::InputTag(triggerSummaryLabel_.label(),triggerSummaryLabel_.instance(),std::string("FU"))); + triggerResultsFUToken = consumes (edm::InputTag(triggerResultsLabel_.label(),triggerResultsLabel_.instance(),std::string("FU"))); shallowTagInfosTokenCalo_ = consumes > (edm::InputTag("hltDeepCombinedSecondaryVertexBJetTagsInfosCalo")); shallowTagInfosTokenPf_ = consumes > (edm::InputTag("hltDeepCombinedSecondaryVertexBJetTagsInfos")); - csvCaloTagInfosToken_ = consumes,reco::Track,edm::refhelper::FindUsingAdvance,reco::Track> >,reco::JTATagInfo>,reco::Vertex> > > ( - edm::InputTag("hltInclusiveSecondaryVertexFinderTagInfos")); - csvPfTagInfosToken_ = consumes,reco::Track,edm::refhelper::FindUsingAdvance,reco::Track> >,reco::JTATagInfo>,reco::Vertex> > > ( - edm::InputTag("hltSecondaryVertexTagInfosPF")); - csvCaloTagsToken_ = consumes (edm::InputTag("hltCombinedSecondaryVertexBJetTagsCalo")); - csvPfTagsToken_ = consumes (edm::InputTag("hltCombinedSecondaryVertexBJetTagsPF")); - offlineCSVTokenPF_ = consumes (iConfig.getParameter("offlineCSVLabelPF")); - offlineCSVTokenCalo_ = consumes (iConfig.getParameter("offlineCSVLabelCalo")); - hltFastPVToken_ = consumes > (iConfig.getParameter("hltFastPVLabel")); - hltPFPVToken_ = consumes > (iConfig.getParameter("hltPFPVLabel")); - hltCaloPVToken_ = consumes > (iConfig.getParameter("hltCaloPVLabel")); - offlinePVToken_ = consumes > (iConfig.getParameter("offlinePVLabel")); + // caloTagInfosToken_ = consumes,reco::Track,edm::refhelper::FindUsingAdvance,reco::Track> >,reco::JTATagInfo>,reco::Vertex> > > ( + // edm::InputTag("hltCombinedSecondaryVertexBJetTagsCalo")); + // pfTagInfosToken_ = consumes,reco::Track,edm::refhelper::FindUsingAdvance,reco::Track> >,reco::JTATagInfo>,reco::Vertex> > > ( + // edm::InputTag("hltCombinedSecondaryVertexBJetTagsPF")); + caloTagsToken_ = consumes (edm::InputTag("hltDeepCombinedSecondaryVertexBJetTagsCalo", "probb")); + pfTagsToken_ = consumes (edm::InputTag("hltDeepCombinedSecondaryVertexBJetTagsPF", "probb")); + offlineDiscrTokenPF_ = consumes (iConfig.getParameter("offlineDiscrLabelPF")); + offlineDiscrTokenCalo_ = consumes (iConfig.getParameter("offlineDiscrLabelCalo")); + hltFastPVToken_ = consumes > (iConfig.getParameter("hltFastPVLabel")); + hltPFPVToken_ = consumes > (iConfig.getParameter("hltPFPVLabel")); + hltCaloPVToken_ = consumes > (iConfig.getParameter("hltCaloPVLabel")); + offlinePVToken_ = consumes > (iConfig.getParameter("offlinePVLabel")); std::vector paths = iConfig.getParameter >("pathPairs"); for(auto & path : paths) { @@ -127,16 +130,16 @@ BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iS } } - iEvent.getByToken(csvCaloTagsToken_, csvCaloTags); - iEvent.getByToken(csvPfTagsToken_, csvPfTags); + iEvent.getByToken(caloTagsToken_, caloTags); + iEvent.getByToken(pfTagsToken_, pfTags); Handle VertexHandler; Handle offlineJetTagHandlerPF; - iEvent.getByToken(offlineCSVTokenPF_, offlineJetTagHandlerPF); + iEvent.getByToken(offlineDiscrTokenPF_, offlineJetTagHandlerPF); Handle offlineJetTagHandlerCalo; - iEvent.getByToken(offlineCSVTokenCalo_, offlineJetTagHandlerCalo); + iEvent.getByToken(offlineDiscrTokenCalo_, offlineJetTagHandlerCalo); Handle offlineVertexHandler; iEvent.getByToken(offlinePVToken_, offlineVertexHandler); @@ -152,25 +155,25 @@ BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iS float DR = 9999.; // PF btagging - if (csvPfTags.isValid() && v.getTriggerType() == "PF") + if (pfTags.isValid() && v.getTriggerType() == "PF") { - auto iter = csvPfTags->begin(); + auto iter = pfTags->begin(); - float CSV_online = iter->second; - if (CSV_online<0) CSV_online = -0.05; + float Discr_online = iter->second; + if (Discr_online<0) Discr_online = -0.05; - v.getMEhisto_CSV()->Fill(CSV_online); + v.getMEhisto_Discr()->Fill(Discr_online); v.getMEhisto_Pt()->Fill(iter->first->pt()); v.getMEhisto_Eta()->Fill(iter->first->eta()); DR = 9999.; if(offlineJetTagHandlerPF.isValid()){ for (auto const & iterO : *offlineJetTagHandlerPF){ - float CSV_offline = iterO.second; - if (CSV_offline<0) CSV_offline = -0.05; + float Discr_offline = iterO.second; + if (Discr_offline<0) Discr_offline = -0.05; DR = reco::deltaR(iterO.first->eta(),iterO.first->phi(),iter->first->eta(),iter->first->phi()); if (DR<0.3) { - v.getMEhisto_CSV_RECOvsHLT()->Fill(CSV_offline,CSV_online); continue; + v.getMEhisto_Discr_HLTvsRECO()->Fill(Discr_online,Discr_offline); continue; } } } @@ -185,15 +188,15 @@ BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iS // Calo b-tagging - if (csvCaloTags.isValid() && v.getTriggerType() == "Calo" && !csvCaloTags->empty()) + if (caloTags.isValid() && v.getTriggerType() == "Calo" && !caloTags->empty()) { - auto iter = csvCaloTags->begin(); + auto iter = caloTags->begin(); - float CSV_online = iter->second; - if (CSV_online<0) CSV_online = -0.05; + float Discr_online = iter->second; + if (Discr_online<0) Discr_online = -0.05; - v.getMEhisto_CSV()->Fill(CSV_online); + v.getMEhisto_Discr()->Fill(Discr_online); v.getMEhisto_Pt()->Fill(iter->first->pt()); v.getMEhisto_Eta()->Fill(iter->first->eta()); @@ -201,12 +204,12 @@ BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iS if(offlineJetTagHandlerCalo.isValid()){ for (auto const & iterO : *offlineJetTagHandlerCalo) { - float CSV_offline = iterO.second; - if (CSV_offline<0) CSV_offline = -0.05; + float Discr_offline = iterO.second; + if (Discr_offline<0) Discr_offline = -0.05; DR = reco::deltaR(iterO.first->eta(),iterO.first->phi(),iter->first->eta(),iter->first->phi()); if (DR<0.3) { - v.getMEhisto_CSV_RECOvsHLT()->Fill(CSV_offline,CSV_online); continue; + v.getMEhisto_Discr_HLTvsRECO()->Fill(Discr_online,Discr_offline); continue; } } } @@ -231,9 +234,9 @@ BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iS ///////////////////////////////////////////// iEvent.getByToken(shallowTagInfosTokenPf_, shallowTagInfosPf); - iEvent.getByToken(csvPfTagInfosToken_, csvPfTagInfos); iEvent.getByToken(shallowTagInfosTokenCalo_, shallowTagInfosCalo); - iEvent.getByToken(csvCaloTagInfosToken_, csvCaloTagInfos); + // iEvent.getByToken(pfTagInfosToken_, pfTagInfos); + // iEvent.getByToken(caloTagInfosToken_, caloTagInfos); // first try to get info from shallowTagInfos ... if ( (v.getTriggerType() == "PF" && shallowTagInfosPf.isValid()) @@ -265,52 +268,51 @@ BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iS for (const auto & tagVar : tagVars.getList(reco::btau::vertexMass, false)) { v.getMEhisto_vtx_mass()->Fill(tagVar);} for (const auto & tagVar : tagVars.getList(reco::btau::vertexNTracks, false)) { - if (tagVar > 0.) { - v.getMEhisto_n_vtx_trks()->Fill(tagVar);}} - - // track N total/pixel hits - for (const auto & tagVar : tagVars.getList(reco::btau::trackNPixelHits, false)) { - v.getMEhisto_n_pixel_hits()->Fill(tagVar);} - for (const auto & tagVar : tagVars.getList(reco::btau::trackNTotalHits, false)) { - v.getMEhisto_n_total_hits()->Fill(tagVar);} + v.getMEhisto_n_vtx_trks()->Fill(tagVar);} + + // // track N total/pixel hits + // for (const auto & tagVar : tagVars.getList(reco::btau::trackNPixelHits, false)) { + // v.getMEhisto_n_pixel_hits()->Fill(tagVar);} + // for (const auto & tagVar : tagVars.getList(reco::btau::trackNTotalHits, false)) { + // v.getMEhisto_n_total_hits()->Fill(tagVar);} } } // ... otherwise from usual tag infos. - else - if ( (v.getTriggerType() == "PF" && csvPfTagInfos.isValid()) - || (v.getTriggerType() == "Calo" && csvCaloTagInfos.isValid()) ) - { - const auto & csvTagInfoCollection = (v.getTriggerType() == "PF") ? csvPfTagInfos : csvCaloTagInfos; - - // loop over secondary vertex tag infos - for (const auto & csvTagInfo : *csvTagInfoCollection) { - v.getMEhisto_n_vtx()->Fill(csvTagInfo.nVertexCandidates()); - v.getMEhisto_n_sel_tracks()->Fill(csvTagInfo.nSelectedTracks()); - - // loop over selected tracks in each tag info - for (unsigned i_trk=0; i_trk < csvTagInfo.nSelectedTracks(); i_trk++) { - const auto & ip3d = csvTagInfo.trackIPData(i_trk).ip3d; - v.getMEhisto_h_3d_ip_distance()->Fill(ip3d.value()); - v.getMEhisto_h_3d_ip_error()->Fill(ip3d.error()); - v.getMEhisto_h_3d_ip_sig()->Fill(ip3d.significance()); - } - - // loop over vertex candidates in each tag info - for (unsigned i_sv=0; i_sv < csvTagInfo.nVertexCandidates(); i_sv++) { - const auto & sv = csvTagInfo.secondaryVertex(i_sv); - v.getMEhisto_vtx_mass()->Fill(sv.p4().mass()); - v.getMEhisto_n_vtx_trks()->Fill(sv.nTracks()); - - // loop over tracks for number of pixel and total hits - const auto & trkIPTagInfo = csvTagInfo.trackIPTagInfoRef().get(); - for (const auto & trk : trkIPTagInfo->selectedTracks()) { - v.getMEhisto_n_pixel_hits()->Fill(trk.get()->hitPattern().numberOfValidPixelHits()); - v.getMEhisto_n_total_hits()->Fill(trk.get()->hitPattern().numberOfValidHits()); - } - } - } - } + // else + // if ( (v.getTriggerType() == "PF" && pfTagInfos.isValid()) + // || (v.getTriggerType() == "Calo" && caloTagInfos.isValid()) ) + // { + // const auto & DiscrTagInfoCollection = (v.getTriggerType() == "PF") ? pfTagInfos : caloTagInfos; + + // // loop over secondary vertex tag infos + // for (const auto & DiscrTagInfo : *DiscrTagInfoCollection) { + // v.getMEhisto_n_vtx()->Fill(DiscrTagInfo.nVertexCandidates()); + // v.getMEhisto_n_sel_tracks()->Fill(DiscrTagInfo.nSelectedTracks()); + + // // loop over selected tracks in each tag info + // for (unsigned i_trk=0; i_trk < DiscrTagInfo.nSelectedTracks(); i_trk++) { + // const auto & ip3d = DiscrTagInfo.trackIPData(i_trk).ip3d; + // v.getMEhisto_h_3d_ip_distance()->Fill(ip3d.value()); + // v.getMEhisto_h_3d_ip_error()->Fill(ip3d.error()); + // v.getMEhisto_h_3d_ip_sig()->Fill(ip3d.significance()); + // } + + // // loop over vertex candidates in each tag info + // for (unsigned i_sv=0; i_sv < DiscrTagInfo.nVertexCandidates(); i_sv++) { + // const auto & sv = DiscrTagInfo.secondaryVertex(i_sv); + // v.getMEhisto_vtx_mass()->Fill(sv.p4().mass()); + // v.getMEhisto_n_vtx_trks()->Fill(sv.nTracks()); + + // // loop over tracks for number of pixel and total hits + // const auto & trkIPTagInfo = DiscrTagInfo.trackIPTagInfoRef().get(); + // for (const auto & trk : trkIPTagInfo->selectedTracks()) { + // v.getMEhisto_n_pixel_hits()->Fill(trk.get()->hitPattern().numberOfValidPixelHits()); + // v.getMEhisto_n_total_hits()->Fill(trk.get()->hitPattern().numberOfValidHits()); + // } + // } + // } + // } } } @@ -331,9 +333,9 @@ BTVHLTOfflineSource::bookHistograms(DQMStore::IBooker & iBooker, edm::Run const std::string histoname(labelname+""); std::string title(labelname+""); - histoname = labelname+"_CSV"; - title = labelname+"_CSV "+trigPath; - MonitorElement * CSV = iBooker.book1D(histoname.c_str(),title.c_str(),110,-0.1,1); + histoname = labelname+"_Discr"; + title = labelname+"_Discr "+trigPath; + MonitorElement * Discr = iBooker.book1D(histoname.c_str(),title.c_str(),110,-0.1,1); histoname = labelname+"_Pt"; title = labelname+"_Pt "+trigPath; @@ -343,9 +345,9 @@ BTVHLTOfflineSource::bookHistograms(DQMStore::IBooker & iBooker, edm::Run const title = labelname+"_Eta "+trigPath; MonitorElement * Eta = iBooker.book1D(histoname.c_str(),title.c_str(),60,-3.0,3.0); - histoname = "RECOvsHLT_CSV"; - title = "offline CSV vs online CSV "+trigPath; - MonitorElement * CSV_RECOvsHLT = iBooker.book2D(histoname.c_str(),title.c_str(),110,-0.1,1,110,-0.1,1); + histoname = "HLTvsRECO_Discr"; + title = "online Discr vs offline Discr "+trigPath; + MonitorElement * Discr_HLTvsRECO = iBooker.book2D(histoname.c_str(),title.c_str(),110,-0.1,1,110,-0.1,1); histoname = labelname+"_PVz"; title = "online z(PV) "+trigPath; @@ -391,18 +393,18 @@ BTVHLTOfflineSource::bookHistograms(DQMStore::IBooker & iBooker, edm::Run const title = "3D IP significance of tracks (cm)"+trigPath; MonitorElement * h_3d_ip_sig = iBooker.book1D(histoname.c_str(), title.c_str(), 40, -40, 40); - histoname = "n_pixel_hits"; - title = "N pixel hits"+trigPath; - MonitorElement * n_pixel_hits = iBooker.book1D(histoname.c_str(), title.c_str(), 16, -0.5, 15.5); + // histoname = "n_pixel_hits"; + // title = "N pixel hits"+trigPath; + // MonitorElement * n_pixel_hits = iBooker.book1D(histoname.c_str(), title.c_str(), 16, -0.5, 15.5); - histoname = "n_total_hits"; - title = "N hits"+trigPath; - MonitorElement * n_total_hits = iBooker.book1D(histoname.c_str(), title.c_str(), 40, -0.5, 39.5); + // histoname = "n_total_hits"; + // title = "N hits"+trigPath; + // MonitorElement * n_total_hits = iBooker.book1D(histoname.c_str(), title.c_str(), 40, -0.5, 39.5); v.setHistos( - CSV,Pt,Eta,CSV_RECOvsHLT,PVz,fastPVz,PVz_HLTMinusRECO,fastPVz_HLTMinusRECO, - n_vtx, vtx_mass, n_vtx_trks, n_sel_tracks, h_3d_ip_distance, h_3d_ip_error, h_3d_ip_sig, n_pixel_hits, n_total_hits + Discr, Pt, Eta, Discr_HLTvsRECO, PVz, fastPVz, PVz_HLTMinusRECO, fastPVz_HLTMinusRECO, + n_vtx, vtx_mass, n_vtx_trks, n_sel_tracks, h_3d_ip_distance, h_3d_ip_error, h_3d_ip_sig // , n_pixel_hits, n_total_hits ); } } From 199b8d5e4b89b7a361d33e25f83b58585d0349b4 Mon Sep 17 00:00:00 2001 From: Andrew Brinkerhoff Date: Wed, 4 Apr 2018 15:32:32 +0200 Subject: [PATCH 336/426] EMTF applied code style patch to EMTFGEMDetId.h --- L1Trigger/L1TMuonEndCap/interface/EMTFGEMDetId.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/L1Trigger/L1TMuonEndCap/interface/EMTFGEMDetId.h b/L1Trigger/L1TMuonEndCap/interface/EMTFGEMDetId.h index 0ec50a2eee430..61cda46ed156c 100644 --- a/L1Trigger/L1TMuonEndCap/interface/EMTFGEMDetId.h +++ b/L1Trigger/L1TMuonEndCap/interface/EMTFGEMDetId.h @@ -4,7 +4,7 @@ #include "DataFormats/MuonDetId/interface/GEMDetId.h" #include "DataFormats/MuonDetId/interface/ME0DetId.h" -#include +#include #include From 84c9b51f150b8c2e1c325ca2114461d6b557758d Mon Sep 17 00:00:00 2001 From: Heiner Tholen Date: Wed, 4 Apr 2018 15:58:38 +0200 Subject: [PATCH 337/426] whitespace / remove code duplication --- .../Trigger/python/BTVHLTOfflineSource_cfi.py | 2 + DQMOffline/Trigger/src/BTVHLTOfflineSource.cc | 255 ++++++++---------- 2 files changed, 117 insertions(+), 140 deletions(-) diff --git a/DQMOffline/Trigger/python/BTVHLTOfflineSource_cfi.py b/DQMOffline/Trigger/python/BTVHLTOfflineSource_cfi.py index 71982585c2ed8..b7744d8190ea8 100644 --- a/DQMOffline/Trigger/python/BTVHLTOfflineSource_cfi.py +++ b/DQMOffline/Trigger/python/BTVHLTOfflineSource_cfi.py @@ -9,6 +9,8 @@ # triggerSummaryLabel = cms.InputTag("hltTriggerSummaryAOD","","HLT"), triggerResultsLabel = cms.InputTag("TriggerResults","","HLT"), + onlineDiscrLabelPF = cms.InputTag("hltDeepCombinedSecondaryVertexBJetTagsPF", "probb"), + onlineDiscrLabelCalo = cms.InputTag("hltDeepCombinedSecondaryVertexBJetTagsCalo", "probb"), offlineDiscrLabelPF = cms.InputTag("pfDeepCSVJetTags", "probb"), offlineDiscrLabelCalo = cms.InputTag("pfDeepCSVJetTags", "probb"), hltFastPVLabel = cms.InputTag("hltFastPrimaryVertex"), diff --git a/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc b/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc index 1856eaa35d0f1..2625c579f71b2 100644 --- a/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc +++ b/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc @@ -58,8 +58,8 @@ BTVHLTOfflineSource::BTVHLTOfflineSource(const edm::ParameterSet& iConfig) // edm::InputTag("hltCombinedSecondaryVertexBJetTagsCalo")); // pfTagInfosToken_ = consumes,reco::Track,edm::refhelper::FindUsingAdvance,reco::Track> >,reco::JTATagInfo>,reco::Vertex> > > ( // edm::InputTag("hltCombinedSecondaryVertexBJetTagsPF")); - caloTagsToken_ = consumes (edm::InputTag("hltDeepCombinedSecondaryVertexBJetTagsCalo", "probb")); - pfTagsToken_ = consumes (edm::InputTag("hltDeepCombinedSecondaryVertexBJetTagsPF", "probb")); + pfTagsToken_ = consumes (iConfig.getParameter("onlineDiscrLabelPF")); + caloTagsToken_ = consumes (iConfig.getParameter("onlineDiscrLabelCalo")); offlineDiscrTokenPF_ = consumes (iConfig.getParameter("offlineDiscrLabelPF")); offlineDiscrTokenCalo_ = consumes (iConfig.getParameter("offlineDiscrLabelCalo")); hltFastPVToken_ = consumes > (iConfig.getParameter("hltFastPVLabel")); @@ -149,15 +149,20 @@ BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iS if(!triggerResults_.isValid()) return; - for(auto & v : hltPathsAll_){ + for(auto & v : hltPathsAll_) { unsigned index = triggerNames_.triggerIndex(v.getPath()); - if (index < triggerNames_.size() ){ - float DR = 9999.; + if (index >= triggerNames_.size()) { + continue; + } + + float DR = 9999.; // PF btagging - if (pfTags.isValid() && v.getTriggerType() == "PF") - { - auto iter = pfTags->begin(); + if ( ( pfTags.isValid() && v.getTriggerType() == "PF") + || (caloTags.isValid() && v.getTriggerType() == "Calo" && !caloTags->empty()) ) + { + const auto & iter = (v.getTriggerType() == "PF") ? pfTags->begin() : caloTags->begin(); + const auto & offlineJetTagHandler = (v.getTriggerType() == "PF") ? offlineJetTagHandlerPF : offlineJetTagHandlerCalo; float Discr_online = iter->second; if (Discr_online<0) Discr_online = -0.05; @@ -167,155 +172,125 @@ BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iS v.getMEhisto_Eta()->Fill(iter->first->eta()); DR = 9999.; - if(offlineJetTagHandlerPF.isValid()){ - for (auto const & iterO : *offlineJetTagHandlerPF){ + if(offlineJetTagHandler.isValid()){ + for (auto const & iterO : *offlineJetTagHandler){ float Discr_offline = iterO.second; if (Discr_offline<0) Discr_offline = -0.05; DR = reco::deltaR(iterO.first->eta(),iterO.first->phi(),iter->first->eta(),iter->first->phi()); if (DR<0.3) { - v.getMEhisto_Discr_HLTvsRECO()->Fill(Discr_online,Discr_offline); continue; - } + v.getMEhisto_Discr_HLTvsRECO()->Fill(Discr_online,Discr_offline); continue; + } } } - iEvent.getByToken(hltPFPVToken_, VertexHandler); - if (VertexHandler.isValid()) - { + if (v.getTriggerType() == "PF") { + iEvent.getByToken(hltPFPVToken_, VertexHandler); + } else { + iEvent.getByToken(hltFastPVToken_, VertexHandler); + } + if (VertexHandler.isValid()) { v.getMEhisto_PVz()->Fill(VertexHandler->begin()->z()); - if (offlineVertexHandler.isValid()) v.getMEhisto_PVz_HLTMinusRECO()->Fill(VertexHandler->begin()->z()-offlineVertexHandler->begin()->z()); + if (offlineVertexHandler.isValid()) { + v.getMEhisto_PVz_HLTMinusRECO()->Fill(VertexHandler->begin()->z()-offlineVertexHandler->begin()->z()); } } + } - - // Calo b-tagging - if (caloTags.isValid() && v.getTriggerType() == "Calo" && !caloTags->empty()) - { - - auto iter = caloTags->begin(); - - float Discr_online = iter->second; - if (Discr_online<0) Discr_online = -0.05; - - v.getMEhisto_Discr()->Fill(Discr_online); - v.getMEhisto_Pt()->Fill(iter->first->pt()); - v.getMEhisto_Eta()->Fill(iter->first->eta()); - - DR = 9999.; - if(offlineJetTagHandlerCalo.isValid()){ - for (auto const & iterO : *offlineJetTagHandlerCalo) - { - float Discr_offline = iterO.second; - if (Discr_offline<0) Discr_offline = -0.05; - DR = reco::deltaR(iterO.first->eta(),iterO.first->phi(),iter->first->eta(),iter->first->phi()); - if (DR<0.3) - { - v.getMEhisto_Discr_HLTvsRECO()->Fill(Discr_online,Discr_offline); continue; - } - } - } - - iEvent.getByToken(hltFastPVToken_, VertexHandler); - if (VertexHandler.isValid()) - { - v.getMEhisto_PVz()->Fill(VertexHandler->begin()->z()); - if (offlineVertexHandler.isValid()) v.getMEhisto_fastPVz_HLTMinusRECO()->Fill(VertexHandler->begin()->z()-offlineVertexHandler->begin()->z()); - } - + // specific to Calo b-tagging + if (caloTags.isValid() && v.getTriggerType() == "Calo" && !caloTags->empty()) { iEvent.getByToken(hltCaloPVToken_, VertexHandler); - if (VertexHandler.isValid()) - { + if (VertexHandler.isValid()) { v.getMEhisto_fastPVz()->Fill(VertexHandler->begin()->z()); - if (offlineVertexHandler.isValid()) v.getMEhisto_PVz_HLTMinusRECO()->Fill(VertexHandler->begin()->z()-offlineVertexHandler->begin()->z()); - } - - } - - // additional plots from tag info collections - ///////////////////////////////////////////// - - iEvent.getByToken(shallowTagInfosTokenPf_, shallowTagInfosPf); - iEvent.getByToken(shallowTagInfosTokenCalo_, shallowTagInfosCalo); - // iEvent.getByToken(pfTagInfosToken_, pfTagInfos); - // iEvent.getByToken(caloTagInfosToken_, caloTagInfos); - - // first try to get info from shallowTagInfos ... - if ( (v.getTriggerType() == "PF" && shallowTagInfosPf.isValid()) - || (v.getTriggerType() == "Calo" && shallowTagInfosCalo.isValid()) ) - { - const auto & shallowTagInfoCollection = (v.getTriggerType() == "PF") ? shallowTagInfosPf : shallowTagInfosCalo; - for (const auto & shallowTagInfo : *shallowTagInfoCollection) { - const auto & tagVars = shallowTagInfo.taggingVariables(); - - // n secondary vertices and n selected tracks - for (const auto & tagVar : tagVars.getList(reco::btau::jetNSecondaryVertices, false)) { - v.getMEhisto_n_vtx()->Fill(tagVar); - } - for (const auto & tagVar : tagVars.getList(reco::btau::jetNSelectedTracks, false)) { - v.getMEhisto_n_sel_tracks()->Fill(tagVar);} - - // impact parameter - const auto & trackSip3dVal = tagVars.getList(reco::btau::trackSip3dVal, false); - const auto & trackSip3dSig = tagVars.getList(reco::btau::trackSip3dSig, false); - for (unsigned i_trk=0; i_trk < trackSip3dVal.size(); i_trk++) { - float val = trackSip3dVal[i_trk]; - float sig = trackSip3dSig[i_trk]; - v.getMEhisto_h_3d_ip_distance()->Fill(val); - v.getMEhisto_h_3d_ip_error()->Fill(val/sig); - v.getMEhisto_h_3d_ip_sig()->Fill(sig); - } - - // vertex mass and tracks per vertex - for (const auto & tagVar : tagVars.getList(reco::btau::vertexMass, false)) { - v.getMEhisto_vtx_mass()->Fill(tagVar);} - for (const auto & tagVar : tagVars.getList(reco::btau::vertexNTracks, false)) { - v.getMEhisto_n_vtx_trks()->Fill(tagVar);} - - // // track N total/pixel hits - // for (const auto & tagVar : tagVars.getList(reco::btau::trackNPixelHits, false)) { - // v.getMEhisto_n_pixel_hits()->Fill(tagVar);} - // for (const auto & tagVar : tagVars.getList(reco::btau::trackNTotalHits, false)) { - // v.getMEhisto_n_total_hits()->Fill(tagVar);} + if (offlineVertexHandler.isValid()) { + v.getMEhisto_PVz_HLTMinusRECO()->Fill(VertexHandler->begin()->z()-offlineVertexHandler->begin()->z()); } } + } - // ... otherwise from usual tag infos. - // else - // if ( (v.getTriggerType() == "PF" && pfTagInfos.isValid()) - // || (v.getTriggerType() == "Calo" && caloTagInfos.isValid()) ) - // { - // const auto & DiscrTagInfoCollection = (v.getTriggerType() == "PF") ? pfTagInfos : caloTagInfos; - - // // loop over secondary vertex tag infos - // for (const auto & DiscrTagInfo : *DiscrTagInfoCollection) { - // v.getMEhisto_n_vtx()->Fill(DiscrTagInfo.nVertexCandidates()); - // v.getMEhisto_n_sel_tracks()->Fill(DiscrTagInfo.nSelectedTracks()); - - // // loop over selected tracks in each tag info - // for (unsigned i_trk=0; i_trk < DiscrTagInfo.nSelectedTracks(); i_trk++) { - // const auto & ip3d = DiscrTagInfo.trackIPData(i_trk).ip3d; - // v.getMEhisto_h_3d_ip_distance()->Fill(ip3d.value()); - // v.getMEhisto_h_3d_ip_error()->Fill(ip3d.error()); - // v.getMEhisto_h_3d_ip_sig()->Fill(ip3d.significance()); - // } - - // // loop over vertex candidates in each tag info - // for (unsigned i_sv=0; i_sv < DiscrTagInfo.nVertexCandidates(); i_sv++) { - // const auto & sv = DiscrTagInfo.secondaryVertex(i_sv); - // v.getMEhisto_vtx_mass()->Fill(sv.p4().mass()); - // v.getMEhisto_n_vtx_trks()->Fill(sv.nTracks()); - - // // loop over tracks for number of pixel and total hits - // const auto & trkIPTagInfo = DiscrTagInfo.trackIPTagInfoRef().get(); - // for (const auto & trk : trkIPTagInfo->selectedTracks()) { - // v.getMEhisto_n_pixel_hits()->Fill(trk.get()->hitPattern().numberOfValidPixelHits()); - // v.getMEhisto_n_total_hits()->Fill(trk.get()->hitPattern().numberOfValidHits()); - // } - // } - // } - // } + // additional plots from tag info collections + ///////////////////////////////////////////// + + iEvent.getByToken(shallowTagInfosTokenPf_, shallowTagInfosPf); + iEvent.getByToken(shallowTagInfosTokenCalo_, shallowTagInfosCalo); + // iEvent.getByToken(pfTagInfosToken_, pfTagInfos); + // iEvent.getByToken(caloTagInfosToken_, caloTagInfos); + + // first try to get info from shallowTagInfos ... + if ( (v.getTriggerType() == "PF" && shallowTagInfosPf.isValid()) + || (v.getTriggerType() == "Calo" && shallowTagInfosCalo.isValid()) ) + { + const auto & shallowTagInfoCollection = (v.getTriggerType() == "PF") ? shallowTagInfosPf : shallowTagInfosCalo; + for (const auto & shallowTagInfo : *shallowTagInfoCollection) { + const auto & tagVars = shallowTagInfo.taggingVariables(); + + // n secondary vertices and n selected tracks + for (const auto & tagVar : tagVars.getList(reco::btau::jetNSecondaryVertices, false)) { + v.getMEhisto_n_vtx()->Fill(tagVar); + } + for (const auto & tagVar : tagVars.getList(reco::btau::jetNSelectedTracks, false)) { + v.getMEhisto_n_sel_tracks()->Fill(tagVar);} + + // impact parameter + const auto & trackSip3dVal = tagVars.getList(reco::btau::trackSip3dVal, false); + const auto & trackSip3dSig = tagVars.getList(reco::btau::trackSip3dSig, false); + for (unsigned i_trk=0; i_trk < trackSip3dVal.size(); i_trk++) { + float val = trackSip3dVal[i_trk]; + float sig = trackSip3dSig[i_trk]; + v.getMEhisto_h_3d_ip_distance()->Fill(val); + v.getMEhisto_h_3d_ip_error()->Fill(val/sig); + v.getMEhisto_h_3d_ip_sig()->Fill(sig); + } + // vertex mass and tracks per vertex + for (const auto & tagVar : tagVars.getList(reco::btau::vertexMass, false)) { + v.getMEhisto_vtx_mass()->Fill(tagVar);} + for (const auto & tagVar : tagVars.getList(reco::btau::vertexNTracks, false)) { + v.getMEhisto_n_vtx_trks()->Fill(tagVar);} + + // // track N total/pixel hits + // for (const auto & tagVar : tagVars.getList(reco::btau::trackNPixelHits, false)) { + // v.getMEhisto_n_pixel_hits()->Fill(tagVar);} + // for (const auto & tagVar : tagVars.getList(reco::btau::trackNTotalHits, false)) { + // v.getMEhisto_n_total_hits()->Fill(tagVar);} + } } - } + + // ... otherwise from usual tag infos. + // else + // if ( (v.getTriggerType() == "PF" && pfTagInfos.isValid()) + // || (v.getTriggerType() == "Calo" && caloTagInfos.isValid()) ) + // { + // const auto & DiscrTagInfoCollection = (v.getTriggerType() == "PF") ? pfTagInfos : caloTagInfos; + + // // loop over secondary vertex tag infos + // for (const auto & DiscrTagInfo : *DiscrTagInfoCollection) { + // v.getMEhisto_n_vtx()->Fill(DiscrTagInfo.nVertexCandidates()); + // v.getMEhisto_n_sel_tracks()->Fill(DiscrTagInfo.nSelectedTracks()); + + // // loop over selected tracks in each tag info + // for (unsigned i_trk=0; i_trk < DiscrTagInfo.nSelectedTracks(); i_trk++) { + // const auto & ip3d = DiscrTagInfo.trackIPData(i_trk).ip3d; + // v.getMEhisto_h_3d_ip_distance()->Fill(ip3d.value()); + // v.getMEhisto_h_3d_ip_error()->Fill(ip3d.error()); + // v.getMEhisto_h_3d_ip_sig()->Fill(ip3d.significance()); + // } + + // // loop over vertex candidates in each tag info + // for (unsigned i_sv=0; i_sv < DiscrTagInfo.nVertexCandidates(); i_sv++) { + // const auto & sv = DiscrTagInfo.secondaryVertex(i_sv); + // v.getMEhisto_vtx_mass()->Fill(sv.p4().mass()); + // v.getMEhisto_n_vtx_trks()->Fill(sv.nTracks()); + + // // loop over tracks for number of pixel and total hits + // const auto & trkIPTagInfo = DiscrTagInfo.trackIPTagInfoRef().get(); + // for (const auto & trk : trkIPTagInfo->selectedTracks()) { + // v.getMEhisto_n_pixel_hits()->Fill(trk.get()->hitPattern().numberOfValidPixelHits()); + // v.getMEhisto_n_total_hits()->Fill(trk.get()->hitPattern().numberOfValidHits()); + // } + // } + // } + // } + } } void @@ -346,7 +321,7 @@ BTVHLTOfflineSource::bookHistograms(DQMStore::IBooker & iBooker, edm::Run const MonitorElement * Eta = iBooker.book1D(histoname.c_str(),title.c_str(),60,-3.0,3.0); histoname = "HLTvsRECO_Discr"; - title = "online Discr vs offline Discr "+trigPath; + title = "online discr vs offline discr "+trigPath; MonitorElement * Discr_HLTvsRECO = iBooker.book2D(histoname.c_str(),title.c_str(),110,-0.1,1,110,-0.1,1); histoname = labelname+"_PVz"; From 6ffbcfaa7f8feebcb62454d2a9457f6b550058ef Mon Sep 17 00:00:00 2001 From: mbluj Date: Wed, 4 Apr 2018 16:09:42 +0200 Subject: [PATCH 338/426] New MVA-based Tau-Ids (update) (#146) * Add payloads for tau-Id MVAIso 2017v2 * Add MVAIso tau-Id 2017v2 * Move definitions of new MVA tau-Ids to a specific cff file * Use correct eras, add MVAIso2017v1 * Add cut-based isolation WPs * correct eras, comment out idCombIsodR03 due to incorrect behavior * further era corrections * fix bug in eras handling * add rawIso dR=0.3, remove cut-base WPs and footprintCorr * remove MVAIso oldDM dR=0.3 and newDM with 2015 training * remove instead commenting out * keep all MVAIso 2015 Tau-Ids and remove 2017v1/2 ones for 80X * Add era modifiers to NanoDQM --- PhysicsTools/NanoAOD/python/nanoDQM_cff.py | 20 + PhysicsTools/NanoAOD/python/nanoDQM_cfi.py | 14 +- PhysicsTools/NanoAOD/python/taus_cff.py | 89 +++- .../NanoAOD/python/taus_updatedMVAIds_cff.py | 381 ++++++++++++++++++ .../loadRecoTauTagMVAsFromPrepDB_cfi.py | 69 +++- 5 files changed, 531 insertions(+), 42 deletions(-) create mode 100644 PhysicsTools/NanoAOD/python/taus_updatedMVAIds_cff.py diff --git a/PhysicsTools/NanoAOD/python/nanoDQM_cff.py b/PhysicsTools/NanoAOD/python/nanoDQM_cff.py index 42e6dc4d0212f..e01ad8b4eba44 100644 --- a/PhysicsTools/NanoAOD/python/nanoDQM_cff.py +++ b/PhysicsTools/NanoAOD/python/nanoDQM_cff.py @@ -1,7 +1,27 @@ import FWCore.ParameterSet.Config as cms from PhysicsTools.NanoAOD.nanoDQM_cfi import nanoDQM +from PhysicsTools.NanoAOD.nanoDQM_tools_cff import * +## Modify plots accordingly to era +from Configuration.StandardSequences.Eras import eras +_vplots80X = nanoDQM.vplots.clone() +# Tau plots +_tauPlots80X = cms.VPSet() +for plot in _vplots80X.Tau.plots: + if plot.name.value().find("MVA")>-1 and plot.name.value().find("2017")>-1: + continue + _tauPlots80X.append(plot) +_tauPlots80X.append(Plot1D('idMVAnewDM', 'idMVAnewDM', 64, -0.5, 63.5, 'IsolationMVArun2v1DBnewDMwLT ID working point: bitmask 1 = VLoose, 2 = Loose, 4 = Medium, 8 = Tight, 16 = VTight, 32 = VVTight')) +_tauPlots80X.append(Plot1D('idMVAoldDMdR03', 'idMVAoldDMdR03', 64, -0.5, 63.5, 'IsolationMVArun2v1DBdR03oldDMwLT ID working point: bitmask 1 = VLoose, 2 = Loose, 4 = Medium, 8 = Tight, 16 = VTight, 32 = VVTight')) +_tauPlots80X.append(Plot1D('rawMVAnewDM', 'rawMVAnewDM', 20, -1, 1, 'byIsolationMVArun2v1DBnewDMwLT raw output discriminator')) +_tauPlots80X.append(Plot1D('rawMVAoldDMdR03', 'rawMVAoldDMdR03', 20, -1, 1, 'byIsolationMVArun2v1DBdR03oldDMwLT raw output discriminator')) +_vplots80X.Tau.plots = _tauPlots80X +eras.run2_miniAOD_80XLegacy.toModify(nanoDQM, + vplots = _vplots80X +) + +## MC nanoDQMMC = nanoDQM.clone() nanoDQMMC.vplots.Electron.sels.Prompt = cms.string("genPartFlav == 1") nanoDQMMC.vplots.Muon.sels.Prompt = cms.string("genPartFlav == 1") diff --git a/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py b/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py index 950dd49aadb2a..49aed020d2322 100644 --- a/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py +++ b/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py @@ -440,16 +440,17 @@ Plot1D('dxy', 'dxy', 20, -1000, 1000, 'd_{xy} of lead track with respect to PV, in cm (with sign)'), Plot1D('dz', 'dz', 20, -20, 20, 'd_{z} of lead track with respect to PV, in cm (with sign)'), Plot1D('eta', 'eta', 20, -3, 3, 'eta'), - Plot1D('footprintCorr', 'footprintCorr', 20, 0, 30, 'footprint correction'), Plot1D('genPartFlav', 'genPartFlav', 6, -0.5, 5.5, 'Flavour of genParticle for MC matching to status==2 taus: 1 = prompt electron, 2 = prompt muon, 3 = tau->e decay, 4 = tau->mu decay, 5 = hadronic tau decay, 0 = unknown or unmatched'), NoPlot('genPartIdx'), Plot1D('idAntiEle', 'idAntiEle', 32, -0.5, 31.5, 'Anti-electron MVA discriminator V6: bitmask 1 = VLoose, 2 = Loose, 4 = Medium, 8 = Tight, 16 = VTight'), Plot1D('idAntiMu', 'idAntiMu', 4, -0.5, 3.5, 'Anti-muon discriminator V3: : bitmask 1 = Loose, 2 = Tight'), Plot1D('idDecayMode', 'idDecayMode', 2, -0.5, 1.5, "tauID('decayModeFinding')"), Plot1D('idDecayModeNewDMs', 'idDecayModeNewDMs', 2, -0.5, 1.5, "tauID('decayModeFindingNewDMs')"), - Plot1D('idMVAnewDM', 'idMVAnewDM', 64, -0.5, 63.5, 'IsolationMVArun2v1DBnewDMwLT ID working point: bitmask 1 = VLoose, 2 = Loose, 4 = Medium, 8 = Tight, 16 = VTight, 32 = VVTight'), + Plot1D('idMVAnewDM2017v2', 'idMVAnewDM2017v2', 128, -0.5, 127.5, 'IsolationMVArun2v1DBnewDMwLT ID working point (2017v2): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), Plot1D('idMVAoldDM', 'idMVAoldDM', 64, -0.5, 63.5, 'IsolationMVArun2v1DBoldDMwLT ID working point: bitmask 1 = VLoose, 2 = Loose, 4 = Medium, 8 = Tight, 16 = VTight, 32 = VVTight'), - Plot1D('idMVAoldDMdR03', 'idMVAoldDMdR03', 64, -0.5, 63.5, 'IsolationMVArun2v1DBdR03oldDMwLT ID working point: bitmask 1 = VLoose, 2 = Loose, 4 = Medium, 8 = Tight, 16 = VTight, 32 = VVTight'), + Plot1D('idMVAoldDM2017v1', 'idMVAoldDM2017v1', 128, -0.5, 127.5, 'IsolationMVArun2v1DBoldDMwLT ID working point (2017v1): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), + Plot1D('idMVAoldDM2017v2', 'idMVAoldDM2017v2', 128, -0.5, 127.5, 'IsolationMVArun2v1DBoldDMwLT ID working point (2017v2): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), + Plot1D('idMVAoldDMdR032017v2', 'idMVAoldDMdR032017v2', 128, -0.5, 127.5, 'IsolationMVArun2v1DBdR03oldDMwLT ID working point (217v2): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), NoPlot('jetIdx'), Plot1D('leadTkDeltaEta', 'leadTkDeltaEta', 20, -0.1, 0.1, 'eta of the leading track, minus tau eta'), Plot1D('leadTkDeltaPhi', 'leadTkDeltaPhi', 20, -0.1, 0.1, 'phi of the leading track, minus tau phi'), @@ -463,9 +464,12 @@ Plot1D('rawAntiEle', 'rawAntiEle', 20, -100, 100, 'Anti-electron MVA discriminator V6 raw output discriminator'), Plot1D('rawAntiEleCat', 'rawAntiEleCat', 17, -1.5, 15.5, 'Anti-electron MVA discriminator V6 category'), Plot1D('rawIso', 'rawIso', 20, 0, 200, 'combined isolation (deltaBeta corrections)'), - Plot1D('rawMVAnewDM', 'rawMVAnewDM', 20, -1, 1, 'byIsolationMVArun2v1DBnewDMwLT raw output discriminator'), + Plot1D('rawIsodR03', 'rawIsodR03', 20, 0, 200, 'combined isolation (deltaBeta corrections, dR=0.3)'), + Plot1D('rawMVAnewDM2017v2', 'rawMVAnewDM2017v2', 20, -1, 1, 'byIsolationMVArun2v1DBnewDMwLT raw output discriminator (2017v2)'), Plot1D('rawMVAoldDM', 'rawMVAoldDM', 20, -1, 1, 'byIsolationMVArun2v1DBoldDMwLT raw output discriminator'), - Plot1D('rawMVAoldDMdR03', 'rawMVAoldDMdR03', 20, -1, 1, 'byIsolationMVArun2v1DBdR03oldDMwLT raw output discriminator'), + Plot1D('rawMVAoldDM2017v1', 'rawMVAoldDM2017v1', 20, -1, 1, 'byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2017v1)'), + Plot1D('rawMVAoldDM2017v2', 'rawMVAoldDM2017v2', 20, -1, 1, 'byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2017v2)'), + Plot1D('rawMVAoldDMdR032017v2', 'rawMVAoldDMdR032017v2', 20, -1, 1, 'byIsolationMVArun2v1DBdR03oldDMwLT raw output discriminator (2017v2)'), ) ), TkMET = cms.PSet( diff --git a/PhysicsTools/NanoAOD/python/taus_cff.py b/PhysicsTools/NanoAOD/python/taus_cff.py index 61ef188241926..a6c27e9ebf567 100644 --- a/PhysicsTools/NanoAOD/python/taus_cff.py +++ b/PhysicsTools/NanoAOD/python/taus_cff.py @@ -3,14 +3,25 @@ from PhysicsTools.JetMCAlgos.TauGenJets_cfi import tauGenJets from PhysicsTools.JetMCAlgos.TauGenJetsDecayModeSelectorAllHadrons_cfi import tauGenJetsSelectorAllHadrons +##################### Updated tau collection with MVA-based tau-Ids rerun ####### +# Used only in some eras +from PhysicsTools.NanoAOD.taus_updatedMVAIds_cff import * ##################### User floats producers, selectors ########################## finalTaus = cms.EDFilter("PATTauRefSelector", - src = cms.InputTag("slimmedTaus"), - cut = cms.string("pt > 18 && tauID('decayModeFindingNewDMs') && (tauID('byLooseCombinedIsolationDeltaBetaCorr3Hits') || tauID('byVLooseIsolationMVArun2v1DBoldDMwLT') || tauID('byVLooseIsolationMVArun2v1DBnewDMwLT') || tauID('byVLooseIsolationMVArun2v1DBdR03oldDMwLT'))") + src = cms.InputTag("slimmedTausUpdated"), + cut = cms.string("pt > 18 && tauID('decayModeFindingNewDMs') && (tauID('byLooseCombinedIsolationDeltaBetaCorr3Hits') || tauID('byVLooseIsolationMVArun2v1DBoldDMwLT2015') || tauID('byVLooseIsolationMVArun2v1DBnewDMwLT') || tauID('byVLooseIsolationMVArun2v1DBdR03oldDMwLT') || tauID('byVVLooseIsolationMVArun2v1DBoldDMwLT') || tauID('byVVLooseIsolationMVArun2v1DBoldDMwLT2017v2') || tauID('byVVLooseIsolationMVArun2v1DBnewDMwLT2017v2') || tauID('byVVLooseIsolationMVArun2v1DBdR03oldDMwLT2017v2'))") ) +for era in [eras.run2_nanoAOD_94XMiniAODv1,eras.run2_nanoAOD_92X]: + era.toModify(finalTaus, + cut = cms.string("pt > 18 && tauID('decayModeFindingNewDMs') && (tauID('byLooseCombinedIsolationDeltaBetaCorr3Hits') || tauID('byVLooseIsolationMVArun2v1DBoldDMwLT') || tauID('byVLooseIsolationMVArun2v1DBnewDMwLT') || tauID('byVLooseIsolationMVArun2v1DBdR03oldDMwLT') || tauID('byVVLooseIsolationMVArun2v1DBoldDMwLT2017v1') || tauID('byVVLooseIsolationMVArun2v1DBoldDMwLT2017v2') || tauID('byVVLooseIsolationMVArun2v1DBnewDMwLT2017v2') || tauID('byVVLooseIsolationMVArun2v1DBdR03oldDMwLT2017v2'))") + ) +eras.run2_miniAOD_80XLegacy.toModify(finalTaus, + src = cms.InputTag("slimmedTaus"), + cut = cms.string("pt > 18 && tauID('decayModeFindingNewDMs') && (tauID('byLooseCombinedIsolationDeltaBetaCorr3Hits') || tauID('byVLooseIsolationMVArun2v1DBoldDMwLT') || tauID('byVLooseIsolationMVArun2v1DBnewDMwLT') || tauID('byVLooseIsolationMVArun2v1DBdR03oldDMwLT'))") + ) ##################### Tables for final output and docs ########################## def _tauIdWPMask(pattern, choices, doc=""): @@ -18,11 +29,14 @@ def _tauIdWPMask(pattern, choices, doc=""): doc=doc+": bitmask "+", ".join(["%d = %s" % (pow(2,i),c) for (i,c) in enumerate(choices)])) def _tauId2WPMask(pattern,doc): return _tauIdWPMask(pattern,choices=("Loose","Tight"),doc=doc) +def _tauId3WPMask(pattern,doc): + return _tauIdWPMask(pattern,choices=("Loose","Medium","Tight"),doc=doc) def _tauId5WPMask(pattern,doc): return _tauIdWPMask(pattern,choices=("VLoose","Loose","Medium","Tight","VTight"),doc=doc) def _tauId6WPMask(pattern,doc): return _tauIdWPMask(pattern,choices=("VLoose","Loose","Medium","Tight","VTight","VVTight"),doc=doc) - +def _tauId7WPMask(pattern,doc): + return _tauIdWPMask(pattern,choices=("VVLoose","VLoose","Loose","Medium","Tight","VTight","VVTight"),doc=doc) tauTable = cms.EDProducer("SimpleCandidateFlatTableProducer", src = cms.InputTag("linkedObjects","taus"), @@ -47,24 +61,17 @@ def _tauId6WPMask(pattern,doc): # these are too many, we may have to suppress some rawIso = Var( "tauID('byCombinedIsolationDeltaBetaCorrRaw3Hits')", float, doc = "combined isolation (deltaBeta corrections)", precision=10), + rawIsodR03 = Var( "(tauID('chargedIsoPtSumdR03')+max(0.,tauID('neutralIsoPtSumdR03')-0.072*tauID('puCorrPtSum')))", float, doc = "combined isolation (deltaBeta corrections, dR=0.3)", precision=10), chargedIso = Var( "tauID('chargedIsoPtSum')", float, doc = "charged isolation", precision=10), neutralIso = Var( "tauID('neutralIsoPtSum')", float, doc = "neutral (photon) isolation", precision=10), puCorr = Var( "tauID('puCorrPtSum')", float, doc = "pileup correction", precision=10), - footprintCorr = Var( "tauID('footprintCorrection')", float, doc = "footprint correction", precision=10), photonsOutsideSignalCone = Var( "tauID('photonPtSumOutsideSignalCone')", float, doc = "sum of photons outside signal cone", precision=10), - - rawMVAnewDM = Var( "tauID('byIsolationMVArun2v1DBnewDMwLTraw')",float, doc="byIsolationMVArun2v1DBnewDMwLT raw output discriminator",precision=10), - rawMVAoldDM = Var( "tauID('byIsolationMVArun2v1DBoldDMwLTraw')",float, doc="byIsolationMVArun2v1DBoldDMwLT raw output discriminator",precision=10), - rawMVAoldDMdR03 = Var( "tauID('byIsolationMVArun2v1DBdR03oldDMwLTraw')",float, doc="byIsolationMVArun2v1DBdR03oldDMwLT raw output discriminator",precision=10), + rawAntiEle = Var("tauID('againstElectronMVA6Raw')", float, doc= "Anti-electron MVA discriminator V6 raw output discriminator", precision=10), rawAntiEleCat = Var("tauID('againstElectronMVA6category')", int, doc="Anti-electron MVA discriminator V6 category"), - + idAntiMu = _tauId2WPMask("againstMuon%s3", doc= "Anti-muon discriminator V3: "), - idAntiEle = _tauId5WPMask("againstElectron%sMVA6", doc= "Anti-electron MVA discriminator V6"), - idMVAnewDM = _tauId6WPMask( "by%sIsolationMVArun2v1DBnewDMwLT", doc="IsolationMVArun2v1DBnewDMwLT ID working point"), - idMVAoldDM = _tauId6WPMask( "by%sIsolationMVArun2v1DBoldDMwLT", doc="IsolationMVArun2v1DBoldDMwLT ID working point"), - idMVAoldDMdR03 = _tauId6WPMask( "by%sIsolationMVArun2v1DBdR03oldDMwLT", doc="IsolationMVArun2v1DBdR03oldDMwLT ID working point"), - + idAntiEle = _tauId5WPMask("againstElectron%sMVA6", doc= "Anti-electron MVA discriminator V6"), # isoCI3hit = Var( "tauID("byCombinedIsolationDeltaBetaCorrRaw3Hits")" doc="byCombinedIsolationDeltaBetaCorrRaw3Hits raw output discriminator"), # photonOutsideSigCone = Var( "tauID("photonPtSumOutsideSignalCone")" doc="photonPtSumOutsideSignalCone raw output discriminator"), @@ -72,7 +79,55 @@ def _tauId6WPMask(pattern,doc): ) ) - +_mvaIsoVars2015 = cms.PSet( + rawMVAoldDM = Var( "tauID('byIsolationMVArun2v1DBoldDMwLTraw')",float, doc="byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2015)",precision=10), + rawMVAnewDM = Var( "tauID('byIsolationMVArun2v1DBnewDMwLTraw')",float, doc="byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2015)",precision=10), + rawMVAoldDMdR03 = Var( "tauID('byIsolationMVArun2v1DBdR03oldDMwLTraw')",float, doc="byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2015)",precision=10), + idMVAnew = _tauId6WPMask( "by%sIsolationMVArun2v1DBnewDMwLT", doc="IsolationMVArun2v1DBnewDMwLT ID working point (2015)"), + idMVAoldDM = _tauId6WPMask( "by%sIsolationMVArun2v1DBoldDMwLT", doc="IsolationMVArun2v1DBoldDMwLT ID working point (2015)"), + idMVAoldDMdR03 = _tauId6WPMask( "by%sIsolationMVArun2v1DBdR03oldDMwLT", doc="IsolationMVArun2v1DBoldDMdR0p3wLT ID working point (2015)") +) +_mvaIsoVars2015Reduced = cms.PSet( + rawMVAoldDM = Var( "tauID('byIsolationMVArun2v1DBoldDMwLTraw2015')",float, doc="byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2015)",precision=10), + idMVAoldDM = _tauId6WPMask( "by%sIsolationMVArun2v1DBoldDMwLT2015", doc="IsolationMVArun2v1DBoldDMwLT ID working point (2015)"), +) +_mvaIsoVars2017v1 = cms.PSet( + rawMVAoldDM2017v1 = Var( "tauID('byIsolationMVArun2v1DBoldDMwLTraw')",float, doc="byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2017v1)",precision=10), + idMVAoldDM2017v1 = _tauId7WPMask( "by%sIsolationMVArun2v1DBoldDMwLT", doc="IsolationMVArun2v1DBoldDMwLT ID working point (2017v1)") +) +_mvaIsoVars2017v2 = cms.PSet( + rawMVAnewDM2017v2 = Var( "tauID('byIsolationMVArun2v1DBnewDMwLTraw2017v2')",float, doc="byIsolationMVArun2v1DBnewDMwLT raw output discriminator (2017v2)",precision=10), + rawMVAoldDM2017v2 = Var( "tauID('byIsolationMVArun2v1DBoldDMwLTraw2017v2')",float, doc="byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2017v2)",precision=10), + rawMVAoldDMdR032017v2 = Var( "tauID('byIsolationMVArun2v1DBdR03oldDMwLTraw2017v2')",float, doc="byIsolationMVArun2v1DBdR03oldDMwLT raw output discriminator (2017v2)",precision=10), + idMVAnewDM2017v2 = _tauId7WPMask( "by%sIsolationMVArun2v1DBnewDMwLT2017v2", doc="IsolationMVArun2v1DBnewDMwLT ID working point (2017v2)"), + idMVAoldDM2017v2 = _tauId7WPMask( "by%sIsolationMVArun2v1DBoldDMwLT2017v2", doc="IsolationMVArun2v1DBoldDMwLT ID working point (2017v2)"), + idMVAoldDMdR032017v2 = _tauId7WPMask( "by%sIsolationMVArun2v1DBdR03oldDMwLT2017v2", doc="IsolationMVArun2v1DBoldDMdR0p3wLT ID working point (2017v2)") +) +_variablesMiniV2 = cms.PSet( + tauTable.variables.clone(), + _mvaIsoVars2015Reduced, + _mvaIsoVars2017v1, + _mvaIsoVars2017v2 +) +_variablesMiniV1 = _variablesMiniV2.clone() +_variablesMiniV1.rawMVAoldDM = Var( "tauID('byIsolationMVArun2v1DBoldDMwLTraw')",float, doc="byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2015)",precision=10) +_variablesMiniV1.rawMVAoldDM2017v1 = Var( "tauID('byIsolationMVArun2v1DBoldDMwLTraw2017v1')",float, doc="byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2017v1)",precision=10) +_variablesMiniV1.idMVAoldDM = _tauId6WPMask( "by%sIsolationMVArun2v1DBoldDMwLT", doc="IsolationMVArun2v1DBoldDMwLT ID working point (2015)") +_variablesMiniV1.idMVAoldDM2017v1 = _tauId7WPMask( "by%sIsolationMVArun2v1DBoldDMwLT2017v1", doc="IsolationMVArun2v1DBoldDMwLT ID working point (2017v1)") +_variables80X = cms.PSet( + tauTable.variables.clone(), + _mvaIsoVars2015 +) +eras.run2_nanoAOD_94XMiniAODv2.toModify(tauTable, + variables = _variablesMiniV2 +) +for era in [eras.run2_nanoAOD_94XMiniAODv1,eras.run2_nanoAOD_92X]: + era.toModify(tauTable, + variables = _variablesMiniV1 + ) +eras.run2_miniAOD_80XLegacy.toModify(tauTable, + variables = _variables80X +) tauGenJets.GenParticles = cms.InputTag("prunedGenParticles") tauGenJets.includeNeutrinos = cms.bool(False) @@ -134,7 +189,9 @@ def _tauId6WPMask(pattern,doc): ) -tauSequence = cms.Sequence(finalTaus) +tauSequence = cms.Sequence(patTauMVAIDsSeq + finalTaus) +_tauSequence80X = cms.Sequence(finalTaus) +eras.run2_miniAOD_80XLegacy.toReplaceWith(tauSequence,_tauSequence80X) tauTables = cms.Sequence(tauTable) tauMC = cms.Sequence(tauGenJets + tauGenJetsSelectorAllHadrons + genVisTaus + genVisTauTable + tausMCMatchLepTauForTable + tausMCMatchHadTauForTable + tauMCTable) diff --git a/PhysicsTools/NanoAOD/python/taus_updatedMVAIds_cff.py b/PhysicsTools/NanoAOD/python/taus_updatedMVAIds_cff.py new file mode 100644 index 0000000000000..7bb275e2a2983 --- /dev/null +++ b/PhysicsTools/NanoAOD/python/taus_updatedMVAIds_cff.py @@ -0,0 +1,381 @@ +import FWCore.ParameterSet.Config as cms + +##################### Updated tau collection with MVA-based tau-Ids rerun ####### +# Used only in some eras +from Configuration.StandardSequences.Eras import eras +from RecoTauTag.Configuration.loadRecoTauTagMVAsFromPrepDB_cfi import * +from RecoTauTag.RecoTau.PATTauDiscriminationByMVAIsolationRun2_cff import * + +### MVAIso 2017v2 +## DBoldDM +# Raw +patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw = patDiscriminationByIsolationMVArun2v1raw.clone( + PATTauProducer = cms.InputTag('slimmedTaus'), + Prediscriminants = noPrediscriminants, + loadMVAfromDB = cms.bool(True), + mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2"), # name of the training you want to use + mvaOpt = cms.string("DBoldDMwLTwGJ"), # option you want to use for your training (i.e., which variables are used to compute the BDT score) + requireDecayMode = cms.bool(True), + verbosity = cms.int32(0) +) +# VVLoose WP +patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT = patDiscriminationByIsolationMVArun2v1VLoose.clone( + PATTauProducer = cms.InputTag('slimmedTaus'), + Prediscriminants = noPrediscriminants, + toMultiplex = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw'), + key = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw','category'), + loadMVAfromDB = cms.bool(True), + mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_mvaOutput_normalization"), # normalization fo the training you want to use + mapping = cms.VPSet( + cms.PSet( + category = cms.uint32(0), + cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff95"), # this is the name of the working point you want to use + variable = cms.string("pt"), + ) + ) +) +# VLoose WP +patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT.clone() +patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff90") +# Loose WP +patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT.clone() +patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff80") +# Medium WP +patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT.clone() +patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff70") +# Tight WP +patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT.clone() +patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff60") +# VTight WP +patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT.clone() +patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff50") +# VVTights WP +patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT.clone() +patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff40") +# MVAIso DBoldDM Seqeunce +patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTSeq = cms.Sequence( + patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw + + patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT + + patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT + + patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT + + patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT + + patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT + + patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT + + patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT +) +## DBnewDM +# Raw +patTauDiscriminationByIsolationMVArun2v1DBnewDMwLTraw = patDiscriminationByIsolationMVArun2v1raw.clone( + PATTauProducer = cms.InputTag('slimmedTaus'), + Prediscriminants = noPrediscriminants, + loadMVAfromDB = cms.bool(True), + mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2"), # name of the training you want to use + mvaOpt = cms.string("DBnewDMwLTwGJ"), # option you want to use for your training (i.e., which variables are used to compute the BDT score) + requireDecayMode = cms.bool(True), + verbosity = cms.int32(0) +) +# VVLoose WP +patTauDiscriminationByVVLooseIsolationMVArun2v1DBnewDMwLT = patDiscriminationByIsolationMVArun2v1VLoose.clone( + PATTauProducer = cms.InputTag('slimmedTaus'), + Prediscriminants = noPrediscriminants, + toMultiplex = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBnewDMwLTraw'), + key = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBnewDMwLTraw','category'), + loadMVAfromDB = cms.bool(True), + mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_mvaOutput_normalization"), # normalization fo the training you want to use + mapping = cms.VPSet( + cms.PSet( + category = cms.uint32(0), + cut = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff95"), # this is the name of the working point you want to use + variable = cms.string("pt"), + ) + ) +) +# VLoose WP +patTauDiscriminationByVLooseIsolationMVArun2v1DBnewDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBnewDMwLT.clone() +patTauDiscriminationByVLooseIsolationMVArun2v1DBnewDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff90") +# Loose WP +patTauDiscriminationByLooseIsolationMVArun2v1DBnewDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBnewDMwLT.clone() +patTauDiscriminationByLooseIsolationMVArun2v1DBnewDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff80") +# Medium WP +patTauDiscriminationByMediumIsolationMVArun2v1DBnewDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBnewDMwLT.clone() +patTauDiscriminationByMediumIsolationMVArun2v1DBnewDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff70") +# Tight WP +patTauDiscriminationByTightIsolationMVArun2v1DBnewDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBnewDMwLT.clone() +patTauDiscriminationByTightIsolationMVArun2v1DBnewDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff60") +# VTight WP +patTauDiscriminationByVTightIsolationMVArun2v1DBnewDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBnewDMwLT.clone() +patTauDiscriminationByVTightIsolationMVArun2v1DBnewDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff50") +# VVTights WP +patTauDiscriminationByVVTightIsolationMVArun2v1DBnewDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBnewDMwLT.clone() +patTauDiscriminationByVVTightIsolationMVArun2v1DBnewDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff40") +# MVAIso DBnewDM Seqeunce +patTauDiscriminationByIsolationMVArun2v1DBnewDMwLTSeq = cms.Sequence( + patTauDiscriminationByIsolationMVArun2v1DBnewDMwLTraw + + patTauDiscriminationByVVLooseIsolationMVArun2v1DBnewDMwLT + + patTauDiscriminationByVLooseIsolationMVArun2v1DBnewDMwLT + + patTauDiscriminationByLooseIsolationMVArun2v1DBnewDMwLT + + patTauDiscriminationByMediumIsolationMVArun2v1DBnewDMwLT + + patTauDiscriminationByTightIsolationMVArun2v1DBnewDMwLT + + patTauDiscriminationByVTightIsolationMVArun2v1DBnewDMwLT + + patTauDiscriminationByVVTightIsolationMVArun2v1DBnewDMwLT +) +## DBoldDMdR0p3 +# Raw +patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLTraw = patDiscriminationByIsolationMVArun2v1raw.clone( + PATTauProducer = cms.InputTag('slimmedTaus'), + Prediscriminants = noPrediscriminants, + loadMVAfromDB = cms.bool(True), + mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2"), # name of the training you want to use + mvaOpt = cms.string("DBoldDMwLTwGJ"), # option you want to use for your training (i.e., which variables are used to compute the BDT score) + requireDecayMode = cms.bool(True), + srcChargedIsoPtSum = cms.string('chargedIsoPtSumdR03'), + srcFootprintCorrection = cms.string('footprintCorrectiondR03'), + srcNeutralIsoPtSum = cms.string('neutralIsoPtSumdR03'), + srcPUcorrPtSum = cms.string('puCorrPtSum'), + srcPhotonPtSumOutsideSignalCone = cms.string('photonPtSumOutsideSignalConedR03'), + verbosity = cms.int32(0) +) +# VVLoose WP +patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMdR0p3wLT = patDiscriminationByIsolationMVArun2v1VLoose.clone( + PATTauProducer = cms.InputTag('slimmedTaus'), + Prediscriminants = noPrediscriminants, + toMultiplex = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLTraw'), + key = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLTraw','category'), + loadMVAfromDB = cms.bool(True), + mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_mvaOutput_normalization"), # normalization fo the training you want to use + mapping = cms.VPSet( + cms.PSet( + category = cms.uint32(0), + cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff95"), # this is the name of the working point you want to use + variable = cms.string("pt"), + ) + ) +) +# VLoose WP +patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMdR0p3wLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMdR0p3wLT.clone() +patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMdR0p3wLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff90") +# Loose WP +patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMdR0p3wLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMdR0p3wLT.clone() +patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMdR0p3wLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff80") +# Medium WP +patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMdR0p3wLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMdR0p3wLT.clone() +patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMdR0p3wLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff70") +# Tight WP +patTauDiscriminationByTightIsolationMVArun2v1DBoldDMdR0p3wLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMdR0p3wLT.clone() +patTauDiscriminationByTightIsolationMVArun2v1DBoldDMdR0p3wLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff60") +# VTight WP +patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMdR0p3wLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMdR0p3wLT.clone() +patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMdR0p3wLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff50") +# VVTights WP +patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMdR0p3wLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMdR0p3wLT.clone() +patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMdR0p3wLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff40") +# MVAIso DBoldDMdR0p3 Seqeunce +patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLTSeq = cms.Sequence( + patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLTraw + + patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMdR0p3wLT + + patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMdR0p3wLT + + patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMdR0p3wLT + + patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMdR0p3wLT + + patTauDiscriminationByTightIsolationMVArun2v1DBoldDMdR0p3wLT + + patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMdR0p3wLT + + patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMdR0p3wLT +) +### MVAIso 2017v1 for Nano on top of MiniAODv1 +## DBoldDM +# Raw +patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2017v1 = patDiscriminationByIsolationMVArun2v1raw.clone( + PATTauProducer = cms.InputTag('slimmedTaus'), + Prediscriminants = noPrediscriminants, + loadMVAfromDB = cms.bool(True), + mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1"), # name of the training you want to use + mvaOpt = cms.string("DBoldDMwLTwGJ"), # option you want to use for your training (i.e., which variables are used to compute the BDT score) + requireDecayMode = cms.bool(True), + verbosity = cms.int32(0) +) +# VVLoose WP +patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT2017v1 = patDiscriminationByIsolationMVArun2v1VLoose.clone( + PATTauProducer = cms.InputTag('slimmedTaus'), + Prediscriminants = noPrediscriminants, + toMultiplex = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2017v1'), + key = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2017v1','category'), + loadMVAfromDB = cms.bool(True), + mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_mvaOutput_normalization"), # normalization fo the training you want to use + mapping = cms.VPSet( + cms.PSet( + category = cms.uint32(0), + cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff95"), # this is the name of the working point you want to use + variable = cms.string("pt"), + ) + ) +) +# VLoose WP +patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2017v1 = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT2017v1.clone() +patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2017v1.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff90") +# Loose WP +patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT2017v1 = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT2017v1.clone() +patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT2017v1.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff80") +# Medium WP +patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT2017v1 = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT2017v1.clone() +patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT2017v1.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff70") +# Tight WP +patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT2017v1 = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT2017v1.clone() +patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT2017v1.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff60") +# VTight WP +patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT2017v1 = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT2017v1.clone() +patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT2017v1.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff50") +# VVTights WP +patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT2017v1 = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT2017v1.clone() +patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT2017v1.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff40") +# MVAIso DBoldDM Seqeunce +patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2017v1Seq = cms.Sequence( + patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2017v1 + + patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT2017v1 + + patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2017v1 + + patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT2017v1 + + patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT2017v1 + + patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT2017v1 + + patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT2017v1 + + patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT2017v1 +) +### MVAIso 2015 for Nano on top of MiniAODv2 +## DBoldDM +# Raw +patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2015 = patDiscriminationByIsolationMVArun2v1raw.clone( + PATTauProducer = cms.InputTag('slimmedTaus'), + Prediscriminants = noPrediscriminants, + loadMVAfromDB = cms.bool(True), + mvaName = cms.string("RecoTauTag_tauIdMVADBoldDMwLTv1"), # name of the training you want to use + mvaOpt = cms.string("DBoldDMwLT"), # option you want to use for your training (i.e., which variables are used to compute the BDT score) + requireDecayMode = cms.bool(True), + verbosity = cms.int32(0) +) +# VLoose WP +patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2015 = patDiscriminationByIsolationMVArun2v1VLoose.clone( + PATTauProducer = cms.InputTag('slimmedTaus'), + Prediscriminants = noPrediscriminants, + toMultiplex = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2015'), + key = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2015','category'), + loadMVAfromDB = cms.bool(True), + mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVADBoldDMwLTv1_mvaOutput_normalization"), # normalization fo the training you want to use + mapping = cms.VPSet( + cms.PSet( + category = cms.uint32(0), + cut = cms.string("RecoTauTag_tauIdMVADBoldDMwLTv1_WPEff90"), # this is the name of the working point you want to use + variable = cms.string("pt"), + ) + ) +) +# Loose WP +patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT2015 = patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2015.clone() +patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT2015.mapping[0].cut = cms.string("RecoTauTag_tauIdMVADBoldDMwLTv1_WPEff80") +# Medium WP +patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT2015 = patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2015.clone() +patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT2015.mapping[0].cut = cms.string("RecoTauTag_tauIdMVADBoldDMwLTv1_WPEff70") +# Tight WP +patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT2015 = patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2015.clone() +patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT2015.mapping[0].cut = cms.string("RecoTauTag_tauIdMVADBoldDMwLTv1_WPEff60") +# VTight WP +patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT2015 = patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2015.clone() +patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT2015.mapping[0].cut = cms.string("RecoTauTag_tauIdMVADBoldDMwLTv1_WPEff50") +# VVTights WP +patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT2015 = patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2015.clone() +patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT2015.mapping[0].cut = cms.string("RecoTauTag_tauIdMVADBoldDMwLTv1_WPEff40") +# MVAIso DBoldDM Seqeunce +patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2015Seq = cms.Sequence( + patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2015 + + patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2015 + + patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT2015 + + patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT2015 + + patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT2015 + + patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT2015 + + patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT2015 +) + + +### FIXME: add other tau-Ids when ready + +### put all new MVA tau-Id stuff to one Sequence +patTauMVAIDsSeq = cms.Sequence( + patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTSeq + +patTauDiscriminationByIsolationMVArun2v1DBnewDMwLTSeq + +patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLTSeq +) +_patTauMVAIDsSeqWith2017v1 = patTauMVAIDsSeq.copy() +_patTauMVAIDsSeqWith2017v1 += patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2017v1Seq +for era in [eras.run2_nanoAOD_94XMiniAODv1,eras.run2_nanoAOD_92X]: + era.toReplaceWith(patTauMVAIDsSeq,_patTauMVAIDsSeqWith2017v1) +_patTauMVAIDsSeqWith2015 = patTauMVAIDsSeq.copy() +_patTauMVAIDsSeqWith2015 += patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2015Seq +eras.run2_nanoAOD_94XMiniAODv2.toReplaceWith(patTauMVAIDsSeq,_patTauMVAIDsSeqWith2015) + +# embed new MVA tau-Ids into new tau collection +slimmedTausUpdated = cms.EDProducer("PATTauIDEmbedder", + src = cms.InputTag('slimmedTaus'), + tauIDSources = cms.PSet( + #oldDM + byIsolationMVArun2v1DBoldDMwLTraw2017v2 = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw'), + byVVLooseIsolationMVArun2v1DBoldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT'), + byVLooseIsolationMVArun2v1DBoldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT'), + byLooseIsolationMVArun2v1DBoldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT'), + byMediumIsolationMVArun2v1DBoldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT'), + byTightIsolationMVArun2v1DBoldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT'), + byVTightIsolationMVArun2v1DBoldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT'), + byVVTightIsolationMVArun2v1DBoldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT'), + #newDM + byIsolationMVArun2v1DBnewDMwLTraw2017v2 = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBnewDMwLTraw'), + byVVLooseIsolationMVArun2v1DBnewDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVVLooseIsolationMVArun2v1DBnewDMwLT'), + byVLooseIsolationMVArun2v1DBnewDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVLooseIsolationMVArun2v1DBnewDMwLT'), + byLooseIsolationMVArun2v1DBnewDMwLT2017v2 = cms.InputTag('patTauDiscriminationByLooseIsolationMVArun2v1DBnewDMwLT'), + byMediumIsolationMVArun2v1DBnewDMwLT2017v2 = cms.InputTag('patTauDiscriminationByMediumIsolationMVArun2v1DBnewDMwLT'), + byTightIsolationMVArun2v1DBnewDMwLT2017v2 = cms.InputTag('patTauDiscriminationByTightIsolationMVArun2v1DBnewDMwLT'), + byVTightIsolationMVArun2v1DBnewDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVTightIsolationMVArun2v1DBnewDMwLT'), + byVVTightIsolationMVArun2v1DBnewDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVVTightIsolationMVArun2v1DBnewDMwLT'), + #oldDMdR0p3 + byIsolationMVArun2v1DBdR03oldDMwLTraw2017v2 = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLTraw'), + byVVLooseIsolationMVArun2v1DBdR03oldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMdR0p3wLT'), + byVLooseIsolationMVArun2v1DBdR03oldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMdR0p3wLT'), + byLooseIsolationMVArun2v1DBdR03oldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMdR0p3wLT'), + byMediumIsolationMVArun2v1DBdR03oldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMdR0p3wLT'), + byTightIsolationMVArun2v1DBdR03oldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByTightIsolationMVArun2v1DBoldDMdR0p3wLT'), + byVTightIsolationMVArun2v1DBdR03oldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMdR0p3wLT'), + byVVTightIsolationMVArun2v1DBdR03oldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMdR0p3wLT'), + ) +) +_tauIDSources2017v1 = cms.PSet( + byIsolationMVArun2v1DBoldDMwLTraw2017v1 = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2017v1'), + byVVLooseIsolationMVArun2v1DBoldDMwLT2017v1 = cms.InputTag('patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT2017v1'), + byVLooseIsolationMVArun2v1DBoldDMwLT2017v1 = cms.InputTag('patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2017v1'), + byLooseIsolationMVArun2v1DBoldDMwLT2017v1 = cms.InputTag('patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT2017v1'), + byMediumIsolationMVArun2v1DBoldDMwLT2017v1 = cms.InputTag('patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT2017v1'), + byTightIsolationMVArun2v1DBoldDMwLT2017v1 = cms.InputTag('patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT2017v1'), + byVTightIsolationMVArun2v1DBoldDMwLT2017v1 = cms.InputTag('patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT2017v1'), + byVVTightIsolationMVArun2v1DBoldDMwLT2017v1 = cms.InputTag('patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT2017v1') +) +_tauIDSourcesWith2017v1 = cms.PSet( + slimmedTausUpdated.tauIDSources.clone(), + _tauIDSources2017v1 +) +_tauIDSources2015 = cms.PSet( + byIsolationMVArun2v1DBoldDMwLTraw2015 = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2015'), + byVLooseIsolationMVArun2v1DBoldDMwLT2015 = cms.InputTag('patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2015'), + byLooseIsolationMVArun2v1DBoldDMwLT2015 = cms.InputTag('patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT2015'), + byMediumIsolationMVArun2v1DBoldDMwLT2015 = cms.InputTag('patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT2015'), + byTightIsolationMVArun2v1DBoldDMwLT2015 = cms.InputTag('patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT2015'), + byVTightIsolationMVArun2v1DBoldDMwLT2015 = cms.InputTag('patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT2015'), + byVVTightIsolationMVArun2v1DBoldDMwLT2015 = cms.InputTag('patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT2015') +) +_tauIDSourcesWith2015 = cms.PSet( + slimmedTausUpdated.tauIDSources.clone(), + _tauIDSources2015 +) + +for era in [eras.run2_nanoAOD_94XMiniAODv1,eras.run2_nanoAOD_92X]: + era.toModify(slimmedTausUpdated, + tauIDSources = _tauIDSourcesWith2017v1 + ) +eras.run2_nanoAOD_94XMiniAODv2.toModify(slimmedTausUpdated, + tauIDSources = _tauIDSourcesWith2015 +) + +patTauMVAIDsSeq += slimmedTausUpdated + diff --git a/RecoTauTag/Configuration/python/loadRecoTauTagMVAsFromPrepDB_cfi.py b/RecoTauTag/Configuration/python/loadRecoTauTagMVAsFromPrepDB_cfi.py index 6fa710afb1f2f..6a34a321ed2a2 100644 --- a/RecoTauTag/Configuration/python/loadRecoTauTagMVAsFromPrepDB_cfi.py +++ b/RecoTauTag/Configuration/python/loadRecoTauTagMVAsFromPrepDB_cfi.py @@ -39,6 +39,8 @@ } tauIdDiscrMVA_trainings_run2_2017 = { 'tauIdMVAIsoDBoldDMwLT2017' : "tauIdMVAIsoDBoldDMwLT2017", + 'tauIdMVAIsoDBnewDMwLT2017' : "tauIdMVAIsoDBnewDMwLT2017", + 'tauIdMVAIsoDBoldDMdR0p3wLT2017' : "tauIdMVAIsoDBoldDMdR0p3wLT2017", } tauIdDiscrMVA_WPs = { 'tauIdMVAoldDMwoLT' : { @@ -151,6 +153,24 @@ 'Eff60' : "DBoldDMwLTEff60", 'Eff50' : "DBoldDMwLTEff50", 'Eff40' : "DBoldDMwLTEff40" + }, + 'tauIdMVAIsoDBnewDMwLT2017' : { + 'Eff95' : "DBnewDMwLTEff95", + 'Eff90' : "DBnewDMwLTEff90", + 'Eff80' : "DBnewDMwLTEff80", + 'Eff70' : "DBnewDMwLTEff70", + 'Eff60' : "DBnewDMwLTEff60", + 'Eff50' : "DBnewDMwLTEff50", + 'Eff40' : "DBnewDMwLTEff40" + }, + 'tauIdMVAIsoDBoldDMdR0p3wLT2017' : { + 'Eff95' : "DBoldDMdR0p3wLTEff95", + 'Eff90' : "DBoldDMdR0p3wLTEff90", + 'Eff80' : "DBoldDMdR0p3wLTEff80", + 'Eff70' : "DBoldDMdR0p3wLTEff70", + 'Eff60' : "DBoldDMdR0p3wLTEff60", + 'Eff50' : "DBoldDMdR0p3wLTEff50", + 'Eff40' : "DBoldDMdR0p3wLTEff40" } } tauIdDiscrMVA_mvaOutput_normalizations = { @@ -172,7 +192,9 @@ 'tauIdMVAIsoDBnewDMwLT2016' : "mvaOutput_normalization_DBnewDMwLT2016" } tauIdDiscrMVA_mvaOutput_normalizations_run2_2017 = { - 'tauIdMVAIsoDBoldDMwLT2017' : "mvaOutput_normalization" + 'tauIdMVAIsoDBoldDMwLT2017' : "mvaOutput_normalization", + 'tauIdMVAIsoDBnewDMwLT2017' : "mvaOutput_normalization", + 'tauIdMVAIsoDBoldDMdR0p3wLT2017' : "mvaOutput_normalization" } tauIdDiscrMVA_version = "v1" for training, gbrForestName in tauIdDiscrMVA_trainings.items(): @@ -221,6 +243,7 @@ label = cms.untracked.string("RecoTauTag_%s%s_mvaOutput_normalization" % (gbrForestName, tauIdDiscrMVA_version)) ) ) +# MVAIso 2016 for training, gbrForestName in tauIdDiscrMVA_trainings_run2_2016.items(): loadRecoTauTagMVAsFromPrepDB.toGet.append( cms.PSet( @@ -244,30 +267,34 @@ label = cms.untracked.string("RecoTauTag_%s%s_mvaOutput_normalization" % (gbrForestName, tauIdDiscrMVA_version)) ) ) -tauIdDiscrMVA_2017_version = "v1" -for training, gbrForestName in tauIdDiscrMVA_trainings_run2_2017.items(): - loadRecoTauTagMVAsFromPrepDB.toGet.append( - cms.PSet( - record = cms.string('GBRWrapperRcd'), - tag = cms.string("RecoTauTag_%s%s" % (gbrForestName, tauIdDiscrMVA_2017_version)), - label = cms.untracked.string("RecoTauTag_%s%s" % (gbrForestName, tauIdDiscrMVA_2017_version)) - ) - ) - for WP in tauIdDiscrMVA_WPs_run2_2017[training].keys(): +# MVAIso 2017 +tauIdDiscrMVA_2017_version = ["v1","v2"] +for ver2017 in tauIdDiscrMVA_2017_version: + for training, gbrForestName in tauIdDiscrMVA_trainings_run2_2017.items(): + if ver2017=="v1" and (training.find("newDM")>-1 or training.find("dR0p3")>-1): + continue #skip nonexistent trainings loadRecoTauTagMVAsFromPrepDB.toGet.append( cms.PSet( - record = cms.string('PhysicsTGraphPayloadRcd'), - tag = cms.string("RecoTauTag_%s%s_WP%s" % (gbrForestName, tauIdDiscrMVA_2017_version, WP)), - label = cms.untracked.string("RecoTauTag_%s%s_WP%s" % (gbrForestName, tauIdDiscrMVA_2017_version, WP)) + record = cms.string('GBRWrapperRcd'), + tag = cms.string("RecoTauTag_%s%s" % (gbrForestName, ver2017)), + label = cms.untracked.string("RecoTauTag_%s%s" % (gbrForestName, ver2017)) ) ) - loadRecoTauTagMVAsFromPrepDB.toGet.append( - cms.PSet( - record = cms.string('PhysicsTFormulaPayloadRcd'), - tag = cms.string("RecoTauTag_%s%s_mvaOutput_normalization" % (gbrForestName, tauIdDiscrMVA_2017_version)), - label = cms.untracked.string("RecoTauTag_%s%s_mvaOutput_normalization" % (gbrForestName, tauIdDiscrMVA_2017_version)) - ) - ) + for WP in tauIdDiscrMVA_WPs_run2_2017[training].keys(): + loadRecoTauTagMVAsFromPrepDB.toGet.append( + cms.PSet( + record = cms.string('PhysicsTGraphPayloadRcd'), + tag = cms.string("RecoTauTag_%s%s_WP%s" % (gbrForestName, ver2017, WP)), + label = cms.untracked.string("RecoTauTag_%s%s_WP%s" % (gbrForestName, ver2017, WP)) + ) + ) + loadRecoTauTagMVAsFromPrepDB.toGet.append( + cms.PSet( + record = cms.string('PhysicsTFormulaPayloadRcd'), + tag = cms.string("RecoTauTag_%s%s_mvaOutput_normalization" % (gbrForestName, ver2017)), + label = cms.untracked.string("RecoTauTag_%s%s_mvaOutput_normalization" % (gbrForestName, ver2017)) + ) + ) #### # register anti-electron discriminator MVA From 9e9d036614b5d657f75d47c18040bc6717f67e00 Mon Sep 17 00:00:00 2001 From: Heiner Tholen Date: Wed, 4 Apr 2018 17:00:35 +0200 Subject: [PATCH 339/426] adding classes to the class dictionary --- PhysicsTools/KinFitter/src/classes.h | 40 ++++++++++++++-------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/PhysicsTools/KinFitter/src/classes.h b/PhysicsTools/KinFitter/src/classes.h index 6a7477b2d3a03..c0e112b57b994 100644 --- a/PhysicsTools/KinFitter/src/classes.h +++ b/PhysicsTools/KinFitter/src/classes.h @@ -23,25 +23,25 @@ namespace PhysicsTools_KinFitter { struct dictionary { -// TFitConstraintEp fce; -// TFitConstraintEp::component fce_c; -// TFitConstraintM fcm; -// TFitConstraintMGaus fcmg; -// TFitParticleCart fpc; -// TFitParticleECart fpec; -// TFitParticleEMomDev fpemd; -// TFitParticleEScaledMomDev fpesmd; -// TFitParticleESpher fpes; -// TFitParticleEtEtaPhi fpeep; -// TFitParticleEtThetaPhi fpetp; -// TFitParticleMCCart fpmcc; -// TFitParticleMCMomDev fmmccd; -// TFitParticleMCPInvSpher fpmcpis; -// TFitParticleMCSpher fpmcs; -// TFitParticleMomDev fpmd; -// TFitParticleSpher fps; -// TKinFitter kf; -// TSLToyGen sltg; + TFitConstraintEp fce; + TFitConstraintEp::component fce_c; + TFitConstraintM fcm; + TFitConstraintMGaus fcmg; + TFitParticleCart fpc; + TFitParticleECart fpec; + TFitParticleEMomDev fpemd; + TFitParticleEScaledMomDev fpesmd; + TFitParticleESpher fpes; + TFitParticleEtEtaPhi fpeep; + TFitParticleEtThetaPhi fpetp; + TFitParticleMCCart fpmcc; + TFitParticleMCMomDev fmmccd; + TFitParticleMCPInvSpher fpmcpis; + TFitParticleMCSpher fpmcs; + TFitParticleMomDev fpmd; + TFitParticleSpher fps; + TKinFitter kf; + TSLToyGen sltg; }; -} \ No newline at end of file +} From 5eb74f36c5492b452e39efef9d605bae8de37fea Mon Sep 17 00:00:00 2001 From: Andrea Bocci Date: Wed, 4 Apr 2018 17:00:48 +0200 Subject: [PATCH 340/426] Remove #pragma once --- DataFormats/GeometrySurface/interface/SOARotation.h | 1 - Geometry/TrackerGeometryBuilder/interface/phase1PixelTopology.h | 1 - 2 files changed, 2 deletions(-) diff --git a/DataFormats/GeometrySurface/interface/SOARotation.h b/DataFormats/GeometrySurface/interface/SOARotation.h index 9978973aa5d3d..1373a4091c5e5 100644 --- a/DataFormats/GeometrySurface/interface/SOARotation.h +++ b/DataFormats/GeometrySurface/interface/SOARotation.h @@ -1,4 +1,3 @@ -#pragma once #ifndef DataFormats_GeometrySurface_SOARotation_h #define DataFormats_GeometrySurface_SOARotation_h diff --git a/Geometry/TrackerGeometryBuilder/interface/phase1PixelTopology.h b/Geometry/TrackerGeometryBuilder/interface/phase1PixelTopology.h index 872e0b732ae14..455de58ce3408 100644 --- a/Geometry/TrackerGeometryBuilder/interface/phase1PixelTopology.h +++ b/Geometry/TrackerGeometryBuilder/interface/phase1PixelTopology.h @@ -1,4 +1,3 @@ -#pragma once #ifndef Geometry_TrackerGeometryBuilder_phase1PixelTopology_h #define Geometry_TrackerGeometryBuilder_phase1PixelTopology_h From 06008473fb00bf79378b3fa79cd282496c06d7d4 Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Tue, 3 Apr 2018 10:56:24 -0500 Subject: [PATCH 341/426] Add GlobalCache to PileupJetIdProducer to improve startup performance. Without the GlobalCache the startup time is proportional to the number of streams and the time to initialize the GBRForest is significant. Several of the other data members that do not change after construction are needed to initialize the GBRForest, so I also moved all those into the GlobalCache (which also slightly improves performance). --- .../JetProducers/interface/PileupJetIdAlgo.h | 93 ++++-- .../plugins/PileupJetIdProducer.cc | 100 +++--- .../plugins/PileupJetIdProducer.h | 70 ++-- RecoJets/JetProducers/src/PileupJetIdAlgo.cc | 303 +++++++++--------- 4 files changed, 312 insertions(+), 254 deletions(-) diff --git a/RecoJets/JetProducers/interface/PileupJetIdAlgo.h b/RecoJets/JetProducers/interface/PileupJetIdAlgo.h index 4783b0c251bd2..faea19667f40d 100644 --- a/RecoJets/JetProducers/interface/PileupJetIdAlgo.h +++ b/RecoJets/JetProducers/interface/PileupJetIdAlgo.h @@ -27,21 +27,20 @@ class PileupJetIdAlgo { public: enum version_t { USER=-1, PHILv0=0 }; - - PileupJetIdAlgo(int version=PHILv0, const std::string & tmvaWeight="", const std::string & tmvaMethod="", - Float_t impactParTkThreshod_=1., const std::vector & tmvaVariables= std::vector(), bool runMvas=true); - PileupJetIdAlgo(const edm::ParameterSet & ps, bool runMvas); + + class AlgoGBRForestsAndConstants; + + PileupJetIdAlgo(AlgoGBRForestsAndConstants const* cache); ~PileupJetIdAlgo(); PileupJetIdentifier computeIdVariables(const reco::Jet * jet, float jec, const reco::Vertex *, const reco::VertexCollection &, double rho); void set(const PileupJetIdentifier &); - std::unique_ptr getMVA(const std::vector &, const std::string &); float getMVAval(const std::vector &, const std::unique_ptr &); PileupJetIdentifier computeMva(); - const std::string method() const { return tmvaMethod_; } - + const std::string method() const { return cache_->tmvaMethod(); } + std::string dumpVariables() const; typedef std::map > variables_list_t; @@ -54,38 +53,68 @@ class PileupJetIdAlgo { /// const PileupJetIdentifier::variables_list_t & getVariables() const { return variables_; }; const variables_list_t & getVariables() const { return variables_; }; + // In multithreaded mode, each PileupIdAlgo object will get duplicated + // on every stream. Some of the data it contains never changes after + // construction and can be shared by all streams. This nested class contains + // the data members that can be shared across streams. In particular + // the GBRForests take significant time to initialize and can be shared. + class AlgoGBRForestsAndConstants { + public: + + AlgoGBRForestsAndConstants(edm::ParameterSet const&, bool runMvas); + + std::unique_ptr const& reader() const { return reader_; } + std::vector> const& etaReader() const { return etaReader_; } + bool cutBased() const { return cutBased_; } + bool etaBinnedWeights() const { return etaBinnedWeights_; } + bool runMvas() const { return runMvas_; } + int nEtaBins() const { return nEtaBins_; } + std::vector const& jEtaMin() const { return jEtaMin_; } + std::vector const& jEtaMax() const { return jEtaMax_; } + std::string const& label() const { return label_; } + std::string const& tmvaMethod() const { return tmvaMethod_; } + std::vector const& tmvaVariables() const { return tmvaVariables_; } + std::vector> const& tmvaEtaVariables() const { return tmvaEtaVariables_; } + + typedef float array_t[3][4][4]; + array_t const& mvacut() const { return mvacut_; } + array_t const& rmsCut() const { return rmsCut_; } + array_t const& betaStarCut() const { return betaStarCut_; } + + std::unique_ptr getMVA(std::vector const& varList, + std::string const& tmvaWeights, + std::vector const& tmvaSpectators); + + private: + + std::unique_ptr reader_; + std::vector> etaReader_; + bool cutBased_; + bool etaBinnedWeights_; + bool runMvas_; + int nEtaBins_; + std::vector jEtaMin_; + std::vector jEtaMax_; + std::string label_; + std::string tmvaMethod_; + std::vector tmvaVariables_; + std::vector> tmvaEtaVariables_; + + float mvacut_ [3][4][4]; //Keep the array fixed + float rmsCut_ [3][4][4]; //Keep the array fixed + float betaStarCut_[3][4][4]; //Keep the array fixed + + std::map tmvaNames_; + }; + protected: - void setup(); void runMva(); - void bookReader(); void resetVariables(); void initVariables(); - PileupJetIdentifier internalId_; variables_list_t variables_; - - std::unique_ptr reader_; - std::vector> etaReader_; - std::string tmvaWeights_, tmvaMethod_; - std::vector tmvaEtaWeights_; - std::vector tmvaVariables_; - std::vector> tmvaEtaVariables_; - std::vector tmvaSpectators_; - std::map tmvaNames_; - - int version_; - float impactParTkThreshod_; - bool cutBased_; - bool etaBinnedWeights_; - int nEtaBins_; - std::vector jEtaMin_; - std::vector jEtaMax_; - bool runMvas_; - float mvacut_ [3][4][4]; //Keep the array fixed - float rmsCut_ [3][4][4]; //Keep the array fixed - float betaStarCut_[3][4][4]; //Keep the array fixed + AlgoGBRForestsAndConstants const* cache_; }; - #endif diff --git a/RecoJets/JetProducers/plugins/PileupJetIdProducer.cc b/RecoJets/JetProducers/plugins/PileupJetIdProducer.cc index 71051589d456e..3f02844b14740 100644 --- a/RecoJets/JetProducers/plugins/PileupJetIdProducer.cc +++ b/RecoJets/JetProducers/plugins/PileupJetIdProducer.cc @@ -16,46 +16,49 @@ Description: [one line class summary] // // -#include #include "RecoJets/JetProducers/plugins/PileupJetIdProducer.h" +GBRForestsAndConstants::GBRForestsAndConstants(edm::ParameterSet const& iConfig) : + runMvas_(iConfig.getParameter("runMvas")), + produceJetIds_(iConfig.getParameter("produceJetIds")), + inputIsCorrected_(iConfig.getParameter("inputIsCorrected")), + applyJec_(iConfig.getParameter("applyJec")), + jec_(iConfig.getParameter("jec")), + residualsFromTxt_(iConfig.getParameter("residualsFromTxt")) { + + if (residualsFromTxt_) { + residualsTxt_ = iConfig.getParameter("residualsTxt"); + } + + std::vector algos = iConfig.getParameter >("algos"); + for (auto const& algoPset : algos) { + vAlgoGBRForestsAndConstants_.emplace_back(algoPset, runMvas_); + } + + if (!runMvas_) { + assert(algos.size() == 1); + } +} // ------------------------------------------------------------------------------------------ -PileupJetIdProducer::PileupJetIdProducer(const edm::ParameterSet& iConfig) +PileupJetIdProducer::PileupJetIdProducer(const edm::ParameterSet& iConfig, GBRForestsAndConstants const* globalCache) { - runMvas_ = iConfig.getParameter("runMvas"); - produceJetIds_ = iConfig.getParameter("produceJetIds"); - jets_ = iConfig.getParameter("jets"); - vertexes_ = iConfig.getParameter("vertexes"); - jetids_ = iConfig.getParameter("jetids"); - inputIsCorrected_ = iConfig.getParameter("inputIsCorrected"); - applyJec_ = iConfig.getParameter("applyJec"); - jec_ = iConfig.getParameter("jec"); - rho_ = iConfig.getParameter("rho"); - residualsFromTxt_ = iConfig.getParameter("residualsFromTxt"); - if(residualsFromTxt_) residualsTxt_ = iConfig.getParameter("residualsTxt"); - std::vector algos = iConfig.getParameter >("algos"); - - - if( ! runMvas_ ) assert( algos.size() == 1 ); - - if( produceJetIds_ ) { + if ( globalCache->produceJetIds() ) { produces > (""); } - for(std::vector::iterator it=algos.begin(); it!=algos.end(); ++it) { - std::string label = it->getParameter("label"); - algos_.emplace_back( label, std::make_unique(*it, runMvas_)); - if( runMvas_ ) { + for (auto const& algoGBRForestsAndConstants : globalCache->vAlgoGBRForestsAndConstants()) { + std::string const& label = algoGBRForestsAndConstants.label(); + algos_.emplace_back(label, std::make_unique(&algoGBRForestsAndConstants)); + if ( globalCache->runMvas() ) { produces > (label+"Discriminant"); produces > (label+"Id"); } } - input_jet_token_ = consumes >(jets_); - input_vertex_token_ = consumes(vertexes_); - input_vm_pujetid_token_ = consumes >(jetids_); - input_rho_token_ = consumes(rho_); - + input_jet_token_ = consumes >(iConfig.getParameter("jets")); + input_vertex_token_ = consumes(iConfig.getParameter("vertexes")); + input_vm_pujetid_token_ = consumes >(iConfig.getParameter("jetids")); + input_rho_token_ = consumes(iConfig.getParameter("rho")); } @@ -70,6 +73,8 @@ PileupJetIdProducer::~PileupJetIdProducer() void PileupJetIdProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + GBRForestsAndConstants const* gc = globalCache(); + using namespace edm; using namespace std; using namespace reco; @@ -80,13 +85,13 @@ PileupJetIdProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) const View & jets = *jetHandle; // vertexes Handle vertexHandle; - if( produceJetIds_ ) { + if( gc->produceJetIds() ) { iEvent.getByToken(input_vertex_token_, vertexHandle); } const VertexCollection & vertexes = *(vertexHandle.product()); // input variables Handle > vmap; - if( ! produceJetIds_ ) { + if( ! gc->produceJetIds() ) { iEvent.getByToken(input_vm_pujetid_token_, vmap); } // rho @@ -99,7 +104,7 @@ PileupJetIdProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) map > idflags; VertexCollection::const_iterator vtx; - if( produceJetIds_ ) { + if( gc->produceJetIds() ) { // require basic quality cuts on the vertexes vtx = vertexes.begin(); while( vtx != vertexes.end() && ( vtx->isFake() || vtx->ndof() < 4 ) ) { @@ -124,7 +129,7 @@ PileupJetIdProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) // Get jet energy correction float jec = 0.; - if( applyJec_ ) { + if( gc->applyJec() ) { // If haven't done it get rho from the event if( rho == 0. ) { iEvent.getByToken(input_rho_token_,rhoH); @@ -145,22 +150,22 @@ PileupJetIdProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) jec = jecCor_->getCorrection(); } // If it was requested AND the input is an uncorrected jet apply the JEC - bool applyJec = applyJec_ && ( ispat || !inputIsCorrected_ ); - reco::Jet * corrJet = nullptr; + bool applyJec = gc->applyJec() && ( ispat || !gc->inputIsCorrected() ); + std::unique_ptr corrJet; if( applyJec ) { float scale = jec; if( ispat ) { - corrJet = new pat::Jet(patjet->correctedJet(0)) ; + corrJet.reset(new pat::Jet(patjet->correctedJet(0))) ; } else { - corrJet = dynamic_cast( jet.clone() ); + corrJet.reset(dynamic_cast( jet.clone() )); } corrJet->scaleEnergy(scale); } - const reco::Jet * theJet = ( applyJec ? corrJet : &jet ); + const reco::Jet * theJet = ( applyJec ? corrJet.get() : &jet ); PileupJetIdentifier puIdentifier; - if( produceJetIds_ ) { + if( gc->produceJetIds() ) { // Compute the input variables puIdentifier = ialgo->computeIdVariables(theJet, jec, &(*vtx), vertexes, rho); ids.push_back( puIdentifier ); @@ -174,7 +179,7 @@ PileupJetIdProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) puIdentifier = ialgo->computeMva(); } - if( runMvas_ ) { + if( gc->runMvas() ) { // Compute the MVA and WP mvas[algoi->first].push_back( puIdentifier.mva() ); idflags[algoi->first].push_back( puIdentifier.idFlag() ); @@ -186,13 +191,10 @@ PileupJetIdProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) idflags[algoi->first].push_back( id.idFlag() ); } } - - // cleanup - if( corrJet ) { delete corrJet; } } // Produce the output value maps - if( runMvas_ ) { + if( gc->runMvas() ) { for( const auto& ialgo : algos_) { // MVA vector & mva = mvas[ialgo.first]; @@ -212,7 +214,7 @@ PileupJetIdProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) } } // input variables - if( produceJetIds_ ) { + if( gc->produceJetIds() ) { assert( jetHandle->size() == ids.size() ); auto idsout = std::make_unique>(); ValueMap::Filler idsfiller(*idsout); @@ -239,23 +241,25 @@ PileupJetIdProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptio void PileupJetIdProducer::initJetEnergyCorrector(const edm::EventSetup &iSetup, bool isData) { + GBRForestsAndConstants const* gc = globalCache(); + //jet energy correction levels to apply on raw jet std::vector jecLevels; jecLevels.push_back("L1FastJet"); jecLevels.push_back("L2Relative"); jecLevels.push_back("L3Absolute"); - if(isData && ! residualsFromTxt_ ) jecLevels.push_back("L2L3Residual"); + if(isData && ! gc->residualsFromTxt() ) jecLevels.push_back("L2L3Residual"); //check the corrector parameters needed according to the correction levels edm::ESHandle parameters; - iSetup.get().get(jec_,parameters); + iSetup.get().get(gc->jec(),parameters); for(std::vector::const_iterator ll = jecLevels.begin(); ll != jecLevels.end(); ++ll) { const JetCorrectorParameters& ip = (*parameters)[*ll]; jetCorPars_.push_back(ip); } - if( isData && residualsFromTxt_ ) { - jetCorPars_.push_back(JetCorrectorParameters(residualsTxt_.fullPath())); + if( isData && gc->residualsFromTxt() ) { + jetCorPars_.push_back(JetCorrectorParameters(gc->residualsTxt().fullPath())); } //instantiate the jet corrector diff --git a/RecoJets/JetProducers/plugins/PileupJetIdProducer.h b/RecoJets/JetProducers/plugins/PileupJetIdProducer.h index ca5efae40ff3a..331f97f2e88d1 100644 --- a/RecoJets/JetProducers/plugins/PileupJetIdProducer.h +++ b/RecoJets/JetProducers/plugins/PileupJetIdProducer.h @@ -46,33 +46,65 @@ Description: Produces a value map of jet --> pileup jet ID #include "FWCore/ParameterSet/interface/FileInPath.h" // ------------------------------------------------------------------------------------------ -class PileupJetIdProducer : public edm::stream::EDProducer<> { + +class GBRForestsAndConstants { +public: + + GBRForestsAndConstants(edm::ParameterSet const&); + + std::vector const& vAlgoGBRForestsAndConstants() const { + return vAlgoGBRForestsAndConstants_; + } + + bool runMvas() const { return runMvas_; } + bool produceJetIds() const { return produceJetIds_; } + bool inputIsCorrected() const { return inputIsCorrected_; } + bool applyJec() const { return applyJec_; } + std::string const& jec() const { return jec_; } + bool residualsFromTxt() const { return residualsFromTxt_; } + edm::FileInPath const& residualsTxt() const { return residualsTxt_; } + +private: + + std::vector vAlgoGBRForestsAndConstants_; + + bool runMvas_; + bool produceJetIds_; + bool inputIsCorrected_; + bool applyJec_; + std::string jec_; + bool residualsFromTxt_; + edm::FileInPath residualsTxt_; +}; + +class PileupJetIdProducer : public edm::stream::EDProducer> { public: - explicit PileupJetIdProducer(const edm::ParameterSet&); - ~PileupJetIdProducer() override; + explicit PileupJetIdProducer(const edm::ParameterSet&, GBRForestsAndConstants const*); + ~PileupJetIdProducer() override; - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + static std::unique_ptr initializeGlobalCache(edm::ParameterSet const& pset) { + return std::make_unique(pset); + } + + static void globalEndJob(GBRForestsAndConstants*) { } private: - void produce(edm::Event&, const edm::EventSetup&) override; + void produce(edm::Event&, const edm::EventSetup&) override; - void initJetEnergyCorrector(const edm::EventSetup &iSetup, bool isData); + void initJetEnergyCorrector(const edm::EventSetup &iSetup, bool isData); - edm::InputTag jets_, vertexes_, jetids_, rho_; - std::string jec_; - bool runMvas_, produceJetIds_, inputIsCorrected_, applyJec_; - std::vector> > algos_; + std::vector> > algos_; - bool residualsFromTxt_; - edm::FileInPath residualsTxt_; - std::unique_ptr jecCor_; - std::vector jetCorPars_; - - edm::EDGetTokenT > input_jet_token_; - edm::EDGetTokenT input_vertex_token_; - edm::EDGetTokenT > input_vm_pujetid_token_; - edm::EDGetTokenT input_rho_token_; + std::unique_ptr jecCor_; + std::vector jetCorPars_; + + edm::EDGetTokenT > input_jet_token_; + edm::EDGetTokenT input_vertex_token_; + edm::EDGetTokenT > input_vm_pujetid_token_; + edm::EDGetTokenT input_rho_token_; }; diff --git a/RecoJets/JetProducers/src/PileupJetIdAlgo.cc b/RecoJets/JetProducers/src/PileupJetIdAlgo.cc index 56bbec7ffb236..2c56d95acb7b4 100644 --- a/RecoJets/JetProducers/src/PileupJetIdAlgo.cc +++ b/RecoJets/JetProducers/src/PileupJetIdAlgo.cc @@ -12,110 +12,129 @@ #include "TMatrixDSymEigen.h" #include "TMVA/MethodBDT.h" +#include + // ------------------------------------------------------------------------------------------ const float large_val = std::numeric_limits::max(); // ------------------------------------------------------------------------------------------ -PileupJetIdAlgo::PileupJetIdAlgo(const edm::ParameterSet & ps, bool runMvas) -{ - impactParTkThreshod_ = 1.;/// ps.getParameter("impactParTkThreshod"); - cutBased_ = false; - etaBinnedWeights_ = false; - runMvas_=runMvas; - //std::string label = ps.getParameter("label"); - cutBased_ = ps.getParameter("cutBased"); - if(!cutBased_) - { - etaBinnedWeights_ = ps.getParameter("etaBinnedWeights"); - if(etaBinnedWeights_){ - - const std::vector& trainings = ps.getParameter >("trainings"); - nEtaBins_ = ps.getParameter("nEtaBins"); - for(int v=0; v("tmvaWeights")).fullPath() ); - jEtaMin_.push_back( trainings.at(v).getParameter("jEtaMin") ); - jEtaMax_.push_back( trainings.at(v).getParameter("jEtaMax") ); - } - for(int v=0; v >("tmvaVariables") ); - } - } - else{ - tmvaWeights_ = edm::FileInPath(ps.getParameter("tmvaWeights")).fullPath(); - tmvaVariables_ = ps.getParameter >("tmvaVariables"); - } - tmvaMethod_ = ps.getParameter("tmvaMethod"); - tmvaSpectators_ = ps.getParameter >("tmvaSpectators"); - version_ = ps.getParameter("version"); - } - else version_ = USER; - edm::ParameterSet jetConfig = ps.getParameter("JetIdParams"); - for(int i0 = 0; i0 < 3; i0++) { - std::string lCutType = "Tight"; - if(i0 == PileupJetIdentifier::kMedium) lCutType = "Medium"; - if(i0 == PileupJetIdentifier::kLoose) lCutType = "Loose"; - int nCut = 1; - if(cutBased_) nCut++; - for(int i1 = 0; i1 < nCut; i1++) { - std::string lFullCutType = lCutType; - if(cutBased_ && i1 == 0) lFullCutType = "BetaStar"+ lCutType; - if(cutBased_ && i1 == 1) lFullCutType = "RMS" + lCutType; - std::vector pt010 = jetConfig.getParameter >(("Pt010_" +lFullCutType).c_str()); - std::vector pt1020 = jetConfig.getParameter >(("Pt1020_"+lFullCutType).c_str()); - std::vector pt2030 = jetConfig.getParameter >(("Pt2030_"+lFullCutType).c_str()); - std::vector pt3050 = jetConfig.getParameter >(("Pt3050_"+lFullCutType).c_str()); - if(!cutBased_) { - for(int i2 = 0; i2 < 4; i2++) mvacut_[i0][0][i2] = pt010 [i2]; - for(int i2 = 0; i2 < 4; i2++) mvacut_[i0][1][i2] = pt1020[i2]; - for(int i2 = 0; i2 < 4; i2++) mvacut_[i0][2][i2] = pt2030[i2]; - for(int i2 = 0; i2 < 4; i2++) mvacut_[i0][3][i2] = pt3050[i2]; - } - if(cutBased_ && i1 == 0) { - for(int i2 = 0; i2 < 4; i2++) betaStarCut_[i0][0][i2] = pt010 [i2]; - for(int i2 = 0; i2 < 4; i2++) betaStarCut_[i0][1][i2] = pt1020[i2]; - for(int i2 = 0; i2 < 4; i2++) betaStarCut_[i0][2][i2] = pt2030[i2]; - for(int i2 = 0; i2 < 4; i2++) betaStarCut_[i0][3][i2] = pt3050[i2]; - } - if(cutBased_ && i1 == 1) { - for(int i2 = 0; i2 < 4; i2++) rmsCut_[i0][0][i2] = pt010 [i2]; - for(int i2 = 0; i2 < 4; i2++) rmsCut_[i0][1][i2] = pt1020[i2]; - for(int i2 = 0; i2 < 4; i2++) rmsCut_[i0][2][i2] = pt2030[i2]; - for(int i2 = 0; i2 < 4; i2++) rmsCut_[i0][3][i2] = pt3050[i2]; - } - } - } - setup(); + +PileupJetIdAlgo::AlgoGBRForestsAndConstants::AlgoGBRForestsAndConstants(edm::ParameterSet const& ps, bool runMvas) : + cutBased_(ps.getParameter("cutBased")), + etaBinnedWeights_(false), + runMvas_(runMvas), + nEtaBins_(0), + label_(ps.getParameter("label")), + mvacut_{}, + rmsCut_{}, + betaStarCut_{} + { + + std::string tmvaWeights; + std::vector tmvaEtaWeights; + std::vector tmvaSpectators; + int version; + + if (!cutBased_) { + etaBinnedWeights_ = ps.getParameter("etaBinnedWeights"); + if (etaBinnedWeights_) { + const std::vector& trainings = ps.getParameter >("trainings"); + nEtaBins_ = ps.getParameter("nEtaBins"); + for (int v = 0; v < nEtaBins_; v++) { + tmvaEtaWeights.push_back( edm::FileInPath(trainings.at(v).getParameter("tmvaWeights")).fullPath() ); + jEtaMin_.push_back( trainings.at(v).getParameter("jEtaMin") ); + jEtaMax_.push_back( trainings.at(v).getParameter("jEtaMax") ); + } + for (int v = 0; v < nEtaBins_; v++) { + tmvaEtaVariables_.push_back( trainings.at(v).getParameter >("tmvaVariables") ); + } + } else { + tmvaWeights = edm::FileInPath(ps.getParameter("tmvaWeights")).fullPath(); + tmvaVariables_ = ps.getParameter >("tmvaVariables"); + } + tmvaMethod_ = ps.getParameter("tmvaMethod"); + tmvaSpectators = ps.getParameter >("tmvaSpectators"); + version = ps.getParameter("version"); + } else { + version = USER; + } + + edm::ParameterSet jetConfig = ps.getParameter("JetIdParams"); + for (int i0 = 0; i0 < 3; i0++) { + std::string lCutType = "Tight"; + if (i0 == PileupJetIdentifier::kMedium) lCutType = "Medium"; + if (i0 == PileupJetIdentifier::kLoose) lCutType = "Loose"; + int nCut = 1; + if(cutBased_) nCut++; + for (int i1 = 0; i1 < nCut; i1++) { + std::string lFullCutType = lCutType; + if (cutBased_ && i1 == 0) lFullCutType = "BetaStar"+ lCutType; + if (cutBased_ && i1 == 1) lFullCutType = "RMS" + lCutType; + std::vector pt010 = jetConfig.getParameter >(("Pt010_" +lFullCutType).c_str()); + std::vector pt1020 = jetConfig.getParameter >(("Pt1020_"+lFullCutType).c_str()); + std::vector pt2030 = jetConfig.getParameter >(("Pt2030_"+lFullCutType).c_str()); + std::vector pt3050 = jetConfig.getParameter >(("Pt3050_"+lFullCutType).c_str()); + if (!cutBased_) { + for (int i2 = 0; i2 < 4; i2++) mvacut_[i0][0][i2] = pt010 [i2]; + for (int i2 = 0; i2 < 4; i2++) mvacut_[i0][1][i2] = pt1020[i2]; + for (int i2 = 0; i2 < 4; i2++) mvacut_[i0][2][i2] = pt2030[i2]; + for (int i2 = 0; i2 < 4; i2++) mvacut_[i0][3][i2] = pt3050[i2]; + } + if (cutBased_ && i1 == 0) { + for (int i2 = 0; i2 < 4; i2++) betaStarCut_[i0][0][i2] = pt010 [i2]; + for (int i2 = 0; i2 < 4; i2++) betaStarCut_[i0][1][i2] = pt1020[i2]; + for (int i2 = 0; i2 < 4; i2++) betaStarCut_[i0][2][i2] = pt2030[i2]; + for (int i2 = 0; i2 < 4; i2++) betaStarCut_[i0][3][i2] = pt3050[i2]; + } + if (cutBased_ && i1 == 1) { + for (int i2 = 0; i2 < 4; i2++) rmsCut_[i0][0][i2] = pt010 [i2]; + for (int i2 = 0; i2 < 4; i2++) rmsCut_[i0][1][i2] = pt1020[i2]; + for (int i2 = 0; i2 < 4; i2++) rmsCut_[i0][2][i2] = pt2030[i2]; + for (int i2 = 0; i2 < 4; i2++) rmsCut_[i0][3][i2] = pt3050[i2]; + } + } + } + + if ( ! cutBased_ ) { + assert( tmvaMethod_.empty() || ((! tmvaVariables_.empty() || ( !tmvaEtaVariables_.empty() )) && version == USER) ); + } + + if (( ! cutBased_ ) && (runMvas_)) { + if (etaBinnedWeights_) { + for (int v = 0; v < nEtaBins_; v++) { + etaReader_.push_back(getMVA(tmvaEtaVariables_.at(v), tmvaEtaWeights.at(v), tmvaSpectators)); + } + } else { + reader_ = getMVA(tmvaVariables_, tmvaWeights, tmvaSpectators); + } + } } -// ------------------------------------------------------------------------------------------ -PileupJetIdAlgo::PileupJetIdAlgo(int version, - const std::string & tmvaWeights, - const std::string & tmvaMethod, - Float_t impactParTkThreshod, - const std::vector & tmvaVariables, - bool runMvas - ) -{ - impactParTkThreshod_ = impactParTkThreshod; - tmvaWeights_ = tmvaWeights; - tmvaMethod_ = tmvaMethod; - tmvaVariables_ = tmvaVariables; - version_ = version; - - runMvas_=runMvas; - - setup(); +std::unique_ptr +PileupJetIdAlgo::AlgoGBRForestsAndConstants::getMVA(std::vector const& varList, + std::string const& tmvaWeights, + std::vector const& tmvaSpectators) { + + // A temporary only to access the variables while calling TMVA AddVariable and TMVA AddSpectator. + PileupJetIdAlgo algo(nullptr); + + TMVA::Reader tmpTMVAReader( "!Color:Silent:!Error" ); + for (auto const& varName : varList) { + if ( tmvaNames_[varName].empty() ) tmvaNames_[varName] = varName; + tmpTMVAReader.AddVariable( varName, std::get(algo.getVariables().at(tmvaNames_[varName])) ); + } + for (auto const& spectatorName : tmvaSpectators) { + if ( tmvaNames_[spectatorName].empty() ) tmvaNames_[spectatorName] = spectatorName; + tmpTMVAReader.AddSpectator( spectatorName, std::get(algo.getVariables().at(tmvaNames_[spectatorName])) ); + } + reco::details::loadTMVAWeights(&tmpTMVAReader, tmvaMethod_, tmvaWeights); + return ( std::make_unique ( dynamic_cast( tmpTMVAReader.FindMVA(tmvaMethod_.c_str()) ) ) ); } -// ------------------------------------------------------------------------------------------ -void PileupJetIdAlgo::setup() -{ - initVariables(); +PileupJetIdAlgo::PileupJetIdAlgo(AlgoGBRForestsAndConstants const* cache) : + cache_(cache) { - if( ! cutBased_ ){ - assert( tmvaMethod_.empty() || ((! tmvaVariables_.empty() || ( !tmvaEtaVariables_.empty() )) && version_ == USER) ); - } - if(( ! cutBased_ ) && (runMvas_)) { bookReader();} + initVariables(); } // ------------------------------------------------------------------------------------------ @@ -140,30 +159,6 @@ void setPtEtaPhi(const reco::Candidate & p, float & pt, float & eta, float &phi phi = p.phi(); } -std::unique_ptr PileupJetIdAlgo::getMVA(const std::vector &varList, const std::string &tmvaWeights) -{ - TMVA::Reader tmpTMVAReader( "!Color:Silent:!Error" ); - for(std::vector::const_iterator it=varList.begin(); it!=varList.end(); ++it) { - if( tmvaNames_[*it].empty() ) tmvaNames_[*it] = *it; - tmpTMVAReader.AddVariable( *it, variables_[ tmvaNames_[*it] ].first ); - } - for(std::vector::iterator it=tmvaSpectators_.begin(); it!=tmvaSpectators_.end(); ++it) { - if( tmvaNames_[*it].empty() ) tmvaNames_[*it] = *it; - tmpTMVAReader.AddSpectator( *it, variables_[ tmvaNames_[*it] ].first ); - } - reco::details::loadTMVAWeights(&tmpTMVAReader, tmvaMethod_, tmvaWeights); - return( std::make_unique ( dynamic_cast( tmpTMVAReader.FindMVA(tmvaMethod_.c_str()) ) ) ); -} - -void PileupJetIdAlgo::bookReader() -{ - if(etaBinnedWeights_){ - for(int v=0; v &varList, const std::unique_ptr &reader) { - float mvaval = -2; std::vector vars; for(std::vector::const_iterator it=varList.begin(); it!=varList.end(); ++it) { std::pair var = variables_.at(*it); vars.push_back( *var.first ); } - mvaval = reader->GetClassifier(vars.data()); - return mvaval; + return reader->GetClassifier(vars.data()); } void PileupJetIdAlgo::runMva() { - if( cutBased_ ) { - internalId_.idFlag_ = computeCutIDflag(internalId_.betaStarClassic_,internalId_.dR2Mean_,internalId_.nvtx_,internalId_.jetPt_,internalId_.jetEta_); - } else { - if(std::abs(internalId_.jetEta_) >= 5.0) { - internalId_.mva_ = -2.; - } else { - if(etaBinnedWeights_){ - if(std::abs(internalId_.jetEta_) > jEtaMax_.at(nEtaBins_-1)) { - internalId_.mva_ = -2.; - } else { - for(int v=0; v=jEtaMin_.at(v) && std::abs(internalId_.jetEta_)cutBased() ) { + internalId_.idFlag_ = computeCutIDflag(internalId_.betaStarClassic_,internalId_.dR2Mean_,internalId_.nvtx_,internalId_.jetPt_,internalId_.jetEta_); + } else { + if(std::abs(internalId_.jetEta_) >= 5.0) { + internalId_.mva_ = -2.; + } else { + if(cache_->etaBinnedWeights()){ + if(std::abs(internalId_.jetEta_) > cache_->jEtaMax().at(cache_->nEtaBins() - 1)) { + internalId_.mva_ = -2.; + } else { + for(int v = 0; v < cache_->nEtaBins(); v++){ + if(std::abs(internalId_.jetEta_) >= cache_->jEtaMin().at(v) && std::abs(internalId_.jetEta_) < cache_->jEtaMax().at(v)) { + internalId_.mva_ = getMVAval(cache_->tmvaEtaVariables().at(v), cache_->etaReader().at(v)); + break; + } + } + } + } else { + internalId_.mva_ = getMVAval(cache_->tmvaVariables(), cache_->reader()); + } + } + internalId_.idFlag_ = computeIDflag(internalId_.mva_,internalId_.jetPt_,internalId_.jetEta_); + } } // ------------------------------------------------------------------------------------------ @@ -232,16 +225,16 @@ int PileupJetIdAlgo::computeCutIDflag(float betaStarClassic,float dR2Mean,float std::pair jetIdKey = getJetIdKey(jetPt,jetEta); float betaStarModified = betaStarClassic/log(nvtx-0.64); int idFlag(0); - if(betaStarModified < betaStarCut_[PileupJetIdentifier::kTight ][jetIdKey.first][jetIdKey.second] && - dR2Mean < rmsCut_ [PileupJetIdentifier::kTight ][jetIdKey.first][jetIdKey.second] + if(betaStarModified < cache_->betaStarCut()[PileupJetIdentifier::kTight ][jetIdKey.first][jetIdKey.second] && + dR2Mean < cache_->rmsCut() [PileupJetIdentifier::kTight ][jetIdKey.first][jetIdKey.second] ) idFlag += 1 << PileupJetIdentifier::kTight; - if(betaStarModified < betaStarCut_[PileupJetIdentifier::kMedium ][jetIdKey.first][jetIdKey.second] && - dR2Mean < rmsCut_ [PileupJetIdentifier::kMedium ][jetIdKey.first][jetIdKey.second] + if(betaStarModified < cache_->betaStarCut()[PileupJetIdentifier::kMedium ][jetIdKey.first][jetIdKey.second] && + dR2Mean < cache_->rmsCut() [PileupJetIdentifier::kMedium ][jetIdKey.first][jetIdKey.second] ) idFlag += 1 << PileupJetIdentifier::kMedium; - if(betaStarModified < betaStarCut_[PileupJetIdentifier::kLoose ][jetIdKey.first][jetIdKey.second] && - dR2Mean < rmsCut_ [PileupJetIdentifier::kLoose ][jetIdKey.first][jetIdKey.second] + if(betaStarModified < cache_->betaStarCut()[PileupJetIdentifier::kLoose ][jetIdKey.first][jetIdKey.second] && + dR2Mean < cache_->rmsCut() [PileupJetIdentifier::kLoose ][jetIdKey.first][jetIdKey.second] ) idFlag += 1 << PileupJetIdentifier::kLoose; return idFlag; } @@ -256,9 +249,9 @@ int PileupJetIdAlgo::computeIDflag(float mva, float jetPt, float jetEta) int PileupJetIdAlgo::computeIDflag(float mva,int ptId,int etaId) { int idFlag(0); - if(mva > mvacut_[PileupJetIdentifier::kTight ][ptId][etaId]) idFlag += 1 << PileupJetIdentifier::kTight; - if(mva > mvacut_[PileupJetIdentifier::kMedium][ptId][etaId]) idFlag += 1 << PileupJetIdentifier::kMedium; - if(mva > mvacut_[PileupJetIdentifier::kLoose ][ptId][etaId]) idFlag += 1 << PileupJetIdentifier::kLoose; + if(mva > cache_->mvacut()[PileupJetIdentifier::kTight ][ptId][etaId]) idFlag += 1 << PileupJetIdentifier::kTight; + if(mva > cache_->mvacut()[PileupJetIdentifier::kMedium][ptId][etaId]) idFlag += 1 << PileupJetIdentifier::kMedium; + if(mva > cache_->mvacut()[PileupJetIdentifier::kLoose ][ptId][etaId]) idFlag += 1 << PileupJetIdentifier::kLoose; return idFlag; } @@ -641,7 +634,7 @@ PileupJetIdentifier PileupJetIdAlgo::computeIdVariables(const reco::Jet * jet, f assert( internalId_.beta_ == 0. && internalId_.betaStar_ == 0.&& internalId_.betaClassic_ == 0. && internalId_.betaStarClassic_ == 0. ); } - if( runMvas_ ) { + if( cache_->runMvas() ) { runMva(); } From d30b1455f086dcb051b343c5da3d4edfa9448959 Mon Sep 17 00:00:00 2001 From: Heiner Tholen Date: Wed, 4 Apr 2018 17:34:31 +0200 Subject: [PATCH 342/426] adding Discr_HLTMinusRECO and turn-on histograms --- .../Trigger/interface/BTVHLTOfflineSource.h | 20 +++++++---- .../Trigger/python/BTVHLTOfflineSource_cfi.py | 6 ++-- DQMOffline/Trigger/src/BTVHLTOfflineSource.cc | 34 +++++++++++++------ 3 files changed, 40 insertions(+), 20 deletions(-) diff --git a/DQMOffline/Trigger/interface/BTVHLTOfflineSource.h b/DQMOffline/Trigger/interface/BTVHLTOfflineSource.h index 428a68a96dca0..0c3184575cae2 100644 --- a/DQMOffline/Trigger/interface/BTVHLTOfflineSource.h +++ b/DQMOffline/Trigger/interface/BTVHLTOfflineSource.h @@ -61,9 +61,9 @@ class BTVHLTOfflineSource : public DQMEDAnalyzer { edm::InputTag triggerSummaryLabel_; edm::InputTag triggerResultsLabel_; - float turnon_threshold_low_; + float turnon_threshold_loose_; float turnon_threshold_medium_; - float turnon_threshold_high_; + float turnon_threshold_tight_; edm::EDGetTokenT offlineDiscrTokenPF_; edm::EDGetTokenT offlineDiscrTokenCalo_; @@ -117,15 +117,19 @@ class BTVHLTOfflineSource : public DQMEDAnalyzer { public: void setHistos( MonitorElement* const Discr, MonitorElement* const Pt, MonitorElement* const Eta, - MonitorElement* const Discr_HLTvsRECO, MonitorElement* const PVz, MonitorElement* const fastPVz, + MonitorElement* const Discr_HLTvsRECO, MonitorElement* const Discr_HLTMinusRECO, + MonitorElement* const Discr_turnon_loose, MonitorElement* const Discr_turnon_medium, MonitorElement* const Discr_turnon_tight, + MonitorElement* const PVz, MonitorElement* const fastPVz, MonitorElement* const PVz_HLTMinusRECO, MonitorElement* const fastPVz_HLTMinusRECO, MonitorElement* const n_vtx, MonitorElement* const vtx_mass, MonitorElement* const n_vtx_trks, MonitorElement* const n_sel_tracks, MonitorElement* const h_3d_ip_distance, MonitorElement* const h_3d_ip_error, MonitorElement* const h_3d_ip_sig // , // MonitorElement* const n_pixel_hits, MonitorElement* const n_total_hits ) - { Discr_ = Discr; Pt_ = Pt; Eta_ = Eta; Discr_HLTvsRECO_ = Discr_HLTvsRECO; PVz_ = PVz; fastPVz_ = fastPVz; - PVz_HLTMinusRECO_ = PVz_HLTMinusRECO; fastPVz_HLTMinusRECO_ = fastPVz_HLTMinusRECO; + { Discr_ = Discr; Pt_ = Pt; Eta_ = Eta; + Discr_HLTvsRECO_ = Discr_HLTvsRECO; Discr_HLTvsRECO_ = Discr_HLTMinusRECO; + Discr_turnon_loose_ = Discr_turnon_loose; Discr_turnon_medium_ = Discr_turnon_medium; Discr_turnon_tight_ = Discr_turnon_tight; + PVz_ = PVz; fastPVz_ = fastPVz; fastPVz_HLTMinusRECO_ = fastPVz_HLTMinusRECO; n_vtx_ = n_vtx; vtx_mass_ = vtx_mass; n_vtx_trks_ = n_vtx_trks; n_sel_tracks_ = n_sel_tracks; h_3d_ip_distance_ = h_3d_ip_distance; h_3d_ip_error_ = h_3d_ip_error; h_3d_ip_sig_ = h_3d_ip_sig; @@ -153,6 +157,10 @@ class BTVHLTOfflineSource : public DQMEDAnalyzer { MonitorElement * getMEhisto_Pt() { return Pt_; } MonitorElement * getMEhisto_Eta() { return Eta_;} MonitorElement * getMEhisto_Discr_HLTvsRECO() { return Discr_HLTvsRECO_;} + MonitorElement * getMEhisto_Discr_HLTMinusRECO() { return Discr_HLTMinusRECO_;} + MonitorElement * getMEhisto_Discr_turnon_loose() { return Discr_turnon_loose_;} + MonitorElement * getMEhisto_Discr_turnon_medium() { return Discr_turnon_medium_;} + MonitorElement * getMEhisto_Discr_turnon_tight() { return Discr_turnon_tight_;} MonitorElement * getMEhisto_PVz() { return PVz_;} MonitorElement * getMEhisto_fastPVz() { return fastPVz_;} MonitorElement * getMEhisto_PVz_HLTMinusRECO() { return PVz_HLTMinusRECO_;} @@ -212,7 +220,7 @@ class BTVHLTOfflineSource : public DQMEDAnalyzer { MonitorElement* Eta_; MonitorElement* Discr_HLTvsRECO_; MonitorElement* Discr_HLTMinusRECO_; - MonitorElement* Discr_turnon_low_; + MonitorElement* Discr_turnon_loose_; MonitorElement* Discr_turnon_medium_; MonitorElement* Discr_turnon_tight_; MonitorElement* PVz_; diff --git a/DQMOffline/Trigger/python/BTVHLTOfflineSource_cfi.py b/DQMOffline/Trigger/python/BTVHLTOfflineSource_cfi.py index b7744d8190ea8..d2886c2ff9ca8 100644 --- a/DQMOffline/Trigger/python/BTVHLTOfflineSource_cfi.py +++ b/DQMOffline/Trigger/python/BTVHLTOfflineSource_cfi.py @@ -17,9 +17,9 @@ hltPFPVLabel = cms.InputTag("hltVerticesPFSelector"), hltCaloPVLabel = cms.InputTag("hltVerticesL3"), offlinePVLabel = cms.InputTag("offlinePrimaryVertices"), - turnon_threshold_low = cms.float32(0.2), - turnon_threshold_medium = cms.float32(0.5), - turnon_threshold_high = cms.float32(0.8), + turnon_threshold_loose = cms.double(0.2), + turnon_threshold_medium = cms.double(0.5), + turnon_threshold_tight = cms.double(0.8), # pathPairs = cms.VPSet( cms.PSet( diff --git a/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc b/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc index 2625c579f71b2..7e546f25eb887 100644 --- a/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc +++ b/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc @@ -45,9 +45,9 @@ BTVHLTOfflineSource::BTVHLTOfflineSource(const edm::ParameterSet& iConfig) verbose_ = iConfig.getUntrackedParameter< bool >("verbose", false); triggerSummaryLabel_ = iConfig.getParameter("triggerSummaryLabel"); triggerResultsLabel_ = iConfig.getParameter("triggerResultsLabel"); - turnon_threshold_low_ = iConfig.getParameter("turnon_threshold_low"); + turnon_threshold_loose_ = iConfig.getParameter("turnon_threshold_loose"); turnon_threshold_medium_ = iConfig.getParameter("turnon_threshold_medium"); - turnon_threshold_high_ = iConfig.getParameter("turnon_threshold_high"); + turnon_threshold_tight_ = iConfig.getParameter("turnon_threshold_tight"); triggerSummaryToken = consumes (triggerSummaryLabel_); triggerResultsToken = consumes (triggerResultsLabel_); triggerSummaryFUToken = consumes (edm::InputTag(triggerSummaryLabel_.label(),triggerSummaryLabel_.instance(),std::string("FU"))); @@ -150,16 +150,11 @@ BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iS if(!triggerResults_.isValid()) return; for(auto & v : hltPathsAll_) { - unsigned index = triggerNames_.triggerIndex(v.getPath()); - if (index >= triggerNames_.size()) { - continue; - } - float DR = 9999.; - // PF btagging - if ( ( pfTags.isValid() && v.getTriggerType() == "PF") - || (caloTags.isValid() && v.getTriggerType() == "Calo" && !caloTags->empty()) ) + // PF and Calo btagging + if ( (v.getTriggerType() == "PF" && pfTags.isValid()) + || (v.getTriggerType() == "Calo" && caloTags.isValid() && !caloTags->empty()) ) { const auto & iter = (v.getTriggerType() == "PF") ? pfTags->begin() : caloTags->begin(); const auto & offlineJetTagHandler = (v.getTriggerType() == "PF") ? offlineJetTagHandlerPF : offlineJetTagHandlerCalo; @@ -324,6 +319,22 @@ BTVHLTOfflineSource::bookHistograms(DQMStore::IBooker & iBooker, edm::Run const title = "online discr vs offline discr "+trigPath; MonitorElement * Discr_HLTvsRECO = iBooker.book2D(histoname.c_str(),title.c_str(),110,-0.1,1,110,-0.1,1); + histoname = "HLTMinusRECO_Discr"; + title = "online discr minus offline discr "+trigPath; + MonitorElement * Discr_HLTMinusRECO = iBooker.book1D(histoname.c_str(),title.c_str(),100,-1,1); + + histoname = "Turnon_loose_Discr"; + title = "turn-on with loose threshold "+trigPath; + MonitorElement * Discr_turnon_loose = iBooker.book1D(histoname.c_str(),title.c_str(),20,0,1); + + histoname = "Turnon_medium_Discr"; + title = "turn-on with medium threshold "+trigPath; + MonitorElement * Discr_turnon_medium = iBooker.book1D(histoname.c_str(),title.c_str(),20,0,1); + + histoname = "Turnon_tight_Discr"; + title = "turn-on with tight threshold "+trigPath; + MonitorElement * Discr_turnon_tight = iBooker.book1D(histoname.c_str(),title.c_str(),20,0,1); + histoname = labelname+"_PVz"; title = "online z(PV) "+trigPath; MonitorElement * PVz = iBooker.book1D(histoname.c_str(),title.c_str(),80,-20,20); @@ -378,7 +389,8 @@ BTVHLTOfflineSource::bookHistograms(DQMStore::IBooker & iBooker, edm::Run const v.setHistos( - Discr, Pt, Eta, Discr_HLTvsRECO, PVz, fastPVz, PVz_HLTMinusRECO, fastPVz_HLTMinusRECO, + Discr, Pt, Eta, Discr_HLTvsRECO, Discr_HLTMinusRECO, Discr_turnon_loose, Discr_turnon_medium, Discr_turnon_tight, + PVz, fastPVz, PVz_HLTMinusRECO, fastPVz_HLTMinusRECO, n_vtx, vtx_mass, n_vtx_trks, n_sel_tracks, h_3d_ip_distance, h_3d_ip_error, h_3d_ip_sig // , n_pixel_hits, n_total_hits ); } From 41bde72a0ad07c8f936ccf8ca3d578e42aa01521 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Wed, 4 Apr 2018 10:52:48 -0500 Subject: [PATCH 343/426] Avoid reading memory after delete in CosMuoGenProducer The HepMC::GenEvent instance was being inspected after it was deleted when the HepMCProduct was put into the event. Changing the order of calls avoids the problem. Additionally, the use of bare pointers was changed to std::unique_ptr. --- .../interface/CosMuoGenProducer.h | 5 +++-- .../src/CosMuoGenProducer.cc | 21 ++++++++----------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/GeneratorInterface/CosmicMuonGenerator/interface/CosMuoGenProducer.h b/GeneratorInterface/CosmicMuonGenerator/interface/CosMuoGenProducer.h index 17218feb31702..fde6a80a4eb99 100644 --- a/GeneratorInterface/CosmicMuonGenerator/interface/CosMuoGenProducer.h +++ b/GeneratorInterface/CosmicMuonGenerator/interface/CosMuoGenProducer.h @@ -15,6 +15,8 @@ #include "GeneratorInterface/CosmicMuonGenerator/interface/CosmicMuonGenerator.h" +#include + namespace edm { class CosMuoGenProducer : public one::EDProducer { @@ -81,9 +83,8 @@ namespace edm double extCrossSect; double extFilterEff; - CosmicMuonGenerator* CosMuoGen; + std::unique_ptr CosMuoGen; // the event format itself - HepMC::GenEvent* fEvt; bool cmVerbosity_; bool isInitialized_; diff --git a/GeneratorInterface/CosmicMuonGenerator/src/CosMuoGenProducer.cc b/GeneratorInterface/CosmicMuonGenerator/src/CosMuoGenProducer.cc index dff753c40dc5e..89e3ee22899dc 100644 --- a/GeneratorInterface/CosmicMuonGenerator/src/CosMuoGenProducer.cc +++ b/GeneratorInterface/CosmicMuonGenerator/src/CosMuoGenProducer.cc @@ -52,7 +52,7 @@ edm::CosMuoGenProducer::CosMuoGenProducer( const ParameterSet & pset ) : if(MinP_CMS < 0) MinP_CMS = MinP; // set up the generator - CosMuoGen = new CosmicMuonGenerator(); + CosMuoGen = std::make_unique(); // Begin JMM change // CosMuoGen->setNumberOfEvents(numberEventsInRun()); CosMuoGen->setNumberOfEvents(999999999); @@ -97,9 +97,6 @@ edm::CosMuoGenProducer::CosMuoGenProducer( const ParameterSet & pset ) : } edm::CosMuoGenProducer::~CosMuoGenProducer(){ - //CosMuoGen->terminate(); - delete CosMuoGen; - // delete fEvt; clear(); } @@ -107,7 +104,7 @@ void edm::CosMuoGenProducer::beginLuminosityBlock(LuminosityBlock const& lumi, E { if(!isInitialized_) { isInitialized_ = true; - RandomEngineSentry randomEngineSentry(CosMuoGen, lumi.index()); + RandomEngineSentry randomEngineSentry(CosMuoGen.get(), lumi.index()); CosMuoGen->initialize(randomEngineSentry.randomEngine()); } } @@ -131,7 +128,7 @@ void edm::CosMuoGenProducer::clear(){} void edm::CosMuoGenProducer::produce(Event &e, const edm::EventSetup &es) { - RandomEngineSentry randomEngineSentry(CosMuoGen, e.streamID()); + RandomEngineSentry randomEngineSentry(CosMuoGen.get(), e.streamID()); // generate event if (!MultiMuon) { @@ -177,7 +174,7 @@ void edm::CosMuoGenProducer::produce(Event &e, const edm::EventSetup &es) } - fEvt = new HepMC::GenEvent(); + auto fEvt = std::make_unique(); HepMC::GenVertex* Vtx_at = new HepMC::GenVertex(HepMC::FourVector(CosMuoGen->Vx_at, //[mm] CosMuoGen->Vy_at, //[mm] @@ -232,11 +229,11 @@ void edm::CosMuoGenProducer::produce(Event &e, const edm::EventSetup &es) if (cmVerbosity_) fEvt->print(); - std::unique_ptr CMProduct(new HepMCProduct()); - CMProduct->addHepMCData( fEvt ); - e.put(std::move(CMProduct), "unsmeared"); - - std::unique_ptr genEventInfo(new GenEventInfoProduct( fEvt )); + std::unique_ptr genEventInfo(new GenEventInfoProduct( fEvt.get() )); e.put(std::move(genEventInfo)); + //This causes fEvt to be deleted + std::unique_ptr CMProduct(new HepMCProduct()); + CMProduct->addHepMCData( fEvt.release() ); + e.put(std::move(CMProduct), "unsmeared"); } From e676178e8d8d95b5150484709b04e46b7207cf8e Mon Sep 17 00:00:00 2001 From: Heiner Tholen Date: Wed, 4 Apr 2018 19:21:37 +0200 Subject: [PATCH 344/426] fixes / cleanup --- .../Trigger/interface/BTVHLTOfflineSource.h | 8 ++-- DQMOffline/Trigger/src/BTVHLTOfflineSource.cc | 40 ++++++++++--------- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/DQMOffline/Trigger/interface/BTVHLTOfflineSource.h b/DQMOffline/Trigger/interface/BTVHLTOfflineSource.h index 0c3184575cae2..088df64d9d84d 100644 --- a/DQMOffline/Trigger/interface/BTVHLTOfflineSource.h +++ b/DQMOffline/Trigger/interface/BTVHLTOfflineSource.h @@ -127,9 +127,9 @@ class BTVHLTOfflineSource : public DQMEDAnalyzer { // MonitorElement* const n_pixel_hits, MonitorElement* const n_total_hits ) { Discr_ = Discr; Pt_ = Pt; Eta_ = Eta; - Discr_HLTvsRECO_ = Discr_HLTvsRECO; Discr_HLTvsRECO_ = Discr_HLTMinusRECO; + Discr_HLTvsRECO_ = Discr_HLTvsRECO; Discr_HLTMinusRECO_ = Discr_HLTMinusRECO; Discr_turnon_loose_ = Discr_turnon_loose; Discr_turnon_medium_ = Discr_turnon_medium; Discr_turnon_tight_ = Discr_turnon_tight; - PVz_ = PVz; fastPVz_ = fastPVz; fastPVz_HLTMinusRECO_ = fastPVz_HLTMinusRECO; + PVz_ = PVz; fastPVz_ = fastPVz; PVz_HLTMinusRECO_ = PVz_HLTMinusRECO; fastPVz_HLTMinusRECO_ = fastPVz_HLTMinusRECO; n_vtx_ = n_vtx; vtx_mass_ = vtx_mass; n_vtx_trks_ = n_vtx_trks; n_sel_tracks_ = n_sel_tracks; h_3d_ip_distance_ = h_3d_ip_distance; h_3d_ip_error_ = h_3d_ip_error; h_3d_ip_sig_ = h_3d_ip_sig; @@ -158,9 +158,9 @@ class BTVHLTOfflineSource : public DQMEDAnalyzer { MonitorElement * getMEhisto_Eta() { return Eta_;} MonitorElement * getMEhisto_Discr_HLTvsRECO() { return Discr_HLTvsRECO_;} MonitorElement * getMEhisto_Discr_HLTMinusRECO() { return Discr_HLTMinusRECO_;} - MonitorElement * getMEhisto_Discr_turnon_loose() { return Discr_turnon_loose_;} + MonitorElement * getMEhisto_Discr_turnon_loose() { return Discr_turnon_loose_;} MonitorElement * getMEhisto_Discr_turnon_medium() { return Discr_turnon_medium_;} - MonitorElement * getMEhisto_Discr_turnon_tight() { return Discr_turnon_tight_;} + MonitorElement * getMEhisto_Discr_turnon_tight() { return Discr_turnon_tight_;} MonitorElement * getMEhisto_PVz() { return PVz_;} MonitorElement * getMEhisto_fastPVz() { return fastPVz_;} MonitorElement * getMEhisto_PVz_HLTMinusRECO() { return PVz_HLTMinusRECO_;} diff --git a/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc b/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc index 7e546f25eb887..bf468d6926dd8 100644 --- a/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc +++ b/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc @@ -77,34 +77,32 @@ BTVHLTOfflineSource::BTVHLTOfflineSource(const edm::ParameterSet& iConfig) BTVHLTOfflineSource::~BTVHLTOfflineSource() = default; + void BTVHLTOfflineSource::dqmBeginRun(const edm::Run& run, const edm::EventSetup& c) { - bool changed(true); - if (!hltConfig_.init(run, c, processname_, changed)) { - LogDebug("BTVHLTOfflineSource") << "HLTConfigProvider failed to initialize."; - } + bool changed = true; + if (!hltConfig_.init(run, c, processname_, changed)) { + LogDebug("BTVHLTOfflineSource") << "HLTConfigProvider failed to initialize."; + } - const unsigned int numberOfPaths(hltConfig_.size()); - for(unsigned int i=0; i!=numberOfPaths; ++i){ + for (unsigned int i=0; i!=hltConfig_.size(); ++i) { pathname_ = hltConfig_.triggerName(i); filtername_ = "dummy"; unsigned int usedPrescale = 1; unsigned int objectType = 0; std::string triggerType = ""; - bool trigSelected = false; - for (auto & custompathnamepair : custompathnamepairs_){ - if(pathname_.find(custompathnamepair.first)!=std::string::npos) { trigSelected = true; triggerType = custompathnamepair.second;} + for (auto & custompathnamepair : custompathnamepairs_) { + if(pathname_.find(custompathnamepair.first) != std::string::npos) { + triggerType = custompathnamepair.second; + hltPathsAll_.push_back( + PathInfo(usedPrescale, pathname_, "dummy", processname_, objectType, triggerType)); } - - if (!trigSelected) continue; - - hltPathsAll_.push_back(PathInfo(usedPrescale, pathname_, "dummy", processname_, objectType, triggerType)); - } - - + } + } } + void BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { @@ -150,7 +148,10 @@ BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iS if(!triggerResults_.isValid()) return; for(auto & v : hltPathsAll_) { - float DR = 9999.; + unsigned index = triggerNames_.triggerIndex(v.getPath()); + if (!(index < triggerNames_.size())) { + continue; + } // PF and Calo btagging if ( (v.getTriggerType() == "PF" && pfTags.isValid()) @@ -166,7 +167,7 @@ BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iS v.getMEhisto_Pt()->Fill(iter->first->pt()); v.getMEhisto_Eta()->Fill(iter->first->eta()); - DR = 9999.; + float DR = 9999.; if(offlineJetTagHandler.isValid()){ for (auto const & iterO : *offlineJetTagHandler){ float Discr_offline = iterO.second; @@ -197,11 +198,12 @@ BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iS if (VertexHandler.isValid()) { v.getMEhisto_fastPVz()->Fill(VertexHandler->begin()->z()); if (offlineVertexHandler.isValid()) { - v.getMEhisto_PVz_HLTMinusRECO()->Fill(VertexHandler->begin()->z()-offlineVertexHandler->begin()->z()); + v.getMEhisto_fastPVz_HLTMinusRECO()->Fill(VertexHandler->begin()->z()-offlineVertexHandler->begin()->z()); } } } + // additional plots from tag info collections ///////////////////////////////////////////// From a6b411423f6ec3deceecbd6e2c0b3ae42c533842 Mon Sep 17 00:00:00 2001 From: Chris West Date: Wed, 4 Apr 2018 20:37:04 +0200 Subject: [PATCH 345/426] Revert "Do not truncate QIE11 linearization LUTs at 10 bits" This reverts commit 21db65c2e43b405e3a19f60230f7b7c72165c001. --- .../HcalTPGAlgos/interface/HcaluLUTTPGCoder.h | 8 +++----- CalibCalorimetry/HcalTPGAlgos/src/HcaluLUTTPGCoder.cc | 4 +--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/CalibCalorimetry/HcalTPGAlgos/interface/HcaluLUTTPGCoder.h b/CalibCalorimetry/HcalTPGAlgos/interface/HcaluLUTTPGCoder.h index 1e8106c233031..160651c147a1a 100644 --- a/CalibCalorimetry/HcalTPGAlgos/interface/HcaluLUTTPGCoder.h +++ b/CalibCalorimetry/HcalTPGAlgos/interface/HcaluLUTTPGCoder.h @@ -64,9 +64,7 @@ class HcaluLUTTPGCoder : public HcalTPGCoder { static const int QIE8_LUT_BITMASK = 0x3FF; static const int QIE10_LUT_BITMASK = 0x7FF; - static const int QIE11_LUT_BITMASK = 0x7FF; - // only the lowest 10 bits were used in 2017 - static const int QIE11_LUT_BITMASK_2017 = 0x3FF; + static const int QIE11_LUT_BITMASK = 0x3FF; private: // typedef @@ -79,8 +77,8 @@ class HcaluLUTTPGCoder : public HcalTPGCoder { static const int nFi_ = 72; static const int QIE8_LUT_MSB = 0x400; - static const int QIE11_LUT_MSB0 = 0x800; - static const int QIE11_LUT_MSB1 = 0x1000; + static const int QIE11_LUT_MSB0 = 0x400; + static const int QIE11_LUT_MSB1 = 0x800; static const int QIE10_LUT_MSB = 0x1000; // member variables diff --git a/CalibCalorimetry/HcalTPGAlgos/src/HcaluLUTTPGCoder.cc b/CalibCalorimetry/HcalTPGAlgos/src/HcaluLUTTPGCoder.cc index 46f3c73f00605..f0f29135233d8 100644 --- a/CalibCalorimetry/HcalTPGAlgos/src/HcaluLUTTPGCoder.cc +++ b/CalibCalorimetry/HcalTPGAlgos/src/HcaluLUTTPGCoder.cc @@ -35,7 +35,6 @@ const float HcaluLUTTPGCoder::lsb_=1./16; const int HcaluLUTTPGCoder::QIE8_LUT_BITMASK; const int HcaluLUTTPGCoder::QIE10_LUT_BITMASK; const int HcaluLUTTPGCoder::QIE11_LUT_BITMASK; -const int HcaluLUTTPGCoder::QIE11_LUT_BITMASK_2017; constexpr double MaximumFractionalError = 0.002; // 0.2% error allowed from this source @@ -348,8 +347,7 @@ void HcaluLUTTPGCoder::update(const HcalDbService& conditions) { const size_t SIZE = qieType==QIE8 ? INPUT_LUT_SIZE : UPGRADE_LUT_SIZE; const int MASK = qieType==QIE8 ? QIE8_LUT_BITMASK : - qieType==QIE10 ? QIE10_LUT_BITMASK : - is2018OrLater ? QIE11_LUT_BITMASK : QIE11_LUT_BITMASK_2017; + qieType==QIE10 ? QIE10_LUT_BITMASK : QIE11_LUT_BITMASK; double linearLSB = linearLSB_QIE8_; if (qieType == QIE11 and cell.ietaAbs() == topo_->lastHBRing()) linearLSB = linearLSB_QIE11Overlap_; From c7007c2ecf56ba7525b97de044f2d5bc6878f461 Mon Sep 17 00:00:00 2001 From: Luca Date: Wed, 4 Apr 2018 23:24:38 +0200 Subject: [PATCH 346/426] data GT --- Configuration/AlCa/python/autoCond.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Configuration/AlCa/python/autoCond.py b/Configuration/AlCa/python/autoCond.py index eda421e463130..ca55939787f8b 100644 --- a/Configuration/AlCa/python/autoCond.py +++ b/Configuration/AlCa/python/autoCond.py @@ -24,21 +24,21 @@ # GlobalTag for MC production (p-Pb collisions) with realistic alignment and calibrations for Run2 'run2_mc_pa' : '101X_mcRun2_pA_v4', # GlobalTag for Run1 data reprocessing - 'run1_data' : '101X_dataRun2_v7', + 'run1_data' : '101X_dataRun2_v8', # GlobalTag for Run2 data reprocessing - 'run2_data' : '101X_dataRun2_v7', + 'run2_data' : '101X_dataRun2_v8', # GlobalTag for Run2 data relvals: allows customization to run with fixed L1 menu - 'run2_data_relval' : '101X_dataRun2_relval_v7', + 'run2_data_relval' : '101X_dataRun2_relval_v8', # GlobalTag for Run2 data 2016H relvals only: Prompt Conditions + fixed L1 menu (to be removed) - 'run2_data_promptlike' : '101X_dataRun2_PromptLike_v7', + 'run2_data_promptlike' : '101X_dataRun2_PromptLike_v8', # GlobalTag for Run1 HLT: it points to the online GT - 'run1_hlt' : '101X_dataRun2_HLT_frozen_v5', + 'run1_hlt' : '101X_dataRun2_HLT_frozen_v6', # GlobalTag for Run2 HLT: it points to the online GT - 'run2_hlt' : '101X_dataRun2_HLT_frozen_v5', + 'run2_hlt' : '101X_dataRun2_HLT_frozen_v6', # GlobalTag for Run2 HLT RelVals: customizations to run with fixed L1 Menu - 'run2_hlt_relval' : '101X_dataRun2_HLT_relval_v6', + 'run2_hlt_relval' : '101X_dataRun2_HLT_relval_v7', # GlobalTag for Run2 HLT for HI: it points to the online GT - 'run2_hlt_hi' : '101X_dataRun2_HLTHI_frozen_v6', + 'run2_hlt_hi' : '101X_dataRun2_HLTHI_frozen_v7', # GlobalTag for MC production with perfectly aligned and calibrated detector for Phase1 2017 (and 0,0,~0-centred beamspot) 'phase1_2017_design' : '101X_mc2017_design_IdealBS_v6', # GlobalTag for MC production with realistic conditions for Phase1 2017 detector From 9fc622c5d3305ca9317c612298f4ef4b93efa7d5 Mon Sep 17 00:00:00 2001 From: tocheng Date: Wed, 4 Apr 2018 23:50:38 +0200 Subject: [PATCH 347/426] remove perROC digi occupancy and variance from private members of SiPixelModuleStatus and SiPixelDetectorStatus to reduce size and memory cost --- .../interface/SiPixelDetectorStatus.h | 14 ++- .../interface/SiPixelModuleStatus.h | 2 - .../interface/SiPixelRocStatus.h | 2 - .../src/SiPixelDetectorStatus.cc | 90 +++++++++---------- .../SiPixelQuality/src/SiPixelModuleStatus.cc | 36 +++----- .../SiPixelQuality/src/classes_def.xml | 8 +- 6 files changed, 64 insertions(+), 88 deletions(-) diff --git a/CalibTracker/SiPixelQuality/interface/SiPixelDetectorStatus.h b/CalibTracker/SiPixelQuality/interface/SiPixelDetectorStatus.h index d2dd3fbd6190f..21a784ebae6bf 100644 --- a/CalibTracker/SiPixelQuality/interface/SiPixelDetectorStatus.h +++ b/CalibTracker/SiPixelQuality/interface/SiPixelDetectorStatus.h @@ -32,9 +32,9 @@ class SiPixelDetectorStatus { std::map> getFEDerror25Rocs(); // determine detector average nhits and RMS - void digiOccupancy(); - double perRocDigiOcc(){ digiOccupancy(); return fDetAverage; } - double perRocDigiOccVar(){ digiOccupancy(); return fDetSigma; } + double perRocDigiOcc(); + double perRocDigiOccVar(); + unsigned long int digiOccDET(){ return fDetHits; } // number of modules in detector @@ -59,7 +59,7 @@ class SiPixelDetectorStatus { void setNevents(unsigned long int N){ fNevents = N; } unsigned long int getNevents(){ return fNevents; } - void resetDetectorStatus() { fModules.clear(); fDetAverage=0; fDetSigma=0; fDetHits=0; fNevents=0; + void resetDetectorStatus() { fModules.clear(); fDetHits=0; fNevents=0; fRun0 = 99999999; fRun1 = 0; fLS0 = 99999999; fLS1 = 0; } @@ -75,16 +75,12 @@ class SiPixelDetectorStatus { // first and last lumisection seen in this instance int fLS0, fLS1; - - // first and last run seen in this instance (likely to be the same number!) + // first and last run seen in this instance (should be the same number!) int fRun0, fRun1; // number of events processed unsigned long int fNevents; - // average (per module) number of hits over entire detector - double fDetAverage, fDetSigma; - // total hits in detector unsigned long int fDetHits; diff --git a/CalibTracker/SiPixelQuality/interface/SiPixelModuleStatus.h b/CalibTracker/SiPixelQuality/interface/SiPixelModuleStatus.h index d891122bcd450..c9c8fc6f5acfe 100644 --- a/CalibTracker/SiPixelQuality/interface/SiPixelModuleStatus.h +++ b/CalibTracker/SiPixelQuality/interface/SiPixelModuleStatus.h @@ -39,7 +39,6 @@ class SiPixelModuleStatus { void setNrocs(int iroc); /// calculate (averaged over this module's ROCs) mean hit number and its sigma - void digiOccupancy(); double perRocDigiOcc(); double perRocDigiOccVar(); @@ -50,7 +49,6 @@ class SiPixelModuleStatus { private: int fDetid, fNrocs; - double fModAverage, fModSigma; std::vector fRocs; }; diff --git a/CalibTracker/SiPixelQuality/interface/SiPixelRocStatus.h b/CalibTracker/SiPixelQuality/interface/SiPixelRocStatus.h index 1f79df0199352..8606b6a4b867d 100644 --- a/CalibTracker/SiPixelQuality/interface/SiPixelRocStatus.h +++ b/CalibTracker/SiPixelQuality/interface/SiPixelRocStatus.h @@ -1,8 +1,6 @@ #ifndef SIPIXELROCSTATUS_h #define SIPIXELROCSTATUS_h -#include - // ---------------------------------------------------------------------- class SiPixelRocStatus { public: diff --git a/CalibTracker/SiPixelQuality/src/SiPixelDetectorStatus.cc b/CalibTracker/SiPixelQuality/src/SiPixelDetectorStatus.cc index 54245569ff683..ad266ec13e7b5 100644 --- a/CalibTracker/SiPixelQuality/src/SiPixelDetectorStatus.cc +++ b/CalibTracker/SiPixelQuality/src/SiPixelDetectorStatus.cc @@ -9,15 +9,11 @@ #include #include "CalibTracker/SiPixelQuality/interface/SiPixelDetectorStatus.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -using namespace std; - // ---------------------------------------------------------------------- -SiPixelDetectorStatus::SiPixelDetectorStatus(): fLS0(99999999), fLS1(0), fRun0(99999999), fRun1(0), fDetHits(0) { +SiPixelDetectorStatus::SiPixelDetectorStatus(): fLS0(99999999), fLS1(0), fRun0(99999999), fRun1(0) { - fDetAverage = fDetSigma = 0.; + fDetHits = 0; fNevents = 0; } @@ -31,41 +27,41 @@ SiPixelDetectorStatus::~SiPixelDetectorStatus() { // ---------------------------------------------------------------------- void SiPixelDetectorStatus::readFromFile(std::string filename) { - ifstream INS; - string sline; + std::ifstream INS; + std::string sline; INS.open(filename.c_str()); int oldDetId(-1); int detid(0), roc(0), hits(0), nroc(0); SiPixelModuleStatus *pMod(nullptr); bool readOK(false); - while (getline(INS, sline)) { + while (std::getline(INS, sline)) { - if (string::npos != sline.find("# SiPixelDetectorStatus START")) { + if (std::string::npos != sline.find("# SiPixelDetectorStatus START")) { readOK = true; continue; } if (!readOK) continue; - if (string::npos != sline.find("# SiPixelDetectorStatus END")) { + if (std::string::npos != sline.find("# SiPixelDetectorStatus END")) { pMod->setNrocs(nroc+1); break; } - if (sline.find("# SiPixelDetectorStatus for LS") != string::npos) { - sscanf(sline.c_str(), "# SiPixelDetectorStatus for LS %d .. %d", &fLS0, &fLS1); + if (sline.find("# SiPixelDetectorStatus for LS") != std::string::npos) { + std::sscanf(sline.c_str(), "# SiPixelDetectorStatus for LS %d .. %d", &fLS0, &fLS1); continue; } - if (sline.find("# SiPixelDetectorStatus for run") != string::npos) { - sscanf(sline.c_str(), "# SiPixelDetectorStatus for run %d .. %d", &fRun0, &fRun1); + if (sline.find("# SiPixelDetectorStatus for run") != std::string::npos) { + std::sscanf(sline.c_str(), "# SiPixelDetectorStatus for run %d .. %d", &fRun0, &fRun1); continue; } - if (sline.find("# SiPixelDetectorStatus total hits = ") != string::npos) { - sscanf(sline.c_str(), "# SiPixelDetectorStatus total hits = %ld", &fDetHits); + if (sline.find("# SiPixelDetectorStatus total hits = ") != std::string::npos) { + std::sscanf(sline.c_str(), "# SiPixelDetectorStatus total hits = %ld", &fDetHits); continue; } - sscanf(sline.c_str(), "%d %d %d", &detid, &roc, &hits); + std::sscanf(sline.c_str(), "%d %d %d", &detid, &roc, &hits); if (roc > nroc) nroc = roc; if (detid != oldDetId) { if (pMod) { @@ -95,20 +91,20 @@ void SiPixelDetectorStatus::readFromFile(std::string filename) { // ---------------------------------------------------------------------- void SiPixelDetectorStatus::dumpToFile(std::string filename) { - ofstream OD(filename.c_str()); - OD << "# SiPixelDetectorStatus START" << endl; - OD << "# SiPixelDetectorStatus for LS " << fLS0 << " .. " << fLS1 << endl; - OD << "# SiPixelDetectorStatus for run " << fRun0 << " .. " << fRun1 << endl; - OD << "# SiPixelDetectorStatus total hits = " << fDetHits << endl; - map::iterator itEnd = end(); - for (map::iterator it = begin(); it != itEnd; ++it) { + std::ofstream OD(filename.c_str()); + OD << "# SiPixelDetectorStatus START" << std::endl; + OD << "# SiPixelDetectorStatus for LS " << fLS0 << " .. " << fLS1 << std::endl; + OD << "# SiPixelDetectorStatus for run " << fRun0 << " .. " << fRun1 << std::endl; + OD << "# SiPixelDetectorStatus total hits = " << fDetHits << std::endl; + + for (std::map::iterator it = SiPixelDetectorStatus::begin(); it != SiPixelDetectorStatus::end(); ++it) { for (int iroc = 0; iroc < it->second.nrocs(); ++iroc) { for (int idc = 0; idc < 26; ++idc) { - OD << Form("%10d %2d %3d", it->first, iroc, int(it->second.getRoc(iroc)->digiOccROC())) << endl; + OD << Form("%10d %2d %3d", it->first, iroc, int(it->second.getRoc(iroc)->digiOccROC())) << std::endl; } } } - OD << "# SiPixelDetectorStatus END" << endl; + OD << "# SiPixelDetectorStatus END" << std::endl; OD.close(); } @@ -118,14 +114,14 @@ void SiPixelDetectorStatus::dumpToFile(std::string filename) { void SiPixelDetectorStatus::addModule(int detid, int nrocs) { SiPixelModuleStatus a(detid, nrocs); - fModules.insert(make_pair(detid, a)); + fModules.insert(std::make_pair(detid, a)); } // ---------------------------------------------------------------------- void SiPixelDetectorStatus::addModule(int detid, SiPixelModuleStatus a) { - fModules.insert(make_pair(detid, a)); + fModules.insert(std::make_pair(detid, a)); } @@ -152,9 +148,8 @@ std::map> SiPixelDetectorStatus::getFEDerror25Rocs(){ std::map> badRocLists_; - std::map::iterator itModEnd = end(); - for (std::map::iterator itMod = begin(); itMod != itModEnd; ++itMod) { - + for(std::map::iterator itMod = SiPixelDetectorStatus::begin(); itMod != SiPixelDetectorStatus::end(); ++itMod) + { int detid = itMod->first; // FEDerror25 effected ROCs in a given module std::vector list; @@ -219,42 +214,47 @@ bool SiPixelDetectorStatus::findModule(int detid) { } // ---------------------------------------------------------------------- -void SiPixelDetectorStatus::digiOccupancy() { +double SiPixelDetectorStatus::perRocDigiOcc() { - fDetAverage = fDetSigma = 0; - unsigned long int ave(0), sig(0); + unsigned long int ave(0); int nrocs(0); - map::iterator itEnd = end(); - for (map::iterator it = begin(); it != itEnd; ++it) { + for (std::map::iterator it = SiPixelDetectorStatus::begin(); it != SiPixelDetectorStatus::end(); ++it) { unsigned long int inc = it->second.digiOccMOD(); ave += inc; nrocs += it->second.nrocs(); } - fDetAverage = (1.0*ave)/nrocs; + return (1.0*ave)/nrocs; + +} - for (map::iterator it = begin(); it != itEnd; ++it) { +double SiPixelDetectorStatus::perRocDigiOccVar(){ + + double fDetAverage = SiPixelDetectorStatus::perRocDigiOcc(); + + double sig = 0.0; + int nrocs(0); + for(std::map::iterator it = SiPixelDetectorStatus::begin(); it != SiPixelDetectorStatus::end(); ++it) { unsigned long int inc = it->second.digiOccMOD(); sig += (fDetAverage - inc) * (fDetAverage - inc); + nrocs += it->second.nrocs(); } - fDetSigma = sig/(nrocs - 1); - fDetSigma = TMath::Sqrt(fDetSigma); - + double fDetSigma = sig/(nrocs - 1); + return TMath::Sqrt(fDetSigma); } // combine status from different data (coming from different run/lumi) void SiPixelDetectorStatus::updateDetectorStatus(SiPixelDetectorStatus newData){ // loop over new data status - std::map::iterator itEnd = newData.end(); - for (map::iterator it = newData.begin(); it != itEnd; ++it) { + for(std::map::iterator it = newData.begin(); it != newData.end(); ++it) { int detid = it->first; if(fModules.find(detid) != fModules.end()){// if the detid is in the module lists fModules[detid].updateModuleStatus( *(newData.getModule(detid)) ); } else{ - fModules.insert(make_pair(detid, *(newData.getModule(detid)))); + fModules.insert(std::make_pair(detid, *(newData.getModule(detid)))); } } diff --git a/CalibTracker/SiPixelQuality/src/SiPixelModuleStatus.cc b/CalibTracker/SiPixelQuality/src/SiPixelModuleStatus.cc index c3c982b755773..7de17ac04b0ee 100644 --- a/CalibTracker/SiPixelQuality/src/SiPixelModuleStatus.cc +++ b/CalibTracker/SiPixelQuality/src/SiPixelModuleStatus.cc @@ -8,8 +8,6 @@ #include "CalibTracker/SiPixelQuality/interface/SiPixelModuleStatus.h" -using namespace std; - // ---------------------------------------------------------------------- SiPixelModuleStatus::SiPixelModuleStatus(int detId, int nrocs): fDetid(detId), fNrocs(nrocs) { @@ -18,8 +16,6 @@ SiPixelModuleStatus::SiPixelModuleStatus(int detId, int nrocs): fDetid(detId), f fRocs.push_back(a); } - fModAverage = fModSigma = 0.; - }; @@ -94,42 +90,30 @@ void SiPixelModuleStatus::setNrocs(int iroc) { } - // ---------------------------------------------------------------------- double SiPixelModuleStatus::perRocDigiOcc() { - digiOccupancy(); - return fModAverage; - -} - - -// ---------------------------------------------------------------------- -double SiPixelModuleStatus::perRocDigiOccVar() { - - digiOccupancy(); - return fModSigma; - -} - -// ---------------------------------------------------------------------- -void SiPixelModuleStatus::digiOccupancy() { - - fModAverage = fModSigma = 0.; unsigned int ave(0), sig(0); for (int iroc = 0; iroc < fNrocs; ++iroc) { unsigned int inc = digiOccROC(iroc); ave += inc; } - fModAverage = (1.0*ave)/fNrocs; + return (1.0*ave)/fNrocs; + +} + +double SiPixelModuleStatus::perRocDigiOccVar() { + + double fModAverage = SiPixelModuleStatus::perRocDigiOcc(); + double sig = 1.0; for (int iroc = 0; iroc < fNrocs; ++iroc) { unsigned int inc = digiOccROC(iroc); sig += (fModAverage-inc)*(fModAverage-inc); } - fModSigma = sig/(fNrocs-1); - fModSigma = TMath::Sqrt(fModSigma); + double fModSigma = sig/(fNrocs-1); + return TMath::Sqrt(fModSigma); } diff --git a/CalibTracker/SiPixelQuality/src/classes_def.xml b/CalibTracker/SiPixelQuality/src/classes_def.xml index 7b17355ed9170..ce92229721d54 100644 --- a/CalibTracker/SiPixelQuality/src/classes_def.xml +++ b/CalibTracker/SiPixelQuality/src/classes_def.xml @@ -3,13 +3,13 @@ - - + + - - + + From ac4a23ca99457fd992e0f42a0b9c4eb8d0d20920 Mon Sep 17 00:00:00 2001 From: tocheng Date: Thu, 5 Apr 2018 08:40:52 +0200 Subject: [PATCH 348/426] Add more info for SiPixelStatusProducer; in the harvester, read in all data in all lumi sections by std::vector then rank it by lumi --- .../interface/SiPixelStatusManager.h | 10 +- .../plugins/SiPixelStatusHarvester.cc | 156 +++++++++--------- .../plugins/SiPixelStatusHarvester.h | 8 +- .../plugins/SiPixelStatusProducer.cc | 39 +++-- .../python/SiPixelStatusHarvester_cfi.py | 4 +- .../src/SiPixelStatusManager.cc | 133 ++++++++------- .../python/AlCaHarvesting_cff.py | 8 + 7 files changed, 201 insertions(+), 157 deletions(-) diff --git a/CalibTracker/SiPixelQuality/interface/SiPixelStatusManager.h b/CalibTracker/SiPixelQuality/interface/SiPixelStatusManager.h index a52c3dd2d2d31..388c6794a0e1b 100644 --- a/CalibTracker/SiPixelQuality/interface/SiPixelStatusManager.h +++ b/CalibTracker/SiPixelQuality/interface/SiPixelStatusManager.h @@ -15,6 +15,8 @@ #include #include #include +#include // std::sort +#include // std::vector //Data format #include "CalibTracker/SiPixelQuality/interface/SiPixelDetectorStatus.h" @@ -29,22 +31,22 @@ class SiPixelStatusManager { void reset(); void readLumi(const edm::LuminosityBlock&); - void createPayloads(){ - createFEDerror25(); - createBadComponents(); - } + void createPayloads(); const std::map& getBadComponents(){return siPixelStatusMap_; } const std::map> >& getFEDerror25Rocs(){return FEDerror25Map_;} typedef std::map::iterator siPixelStatusMap_iterator; typedef std::map> >::iterator FEDerror25Map_iterator; + typedef std::vector::iterator siPixelStatusVtr_iterator; private: + static bool rankByLumi(SiPixelDetectorStatus status1, SiPixelDetectorStatus status2); void createFEDerror25(); void createBadComponents(); + std::vector siPixelStatusVtr_; std::map siPixelStatusMap_; std::map> > FEDerror25Map_; diff --git a/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.cc b/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.cc index ce9d7f04646e3..d5ad30eb76a1e 100644 --- a/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.cc +++ b/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.cc @@ -44,16 +44,14 @@ using namespace edm; //-------------------------------------------------------------------------------------------------- SiPixelStatusHarvester::SiPixelStatusHarvester(const edm::ParameterSet& iConfig) : outputBase_(iConfig.getParameter("SiPixelStatusManagerParameters").getUntrackedParameter("outputBase")), - aveDigiOcc_(iConfig.getParameter("SiPixelStatusManagerParameters").getUntrackedParameter("aveDigiOcc", 20000)), + aveDigiOcc_(iConfig.getParameter("SiPixelStatusManagerParameters").getUntrackedParameter("aveDigiOcc")), nLumi_(iConfig.getParameter("SiPixelStatusManagerParameters").getUntrackedParameter("resetEveryNLumi")), moduleName_(iConfig.getParameter("SiPixelStatusManagerParameters").getUntrackedParameter("moduleName")), label_(iConfig.getParameter("SiPixelStatusManagerParameters").getUntrackedParameter("label")), - siPixelStatusManager_(iConfig, consumesCollector()) { + siPixelStatusManager_(iConfig, consumesCollector()){ + debug_ = iConfig.getUntrackedParameter("debug"); recordName_ = iConfig.getUntrackedParameter("recordName", "SiPixelQualityFromDbRcd"); - debug_ = iConfig.getUntrackedParameter("debug",false); - dumpTxt_ = iConfig.getUntrackedParameter("dumpTxt",false); - outTxtFileName_ = iConfig.getUntrackedParameter("txtFileName"); } @@ -100,6 +98,11 @@ void SiPixelStatusHarvester::endRun(const edm::Run& iRun, const edm::EventSetup& siPixelQualityPermBad->addDisabledModule(badComponentList[i]); } + // IOV for final payloads. FEDerror25 and pcl + std::map finalIOV; + std::map fedError25IOV; + std::map pclIOV; + // stuckTBM tag from FED error 25 with permanent component removed for(SiPixelStatusManager::FEDerror25Map_iterator it=FEDerror25Map.begin(); it!=FEDerror25Map.end();it++){ @@ -143,35 +146,37 @@ void SiPixelStatusHarvester::endRun(const edm::Run& iRun, const edm::EventSetup& BadModule.BadRocs = badrocs; siPixelQuality->addDisabledModule(BadModule); } - } - if (poolDbService->isNewTagRequest(recordName_+"_stuckTBM") ) { - edm::LogInfo("SiPixelStatusHarvester") - << "new tag requested for stuckTBM" << std::endl; - poolDbService->writeOne(siPixelQuality, thisIOV, recordName_+"_stuckTBM"); - } - else { - edm::LogInfo("SiPixelStatusHarvester") - << "no new tag requested, appending IOV for stuckTBM" << std::endl; - poolDbService->writeOne(siPixelQuality, thisIOV, recordName_+"_stuckTBM"); - } + } // loop over modules + + finalIOV[it->first] = it->first; + fedError25IOV[it->first] = it->first; + + poolDbService->writeOne(siPixelQuality, thisIOV, recordName_+"_stuckTBM"); } - // Payload for PCL combines permanent bad/stuckTBM/other + // IOV for PCL combines permanent bad/stuckTBM/other for(SiPixelStatusManager::siPixelStatusMap_iterator it=siPixelStatusMap.begin(); it!=siPixelStatusMap.end();it++){ + finalIOV[it->first] = it->first; + pclIOV[it->first] = it->first; + } + + // loop over final IOV + std::map::iterator itIOV; + for(itIOV=finalIOV.begin();itIOV!=finalIOV.end();itIOV++){ cond::Time_t thisIOV = 1; + edm::LuminosityBlockID lu(iRun.id().run(),itIOV->first); + thisIOV = (cond::Time_t)(lu.value()); - if (outputBase_ == "runbased") { - thisIOV = (cond::Time_t) iRun.id().run(); - } - else if (outputBase_ == "nLumibased" || outputBase_ == "dynamicLumibased" ) { - edm::LuminosityBlockID lu(iRun.id().run(),it->first); - thisIOV = (cond::Time_t)(lu.value()); - } + edm::LuminosityBlockNumber_t lumiStuckTBMs = SiPixelStatusHarvester::stepIOV(itIOV->first,fedError25IOV); + edm::LuminosityBlockNumber_t lumiPCL = SiPixelStatusHarvester::stepIOV(itIOV->first,pclIOV); - SiPixelDetectorStatus tmpSiPixelStatus = it->second; + // get badROC list due to FEDerror25 = stuckTBM + permanent bad components + std::map > tmpFEDerror25 = FEDerror25Map[lumiStuckTBMs]; + // get SiPixelDetectorStatus + SiPixelDetectorStatus tmpSiPixelStatus = siPixelStatusMap[lumiPCL]; double DetAverage = tmpSiPixelStatus.perRocDigiOcc(); // For the IOV of which the statistics is too low, for e.g., a cosmic run @@ -197,19 +202,14 @@ void SiPixelStatusHarvester::endRun(const edm::Run& iRun, const edm::EventSetup& // create the DB object // payload including all : PCL = permanent bad + other + stuckTBM SiPixelQuality *siPixelQualityPCL = new SiPixelQuality(); - // payload for prompt reco : permanent bad + other sources of bad components SiPixelQuality *siPixelQualityPrompt = new SiPixelQuality(); - // payload for : other sources of bad components SiPixelQuality *siPixelQualityOther = new SiPixelQuality(); - // get badROC list due to FEDerror25 = stuckTBM + permanent bad components - std::map > tmpFEDerror25 = tmpSiPixelStatus.getFEDerror25Rocs(); - std::map detectorStatus = tmpSiPixelStatus.getDetectorStatus(); std::map::iterator itModEnd = detectorStatus.end(); for (std::map::iterator itMod = detectorStatus.begin(); itMod != itModEnd; ++itMod) { - // create the bad module list + // create the bad module list for PCL, prompt and other SiPixelQuality::disabledModuleType BadModulePCL, BadModulePrompt, BadModuleOther; int detid = itMod->first; @@ -234,89 +234,73 @@ void SiPixelStatusHarvester::endRun(const edm::Run& iRun, const edm::EventSetup& // Bad ROC are from low DIGI Occ ROCs if(rocOccupancy<1.e-4*DetAverage){ + //PCL bad roc list BadRocListPCL.push_back(uint32_t(iroc)); + //FEDerror25 list std::vector::iterator it = std::find(listFEDerror25.begin(), listFEDerror25.end(),iroc); - // from prompt = permanent bad + other + // from prompt = PCL bad - stuckTBM = PCL bad - FEDerror25 + permanent bad if(it==listFEDerror25.end() || badPixelInfo_->IsRocBad(detid, iroc)) - // if permanent or not stuck TBM( this is to say either in the FEDerror25 list or permanent bdd) - BadRocListPrompt.push_back(uint32_t(iroc)); + // if not FEDerror25 or permanent bad + BadRocListPrompt.push_back(uint32_t(iroc)); - // other source of bad components + // other source of bad components = prompt - permanent bad = PCL bad - FEDerror25 + // or to be safe, say not FEDerro25 and not permanent bad if(it==listFEDerror25.end() && !(badPixelInfo_->IsRocBad(detid, iroc))) - // if not permanent and not stuck TBM( this is to say either in the FEDerror25 list or permanent bdd) - BadRocListOther.push_back(uint32_t(iroc)); - + // if not permanent and not stuck TBM + BadRocListOther.push_back(uint32_t(iroc)); + } - } + + } // loop over ROCs if(BadRocListPCL.size()==16) BadModulePCL.errorType = 0; if(BadRocListPrompt.size()==16) BadModulePrompt.errorType = 0; if(BadRocListOther.size()==16) BadModuleOther.errorType = 0; + // pcl short badrocsPCL = 0; for(std::vector::iterator iterPCL = BadRocListPCL.begin(); iterPCL != BadRocListPCL.end(); ++iterPCL){ badrocsPCL += 1 << *iterPCL; // 1 << *iter = 2^{*iter} using bitwise shift } - // fill the badmodule only if there is(are) bad ROC(s) in it if(badrocsPCL!=0){ BadModulePCL.BadRocs = badrocsPCL; siPixelQualityPCL->addDisabledModule(BadModulePCL); } + // prompt short badrocsPrompt = 0; for(std::vector::iterator iterPrompt = BadRocListPrompt.begin(); iterPrompt != BadRocListPrompt.end(); ++iterPrompt){ badrocsPrompt += 1 << *iterPrompt; // 1 << *iter = 2^{*iter} using bitwise shift } - // fill the badmodule only if there is(are) bad ROC(s) in it if(badrocsPrompt!=0){ BadModulePrompt.BadRocs = badrocsPrompt; siPixelQualityPrompt->addDisabledModule(BadModulePrompt); } - short badrocsOther = 0; + // other + short badrocsOther= 0; for(std::vector::iterator iterOther = BadRocListOther.begin(); iterOther != BadRocListOther.end(); ++iterOther){ badrocsOther += 1 << *iterOther; // 1 << *iter = 2^{*iter} using bitwise shift } - // fill the badmodule only if there is(are) bad ROC(s) in it if(badrocsOther!=0){ BadModuleOther.BadRocs = badrocsOther; siPixelQualityOther->addDisabledModule(BadModuleOther); } - + } // end module loop + + //PCL + if(debug_==true) // only produce the tag for all sources of bad components for debugging reason + poolDbService->writeOne(siPixelQualityPCL, thisIOV, recordName_+"_PCL"); - if(debug_) // only produce the tag for all sources of bad components for debugging reason - poolDbService->writeOne(siPixelQualityPCL, thisIOV, recordName_+"_PCL"); - - if (poolDbService->isNewTagRequest(recordName_+"_prompt")) { - edm::LogInfo("SiPixelStatusHarvester") - << "new tag requested for prompt" << std::endl; - poolDbService->writeOne(siPixelQualityPrompt, thisIOV, recordName_+"_prompt"); - } - else { - edm::LogInfo("SiPixelStatusHarvester") - << "no new tag requested, appending IOV for prompt" << std::endl; - poolDbService->writeOne(siPixelQualityPrompt, thisIOV, recordName_+"_prompt"); - } - - if (poolDbService->isNewTagRequest(recordName_+"_other")) { - edm::LogInfo("SiPixelStatusHarvester") - << "new tag requested for other" << std::endl; - poolDbService->writeOne(siPixelQualityOther, thisIOV, recordName_+"_other"); - } - else { - edm::LogInfo("SiPixelStatusHarvester") - << "no new tag requested, appending IOV for other" << std::endl; - poolDbService->writeOne(siPixelQualityOther, thisIOV, recordName_+"_other"); - } + // prompt + poolDbService->writeOne(siPixelQualityPrompt, thisIOV, recordName_+"_prompt"); - if (dumpTxt_){ // text dump for the DIGI occuancy for all pixels in all ROCs for the pixle detector - std::string outTxt = Form("%s_Run%d_Lumi%d_SiPixelStatus.txt", outTxtFileName_.c_str(), iRun.id().run(),it->first); - tmpSiPixelStatus.dumpToFile(outTxt); - } + // other + poolDbService->writeOne(siPixelQualityOther, thisIOV, recordName_+"_other"); - }// loop over IOV-structured Map (payloads) + }// loop over IOV // Add a dummy IOV starting from last lumisection+1 to close the tag for the run if(outputBase_ == "nLumibased" || outputBase_ == "dynamicLumibased"){ @@ -343,7 +327,6 @@ void SiPixelStatusHarvester::beginLuminosityBlock(const edm::LuminosityBlock& iL //-------------------------------------------------------------------------------------------------- void SiPixelStatusHarvester::endLuminosityBlock(const edm::LuminosityBlock& iLumi, const edm::EventSetup& iEVentSetup) { - std::cout<<"lumi "< IOV){ + + std::map::iterator itIOV; + for(itIOV=IOV.begin();itIOV!=IOV.end();itIOV++){ + std::map::iterator nextItIOV; + nextItIOV = itIOV; nextItIOV++; + + if(nextItIOV!=IOV.end()){ + if(pin>=itIOV->first && pinfirst){ + return itIOV->first; + } + } + else{ + if(pin>=itIOV->first){ + return itIOV->first; + } + } + + } + + // return the firstIOV in case all above fail + return (IOV.begin())->first; + +} DEFINE_FWK_MODULE(SiPixelStatusHarvester); diff --git a/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.h b/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.h index f2f04b0fccebc..e27b965657afc 100644 --- a/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.h +++ b/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.h @@ -30,7 +30,6 @@ class SiPixelStatusHarvester : public edm::EDAnalyzer { protected: private: - bool debug_; // Parameters std::string outputBase_; int aveDigiOcc_; @@ -39,6 +38,8 @@ class SiPixelStatusHarvester : public edm::EDAnalyzer { std::string label_; // harvest helper classs that setup the IOV structure SiPixelStatusManager siPixelStatusManager_; + // debug mode + bool debug_; // for DB output naming std::string recordName_; @@ -48,9 +49,8 @@ class SiPixelStatusHarvester : public edm::EDAnalyzer { // last lumi section of the SiPixeDetectorStatus data edm::LuminosityBlockNumber_t endLumiBlock_; - // only for debugging - bool dumpTxt_; - std::string outTxtFileName_; + // "step function" for IOV + edm::LuminosityBlockNumber_t stepIOV(edm::LuminosityBlockNumber_t pin, std::map IOV); }; diff --git a/CalibTracker/SiPixelQuality/plugins/SiPixelStatusProducer.cc b/CalibTracker/SiPixelQuality/plugins/SiPixelStatusProducer.cc index ca73b89c4e847..5aabc3c71e7eb 100644 --- a/CalibTracker/SiPixelQuality/plugins/SiPixelStatusProducer.cc +++ b/CalibTracker/SiPixelQuality/plugins/SiPixelStatusProducer.cc @@ -110,7 +110,7 @@ void SiPixelStatusProducer::beginLuminosityBlock(edm::LuminosityBlock const& lum for (TrackerGeometry::DetContainer::const_iterator it = fTG->dets().begin(); it != fTG->dets().end(); it++){ const PixelGeomDetUnit *pgdu = dynamic_cast((*it)); - if (nullptr == pgdu) continue; + if (pgdu == nullptr) continue; DetId detId = (*it)->geographicalId(); int detid = detId.rawId(); @@ -169,13 +169,17 @@ void SiPixelStatusProducer::accumulate(edm::Event const& iEvent, const edm::Even // ---------------------------------------------------------------------- edm::Handle > hClusterColl; + if(!iEvent.getByToken(fSiPixelClusterToken_, hClusterColl)){ + edm::LogWarning("SiPixelStatusProducer") << " edmNew::DetSetVector "< "<& tk: theBadPixelFEDChannelsTokens_) { - if (!iEvent.getByToken(tk, pixelFEDChannelCollectionHandle)) continue; + // collection has to exist + if (!iEvent.getByToken(tk, pixelFEDChannelCollectionHandle)) { + edm::LogWarning("SiPixelStatusProducer") << " PixelFEDChannelCollection with index "<0) { - lumiSeg.put(std::move(result), std::string("siPixelStatus")); - edm::LogInfo("SiPixelStatusProducer") + lumiSeg.put(std::move(result), std::string("siPixelStatus")); + edm::LogInfo("SiPixelStatusProducer") << "new lumi-based data stored for run "<0){ // only put in SiPixelDetectorStatus with non zero digi (pixel hit) + siPixelStatusVtr_.push_back(tmpStatus); + } } else { - LogInfo("SiPixelStatusManager") - << "Lumi: " << iLumi.luminosityBlock() << std::endl; - LogInfo("SiPixelStatusManager") - << " SiPixelDetectorStatus is not valid!" << std::endl; + edm::LogWarning("SiPixelStatusManager") + << " SiPixelDetectorStatus is not valid for run "< tmpSiPixelStatusMap_; + siPixelStatusMap_.clear(); if(outputBase_ == "nLumibased" && nLumi_>1){ // doesn't work for nLumi_=1 cos any integer can be completely divided by 1 @@ -84,41 +101,42 @@ void SiPixelStatusManager::createBadComponents(){ LuminosityBlockNumber_t tmpLumi; SiPixelDetectorStatus tmpSiPixelStatus; - for (siPixelStatusMap_iterator it = firstStatus; it != lastStatus; it++) { - + for (siPixelStatusVtr_iterator it = firstStatus; it != lastStatus; it++) { + // this is the begining of an IOV if(iterationLumi%nLumi_==0){ - tmpLumi = it->first; - tmpSiPixelStatus = it->second; + tmpLumi = edm::LuminosityBlockNumber_t(it->getLSRange().first); + tmpSiPixelStatus = (*it); } // keep update detector status up to nLumi_ lumi sections if(iterationLumi%nLumi_>0){ - tmpSiPixelStatus.updateDetectorStatus(it->second); + tmpSiPixelStatus.updateDetectorStatus((*it)); + tmpSiPixelStatus.setLSRange(int(tmpLumi), (*it).getLSRange().second); } - siPixelStatusMap_iterator currentIt = it; - siPixelStatusMap_iterator nextIt = (++currentIt); + siPixelStatusVtr_iterator currentIt = it; + siPixelStatusVtr_iterator nextIt = (++currentIt); // wirte out if current lumi is the last lumi-section in the IOV if(iterationLumi%nLumi_==nLumi_-1 || nextIt==lastStatus) { // fill it into a new map (with IOV structured) - tmpSiPixelStatusMap_[tmpLumi] = tmpSiPixelStatus; + siPixelStatusMap_[tmpLumi] = tmpSiPixelStatus; } iterationLumi=iterationLumi+1; } // check whether there is not enough number of Lumi in the last IOV - // (only when siPixelStatusMap_.size() > nLumi_ or equivalently tmpSiPixelStatusMap_.size()>1 + // (only when siPixelStatusVtr_.size() > nLumi_ or equivalently current siPixelStatusMap_.size()>1 // (otherwise there will be only one IOV, and not previous IOV before the last IOV) // and the number of lumi can not be completely divided by the nLumi_. // (then the number of lumis in the last IOV is equal to the residual, which is less than nLumi_) // if it is, combine last IOV with the IOV before it - if(siPixelStatusMap_.size()%nLumi_!=0 && tmpSiPixelStatusMap_.size()>1){ + if(siPixelStatusVtr_.size()%nLumi_!=0 && siPixelStatusMap_.size()>1){ // start from the iterator of the end of std::map - siPixelStatusMap_iterator iterEnd = tmpSiPixelStatusMap_.end(); + siPixelStatusMap_iterator iterEnd = siPixelStatusMap_.end(); // the last IOV siPixelStatusMap_iterator iterLastIOV = std::prev(iterEnd); // the IOV before the last IOV @@ -126,43 +144,43 @@ void SiPixelStatusManager::createBadComponents(){ // combine the last IOV data to the IOV before the last IOV (iterBeforeLastIOV->second).updateDetectorStatus(iterLastIOV->second); + (iterBeforeLastIOV->second).setLSRange((iterBeforeLastIOV->second).getLSRange().first, (iterLastIOV->second).getLSRange().second); + // delete the last IOV, so the IOV before the last IOV becomes the new last IOV - tmpSiPixelStatusMap_.erase(iterLastIOV); + siPixelStatusMap_.erase(iterLastIOV); } - siPixelStatusMap_.clear(); - siPixelStatusMap_ = tmpSiPixelStatusMap_; - } else if(outputBase_ == "dynamicLumibased"){ double aveDigiOcc = 1.0*aveDigiOcc_; - LuminosityBlockNumber_t tmpLumi; + edm::LuminosityBlockNumber_t tmpLumi; SiPixelDetectorStatus tmpSiPixelStatus; bool isNewIOV = true; int counter = 0; - for (siPixelStatusMap_iterator it = firstStatus; it != lastStatus; it++) { + for (siPixelStatusVtr_iterator it = firstStatus; it != lastStatus; it++) { if(isNewIOV){ // if it is new IOV, init with the current data - tmpLumi = it->first; - tmpSiPixelStatus = it->second; + tmpLumi = edm::LuminosityBlockNumber_t(it->getLSRange().first); + tmpSiPixelStatus = (*it); } else{ // if it is not new IOV, append current data - tmpSiPixelStatus.updateDetectorStatus(it->second); + tmpSiPixelStatus.updateDetectorStatus((*it)); + tmpSiPixelStatus.setLSRange(int(tmpLumi),(*it).getLSRange().second); } // if reaching the end of data, write the last IOV to the map whatsoevec - siPixelStatusMap_iterator currentIt = it; - siPixelStatusMap_iterator nextIt = (++currentIt); + siPixelStatusVtr_iterator currentIt = it; + siPixelStatusVtr_iterator nextIt = (++currentIt); if(tmpSiPixelStatus.perRocDigiOcc()1){ + if(siPixelStatusMap_.size()>1){ // start from the end iterator of the std::map - siPixelStatusMap_iterator iterEnd = tmpSiPixelStatusMap_.end(); + siPixelStatusMap_iterator iterEnd = siPixelStatusMap_.end(); // the last IOV siPixelStatusMap_iterator iterLastIOV = std::prev(iterEnd); // if the statistics of the last IOV is not enough @@ -184,30 +202,25 @@ void SiPixelStatusManager::createBadComponents(){ siPixelStatusMap_iterator iterBeforeLastIOV = std::prev(iterLastIOV); // combine the last IOV data to the IOV before the last IOV (iterBeforeLastIOV->second).updateDetectorStatus(iterLastIOV->second); + (iterBeforeLastIOV->second).setLSRange((iterBeforeLastIOV->second).getLSRange().first, (iterLastIOV->second).getLSRange().second); // erase the last IOV, so the IOV before the last IOV becomes the new last IOV - tmpSiPixelStatusMap_.erase(iterLastIOV); + siPixelStatusMap_.erase(iterLastIOV); } } - siPixelStatusMap_.clear(); - siPixelStatusMap_ = tmpSiPixelStatusMap_; - } - else if(outputBase_ == "runbased" || ( (int(siPixelStatusMap_.size()) <= nLumi_ && outputBase_ == "nLumibased")) ){ - - siPixelStatusMap_iterator firstStatus = siPixelStatusMap_.begin(); - siPixelStatusMap_iterator lastStatus = siPixelStatusMap_.end(); + else if(outputBase_ == "runbased" || ( (int(siPixelStatusVtr_.size()) <= nLumi_ && outputBase_ == "nLumibased")) ){ - LuminosityBlockNumber_t tmpLumi = firstStatus->first; - SiPixelDetectorStatus tmpSiPixelStatus = firstStatus->second; + edm::LuminosityBlockNumber_t tmpLumi = edm::LuminosityBlockNumber_t(firstStatus->getLSRange().first); + SiPixelDetectorStatus tmpSiPixelStatus = (*firstStatus); - siPixelStatusMap_iterator nextStatus = ++siPixelStatusMap_.begin(); - for (siPixelStatusMap_iterator it = nextStatus; it != lastStatus; it++) { - tmpSiPixelStatus.updateDetectorStatus(it->second); + siPixelStatusVtr_iterator nextStatus = ++siPixelStatusVtr_.begin(); + for (siPixelStatusVtr_iterator it = nextStatus; it != lastStatus; it++) { + tmpSiPixelStatus.updateDetectorStatus((*it)); + tmpSiPixelStatus.setLSRange(int(tmpLumi),(*it).getLSRange().second); } - siPixelStatusMap_.clear(); siPixelStatusMap_[tmpLumi] = tmpSiPixelStatus; } @@ -224,21 +237,23 @@ void SiPixelStatusManager::createBadComponents(){ void SiPixelStatusManager::createFEDerror25(){ // initialize the first IOV and SiPixelDetector status (in the first IOV) - siPixelStatusMap_iterator firstStatus = siPixelStatusMap_.begin(); - LuminosityBlockNumber_t firstLumi = firstStatus->first; - SiPixelDetectorStatus firstFEDerror25 = firstStatus->second; + siPixelStatusVtr_iterator firstStatus = siPixelStatusVtr_.begin(); + edm::LuminosityBlockNumber_t firstLumi = edm::LuminosityBlockNumber_t(firstStatus->getLSRange().first); + SiPixelDetectorStatus firstFEDerror25 = (*firstStatus); FEDerror25Map_[firstLumi] = firstFEDerror25.getFEDerror25Rocs(); - siPixelStatusMap_iterator lastStatus = siPixelStatusMap_.end(); + siPixelStatusVtr_iterator lastStatus = siPixelStatusVtr_.end(); /////////// bool sameAsLastIOV = true; - LuminosityBlockNumber_t previousLumi = firstLumi; - siPixelStatusMap_iterator secondStatus = ++siPixelStatusMap_.begin(); - for (siPixelStatusMap_iterator it = secondStatus; it != lastStatus; it++) { - - LuminosityBlockNumber_t tmpLumi = it->first; - SiPixelDetectorStatus tmpFEDerror25 = it->second; + edm::LuminosityBlockNumber_t previousLumi = firstLumi; + + siPixelStatusVtr_iterator secondStatus = ++siPixelStatusVtr_.begin(); + for (siPixelStatusVtr_iterator it = secondStatus; it != lastStatus; it++) { + // init for each lumi section (iterator) + edm::LuminosityBlockNumber_t tmpLumi = edm::LuminosityBlockNumber_t(it->getLSRange().first); + SiPixelDetectorStatus tmpFEDerror25 = (*it); + std::map >tmpBadRocLists = tmpFEDerror25.getFEDerror25Rocs(); std::map::iterator itModEnd = tmpFEDerror25.end(); diff --git a/Configuration/StandardSequences/python/AlCaHarvesting_cff.py b/Configuration/StandardSequences/python/AlCaHarvesting_cff.py index 2c8e3c9b2cba5..be5f67181a246 100644 --- a/Configuration/StandardSequences/python/AlCaHarvesting_cff.py +++ b/Configuration/StandardSequences/python/AlCaHarvesting_cff.py @@ -165,6 +165,14 @@ ) ) +if ALCAHARVESTSiPixelQuality.debug == cms.untracked.bool(True) : + ALCAHARVESTSiPixelQuality_dbOutput.append( + cms.PSet(record = cms.string('SiPixelQualityFromDbRcd_PCL'), + tag = cms.string('SiPixelQualityFromDbRcd_PCL'), + timetype = cms.untracked.string('lumiid') + ) + ) + # define all the paths BeamSpotByRun = cms.Path(ALCAHARVESTBeamSpotByRun) BeamSpotByLumi = cms.Path(ALCAHARVESTBeamSpotByLumi) From 53ce6a8b465fd04f30c28b7fc31887d7c2d57c9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Ehat=C3=A4ht?= Date: Wed, 4 Apr 2018 12:01:03 +0300 Subject: [PATCH 349/426] fixed lep-aware JEC formula --- PhysicsTools/NanoAOD/plugins/LeptonJetVarProducer.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PhysicsTools/NanoAOD/plugins/LeptonJetVarProducer.cc b/PhysicsTools/NanoAOD/plugins/LeptonJetVarProducer.cc index a671e8650a98f..14f3064688c2f 100644 --- a/PhysicsTools/NanoAOD/plugins/LeptonJetVarProducer.cc +++ b/PhysicsTools/NanoAOD/plugins/LeptonJetVarProducer.cc @@ -160,7 +160,9 @@ LeptonJetVarProducer::calculatePtRatioRel(edm::Ptr lep, edm: if ((rawp4-lepp4).R()<1e-4) return std::tuple(1.0,0.0,0.0); - auto jetp4 = (rawp4 - lepp4*(1.0/jet->jecFactor("L1FastJet")))*(jet->pt()/rawp4.pt())+lepp4; + auto l1corrFactor = jet->jecFactor("L1FastJet")/jet->jecFactor("Uncorrected"); + + auto jetp4 = (rawp4 - lepp4*(1.0/l1corrFactor))*(jet->pt()/rawp4.pt())+lepp4; auto ptratio = lepp4.pt()/jetp4.pt(); auto ptrel = lepp4.Vect().Cross((jetp4-lepp4).Vect().Unit()).R(); From 7dd92e5e12f586fb40b0605afe580f794cd3d353 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Thu, 5 Apr 2018 12:33:12 +0200 Subject: [PATCH 350/426] Take Salavat's changes as in abdoulline:ALCARECOHcal_fix_and_M0firstSample --- .../python/ALCARECOHcalCalMinBiasNoise_cff.py | 8 +++----- .../python/ALCARECOHcalCalMinBias_cff.py | 10 ++++------ .../python/ALCARECOHcalCalPedestal_cff.py | 5 ++--- .../python/HBHEMethod0Parameters_cfi.py | 2 +- .../python/HBHEPhase1Reconstructor_cfi.py | 3 --- 5 files changed, 10 insertions(+), 18 deletions(-) diff --git a/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalMinBiasNoise_cff.py b/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalMinBiasNoise_cff.py index 5581e4b98451f..13ad8e7050077 100644 --- a/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalMinBiasNoise_cff.py +++ b/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalMinBiasNoise_cff.py @@ -21,7 +21,7 @@ hbherecoNoise = RecoLocalCalo.HcalRecProducers.HBHEPhase1Reconstructor_cfi.hbheprereco.clone( digiLabelQIE8 = cms.InputTag("hcalDigiAlCaMB"), digiLabelQIE11 = cms.InputTag("hcalDigiAlCaMB"), - tsFromDB = cms.bool(False), +### tsFromDB = cms.bool(False), dropZSmarkedPassed = cms.bool(False), algorithm = dict( useMahi = cms.bool(False), @@ -39,15 +39,13 @@ setLegacyFlagsQIE11 = cms.bool(False), ) -hbherecoNoise.algorithm.firstSample = 0 -hbherecoNoise.algorithm.firstSampleShift = -3 -hbherecoNoise.algorithm.samplesToAdd = 3 +hbherecoNoise.algorithm.firstSampleShift = -100 # to set reco window at very beginning of the TS array import RecoLocalCalo.HcalRecProducers.hosimplereco_cfi horecoNoise = RecoLocalCalo.HcalRecProducers.hosimplereco_cfi.hosimplereco.clone() horecoNoise.firstSample = 0 -horecoNoise.samplesToAdd = 3 +horecoNoise.samplesToAdd = 4 horecoNoise.digiLabel = 'hcalDigiAlCaMB' horecoNoise.tsFromDB = cms.bool(False) horecoNoise.dropZSmarkedPassed = cms.bool(False) diff --git a/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalMinBias_cff.py b/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalMinBias_cff.py index eca4b8dc1e75d..8d7371ee07f4f 100644 --- a/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalMinBias_cff.py +++ b/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalMinBias_cff.py @@ -17,7 +17,7 @@ hbherecoMBNZS = RecoLocalCalo.HcalRecProducers.HBHEPhase1Reconstructor_cfi.hbheprereco.clone( digiLabelQIE8 = cms.InputTag("hcalDigiAlCaMB"), digiLabelQIE11 = cms.InputTag("hcalDigiAlCaMB"), - tsFromDB = cms.bool(False), +### tsFromDB = cms.bool(False), dropZSmarkedPassed = cms.bool(False), algorithm = dict( useMahi = cms.bool(False), @@ -35,14 +35,12 @@ setLegacyFlagsQIE11 = cms.bool(False), ) -hbherecoMBNZS.algorithm.firstSample = 3 -hbherecoMBNZS.algorithm.firstSampleShift = 0 -hbherecoMBNZS.algorithm.samplesToAdd = 3 +hbherecoMBNZS.algorithm.firstSampleShift = 0 # explicitly repeating the default import RecoLocalCalo.HcalRecProducers.hosimplereco_cfi horecoMBNZS = RecoLocalCalo.HcalRecProducers.hosimplereco_cfi.hosimplereco.clone() -horecoMBNZS.firstSample = 3 +horecoMBNZS.firstSample = 4 horecoMBNZS.samplesToAdd = 4 horecoMBNZS.digiLabel = 'hcalDigiAlCaMB' horecoMBNZS.tsFromDB = cms.bool(False) @@ -51,7 +49,7 @@ import RecoLocalCalo.HcalRecProducers.hfsimplereco_cfi hfrecoMBNZS = RecoLocalCalo.HcalRecProducers.hfsimplereco_cfi.hfsimplereco.clone() -hfrecoMBNZS.firstSample = 2 +hfrecoMBNZS.firstSample = 2 # Run 2 default before 2017 hfrecoMBNZS.samplesToAdd = 2 hfrecoMBNZS.digiLabel = 'hcalDigiAlCaMB' hfrecoMBNZS.tsFromDB = cms.bool(False) diff --git a/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalPedestal_cff.py b/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalPedestal_cff.py index ff0ee534f975e..a7cbd5a691a78 100644 --- a/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalPedestal_cff.py +++ b/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalPedestal_cff.py @@ -35,7 +35,7 @@ hbherecoPedestal = RecoLocalCalo.HcalRecProducers.HBHEPhase1Reconstructor_cfi.hbheprereco.clone( digiLabelQIE8 = cms.InputTag("hcalDigiAlCaPedestal"), digiLabelQIE11 = cms.InputTag("hcalDigiAlCaPedestal"), - tsFromDB = cms.bool(False), +### tsFromDB = cms.bool(False), dropZSmarkedPassed = cms.bool(False), algorithm = dict( useMahi = cms.bool(False), @@ -53,8 +53,7 @@ setLegacyFlagsQIE11 = cms.bool(False), ) -hbherecoPedestal.algorithm.firstSample = 0 -hbherecoPedestal.algorithm.samplesToAdd = 4 +hbherecoPedestal.algorithm.firstSampleShift = -100 # for the very beginning of the TS array import RecoLocalCalo.HcalRecProducers.hfsimplereco_cfi hfrecoPedestal = RecoLocalCalo.HcalRecProducers.hfsimplereco_cfi.hfsimplereco.clone() diff --git a/RecoLocalCalo/HcalRecProducers/python/HBHEMethod0Parameters_cfi.py b/RecoLocalCalo/HcalRecProducers/python/HBHEMethod0Parameters_cfi.py index a511ccbf8b3e0..15ec32711d81c 100644 --- a/RecoLocalCalo/HcalRecProducers/python/HBHEMethod0Parameters_cfi.py +++ b/RecoLocalCalo/HcalRecProducers/python/HBHEMethod0Parameters_cfi.py @@ -2,7 +2,7 @@ # Configuration parameters for Method 0 m0Parameters = cms.PSet( - firstSample = cms.int32(4), + firstSampleShift = cms.int32(0), samplesToAdd = cms.int32(2), correctForPhaseContainment = cms.bool(True), correctionPhaseNS = cms.double(6.0), diff --git a/RecoLocalCalo/HcalRecProducers/python/HBHEPhase1Reconstructor_cfi.py b/RecoLocalCalo/HcalRecProducers/python/HBHEPhase1Reconstructor_cfi.py index 5ae57e2821206..3f39e462f65af 100644 --- a/RecoLocalCalo/HcalRecProducers/python/HBHEPhase1Reconstructor_cfi.py +++ b/RecoLocalCalo/HcalRecProducers/python/HBHEPhase1Reconstructor_cfi.py @@ -64,9 +64,6 @@ # Time shift (in ns) to add to TDC timing (for QIE11) tdcTimeShift = cms.double(0.0), - # Parameters for "Method 0" - firstSampleShift = cms.int32(0), - # Use "Method 2"? useM2 = cms.bool(False), From 31eeb7850c588a936dd1e2610623122c9af77bb2 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Thu, 5 Apr 2018 11:36:58 +0200 Subject: [PATCH 351/426] Move libminifloat and liblogintpack to DataFormats/Math --- DQM/TrackingMonitor/src/PackedCandidateTrackValidator.cc | 4 ++-- DataFormats/Luminosity/src/BeamCurrentInfo.cc | 2 +- DataFormats/{PatCandidates => Math}/interface/liblogintpack.h | 0 DataFormats/{PatCandidates => Math}/interface/libminifloat.h | 0 DataFormats/{PatCandidates => Math}/src/libminifloat.cc | 2 +- DataFormats/Math/test/BuildFile.xml | 4 ++++ DataFormats/{PatCandidates => Math}/test/testMiniFloat.cpp | 2 +- DataFormats/Math/test/testRunner.cpp | 1 + DataFormats/{PatCandidates => Math}/test/testlogintpack.cpp | 2 +- DataFormats/NanoAOD/interface/FlatTable.h | 2 +- DataFormats/PatCandidates/interface/ioread_packedgen.h | 2 +- DataFormats/PatCandidates/src/CovarianceParameterization.cc | 4 ++-- DataFormats/PatCandidates/src/MET.cc | 2 +- DataFormats/PatCandidates/src/PackedCandidate.cc | 4 ++-- DataFormats/PatCandidates/src/PackedGenParticle.cc | 2 +- DataFormats/PatCandidates/src/TriggerObjectStandAlone.cc | 2 +- DataFormats/PatCandidates/test/BuildFile.xml | 2 +- PhysicsTools/PatAlgos/plugins/PATMuonSlimmer.cc | 2 +- PhysicsTools/PatAlgos/plugins/PATVertexSlimmer.cc | 2 +- 19 files changed, 23 insertions(+), 18 deletions(-) rename DataFormats/{PatCandidates => Math}/interface/liblogintpack.h (100%) rename DataFormats/{PatCandidates => Math}/interface/libminifloat.h (100%) rename DataFormats/{PatCandidates => Math}/src/libminifloat.cc (97%) rename DataFormats/{PatCandidates => Math}/test/testMiniFloat.cpp (98%) create mode 100644 DataFormats/Math/test/testRunner.cpp rename DataFormats/{PatCandidates => Math}/test/testlogintpack.cpp (99%) diff --git a/DQM/TrackingMonitor/src/PackedCandidateTrackValidator.cc b/DQM/TrackingMonitor/src/PackedCandidateTrackValidator.cc index 3dc9014546df3..3fa7dadee67e3 100644 --- a/DQM/TrackingMonitor/src/PackedCandidateTrackValidator.cc +++ b/DQM/TrackingMonitor/src/PackedCandidateTrackValidator.cc @@ -13,8 +13,8 @@ #include "DataFormats/Common/interface/Association.h" #include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/PatCandidates/interface/PackedCandidate.h" -#include "DataFormats/PatCandidates/interface/libminifloat.h" -#include "DataFormats/PatCandidates/interface/liblogintpack.h" +#include "DataFormats/Math/interface/libminifloat.h" +#include "DataFormats/Math/interface/liblogintpack.h" #include "DataFormats/VertexReco/interface/Vertex.h" #include "DataFormats/VertexReco/interface/VertexFwd.h" #include "DataFormats/Math/interface/deltaPhi.h" diff --git a/DataFormats/Luminosity/src/BeamCurrentInfo.cc b/DataFormats/Luminosity/src/BeamCurrentInfo.cc index 9c7936b45996b..966b654325c72 100644 --- a/DataFormats/Luminosity/src/BeamCurrentInfo.cc +++ b/DataFormats/Luminosity/src/BeamCurrentInfo.cc @@ -1,5 +1,5 @@ #include "DataFormats/Luminosity/interface/BeamCurrentInfo.h" -#include "DataFormats/PatCandidates/interface/libminifloat.h" +#include "DataFormats/Math/interface/libminifloat.h" #include #include diff --git a/DataFormats/PatCandidates/interface/liblogintpack.h b/DataFormats/Math/interface/liblogintpack.h similarity index 100% rename from DataFormats/PatCandidates/interface/liblogintpack.h rename to DataFormats/Math/interface/liblogintpack.h diff --git a/DataFormats/PatCandidates/interface/libminifloat.h b/DataFormats/Math/interface/libminifloat.h similarity index 100% rename from DataFormats/PatCandidates/interface/libminifloat.h rename to DataFormats/Math/interface/libminifloat.h diff --git a/DataFormats/PatCandidates/src/libminifloat.cc b/DataFormats/Math/src/libminifloat.cc similarity index 97% rename from DataFormats/PatCandidates/src/libminifloat.cc rename to DataFormats/Math/src/libminifloat.cc index c8078232d189a..3d2dc5904c613 100644 --- a/DataFormats/PatCandidates/src/libminifloat.cc +++ b/DataFormats/Math/src/libminifloat.cc @@ -1,4 +1,4 @@ -#include "DataFormats/PatCandidates/interface/libminifloat.h" +#include "DataFormats/Math/interface/libminifloat.h" namespace { MiniFloatConverter dummy; // so the constructor is called diff --git a/DataFormats/Math/test/BuildFile.xml b/DataFormats/Math/test/BuildFile.xml index 32ac3a3074890..0fea2a9418c49 100644 --- a/DataFormats/Math/test/BuildFile.xml +++ b/DataFormats/Math/test/BuildFile.xml @@ -65,3 +65,7 @@ + + + + diff --git a/DataFormats/PatCandidates/test/testMiniFloat.cpp b/DataFormats/Math/test/testMiniFloat.cpp similarity index 98% rename from DataFormats/PatCandidates/test/testMiniFloat.cpp rename to DataFormats/Math/test/testMiniFloat.cpp index ddff36646a9d3..297f21bbef3ff 100644 --- a/DataFormats/PatCandidates/test/testMiniFloat.cpp +++ b/DataFormats/Math/test/testMiniFloat.cpp @@ -1,7 +1,7 @@ #include #include -#include "DataFormats/PatCandidates/interface/libminifloat.h" +#include "DataFormats/Math/interface/libminifloat.h" #include "FWCore/Utilities/interface/isFinite.h" class testMiniFloat : public CppUnit::TestFixture { diff --git a/DataFormats/Math/test/testRunner.cpp b/DataFormats/Math/test/testRunner.cpp new file mode 100644 index 0000000000000..afea4e798f6d9 --- /dev/null +++ b/DataFormats/Math/test/testRunner.cpp @@ -0,0 +1 @@ +#include "Utilities/Testing/interface/CppUnit_testdriver.icpp" diff --git a/DataFormats/PatCandidates/test/testlogintpack.cpp b/DataFormats/Math/test/testlogintpack.cpp similarity index 99% rename from DataFormats/PatCandidates/test/testlogintpack.cpp rename to DataFormats/Math/test/testlogintpack.cpp index 84c4187225a67..d12783f6cfce5 100644 --- a/DataFormats/PatCandidates/test/testlogintpack.cpp +++ b/DataFormats/Math/test/testlogintpack.cpp @@ -3,7 +3,7 @@ #include #include -#include "DataFormats/PatCandidates/interface/liblogintpack.h" +#include "DataFormats/Math/interface/liblogintpack.h" class testlogintpack : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(testlogintpack); diff --git a/DataFormats/NanoAOD/interface/FlatTable.h b/DataFormats/NanoAOD/interface/FlatTable.h index d15b26df9b34d..47cb6ca76f619 100644 --- a/DataFormats/NanoAOD/interface/FlatTable.h +++ b/DataFormats/NanoAOD/interface/FlatTable.h @@ -6,7 +6,7 @@ #include #include #include "FWCore/Utilities/interface/Exception.h" -#include "DataFormats/PatCandidates/interface/libminifloat.h" +#include "DataFormats/Math/interface/libminifloat.h" namespace nanoaod { diff --git a/DataFormats/PatCandidates/interface/ioread_packedgen.h b/DataFormats/PatCandidates/interface/ioread_packedgen.h index 87d1a25f7ace8..bc28c376156e5 100644 --- a/DataFormats/PatCandidates/interface/ioread_packedgen.h +++ b/DataFormats/PatCandidates/interface/ioread_packedgen.h @@ -1,4 +1,4 @@ -#include "DataFormats/PatCandidates/interface/libminifloat.h" +#include "DataFormats/Math/interface/libminifloat.h" #include "DataFormats/Candidate/interface/Candidate.h" int16_t convertPackedEtaToPackedY(int16_t packedPt_, int16_t packedEta_,int16_t packedM_) { diff --git a/DataFormats/PatCandidates/src/CovarianceParameterization.cc b/DataFormats/PatCandidates/src/CovarianceParameterization.cc index 91e0ff74a418e..5a327f8f588e7 100644 --- a/DataFormats/PatCandidates/src/CovarianceParameterization.cc +++ b/DataFormats/PatCandidates/src/CovarianceParameterization.cc @@ -1,6 +1,6 @@ #include "DataFormats/PatCandidates/interface/CovarianceParameterization.h" -#include "DataFormats/PatCandidates/interface/liblogintpack.h" -#include "DataFormats/PatCandidates/interface/libminifloat.h" +#include "DataFormats/Math/interface/liblogintpack.h" +#include "DataFormats/Math/interface/libminifloat.h" #include "FWCore/ParameterSet/interface/FileInPath.h" #include #include diff --git a/DataFormats/PatCandidates/src/MET.cc b/DataFormats/PatCandidates/src/MET.cc index 494321d86645b..10b5286502cbf 100644 --- a/DataFormats/PatCandidates/src/MET.cc +++ b/DataFormats/PatCandidates/src/MET.cc @@ -445,7 +445,7 @@ double MET::shiftedSumEt_74x(MET::METUncertainty shift, MET::METCorrectionLevel -#include "DataFormats/PatCandidates/interface/libminifloat.h" +#include "DataFormats/Math/interface/libminifloat.h" void MET::PackedMETUncertainty::pack() { packedDpx_ = MiniFloatConverter::float32to16(dpx_); diff --git a/DataFormats/PatCandidates/src/PackedCandidate.cc b/DataFormats/PatCandidates/src/PackedCandidate.cc index d5826dde3bd54..18749daaea243 100644 --- a/DataFormats/PatCandidates/src/PackedCandidate.cc +++ b/DataFormats/PatCandidates/src/PackedCandidate.cc @@ -1,10 +1,10 @@ #include "DataFormats/PatCandidates/interface/PackedCandidate.h" #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" #include "DataFormats/SiStripDetId/interface/StripSubdetector.h" -#include "DataFormats/PatCandidates/interface/libminifloat.h" +#include "DataFormats/Math/interface/libminifloat.h" #include "DataFormats/Math/interface/deltaPhi.h" -#include "DataFormats/PatCandidates/interface/liblogintpack.h" +#include "DataFormats/Math/interface/liblogintpack.h" using namespace logintpack; CovarianceParameterization pat::PackedCandidate::covarianceParameterization_; diff --git a/DataFormats/PatCandidates/src/PackedGenParticle.cc b/DataFormats/PatCandidates/src/PackedGenParticle.cc index e5bb456546103..f39b77d7cde3f 100644 --- a/DataFormats/PatCandidates/src/PackedGenParticle.cc +++ b/DataFormats/PatCandidates/src/PackedGenParticle.cc @@ -1,5 +1,5 @@ #include "DataFormats/PatCandidates/interface/PackedGenParticle.h" -#include "DataFormats/PatCandidates/interface/libminifloat.h" +#include "DataFormats/Math/interface/libminifloat.h" #include "DataFormats/Math/interface/deltaPhi.h" diff --git a/DataFormats/PatCandidates/src/TriggerObjectStandAlone.cc b/DataFormats/PatCandidates/src/TriggerObjectStandAlone.cc index 60cdb237f02b8..c045fb5d8d8a9 100644 --- a/DataFormats/PatCandidates/src/TriggerObjectStandAlone.cc +++ b/DataFormats/PatCandidates/src/TriggerObjectStandAlone.cc @@ -3,7 +3,7 @@ #include "DataFormats/Common/interface/TriggerResults.h" #include "DataFormats/PatCandidates/interface/TriggerObjectStandAlone.h" -#include "DataFormats/PatCandidates/interface/libminifloat.h" +#include "DataFormats/Math/interface/libminifloat.h" #include "DataFormats/Provenance/interface/ProcessConfiguration.h" #include "DataFormats/Provenance/interface/ProcessHistory.h" #include "FWCore/Common/interface/TriggerNames.h" diff --git a/DataFormats/PatCandidates/test/BuildFile.xml b/DataFormats/PatCandidates/test/BuildFile.xml index 49fc6eb4e5d29..14eda66621850 100644 --- a/DataFormats/PatCandidates/test/BuildFile.xml +++ b/DataFormats/PatCandidates/test/BuildFile.xml @@ -1,7 +1,7 @@ - + diff --git a/PhysicsTools/PatAlgos/plugins/PATMuonSlimmer.cc b/PhysicsTools/PatAlgos/plugins/PATMuonSlimmer.cc index 77589f82a936c..3f829ca818594 100644 --- a/PhysicsTools/PatAlgos/plugins/PATMuonSlimmer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATMuonSlimmer.cc @@ -19,7 +19,7 @@ #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" #include "DataFormats/PatCandidates/interface/PackedCandidate.h" #include "CommonTools/UtilAlgos/interface/StringCutObjectSelector.h" -#include "DataFormats/PatCandidates/interface/libminifloat.h" +#include "DataFormats/Math/interface/libminifloat.h" namespace pat { diff --git a/PhysicsTools/PatAlgos/plugins/PATVertexSlimmer.cc b/PhysicsTools/PatAlgos/plugins/PATVertexSlimmer.cc index 1e81cbf4bb514..dc2b6e9ff9774 100644 --- a/PhysicsTools/PatAlgos/plugins/PATVertexSlimmer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATVertexSlimmer.cc @@ -11,7 +11,7 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "DataFormats/VertexReco/interface/Vertex.h" #include "DataFormats/Common/interface/ValueMap.h" -#include "DataFormats/PatCandidates/interface/libminifloat.h" +#include "DataFormats/Math/interface/libminifloat.h" namespace pat { class PATVertexSlimmer : public edm::global::EDProducer<> { From a1ada16be07b782579fd77b04001c0035a4461e0 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Thu, 5 Apr 2018 09:12:36 -0500 Subject: [PATCH 352/426] Do not throw exception for fitting error Added an additional case where a message about a fitting error should not cause an exception to be thrown. --- FWCore/Services/plugins/InitRootHandlers.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/FWCore/Services/plugins/InitRootHandlers.cc b/FWCore/Services/plugins/InitRootHandlers.cc index 88fc29cd31ff6..b5aa5c5385517 100644 --- a/FWCore/Services/plugins/InitRootHandlers.cc +++ b/FWCore/Services/plugins/InitRootHandlers.cc @@ -252,7 +252,8 @@ namespace { // be fatal, but we do want an error to print. bool alreadyPrinted = false; if ((el_message.find("number of iterations was insufficient") != std::string::npos) || - (el_message.find("bad integrand behavior") != std::string::npos)) { + (el_message.find("bad integrand behavior") != std::string::npos) || + (el_message.find("integral is divergent, or slowly convergent") != std::string::npos)) { el_severity = SeverityLevel::kInfo; edm::LogError("Root_Error") << el_location << el_message; alreadyPrinted = true; From 00da6757ba70fb2631bb8075426c15b697913069 Mon Sep 17 00:00:00 2001 From: Heiner Tholen Date: Thu, 5 Apr 2018 16:44:21 +0200 Subject: [PATCH 353/426] moving BTVHLTOfflineSource.* to be able to use TriggerDQMBase (which lives in the plugins library) --- DQMOffline/Trigger/{src => plugins}/BTVHLTOfflineSource.cc | 0 DQMOffline/Trigger/{interface => plugins}/BTVHLTOfflineSource.h | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename DQMOffline/Trigger/{src => plugins}/BTVHLTOfflineSource.cc (100%) rename DQMOffline/Trigger/{interface => plugins}/BTVHLTOfflineSource.h (100%) diff --git a/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc b/DQMOffline/Trigger/plugins/BTVHLTOfflineSource.cc similarity index 100% rename from DQMOffline/Trigger/src/BTVHLTOfflineSource.cc rename to DQMOffline/Trigger/plugins/BTVHLTOfflineSource.cc diff --git a/DQMOffline/Trigger/interface/BTVHLTOfflineSource.h b/DQMOffline/Trigger/plugins/BTVHLTOfflineSource.h similarity index 100% rename from DQMOffline/Trigger/interface/BTVHLTOfflineSource.h rename to DQMOffline/Trigger/plugins/BTVHLTOfflineSource.h From 77dc1bf94cf983c14b7b08e9efe0e65884937015 Mon Sep 17 00:00:00 2001 From: Heiner Tholen Date: Thu, 5 Apr 2018 16:46:22 +0200 Subject: [PATCH 354/426] adding turnon efficiency histograms and harvesting clients --- .../Trigger/plugins/BTVHLTOfflineSource.cc | 275 +++++++++--------- .../Trigger/plugins/BTVHLTOfflineSource.h | 153 +++------- DQMOffline/Trigger/plugins/TriggerDQMBase.h | 7 +- .../python/BTaggingMonitoring_Client_cff.py | 17 +- .../python/DQMOffline_HLT_Client_cff.py | 4 +- DQMOffline/Trigger/src/SealModule.cc | 2 - 6 files changed, 204 insertions(+), 254 deletions(-) diff --git a/DQMOffline/Trigger/plugins/BTVHLTOfflineSource.cc b/DQMOffline/Trigger/plugins/BTVHLTOfflineSource.cc index bf468d6926dd8..db15c7f414486 100644 --- a/DQMOffline/Trigger/plugins/BTVHLTOfflineSource.cc +++ b/DQMOffline/Trigger/plugins/BTVHLTOfflineSource.cc @@ -1,4 +1,4 @@ -#include "DQMOffline/Trigger/interface/BTVHLTOfflineSource.h" +#include "DQMOffline/Trigger/plugins/BTVHLTOfflineSource.h" #include "FWCore/Common/interface/TriggerNames.h" #include "FWCore/Framework/interface/EDAnalyzer.h" @@ -163,20 +163,28 @@ BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iS float Discr_online = iter->second; if (Discr_online<0) Discr_online = -0.05; - v.getMEhisto_Discr()->Fill(Discr_online); - v.getMEhisto_Pt()->Fill(iter->first->pt()); - v.getMEhisto_Eta()->Fill(iter->first->eta()); + v.Discr->Fill(Discr_online); + v.Pt->Fill(iter->first->pt()); + v.Eta->Fill(iter->first->eta()); - float DR = 9999.; if(offlineJetTagHandler.isValid()){ - for (auto const & iterO : *offlineJetTagHandler){ + for (auto const & iterO : *offlineJetTagHandler){ + float DR = reco::deltaR(iterO.first->eta(),iterO.first->phi(),iter->first->eta(),iter->first->phi()); + if (DR<0.3) { float Discr_offline = iterO.second; if (Discr_offline<0) Discr_offline = -0.05; - DR = reco::deltaR(iterO.first->eta(),iterO.first->phi(),iter->first->eta(),iter->first->phi()); - if (DR<0.3) { - v.getMEhisto_Discr_HLTvsRECO()->Fill(Discr_online,Discr_offline); continue; - } + v.Discr_HLTvsRECO->Fill(Discr_online, Discr_offline); + v.Discr_HLTMinusRECO->Fill(Discr_online - Discr_offline); + + v.Discr_turnon_loose .denominator->Fill(Discr_offline); + v.Discr_turnon_medium.denominator->Fill(Discr_offline); + v.Discr_turnon_tight .denominator->Fill(Discr_offline); + + if (Discr_online > turnon_threshold_loose_) v.Discr_turnon_loose .numerator->Fill(Discr_offline); + if (Discr_online > turnon_threshold_medium_)v.Discr_turnon_medium.numerator->Fill(Discr_offline); + if (Discr_online > turnon_threshold_tight_) v.Discr_turnon_tight .numerator->Fill(Discr_offline); } + } } if (v.getTriggerType() == "PF") { @@ -185,9 +193,9 @@ BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iS iEvent.getByToken(hltFastPVToken_, VertexHandler); } if (VertexHandler.isValid()) { - v.getMEhisto_PVz()->Fill(VertexHandler->begin()->z()); + v.PVz->Fill(VertexHandler->begin()->z()); if (offlineVertexHandler.isValid()) { - v.getMEhisto_PVz_HLTMinusRECO()->Fill(VertexHandler->begin()->z()-offlineVertexHandler->begin()->z()); + v.PVz_HLTMinusRECO->Fill(VertexHandler->begin()->z()-offlineVertexHandler->begin()->z()); } } } @@ -196,9 +204,9 @@ BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iS if (caloTags.isValid() && v.getTriggerType() == "Calo" && !caloTags->empty()) { iEvent.getByToken(hltCaloPVToken_, VertexHandler); if (VertexHandler.isValid()) { - v.getMEhisto_fastPVz()->Fill(VertexHandler->begin()->z()); + v.fastPVz->Fill(VertexHandler->begin()->z()); if (offlineVertexHandler.isValid()) { - v.getMEhisto_fastPVz_HLTMinusRECO()->Fill(VertexHandler->begin()->z()-offlineVertexHandler->begin()->z()); + v.fastPVz_HLTMinusRECO->Fill(VertexHandler->begin()->z()-offlineVertexHandler->begin()->z()); } } } @@ -222,10 +230,10 @@ BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iS // n secondary vertices and n selected tracks for (const auto & tagVar : tagVars.getList(reco::btau::jetNSecondaryVertices, false)) { - v.getMEhisto_n_vtx()->Fill(tagVar); + v.n_vtx->Fill(tagVar); } for (const auto & tagVar : tagVars.getList(reco::btau::jetNSelectedTracks, false)) { - v.getMEhisto_n_sel_tracks()->Fill(tagVar);} + v.n_sel_tracks->Fill(tagVar);} // impact parameter const auto & trackSip3dVal = tagVars.getList(reco::btau::trackSip3dVal, false); @@ -233,22 +241,22 @@ BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iS for (unsigned i_trk=0; i_trk < trackSip3dVal.size(); i_trk++) { float val = trackSip3dVal[i_trk]; float sig = trackSip3dSig[i_trk]; - v.getMEhisto_h_3d_ip_distance()->Fill(val); - v.getMEhisto_h_3d_ip_error()->Fill(val/sig); - v.getMEhisto_h_3d_ip_sig()->Fill(sig); + v.h_3d_ip_distance->Fill(val); + v.h_3d_ip_error->Fill(val/sig); + v.h_3d_ip_sig->Fill(sig); } // vertex mass and tracks per vertex for (const auto & tagVar : tagVars.getList(reco::btau::vertexMass, false)) { - v.getMEhisto_vtx_mass()->Fill(tagVar);} + v.vtx_mass->Fill(tagVar);} for (const auto & tagVar : tagVars.getList(reco::btau::vertexNTracks, false)) { - v.getMEhisto_n_vtx_trks()->Fill(tagVar);} + v.n_vtx_trks->Fill(tagVar);} // // track N total/pixel hits // for (const auto & tagVar : tagVars.getList(reco::btau::trackNPixelHits, false)) { - // v.getMEhisto_n_pixel_hits()->Fill(tagVar);} + // v.n_pixel_hits->Fill(tagVar);} // for (const auto & tagVar : tagVars.getList(reco::btau::trackNTotalHits, false)) { - // v.getMEhisto_n_total_hits()->Fill(tagVar);} + // v.n_total_hits->Fill(tagVar);} } } @@ -261,28 +269,28 @@ BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iS // // loop over secondary vertex tag infos // for (const auto & DiscrTagInfo : *DiscrTagInfoCollection) { - // v.getMEhisto_n_vtx()->Fill(DiscrTagInfo.nVertexCandidates()); - // v.getMEhisto_n_sel_tracks()->Fill(DiscrTagInfo.nSelectedTracks()); + // v.n_vtx->Fill(DiscrTagInfo.nVertexCandidates()); + // v.n_sel_tracks->Fill(DiscrTagInfo.nSelectedTracks()); // // loop over selected tracks in each tag info // for (unsigned i_trk=0; i_trk < DiscrTagInfo.nSelectedTracks(); i_trk++) { // const auto & ip3d = DiscrTagInfo.trackIPData(i_trk).ip3d; - // v.getMEhisto_h_3d_ip_distance()->Fill(ip3d.value()); - // v.getMEhisto_h_3d_ip_error()->Fill(ip3d.error()); - // v.getMEhisto_h_3d_ip_sig()->Fill(ip3d.significance()); + // v.h_3d_ip_distance->Fill(ip3d.value()); + // v.h_3d_ip_error->Fill(ip3d.error()); + // v.h_3d_ip_sig->Fill(ip3d.significance()); // } // // loop over vertex candidates in each tag info // for (unsigned i_sv=0; i_sv < DiscrTagInfo.nVertexCandidates(); i_sv++) { // const auto & sv = DiscrTagInfo.secondaryVertex(i_sv); - // v.getMEhisto_vtx_mass()->Fill(sv.p4().mass()); - // v.getMEhisto_n_vtx_trks()->Fill(sv.nTracks()); + // v.vtx_mass->Fill(sv.p4().mass()); + // v.n_vtx_trks->Fill(sv.nTracks()); // // loop over tracks for number of pixel and total hits // const auto & trkIPTagInfo = DiscrTagInfo.trackIPTagInfoRef().get(); // for (const auto & trk : trkIPTagInfo->selectedTracks()) { - // v.getMEhisto_n_pixel_hits()->Fill(trk.get()->hitPattern().numberOfValidPixelHits()); - // v.getMEhisto_n_total_hits()->Fill(trk.get()->hitPattern().numberOfValidHits()); + // v.n_pixel_hits->Fill(trk.get()->hitPattern().numberOfValidPixelHits()); + // v.n_total_hits->Fill(trk.get()->hitPattern().numberOfValidHits()); // } // } // } @@ -293,107 +301,104 @@ BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iS void BTVHLTOfflineSource::bookHistograms(DQMStore::IBooker & iBooker, edm::Run const & run, edm::EventSetup const & c) { - iBooker.setCurrentFolder(dirname_); - for(auto & v : hltPathsAll_){ - // - std::string trgPathName = HLTConfigProvider::removeVersion(v.getPath()); - std::string subdirName = dirname_ +"/"+ trgPathName; - std::string trigPath = "("+trgPathName+")"; - iBooker.setCurrentFolder(subdirName); - - std::string labelname("HLT"); - std::string histoname(labelname+""); - std::string title(labelname+""); - - histoname = labelname+"_Discr"; - title = labelname+"_Discr "+trigPath; - MonitorElement * Discr = iBooker.book1D(histoname.c_str(),title.c_str(),110,-0.1,1); - - histoname = labelname+"_Pt"; - title = labelname+"_Pt "+trigPath; - MonitorElement * Pt = iBooker.book1D(histoname.c_str(),title.c_str(),100,0,400); - - histoname = labelname+"_Eta"; - title = labelname+"_Eta "+trigPath; - MonitorElement * Eta = iBooker.book1D(histoname.c_str(),title.c_str(),60,-3.0,3.0); - - histoname = "HLTvsRECO_Discr"; - title = "online discr vs offline discr "+trigPath; - MonitorElement * Discr_HLTvsRECO = iBooker.book2D(histoname.c_str(),title.c_str(),110,-0.1,1,110,-0.1,1); - - histoname = "HLTMinusRECO_Discr"; - title = "online discr minus offline discr "+trigPath; - MonitorElement * Discr_HLTMinusRECO = iBooker.book1D(histoname.c_str(),title.c_str(),100,-1,1); - - histoname = "Turnon_loose_Discr"; - title = "turn-on with loose threshold "+trigPath; - MonitorElement * Discr_turnon_loose = iBooker.book1D(histoname.c_str(),title.c_str(),20,0,1); - - histoname = "Turnon_medium_Discr"; - title = "turn-on with medium threshold "+trigPath; - MonitorElement * Discr_turnon_medium = iBooker.book1D(histoname.c_str(),title.c_str(),20,0,1); - - histoname = "Turnon_tight_Discr"; - title = "turn-on with tight threshold "+trigPath; - MonitorElement * Discr_turnon_tight = iBooker.book1D(histoname.c_str(),title.c_str(),20,0,1); - - histoname = labelname+"_PVz"; - title = "online z(PV) "+trigPath; - MonitorElement * PVz = iBooker.book1D(histoname.c_str(),title.c_str(),80,-20,20); - - histoname = labelname+"_fastPVz"; - title = "online z(fastPV) "+trigPath; - MonitorElement * fastPVz = iBooker.book1D(histoname.c_str(),title.c_str(),80,-20,20); - - histoname = "HLTMinusRECO_PVz"; - title = "online z(PV) - offline z(PV) "+trigPath; - MonitorElement * PVz_HLTMinusRECO = iBooker.book1D(histoname.c_str(),title.c_str(),200,-0.5,0.5); - - histoname = "HLTMinusRECO_fastPVz"; - title = "online z(fastPV) - offline z(PV) "+trigPath; - MonitorElement * fastPVz_HLTMinusRECO = iBooker.book1D(histoname.c_str(),title.c_str(),100,-2,2); - - histoname = "n_vtx"; - title = "N vertex candidates "+trigPath; - MonitorElement * n_vtx = iBooker.book1D(histoname.c_str(),title.c_str(), 10, -0.5, 9.5); - - histoname = "vtx_mass"; - title = "secondary vertex mass (GeV)"+trigPath; - MonitorElement * vtx_mass = iBooker.book1D(histoname.c_str(), title.c_str(), 20, 0, 10); - - histoname = "n_vtx_trks"; - title = "N tracks associated to secondary vertex"+trigPath; - MonitorElement * n_vtx_trks = iBooker.book1D(histoname.c_str(), title.c_str(), 20, -0.5, 19.5); - - histoname = "n_sel_tracks"; - title = "N selected tracks"+trigPath; - MonitorElement * n_sel_tracks = iBooker.book1D(histoname.c_str(), title.c_str(), 25, -0.5, 24.5); - - histoname = "3d_ip_distance"; - title = "3D IP distance of tracks (cm)"+trigPath; - MonitorElement * h_3d_ip_distance = iBooker.book1D(histoname.c_str(), title.c_str(), 40, -0.1, 0.1); - - histoname = "3d_ip_error"; - title = "3D IP error of tracks (cm)"+trigPath; - MonitorElement * h_3d_ip_error = iBooker.book1D(histoname.c_str(), title.c_str(), 40, 0., 0.1); - - histoname = "3d_ip_sig"; - title = "3D IP significance of tracks (cm)"+trigPath; - MonitorElement * h_3d_ip_sig = iBooker.book1D(histoname.c_str(), title.c_str(), 40, -40, 40); - - // histoname = "n_pixel_hits"; - // title = "N pixel hits"+trigPath; - // MonitorElement * n_pixel_hits = iBooker.book1D(histoname.c_str(), title.c_str(), 16, -0.5, 15.5); - - // histoname = "n_total_hits"; - // title = "N hits"+trigPath; - // MonitorElement * n_total_hits = iBooker.book1D(histoname.c_str(), title.c_str(), 40, -0.5, 39.5); - - - v.setHistos( - Discr, Pt, Eta, Discr_HLTvsRECO, Discr_HLTMinusRECO, Discr_turnon_loose, Discr_turnon_medium, Discr_turnon_tight, - PVz, fastPVz, PVz_HLTMinusRECO, fastPVz_HLTMinusRECO, - n_vtx, vtx_mass, n_vtx_trks, n_sel_tracks, h_3d_ip_distance, h_3d_ip_error, h_3d_ip_sig // , n_pixel_hits, n_total_hits - ); - } + iBooker.setCurrentFolder(dirname_); + for(auto & v : hltPathsAll_){ + // + std::string trgPathName = HLTConfigProvider::removeVersion(v.getPath()); + std::string subdirName = dirname_ +"/"+ trgPathName; + std::string trigPath = "("+trgPathName+")"; + iBooker.setCurrentFolder(subdirName); + + std::string labelname("HLT"); + std::string histoname(labelname+""); + std::string title(labelname+""); + + histoname = labelname+"_Discr"; + title = labelname+"_Discr "+trigPath; + v.Discr = iBooker.book1D(histoname.c_str(),title.c_str(),110,-0.1,1); + + histoname = labelname+"_Pt"; + title = labelname+"_Pt "+trigPath; + v.Pt = iBooker.book1D(histoname.c_str(),title.c_str(),100,0,400); + + histoname = labelname+"_Eta"; + title = labelname+"_Eta "+trigPath; + v.Eta = iBooker.book1D(histoname.c_str(),title.c_str(),60,-3.0,3.0); + + histoname = "HLTvsRECO_Discr"; + title = "online discr vs offline discr "+trigPath; + v.Discr_HLTvsRECO = iBooker.book2D(histoname.c_str(),title.c_str(),110,-0.1,1,110,-0.1,1); + + histoname = "HLTMinusRECO_Discr"; + title = "online discr minus offline discr "+trigPath; + v.Discr_HLTMinusRECO = iBooker.book1D(histoname.c_str(),title.c_str(),100,-1,1); + + histoname = "Turnon_loose_Discr"; + title = "turn-on with loose threshold "+trigPath; + v.bookME(iBooker, v.Discr_turnon_loose, histoname, title, 22, -0.1, 1.); + + histoname = "Turnon_medium_Discr"; + title = "turn-on with medium threshold "+trigPath; + v.bookME(iBooker, v.Discr_turnon_medium, histoname, title, 22, -0.1, 1.); + + histoname = "Turnon_tight_Discr"; + title = "turn-on with tight threshold "+trigPath; + v.bookME(iBooker, v.Discr_turnon_tight, histoname, title, 22, -0.1, 1.); + + histoname = labelname+"_PVz"; + title = "online z(PV) "+trigPath; + v.PVz = iBooker.book1D(histoname.c_str(),title.c_str(),80,-20,20); + + histoname = labelname+"_fastPVz"; + title = "online z(fastPV) "+trigPath; + v.fastPVz = iBooker.book1D(histoname.c_str(),title.c_str(),80,-20,20); + + histoname = "HLTMinusRECO_PVz"; + title = "online z(PV) - offline z(PV) "+trigPath; + v.PVz_HLTMinusRECO = iBooker.book1D(histoname.c_str(),title.c_str(),200,-0.5,0.5); + + histoname = "HLTMinusRECO_fastPVz"; + title = "online z(fastPV) - offline z(PV) "+trigPath; + v.fastPVz_HLTMinusRECO = iBooker.book1D(histoname.c_str(),title.c_str(),100,-2,2); + + histoname = "n_vtx"; + title = "N vertex candidates "+trigPath; + v.n_vtx = iBooker.book1D(histoname.c_str(),title.c_str(), 10, -0.5, 9.5); + + histoname = "vtx_mass"; + title = "secondary vertex mass (GeV)"+trigPath; + v.vtx_mass = iBooker.book1D(histoname.c_str(), title.c_str(), 20, 0, 10); + + histoname = "n_vtx_trks"; + title = "N tracks associated to secondary vertex"+trigPath; + v.n_vtx_trks = iBooker.book1D(histoname.c_str(), title.c_str(), 20, -0.5, 19.5); + + histoname = "n_sel_tracks"; + title = "N selected tracks"+trigPath; + v.n_sel_tracks = iBooker.book1D(histoname.c_str(), title.c_str(), 25, -0.5, 24.5); + + histoname = "3d_ip_distance"; + title = "3D IP distance of tracks (cm)"+trigPath; + v.h_3d_ip_distance = iBooker.book1D(histoname.c_str(), title.c_str(), 40, -0.1, 0.1); + + histoname = "3d_ip_error"; + title = "3D IP error of tracks (cm)"+trigPath; + v.h_3d_ip_error = iBooker.book1D(histoname.c_str(), title.c_str(), 40, 0., 0.1); + + histoname = "3d_ip_sig"; + title = "3D IP significance of tracks (cm)"+trigPath; + v.h_3d_ip_sig = iBooker.book1D(histoname.c_str(), title.c_str(), 40, -40, 40); + + // histoname = "n_pixel_hits"; + // title = "N pixel hits"+trigPath; + // v.n_pixel_hits = iBooker.book1D(histoname.c_str(), title.c_str(), 16, -0.5, 15.5); + + // histoname = "n_total_hits"; + // title = "N hits"+trigPath; + // v.n_total_hits = iBooker.book1D(histoname.c_str(), title.c_str(), 40, -0.5, 39.5); + } } + +// Define this as a plug-in +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(BTVHLTOfflineSource); diff --git a/DQMOffline/Trigger/plugins/BTVHLTOfflineSource.h b/DQMOffline/Trigger/plugins/BTVHLTOfflineSource.h index 088df64d9d84d..ebeccb6474a81 100644 --- a/DQMOffline/Trigger/plugins/BTVHLTOfflineSource.h +++ b/DQMOffline/Trigger/plugins/BTVHLTOfflineSource.h @@ -23,6 +23,7 @@ #include "DQMServices/Core/interface/DQMEDAnalyzer.h" #include "DQMServices/Core/interface/DQMStore.h" #include "DQMServices/Core/interface/MonitorElement.h" +#include "DQMOffline/Trigger/plugins/TriggerDQMBase.h" #include "DataFormats/BTauReco/interface/JetTag.h" #include "DataFormats/BTauReco/interface/SecondaryVertexTagInfo.h" #include "DataFormats/BTauReco/interface/ShallowTagInfo.h" @@ -104,7 +105,7 @@ class BTVHLTOfflineSource : public DQMEDAnalyzer { edm::TriggerNames triggerNames_; edm::Handle triggerObj_; - class PathInfo { + class PathInfo : public TriggerDQMBase { PathInfo(): prescaleUsed_(-1), pathName_("unset"), @@ -115,28 +116,6 @@ class BTVHLTOfflineSource : public DQMEDAnalyzer { {}; public: - void setHistos( - MonitorElement* const Discr, MonitorElement* const Pt, MonitorElement* const Eta, - MonitorElement* const Discr_HLTvsRECO, MonitorElement* const Discr_HLTMinusRECO, - MonitorElement* const Discr_turnon_loose, MonitorElement* const Discr_turnon_medium, MonitorElement* const Discr_turnon_tight, - MonitorElement* const PVz, MonitorElement* const fastPVz, - MonitorElement* const PVz_HLTMinusRECO, MonitorElement* const fastPVz_HLTMinusRECO, - MonitorElement* const n_vtx, MonitorElement* const vtx_mass, MonitorElement* const n_vtx_trks, - MonitorElement* const n_sel_tracks, MonitorElement* const h_3d_ip_distance, - MonitorElement* const h_3d_ip_error, MonitorElement* const h_3d_ip_sig // , - // MonitorElement* const n_pixel_hits, MonitorElement* const n_total_hits - ) - { Discr_ = Discr; Pt_ = Pt; Eta_ = Eta; - Discr_HLTvsRECO_ = Discr_HLTvsRECO; Discr_HLTMinusRECO_ = Discr_HLTMinusRECO; - Discr_turnon_loose_ = Discr_turnon_loose; Discr_turnon_medium_ = Discr_turnon_medium; Discr_turnon_tight_ = Discr_turnon_tight; - PVz_ = PVz; fastPVz_ = fastPVz; PVz_HLTMinusRECO_ = PVz_HLTMinusRECO; fastPVz_HLTMinusRECO_ = fastPVz_HLTMinusRECO; - n_vtx_ = n_vtx; vtx_mass_ = vtx_mass; n_vtx_trks_ = n_vtx_trks; - n_sel_tracks_ = n_sel_tracks; h_3d_ip_distance_ = h_3d_ip_distance; - h_3d_ip_error_ = h_3d_ip_error; h_3d_ip_sig_ = h_3d_ip_sig; - // n_pixel_hits_ = n_pixel_hits; n_total_hits_ = n_total_hits; - }; - - ~PathInfo() = default;; PathInfo(int prescaleUsed, std::string pathName, @@ -149,96 +128,48 @@ class BTVHLTOfflineSource : public DQMEDAnalyzer { filterName_(std::move(filterName)), processName_(std::move(processName)), objectType_(type), - triggerType_(std::move(triggerType)) - { - } - - MonitorElement * getMEhisto_Discr() { return Discr_;} - MonitorElement * getMEhisto_Pt() { return Pt_; } - MonitorElement * getMEhisto_Eta() { return Eta_;} - MonitorElement * getMEhisto_Discr_HLTvsRECO() { return Discr_HLTvsRECO_;} - MonitorElement * getMEhisto_Discr_HLTMinusRECO() { return Discr_HLTMinusRECO_;} - MonitorElement * getMEhisto_Discr_turnon_loose() { return Discr_turnon_loose_;} - MonitorElement * getMEhisto_Discr_turnon_medium() { return Discr_turnon_medium_;} - MonitorElement * getMEhisto_Discr_turnon_tight() { return Discr_turnon_tight_;} - MonitorElement * getMEhisto_PVz() { return PVz_;} - MonitorElement * getMEhisto_fastPVz() { return fastPVz_;} - MonitorElement * getMEhisto_PVz_HLTMinusRECO() { return PVz_HLTMinusRECO_;} - MonitorElement * getMEhisto_fastPVz_HLTMinusRECO() { return fastPVz_HLTMinusRECO_;} - MonitorElement * getMEhisto_n_vtx() { return n_vtx_; } - MonitorElement * getMEhisto_vtx_mass() { return vtx_mass_; } - MonitorElement * getMEhisto_n_vtx_trks() { return n_vtx_trks_; } - MonitorElement * getMEhisto_n_sel_tracks() { return n_sel_tracks_; } - MonitorElement * getMEhisto_h_3d_ip_distance() { return h_3d_ip_distance_; } - MonitorElement * getMEhisto_h_3d_ip_error() { return h_3d_ip_error_; } - MonitorElement * getMEhisto_h_3d_ip_sig() { return h_3d_ip_sig_; } - // MonitorElement * getMEhisto_n_pixel_hits() { return n_pixel_hits_; } - // MonitorElement * getMEhisto_n_total_hits() { return n_total_hits_; } - - const std::string getLabel( ) const { - return filterName_; - } - void setLabel(std::string labelName){ - filterName_ = std::move(labelName); - return; - } - const std::string getPath( ) const { - return pathName_; - } - const int getprescaleUsed() const { - return prescaleUsed_; - } - const std::string getProcess( ) const { - return processName_; - } - const int getObjectType( ) const { - return objectType_; - } - const std::string getTriggerType( ) const { - return triggerType_; - } - const edm::InputTag getTag() const{ - edm::InputTag tagName(filterName_,"",processName_); - return tagName; - } - bool operator==(const std::string& v) - { - return v==pathName_; - } + triggerType_(std::move(triggerType)) {} + + const std::string getLabel( ) const {return filterName_;} + void setLabel(std::string labelName) {filterName_ = std::move(labelName);} + const std::string getPath( ) const {return pathName_;} + const int getprescaleUsed() const {return prescaleUsed_;} + const std::string getProcess( ) const {return processName_;} + const int getObjectType( ) const {return objectType_;} + const std::string getTriggerType( ) const {return triggerType_;} + const edm::InputTag getTag() const {return edm::InputTag(filterName_,"",processName_);} + const bool operator== (const std::string& v) const {return v==pathName_;} + + MonitorElement* Discr; + MonitorElement* Pt; + MonitorElement* Eta; + MonitorElement* Discr_HLTvsRECO; + MonitorElement* Discr_HLTMinusRECO; + ObjME Discr_turnon_loose; + ObjME Discr_turnon_medium; + ObjME Discr_turnon_tight; + MonitorElement* PVz; + MonitorElement* fastPVz; + MonitorElement* PVz_HLTMinusRECO; + MonitorElement* fastPVz_HLTMinusRECO; + MonitorElement* n_vtx; + MonitorElement* vtx_mass; + MonitorElement* n_vtx_trks; + MonitorElement* n_sel_tracks; + MonitorElement* h_3d_ip_distance; + MonitorElement* h_3d_ip_error; + MonitorElement* h_3d_ip_sig; + // MonitorElement* n_pixel_hits_; + // MonitorElement* n_total_hits_; private: - - int prescaleUsed_; - std::string pathName_; - std::string filterName_; - std::string processName_; - int objectType_; - std::string triggerType_; - - MonitorElement* Discr_; - MonitorElement* Pt_; - MonitorElement* Eta_; - MonitorElement* Discr_HLTvsRECO_; - MonitorElement* Discr_HLTMinusRECO_; - MonitorElement* Discr_turnon_loose_; - MonitorElement* Discr_turnon_medium_; - MonitorElement* Discr_turnon_tight_; - MonitorElement* PVz_; - MonitorElement* fastPVz_; - MonitorElement* PVz_HLTMinusRECO_; - MonitorElement* fastPVz_HLTMinusRECO_; - MonitorElement* n_vtx_; - MonitorElement* vtx_mass_; - MonitorElement* n_vtx_trks_; - MonitorElement* n_sel_tracks_; - MonitorElement* h_3d_ip_distance_; - MonitorElement* h_3d_ip_error_; - MonitorElement* h_3d_ip_sig_; - // MonitorElement* n_pixel_hits_; - // MonitorElement* n_total_hits_; - - - }; + int prescaleUsed_; + std::string pathName_; + std::string filterName_; + std::string processName_; + int objectType_; + std::string triggerType_; + }; class PathInfoCollection: public std::vector { public: diff --git a/DQMOffline/Trigger/plugins/TriggerDQMBase.h b/DQMOffline/Trigger/plugins/TriggerDQMBase.h index f02d5086fc3c5..c4606191a1636 100644 --- a/DQMOffline/Trigger/plugins/TriggerDQMBase.h +++ b/DQMOffline/Trigger/plugins/TriggerDQMBase.h @@ -8,7 +8,7 @@ class TriggerDQMBase { public: - TriggerDQMBase()= default;; + TriggerDQMBase()= default;; virtual ~TriggerDQMBase()= default;; struct MEbinning { @@ -16,7 +16,7 @@ class TriggerDQMBase double xmin; double xmax; }; - + struct ObjME { MonitorElement* numerator = nullptr; MonitorElement* denominator = nullptr; @@ -27,7 +27,6 @@ class TriggerDQMBase static MEbinning getHistoPSet (const edm::ParameterSet& pset); static MEbinning getHistoLSPSet (const edm::ParameterSet& pset); - protected: void bookME(DQMStore::IBooker &, ObjME& me, const std::string& histname, const std::string& histtitle, unsigned nbins, double xmin, double xmax); void bookME(DQMStore::IBooker &, ObjME& me, const std::string& histname, const std::string& histtitle, const std::vector& binningX); void bookME(DQMStore::IBooker &, ObjME& me, const std::string& histname, const std::string& histtitle, unsigned nbinsX, double xmin, double xmax, double ymin, double ymax); @@ -35,6 +34,8 @@ class TriggerDQMBase void bookME(DQMStore::IBooker &, ObjME& me, const std::string& histname, const std::string& histtitle, const std::vector& binningX, const std::vector& binningY); void setMETitle(ObjME& me, const std::string& titleX, const std::string& titleY); + protected: + private: };//class diff --git a/DQMOffline/Trigger/python/BTaggingMonitoring_Client_cff.py b/DQMOffline/Trigger/python/BTaggingMonitoring_Client_cff.py index 191d132f77754..4e185a6bbfd9c 100644 --- a/DQMOffline/Trigger/python/BTaggingMonitoring_Client_cff.py +++ b/DQMOffline/Trigger/python/BTaggingMonitoring_Client_cff.py @@ -126,12 +126,25 @@ ), ) +BTVEfficiency_TurnOnCurves = DQMEDHarvester("DQMGenericClient", + subDirs = cms.untracked.vstring( + "HLT/BTV/HLT_PFHT380_SixPFJet32_DoublePFBTagDeepCSV_*", + ), + verbose = cms.untracked.uint32(0), # Set to 2 for all messages + resolution = cms.vstring(), + efficiency = cms.vstring( + "turnon_loose 'turn-on (loose online OP); discriminator; efficiency' Turnon_loose_Discr_numerator Turnon_loose_Discr_denominator", + "turnon_medium 'turn-on (medium online OP); discriminator; efficiency' Turnon_medium_Discr_numerator Turnon_medium_Discr_denominator", + "turnon_tight 'turn-on (tight online OP); discriminator; efficiency' Turnon_tight_Discr_numerator Turnon_tight_Discr_denominator", + ), +) + btaggingClient = cms.Sequence( - BTVEfficiency_BTagMu_DiJet + BTVEfficiency_TurnOnCurves + + BTVEfficiency_BTagMu_DiJet + BTVEfficiency_BTagMu_Jet + BTVEfficiency_PFJet ) - diff --git a/DQMOffline/Trigger/python/DQMOffline_HLT_Client_cff.py b/DQMOffline/Trigger/python/DQMOffline_HLT_Client_cff.py index 387f3e4a1f457..d713a300ee6dd 100644 --- a/DQMOffline/Trigger/python/DQMOffline_HLT_Client_cff.py +++ b/DQMOffline/Trigger/python/DQMOffline_HLT_Client_cff.py @@ -28,6 +28,8 @@ from DQMOffline.Trigger.BTaggingMonitoring_Client_cff import * from DQMOffline.Trigger.BPHMonitoring_Client_cff import * from DQMOffline.Trigger.JetMETPromptMonitoring_Client_cff import * + + hltOfflineDQMClient = cms.Sequence( # hltGeneralSeqClient * sipixelHarvesterHLTsequence * @@ -35,7 +37,7 @@ hltMuonPostVal * jetMETHLTOfflineClient * fsqClient * - HiJetClient * + HiJetClient * #tagAndProbeEfficiencyPostProcessor * HLTTauPostSeq * dqmOfflineHLTCert * diff --git a/DQMOffline/Trigger/src/SealModule.cc b/DQMOffline/Trigger/src/SealModule.cc index 37b2f4f9a72b4..c46c5bdea4758 100644 --- a/DQMOffline/Trigger/src/SealModule.cc +++ b/DQMOffline/Trigger/src/SealModule.cc @@ -14,7 +14,6 @@ #include "DQMOffline/Trigger/interface/TopDiLeptonHLTOfflineDQM.h" #include "DQMOffline/Trigger/interface/TopSingleLeptonHLTOfflineDQM.h" #include "DQMOffline/Trigger/interface/FSQDiJetAve.h" -#include "DQMOffline/Trigger/interface/BTVHLTOfflineSource.h" #include "FWCore/Framework/interface/MakerMacros.h" DEFINE_FWK_MODULE(EgHLTOfflineSource); @@ -32,5 +31,4 @@ DEFINE_FWK_MODULE(HLTInclusiveVBFClient); DEFINE_FWK_MODULE(TopDiLeptonHLTOfflineDQM); DEFINE_FWK_MODULE(TopSingleLeptonHLTOfflineDQM); DEFINE_FWK_MODULE(FSQDiJetAve); -DEFINE_FWK_MODULE(BTVHLTOfflineSource); From e07aec524cabc95c5b4a894a4ae41e040143f137 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 5 Apr 2018 16:51:22 +0200 Subject: [PATCH 355/426] Reduce TDCTime axis bin 250 -> 100, or 1ns to 2.5ns granularity --- DQM/HcalCommon/interface/ValueQuantity.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DQM/HcalCommon/interface/ValueQuantity.h b/DQM/HcalCommon/interface/ValueQuantity.h index 3787ce0937dbf..f18cd49ced849 100644 --- a/DQM/HcalCommon/interface/ValueQuantity.h +++ b/DQM/HcalCommon/interface/ValueQuantity.h @@ -261,7 +261,7 @@ namespace hcaldqm {fQIE10fC_2000,100}, {fQIE10fC_10000,500}, {fQIE8fC_1000_50,50}, - {fTime_ns_250,250}, + {fTime_ns_250,100}, {fADC_256,256}, {ffC_generic_10000,10000}, {ffC_generic_400000,10000}, From 2f6aab03a4211c38ed59ff40bf288006e8300ef5 Mon Sep 17 00:00:00 2001 From: Heiner Tholen Date: Thu, 5 Apr 2018 16:54:41 +0200 Subject: [PATCH 356/426] adapting subdir-name to be able to handle one trigger for PF and Calo b-tagging --- DQMOffline/Trigger/plugins/BTVHLTOfflineSource.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DQMOffline/Trigger/plugins/BTVHLTOfflineSource.cc b/DQMOffline/Trigger/plugins/BTVHLTOfflineSource.cc index db15c7f414486..926794e23f6fe 100644 --- a/DQMOffline/Trigger/plugins/BTVHLTOfflineSource.cc +++ b/DQMOffline/Trigger/plugins/BTVHLTOfflineSource.cc @@ -305,7 +305,7 @@ BTVHLTOfflineSource::bookHistograms(DQMStore::IBooker & iBooker, edm::Run const for(auto & v : hltPathsAll_){ // std::string trgPathName = HLTConfigProvider::removeVersion(v.getPath()); - std::string subdirName = dirname_ +"/"+ trgPathName; + std::string subdirName = dirname_ +"/"+ trgPathName + v.getTriggerType(); std::string trigPath = "("+trgPathName+")"; iBooker.setCurrentFolder(subdirName); From af9ebd9f0162f37e1812b5c8700526fa93fabbda Mon Sep 17 00:00:00 2001 From: Heiner Tholen Date: Thu, 5 Apr 2018 17:13:01 +0200 Subject: [PATCH 357/426] adding support for adding offline probb and probbb --- .../Trigger/plugins/BTVHLTOfflineSource.cc | 37 +++++++++++++------ .../Trigger/plugins/BTVHLTOfflineSource.h | 4 +- .../Trigger/python/BTVHLTOfflineSource_cfi.py | 4 +- 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/DQMOffline/Trigger/plugins/BTVHLTOfflineSource.cc b/DQMOffline/Trigger/plugins/BTVHLTOfflineSource.cc index 926794e23f6fe..4b3eb52b59735 100644 --- a/DQMOffline/Trigger/plugins/BTVHLTOfflineSource.cc +++ b/DQMOffline/Trigger/plugins/BTVHLTOfflineSource.cc @@ -47,7 +47,7 @@ BTVHLTOfflineSource::BTVHLTOfflineSource(const edm::ParameterSet& iConfig) triggerResultsLabel_ = iConfig.getParameter("triggerResultsLabel"); turnon_threshold_loose_ = iConfig.getParameter("turnon_threshold_loose"); turnon_threshold_medium_ = iConfig.getParameter("turnon_threshold_medium"); - turnon_threshold_tight_ = iConfig.getParameter("turnon_threshold_tight"); + turnon_threshold_tight_ = iConfig.getParameter("turnon_threshold_tight"); triggerSummaryToken = consumes (triggerSummaryLabel_); triggerResultsToken = consumes (triggerResultsLabel_); triggerSummaryFUToken = consumes (edm::InputTag(triggerSummaryLabel_.label(),triggerSummaryLabel_.instance(),std::string("FU"))); @@ -60,8 +60,8 @@ BTVHLTOfflineSource::BTVHLTOfflineSource(const edm::ParameterSet& iConfig) // edm::InputTag("hltCombinedSecondaryVertexBJetTagsPF")); pfTagsToken_ = consumes (iConfig.getParameter("onlineDiscrLabelPF")); caloTagsToken_ = consumes (iConfig.getParameter("onlineDiscrLabelCalo")); - offlineDiscrTokenPF_ = consumes (iConfig.getParameter("offlineDiscrLabelPF")); - offlineDiscrTokenCalo_ = consumes (iConfig.getParameter("offlineDiscrLabelCalo")); + offlineDiscrTokenb_ = consumes (iConfig.getParameter("offlineDiscrLabelb")); + offlineDiscrTokenbb_ = consumes (iConfig.getParameter("offlineDiscrLabelbb")); hltFastPVToken_ = consumes > (iConfig.getParameter("hltFastPVLabel")); hltPFPVToken_ = consumes > (iConfig.getParameter("hltPFPVLabel")); hltCaloPVToken_ = consumes > (iConfig.getParameter("hltCaloPVLabel")); @@ -133,11 +133,11 @@ BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iS Handle VertexHandler; - Handle offlineJetTagHandlerPF; - iEvent.getByToken(offlineDiscrTokenPF_, offlineJetTagHandlerPF); + Handle offlineJetTagHandlerb; + iEvent.getByToken(offlineDiscrTokenb_, offlineJetTagHandlerb); - Handle offlineJetTagHandlerCalo; - iEvent.getByToken(offlineDiscrTokenCalo_, offlineJetTagHandlerCalo); + Handle offlineJetTagHandlerbb; + iEvent.getByToken(offlineDiscrTokenbb_, offlineJetTagHandlerbb); Handle offlineVertexHandler; iEvent.getByToken(offlinePVToken_, offlineVertexHandler); @@ -158,7 +158,6 @@ BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iS || (v.getTriggerType() == "Calo" && caloTags.isValid() && !caloTags->empty()) ) { const auto & iter = (v.getTriggerType() == "PF") ? pfTags->begin() : caloTags->begin(); - const auto & offlineJetTagHandler = (v.getTriggerType() == "PF") ? offlineJetTagHandlerPF : offlineJetTagHandlerCalo; float Discr_online = iter->second; if (Discr_online<0) Discr_online = -0.05; @@ -167,11 +166,23 @@ BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iS v.Pt->Fill(iter->first->pt()); v.Eta->Fill(iter->first->eta()); - if(offlineJetTagHandler.isValid()){ - for (auto const & iterO : *offlineJetTagHandler){ - float DR = reco::deltaR(iterO.first->eta(),iterO.first->phi(),iter->first->eta(),iter->first->phi()); + if(offlineJetTagHandlerb.isValid()){ + for (auto const & iterOffb : *offlineJetTagHandlerb){ + float DR = reco::deltaR(iterOffb.first->eta(),iterOffb.first->phi(),iter->first->eta(),iter->first->phi()); if (DR<0.3) { - float Discr_offline = iterO.second; + float Discr_offline = iterOffb.second; + + // offline probb and probbb must be added (if probbb isn't specified, it'll just use probb) + if(offlineJetTagHandlerbb.isValid()){ + for (auto const & iterOffbb : *offlineJetTagHandlerbb){ + DR = reco::deltaR(iterOffbb.first->eta(),iterOffbb.first->phi(),iter->first->eta(),iter->first->phi()); + if (DR<0.3) { + Discr_offline += iterOffbb.second; + break; + } + } + } + if (Discr_offline<0) Discr_offline = -0.05; v.Discr_HLTvsRECO->Fill(Discr_online, Discr_offline); v.Discr_HLTMinusRECO->Fill(Discr_online - Discr_offline); @@ -183,6 +194,8 @@ BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iS if (Discr_online > turnon_threshold_loose_) v.Discr_turnon_loose .numerator->Fill(Discr_offline); if (Discr_online > turnon_threshold_medium_)v.Discr_turnon_medium.numerator->Fill(Discr_offline); if (Discr_online > turnon_threshold_tight_) v.Discr_turnon_tight .numerator->Fill(Discr_offline); + + break; } } } diff --git a/DQMOffline/Trigger/plugins/BTVHLTOfflineSource.h b/DQMOffline/Trigger/plugins/BTVHLTOfflineSource.h index ebeccb6474a81..54b7826eeb74e 100644 --- a/DQMOffline/Trigger/plugins/BTVHLTOfflineSource.h +++ b/DQMOffline/Trigger/plugins/BTVHLTOfflineSource.h @@ -66,8 +66,8 @@ class BTVHLTOfflineSource : public DQMEDAnalyzer { float turnon_threshold_medium_; float turnon_threshold_tight_; - edm::EDGetTokenT offlineDiscrTokenPF_; - edm::EDGetTokenT offlineDiscrTokenCalo_; + edm::EDGetTokenT offlineDiscrTokenb_; + edm::EDGetTokenT offlineDiscrTokenbb_; edm::EDGetTokenT > hltFastPVToken_; edm::EDGetTokenT > hltPFPVToken_; diff --git a/DQMOffline/Trigger/python/BTVHLTOfflineSource_cfi.py b/DQMOffline/Trigger/python/BTVHLTOfflineSource_cfi.py index d2886c2ff9ca8..4131d4d7e070a 100644 --- a/DQMOffline/Trigger/python/BTVHLTOfflineSource_cfi.py +++ b/DQMOffline/Trigger/python/BTVHLTOfflineSource_cfi.py @@ -11,8 +11,8 @@ triggerResultsLabel = cms.InputTag("TriggerResults","","HLT"), onlineDiscrLabelPF = cms.InputTag("hltDeepCombinedSecondaryVertexBJetTagsPF", "probb"), onlineDiscrLabelCalo = cms.InputTag("hltDeepCombinedSecondaryVertexBJetTagsCalo", "probb"), - offlineDiscrLabelPF = cms.InputTag("pfDeepCSVJetTags", "probb"), - offlineDiscrLabelCalo = cms.InputTag("pfDeepCSVJetTags", "probb"), + offlineDiscrLabelb = cms.InputTag("pfDeepCSVJetTags", "probb"), + offlineDiscrLabelbb = cms.InputTag("pfDeepCSVJetTags", "probbb"), hltFastPVLabel = cms.InputTag("hltFastPrimaryVertex"), hltPFPVLabel = cms.InputTag("hltVerticesPFSelector"), hltCaloPVLabel = cms.InputTag("hltVerticesL3"), From 1ad27edacd1311fec6fb3dffb7f1eed6375a312d Mon Sep 17 00:00:00 2001 From: Heiner Tholen Date: Thu, 5 Apr 2018 17:19:09 +0200 Subject: [PATCH 358/426] reverting accidental modification --- DQMOffline/Trigger/python/DQMOffline_HLT_Client_cff.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/DQMOffline/Trigger/python/DQMOffline_HLT_Client_cff.py b/DQMOffline/Trigger/python/DQMOffline_HLT_Client_cff.py index d713a300ee6dd..387f3e4a1f457 100644 --- a/DQMOffline/Trigger/python/DQMOffline_HLT_Client_cff.py +++ b/DQMOffline/Trigger/python/DQMOffline_HLT_Client_cff.py @@ -28,8 +28,6 @@ from DQMOffline.Trigger.BTaggingMonitoring_Client_cff import * from DQMOffline.Trigger.BPHMonitoring_Client_cff import * from DQMOffline.Trigger.JetMETPromptMonitoring_Client_cff import * - - hltOfflineDQMClient = cms.Sequence( # hltGeneralSeqClient * sipixelHarvesterHLTsequence * @@ -37,7 +35,7 @@ hltMuonPostVal * jetMETHLTOfflineClient * fsqClient * - HiJetClient * + HiJetClient * #tagAndProbeEfficiencyPostProcessor * HLTTauPostSeq * dqmOfflineHLTCert * From a79f9af8053a060917b23d6e7c4ee4f44ef8ca85 Mon Sep 17 00:00:00 2001 From: Luca Date: Thu, 5 Apr 2018 17:27:34 +0200 Subject: [PATCH 359/426] add egamma corrections to run1,2 2017 mc --- Configuration/AlCa/python/autoCond.py | 30 +++++++++++++-------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Configuration/AlCa/python/autoCond.py b/Configuration/AlCa/python/autoCond.py index ca55939787f8b..66f21a8eee278 100644 --- a/Configuration/AlCa/python/autoCond.py +++ b/Configuration/AlCa/python/autoCond.py @@ -2,27 +2,27 @@ ### NEW KEYS ### # GlobalTag for MC production with perfectly aligned and calibrated detector for Run1 - 'run1_design' : '101X_mcRun1_design_v3', + 'run1_design' : '101X_mcRun1_design_v4', # GlobalTag for MC production (pp collisions) with realistic alignment and calibrations for Run1 - 'run1_mc' : '101X_mcRun1_realistic_v3', + 'run1_mc' : '101X_mcRun1_realistic_v4', # GlobalTag for MC production (Heavy Ions collisions) with realistic alignment and calibrations for Run1 - 'run1_mc_hi' : '101X_mcRun1_HeavyIon_v3', + 'run1_mc_hi' : '101X_mcRun1_HeavyIon_v4', # GlobalTag for MC production (p-Pb collisions) with realistic alignment and calibrations for Run1 - 'run1_mc_pa' : '101X_mcRun1_pA_v3', + 'run1_mc_pa' : '101X_mcRun1_pA_v4', # GlobalTag for MC production with perfectly aligned and calibrated detector for Run2 - 'run2_design' : '101X_mcRun2_design_v4', + 'run2_design' : '101X_mcRun2_design_v5', # GlobalTag for MC production with pessimistic alignment and calibrations for Run2 - 'run2_mc_50ns' : '101X_mcRun2_startup_v4', + 'run2_mc_50ns' : '101X_mcRun2_startup_v5', #GlobalTag for MC production with optimistic alignment and calibrations for Run2 - 'run2_mc' : '101X_mcRun2_asymptotic_v4', + 'run2_mc' : '101X_mcRun2_asymptotic_v5', # GlobalTag for MC production (L1 Trigger Stage1) with starup-like alignment and calibrations for Run2, L1 trigger in Stage1 mode - 'run2_mc_l1stage1' : '93X_mcRun2_asymptotic_v5', + 'run2_mc_l1stage1' : '93X_mcRun2_asymptotic_v6', # GlobalTag for MC production (cosmics) with starup-like alignment and calibrations for Run2, Strip tracker in peak mode - 'run2_mc_cosmics' : '101X_mcRun2cosmics_startup_deco_v4', + 'run2_mc_cosmics' : '101X_mcRun2cosmics_startup_deco_v5', # GlobalTag for MC production (Heavy Ions collisions) with optimistic alignment and calibrations for Run2 - 'run2_mc_hi' : '101X_mcRun2_HeavyIon_v5', + 'run2_mc_hi' : '101X_mcRun2_HeavyIon_v6', # GlobalTag for MC production (p-Pb collisions) with realistic alignment and calibrations for Run2 - 'run2_mc_pa' : '101X_mcRun2_pA_v4', + 'run2_mc_pa' : '101X_mcRun2_pA_v5', # GlobalTag for Run1 data reprocessing 'run1_data' : '101X_dataRun2_v8', # GlobalTag for Run2 data reprocessing @@ -40,13 +40,13 @@ # GlobalTag for Run2 HLT for HI: it points to the online GT 'run2_hlt_hi' : '101X_dataRun2_HLTHI_frozen_v7', # GlobalTag for MC production with perfectly aligned and calibrated detector for Phase1 2017 (and 0,0,~0-centred beamspot) - 'phase1_2017_design' : '101X_mc2017_design_IdealBS_v6', + 'phase1_2017_design' : '101X_mc2017_design_IdealBS_v7', # GlobalTag for MC production with realistic conditions for Phase1 2017 detector - 'phase1_2017_realistic' : '101X_mc2017_realistic_v6', + 'phase1_2017_realistic' : '101X_mc2017_realistic_v7', # GlobalTag for MC production (cosmics) with realistic alignment and calibrations for Phase1 2017 detector, Strip tracker in DECO mode - 'phase1_2017_cosmics' : '101X_mc2017cosmics_realistic_deco_v6', + 'phase1_2017_cosmics' : '101X_mc2017cosmics_realistic_deco_v7', # GlobalTag for MC production (cosmics) with realistic alignment and calibrations for Phase1 2017 detector, Strip tracker in PEAK mode - 'phase1_2017_cosmics_peak' : '101X_mc2017cosmics_realistic_peak_v6', + 'phase1_2017_cosmics_peak' : '101X_mc2017cosmics_realistic_peak_v7', # GlobalTag for MC production with perfectly aligned and calibrated detector for full Phase1 2018 (and 0,0,0-centred beamspot) 'phase1_2018_design' : '101X_upgrade2018_design_v8', # GlobalTag for MC production with realistic conditions for full Phase1 2018 detector From aaaff8f67c77cb1cb9ecb151849feaf14f5a2ff3 Mon Sep 17 00:00:00 2001 From: Sam Harper Date: Thu, 5 Apr 2018 17:25:28 +0100 Subject: [PATCH 360/426] setting the 1/E-1/p default var to 0 not 1 --- .../EgammaHLTProducers/src/EgammaHLTGsfTrackVarProducer.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RecoEgamma/EgammaHLTProducers/src/EgammaHLTGsfTrackVarProducer.cc b/RecoEgamma/EgammaHLTProducers/src/EgammaHLTGsfTrackVarProducer.cc index 1314de7a716d0..eb20c3d711463 100644 --- a/RecoEgamma/EgammaHLTProducers/src/EgammaHLTGsfTrackVarProducer.cc +++ b/RecoEgamma/EgammaHLTProducers/src/EgammaHLTGsfTrackVarProducer.cc @@ -144,8 +144,8 @@ void EgammaHLTGsfTrackVarProducer::produce(edm::Event& iEvent, const edm::EventS missingHitsValue = 0; validHitsValue = 100; chi2Value = 0; - oneOverESuperMinusOneOverPValue = 1; - oneOverESeedMinusOneOverPValue = 1; + oneOverESuperMinusOneOverPValue = 0; + oneOverESeedMinusOneOverPValue = 0; }else{ for(size_t trkNr=0;trkNr Date: Thu, 5 Apr 2018 22:42:21 +0200 Subject: [PATCH 361/426] fix run2_mc_l1stage1 --- Configuration/AlCa/python/autoCond.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Configuration/AlCa/python/autoCond.py b/Configuration/AlCa/python/autoCond.py index 66f21a8eee278..c7f91d9cb8c85 100644 --- a/Configuration/AlCa/python/autoCond.py +++ b/Configuration/AlCa/python/autoCond.py @@ -16,7 +16,7 @@ #GlobalTag for MC production with optimistic alignment and calibrations for Run2 'run2_mc' : '101X_mcRun2_asymptotic_v5', # GlobalTag for MC production (L1 Trigger Stage1) with starup-like alignment and calibrations for Run2, L1 trigger in Stage1 mode - 'run2_mc_l1stage1' : '93X_mcRun2_asymptotic_v6', + 'run2_mc_l1stage1' : '93X_mcRun2_asymptotic_v4', # GlobalTag for MC production (cosmics) with starup-like alignment and calibrations for Run2, Strip tracker in peak mode 'run2_mc_cosmics' : '101X_mcRun2cosmics_startup_deco_v5', # GlobalTag for MC production (Heavy Ions collisions) with optimistic alignment and calibrations for Run2 From 1da368f34e91b88d7009cea2d9081b36119f033a Mon Sep 17 00:00:00 2001 From: Leonard Apanasevich Date: Thu, 5 Apr 2018 20:04:29 -0500 Subject: [PATCH 362/426] Check size of bx collections in data too --- DQM/L1TMonitor/src/L1TdeStage2uGT.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/DQM/L1TMonitor/src/L1TdeStage2uGT.cc b/DQM/L1TMonitor/src/L1TdeStage2uGT.cc index 91aca3cec94b5..6ba68dc65c5d8 100644 --- a/DQM/L1TMonitor/src/L1TdeStage2uGT.cc +++ b/DQM/L1TMonitor/src/L1TdeStage2uGT.cc @@ -67,10 +67,14 @@ void L1TdeStage2uGT::analyze(const edm::Event & event, const edm::EventSetup & e // int bx = event.bunchCrossing(); - // check that the requested range of BX's is consistant with the BX's in the emulated collection + // check that the requested range of BX's is consistent with the BX's in the emulated and unpacked collections if (emulCollection->getFirstBX() > firstBx) firstBx = emulCollection->getFirstBX(); if (emulCollection->getLastBX() < lastBx) lastBx = emulCollection->getLastBX(); + if (dataCollection->getFirstBX() > firstBx) firstBx = dataCollection->getFirstBX(); + if (dataCollection->getLastBX() < lastBx) lastBx = dataCollection->getLastBX(); + + for (int ibx = firstBx; ibx <= lastBx; ++ibx) { ostringstream bxt; From 8b66d66177d62adc1243f4faaaa80b9aba137b11 Mon Sep 17 00:00:00 2001 From: wouf Date: Fri, 6 Apr 2018 06:57:53 +0300 Subject: [PATCH 363/426] Update Hydjet_Quenched_MinBias_XeXe_5442GeV_cfi.py New 5 TeV tune update --- .../python/Hydjet_Quenched_MinBias_XeXe_5442GeV_cfi.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Configuration/Generator/python/Hydjet_Quenched_MinBias_XeXe_5442GeV_cfi.py b/Configuration/Generator/python/Hydjet_Quenched_MinBias_XeXe_5442GeV_cfi.py index d8cc727c664cc..e90c8b1b1eb1d 100644 --- a/Configuration/Generator/python/Hydjet_Quenched_MinBias_XeXe_5442GeV_cfi.py +++ b/Configuration/Generator/python/Hydjet_Quenched_MinBias_XeXe_5442GeV_cfi.py @@ -15,10 +15,10 @@ numQuarkFlavor = cms.int32(0), ## to be removed sigmaInelNN = cms.double(70), shadowingSwitch = cms.int32(1), - nMultiplicity = cms.int32(9000), + nMultiplicity = cms.int32(18545), fracSoftMultiplicity = cms.double(1.), - maxLongitudinalRapidity = cms.double(2.3), - maxTransverseRapidity = cms.double(1.15), + maxLongitudinalRapidity = cms.double(3.75), + maxTransverseRapidity = cms.double(1.16), angularSpectrumSelector = cms.int32(1), rotateEventPlane = cms.bool(True), allowEmptyEvents = cms.bool(False), @@ -28,7 +28,7 @@ PythiaParameters = cms.PSet( pythiaUESettingsBlock, hydjetPythiaDefault = cms.vstring('MSEL=0 ! user processes', - 'CKIN(3)=8.15',# ! ptMin + 'CKIN(3)=9.2',# ! ptMin 'MSTP(81)=1' ), myParameters = cms.vstring('MDCY(310,1)=0'), From 9962cf74778209b49e87127dc3b524103f959a3c Mon Sep 17 00:00:00 2001 From: Cedric Prieels Date: Fri, 6 Apr 2018 13:11:39 +0200 Subject: [PATCH 364/426] Added ratios --- Validation/RecoMuon/test/macro/PlotHelpers.C | 85 +++++++++++++++++-- .../RecoMuon/test/macro/new_PlotHelpers.C | 79 ++++++++++++++++- .../test/macro/new_TrackValHistoPublisher.C | 3 +- 3 files changed, 158 insertions(+), 9 deletions(-) diff --git a/Validation/RecoMuon/test/macro/PlotHelpers.C b/Validation/RecoMuon/test/macro/PlotHelpers.C index 49a83f33b506f..f3848677dca91 100644 --- a/Validation/RecoMuon/test/macro/PlotHelpers.C +++ b/Validation/RecoMuon/test/macro/PlotHelpers.C @@ -17,6 +17,10 @@ void NormalizeHistogramsToFirst(TH1* h1, TH1* h2); void NormalizeHistogramsTo1(TH1* h1, TH1* h2); +TH1* PlotRatiosHistograms(TH1* h1, TH1* h2); + +int ratioCounter = 0; + ///// // Uncomment the following line to get more debuggin output @@ -40,6 +44,7 @@ void SetGlobalStyle() { //tyle->SetTitleYSize(0.3); //gStyle->SetLabelSize(0.6) //gStyle->SetTextSize(0.5); + gStyle->SetOptStat(0); } // //////////////////////////////////////////////////////////// @@ -62,12 +67,15 @@ void SetHistogramStyle(TH1* h, Style_t mstyle, Color_t color, Size_t msize = 0.7 h->SetLineWidth(lwidth); h->GetYaxis()->SetTitleSize(tsize); h->GetYaxis()->SetTitleOffset(toffset); + h->GetXaxis()->SetLabelFont(63); + h->GetXaxis()->SetLabelSize(14); // labels will be 14 pixels + h->GetYaxis()->SetLabelFont(63); + h->GetYaxis()->SetLabelSize(14); } // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// -// // This function finds the list of TDirectories in a branch // that match a given string @@ -354,7 +362,7 @@ void PlotNHistograms(const TString& pdfFile, #endif rdir->GetObject(rcollname + "/" + hnames_tmp, rh); if (! rh) { - cout << "WARNING: Could not find a reference histogram or profile named " << hnames_tmp[i] + cout << "WARNING: Could not find a reference histogram or profile named " << hnames_tmp << " in " << rdir->GetName() << endl; cout << " Skipping" << endl; continue; @@ -398,8 +406,8 @@ void PlotNHistograms(const TString& pdfFile, << " from " << sdir << endl; #endif sdir->GetObject(scollname + "/" + hnames_tmp, sh); - if (! rh) { - cout << "WARNING: Could not find a signal histogram or profile named " << hnames_tmp[i] + if (! sh) { + cout << "WARNING: Could not find a signal histogram or profile named " << hnames_tmp << " in " << rdir->GetName() << endl; cout << " Skipping" << endl; continue; @@ -408,7 +416,7 @@ void PlotNHistograms(const TString& pdfFile, //If it is a 2D project it in Y... is this what we always want? if (TString(sh->IsA()->GetName()) == "TH2F") { #ifdef DEBUG - cout << "DEBUG: " << hnames_tmp[i] << " is a TH2F object... project in Y!" << endl; + cout << "DEBUG: " << hnames_tmp << " is a TH2F object... project in Y!" << endl; #endif TH1* proj = ((TH2F*) sh)->ProjectionY(); sh = proj; @@ -470,6 +478,22 @@ void PlotNHistograms(const TString& pdfFile, // Move to subpad canvas->cd(i+1); + TPad* pad1 = NULL; + TPad* pad2 = NULL; + + pad1 = new TPad("pad1", "pad1", 0, 0.3, 1, 1.0); + pad2 = new TPad("pad2", "pad2", 0, 0.0, 1, 0.3); + + pad1->SetTopMargin (0.08); + pad1->SetBottomMargin(0.01); + pad1->Draw(); + + pad2->SetTopMargin (0.05); + pad2->SetBottomMargin(0.45); + pad2->Draw(); + + pad1->cd(); + // Check Logy if (logy) { if (logy[i]) @@ -508,6 +532,12 @@ void PlotNHistograms(const TString& pdfFile, gPad->SetFillColor(kBlue-10); } } + + pad2->cd(); + + TH1* ratioplot = PlotRatiosHistograms(rh, sh); + SetHistogramStyle(ratioplot, 21, 4); + ratioplot->Draw("ep"); } // End loop @@ -787,3 +817,48 @@ void plot6histos(TCanvas *canvas, } */ +//////////////////////////////////////////////////////// +// +// ratio plot from the two histograms +// +///////////////////////////////////////////////////////// + +TH1* PlotRatiosHistograms(TH1* h1, TH1* h2){ + + ++ratioCounter; + + Int_t nbinsx = h1->GetNbinsX(); + + Double_t xmin = h1->GetBinLowEdge(0); + Double_t xmax = h1->GetBinLowEdge(nbinsx+1); + + TH1F* h_ratio = new TH1F(Form("h_ratio_%d", ratioCounter), "", nbinsx, xmin, xmax); + + for (Int_t ibin=1; ibin<=nbinsx; ibin++) { + + Float_t h1Value = h1->GetBinContent(ibin); + Float_t h1Error = h1->GetBinError(ibin); + + Float_t h2Value = h2->GetBinContent(ibin); + Float_t h2Error = h2->GetBinError(ibin); + + Float_t ratioVal = 999; + Float_t ratioErr = 999; + + if (h2Value > 0) { + ratioVal = h1Value / h2Value; + ratioErr = h1Error / h2Value; + } + + h_ratio->SetBinContent(ibin, ratioVal); + h_ratio->SetBinError (ibin, ratioErr); + + } + + h_ratio->SetTitle(""); + h_ratio->GetYaxis()->SetTitle(""); + h_ratio->GetYaxis()->SetRangeUser(0.4, 1.6); + + return h_ratio; + +} diff --git a/Validation/RecoMuon/test/macro/new_PlotHelpers.C b/Validation/RecoMuon/test/macro/new_PlotHelpers.C index 459d10612b426..3f80c163ac0e0 100644 --- a/Validation/RecoMuon/test/macro/new_PlotHelpers.C +++ b/Validation/RecoMuon/test/macro/new_PlotHelpers.C @@ -16,6 +16,9 @@ void NormalizeHistogramsToFirst(TH1* h1, TH1* h2); void NormalizeHistogramsToOne(TH1* h1, TH1* h2); void NormalizeHistogramsAsDensity(TH1* h1, TH1* h2); +TH1* PlotRatiosHistograms(TH1* h1, TH1* h2); + +int ratioCounter = 0; // debugging printouts bool DEBUGP = false; @@ -38,6 +41,7 @@ void SetGlobalStyle() { //tyle->SetTitleYSize(0.3); //gStyle->SetLabelSize(0.6) //gStyle->SetTextSize(0.5); + gStyle->SetOptStat(0); } // //////////////////////////////////////////////////////////// @@ -60,6 +64,10 @@ void SetHistogramStyle(TH1* h, Style_t mstyle, Color_t color, Size_t msize = 0.7 h->SetLineWidth(lwidth); h->GetYaxis()->SetTitleSize(tsize); h->GetYaxis()->SetTitleOffset(toffset); + h->GetXaxis()->SetLabelFont(63); + h->GetXaxis()->SetLabelSize(14); // labels will be 14 pixels + h->GetYaxis()->SetLabelFont(63); + h->GetYaxis()->SetLabelSize(14); } // //////////////////////////////////////////////////////////// @@ -467,9 +475,24 @@ void PlotNHistograms(const TString& pdfFile, // Move to subpad canvas->cd(i+1); - // Check Logy + TPad* pad1 = NULL; + TPad* pad2 = NULL; + + pad1 = new TPad("pad1", "pad1", 0, 0.3, 1, 1.0); + pad2 = new TPad("pad2", "pad2", 0, 0.0, 1, 0.3); + + pad1->SetTopMargin (0.08); + pad1->SetBottomMargin(0.01); + pad1->Draw(); + + pad2->SetTopMargin (0.05); + pad2->SetBottomMargin(0.45); + pad2->Draw();// Set stat boxes + pad1->cd(); + + // Check Logy if (logy[i]) gPad->SetLogy(); - if (logx[i]) gPad->SetLogx(); + if (logx[i]) {gPad->SetLogx(); pad2->SetLogx();} // Set stat boxes @@ -501,7 +524,13 @@ void PlotNHistograms(const TString& pdfFile, gPad->SetFillColor(kBlue-10); } } - } // End loop + + pad2->cd(); + + TH1* ratioplot = PlotRatiosHistograms(rh, sh); + SetHistogramStyle(ratioplot, 21, 4); + ratioplot->Draw("ep"); + } // End loop // Draw Legend @@ -662,3 +691,47 @@ void NormalizeHistogramsAsDensity(TH1* h1, TH1* h2) { h2->Scale(scale2, "width"); } } +/////////////////////////////////////////////////////////// +// +// ratio plot from the two histograms +// +///////////////////////////////////////////////////////// + +TH1* PlotRatiosHistograms(TH1* h1, TH1* h2){ + + ++ratioCounter; + + Int_t nbinsx = h1->GetNbinsX(); + + Double_t xmin = h1->GetBinLowEdge(0); + Double_t xmax = h1->GetBinLowEdge(nbinsx+1); + + TH1F* h_ratio = new TH1F(Form("h_ratio_%d", ratioCounter), "", nbinsx, xmin, xmax); + + for (Int_t ibin=1; ibin<=nbinsx; ibin++) { + + Float_t h1Value = h1->GetBinContent(ibin); + Float_t h2Value = h2->GetBinContent(ibin); + + Float_t h1Error = h1->GetBinError(ibin); + Float_t h2Error = h2->GetBinError(ibin); + + Float_t ratioVal = 999; + Float_t ratioErr = 999; + + if (h2Value > 0) { + ratioVal = h1Value / h2Value; + ratioErr = h1Error / h2Value; + } + + h_ratio->SetBinContent(ibin, ratioVal); + h_ratio->SetBinError (ibin, ratioErr); + + } + + h_ratio->SetTitle(""); + h_ratio->GetYaxis()->SetTitle(""); + h_ratio->GetYaxis()->SetRangeUser(0.4, 1.6); + + return h_ratio; +} diff --git a/Validation/RecoMuon/test/macro/new_TrackValHistoPublisher.C b/Validation/RecoMuon/test/macro/new_TrackValHistoPublisher.C index aa8a7acea3279..5c0a43482dc55 100644 --- a/Validation/RecoMuon/test/macro/new_TrackValHistoPublisher.C +++ b/Validation/RecoMuon/test/macro/new_TrackValHistoPublisher.C @@ -563,7 +563,8 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi rcollname = "NEWprobeTrks_TkAsso"; scollname = "NEWprobeTrks"; } - const char* _refLabel("REF_LABEL, REF_RELEASE REFSELECTION quickTrackAssociatorByHits"); + + const char* _refLabel("NEW_LABEL, NEW_RELEASE NEWSELECTION quickTrackAssociatorByHits"); const char* _newLabel("NEW_LABEL, NEW_RELEASE NEWSELECTION MuonAssociatorByHits"); // efficiency and fake rate Vs eta and phi From 62fd4ddd1a3693014dea1f2d840fc587c1de2ec8 Mon Sep 17 00:00:00 2001 From: Antoni Shtipliyski Date: Fri, 6 Apr 2018 15:24:05 +0200 Subject: [PATCH 365/426] Remove check for empty sum collection in CALOL2-uGT comparison to avoid edge case false alarm where no calorimeters are included in run --- DQM/L1TMonitor/src/L1TStage2uGTCaloLayer2Comp.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/DQM/L1TMonitor/src/L1TStage2uGTCaloLayer2Comp.cc b/DQM/L1TMonitor/src/L1TStage2uGTCaloLayer2Comp.cc index aa23d0caff905..671d395cb4042 100644 --- a/DQM/L1TMonitor/src/L1TStage2uGTCaloLayer2Comp.cc +++ b/DQM/L1TMonitor/src/L1TStage2uGTCaloLayer2Comp.cc @@ -346,8 +346,7 @@ bool L1TStage2uGTCaloLayer2Comp::compareSums( // if either calol2 or ugt collections are empty, or they have different // size, mark the event as bad (this should never occur in normal running) - if (calol2Col->size() == 0 || uGTCol->size() == 0 || - (calol2Col->size() != uGTCol->size())) { + if ((calol2Col->size() != uGTCol->size())) { comparisonNum->Fill(EVENTBADSUMCOL); return false; } From 42277002b2f4a2b11fc2f6a3b098466a77eb8523 Mon Sep 17 00:00:00 2001 From: Antoni Shtipliyski Date: Fri, 6 Apr 2018 15:53:33 +0200 Subject: [PATCH 366/426] Update the comment in calol2-ugt comparison plot to agree with check --- DQM/L1TMonitor/src/L1TStage2uGTCaloLayer2Comp.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DQM/L1TMonitor/src/L1TStage2uGTCaloLayer2Comp.cc b/DQM/L1TMonitor/src/L1TStage2uGTCaloLayer2Comp.cc index 671d395cb4042..dd724804a6bef 100644 --- a/DQM/L1TMonitor/src/L1TStage2uGTCaloLayer2Comp.cc +++ b/DQM/L1TMonitor/src/L1TStage2uGTCaloLayer2Comp.cc @@ -344,8 +344,8 @@ bool L1TStage2uGTCaloLayer2Comp::compareSums( l1t::EtSumBxCollection::const_iterator calol2It = calol2Col->begin(); l1t::EtSumBxCollection::const_iterator uGTIt = uGTCol->begin(); - // if either calol2 or ugt collections are empty, or they have different - // size, mark the event as bad (this should never occur in normal running) + // if the calol2 or ugt collections have different size, mark the event as + // bad (this should never occur in normal running) if ((calol2Col->size() != uGTCol->size())) { comparisonNum->Fill(EVENTBADSUMCOL); return false; From e9def07d8a324b0c583ab5b0b9bc3746f1b23b27 Mon Sep 17 00:00:00 2001 From: Heiner Tholen Date: Fri, 6 Apr 2018 16:01:37 +0200 Subject: [PATCH 367/426] adding classes.h and classes_def.xml --- JetMETCorrections/Modules/src/classes.h | 7 +++++++ JetMETCorrections/Modules/src/classes_def.xml | 3 +++ 2 files changed, 10 insertions(+) create mode 100644 JetMETCorrections/Modules/src/classes.h create mode 100644 JetMETCorrections/Modules/src/classes_def.xml diff --git a/JetMETCorrections/Modules/src/classes.h b/JetMETCorrections/Modules/src/classes.h new file mode 100644 index 0000000000000..b9f5fea09ac96 --- /dev/null +++ b/JetMETCorrections/Modules/src/classes.h @@ -0,0 +1,7 @@ +#include "JetMETCorrections/Modules/interface/JetResolution.h" + +namespace JetMETCorrections_Modules { + struct dictionary { + JME::JetResolution jr; + }; +} diff --git a/JetMETCorrections/Modules/src/classes_def.xml b/JetMETCorrections/Modules/src/classes_def.xml new file mode 100644 index 0000000000000..8a6e9d21c4419 --- /dev/null +++ b/JetMETCorrections/Modules/src/classes_def.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file From bb87927fcf0fae7c3175448e13134d7926834350 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Fri, 6 Apr 2018 09:20:54 -0500 Subject: [PATCH 368/426] Avoid self assignments in SiStrip Key classes When testing for validity of the set values, the logic was changed to avoid doing self assignments. This avoids a clang compiler warning. The changes result in the exact same logic as the original code. --- .../SiStripCommon/src/SiStripDetKey.cc | 10 +-- .../SiStripCommon/src/SiStripFecKey.cc | 66 ++++++++----------- .../SiStripCommon/src/SiStripFedKey.cc | 18 ++--- 3 files changed, 35 insertions(+), 59 deletions(-) diff --git a/DataFormats/SiStripCommon/src/SiStripDetKey.cc b/DataFormats/SiStripCommon/src/SiStripDetKey.cc index 52e873b63e06b..f40ed86ff7516 100644 --- a/DataFormats/SiStripCommon/src/SiStripDetKey.cc +++ b/DataFormats/SiStripCommon/src/SiStripDetKey.cc @@ -206,13 +206,9 @@ bool SiStripDetKey::isInvalid( const sistrip::Granularity& gran ) const { void SiStripDetKey::initFromValue() { // partition - if ( partition_ >= 1 && //sistrip::PARTITION_MIN && - partition_ <= 4 ) { //sistrip::PARTITION_MAX ) { - partition_ = partition_; - } else if ( partition_ == 0 ) { - partition_ = 0; - } else { partition_ = sistrip::invalid_; } - + if(partition_ > 4) { + partition_ = sistrip::invalid_; + } } // ----------------------------------------------------------------------------- diff --git a/DataFormats/SiStripCommon/src/SiStripFecKey.cc b/DataFormats/SiStripCommon/src/SiStripFecKey.cc index b74927478a405..6ad8f9c720da3 100644 --- a/DataFormats/SiStripCommon/src/SiStripFecKey.cc +++ b/DataFormats/SiStripCommon/src/SiStripFecKey.cc @@ -346,64 +346,50 @@ bool SiStripFecKey::isInvalid( const sistrip::Granularity& gran ) const { void SiStripFecKey::initFromValue() { // FEC crate - if ( fecCrate_ >= sistrip::FEC_CRATE_MIN && - fecCrate_ <= sistrip::FEC_CRATE_MAX ) { - fecCrate_ = fecCrate_; - } else if ( fecCrate_ == 0 ) { - fecCrate_ = 0; - } else { fecCrate_ = sistrip::invalid_; } + if ( not ( (fecCrate_ >= sistrip::FEC_CRATE_MIN && + fecCrate_ <= sistrip::FEC_CRATE_MAX) || + (fecCrate_ == 0) ) ) { + fecCrate_ = sistrip::invalid_; } // FEC slot - if ( fecSlot_ >= sistrip::CRATE_SLOT_MIN && - fecSlot_ <= sistrip::CRATE_SLOT_MAX ) { - fecSlot_ = fecSlot_; - } else if ( fecSlot_ == 0 ) { - fecSlot_ = 0; - } else { fecSlot_ = sistrip::invalid_; } + if ( not ( (fecSlot_ >= sistrip::CRATE_SLOT_MIN && + fecSlot_ <= sistrip::CRATE_SLOT_MAX) || + ( fecSlot_ == 0 ) ) ) { + fecSlot_ = sistrip::invalid_; } // FEC ring - if ( fecRing_ >= sistrip::FEC_RING_MIN && - fecRing_ <= sistrip::FEC_RING_MAX ) { - fecRing_ = fecRing_; - } else if ( fecRing_ == 0 ) { - fecRing_ = 0; - } else { fecRing_ = sistrip::invalid_; } + if ( not ( (fecRing_ >= sistrip::FEC_RING_MIN && + fecRing_ <= sistrip::FEC_RING_MAX ) || + ( fecRing_ == 0 ) ) ) { + fecRing_ = sistrip::invalid_; } // CCU addr - if ( ccuAddr_ >= sistrip::CCU_ADDR_MIN && - ccuAddr_ <= sistrip::CCU_ADDR_MAX ) { - ccuAddr_ = ccuAddr_; - } else if ( ccuAddr_ == 0 ) { - ccuAddr_ = 0; - } else { ccuAddr_ = sistrip::invalid_; } + if ( not ( (ccuAddr_ >= sistrip::CCU_ADDR_MIN && + ccuAddr_ <= sistrip::CCU_ADDR_MAX ) || + ( ccuAddr_ == 0 ) ) ) { + ccuAddr_ = sistrip::invalid_; } // CCU chan - if ( ccuChan_ >= sistrip::CCU_CHAN_MIN && - ccuChan_ <= sistrip::CCU_CHAN_MAX ) { - ccuChan_ = ccuChan_; - } else if ( ccuChan_ == 0 ) { - ccuChan_ = 0; - } else { ccuChan_ = sistrip::invalid_; } + if ( not ( (ccuChan_ >= sistrip::CCU_CHAN_MIN && + ccuChan_ <= sistrip::CCU_CHAN_MAX ) || + ( ccuChan_ == 0 ) ) ) { + ccuChan_ = sistrip::invalid_; } // LLD channel - if ( lldChan_ >= sistrip::LLD_CHAN_MIN && - lldChan_ <= sistrip::LLD_CHAN_MAX ) { - lldChan_ = lldChan_; - } else if ( lldChan_ == 0 ) { - lldChan_ = 0; - } else { lldChan_ = sistrip::invalid_; } + if ( not ( (lldChan_ >= sistrip::LLD_CHAN_MIN && + lldChan_ <= sistrip::LLD_CHAN_MAX ) || + ( lldChan_ == 0 ) ) ) { + lldChan_ = sistrip::invalid_; } // APV I2C address if ( i2cAddr_ >= sistrip::APV_I2C_MIN && i2cAddr_ <= sistrip::APV_I2C_MAX ) { - i2cAddr_ = i2cAddr_; if ( lldChan_ && lldChan( i2cAddr_ ) != lldChan_ ) { i2cAddr_ = sistrip::invalid_; key( key() | (i2cAddrMask_<= sistrip::FED_ID_MIN && - fedId_ <= sistrip::FED_ID_MAX ) { - fedId_ = fedId_; - } else if ( fedId_ == 0 ) { - fedId_ = fedId_; - } else { + if ( not ( (fedId_ >= sistrip::FED_ID_MIN && + fedId_ <= sistrip::FED_ID_MAX ) || + ( fedId_ == 0 ) ) ) { fedId_ = sistrip::invalid_; } - if ( feUnit_ <= sistrip::FEUNITS_PER_FED ) { feUnit_ = feUnit_; } - else { feUnit_ = sistrip::invalid_; } + if ( feUnit_ > sistrip::FEUNITS_PER_FED ) { feUnit_ = sistrip::invalid_; } - if ( feChan_ <= sistrip::FEDCH_PER_FEUNIT ) { feChan_ = feChan_; } - else { feChan_ = sistrip::invalid_; } + if ( feChan_ > sistrip::FEDCH_PER_FEUNIT ) { feChan_ = sistrip::invalid_; } - if ( fedApv_ <= sistrip::APVS_PER_FEDCH ) { fedApv_ = fedApv_; } - else { fedApv_ = sistrip::invalid_; } + if ( fedApv_ > sistrip::APVS_PER_FEDCH ) { fedApv_ = sistrip::invalid_; } } From 8ec0847aabca97e5550802063d1dca7469a0e14c Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Fri, 6 Apr 2018 09:48:25 -0500 Subject: [PATCH 369/426] Minor cleanups to avoid clang warnings -Removed an unused parameter in a lambda -Switched a struct to be a class to be consistent with other headers -Delcared noexcept(false) to be consistent between header and source file --- FWCore/Framework/interface/ProducerBase.h | 2 +- FWCore/Framework/src/EventProcessor.cc | 2 +- FWCore/Framework/test/MockEventProcessor.cc | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/FWCore/Framework/interface/ProducerBase.h b/FWCore/Framework/interface/ProducerBase.h index 3896584ba3b36..865b2d4953080 100644 --- a/FWCore/Framework/interface/ProducerBase.h +++ b/FWCore/Framework/interface/ProducerBase.h @@ -60,7 +60,7 @@ namespace edm { public: typedef ProductRegistryHelper::TypeLabelList TypeLabelList; ProducerBase (); - ~ProducerBase() override; + ~ProducerBase() noexcept(false) override; /// used by the fwk to register list of products std::function registrationCallback() const; diff --git a/FWCore/Framework/src/EventProcessor.cc b/FWCore/Framework/src/EventProcessor.cc index 532d7e04c5520..838962e8eb01f 100644 --- a/FWCore/Framework/src/EventProcessor.cc +++ b/FWCore/Framework/src/EventProcessor.cc @@ -1118,7 +1118,7 @@ namespace edm { auto status= std::make_shared(this, preallocations_.numberOfStreams(), iRunResource) ; - auto lumiWork = [this, iHolder, iSync, status](edm::LimitedTaskQueue::Resumer iResumer) mutable { + auto lumiWork = [this, iHolder, status](edm::LimitedTaskQueue::Resumer iResumer) mutable { if(iHolder.taskHasFailed()) { return; } status->setResumer(std::move(iResumer)); diff --git a/FWCore/Framework/test/MockEventProcessor.cc b/FWCore/Framework/test/MockEventProcessor.cc index 6992bc04b6483..dc95cba24e619 100644 --- a/FWCore/Framework/test/MockEventProcessor.cc +++ b/FWCore/Framework/test/MockEventProcessor.cc @@ -30,7 +30,8 @@ namespace { } namespace edm { -struct LuminosityBlockPrincipal { +class LuminosityBlockPrincipal { +public: LuminosityBlockPrincipal(int iRun,int iLumi): run_(iRun),lumi_(iLumi){} int run_; int lumi_; From 292f7ac7cea4b2941db662094c5792720eea727a Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Fri, 6 Apr 2018 13:03:20 -0500 Subject: [PATCH 370/426] Add GlobalCache to DeepFlavourJetTagsProducer to improve startup performance igprof profiles showed this module was taking significant time at startup, most as it reads the configuration file used to initialize its neural network (lots of memory churn also). Without the GlobalCache the startup time is proportional to the number of streams. This change moves the LightweightNeuralNetwork into the global cache so there is only one and the initialization time is no longer proportional to the number of streams. LightweightNeuralNetwork is supposed to be thread safe to use in this manner. --- .../plugins/DeepFlavourJetTagsProducer.cc | 132 +++++++++++------- 1 file changed, 79 insertions(+), 53 deletions(-) diff --git a/RecoBTag/Combined/plugins/DeepFlavourJetTagsProducer.cc b/RecoBTag/Combined/plugins/DeepFlavourJetTagsProducer.cc index b89afb6e3d7bf..293250a79825e 100644 --- a/RecoBTag/Combined/plugins/DeepFlavourJetTagsProducer.cc +++ b/RecoBTag/Combined/plugins/DeepFlavourJetTagsProducer.cc @@ -54,19 +54,48 @@ using namespace reco; // class declaration // -class DeepFlavourJetTagsProducer : public edm::stream::EDProducer<> { +namespace { + +struct MVAVar { + std::string name; + reco::btau::TaggingVariableName id; + int index; + double default_value; +}; + +class NeuralNetworkAndConstants { +public: + + NeuralNetworkAndConstants(const edm::ParameterSet&); + + std::unique_ptr const& neural_network() const { return neural_network_; } + vector const& outputs() const { return outputs_; } + bool check_sv_for_defaults() const { return check_sv_for_defaults_; } + map const& toadd() const { return toadd_; } + vector const& variables() const { return variables_; } + +private: + + std::unique_ptr neural_network_; + vector outputs_; + bool check_sv_for_defaults_; + map toadd_; + vector variables_; +}; +} + +class DeepFlavourJetTagsProducer : public edm::stream::EDProducer> { public: - explicit DeepFlavourJetTagsProducer(const edm::ParameterSet&); + explicit DeepFlavourJetTagsProducer(const edm::ParameterSet&, NeuralNetworkAndConstants const*); ~DeepFlavourJetTagsProducer() override; static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - struct MVAVar { - std::string name; - reco::btau::TaggingVariableName id; - int index; - double default_value; - }; + static std::unique_ptr initializeGlobalCache(const edm::ParameterSet& iConfig) { + return std::make_unique(iConfig); + } + + static void globalEndJob(NeuralNetworkAndConstants*) { } private: typedef std::vector INFOS; @@ -76,14 +105,7 @@ class DeepFlavourJetTagsProducer : public edm::stream::EDProducer<> { // ----------member data --------------------------- const edm::EDGetTokenT< INFOS > src_; - edm::FileInPath nnconfig_; - bool check_sv_for_defaults_; - bool mean_padding_; - lwt::LightweightNeuralNetwork *neural_network_; lwt::ValueMap inputs_; //typedef of unordered_map - vector outputs_; - vector variables_; - map toadd_; }; // @@ -98,29 +120,27 @@ class DeepFlavourJetTagsProducer : public edm::stream::EDProducer<> { // // constructors and destructor // -DeepFlavourJetTagsProducer::DeepFlavourJetTagsProducer(const edm::ParameterSet& iConfig) : - src_( consumes< INFOS >(iConfig.getParameter("src")) ), - nnconfig_(iConfig.getParameter("NNConfig")), - check_sv_for_defaults_(iConfig.getParameter("checkSVForDefaults")), - mean_padding_(iConfig.getParameter("meanPadding")), - neural_network_(nullptr), - inputs_(), - outputs_(), - variables_() + +NeuralNetworkAndConstants::NeuralNetworkAndConstants(const edm::ParameterSet& iConfig) : + check_sv_for_defaults_(iConfig.getParameter("checkSVForDefaults")) { + bool mean_padding = iConfig.getParameter("meanPadding"); + //parse json - ifstream jsonfile(nnconfig_.fullPath()); + edm::FileInPath nnconfig = iConfig.getParameter("NNConfig"); + ifstream jsonfile(nnconfig.fullPath()); auto config = lwt::parse_json(jsonfile); //create NN and store the output names for the future - neural_network_ = new lwt::LightweightNeuralNetwork(config.inputs, config.layers, config.outputs); + neural_network_ = std::make_unique(config.inputs, config.layers, config.outputs); + outputs_ = config.outputs; set outset(outputs_.begin(), outputs_.end()); //in case we want to merge some different outputs together - edm::ParameterSet toadd = iConfig.getParameter("toAdd"); - for(auto output : toadd.getParameterNamesForType()) { - string target = toadd.getParameter(output); + edm::ParameterSet toaddPSet = iConfig.getParameter("toAdd"); + for(auto const& output : toaddPSet.getParameterNamesForType()) { + string target = toaddPSet.getParameter(output); if(outset.find(output) == outset.end()) throw cms::Exception("RuntimeError") << "The required output: " << output << " to be added to " << target << " could not be found among the NN outputs" << endl; if(outset.find(target) == outset.end()) @@ -128,16 +148,8 @@ DeepFlavourJetTagsProducer::DeepFlavourJetTagsProducer(const edm::ParameterSet& toadd_[output] = target; } - //produce one output kind per node - for(auto outnode : config.outputs) { - if(toadd_.find(outnode) == toadd_.end()){ //produce output only if does not get added - produces(outnode); - } - } - - //get the set-up for the inputs - for(auto& input : config.inputs) { + for(auto const& input : config.inputs) { MVAVar var; var.name = input.name; //two paradigms @@ -151,21 +163,31 @@ DeepFlavourJetTagsProducer::DeepFlavourJetTagsProducer(const edm::ParameterSet& //die grafully if the tagging variable is not found! if(var.id == reco::btau::lastTaggingVariable) { throw cms::Exception("ValueError") << "I could not find the TaggingVariable named " << tokens.at(0) - << " from the NN input variable: " << input.name - << ". Please check the spelling" << std::endl; + << " from the NN input variable: " << input.name + << ". Please check the spelling" << std::endl; } var.index = (tokens.size() == 2) ? stoi(tokens.at(1)) : -1; - var.default_value = (mean_padding_) ? 0. : -1*input.offset; //set default to -offset so that when scaling (val+offset)*scale the outcome is 0 + var.default_value = (mean_padding) ? 0. : -1*input.offset; //set default to -offset so that when scaling (val+offset)*scale the outcome is 0 //for mean padding it is set to zero so that undefined values are assigned -mean/scale variables_.push_back(var); } } +DeepFlavourJetTagsProducer::DeepFlavourJetTagsProducer(const edm::ParameterSet& iConfig, NeuralNetworkAndConstants const* gc) : + src_( consumes< INFOS >(iConfig.getParameter("src")) ), + inputs_() +{ + //produce one output kind per node + for(auto const& outnode : gc->outputs()) { + if(gc->toadd().find(outnode) == gc->toadd().end()){ //produce output only if does not get added + produces(outnode); + } + } +} DeepFlavourJetTagsProducer::~DeepFlavourJetTagsProducer() { - delete neural_network_; } @@ -177,6 +199,10 @@ DeepFlavourJetTagsProducer::~DeepFlavourJetTagsProducer() void DeepFlavourJetTagsProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + NeuralNetworkAndConstants const* gc = globalCache(); + vector const& outputs = gc->outputs(); + map const& toadd = gc->toadd(); + // get input TagInfos edm::Handle taginfos; iEvent.getByToken(src_, taginfos); @@ -184,8 +210,8 @@ DeepFlavourJetTagsProducer::produce(edm::Event& iEvent, const edm::EventSetup& i // create the output collection // which is a "map" RefToBase --> float vector< std::unique_ptr > output_tags; - output_tags.reserve(outputs_.size()); - for(size_t i=0; iempty()) { edm::RefToBase jj = taginfos->begin()->jet(); output_tags.push_back( @@ -207,11 +233,11 @@ DeepFlavourJetTagsProducer::produce(edm::Event& iEvent, const edm::EventSetup& i //if there are no tracks there's no point in doing it bool notracks = (vars.get(reco::btau::jetNSelectedTracks) == 0); bool novtx = (vars.get(reco::btau::jetNSecondaryVertices) == 0); - bool defaulted = (check_sv_for_defaults_) ? (notracks && novtx) : notracks; + bool defaulted = (gc->check_sv_for_defaults()) ? (notracks && novtx) : notracks; lwt::ValueMap nnout; //returned value if(!defaulted) { - for(auto& var : variables_) { + for(auto const& var : gc->variables()) { if(var.index >= 0){ std::vector vals = vars.getList(var.id, false); inputs_[var.name] = (((int) vals.size()) > var.index) ? vals.at(var.index) : var.default_value; @@ -223,10 +249,10 @@ DeepFlavourJetTagsProducer::produce(edm::Event& iEvent, const edm::EventSetup& i } //compute NN output(s) - nnout = neural_network_->compute(inputs_); + nnout = gc->neural_network()->compute(inputs_); //merge outputs - for(auto entry : toadd_) { + for(auto const& entry : toadd) { nnout[entry.second] += nnout[entry.first]; } } @@ -235,15 +261,15 @@ DeepFlavourJetTagsProducer::produce(edm::Event& iEvent, const edm::EventSetup& i edm::RefToBase key = info.jet(); //dump the NN output(s) - for(size_t i=0; i Date: Fri, 6 Apr 2018 14:35:14 -0500 Subject: [PATCH 371/426] Added Sleeping Modules Created a series of Modules which call usleep in order to allow scale testing without consuming the entire system. --- FWCore/Modules/src/TimeStudyModules.cc | 374 +++++++++++++++++++++ FWCore/Modules/test/FWCoreModulesTest.sh | 2 + FWCore/Modules/test/sleepingModules_cfg.py | 67 ++++ 3 files changed, 443 insertions(+) create mode 100644 FWCore/Modules/src/TimeStudyModules.cc create mode 100644 FWCore/Modules/test/sleepingModules_cfg.py diff --git a/FWCore/Modules/src/TimeStudyModules.cc b/FWCore/Modules/src/TimeStudyModules.cc new file mode 100644 index 0000000000000..8b6a32544b934 --- /dev/null +++ b/FWCore/Modules/src/TimeStudyModules.cc @@ -0,0 +1,374 @@ +// -*- C++ -*- +// +// Package: FWCore/Modules +// Class : TimeStudyModules +// +// Implementation: +// [Notes on implementation] +// +// Original Author: Chris Jones +// Created: Thu, 22 Mar 2018 16:23:48 GMT +// + +// system include files +#include +#include +#include +#include +#include +#include + +// user include files +#include "FWCore/Framework/interface/global/EDProducer.h" +#include "FWCore/Framework/interface/one/EDProducer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/Utilities/interface/EDGetToken.h" +#include "FWCore/Utilities/interface/InputTag.h" + +#include "FWCore/ServiceRegistry/interface/SystemBounds.h" + +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ServiceRegistry/interface/ServiceMaker.h" +#include "FWCore/ServiceRegistry/interface/Service.h" + + +namespace timestudy { + namespace { + struct Sleeper { + Sleeper(edm::ParameterSet const& p, edm::ConsumesCollector&& iCol ) { + auto const& cv = p.getParameter>("consumes"); + tokens_.reserve(cv.size()); + for(auto const& c: cv) { + tokens_.emplace_back( iCol.consumes(c)); + } + + auto const& tv = p.getParameter>("eventTimes"); + eventTimes_.reserve(tv.size()); + for(auto t: tv) { + eventTimes_.push_back( static_cast(t*1E6)); + } + } + + void + getAndSleep(edm::Event const& e) const { + edm::Handle h; + for(auto const&t: tokens_) { + e.getByToken(t,h); + } + //Event number minimum value is 1 + usleep( eventTimes_[ (e.id().event()-1) % eventTimes_.size()]); + } + + static void fillDescription(edm::ParameterSetDescription& desc) { + desc.add>("consumes", {})->setComment("What event int data products to consume"); + desc.add>("eventTimes")->setComment("The time, in seconds, for how long the module should sleep each event. The index to use is based on a modulo of size of the list applied to the Event ID number."); + } + + private: + std::vector> tokens_; + std::vector eventTimes_; + + }; + } +//-------------------------------------------------------------------- +// +// Produces an IntProduct instance. +// +class SleepingProducer : public edm::global::EDProducer<> { +public: + explicit SleepingProducer(edm::ParameterSet const& p) : + value_(p.getParameter("ivalue")), + sleeper_(p, consumesCollector()) + { + produces(); + } + void produce(edm::StreamID, edm::Event& e, edm::EventSetup const& c) const override; + + static void fillDescriptions(edm::ConfigurationDescriptions & descriptions); + +private: + int value_; + Sleeper sleeper_; +}; + +void +SleepingProducer::produce(edm::StreamID, edm::Event& e, edm::EventSetup const&) const { + // EventSetup is not used. + sleeper_.getAndSleep(e); + + e.put(std::make_unique(value_)); +} + +void +SleepingProducer::fillDescriptions(edm::ConfigurationDescriptions & descriptions) { + edm::ParameterSetDescription desc; + + desc.add("ivalue")->setComment("Value to put into Event"); + Sleeper::fillDescription(desc); + + descriptions.addDefault(desc); +} + + class OneSleepingProducer : public edm::one::EDProducer { + public: + explicit OneSleepingProducer(edm::ParameterSet const& p) : + value_(p.getParameter("ivalue")), + sleeper_(p, consumesCollector()) + { + produces(); + usesResource(p.getParameter("resource")); + } + void produce( edm::Event& e, edm::EventSetup const& c) override; + + static void fillDescriptions(edm::ConfigurationDescriptions & descriptions); + + private: + int value_; + Sleeper sleeper_; + }; + + void + OneSleepingProducer::produce(edm::Event& e, edm::EventSetup const&) { + // EventSetup is not used. + sleeper_.getAndSleep(e); + + e.put(std::make_unique(value_)); + } + + void + OneSleepingProducer::fillDescriptions(edm::ConfigurationDescriptions & descriptions) { + edm::ParameterSetDescription desc; + + desc.add("ivalue")->setComment("Value to put into Event"); + desc.add("resource",std::string())->setComment("The name of the resource that is being shared"); + Sleeper::fillDescription(desc); + + descriptions.addDefault(desc); + } + + class OneSleepingAnalyzer : public edm::one::EDAnalyzer<> { + public: + explicit OneSleepingAnalyzer(edm::ParameterSet const& p) : + sleeper_(p, consumesCollector()) + { + } + void analyze( edm::Event const& e, edm::EventSetup const& c) override; + + static void fillDescriptions(edm::ConfigurationDescriptions & descriptions); + + private: + int value_; + Sleeper sleeper_; + }; + + void + OneSleepingAnalyzer::analyze(edm::Event const& e, edm::EventSetup const&) { + // EventSetup is not used. + sleeper_.getAndSleep(e); + } + + void + OneSleepingAnalyzer::fillDescriptions(edm::ConfigurationDescriptions & descriptions) { + edm::ParameterSetDescription desc; + + Sleeper::fillDescription(desc); + + descriptions.addDefault(desc); + } + + /* + The SleepingServer is configured to wait to accumulate X events before starting to run. + On a call to asyncWork + -the data will be added to the streams' slot then the waiting thread will be informed + -if the server is waiting on threads + - it wakes up and sleeps for 'initTime' + - it then checks to see if another event was pushed and if it does it continues to do the sleep loop + - once all sleep are done, it checks to see if enough events have contacted it and if so it sleeps for the longest 'workTime' duration given + - when done, it sleeps for each event 'finishTime' and when it wakes it sends the callback + - when all calledback, it goes back to check if there are waiting events + - if there are not enough waiting events, it goes back to waiting on a condition variable + + The SleepingServer keeps track of the number of active Streams by counting the number of streamBeginLumi and streamEndLumi calls have taken place. If there are insufficient active Lumis compared to the number of events it wants to wait for, the Server thread is told to start processing without further waiting. + + */ + class SleepingServer { + public: + SleepingServer(edm::ParameterSet const& iPS, edm::ActivityRegistry& iAR): + nWaitingEvents_(iPS.getUntrackedParameter("nWaitingEvents")) + { + iAR.watchPreallocate([this](edm::service::SystemBounds const& iBounds) { + auto const nStreams =iBounds.maxNumberOfStreams(); + waitingStreams_.reserve(nStreams); + waitTimesPerStream_.resize(nStreams); + waitingTaskPerStream_.resize(nStreams); + }); + + iAR.watchPreEndJob([this]() { + stopProcessing_ = true; + condition_.notify_one(); + serverThread_->join(); + }); + iAR.watchPreStreamBeginLumi([this](edm::StreamContext const&) { + ++activeStreams_; + }); + iAR.watchPreStreamEndLumi([this](edm::StreamContext const&) { + --activeStreams_; + condition_.notify_one(); + }); + + serverThread_ = std::make_unique([this]() { threadWork(); } ); + } + + void asyncWork(edm::StreamID id, edm::WaitingTaskWithArenaHolder iTask, long initTime, long workTime, long finishTime) { + waitTimesPerStream_[id.value()]={{initTime,workTime,finishTime}}; + waitingTaskPerStream_[id.value()]=std::move(iTask); + { + std::lock_guard lk{mutex_}; + waitingStreams_.push_back(id.value()); + } + condition_.notify_one(); + } + + private: + bool readyToDoSomething() { + if(stopProcessing_) { + return true; + } + if(waitingStreams_.size() >= nWaitingEvents_) { + return true; + } + //every running stream is now waiting + return waitingStreams_.size() == activeStreams_; + } + + void threadWork() { + while(not stopProcessing_.load()) { + std::vector streamsToProcess; + { + std::unique_lock lk(mutex_); + condition_.wait(lk, [this]() { + return readyToDoSomething(); + }); + swap(streamsToProcess,waitingStreams_); + } + if(stopProcessing_) { + break; + } + long longestTime = 0; + //simulate filling the external device + for(auto i: streamsToProcess) { + auto const& v=waitTimesPerStream_[i]; + if(v[1]>longestTime) { + longestTime = v[1]; + } + usleep(v[0]); + } + //simulate running external device + usleep(longestTime); + + //simulate copying data back + for(auto i: streamsToProcess) { + auto const& v=waitTimesPerStream_[i]; + usleep(v[2]); + waitingTaskPerStream_[i].doneWaiting(std::exception_ptr()); + } + } + waitingTaskPerStream_.clear(); + } + const unsigned int nWaitingEvents_; + std::unique_ptr serverThread_; + std::vector waitingStreams_; + std::vector> waitTimesPerStream_; + std::vector waitingTaskPerStream_; + std::mutex mutex_; + std::condition_variable condition_; + std::atomic activeStreams_{0}; + std::atomic stopProcessing_{false}; + }; + + class ExternalWorkSleepingProducer : public edm::global::EDProducer { + public: + explicit ExternalWorkSleepingProducer(edm::ParameterSet const& p) : + value_(p.getParameter("ivalue")), + sleeper_(p, consumesCollector()) + { + { + auto const& tv = p.getParameter>("serviceInitTimes"); + initTimes_.reserve(tv.size()); + for(auto t: tv) { + initTimes_.push_back( static_cast(t*1E6)); + } + } + { + auto const& tv = p.getParameter>("serviceWorkTimes"); + workTimes_.reserve(tv.size()); + for(auto t: tv) { + workTimes_.push_back( static_cast(t*1E6)); + } + } + { + auto const& tv = p.getParameter>("serviceFinishTimes"); + finishTimes_.reserve(tv.size()); + for(auto t: tv) { + finishTimes_.push_back( static_cast(t*1E6)); + } + } + assert(finishTimes_.size() == initTimes_.size()); + assert(workTimes_.size() == initTimes_.size()); + + produces(); + } + void acquire(edm::StreamID, edm::Event const & e, edm::EventSetup const& c, edm::WaitingTaskWithArenaHolder holder) const override; + + void produce(edm::StreamID, edm::Event& e, edm::EventSetup const& c) const override; + + static void fillDescriptions(edm::ConfigurationDescriptions & descriptions); + + private: + std::vector initTimes_; + std::vector workTimes_; + std::vector finishTimes_; + int value_; + Sleeper sleeper_; + }; + + void + ExternalWorkSleepingProducer::acquire(edm::StreamID id, edm::Event const& e, edm::EventSetup const&, edm::WaitingTaskWithArenaHolder holder) const { + // EventSetup is not used. + sleeper_.getAndSleep(e); + edm::Service server; + auto index = (e.id().event()-1) % initTimes_.size(); + server->asyncWork(id, std::move(holder), initTimes_[index], workTimes_[index], finishTimes_[index]); + } + + void + ExternalWorkSleepingProducer::produce(edm::StreamID, edm::Event& e, edm::EventSetup const&) const { + e.put(std::make_unique(value_)); + } + + void + ExternalWorkSleepingProducer::fillDescriptions(edm::ConfigurationDescriptions & descriptions) { + edm::ParameterSetDescription desc; + + desc.add("ivalue")->setComment("Value to put into Event"); + desc.add>("serviceInitTimes"); + desc.add>("serviceWorkTimes"); + desc.add>("serviceFinishTimes"); + Sleeper::fillDescription(desc); + + descriptions.addDefault(desc); + } + +} +DEFINE_FWK_SERVICE(timestudy::SleepingServer); +DEFINE_FWK_MODULE(timestudy::SleepingProducer); +DEFINE_FWK_MODULE(timestudy::OneSleepingProducer); +DEFINE_FWK_MODULE(timestudy::ExternalWorkSleepingProducer); +DEFINE_FWK_MODULE(timestudy::OneSleepingAnalyzer); + diff --git a/FWCore/Modules/test/FWCoreModulesTest.sh b/FWCore/Modules/test/FWCoreModulesTest.sh index 6b1ac1515e6b4..606e4a4fa1106 100755 --- a/FWCore/Modules/test/FWCoreModulesTest.sh +++ b/FWCore/Modules/test/FWCoreModulesTest.sh @@ -14,5 +14,7 @@ echo checkcacheidentifier cmsRun ${LOCAL_TEST_DIR}/checkcacheidentifier_cfg.py || die 'failed running cmsRun checkcacheidentifier_cfg.py' $? echo testPathStatusFilter cmsRun ${LOCAL_TEST_DIR}/testPathStatusFilter_cfg.py || die 'failed running cmsRun testPathStatusFilter_cfg.py' $? +echo sleepingModules +cmsRun ${LOCAL_TEST_DIR}/sleepingModules_cfg.py || die 'failed running cmsRun sleepingModules_cfg.py' $? popd diff --git a/FWCore/Modules/test/sleepingModules_cfg.py b/FWCore/Modules/test/sleepingModules_cfg.py new file mode 100644 index 0000000000000..e76e6f67df11e --- /dev/null +++ b/FWCore/Modules/test/sleepingModules_cfg.py @@ -0,0 +1,67 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("Test") + +process.source =cms.Source("EmptySource") + +process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(10)) + +process.options = cms.untracked.PSet(numberOfThreads = cms.untracked.uint32(4), + numberOfStreams = cms.untracked.uint32(0)) + +#allows something like simulation of source +process.s1 = cms.EDProducer("timestudy::OneSleepingProducer", + resource = cms.string("source"), + ivalue = cms.int32(1), + consumes = cms.VInputTag(), + eventTimes = cms.vdouble(0.01,0.005)) + +process.s2 = cms.EDProducer("timestudy::OneSleepingProducer", + resource = cms.string("source"), + ivalue = cms.int32(2), + consumes = cms.VInputTag(), + eventTimes = cms.vdouble(0.02,0.03)) + +process.p1 = cms.EDProducer("timestudy::SleepingProducer", + ivalue = cms.int32(3), + consumes = cms.VInputTag("s1","s2"), + eventTimes = cms.vdouble(0.05)) + + +process.p2 = cms.EDProducer("timestudy::SleepingProducer", + ivalue = cms.int32(3), + consumes = cms.VInputTag("s2"), + eventTimes = cms.vdouble(0.03)) + +process.p3 = cms.EDProducer("timestudy::SleepingProducer", + ivalue = cms.int32(3), + consumes = cms.VInputTag("p1","p2"), + eventTimes = cms.vdouble(0.03)) + +#external work +process.add_(cms.Service("timestudy::SleepingServer", + nWaitingEvents = cms.untracked.uint32(4))) + +process.e = cms.EDProducer("timestudy::ExternalWorkSleepingProducer", + consumes = cms.VInputTag("p2","p3"), + ivalue = cms.int32(10), + eventTimes = cms.vdouble(0.01), + serviceInitTimes = cms.vdouble(0.,0.), + serviceWorkTimes = cms.vdouble(0.1,0.15), + serviceFinishTimes = cms.vdouble(0.,0.) +) + +#approximates an OutputModule +process.out = cms.EDAnalyzer("timestudy::OneSleepingAnalyzer", + consumes = cms.VInputTag("s1","s2", "p1", "p2", "p3","e"), + eventTimes = cms.vdouble(0.02,0.03) +) + + +process.o = cms.EndPath(process.out, cms.Task(process.s1,process.s2,process.p1,process.p2,process.p3,process.e)) + +#process.add_(cms.Service("Tracer")) + +#process.add_(cms.Service("StallMonitor", fileName = cms.untracked.string("stall_sleep.log"))) + +process.add_(cms.Service("ZombieKillerService", secondsBetweenChecks = cms.untracked.uint32(10))) \ No newline at end of file From 611e1552ef34a58a1b29ee3efb5d165066a2c2bf Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Fri, 6 Apr 2018 14:36:59 -0500 Subject: [PATCH 372/426] Find proper number of streams in stallMonitor log If no module uses the global begin run transition then the script was unable to find the number of streams. Now the script also looks at the source transitions to find the number of streams. --- FWCore/Concurrency/scripts/edmStreamStallGrapher.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/FWCore/Concurrency/scripts/edmStreamStallGrapher.py b/FWCore/Concurrency/scripts/edmStreamStallGrapher.py index a370c88ceefb2..23f10658813d0 100755 --- a/FWCore/Concurrency/scripts/edmStreamStallGrapher.py +++ b/FWCore/Concurrency/scripts/edmStreamStallGrapher.py @@ -137,6 +137,7 @@ def processingStepsFromStallMonitorOutput(f,moduleNames): class StallMonitorParser(object): def __init__(self,f): numStreams = 0 + numStreamsFromSource = 0 moduleNames = {} for rawl in f: l = rawl.strip() @@ -146,11 +147,17 @@ def __init__(self,f): #found global begin run numStreams = int(i[1])+1 break + if numStreams == 0 and l and l[0] == 'S': + s = int(l.split(' ')[1]) + if s > numStreamsFromSource: + numStreamsFromSource = s if len(l) > 5 and l[0:2] == "#M": (id,name)=tuple(l[2:].split()) moduleNames[id] = name continue self._f = f + if numStreams == 0: + numStreams = numStreamsFromSource +1 self.numStreams =numStreams self._moduleNames = moduleNames self.maxNameSize =0 From 41d293d0a5cf01019d91e2a0941b703dbdc4085a Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Fri, 6 Apr 2018 22:46:37 +0200 Subject: [PATCH 373/426] PhysicsTools/KinFitter: Use ClassDefOverride macro instead os ClassDef macro so that override keyword is used where needed. --- PhysicsTools/KinFitter/interface/TFitConstraintEp.h | 2 +- PhysicsTools/KinFitter/interface/TFitConstraintM.h | 2 +- PhysicsTools/KinFitter/interface/TFitConstraintMGaus.h | 2 +- PhysicsTools/KinFitter/interface/TFitParticleCart.h | 2 +- PhysicsTools/KinFitter/interface/TKinFitter.h | 2 +- PhysicsTools/KinFitter/interface/TSLToyGen.h | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/PhysicsTools/KinFitter/interface/TFitConstraintEp.h b/PhysicsTools/KinFitter/interface/TFitConstraintEp.h index 4807fc30be07e..9884982c99772 100644 --- a/PhysicsTools/KinFitter/interface/TFitConstraintEp.h +++ b/PhysicsTools/KinFitter/interface/TFitConstraintEp.h @@ -56,7 +56,7 @@ protected : Double_t _constraint; // Value of constraint TFitConstraintEp::component _component; // 4vector component to be constrained - ClassDef(TFitConstraintEp, 0) + ClassDefOverride(TFitConstraintEp, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitConstraintM.h b/PhysicsTools/KinFitter/interface/TFitConstraintM.h index 14deb068e2757..f5775dad47656 100644 --- a/PhysicsTools/KinFitter/interface/TFitConstraintM.h +++ b/PhysicsTools/KinFitter/interface/TFitConstraintM.h @@ -53,7 +53,7 @@ protected : private : - ClassDef(TFitConstraintM, 0) + ClassDefOverride(TFitConstraintM, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitConstraintMGaus.h b/PhysicsTools/KinFitter/interface/TFitConstraintMGaus.h index fb671da05296c..3fbe516498a9c 100644 --- a/PhysicsTools/KinFitter/interface/TFitConstraintMGaus.h +++ b/PhysicsTools/KinFitter/interface/TFitConstraintMGaus.h @@ -39,7 +39,7 @@ protected : private : - ClassDef(TFitConstraintMGaus, 0) + ClassDefOverride(TFitConstraintMGaus, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitParticleCart.h b/PhysicsTools/KinFitter/interface/TFitParticleCart.h index ec8876a25598c..d2a215631fd67 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleCart.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleCart.h @@ -35,7 +35,7 @@ protected : private: - ClassDef(TFitParticleCart, 0) + ClassDefOverride(TFitParticleCart, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TKinFitter.h b/PhysicsTools/KinFitter/interface/TKinFitter.h index fc13925ea32e6..445c976ec4f02 100644 --- a/PhysicsTools/KinFitter/interface/TKinFitter.h +++ b/PhysicsTools/KinFitter/interface/TKinFitter.h @@ -148,7 +148,7 @@ private : Int_t _status; // Status of the last fit;_ Int_t _nbIter; // number of iteration performed in the fit - ClassDef(TKinFitter, 0) + ClassDefOverride(TKinFitter, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TSLToyGen.h b/PhysicsTools/KinFitter/interface/TSLToyGen.h index 8b2f290ca2d07..e365d41ba3939 100644 --- a/PhysicsTools/KinFitter/interface/TSLToyGen.h +++ b/PhysicsTools/KinFitter/interface/TSLToyGen.h @@ -92,7 +92,7 @@ private : Bool_t _withMPDGCons; Bool_t _doCheckConstraintsTruth; - ClassDef(TSLToyGen, 0) + ClassDefOverride(TSLToyGen, 0) }; #endif From 780ab864299e23876144967a580385cb38b320f0 Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Fri, 6 Apr 2018 22:58:55 +0200 Subject: [PATCH 374/426] Change all other occurances of ClassDef to ClassDefOverride to be safe. --- PhysicsTools/KinFitter/interface/TFitParticleECart.h | 2 +- PhysicsTools/KinFitter/interface/TFitParticleEMomDev.h | 2 +- PhysicsTools/KinFitter/interface/TFitParticleEScaledMomDev.h | 2 +- PhysicsTools/KinFitter/interface/TFitParticleESpher.h | 2 +- PhysicsTools/KinFitter/interface/TFitParticleEtEtaPhi.h | 2 +- PhysicsTools/KinFitter/interface/TFitParticleEtThetaPhi.h | 2 +- PhysicsTools/KinFitter/interface/TFitParticleMCCart.h | 2 +- PhysicsTools/KinFitter/interface/TFitParticleMCMomDev.h | 2 +- PhysicsTools/KinFitter/interface/TFitParticleMCPInvSpher.h | 2 +- PhysicsTools/KinFitter/interface/TFitParticleMCSpher.h | 2 +- PhysicsTools/KinFitter/interface/TFitParticleMomDev.h | 2 +- PhysicsTools/KinFitter/interface/TFitParticleSpher.h | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/PhysicsTools/KinFitter/interface/TFitParticleECart.h b/PhysicsTools/KinFitter/interface/TFitParticleECart.h index 1c6d29a849132..a15846a51a75b 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleECart.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleECart.h @@ -35,7 +35,7 @@ protected : private: - ClassDef(TFitParticleECart, 0) + ClassDefOverride(TFitParticleECart, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitParticleEMomDev.h b/PhysicsTools/KinFitter/interface/TFitParticleEMomDev.h index f81c4f59b258e..df087754c51d7 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleEMomDev.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleEMomDev.h @@ -37,7 +37,7 @@ protected : private: - ClassDef(TFitParticleEMomDev, 0) + ClassDefOverride(TFitParticleEMomDev, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitParticleEScaledMomDev.h b/PhysicsTools/KinFitter/interface/TFitParticleEScaledMomDev.h index f9bf19d69be25..416952df37c7c 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleEScaledMomDev.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleEScaledMomDev.h @@ -32,7 +32,7 @@ protected : private : - ClassDef(TFitParticleEScaledMomDev, 0) + ClassDefOverride(TFitParticleEScaledMomDev, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitParticleESpher.h b/PhysicsTools/KinFitter/interface/TFitParticleESpher.h index e4ebfc814aee3..8e44c7b2519bc 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleESpher.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleESpher.h @@ -35,7 +35,7 @@ protected : private: - ClassDef(TFitParticleESpher, 0) + ClassDefOverride(TFitParticleESpher, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitParticleEtEtaPhi.h b/PhysicsTools/KinFitter/interface/TFitParticleEtEtaPhi.h index 1f5f6127749f2..844b05a32d816 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleEtEtaPhi.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleEtEtaPhi.h @@ -35,7 +35,7 @@ protected : private: - ClassDef(TFitParticleEtEtaPhi, 0) + ClassDefOverride(TFitParticleEtEtaPhi, 0) }; diff --git a/PhysicsTools/KinFitter/interface/TFitParticleEtThetaPhi.h b/PhysicsTools/KinFitter/interface/TFitParticleEtThetaPhi.h index aedb5713de333..b7db328ab5482 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleEtThetaPhi.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleEtThetaPhi.h @@ -35,7 +35,7 @@ protected : private: - ClassDef(TFitParticleEtThetaPhi, 0) + ClassDefOverride(TFitParticleEtThetaPhi, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitParticleMCCart.h b/PhysicsTools/KinFitter/interface/TFitParticleMCCart.h index dcba36e7def52..735534feb144b 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleMCCart.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleMCCart.h @@ -34,7 +34,7 @@ protected : private: - ClassDef(TFitParticleMCCart, 0) + ClassDefOverride(TFitParticleMCCart, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitParticleMCMomDev.h b/PhysicsTools/KinFitter/interface/TFitParticleMCMomDev.h index 5331849e3b9d1..e58403ffc9f26 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleMCMomDev.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleMCMomDev.h @@ -35,7 +35,7 @@ protected : private: - ClassDef(TFitParticleMCMomDev, 0) + ClassDefOverride(TFitParticleMCMomDev, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitParticleMCPInvSpher.h b/PhysicsTools/KinFitter/interface/TFitParticleMCPInvSpher.h index c28832f79789a..a3430e34df3c0 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleMCPInvSpher.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleMCPInvSpher.h @@ -34,7 +34,7 @@ protected : private: - ClassDef(TFitParticleMCPInvSpher, 0) + ClassDefOverride(TFitParticleMCPInvSpher, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitParticleMCSpher.h b/PhysicsTools/KinFitter/interface/TFitParticleMCSpher.h index 52be1e2e823a7..3298a4fef0855 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleMCSpher.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleMCSpher.h @@ -34,7 +34,7 @@ protected : private: - ClassDef(TFitParticleMCSpher, 0) + ClassDefOverride(TFitParticleMCSpher, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitParticleMomDev.h b/PhysicsTools/KinFitter/interface/TFitParticleMomDev.h index 09e04a86fe3db..61c5c37b405f8 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleMomDev.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleMomDev.h @@ -37,7 +37,7 @@ protected : private: - ClassDef(TFitParticleMomDev, 0) + ClassDefOverride(TFitParticleMomDev, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitParticleSpher.h b/PhysicsTools/KinFitter/interface/TFitParticleSpher.h index b6ccf1f5f06fd..740240d139f75 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleSpher.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleSpher.h @@ -35,7 +35,7 @@ protected : private: - ClassDef(TFitParticleSpher, 0) + ClassDefOverride(TFitParticleSpher, 0) }; #endif From f7f8703aec6d13c6e0054de1df59a18d8c408df3 Mon Sep 17 00:00:00 2001 From: vladimir Date: Sat, 7 Apr 2018 01:00:37 +0200 Subject: [PATCH 375/426] protect against RP ID corruption --- DQM/CTPPS/plugins/CTPPSPixelDQMSource.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/DQM/CTPPS/plugins/CTPPSPixelDQMSource.cc b/DQM/CTPPS/plugins/CTPPSPixelDQMSource.cc index aeb4702f59555..c3904d839f203 100644 --- a/DQM/CTPPS/plugins/CTPPSPixelDQMSource.cc +++ b/DQM/CTPPS/plugins/CTPPSPixelDQMSource.cc @@ -486,6 +486,8 @@ void CTPPSPixelDQMSource::analyze(edm::Event const& event, edm::EventSetup const int station = theId.station()&0x3; int rpot = theId.rp()&0x7; + if((StationStatus[station]==0) || (RPstatus[station][rpot]==0)) continue; + int index = getRPindex(arm,station,rpot); ++ClusMultPlane[index][plane]; From 8666ae7294b46f6bd8eb6064b2e39447601f70ce Mon Sep 17 00:00:00 2001 From: Suchandra Date: Sat, 7 Apr 2018 04:49:10 +0200 Subject: [PATCH 376/426] ParameterSet (iconfig_) no longer a data member of Phase2TrackerDigitizer --- .../plugins/Phase2TrackerDigitizer.cc | 11 +++++------ .../plugins/Phase2TrackerDigitizer.h | 3 +-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.cc b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.cc index b79e4d7ed6d44..10a9a0044cc45 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.cc +++ b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.cc @@ -82,7 +82,7 @@ namespace cms hitsProducer_(iConfig.getParameter("hitsProducer")), trackerContainers_(iConfig.getParameter >("ROUList")), geometryType_(iConfig.getParameter("GeometryType")), - iconfig_(iConfig) + isOuterTrackerReadoutAnalog(iConfig.getParameter("isOTreadoutAnalog")) { //edm::LogInfo("Phase2TrackerDigitizer") << "Initialize Digitizer Algorithms"; const std::string alias1("simSiPixelDigis"); @@ -94,10 +94,10 @@ namespace cms mixMod.produces >("Tracker").setBranchAlias(alias2); // creating algorithm objects and pushing them into the map - algomap_[AlgorithmType::InnerPixel] = std::unique_ptr(new PixelDigitizerAlgorithm(iconfig_)); - algomap_[AlgorithmType::PixelinPS] = std::unique_ptr(new PSPDigitizerAlgorithm(iconfig_)); - algomap_[AlgorithmType::StripinPS] = std::unique_ptr(new PSSDigitizerAlgorithm(iconfig_)); - algomap_[AlgorithmType::TwoStrip] = std::unique_ptr(new SSDigitizerAlgorithm(iconfig_)); + algomap_[AlgorithmType::InnerPixel] = std::unique_ptr(new PixelDigitizerAlgorithm(iConfig)); + algomap_[AlgorithmType::PixelinPS] = std::unique_ptr(new PSPDigitizerAlgorithm(iConfig)); + algomap_[AlgorithmType::StripinPS] = std::unique_ptr(new PSSDigitizerAlgorithm(iConfig)); + algomap_[AlgorithmType::TwoStrip] = std::unique_ptr(new SSDigitizerAlgorithm(iConfig)); } void Phase2TrackerDigitizer::beginLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const& iSetup) { @@ -213,7 +213,6 @@ namespace cms } } void Phase2TrackerDigitizer::finalizeEvent(edm::Event& iEvent, const edm::EventSetup& iSetup) { - const bool isOuterTrackerReadoutAnalog = iconfig_.getParameter("isOTreadoutAnalog"); //Decide if we want analog readout for Outer Tracker. addPixelCollection(iEvent, iSetup, isOuterTrackerReadoutAnalog); if(!isOuterTrackerReadoutAnalog) diff --git a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.h b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.h index 72296163b5e34..b07aa4d4bde4e 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.h +++ b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.h @@ -106,8 +106,7 @@ namespace cms std::map detectorUnits_; edm::ESHandle tTopoHand; edm::ESWatcher theTkDigiGeomWatcher; - const edm::ParameterSet& iconfig_; - + const bool isOuterTrackerReadoutAnalog; // cache for detector types ModuleTypeCache moduleTypeCache_; From a1a8849a60de2599723c5717859bf14bd9b7b12c Mon Sep 17 00:00:00 2001 From: Suchandra Date: Sat, 7 Apr 2018 05:58:54 +0200 Subject: [PATCH 377/426] code cleanup and random number engine related optimization --- .../plugins/Phase2TrackerDigitizer.cc | 9 ++++----- .../plugins/Phase2TrackerDigitizerAlgorithm.cc | 13 ++++--------- .../plugins/Phase2TrackerDigitizerAlgorithm.h | 1 - 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.cc b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.cc index 10a9a0044cc45..3144aab16ed3a 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.cc +++ b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.cc @@ -94,10 +94,10 @@ namespace cms mixMod.produces >("Tracker").setBranchAlias(alias2); // creating algorithm objects and pushing them into the map - algomap_[AlgorithmType::InnerPixel] = std::unique_ptr(new PixelDigitizerAlgorithm(iConfig)); - algomap_[AlgorithmType::PixelinPS] = std::unique_ptr(new PSPDigitizerAlgorithm(iConfig)); - algomap_[AlgorithmType::StripinPS] = std::unique_ptr(new PSSDigitizerAlgorithm(iConfig)); - algomap_[AlgorithmType::TwoStrip] = std::unique_ptr(new SSDigitizerAlgorithm(iConfig)); + algomap_[AlgorithmType::InnerPixel] = std::make_unique(iConfig); + algomap_[AlgorithmType::PixelinPS] = std::make_unique(iConfig); + algomap_[AlgorithmType::StripinPS] = std::make_unique(iConfig); + algomap_[AlgorithmType::TwoStrip] = std::make_unique(iConfig); } void Phase2TrackerDigitizer::beginLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const& iSetup) { @@ -127,7 +127,6 @@ namespace cms Phase2TrackerDigitizer::~Phase2TrackerDigitizer() { edm::LogInfo("Phase2TrackerDigitizer") << "Destroying the Digitizer"; - algomap_.clear(); } void Phase2TrackerDigitizer::accumulatePixelHits(edm::Handle > hSimHits, diff --git a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.cc b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.cc index ca4fdfadbcdf8..a599f75c7f262 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.cc +++ b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.cc @@ -153,10 +153,6 @@ Phase2TrackerDigitizerAlgorithm::Phase2TrackerDigitizerAlgorithm(const edm::Para theSiPixelGainCalibrationService_(use_ineff_from_db_ ? new SiPixelGainCalibrationOfflineSimService(conf_specific) : nullptr), subdetEfficiencies_(conf_specific) { - flatDistribution_.reset(nullptr); - gaussDistribution_.reset(nullptr); - smearedThreshold_Endcap_.reset(nullptr); - smearedThreshold_Barrel_.reset(nullptr); LogInfo("Phase2TrackerDigitizerAlgorithm") << "Phase2TrackerDigitizerAlgorithm constructed\n" << "Configuration parameters:\n" @@ -717,7 +713,7 @@ void Phase2TrackerDigitizerAlgorithm::pixel_inefficiency(const SubdetEfficiencie // Now loop again over pixels to kill some of them. // Loop over hits, amplitude in electrons, channel = coded row,col for (auto & s : theSignal) { - float rand = flatDistribution_->fire(); + float rand = rengine_->flat(); if( rand>subdetEfficiency ) { // make amplitude =0 s.second.set(0.); // reset amplitude, @@ -727,13 +723,12 @@ void Phase2TrackerDigitizerAlgorithm::pixel_inefficiency(const SubdetEfficiencie void Phase2TrackerDigitizerAlgorithm::initializeEvent(CLHEP::HepRandomEngine* eng) { if (addNoise || AddPixelInefficiency || fluctuateCharge || addThresholdSmearing) { - flatDistribution_ = std::unique_ptr(new CLHEP::RandFlat(*eng, 0., 1.)); - gaussDistribution_ = std::unique_ptr(new CLHEP::RandGaussQ(eng, 0., theReadoutNoise)); + gaussDistribution_ = std::make_unique(eng, 0., theReadoutNoise); } // Threshold smearing with gaussian distribution: if (addThresholdSmearing) { - smearedThreshold_Endcap_ = std::unique_ptr (new CLHEP::RandGaussQ(eng, theThresholdInE_Endcap , theThresholdSmearing_Endcap)); - smearedThreshold_Barrel_ = std::unique_ptr (new CLHEP::RandGaussQ(eng, theThresholdInE_Barrel , theThresholdSmearing_Barrel)); + smearedThreshold_Endcap_ = std::make_unique (eng, theThresholdInE_Endcap , theThresholdSmearing_Endcap); + smearedThreshold_Barrel_ = std::make_unique (eng, theThresholdInE_Barrel , theThresholdSmearing_Barrel); } rengine_ = eng; _signal.clear(); diff --git a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.h b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.h index dff2fa1c91777..77118da6a1a24 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.h +++ b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.h @@ -198,7 +198,6 @@ class Phase2TrackerDigitizerAlgorithm { const SubdetEfficiencies subdetEfficiencies_; // For random numbers - std::unique_ptr flatDistribution_; std::unique_ptr gaussDistribution_; // Threshold gaussian smearing: From 7093ff469b108de97b7eb1200a1e75324232f2fa Mon Sep 17 00:00:00 2001 From: Sunanda Date: Sat, 7 Apr 2018 08:28:48 +0200 Subject: [PATCH 378/426] Step toward HGCal interface of Geometry --- .../HGCalCommonData/data/hgcal/v9/hgcal.xml | 4 +- .../HGCalCommonData/data/hgcal/v9p/hgcal.xml | 4 +- .../data/hgcalCons/v9/hgcalCons.xml | 71 +++++++++++++++++++ .../data/hgcalEE/v9/hgcalEE.xml | 2 +- .../data/hgcalHEmix/v9/hgcalHEmix.xml | 2 +- .../data/hgcalHEsil/v9/hgcalHEsil.xml | 2 +- .../data/hgcalwafer/v9/hgcalwafer.xml | 2 +- .../interface/HGCalGeometryMode.h | 3 +- .../interface/HGCalParametersFromDD.h | 4 ++ .../HGCalCommonData/plugins/DDHGCalHEAlgo.cc | 14 +++- .../HGCalCommonData/python/testHGCXML_cfi.py | 3 + .../python/testHGCalEEXML_cfi.py | 2 + .../python/testHGCalHEmixXML_cfi.py | 2 + .../python/testHGCalHEsilXML_cfi.py | 2 + .../HGCalCommonData/src/HGCalGeometryMode.cc | 12 ++-- .../src/HGCalParametersFromDD.cc | 30 ++++++-- 16 files changed, 137 insertions(+), 22 deletions(-) create mode 100644 Geometry/HGCalCommonData/data/hgcalCons/v9/hgcalCons.xml diff --git a/Geometry/HGCalCommonData/data/hgcal/v9/hgcal.xml b/Geometry/HGCalCommonData/data/hgcal/v9/hgcal.xml index 1a531937f9185..a64dbb69d4201 100644 --- a/Geometry/HGCalCommonData/data/hgcal/v9/hgcal.xml +++ b/Geometry/HGCalCommonData/data/hgcal/v9/hgcal.xml @@ -128,12 +128,12 @@ - + - + diff --git a/Geometry/HGCalCommonData/data/hgcal/v9p/hgcal.xml b/Geometry/HGCalCommonData/data/hgcal/v9p/hgcal.xml index eb474bf7a9e52..455de1d440bdc 100644 --- a/Geometry/HGCalCommonData/data/hgcal/v9p/hgcal.xml +++ b/Geometry/HGCalCommonData/data/hgcal/v9p/hgcal.xml @@ -128,12 +128,12 @@ - + - + diff --git a/Geometry/HGCalCommonData/data/hgcalCons/v9/hgcalCons.xml b/Geometry/HGCalCommonData/data/hgcalCons/v9/hgcalCons.xml new file mode 100644 index 0000000000000..0de48904ddb23 --- /dev/null +++ b/Geometry/HGCalCommonData/data/hgcalCons/v9/hgcalCons.xml @@ -0,0 +1,71 @@ + + + + + + [hgcal:CellThicknessFine], [hgcal:CellThicknessCoarse1], + [hgcal:CellThicknessCoarse2] + + [hgcal:rad100200P0], [hgcal:rad100200P1], [hgcal:rad100200P2], + [hgcal:rad100200P3], [hgcal:rad100200P4] + + [hgcal:rad200300P0], [hgcal:rad200300P1], [hgcal:rad200300P2], + [hgcal:rad200300P3], [hgcal:rad200300P4] + + [hgcal:NCornerCut], [hgcal:zMinForRadPar] + + [hgcal:radMixL0], [hgcal:radMixL1], [hgcal:radMixL2], [hgcal:radMixL3], + [hgcal:radMixL4], [hgcal:radMixL5], [hgcal:radMixL6], [hgcal:radMixL7], + [hgcal:radMixL8], [hgcal:radMixL9], [hgcal:radMixL10],[hgcal:radMixL11], + [hgcal:radMixL12],[hgcal:radMixL13],[hgcal:radMixL14],[hgcal:radMixL15] + + + 360, 360, 360, 360, 240, 240, 240, 240, 240, 240, + 240, 240, 240, 240, 240, 240 + + [etaMax:slope], [etaMax:slope] + + [hgcal:slope2], [hgcal:slope3], 0, 0 + + [hgcal:zHGCal1], [hgcal:zHGCal2], [hgcal:zHGCal3], + [hgcal:zHGCal4] + + [hgcal:rMaxHGCal1], [hgcal:rMaxHGCal2], [hgcal:rMaxHGCal3], + [hgcal:rMaxHGCal4] + + [hgcal:zMinEE], [hgcal:zMinHEsil], [hgcal:zMinHEmix], + [hgcal:zMaxHEmix] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/HGCalCommonData/data/hgcalEE/v9/hgcalEE.xml b/Geometry/HGCalCommonData/data/hgcalEE/v9/hgcalEE.xml index d059fc584d572..3d06ede303803 100644 --- a/Geometry/HGCalCommonData/data/hgcalEE/v9/hgcalEE.xml +++ b/Geometry/HGCalCommonData/data/hgcalEE/v9/hgcalEE.xml @@ -67,7 +67,7 @@ - + [etaMax:slope], [etaMax:slope] diff --git a/Geometry/HGCalCommonData/data/hgcalHEmix/v9/hgcalHEmix.xml b/Geometry/HGCalCommonData/data/hgcalHEmix/v9/hgcalHEmix.xml index eac5d626751c2..eef4f2bbb73cd 100644 --- a/Geometry/HGCalCommonData/data/hgcalHEmix/v9/hgcalHEmix.xml +++ b/Geometry/HGCalCommonData/data/hgcalHEmix/v9/hgcalHEmix.xml @@ -75,7 +75,7 @@ - + [etaMax:slope], [etaMax:slope] diff --git a/Geometry/HGCalCommonData/data/hgcalHEsil/v9/hgcalHEsil.xml b/Geometry/HGCalCommonData/data/hgcalHEsil/v9/hgcalHEsil.xml index 2c9cdfbb9810f..06cc87e7dc422 100644 --- a/Geometry/HGCalCommonData/data/hgcalHEsil/v9/hgcalHEsil.xml +++ b/Geometry/HGCalCommonData/data/hgcalHEsil/v9/hgcalHEsil.xml @@ -53,7 +53,7 @@ - + [etaMax:slope], [etaMax:slope] diff --git a/Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcalwafer.xml b/Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcalwafer.xml index c9597c2778a6a..cdfe40f98bc26 100644 --- a/Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcalwafer.xml +++ b/Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcalwafer.xml @@ -168,7 +168,7 @@ hgcalcell:HGCalHECellFull0Coarse2, hgcalcell:HGCalHECellTrunc01Coarse2, hgcalcell:HGCalHECellTrunc02Coarse2, hgcalcell:HGCalHECellTrunc03Coarse2, hgcalcell:HGCalHECellExten01Coarse2, hgcalcell:HGCalHECellExten02Coarse2, - hgcalcell:HGCalHECellExten03Coarse2, hgcalcell:HGCalHECellCorner01Coarse2, + hgcalcell:HGCalHECellExten03Coarse2, hgcalcell:HGCalHECellCorner01Coarse2, hgcalcell:HGCalHECellCorner02Coarse2,hgcalcell:HGCalHECellCorner03Coarse2, hgcalcell:HGCalHECellCorner04Coarse2,hgcalcell:HGCalHECellCorner05Coarse2, hgcalcell:HGCalHECellCorner06Coarse2 diff --git a/Geometry/HGCalCommonData/interface/HGCalGeometryMode.h b/Geometry/HGCalCommonData/interface/HGCalGeometryMode.h index fd069940c1599..8271a1ce6adbe 100644 --- a/Geometry/HGCalCommonData/interface/HGCalGeometryMode.h +++ b/Geometry/HGCalCommonData/interface/HGCalGeometryMode.h @@ -23,7 +23,8 @@ class HGCalStringToEnumParser { }; namespace HGCalGeometryMode { - enum GeometryMode { Square=0, Hexagon=1, HexagonFull=2 }; + enum GeometryMode { Square=0, Hexagon=1, HexagonFull=2, Hexagon8=3, + Hexagon8Full=4, Trapezoid=5}; enum WaferMode { Polyhedra=0, ExtrudedPolygon=1}; } diff --git a/Geometry/HGCalCommonData/interface/HGCalParametersFromDD.h b/Geometry/HGCalCommonData/interface/HGCalParametersFromDD.h index 32eb15f7cee51..313e3f2debfd9 100644 --- a/Geometry/HGCalCommonData/interface/HGCalParametersFromDD.h +++ b/Geometry/HGCalCommonData/interface/HGCalParametersFromDD.h @@ -1,6 +1,7 @@ #ifndef HGCalCommonData_HGCalParametersFromDD_h #define HGCalCommonData_HGCalParametersFromDD_h +#include "DetectorDescription/Core/interface/DDsvalues.h" #include class DDCompactView; @@ -13,6 +14,9 @@ class HGCalParametersFromDD { bool build(const DDCompactView*, HGCalParameters&, const std::string&, const std::string&, const std::string&); + +private: + double getDDDVallue(const char* s, const DDsvalues_type& sv); }; #endif diff --git a/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.cc b/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.cc index 70c9d70e3af53..b2cd1525ebd05 100644 --- a/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.cc +++ b/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.cc @@ -363,7 +363,7 @@ void DDHGCalHEAlgo::positionMix(const DDLogicalPart& glog, int copy = copyNumberTop_[ii]; double hthickl = 0.5*layerThickTop_[ii]; thickTot += layerThickTop_[ii]; - name = nameM+namesTop_[ii]+std::to_string(copy); + name = "HGCal"+namesTop_[ii]+std::to_string(copy); #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: Layer " << ly << ":" << ii << " R " << rmid << ":" << rout << " Thick " @@ -376,6 +376,11 @@ void DDHGCalHEAlgo::positionMix(const DDLogicalPart& glog, 0.0, CLHEP::twopi); DDLogicalPart glog2 = DDLogicalPart(solid.ddname(), matter1, solid); #ifdef EDM_ML_DEBUG + double eta1 = -log(tan(0.5*atan(rmid/zz))); + double eta2 = -log(tan(0.5*atan(rout/zz))); + edm::LogVerbatim("HGCalGeom") << name << " z|rin|rout " << zz << ":" + << rmid << ":" << rout << " eta " << eta1 + << ":" << eta2; edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << solid.name() << " Tubs made of " << matName << " of dimensions " << rmid << ", " << rout @@ -431,7 +436,7 @@ void DDHGCalHEAlgo::positionMix(const DDLogicalPart& glog, int copy = copyNumberBot_[ii]; double hthickl = 0.5*layerThickBot_[ii]; thickTot += layerThickBot_[ii]; - name = nameM+namesBot_[ii]+std::to_string(copy); + name = "HGCal"+namesBot_[ii]+std::to_string(copy); #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: Layer " << ly << ":" << ii << " R " << rin << ":" << rmid << " Thick " @@ -444,6 +449,11 @@ void DDHGCalHEAlgo::positionMix(const DDLogicalPart& glog, 0.0, CLHEP::twopi); DDLogicalPart glog2 = DDLogicalPart(solid.ddname(), matter1, solid); #ifdef EDM_ML_DEBUG + double eta1 = -log(tan(0.5*atan(rin/zz))); + double eta2 = -log(tan(0.5*atan(rmid/zz))); + edm::LogVerbatim("HGCalGeom") << name << " z|rin|rout " << zz << ":" + << rin << ":" << rmid << " eta " << eta1 + << ":" << eta2; edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << solid.name() << " Tubs made of " << matName << " of dimensions " << rin << ", " << rmid diff --git a/Geometry/HGCalCommonData/python/testHGCXML_cfi.py b/Geometry/HGCalCommonData/python/testHGCXML_cfi.py index 22e687704d45d..69b5a4db2d38e 100644 --- a/Geometry/HGCalCommonData/python/testHGCXML_cfi.py +++ b/Geometry/HGCalCommonData/python/testHGCXML_cfi.py @@ -8,12 +8,15 @@ 'Geometry/CMSCommonData/data/cms/2019/v1/cms.xml', 'Geometry/CMSCommonData/data/eta3/etaMax.xml', 'Geometry/CMSCommonData/data/cmsMother.xml', + 'Geometry/CMSCommonData/data/caloBase/2023/v1/caloBase.xml', + 'Geometry/CMSCommonData/data/cmsCalo.xml', 'Geometry/HGCalCommonData/data/hgcal/v9/hgcal.xml', 'Geometry/HGCalCommonData/data/hgcalEE/v9/hgcalEE.xml', 'Geometry/HGCalCommonData/data/hgcalHEsil/v9/hgcalHEsil.xml', 'Geometry/HGCalCommonData/data/hgcalHEmix/v9/hgcalHEmix.xml', 'Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcalwafer.xml', 'Geometry/HGCalCommonData/data/hgcalcell/v9/hgcalcell.xml', + 'Geometry/HGCalCommonData/data/hgcalCons/v9/hgcalCons.xml', 'Geometry/CMSCommonData/data/FieldParameters.xml', ), rootNodeName = cms.string('cms:OCMS') diff --git a/Geometry/HGCalCommonData/python/testHGCalEEXML_cfi.py b/Geometry/HGCalCommonData/python/testHGCalEEXML_cfi.py index e577dbb036642..3edd91ed7950e 100644 --- a/Geometry/HGCalCommonData/python/testHGCalEEXML_cfi.py +++ b/Geometry/HGCalCommonData/python/testHGCalEEXML_cfi.py @@ -8,6 +8,8 @@ 'Geometry/CMSCommonData/data/cms/2019/v1/cms.xml', 'Geometry/CMSCommonData/data/eta3/etaMax.xml', 'Geometry/CMSCommonData/data/cmsMother.xml', + 'Geometry/CMSCommonData/data/caloBase/2023/v1/caloBase.xml', + 'Geometry/CMSCommonData/data/cmsCalo.xml', 'Geometry/HGCalCommonData/data/hgcalEE/v9/hgcal.xml', 'Geometry/HGCalCommonData/data/hgcalEE/v9/hgcalEE.xml', 'Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcalwafer.xml', diff --git a/Geometry/HGCalCommonData/python/testHGCalHEmixXML_cfi.py b/Geometry/HGCalCommonData/python/testHGCalHEmixXML_cfi.py index 5ca7964453394..fa7b065b0d9b2 100644 --- a/Geometry/HGCalCommonData/python/testHGCalHEmixXML_cfi.py +++ b/Geometry/HGCalCommonData/python/testHGCalHEmixXML_cfi.py @@ -8,6 +8,8 @@ 'Geometry/CMSCommonData/data/cms/2019/v1/cms.xml', 'Geometry/CMSCommonData/data/eta3/etaMax.xml', 'Geometry/CMSCommonData/data/cmsMother.xml', + 'Geometry/CMSCommonData/data/caloBase/2023/v1/caloBase.xml', + 'Geometry/CMSCommonData/data/cmsCalo.xml', 'Geometry/HGCalCommonData/data/hgcalHEmix/v9/hgcal.xml', 'Geometry/HGCalCommonData/data/hgcalHEmix/v9/hgcalHEmix.xml', 'Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcalwafer.xml', diff --git a/Geometry/HGCalCommonData/python/testHGCalHEsilXML_cfi.py b/Geometry/HGCalCommonData/python/testHGCalHEsilXML_cfi.py index e0597e30da6b8..1004daa9d2d37 100644 --- a/Geometry/HGCalCommonData/python/testHGCalHEsilXML_cfi.py +++ b/Geometry/HGCalCommonData/python/testHGCalHEsilXML_cfi.py @@ -8,6 +8,8 @@ 'Geometry/CMSCommonData/data/cms/2019/v1/cms.xml', 'Geometry/CMSCommonData/data/eta3/etaMax.xml', 'Geometry/CMSCommonData/data/cmsMother.xml', + 'Geometry/CMSCommonData/data/caloBase/2023/v1/caloBase.xml', + 'Geometry/CMSCommonData/data/cmsCalo.xml', 'Geometry/HGCalCommonData/data/hgcalHEsil/v9/hgcal.xml', 'Geometry/HGCalCommonData/data/hgcalHEsil/v9/hgcalHEsil.xml', 'Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcalwafer.xml', diff --git a/Geometry/HGCalCommonData/src/HGCalGeometryMode.cc b/Geometry/HGCalCommonData/src/HGCalGeometryMode.cc index d436a4f260674..f49005ecc06c0 100644 --- a/Geometry/HGCalCommonData/src/HGCalGeometryMode.cc +++ b/Geometry/HGCalCommonData/src/HGCalGeometryMode.cc @@ -2,13 +2,17 @@ template<> HGCalStringToEnumParser::HGCalStringToEnumParser() { - enumMap["HGCalGeometryMode::Hexagon"] = HGCalGeometryMode::Hexagon; - enumMap["HGCalGeometryMode::HexagonFull"] = HGCalGeometryMode::HexagonFull; -} + enumMap["HGCalGeometryMode::Square"] = HGCalGeometryMode::Square; + enumMap["HGCalGeometryMode::Hexagon"] = HGCalGeometryMode::Hexagon; + enumMap["HGCalGeometryMode::HexagonFull"] = HGCalGeometryMode::HexagonFull; + enumMap["HGCalGeometryMode::Hexagon8"] = HGCalGeometryMode::Hexagon8; + enumMap["HGCalGeometryMode::Hexagon8Full"] = HGCalGeometryMode::Hexagon8Full; + enumMap["HGCalGeometryMode::Trapezoid"] = HGCalGeometryMode::Trapezoid; + } template<> HGCalStringToEnumParser::HGCalStringToEnumParser() { - enumMap["HGCalGeometryMode::Polyhedra"] = HGCalGeometryMode::Polyhedra; + enumMap["HGCalGeometryMode::Polyhedra"] = HGCalGeometryMode::Polyhedra; enumMap["HGCalGeometryMode::ExtrudedPolygon"] = HGCalGeometryMode::ExtrudedPolygon; } diff --git a/Geometry/HGCalCommonData/src/HGCalParametersFromDD.cc b/Geometry/HGCalCommonData/src/HGCalParametersFromDD.cc index 64861d9e0c679..ea9bfc60eace0 100644 --- a/Geometry/HGCalCommonData/src/HGCalParametersFromDD.cc +++ b/Geometry/HGCalCommonData/src/HGCalParametersFromDD.cc @@ -56,8 +56,9 @@ bool HGCalParametersFromDD::build(const DDCompactView* cpv, const std::string& namec) { #ifdef EDM_ML_DEBUG - std::cout << "HGCalParametersFromDD::build called with names " << name << ":" - << namew << ":" << namec << std::endl; + edm::LogVerbatim("HGCalGeom") << "HGCalParametersFromDD::build called with " + << "names " << name << ":" << namew << ":" + << namec; #endif //Special parameters at simulation level @@ -73,9 +74,9 @@ bool HGCalParametersFromDD::build(const DDCompactView* cpv, DDsvalues_type sv(fv.mergedSpecifics()); php.mode_ = getGeometryMode("GeometryMode", sv); #ifdef EDM_ML_DEBUG - std::cout << "GeometryMode " << php.mode_ - << ":" << HGCalGeometryMode::Hexagon << ":" - << HGCalGeometryMode::HexagonFull << std::endl; + edm::LogVerbatim("HGCalGeom") << "GeometryMode " << php.mode_ + << ":" << HGCalGeometryMode::Hexagon << ":" + << HGCalGeometryMode::HexagonFull; #endif HGCalGeomParameters *geom = new HGCalGeomParameters(); if ((php.mode_ == HGCalGeometryMode::Hexagon) || @@ -90,8 +91,9 @@ bool HGCalParametersFromDD::build(const DDCompactView* cpv, DDsvalues_type sv2(fv2.mergedSpecifics()); mode = getGeometryWaferMode("WaferMode", sv2); #ifdef EDM_ML_DEBUG - std::cout << "WaferMode " << mode << ":" << HGCalGeometryMode::Polyhedra - << ":" << HGCalGeometryMode::ExtrudedPolygon << std::endl; + edm::LogVerbatim("HGCalGeom") << "WaferMode " << mode << ":" + << HGCalGeometryMode::Polyhedra << ":" + << HGCalGeometryMode::ExtrudedPolygon; #endif } } @@ -130,3 +132,17 @@ bool HGCalParametersFromDD::build(const DDCompactView* cpv, << ok; return ok; } + +double HGCalParametersFromDD::getDDDVallue(const char* s, + const DDsvalues_type& sv) { + DDValue val(s); + if (DDfetch(&sv, val)) { + const std::vector & fvec = val.doubles(); + if (fvec.empty()) { + throw cms::Exception("HGCalGeom") << "Failed to get " << s << " tag."; + } + return fvec[0]; + } else { + throw cms::Exception("HGCalGeom") << "Failed to get "<< s << " tag"; + } +} From db6bbddfb31812a7f7bbef1d7a0eadf67799e52e Mon Sep 17 00:00:00 2001 From: nminafra Date: Sat, 7 Apr 2018 10:21:00 +0200 Subject: [PATCH 379/426] Removed pragmas --- .../interface/TotemSampicFrame.h | 230 +++++++++++------- 1 file changed, 140 insertions(+), 90 deletions(-) diff --git a/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h b/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h index 3a636079b1316..bc512ff47fbbb 100644 --- a/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h +++ b/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h @@ -19,52 +19,56 @@ enum TotemSampicConstant { + hwId_Position = 0, + hwId_Size = 1, + controlBits0_Position = 1, + controlBits1_Position = 2, + controlBits2_Position = 3, + controlBits3_Position = 4, + controlBits4_Position = 5, + controlBits5_Position = 6, + fpgaTime_Position = 7, + fpgaTime_Size = 5, + timestampA_Position = 12, + timestampA_Size = 2, + timestampB_Position = 14, + timestampB_Size = 2, + cellInfo_Position = 16, + cellInfo_Size = 2, + planeChannelId_Position = 18, + planeChannelId_Size = 1, + reserved_Position = 19, + reserved_Size = 5, + + boardId_Position = 0, + boardId_Size = 1, + l1ATimestamp_Position = 1, + l1ATimestamp_Size = 5, + bunchNumber_Position = 6, + bunchNumber_Size = 2, + orbitNumber_Position = 8, + orbitNumber_Size = 4, + eventNumber_Position = 12, + eventNumber_Size = 4, + channelMap_Position = 16, + channelMap_Size = 2, + l1ALatency_Position = 18, + l1ALatency_Size = 2, + numberOfSamples_Position = 20, + numberOfSamples_Size = 1, + offsetOfSamples_Position = 21, + offsetOfSamples_Size = 1, + fwVersion_Position = 22, + fwVersion_Size = 1, + pllInfo_Position = 23, + pllInfo_Size = 1, + numberOfSamples = 24, + controlBits3 = 0x69, + cellInfo_Mask = 0x3F, + }; -#pragma pack(push,1) -struct TotemSampicData -{ - uint8_t samples[TotemSampicConstant::numberOfSamples]; - - TotemSampicData() {} -}; -#pragma pack(pop) - -#pragma pack(push,1) -struct TotemSampicInfo -{ - uint8_t hwId; - uint8_t controlBits[6]; - uint8_t fpgaTime[5]; - uint16_t timestampA; - uint16_t timestampB; - uint16_t cellInfo; - uint8_t planeChannelId; - uint8_t reserved[5]; - - TotemSampicInfo() {} -}; -#pragma pack(pop) - -#pragma pack(push,1) -struct TotemSampicEventInfo -{ - uint8_t hwId; - uint8_t l1ATimestamp[5]; - uint16_t bunchNumber; - uint32_t orbitNumber; - uint32_t eventNumber; - uint16_t channelMap; - uint16_t l1ALatency; - uint8_t numberOfSamples; - uint8_t offsetOfSamples; - uint8_t fwVersion; - uint8_t pllInfo; - - TotemSampicEventInfo() {} -}; -#pragma pack(pop) uint8_t grayToBinary_8bit( const uint8_t &gcode_data ) { @@ -90,16 +94,10 @@ class TotemSampicFrame { public: TotemSampicFrame( const uint8_t* chInfoPtr, const uint8_t* chDataPtr, const uint8_t* eventInfoPtr ) : - totemSampicInfo_( nullptr ), totemSampicData_( nullptr ), totemSampicEventInfo_( nullptr ), + totemSampicInfoPtr_( chInfoPtr ), totemSampicDataPtr_( chDataPtr ), totemSampicEventInfoPtr_( eventInfoPtr ), status_( 0 ) { - if ( chInfoPtr != nullptr && chDataPtr != nullptr && eventInfoPtr != nullptr) { - totemSampicInfo_ = (TotemSampicInfo*) chInfoPtr; - totemSampicData_ = (TotemSampicData*) chDataPtr; - totemSampicEventInfo_ = (TotemSampicEventInfo*) eventInfoPtr; - } - if ( totemSampicEventInfo_->numberOfSamples == TotemSampicConstant::numberOfSamples - || totemSampicInfo_->controlBits[3] == 0x69 ) - status_ = 1; + if ( chInfoPtr != nullptr && chDataPtr != nullptr && eventInfoPtr != nullptr && totemSampicInfoPtr_[ TotemSampicConstant::controlBits3_Position ] == TotemSampicConstant::controlBits3 ) + status_ = 1; } ~TotemSampicFrame() {} @@ -107,13 +105,13 @@ class TotemSampicFrame /// If binary is true, binary format is used. void printRaw( bool binary = false ) const { std::cout << "Event Info: " << std::endl; - printRawBuffer( (uint16_t*) totemSampicEventInfo_ ); + printRawBuffer( (uint16_t*) totemSampicEventInfoPtr_ ); std::cout << "Channel Info: " << std::endl; - printRawBuffer( (uint16_t*) totemSampicInfo_ ); + printRawBuffer( (uint16_t*) totemSampicInfoPtr_ ); std::cout << "Channel Data: " << std::endl; - printRawBuffer( (uint16_t*) totemSampicData_ ); + printRawBuffer( (uint16_t*) totemSampicDataPtr_ ); } void print() const { @@ -143,48 +141,63 @@ class TotemSampicFrame // All getters inline uint8_t getHardwareId() const { - return status_ * totemSampicInfo_->hwId; + uint8_t tmp = 0; + if ( status_ ) tmp = totemSampicInfoPtr_[ TotemSampicConstant::hwId_Position ]; + return tmp; } inline uint64_t getFPGATimestamp() const { - uint64_t time = 0; - for ( unsigned short i = 0; i < 5; ++i ) - time += totemSampicInfo_->fpgaTime[i] << 8*1; - return status_ * time; + uint64_t tmp = 0; + if ( status_ ) { + for ( unsigned short i = 0; i < TotemSampicConstant::fpgaTime_Size; ++i ) + tmp += totemSampicInfoPtr_[ TotemSampicConstant::fpgaTime_Position + i ] << 8*i; + } + return tmp; } inline uint16_t getTimestampA() const { - return status_ * grayToBinary_8bit( totemSampicInfo_->timestampA ); + uint16_t tmp = 0; + if ( status_ ) { + for ( unsigned short i = 0; i < TotemSampicConstant::timestampA_Size; ++i ) + tmp += grayToBinary_8bit( totemSampicInfoPtr_[ TotemSampicConstant::timestampA_Position + i ] ) << 8*i; + } + return tmp; } inline uint16_t getTimestampB() const { - return status_ * grayToBinary_8bit( totemSampicInfo_->timestampB ); + uint16_t tmp = 0; + if ( status_ ) { + for ( unsigned short i = 0; i < TotemSampicConstant::timestampB_Size; ++i ) + tmp += grayToBinary_8bit( totemSampicInfoPtr_[ TotemSampicConstant::timestampB_Position + i ] ) << 8*i; + } + return tmp; } inline uint16_t getCellInfo() const { - return status_ * ( totemSampicInfo_->cellInfo & 0x3F ); + uint16_t tmp = 0; + if ( status_ ) + tmp = *( ( const uint16_t* ) ( totemSampicInfoPtr_ + TotemSampicConstant::cellInfo_Position ) ); + return tmp & TotemSampicConstant::cellInfo_Mask; } inline int getDetPlane() const { - return status_ * ( ( totemSampicInfo_->planeChannelId & 0xF0 ) >> 4 ); + int tmp = 0; + if ( status_ ) + tmp = ( totemSampicInfoPtr_[ planeChannelId_Position ] & 0xF0 ) >> 4; + return tmp; } inline int getDetChannel() const { - return status_ * ( totemSampicInfo_->planeChannelId & 0xF0 ); - } - - inline int getPLLInfo() const { - return status_ * totemSampicEventInfo_->pllInfo; - } - - inline int getFWVersion() const { - return status_ * totemSampicEventInfo_->fwVersion; + int tmp = 0; + if ( status_ ) + tmp = totemSampicInfoPtr_[ planeChannelId_Position ] & 0x0F; + return tmp; } const std::vector getSamples() const { std::vector samples; if ( status_ ) { - samples.assign( totemSampicData_->samples, totemSampicData_->samples + TotemSampicConstant::numberOfSamples ); + samples.assign( totemSampicDataPtr_, totemSampicDataPtr_ + TotemSampicConstant::numberOfSamples ); std::for_each( samples.begin(), samples.end(), &grayToBinary_8bit ); } return samples; @@ -196,49 +209,85 @@ class TotemSampicFrame // Event Info inline uint8_t getEventHardwareId() const { - return status_ * totemSampicEventInfo_->hwId; + uint8_t tmp = 0; + if ( status_ ) + tmp = totemSampicEventInfoPtr_[ TotemSampicConstant::boardId_Position ]; + return tmp; } inline uint64_t getL1ATimestamp() const { - uint64_t time = 0; - for ( unsigned short i = 0; i < 5; ++i ) - time += totemSampicEventInfo_->l1ATimestamp[i] << 8*1; - return status_ * time; + uint64_t tmp = 0; + if ( status_ ) { + for ( unsigned short i = 0; i < TotemSampicConstant::l1ATimestamp_Size; ++i ) + tmp += totemSampicEventInfoPtr_[ TotemSampicConstant::l1ATimestamp_Position + i ] << 8*i; + } + return tmp; } inline uint16_t getBunchNumber() const { - return status_ * totemSampicEventInfo_->bunchNumber; + uint16_t tmp = 0; + if ( status_ ) + tmp = *( ( const uint16_t* ) ( totemSampicEventInfoPtr_ + TotemSampicConstant::bunchNumber_Position ) ); + return tmp; } inline uint32_t getOrbitNumber() const { - return status_ * totemSampicEventInfo_->orbitNumber; + uint32_t tmp = 0; + if ( status_ ) + tmp = *( ( const uint32_t* ) ( totemSampicEventInfoPtr_ + TotemSampicConstant::orbitNumber_Position ) ); + return tmp; } inline uint32_t getEventNumber() const { - return status_ * totemSampicEventInfo_->eventNumber; + uint32_t tmp = 0; + if ( status_ ) + tmp = *( ( const uint32_t* ) ( totemSampicEventInfoPtr_ + TotemSampicConstant::eventNumber_Position ) ); + return tmp; } inline uint16_t getChannelMap() const { - return status_ * totemSampicEventInfo_->channelMap; + uint16_t tmp = 0; + if ( status_ ) + tmp = *( ( const uint16_t* ) ( totemSampicEventInfoPtr_ + TotemSampicConstant::channelMap_Position ) ); + return tmp; } inline uint16_t getL1ALatency() const { - return status_ * totemSampicEventInfo_->l1ALatency; + uint16_t tmp = 0; + if ( status_ ) + tmp = *( ( const uint16_t* ) ( totemSampicEventInfoPtr_ + TotemSampicConstant::l1ALatency_Position ) ); + return tmp; } - + inline uint8_t getNumberOfSentSamples() const { - return status_ * totemSampicEventInfo_->numberOfSamples; + uint8_t tmp = 0; + if ( status_ ) tmp = totemSampicEventInfoPtr_[ TotemSampicConstant::numberOfSamples_Position ]; + return tmp; } inline uint8_t getOffsetOfSamples() const { - return status_ * totemSampicEventInfo_->offsetOfSamples; + uint8_t tmp = 0; + if ( status_ ) tmp = totemSampicEventInfoPtr_[ TotemSampicConstant::offsetOfSamples_Position ]; + return tmp; + } + + inline uint8_t getPLLInfo() const { + uint8_t tmp = 0; + if ( status_ ) tmp = totemSampicEventInfoPtr_[ pllInfo_Position ]; + return tmp; + } + + inline uint8_t getFWVersion() const { + uint8_t tmp = 0; + if ( status_ ) tmp = totemSampicEventInfoPtr_[ fwVersion_Position ]; + return tmp; } inline bool valid() const { @@ -246,9 +295,9 @@ class TotemSampicFrame } protected: - const TotemSampicInfo* totemSampicInfo_; - const TotemSampicData* totemSampicData_; - const TotemSampicEventInfo* totemSampicEventInfo_; + const uint8_t* totemSampicInfoPtr_; + const uint8_t* totemSampicDataPtr_; + const uint8_t* totemSampicEventInfoPtr_; int status_; @@ -263,6 +312,7 @@ class TotemSampicFrame } std::cout << std::endl; } + }; From 58e50eb99e0a68de5fbc324925b8429f89f5d605 Mon Sep 17 00:00:00 2001 From: nminafra Date: Sat, 7 Apr 2018 10:21:43 +0200 Subject: [PATCH 380/426] Added pllInfo to TotemTimingEventInfo --- DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h | 2 +- DataFormats/CTPPSDigi/src/TotemTimingEventInfo.cc | 9 +++++---- EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h b/DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h index eee6d4d574286..a3968b659ddd9 100644 --- a/DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h +++ b/DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h @@ -16,7 +16,7 @@ class TotemTimingEventInfo { public: - TotemTimingEventInfo( const uint8_t hwId, const uint64_t l1ATimestamp, const uint16_t bunchNumber, const uint32_t orbitNumber, const uint32_t eventNumber, const uint16_t channelMap, const uint16_t l1ALatency, const uint8_t numberOfSamples, const uint8_t offsetOfSamples ); + TotemTimingEventInfo( const uint8_t hwId, const uint64_t l1ATimestamp, const uint16_t bunchNumber, const uint32_t orbitNumber, const uint32_t eventNumber, const uint16_t channelMap, const uint16_t l1ALatency, const uint8_t numberOfSamples, const uint8_t offsetOfSamples, const uint8_t pllInfo ); TotemTimingEventInfo( const TotemTimingEventInfo& eventInfo ); TotemTimingEventInfo(); ~TotemTimingEventInfo() {}; diff --git a/DataFormats/CTPPSDigi/src/TotemTimingEventInfo.cc b/DataFormats/CTPPSDigi/src/TotemTimingEventInfo.cc index 28459ca24c6c6..5c661f5baa3c0 100644 --- a/DataFormats/CTPPSDigi/src/TotemTimingEventInfo.cc +++ b/DataFormats/CTPPSDigi/src/TotemTimingEventInfo.cc @@ -9,25 +9,25 @@ TotemTimingEventInfo::TotemTimingEventInfo( const uint8_t hwId, const uint64_t l1ATimestamp, const uint16_t bunchNumber, const uint32_t orbitNumber, const uint32_t eventNumber, const uint16_t channelMap, const uint16_t l1ALatency, - const uint8_t numberOfSamples, const uint8_t offsetOfSamples ) : + const uint8_t numberOfSamples, const uint8_t offsetOfSamples, const uint8_t pllInfo ) : hwId_( hwId ), l1ATimestamp_( l1ATimestamp ), bunchNumber_( bunchNumber ), orbitNumber_( orbitNumber ), eventNumber_( eventNumber ), channelMap_( channelMap ), l1ALatency_( l1ALatency ), - numberOfSamples_( numberOfSamples ), offsetOfSamples_( offsetOfSamples ) + numberOfSamples_( numberOfSamples ), offsetOfSamples_( offsetOfSamples ), pllInfo_( pllInfo ) {} TotemTimingEventInfo::TotemTimingEventInfo( const TotemTimingEventInfo& eventInfo ) : hwId_( eventInfo.hwId_ ), l1ATimestamp_( eventInfo.l1ATimestamp_ ), bunchNumber_( eventInfo.bunchNumber_ ), orbitNumber_( eventInfo.orbitNumber_ ), eventNumber_( eventInfo.eventNumber_ ), channelMap_( eventInfo.channelMap_ ), l1ALatency_( eventInfo.l1ALatency_ ), - numberOfSamples_( eventInfo.numberOfSamples_ ), offsetOfSamples_( eventInfo.offsetOfSamples_ ) + numberOfSamples_( eventInfo.numberOfSamples_ ), offsetOfSamples_( eventInfo.offsetOfSamples_ ), pllInfo_ ( eventInfo.pllInfo_ ) {} TotemTimingEventInfo::TotemTimingEventInfo() : hwId_( 0 ), l1ATimestamp_( 0 ), bunchNumber_( 0 ), orbitNumber_( 0 ), eventNumber_( 0 ), channelMap_( 0 ), l1ALatency_( 0 ), - numberOfSamples_( 0 ), offsetOfSamples_( 0 ) + numberOfSamples_( 0 ), offsetOfSamples_( 0 ), pllInfo_( 0 ) {} // Comparison @@ -43,6 +43,7 @@ TotemTimingEventInfo::operator==(const TotemTimingEventInfo& eventInfo) const || l1ALatency_ != eventInfo.l1ALatency_ || numberOfSamples_ != eventInfo.numberOfSamples_ || offsetOfSamples_ != eventInfo.offsetOfSamples_ + || pllInfo_ != eventInfo.pllInfo_ ) return false; return true; } diff --git a/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc b/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc index 2964e12194527..72c7f364a211c 100644 --- a/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc +++ b/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc @@ -336,7 +336,7 @@ void RawToDigiConverter::run(const VFATFrameCollection &coll, const TotemDAQMapp if (totemSampicFrame.valid()) { // create the digi - TotemTimingEventInfo eventInfoTmp( totemSampicFrame.getEventHardwareId(), totemSampicFrame.getL1ATimestamp(), totemSampicFrame.getBunchNumber(), totemSampicFrame.getOrbitNumber(), totemSampicFrame.getEventNumber(), totemSampicFrame.getChannelMap(), totemSampicFrame.getL1ALatency(), totemSampicFrame.getNumberOfSentSamples(), totemSampicFrame.getOffsetOfSamples() ); + TotemTimingEventInfo eventInfoTmp( totemSampicFrame.getEventHardwareId(), totemSampicFrame.getL1ATimestamp(), totemSampicFrame.getBunchNumber(), totemSampicFrame.getOrbitNumber(), totemSampicFrame.getEventNumber(), totemSampicFrame.getChannelMap(), totemSampicFrame.getL1ALatency(), totemSampicFrame.getNumberOfSentSamples(), totemSampicFrame.getOffsetOfSamples(), totemSampicFrame.getPLLInfo() ); TotemTimingDigi digiTmp( totemSampicFrame.getHardwareId(), totemSampicFrame.getFPGATimestamp(), totemSampicFrame.getTimestampA(), totemSampicFrame.getTimestampB(), totemSampicFrame.getCellInfo(), totemSampicFrame.getSamples(), eventInfoTmp); // calculate ids TotemTimingDetId detId(record.info->symbolicID.symbolicID); From ef00bc7615b8d886a356d1c09dd6f003bd8fd3dc Mon Sep 17 00:00:00 2001 From: arun Date: Sat, 7 Apr 2018 10:25:04 +0200 Subject: [PATCH 381/426] fix of prompt GT --- Configuration/AlCa/python/autoCond.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Configuration/AlCa/python/autoCond.py b/Configuration/AlCa/python/autoCond.py index c7f91d9cb8c85..d5319a268b049 100644 --- a/Configuration/AlCa/python/autoCond.py +++ b/Configuration/AlCa/python/autoCond.py @@ -30,7 +30,7 @@ # GlobalTag for Run2 data relvals: allows customization to run with fixed L1 menu 'run2_data_relval' : '101X_dataRun2_relval_v8', # GlobalTag for Run2 data 2016H relvals only: Prompt Conditions + fixed L1 menu (to be removed) - 'run2_data_promptlike' : '101X_dataRun2_PromptLike_v8', + 'run2_data_promptlike' : '101X_dataRun2_PromptLike_v9', # GlobalTag for Run1 HLT: it points to the online GT 'run1_hlt' : '101X_dataRun2_HLT_frozen_v6', # GlobalTag for Run2 HLT: it points to the online GT From 06628551f9f308a3d8b4b2809e695cc59be8fe87 Mon Sep 17 00:00:00 2001 From: Francesco Date: Sat, 7 Apr 2018 12:20:36 +0200 Subject: [PATCH 382/426] updating gensim --- .../PyReleaseValidation/python/relval_steps.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Configuration/PyReleaseValidation/python/relval_steps.py b/Configuration/PyReleaseValidation/python/relval_steps.py index 8666f6cdaafdc..ded23faaad7e9 100644 --- a/Configuration/PyReleaseValidation/python/relval_steps.py +++ b/Configuration/PyReleaseValidation/python/relval_steps.py @@ -507,7 +507,7 @@ def identitySim(wf): baseDataSetRelease=[ 'CMSSW_9_2_4-91X_mcRun1_realistic_v2-v1', # 0 run1 samples; note TTbar GENSIM has v2 (see TTbarINPUT below) - 'CMSSW_10_1_0_pre3-101X_upgrade2018_realistic_v3-v1', # 1 GEN-SIM for HI RunII, 2018 + 'CMSSW_10_1_0-101X_upgrade2018_realistic_v6_resub-v1', # 1 GEN-SIM for HI RunII, 2018 'CMSSW_6_2_0_pre8-PRE_ST62_V8_FastSim-v1', # 2 for fastsim id test # 'CMSSW_7_1_0_pre5-START71_V1-v2', # 3 8 TeV , for the one sample which is part of the routine relval production (RelValZmumuJets_Pt_20_300, because of -v2) # THIS ABOVE IS NOT USED, AT THE MOMENT @@ -515,16 +515,16 @@ def identitySim(wf): 'CMSSW_7_3_0_pre1-PRE_LS172_V15_FastSim-v1', # 4 - fast sim GEN-SIM-DIGI-RAW-HLTDEBUG for id tests 'CMSSW_9_0_0_pre4-PU25ns_90X_mcRun2_asymptotic_v1-v1', # 5 - fullSim PU 25ns UP15 premix 'CMSSW_8_1_0_pre15-PU50ns_81X_mcRun2_startup_v12-v1', # 6 - fullSim PU 50ns UP15 premix - 'CMSSW_10_1_0_pre3-101X_mcRun2_asymptotic_v2_FastSim-v1', # 7 - fastSim MinBias for mixing - 'CMSSW_10_1_0_pre3-PU25ns_101X_mcRun2_asymptotic_v2_FastSim-v1',# 8 - fastSim premixed MinBias - 'CMSSW_10_1_0_pre3-101X_upgrade2018_realistic_v3-v1', # 9 - Run2 HI GEN-SIM for mixing + 'CMSSW_10_1_0-101X_mcRun2_asymptotic_v3_resub_FastSim-v1', # 7 - fastSim MinBias for mixing + 'CMSSW_10_1_0-PU25ns_101X_mcRun2_asymptotic_v3_FastSim-v1',# 8 - fastSim premixed MinBias + 'CMSSW_10_1_0-101X_upgrade2018_realistic_v6_resub-v1', # 9 - Run2 HI GEN-SIM for mixing 'CMSSW_7_6_0-76X_mcRun2_asymptotic_v11-v1', # 10 - 13 TeV High Stats GEN-SIM 'CMSSW_7_6_0_pre7-76X_mcRun2_asymptotic_v9_realBS-v1', # 11 - 13 TeV High Stats MiniBias for mixing GEN-SIM 'CMSSW_8_1_0_pre9_Geant4102-81X_mcRun2cosmics_startup_peak_v2-v1', # 12 - GEN-SIM input for 1307 cosmics wf from 810_p2 'CMSSW_10_0_0_pre2-100X_mc2017_realistic_v1-v1', # 13 - 13 TeV samples with GEN-SIM from PhaseI upgrade 'CMSSW_10_0_0_pre2-PU25ns_100X_mc2017_realistic_v1-v1', # 14 - fullSim PU 25ns UP17 premix - 'CMSSW_10_1_0_pre3-PU25ns_101X_upgrade2018_realistic_v3-v1', #15 - fullSim PU 25ns UP18 premix - 'CMSSW_10_1_0_pre3-101X_upgrade2018_realistic_v3-v1', #16 - GENSIM input 2018 + 'CMSSW_10_1_0-PU25ns_101X_upgrade2018_realistic_v6-v1', #15 - fullSim PU 25ns UP18 premix + 'CMSSW_10_1_0-101X_upgrade2018_realistic_v6_rsb-v1', #16 - GENSIM input 2018 ] @@ -2358,8 +2358,8 @@ def gen2018HiMix(fragment,howMuch): defaultDataSets={} defaultDataSets['2017']='CMSSW_10_0_0_pre2-100X_mc2017_realistic_v1-v' defaultDataSets['2017Design']='CMSSW_10_0_0_pre2-100X_mc2017_design_IdealBS_v1-v' -defaultDataSets['2018']='CMSSW_10_1_0_pre3-101X_upgrade2018_realistic_v3-v' -defaultDataSets['2018Design']='CMSSW_10_1_0_pre3-101X_upgrade2018_design_v4-v' +defaultDataSets['2018']='CMSSW_10_1_0-101X_upgrade2018_realistic_v6_rsb-v' +defaultDataSets['2018Design']='CMSSW_10_1_0-101X_upgrade2018_design_v7_resub-v' #defaultDataSets['2019']='' #defaultDataSets['2019Design']='' defaultDataSets['2023D17']='CMSSW_9_3_2-93X_upgrade2023_realistic_v2_2023D17noPU-v' From c0098446eef0348a292f3198526338dcd8df1013 Mon Sep 17 00:00:00 2001 From: nminafra Date: Sat, 7 Apr 2018 13:31:04 +0200 Subject: [PATCH 383/426] Fixed printing bug --- DataFormats/CTPPSDigi/interface/TotemTimingDigi.h | 7 ++++--- DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h b/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h index 2c0707e8de0f5..db2e16e8bb863 100644 --- a/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h +++ b/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h @@ -7,6 +7,7 @@ * * \author Mirko Berretti * \author Nicola Minafra + * \author Laurent Forthomme * March 2018 */ @@ -196,9 +197,9 @@ inline std::ostream& operator<<( std::ostream& os, const TotemTimingDigi& digi ) return os << "TotemTimingDigi:" << "\nHardwareId:\t" << std::hex << digi.getHardwareId() << "\nDB: " << std::dec << digi.getHardwareBoardId() << "\tSampic: " << digi.getHardwareSampicId() << "\tChannel: " << digi.getHardwareChannelId() - << "\nFPGATimestamp:\t" << std::hex << digi.getFPGATimestamp() - << "\nTimestampA:\t" << std::hex << digi.getTimestampA() - << "\nTimestampA:\t" << std::hex << digi.getTimestampA() + << "\nFPGATimestamp:\t" << std::dec << digi.getFPGATimestamp() + << "\nTimestampA:\t" << std::dec << digi.getTimestampA() + << "\nTimestampB:\t" << std::dec << digi.getTimestampB() << "\nCellInfo:\t" << std::hex << digi.getCellInfo() << "\nNumberOfSamples:\t" << std::dec << digi.getNumberOfSamples() << std::endl << digi.getEventInfo() << std::endl; diff --git a/DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h b/DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h index a3968b659ddd9..64aa6b64a52e5 100644 --- a/DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h +++ b/DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h @@ -7,6 +7,7 @@ * * \author Mirko Berretti * \author Nicola Minafra + * \author Laurent Forthomme * \date March 2018 */ @@ -202,7 +203,7 @@ inline std::ostream& operator<<( std::ostream& o, const TotemTimingEventInfo& di << "\nChannels fired:\t" << std::hex << digi.getChannelMap() << "\nNumber of Samples:\t" << std::dec << digi.getNumberOfSamples() << "\nOffset of Samples:\t" << std::dec << digi.getOffsetOfSamples() - << "\\nPLL Info:\t" << bitsPLLInfo.to_string() + << "\nPLL Info:\t" << bitsPLLInfo.to_string() << std::endl; } From b3f48e58f3c6ba09e2fa651f2554d32269bd6592 Mon Sep 17 00:00:00 2001 From: nminafra Date: Sat, 7 Apr 2018 13:31:38 +0200 Subject: [PATCH 384/426] Fixed grayCounter bug --- .../interface/TotemSampicFrame.h | 36 +++++++++---------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h b/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h index bc512ff47fbbb..8fe703e877fcc 100644 --- a/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h +++ b/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h @@ -69,22 +69,17 @@ enum TotemSampicConstant }; - -uint8_t grayToBinary_8bit( const uint8_t &gcode_data ) +template +T grayToBinary( const T& gcode_data ) { - //b[0] = g[0] - uint8_t binary_byte = gcode_data & 0x80; // MSB is the same + //b[0] = g[0] + T binary = gcode_data & ( 0x0001 << ( 8*sizeof(T) - 1 ) ); // MSB is the same //b[i] = g[i] xor b[i-1] - binary_byte |= ( gcode_data ^ ( binary_byte >> 1 ) ) & 0x40; - binary_byte |= ( gcode_data ^ ( binary_byte >> 1 ) ) & 0x20; - binary_byte |= ( gcode_data ^ ( binary_byte >> 1 ) ) & 0x10; - binary_byte |= ( gcode_data ^ ( binary_byte >> 1 ) ) & 0x08; - binary_byte |= ( gcode_data ^ ( binary_byte >> 1 ) ) & 0x04; - binary_byte |= ( gcode_data ^ ( binary_byte >> 1 ) ) & 0x02; - binary_byte |= ( gcode_data ^ ( binary_byte >> 1 ) ) & 0x01; - - return binary_byte; + for (unsigned short int i = 1; i < 8*sizeof(T); ++i) + binary |= ( gcode_data ^ ( binary >> 1 ) ) & (0x0001 << ( 8*sizeof(T) - i - 1 ) ); + + return binary; } /** @@ -131,11 +126,11 @@ class TotemSampicFrame << "\nChannel:\nHardwareId:\t" << std::hex << (unsigned int) getHardwareId() << "\nFPGATimestamp:\t" << std::dec << getFPGATimestamp() << "\nTimestampA:\t" << std::dec << getTimestampA() - << "\nTimestampA:\t" << std::dec << getTimestampA() + << "\nTimestampB:\t" << std::dec << getTimestampB() << "\nCellInfo:\t" << std::dec << getCellInfo() << "\nPlane:\t" << std::dec << getDetPlane() << "\nChannel:\t" << std::dec << getDetChannel() - << "\\nPLL Info:\t" << bitsPLLInfo.to_string() + << "\nPLL Info:\t" << bitsPLLInfo.to_string() << std::endl << std::endl; } @@ -159,18 +154,18 @@ class TotemSampicFrame uint16_t tmp = 0; if ( status_ ) { for ( unsigned short i = 0; i < TotemSampicConstant::timestampA_Size; ++i ) - tmp += grayToBinary_8bit( totemSampicInfoPtr_[ TotemSampicConstant::timestampA_Position + i ] ) << 8*i; + tmp |= ( totemSampicInfoPtr_[ TotemSampicConstant::timestampA_Position + i ] ) << 8*i; } - return tmp; + return grayToBinary ( tmp ); } inline uint16_t getTimestampB() const { uint16_t tmp = 0; if ( status_ ) { for ( unsigned short i = 0; i < TotemSampicConstant::timestampB_Size; ++i ) - tmp += grayToBinary_8bit( totemSampicInfoPtr_[ TotemSampicConstant::timestampB_Position + i ] ) << 8*i; + tmp |= ( totemSampicInfoPtr_[ TotemSampicConstant::timestampB_Position + i ] ) << 8*i; } - return tmp; + return grayToBinary ( tmp ); } inline uint16_t getCellInfo() const { @@ -198,7 +193,8 @@ class TotemSampicFrame std::vector samples; if ( status_ ) { samples.assign( totemSampicDataPtr_, totemSampicDataPtr_ + TotemSampicConstant::numberOfSamples ); - std::for_each( samples.begin(), samples.end(), &grayToBinary_8bit ); + for ( auto it = samples.begin(); it != samples.end(); ++it ) + *it = grayToBinary( *it ); } return samples; } From 4f520f77fe6498d318a777c3d3bcc93b9a2e87fe Mon Sep 17 00:00:00 2001 From: Leonard Apanasevich Date: Sat, 7 Apr 2018 11:10:16 -0500 Subject: [PATCH 385/426] Add mismatch ratio plots and do some code cleanup --- DQM/L1TMonitor/interface/L1TdeStage2uGT.h | 12 ++-- .../python/L1TStage2Emulator_cff.py | 2 + DQM/L1TMonitor/src/L1TdeStage2uGT.cc | 61 ++++++++++------ .../L1TStage2EmulatorMonitorClient_cff.py | 5 +- .../python/L1TStage2uGTEmulatorClient_cff.py | 72 +++++++++++++++++++ .../L1TGlobal/plugins/L1TGlobalProducer.cc | 19 +++-- 6 files changed, 132 insertions(+), 39 deletions(-) create mode 100644 DQM/L1TMonitorClient/python/L1TStage2uGTEmulatorClient_cff.py diff --git a/DQM/L1TMonitor/interface/L1TdeStage2uGT.h b/DQM/L1TMonitor/interface/L1TdeStage2uGT.h index e0fd2b7a479af..11f2b9e34094b 100644 --- a/DQM/L1TMonitor/interface/L1TdeStage2uGT.h +++ b/DQM/L1TMonitor/interface/L1TdeStage2uGT.h @@ -8,14 +8,13 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ServiceRegistry/interface/Service.h" +// #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Framework/interface/ESHandle.h" @@ -25,7 +24,7 @@ #include "DQMServices/Core/interface/DQMEDAnalyzer.h" #include "DataFormats/L1TGlobal/interface/GlobalAlgBlk.h" -#include "DataFormats/Provenance/interface/EventAuxiliary.h" +// #include "DataFormats/Provenance/interface/EventAuxiliary.h" #include "CondFormats/RunInfo/interface/RunInfo.h" #include "CondFormats/DataRecord/interface/RunSummaryRcd.h" @@ -60,15 +59,16 @@ class L1TdeStage2uGT : public DQMEDAnalyzer { std::string histFolder_; L1TGlobalUtil* gtUtil_; int numLS_; + uint m_currentLumi; int firstBx, lastBx; - std::map m_HistNamesInitial, m_HistNamesFinal, m_SummaryHistograms; + std::map m_HistNamesInitial, m_HistNamesFinal, m_SummaryHistograms; MonitorElement* initDecisionMismatches_vs_LS; MonitorElement* finalDecisionMismatches_vs_LS; + MonitorElement* m_normalizationHisto; enum SummaryColumn { - Nevt, NInitalMismatchDataNoEmul, NInitalMismatchEmulNoData, NFinalMismatchDataNoEmul, @@ -76,7 +76,7 @@ class L1TdeStage2uGT : public DQMEDAnalyzer { NSummaryColumns, }; - void fillHist(const std::map&, const TString&, const Double_t& , const Double_t&); + void fillHist(const std::map&, const std::string&, const Double_t& , const Double_t&); }; #endif diff --git a/DQM/L1TMonitor/python/L1TStage2Emulator_cff.py b/DQM/L1TMonitor/python/L1TStage2Emulator_cff.py index 86d52bc332f23..df2cff83272b2 100644 --- a/DQM/L1TMonitor/python/L1TStage2Emulator_cff.py +++ b/DQM/L1TMonitor/python/L1TStage2Emulator_cff.py @@ -63,6 +63,8 @@ valGtStage2Digis.AlgorithmTriggersUnprescaled = cms.bool(False) valGtStage2Digis.EmulateBxInEvent = cms.int32(5) valGtStage2Digis.PrescaleSet = cms.uint32(7) +valGtStage2Digis.GetPrescaleColumnFromData = cms.bool(True) +valGtStage2Digis.AlgoBlkInputTag = cms.InputTag("gtStage2Digis") Stage2L1HardwareValidation = cms.Sequence( valCaloStage2Layer1Digis + diff --git a/DQM/L1TMonitor/src/L1TdeStage2uGT.cc b/DQM/L1TMonitor/src/L1TdeStage2uGT.cc index 6ba68dc65c5d8..aef5edfbeae92 100644 --- a/DQM/L1TMonitor/src/L1TdeStage2uGT.cc +++ b/DQM/L1TMonitor/src/L1TdeStage2uGT.cc @@ -15,7 +15,8 @@ L1TdeStage2uGT::L1TdeStage2uGT(const edm::ParameterSet & ps) : numBx_(ps.getParameter("numBxToMonitor")), histFolder_(ps.getParameter("histFolder")), gtUtil_(new l1t::L1TGlobalUtil(ps, consumesCollector(), *this, ps.getParameter("dataSource"), ps.getParameter("dataSource"))), - numLS_(2000) + numLS_(2000), + m_currentLumi(0) { if (numBx_ >5 ) numBx_ = 5; @@ -45,20 +46,24 @@ void L1TdeStage2uGT::dqmBeginRun(const edm::Run& iRun, const edm::EventSetup& ev void L1TdeStage2uGT::analyze(const edm::Event & event, const edm::EventSetup & es) { - edm::Handle dataCollection; - event.getByToken(dataSource_, dataCollection); - edm::Handle emulCollection; - event.getByToken(emulSource_, emulCollection); - - gtUtil_->retrieveL1(event,es,dataSource_); + edm::Handle dataCollection; + event.getByToken(dataSource_, dataCollection); + edm::Handle emulCollection; + event.getByToken(emulSource_, emulCollection); if (!dataCollection.isValid()) { - edm::LogInfo("L1TdeStage2uGT") << "Cannot find unpacked uGT readout record."; - return; + edm::LogError("L1TdeStage2uGT") << "Cannot find unpacked uGT readout record."; + return; } if (!emulCollection.isValid()) { - edm::LogInfo("L1TdeStage2uGT") << "Cannot find emulated uGT readout record."; - return; + edm::LogError("L1TdeStage2uGT") << "Cannot find emulated uGT readout record."; + return; + } + + // Only using gtUtil to find prescale factors and mapping of bits to names, so only call gtUtil_ at lumi boundaries. + if (m_currentLumi != event.luminosityBlock()){ + m_currentLumi=event.luminosityBlock(); + gtUtil_->retrieveL1(event,es,dataSource_); } // Get standard event parameters @@ -74,6 +79,10 @@ void L1TdeStage2uGT::analyze(const edm::Event & event, const edm::EventSetup & e if (dataCollection->getFirstBX() > firstBx) firstBx = dataCollection->getFirstBX(); if (dataCollection->getLastBX() < lastBx) lastBx = dataCollection->getLastBX(); + m_normalizationHisto -> Fill(float(NInitalMismatchDataNoEmul)); + m_normalizationHisto -> Fill(float(NInitalMismatchEmulNoData)); + m_normalizationHisto -> Fill(float(NFinalMismatchDataNoEmul)); + m_normalizationHisto -> Fill(float(NFinalMismatchEmulNoData)); for (int ibx = firstBx; ibx <= lastBx; ++ibx) { @@ -83,25 +92,24 @@ void L1TdeStage2uGT::analyze(const edm::Event & event, const edm::EventSetup & e }else{ bxt << "BX" << ibx; } - TString hname, hsummary; + std::string hname, hsummary; float wt; hsummary="dataEmulSummary_" + bxt.str(); - fillHist(m_SummaryHistograms, hsummary, float(Nevt),1.); std::vector::const_iterator it_data, it_emul; for (it_data = dataCollection->begin(ibx), it_emul = emulCollection->begin(ibx); it_data != dataCollection->end(ibx) && it_emul != emulCollection->end(ibx); ++it_data, ++it_emul) { + // Fills algorithm bits histograms int numAlgs= it_data->getAlgoDecisionInitial().size(); for(int algoBit = 0; algoBit < numAlgs; ++algoBit) { string algoName = "xxx"; bool found=gtUtil_->getAlgNameFromBit(algoBit,algoName); - if (not found) algoName="NULL"; - if (algoName == "NULL") continue; + if (not found) continue; // skip bits which emulator does not handle (only skiped for bx !=0) bool isBlackListed(false); @@ -140,7 +148,7 @@ void L1TdeStage2uGT::analyze(const edm::Event & event, const edm::EventSetup & e int prescale = -999; bool dummy=gtUtil_->getPrescaleByBit(algoBit,prescale); if (not dummy) - edm::LogError("L1TdeStage2uGT") << "Could not find prescale value for algobit: " << algoBit << std::endl; + edm::LogWarning("L1TdeStage2uGT") << "Could not find prescale value for algobit: " << algoBit << std::endl; if (prescale != 1) unprescaled=false; @@ -200,12 +208,21 @@ void L1TdeStage2uGT::bookHistograms(DQMStore::IBooker &ibooker, const edm::Run& htitle = "uGT Data/Emulator Mismatches --" + bxn.str(); m_SummaryHistograms[hname] = ibooker.book1D(hname, htitle, NSummaryColumns, 0., double(NSummaryColumns)); m_SummaryHistograms[hname]->getTH1F()->GetYaxis()->SetTitle("Events"); - m_SummaryHistograms[hname]->getTH1F()->GetXaxis()->SetBinLabel(1+Nevt, "Events processed"); m_SummaryHistograms[hname]->getTH1F()->GetXaxis()->SetBinLabel(1+NInitalMismatchDataNoEmul, "Data, NoEmul -- Initial Decisions"); m_SummaryHistograms[hname]->getTH1F()->GetXaxis()->SetBinLabel(1+NInitalMismatchEmulNoData, "Emulator, No Data -- Initial Decisions"); m_SummaryHistograms[hname]->getTH1F()->GetXaxis()->SetBinLabel(1+NFinalMismatchDataNoEmul, "Data, NoEmul -- Final Decisions"); m_SummaryHistograms[hname]->getTH1F()->GetXaxis()->SetBinLabel(1+NFinalMismatchEmulNoData, "Emulator, No Data -- Final Decisions"); + if (i == 0){ + hname="normalizationHisto"; + htitle="Normalization histogram for uGT Data/Emulator Mismatches ratios"; + m_normalizationHisto = ibooker.book1D(hname, htitle, NSummaryColumns, 0., double(NSummaryColumns)); + m_normalizationHisto->getTH1F()->GetYaxis()->SetTitle("Events"); + m_normalizationHisto->getTH1F()->GetXaxis()->SetBinLabel(1+NInitalMismatchDataNoEmul, "Data, NoEmul -- Initial Decisions"); + m_normalizationHisto->getTH1F()->GetXaxis()->SetBinLabel(1+NInitalMismatchEmulNoData, "Emulator, No Data -- Initial Decisions"); + m_normalizationHisto->getTH1F()->GetXaxis()->SetBinLabel(1+NFinalMismatchDataNoEmul, "Data, NoEmul -- Final Decisions"); + m_normalizationHisto->getTH1F()->GetXaxis()->SetBinLabel(1+NFinalMismatchEmulNoData, "Emulator, No Data -- Final Decisions"); + } // book initial decisions histograms ibooker.setCurrentFolder(histFolder_+"/InitialDecisionMismatches"); @@ -239,7 +256,7 @@ void L1TdeStage2uGT::bookHistograms(DQMStore::IBooker &ibooker, const edm::Run& } // Set some histogram attributes - for (std::map::iterator it = m_HistNamesInitial.begin(); it != m_HistNamesInitial.end(); ++it) { + for (std::map::iterator it = m_HistNamesInitial.begin(); it != m_HistNamesInitial.end(); ++it) { // for (unsigned int i = 0; i < prescales.size(); i++) { // auto const& name = prescales.at(i).first; // if (name != "NULL") @@ -249,7 +266,7 @@ void L1TdeStage2uGT::bookHistograms(DQMStore::IBooker &ibooker, const edm::Run& (*it).second->getTH1F()->GetYaxis()->SetTitle("Events with Initial Decision Mismatch"); } - for (std::map::iterator it = m_HistNamesFinal.begin(); it != m_HistNamesFinal.end(); ++it) { + for (std::map::iterator it = m_HistNamesFinal.begin(); it != m_HistNamesFinal.end(); ++it) { // for (unsigned int i = 0; i < prescales.size(); i++) { // auto const& name = prescales.at(i).first; // if (name != "NULL") @@ -262,12 +279,12 @@ void L1TdeStage2uGT::bookHistograms(DQMStore::IBooker &ibooker, const edm::Run& } -void L1TdeStage2uGT::fillHist(const std::map& m_HistNames, const TString& histName, const Double_t& value, const Double_t& wt=1.){ +void L1TdeStage2uGT::fillHist(const std::map& m_HistNames, const std::string& histName, const Double_t& value, const Double_t& wt=1.){ - std::map::const_iterator hid = m_HistNames.find(histName); + std::map::const_iterator hid = m_HistNames.find(histName); if (hid==m_HistNames.end()) - edm::LogError("L1TdeStage2uGT") << "%fillHist -- Could not find histogram with name: " << histName << std::endl; + edm::LogWarning("L1TdeStage2uGT") << "%fillHist -- Could not find histogram with name: " << histName << std::endl; else hid->second->Fill(value,wt); } diff --git a/DQM/L1TMonitorClient/python/L1TStage2EmulatorMonitorClient_cff.py b/DQM/L1TMonitorClient/python/L1TStage2EmulatorMonitorClient_cff.py index e03ce52326671..b4bf6fa938b8a 100644 --- a/DQM/L1TMonitorClient/python/L1TStage2EmulatorMonitorClient_cff.py +++ b/DQM/L1TMonitorClient/python/L1TStage2EmulatorMonitorClient_cff.py @@ -35,6 +35,8 @@ # L1 emulator event info DQM client from DQM.L1TMonitorClient.L1TStage2EmulatorEventInfoClient_cfi import * +## uGT emulator client +from DQM.L1TMonitorClient.L1TStage2uGTEmulatorClient_cff import * # # define sequences @@ -48,7 +50,8 @@ + l1tStage2BMTFEmulatorClient + l1tStage2OMTFEmulatorClient + l1tStage2EMTFEmulatorClient - + l1tStage2EmulatorEventInfoClient + + l1tStage2EmulatorEventInfoClient + + l1tStage2uGTEmulatorClient ) l1tStage2EmulatorMonitorClient = cms.Sequence( diff --git a/DQM/L1TMonitorClient/python/L1TStage2uGTEmulatorClient_cff.py b/DQM/L1TMonitorClient/python/L1TStage2uGTEmulatorClient_cff.py new file mode 100644 index 0000000000000..363819cefe0cc --- /dev/null +++ b/DQM/L1TMonitorClient/python/L1TStage2uGTEmulatorClient_cff.py @@ -0,0 +1,72 @@ +import FWCore.ParameterSet.Config as cms +from DQMServices.Core.DQMEDHarvester import DQMEDHarvester +from DQM.L1TMonitor.L1TdeStage2uGMT_cff import ignoreBins + +# directories +ugmtEmuDqmDir = "L1TEMU/L1TdeStage2uGT" + + +BX = 'CentralBX' +errHistNumStr = 'dataEmulSummary_' + BX +errHistDenStr = 'normalizationHisto' +ratioHistStr = 'dataEmulMismatchRatio_' + BX + +l1tStage2uGTEmulatorCompRatioClientBX0 = DQMEDHarvester("L1TStage2RatioClient", + monitorDir = cms.untracked.string(ugmtEmuDqmDir), + inputNum = cms.untracked.string(ugmtEmuDqmDir+'/'+errHistNumStr), + inputDen = cms.untracked.string(ugmtEmuDqmDir+'/'+errHistDenStr), + ratioName = cms.untracked.string(ratioHistStr), + ratioTitle = cms.untracked.string('Summary of mismatch rates between uGT emulator and data'), + yAxisTitle = cms.untracked.string('# mismatch / # total'), + binomialErr = cms.untracked.bool(True) +) + +l1tStage2uGTEmulatorCompRatioClientBXP1 = l1tStage2uGTEmulatorCompRatioClientBX0.clone() +l1tStage2uGTEmulatorCompRatioClientBXP2 = l1tStage2uGTEmulatorCompRatioClientBX0.clone() +l1tStage2uGTEmulatorCompRatioClientBXM1 = l1tStage2uGTEmulatorCompRatioClientBX0.clone() +l1tStage2uGTEmulatorCompRatioClientBXM2 = l1tStage2uGTEmulatorCompRatioClientBX0.clone() + + +BX = 'BX1' +errHistNumStr = 'dataEmulSummary_' + BX +errHistDenStr = 'normalizationHisto' +ratioHistStr = 'dataEmulMismatchRatio_' + BX +l1tStage2uGTEmulatorCompRatioClientBXP1.inputNum = cms.untracked.string(ugmtEmuDqmDir+'/'+errHistNumStr) +l1tStage2uGTEmulatorCompRatioClientBXP1.inputDen = cms.untracked.string(ugmtEmuDqmDir+'/'+errHistDenStr) +l1tStage2uGTEmulatorCompRatioClientBXP1.ratioName = cms.untracked.string(ratioHistStr) + +BX = 'BX2' +errHistNumStr = 'dataEmulSummary_' + BX +errHistDenStr = 'normalizationHisto' +ratioHistStr = 'dataEmulMismatchRatio_' + BX +l1tStage2uGTEmulatorCompRatioClientBXP2.inputNum = cms.untracked.string(ugmtEmuDqmDir+'/'+errHistNumStr) +l1tStage2uGTEmulatorCompRatioClientBXP2.inputDen = cms.untracked.string(ugmtEmuDqmDir+'/'+errHistDenStr) +l1tStage2uGTEmulatorCompRatioClientBXP2.ratioName = cms.untracked.string(ratioHistStr) + +BX = 'BX-1' +errHistNumStr = 'dataEmulSummary_' + BX +errHistDenStr = 'normalizationHisto' +ratioHistStr = 'dataEmulMismatchRatio_' + BX +l1tStage2uGTEmulatorCompRatioClientBXM1.inputNum = cms.untracked.string(ugmtEmuDqmDir+'/'+errHistNumStr) +l1tStage2uGTEmulatorCompRatioClientBXM1.inputDen = cms.untracked.string(ugmtEmuDqmDir+'/'+errHistDenStr) +l1tStage2uGTEmulatorCompRatioClientBXM1.ratioName = cms.untracked.string(ratioHistStr) + +BX = 'BX-2' +errHistNumStr = 'dataEmulSummary_' + BX +errHistDenStr = 'normalizationHisto' +ratioHistStr = 'dataEmulMismatchRatio_' + BX +l1tStage2uGTEmulatorCompRatioClientBXM2.inputNum = cms.untracked.string(ugmtEmuDqmDir+'/'+errHistNumStr) +l1tStage2uGTEmulatorCompRatioClientBXM2.inputDen = cms.untracked.string(ugmtEmuDqmDir+'/'+errHistDenStr) +l1tStage2uGTEmulatorCompRatioClientBXM2.ratioName = cms.untracked.string(ratioHistStr) + +# uGT + +# sequences +l1tStage2uGTEmulatorClient = cms.Sequence( + l1tStage2uGTEmulatorCompRatioClientBX0 + + l1tStage2uGTEmulatorCompRatioClientBXP1 + + l1tStage2uGTEmulatorCompRatioClientBXP2 + + l1tStage2uGTEmulatorCompRatioClientBXM1 + + l1tStage2uGTEmulatorCompRatioClientBXM2 +) + diff --git a/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.cc b/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.cc index fdc2e531b5e09..e8b166f78b7f6 100644 --- a/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.cc +++ b/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.cc @@ -104,13 +104,14 @@ L1TGlobalProducer::L1TGlobalProducer(const edm::ParameterSet& parSet) : m_algoblkInputTag(parSet.getParameter("AlgoBlkInputTag")) { - m_egInputToken = consumes > (m_egInputTag); - m_tauInputToken = consumes > (m_tauInputTag); - m_jetInputToken = consumes > (m_jetInputTag); - m_sumInputToken = consumes > (m_sumInputTag); - m_muInputToken = consumes > (m_muInputTag); - m_extInputToken = consumes > (m_extInputTag); - m_algoblkInputToken = consumes > (m_algoblkInputTag); + m_egInputToken = consumes > (m_egInputTag); + m_tauInputToken = consumes > (m_tauInputTag); + m_jetInputToken = consumes > (m_jetInputTag); + m_sumInputToken = consumes > (m_sumInputTag); + m_muInputToken = consumes > (m_muInputTag); + m_extInputToken = consumes > (m_extInputTag); + if (m_getPrescaleColumnFromData) + m_algoblkInputToken = consumes > (m_algoblkInputTag); if (m_verbosity) { @@ -404,7 +405,6 @@ void L1TGlobalProducer::produce(edm::Event& iEvent, const edm::EventSetup& evSet } if (m_getPrescaleColumnFromData && (m_currentLumi != iEvent.luminosityBlock()) ){ // get prescale column from unpacked data - std::cout << "CCLA L1TGlobalProducer -- Lumi Block Changed: " << m_currentLumi << "\t" << iEvent.luminosityBlock() << std::endl; m_currentLumi=iEvent.luminosityBlock(); edm::Handle> m_uGtAlgBlk; @@ -413,10 +413,9 @@ void L1TGlobalProducer::produce(edm::Event& iEvent, const edm::EventSetup& evSet if(m_uGtAlgBlk.isValid()) { std::vector::const_iterator algBlk = m_uGtAlgBlk->begin(0); m_prescaleSet=static_cast(algBlk->getPreScColumn()); - std::cout << "CCLA L1TGlobalProducer -- Getting prescale column from algoblk " << m_prescaleSet << std::endl; }else{ m_prescaleSet=1; - std::cout << "CCLA L1TGlobalProducer -- Could not find valid algo block. Setting prescale column to 1" << std::endl; + edm::LogError("L1TGlobalProduce") << "Could not find valid algo block. Setting prescale column to 1" << std::endl; } } } From da24e80d79be31c90fb5ac45ab4f01ef13c281dd Mon Sep 17 00:00:00 2001 From: Leonard Apanasevich Date: Sat, 7 Apr 2018 11:25:29 -0500 Subject: [PATCH 386/426] Remove a couple of unnecessary couts --- L1Trigger/L1TGlobal/src/GlobalBoard.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/L1Trigger/L1TGlobal/src/GlobalBoard.cc b/L1Trigger/L1TGlobal/src/GlobalBoard.cc index 1220695533b26..ae886eee51f9a 100644 --- a/L1Trigger/L1TGlobal/src/GlobalBoard.cc +++ b/L1Trigger/L1TGlobal/src/GlobalBoard.cc @@ -959,12 +959,10 @@ void l1t::GlobalBoard::runFDL(edm::Event& iEvent, } m_firstEv = false; m_currentLumi=iEvent.luminosityBlock(); - std::cout << "CCLA GlobalBoard -- First event. Lumi block: " << iEvent.luminosityBlock() << std::endl; } - // TODO FIXME find the beginning of the luminosity segment + // update and clear prescales at the beginning of the luminosity segment if( m_firstEvLumiSegment || m_currentLumi != iEvent.luminosityBlock() ){ - std::cout << "CCLA GlobalBoard -- New Lumi Segment: " << iEvent.luminosityBlock() << std::endl; m_prescaleCounterAlgoTrig.clear(); for( int iBxInEvent = 0; iBxInEvent <= totalBxInEvent; ++iBxInEvent ){ From fe930671f003a8587dd5a7ff7ac4faab264e5430 Mon Sep 17 00:00:00 2001 From: Leonard Apanasevich Date: Sat, 7 Apr 2018 12:50:04 -0500 Subject: [PATCH 387/426] Add option to use prescale column from unpacked GlobalAlgBlk in emulator --- L1Trigger/L1TGlobal/python/simGtStage2Digis_cfi.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/L1Trigger/L1TGlobal/python/simGtStage2Digis_cfi.py b/L1Trigger/L1TGlobal/python/simGtStage2Digis_cfi.py index 635d8d2be682c..a765f9b3ec85d 100644 --- a/L1Trigger/L1TGlobal/python/simGtStage2Digis_cfi.py +++ b/L1Trigger/L1TGlobal/python/simGtStage2Digis_cfi.py @@ -16,6 +16,8 @@ EtSumInputTag = cms.InputTag("simCaloStage2Digis"), AlgorithmTriggersUnmasked = cms.bool(True), AlgorithmTriggersUnprescaled = cms.bool(True), + GetPrescaleColumnFromData = cms.bool(False), + AlgoBlkInputTag = cms.InputTag("gtStage2Digis") # deprecated in Mike's version of producer: #ProduceL1GtDaqRecord = cms.bool(True), #GmtInputTag = cms.InputTag("gtInput"), From 7d9a347ac6039bd2fef4f23b5ac9c5994cb49105 Mon Sep 17 00:00:00 2001 From: Leonard Apanasevich Date: Sat, 7 Apr 2018 15:31:18 -0500 Subject: [PATCH 388/426] revert cfg back to original state --- .../clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/DQM/Integration/python/clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py index f32fd8acc0008..81d7cda19c822 100644 --- a/DQM/Integration/python/clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py @@ -140,9 +140,6 @@ process.gtStage2Digis.InputLabel = cms.InputTag("rawDataRepacker") process.selfFatEventFilter.rawInput = cms.InputTag("rawDataRepacker") -process.valGtStage2Digis.EmulateBxInEvent = cms.int32(5) -process.valGtStage2Digis.PrescaleSet = cms.uint32(7) - #-------------------------------------------------- # L1T Emulator Online DQM Schedule From 8f2de67fecaf30e4be450beed1218436853f1ef1 Mon Sep 17 00:00:00 2001 From: Silvio Donato Date: Sun, 8 Apr 2018 17:00:47 +0200 Subject: [PATCH 389/426] Fix HLT DQM online crash --- .../python/clients/hlt_dqm_sourceclient-live_cfg.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/DQM/Integration/python/clients/hlt_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/hlt_dqm_sourceclient-live_cfg.py index dfd1c78c14049..6f6c4f74fe210 100644 --- a/DQM/Integration/python/clients/hlt_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/hlt_dqm_sourceclient-live_cfg.py @@ -22,6 +22,12 @@ process.load("Configuration.StandardSequences.GeometryRecoDB_cff") process.load("Configuration.StandardSequences.MagneticField_cff") process.GlobalTrackingGeometryESProducer = cms.ESProducer( "GlobalTrackingGeometryESProducer" ) # for muon hlt dqm +process.ClusterShapeHitFilterESProducer = cms.ESProducer( "ClusterShapeHitFilterESProducer", + ComponentName = cms.string( "ClusterShapeHitFilter" ), + PixelShapeFileL1 = cms.string( "RecoPixelVertexing/PixelLowPtUtilities/data/pixelShapePhase1_loose.par" ), + clusterChargeCut = cms.PSet( refToPSet_ = cms.string( "HLTSiStripClusterChargeCutNone" ) ), + PixelShapeFile = cms.string( "RecoPixelVertexing/PixelLowPtUtilities/data/pixelShapePhase1_noL1.par" ) +) #SiStrip Local Reco process.load("CalibTracker.SiStripCommon.TkDetMap_cff") From a3deb436e7c25156957ed375f26110846c66d9dc Mon Sep 17 00:00:00 2001 From: threus Date: Sun, 8 Apr 2018 18:57:37 +0200 Subject: [PATCH 390/426] remove eventAutoFlushCompressedSize --- .../python/clients/visualization-live-secondInstance_cfg.py | 1 - DQM/Integration/python/clients/visualization-live_cfg.py | 1 - 2 files changed, 2 deletions(-) diff --git a/DQM/Integration/python/clients/visualization-live-secondInstance_cfg.py b/DQM/Integration/python/clients/visualization-live-secondInstance_cfg.py index ee354984be30b..80fd32375beb7 100644 --- a/DQM/Integration/python/clients/visualization-live-secondInstance_cfg.py +++ b/DQM/Integration/python/clients/visualization-live-secondInstance_cfg.py @@ -74,7 +74,6 @@ process.FEVToutput = cms.OutputModule("JsonWritingTimeoutPoolOutputModule", splitLevel = oldo.splitLevel, - eventAutoFlushCompressedSize = oldo.eventAutoFlushCompressedSize, outputCommands = oldo.outputCommands, fileName = oldo.fileName, dataset = oldo.dataset, diff --git a/DQM/Integration/python/clients/visualization-live_cfg.py b/DQM/Integration/python/clients/visualization-live_cfg.py index 665a6d453bb66..a531379fc563a 100644 --- a/DQM/Integration/python/clients/visualization-live_cfg.py +++ b/DQM/Integration/python/clients/visualization-live_cfg.py @@ -74,7 +74,6 @@ process.FEVToutput = cms.OutputModule("JsonWritingTimeoutPoolOutputModule", splitLevel = oldo.splitLevel, - eventAutoFlushCompressedSize = oldo.eventAutoFlushCompressedSize, outputCommands = oldo.outputCommands, fileName = oldo.fileName, dataset = oldo.dataset, From d0db8b733c08faf313eaabcb85566b8cd6796301 Mon Sep 17 00:00:00 2001 From: Andrea Date: Sun, 8 Apr 2018 07:52:14 +0200 Subject: [PATCH 391/426] add deep flavour of MiniAOD v2 to nanoaod --- PhysicsTools/NanoAOD/python/jets_cff.py | 1 + 1 file changed, 1 insertion(+) diff --git a/PhysicsTools/NanoAOD/python/jets_cff.py b/PhysicsTools/NanoAOD/python/jets_cff.py index 19d133fd71090..fb7e550a0de3c 100644 --- a/PhysicsTools/NanoAOD/python/jets_cff.py +++ b/PhysicsTools/NanoAOD/python/jets_cff.py @@ -156,6 +156,7 @@ nElectrons = Var("?hasOverlaps('electrons')?overlaps('electrons').size():0", int, doc="number of electrons in the jet"), btagCMVA = Var("bDiscriminator('pfCombinedMVAV2BJetTags')",float,doc="CMVA V2 btag discriminator",precision=10), btagDeepB = Var("bDiscriminator('pfDeepCSVJetTags:probb')+bDiscriminator('pfDeepCSVJetTags:probbb')",float,doc="DeepCSV b+bb tag discriminator",precision=10), + btagDeepFlavB = Var("bDiscriminator('pfDeepFlavourJetTags:probb')+bDiscriminator('pfDeepFlavourJetTags:probbb')",float,doc="DeepFlavour b+bb tag discriminator",precision=10), btagCSVV2 = Var("bDiscriminator('pfCombinedInclusiveSecondaryVertexV2BJetTags')",float,doc=" pfCombinedInclusiveSecondaryVertexV2 b-tag discriminator (aka CSVV2)",precision=10), btagDeepC = Var("bDiscriminator('pfDeepCSVJetTags:probc')",float,doc="DeepCSV charm btag discriminator",precision=10), #puIdDisc = Var("userFloat('pileupJetId:fullDiscriminant')",float,doc="Pilup ID discriminant",precision=10), From 93c377ea1ac5881cc749efa71f06a9aba3cbebbc Mon Sep 17 00:00:00 2001 From: vladimir Date: Mon, 9 Apr 2018 03:02:25 +0200 Subject: [PATCH 392/426] protect against station+RP IDs corruption --- DQM/CTPPS/plugins/CTPPSPixelDQMSource.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/DQM/CTPPS/plugins/CTPPSPixelDQMSource.cc b/DQM/CTPPS/plugins/CTPPSPixelDQMSource.cc index c3904d839f203..c7eef77b14ea6 100644 --- a/DQM/CTPPS/plugins/CTPPSPixelDQMSource.cc +++ b/DQM/CTPPS/plugins/CTPPSPixelDQMSource.cc @@ -54,6 +54,8 @@ class CTPPSPixelDQMSource: public DQMEDAnalyzer static constexpr int NROCsMAX = 6; // per plane static constexpr int RPn_first = 3, RPn_last = 4; static constexpr int ADCMax = 256; + static constexpr int StationIDMAX=4; // possible range of ID + static constexpr int RPotsIDMAX=8; // possible range of ID const int hitMultMAX = 300; // tuned const int ClusMultMAX = 10; // tuned @@ -95,8 +97,8 @@ class CTPPSPixelDQMSource: public DQMEDAnalyzer unsigned int rpStatusWord = 0x8008; //220_fr_hr(stn2rp3)+ 210_fr_hr - int RPstatus[NStationMAX][NRPotsMAX]; // symmetric in both arms - int StationStatus[NStationMAX]; // symmetric in both arms + int RPstatus[StationIDMAX][RPotsIDMAX]; // symmetric in both arms + int StationStatus[StationIDMAX]; // symmetric in both arms const int IndexNotValid = 0; int getRPindex(int arm, int station, int rp) { @@ -168,8 +170,13 @@ void CTPPSPixelDQMSource::dqmBeginRun(edm::Run const &run, edm::EventSetup const ROCSizeInX = pixRowMAX/2; // ROC row size in pixels = 80 ROCSizeInY = pixColMAX/3; + for(int stn=0; stn> 1); RPstatus[stn][rp] = rpSts&1; From f99752fb9eb0e435c99e523281a07ffa9d8fe10e Mon Sep 17 00:00:00 2001 From: Leonard Apanasvich Date: Sun, 8 Apr 2018 22:45:31 -0500 Subject: [PATCH 393/426] Update L1TdeStage2uGT_cfi.py Add CDC algos to blacklist --- DQM/L1TMonitor/python/L1TdeStage2uGT_cfi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DQM/L1TMonitor/python/L1TdeStage2uGT_cfi.py b/DQM/L1TMonitor/python/L1TdeStage2uGT_cfi.py index b4739f68af56a..78c6469e9adb4 100644 --- a/DQM/L1TMonitor/python/L1TdeStage2uGT_cfi.py +++ b/DQM/L1TMonitor/python/L1TdeStage2uGT_cfi.py @@ -4,7 +4,7 @@ l1tdeStage2uGT = DQMEDAnalyzer('L1TdeStage2uGT', dataSource = cms.InputTag("gtStage2Digis"), emulSource = cms.InputTag("valGtStage2Digis"), - triggerBlackList = cms.vstring("L1_IsolatedBunch","L1_FirstBunchInTrain","L1_FirstBunchAfterTrain","*3BX"), + triggerBlackList = cms.vstring("L1_IsolatedBunch","L1_FirstBunchInTrain","L1_FirstBunchAfterTrain","*3BX","L1_CDC*"), numBxToMonitor = cms.int32(5), histFolder = cms.string('L1TEMU/L1TdeStage2uGT') ) From 1e4adf5e894faa6e6ea322776a4590f4dab87ad0 Mon Sep 17 00:00:00 2001 From: Silvio Donato Date: Mon, 9 Apr 2018 11:00:45 +0200 Subject: [PATCH 394/426] add a missing parameter --- DQM/Integration/python/clients/hlt_dqm_sourceclient-live_cfg.py | 1 + 1 file changed, 1 insertion(+) diff --git a/DQM/Integration/python/clients/hlt_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/hlt_dqm_sourceclient-live_cfg.py index 6f6c4f74fe210..68d90b5c0fa70 100644 --- a/DQM/Integration/python/clients/hlt_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/hlt_dqm_sourceclient-live_cfg.py @@ -22,6 +22,7 @@ process.load("Configuration.StandardSequences.GeometryRecoDB_cff") process.load("Configuration.StandardSequences.MagneticField_cff") process.GlobalTrackingGeometryESProducer = cms.ESProducer( "GlobalTrackingGeometryESProducer" ) # for muon hlt dqm +process.HLTSiStripClusterChargeCutNone = cms.PSet( value = cms.double( -1.0 ) ) process.ClusterShapeHitFilterESProducer = cms.ESProducer( "ClusterShapeHitFilterESProducer", ComponentName = cms.string( "ClusterShapeHitFilter" ), PixelShapeFileL1 = cms.string( "RecoPixelVertexing/PixelLowPtUtilities/data/pixelShapePhase1_loose.par" ), From 336c8147c2bf1f2bc044fc36cd6f63aca3539866 Mon Sep 17 00:00:00 2001 From: Heiner Tholen Date: Mon, 9 Apr 2018 12:12:47 +0200 Subject: [PATCH 395/426] classes_def with persistent eq false --- JetMETCorrections/Modules/src/classes_def.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/JetMETCorrections/Modules/src/classes_def.xml b/JetMETCorrections/Modules/src/classes_def.xml index 8a6e9d21c4419..f98c7c8a6c1bd 100644 --- a/JetMETCorrections/Modules/src/classes_def.xml +++ b/JetMETCorrections/Modules/src/classes_def.xml @@ -1,3 +1,4 @@ - - \ No newline at end of file + + + From b143d77f9545f5756b9b7c03b8e7d6dce616a5e1 Mon Sep 17 00:00:00 2001 From: lgray Date: Thu, 7 Dec 2017 10:35:34 -0600 Subject: [PATCH 396/426] require vertex to have time to use timing cuts in displaced track seeding --- .../src/TracksClusteringFromDisplacedSeed.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/RecoVertex/AdaptiveVertexFinder/src/TracksClusteringFromDisplacedSeed.cc b/RecoVertex/AdaptiveVertexFinder/src/TracksClusteringFromDisplacedSeed.cc index ad9edfb2464d9..3ce8d2a5ddffd 100644 --- a/RecoVertex/AdaptiveVertexFinder/src/TracksClusteringFromDisplacedSeed.cc +++ b/RecoVertex/AdaptiveVertexFinder/src/TracksClusteringFromDisplacedSeed.cc @@ -42,7 +42,9 @@ std::pair,GlobalPoint> TracksClusteringFromDis GlobalPoint cp(dist.crossingPoint()); double timeSig = 0.; - if( edm::isFinite(seed.timeExt()) && edm::isFinite(tt->timeExt()) ) { // apply only if time available + if( primaryVertex.covariance(3,3) > 0. && + edm::isFinite(seed.timeExt()) && edm::isFinite(tt->timeExt()) ) { + // apply only if time available and being used in vertexing const double tError = std::sqrt( std::pow(seed.dtErrorExt(),2) + std::pow(tt->dtErrorExt(),2) ); timeSig = std::abs( seed.timeExt() - tt->timeExt() ) / tError; } From bc93565dfd3c27642cec61c206d400671b0a10e3 Mon Sep 17 00:00:00 2001 From: lgray Date: Mon, 9 Apr 2018 13:18:07 -0500 Subject: [PATCH 397/426] only calculate SV times if PV has timing info --- .../AdaptiveVertexFinder/interface/TrackVertexArbitration.h | 2 +- .../AdaptiveVertexFinder/plugins/InclusiveVertexFinder.h | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/RecoVertex/AdaptiveVertexFinder/interface/TrackVertexArbitration.h b/RecoVertex/AdaptiveVertexFinder/interface/TrackVertexArbitration.h index 7a78522240027..94572f9374bfb 100644 --- a/RecoVertex/AdaptiveVertexFinder/interface/TrackVertexArbitration.h +++ b/RecoVertex/AdaptiveVertexFinder/interface/TrackVertexArbitration.h @@ -271,7 +271,7 @@ std::vector TrackVertexArbitration::trackVertexArbitrator( singleFitVertex = theAdaptiveFitter.vertex(selTracks,ssv); if(singleFitVertex.isValid()) { - svhelper::updateVertexTime(singleFitVertex); + if( pv.covariance(3,3) > 0. ) svhelper::updateVertexTime(singleFitVertex); recoVertices.push_back(VTX(singleFitVertex)); diff --git a/RecoVertex/AdaptiveVertexFinder/plugins/InclusiveVertexFinder.h b/RecoVertex/AdaptiveVertexFinder/plugins/InclusiveVertexFinder.h index 476f867359dbc..a41c0dccf5257 100644 --- a/RecoVertex/AdaptiveVertexFinder/plugins/InclusiveVertexFinder.h +++ b/RecoVertex/AdaptiveVertexFinder/plugins/InclusiveVertexFinder.h @@ -255,8 +255,10 @@ void TemplatedInclusiveVertexFinder::produce(edm::Event &eve } // for each transient vertex state determine if a time can be measured and fill covariance - for(auto& vtx : vertices) { - svhelper::updateVertexTime(vtx); + if( pv.covariance(3,3) > 0. ) { + for(auto& vtx : vertices) { + svhelper::updateVertexTime(vtx); + } } for(std::vector::const_iterator v = vertices.begin(); From 7226d82a9ebeffd046811cf5d1cd6e2d52418572 Mon Sep 17 00:00:00 2001 From: Andrew Brinkerhoff Date: Tue, 10 Apr 2018 11:20:19 +0200 Subject: [PATCH 398/426] EMTF change to auto loop over TTTriggerPrimitive --- .../src/TTPrimitiveConversion.cc | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/L1Trigger/L1TMuonEndCap/src/TTPrimitiveConversion.cc b/L1Trigger/L1TMuonEndCap/src/TTPrimitiveConversion.cc index c81c729ea9269..5c243a9fed9f6 100644 --- a/L1Trigger/L1TMuonEndCap/src/TTPrimitiveConversion.cc +++ b/L1Trigger/L1TMuonEndCap/src/TTPrimitiveConversion.cc @@ -25,16 +25,11 @@ void TTPrimitiveConversion::process( const std::map& selected_ttprim_map, EMTFHitCollection& conv_hits ) const { - std::map::const_iterator map_tp_it = selected_ttprim_map.begin(); - std::map::const_iterator map_tp_end = selected_ttprim_map.end(); - for (; map_tp_it != map_tp_end; ++map_tp_it) { - TTTriggerPrimitiveCollection::const_iterator tp_it = map_tp_it->second.begin(); - TTTriggerPrimitiveCollection::const_iterator tp_end = map_tp_it->second.end(); - - for (; tp_it != tp_end; ++tp_it) { + for (const auto& map_tp_it : selected_ttprim_map) { + for (const auto& tp_it : map_tp_it.second) { EMTFHit conv_hit; - convert_tt(*tp_it, conv_hit); + convert_tt(tp_it, conv_hit); conv_hits.push_back(conv_hit); } } @@ -44,13 +39,11 @@ void TTPrimitiveConversion::process_no_prim_sel( const TTTriggerPrimitiveCollection& ttmuon_primitives, EMTFHitCollection& conv_hits ) const { - TTTriggerPrimitiveCollection::const_iterator tp_it = ttmuon_primitives.begin(); - TTTriggerPrimitiveCollection::const_iterator tp_end = ttmuon_primitives.end(); - for (; tp_it != tp_end; ++tp_it) { - if (endcap_ == 1 && sector_ == 1 && bx_ == tp_it->getTTData().bx) { //FIXME: stupidly put everything into sector +1, to be fixed. + for (const auto& tp_it : ttmuon_primitives) { + if (endcap_ == 1 && sector_ == 1 && bx_ == tp_it.getTTData().bx) { //FIXME: stupidly put everything into sector +1, to be fixed. EMTFHit conv_hit; - convert_tt(*tp_it, conv_hit); + convert_tt(tp_it, conv_hit); conv_hits.push_back(conv_hit); } } From c1face7d0dc1503fa488c67b151c30c6d63429a3 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Tue, 10 Apr 2018 13:18:24 +0200 Subject: [PATCH 399/426] Correct spelling mistake --- Geometry/HGCalCommonData/interface/HGCalParametersFromDD.h | 2 +- Geometry/HGCalCommonData/src/HGCalParametersFromDD.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Geometry/HGCalCommonData/interface/HGCalParametersFromDD.h b/Geometry/HGCalCommonData/interface/HGCalParametersFromDD.h index 313e3f2debfd9..91d4ecc5fc6e4 100644 --- a/Geometry/HGCalCommonData/interface/HGCalParametersFromDD.h +++ b/Geometry/HGCalCommonData/interface/HGCalParametersFromDD.h @@ -16,7 +16,7 @@ class HGCalParametersFromDD { const std::string&, const std::string&); private: - double getDDDVallue(const char* s, const DDsvalues_type& sv); + double getDDDValue(const char* s, const DDsvalues_type& sv); }; #endif diff --git a/Geometry/HGCalCommonData/src/HGCalParametersFromDD.cc b/Geometry/HGCalCommonData/src/HGCalParametersFromDD.cc index ea9bfc60eace0..31a12c7db4e6c 100644 --- a/Geometry/HGCalCommonData/src/HGCalParametersFromDD.cc +++ b/Geometry/HGCalCommonData/src/HGCalParametersFromDD.cc @@ -133,8 +133,8 @@ bool HGCalParametersFromDD::build(const DDCompactView* cpv, return ok; } -double HGCalParametersFromDD::getDDDVallue(const char* s, - const DDsvalues_type& sv) { +double HGCalParametersFromDD::getDDDValue(const char* s, + const DDsvalues_type& sv) { DDValue val(s); if (DDfetch(&sv, val)) { const std::vector & fvec = val.doubles(); From ade3fbc5e6783391546702e104f0c91f08c9fcf5 Mon Sep 17 00:00:00 2001 From: Luca Date: Tue, 10 Apr 2018 15:30:41 +0200 Subject: [PATCH 400/426] Add PCC, remove TrackAl from PCL --- CondFormats/Common/test/LumiCorrections_prep.json | 9 +++++++++ CondFormats/Common/test/LumiCorrections_prod.json | 9 +++++++++ CondFormats/Common/test/ProduceDropBoxMetadata.py | 14 ++++++++++++-- CondFormats/Common/test/SiPixelAliRcd_prod.json | 4 ++-- 4 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 CondFormats/Common/test/LumiCorrections_prep.json create mode 100644 CondFormats/Common/test/LumiCorrections_prod.json diff --git a/CondFormats/Common/test/LumiCorrections_prep.json b/CondFormats/Common/test/LumiCorrections_prep.json new file mode 100644 index 0000000000000..9b6ee12c2bb7c --- /dev/null +++ b/CondFormats/Common/test/LumiCorrections_prep.json @@ -0,0 +1,9 @@ +{ + "destinationDatabase": "oracle://cms_orcoff_prep/CMS_CONDITIONS", + "destinationTags": { + "LumiPCC_Corrections_prep_prompt": {} + }, + "inputTag": "LumiPCCCorrections_pcl", + "since": null, + "userText": "Tier0 PCL Upload for PCC" +} diff --git a/CondFormats/Common/test/LumiCorrections_prod.json b/CondFormats/Common/test/LumiCorrections_prod.json new file mode 100644 index 0000000000000..38256023f0a78 --- /dev/null +++ b/CondFormats/Common/test/LumiCorrections_prod.json @@ -0,0 +1,9 @@ +{ + "destinationDatabase": "oracle://cms_orcon_prod/CMS_CONDITIONS", + "destinationTags": { + "LumiPCC_Corrections_prompt": {} + }, + "inputTag": "LumiPCCCorrections_pcl", + "since": null, + "userText": "Tier0 PCL Upload for PCC" +} diff --git a/CondFormats/Common/test/ProduceDropBoxMetadata.py b/CondFormats/Common/test/ProduceDropBoxMetadata.py index 4dbfb4e91c5d8..ecf3114244741 100644 --- a/CondFormats/Common/test/ProduceDropBoxMetadata.py +++ b/CondFormats/Common/test/ProduceDropBoxMetadata.py @@ -66,6 +66,10 @@ def encodeJsonInString(filename): EcalPedestalsRcd_prod_str = encodeJsonInString("EcalPedestal_prod.json") EcalPedestalsRcd_prep_str = encodeJsonInString("EcalPedestal_prep.json") +#LumiCorrectionsRcd +LumiCorrectionsRcd_prod_str = encodeJsonInString("LumiCorrections_prod.json") +LumiCorrectionsRcd_prep_str = encodeJsonInString("LumiCorrections_prep.json") + # given a set of .json files in the current dir, ProduceDropBoxMetadata produces a sqlite containign the payload with the prod/and/prep metadata process.mywriter = cms.EDAnalyzer("ProduceDropBoxMetadata", # set to True if you want to write out a sqlite.db translating the json's into a payload @@ -136,13 +140,19 @@ def encodeJsonInString(filename): prodMetaData = cms.untracked.string(EcalPedestalsRcd_prod_str), prepMetaData = cms.untracked.string(EcalPedestalsRcd_prep_str), ), + cms.PSet(record = cms.untracked.string('LumiCorrectionsRcd'), + Source = cms.untracked.string("AlcaHarvesting"), + FileClass = cms.untracked.string("ALCA"), + prodMetaData = cms.untracked.string(LumiCorrectionsRcd_prod_str), + prepMetaData = cms.untracked.string(LumiCorrectionsRcd_prep_str), + ), ), # this boolean will read the content of whichever payload is available and print its content to stoutput # set this to false if you write out a sqlite.db translating the json's into a payload read = cms.untracked.bool(False), # toRead lists of record naemes to be sought inside the DropBoxMetadataRcd payload avaialble to the ProduceDropBoxMetadata; for instance, if write is True, you're reading back the metadata you've just entered in the payload from the .json files - toRead = cms.untracked.vstring('BeamSpotObjectsRcdByRun','BeamSpotObjectsRcdByLumi','BeamSpotObjectsRcdHPByLumi','BeamSpotObjectsRcdHPByRun','SiStripBadStripRcd','SiStripApvGainRcd','TrackerAlignmentRcd','SiStripApvGainRcdAfterAbortGap','SiStripApvGainRcdAAG','EcalPedestalsRcd') # same strings as fType + toRead = cms.untracked.vstring('BeamSpotObjectsRcdByRun','BeamSpotObjectsRcdByLumi','BeamSpotObjectsRcdHPByLumi','BeamSpotObjectsRcdHPByRun','SiStripBadStripRcd','SiStripApvGainRcd','TrackerAlignmentRcd','SiStripApvGainRcdAfterAbortGap','SiStripApvGainRcdAAG','EcalPedestalsRcd',"LumiCorrectionsRcd")# same strings as fType ) process.p = cms.Path(process.mywriter) @@ -150,7 +160,7 @@ def encodeJsonInString(filename): if process.mywriter.write: from CondCore.CondDB.CondDB_cfi import CondDB - CondDB.connect = "sqlite_file:DropBoxMetadata_addHPbyRun_addAAGmulti.db" + CondDB.connect = "sqlite_file:DropBoxMetadata_addLumiCorrections_TrackerAlignmentPCLoff.db" process.PoolDBOutputService = cms.Service("PoolDBOutputService", CondDB, diff --git a/CondFormats/Common/test/SiPixelAliRcd_prod.json b/CondFormats/Common/test/SiPixelAliRcd_prod.json index 7458f05704a93..49307ff5085cc 100644 --- a/CondFormats/Common/test/SiPixelAliRcd_prod.json +++ b/CondFormats/Common/test/SiPixelAliRcd_prod.json @@ -2,9 +2,9 @@ "destinationDatabase": "oracle://cms_orcon_prod/CMS_CONDITIONS", "destinationTags": { "SiPixelAli_PCL_v0_hlt": {}, - "TrackerAlignment_PCL_byRun_v2_express": {} + "TrackerAlignment_PCL_byRun_v1_express": {} }, "inputTag": "SiPixelAli_pcl", "since": null, - "userText": "T0 PCL Upload for SiPixel Ali - moved to the tag consumed by prompt. (prod)" + "userText": "T0 PCL Upload for SiPixel Ali - changed to v1 to not be consumed by prompt. (prod). To be consumed change v1 to v2." } From 99933779dadfe6f4d7bab2060d1e31f61574b5a1 Mon Sep 17 00:00:00 2001 From: Kevin Pedro Date: Tue, 10 Apr 2018 09:55:10 -0500 Subject: [PATCH 401/426] avoid repeating computations by using magic static variables --- .../HcalAlgos/interface/HcalPulseShape.h | 1 + .../HcalAlgos/interface/HcalPulseShapes.h | 36 +++++++++++-- .../HcalAlgos/src/HcalPulseShape.cc | 8 +++ .../HcalAlgos/src/HcalPulseShapes.cc | 51 ++++--------------- 4 files changed, 50 insertions(+), 46 deletions(-) diff --git a/CalibCalorimetry/HcalAlgos/interface/HcalPulseShape.h b/CalibCalorimetry/HcalAlgos/interface/HcalPulseShape.h index 12751a62770b6..a389ad8336167 100644 --- a/CalibCalorimetry/HcalAlgos/interface/HcalPulseShape.h +++ b/CalibCalorimetry/HcalAlgos/interface/HcalPulseShape.h @@ -6,6 +6,7 @@ class HcalPulseShape { public: HcalPulseShape(); + HcalPulseShape(const std::vector&,unsigned); void setNBin(int n); void setShapeBin(int i, float f); float getTpeak() const { return tpeak_; } diff --git a/CalibCalorimetry/HcalAlgos/interface/HcalPulseShapes.h b/CalibCalorimetry/HcalAlgos/interface/HcalPulseShapes.h index 6bfcdb8728a35..a525294972a30 100644 --- a/CalibCalorimetry/HcalAlgos/interface/HcalPulseShapes.h +++ b/CalibCalorimetry/HcalAlgos/interface/HcalPulseShapes.h @@ -65,19 +65,47 @@ class HcalPulseShapes { } return result; } + static std::vector normalize(std::vector nt, unsigned nbin){ + //skip first bin, always 0 + double norm = 0.; + for (unsigned int j = 1; j <= nbin; ++j) { + norm += (nt[j]>0) ? nt[j] : 0.; + } + + double normInv=1./norm; + for (unsigned int j = 1; j <= nbin; ++j) { + nt[j] *= normInv; + } + + return nt; + } + static std::vector normalizeShift(std::vector nt, unsigned nbin, int shift){ + //skip first bin, always 0 + double norm = 0.; + for (unsigned int j = std::max(1,-1*shift); j<=nbin; j++) { + norm += std::max(0., nt[j-shift]); + } + double normInv=1./norm; + std::vector nt2(nbin,0); + for ( int j = 1; j<=(int)nbin; j++) { + if ( j-shift>=0 ) { + nt2[j] = nt[j-shift]*normInv; + } + } + return nt2; + } private: void computeHPDShape(float, float, float, float, float , float, float, float, Shape&); void computeHFShape(); void computeSiPMShapeHO(); - void computeSiPMShapeHE203(); - void computeSiPMShapeHE206(); + const HcalPulseShape& computeSiPMShapeHE203(); + const HcalPulseShape& computeSiPMShapeHE206(); void computeSiPMShapeData2017(); void computeSiPMShapeData2018(); Shape hpdShape_, hfShape_, siPMShapeHO_; - Shape siPMShapeMC2017_, siPMShapeData2017_; - Shape siPMShapeMC2018_, siPMShapeData2018_; + Shape siPMShapeData2017_, siPMShapeData2018_; Shape hpdShape_v2, hpdShapeMC_v2; Shape hpdShape_v3, hpdShapeMC_v3; Shape hpdBV30Shape_v2, hpdBV30ShapeMC_v2; diff --git a/CalibCalorimetry/HcalAlgos/src/HcalPulseShape.cc b/CalibCalorimetry/HcalAlgos/src/HcalPulseShape.cc index 72d21c603c7b0..fd254f9d632b4 100644 --- a/CalibCalorimetry/HcalAlgos/src/HcalPulseShape.cc +++ b/CalibCalorimetry/HcalAlgos/src/HcalPulseShape.cc @@ -5,6 +5,14 @@ HcalPulseShape::HcalPulseShape() { tpeak_=0; } +HcalPulseShape::HcalPulseShape(const std::vector& shape, unsigned nbin) : + shape_(shape.begin(),shape.begin()+nbin), + nbin_(nbin) +{ + tpeak_ = 0; +} + + void HcalPulseShape::setNBin(int n) { nbin_=n; shape_=std::vector(n,0.0f); diff --git a/CalibCalorimetry/HcalAlgos/src/HcalPulseShapes.cc b/CalibCalorimetry/HcalAlgos/src/HcalPulseShapes.cc index 5ca3d9e9f1f0c..1059c4463deb1 100644 --- a/CalibCalorimetry/HcalAlgos/src/HcalPulseShapes.cc +++ b/CalibCalorimetry/HcalAlgos/src/HcalPulseShapes.cc @@ -77,16 +77,14 @@ Reco MC computeHFShape(); computeSiPMShapeHO(); - computeSiPMShapeHE203(); - computeSiPMShapeHE206(); computeSiPMShapeData2017(); computeSiPMShapeData2018(); theShapes[201] = &siPMShapeHO_; theShapes[202] = theShapes[201]; - theShapes[203] = &siPMShapeMC2017_; + theShapes[203] = &(computeSiPMShapeHE203()); theShapes[205] = &siPMShapeData2017_; - theShapes[206] = &siPMShapeMC2018_; + theShapes[206] = &(computeSiPMShapeHE206()); theShapes[207] = &siPMShapeData2018_; theShapes[301] = &hfShape_; //theShapes[401] = new CaloCachedShapeIntegrator(&theZDCShape); @@ -380,50 +378,19 @@ void HcalPulseShapes::computeSiPMShapeHO() } } -void HcalPulseShapes::computeSiPMShapeHE203() +const HcalPulseShape& HcalPulseShapes::computeSiPMShapeHE203() { //numerical convolution of SiPM pulse + WLS fiber shape - std::vector nt = convolve(nBinsSiPM_,analyticPulseShapeSiPMHE,Y11203); - - siPMShapeMC2017_.setNBin(nBinsSiPM_); - - //skip first bin, always 0 - double norm = 0.; - for (unsigned int j = 1; j <= nBinsSiPM_; ++j) { - norm += (nt[j]>0) ? nt[j] : 0.; - } - - for (unsigned int j = 1; j <= nBinsSiPM_; ++j) { - nt[j] /= norm; - siPMShapeMC2017_.setShapeBin(j,nt[j]); - } + static HcalPulseShape siPMShapeMC2017(normalize(convolve(nBinsSiPM_,analyticPulseShapeSiPMHE,Y11203),nBinsSiPM_),nBinsSiPM_); + return siPMShapeMC2017; } -void HcalPulseShapes::computeSiPMShapeHE206() +const HcalPulseShape& HcalPulseShapes::computeSiPMShapeHE206() { //numerical convolution of SiPM pulse + WLS fiber shape - std::vector nt = convolve(nBinsSiPM_,analyticPulseShapeSiPMHE,Y11206); - - siPMShapeMC2018_.setNBin(nBinsSiPM_); - - //Aligning 206 phase closer to 205 in order to have good reco agreement - int shift = -2; - - //skip first bin, always 0 - double norm = 0.; - for (unsigned int j = std::max(1,-1*shift); j<=nBinsSiPM_; j++) { - norm += std::max(0., nt[j-shift]); - } - double normInv=1./norm; - for ( int j = 1; j<=nBinsSiPM_; j++) { - if ( j-shift>=0 ) { - nt[j-shift]*=normInv; - siPMShapeMC2018_.setShapeBin(j,nt[j-shift]); - } - else{ - siPMShapeMC2018_.setShapeBin(j,0); - } - } + //shift: aligning 206 phase closer to 205 in order to have good reco agreement + static HcalPulseShape siPMShapeMC2018(normalizeShift(convolve(nBinsSiPM_,analyticPulseShapeSiPMHE,Y11206),nBinsSiPM_,-2),nBinsSiPM_); + return siPMShapeMC2018; } const HcalPulseShapes::Shape & From 8485669c5d3c227f58e2b5acc16150b9e3fb1782 Mon Sep 17 00:00:00 2001 From: Kevin Pedro Date: Tue, 10 Apr 2018 10:15:07 -0500 Subject: [PATCH 402/426] remove unused member --- CalibCalorimetry/HcalAlgos/interface/HcalPulseShape.h | 2 -- CalibCalorimetry/HcalAlgos/src/HcalPulseShape.cc | 2 -- 2 files changed, 4 deletions(-) diff --git a/CalibCalorimetry/HcalAlgos/interface/HcalPulseShape.h b/CalibCalorimetry/HcalAlgos/interface/HcalPulseShape.h index a389ad8336167..f334b8897ff1a 100644 --- a/CalibCalorimetry/HcalAlgos/interface/HcalPulseShape.h +++ b/CalibCalorimetry/HcalAlgos/interface/HcalPulseShape.h @@ -9,7 +9,6 @@ class HcalPulseShape { HcalPulseShape(const std::vector&,unsigned); void setNBin(int n); void setShapeBin(int i, float f); - float getTpeak() const { return tpeak_; } float operator()(double time) const; float at(double time) const; float integrate(double tmin, double tmax) const; @@ -17,7 +16,6 @@ class HcalPulseShape { private: std::vector shape_; int nbin_; - float tpeak_; }; #endif diff --git a/CalibCalorimetry/HcalAlgos/src/HcalPulseShape.cc b/CalibCalorimetry/HcalAlgos/src/HcalPulseShape.cc index fd254f9d632b4..1cae3776d730a 100644 --- a/CalibCalorimetry/HcalAlgos/src/HcalPulseShape.cc +++ b/CalibCalorimetry/HcalAlgos/src/HcalPulseShape.cc @@ -2,14 +2,12 @@ HcalPulseShape::HcalPulseShape() { nbin_=0; - tpeak_=0; } HcalPulseShape::HcalPulseShape(const std::vector& shape, unsigned nbin) : shape_(shape.begin(),shape.begin()+nbin), nbin_(nbin) { - tpeak_ = 0; } From 0539776a024aba3cca27050f5b1396b963423f8f Mon Sep 17 00:00:00 2001 From: Kevin Pedro Date: Tue, 10 Apr 2018 11:10:10 -0500 Subject: [PATCH 403/426] const --- CalibCalorimetry/HcalAlgos/src/HcalPulseShapes.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CalibCalorimetry/HcalAlgos/src/HcalPulseShapes.cc b/CalibCalorimetry/HcalAlgos/src/HcalPulseShapes.cc index 1059c4463deb1..0a048b34b22bb 100644 --- a/CalibCalorimetry/HcalAlgos/src/HcalPulseShapes.cc +++ b/CalibCalorimetry/HcalAlgos/src/HcalPulseShapes.cc @@ -381,7 +381,7 @@ void HcalPulseShapes::computeSiPMShapeHO() const HcalPulseShape& HcalPulseShapes::computeSiPMShapeHE203() { //numerical convolution of SiPM pulse + WLS fiber shape - static HcalPulseShape siPMShapeMC2017(normalize(convolve(nBinsSiPM_,analyticPulseShapeSiPMHE,Y11203),nBinsSiPM_),nBinsSiPM_); + static const HcalPulseShape siPMShapeMC2017(normalize(convolve(nBinsSiPM_,analyticPulseShapeSiPMHE,Y11203),nBinsSiPM_),nBinsSiPM_); return siPMShapeMC2017; } @@ -389,7 +389,7 @@ const HcalPulseShape& HcalPulseShapes::computeSiPMShapeHE206() { //numerical convolution of SiPM pulse + WLS fiber shape //shift: aligning 206 phase closer to 205 in order to have good reco agreement - static HcalPulseShape siPMShapeMC2018(normalizeShift(convolve(nBinsSiPM_,analyticPulseShapeSiPMHE,Y11206),nBinsSiPM_,-2),nBinsSiPM_); + static const HcalPulseShape siPMShapeMC2018(normalizeShift(convolve(nBinsSiPM_,analyticPulseShapeSiPMHE,Y11206),nBinsSiPM_,-2),nBinsSiPM_); return siPMShapeMC2018; } From 761119591660c033b7e0fbe711bd425d2b6bac03 Mon Sep 17 00:00:00 2001 From: threus Date: Wed, 11 Apr 2018 08:51:04 +0200 Subject: [PATCH 404/426] updated online/express GT --- .../python/config/FrontierCondition_GT_autoExpress_cfi.py | 2 +- DQM/Integration/python/config/FrontierCondition_GT_cfi.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DQM/Integration/python/config/FrontierCondition_GT_autoExpress_cfi.py b/DQM/Integration/python/config/FrontierCondition_GT_autoExpress_cfi.py index b27f926db6a95..f79273188ff41 100644 --- a/DQM/Integration/python/config/FrontierCondition_GT_autoExpress_cfi.py +++ b/DQM/Integration/python/config/FrontierCondition_GT_autoExpress_cfi.py @@ -6,7 +6,7 @@ # It should be kept in synch with Express processing at Tier0: what the url # https://cmsweb.cern.ch/t0wmadatasvc/prod/express_config # would tell you. -GlobalTag.globaltag = "100X_dataRun2_Express_v1" +GlobalTag.globaltag = "101X_dataRun2_Express_v7" # ===== auto -> Automatically get the GT string from current Tier0 configuration via a Tier0Das call. # This needs a valid proxy to access the cern.ch network from the .cms one. diff --git a/DQM/Integration/python/config/FrontierCondition_GT_cfi.py b/DQM/Integration/python/config/FrontierCondition_GT_cfi.py index 48ba0a7b62072..d48d1bb5e4005 100644 --- a/DQM/Integration/python/config/FrontierCondition_GT_cfi.py +++ b/DQM/Integration/python/config/FrontierCondition_GT_cfi.py @@ -1,3 +1,3 @@ import FWCore.ParameterSet.Config as cms from Configuration.StandardSequences.FrontierConditions_GlobalTag_cff import * -GlobalTag.globaltag = "100X_dataRun2_HLT_v3" +GlobalTag.globaltag = "101X_dataRun2_HLT_v7" From 2c41e3609b2ba08c1284c040c3d23afe82667a04 Mon Sep 17 00:00:00 2001 From: Marcel Andre Schneider Date: Wed, 11 Apr 2018 09:37:46 +0200 Subject: [PATCH 405/426] Assume constant size for strings in dqmMemoryStats. This should prevenv the noise in PR comparisons where nothing changed, except for the release name. --- DQMServices/FileIO/scripts/dqmMemoryStats.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/DQMServices/FileIO/scripts/dqmMemoryStats.py b/DQMServices/FileIO/scripts/dqmMemoryStats.py index 7286a5ca78cf1..bd93fe278369f 100755 --- a/DQMServices/FileIO/scripts/dqmMemoryStats.py +++ b/DQMServices/FileIO/scripts/dqmMemoryStats.py @@ -38,7 +38,9 @@ def analyze(self, fn, obj): self._all[fn] = HistogramEntry(t, bin_size, bin_count, extra, total_bytes) else: t = str(type(obj)) - bin_count, bin_size, extra = 0, 0, len(str(obj)) + len(fn) + #bin_count, bin_size, extra = 0, 0, len(str(obj)) + len(fn) + # assume constant size for strings + bin_count, bin_size, extra = 0, 0, 10 + len(fn) total_bytes = bin_count * bin_size + extra self._all[fn] = HistogramEntry(t, bin_size, bin_count, extra, total_bytes) From ed060339a3f6f51090c6c2c57e24aa09d594f1bd Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Fri, 6 Apr 2018 10:28:40 +0200 Subject: [PATCH 406/426] Replace explicit stream-based caching with implicit one Now that MixingModule is a stream producer, there is no need to have explicit stream-based cache for the random number engines in the digitizer algorithms. A simple member variable is enough, and it is safe because framework runs always the same instance of a stream module in a given stream. --- .../CastorSim/plugins/CastorDigiProducer.cc | 12 +++--------- .../CastorSim/plugins/CastorDigiProducer.h | 2 +- .../EcalSimProducers/interface/EcalDigiProducer.h | 2 +- .../EcalSimProducers/src/EcalDigiProducer.cc | 12 +++--------- .../HGCalSimProducers/plugins/HGCDigiProducer.cc | 12 +++--------- .../HGCalSimProducers/plugins/HGCDigiProducer.h | 2 +- .../HcalSimProducers/interface/HcalDigiProducer.h | 2 +- .../HcalSimProducers/src/HcalDigiProducer.cc | 12 +++--------- .../HcalTestBeam/interface/HcalTBDigiProducer.h | 2 +- .../HcalTestBeam/src/HcalTBDigiProducer.cc | 12 +++--------- .../FastTimingCommon/plugins/FTLDigiProducer.cc | 12 +++--------- .../FastTimingCommon/plugins/FTLDigiProducer.h | 2 +- .../SiPixelDigitizer/plugins/SiPixelDigitizer.cc | 12 +++--------- .../SiPixelDigitizer/plugins/SiPixelDigitizer.h | 2 +- .../SiStripDigitizer/plugins/SiStripDigitizer.cc | 12 +++--------- .../SiStripDigitizer/plugins/SiStripDigitizer.h | 2 +- 16 files changed, 32 insertions(+), 80 deletions(-) diff --git a/SimCalorimetry/CastorSim/plugins/CastorDigiProducer.cc b/SimCalorimetry/CastorSim/plugins/CastorDigiProducer.cc index f97f486f5e6e6..4e2f3bbacd54a 100644 --- a/SimCalorimetry/CastorSim/plugins/CastorDigiProducer.cc +++ b/SimCalorimetry/CastorSim/plugins/CastorDigiProducer.cc @@ -164,16 +164,10 @@ void CastorDigiProducer::checkGeometry(const edm::EventSetup & eventSetup) { } CLHEP::HepRandomEngine* CastorDigiProducer::randomEngine(edm::StreamID const& streamID) { - unsigned int index = streamID.value(); - if(index >= randomEngines_.size()) { - randomEngines_.resize(index + 1, nullptr); - } - CLHEP::HepRandomEngine* ptr = randomEngines_[index]; - if(!ptr) { + if(!randomEngine_) { edm::Service rng; - ptr = &rng->getEngine(streamID); - randomEngines_[index] = ptr; + randomEngine_ = &rng->getEngine(streamID); } - return ptr; + return randomEngine_; } diff --git a/SimCalorimetry/CastorSim/plugins/CastorDigiProducer.h b/SimCalorimetry/CastorSim/plugins/CastorDigiProducer.h index 075fca39992ba..92e7b3ccac6ee 100644 --- a/SimCalorimetry/CastorSim/plugins/CastorDigiProducer.h +++ b/SimCalorimetry/CastorSim/plugins/CastorDigiProducer.h @@ -81,7 +81,7 @@ class CastorDigiProducer : public DigiAccumulatorMixMod { std::vector theCastorHits; - std::vector randomEngines_; + CLHEP::HepRandomEngine* randomEngine_ = nullptr; }; #endif diff --git a/SimCalorimetry/EcalSimProducers/interface/EcalDigiProducer.h b/SimCalorimetry/EcalSimProducers/interface/EcalDigiProducer.h index 4b561ce1c61b5..6d1f5dad7d1c1 100644 --- a/SimCalorimetry/EcalSimProducers/interface/EcalDigiProducer.h +++ b/SimCalorimetry/EcalSimProducers/interface/EcalDigiProducer.h @@ -148,7 +148,7 @@ class EcalDigiProducer : public DigiAccumulatorMixMod { std::array< std::unique_ptr >, 3 > m_EBCorrNoise ; std::array< std::unique_ptr >, 3 > m_EECorrNoise ; - std::vector randomEngines_; + CLHEP::HepRandomEngine* randomEngine_ = nullptr; }; #endif diff --git a/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer.cc b/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer.cc index 1b7651d82efac..323f4edd372bf 100644 --- a/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer.cc +++ b/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer.cc @@ -629,17 +629,11 @@ EcalDigiProducer::updateGeometry() } CLHEP::HepRandomEngine* EcalDigiProducer::randomEngine(edm::StreamID const& streamID) { - unsigned int index = streamID.value(); - if(index >= randomEngines_.size()) { - randomEngines_.resize(index + 1, nullptr); - } - CLHEP::HepRandomEngine* ptr = randomEngines_[index]; - if(!ptr) { + if(!randomEngine_) { edm::Service rng; - ptr = &rng->getEngine(streamID); - randomEngines_[index] = ptr; + randomEngine_ = &rng->getEngine(streamID); } - return ptr; + return randomEngine_; } void EcalDigiProducer::setEBNoiseSignalGenerator(EcalBaseSignalGenerator * noiseGenerator) { diff --git a/SimCalorimetry/HGCalSimProducers/plugins/HGCDigiProducer.cc b/SimCalorimetry/HGCalSimProducers/plugins/HGCDigiProducer.cc index ecf822332241b..40b2a79969c75 100644 --- a/SimCalorimetry/HGCalSimProducers/plugins/HGCDigiProducer.cc +++ b/SimCalorimetry/HGCalSimProducers/plugins/HGCDigiProducer.cc @@ -61,17 +61,11 @@ void HGCDigiProducer::endRun(edm::Run const&, edm::EventSetup const&) } CLHEP::HepRandomEngine* HGCDigiProducer::randomEngine(edm::StreamID const& streamID) { - unsigned int index = streamID.value(); - if(index >= randomEngines_.size()) { - randomEngines_.resize(index + 1, nullptr); - } - CLHEP::HepRandomEngine* ptr = randomEngines_[index]; - if(!ptr) { + if(!randomEngine_) { edm::Service rng; - ptr = &rng->getEngine(streamID); - randomEngines_[index] = ptr; + randomEngine_ = &rng->getEngine(streamID); } - return ptr; + return randomEngine_; } DEFINE_DIGI_ACCUMULATOR(HGCDigiProducer); diff --git a/SimCalorimetry/HGCalSimProducers/plugins/HGCDigiProducer.h b/SimCalorimetry/HGCalSimProducers/plugins/HGCDigiProducer.h index f2c7aa8be0121..416606dae8302 100644 --- a/SimCalorimetry/HGCalSimProducers/plugins/HGCDigiProducer.h +++ b/SimCalorimetry/HGCalSimProducers/plugins/HGCDigiProducer.h @@ -35,7 +35,7 @@ class HGCDigiProducer : public DigiAccumulatorMixMod { CLHEP::HepRandomEngine* randomEngine(edm::StreamID const& streamID); //the digitizer HGCDigitizer theDigitizer_; - std::vector randomEngines_; + CLHEP::HepRandomEngine* randomEngine_ = nullptr; }; #endif diff --git a/SimCalorimetry/HcalSimProducers/interface/HcalDigiProducer.h b/SimCalorimetry/HcalSimProducers/interface/HcalDigiProducer.h index b19a601cedfa4..190c17c8beb48 100644 --- a/SimCalorimetry/HcalSimProducers/interface/HcalDigiProducer.h +++ b/SimCalorimetry/HcalSimProducers/interface/HcalDigiProducer.h @@ -43,7 +43,7 @@ class HcalDigiProducer : public DigiAccumulatorMixMod { HcalDigitizer theDigitizer_; - std::vector randomEngines_; + CLHEP::HepRandomEngine* randomEngine_ = nullptr; }; #endif diff --git a/SimCalorimetry/HcalSimProducers/src/HcalDigiProducer.cc b/SimCalorimetry/HcalSimProducers/src/HcalDigiProducer.cc index 2345642e9bb65..ea902da6c5020 100644 --- a/SimCalorimetry/HcalSimProducers/src/HcalDigiProducer.cc +++ b/SimCalorimetry/HcalSimProducers/src/HcalDigiProducer.cc @@ -86,15 +86,9 @@ HcalDigiProducer::setQIE11NoiseSignalGenerator(HcalBaseSignalGenerator * noiseGe } CLHEP::HepRandomEngine* HcalDigiProducer::randomEngine(edm::StreamID const& streamID) { - unsigned int index = streamID.value(); - if(index >= randomEngines_.size()) { - randomEngines_.resize(index + 1, nullptr); - } - CLHEP::HepRandomEngine* ptr = randomEngines_[index]; - if(!ptr) { + if(!randomEngine_) { edm::Service rng; - ptr = &rng->getEngine(streamID); - randomEngines_[index] = ptr; + randomEngine_ = &rng->getEngine(streamID); } - return ptr; + return randomEngine_; } diff --git a/SimCalorimetry/HcalTestBeam/interface/HcalTBDigiProducer.h b/SimCalorimetry/HcalTestBeam/interface/HcalTBDigiProducer.h index 26062efd4f1c1..03b25773c272a 100644 --- a/SimCalorimetry/HcalTestBeam/interface/HcalTBDigiProducer.h +++ b/SimCalorimetry/HcalTestBeam/interface/HcalTBDigiProducer.h @@ -96,7 +96,7 @@ class HcalTBDigiProducer : public DigiAccumulatorMixMod { bool doPhaseShift; double tunePhaseShift; - std::vector randomEngines_; + CLHEP::HepRandomEngine* randomEngine_ = nullptr; }; #endif diff --git a/SimCalorimetry/HcalTestBeam/src/HcalTBDigiProducer.cc b/SimCalorimetry/HcalTestBeam/src/HcalTBDigiProducer.cc index 34f690d3fa199..d93eb83a024ce 100644 --- a/SimCalorimetry/HcalTestBeam/src/HcalTBDigiProducer.cc +++ b/SimCalorimetry/HcalTestBeam/src/HcalTBDigiProducer.cc @@ -244,15 +244,9 @@ void HcalTBDigiProducer::setPhaseShift(const DetId & detId) { } CLHEP::HepRandomEngine* HcalTBDigiProducer::randomEngine(edm::StreamID const& streamID) { - unsigned int index = streamID.value(); - if(index >= randomEngines_.size()) { - randomEngines_.resize(index + 1, nullptr); - } - CLHEP::HepRandomEngine* ptr = randomEngines_[index]; - if(!ptr) { + if(!randomEngine_) { edm::Service rng; - ptr = &rng->getEngine(streamID); - randomEngines_[index] = ptr; + randomEngine_ = &rng->getEngine(streamID); } - return ptr; + return randomEngine_; } diff --git a/SimFastTiming/FastTimingCommon/plugins/FTLDigiProducer.cc b/SimFastTiming/FastTimingCommon/plugins/FTLDigiProducer.cc index 1d071ff1ab394..3a9ff7494d420 100644 --- a/SimFastTiming/FastTimingCommon/plugins/FTLDigiProducer.cc +++ b/SimFastTiming/FastTimingCommon/plugins/FTLDigiProducer.cc @@ -76,15 +76,9 @@ void FTLDigiProducer::endRun(edm::Run const&, edm::EventSetup const&) } CLHEP::HepRandomEngine* FTLDigiProducer::randomEngine(edm::StreamID const& streamID) { - unsigned int index = streamID.value(); - if(index >= randomEngines_.size()) { - randomEngines_.resize(index + 1, nullptr); - } - CLHEP::HepRandomEngine* ptr = randomEngines_[index]; - if(!ptr) { + if(!randomEngine_) { edm::Service rng; - ptr = &rng->getEngine(streamID); - randomEngines_[index] = ptr; + randomEngine_ = &rng->getEngine(streamID); } - return ptr; + return randomEngine_; } diff --git a/SimFastTiming/FastTimingCommon/plugins/FTLDigiProducer.h b/SimFastTiming/FastTimingCommon/plugins/FTLDigiProducer.h index f53e9ee05890f..63fbddf0335c9 100644 --- a/SimFastTiming/FastTimingCommon/plugins/FTLDigiProducer.h +++ b/SimFastTiming/FastTimingCommon/plugins/FTLDigiProducer.h @@ -37,7 +37,7 @@ class FTLDigiProducer : public DigiAccumulatorMixMod { CLHEP::HepRandomEngine* randomEngine(edm::StreamID const& streamID); //the digitizer std::vector > theDigitizers_; - std::vector randomEngines_; + CLHEP::HepRandomEngine* randomEngine_ = nullptr; }; #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizer.cc b/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizer.cc index e392c1f12d928..84e1d27119af8 100644 --- a/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizer.cc +++ b/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizer.cc @@ -301,17 +301,11 @@ namespace cms } CLHEP::HepRandomEngine* SiPixelDigitizer::randomEngine(edm::StreamID const& streamID) { - unsigned int index = streamID.value(); - if(index >= randomEngines_.size()) { - randomEngines_.resize(index + 1, nullptr); - } - CLHEP::HepRandomEngine* ptr = randomEngines_[index]; - if(!ptr) { + if(!randomEngine_) { edm::Service rng; - ptr = &rng->getEngine(streamID); - randomEngines_[index] = ptr; + randomEngine_ = &rng->getEngine(streamID); } - return ptr; + return randomEngine_; } }// end namespace cms:: diff --git a/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizer.h b/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizer.h index 79b0573933846..e0b3e66904201 100644 --- a/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizer.h +++ b/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizer.h @@ -95,7 +95,7 @@ namespace cms { edm::ESHandle pDD; edm::ESHandle pSetup; std::map detectorUnits; - std::vector randomEngines_; + CLHEP::HepRandomEngine* randomEngine_ = nullptr; PileupMixingContent* PileupInfo_; diff --git a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.cc b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.cc index 6dee5c40d19a8..fe872233fb3bb 100644 --- a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.cc +++ b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.cc @@ -288,15 +288,9 @@ void SiStripDigitizer::finalizeEvent(edm::Event& iEvent, edm::EventSetup const& } CLHEP::HepRandomEngine* SiStripDigitizer::randomEngine(edm::StreamID const& streamID) { - unsigned int index = streamID.value(); - if(index >= randomEngines_.size()) { - randomEngines_.resize(index + 1, nullptr); - } - CLHEP::HepRandomEngine* ptr = randomEngines_[index]; - if(!ptr) { + if(!randomEngine_) { edm::Service rng; - ptr = &rng->getEngine(streamID); - randomEngines_[index] = ptr; + randomEngine_ = &rng->getEngine(streamID); } - return ptr; + return randomEngine_; } diff --git a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.h b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.h index 3f38d3f9e29c8..db7dd6f067347 100644 --- a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.h +++ b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.h @@ -98,7 +98,7 @@ class SiStripDigitizer : public DigiAccumulatorMixMod { edm::ESHandle pDD; edm::ESHandle pSetup; std::map detectorUnits; - std::vector randomEngines_; + CLHEP::HepRandomEngine* randomEngine_ = nullptr; std::vector>> theAffectedAPVvector; PileupMixingContent* PileupInfo_; From 4d5093e4d8cacbabe0b87d652556dd790b7c8078 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Tue, 10 Apr 2018 14:46:15 +0200 Subject: [PATCH 407/426] Simplify caching of random number engine further The cache can be set unconditionally in initializeEvent() (and reset to nullptr in finalizeEvent() to prevent accidental use outside event). This makes the situation simpler to understand without deep knowledge of random number service internals. --- .../CastorSim/plugins/CastorDigiProducer.cc | 27 ++++++------- .../CastorSim/plugins/CastorDigiProducer.h | 4 +- .../interface/EcalDigiProducer.h | 4 +- .../EcalSimProducers/src/EcalDigiProducer.cc | 39 +++++++++---------- .../plugins/HGCDigiProducer.cc | 17 +++----- .../plugins/HGCDigiProducer.h | 1 - .../interface/HcalDigiProducer.h | 3 -- .../HcalSimProducers/src/HcalDigiProducer.cc | 17 +++----- .../interface/HcalTBDigiProducer.h | 4 +- .../HcalTestBeam/src/HcalTBDigiProducer.cc | 27 ++++++------- .../plugins/FTLDigiProducer.cc | 17 +++----- .../plugins/FTLDigiProducer.h | 1 - .../plugins/SiPixelDigitizer.cc | 31 +++++---------- .../plugins/SiPixelDigitizer.h | 2 - .../plugins/SiStripDigitizer.cc | 23 +++++------ .../plugins/SiStripDigitizer.h | 3 +- 16 files changed, 83 insertions(+), 137 deletions(-) diff --git a/SimCalorimetry/CastorSim/plugins/CastorDigiProducer.cc b/SimCalorimetry/CastorSim/plugins/CastorDigiProducer.cc index 4e2f3bbacd54a..9ae5d992e4c47 100644 --- a/SimCalorimetry/CastorSim/plugins/CastorDigiProducer.cc +++ b/SimCalorimetry/CastorSim/plugins/CastorDigiProducer.cc @@ -73,7 +73,7 @@ CastorDigiProducer::~CastorDigiProducer() { delete theHitCorrection; } -void CastorDigiProducer::initializeEvent(edm::Event const&, edm::EventSetup const& eventSetup) { +void CastorDigiProducer::initializeEvent(edm::Event const& event, edm::EventSetup const& eventSetup) { // get the appropriate gains, noises, & widths for this event edm::ESHandle conditions; eventSetup.get().get(conditions); @@ -81,6 +81,10 @@ void CastorDigiProducer::initializeEvent(edm::Event const&, edm::EventSetup cons theCoderFactory->setDbService(conditions.product()); theParameterMap->setDbService(conditions.product()); + // Cache random number engine + edm::Service rng; + randomEngine_ = &rng->getEngine(event.streamID()); + edm::LogInfo("CastorDigiProducer") << "checking the geometry..."; // get the correct geometry @@ -91,13 +95,13 @@ void CastorDigiProducer::initializeEvent(edm::Event const&, edm::EventSetup cons theCastorDigitizer->initializeHits(); } -void CastorDigiProducer::accumulateCaloHits(std::vector const& hcalHits, int bunchCrossing, CLHEP::HepRandomEngine* engine) { +void CastorDigiProducer::accumulateCaloHits(std::vector const& hcalHits, int bunchCrossing) { //fillFakeHits(); if(theHitCorrection != nullptr) { theHitCorrection->fillChargeSums(hcalHits); } - theCastorDigitizer->add(hcalHits, bunchCrossing, engine); + theCastorDigitizer->add(hcalHits, bunchCrossing, randomEngine_); } void CastorDigiProducer::accumulate(edm::Event const& e, edm::EventSetup const&) { @@ -105,7 +109,7 @@ void CastorDigiProducer::accumulate(edm::Event const& e, edm::EventSetup const&) edm::Handle > castorHandle; e.getByLabel(theHitsProducerTag, castorHandle); - accumulateCaloHits(*castorHandle.product(), 0, randomEngine(e.streamID())); + accumulateCaloHits(*castorHandle.product(), 0); } void CastorDigiProducer::accumulate(PileUpEventPrincipal const& e, edm::EventSetup const&, edm::StreamID const& streamID) { @@ -113,7 +117,7 @@ void CastorDigiProducer::accumulate(PileUpEventPrincipal const& e, edm::EventSet edm::Handle > castorHandle; e.getByLabel(theHitsProducerTag, castorHandle); - accumulateCaloHits(*castorHandle.product(), e.bunchCrossing(), randomEngine(streamID)); + accumulateCaloHits(*castorHandle.product(), e.bunchCrossing()); } void CastorDigiProducer::finalizeEvent(edm::Event& e, const edm::EventSetup& eventSetup) { @@ -122,12 +126,14 @@ void CastorDigiProducer::finalizeEvent(edm::Event& e, const edm::EventSetup& eve std::unique_ptr castorResult(new CastorDigiCollection()); // Step C: Invoke the algorithm, getting back outputs. - theCastorDigitizer->run(*castorResult, randomEngine(e.streamID())); + theCastorDigitizer->run(*castorResult, randomEngine_); edm::LogInfo("CastorDigiProducer") << "HCAL/Castor digis : " << castorResult->size(); // Step D: Put outputs into event e.put(std::move(castorResult)); + + randomEngine_ = nullptr; // to prevent access outside event } @@ -162,12 +168,3 @@ void CastorDigiProducer::checkGeometry(const edm::EventSetup & eventSetup) { //std::cout<<"CastorDigiProducer::CheckGeometry number of cells: "<setDetIds(castorCells); } - -CLHEP::HepRandomEngine* CastorDigiProducer::randomEngine(edm::StreamID const& streamID) { - if(!randomEngine_) { - edm::Service rng; - randomEngine_ = &rng->getEngine(streamID); - } - return randomEngine_; -} - diff --git a/SimCalorimetry/CastorSim/plugins/CastorDigiProducer.h b/SimCalorimetry/CastorSim/plugins/CastorDigiProducer.h index 92e7b3ccac6ee..bdf793e344fd6 100644 --- a/SimCalorimetry/CastorSim/plugins/CastorDigiProducer.h +++ b/SimCalorimetry/CastorSim/plugins/CastorDigiProducer.h @@ -46,7 +46,7 @@ class CastorDigiProducer : public DigiAccumulatorMixMod { private: - void accumulateCaloHits(std::vector const&, int bunchCrossing, CLHEP::HepRandomEngine*); + void accumulateCaloHits(std::vector const&, int bunchCrossing); /// fills the vectors for each subdetector void sortHits(const edm::PCaloHitContainer & hits); @@ -58,8 +58,6 @@ class CastorDigiProducer : public DigiAccumulatorMixMod { edm::InputTag theHitsProducerTag; - CLHEP::HepRandomEngine* randomEngine(edm::StreamID const& streamID); - /** Reconstruction algorithm*/ typedef CaloTDigitizer CastorDigitizer; diff --git a/SimCalorimetry/EcalSimProducers/interface/EcalDigiProducer.h b/SimCalorimetry/EcalSimProducers/interface/EcalDigiProducer.h index 6d1f5dad7d1c1..49f1d9874c899 100644 --- a/SimCalorimetry/EcalSimProducers/interface/EcalDigiProducer.h +++ b/SimCalorimetry/EcalSimProducers/interface/EcalDigiProducer.h @@ -78,7 +78,7 @@ class EcalDigiProducer : public DigiAccumulatorMixMod { virtual void cacheEEDigis( const EEDigiCollection* eeDigiPtr ) const { } typedef edm::Handle > HitsHandle; - void accumulateCaloHits(HitsHandle const& ebHandle, HitsHandle const& eeHandle, HitsHandle const& esHandle, int bunchCrossing, CLHEP::HepRandomEngine*); + void accumulateCaloHits(HitsHandle const& ebHandle, HitsHandle const& eeHandle, HitsHandle const& esHandle, int bunchCrossing); void checkGeometry(const edm::EventSetup& eventSetup) ; @@ -86,8 +86,6 @@ class EcalDigiProducer : public DigiAccumulatorMixMod { void checkCalibrations(const edm::Event& event, const edm::EventSetup& eventSetup) ; - CLHEP::HepRandomEngine* randomEngine(edm::StreamID const& streamID); - const APDShape m_APDShape ; const EBShape m_EBShape ; const EEShape m_EEShape ; diff --git a/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer.cc b/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer.cc index 323f4edd372bf..9324990bba602 100644 --- a/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer.cc +++ b/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer.cc @@ -293,6 +293,9 @@ EcalDigiProducer::~EcalDigiProducer() void EcalDigiProducer::initializeEvent(edm::Event const& event, edm::EventSetup const& eventSetup) { + edm::Service rng; + randomEngine_ = &rng->getEngine(event.streamID()); + checkGeometry( eventSetup ); checkCalibrations( event, eventSetup ); if( m_doEB ) { @@ -314,24 +317,24 @@ EcalDigiProducer::initializeEvent(edm::Event const& event, edm::EventSetup const } void -EcalDigiProducer::accumulateCaloHits(HitsHandle const& ebHandle, HitsHandle const& eeHandle, HitsHandle const& esHandle, int bunchCrossing, CLHEP::HepRandomEngine* engine) { +EcalDigiProducer::accumulateCaloHits(HitsHandle const& ebHandle, HitsHandle const& eeHandle, HitsHandle const& esHandle, int bunchCrossing) { if(m_doEB && ebHandle.isValid()) { - m_BarrelDigitizer->add(*ebHandle.product(), bunchCrossing, engine); + m_BarrelDigitizer->add(*ebHandle.product(), bunchCrossing, randomEngine_); if(m_apdSeparateDigi) { - m_APDDigitizer->add(*ebHandle.product(), bunchCrossing, engine); + m_APDDigitizer->add(*ebHandle.product(), bunchCrossing, randomEngine_); } } if(m_doEE && eeHandle.isValid()) { - m_EndcapDigitizer->add(*eeHandle.product(), bunchCrossing, engine); + m_EndcapDigitizer->add(*eeHandle.product(), bunchCrossing, randomEngine_); } if(m_doES && esHandle.isValid()) { if(m_doFastES) { - m_ESDigitizer->add(*esHandle.product(), bunchCrossing, engine); + m_ESDigitizer->add(*esHandle.product(), bunchCrossing, randomEngine_); } else { - m_ESOldDigitizer->add(*esHandle.product(), bunchCrossing, engine); + m_ESOldDigitizer->add(*esHandle.product(), bunchCrossing, randomEngine_); } } } @@ -357,7 +360,7 @@ EcalDigiProducer::accumulate(edm::Event const& e, edm::EventSetup const& eventSe e.getByLabel(esTag, esHandle); } - accumulateCaloHits(ebHandle, eeHandle, esHandle, 0, randomEngine(e.streamID())); + accumulateCaloHits(ebHandle, eeHandle, esHandle, 0); } void @@ -381,7 +384,7 @@ EcalDigiProducer::accumulate(PileUpEventPrincipal const& e, edm::EventSetup cons e.getByLabel(esTag, esHandle); } - accumulateCaloHits(ebHandle, eeHandle, esHandle, e.bunchCrossing(), randomEngine(streamID)); + accumulateCaloHits(ebHandle, eeHandle, esHandle, e.bunchCrossing()); } void @@ -396,27 +399,27 @@ EcalDigiProducer::finalizeEvent(edm::Event& event, edm::EventSetup const& eventS // run the algorithm if( m_doEB ) { - m_BarrelDigitizer->run( *barrelResult, randomEngine(event.streamID()) ) ; + m_BarrelDigitizer->run( *barrelResult, randomEngine_ ) ; cacheEBDigis( &*barrelResult ) ; edm::LogInfo("DigiInfo") << "EB Digis: " << barrelResult->size() ; if( m_apdSeparateDigi ) { - m_APDDigitizer->run( *apdResult, randomEngine(event.streamID()) ) ; + m_APDDigitizer->run( *apdResult, randomEngine_ ) ; edm::LogInfo("DigiInfo") << "APD Digis: " << apdResult->size() ; } } if( m_doEE ) { - m_EndcapDigitizer->run( *endcapResult, randomEngine(event.streamID()) ) ; + m_EndcapDigitizer->run( *endcapResult, randomEngine_ ) ; edm::LogInfo("EcalDigi") << "EE Digis: " << endcapResult->size() ; cacheEEDigis( &*endcapResult ) ; } if( m_doES ) { if(m_doFastES) { - m_ESDigitizer->run( *preshowerResult, randomEngine(event.streamID()) ) ; + m_ESDigitizer->run( *preshowerResult, randomEngine_ ) ; } else { - m_ESOldDigitizer->run( *preshowerResult, randomEngine(event.streamID()) ) ; + m_ESOldDigitizer->run( *preshowerResult, randomEngine_ ) ; } edm::LogInfo("EcalDigi") << "ES Digis: " << preshowerResult->size(); } @@ -430,6 +433,8 @@ EcalDigiProducer::finalizeEvent(edm::Event& event, edm::EventSetup const& eventS event.put(std::move(barrelResult), m_EBdigiCollection ) ; event.put(std::move(endcapResult), m_EEdigiCollection ) ; event.put(std::move(preshowerResult), m_ESdigiCollection ) ; + + randomEngine_ = nullptr; // to prevent access outside event } void @@ -628,14 +633,6 @@ EcalDigiProducer::updateGeometry() } } -CLHEP::HepRandomEngine* EcalDigiProducer::randomEngine(edm::StreamID const& streamID) { - if(!randomEngine_) { - edm::Service rng; - randomEngine_ = &rng->getEngine(streamID); - } - return randomEngine_; -} - void EcalDigiProducer::setEBNoiseSignalGenerator(EcalBaseSignalGenerator * noiseGenerator) { //noiseGenerator->setParameterMap(theParameterMap); if(nullptr != m_BarrelDigitizer) m_BarrelDigitizer->setNoiseSignalGenerator(noiseGenerator); diff --git a/SimCalorimetry/HGCalSimProducers/plugins/HGCDigiProducer.cc b/SimCalorimetry/HGCalSimProducers/plugins/HGCDigiProducer.cc index 40b2a79969c75..69ba7c63db1b5 100644 --- a/SimCalorimetry/HGCalSimProducers/plugins/HGCDigiProducer.cc +++ b/SimCalorimetry/HGCalSimProducers/plugins/HGCDigiProducer.cc @@ -28,24 +28,27 @@ HGCDigiProducer::HGCDigiProducer(edm::ParameterSet const& pset, edm::ConsumesCol // void HGCDigiProducer::initializeEvent(edm::Event const& event, edm::EventSetup const& es) { + edm::Service rng; + randomEngine_ = &rng->getEngine(event.streamID()); theDigitizer_.initializeEvent(event, es); } // void HGCDigiProducer::finalizeEvent(edm::Event& event, edm::EventSetup const& es) { - theDigitizer_.finalizeEvent(event, es, randomEngine(event.streamID())); + theDigitizer_.finalizeEvent(event, es, randomEngine_); + randomEngine_ = nullptr; // to precent access outside event } // void HGCDigiProducer::accumulate(edm::Event const& event, edm::EventSetup const& es) { - theDigitizer_.accumulate(event, es, randomEngine(event.streamID())); + theDigitizer_.accumulate(event, es, randomEngine_); } void HGCDigiProducer::accumulate(PileUpEventPrincipal const& event, edm::EventSetup const& es, edm::StreamID const& streamID) { - theDigitizer_.accumulate(event, es, randomEngine(streamID)); + theDigitizer_.accumulate(event, es, randomEngine_); } // @@ -60,12 +63,4 @@ void HGCDigiProducer::endRun(edm::Run const&, edm::EventSetup const&) theDigitizer_.endRun(); } -CLHEP::HepRandomEngine* HGCDigiProducer::randomEngine(edm::StreamID const& streamID) { - if(!randomEngine_) { - edm::Service rng; - randomEngine_ = &rng->getEngine(streamID); - } - return randomEngine_; -} - DEFINE_DIGI_ACCUMULATOR(HGCDigiProducer); diff --git a/SimCalorimetry/HGCalSimProducers/plugins/HGCDigiProducer.h b/SimCalorimetry/HGCalSimProducers/plugins/HGCDigiProducer.h index 416606dae8302..18bb376243ce7 100644 --- a/SimCalorimetry/HGCalSimProducers/plugins/HGCDigiProducer.h +++ b/SimCalorimetry/HGCalSimProducers/plugins/HGCDigiProducer.h @@ -32,7 +32,6 @@ class HGCDigiProducer : public DigiAccumulatorMixMod { void endRun(edm::Run const&, edm::EventSetup const&) override; ~HGCDigiProducer() override = default; private: - CLHEP::HepRandomEngine* randomEngine(edm::StreamID const& streamID); //the digitizer HGCDigitizer theDigitizer_; CLHEP::HepRandomEngine* randomEngine_ = nullptr; diff --git a/SimCalorimetry/HcalSimProducers/interface/HcalDigiProducer.h b/SimCalorimetry/HcalSimProducers/interface/HcalDigiProducer.h index 190c17c8beb48..a7d359c197100 100644 --- a/SimCalorimetry/HcalSimProducers/interface/HcalDigiProducer.h +++ b/SimCalorimetry/HcalSimProducers/interface/HcalDigiProducer.h @@ -38,9 +38,6 @@ class HcalDigiProducer : public DigiAccumulatorMixMod { void setQIE11NoiseSignalGenerator(HcalBaseSignalGenerator * noiseGenerator); private: - - CLHEP::HepRandomEngine* randomEngine(edm::StreamID const& streamID); - HcalDigitizer theDigitizer_; CLHEP::HepRandomEngine* randomEngine_ = nullptr; diff --git a/SimCalorimetry/HcalSimProducers/src/HcalDigiProducer.cc b/SimCalorimetry/HcalSimProducers/src/HcalDigiProducer.cc index ea902da6c5020..36f508cd4a16e 100644 --- a/SimCalorimetry/HcalSimProducers/src/HcalDigiProducer.cc +++ b/SimCalorimetry/HcalSimProducers/src/HcalDigiProducer.cc @@ -31,22 +31,25 @@ HcalDigiProducer::HcalDigiProducer(edm::ParameterSet const& pset, edm::ConsumesC void HcalDigiProducer::initializeEvent(edm::Event const& event, edm::EventSetup const& es) { + edm::Service rng; + randomEngine_ = &rng->getEngine(event.streamID()); theDigitizer_.initializeEvent(event, es); } void HcalDigiProducer::finalizeEvent(edm::Event& event, edm::EventSetup const& es) { - theDigitizer_.finalizeEvent(event, es, randomEngine(event.streamID())); + theDigitizer_.finalizeEvent(event, es, randomEngine_); + randomEngine_ = nullptr; // to prevent access outside event } void HcalDigiProducer::accumulate(edm::Event const& event, edm::EventSetup const& es) { - theDigitizer_.accumulate(event, es, randomEngine(event.streamID())); + theDigitizer_.accumulate(event, es, randomEngine_); } void HcalDigiProducer::accumulate(PileUpEventPrincipal const& event, edm::EventSetup const& es, edm::StreamID const& streamID) { - theDigitizer_.accumulate(event, es, randomEngine(streamID)); + theDigitizer_.accumulate(event, es, randomEngine_); } void @@ -84,11 +87,3 @@ void HcalDigiProducer::setQIE11NoiseSignalGenerator(HcalBaseSignalGenerator * noiseGenerator) { theDigitizer_.setQIE11NoiseSignalGenerator(noiseGenerator); } - -CLHEP::HepRandomEngine* HcalDigiProducer::randomEngine(edm::StreamID const& streamID) { - if(!randomEngine_) { - edm::Service rng; - randomEngine_ = &rng->getEngine(streamID); - } - return randomEngine_; -} diff --git a/SimCalorimetry/HcalTestBeam/interface/HcalTBDigiProducer.h b/SimCalorimetry/HcalTestBeam/interface/HcalTBDigiProducer.h index 03b25773c272a..c55030dde7c16 100644 --- a/SimCalorimetry/HcalTestBeam/interface/HcalTBDigiProducer.h +++ b/SimCalorimetry/HcalTestBeam/interface/HcalTBDigiProducer.h @@ -44,7 +44,7 @@ class HcalTBDigiProducer : public DigiAccumulatorMixMod { void finalizeEvent(edm::Event& e, edm::EventSetup const& c) override; private: - void accumulateCaloHits(edm::Handle > const& hits, int bunchCrossing, CLHEP::HepRandomEngine*); + void accumulateCaloHits(edm::Handle > const& hits, int bunchCrossing); /// fills the vectors for each subdetector void sortHits(const edm::PCaloHitContainer & hits); @@ -55,8 +55,6 @@ class HcalTBDigiProducer : public DigiAccumulatorMixMod { void setPhaseShift(const DetId & detId); - CLHEP::HepRandomEngine* randomEngine(edm::StreamID const& streamID); - const HcalTimeSlew* hcalTimeSlew_delay_; private: diff --git a/SimCalorimetry/HcalTestBeam/src/HcalTBDigiProducer.cc b/SimCalorimetry/HcalTestBeam/src/HcalTBDigiProducer.cc index d93eb83a024ce..0eaa2dfad5c5b 100644 --- a/SimCalorimetry/HcalTestBeam/src/HcalTBDigiProducer.cc +++ b/SimCalorimetry/HcalTestBeam/src/HcalTBDigiProducer.cc @@ -99,6 +99,10 @@ void HcalTBDigiProducer::initializeEvent(edm::Event const& e, edm::EventSetup co // get the correct geometry checkGeometry(eventSetup); + // Cache random number engine + edm::Service rng; + randomEngine_ = &rng->getEngine(e.streamID()); + theHBHEHits.clear(); theHOHits.clear(); if (doPhaseShift) { @@ -123,15 +127,15 @@ void HcalTBDigiProducer::initializeEvent(edm::Event const& e, edm::EventSetup co theHODigitizer->initializeHits(); } -void HcalTBDigiProducer::accumulateCaloHits(edm::Handle > const& hcalHandle, int bunchCrossing, CLHEP::HepRandomEngine* engine) { +void HcalTBDigiProducer::accumulateCaloHits(edm::Handle > const& hcalHandle, int bunchCrossing) { LogDebug("HcalSim") << "HcalTBDigiProducer::accumulate trying to get SimHit"; if(hcalHandle.isValid()) { std::vector hits = *hcalHandle.product(); LogDebug("HcalSim") << "HcalTBDigiProducer::accumulate Hits corrected"; - theHBHEDigitizer->add(hits, bunchCrossing, engine); - theHODigitizer->add(hits, bunchCrossing, engine); + theHBHEDigitizer->add(hits, bunchCrossing, randomEngine_); + theHODigitizer->add(hits, bunchCrossing, randomEngine_); } } @@ -142,7 +146,7 @@ void HcalTBDigiProducer::accumulate(edm::Event const& e, edm::EventSetup const&) edm::Handle > hcalHandle; e.getByLabel(hcalTag, hcalHandle); - accumulateCaloHits(hcalHandle, 0, randomEngine(e.streamID())); + accumulateCaloHits(hcalHandle, 0); } void HcalTBDigiProducer::accumulate(PileUpEventPrincipal const& e, edm::EventSetup const&, edm::StreamID const& streamID) { @@ -152,7 +156,7 @@ void HcalTBDigiProducer::accumulate(PileUpEventPrincipal const& e, edm::EventSet edm::Handle > hcalHandle; e.getByLabel(hcalTag, hcalHandle); - accumulateCaloHits(hcalHandle, e.bunchCrossing(), randomEngine(streamID)); + accumulateCaloHits(hcalHandle, e.bunchCrossing()); } void HcalTBDigiProducer::finalizeEvent(edm::Event& e, const edm::EventSetup& eventSetup) { @@ -161,9 +165,9 @@ void HcalTBDigiProducer::finalizeEvent(edm::Event& e, const edm::EventSetup& eve std::unique_ptr hoResult(new HODigiCollection()); LogDebug("HcalSim") << "HcalTBDigiProducer::produce Empty collection created"; // Step C: Invoke the algorithm, getting back outputs. - theHBHEDigitizer->run(*hbheResult, randomEngine(e.streamID())); + theHBHEDigitizer->run(*hbheResult, randomEngine_); edm::LogInfo("HcalSim") << "HcalTBDigiProducer: HBHE digis : " << hbheResult->size(); - theHODigitizer->run(*hoResult, randomEngine(e.streamID())); + theHODigitizer->run(*hoResult, randomEngine_); edm::LogInfo("HcalSim") << "HcalTBDigiProducer: HO digis : " << hoResult->size(); // Step D: Put outputs into event @@ -171,6 +175,7 @@ void HcalTBDigiProducer::finalizeEvent(edm::Event& e, const edm::EventSetup& eve e.put(std::move(hbheResult), instance); e.put(std::move(hoResult), instance); + randomEngine_ = nullptr; // to prevent access outside event } void HcalTBDigiProducer::sortHits(const edm::PCaloHitContainer & hits) { @@ -242,11 +247,3 @@ void HcalTBDigiProducer::setPhaseShift(const DetId & detId) { } } } - -CLHEP::HepRandomEngine* HcalTBDigiProducer::randomEngine(edm::StreamID const& streamID) { - if(!randomEngine_) { - edm::Service rng; - randomEngine_ = &rng->getEngine(streamID); - } - return randomEngine_; -} diff --git a/SimFastTiming/FastTimingCommon/plugins/FTLDigiProducer.cc b/SimFastTiming/FastTimingCommon/plugins/FTLDigiProducer.cc index 3a9ff7494d420..83169b076704b 100644 --- a/SimFastTiming/FastTimingCommon/plugins/FTLDigiProducer.cc +++ b/SimFastTiming/FastTimingCommon/plugins/FTLDigiProducer.cc @@ -31,6 +31,8 @@ FTLDigiProducer::~FTLDigiProducer() // void FTLDigiProducer::initializeEvent(edm::Event const& event, edm::EventSetup const& es) { + edm::Service rng; + randomEngine_ = &rng->getEngine(event.streamID()); for( auto& digitizer : theDigitizers_ ) { digitizer->initializeEvent(event, es); } @@ -40,22 +42,23 @@ void FTLDigiProducer::initializeEvent(edm::Event const& event, edm::EventSetup c void FTLDigiProducer::finalizeEvent(edm::Event& event, edm::EventSetup const& es) { for( auto& digitizer : theDigitizers_ ) { - digitizer->finalizeEvent(event, es, randomEngine(event.streamID())); + digitizer->finalizeEvent(event, es, randomEngine_); } + randomEngine_ = nullptr; // to prevent access outside event } // void FTLDigiProducer::accumulate(edm::Event const& event, edm::EventSetup const& es) { for( auto& digitizer : theDigitizers_ ) { - digitizer->accumulate(event, es, randomEngine(event.streamID())); + digitizer->accumulate(event, es, randomEngine_); } } void FTLDigiProducer::accumulate(PileUpEventPrincipal const& event, edm::EventSetup const& es, edm::StreamID const& streamID) { for( auto& digitizer : theDigitizers_ ) { - digitizer->accumulate(event, es, randomEngine(streamID)); + digitizer->accumulate(event, es, randomEngine_); } } @@ -74,11 +77,3 @@ void FTLDigiProducer::endRun(edm::Run const&, edm::EventSetup const&) digitizer->endRun(); } } - -CLHEP::HepRandomEngine* FTLDigiProducer::randomEngine(edm::StreamID const& streamID) { - if(!randomEngine_) { - edm::Service rng; - randomEngine_ = &rng->getEngine(streamID); - } - return randomEngine_; -} diff --git a/SimFastTiming/FastTimingCommon/plugins/FTLDigiProducer.h b/SimFastTiming/FastTimingCommon/plugins/FTLDigiProducer.h index 63fbddf0335c9..8bdc3c7b80596 100644 --- a/SimFastTiming/FastTimingCommon/plugins/FTLDigiProducer.h +++ b/SimFastTiming/FastTimingCommon/plugins/FTLDigiProducer.h @@ -34,7 +34,6 @@ class FTLDigiProducer : public DigiAccumulatorMixMod { void endRun(edm::Run const&, edm::EventSetup const&) override; ~FTLDigiProducer() override; private: - CLHEP::HepRandomEngine* randomEngine(edm::StreamID const& streamID); //the digitizer std::vector > theDigitizers_; CLHEP::HepRandomEngine* randomEngine_ = nullptr; diff --git a/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizer.cc b/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizer.cc index 84e1d27119af8..e8961d867a237 100644 --- a/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizer.cc +++ b/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizer.cc @@ -70,11 +70,6 @@ #include "FWCore/Utilities/interface/StreamID.h" #include "FWCore/Utilities/interface/Exception.h" -namespace CLHEP { - class HepRandomEngine; -} - - // // constants, enums and typedefs // @@ -135,7 +130,6 @@ namespace cms SiPixelDigitizer::accumulatePixelHits(edm::Handle > hSimHits, size_t globalSimHitIndex, const unsigned int tofBin, - CLHEP::HepRandomEngine* engine, edm::EventSetup const& iSetup) { if(hSimHits.isValid()) { std::set detIds; @@ -157,7 +151,7 @@ namespace cms GlobalVector bfield = pSetup->inTesla(pixdet->surface().position()); LogDebug ("PixelDigitizer ") << "B-field(T) at " << pixdet->surface().position() << "(cm): " << pSetup->inTesla(pixdet->surface().position()); - _pixeldigialgo->accumulateSimHits(it, itEnd, globalSimHitIndex, tofBin, pixdet, bfield, tTopo, engine); + _pixeldigialgo->accumulateSimHits(it, itEnd, globalSimHitIndex, tofBin, pixdet, bfield, tTopo, randomEngine_); } } } @@ -177,6 +171,10 @@ namespace cms // from zero for each crossing. crossingSimHitIndexOffset_.clear(); + // Cache random number engine + edm::Service rng; + randomEngine_ = &rng->getEngine(e.streamID()); + _pixeldigialgo->initializeEvent(); iSetup.get().get(geometryType, pDD); iSetup.get().get(pSetup); @@ -213,7 +211,7 @@ namespace cms iEvent.getByLabel(tag, simHits); unsigned int tofBin = PixelDigiSimLink::LowTof; if ((*i).find(std::string("HighTof")) != std::string::npos) tofBin = PixelDigiSimLink::HighTof; - accumulatePixelHits(simHits, crossingSimHitIndexOffset_[tag.encode()], tofBin, randomEngine(iEvent.streamID()), iSetup); + accumulatePixelHits(simHits, crossingSimHitIndexOffset_[tag.encode()], tofBin, iSetup); // Now that the hits have been processed, I'll add the amount of hits in this crossing on to // the global counter. Next time accumulateStripHits() is called it will count the sim hits // as though they were on the end of this collection. @@ -233,7 +231,7 @@ namespace cms iEvent.getByLabel(tag, simHits); unsigned int tofBin = PixelDigiSimLink::LowTof; if ((*i).find(std::string("HighTof")) != std::string::npos) tofBin = PixelDigiSimLink::HighTof; - accumulatePixelHits(simHits, crossingSimHitIndexOffset_[tag.encode()], tofBin, randomEngine(streamID), iSetup); + accumulatePixelHits(simHits, crossingSimHitIndexOffset_[tag.encode()], tofBin, iSetup); // Now that the hits have been processed, I'll add the amount of hits in this crossing on to // the global counter. Next time accumulateStripHits() is called it will count the sim hits // as though they were on the end of this collection. @@ -246,10 +244,6 @@ namespace cms // ------------ method called to produce the data ------------ void SiPixelDigitizer::finalizeEvent(edm::Event& iEvent, const edm::EventSetup& iSetup) { - - edm::Service rng; - CLHEP::HepRandomEngine* engine = &rng->getEngine(iEvent.streamID()); - edm::ESHandle tTopoHand; iSetup.get().get(tTopoHand); const TrackerTopology *tTopo=tTopoHand.product(); @@ -279,7 +273,7 @@ namespace cms collector.data, linkcollector.data, tTopo, - engine); + randomEngine_); if(!collector.data.empty()) { theDigiVector.push_back(std::move(collector)); } @@ -298,15 +292,8 @@ namespace cms // Step D: write output to file iEvent.put(std::move(output)); iEvent.put(std::move(outputlink)); - } - CLHEP::HepRandomEngine* SiPixelDigitizer::randomEngine(edm::StreamID const& streamID) { - if(!randomEngine_) { - edm::Service rng; - randomEngine_ = &rng->getEngine(streamID); - } - return randomEngine_; + randomEngine_ = nullptr; // to prevent access outside event } - }// end namespace cms:: diff --git a/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizer.h b/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizer.h index e0b3e66904201..9b945ba7b3906 100644 --- a/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizer.h +++ b/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizer.h @@ -71,9 +71,7 @@ namespace cms { void accumulatePixelHits(edm::Handle >, size_t globalSimHitIndex, const unsigned int tofBin, - CLHEP::HepRandomEngine*, edm::EventSetup const& c); - CLHEP::HepRandomEngine* randomEngine(edm::StreamID const& streamID); bool firstInitializeEvent_; bool firstFinalizeEvent_; diff --git a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.cc b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.cc index fe872233fb3bb..5461184f665cc 100644 --- a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.cc +++ b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.cc @@ -95,7 +95,7 @@ SiStripDigitizer::~SiStripDigitizer() { } void SiStripDigitizer::accumulateStripHits(edm::Handle > hSimHits, - const TrackerTopology *tTopo, size_t globalSimHitIndex, const unsigned int tofBin, CLHEP::HepRandomEngine* engine ) { + const TrackerTopology *tTopo, size_t globalSimHitIndex, const unsigned int tofBin) { // globalSimHitIndex is the index the sim hit will have when it is put in a collection // of sim hits for all crossings. This is only used when creating digi-sim links if // configured to do so. @@ -114,7 +114,7 @@ void SiStripDigitizer::accumulateStripHits(edm::Handle > hS GlobalVector bfield = pSetup->inTesla(stripdet->surface().position()); LogDebug ("Digitizer ") << "B-field(T) at " << stripdet->surface().position() << "(cm): " << pSetup->inTesla(stripdet->surface().position()); - theDigiAlgo->accumulateSimHits(it, itEnd, globalSimHitIndex, tofBin, stripdet, bfield, tTopo, engine); + theDigiAlgo->accumulateSimHits(it, itEnd, globalSimHitIndex, tofBin, stripdet, bfield, tTopo, randomEngine_); } } } // end of loop over sim hits @@ -137,7 +137,7 @@ void SiStripDigitizer::accumulateStripHits(edm::Handle > hS if (trackerContainer.find(std::string("HighTof")) != std::string::npos) tofBin = StripDigiSimLink::HighTof; iEvent.getByLabel(tag, simHits); - accumulateStripHits(simHits,tTopo,crossingSimHitIndexOffset_[tag.encode()], tofBin, randomEngine(iEvent.streamID())); + accumulateStripHits(simHits,tTopo,crossingSimHitIndexOffset_[tag.encode()], tofBin); // Now that the hits have been processed, I'll add the amount of hits in this crossing on to // the global counter. Next time accumulateStripHits() is called it will count the sim hits // as though they were on the end of this collection. @@ -165,7 +165,7 @@ void SiStripDigitizer::accumulateStripHits(edm::Handle > hS if (trackerContainer.find(std::string("HighTof")) != std::string::npos) tofBin = StripDigiSimLink::HighTof; iEvent.getByLabel(tag, simHits); - accumulateStripHits(simHits,tTopo,crossingSimHitIndexOffset_[tag.encode()], tofBin, randomEngine(streamID)); + accumulateStripHits(simHits,tTopo,crossingSimHitIndexOffset_[tag.encode()], tofBin); // Now that the hits have been processed, I'll add the amount of hits in this crossing on to // the global counter. Next time accumulateStripHits() is called it will count the sim hits // as though they were on the end of this collection. @@ -190,6 +190,10 @@ void SiStripDigitizer::initializeEvent(edm::Event const& iEvent, edm::EventSetup detCabling->addConnected(theDetIdList); } + // Cache random number engine + edm::Service rng; + randomEngine_ = &rng->getEngine(iEvent.streamID()); + theDigiAlgo->initializeEvent(iSetup); iSetup.get().get(geometryType,pDD); @@ -244,7 +248,7 @@ void SiStripDigitizer::finalizeEvent(edm::Event& iEvent, edm::EventSetup const& edm::DetSet collectorRaw(iu->geographicalId().rawId()); edm::DetSet collectorLink(iu->geographicalId().rawId()); theDigiAlgo->digitize(collectorZS,collectorRaw,collectorLink,sgd, - gainHandle,thresholdHandle,noiseHandle,pedestalHandle,theAffectedAPVvector,randomEngine(iEvent.streamID())); + gainHandle,thresholdHandle,noiseHandle,pedestalHandle,theAffectedAPVvector,randomEngine_); if(zeroSuppression){ if(!collectorZS.data.empty()){ theDigiVector.push_back(collectorZS); @@ -285,12 +289,5 @@ void SiStripDigitizer::finalizeEvent(edm::Event& iEvent, edm::EventSetup const& iEvent.put(std::move(output_processedraw), PRDigi); if( makeDigiSimLinks_ ) iEvent.put(std::move(pOutputDigiSimLink)); // The previous EDProducer didn't name this collection so I won't either } -} - -CLHEP::HepRandomEngine* SiStripDigitizer::randomEngine(edm::StreamID const& streamID) { - if(!randomEngine_) { - edm::Service rng; - randomEngine_ = &rng->getEngine(streamID); - } - return randomEngine_; + randomEngine_ = nullptr; // to prevent access outside event } diff --git a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.h b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.h index db7dd6f067347..3ad1dd08cade9 100644 --- a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.h +++ b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.h @@ -63,8 +63,7 @@ class SiStripDigitizer : public DigiAccumulatorMixMod { private: - void accumulateStripHits(edm::Handle >, const TrackerTopology *tTopo, size_t globalSimHitIndex, const unsigned int tofBin, CLHEP::HepRandomEngine*); - CLHEP::HepRandomEngine* randomEngine(edm::StreamID const& streamID); + void accumulateStripHits(edm::Handle >, const TrackerTopology *tTopo, size_t globalSimHitIndex, const unsigned int tofBin); typedef std::vector vstring; typedef std::map >,std::less > simhit_map; From 967b49abeaad25f659c5d371cbf7ba3c3ac078c7 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Wed, 11 Apr 2018 13:47:16 +0200 Subject: [PATCH 408/426] Add disableAlphanumeric() to ConcurrentMonitorElement --- DQMServices/Core/interface/ConcurrentMonitorElement.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/DQMServices/Core/interface/ConcurrentMonitorElement.h b/DQMServices/Core/interface/ConcurrentMonitorElement.h index c54b879b58a85..3fdc6799ef9b6 100644 --- a/DQMServices/Core/interface/ConcurrentMonitorElement.h +++ b/DQMServices/Core/interface/ConcurrentMonitorElement.h @@ -141,6 +141,11 @@ class ConcurrentMonitorElement me_->getTH1()->Sumw2(); } + void disableAlphanumeric() + { + me_->getTH1()->GetXaxis()->SetNoAlphanumeric(false); + me_->getTH1()->GetYaxis()->SetNoAlphanumeric(false); + } }; #endif // DQMServices_Core_ConcurrentMonitorElement_h From 89cb4b87f14e047332caf8eed718aa5d77339b73 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Wed, 11 Apr 2018 13:47:56 +0200 Subject: [PATCH 409/426] Call ConcurrentMonitorElement::disableAlphanumeric() from MultiTrackValidator For some reason without this call the histograms with all bins having alphanumeric bin labels get extra empty, non-labeled bins (such that the total number of bins is an integral multiplet of the supposed number of bins). --- Validation/RecoTrack/plugins/MultiTrackValidator.cc | 1 + Validation/RecoTrack/src/MTVHistoProducerAlgoForTracker.cc | 3 +++ 2 files changed, 4 insertions(+) diff --git a/Validation/RecoTrack/plugins/MultiTrackValidator.cc b/Validation/RecoTrack/plugins/MultiTrackValidator.cc index d8ad71444a5b7..27cdd91adc6bb 100644 --- a/Validation/RecoTrack/plugins/MultiTrackValidator.cc +++ b/Validation/RecoTrack/plugins/MultiTrackValidator.cc @@ -220,6 +220,7 @@ void MultiTrackValidator::bookHistograms(DQMStore::ConcurrentBooker& ibook, edm: for(size_t i=0; i(i)), axis); } + h.disableAlphanumeric(); } void fillMVAHistos(const std::vector& h_mva, @@ -470,6 +472,7 @@ void MTVHistoProducerAlgoForTracker::bookRecoHistos(DQMStore::ConcurrentBooker& histograms.h_algo.push_back( ibook.book1D("h_algo","Tracks by algo",reco::TrackBase::algoSize, 0., double(reco::TrackBase::algoSize) ) ); for (size_t ibin=0; ibin Date: Wed, 11 Apr 2018 17:05:14 +0200 Subject: [PATCH 410/426] Add a flag to prevent storage of LHEXMLStringProduct, update the dumper which is no more working --- .../plugins/ExternalLHEAsciiDumper.cc | 6 ++++- .../plugins/ExternalLHEProducer.cc | 27 ++++++++++++------- .../python/ExternalLHEProducer_cfi.py | 3 ++- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/GeneratorInterface/LHEInterface/plugins/ExternalLHEAsciiDumper.cc b/GeneratorInterface/LHEInterface/plugins/ExternalLHEAsciiDumper.cc index d6023990db5e1..50a2b68f4f43e 100644 --- a/GeneratorInterface/LHEInterface/plugins/ExternalLHEAsciiDumper.cc +++ b/GeneratorInterface/LHEInterface/plugins/ExternalLHEAsciiDumper.cc @@ -42,6 +42,8 @@ class ExternalLHEAsciiDumper : public edm::EDAnalyzer { edm::InputTag lheProduct_; std::string lheFileName_; + edm::EDGetTokenT LHEAsciiToken_; + // ----------member data --------------------------- }; @@ -51,6 +53,8 @@ ExternalLHEAsciiDumper::ExternalLHEAsciiDumper(const edm::ParameterSet& ps): lheFileName_( ps.getParameter("lheFileName") ) { + LHEAsciiToken_ = consumes (edm::InputTag(lheProduct_)); + return; } @@ -70,7 +74,7 @@ void ExternalLHEAsciiDumper::endRun(edm::Run const& iRun, edm::EventSetup const&) { edm::Handle< LHEXMLStringProduct > LHEAscii; - iRun.getByLabel(lheProduct_,LHEAscii); + iRun.getByToken(LHEAsciiToken_,LHEAscii); const std::vector& lheOutputs = LHEAscii->getStrings(); diff --git a/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc b/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc index d9291aa1fbcb0..08cc57b926cd0 100644 --- a/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc +++ b/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc @@ -93,6 +93,7 @@ class ExternalLHEProducer : public edm::one::EDProducer args_; uint32_t npars_; uint32_t nEvents_; + bool storeXML_; unsigned int nThreads_{1}; std::string outputContents_; @@ -133,7 +134,8 @@ ExternalLHEProducer::ExternalLHEProducer(const edm::ParameterSet& iConfig) : outputFile_(iConfig.getParameter("outputFile")), args_(iConfig.getParameter >("args")), npars_(iConfig.getParameter("numberOfParameters")), - nEvents_(iConfig.getUntrackedParameter("nEvents")) + nEvents_(iConfig.getUntrackedParameter("nEvents")), + storeXML_(iConfig.getUntrackedParameter("storeXML")) { if (npars_ != args_.size()) throw cms::Exception("ExternalLHEProducer") << "Problem with configuration: " << args_.size() << " script arguments given, expected " << npars_; @@ -258,15 +260,19 @@ ExternalLHEProducer::beginRunProduce(edm::Run& run, edm::EventSetup const& es) //fill LHEXMLProduct (streaming read directly into compressed buffer to save memory) std::unique_ptr p(new LHEXMLStringProduct); - std::ifstream instream(outputFile_); - if (!instream) { - throw cms::Exception("OutputOpenError") << "Unable to open script output file " << outputFile_ << "."; - } - instream.seekg (0, instream.end); - int insize = instream.tellg(); - instream.seekg (0, instream.beg); - p->fillCompressedContent(instream, 0.25*insize); - instream.close(); + + //store the XML file only if explictly requested + if (storeXML_) { + std::ifstream instream(outputFile_); + if (!instream) { + throw cms::Exception("OutputOpenError") << "Unable to open script output file " << outputFile_ << "."; + } + instream.seekg (0, instream.end); + int insize = instream.tellg(); + instream.seekg (0, instream.beg); + p->fillCompressedContent(instream, 0.25*insize); + instream.close(); + } run.put(std::move(p), "LHEScriptOutput"); // LHE C++ classes translation @@ -499,6 +505,7 @@ ExternalLHEProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptio desc.add >("args"); desc.add("numberOfParameters"); desc.addUntracked("nEvents"); + desc.addUntracked("storeXML", false); descriptions.addDefault(desc); } diff --git a/GeneratorInterface/LHEInterface/python/ExternalLHEProducer_cfi.py b/GeneratorInterface/LHEInterface/python/ExternalLHEProducer_cfi.py index 59e4a9259898b..2abd6225f4775 100644 --- a/GeneratorInterface/LHEInterface/python/ExternalLHEProducer_cfi.py +++ b/GeneratorInterface/LHEInterface/python/ExternalLHEProducer_cfi.py @@ -5,6 +5,7 @@ outputFile = cms.string("W1Jet_7TeV_madgraph_final.lhe"), numberOfParameters = cms.uint32(10), args = cms.vstring('slc5_ia32_gcc434/madgraph/V5_1.3.27/test','W1Jet_7TeV_madgraph','false','true','wjets','5','20','false','0','99'), - nEvents = cms.untracked.uint32(100) + nEvents = cms.untracked.uint32(100), + storeXML = cms.untracked.bool(False) ) From 3c56ba6ac472b1253ed2398567705985e832e05c Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Wed, 11 Apr 2018 17:13:53 +0200 Subject: [PATCH 411/426] Code checks --- Validation/RecoTrack/plugins/MultiTrackValidator.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Validation/RecoTrack/plugins/MultiTrackValidator.cc b/Validation/RecoTrack/plugins/MultiTrackValidator.cc index 27cdd91adc6bb..b4e2a31714e3e 100644 --- a/Validation/RecoTrack/plugins/MultiTrackValidator.cc +++ b/Validation/RecoTrack/plugins/MultiTrackValidator.cc @@ -257,11 +257,11 @@ void MultiTrackValidator::bookHistograms(DQMStore::ConcurrentBooker& ibook, edm: ibook.cd(); InputTag algo = label[www]; string dirName=dirName_; - if (algo.process()!="") + if (!algo.process().empty()) dirName+=algo.process()+"_"; - if(algo.label()!="") + if(!algo.label().empty()) dirName+=algo.label()+"_"; - if(algo.instance()!="") + if(!algo.instance().empty()) dirName+=algo.instance()+"_"; if (dirName.find("Tracks") Date: Wed, 11 Apr 2018 17:18:49 +0200 Subject: [PATCH 412/426] Fix code style according to scram suggestion --- .../LHEInterface/plugins/ExternalLHEAsciiDumper.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GeneratorInterface/LHEInterface/plugins/ExternalLHEAsciiDumper.cc b/GeneratorInterface/LHEInterface/plugins/ExternalLHEAsciiDumper.cc index 50a2b68f4f43e..554744386b1a9 100644 --- a/GeneratorInterface/LHEInterface/plugins/ExternalLHEAsciiDumper.cc +++ b/GeneratorInterface/LHEInterface/plugins/ExternalLHEAsciiDumper.cc @@ -91,7 +91,7 @@ ExternalLHEAsciiDumper::endRun(edm::Run const& iRun, edm::EventSetup const&) { else { std::stringstream fname; fname << basename << "_" << iout ; - if (extension != "") + if (!extension.empty()) fname << "." << extension; outfile.open (fname.str().c_str(), std::ofstream::out | std::ofstream::app); } @@ -107,7 +107,7 @@ ExternalLHEAsciiDumper::endRun(edm::Run const& iRun, edm::EventSetup const&) { else { std::stringstream fname; fname << basename << "_" << iout ; - if (extension != "") + if (!extension.empty()) fname << "." << extension; outfile.open (fname.str().c_str(), std::ofstream::out | std::ofstream::app); } From 451bbca41d9b5255e9fe5c316d814f27377638d1 Mon Sep 17 00:00:00 2001 From: Suchandra Date: Wed, 11 Apr 2018 18:59:26 +0200 Subject: [PATCH 413/426] Updated to use CLHEP::RandomEngine by reference --- .../SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.cc | 7 +------ .../SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.h | 1 - .../plugins/Phase2TrackerDigitizerAlgorithm.cc | 4 ++-- .../plugins/Phase2TrackerDigitizerAlgorithm.h | 2 +- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.cc b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.cc index 3144aab16ed3a..c91a387c2bb14 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.cc +++ b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.cc @@ -121,12 +121,8 @@ namespace cms } } } - void Phase2TrackerDigitizer::endLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const& iSetup) { - edm::LogInfo("Phase2TrackerDigitizer") << "End Luminosity Block"; - } Phase2TrackerDigitizer::~Phase2TrackerDigitizer() { - edm::LogInfo("Phase2TrackerDigitizer") << "Destroying the Digitizer"; } void Phase2TrackerDigitizer::accumulatePixelHits(edm::Handle > hSimHits, @@ -166,13 +162,12 @@ namespace cms "which is not present in the configuration file. You must add the service\n" "in the configuration file or remove the modules that require it."; } - CLHEP::HepRandomEngine* rnd_engine = &(rng->getEngine(e.streamID())); // Must initialize all the algorithms for (auto const & el : algomap_) { if (first_) el.second->init(iSetup); - el.second->initializeEvent(rnd_engine); + el.second->initializeEvent(rng->getEngine(e.streamID())); } first_ = false; // Make sure that the first crossing processed starts indexing the sim hits from zero. diff --git a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.h b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.h index b07aa4d4bde4e..9a915a4673690 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.h +++ b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.h @@ -60,7 +60,6 @@ namespace cms void finalizeEvent(edm::Event& e, edm::EventSetup const& c) override; virtual void beginJob() {} void beginLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const& iSetup) override; - void endLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const& iSetup) override; template void accumulate_local(T const& iEvent, edm::EventSetup const& iSetup); diff --git a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.cc b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.cc index a599f75c7f262..a176cd7e92a0f 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.cc +++ b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.cc @@ -720,7 +720,7 @@ void Phase2TrackerDigitizerAlgorithm::pixel_inefficiency(const SubdetEfficiencie } } } -void Phase2TrackerDigitizerAlgorithm::initializeEvent(CLHEP::HepRandomEngine* eng) { +void Phase2TrackerDigitizerAlgorithm::initializeEvent(CLHEP::HepRandomEngine& eng) { if (addNoise || AddPixelInefficiency || fluctuateCharge || addThresholdSmearing) { gaussDistribution_ = std::make_unique(eng, 0., theReadoutNoise); @@ -730,7 +730,7 @@ void Phase2TrackerDigitizerAlgorithm::initializeEvent(CLHEP::HepRandomEngine* en smearedThreshold_Endcap_ = std::make_unique (eng, theThresholdInE_Endcap , theThresholdSmearing_Endcap); smearedThreshold_Barrel_ = std::make_unique (eng, theThresholdInE_Barrel , theThresholdSmearing_Barrel); } - rengine_ = eng; + rengine_ = (&eng); _signal.clear(); } diff --git a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.h b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.h index 77118da6a1a24..06f8e4ff30980 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.h +++ b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.h @@ -49,7 +49,7 @@ class Phase2TrackerDigitizerAlgorithm { // initialization that cannot be done in the constructor virtual void init(const edm::EventSetup& es) = 0; - virtual void initializeEvent(CLHEP::HepRandomEngine* eng); + virtual void initializeEvent(CLHEP::HepRandomEngine& eng); // run the algorithm to digitize a single det virtual void accumulateSimHits(const std::vector::const_iterator inputBegin, const std::vector::const_iterator inputEnd, From 1e9dcd41dae5a3f97f4c04bb17dace8f84dd2d06 Mon Sep 17 00:00:00 2001 From: Slava Krutelyov Date: Wed, 11 Apr 2018 20:00:22 +0200 Subject: [PATCH 414/426] add mergeNANO option for testing --- Configuration/DataProcessing/test/RunMerge.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Configuration/DataProcessing/test/RunMerge.py b/Configuration/DataProcessing/test/RunMerge.py index f94d68c986886..43f3f7158dd33 100644 --- a/Configuration/DataProcessing/test/RunMerge.py +++ b/Configuration/DataProcessing/test/RunMerge.py @@ -51,7 +51,7 @@ def __call__(self): if __name__ == '__main__': - valid = ["input-files=", "output-file=", "output-lfn=", "dqmroot" ] + valid = ["input-files=", "output-file=", "output-lfn=", "dqmroot", "mergeNANO" ] usage = """RunMerge.py """ try: @@ -75,6 +75,7 @@ def __call__(self): merger.outputLFN = arg if opt == "--dqmroot" : merger.newDQMIO = True - + if opt == "--mergeNANO" : + merger.mergeNANO = True merger() From e48da6a56cb2f1f299680aae16f52f7b5fb603e5 Mon Sep 17 00:00:00 2001 From: Slava Krutelyov Date: Wed, 11 Apr 2018 20:00:46 +0200 Subject: [PATCH 415/426] do less inclusive import/use of the EventContent_cff --- Configuration/DataProcessing/python/Merge.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Configuration/DataProcessing/python/Merge.py b/Configuration/DataProcessing/python/Merge.py index c5d416286c3e2..b812ec427953b 100644 --- a/Configuration/DataProcessing/python/Merge.py +++ b/Configuration/DataProcessing/python/Merge.py @@ -10,7 +10,6 @@ from FWCore.ParameterSet.Config import Process, EndPath from FWCore.ParameterSet.Modules import OutputModule, Source, Service -from Configuration.EventContent.EventContent_cff import NANOAODEventContent import FWCore.ParameterSet.Types as CfgTypes @@ -65,7 +64,7 @@ def mergeProcess(*inputFiles, **options): if newDQMIO: outMod = OutputModule("DQMRootOutputModule") elif mergeNANO: - outMod = OutputModule("NanoAODOutputModule",NANOAODEventContent.clone()) + outMod = OutputModule("NanoAODOutputModule",Configuration.EventContent.EventContent_cff.NANOAODEventContent.clone()) else: outMod = OutputModule("PoolOutputModule") From b749f05a8f32f08004a5049555562dc592862a8b Mon Sep 17 00:00:00 2001 From: Slava Krutelyov Date: Wed, 11 Apr 2018 22:06:42 +0200 Subject: [PATCH 416/426] actually add mergeNANO option for testing --- Configuration/DataProcessing/test/RunMerge.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Configuration/DataProcessing/test/RunMerge.py b/Configuration/DataProcessing/test/RunMerge.py index 43f3f7158dd33..8a88d3aaf1f1c 100644 --- a/Configuration/DataProcessing/test/RunMerge.py +++ b/Configuration/DataProcessing/test/RunMerge.py @@ -35,7 +35,8 @@ def __call__(self): process_name = self.processName, output_file = self.outputFile, output_lfn = self.outputLFN, - newDQMIO = self.newDQMIO) + newDQMIO = self.newDQMIO, + mergeNANO = self.mergeNANO) except Exception as ex: msg = "Error creating process for Merge:\n" msg += str(ex) From a46262936096822c49b2b8537beaa5b79e08b973 Mon Sep 17 00:00:00 2001 From: Slava Krutelyov Date: Wed, 11 Apr 2018 22:19:47 +0200 Subject: [PATCH 417/426] do less inclusive import/use of the EventContent_cff --- Configuration/DataProcessing/python/Merge.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Configuration/DataProcessing/python/Merge.py b/Configuration/DataProcessing/python/Merge.py index b812ec427953b..7c2659a61d727 100644 --- a/Configuration/DataProcessing/python/Merge.py +++ b/Configuration/DataProcessing/python/Merge.py @@ -64,6 +64,7 @@ def mergeProcess(*inputFiles, **options): if newDQMIO: outMod = OutputModule("DQMRootOutputModule") elif mergeNANO: + import Configuration.EventContent.EventContent_cff outMod = OutputModule("NanoAODOutputModule",Configuration.EventContent.EventContent_cff.NANOAODEventContent.clone()) else: outMod = OutputModule("PoolOutputModule") From ade669915ba852e4d16e311623a7a5831f373e35 Mon Sep 17 00:00:00 2001 From: silviodonato Date: Thu, 12 Apr 2018 13:27:26 +0200 Subject: [PATCH 418/426] remove Scouting EndPath with --no-output option in hltGetConfiguration --- HLTrigger/Configuration/python/Tools/confdb.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/HLTrigger/Configuration/python/Tools/confdb.py b/HLTrigger/Configuration/python/Tools/confdb.py index d4b394e11c4c8..51e89261de7e9 100644 --- a/HLTrigger/Configuration/python/Tools/confdb.py +++ b/HLTrigger/Configuration/python/Tools/confdb.py @@ -682,9 +682,9 @@ def buildPathList(self): else: # drop all output EndPaths but the Scouting ones, and drop the RatesMonitoring and DQMHistograms paths.append( "-*Output" ) - paths.append( "Scouting*Output" ) paths.append( "-RatesMonitoring") paths.append( "-DQMHistograms") + if self.config.fragment: paths.append( "Scouting*Output" ) elif self.config.output in ('dqm', 'minimal', 'full'): if self.config.paths: @@ -693,8 +693,8 @@ def buildPathList(self): else: # drop all output EndPaths but the Scouting ones, and drop the RatesMonitoring paths.append( "-*Output" ) - paths.append( "Scouting*Output" ) paths.append( "-RatesMonitoring") + if self.config.fragment: paths.append( "Scouting*Output" ) else: if self.config.paths: From 8c4229733fa72779f5e4b92788442337210fc96a Mon Sep 17 00:00:00 2001 From: Francesco Date: Thu, 12 Apr 2018 17:17:09 +0200 Subject: [PATCH 419/426] updates to relvals --- Configuration/PyReleaseValidation/python/relval_standard.py | 4 +++- Configuration/PyReleaseValidation/python/relval_steps.py | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Configuration/PyReleaseValidation/python/relval_standard.py b/Configuration/PyReleaseValidation/python/relval_standard.py index e37ba9bc38849..1b2b8f9544f97 100644 --- a/Configuration/PyReleaseValidation/python/relval_standard.py +++ b/Configuration/PyReleaseValidation/python/relval_standard.py @@ -247,7 +247,7 @@ workflows[136.791] = ['',['RunNoBPTX2017B','HLTDR2_2017','RECODR2_2017reHLTAlCaTkCosmics_Prompt','HARVEST2017']] workflows[136.7801] = ['',['RunHLTPhy2017B_AOD','DQMHLTonAOD_2017','HARVESTDQMHLTonAOD_2017']] workflows[136.7802] = ['',['RunHLTPhy2017B_AODextra','DQMHLTonAODextra_2017','HARVESTDQMHLTonAOD_2017']] -workflows[136.7803] = ['',['RunHLTPhy2017B_RAWAOD','DQMHLTonRAWAOD_2017']] +workflows[136.7803] = ['',['RunHLTPhy2017B_RAWAOD','DQMHLTonRAWAOD_2017','HARVESTDQMHLTonAOD_2017']] workflows[136.844] = ['',['RunCharmonium2017B','HLTDR2_2017','RECODR2_2017reHLT_skimCharmonium_Prompt','HARVEST2017']] ### run 2017C ### @@ -317,6 +317,8 @@ # reminiAOD wf on 2017F 94X input workflows[136.8311] = ['',['RunJetHT2017F_reminiaod','REMINIAOD_data2017','HARVEST2017_REMINIAOD_data2017']] +# NANOAOD wf on 2017C miniAODv2 94X input +workflows[136.7952] = ['',['RunJetHT2017C_94Xv2NanoAODINPUT','NANOEDM2017_94XMiniAODv2','HARVESTNANOAOD2017_94XMiniAODv2']] ### fastsim ### workflows[5.1] = ['TTbar', ['TTbarFS','HARVESTFS']] diff --git a/Configuration/PyReleaseValidation/python/relval_steps.py b/Configuration/PyReleaseValidation/python/relval_steps.py index ded23faaad7e9..6cfb734d1c835 100644 --- a/Configuration/PyReleaseValidation/python/relval_steps.py +++ b/Configuration/PyReleaseValidation/python/relval_steps.py @@ -365,6 +365,7 @@ steps['RunJetHT2017F_reminiaod']={'INPUT':InputInfo(dataSet='/JetHT/Run2017F-17Nov2017-v1/AOD',label='rmaod_jetHT2017F',events=100000,location='STD', ls=Run2017F)} +steps['RunJetHT2017C_94Xv2NanoAODINPUT']={'INPUT':InputInfo(dataSet='/JetHT/CMSSW_9_4_5_cand1-94X_dataRun2_relval_v11_RelVal_rmaod_jetHT2017C-v1/MINIAOD',label='nano_jetHT2017C',events=100000,location='STD', ls=Run2017C)} # Highstat HLTPhysics Run2015DHS=selectedLS([258712,258713,258714,258741,258742,258745,258749,258750,259626,259637,259683,259685,259686,259721,259809,259810,259818,259820,259821,259822,259862,259890,259891]) From 43c1b54b7dd9504256a8c01f0c0b09d02c951d70 Mon Sep 17 00:00:00 2001 From: Leonard Apanasevich Date: Thu, 12 Apr 2018 21:20:26 +0200 Subject: [PATCH 420/426] Make sure the GlobalAlgBlk is not empty before accessing member data --- L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.cc b/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.cc index e8b166f78b7f6..caa19e1ed016f 100644 --- a/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.cc +++ b/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.cc @@ -410,7 +410,7 @@ void L1TGlobalProducer::produce(edm::Event& iEvent, const edm::EventSetup& evSet edm::Handle> m_uGtAlgBlk; iEvent.getByToken(m_algoblkInputToken, m_uGtAlgBlk); - if(m_uGtAlgBlk.isValid()) { + if(m_uGtAlgBlk.isValid() && !m_uGtAlgBlk->isEmpty(0)) { std::vector::const_iterator algBlk = m_uGtAlgBlk->begin(0); m_prescaleSet=static_cast(algBlk->getPreScColumn()); }else{ From ba34a65d489af22b1aee114187c920c06bafac37 Mon Sep 17 00:00:00 2001 From: Jan-Frederik Date: Fri, 13 Apr 2018 10:44:20 +0200 Subject: [PATCH 421/426] add layer counting capability to PixelActivityFilter --- .../special/plugins/HLTPixelActivityFilter.cc | 56 ++++++++++++++++++- 1 file changed, 53 insertions(+), 3 deletions(-) diff --git a/HLTrigger/special/plugins/HLTPixelActivityFilter.cc b/HLTrigger/special/plugins/HLTPixelActivityFilter.cc index 1913637357b84..da47eabd43e5d 100644 --- a/HLTrigger/special/plugins/HLTPixelActivityFilter.cc +++ b/HLTrigger/special/plugins/HLTPixelActivityFilter.cc @@ -5,6 +5,8 @@ #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" // // class declaration @@ -18,10 +20,13 @@ class HLTPixelActivityFilter : public HLTFilter { private: bool hltFilter(edm::Event&, const edm::EventSetup&, trigger::TriggerFilterObjectWithRefs & filterproduct) const override; +// int countLayersWithClusters(edm::Handle > & clusterCol,const TrackerTopology& tTopo); edm::InputTag inputTag_; // input tag identifying product containing pixel clusters unsigned int min_clusters_; // minimum number of clusters unsigned int max_clusters_; // maximum number of clusters + unsigned int min_layers_; // minimum number of clusters + unsigned int max_layers_; // maximum number of clusters edm::EDGetTokenT > inputToken_; }; @@ -32,7 +37,6 @@ class HLTPixelActivityFilter : public HLTFilter { #include "DataFormats/Common/interface/Handle.h" #include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" #include "DataFormats/HLTReco/interface/TriggerTypeDefs.h" - // // constructors and destructor // @@ -40,13 +44,20 @@ class HLTPixelActivityFilter : public HLTFilter { HLTPixelActivityFilter::HLTPixelActivityFilter(const edm::ParameterSet& config) : HLTFilter(config), inputTag_ (config.getParameter("inputTag")), min_clusters_ (config.getParameter("minClusters")), - max_clusters_ (config.getParameter("maxClusters")) + max_clusters_ (config.getParameter("maxClusters")), + min_layers_ (config.getParameter("minLayers")), + max_layers_ (config.getParameter("maxLayers")) { inputToken_ = consumes >(inputTag_); LogDebug("") << "Using the " << inputTag_ << " input collection"; LogDebug("") << "Requesting at least " << min_clusters_ << " clusters"; if(max_clusters_ > 0) LogDebug("") << "...but no more than " << max_clusters_ << " clusters"; + if(min_layers_ > 0) + LogDebug("") << "Also requesting at least " << min_layers_ << " layers with clusters"; + if(max_layers_ > 0) + LogDebug("") << "...but no more than " << max_layers_ << " layers with clusters"; + } HLTPixelActivityFilter::~HLTPixelActivityFilter() = default; @@ -58,13 +69,14 @@ HLTPixelActivityFilter::fillDescriptions(edm::ConfigurationDescriptions& descrip desc.add("inputTag",edm::InputTag("hltSiPixelClusters")); desc.add("minClusters",3); desc.add("maxClusters",0); + desc.add("minLayers",0); + desc.add("maxLayers",0); descriptions.add("hltPixelActivityFilter",desc); } // // member functions // - // ------------ method called to produce the data ------------ bool HLTPixelActivityFilter::hltFilter(edm::Event& event, const edm::EventSetup& iSetup, trigger::TriggerFilterObjectWithRefs & filterproduct) const { @@ -85,6 +97,44 @@ bool HLTPixelActivityFilter::hltFilter(edm::Event& event, const edm::EventSetup& if(max_clusters_ > 0) accept &= (clusterSize <= max_clusters_); + if (min_layers_ > 0 || max_layers_ > 0){ + + edm::ESHandle tTopoHandle; + iSetup.get().get(tTopoHandle); + const TrackerTopology& tTopo = *tTopoHandle; + unsigned int layerCount = 0; + const edmNew::DetSetVector& clusters = *clusterColl; + + edmNew::DetSetVector::const_iterator DSViter=clusters.begin(); + + + std::vector foundLayersB; + std::vector foundLayersEp; + std::vector foundLayersEm; + for ( ; DSViter != clusters.end() ; DSViter++) { + unsigned int detid = DSViter->detId(); + DetId detIdObject( detid ); + const auto nCluster = DSViter->size(); + const auto subdet = detIdObject.subdetId(); + if (subdet == PixelSubdetector::PixelBarrel){ + if(!(std::find(foundLayersB.begin(), foundLayersB.end(), tTopo.layer(detIdObject)) != foundLayersB.end()) && nCluster > 0) foundLayersB.push_back(tTopo.layer(detIdObject)); + } + else if (subdet ==PixelSubdetector::PixelEndcap){ + if (tTopo.side(detIdObject) == 2){ + if(!(std::find(foundLayersEp.begin(), foundLayersEp.end(), tTopo.layer(detIdObject)) != foundLayersEp.end()) && nCluster > 0) foundLayersEp.push_back(tTopo.layer(detIdObject)); + } + else if (tTopo.side(detIdObject) == 1){ + if(!(std::find(foundLayersEm.begin(), foundLayersEm.end(), tTopo.layer(detIdObject)) != foundLayersEm.end()) && nCluster > 0) foundLayersEm.push_back(tTopo.layer(detIdObject)); + } + + } + } + layerCount = foundLayersB.size()+foundLayersEp.size()+foundLayersEm.size(); + if (max_layers_ > 0) accept &= (layerCount <= max_layers_); + if (min_layers_ > 0) accept &= (layerCount >= min_layers_); + + + } // return with final filter decision return accept; } From a4b6575611dfee239dc4c996c91158414e35382e Mon Sep 17 00:00:00 2001 From: Francesco Date: Fri, 13 Apr 2018 11:12:02 +0200 Subject: [PATCH 422/426] fix --- Configuration/PyReleaseValidation/python/relval_steps.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Configuration/PyReleaseValidation/python/relval_steps.py b/Configuration/PyReleaseValidation/python/relval_steps.py index 6cfb734d1c835..554f5ec63d2d7 100644 --- a/Configuration/PyReleaseValidation/python/relval_steps.py +++ b/Configuration/PyReleaseValidation/python/relval_steps.py @@ -2018,6 +2018,7 @@ def gen2018HiMix(fragment,howMuch): '--era':'Run2_2017', '--secondfilein':'filelist:step1_dasparentquery.log', '--customise_commands':'"process.HLTAnalyzerEndpath.remove(process.hltL1TGlobalSummary)"', + '--fileout':'DQMHLTonAOD.root', } steps['HARVESTDQMHLTonAOD_2017'] = merge([ {'--filein':'file:DQMHLTonAOD.root','-s':'HARVESTING:hltOfflineDQMClient'}, steps['HARVEST2017'] ]) ### Harvesting step for the DQM-only workflow From ee197c5c4f185be612b3a910fc024e27b4a4fdf8 Mon Sep 17 00:00:00 2001 From: Francesco Fiori Date: Fri, 13 Apr 2018 18:29:27 +0200 Subject: [PATCH 423/426] Activating Dead channel monitor Online --- .../python/SiPixelPhase1OnlineDQM_cff.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/DQM/SiPixelPhase1Config/python/SiPixelPhase1OnlineDQM_cff.py b/DQM/SiPixelPhase1Config/python/SiPixelPhase1OnlineDQM_cff.py index 785441d0186d6..f0dc279c4d454 100644 --- a/DQM/SiPixelPhase1Config/python/SiPixelPhase1OnlineDQM_cff.py +++ b/DQM/SiPixelPhase1Config/python/SiPixelPhase1OnlineDQM_cff.py @@ -34,7 +34,7 @@ SiPixelPhase1Geometry.upgradePhase = 1 #define number of lumis for overlayed plots -SiPixelPhase1Geometry.onlineblock = 50 +SiPixelPhase1Geometry.onlineblock = 150 # Turn on 'online' harvesting. This has to be set before other configs are # loaded (due to how the DefaultHisto PSet is later cloned), therefore it is @@ -61,6 +61,7 @@ # Raw data errors from DQM.SiPixelPhase1RawData.SiPixelPhase1RawData_cfi import * +from DQM.SiPixelPhase1DeadFEDChannels.SiPixelPhase1DeadFEDChannels_cfi import * from DQM.SiPixelPhase1Common.SiPixelPhase1GeometryDebug_cfi import * @@ -73,6 +74,7 @@ siPixelPhase1OnlineDQM_source = cms.Sequence( SiPixelPhase1DigisAnalyzer + + SiPixelPhase1DeadFEDChannelsAnalyzer + SiPixelPhase1ClustersAnalyzer + SiPixelPhase1RawDataAnalyzer + SiPixelPhase1TrackClustersAnalyzer @@ -82,6 +84,7 @@ siPixelPhase1OnlineDQM_harvesting = cms.Sequence( SiPixelPhase1DigisHarvester + + SiPixelPhase1DeadFEDChannelsHarvester + SiPixelPhase1ClustersHarvester + SiPixelPhase1RawDataHarvester + SiPixelPhase1TrackClustersHarvester @@ -104,6 +107,7 @@ siPixelPhase1OnlineDQM_source_cosmics = cms.Sequence( SiPixelPhase1DigisAnalyzer + + SiPixelPhase1DeadFEDChannelsAnalyzer + SiPixelPhase1ClustersAnalyzer + SiPixelPhase1RawDataAnalyzer + SiPixelPhase1TrackClustersAnalyzer_cosmics @@ -124,6 +128,7 @@ siPixelPhase1OnlineDQM_source_pprun = cms.Sequence( SiPixelPhase1DigisAnalyzer + + SiPixelPhase1DeadFEDChannelsAnalyzer + SiPixelPhase1ClustersAnalyzer + SiPixelPhase1RawDataAnalyzer + SiPixelPhase1TrackClustersAnalyzer_pprun From b641aa59bc4ced53590d6a1cf04fd9d09cd90523 Mon Sep 17 00:00:00 2001 From: Kai-Feng Date: Sat, 14 Apr 2018 04:35:46 +0200 Subject: [PATCH 424/426] Module name fix for SingleMuon and Charmonium skims for T0 --- Configuration/Skimming/python/Skims_PDWG_cff.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Configuration/Skimming/python/Skims_PDWG_cff.py b/Configuration/Skimming/python/Skims_PDWG_cff.py index 3a4dcc8a9d38e..bacf6cde78cb2 100644 --- a/Configuration/Skimming/python/Skims_PDWG_cff.py +++ b/Configuration/Skimming/python/Skims_PDWG_cff.py @@ -399,7 +399,7 @@ from Configuration.Skimming.PDWG_MuonPOGSkim_cff import * MuonPOGSkimTrackPath = cms.Path(MuonPOGSkimTrackSequence) MuonPOGSkimSTAPath = cms.Path(MuonPOGSkimSTASequence) -MuonPOGSkim = cms.FilteredStream( +SKIMStreamMuonPOGSkim = cms.FilteredStream( responsible = 'PDWG', name = 'MuonPOGSkim', paths = (MuonPOGSkimTrackPath,MuonPOGSkimSTAPath), @@ -412,7 +412,7 @@ MuonPOGJPsiSkimTrackPath = cms.Path(MuonPOGJPsiSkimTrackSequence) MuonPOGJPsiSkimSTAPath = cms.Path(MuonPOGJPsiSkimSTASequence) -MuonPOGJPsiSkim = cms.FilteredStream( +SKIMStreamMuonPOGJPsiSkim = cms.FilteredStream( responsible = 'PDWG', name = 'MuonPOGJPsiSkim', paths = (MuonPOGJPsiSkimTrackPath,MuonPOGJPsiSkimSTAPath), From 3de0173144a9bdf003f6a466ee66c6887ae9aba1 Mon Sep 17 00:00:00 2001 From: Leonard Apanasevich Date: Sat, 14 Apr 2018 22:10:49 +0200 Subject: [PATCH 425/426] Add back check for empty sum collection --- DQM/L1TMonitor/src/L1TStage2uGTCaloLayer2Comp.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/DQM/L1TMonitor/src/L1TStage2uGTCaloLayer2Comp.cc b/DQM/L1TMonitor/src/L1TStage2uGTCaloLayer2Comp.cc index dd724804a6bef..aa23d0caff905 100644 --- a/DQM/L1TMonitor/src/L1TStage2uGTCaloLayer2Comp.cc +++ b/DQM/L1TMonitor/src/L1TStage2uGTCaloLayer2Comp.cc @@ -344,9 +344,10 @@ bool L1TStage2uGTCaloLayer2Comp::compareSums( l1t::EtSumBxCollection::const_iterator calol2It = calol2Col->begin(); l1t::EtSumBxCollection::const_iterator uGTIt = uGTCol->begin(); - // if the calol2 or ugt collections have different size, mark the event as - // bad (this should never occur in normal running) - if ((calol2Col->size() != uGTCol->size())) { + // if either calol2 or ugt collections are empty, or they have different + // size, mark the event as bad (this should never occur in normal running) + if (calol2Col->size() == 0 || uGTCol->size() == 0 || + (calol2Col->size() != uGTCol->size())) { comparisonNum->Fill(EVENTBADSUMCOL); return false; } From d83a2a8e013a1a7c68fa92bbb238a353eb909611 Mon Sep 17 00:00:00 2001 From: Ianna Osborne Date: Mon, 16 Apr 2018 14:47:50 +0200 Subject: [PATCH 426/426] Remove DDPartSelector --- DetectorDescription/Core/interface/DDCompactView.h | 10 ++-------- DetectorDescription/Core/interface/DDCompactViewImpl.h | 1 - 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/DetectorDescription/Core/interface/DDCompactView.h b/DetectorDescription/Core/interface/DDCompactView.h index 04e7b14e08002..3ecebbb7d20e8 100644 --- a/DetectorDescription/Core/interface/DDCompactView.h +++ b/DetectorDescription/Core/interface/DDCompactView.h @@ -1,5 +1,5 @@ -#ifndef DDCompactView_h -#define DDCompactView_h +#ifndef DETECTOR_DESCRIPTION_CORE_DD_COMPACT_VIEW_H +#define DETECTOR_DESCRIPTION_CORE_DD_COMPACT_VIEW_H #include #include @@ -19,8 +19,6 @@ class DDCompactViewImpl; class DDDivision; class DDName; -class DDPartSelector; -class DDPhysicalPart; struct DDPosData; namespace DDI { @@ -49,10 +47,6 @@ Updated: Michael Case [ MEC ] 2010-02-11 //FIXME: THIS IS NOT ALLOWED, but currently can be specified using DDL .... //FIXME: -//typedef TreeNode expnode_t; -//! type of data representation of DDCompactView -//typedef graph graph_type; //:typedef Graph graph_type; - //! Compact representation of the geometrical detector hierarchy /** A DDCompactView represents the detector as an acyclic directed multigraph. The nodes are instances of DDLogicalPart while the edges are pointers to diff --git a/DetectorDescription/Core/interface/DDCompactViewImpl.h b/DetectorDescription/Core/interface/DDCompactViewImpl.h index fe6e9c1684296..c2ca14ec7c8cc 100644 --- a/DetectorDescription/Core/interface/DDCompactViewImpl.h +++ b/DetectorDescription/Core/interface/DDCompactViewImpl.h @@ -9,7 +9,6 @@ #include "DataFormats/Math/interface/GraphWalker.h" class DDDivision; -class DDPartSelector; struct DDPosData; class DDCompactViewImpl