diff --git a/CondCore/Utilities/python/tier0.py b/CondCore/Utilities/python/tier0.py index 47dea331c9081..b8eb3d6c349ac 100644 --- a/CondCore/Utilities/python/tier0.py +++ b/CondCore/Utilities/python/tier0.py @@ -11,7 +11,7 @@ import pycurl -tier0Url = 'https://cmsweb.cern.ch/t0wmadatasvc/prod/' +tier0Url = os.getenv('TIER0_API_URL', 'https://cmsweb.cern.ch/t0wmadatasvc/prod/') class Tier0Error(Exception): '''Tier0 exception. @@ -23,7 +23,7 @@ def __init__(self, message): def unique(seq, keepstr=True): t = type(seq) - if t in (unicode, str): + if t is str: t = (list, t('').join)[bool(keepstr)] try: remaining = set(seq) @@ -38,44 +38,52 @@ def unique(seq, keepstr=True): seen = [] return t(c for c in seq if not (c in seen or seen.append(c))) +#note: this exception seems unused class ResponseError( Tier0Error ): - def __init__( self, curl, response, proxy, timeout ): + def __init__( self, curl, response, proxy, timeout, maxTime ): super( ResponseError, self ).__init__( response ) self.args += ( curl, proxy ) self.timeout = timeout - - def __str__( self ): - errStr = """Wrong response for curl connection to Tier0DataSvc from URL \"%s\"""" %( self.args[1].getinfo( self.args[1].EFFECTIVE_URL ), ) - if self.args[ -1 ]: - errStr += """ using proxy \"%s\"""" %( str( self.args[ -1 ] ), ) - errStr += """ with timeout \"%d\" with error code \"%d\".""" %( self.timeout, self.args[1].getinfo( self.args[1].RESPONSE_CODE) ) - if self.args[0].find( '

' ) != -1: - errStr += """\nFull response: \"%s\".""" %( self.args[0].partition('

')[-1].rpartition('

')[0], ) + self.maxTime = maxTime + + def __str__(self): + errStr = f'Wrong response for curl connection to Tier0DataSvc'\ + f' from URL "{self.args[1].getinfo(self.args[1].EFFECTIVE_URL)}"' + if self.args[-1]: + errStr += f' using proxy "{str(self.args[-1])}"' + errStr += f' with connection-timeout "{self.timeout}", max-time "{self.maxtime}"'\ + f' with error code "{self.args[1].getinfo(self.args[1].RESPONSE_CODE)}".' + if '

' in self.args[0]: + full_response = self.args[0].partition('

')[-1].rpartition('

')[0] + errStr += f'\nFull response: "{full_response}".' else: - errStr += """\nFull response: \"%s\".""" %( self.args[0], ) + errStr += f'\nFull response: "{self.args[0]}".' + return errStr #TODO: Add exceptions for each category of HTTP error codes #TODO: check response code and raise corresponding exceptions - -def _raise_http_error( curl, response, proxy, timeout ): - raise ResponseError( curl, response, proxy, timeout ) +#note: this function seems to be unused +def _raise_http_error( curl, response, proxy, timeout, maxTime ): + raise ResponseError( curl, response, proxy, timeout, maxTime ) class Tier0Handler( object ): - def __init__( self, uri, timeOut, retries, retryPeriod, proxy, debug ): + def __init__( self, uri, timeOut, maxTime, retries, retryPeriod, proxy, debug ): """ Parameters: uri: Tier0DataSvc URI; - timeOut: time out for Tier0DataSvc HTTPS calls; + timeOut: time out for connection of Tier0DataSvc HTTPS calls [seconds]; + maxTime: maximum time for Tier0DataSvc HTTPS calls (including data transfer) [seconds]; retries: maximum retries for Tier0DataSvc HTTPS calls; - retryPeriod: sleep time between two Tier0DataSvc HTTPS calls; + retryPeriod: sleep time between two Tier0DataSvc HTTPS calls [seconds]; proxy: HTTP proxy for accessing Tier0DataSvc HTTPS calls; debug: if set to True, enables debug information. """ self._uri = uri self._timeOut = timeOut + self._maxTime = maxTime self._retries = retries self._retryPeriod = retryPeriod self._proxy = proxy @@ -90,51 +98,69 @@ def unsetDebug( self ): def setProxy( self, proxy ): self._proxy = proxy - def _queryTier0DataSvc( self, url ): - """ - Queries Tier0DataSvc. - url: Tier0DataSvc URL. - @returns: dictionary, from whence the required information must be retrieved according to the API call. - Raises if connection error, bad response, or timeout after retries occur. - """ + def _getCerts( self ) -> str: + cert_path = os.getenv('X509_USER_CERT', '') + key_path = os.getenv('X509_USER_KEY', '') - userAgent = "User-Agent: ConditionWebServices/1.0 python/%d.%d.%d PycURL/%s" % ( sys.version_info[ :3 ] + ( pycurl.version_info()[ 1 ], ) ) - - proxy = "" - if self._proxy: proxy = ' --proxy=%s ' % self._proxy - - debug = " -s -S " - if self._debug: debug = " -v " + certs = "" + if cert_path: + certs += f' --cert {cert_path}' + else: + logging.warning("No certificate provided for Tier0 access, use X509_USER_CERT and" + " optionally X509_USER_KEY env variables to specify the path to the cert" + " (and the key unless included in the cert file)") + if key_path: + certs += f' --key {key_path}' + return certs + + def _curlQueryTier0( self, url:str, force_debug:bool = False, force_cert:bool = False): + userAgent = "User-Agent: ConditionWebServices/1.0 python/%d.%d.%d PycURL/%s" \ + % ( sys.version_info[ :3 ] + ( pycurl.version_info()[ 1 ], ) ) + debug = "-v" if self._debug or force_debug else "-s -S" + + proxy = f"--proxy {self._proxy}" if self._proxy else "" + certs = self._getCerts() if not self._proxy or force_cert else "" - cmd = '/usr/bin/curl -k -L --user-agent "%s" %s --connect-timeout %i --retry %i %s %s ' % (userAgent, proxy, self._timeOut, self._retries, debug, url) + cmd = f'/usr/bin/curl -k -L --user-agent "{userAgent}" {proxy}'\ + f' --connect-timeout {self._timeOut} --max-time {self._maxTime} --retry {self._retries}'\ + f' {debug} {url} {certs}' # time the curl to understand if re-tries have been carried out start = time.time() process = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (stdoutdata, stderrdata) = process.communicate() - retcode = process.returncode end = time.time() + return process.returncode, stdoutdata, stderrdata, end-start + + def _queryTier0DataSvc( self, url ): + """ + Queries Tier0DataSvc. + url: Tier0DataSvc URL. + @returns: dictionary, from whence the required information must be retrieved according to the API call. + Raises if connection error, bad response, or timeout after retries occur. + """ + + retcode, stdoutdata, stderrdata, query_time = self._curlQueryTier0(url) if retcode != 0 or stderrdata: - - # if the first curl has failed, logg its stderror and prepare and independent retry - msg = "looks like curl returned an error: retcode=%s and took %s seconds" % (retcode,(end-start),) - msg += ' msg = "'+str(stderrdata)+'"' - logging.error(msg) - - time.sleep(10) - cmd = '/usr/bin/curl -k -L --user-agent "%s" %s --connect-timeout %i --retry %i %s %s ' % (userAgent, proxy, self._timeOut, self._retries, "-v", url) - process = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - (stdoutdata, stderrdata) = process.communicate() - retcode = process.returncode - if retcode != 0: - msg = "looks like curl returned an error for the second time: retcode=%s" % (retcode,) - msg += ' msg = "'+str(stderrdata)+'"' - logging.error(msg) - raise Tier0Error(msg) - else : - msg = "curl returned ok upon the second try" - logging.info(msg) + + # if the first curl has failed, logg its stderror and prepare and independent retry + msg = "looks like curl returned an error: retcode=%s and took %s seconds" % (retcode, query_time,) + msg += ' msg = "'+str(stderrdata)+'"' + logging.error(msg) + if self._proxy: + logging.info("before assumed proxy provides authentication, now trying with both proxy and certificate") + + time.sleep(self._retryPeriod) + retcode, stdoutdata, stderrdata, query_time = self._curlQueryTier0(url, force_debug=True, force_cert=True) + if retcode != 0: + msg = "looks like curl returned an error for the second time: retcode=%s" % (retcode,) + msg += ' msg = "'+str(stderrdata)+'"' + logging.error(msg) + raise Tier0Error(msg) + else: + msg = "curl returned ok upon the second try" + logging.info(msg) resp = json.loads( ''.join(stdoutdata.decode()).replace( "'", '"').replace(' None', ' "None"') ) return resp @@ -149,7 +175,8 @@ def getFirstSafeRun( self ): firstConditionSafeRunAPI = "firstconditionsaferun" safeRunDict = self._queryTier0DataSvc( os.path.join( self._uri, firstConditionSafeRunAPI ) ) if safeRunDict is None: - errStr = """First condition safe run is not available in Tier0DataSvc from URL \"%s\"""" %( os.path.join( self._uri, firstConditionSafeRunAPI ), ) + errStr = """First condition safe run is not available in Tier0DataSvc from URL \"%s\"""" \ + %( os.path.join( self._uri, firstConditionSafeRunAPI ), ) if self._proxy: errStr += """ using proxy \"%s\".""" %( str( self._proxy ), ) raise Tier0Error( errStr ) @@ -164,19 +191,20 @@ def getGlobalTag( self, config ): Raises if connection error, bad response, timeout after retries occur, or if no Global Tags are available. """ data = self._queryTier0DataSvc( os.path.join( self._uri, config ) ) - gtnames = sorted(unique( [ str( di[ 'global_tag' ] ) for di in data['result'] if di[ 'global_tag' ] is not None ] )) + gtnames = sorted(unique( [ str( di['global_tag'] ) for di in data['result'] if di['global_tag'] is not None ] )) try: recentGT = gtnames[-1] return recentGT except IndexError: - errStr = """No Global Tags for \"%s\" are available in Tier0DataSvc from URL \"%s\"""" %( config, os.path.join( self._uri, config ) ) + errStr = """No Global Tags for \"%s\" are available in Tier0DataSvc from URL \"%s\"""" \ + %( config, os.path.join( self._uri, config ) ) if self._proxy: errStr += """ using proxy \"%s\".""" %( str( self._proxy ), ) raise Tier0Error( errStr ) def test( url ): - t0 = Tier0Handler( url, 1, 1, 1, None, debug=False) + t0 = Tier0Handler( url, 1, 5, 1, 10, None, debug=False) print(' fcsr = %s (%s)' % (t0.getFirstSafeRun(), type(t0.getFirstSafeRun()) )) print(' reco_config = %s' % t0.getGlobalTag('reco_config')) @@ -186,4 +214,3 @@ def test( url ): if __name__ == '__main__': test( tier0Url ) - diff --git a/CondCore/Utilities/scripts/conddb b/CondCore/Utilities/scripts/conddb index 5b33496db1938..788ec3fc2fe6b 100755 --- a/CondCore/Utilities/scripts/conddb +++ b/CondCore/Utilities/scripts/conddb @@ -706,12 +706,13 @@ def _get_hlt_fcsr( session, timeType ): def _get_prompt_fcsr( session, timeType ): tier0timeout = 5 + tier0maxtime = 60 tier0retries = 3 tier0retryPeriod = 5 tier0proxy = None try: t0DataSvc = Tier0Handler( tier0Url, - tier0timeout, tier0retries, tier0retryPeriod, + tier0timeout, tier0maxtime, tier0retries, tier0retryPeriod, tier0proxy, False ) try: fcsr = t0DataSvc.getFirstSafeRun() diff --git a/Configuration/AlCa/python/autoCond.py b/Configuration/AlCa/python/autoCond.py index 0de8dce141fc1..d2d45614d765e 100644 --- a/Configuration/AlCa/python/autoCond.py +++ b/Configuration/AlCa/python/autoCond.py @@ -37,9 +37,9 @@ 'run3_data_express' : '140X_dataRun3_Express_frozen_v1', # GlobalTag for Run3 data relvals (prompt GT) - 140X_dataRun3_Prompt_v3 but snapshot at 2024-05-31 09:09:12 (UTC) 'run3_data_prompt' : '140X_dataRun3_Prompt_frozen_v3', - # GlobalTag for Run3 offline data reprocessing - snapshot at 2024-02-07 16:38:59 (UTC) - 'run3_data' : '140X_dataRun3_v4', - # GlobalTag for Run3 offline data reprocessing with Prompt GT, currenlty for 2022FG - snapshot at 2024-02-12 12:00:00 (UTC) + # GlobalTag for Run3 offline data reprocessing - snapshot at 2024-09-04 16:25:09 (UTC) + 'run3_data' : '140X_dataRun3_v9', + # GlobalTag for Run3 offline data reprocessing with Prompt GT, currently for 2022FG - snapshot at 2024-02-12 12:00:00 (UTC) 'run3_data_PromptAnalysis' : '140X_dataRun3_PromptAnalysis_v2', # GlobalTag for MC production with perfectly aligned and calibrated detector for Phase1 2017 (and 0,0,~0-centred beamspot) 'phase1_2017_design' : '131X_mc2017_design_v3', diff --git a/Configuration/Eras/python/Era_Run3_2024_cff.py b/Configuration/Eras/python/Era_Run3_2024_cff.py index 0942fc2cad206..ca6a04e3fb756 100644 --- a/Configuration/Eras/python/Era_Run3_2024_cff.py +++ b/Configuration/Eras/python/Era_Run3_2024_cff.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms from Configuration.Eras.Era_Run3_cff import Run3 -from Configuration.Eras.Modifier_run3_2024_L1T_cff import run3_2024_L1T +from Configuration.Eras.Modifier_stage2L1Trigger_2024_cff import stage2L1Trigger_2024 from Configuration.Eras.Modifier_run3_scouting_nanoAOD_post2023_cff import run3_scouting_nanoAOD_post2023 -Run3_2024 = cms.ModifierChain(Run3, run3_2024_L1T, run3_scouting_nanoAOD_post2023) +Run3_2024 = cms.ModifierChain(Run3, stage2L1Trigger_2024, run3_scouting_nanoAOD_post2023) \ No newline at end of file diff --git a/Configuration/Eras/python/Modifier_run3_2024_L1T_cff.py b/Configuration/Eras/python/Modifier_stage2L1Trigger_2024_cff.py similarity index 52% rename from Configuration/Eras/python/Modifier_run3_2024_L1T_cff.py rename to Configuration/Eras/python/Modifier_stage2L1Trigger_2024_cff.py index 7a981a35023ac..e8140b6718e9e 100644 --- a/Configuration/Eras/python/Modifier_run3_2024_L1T_cff.py +++ b/Configuration/Eras/python/Modifier_stage2L1Trigger_2024_cff.py @@ -1,3 +1,3 @@ import FWCore.ParameterSet.Config as cms -run3_2024_L1T = cms.Modifier() +stage2L1Trigger_2024 = cms.Modifier() diff --git a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py index 8a70a74aa0c3e..5534e45c5cb67 100644 --- a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py +++ b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py @@ -1639,7 +1639,8 @@ def setup_(self, step, stepName, stepDict, k, properties): '--customise' : 'HeterogeneousCore/AlpakaServices/customiseAlpakaServiceMemoryFilling.customiseAlpakaServiceMemoryFilling', }, harvest = { - '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM' + '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM', + '--procModifiers': 'alpakaValidation', }, suffix = 'Patatrack_PixelOnlyAlpaka_Validation', offset = 0.403, diff --git a/DQM/EcalMonitorClient/python/IntegrityClient_cfi.py b/DQM/EcalMonitorClient/python/IntegrityClient_cfi.py index 7f631d75a86da..2a2e61d0aecbf 100644 --- a/DQM/EcalMonitorClient/python/IntegrityClient_cfi.py +++ b/DQM/EcalMonitorClient/python/IntegrityClient_cfi.py @@ -27,7 +27,7 @@ kind = cms.untracked.string('TH2F'), otype = cms.untracked.string('Ecal3P'), btype = cms.untracked.string('Crystal'), - description = cms.untracked.string('Summary of the data integrity. A channel is red if more than ' + str(errFractionThreshold) + ' of its entries have integrity errors.') + description = cms.untracked.string('Summary of the data integrity. A channel is red if more than ' + str(errFractionThreshold) + ' of its entries have integrity errors. Also, an entire SuperModule can show red if more than 0.01 of its entries have DCC-SRP or DCC-TCC Desync errors.') ), Quality = cms.untracked.PSet( path = cms.untracked.string('%(subdet)s/%(prefix)sIntegrityClient/%(prefix)sIT data integrity quality %(sm)s'), diff --git a/DQM/EcalMonitorClient/src/IntegrityClient.cc b/DQM/EcalMonitorClient/src/IntegrityClient.cc index 159904346cce8..ecd33aa1ef42f 100644 --- a/DQM/EcalMonitorClient/src/IntegrityClient.cc +++ b/DQM/EcalMonitorClient/src/IntegrityClient.cc @@ -123,15 +123,20 @@ namespace ecaldqm { } } - // Quality check: set an entire FED to BAD if "any" DCC-SRP or DCC-TCC mismatch errors are detected + // Quality check: set an entire FED to BAD if "any" DCC-SRP or DCC-TCC mismatch errors are detected AND the number of events affected by the DCC-SRP or DCC-TCC mismatch errors is more than 1% of the events analyzed in the run // Fill mismatch statistics MESet const& sBXSRP(sources_.at("BXSRP")); MESet const& sBXTCC(sources_.at("BXTCC")); std::vector hasMismatchDCC(nDCC, false); for (unsigned iDCC(0); iDCC < nDCC; ++iDCC) { - if (sBXSRP.getBinContent(getEcalDQMSetupObjects(), iDCC + 1) > 50. || - sBXTCC.getBinContent(getEcalDQMSetupObjects(), iDCC + 1) > 50.) // "any" => 50 - hasMismatchDCC[iDCC] = true; + int nBXSRPdesync = sBXSRP.getBinContent(getEcalDQMSetupObjects(), iDCC + 1); + int nBXTCCdesync = sBXTCC.getBinContent(getEcalDQMSetupObjects(), iDCC + 1); + + if (nBXSRPdesync > 50. || nBXTCCdesync > 50.) { // "any" => 50 + if (nBXSRPdesync > int(0.01 * processedEvents) || nBXTCCdesync > int(0.01 * processedEvents)) { // check if the events with DCC-SRP or DCC-TCC desyncs for the given DCC is more than 1% of the events analyzed + hasMismatchDCC[iDCC] = true; + } + } } // Analyze mismatch statistics for (MESet::iterator qsItr(meQualitySummary.beginChannel(GetElectronicsMap())); diff --git a/DQM/EcalMonitorTasks/python/RawDataTask_cfi.py b/DQM/EcalMonitorTasks/python/RawDataTask_cfi.py index 25c4fe7e05018..6ba4284e2e8cd 100644 --- a/DQM/EcalMonitorTasks/python/RawDataTask_cfi.py +++ b/DQM/EcalMonitorTasks/python/RawDataTask_cfi.py @@ -49,6 +49,34 @@ ecalRawDataTask = cms.untracked.PSet( MEs = cms.untracked.PSet( + TrendBXTCC = cms.untracked.PSet( + path = cms.untracked.string('Ecal/Trends/RawDataTask number of %(prefix)sRDT bunch crossing TCC errors'), + kind = cms.untracked.string('TH1F'), + otype = cms.untracked.string('Ecal2P'), + btype = cms.untracked.string('Trend'), + description = cms.untracked.string('Trend of the number of bunch crossing value mismatches between DCC and TCC.') + ), + TrendL1ATCC = cms.untracked.PSet( + path = cms.untracked.string('Ecal/Trends/RawDataTask number of %(prefix)sRDT L1A TCC errors'), + kind = cms.untracked.string('TH1F'), + otype = cms.untracked.string('Ecal2P'), + btype = cms.untracked.string('Trend'), + description = cms.untracked.string('Trend of the number of L1A value mismatches between DCC and TCC.') + ), + TrendBXSRP = cms.untracked.PSet( + path = cms.untracked.string('Ecal/Trends/RawDataTask number of %(prefix)sRDT bunch crossing SRP errors'), + kind = cms.untracked.string('TH1F'), + otype = cms.untracked.string('Ecal2P'), + btype = cms.untracked.string('Trend'), + description = cms.untracked.string('Trend of the number of bunch crossing value mismatches between DCC and SRP.') + ), + TrendL1ASRP = cms.untracked.PSet( + path = cms.untracked.string('Ecal/Trends/RawDataTask number of %(prefix)sRDT L1A SRP errors'), + kind = cms.untracked.string('TH1F'), + otype = cms.untracked.string('Ecal2P'), + btype = cms.untracked.string('Trend'), + description = cms.untracked.string('Trend of the number of L1A value mismatches between DCC and SRP.') + ), BXSRP = cms.untracked.PSet( path = cms.untracked.string('%(subdet)s/%(prefix)sRawDataTask/%(prefix)sRDT bunch crossing SRP errors'), kind = cms.untracked.string('TH1F'), diff --git a/DQM/EcalMonitorTasks/src/RawDataTask.cc b/DQM/EcalMonitorTasks/src/RawDataTask.cc index 225dbac456508..d3b9087de0e50 100644 --- a/DQM/EcalMonitorTasks/src/RawDataTask.cc +++ b/DQM/EcalMonitorTasks/src/RawDataTask.cc @@ -88,6 +88,10 @@ namespace ecaldqm { MESet& meBXSRP(MEs_.at("BXSRP")); MESet& meL1ASRP(MEs_.at("L1ASRP")); MESet& meTrendNSyncErrors(MEs_.at("L1ATCC")); + MESet& meTrendBXTCC(MEs_.at("TrendBXTCC")); + MESet& meTrendL1ATCC(MEs_.at("TrendL1ATCC")); + MESet& meTrendBXSRP(MEs_.at("TrendBXSRP")); + MESet& meTrendL1ASRP(MEs_.at("TrendL1ASRP")); MESet& meEventTypePreCalib(MEs_.at("EventTypePreCalib")); MESet& meEventTypeCalib(MEs_.at("EventTypeCalib")); MESet& meEventTypePostCalib(MEs_.at("EventTypePostCalib")); @@ -214,30 +218,54 @@ namespace ecaldqm { if (tccBx.size() == 4) { // EB uses tccBx[0]; EE uses all if (dccId <= kEEmHigh + 1 || dccId >= kEEpLow + 1) { for (int iTCC(0); iTCC < 4; iTCC++) { - if (tccBx[iTCC] != dccBX && tccBx[iTCC] != -1 && dccBX != -1) + if (tccBx[iTCC] != dccBX && tccBx[iTCC] != -1 && dccBX != -1) { meBXTCC.fill(getEcalDQMSetupObjects(), dccId); + meTrendBXTCC.fill(getEcalDQMSetupObjects(), EcalEndcap, double(timestamp_.iLumi), 1); + } - if (tccL1[iTCC] != dccL1AShort && tccL1[iTCC] != -1 && dccL1AShort != 0) + if (tccL1[iTCC] != dccL1AShort && tccL1[iTCC] != -1 && dccL1AShort != 0) { meL1ATCC.fill(getEcalDQMSetupObjects(), dccId); + meTrendL1ATCC.fill(getEcalDQMSetupObjects(), EcalEndcap, double(timestamp_.iLumi), 1); + } } } else { - if (tccBx[0] != dccBX && tccBx[0] != -1 && dccBX != -1) + if (tccBx[0] != dccBX && tccBx[0] != -1 && dccBX != -1) { meBXTCC.fill(getEcalDQMSetupObjects(), dccId); + meTrendBXTCC.fill(getEcalDQMSetupObjects(), EcalBarrel, double(timestamp_.iLumi), 1); + } - if (tccL1[0] != dccL1AShort && tccL1[0] != -1 && dccL1AShort != 0) + if (tccL1[0] != dccL1AShort && tccL1[0] != -1 && dccL1AShort != 0) { meL1ATCC.fill(getEcalDQMSetupObjects(), dccId); + meTrendL1ATCC.fill(getEcalDQMSetupObjects(), EcalBarrel, double(timestamp_.iLumi), 1); + } } } short srpBx(dcchItr->getSRPBx()); short srpL1(dcchItr->getSRPLv1()); - if (srpBx != dccBX && srpBx != -1 && dccBX != -1) + if (srpBx != dccBX && srpBx != -1 && dccBX != -1) { meBXSRP.fill(getEcalDQMSetupObjects(), dccId); - if (srpL1 != dccL1AShort && srpL1 != -1 && dccL1AShort != 0) + if (dccId <= kEEmHigh + 1 || dccId >= kEEpLow + 1) { // EE + meTrendBXSRP.fill(getEcalDQMSetupObjects(), EcalEndcap, double(timestamp_.iLumi), 1); + } + else { // EB + meTrendBXSRP.fill(getEcalDQMSetupObjects(), EcalBarrel, double(timestamp_.iLumi), 1); + } + } + + if (srpL1 != dccL1AShort && srpL1 != -1 && dccL1AShort != 0) { meL1ASRP.fill(getEcalDQMSetupObjects(), dccId); + if (dccId <= kEEmHigh + 1 || dccId >= kEEpLow + 1) { // EE + meTrendL1ASRP.fill(getEcalDQMSetupObjects(), EcalEndcap, double(timestamp_.iLumi), 1); + } + else { // EB + meTrendL1ASRP.fill(getEcalDQMSetupObjects(), EcalBarrel, double(timestamp_.iLumi), 1); + } + } + const int calibBX(3490); short runType(dcchItr->getRunType() + 1); diff --git a/DQM/GEM/plugins/GEMDQMHarvester.cc b/DQM/GEM/plugins/GEMDQMHarvester.cc index 8437308c764e4..f7043cbf51d18 100644 --- a/DQM/GEM/plugins/GEMDQMHarvester.cc +++ b/DQM/GEM/plugins/GEMDQMHarvester.cc @@ -349,12 +349,13 @@ void GEMDQMHarvester::getGeometryInfo(edm::Service &store, MonitorElem if (h2Src != nullptr) { // For online and offline Int_t nBinY = h2Src->getNbinsY(); listLayer_.push_back(""); + Int_t nNumMerge = std::max((Int_t)(h2Src->getBinContent(0, 0) + 0.5), 1); for (Int_t i = 1; i <= nBinY; i++) { std::string strLabelFull = h2Src->getTH2F()->GetYaxis()->GetBinLabel(i); auto nPos = strLabelFull.find(';'); auto strLayer = strLabelFull.substr(nPos + 1); - Int_t nBinXActual = (Int_t)(h2Src->getBinContent(0, i) + 0.5); + Int_t nBinXActual = ((Int_t)(h2Src->getBinContent(0, i) + 0.5)) / nNumMerge; if (nBinXActual > 108) { // When the number seems wrong if (strLayer.find("GE11") != std::string::npos) { nBinXActual = 36; diff --git a/DQM/GEM/src/GEMDQMBase.cc b/DQM/GEM/src/GEMDQMBase.cc index 0544639cdcf7a..5328c0e204bc4 100644 --- a/DQM/GEM/src/GEMDQMBase.cc +++ b/DQM/GEM/src/GEMDQMBase.cc @@ -189,6 +189,8 @@ dqm::impl::MonitorElement* GEMDQMBase::CreateSummaryHist(DQMStore::IBooker& iboo h2Res->setBinContent(0, i, nNumCh); } + h2Res->setBinContent(0, 0, 1.0); + return h2Res; } diff --git a/DQM/HcalTasks/data/HcalQualityTests.xml b/DQM/HcalTasks/data/HcalQualityTests.xml index 1e72797cb84e5..c39d2df08e6de 100644 --- a/DQM/HcalTasks/data/HcalQualityTests.xml +++ b/DQM/HcalTasks/data/HcalQualityTests.xml @@ -30,4 +30,21 @@ BadCapIDThreshold - \ No newline at end of file + + ContentsWithinExpected + 1.0 + 1.0 + -1.0 + 0.0 + 0.0 + 0.0 + -1.0 + 0 + 1 + + + BadQualityThreshold + + + + diff --git a/DQM/HcalTasks/interface/DigiTask.h b/DQM/HcalTasks/interface/DigiTask.h index e13f532ee5a15..e2664eb15c3ee 100644 --- a/DQM/HcalTasks/interface/DigiTask.h +++ b/DQM/HcalTasks/interface/DigiTask.h @@ -169,7 +169,7 @@ class DigiTask : public hcaldqm::DQTask { hcaldqm::ContainerSingle2D _cCapidMinusBXmod4_CrateSlotuTCA[4]; // CrateSlot 2D histograms for each (capid-BX)%4 hcaldqm::ContainerSingle2D _cCapid_BadvsFEDvsLS; hcaldqm::ContainerSingle2D - _cCapid_BadvsFEDvsLSmod60; // Same as _cCapid_BadvsFEDvsLS, but only for last 50 LSes (for sound alarm turning off when problem goes away) + _cCapid_BadvsFEDvsLSmod10; // Same as _cCapid_BadvsFEDvsLS, but only for last 50 LSes (for sound alarm turning off when problem goes away) // #events counters MonitorElement *meNumEvents1LS; // to transfer the #events to harvesting diff --git a/DQM/HcalTasks/interface/RawTask.h b/DQM/HcalTasks/interface/RawTask.h index 99b35969afdf6..fe994a5538518 100644 --- a/DQM/HcalTasks/interface/RawTask.h +++ b/DQM/HcalTasks/interface/RawTask.h @@ -51,7 +51,7 @@ class RawTask : public hcaldqm::DQTask { // physics vs calib processing switch bool _calibProcessing; int _thresh_calib_nbadq; - + int _NBadQEvent; // vector of HcalElectronicsId for FEDs std::vector _vhashFEDs; @@ -75,8 +75,9 @@ class RawTask : public hcaldqm::DQTask { hcaldqm::Container2D _cOrnMsm_ElectronicsuTCA; hcaldqm::ContainerXXX _xEvnMsmLS, _xBcnMsmLS, _xOrnMsmLS, _xBadQLS; - hcaldqm::Container2D _cSummaryvsLS_FED; // online only - hcaldqm::ContainerSingle2D _cSummaryvsLS; // online only + hcaldqm::Container2D _cSummaryvsLS_FED; // online only + hcaldqm::ContainerSingle2D _cSummaryvsLS; // online only + hcaldqm::ContainerSingle2D _cBadQ_FEDvsLSmod10; // online only }; #endif diff --git a/DQM/HcalTasks/plugins/DigiTask.cc b/DQM/HcalTasks/plugins/DigiTask.cc index 7b9daa4e19052..69bede7bd69db 100644 --- a/DQM/HcalTasks/plugins/DigiTask.cc +++ b/DQM/HcalTasks/plugins/DigiTask.cc @@ -459,9 +459,9 @@ DigiTask::DigiTask(edm::ParameterSet const& ps) new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), 0); - _cCapid_BadvsFEDvsLSmod60.initialize(_name, + _cCapid_BadvsFEDvsLSmod10.initialize(_name, "CapID", - new hcaldqm::quantity::LumiSection(60), + new hcaldqm::quantity::LumiSection(10), new hcaldqm::quantity::FEDQuantity(vFEDs), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), 0); @@ -658,7 +658,7 @@ DigiTask::DigiTask(edm::ParameterSet const& ps) _cCapidMinusBXmod4_SubdetPM.book(ib, _emap, _subsystem); if (_ptype == fOnline) { _cCapid_BadvsFEDvsLS.book(ib, _subsystem, "BadvsLS"); - _cCapid_BadvsFEDvsLSmod60.book(ib, _subsystem, "BadvsLSmod60"); + _cCapid_BadvsFEDvsLSmod10.book(ib, _subsystem, "BadvsLSmod10"); } for (int i = 0; i < 4; ++i) { constexpr unsigned int kSize = 32; @@ -787,10 +787,10 @@ DigiTask::DigiTask(edm::ParameterSet const& ps) _xQuality = lumiCache->xQuality; if (_ptype == fOnline && - lumiCache->EvtCntLS == 1) { // Reset the bin for _cCapid_BadvsFEDvsLSmod60 at the beginning of each new LS + lumiCache->EvtCntLS == 1) { // Reset the bin for _cCapid_BadvsFEDvsLSmod10 at the beginning of each new LS for (std::vector::const_iterator it = _vhashFEDs.begin(); it != _vhashFEDs.end(); ++it) { HcalElectronicsId eid = HcalElectronicsId(*it); - _cCapid_BadvsFEDvsLSmod60.setBinContent(eid, _currentLS % 60, 0); + _cCapid_BadvsFEDvsLSmod10.setBinContent(eid, _currentLS % 10, 0); } } @@ -898,7 +898,7 @@ DigiTask::DigiTask(edm::ParameterSet const& ps) if (!good_capidmbx) { _xBadCapid.get(eid)++; _cCapid_BadvsFEDvsLS.fill(eid, _currentLS); - _cCapid_BadvsFEDvsLSmod60.fill(eid, _currentLS % 60); + _cCapid_BadvsFEDvsLSmod10.fill(eid, _currentLS % 10); } if (!eid.isVMEid()) { _cCapidMinusBXmod4_CrateSlotuTCA[this_capidmbx].fill(eid); @@ -1091,7 +1091,7 @@ DigiTask::DigiTask(edm::ParameterSet const& ps) if (!good_capidmbx) { _xBadCapid.get(eid)++; _cCapid_BadvsFEDvsLS.fill(eid, _currentLS); - _cCapid_BadvsFEDvsLSmod60.fill(eid, _currentLS % 60); + _cCapid_BadvsFEDvsLSmod10.fill(eid, _currentLS % 10); } if (!eid.isVMEid()) { _cCapidMinusBXmod4_CrateSlotuTCA[this_capidmbx].fill(eid); @@ -1256,7 +1256,7 @@ DigiTask::DigiTask(edm::ParameterSet const& ps) if (!good_capidmbx) { _xBadCapid.get(eid)++; _cCapid_BadvsFEDvsLS.fill(eid, _currentLS); - _cCapid_BadvsFEDvsLSmod60.fill(eid, _currentLS % 60); + _cCapid_BadvsFEDvsLSmod10.fill(eid, _currentLS % 10); } if (!eid.isVMEid()) { _cCapidMinusBXmod4_CrateSlotuTCA[this_capidmbx].fill(eid); diff --git a/DQM/HcalTasks/plugins/RawTask.cc b/DQM/HcalTasks/plugins/RawTask.cc index 1206a6a5166e3..3fe1693c98fa9 100644 --- a/DQM/HcalTasks/plugins/RawTask.cc +++ b/DQM/HcalTasks/plugins/RawTask.cc @@ -18,6 +18,7 @@ RawTask::RawTask(edm::ParameterSet const& ps) _vflags[fBcnMsm] = flag::Flag("BcnMsm"); _vflags[fBadQ] = flag::Flag("BadQ"); _vflags[fOrnMsm] = flag::Flag("OrnMsm"); + _NBadQEvent = 0; } /* virtual */ void RawTask::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) { @@ -131,6 +132,12 @@ RawTask::RawTask(edm::ParameterSet const& ps) new hcaldqm::quantity::FEDQuantity(vFEDs), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fState), 0); + _cBadQ_FEDvsLSmod10.initialize(_name, + "BadQ_FEDvsLSmod10", + new hcaldqm::quantity::LumiSection(10), + new hcaldqm::quantity::FEDQuantity(vFEDs), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); // FED Size vs LS _cDataSizevsLS_FED.initialize(_name, "DataSizevsLS", @@ -166,6 +173,7 @@ RawTask::RawTask(edm::ParameterSet const& ps) _xBadQLS.book(_emap); _cSummaryvsLS_FED.book(ib, _emap, _subsystem); _cSummaryvsLS.book(ib, _subsystem); + _cBadQ_FEDvsLSmod10.book(ib, _subsystem); _cDataSizevsLS_FED.book(ib, _emap, _subsystem); } @@ -224,6 +232,12 @@ RawTask::RawTask(edm::ParameterSet const& ps) // TODO: Include for Online Calibration Channels marked as bad // a comment below is left on purpose! //_cBadQualityvsBX.fill(bx, creport->badQualityDigis()); + int Nbadq = creport->badQualityDigis(); + if (lumiCache->EvtCntLS == 1) + _NBadQEvent = 0; // Reset at the beginning of each new LS + if (Nbadq > 0) + _NBadQEvent++; + //std::cout << " Nbadq "<< Nbadq << " NBadQEvent " <<_NBadQEvent<< std::endl; for (std::vector::const_iterator it = creport->bad_quality_begin(); it != creport->bad_quality_end(); ++it) { // skip non HCAL det ids if (!HcalGenericDetId(*it).isHcalDetId()) @@ -242,7 +256,9 @@ RawTask::RawTask(edm::ParameterSet const& ps) _cBadQuality_depth.fill(HcalDetId(*it)); // ONLINE ONLY! if (_ptype == fOnline) + //Number of BadQualityDigis _xBadQLS.get(eid)++; + //std::cout << " event _xBadQLS "<< double(_xBadQLS.get(eid)) << std::endl; if (_ptype != fOffline) { // hidefed2crate if (!eid.isVMEid()) { if (_filter_FEDsuTCA.filter(eid)) @@ -393,13 +409,15 @@ std::shared_ptr RawTask::globalBeginLuminosityBlock(edm::Luminos for (std::vector::const_iterator it = _vhashFEDs.begin(); it != _vhashFEDs.end(); ++it) { flag::Flag fSum("RAW"); HcalElectronicsId eid = HcalElectronicsId(*it); - + int fed = hcaldqm::utilities::crate2fed(eid.crateId(), eid.slot()); std::vector::const_iterator cit = std::find(_vcdaqEids.begin(), _vcdaqEids.end(), *it); if (cit == _vcdaqEids.end()) { // not @cDAQ for (uint32_t iflag = 0; iflag < _vflags.size(); iflag++) _cSummaryvsLS_FED.setBinContent(eid, _currentLS, int(iflag), int(flag::fNCDAQ)); _cSummaryvsLS.setBinContent(eid, _currentLS, int(flag::fNCDAQ)); + if (!hcaldqm::utilities::isFEDHO(eid) && fed != 1136) + _cBadQ_FEDvsLSmod10.setBinContent(eid, _currentLS % 10, int(flag::fNCDAQ)); continue; } @@ -419,9 +437,13 @@ std::shared_ptr RawTask::globalBeginLuminosityBlock(edm::Luminos _vflags[fOrnMsm]._state = flag::fGOOD; if (double(_xBadQLS.get(eid)) > double(12 * _evsPerLS)) _vflags[fBadQ]._state = flag::fBAD; - else if (_xBadQLS.get(eid) > 0) + //else if (_xBadQLS.get(eid) > 0){ + // Following line added due to https://gitlab.cern.ch/cmshcal/docs/-/issues/233 + // BadQ > (5%) of number of events in this LS. + else if (double(_xBadQLS.get(eid)) > 0 && double(_NBadQEvent) > double(0.05 * _evsPerLS)) { _vflags[fBadQ]._state = flag::fPROBLEMATIC; - else + + } else _vflags[fBadQ]._state = flag::fGOOD; } @@ -431,6 +453,12 @@ std::shared_ptr RawTask::globalBeginLuminosityBlock(edm::Luminos // - reset each flag right after using it for (std::vector::iterator ft = _vflags.begin(); ft != _vflags.end(); ++ft) { _cSummaryvsLS_FED.setBinContent(eid, _currentLS, int(iflag), ft->_state); + + if (ft->_name == "BadQ") { + if (!hcaldqm::utilities::isFEDHO(eid) && fed != 1136 && ft->_state != 3) { + _cBadQ_FEDvsLSmod10.setBinContent(eid, _currentLS % 10, (double(_NBadQEvent) / double(_evsPerLS)) * 100); + } + } fSum += (*ft); iflag++; diff --git a/DQM/Integration/python/clients/l1tstage2_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/l1tstage2_dqm_sourceclient-live_cfg.py index 0350ce6412c73..80024d91aa6cd 100644 --- a/DQM/Integration/python/clients/l1tstage2_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/l1tstage2_dqm_sourceclient-live_cfg.py @@ -1,8 +1,8 @@ import FWCore.ParameterSet.Config as cms import sys -from Configuration.Eras.Era_Run3_cff import Run3 -process = cms.Process("L1TStage2DQM", Run3) +from Configuration.Eras.Era_Run3_2024_cff import Run3_2024 +process = cms.Process("L1TStage2DQM", Run3_2024) unitTest = False if 'unitTest=True' in sys.argv: 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 9f19fd4704428..906f9456f8686 100644 --- a/DQM/Integration/python/clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py @@ -1,8 +1,8 @@ import FWCore.ParameterSet.Config as cms import sys -from Configuration.Eras.Era_Run3_cff import Run3 -process = cms.Process("L1TStage2EmulatorDQM", Run3) +from Configuration.Eras.Era_Run3_2024_cff import Run3_2024 +process = cms.Process("L1TStage2EmulatorDQM", Run3_2024) unitTest = False if 'unitTest=True' in sys.argv: diff --git a/DQM/Integration/python/clients/pixelgpu_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/pixelgpu_dqm_sourceclient-live_cfg.py index abfa60c5b0d75..78e036c4008ec 100644 --- a/DQM/Integration/python/clients/pixelgpu_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/pixelgpu_dqm_sourceclient-live_cfg.py @@ -87,14 +87,20 @@ # Pixel DQM Tasks and Harvesters import #------------------------------------- process.load('DQM.SiPixelHeterogeneous.SiPixelHeterogenousDQM_FirstStep_cff') +process.load('DQM.SiPixelHeterogeneous.SiPixelHeterogenousDQMHarvesting_cff') +process.siPixelTrackComparisonHarvesterAlpaka.topFolderName = cms.string('SiPixelHeterogeneous/PixelTrackCompareGPUvsCPU') #------------------------------------- # Some Settings before Finishing up #------------------------------------- if process.runType.getRunType() == process.runType.hi_run: - process.siPixelPhase1RawDataErrorComparator.pixelErrorSrcGPU = 'hltSiPixelDigisFromSoAPPOnAA' - process.siPixelPhase1RawDataErrorComparator.pixelErrorSrcCPU = 'hltSiPixelDigisLegacyPPOnAA' + process.siPixelPhase1MonitorRawDataASerial.src = 'hltSiPixelDigiErrorsPPOnAASerialSync' + process.siPixelPhase1MonitorRawDataADevice.src = 'hltSiPixelDigiErrorsPPOnAA' + process.siPixelPhase1RawDataErrorComparator.pixelErrorSrcGPU = 'hltSiPixelDigiErrorsPPOnAA' + process.siPixelPhase1RawDataErrorComparator.pixelErrorSrcCPU = 'hltSiPixelDigiErrorsPPOnAASerialSync' else: + process.siPixelPhase1MonitorRawDataASerial.src = 'hltSiPixelDigiErrorsSerialSync' + process.siPixelPhase1MonitorRawDataADevice.src = 'hltSiPixelDigiErrors' process.siPixelPhase1RawDataErrorComparator.pixelErrorSrcGPU = 'hltSiPixelDigiErrors' process.siPixelPhase1RawDataErrorComparator.pixelErrorSrcCPU = 'hltSiPixelDigiErrorsSerialSync' #------------------------------------- @@ -106,7 +112,11 @@ #------------------------------------- # Hcal DQM Tasks/Clients Sequences Definition #------------------------------------- -process.tasksPath = cms.Path(process.siPixelPhase1RawDataErrorComparator) +process.tasksPath = cms.Path(process.siPixelPhase1MonitorRawDataASerial * + process.siPixelPhase1MonitorRawDataADevice * + process.siPixelPhase1RawDataErrorComparator * + process.siPixelHeterogeneousDQMComparisonHarvestingAlpaka + ) #------------------------------------- # Paths/Sequences Definitions diff --git a/DQM/L1TMonitor/interface/L1TCaloLayer1Summary.h b/DQM/L1TMonitor/interface/L1TCaloLayer1Summary.h new file mode 100644 index 0000000000000..bc11d45e7f9ac --- /dev/null +++ b/DQM/L1TMonitor/interface/L1TCaloLayer1Summary.h @@ -0,0 +1,74 @@ +// -*- C++ -*- +// +// Package: L1TMonitor/L1TCaloLayer1Summary +// Class: L1TCaloLayer1Summary +// +/**\class L1TCaloLayer1Summary L1TCaloLayer1Summary.cc Demo/L1TCaloLayer1Summary/plugins/L1TCaloLayer1Summary.cc + + Description: DQM Analyzer for CaloLayer1 regions and CICADAScore + + Implementation: + This module uses emulator sequence for CaloLayer1. +*/ +// +// Original Author: Max Zhao +// Created: 31 Jul 2024 +// +// + +// system include files +#include +#include + +#include "DQMServices/Core/interface/DQMStore.h" +#include "DQMServices/Core/interface/DQMEDAnalyzer.h" + +// user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/InputTag.h" + +#include "FWCore/ServiceRegistry/interface/Service.h" + +#include "DataFormats/L1CaloTrigger/interface/CICADA.h" +#include "DataFormats/L1CaloTrigger/interface/L1CaloCollections.h" +#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" +#include "EventFilter/L1TXRawToDigi/interface/UCTDAQRawData.h" +#include "EventFilter/L1TXRawToDigi/interface/UCTAMCRawData.h" +#include "DataFormats/FEDRawData/interface/FEDNumbering.h" + +class L1TCaloLayer1Summary : public DQMEDAnalyzer { +public: + explicit L1TCaloLayer1Summary(const edm::ParameterSet&); + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void analyze(const edm::Event&, const edm::EventSetup&) override; + void bookHistograms(DQMStore::IBooker&, const edm::Run&, const edm::EventSetup&) override; + + // ----------member data --------------------------- + edm::EDGetTokenT caloLayer1CICADAScoreToken_; + edm::EDGetTokenT gtCICADAScoreToken_; + edm::EDGetTokenT simCICADAScoreToken_; + edm::EDGetTokenT caloLayer1RegionsToken_; + edm::EDGetTokenT simRegionsToken_; + edm::EDGetTokenT fedRawData_; + + dqm::reco::MonitorElement* histoCaloLayer1CICADAScore; + dqm::reco::MonitorElement* histoGtCICADAScore; + dqm::reco::MonitorElement* histoSimCICADAScore; + dqm::reco::MonitorElement* histoCaloMinusSim; + dqm::reco::MonitorElement* histoCaloMinusGt; + dqm::reco::MonitorElement* histoSlot7MinusDaqBxid; + dqm::reco::MonitorElement* histoCaloRegions; + dqm::reco::MonitorElement* histoSimRegions; + dqm::reco::MonitorElement* histoCaloMinusSimRegions; + + std::string histFolder_; +}; \ No newline at end of file diff --git a/DQM/L1TMonitor/plugins/SealModule.cc b/DQM/L1TMonitor/plugins/SealModule.cc index 0d5311f961517..38f2e1a69283e 100644 --- a/DQM/L1TMonitor/plugins/SealModule.cc +++ b/DQM/L1TMonitor/plugins/SealModule.cc @@ -27,6 +27,9 @@ DEFINE_FWK_MODULE(L1TGMT); #include "DQM/L1TMonitor/interface/L1TStage2CaloLayer1.h" DEFINE_FWK_MODULE(L1TStage2CaloLayer1); +#include "DQM/L1TMonitor/interface/L1TCaloLayer1Summary.h" +DEFINE_FWK_MODULE(L1TCaloLayer1Summary); + #include "DQM/L1TMonitor/interface/L1TStage2CaloLayer2.h" DEFINE_FWK_MODULE(L1TStage2CaloLayer2); diff --git a/DQM/L1TMonitor/python/L1TCaloLayer1Summary_cff.py b/DQM/L1TMonitor/python/L1TCaloLayer1Summary_cff.py new file mode 100644 index 0000000000000..551c4aa1c9295 --- /dev/null +++ b/DQM/L1TMonitor/python/L1TCaloLayer1Summary_cff.py @@ -0,0 +1,22 @@ +import FWCore.ParameterSet.Config as cms + +from L1Trigger.Configuration.CaloTriggerPrimitives_cff import * +simEcalTriggerPrimitiveDigis.Label = 'ecalDigis' +simHcalTriggerPrimitiveDigis.inputLabel = cms.VInputTag( + cms.InputTag('hcalDigis'), + cms.InputTag('hcalDigis') +) +simHcalTriggerPrimitiveDigis.inputUpgradeLabel = cms.VInputTag( + cms.InputTag('hcalDigis'), + cms.InputTag('hcalDigis') +) + +from L1Trigger.L1TCaloLayer1.simCaloStage2Layer1Summary_cfi import * +from L1Trigger.L1TCaloLayer1.simCaloStage2Layer1Digis_cfi import * +from DQM.L1TMonitor.L1TCaloLayer1Summary_cfi import * + +simCaloStage2Layer1Summary.caloLayer1Regions = cms.InputTag("caloLayer1Digis", "") +simCaloStage2Layer1Digis.ecalToken = cms.InputTag("ecalDigis", "EcalTriggerPrimitives") +simCaloStage2Layer1Digis.hcalToken = cms.InputTag("hcalDigis", "") + +l1tCaloLayer1SummarySeq = cms.Sequence(simEcalTriggerPrimitiveDigis * simHcalTriggerPrimitiveDigis * simCaloStage2Layer1Digis * simCaloStage2Layer1Summary * l1tCaloLayer1Summary) \ No newline at end of file diff --git a/DQM/L1TMonitor/python/L1TCaloLayer1Summary_cfi.py b/DQM/L1TMonitor/python/L1TCaloLayer1Summary_cfi.py new file mode 100644 index 0000000000000..7e50633658ffb --- /dev/null +++ b/DQM/L1TMonitor/python/L1TCaloLayer1Summary_cfi.py @@ -0,0 +1,12 @@ +import FWCore.ParameterSet.Config as cms +from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer + +l1tCaloLayer1Summary = DQMEDAnalyzer("L1TCaloLayer1Summary", + caloLayer1CICADAScore = cms.InputTag("caloLayer1Digis", "CICADAScore"), + gtCICADAScore = cms.InputTag("gtTestcrateStage2Digis", "CICADAScore"), + simCICADAScore = cms.InputTag("simCaloStage2Layer1Summary", "CICADAScore"), + caloLayer1Regions = cms.InputTag("caloLayer1Digis", ""), + simRegions = cms.InputTag("simCaloStage2Layer1Digis", ""), + fedRawDataLabel = cms.InputTag("rawDataCollector"), + histFolder = cms.string('L1T/L1TCaloLayer1Summary') +) \ No newline at end of file diff --git a/DQM/L1TMonitor/python/L1TStage2_cff.py b/DQM/L1TMonitor/python/L1TStage2_cff.py index 0d830856c7396..ef089869a4b5e 100644 --- a/DQM/L1TMonitor/python/L1TStage2_cff.py +++ b/DQM/L1TMonitor/python/L1TStage2_cff.py @@ -9,6 +9,9 @@ # CaloLayer2 from DQM.L1TMonitor.L1TStage2CaloLayer2_cfi import * +# CaloLayer1Summary +from DQM.L1TMonitor.L1TCaloLayer1Summary_cff import * + # BMTF from DQM.L1TMonitor.L1TStage2BMTF_cff import * @@ -47,7 +50,8 @@ l1tStage2RegionalShower + l1tStage2uGMTOnlineDQMSeq + l1tObjectsTiming + - l1tStage2uGTOnlineDQMSeq + l1tStage2uGTOnlineDQMSeq + + l1tCaloLayer1SummarySeq ) # sequence to run only for validation events diff --git a/DQM/L1TMonitor/python/L1TStage2uGTTiming_cfi.py b/DQM/L1TMonitor/python/L1TStage2uGTTiming_cfi.py index a6ffae4956720..f3d76de4717ec 100644 --- a/DQM/L1TMonitor/python/L1TStage2uGTTiming_cfi.py +++ b/DQM/L1TMonitor/python/L1TStage2uGTTiming_cfi.py @@ -1,44 +1,65 @@ import FWCore.ParameterSet.Config as cms from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer +unprescaledAlgoList = cms.untracked.vstring( + "L1_SingleMu22_BMTF", + "L1_SingleMu22_OMTF", + "L1_SingleMu22_EMTF", + "L1_SingleIsoEG28er1p5", + "L1_SingleIsoEG32er2p5", + "L1_SingleEG40er2p5", + "L1_SingleEG60", + "L1_SingleTau120er2p1", + "L1_SingleJet180", + "L1_ETMHF130", + "L1_HTT360er", + "L1_ETT2000" +) +prescaledAlgoList = cms.untracked.vstring( + "L1_FirstCollisionInTrain", + "L1_LastCollisionInTrain", + "L1_IsolatedBunch", + "L1_SingleMu0_BMTF", + "L1_SingleMu0_OMTF", + "L1_SingleMu0_EMTF", + "L1_SingleEG10er2p5", + "L1_SingleEG15er2p5", + "L1_SingleEG26er2p5", + "L1_SingleLooseIsoEG28er1p5", + "L1_SingleJet35", + "L1_SingleJet35er2p5", + "L1_SingleJet35_FWD2p5", + "L1_ETMHF100", + "L1_HTT120er", + "L1_ETT1600" +) + +unprescaledAlgoList_2024 = cms.untracked.vstring(unprescaledAlgoList) +unprescaledAlgoList_2024.extend([ + "L1_AXO_Nominal", + "L1_AXO_VTight", + "L1_CICADA_Medium", + "L1_CICADA_VTight" +]) + +prescaledAlgoList_2024 = cms.untracked.vstring(prescaledAlgoList) +if "L1_ETT1600" in prescaledAlgoList_2024: + prescaledAlgoList_2024.remove("L1_ETT1600") + l1tStage2uGTTiming = DQMEDAnalyzer('L1TStage2uGTTiming', - l1tStage2uGtSource = cms.InputTag("gtStage2Digis"), + l1tStage2uGtSource = cms.InputTag("gtStage2Digis"), monitorDir = cms.untracked.string("L1T/L1TStage2uGT/timing_aux"), verbose = cms.untracked.bool(False), firstBXInTrainAlgo = cms.untracked.string("L1_FirstCollisionInTrain"), - lastBXInTrainAlgo = cms.untracked.string("L1_LastCollisionInTrain"), - isoBXAlgo = cms.untracked.string("L1_IsolatedBunch"), - unprescaledAlgoShortList = cms.untracked.vstring( - "L1_SingleMu22_BMTF", - "L1_SingleMu22_OMTF", - "L1_SingleMu22_EMTF", - "L1_SingleIsoEG28er1p5", - "L1_SingleIsoEG32er2p5", - "L1_SingleEG40er2p5", - "L1_SingleEG60", - "L1_SingleTau120er2p1", - "L1_SingleJet180", - "L1_ETMHF130", - "L1_HTT360er", - "L1_ETT2000" - ), - prescaledAlgoShortList = cms.untracked.vstring( - "L1_FirstCollisionInTrain", - "L1_LastCollisionInTrain", - "L1_IsolatedBunch", - "L1_SingleMu0_BMTF", - "L1_SingleMu0_OMTF", - "L1_SingleMu0_EMTF", - "L1_SingleEG10er2p5", - "L1_SingleEG15er2p5", - "L1_SingleEG26er2p5", - "L1_SingleLooseIsoEG28er1p5", - "L1_SingleJet35", - "L1_SingleJet35er2p5", - "L1_SingleJet35_FWD2p5", - "L1_ETMHF100", - "L1_HTT120er", - "L1_ETT1600" - ), + lastBXInTrainAlgo = cms.untracked.string("L1_LastCollisionInTrain"), + isoBXAlgo = cms.untracked.string("L1_IsolatedBunch"), + unprescaledAlgoShortList = unprescaledAlgoList, + prescaledAlgoShortList = prescaledAlgoList, useAlgoDecision = cms.untracked.string("initial") ) + +from Configuration.Eras.Modifier_stage2L1Trigger_2024_cff import stage2L1Trigger_2024 +stage2L1Trigger_2024.toModify(l1tStage2uGTTiming, + unprescaledAlgoShortList = unprescaledAlgoList_2024, + prescaledAlgoShortList = prescaledAlgoList_2024 +) diff --git a/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc b/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc new file mode 100644 index 0000000000000..30955ee3ffb9b --- /dev/null +++ b/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc @@ -0,0 +1,143 @@ +#include "DQM/L1TMonitor/interface/L1TCaloLayer1Summary.h" + +L1TCaloLayer1Summary::L1TCaloLayer1Summary(const edm::ParameterSet& iConfig) + : caloLayer1CICADAScoreToken_( + consumes(iConfig.getParameter("caloLayer1CICADAScore"))), + gtCICADAScoreToken_(consumes(iConfig.getParameter("gtCICADAScore"))), + simCICADAScoreToken_(consumes(iConfig.getParameter("simCICADAScore"))), + caloLayer1RegionsToken_( + consumes(iConfig.getParameter("caloLayer1Regions"))), + simRegionsToken_(consumes(iConfig.getParameter("simRegions"))), + fedRawData_(consumes(iConfig.getParameter("fedRawDataLabel"))), + histFolder_(iConfig.getParameter("histFolder")) {} + +// ------------ method called for each event ------------ +void L1TCaloLayer1Summary::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + edm::Handle fedRawDataCollection; + iEvent.getByToken(fedRawData_, fedRawDataCollection); + if (fedRawDataCollection.isValid()) { + for (int iFed = FEDNumbering::MINRCTFEDID + 4; iFed < FEDNumbering::MAXRCTFEDID; iFed += 2) { + const FEDRawData& fedRawData = fedRawDataCollection->FEDData(iFed); + if (fedRawData.size() == 0) { + continue; + } + const uint64_t* fedRawDataArray = (const uint64_t*)fedRawData.data(); + UCTDAQRawData daqData(fedRawDataArray); + + if (daqData.nAMCs() == 7) { + UCTAMCRawData amcSlot7(daqData.amcPayload(3)); + if (amcSlot7.amcNo() == 7) { + histoSlot7MinusDaqBxid->Fill(amcSlot7.BXID() - daqData.BXID()); + } + } + } + } + + L1CaloRegionCollection caloLayer1Regions = iEvent.get(caloLayer1RegionsToken_); + L1CaloRegionCollection simRegions = iEvent.get(simRegionsToken_); + int nRegions = caloLayer1Regions.size(); + + unsigned int maxEtaIdx = 0; + for (int iRegion = 0; iRegion < nRegions; iRegion++) { + if (maxEtaIdx < caloLayer1Regions[iRegion].gctEta()) { + maxEtaIdx = caloLayer1Regions[iRegion].gctEta(); + } + } + int matrixSize = maxEtaIdx + 1; + + bool foundMatrix[2][matrixSize][matrixSize]; + int etMatrix[2][matrixSize][matrixSize]; + for (int i = 0; i < 2; i++) { + for (int j = 0; j < matrixSize; j++) { + for (int k = 0; k < matrixSize; k++) { + foundMatrix[i][j][k] = false; + etMatrix[i][j][k] = 0; + } + } + } + + for (int iRegion = 0; iRegion < nRegions; iRegion++) { + L1CaloRegion cRegion = caloLayer1Regions[iRegion]; + L1CaloRegion sRegion = simRegions[iRegion]; + + foundMatrix[0][cRegion.gctEta()][cRegion.gctPhi()] = true; + etMatrix[0][cRegion.gctEta()][cRegion.gctPhi()] = cRegion.et(); + foundMatrix[1][sRegion.gctEta()][sRegion.gctPhi()] = true; + etMatrix[1][sRegion.gctEta()][sRegion.gctPhi()] = sRegion.et(); + } + int iRegion = 0; + for (int iEta = 0; iEta < matrixSize; iEta++) { + for (int iPhi = 0; iPhi < matrixSize; iPhi++) { + if (foundMatrix[0][iEta][iPhi] && foundMatrix[1][iEta][iPhi]) { + histoCaloRegions->Fill(iRegion, etMatrix[0][iEta][iPhi]); + histoSimRegions->Fill(iRegion, etMatrix[1][iEta][iPhi]); + histoCaloMinusSimRegions->Fill(iRegion, etMatrix[0][iEta][iPhi] - etMatrix[1][iEta][iPhi]); + iRegion++; + } + } + } + + auto caloCICADAScores = iEvent.get(caloLayer1CICADAScoreToken_); + auto gtCICADAScores = iEvent.get(gtCICADAScoreToken_); + auto simCICADAScores = iEvent.get(simCICADAScoreToken_); + + if (caloCICADAScores.size() > 0) { + histoCaloLayer1CICADAScore->Fill(caloCICADAScores[0]); + if (gtCICADAScores.size() > 0) { + histoGtCICADAScore->Fill(gtCICADAScores.at(0, 0)); + histoCaloMinusGt->Fill(caloCICADAScores[0] - gtCICADAScores.at(0, 0)); + } + if (simCICADAScores.size() > 0) { + histoSimCICADAScore->Fill(simCICADAScores[0]); + histoCaloMinusSim->Fill(caloCICADAScores[0] - simCICADAScores[0]); + } + } +} + +void L1TCaloLayer1Summary::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const&, edm::EventSetup const&) { + ibooker.setCurrentFolder(histFolder_); + histoSlot7MinusDaqBxid = ibooker.book1D("slot7BXID", "Slot 7- DAQ BXID", 50, -20, 20); + + ibooker.setCurrentFolder(histFolder_ + "/CICADAScore"); + histoCaloLayer1CICADAScore = ibooker.book1D("caloLayer1CICADAScore", "CaloLayer1 CICADAScore", 50, 0, 200); + histoGtCICADAScore = ibooker.book1D("gtCICADAScore", "GT CICADAScore at BX0", 50, 0, 200); + histoCaloMinusGt = ibooker.book1D("caloMinusGtCICADAScore", "CaloLayer1 - GT CICADAScore at BX0", 50, -50, 50); + histoSimCICADAScore = + ibooker.book1D("simCaloLayer1CICADAScore", "simCaloLayer1 CICADAScore (input: DAQ regions)", 50, 0, 200); + histoCaloMinusSim = ibooker.book1D( + "caloMinusSimCICADAScore", "CaloLayer1 - simCaloLayer1 (input: DAQ regions) CICADAScore", 50, -50, 50); + + ibooker.setCurrentFolder(histFolder_ + "/Regions"); + histoCaloMinusSimRegions = + ibooker.book2D("caloMinusSumRegions", + "CaloLayer1 - simCaloLayer1 (input: DAQ trigger primatives) Regions;Region;ET Difference", + 252, + -0.5, + 252.5, + 100, + -400, + 400); + histoCaloRegions = ibooker.book2D("caloLayer1Regions", "CaloLayer1 Regions;Region;ET", 252, -0.5, 252.5, 100, 0, 800); + histoSimRegions = ibooker.book2D("simCaloLayer1Regions", + "simCaloLayer1 Regions (input: DAQ trigger primatives);Region;ET", + 252, + -0.5, + 252.5, + 100, + 0, + 800); +} + +// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ +void L1TCaloLayer1Summary::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + // l1tCaloLayer1Summary + edm::ParameterSetDescription desc; + desc.add("caloLayer1CICADAScore", edm::InputTag("caloLayer1Digis", "CICADAScore")); + desc.add("gtCICADAScore", edm::InputTag("gtTestcrateStage2Digis", "CICADAScore")); + desc.add("simCICADAScore", edm::InputTag("simCaloStage2Layer1Summary", "CICADAScore")); + desc.add("caloLayer1Regions", edm::InputTag("caloLayer1Digis")); + desc.add("simRegions", edm::InputTag("simCaloStage2Layer1Digis")); + desc.add("fedRawDataLabel", edm::InputTag("rawDataCollector")); + desc.add("histFolder", "L1T/L1TCaloLayer1Summary"); + descriptions.add("l1tCaloLayer1Summary", desc); +} \ No newline at end of file diff --git a/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareTrackSoA.cc b/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareTrackSoA.cc index 03d023cf17a71..f3635d6df45da 100644 --- a/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareTrackSoA.cc +++ b/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareTrackSoA.cc @@ -84,6 +84,9 @@ class SiPixelCompareTrackSoA : public DQMEDAnalyzer { MonitorElement* hnTracks_; MonitorElement* hnLooseAndAboveTracks_; MonitorElement* hnLooseAndAboveTracks_matched_; + MonitorElement* hDeltaNTracks_; + MonitorElement* hDeltaNLooseAndAboveTracks_; + MonitorElement* hDeltaNLooseAndAboveTracks_matched_; MonitorElement* hnHits_; MonitorElement* hnHitsVsPhi_; MonitorElement* hnHitsVsEta_; @@ -95,6 +98,7 @@ class SiPixelCompareTrackSoA : public DQMEDAnalyzer { MonitorElement* hChi2VsPhi_; MonitorElement* hChi2VsEta_; MonitorElement* hpt_; + MonitorElement* hCurvature_; MonitorElement* hptLogLog_; MonitorElement* heta_; MonitorElement* hphi_; @@ -110,10 +114,10 @@ class SiPixelCompareTrackSoA : public DQMEDAnalyzer { MonitorElement* htipdiffMatched_; //for matching eff vs region: derive the ratio at harvesting - MonitorElement* hpt_eta_tkAllCPU_; - MonitorElement* hpt_eta_tkAllCPUMatched_; - MonitorElement* hphi_z_tkAllCPU_; - MonitorElement* hphi_z_tkAllCPUMatched_; + MonitorElement* hpt_eta_tkAllRef_; + MonitorElement* hpt_eta_tkAllRefMatched_; + MonitorElement* hphi_z_tkAllRef_; + MonitorElement* hphi_z_tkAllRefMatched_; }; // @@ -187,6 +191,7 @@ void SiPixelCompareTrackSoA::analyze(const edm::Event& iEvent, const edm::Eve float phiCPU = helper::phi(tsoaCPU.view(), it); float zipCPU = helper::zip(tsoaCPU.view(), it); float tipCPU = helper::tip(tsoaCPU.view(), it); + auto qCPU = helper::charge(tsoaCPU.view(), it); if (!(ptCPU > 0.)) continue; @@ -211,17 +216,18 @@ void SiPixelCompareTrackSoA::analyze(const edm::Event& iEvent, const edm::Eve } } - hpt_eta_tkAllCPU_->Fill(etaCPU, ptCPU); //all CPU tk - hphi_z_tkAllCPU_->Fill(phiCPU, zipCPU); + hpt_eta_tkAllRef_->Fill(etaCPU, ptCPU); //all CPU tk + hphi_z_tkAllRef_->Fill(phiCPU, zipCPU); if (closestTkidx == notFound) continue; nLooseAndAboveTracksCPU_matchedGPU++; hchi2_->Fill(tsoaCPU.view()[it].chi2(), tsoaGPU.view()[closestTkidx].chi2()); - hCharge_->Fill(helper::charge(tsoaCPU.view(), it), helper::charge(tsoaGPU.view(), closestTkidx)); + hCharge_->Fill(qCPU, helper::charge(tsoaGPU.view(), closestTkidx)); hnHits_->Fill(helper::nHits(tsoaCPU.view(), it), helper::nHits(tsoaGPU.view(), closestTkidx)); hnLayers_->Fill(tsoaCPU.view()[it].nLayers(), tsoaGPU.view()[closestTkidx].nLayers()); hpt_->Fill(ptCPU, tsoaGPU.view()[closestTkidx].pt()); + hCurvature_->Fill(qCPU / ptCPU, helper::charge(tsoaGPU.view(), closestTkidx) / tsoaGPU.view()[closestTkidx].pt()); hptLogLog_->Fill(ptCPU, tsoaGPU.view()[closestTkidx].pt()); heta_->Fill(etaCPU, tsoaGPU.view()[closestTkidx].eta()); hphi_->Fill(phiCPU, helper::phi(tsoaGPU.view(), closestTkidx)); @@ -234,12 +240,26 @@ void SiPixelCompareTrackSoA::analyze(const edm::Event& iEvent, const edm::Eve hphidiffMatched_->Fill(reco::deltaPhi(phiCPU, helper::phi(tsoaGPU.view(), closestTkidx))); hzdiffMatched_->Fill(zipCPU - helper::zip(tsoaGPU.view(), closestTkidx)); htipdiffMatched_->Fill(tipCPU - helper::tip(tsoaGPU.view(), closestTkidx)); - hpt_eta_tkAllCPUMatched_->Fill(etaCPU, tsoaCPU.view()[it].pt()); //matched to gpu - hphi_z_tkAllCPUMatched_->Fill(etaCPU, zipCPU); + hpt_eta_tkAllRefMatched_->Fill(etaCPU, tsoaCPU.view()[it].pt()); //matched to gpu + hphi_z_tkAllRefMatched_->Fill(etaCPU, zipCPU); } - hnTracks_->Fill(nTracksCPU, nTracksGPU); - hnLooseAndAboveTracks_->Fill(nLooseAndAboveTracksCPU, nLooseAndAboveTracksGPU); - hnLooseAndAboveTracks_matched_->Fill(nLooseAndAboveTracksCPU, nLooseAndAboveTracksCPU_matchedGPU); + + // Define a lambda function for filling the histograms + auto fillHistogram = [](auto& histogram, auto xValue, auto yValue) { histogram->Fill(xValue, yValue); }; + + // Define a lambda for filling delta histograms + auto fillDeltaHistogram = [](auto& histogram, int cpuValue, int gpuValue) { + histogram->Fill(std::min(cpuValue, 1000), std::clamp(gpuValue - cpuValue, -100, 100)); + }; + + // Fill the histograms + fillHistogram(hnTracks_, nTracksCPU, nTracksGPU); + fillHistogram(hnLooseAndAboveTracks_, nLooseAndAboveTracksCPU, nLooseAndAboveTracksGPU); + fillHistogram(hnLooseAndAboveTracks_matched_, nLooseAndAboveTracksCPU, nLooseAndAboveTracksCPU_matchedGPU); + + fillDeltaHistogram(hDeltaNTracks_, nTracksCPU, nTracksGPU); + fillDeltaHistogram(hDeltaNLooseAndAboveTracks_, nLooseAndAboveTracksCPU, nLooseAndAboveTracksGPU); + fillDeltaHistogram(hDeltaNLooseAndAboveTracks_matched_, nLooseAndAboveTracksCPU, nLooseAndAboveTracksCPU_matchedGPU); } // @@ -252,13 +272,44 @@ void SiPixelCompareTrackSoA::bookHistograms(DQMStore::IBooker& iBook, iBook.cd(); iBook.setCurrentFolder(topFolderName_); - // clang-format off + // Define a helper function for booking histograms std::string toRep = "Number of tracks"; + auto bookTracksTH2I = [&](const std::string& name, + const std::string& title, + int xBins, + double xMin, + double xMax, + int yBins, + double yMin, + double yMax) { + return iBook.book2I(name, fmt::sprintf(title, toRep), xBins, xMin, xMax, yBins, yMin, yMax); + }; + + // Define common parameters for different histogram types + constexpr int xBins = 501; + constexpr double xMin = -0.5; + constexpr double xMax = 1001.5; + + constexpr int dXBins = 1001; + constexpr double dXMin = -0.5; + constexpr double dXMax = 1000.5; + + constexpr int dYBins = 201; + constexpr double dYMin = -100.5; + constexpr double dYMax = 100.5; + // FIXME: all the 2D correlation plots are quite heavy in terms of memory consumption, so a as soon as DQM supports THnSparse // these should be moved to a less resource consuming format - hnTracks_ = iBook.book2I("nTracks", fmt::sprintf("%s per event; CPU; GPU",toRep), 501, -0.5, 500.5, 501, -0.5, 500.5); - hnLooseAndAboveTracks_ = iBook.book2I("nLooseAndAboveTracks", fmt::sprintf("%s (quality #geq loose) per event; CPU; GPU",toRep), 501, -0.5, 500.5, 501, -0.5, 500.5); - hnLooseAndAboveTracks_matched_ = iBook.book2I("nLooseAndAboveTracks_matched", fmt::sprintf("%s (quality #geq loose) per event; CPU; GPU",toRep), 501, -0.5, 500.5, 501, -0.5, 500.5); + + // Book histograms using the helper function + // clang-format off + hnTracks_ = bookTracksTH2I("nTracks", "%s per event; Reference; Target", xBins, xMin, xMax, xBins, xMin, xMax); + hnLooseAndAboveTracks_ = bookTracksTH2I("nLooseAndAboveTracks", "%s (quality #geq loose) per event; Reference; Target", xBins, xMin, xMax, xBins, xMin, xMax); + hnLooseAndAboveTracks_matched_ = bookTracksTH2I("nLooseAndAboveTracks_matched", "%s (quality #geq loose) per event; Reference; Target", xBins, xMin, xMax, xBins, xMin, xMax); + + hDeltaNTracks_ = bookTracksTH2I("deltaNTracks", "%s per event; Reference; Target - Reference", dXBins, dXMin, dXMax, dYBins, dYMin, dYMax); + hDeltaNLooseAndAboveTracks_ = bookTracksTH2I("deltaNLooseAndAboveTracks", "%s (quality #geq loose) per event; Reference; Target - Reference", dXBins, dXMin, dXMax, dYBins, dYMin, dYMax); + hDeltaNLooseAndAboveTracks_matched_ = bookTracksTH2I("deltaNLooseAndAboveTracks_matched", "%s (quality #geq loose) per event; Reference; Target - Reference", dXBins, dXMin, dXMax, dYBins, dYMin, dYMax); toRep = "Number of all RecHits per track (quality #geq loose)"; hnHits_ = iBook.book2I("nRecHits", fmt::sprintf("%s;CPU;GPU",toRep), 15, -0.5, 14.5, 15, -0.5, 14.5); @@ -273,24 +324,25 @@ void SiPixelCompareTrackSoA::bookHistograms(DQMStore::IBooker& iBook, hCharge_ = iBook.book2I("charge",fmt::sprintf("%s;CPU;GPU",toRep),3, -1.5, 1.5, 3, -1.5, 1.5); hpt_ = iBook.book2I("pt", "Track (quality #geq loose) p_{T} [GeV];CPU;GPU", 200, 0., 200., 200, 0., 200.); + hCurvature_ = iBook.book2I("curvature", "Track (quality #geq loose) q/p_{T} [GeV^{-1}];CPU;GPU", 60,- 3., 3., 60, -3., 3. ); hptLogLog_ = make2DIfLog(iBook, true, true, "ptLogLog", "Track (quality #geq loose) p_{T} [GeV];CPU;GPU", 200, log10(0.5), log10(200.), 200, log10(0.5), log10(200.)); heta_ = iBook.book2I("eta", "Track (quality #geq loose) #eta;CPU;GPU", 30, -3., 3., 30, -3., 3.); hphi_ = iBook.book2I("phi", "Track (quality #geq loose) #phi;CPU;GPU", 30, -M_PI, M_PI, 30, -M_PI, M_PI); hz_ = iBook.book2I("z", "Track (quality #geq loose) z [cm];CPU;GPU", 30, -30., 30., 30, -30., 30.); htip_ = iBook.book2I("tip", "Track (quality #geq loose) TIP [cm];CPU;GPU", 100, -0.5, 0.5, 100, -0.5, 0.5); //1D difference plots - hptdiffMatched_ = iBook.book1D("ptdiffmatched", " p_{T} diff [GeV] between matched tracks; #Delta p_{T} [GeV]", 60, -30., 30.); - hCurvdiffMatched_ = iBook.book1D("curvdiffmatched", "q/p_{T} diff [GeV] between matched tracks; #Delta q/p_{T} [GeV]", 60, -30., 30.); - hetadiffMatched_ = iBook.book1D("etadiffmatched", " #eta diff between matched tracks; #Delta #eta", 160, -0.04 ,0.04); - hphidiffMatched_ = iBook.book1D("phidiffmatched", " #phi diff between matched tracks; #Delta #phi", 160, -0.04 ,0.04); - hzdiffMatched_ = iBook.book1D("zdiffmatched", " z diff between matched tracks; #Delta z [cm]", 300, -1.5, 1.5); - htipdiffMatched_ = iBook.book1D("tipdiffmatched", " TIP diff between matched tracks; #Delta TIP [cm]", 300, -1.5, 1.5); + hptdiffMatched_ = iBook.book1D("ptdiffmatched", " p_{T} diff [GeV] between matched tracks; #Delta p_{T} [GeV]", 61, -30.5, 30.5); + hCurvdiffMatched_ = iBook.book1D("curvdiffmatched", "q/p_{T} diff [GeV^{-1}] between matched tracks; #Delta q/p_{T} [GeV^{-1}]", 61, -3.05, 3.05); + hetadiffMatched_ = iBook.book1D("etadiffmatched", " #eta diff between matched tracks; #Delta #eta", 161, -0.045 ,0.045); + hphidiffMatched_ = iBook.book1D("phidiffmatched", " #phi diff between matched tracks; #Delta #phi", 161, -0.045 ,0.045); + hzdiffMatched_ = iBook.book1D("zdiffmatched", " z diff between matched tracks; #Delta z [cm]", 301, -1.55, 1.55); + htipdiffMatched_ = iBook.book1D("tipdiffmatched", " TIP diff between matched tracks; #Delta TIP [cm]", 301, -1.55, 1.55); //2D plots for eff - hpt_eta_tkAllCPU_ = iBook.book2I("ptetatrkAllCPU", "Track (quality #geq loose) on CPU; #eta; p_{T} [GeV];", 30, -M_PI, M_PI, 200, 0., 200.); - hpt_eta_tkAllCPUMatched_ = iBook.book2I("ptetatrkAllCPUmatched", "Track (quality #geq loose) on CPU matched to GPU track; #eta; p_{T} [GeV];", 30, -M_PI, M_PI, 200, 0., 200.); + hpt_eta_tkAllRef_ = iBook.book2I("ptetatrkAllReference", "Track (quality #geq loose) on CPU; #eta; p_{T} [GeV];", 30, -M_PI, M_PI, 200, 0., 200.); + hpt_eta_tkAllRefMatched_ = iBook.book2I("ptetatrkAllReferencematched", "Track (quality #geq loose) on CPU matched to GPU track; #eta; p_{T} [GeV];", 30, -M_PI, M_PI, 200, 0., 200.); - hphi_z_tkAllCPU_ = iBook.book2I("phiztrkAllCPU", "Track (quality #geq loose) on CPU; #phi; z [cm];", 30, -M_PI, M_PI, 30, -30., 30.); - hphi_z_tkAllCPUMatched_ = iBook.book2I("phiztrkAllCPUmatched", "Track (quality #geq loose) on CPU; #phi; z [cm];", 30, -M_PI, M_PI, 30, -30., 30.); + hphi_z_tkAllRef_ = iBook.book2I("phiztrkAllReference", "Track (quality #geq loose) on CPU; #phi; z [cm];", 30, -M_PI, M_PI, 30, -30., 30.); + hphi_z_tkAllRefMatched_ = iBook.book2I("phiztrkAllReferencematched", "Track (quality #geq loose) on CPU; #phi; z [cm];", 30, -M_PI, M_PI, 30, -30., 30.); } @@ -303,7 +355,7 @@ void SiPixelCompareTrackSoA::fillDescriptions(edm::ConfigurationDescriptions& desc.add("topFolderName", "SiPixelHeterogeneous/PixelTrackCompareGPUvsCPU"); desc.add("useQualityCut", true); desc.add("minQuality", "loose"); - desc.add("deltaR2cut", 0.04); + desc.add("deltaR2cut", 0.02 * 0.02)->setComment("deltaR2 cut between track on CPU and GPU"); descriptions.addWithDefaultLabel(desc); } diff --git a/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareTracks.cc b/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareTracks.cc index 064831cab6d13..4394b5d59f34b 100644 --- a/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareTracks.cc +++ b/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareTracks.cc @@ -11,6 +11,7 @@ // // for string manipulations +#include #include #include "DataFormats/Common/interface/Handle.h" #include "DataFormats/Math/interface/deltaR.h" @@ -94,6 +95,9 @@ class SiPixelCompareTracks : public DQMEDAnalyzer { MonitorElement* hnTracks_; MonitorElement* hnLooseAndAboveTracks_; MonitorElement* hnLooseAndAboveTracks_matched_; + MonitorElement* hDeltaNTracks_; + MonitorElement* hDeltaNLooseAndAboveTracks_; + MonitorElement* hDeltaNLooseAndAboveTracks_matched_; MonitorElement* hnHits_; MonitorElement* hnHitsVsPhi_; MonitorElement* hnHitsVsEta_; @@ -105,6 +109,7 @@ class SiPixelCompareTracks : public DQMEDAnalyzer { MonitorElement* hChi2VsPhi_; MonitorElement* hChi2VsEta_; MonitorElement* hpt_; + MonitorElement* hCurvature_; MonitorElement* hptLogLog_; MonitorElement* heta_; MonitorElement* hphi_; @@ -200,6 +205,7 @@ void SiPixelCompareTracks::analyzeSeparate(U tokenRef, V tokenTar, const edm: float phiRef = reco::phi(tsoaRef.view(), it); float zipRef = reco::zip(tsoaRef.view(), it); float tipRef = reco::tip(tsoaRef.view(), it); + auto qRef = reco::charge(tsoaRef.view(), it); if (!(ptRef > 0.)) continue; @@ -231,17 +237,18 @@ void SiPixelCompareTracks::analyzeSeparate(U tokenRef, V tokenTar, const edm: nLooseAndAboveTracksRef_matchedTar++; hchi2_->Fill(tsoaRef.view()[it].chi2(), tsoaTar.view()[closestTkidx].chi2()); - hCharge_->Fill(reco::charge(tsoaRef.view(), it), reco::charge(tsoaTar.view(), closestTkidx)); + hCharge_->Fill(qRef, reco::charge(tsoaTar.view(), closestTkidx)); hnHits_->Fill(helper::nHits(tsoaRef.view(), it), helper::nHits(tsoaTar.view(), closestTkidx)); hnLayers_->Fill(tsoaRef.view()[it].nLayers(), tsoaTar.view()[closestTkidx].nLayers()); hpt_->Fill(ptRef, tsoaTar.view()[closestTkidx].pt()); + hCurvature_->Fill(qRef / ptRef, reco::charge(tsoaTar.view(), closestTkidx) / tsoaTar.view()[closestTkidx].pt()); hptLogLog_->Fill(ptRef, tsoaTar.view()[closestTkidx].pt()); heta_->Fill(etaRef, tsoaTar.view()[closestTkidx].eta()); hphi_->Fill(phiRef, reco::phi(tsoaTar.view(), closestTkidx)); hz_->Fill(zipRef, reco::zip(tsoaTar.view(), closestTkidx)); htip_->Fill(tipRef, reco::tip(tsoaTar.view(), closestTkidx)); hptdiffMatched_->Fill(ptRef - tsoaTar.view()[closestTkidx].pt()); - hCurvdiffMatched_->Fill((reco::charge(tsoaRef.view(), it) / tsoaRef.view()[it].pt()) - + hCurvdiffMatched_->Fill(qRef / ptRef - (reco::charge(tsoaTar.view(), closestTkidx) / tsoaTar.view()[closestTkidx].pt())); hetadiffMatched_->Fill(etaRef - tsoaTar.view()[closestTkidx].eta()); hphidiffMatched_->Fill(reco::deltaPhi(phiRef, reco::phi(tsoaTar.view(), closestTkidx))); @@ -250,9 +257,23 @@ void SiPixelCompareTracks::analyzeSeparate(U tokenRef, V tokenTar, const edm: hpt_eta_tkAllRefMatched_->Fill(etaRef, tsoaRef.view()[it].pt()); //matched to gpu hphi_z_tkAllRefMatched_->Fill(etaRef, zipRef); } - hnTracks_->Fill(nTracksRef, nTracksTar); - hnLooseAndAboveTracks_->Fill(nLooseAndAboveTracksRef, nLooseAndAboveTracksTar); - hnLooseAndAboveTracks_matched_->Fill(nLooseAndAboveTracksRef, nLooseAndAboveTracksRef_matchedTar); + + // Define a lambda function for filling the histograms + auto fillHistogram = [](auto& histogram, auto xValue, auto yValue) { histogram->Fill(xValue, yValue); }; + + // Define a lambda for filling delta histograms + auto fillDeltaHistogram = [](auto& histogram, int cpuValue, int gpuValue) { + histogram->Fill(std::min(cpuValue, 1000), std::clamp(gpuValue - cpuValue, -100, 100)); + }; + + // Fill the histograms + fillHistogram(hnTracks_, nTracksRef, nTracksTar); + fillHistogram(hnLooseAndAboveTracks_, nLooseAndAboveTracksRef, nLooseAndAboveTracksTar); + fillHistogram(hnLooseAndAboveTracks_matched_, nLooseAndAboveTracksRef, nLooseAndAboveTracksRef_matchedTar); + + fillDeltaHistogram(hDeltaNTracks_, nTracksRef, nTracksTar); + fillDeltaHistogram(hDeltaNLooseAndAboveTracks_, nLooseAndAboveTracksRef, nLooseAndAboveTracksTar); + fillDeltaHistogram(hDeltaNLooseAndAboveTracks_matched_, nLooseAndAboveTracksRef, nLooseAndAboveTracksRef_matchedTar); } // @@ -275,13 +296,44 @@ void SiPixelCompareTracks::bookHistograms(DQMStore::IBooker& iBook, iBook.cd(); iBook.setCurrentFolder(topFolderName_); - // clang-format off + // Define a helper function for booking histograms std::string toRep = "Number of tracks"; + auto bookTracksTH2I = [&](const std::string& name, + const std::string& title, + int xBins, + double xMin, + double xMax, + int yBins, + double yMin, + double yMax) { + return iBook.book2I(name, fmt::sprintf(title, toRep), xBins, xMin, xMax, yBins, yMin, yMax); + }; + + // Define common parameters for different histogram types + constexpr int xBins = 501; + constexpr double xMin = -0.5; + constexpr double xMax = 1001.5; + + constexpr int dXBins = 1001; + constexpr double dXMin = -0.5; + constexpr double dXMax = 1000.5; + + constexpr int dYBins = 201; + constexpr double dYMin = -100.5; + constexpr double dYMax = 100.5; + // FIXME: all the 2D correlation plots are quite heavy in terms of memory consumption, so a as soon as DQM supports THnSparse // these should be moved to a less resource consuming format - hnTracks_ = iBook.book2I("nTracks", fmt::sprintf("%s per event; Reference; Target",toRep), 501, -0.5, 500.5, 501, -0.5, 500.5); - hnLooseAndAboveTracks_ = iBook.book2I("nLooseAndAboveTracks", fmt::sprintf("%s (quality #geq loose) per event; Reference; Target",toRep), 501, -0.5, 500.5, 501, -0.5, 500.5); - hnLooseAndAboveTracks_matched_ = iBook.book2I("nLooseAndAboveTracks_matched", fmt::sprintf("%s (quality #geq loose) per event; Reference; Target",toRep), 501, -0.5, 500.5, 501, -0.5, 500.5); + + // Book histograms using the helper function + // clang-format off + hnTracks_ = bookTracksTH2I("nTracks", "%s per event; Reference; Target", xBins, xMin, xMax, xBins, xMin, xMax); + hnLooseAndAboveTracks_ = bookTracksTH2I("nLooseAndAboveTracks", "%s (quality #geq loose) per event; Reference; Target", xBins, xMin, xMax, xBins, xMin, xMax); + hnLooseAndAboveTracks_matched_ = bookTracksTH2I("nLooseAndAboveTracks_matched", "%s (quality #geq loose) per event; Reference; Target", xBins, xMin, xMax, xBins, xMin, xMax); + + hDeltaNTracks_ = bookTracksTH2I("deltaNTracks", "%s per event; Reference; Target - Reference", dXBins, dXMin, dXMax, dYBins, dYMin, dYMax); + hDeltaNLooseAndAboveTracks_ = bookTracksTH2I("deltaNLooseAndAboveTracks", "%s (quality #geq loose) per event; Reference; Target - Reference", dXBins, dXMin, dXMax, dYBins, dYMin, dYMax); + hDeltaNLooseAndAboveTracks_matched_ = bookTracksTH2I("deltaNLooseAndAboveTracks_matched", "%s (quality #geq loose) per event; Reference; Target - Reference", dXBins, dXMin, dXMax, dYBins, dYMin, dYMax); toRep = "Number of all RecHits per track (quality #geq loose)"; hnHits_ = iBook.book2I("nRecHits", fmt::sprintf("%s;Reference;Target",toRep), 15, -0.5, 14.5, 15, -0.5, 14.5); @@ -296,18 +348,20 @@ void SiPixelCompareTracks::bookHistograms(DQMStore::IBooker& iBook, hCharge_ = iBook.book2I("charge",fmt::sprintf("%s;Reference;Target",toRep),3, -1.5, 1.5, 3, -1.5, 1.5); hpt_ = iBook.book2I("pt", "Track (quality #geq loose) p_{T} [GeV];Reference;Target", 200, 0., 200., 200, 0., 200.); + hCurvature_ = iBook.book2I("curvature", "Track (quality #geq loose) q/p_{T} [GeV^{-1}];Reference;Target", 60,- 3., 3., 60, -3., 3. ); hptLogLog_ = make2DIfLog(iBook, true, true, "ptLogLog", "Track (quality #geq loose) p_{T} [GeV];Reference;Target", 200, log10(0.5), log10(200.), 200, log10(0.5), log10(200.)); heta_ = iBook.book2I("eta", "Track (quality #geq loose) #eta;Reference;Target", 30, -3., 3., 30, -3., 3.); hphi_ = iBook.book2I("phi", "Track (quality #geq loose) #phi;Reference;Target", 30, -M_PI, M_PI, 30, -M_PI, M_PI); hz_ = iBook.book2I("z", "Track (quality #geq loose) z [cm];Reference;Target", 30, -30., 30., 30, -30., 30.); htip_ = iBook.book2I("tip", "Track (quality #geq loose) TIP [cm];Reference;Target", 100, -0.5, 0.5, 100, -0.5, 0.5); + //1D difference plots - hptdiffMatched_ = iBook.book1D("ptdiffmatched", " p_{T} diff [GeV] between matched tracks; #Delta p_{T} [GeV]", 60, -30., 30.); - hCurvdiffMatched_ = iBook.book1D("curvdiffmatched", "q/p_{T} diff [GeV] between matched tracks; #Delta q/p_{T} [GeV]", 60, -30., 30.); - hetadiffMatched_ = iBook.book1D("etadiffmatched", " #eta diff between matched tracks; #Delta #eta", 160, -0.04 ,0.04); - hphidiffMatched_ = iBook.book1D("phidiffmatched", " #phi diff between matched tracks; #Delta #phi", 160, -0.04 ,0.04); - hzdiffMatched_ = iBook.book1D("zdiffmatched", " z diff between matched tracks; #Delta z [cm]", 300, -1.5, 1.5); - htipdiffMatched_ = iBook.book1D("tipdiffmatched", " TIP diff between matched tracks; #Delta TIP [cm]", 300, -1.5, 1.5); + hptdiffMatched_ = iBook.book1D("ptdiffmatched", " p_{T} diff [GeV] between matched tracks; #Delta p_{T} [GeV]", 61, -30.5, 30.5); + hCurvdiffMatched_ = iBook.book1D("curvdiffmatched", "q/p_{T} diff [GeV^{-1}] between matched tracks; #Delta q/p_{T} [GeV^{-1}]", 61, -3.05, 3.05); + hetadiffMatched_ = iBook.book1D("etadiffmatched", " #eta diff between matched tracks; #Delta #eta", 161, -0.045 ,0.045); + hphidiffMatched_ = iBook.book1D("phidiffmatched", " #phi diff between matched tracks; #Delta #phi", 161, -0.045 ,0.045); + hzdiffMatched_ = iBook.book1D("zdiffmatched", " z diff between matched tracks; #Delta z [cm]", 301, -1.55, 1.55); + htipdiffMatched_ = iBook.book1D("tipdiffmatched", " TIP diff between matched tracks; #Delta TIP [cm]", 301, -1.55, 1.55); //2D plots for eff hpt_eta_tkAllRef_ = iBook.book2I("ptetatrkAllReference", "Track (quality #geq loose) on Reference; #eta; p_{T} [GeV];", 30, -M_PI, M_PI, 200, 0., 200.); hpt_eta_tkAllRefMatched_ = iBook.book2I("ptetatrkAllReferencematched", "Track (quality #geq loose) on Reference matched to Target track; #eta; p_{T} [GeV];", 30, -M_PI, M_PI, 200, 0., 200.); @@ -326,7 +380,7 @@ void SiPixelCompareTracks::fillDescriptions(edm::ConfigurationDescriptions& d desc.add("topFolderName", "SiPixelHeterogeneous/PixelTrackCompareDeviceVSHost"); desc.add("useQualityCut", true); desc.add("minQuality", "loose"); - desc.add("deltaR2cut", 0.04); + desc.add("deltaR2cut", 0.02 * 0.02)->setComment("deltaR2 cut between track on device and host"); descriptions.addWithDefaultLabel(desc); } diff --git a/DQM/SiPixelHeterogeneous/plugins/SiPixelMonitorTrackSoA.cc b/DQM/SiPixelHeterogeneous/plugins/SiPixelMonitorTrackSoA.cc index e971ff184b052..f3ccb74bc3fea 100644 --- a/DQM/SiPixelHeterogeneous/plugins/SiPixelMonitorTrackSoA.cc +++ b/DQM/SiPixelHeterogeneous/plugins/SiPixelMonitorTrackSoA.cc @@ -52,6 +52,7 @@ class SiPixelMonitorTrackSoA : public DQMEDAnalyzer { MonitorElement* hChi2VsPhi; MonitorElement* hChi2VsEta; MonitorElement* hpt; + MonitorElement* hCurvature; MonitorElement* heta; MonitorElement* hphi; MonitorElement* hz; @@ -112,6 +113,7 @@ void SiPixelMonitorTrackSoA::analyze(const edm::Event& iEvent, const edm::Eve float zip = helper::zip(tsoa.const_view(), it); float eta = tsoa.view()[it].eta(); float tip = helper::tip(tsoa.const_view(), it); + auto charge = helper::charge(tsoa.const_view(), it); hchi2->Fill(chi2); hChi2VsPhi->Fill(phi, chi2); @@ -123,6 +125,7 @@ void SiPixelMonitorTrackSoA::analyze(const edm::Event& iEvent, const edm::Eve hnLayersVsPhi->Fill(phi, nLayers); hnLayersVsEta->Fill(eta, nLayers); hpt->Fill(pt); + hCurvature->Fill(charge / pt); heta->Fill(eta); hphi->Fill(phi); hz->Fill(zip); @@ -145,8 +148,8 @@ void SiPixelMonitorTrackSoA::bookHistograms(DQMStore::IBooker& iBook, // clang-format off std::string toRep = "Number of tracks"; - hnTracks = iBook.book1D("nTracks", fmt::sprintf(";%s per event;#events",toRep), 1001, -0.5, 1000.5); - hnLooseAndAboveTracks = iBook.book1D("nLooseAndAboveTracks", fmt::sprintf(";%s (quality #geq loose) per event;#events",toRep), 1001, -0.5, 1000.5); + hnTracks = iBook.book1D("nTracks", fmt::sprintf(";%s per event;#events",toRep), 1001, -0.5, 2001.5); + hnLooseAndAboveTracks = iBook.book1D("nLooseAndAboveTracks", fmt::sprintf(";%s (quality #geq loose) per event;#events",toRep), 1001, -0.5, 2001.5); toRep = "Number of all RecHits per track (quality #geq loose)"; hnHits = iBook.book1D("nRecHits", fmt::sprintf(";%s;#tracks",toRep), 15, -0.5, 14.5); @@ -165,6 +168,7 @@ void SiPixelMonitorTrackSoA::bookHistograms(DQMStore::IBooker& iBook, // clang-format on hpt = iBook.book1D("pt", ";Track (quality #geq loose) p_{T} [GeV];#tracks", 200, 0., 200.); + hCurvature = iBook.book1D("curvature", ";Track (quality #geq loose) q/p_{T} [GeV^{-1}];#tracks", 100, -3., 3.); heta = iBook.book1D("eta", ";Track (quality #geq loose) #eta;#tracks", 30, -3., 3.); hphi = iBook.book1D("phi", ";Track (quality #geq loose) #phi;#tracks", 30, -M_PI, M_PI); hz = iBook.book1D("z", ";Track (quality #geq loose) z [cm];#tracks", 30, -30., 30.); diff --git a/DQM/SiPixelHeterogeneous/plugins/SiPixelMonitorTrackSoAAlpaka.cc b/DQM/SiPixelHeterogeneous/plugins/SiPixelMonitorTrackSoAAlpaka.cc index fd98957ee8492..8bd1cdfa2e429 100644 --- a/DQM/SiPixelHeterogeneous/plugins/SiPixelMonitorTrackSoAAlpaka.cc +++ b/DQM/SiPixelHeterogeneous/plugins/SiPixelMonitorTrackSoAAlpaka.cc @@ -52,6 +52,7 @@ class SiPixelMonitorTrackSoAAlpaka : public DQMEDAnalyzer { MonitorElement* hChi2VsPhi; MonitorElement* hChi2VsEta; MonitorElement* hpt; + MonitorElement* hCurvature; MonitorElement* heta; MonitorElement* hphi; MonitorElement* hz; @@ -112,6 +113,7 @@ void SiPixelMonitorTrackSoAAlpaka::analyze(const edm::Event& iEvent, const ed float zip = tsoa.view()[it].state()(4); float eta = tsoa.view()[it].eta(); float tip = tsoa.view()[it].state()(1); + auto charge = reco::charge(tsoa.view(), it); hchi2->Fill(chi2); hChi2VsPhi->Fill(phi, chi2); @@ -123,6 +125,7 @@ void SiPixelMonitorTrackSoAAlpaka::analyze(const edm::Event& iEvent, const ed hnLayersVsPhi->Fill(phi, nLayers); hnLayersVsEta->Fill(eta, nLayers); hpt->Fill(pt); + hCurvature->Fill(charge / pt); heta->Fill(eta); hphi->Fill(phi); hz->Fill(zip); @@ -145,8 +148,8 @@ void SiPixelMonitorTrackSoAAlpaka::bookHistograms(DQMStore::IBooker& iBook, // clang-format off std::string toRep = "Number of tracks"; -hnTracks = iBook.book1D("nTracks", fmt::format(";{} per event;#events",toRep), 1001, -0.5, 1000.5); -hnLooseAndAboveTracks = iBook.book1D("nLooseAndAboveTracks", fmt::format(";{} (quality #geq loose) per event;#events",toRep), 1001, -0.5, 1000.5); +hnTracks = iBook.book1D("nTracks", fmt::format(";{} per event;#events",toRep), 1001, -0.5, 2001.5); +hnLooseAndAboveTracks = iBook.book1D("nLooseAndAboveTracks", fmt::format(";{} (quality #geq loose) per event;#events",toRep), 1001, -0.5, 2001.5); toRep = "Number of all RecHits per track (quality #geq loose)"; hnHits = iBook.book1D("nRecHits", fmt::format(";{};#tracks",toRep), 15, -0.5, 14.5); @@ -165,6 +168,7 @@ hChi2VsEta = iBook.bookProfile("nChi2ndofVsEta", fmt::format("{} vs track #eta;T // clang-format on hpt = iBook.book1D("pt", ";Track (quality #geq loose) p_{T} [GeV];#tracks", 200, 0., 200.); + hCurvature = iBook.book1D("curvature", ";Track (quality #geq loose) q/p_{T} [GeV^{-1}];#tracks", 100, -3., 3.); heta = iBook.book1D("eta", ";Track (quality #geq loose) #eta;#tracks", 30, -3., 3.); hphi = iBook.book1D("phi", ";Track (quality #geq loose) #phi;#tracks", 30, -M_PI, M_PI); hz = iBook.book1D("z", ";Track (quality #geq loose) z [cm];#tracks", 30, -30., 30.); diff --git a/DQM/SiPixelHeterogeneous/plugins/SiPixelTrackComparisonHarvester.cc b/DQM/SiPixelHeterogeneous/plugins/SiPixelTrackComparisonHarvester.cc index 1d72a7bec4105..12be60250a65a 100644 --- a/DQM/SiPixelHeterogeneous/plugins/SiPixelTrackComparisonHarvester.cc +++ b/DQM/SiPixelHeterogeneous/plugins/SiPixelTrackComparisonHarvester.cc @@ -28,15 +28,31 @@ SiPixelTrackComparisonHarvester::SiPixelTrackComparisonHarvester(const edm::Para : topFolder_(iConfig.getParameter("topFolderName")) {} void SiPixelTrackComparisonHarvester::dqmEndJob(DQMStore::IBooker& ibooker, DQMStore::IGetter& igetter) { - MonitorElement* hpt_eta_tkAllCPU = igetter.get(topFolder_ + "/ptetatrkAllCPU"); - MonitorElement* hpt_eta_tkAllCPUmatched = igetter.get(topFolder_ + "/ptetatrkAllCPUmatched"); - MonitorElement* hphi_z_tkAllCPU = igetter.get(topFolder_ + "/phiztrkAllCPU"); - MonitorElement* hphi_z_tkAllCPUmatched = igetter.get(topFolder_ + "/phiztrkAllCPUmatched"); + MonitorElement* hpt_eta_tkAllReference = igetter.get(topFolder_ + "/ptetatrkAllReference"); + if (hpt_eta_tkAllReference == nullptr) { + edm::LogError("SiPixelTrackComparisonHarvester") + << "MonitorElement not found: " << topFolder_ << "/ptetatrkAllReference. Skipping."; + return; + } + + MonitorElement* hpt_eta_tkAllReferencematched = igetter.get(topFolder_ + "/ptetatrkAllReferencematched"); + if (hpt_eta_tkAllReferencematched == nullptr) { + edm::LogError("SiPixelTrackComparisonHarvester") + << "MonitorElement not found: " << topFolder_ << "/ptetatrkAllReferencematched. Skipping."; + return; + } + + MonitorElement* hphi_z_tkAllReference = igetter.get(topFolder_ + "/phiztrkAllReference"); + if (hphi_z_tkAllReference == nullptr) { + edm::LogError("SiPixelTrackComparisonHarvester") + << "MonitorElement not found: " << topFolder_ << "/phiztrkAllReference. Skipping."; + return; + } - if (hpt_eta_tkAllCPU == nullptr or hpt_eta_tkAllCPUmatched == nullptr or hphi_z_tkAllCPU == nullptr or - hphi_z_tkAllCPUmatched == nullptr) { + MonitorElement* hphi_z_tkAllReferencematched = igetter.get(topFolder_ + "/phiztrkAllReferencematched"); + if (hphi_z_tkAllReferencematched == nullptr) { edm::LogError("SiPixelTrackComparisonHarvester") - << "MEs needed for this module are not found in the input file. Skipping."; + << "MonitorElement not found: " << topFolder_ << "/phiztrkAllReferencematched. Skipping."; return; } @@ -47,8 +63,8 @@ void SiPixelTrackComparisonHarvester::dqmEndJob(DQMStore::IBooker& ibooker, DQMS MonitorElement* hphi_z_matchRatio = ibooker.book2D( "matchingeff_phi_z", "Efficiency of track matching; #phi; z [cm];", 30, -M_PI, M_PI, 30, -30., 30.); - hpt_eta_matchRatio->divide(hpt_eta_tkAllCPUmatched, hpt_eta_tkAllCPU, 1., 1., "B"); - hphi_z_matchRatio->divide(hphi_z_tkAllCPUmatched, hphi_z_tkAllCPU, 1., 1., "B"); + hpt_eta_matchRatio->divide(hpt_eta_tkAllReferencematched, hpt_eta_tkAllReference, 1., 1., "B"); + hphi_z_matchRatio->divide(hphi_z_tkAllReferencematched, hphi_z_tkAllReference, 1., 1., "B"); // now create the 1D projection from the 2D histograms std::vector listOfMEsToProject = {"nTracks", @@ -59,12 +75,14 @@ void SiPixelTrackComparisonHarvester::dqmEndJob(DQMStore::IBooker& ibooker, DQMS "nChi2ndof", "charge", "pt", + "curvature", "eta", "phi", "z", "tip"}; for (const auto& me : listOfMEsToProject) { MonitorElement* input2D = igetter.get(topFolder_ + "/" + me); + edm::LogPrint("SiPixelTrackComparisonHarvester") << "processing " << topFolder_ + "/" + me; this->project2DalongDiagonal(input2D, ibooker); } } @@ -72,7 +90,7 @@ void SiPixelTrackComparisonHarvester::dqmEndJob(DQMStore::IBooker& ibooker, DQMS void SiPixelTrackComparisonHarvester::project2DalongDiagonal(MonitorElement* input2D, DQMStore::IBooker& ibooker) { if (input2D == nullptr) { edm::LogError("SiPixelTrackComparisonHarvester") - << "MEs needed for diagonal projection are not found in the input file. Skipping."; + << "ME needed for diagonal projection is not found in the input file at" << topFolder_ << ". Skipping."; return; } diff --git a/DQM/SiPixelHeterogeneous/python/SiPixelHeterogenousDQMHarvesting_cff.py b/DQM/SiPixelHeterogeneous/python/SiPixelHeterogenousDQMHarvesting_cff.py index d39b9e277bec7..32573ec5a5281 100644 --- a/DQM/SiPixelHeterogeneous/python/SiPixelHeterogenousDQMHarvesting_cff.py +++ b/DQM/SiPixelHeterogeneous/python/SiPixelHeterogenousDQMHarvesting_cff.py @@ -2,19 +2,30 @@ siPixelHeterogeneousDQMHarvesting = cms.Sequence() # empty sequence if not both CPU and GPU recos are run from DQM.SiPixelPhase1Common.SiPixelPhase1RawData_cfi import * -from DQM.SiPixelHeterogeneous.SiPixelHeterogenousDQM_FirstStep_cff import SiPixelPhase1RawDataConfForCPU,SiPixelPhase1RawDataConfForGPU +from DQM.SiPixelHeterogeneous.SiPixelHeterogenousDQM_FirstStep_cff import SiPixelPhase1RawDataConfForCPU,SiPixelPhase1RawDataConfForGPU,SiPixelPhase1RawDataConfForSerial,SiPixelPhase1RawDataConfForDevice +# CUDA code siPixelPhase1RawDataHarvesterCPU = SiPixelPhase1RawDataHarvester.clone(histograms = SiPixelPhase1RawDataConfForCPU) siPixelPhase1RawDataHarvesterGPU = SiPixelPhase1RawDataHarvester.clone(histograms = SiPixelPhase1RawDataConfForGPU) +# alpaka code +siPixelPhase1RawDataHarvesterSerial = SiPixelPhase1RawDataHarvester.clone(histograms = SiPixelPhase1RawDataConfForSerial) +siPixelPhase1RawDataHarvesterDevice = SiPixelPhase1RawDataHarvester.clone(histograms = SiPixelPhase1RawDataConfForDevice) + from DQM.SiPixelHeterogeneous.siPixelTrackComparisonHarvester_cfi import * +siPixelTrackComparisonHarvesterAlpaka = siPixelTrackComparisonHarvester.clone(topFolderName = cms.string('SiPixelHeterogeneous/PixelTrackCompareDeviceVSHost')) siPixelHeterogeneousDQMComparisonHarvesting = cms.Sequence(siPixelPhase1RawDataHarvesterCPU * siPixelPhase1RawDataHarvesterGPU * siPixelTrackComparisonHarvester ) +siPixelHeterogeneousDQMComparisonHarvestingAlpaka = cms.Sequence(siPixelPhase1RawDataHarvesterSerial * + siPixelPhase1RawDataHarvesterDevice * + siPixelTrackComparisonHarvesterAlpaka ) + # add the harvester in case of the validation modifier is active from Configuration.ProcessModifiers.gpuValidationPixel_cff import gpuValidationPixel gpuValidationPixel.toReplaceWith(siPixelHeterogeneousDQMHarvesting,siPixelHeterogeneousDQMComparisonHarvesting) - +from Configuration.ProcessModifiers.alpakaValidationPixel_cff import alpakaValidationPixel +(alpakaValidationPixel & ~gpuValidationPixel).toReplaceWith(siPixelHeterogeneousDQMHarvesting,siPixelHeterogeneousDQMComparisonHarvestingAlpaka) diff --git a/DQM/SiPixelPhase1Config/test/qTests/mean_charge_qualitytest_config.xml b/DQM/SiPixelPhase1Config/test/qTests/mean_charge_qualitytest_config.xml index 0152b5deaa7c0..8caff0998b1a8 100644 --- a/DQM/SiPixelPhase1Config/test/qTests/mean_charge_qualitytest_config.xml +++ b/DQM/SiPixelPhase1Config/test/qTests/mean_charge_qualitytest_config.xml @@ -8,7 +8,7 @@ 0 0.65 0.80 - 27500. + 15000. 75000. @@ -17,7 +17,7 @@ 0 0.65 0.80 - 27500. + 15000. 75000. @@ -26,7 +26,7 @@ 0 0.65 0.80 - 35000. + 15000. 75000. @@ -35,7 +35,7 @@ 0 0.65 0.80 - 30000. + 15000. 75000. @@ -45,7 +45,7 @@ 0 0.75 0.90 - 35000. + 15000. 75000. @@ -54,7 +54,7 @@ 0 0.85 0.95 - 35000. + 15000. 75000. @@ -63,7 +63,7 @@ 0 0.75 0.90 - 35000. + 15000. 75000. @@ -72,7 +72,7 @@ 0 0.75 0.90 - 25000. + 15000. 75000. @@ -82,7 +82,7 @@ 0 0.85 0.95 - 35000. + 15000. 75000. @@ -91,7 +91,7 @@ 0 0.85 0.95 - 35000. + 15000. 75000. @@ -100,7 +100,7 @@ 0 0.85 0.95 - 35000. + 15000. 75000. @@ -109,7 +109,7 @@ 0 0.85 0.95 - 35000. + 15000. 75000. @@ -119,7 +119,7 @@ 0 0.85 0.95 - 35000. + 15000. 75000. @@ -128,7 +128,7 @@ 0 0.85 0.95 - 35000. + 15000. 75000. @@ -137,7 +137,7 @@ 0 0.85 0.95 - 35000. + 15000. 75000. @@ -146,7 +146,7 @@ 0 0.85 0.95 - 35000. + 15000. 75000. @@ -158,7 +158,7 @@ 0 0.85 0.95 - 20000. + 15000. 50000. @@ -167,7 +167,7 @@ 0 0.85 0.95 - 20000. + 15000. 50000. @@ -176,7 +176,7 @@ 0 0.85 0.95 - 20000. + 15000. 50000. @@ -186,7 +186,7 @@ 0 0.85 0.95 - 20000. + 15000. 50000. @@ -195,7 +195,7 @@ 0 0.85 0.95 - 25000. + 15000. 50000. @@ -204,7 +204,7 @@ 0 0.85 0.95 - 25000. + 15000. 50000. @@ -216,7 +216,7 @@ 0 0.85 0.95 - 20000. + 15000. 50000. @@ -225,7 +225,7 @@ 0 0.85 0.95 - 20000. + 15000. 50000. @@ -234,7 +234,7 @@ 0 0.85 0.95 - 20000. + 15000. 50000. @@ -244,7 +244,7 @@ 0 0.85 0.95 - 25000. + 15000. 50000. @@ -253,7 +253,7 @@ 0 0.85 0.95 - 25000. + 15000. 50000. @@ -262,7 +262,7 @@ 0 0.85 0.95 - 25000. + 15000. 50000. @@ -274,7 +274,7 @@ 0 0.85 0.95 - 20000. + 15000. 50000. @@ -283,7 +283,7 @@ 0 0.85 0.95 - 20000. + 15000. 50000. @@ -292,7 +292,7 @@ 0 0.85 0.95 - 20000. + 15000. 50000. @@ -302,7 +302,7 @@ 0 0.85 0.95 - 25000. + 15000. 50000. @@ -311,7 +311,7 @@ 0 0.85 0.95 - 25000. + 15000. 50000. @@ -320,7 +320,7 @@ 0 0.85 0.95 - 25000. + 15000. 50000. @@ -332,7 +332,7 @@ 0 0.85 0.95 - 20000. + 15000. 50000. @@ -341,7 +341,7 @@ 0 0.85 0.95 - 20000. + 15000. 50000. @@ -350,7 +350,7 @@ 0 0.85 0.95 - 20000. + 15000. 50000. @@ -360,7 +360,7 @@ 0 0.85 0.95 - 25000. + 15000. 50000. @@ -369,7 +369,7 @@ 0 0.85 0.95 - 25000. + 15000. 50000. @@ -378,7 +378,7 @@ 0 0.85 0.95 - 25000. + 15000. 50000. diff --git a/DQM/SiPixelPhase1Config/test/qTests/mean_size_qualitytest_config.xml b/DQM/SiPixelPhase1Config/test/qTests/mean_size_qualitytest_config.xml index a399b87d88a94..9b89bc34c379e 100644 --- a/DQM/SiPixelPhase1Config/test/qTests/mean_size_qualitytest_config.xml +++ b/DQM/SiPixelPhase1Config/test/qTests/mean_size_qualitytest_config.xml @@ -9,7 +9,7 @@ 0.65 0.80 1.5 - 6. + 7. @@ -18,7 +18,7 @@ 0.65 0.80 1.5 - 6. + 7. @@ -27,7 +27,7 @@ 0.65 0.80 1.5 - 6. + 7. @@ -36,7 +36,7 @@ 0.65 0.80 1.5 - 6. + 7. diff --git a/DataFormats/TrackingRecHitSoA/interface/alpaka/TrackingRecHitsSoACollection.h b/DataFormats/TrackingRecHitSoA/interface/alpaka/TrackingRecHitsSoACollection.h index da3c3bef3928d..3374863ea1327 100644 --- a/DataFormats/TrackingRecHitSoA/interface/alpaka/TrackingRecHitsSoACollection.h +++ b/DataFormats/TrackingRecHitSoA/interface/alpaka/TrackingRecHitsSoACollection.h @@ -34,6 +34,16 @@ namespace cms::alpakatools { template static auto copyAsync(TQueue& queue, TrackingRecHitDevice const& deviceData) { TrackingRecHitHost hostData(queue, deviceData.view().metadata().size()); + + // Don't bother if zero hits + if (deviceData.view().metadata().size() == 0) { + std::memset(hostData.buffer().data(), + 0, + alpaka::getExtentProduct(hostData.buffer()) * + sizeof(alpaka::Elem::Buffer>)); + return hostData; + } + alpaka::memcpy(queue, hostData.buffer(), deviceData.buffer()); #ifdef GPU_DEBUG printf("TrackingRecHitsSoACollection: I'm copying to host.\n"); diff --git a/L1Trigger/L1TCaloLayer1/plugins/L1TCaloSummary.cc b/L1Trigger/L1TCaloLayer1/plugins/L1TCaloSummary.cc index 324a6f99a362a..b5a72290406dd 100644 --- a/L1Trigger/L1TCaloLayer1/plugins/L1TCaloSummary.cc +++ b/L1Trigger/L1TCaloLayer1/plugins/L1TCaloSummary.cc @@ -107,6 +107,7 @@ class L1TCaloSummary : public edm::stream::EDProducer<> { int fwVersion; edm::EDGetTokenT regionToken; + edm::EDGetTokenT backupRegionToken; UCTLayer1* layer1; @@ -141,7 +142,8 @@ L1TCaloSummary::L1TCaloSummary(const edm::ParameterSet& iConfig) boostedJetPtFactor(iConfig.getParameter("boostedJetPtFactor")), verbose(iConfig.getParameter("verbose")), fwVersion(iConfig.getParameter("firmwareVersion")), - regionToken(consumes(edm::InputTag("simCaloStage2Layer1Digis"))), + regionToken(consumes(iConfig.getParameter("caloLayer1Regions"))), + backupRegionToken(consumes(edm::InputTag("simCaloStage2Layer1Digis"))), loader(hls4mlEmulator::ModelLoader(iConfig.getParameter("CICADAModelVersion"))), overwriteWithTestPatterns(iConfig.getParameter("useTestPatterns")), testPatterns(iConfig.getParameter>("testPatterns")) { @@ -198,6 +200,12 @@ void L1TCaloSummary::produce(edm::Event& iEvent, const edm::Event if (!iEvent.getByToken(regionToken, regionCollection)) edm::LogError("L1TCaloSummary") << "UCT: Failed to get regions from region collection!"; iEvent.getByToken(regionToken, regionCollection); + + if (regionCollection->size() == 0) { + iEvent.getByToken(backupRegionToken, regionCollection); + edm::LogWarning("L1TCaloSummary") << "Switched to emulated regions since data regions was empty.\n"; + } + //Model input //This is done as a flat vector input, but future versions may involve 2D input //This will have to be handled later diff --git a/L1Trigger/L1TCaloLayer1/python/simCaloStage2Layer1Summary_cfi.py b/L1Trigger/L1TCaloLayer1/python/simCaloStage2Layer1Summary_cfi.py index 6ee4753fc5d73..b1a6617bac5be 100644 --- a/L1Trigger/L1TCaloLayer1/python/simCaloStage2Layer1Summary_cfi.py +++ b/L1Trigger/L1TCaloLayer1/python/simCaloStage2Layer1Summary_cfi.py @@ -52,5 +52,6 @@ firmwareVersion = cms.int32(1), CICADAModelVersion = cms.string("CICADAModel_v2p1p2"), useTestPatterns = cms.bool(False), - testPatterns = standardCICADATestPatterns + testPatterns = standardCICADATestPatterns, + caloLayer1Regions = cms.InputTag("simCaloStage2Layer1Digis", "") ) diff --git a/L1Trigger/L1TMuonBarrel/python/simKBmtfDigis_cfi.py b/L1Trigger/L1TMuonBarrel/python/simKBmtfDigis_cfi.py index 42d79cefae658..85d543aa26ff4 100644 --- a/L1Trigger/L1TMuonBarrel/python/simKBmtfDigis_cfi.py +++ b/L1Trigger/L1TMuonBarrel/python/simKBmtfDigis_cfi.py @@ -1,5 +1,5 @@ import FWCore.ParameterSet.Config as cms -from Configuration.Eras.Modifier_run3_2024_L1T_cff import run3_2024_L1T +from Configuration.Eras.Modifier_stage2L1Trigger_2024_cff import stage2L1Trigger_2024 bmtfKalmanTrackingSettings = cms.PSet( verbose = cms.bool(False), # @@ -51,12 +51,12 @@ useNewQualityCalculation = cms.bool(False), ) -run3_2024_L1T.toModify( + +stage2L1Trigger_2024.toModify( bmtfKalmanTrackingSettings, - useNewQualityCalculation = cms.bool(True), + useNewQualityCalculation = True, ) - simKBmtfDigis = cms.EDProducer("L1TMuonBarrelKalmanTrackProducer", src = cms.InputTag("simKBmtfStubs"), bx = cms.vint32(-2,-1,0,1,2), diff --git a/PhysicsTools/PatAlgos/plugins/PATTauHybridProducer.cc b/PhysicsTools/PatAlgos/plugins/PATTauHybridProducer.cc index b23824ed88310..1ad51db3bfdcd 100644 --- a/PhysicsTools/PatAlgos/plugins/PATTauHybridProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATTauHybridProducer.cc @@ -75,11 +75,11 @@ PATTauHybridProducer::PATTauHybridProducer(const edm::ParameterSet& cfg) utagJetScoreNames_.push_back(name); if (UtagPtCorrName_.find(':') != std::string::npos) UtagPtCorrName_ = UtagPtCorrName_.substr(UtagPtCorrName_.find(':') + 1); - // GenJet matching - if (addGenJetMatch_) { - genJetMatchToken_ = - consumes>(cfg.getParameter("genJetMatch")); - } + } + // GenJet matching + if (addGenJetMatch_) { + genJetMatchToken_ = + consumes>(cfg.getParameter("genJetMatch")); } produces>(); diff --git a/RecoBTag/FeatureTools/plugins/UnifiedParticleTransformerAK4TagInfoProducer.cc b/RecoBTag/FeatureTools/plugins/UnifiedParticleTransformerAK4TagInfoProducer.cc index 349da4f98f797..f9ba49ed31205 100644 --- a/RecoBTag/FeatureTools/plugins/UnifiedParticleTransformerAK4TagInfoProducer.cc +++ b/RecoBTag/FeatureTools/plugins/UnifiedParticleTransformerAK4TagInfoProducer.cc @@ -79,6 +79,8 @@ class UnifiedParticleTransformerAK4TagInfoProducer : public edm::stream::EDProdu const double jet_radius_; const double min_candidate_pt_; const bool flip_; + const bool sort_cand_by_pt_; + const bool fix_lt_sorting_; const edm::EDGetTokenT> jet_token_; const edm::EDGetTokenT vtx_token_; @@ -108,6 +110,8 @@ UnifiedParticleTransformerAK4TagInfoProducer::UnifiedParticleTransformerAK4TagIn : jet_radius_(iConfig.getParameter("jet_radius")), min_candidate_pt_(iConfig.getParameter("min_candidate_pt")), flip_(iConfig.getParameter("flip")), + sort_cand_by_pt_(iConfig.getParameter("sort_cand_by_pt")), + fix_lt_sorting_(iConfig.getParameter("fix_lt_sorting")), jet_token_(consumes>(iConfig.getParameter("jets"))), vtx_token_(consumes(iConfig.getParameter("vertices"))), lt_token_(consumes>(iConfig.getParameter("losttracks"))), @@ -154,6 +158,8 @@ void UnifiedParticleTransformerAK4TagInfoProducer::fillDescriptions(edm::Configu desc.add("jet_radius", 0.4); desc.add("min_candidate_pt", 0.10); desc.add("flip", false); + desc.add("sort_cand_by_pt", false); + desc.add("fix_lt_sorting", false); desc.add("vertices", edm::InputTag("offlinePrimaryVertices")); desc.add("losttracks", edm::InputTag("lostTracks")); desc.add("puppi_value_map", edm::InputTag("puppi")); @@ -275,10 +281,16 @@ void UnifiedParticleTransformerAK4TagInfoProducer::produce(edm::Event& iEvent, c auto& trackinfo = lt_trackinfos.emplace(i, track_builder).first->second; trackinfo.buildTrackInfo(PackedCandidate_, jet_dir, jet_ref_track_dir, pv); - lt_sorted.emplace_back(i, - trackinfo.getTrackSip2dSig(), - -btagbtvdeep::mindrsvpfcand(svs_unsorted, PackedCandidate_), - PackedCandidate_->pt() / jet.pt()); + if (sort_cand_by_pt_) + lt_sorted.emplace_back(i, + PackedCandidate_->pt() / jet.pt(), + trackinfo.getTrackSip2dSig(), + -btagbtvdeep::mindrsvpfcand(svs_unsorted, PackedCandidate_)); + else + lt_sorted.emplace_back(i, + trackinfo.getTrackSip2dSig(), + -btagbtvdeep::mindrsvpfcand(svs_unsorted, PackedCandidate_), + PackedCandidate_->pt() / jet.pt()); ltPtrs.push_back(cand); } @@ -312,7 +324,7 @@ void UnifiedParticleTransformerAK4TagInfoProducer::produce(edm::Event& iEvent, c float drminpfcandsv = btagbtvdeep::mindrsvpfcand(svs_unsorted, PackedCandidate_); float distminpfcandsv = 0; - size_t entry = lt_sortedindices.at(i); + size_t entry = lt_sortedindices.at(fix_lt_sorting_ ? lt_sorted[i].get() : i); // get cached track info auto& trackinfo = lt_trackinfos.emplace(i, track_builder).first->second; trackinfo.buildTrackInfo(PackedCandidate_, jet_dir, jet_ref_track_dir, pv); @@ -353,12 +365,21 @@ void UnifiedParticleTransformerAK4TagInfoProducer::produce(edm::Event& iEvent, c auto& trackinfo = trackinfos.emplace(i, track_builder).first->second; trackinfo.buildTrackInfo(cand, jet_dir, jet_ref_track_dir, pv); - c_sorted.emplace_back(i, - trackinfo.getTrackSip2dSig(), - -btagbtvdeep::mindrsvpfcand(svs_unsorted, cand), - cand->pt() / jet.pt()); + if (sort_cand_by_pt_) + c_sorted.emplace_back(i, + cand->pt() / jet.pt(), + trackinfo.getTrackSip2dSig(), + -btagbtvdeep::mindrsvpfcand(svs_unsorted, cand)); + else + c_sorted.emplace_back(i, + trackinfo.getTrackSip2dSig(), + -btagbtvdeep::mindrsvpfcand(svs_unsorted, cand), + cand->pt() / jet.pt()); } else { - n_sorted.emplace_back(i, -1, -btagbtvdeep::mindrsvpfcand(svs_unsorted, cand), cand->pt() / jet.pt()); + if (sort_cand_by_pt_) + n_sorted.emplace_back(i, cand->pt() / jet.pt(), -btagbtvdeep::mindrsvpfcand(svs_unsorted, cand), -1); + else + n_sorted.emplace_back(i, -1, -btagbtvdeep::mindrsvpfcand(svs_unsorted, cand), cand->pt() / jet.pt()); } } } diff --git a/RecoMuon/GlobalTrackingTools/plugins/MuonBeamspotConstraintValueMapProducer.cc b/RecoMuon/GlobalTrackingTools/plugins/MuonBeamspotConstraintValueMapProducer.cc index 74459f475cb0c..f7983cc516938 100644 --- a/RecoMuon/GlobalTrackingTools/plugins/MuonBeamspotConstraintValueMapProducer.cc +++ b/RecoMuon/GlobalTrackingTools/plugins/MuonBeamspotConstraintValueMapProducer.cc @@ -66,14 +66,19 @@ class MuonBeamspotConstraintValueMapProducer : public edm::global::EDProducer<> // SingleTrackVertexConstraint uses the width for the constraint, // not the error) if ((BeamWidthXError / BeamWidthX < 0.3) && (BeamWidthYError / BeamWidthY < 0.3)) { - SingleTrackVertexConstraint::BTFtuple btft = - stvc.constrain(ttkb->build(muon.muonBestTrack()), *beamSpotHandle); - if (std::get<0>(btft)) { - const reco::Track& trkBS = std::get<1>(btft).track(); - pts.push_back(trkBS.pt()); - ptErrs.push_back(trkBS.ptError()); - chi2s.push_back(std::get<2>(btft)); - tbd = false; + try { + SingleTrackVertexConstraint::BTFtuple btft = + stvc.constrain(ttkb->build(muon.muonBestTrack()), *beamSpotHandle); + + if (std::get<0>(btft)) { + const reco::Track& trkBS = std::get<1>(btft).track(); + pts.push_back(trkBS.pt()); + ptErrs.push_back(trkBS.ptError()); + chi2s.push_back(std::get<2>(btft)); + tbd = false; + } + } catch (const VertexException& exc) { + // Update failed; give up. } } } diff --git a/RecoTracker/PixelSeeding/plugins/alpaka/CAHitNtupletGenerator.cc b/RecoTracker/PixelSeeding/plugins/alpaka/CAHitNtupletGenerator.cc index c6615c08d73bf..a9abc99425a2e 100644 --- a/RecoTracker/PixelSeeding/plugins/alpaka/CAHitNtupletGenerator.cc +++ b/RecoTracker/PixelSeeding/plugins/alpaka/CAHitNtupletGenerator.cc @@ -299,6 +299,13 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { TrackSoA tracks(queue); + // Don't bother if less than 2 this + if (hits_d.view().metadata().size() < 2) { + const auto device = alpaka::getDev(queue); + auto ntracks_d = cms::alpakatools::make_device_view(device, tracks.view().nTracks()); + alpaka::memset(queue, ntracks_d, 0); + return tracks; + } GPUKernels kernels(m_params, hits_d.view().metadata().size(), hits_d.offsetBPIX2(), queue); kernels.buildDoublets(hits_d.view(), hits_d.offsetBPIX2(), queue); diff --git a/Validation/MuonRPCDigis/interface/RPCDigiValid.h b/Validation/MuonRPCDigis/interface/RPCDigiValid.h index b7896a53b6c4c..2d3b32a0ef169 100644 --- a/Validation/MuonRPCDigis/interface/RPCDigiValid.h +++ b/Validation/MuonRPCDigis/interface/RPCDigiValid.h @@ -45,6 +45,7 @@ class RPCDigiValid : public DQMEDAnalyzer { MonitorElement *hBxDisc_4Min_; // Timing information + bool isDigiTimeAvailable_; MonitorElement *hDigiTimeAll_, *hDigiTime_, *hDigiTimeIRPC_, *hDigiTimeNoIRPC_; // Multiplicity plots diff --git a/Validation/MuonRPCDigis/python/validationMuonRPCDigis_cfi.py b/Validation/MuonRPCDigis/python/validationMuonRPCDigis_cfi.py index e04d953a5e736..bb5be6e10d096 100644 --- a/Validation/MuonRPCDigis/python/validationMuonRPCDigis_cfi.py +++ b/Validation/MuonRPCDigis/python/validationMuonRPCDigis_cfi.py @@ -8,9 +8,12 @@ # Tag for simulated hits event data retrieval simHitTag = cms.untracked.InputTag("g4SimHits", "MuonRPCHits"), - # Name of the root file which will contain the histos - outputFile = cms.untracked.string('') + # Flag to turn on/off timing plots + digiTime = cms.untracked.bool(False) ) from Configuration.Eras.Modifier_fastSim_cff import fastSim fastSim.toModify(validationMuonRPCDigis, simHitTag = "MuonSimHits:MuonRPCHits") + +from Configuration.Eras.Modifier_phase2_common_cff import phase2_common +phase2_common.toModify(validationMuonRPCDigis, digiTime = True) diff --git a/Validation/MuonRPCDigis/src/RPCDigiValid.cc b/Validation/MuonRPCDigis/src/RPCDigiValid.cc index 6ae4f5921d34f..e6e69d65d4e38 100644 --- a/Validation/MuonRPCDigis/src/RPCDigiValid.cc +++ b/Validation/MuonRPCDigis/src/RPCDigiValid.cc @@ -26,6 +26,8 @@ RPCDigiValid::RPCDigiValid(const ParameterSet &ps) { rpcDigiToken_ = consumes( ps.getUntrackedParameter("rpcDigiTag", edm::InputTag("simMuonRPCDigis"))); + isDigiTimeAvailable_ = ps.getUntrackedParameter("digiTime", false); + rpcGeomToken_ = esConsumes(); } @@ -122,14 +124,16 @@ void RPCDigiValid::analyze(const Event &event, const EventSetup &eventSetup) { } // Fill timing information - const double digiTime = digiIt->hasTime() ? digiIt->time() : digiIt->bx() * 25; - hDigiTimeAll_->Fill(digiTime); - if (digiIt->hasTime()) { - hDigiTime_->Fill(digiTime); - if (roll->isIRPC()) - hDigiTimeIRPC_->Fill(digiTime); - else - hDigiTimeNoIRPC_->Fill(digiTime); + if (isDigiTimeAvailable_) { + const double digiTime = digiIt->hasTime() ? digiIt->time() : digiIt->bx() * 25; + hDigiTimeAll_->Fill(digiTime); + if (digiIt->hasTime()) { + hDigiTime_->Fill(digiTime); + if (roll->isIRPC()) + hDigiTimeIRPC_->Fill(digiTime); + else + hDigiTimeNoIRPC_->Fill(digiTime); + } } // Keep digi position @@ -201,9 +205,11 @@ void RPCDigiValid::bookHistograms(DQMStore::IBooker &booker, edm::Run const &run // RZ plot hRZ_ = booker.book2D("RZ", "R-Z view;Z (cm);R (cm)", nbinsZ, -maxZ, maxZ, nbinsR, minR, maxR); + hRZ_->setOption("colz"); // XY plots hXY_Barrel_ = booker.book2D("XY_Barrel", "X-Y view of Barrel", nbinsXY, -maxXY, maxXY, nbinsXY, -maxXY, maxXY); + hXY_Barrel_->setOption("colz"); for (int disk = 1; disk <= 4; ++disk) { const std::string meNameP = fmt::format("XY_Endcap_p{:1d}", disk); const std::string meNameN = fmt::format("XY_Endcap_m{:1d}", disk); @@ -211,6 +217,8 @@ void RPCDigiValid::bookHistograms(DQMStore::IBooker &booker, edm::Run const &run const std::string meTitleN = fmt::format("X-Y view of Endcap{:+1d};X (cm);Y (cm)", -disk); hXY_Endcap_[disk] = booker.book2D(meNameP, meTitleP, nbinsXY, -maxXY, maxXY, nbinsXY, -maxXY, maxXY); hXY_Endcap_[-disk] = booker.book2D(meNameN, meTitleN, nbinsXY, -maxXY, maxXY, nbinsXY, -maxXY, maxXY); + hXY_Endcap_[disk]->setOption("colz"); + hXY_Endcap_[-disk]->setOption("colz"); } // Z-phi plots @@ -218,6 +226,7 @@ void RPCDigiValid::bookHistograms(DQMStore::IBooker &booker, edm::Run const &run const std::string meName = fmt::format("ZPhi_Layer{:1d}", layer); const std::string meTitle = fmt::format("Z-#phi view of Layer{:1d};Z (cm);#phi (degree)", layer); hZPhi_[layer] = booker.book2D(meName, meTitle, nbinsBarrelZ, -maxBarrelZ, maxBarrelZ, nbinsPhi, -180, 180); + hZPhi_[layer]->setOption("colz"); } // Strip profile @@ -233,11 +242,13 @@ void RPCDigiValid::bookHistograms(DQMStore::IBooker &booker, edm::Run const &run hBxDisc_4Min_ = booker.book1D("BxDisc_4Min", "BxDisc_4Min", 20, -10., 10.); // Timing informations - hDigiTimeAll_ = - booker.book1D("DigiTimeAll", "Digi time including present electronics;Digi time (ns)", 100, -12.5, 12.5); - hDigiTime_ = booker.book1D("DigiTime", "Digi time only with timing information;Digi time (ns)", 100, -12.5, 12.5); - hDigiTimeIRPC_ = booker.book1D("DigiTimeIRPC", "IRPC Digi time;Digi time (ns)", 100, -12.5, 12.5); - hDigiTimeNoIRPC_ = booker.book1D("DigiTimeNoIRPC", "non-IRPC Digi time;Digi time (ns)", 100, -12.5, 12.5); + if (isDigiTimeAvailable_) { + hDigiTimeAll_ = + booker.book1D("DigiTimeAll", "Digi time including present electronics;Digi time (ns)", 100, -12.5, 12.5); + hDigiTime_ = booker.book1D("DigiTime", "Digi time only with timing information;Digi time (ns)", 100, -12.5, 12.5); + hDigiTimeIRPC_ = booker.book1D("DigiTimeIRPC", "IRPC Digi time;Digi time (ns)", 100, -12.5, 12.5); + hDigiTimeNoIRPC_ = booker.book1D("DigiTimeNoIRPC", "non-IRPC Digi time;Digi time (ns)", 100, -12.5, 12.5); + } // SimHit and Digi multiplicity per roll hNSimHitPerRoll_ = booker.book1D("NSimHitPerRoll", "SimHit multiplicity per Roll;Multiplicity", 10, 0, 10); @@ -267,9 +278,7 @@ void RPCDigiValid::bookHistograms(DQMStore::IBooker &booker, edm::Run const &run hResEndcapDisks_[-disk] = booker.book1D(meNameN, meTitleN, 100, -8, 8); } - for (int ring = 1; ring <= 3; ++ring) { - const std::string meName = fmt::format("Residual_Endcap_Ring{:1d}", ring); - const std::string meTitle = fmt::format("Residual of Endcap Ring{:1d};dx (cm)", ring); - hResEndcapRings_[ring] = booker.book1D(meName, meTitle, 100, -8, 8); - } + hResEndcapRings_[1] = booker.book1D("Residual_Endcap_Ring1", "Residual of Endcap Ring1;dx (cm)", 100, -12, 12); + hResEndcapRings_[2] = booker.book1D("Residual_Endcap_Ring2", "Residual of Endcap Ring2;dx (cm)", 100, -8, 8); + hResEndcapRings_[3] = booker.book1D("Residual_Endcap_Ring3", "Residual of Endcap Ring3;dx (cm)", 100, -8, 8); } diff --git a/Validation/RPCRecHits/interface/RPCRecHitValid.h b/Validation/RPCRecHits/interface/RPCRecHitValid.h index 8626702e705c1..dda68eac540a9 100644 --- a/Validation/RPCRecHits/interface/RPCRecHitValid.h +++ b/Validation/RPCRecHits/interface/RPCRecHitValid.h @@ -62,17 +62,12 @@ class RPCRecHitValid : public DQMEDAnalyzer { MEP h_recoMuonBarrel_phi, h_recoMuonOverlap_phi, h_recoMuonEndcap_phi, h_recoMuonNoRPC_phi; MEP h_simParticleType, h_simParticleTypeBarrel, h_simParticleTypeEndcap; - MEP h_refPunchOccupancyBarrel_wheel, h_refPunchOccupancyEndcap_disk, h_refPunchOccupancyBarrel_station; - MEP h_refPunchOccupancyBarrel_wheel_station, h_refPunchOccupancyEndcap_disk_ring; - MEP h_recPunchOccupancyBarrel_wheel, h_recPunchOccupancyEndcap_disk, h_recPunchOccupancyBarrel_station; - MEP h_recPunchOccupancyBarrel_wheel_station, h_recPunchOccupancyEndcap_disk_ring; - MEP h_matchOccupancyBarrel_detId; MEP h_matchOccupancyEndcap_detId; MEP h_refOccupancyBarrel_detId; MEP h_refOccupancyEndcap_detId; - MEP h_noiseOccupancyBarrel_detId; - MEP h_noiseOccupancyEndcap_detId; + MEP h_allOccupancyBarrel_detId; + MEP h_allOccupancyEndcap_detId; MEP h_rollAreaBarrel_detId; MEP h_rollAreaEndcap_detId; diff --git a/Validation/RPCRecHits/src/RPCRecHitValid.cc b/Validation/RPCRecHits/src/RPCRecHitValid.cc index ee74e775dcbab..a82bd2c38ed08 100644 --- a/Validation/RPCRecHits/src/RPCRecHitValid.cc +++ b/Validation/RPCRecHits/src/RPCRecHitValid.cc @@ -1,4 +1,3 @@ -#include "FWCore/Framework/interface/MakerMacros.h" #include "Validation/RPCRecHits/interface/RPCRecHitValid.h" #include "FWCore/Framework/interface/ESHandle.h" @@ -166,85 +165,6 @@ void RPCRecHitValid::bookHistograms(DQMStore::IBooker &booker, edm::Run const &r } h_eventCount->Fill(3); - h_refPunchOccupancyBarrel_wheel = - booker.book1D("RefPunchOccupancyBarrel_wheel", "RefPunchthrough occupancy", 5, -2.5, 2.5); - h_refPunchOccupancyEndcap_disk = - booker.book1D("RefPunchOccupancyEndcap_disk", "RefPunchthrough occupancy", 9, -4.5, 4.5); - h_refPunchOccupancyBarrel_station = - booker.book1D("RefPunchOccupancyBarrel_station", "RefPunchthrough occupancy", 4, 0.5, 4.5); - h_recPunchOccupancyBarrel_wheel = - booker.book1D("RecPunchOccupancyBarrel_wheel", "Punchthrough recHit occupancy", 5, -2.5, 2.5); - h_recPunchOccupancyEndcap_disk = - booker.book1D("RecPunchOccupancyEndcap_disk", "Punchthrough recHit occupancy", 9, -4.5, 4.5); - h_recPunchOccupancyBarrel_station = - booker.book1D("RecPunchOccupancyBarrel_station", "Punchthrough recHit occupancy", 4, 0.5, 4.5); - - h_refPunchOccupancyBarrel_wheel->getTH1()->SetMinimum(0); - h_refPunchOccupancyEndcap_disk->getTH1()->SetMinimum(0); - h_refPunchOccupancyBarrel_station->getTH1()->SetMinimum(0); - h_recPunchOccupancyBarrel_wheel->getTH1()->SetMinimum(0); - h_recPunchOccupancyEndcap_disk->getTH1()->SetMinimum(0); - h_recPunchOccupancyBarrel_station->getTH1()->SetMinimum(0); - - h_refPunchOccupancyBarrel_wheel_station = - booker.book2D("RefPunchOccupancyBarrel_wheel_station", "RefPunchthrough occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5); - h_refPunchOccupancyEndcap_disk_ring = - booker.book2D("RefPunchOccupancyEndcap_disk_ring", "RefPunchthrough occupancy", 9, -4.5, 4.5, 4, 0.5, 4.5); - h_recPunchOccupancyBarrel_wheel_station = booker.book2D( - "RecPunchOccupancyBarrel_wheel_station", "Punchthrough recHit occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5); - h_recPunchOccupancyEndcap_disk_ring = - booker.book2D("RecPunchOccupancyEndcap_disk_ring", "Punchthrough recHit occupancy", 9, -4.5, 4.5, 4, 0.5, 4.5); - - h_refPunchOccupancyBarrel_wheel_station->getTH2F()->SetOption("COLZ"); - h_refPunchOccupancyEndcap_disk_ring->getTH2F()->SetOption("COLZ"); - h_recPunchOccupancyBarrel_wheel_station->getTH2F()->SetOption("COLZ"); - h_recPunchOccupancyEndcap_disk_ring->getTH2F()->SetOption("COLZ"); - - h_refPunchOccupancyBarrel_wheel_station->getTH2F()->SetContour(10); - h_refPunchOccupancyEndcap_disk_ring->getTH2F()->SetContour(10); - h_recPunchOccupancyBarrel_wheel_station->getTH2F()->SetContour(10); - h_recPunchOccupancyEndcap_disk_ring->getTH2F()->SetContour(10); - - h_refPunchOccupancyBarrel_wheel_station->getTH2F()->SetStats(false); - h_refPunchOccupancyEndcap_disk_ring->getTH2F()->SetStats(false); - h_recPunchOccupancyBarrel_wheel_station->getTH2F()->SetStats(false); - h_recPunchOccupancyEndcap_disk_ring->getTH2F()->SetStats(false); - - h_refPunchOccupancyBarrel_wheel_station->getTH2F()->SetMinimum(0); - h_refPunchOccupancyEndcap_disk_ring->getTH2F()->SetMinimum(0); - h_recPunchOccupancyBarrel_wheel_station->getTH2F()->SetMinimum(0); - h_recPunchOccupancyEndcap_disk_ring->getTH2F()->SetMinimum(0); - - for (int i = 1; i <= 5; ++i) { - TString binLabel = Form("Wheel %d", i - 3); - h_refPunchOccupancyBarrel_wheel->getTH1()->GetXaxis()->SetBinLabel(i, binLabel); - h_refPunchOccupancyBarrel_wheel_station->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel); - h_recPunchOccupancyBarrel_wheel->getTH1()->GetXaxis()->SetBinLabel(i, binLabel); - h_recPunchOccupancyBarrel_wheel_station->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel); - } - - for (int i = 1; i <= 9; ++i) { - TString binLabel = Form("Disk %d", i - 5); - h_refPunchOccupancyEndcap_disk->getTH1()->GetXaxis()->SetBinLabel(i, binLabel); - h_refPunchOccupancyEndcap_disk_ring->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel); - h_recPunchOccupancyEndcap_disk->getTH1()->GetXaxis()->SetBinLabel(i, binLabel); - h_recPunchOccupancyEndcap_disk_ring->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel); - } - - for (int i = 1; i <= 4; ++i) { - TString binLabel = Form("Station %d", i); - h_refPunchOccupancyBarrel_station->getTH1()->GetXaxis()->SetBinLabel(i, binLabel); - h_refPunchOccupancyBarrel_wheel_station->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel); - h_recPunchOccupancyBarrel_station->getTH1()->GetXaxis()->SetBinLabel(i, binLabel); - h_recPunchOccupancyBarrel_wheel_station->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel); - } - - for (int i = 1; i <= 4; ++i) { - TString binLabel = Form("Ring %d", i); - h_refPunchOccupancyEndcap_disk_ring->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel); - h_recPunchOccupancyEndcap_disk_ring->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel); - } - // Book roll-by-roll histograms auto rpcGeom = eventSetup.getHandle(rpcGeomTokenInRun_); @@ -299,17 +219,17 @@ void RPCRecHitValid::bookHistograms(DQMStore::IBooker &booker, edm::Run const &r nRPCRollEndcap, 0, nRPCRollEndcap); - h_noiseOccupancyBarrel_detId = booker.book1D( - "NoiseOccupancyBarrel_detId", "Noise occupancy;roll index (can be arbitrary)", nRPCRollBarrel, 0, nRPCRollBarrel); - h_noiseOccupancyEndcap_detId = booker.book1D( - "NoiseOccupancyEndcap_detId", "Noise occupancy;roll index (can be arbitrary)", nRPCRollEndcap, 0, nRPCRollEndcap); + h_allOccupancyBarrel_detId = booker.book1D( + "OccupancyBarrel_detId", "Occupancy;roll index (can be arbitrary)", nRPCRollBarrel, 0, nRPCRollBarrel); + h_allOccupancyEndcap_detId = booker.book1D( + "OccupancyEndcap_detId", "Occupancy;roll index (can be arbitrary)", nRPCRollEndcap, 0, nRPCRollEndcap); h_matchOccupancyBarrel_detId->getTH1()->SetMinimum(0); h_matchOccupancyEndcap_detId->getTH1()->SetMinimum(0); h_refOccupancyBarrel_detId->getTH1()->SetMinimum(0); h_refOccupancyEndcap_detId->getTH1()->SetMinimum(0); - h_noiseOccupancyBarrel_detId->getTH1()->SetMinimum(0); - h_noiseOccupancyEndcap_detId->getTH1()->SetMinimum(0); + h_allOccupancyBarrel_detId->getTH1()->SetMinimum(0); + h_allOccupancyEndcap_detId->getTH1()->SetMinimum(0); h_rollAreaBarrel_detId = booker.bookProfile( "RollAreaBarrel_detId", "Roll area;roll index;Area", nRPCRollBarrel, 0., 1. * nRPCRollBarrel, 0., 1e5); @@ -461,8 +381,6 @@ void RPCRecHitValid::analyze(const edm::Event &event, const edm::EventSetup &eve h_simMuonNoRPC_eta->Fill(simParticle->eta()); h_simMuonNoRPC_phi->Fill(simParticle->phi()); } - } else { - pthrSimHits.insert(pthrSimHits.end(), simHitsFromParticle.begin(), simHitsFromParticle.end()); } if (hasRPCHit) { @@ -533,34 +451,6 @@ void RPCRecHitValid::analyze(const edm::Event &event, const edm::EventSetup &eve } } - // Loop over punch-through simHits, fill histograms which does not need - // associations - for (const auto &simHit : pthrSimHits) { - const RPCDetId detId = static_cast(simHit->detUnitId()); - const RPCRoll *roll = dynamic_cast(rpcGeom->roll(detId())); - - const int region = roll->id().region(); - const int ring = roll->id().ring(); - // const int sector = roll->id().sector(); - const int station = roll->id().station(); - // const int layer = roll->id().layer(); - // const int subSector = roll->id().subsector(); - - if (region == 0) { - ++nRefHitBarrel; - h_refPunchOccupancyBarrel_wheel->Fill(ring); - h_refPunchOccupancyBarrel_station->Fill(station); - h_refPunchOccupancyBarrel_wheel_station->Fill(ring, station); - - h_refOccupancyBarrel_detId->Fill(detIdToIndexMapBarrel_[simHit->detUnitId()]); - } else { - ++nRefHitEndcap; - h_refPunchOccupancyEndcap_disk->Fill(region * station); - h_refPunchOccupancyEndcap_disk_ring->Fill(region * station, ring); - - h_refOccupancyEndcap_detId->Fill(detIdToIndexMapEndcap_[simHit->detUnitId()]); - } - } h_.nRefHitBarrel->Fill(nRefHitBarrel); h_.nRefHitEndcap->Fill(nRefHitEndcap); @@ -592,6 +482,8 @@ void RPCRecHitValid::analyze(const edm::Event &event, const edm::EventSetup &eve h_.recHitOccupancyBarrel_station->Fill(station); h_.recHitOccupancyBarrel_wheel_station->Fill(ring, station); + h_allOccupancyBarrel_detId->Fill(detIdToIndexMapBarrel_[detId.rawId()]); + h_.timeBarrel->Fill(time); } else { ++nRecHitEndcap; @@ -600,6 +492,8 @@ void RPCRecHitValid::analyze(const edm::Event &event, const edm::EventSetup &eve h_.recHitOccupancyEndcap_disk->Fill(region * station); h_.recHitOccupancyEndcap_disk_ring->Fill(region * station, ring); + h_allOccupancyEndcap_detId->Fill(detIdToIndexMapEndcap_[detId.rawId()]); + h_.timeEndcap->Fill(time); } @@ -766,96 +660,8 @@ void RPCRecHitValid::analyze(const edm::Event &event, const edm::EventSetup &eve } } - // Find Non-muon hits - for (RecHitIter recHitIter = recHitHandle->begin(); recHitIter != recHitHandle->end(); ++recHitIter) { - const RPCDetId detId = static_cast(recHitIter->rpcId()); - const RPCRoll *roll = dynamic_cast(rpcGeom->roll(detId)); - - const int region = roll->id().region(); - const int ring = roll->id().ring(); - // const int sector = roll->id().sector(); - const int station = roll->id().station(); - // const int layer = roll->id().layer(); - // const int subsector = roll->id().subsector(); - - bool matched = false; - for (const auto &match : simToRecHitMap) { - if (recHitIter == match.second) { - matched = true; - break; - } - } - - if (!matched) { - int nPunchMatched = 0; - // Check if this recHit came from non-muon simHit - for (const auto &simHit : pthrSimHits) { - const int absSimHitPType = abs(simHit->particleType()); - if (absSimHitPType == 13) - continue; - - const RPCDetId simDetId = static_cast(simHit->detUnitId()); - if (simDetId == detId) - ++nPunchMatched; - } - - if (nPunchMatched > 0) { - if (region == 0) { - h_recPunchOccupancyBarrel_wheel->Fill(ring); - h_recPunchOccupancyBarrel_station->Fill(station); - h_recPunchOccupancyBarrel_wheel_station->Fill(ring, station); - } else { - h_recPunchOccupancyEndcap_disk->Fill(region * station); - h_recPunchOccupancyEndcap_disk_ring->Fill(region * station, ring); - } - } - } - } - - // Find noise recHits : RecHits without SimHit match - for (RecHitIter recHitIter = recHitHandle->begin(); recHitIter != recHitHandle->end(); ++recHitIter) { - const RPCDetId recDetId = static_cast(recHitIter->rpcId()); - const RPCRoll *roll = dynamic_cast(rpcGeom->roll(recDetId)); - - const int region = roll->id().region(); - // const int ring = roll->id().ring(); // UNUSED VARIABLE - // const int sector = roll->id().sector(); - // const int station = roll->id().station(); // UNUSED VARIABLE - // const int layer = roll->id().layer(); - // const int subsector = roll->id().subsector(); - - const double recX = recHitIter->localPosition().x(); - const double recErrX = sqrt(recHitIter->localPositionError().xx()); - - bool matched = false; - for (SimHitIter simHitIter = simHitHandle->begin(); simHitIter != simHitHandle->end(); ++simHitIter) { - const RPCDetId simDetId = static_cast(simHitIter->detUnitId()); - const RPCRoll *simRoll = dynamic_cast(rpcGeom->roll(simDetId)); - if (!simRoll) - continue; - - if (simDetId != recDetId) - continue; - - const double simX = simHitIter->localPosition().x(); - const double dX = fabs(recX - simX); - - if (dX / recErrX < 5) { - matched = true; - break; - } - } - - if (!matched) { - if (region == 0) { - h_noiseOccupancyBarrel_detId->Fill(detIdToIndexMapBarrel_[recDetId.rawId()]); - } else { - h_noiseOccupancyEndcap_detId->Fill(detIdToIndexMapEndcap_[recDetId.rawId()]); - } - } - } - h_eventCount->Fill(2); } +#include "FWCore/Framework/interface/MakerMacros.h" DEFINE_FWK_MODULE(RPCRecHitValid); diff --git a/Validation/RPCRecHits/src/RPCRecHitValidClient.cc b/Validation/RPCRecHits/src/RPCRecHitValidClient.cc index bd5d47d99822f..7c699f5ff3df2 100644 --- a/Validation/RPCRecHits/src/RPCRecHitValidClient.cc +++ b/Validation/RPCRecHits/src/RPCRecHitValidClient.cc @@ -19,18 +19,6 @@ void RPCRecHitValidClient::dqmEndJob(DQMStore::IBooker &booker, DQMStore::IGette booker.book1D("RollEfficiencyBarrel_eff", "Roll efficiency in Barrel;Efficiency [%]", 50 + 2, -2, 100 + 2); MEP me_rollEfficiencyEndcap_eff = booker.book1D("RollEfficiencyEndcap_eff", "Roll efficiency in Endcap;Efficiency [%]", 50 + 2, -2, 100 + 2); - MEP me_rollEfficiencyStatCutOffBarrel_eff = - booker.book1D("RollEfficiencyCutOffBarrel_eff", - "Roll efficiency in Barrel without low stat chamber;Efficiency [%]", - 50 + 2, - -2, - 100 + 2); - MEP me_rollEfficiencyStatCutOffEndcap_eff = - booker.book1D("RollEfficiencyCutOffEndcap_eff", - "Roll efficiency in Endcap without low stat chamber;Efficiency [%]", - 50 + 2, - -2, - 100 + 2); const double maxNoise = 1e-7; MEP me_rollNoiseBarrel_noise = booker.book1D("RollNoiseBarrel_noise", @@ -60,8 +48,6 @@ void RPCRecHitValidClient::dqmEndJob(DQMStore::IBooker &booker, DQMStore::IGette const double eff = nRef ? nRec / nRef * 100 : -1; me_rollEfficiencyBarrel_eff->Fill(eff); - if (nRef >= 20) - me_rollEfficiencyStatCutOffBarrel_eff->Fill(eff); } } @@ -76,17 +62,15 @@ void RPCRecHitValidClient::dqmEndJob(DQMStore::IBooker &booker, DQMStore::IGette const double eff = nRef ? nRec / nRef * 100 : -1; me_rollEfficiencyEndcap_eff->Fill(eff); - if (nRef >= 20) - me_rollEfficiencyStatCutOffEndcap_eff->Fill(eff); } } MEP me_eventCount = getter.get(subDir_ + "/Occupancy/EventCount"); const double nEvent = me_eventCount ? me_eventCount->getTH1()->GetBinContent(1) : 1; - MEP me_noiseOccupancyBarrel_detId = getter.get(subDir_ + "/Occupancy/NoiseOccupancyBarrel_detId"); + MEP me_allOccupancyBarrel_detId = getter.get(subDir_ + "/Occupancy/OccupancyBarrel_detId"); MEP me_rollAreaBarrel_detId = getter.get(subDir_ + "/Occupancy/RollAreaBarrel_detId"); - if (me_noiseOccupancyBarrel_detId and me_rollAreaBarrel_detId) { - TH1 *h_noiseOccupancyBarrel_detId = me_noiseOccupancyBarrel_detId->getTH1(); + if (me_allOccupancyBarrel_detId and me_rollAreaBarrel_detId) { + TH1 *h_noiseOccupancyBarrel_detId = me_allOccupancyBarrel_detId->getTH1(); TH1 *h_rollAreaBarrel_detId = me_rollAreaBarrel_detId->getTH1(); for (int bin = 1, nBin = h_noiseOccupancyBarrel_detId->GetNbinsX(); bin <= nBin; ++bin) { @@ -100,10 +84,10 @@ void RPCRecHitValidClient::dqmEndJob(DQMStore::IBooker &booker, DQMStore::IGette } } - MEP me_noiseOccupancyEndcap_detId = getter.get(subDir_ + "/Occupancy/NoiseOccupancyEndcap_detId"); + MEP me_allOccupancyEndcap_detId = getter.get(subDir_ + "/Occupancy/OccupancyEndcap_detId"); MEP me_rollAreaEndcap_detId = getter.get(subDir_ + "/Occupancy/RollAreaEndcap_detId"); - if (me_noiseOccupancyEndcap_detId and me_rollAreaEndcap_detId) { - TH1 *h_noiseOccupancyEndcap_detId = me_noiseOccupancyEndcap_detId->getTH1(); + if (me_allOccupancyEndcap_detId and me_rollAreaEndcap_detId) { + TH1 *h_noiseOccupancyEndcap_detId = me_allOccupancyEndcap_detId->getTH1(); TH1 *h_rollAreaEndcap_detId = me_rollAreaEndcap_detId->getTH1(); for (int bin = 1, nBin = h_noiseOccupancyEndcap_detId->GetNbinsX(); bin <= nBin; ++bin) {